nodemailer /nodemailer

✉️ Send e-mails with Node.JS – easy as cake!

★ 17,713⑂ 1,443👁 202⑃ 393● 1,514▤ 81
TypeScriptNOASSERTIONCreated 2011-01-19nodemailer.com/
Download: v10.5.0v10.5.0 ↓10.5.02026-11-10
+0
Daily
17,713
stars
1,443
forks
202
watchers
393
prs
1,514
issues
81
releases

README

Nodemailer



Send emails from Node.js – easy as cake! 🍰✉️



See nodemailer.com for documentation and terms.

 Nodemailer is developed by the team behind EmailEngine, a self-hosted email API that turns any Gmail, Microsoft 365, or IMAP account into a REST endpoint, with managed OAuth2, webhooks for incoming mail, and built-in sending. If you would rather call an HTTP API than maintain IMAP and SMTP connections yourself, that is what it is for.

 Supported runtimes

Nodemailer targets Node.js 20 and later. The ES module build also runs on Bun (tested against the latest release) and on Cloudflare Workers with the nodejs_compat compatibility flag. On Workers only the SMTP based transports apply, sendmail needs a child process, and the runtime does not allow turning certificate validation off, so tls.rejectUnauthorized: false fails there with an error.

 Cancelling an individual SMTP send

Pass an AbortSignal in the message options to cancel one sendMail() call:

js
await transporter.sendMail({
    from: '[email protected]',
    to: '[email protected]',
    text: 'Hello',
    signal: AbortSignal.timeout(30_000)
});


This is supported by SMTP and pooled SMTP transports. A pre-aborted signal prevents processing; aborting later stops subsequent plugin processing, removes a queued message, or closes the SMTP connection assigned to that message. Other deliveries in the pool can continue. Both promise and callback forms report an error named AbortError, with code: 'EABORT' and the signal's reason as cause. The signal listener is removed when the send finishes.

Cancellation stops local processing; it does not prove that the SMTP server has not already accepted the message. Do not retry a cancelled send automatically on that assumption.

Work already started by a plugin or a custom getSocket hook requires that code's cooperation to stop. Nodemailer ignores late plugin completion and destroys a socket handed back after cancellation. Plugins can read mail.data.signal to cancel their own work.

Other bundled transports (stream, JSON, sendmail and SES) ignore the signal once the message is handed to them, so the message is sent normally. A signal that is already aborted, or aborts while plugins run, still cancels the send with EABORT on every transport, as that happens before the transport is called. A signal value that is not an AbortSignal fails the send with ECONFIG. Custom transports can opt in with supportsAbortSignal: true; their send() must register its abort listener synchronously, check for a pre-aborted signal, stop the work it owns, invoke its callback once, and remove the listener on completion.

 SMTP socket close timeout

When an SMTP connection closes, Nodemailer ends the socket and destroys it if the server has not closed its side within socketCloseTimeout milliseconds (default 5000). Set it to 0 to destroy the socket right away. This applies to SMTP and pooled SMTP, including aborted sends and transporter.close({ force: true }). It does 

Top issues

Latest release

v10.5.0 v10.5.0 2026-11-10
10.5.0 (2026-11-10)



 Summary

Adds per-message cancellation to sendMail() with an AbortSignal, plus two encoding fixes: DKIM signatures for internationalized domains, and header text that looks like a broken encoded-word.

 Who should upgrade

- Anyone who signs with DKIM for a domain written with upper case or mapped non-ASCII characters (an upper case IDN label, or one holding a soft hyphen). The d= tag named a different domain than From:, so verification and DMARC alignment failed.
- Anyone who wants to cancel or time-limit a single send without closing the transport or pool.

 Highlight

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON