Reference
NodeMailerMTA API
Send mail from code with direct delivery or a relay, and read the per-recipient results.
NodeMailerMTA (server/src/server/mta/node-mta.ts) is the delivery engine behind the outgoing server. You can also use it directly from your own code. It has two modes.
Direct delivery
Resolves the recipient's MX records and delivers to them over DNS.
How it works
- Builds the RFC 5322 message once, using nodemailer's
streamTransport, and signs it with DKIM. - Groups the recipients by domain.
- Resolves the MX records of all domains in parallel, with TTL-based caching.
- Probes ports 25, 587 and 465 in parallel on each MX host.
- Delivers to all domains in parallel, using a single TCP connection per domain.
Relay delivery (smarthost)
Sends everything through one relay server, such as KumoMTA.
DeliveryResult
Both methods return DeliveryResult[].
DSN status codes
| Code | Meaning |
|---|---|
2.0.0 | Successfully delivered. |
4.0.0 | Temporary failure. Retry later. |
5.0.0 | Permanent failure. The message was rejected. |
5.1.2 | No MX records, or the domain cannot be reached. |
Related
- The outbound queue uses
temporaryto decide whether to retry. Thedirectandrelaydrivers call this class, and thegoandkumo-httpdrivers return the same result format. - A bounce report for a failed recipient is handled by the bounce server.
- Environment variables lists the relay settings.