Migrate from SMTP / Nodemailer to Notify
Leave SMTP and Nodemailer transport for a single HTTPS send call.
SMTP is fine plumbing. For app email, an HTTPS API is usually simpler to deploy (no open ports, no SMTP credential sprawl, easier observability). Nodemailer can speak SMTP or other transports — Notify replaces the transport with one POST.
What changes
| SMTP / Nodemailer | Notify | |
|---|---|---|
| Recommended client | nodemailer.createTransport + sendMail | One fetch — no mail library required |
| Protocol | SMTP (often 587/465) | HTTPS JSON |
| Auth | SMTP user/pass | x-api-key |
| Body | html / text fields | message |
| Ops | Relays, IP reputation DIY, firewall rules | Domain verify + API key |
Before / after
Nodemailer + SMTP
import nodemailer from 'nodemailer';
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: 587,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS
}
});
await transporter.sendMail({
from: 'noreply@acme.com',
to: 'user@example.com',
subject: 'Welcome',
html: '<h1>Welcome</h1>'
});
Notify (one fetch — no SDK required)
await fetch('https://notify.cx/api/email/send', {
method: 'POST',
headers: {
'x-api-key': process.env.NOTIFY_API_KEY!,
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'noreply@acme.com',
to: 'user@example.com',
subject: 'Welcome',
message: '<h1>Welcome</h1>'
})
});
Migration checklist
- Add
NOTIFY_API_KEYand remove SMTP secrets from app config where possible - Verify your domain in Notify
- Swap
sendMailhelpers for a smallsendEmail()wrapper around Notify - Use logs instead of scraping SMTP transcripts
- Add webhooks on Pro/Scale for bounces