Send email from Node.js through Sendwax with Nodemailer
The usual way a Node app sends mail.
The values
| Host | smtp.sendwax.com |
|---|---|
| Port | 587 |
| Encryption | TLS / STARTTLS |
| Username | sendwax |
| Password | a send-only API key from API keys in the dashboard |
| From | an address you have approved under Senders |
The username is literally sendwax for everybody — the key is what
identifies your account. Use a send-only key: it can send mail and nothing else, so a key
sitting in a settings screen on shared hosting cannot read your contacts.
const transport = nodemailer.createTransport({
host: 'smtp.sendwax.com',
port: 587,
secure: false, // STARTTLS, upgraded below
requireTLS: true,
auth: { user: 'sendwax', pass: 'esk_send_your_key' },
});
await transport.sendMail({
from: 'you@yourdomain.com',
to: 'them@example.com',
subject: 'Hello',
text: 'Sent through Sendwax.',
});
Step by step
secure: falsewithrequireTLS: trueis the correct pair for port 587 — it means "plain connection, then insist on STARTTLS".secure: trueis for port 465, which we do not serve.frommust be an approved sender.
Nodemailer pools connections
With pool: true a connection is held open between messages. That is fine — we allow up to ten concurrent sessions per key and a session lasts half an hour — but a key you revoke stays usable on an open connection until it closes. Revoking is not instant on a pooled transport.
Checking it worked
transport.verify() performs a real login, so a resolved promise means the credentials are good.
What else to know
We do not relay your message byte for byte — we read it and build a new one that our DKIM signature covers, which is what makes the reporting and the unsubscribe handling work. It costs you inline image placement, threading and a few other things, all listed on the SMTP relay page. Worth two minutes before you point production at it.
If you are writing the code rather than configuring somebody else's, the API is the better door: a message id per recipient and an error you can read, instead of a three-digit reply your framework swallowed.
Other setups
- WP Mail SMTP — The most installed SMTP plugin on WordPress. Takes about two minutes.
- FluentSMTP — Free, open source, and happy to hold several connections at once.
- Post SMTP — Keeps its own email log and can alert you when a send fails.
- Easy WP SMTP — The plainest of them. Nothing to configure beyond the connection.
- Gravity SMTP — From the Gravity Forms team, and the right choice if your forms are theirs.
- WooCommerce — Order confirmations, shipping notices, password resets. The ones customers notice.
- Postfix — Everything on the box — cron, monitoring, mail(1) — goes out properly signed.
- Laravel — Two lines of .env. Or use our package and skip SMTP entirely.
- Python — The standard library, no dependencies.