Email SDK

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.

One typed client, many providers: the only thing that changes between providers is the factory you import and the credential you give it. For an agent-facing summary of this model see /auth.md.

How credentials flow

lib/email.ts
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

ProviderImportCredential modelRequired config → environment variable
Resend@opencoredev/email-sdk/resendAPI keyapiKeyRESEND_API_KEY
Postmark@opencoredev/email-sdk/postmarkServer tokenserverTokenPOSTMARK_SERVER_TOKEN
SendGrid@opencoredev/email-sdk/sendgridAPI keyapiKeySENDGRID_API_KEY
Cloudflare@opencoredev/email-sdk/cloudflareAPI token + accountapiTokenCLOUDFLARE_API_TOKEN, accountIdCLOUDFLARE_ACCOUNT_ID
Unosend@opencoredev/email-sdk/unosendAPI keyapiKeyUNOSEND_API_KEY
AWS SES@opencoredev/email-sdk/sesAccess key pair (SigV4)accessKeyIdAWS_ACCESS_KEY_ID, secretAccessKeyAWS_SECRET_ACCESS_KEY, regionAWS_REGION (optional sessionTokenAWS_SESSION_TOKEN)
Mailgun@opencoredev/email-sdk/mailgunAPI key + domainapiKeyMAILGUN_API_KEY, domainMAILGUN_DOMAIN
MailerSend@opencoredev/email-sdk/mailersendAPI keyapiKeyMAILERSEND_API_KEY
Brevo@opencoredev/email-sdk/brevoAPI keyapiKeyBREVO_API_KEY
Mailchimp Transactional@opencoredev/email-sdk/mailchimpAPI keyapiKeyMAILCHIMP_API_KEY
SparkPost@opencoredev/email-sdk/sparkpostAPI keyapiKeySPARKPOST_API_KEY
Iterable@opencoredev/email-sdk/iterableAPI key + campaignapiKeyITERABLE_API_KEY, campaignIdITERABLE_CAMPAIGN_ID
Loops@opencoredev/email-sdk/loopsAPI key + transactional idapiKeyLOOPS_API_KEY, transactionalIdLOOPS_TRANSACTIONAL_ID
Sequenzy@opencoredev/email-sdk/sequenzyAPI keyapiKeySEQUENZY_API_KEY
JetEmail@opencoredev/email-sdk/jetemailAPI keyapiKeyJETEMAIL_API_KEY
Lettermint@opencoredev/email-sdk/lettermintAPI tokenapiTokenLETTERMINT_API_TOKEN
Primitive@opencoredev/email-sdk/primitiveAPI keyapiKeyPRIMITIVE_API_KEY
Plunk@opencoredev/email-sdk/plunkAPI keyapiKeyPLUNK_API_KEY
Mailtrap@opencoredev/email-sdk/mailtrapAPI keyapiKeyMAILTRAP_API_KEY
Scaleway@opencoredev/email-sdk/scalewayProject id + secret keyprojectIdSCALEWAY_PROJECT_ID, secretKeySCALEWAY_SECRET_KEY (optional region, defaults to fr-par)
ZeptoMail@opencoredev/email-sdk/zeptomailSend-mail tokentokenZEPTOMAIL_TOKEN
MailPace@opencoredev/email-sdk/mailpaceAPI keyapiKeyMAILPACE_API_KEY
SMTP@opencoredev/email-sdk/smtpSMTP username + passwordhost, 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.

lib/email.ts
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, every adapter accepts the same optional fields:

  • baseUrl — override the provider's API origin (for a proxy or region endpoint).
  • headers — extra HTTP headers sent with every request.
  • fetch — a custom fetch implementation for tests or special runtimes.

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.

lib/email.ts
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!,
    }),
  ],
  retry: { retries: 1 },
});

Keeping credentials safe

Keep every credential in environment variables or a secret manager. Never hardcode or log API keys, SMTP passwords, raw tokens, full message bodies, or recipient lists. When an agent drives sends, gate them behind explicit human approval and run email-sdk doctor and send --dry-run first.

  • 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

Sequenzy logo
Sequenzy
Product-led
OfficialAPI testedRequest tested
@opencoredev/email-sdk/sequenzy
JetEmail logo
JetEmail
Popular APIs
OfficialAPI testedRequest tested
@opencoredev/email-sdk/jetemail
Lettermint logo
Lettermint
Popular APIs
OfficialAPI testedRequest tested
@opencoredev/email-sdk/lettermint
Resend logo
Resend
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/resend
Primitive logo
Primitive
Popular APIs
OfficialAPI testedRequest tested
@opencoredev/email-sdk/primitive
Postmark logo
Postmark
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/postmark
SendGrid logo
SendGrid
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/sendgrid
AWS SES logo
AWS SES
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/ses
Mailgun logo
Mailgun
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/mailgun
MailerSend logo
MailerSend
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/mailersend
Brevo logo
Brevo
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/brevo
Mailchimp Transactional logo
Mailchimp Transactional
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/mailchimp
SparkPost logo
SparkPost
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/sparkpost
Mailtrap logo
Mailtrap
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/mailtrap
Cloudflare Email Sending logo
Cloudflare Email Sending
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/cloudflare
Unosend logo
Unosend
Popular APIs
OfficialNot API testedRequest tested
@opencoredev/email-sdk/unosend
Scaleway logo
Scaleway
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/scaleway
ZeptoMail logo
ZeptoMail
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/zeptomail
MailPace logo
MailPace
Infrastructure
OfficialNot API testedRequest tested
@opencoredev/email-sdk/mailpace
Iterable logo
Iterable
Product-led
OfficialNot API testedRequest tested
@opencoredev/email-sdk/iterable
Loops logo
Loops
Product-led
OfficialNot API testedRequest tested
@opencoredev/email-sdk/loops
Plunk logo
Plunk
Product-led
OfficialNot API testedRequest tested
@opencoredev/email-sdk/plunk
SMTP
SMTP
Transport
OfficialNo provider APIBuilt-in transport
@opencoredev/email-sdk/smtp

On this page