CLI
The complete email-sdk command manual — adapters, doctor, send, dry runs, credential flags, and exit codes.
The email-sdk CLI ships inside @opencoredev/email-sdk. Use it to list adapters, check credentials with doctor, validate a message with --dry-run, and run a real smoke send — no app code required.
Run it
One-off, without installing:
bunx --bun --package @opencoredev/email-sdk email-sdk adaptersOr install the package and use the local binary:
npm install @opencoredev/email-sdknpx email-sdk adaptersNode 20+ or Bun 1.1+. The examples below use npx email-sdk; substitute the bunx form for no-install runs.
Commands
| Command | Aliases | What it does |
|---|---|---|
help | --help, -h, no command | Print usage. |
version | --version, -v | Print the installed package name and version. |
adapters | providers | List every adapter with its required environment. |
doctor | — | Check that one adapter's credentials are present. |
send | — | Validate and send one message. |
Any other command fails with Unknown command "x". and exit code 1.
Flag syntax
--flag valueand--flag=valueare equivalent; a flag without a value is treated astrue.--header,--tag,--metadata, and--attachment(alias--attach) are repeatable — pass them once per value.- Repeating any other flag keeps the last value.
--to,--cc,--bcc, and--reply-toaccept comma-separated address lists.
help
npx email-sdk helpPrints usage, all send flags, and the adapter-specific option groups. Running email-sdk with no command does the same.
version
npx email-sdk version
# @opencoredev/email-sdk 0.6.1
npx email-sdk version --json
# { "name": "@opencoredev/email-sdk", "version": "0.6.1" }Reads the metadata of the package actually installed on your machine — check it before comparing behavior against the docs.
adapters
npx email-sdk adaptersPrints one line per adapter: routing name, required environment variables, and a short note. --json prints the same data as a JSON array of { name, env, note } objects.
| Adapter | Required environment | Optional environment |
|---|---|---|
resend | RESEND_API_KEY | — |
postmark | POSTMARK_SERVER_TOKEN | POSTMARK_MESSAGE_STREAM |
sendgrid | SENDGRID_API_KEY | — |
cloudflare | CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID | CLOUDFLARE_BASE_URL |
unosend | UNOSEND_API_KEY | UNOSEND_BASE_URL |
iterable | ITERABLE_API_KEY, ITERABLE_CAMPAIGN_ID | ITERABLE_BASE_URL, ITERABLE_SEND_AT, ITERABLE_ALLOW_REPEAT_MARKETING_SENDS |
ses | AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION | AWS_SESSION_TOKEN, AWS_SES_CONFIGURATION_SET, AWS_SES_BASE_URL |
mailgun | MAILGUN_API_KEY, MAILGUN_DOMAIN | MAILGUN_BASE_URL |
mailersend | MAILERSEND_API_KEY | — |
brevo | BREVO_API_KEY | — |
mailchimp | MAILCHIMP_API_KEY | — |
sparkpost | SPARKPOST_API_KEY | — |
loops | LOOPS_API_KEY, LOOPS_TRANSACTIONAL_ID | — |
sequenzy | SEQUENZY_API_KEY | SEQUENZY_BASE_URL |
plunk | PLUNK_API_KEY | — |
mailtrap | MAILTRAP_API_KEY | — |
scaleway | SCALEWAY_SECRET_KEY, SCALEWAY_PROJECT_ID | SCALEWAY_REGION |
zeptomail | ZEPTOMAIL_TOKEN | — |
mailpace | MAILPACE_API_KEY | — |
smtp | SMTP_HOST | SMTP_PORT (default 587), SMTP_SECURE, SMTP_REQUIRE_TLS, SMTP_ALLOW_INSECURE_AUTH, SMTP_USER, SMTP_PASS |
Adapter auto-detection
When doctor or send runs without --adapter, the CLI walks the table above in order and picks the first adapter whose required environment variables are all set. If none qualifies:
