Nodemailer
Send e-mails with Node.JS – easy as cake! ✉️
Nodemailer makes sending email from a Node.js application straightforward and secure, without pulling in a single runtime dependency.
Install with npm
npm install nodemailer
Looking for a full mail gateway?
EmailEngine is a self‑hosted email gateway that lets you make REST calls to IMAP & SMTP accounts, receive webhooks for mailbox changes, and send email with extras such as OAuth2, delayed delivery, open‑ & click‑tracking, bounce detection, and more.
Why Nodemailer?
- Zero runtime dependencies – the entire implementation lives in one audited package.
 - Security first – avoids known RCE vectors that have affected other Node.js mailers.
 - Unicode everywhere – send any characters, including emoji 💪.
 - Cross‑platform – no native addons, works the same on Linux, macOS, and Windows (great for Azure).
 - HTML e‑mails with plain‑text fallbacks out of the box.
 - Attachments & embedded images without pain.
 - Out‑of‑the‑box TLS/STARTTLS encryption.
 - Multiple transports (SMTP, Sendmail, SES, streams, and more).
 - DKIM signing & OAuth2 authentication.
 - Proxy support for restricted networks.
 - Plugin API for advanced message manipulation.
 - Built‑in test accounts from Ethereal.email for local development.
 
Requirements
- Node.js ≥ 6.0.0 (async/await examples require ≥ 8.0.0).
 
No other system libraries, services, or build tools are needed.
Quick‑start
- Create a transporter. Use SMTP or another supported transport.
 - Compose a message. Define sender, recipient(s), subject, and content.
 - Send it with 
transporter.sendMail(). 
Example (using an Ethereal test account)
const nodemailer = require("nodemailer");
// Create a test account or replace with real credentials.
const transporter = nodemailer.createTransport({
  host: "smtp.ethereal.email",
  port: 587,
  secure: false, // true for 465, false for other ports
  auth: {
    user: "maddison53@ethereal.email",
    pass: "jn7jnAPss4f63QBp6D",
  },
});
// Wrap in an async IIFE so we can use await.
(async () => {
  const info = await transporter.sendMail({
    from: '"Maddison Foo Koch" <maddison53@ethereal.email>',
    to: "bar@example.com, baz@example.com",
    subject: "Hello ✔",
    text: "Hello world?", // plain‑text body
    html: "<b>Hello world?</b>", // HTML body
  });
  console.log("Message sent:", info.messageId);
})();
Tip: Ethereal generates a URL for every message so you can view the rendered email in your browser — perfect for development.
Source & license
Nodemailer is MIT‑licensed open source. Browse the code on GitHub.
Made with ❤️ by Andris Reinman. Logo by Sven Kristjansen.