Lettermint transport for the Upyo email library.
- Single and batch email sending via Lettermint's HTTP API
- Idempotency key support through
Message.idempotencyKey - Cross-runtime compatibility (Node.js, Deno, Bun, edge functions)
- Rich content support: HTML emails, attachments, inline images, and custom headers
- Lettermint route, tag, metadata, and tracking settings
- Retry logic with exponential backoff
- Type-safe configuration with sensible defaults
npm add @upyo/core @upyo/lettermint
pnpm add @upyo/core @upyo/lettermint
yarn add @upyo/core @upyo/lettermint
deno add --jsr @upyo/core @upyo/lettermint
bun add @upyo/core @upyo/lettermintimport { createMessage } from "@upyo/core";
import { LettermintTransport } from "@upyo/lettermint";
import process from "node:process";
const message = createMessage({
from: "sender@example.com",
to: "recipient@example.net",
subject: "Hello from Upyo!",
content: { text: "This is a test email." },
idempotencyKey: "welcome-recipient-example-net",
});
const transport = new LettermintTransport({
apiToken: process.env.LETTERMINT_API_TOKEN!,
});
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(", "));
}const messages = [message1, message2, message3];
for await (const receipt of transport.sendMany(messages)) {
if (receipt.successful) {
console.log(`Email sent with ID: ${receipt.messageId}`);
} else {
console.error(`Email failed: ${receipt.errorMessages.join(", ")}`);
}
}See the Lettermint docs for more information about configuration options.
apiToken: Your Lettermint project sending API tokenbaseUrl: Lettermint API base URL (default:https://api.lettermint.co)timeout: Request timeout in milliseconds (default:30000)retries: Number of retry attempts (default:3)headers: Additional HTTP headersroute: Lettermint route for sent messagestag: Default Lettermint tag when a message has noMessage.tagsmetadata: Metadata to track with sent messagessettings: Lettermint tracking settings (trackOpens,trackClicks)