Get started
Quickstart
Create a Resend client and send your first email.
Set a server-only Resend key:
RESEND_API_KEY=re_xxxThen create the client and send:
import { createEmailClient } from "@opencoredev/email-sdk";
import { resend } from "@opencoredev/email-sdk/resend";
const email = createEmailClient({
adapters: [resend({ apiKey: process.env.RESEND_API_KEY! })],
});
const result = await email.send({
from: "Acme <hello@acme.com>",
to: "user@example.com",
subject: "Welcome",
text: "Your account is ready.",
});
console.log(result.adapter, result.id);That is the whole happy path. The result tells you which adapter ran and includes the provider receipt when one is available.
Check a message without sending
Use validate when you want the same message and routing checks without a provider send request:
await email.validate({
from: "Acme <hello@acme.com>",
to: "user@example.com",
subject: "Welcome",
text: "Your account is ready.",
});Check from the CLI
--dry-run runs the same validation without sending email.
EMAIL_SDK_TELEMETRY=0 npx email-sdk send \
--adapter resend \
--from "Acme <hello@acme.com>" \
--to user@example.com \
--subject "Welcome" \
--text "Your account is ready." \
--dry-runAdd retries and fallback
Choose retry counts and unknown-delivery policy deliberately.
Schedule an email
Use provider scheduling now, or an app-owned queue when you need more control.
Test without a provider
Capture sends with the memory adapter and capture plugin.
