# Nodemailer — card for AI agents

Send emails from Node.js applications with support for multiple transport methods.

Category: Files, images and media · npm package `nodemailer` · latest version 10.3.1 (checked 2026-11-01)
Install: `npm install nodemailer`
License: MIT-0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## Nodemailer
- Create one transporter when the application starts and reuse it. Do not call `createTransport()` for each message.
- Set `secure: true` only for port 465. Use `false` on every other port; Nodemailer still tries to upgrade to TLS if the server supports it.
- Read SMTP credentials from environment variables (`process.env.SMTP_USER`, `process.env.SMTP_PASS`), as the docs do.
- After `sendMail()`, check `info.rejected`. A message counts as sent if at least one recipient was accepted.
- On Nodemailer 10+, remove `@types/nodemailer` because types ship with the package. Import classes from `nodemailer/lib/*` with a default import.
- Target Node.js 20+. On Cloudflare Workers use only SMTP transports, and do not set `tls.rejectUnauthorized: false`, which fails there with an error.
- Call `await transporter.verify()` to catch configuration errors before sending.

## Docs written for agents
- [llms.txt (index of the docs)](https://nodejs.org/llms.txt)

## What it is
- Nodemailer is a library for sending email from Node.js. The GitHub repository was created on 2011-01-19 and is licensed MIT-0, the MIT No Attribution license. The website calls it "the most popular email sending library for Node.js" and says it has "zero runtime dependencies to manage". The same team builds EmailEngine, a self-hosted email API, and the site says Nodemailer development is "sustained by EmailEngine licenses".
- The docs describe three steps. You create a transporter, write a message object, and call `transporter.sendMail()`. The site lists SMTP, Sendmail, Amazon SES and streams as transports, "and more". It also accepts any plugin that implements `send(mail, callback)`.
- Version 10 needs Node.js 20 or later. It ships both an ES module build and a CommonJS build, along with its own TypeScript types. The README says the ES module build also runs on Bun and on Cloudflare Workers with the `nodejs_compat` flag. The site adds Deno 2 to that list.

## Caveats
- Node.js 20 floor: Version 10 will not run on older Node.js. The docs say to stay on the 9.x line if you are on an older runtime.
- Gmail: switching beats debugging: The README says Gmail "either works well, or it does not work at all". It suggests that switching to another service is probably easier than fixing Gmail issues.
- Cloudflare Workers is SMTP-only: On Workers only the SMTP-based transports apply, because `sendmail` needs a child process. The README also says `tls.rejectUnauthorized: false` fails there with an error.
- The `secure` flag is easy to get wrong: The README lists a wrong `secure` value as one cause of TLS errors. It also notes that with `false`, Nodemailer still tries to upgrade to TLS if the server supports it.
- "Sent" can mean partly sent: A message with several recipients counts as sent if the server accepts at least one of them. You have to check `rejected` yourself.

## Numbers (AgentGid data)
- Gid Score: 78.9 (#118 of all tools, 6 of 281 in its category)
- Used in 155 public projects set up for AI coding agents (2.5%)
- Downloads last week: 40,472,572 (as of 2026-11-24), +51.3% over 4 weeks
- GitHub stars: 17,718 (as of 2026-11-24)
- Last push: 2026-11-20

## Often used with
dotenv 64.5%, Next.js 63.9%, Lucide React 63.2%, Tailwind CSS 74.8%, React 74.2%, clsx 55.5%

## Links
- AgentGid page: https://agentgid.com/tools/nodemailer/
- Homepage: https://nodemailer.com/
- Repository: https://github.com/nodemailer/nodemailer
- Source: https://github.com/nodemailer/nodemailer#readme
- Source: https://github.com/nodemailer/nodemailer
- Source: https://github.com/nodemailer/nodemailer/releases
- Source: http://nodemailer.com/

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
