Authentication
How Email SDK authenticates to every provider. There is no platform account; you supply each provider's own credential from an environment variable.
Email SDK is a library, not a hosted service. There is no Email SDK account, API key, or OAuth flow. You authenticate to each email provider with that provider’s own credential, which you read from an environment variable and pass to the adapter. The adapter sets the provider’s required auth header (or signs the request) for you.
How credentials flow
import { createEmailClient } from "@opencoredev/email-sdk";
import { resend } from "@opencoredev/email-sdk/resend";
export const email = createEmailClient({
// The credential comes from your environment, never from email-sdk.dev.
adapters: [resend({ apiKey: process.env.RESEND_API_KEY! })],
});
Each adapter is imported from its own entry point (@opencoredev/email-sdk/<name>)
and takes the fields that provider needs. Most providers use a single API key; a
few add a routing id, use a key pair, or sign requests.
Credential by provider
| Provider | Import | Credential model | Required config → environment variable |
|---|---|---|---|
| Resend | @opencoredev/email-sdk/resend |
API key | apiKey → RESEND_API_KEY |
| Postmark | @opencoredev/email-sdk/postmark |
Server token | serverToken → POSTMARK_SERVER_TOKEN |
| SendGrid | @opencoredev/email-sdk/sendgrid |
API key | apiKey → SENDGRID_API_KEY |
| Cloudflare | @opencoredev/email-sdk/cloudflare |
API token + account | apiToken → CLOUDFLARE_API_TOKEN, accountId → CLOUDFLARE_ACCOUNT_ID |
| Unosend | @opencoredev/email-sdk/unosend |
API key | apiKey → UNOSEND_API_KEY |
| AWS SES | @opencoredev/email-sdk/ses |
Access key pair (SigV4) | accessKeyId → AWS_ACCESS_KEY_ID, secretAccessKey → AWS_SECRET_ACCESS_KEY, region → AWS_REGION (optional sessionToken → AWS_SESSION_TOKEN) |
| Mailgun | @opencoredev/email-sdk/mailgun |
API key + domain | apiKey → MAILGUN_API_KEY, domain → MAILGUN_DOMAIN |
| MailerSend | @opencoredev/email-sdk/mailersend |
API key | apiKey → MAILERSEND_API_KEY |
| Brevo | @opencoredev/email-sdk/brevo |
API key | apiKey → BREVO_API_KEY |
| Mailchimp Transactional | @opencoredev/email-sdk/mailchimp |
API key | apiKey → MAILCHIMP_API_KEY |
| SparkPost | @opencoredev/email-sdk/sparkpost |
API key | apiKey → SPARKPOST_API_KEY |
| Iterable | @opencoredev/email-sdk/iterable |
API key + campaign | apiKey → ITERABLE_API_KEY, campaignId → ITERABLE_CAMPAIGN_ID |
| Loops | @opencoredev/email-sdk/loops |
API key + transactional id | apiKey → LOOPS_API_KEY, transactionalId → LOOPS_TRANSACTIONAL_ID |
| Sequenzy | @opencoredev/email-sdk/sequenzy |
API key | apiKey → SEQUENZY_API_KEY |
| JetEmail | @opencoredev/email-sdk/jetemail |
API key | apiKey → JETEMAIL_API_KEY |
| Lettermint | @opencoredev/email-sdk/lettermint |
API token | apiToken → LETTERMINT_API_TOKEN |
| Primitive | @opencoredev/email-sdk/primitive |
API key | apiKey → PRIMITIVE_API_KEY |
| Plunk | @opencoredev/email-sdk/plunk |
API key | apiKey → PLUNK_API_KEY |
| Mailtrap | @opencoredev/email-sdk/mailtrap |
API key | apiKey → MAILTRAP_API_KEY |
| Scaleway | @opencoredev/email-sdk/scaleway |
Project id + secret key | projectId → SCALEWAY_PROJECT_ID, secretKey → SCALEWAY_SECRET_KEY (optional region, defaults to fr-par) |
| ZeptoMail | @opencoredev/email-sdk/zeptomail |
Send-mail token | token → ZEPTOMAIL_TOKEN |
| MailPace | @opencoredev/email-sdk/mailpace |
API key | apiKey → MAILPACE_API_KEY |
| SMTP | @opencoredev/email-sdk/smtp |
SMTP username + password | host, port, secure, auth: { user, pass } → SMTP_USER, SMTP_PASS |
Each provider page under Adapters links to where that credential is issued and lists every configuration field.
SMTP
SMTP is the one adapter that does not take an API key. It connects to a mail server with a host, port, and username/password. The SDK ships its own SMTP transport, so you do not add Nodemailer.
import { createEmailClient } from "@opencoredev/email-sdk";
import { smtp } from "@opencoredev/email-sdk/smtp";
export const email = createEmailClient({
adapters: [
smtp({
host: "smtp.example.com",
port: 587,
secure: false,
auth: { user: process.env.SMTP_USER!, pass: process.env.SMTP_PASS! },
}),
],
});
Optional configuration
Beyond credentials, the HTTP-based adapters accept two shared optional fields:
baseUrloverrides the provider’s API origin, for a proxy or region endpoint.fetchinjects a customfetchimplementation for tests or special runtimes.
A few adapters (Resend, Postmark, JetEmail, Lettermint, Primitive) also take a headers option for extra HTTP request headers. SMTP is socket-based and has its own options (host, port, secure, tls, and so on) instead of these. Each adapter page lists its exact option set.
Multiple providers and fallbacks
Pass several configured adapters to route across them. Only configure a fallback between adapters that support the same fields; see Field support.
import { createEmailClient } from "@opencoredev/email-sdk";
import { resend } from "@opencoredev/email-sdk/resend";
import { ses } from "@opencoredev/email-sdk/ses";
export const email = createEmailClient({
adapters: [
resend({ apiKey: process.env.RESEND_API_KEY! }),
ses({
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
region: process.env.AWS_REGION!,
}),
],
fallback: ["ses"],
retry: { retries: 1 },
});
Keeping credentials safe
- Scope each provider key to sending only, where the provider supports it.
- Rotate or revoke credentials in the provider’s own dashboard, then update the environment variable. Email SDK holds no session or token state of its own.
- Use idempotency keys for externally visible sends that may be retried.
Per-provider setup
A strong default for developer-first transactional email.
Send through Microsoft 365 and Azure AD with Microsoft Graph.
Great for focused transactional email and deliverability.
Best when your product already runs on Twilio SendGrid.
A good fit for AWS teams sending at high volume.
Use with an existing Mailgun setup or sending domain.
A simple API with a friendly dashboard for growing teams.
Use transactional email alongside your Brevo marketing stack.
Best for products already using Mailchimp Transactional.
Use when SparkPost already powers your email delivery.
Useful when testing and production email live in Mailtrap.
Send directly from apps running on Cloudflare Workers.
A natural fit for apps hosted in the Scaleway ecosystem.
Use transactional email alongside Zoho and ZeptoMail.
A simple transactional email API for smaller products.
Send product and lifecycle email through your Loops account.
An open-source-friendly option for product email.
Connect any existing SMTP server or self-hosted mail system.
Verify your sending domain’s DNS
API credentials get the request accepted; SPF, DKIM, and DMARC records get the mail delivered. After verifying a domain with your provider, confirm the records actually resolve with the free email DNS checker — it validates SPF syntax and lookup limits, probes common DKIM selectors, and checks your DMARC policy.