Email SDK
Adapters

Resend

Configure the fetch-based Resend adapter.

The Resend adapter calls the Resend Email API directly. It does not add a runtime dependency.

Resend logo
Resend
@opencoredev/email-sdk/resend
OfficialNot API testedRequest tested
Open website

Before live sends

Create a Resend API key and verify the sender domain or sender address you plan to use in from. A dry run can validate the Email SDK message shape, but only a live send from your target environment proves the Resend account, sender, and recipient policy are ready.

Configure

import { createEmailClient } from "@opencoredev/email-sdk";
import { resend } from "@opencoredev/email-sdk/resend";

const email = createEmailClient({
  adapters: [resend({ apiKey: process.env.RESEND_API_KEY! })],
});

Send

const result = await email.send(
  {
    from: "Acme <hello@acme.com>",
    to: [{ email: "user@example.com", name: "Ada" }],
    cc: "billing@example.com",
    replyTo: "support@example.com",
    subject: "Welcome",
    html: "<p>Your workspace is ready.</p>",
    headers: {
      "X-Template": "welcome",
    },
    tags: [{ name: "type", value: "welcome" }],
    attachments: [
      {
        filename: "welcome.txt",
        content: "Welcome to Acme.",
        contentType: "text/plain",
      },
    ],
  },
  {
    idempotencyKey: "welcome:user_123",
  },
);

console.log(result.provider, result.messageId);

Resend supports attachments and tags, but it does not support Email SDK metadata. If metadata matters for routing or analytics, choose another fallback route.

Options

OptionTypeRequiredNotes
apiKeystringYesResend API key.
baseUrlstringNoDefaults to https://api.resend.com.
fetchtypeof fetchNoUseful for tests or custom runtimes.
headersRecord<string, string>NoExtra request headers.

Response

The adapter returns the Resend id as id and messageId.

CLI smoke test

RESEND_API_KEY="re_..." npx email-sdk send \
  --adapter resend \
  --from "Acme <hello@acme.com>" \
  --to user@example.com \
  --subject "Resend test" \
  --text "It works"

On this page