Node.js SMTP with Nodemailer: MailSenpai is a built-in service
In recent Nodemailer versions you just write service: 'MailSenpai': it already knows the server, port and security.
- 14-day free trial
- Servers and data in the EU
- A log of every delivery
import nodemailer from 'nodemailer';
const transporter = nodemailer.createTransport({
service: 'MailSenpai', // = host relay.mailsenpai.com, port 2525, STARTTLS
auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS },
});
await transporter.sendMail({
from: '"Your shop" ',
to: '[email protected]',
subject: 'Your order has shipped',
text: 'Hi, your order is on its way.',
}); Four details, and your emails go out
They are the same for every program: you also find them, already filled in, in your customer area.
The sender must be on a domain verified in your area: otherwise the server refuses to send. For SPF, DKIM and DMARC records, use the free email DNS checker.
Three steps
Install Nodemailer
npm install nodemailer (a recent version, such as 10.0.16, already includes the MailSenpai service).
Add your credentials
Username and password from the customer area in environment variables, never in the code.
Send
The sender must be on a domain verified in SMTP Senpai.
Frequently asked questions
I have an old Nodemailer version
Instead of service, use host: 'relay.mailsenpai.com', port: 2525, secure: false: STARTTLS starts automatically.
Does it work with Next.js, Nuxt and serverless functions?
Yes, as long as the code runs server side: never put SMTP credentials in the browser.
Can I use the API instead of SMTP?
Yes: the SMTP Senpai API takes a JSON POST with the key from the customer area, useful where SMTP ports are blocked.
More integration guides
Try SMTP Senpai with your own software
A 14-day trial: connect your software, send your real emails and check the log line by line. Then decide.