Email SDK
Reference

CLI

Reference for the email-sdk command-line smoke test.

The CLI is intentionally small. Use it to inspect adapters, check environment variables, validate a message with --dry-run, and send a smoke-test email from your terminal.

The npm package is @opencoredev/email-sdk; the CLI command it installs is email-sdk.

Install or run

Run the CLI once with the scoped package:

npx --yes --package @opencoredev/email-sdk email-sdk adapters

Install the SDK in a project:

npm install @opencoredev/email-sdk

Then run the installed binary:

npx email-sdk adapters

Check the installed version before comparing behavior against the docs:

npx email-sdk version

The CLI supports Node 20+ and Bun 1.1+. The examples use npx because it is the broadest copy-paste path; Bun users can run the one-off CLI with bunx --bun --package @opencoredev/email-sdk email-sdk adapters.

Send

RESEND_API_KEY="re_..." npx --yes --package @opencoredev/email-sdk email-sdk send \
  --adapter resend \
  --from "Acme <hello@acme.com>" \
  --to "user@example.com" \
  --subject "Hello" \
  --text "It works"

Adapters

npx --yes --package @opencoredev/email-sdk email-sdk adapters
AdapterRequired environment
resendRESEND_API_KEY
postmarkPOSTMARK_SERVER_TOKEN
sendgridSENDGRID_API_KEY
cloudflareCLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID
sesAWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
mailgunMAILGUN_API_KEY, MAILGUN_DOMAIN
mailersendMAILERSEND_API_KEY
brevoBREVO_API_KEY
mailchimpMAILCHIMP_API_KEY
sparkpostSPARKPOST_API_KEY
loopsLOOPS_API_KEY, LOOPS_TRANSACTIONAL_ID
plunkPLUNK_API_KEY
mailtrapMAILTRAP_API_KEY
scalewaySCALEWAY_SECRET_KEY, SCALEWAY_PROJECT_ID
zeptomailZEPTOMAIL_TOKEN
mailpaceMAILPACE_API_KEY
smtpSMTP_HOST, plus SMTP auth variables when needed

If --adapter is omitted, the CLI selects the first adapter with all required environment variables set.

Doctor

RESEND_API_KEY="re_..." npx --yes --package @opencoredev/email-sdk email-sdk doctor --adapter resend

doctor checks whether the selected adapter has the required environment variables or matching CLI credential flags.

Version

npx email-sdk version
npx email-sdk --version
npx email-sdk -v
npx email-sdk version --json

version reads the installed @opencoredev/email-sdk package metadata, so it reports the SDK and CLI version from the package currently on your machine. The docs version picker uses the same package version from this repository.

Flags

FlagAdapterNotes
--adapterallAdapter routing name.
--providerallAlias for --adapter.
--fromallSender address.
--toallRecipient address. Comma-separated values are allowed.
--subjectallMessage subject.
--textallPlain text body.
--htmlallHTML body.
--ccsendComma-separated CC addresses.
--bccsendComma-separated BCC addresses.
--reply-tosendComma-separated reply-to addresses.
--headersendHeader in Name: value format. Repeatable.
--tagsendTag in name=value format. Repeatable.
--metadatasendMetadata in key=value format. Repeatable.
--attachmentsendLocal file path, optionally path:content/type.
--messagesendRead an EmailMessage JSON payload from a file.
--dry-runallValidate the message and adapter field support without sending.
--jsonversion, adaptersPrint output as JSON.
--api-keymanyOverrides the adapter API key variable.
--api-tokenCloudflareOverrides CLOUDFLARE_API_TOKEN.
--account-idCloudflareOverrides CLOUDFLARE_ACCOUNT_ID.
--base-urlCloudflareOverrides CLOUDFLARE_BASE_URL.
--server-tokenPostmarkOverrides POSTMARK_SERVER_TOKEN.
--message-streamPostmarkOptional message stream.
--access-key-idAWS SESOverrides AWS_ACCESS_KEY_ID.
--secret-access-keyAWS SESOverrides AWS_SECRET_ACCESS_KEY.
--regionAWS SESOverrides AWS_REGION.
--session-tokenAWS SESOverrides AWS_SESSION_TOKEN.
--configuration-setAWS SESOverrides AWS_SES_CONFIGURATION_SET.
--domainMailgunOverrides MAILGUN_DOMAIN.
--transactional-idLoopsOverrides LOOPS_TRANSACTIONAL_ID.
--project-idScalewayOverrides SCALEWAY_PROJECT_ID.
--secret-keyScalewayOverrides SCALEWAY_SECRET_KEY.
--tokenZeptoMailOverrides ZEPTOMAIL_TOKEN.
--hostSMTPOverrides SMTP_HOST.
--portSMTPOverrides SMTP_PORT.
--secureSMTPSet to true for secure SMTP.
--require-tlsSMTPRequire STARTTLS.
--allow-insecure-authSMTPAllow SMTP AUTH without TLS.
--userSMTPOverrides SMTP_USER.
--passSMTPOverrides SMTP_PASS.

The CLI prints the normalized adapter response as JSON.

On this page