Integration guide · Node.js

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
4.7/5 · 83 reviewsGoogleCapterraTrustpilot
Node.js · Nodemailer
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.',
});
the 4 details

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.

Serverrelay.mailsenpai.com
Port2525
SecuritySTARTTLS
Username and passwordin the customer area, SMTP Senpai page

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.

how to

Three steps

1

Install Nodemailer

npm install nodemailer (a recent version, such as 10.0.16, already includes the MailSenpai service).

2

Add your credentials

Username and password from the customer area in environment variables, never in the code.

3

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.

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.

14 days freeFree trial