Skip to main content
Home

@upyo/plunk@0.3.1
Built and signed on GitHub Actions

Plunk transport for Upyo email library

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (0.3.1)
class PlunkTransport
implements Transport

Plunk transport implementation for sending emails via Plunk API.

This transport provides efficient email delivery using Plunk's HTTP API, with support for both cloud-hosted and self-hosted instances, authentication, retry logic, and batch sending capabilities.

Examples

Example 1

import { PlunkTransport } from '@upyo/plunk';

const transport = new PlunkTransport({
  apiKey: 'your-plunk-api-key',
  baseUrl: 'https://api.useplunk.com', // or self-hosted URL
  timeout: 30000,
  retries: 3
});

const receipt = await transport.send(message);
if (receipt.successful) {
  console.log('Message sent with ID:', receipt.messageId);
} else {
  console.error('Send failed:', receipt.errorMessages.join(', '));
}

Constructors

new
PlunkTransport(config: PlunkConfig)

Creates a new Plunk transport instance.

Properties

The resolved Plunk configuration used by this transport.

private
httpClient: PlunkHttpClient

Methods

private
extractMessageId(
response: { emails?: readonly { contact?: { id?: string; }; }[]; timestamp?: string; },
message: Message,
): string

Extracts or generates a message ID from the Plunk response.

Plunk returns email details in the response, so we can use the contact ID and timestamp to create a meaningful message ID.

send(
message: Message,
options?: TransportOptions,
): Promise<Receipt>

Sends a single email message via Plunk API.

This method converts the message to Plunk format, makes an HTTP request to the Plunk API, and returns a receipt with the result.

sendMany(
messages: Iterable<Message> | AsyncIterable<Message>,
options?: TransportOptions,
): AsyncIterable<Receipt>

Sends multiple email messages efficiently via Plunk API.

This method sends each message individually but provides a streamlined interface for processing multiple messages. Each message is sent as a separate API request to Plunk.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@upyo/plunk

Import symbol

import { PlunkTransport } from "@upyo/plunk";
or

Import directly with a jsr specifier

import { PlunkTransport } from "jsr:@upyo/plunk";

Add Package

pnpm i jsr:@upyo/plunk
or (using pnpm 10.8 or older)
pnpm dlx jsr add @upyo/plunk

Import symbol

import { PlunkTransport } from "@upyo/plunk";

Add Package

yarn add jsr:@upyo/plunk
or (using Yarn 4.8 or older)
yarn dlx jsr add @upyo/plunk

Import symbol

import { PlunkTransport } from "@upyo/plunk";

Add Package

vlt install jsr:@upyo/plunk

Import symbol

import { PlunkTransport } from "@upyo/plunk";

Add Package

npx jsr add @upyo/plunk

Import symbol

import { PlunkTransport } from "@upyo/plunk";

Add Package

bunx jsr add @upyo/plunk

Import symbol

import { PlunkTransport } from "@upyo/plunk";