Resend
Send through the Resend API with attachments, tags, and native idempotency keys.
The Resend adapter calls the Resend Email API with plain fetch. It is the default first adapter in these docs: setup is one API key, field support is broad, and it forwards idempotency keys to the provider as the Idempotency-Key header, so Resend itself deduplicates retried sends.
@opencoredev/email-sdk/resendConfigure
Grab an API key from the Resend dashboard and verify the domain you plan to send from.
import { createEmailClient } from "@opencoredev/email-sdk";
import { resend } from "@opencoredev/email-sdk/resend";
export const email = createEmailClient({
adapters: [resend({ apiKey: process.env.RESEND_API_KEY! })],
});Prop
Type
Send
Resend maps every common transactional field: cc, bcc, replyTo, headers, attachments, and tags. sendAt schedules the send on Resend's side, transmitted as scheduled_at in ISO 8601 form.
const result = await email.send(
{
from: "Acme <hello@acme.com>",
to: [{ email: "user@example.com", name: "Ada" }],
replyTo: "support@example.com",
subject: "Welcome to Acme",
html: "<p>Your workspace is ready.</p>",
tags: [{ name: "type", value: "welcome" }],
attachments: [
{ filename: "welcome.txt", content: "Welcome to Acme.", contentType: "text/plain" },
],
},
{ idempotencyKey: "welcome:user_123" },
);
console.log(result.id); // Resend email id, also exposed as result.messageIdThe idempotencyKey is sent as Resend's Idempotency-Key header, so retried requests cannot double-send.
No metadata field
Resend has no metadata concept, so metadata on a message throws an EmailValidationError
before any request is made. Use tags instead, or pick a metadata-capable
adapter.
Verify from the CLI
RESEND_API_KEY="re_..." npx email-sdk doctor --adapter resendRESEND_API_KEY="re_..." npx email-sdk send \
--adapter resend \
--from "Acme <hello@acme.com>" \
--to user@example.com \
--subject "Resend smoke test" \
--text "It works" \
--dry-runDrop --dry-run to perform one real send from the environment that will send production email. Local validation cannot tell you whether the account, sender domain, and recipient policy are actually ready; one live send can.
