Documentation
Send email in Node.js.
Works with: Node 18 or newer, Bun, Deno and edge runtimes (it uses fetch). No dependencies.
Install
Get a key under API keys in the dashboard and verify a sending domain first (how). Then add the library:
Send an email
This sends one message and passes an idempotency key, so repeating the request can never deliver it twice. A send is retried only when you pass an idempotencyKey; reads and deletes retry on 429 and 5xx.
More on what you can put in a message (cc, bcc, attachments, tags, templates, scheduling) is under Sending.
Verify webhook signatures
Mailtruss signs every webhook with the Standard Webhooks scheme. Check the signature before you trust a request. Read the raw body with req.text(): re-serialised JSON will not match the signature.
Events, payloads and retries are on the Webhooks page.
Handle errors
Failures throw MailError with statusCode, name_ and requestId. Search the request ID in the dashboard's API logs. Every error name, with its cause and fix, is in the error catalogue.