Skip to main content
Home

Built and signed on GitHub Actions

Works with
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 Score100%
Downloads1/wk
Published3 weeks ago (0.4.0)

Resend transport for Upyo email library

@upyo/resend

JSR npm

Resend transport for the Upyo email library.

Features

  • Single and batch email sending via Resend's HTTP API
  • Automatic idempotency for reliable delivery
  • Smart batch optimization: uses batch API when possible
  • Cross-runtime compatibility (Node.js, Deno, Bun, edge functions)
  • Rich content support: HTML emails, attachments, custom headers
  • Retry logic with exponential backoff
  • Type-safe configuration with sensible defaults
  • Comprehensive error handling

Installation

npm  add       @upyo/core @upyo/resend
pnpm add       @upyo/core @upyo/resend
yarn add       @upyo/core @upyo/resend
deno add --jsr @upyo/core @upyo/resend
bun  add       @upyo/core @upyo/resend

Usage

import { createMessage } from "@upyo/core";
import { ResendTransport } from "@upyo/resend";
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." },
});

const transport = new ResendTransport({
  apiKey: process.env.RESEND_API_KEY!,
});

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(", "));
}

Sending Multiple Emails

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(", ")}`);
  }
}

Configuration

See the Resend docs for more information about configuration options.

Available Options

  • apiKey: Your Resend API key
  • baseUrl: Resend API base URL (default: https://api.resend.com)
  • timeout: Request timeout in milliseconds (default: 30000)
  • retries: Number of retry attempts (default: 3)
  • validateSsl: Whether to validate SSL certificates (default: true)
  • headers: Additional HTTP headers
Built and signed on
GitHub Actions

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/resend

Import symbol

import * as resend from "@upyo/resend";
or

Import directly with a jsr specifier

import * as resend from "jsr:@upyo/resend";

Add Package

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

Import symbol

import * as resend from "@upyo/resend";

Add Package

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

Import symbol

import * as resend from "@upyo/resend";

Add Package

vlt install jsr:@upyo/resend

Import symbol

import * as resend from "@upyo/resend";

Add Package

npx jsr add @upyo/resend

Import symbol

import * as resend from "@upyo/resend";

Add Package

bunx jsr add @upyo/resend

Import symbol

import * as resend from "@upyo/resend";