Nodemailer sends mail from Node.js applications via SMTP and other transports, with attachments, TLS, and no extra runtime dependencies.
Overview
Nodemailer is an email library for Node.js aimed at straightforward, secure sending from application code. It bundles SMTP and several alternate transports in one package with zero declared runtime dependencies.
You create a reusable transporter configured for your mail service, compose messages with plain text and HTML parts, then call sendMail. It builds multipart messages, supports Unicode content, attachments, embedded images, DKIM signing, OAuth2 authentication, and proxy routing.
Transports include SMTP with pooling options, Sendmail, Amazon SES, and stream or JSON outputs for testing. A plugin API lets you extend message processing. Optional verification checks connectivity before sending, and development workflows can use Ethereal test accounts.
The library targets current Node.js releases and also documents use on Bun, Cloudflare Workers with nodejs compatibility, and Deno. TypeScript types ship with the package, and both CommonJS and ESM import styles are supported.
Key features
- SMTP transport with STARTTLS
- HTML and plain-text multipart messages
- Attachments and embedded images
- Amazon SES and Sendmail transports
- DKIM signing and OAuth2 auth
- Plugin API for message processing
- AbortSignal support for SMTP sends
- Bundled TypeScript definitions
Use cases
- Transactional email from Node.js apps
- Notifications with HTML templates
- Testing email with stream transports
- Sending through corporate SMTP or SES