Email SDK
Adapters

AWS SES

Configure the AWS SES v2 SendEmail adapter.

The AWS SES adapter calls the SES v2 SendEmail API directly with SigV4-signed fetch requests. It does not add a runtime dependency on the AWS SDK.

AWS SES logo
AWS SES
@opencoredev/email-sdk/ses
OfficialPayload-testedLive account required
Open website
import { createEmailClient } from "@opencoredev/email-sdk";
import { ses } from "@opencoredev/email-sdk/ses";

const email = createEmailClient({
  adapters: [
    ses({
      accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
      sessionToken: process.env.AWS_SESSION_TOKEN,
      region: process.env.AWS_REGION!,
    }),
  ],
});

Send

await email.send({
  from: "Acme <hello@acme.com>",
  to: "user@example.com",
  subject: "Welcome",
  html: "<p>Your workspace is ready.</p>",
  tags: [{ name: "type", value: "welcome" }],
});

Options

OptionTypeRequiredNotes
accessKeyIdstringYesAWS access key ID.
secretAccessKeystringYesAWS secret access key.
regionstringYesSES region, for example us-east-1.
sessionTokenstringNoRequired for temporary credentials.
baseUrlstringNoDefaults to https://email.{region}.amazonaws.com.
fetchtypeof fetchNoUseful for tests or custom runtimes.
charsetstringNoDefaults to UTF-8.
configurationSetNamestringNoSES configuration set for sends through this adapter.

CLI

AWS_ACCESS_KEY_ID=... \
AWS_SECRET_ACCESS_KEY=... \
AWS_REGION=us-east-1 \
bunx --yes @opencoredev/email-sdk send --adapter ses \
  --from "Acme <hello@acme.com>" \
  --to user@example.com \
  --subject "Welcome" \
  --html "<p>Your workspace is ready.</p>"

Response

The adapter returns the SES MessageId as id and messageId.

On this page