Send email from Express over SMTP
Send from an Express route with Nodemailer pointed at Unitpost. Keep the key in env, not in the repo.
Install Nodemailer
Shellnpm install nodemailerSend from a route
JavaScriptimport express from "express"; import nodemailer from "nodemailer"; const transporter = nodemailer.createTransport({ host: "smtp.unitpost.com", port: 587, secure: false, requireTLS: true, auth: { user: "unitpost", pass: process.env.UNITPOST_API_KEY, }, }); const app = express(); app.post("/send", async (_req, res) => { await transporter.sendMail({ from: "you@yourdomain.com", to: "customer@example.com", subject: "Hello from Express", html: "<p>Sent via SMTP.</p>", }); res.json({ ok: true }); });Verify delivery
Confirm in Activity.