Integration guide · Node.js

Node.js SMTP with Nodemailer: MailSenpai is a built-in service

In recent Nodemailer versions you just write service: 'MailSenpai': the preset sets the server and port 2525; add requireTLS: true to require STARTTLS.

  • Free plan, no card and no expiry
  • Servers and data in the EU
  • A log of every delivery
Reviews of the MailSenpai service, not this connectorGoogleGoogleCapterraCapterraTrustpilotTrustpilotG2G2
Node.js · Nodemailer
import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  service: 'MailSenpai', // preset: relay.mailsenpai.com, port 2525
  requireTLS: true, // fail if STARTTLS cannot be established
  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 MailSenpai preset uses port 2525. Port 587 is available with an explicit host and port, without service. secure: false starts a connection that can be upgraded with STARTTLS; requireTLS: true makes the upgrade mandatory. Keep certificate validation enabled: do not use rejectUnauthorized: false. verify() checks connection and authentication without sending a message; SMTP acceptance from sendMail() does not prove inbox delivery. Local checks: Nodemailer 10.3.1 on Node.js 24.19.0, six loopback protocol cases; no live relay send or delivery test. Nodemailer 10 requires Node.js 20 or later.

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 or 587
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. After the first send, the free email spam test gives it a score from 0 to 10.

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.

Prefer the API to SMTP? The Node.js SDK sends over HTTPS, reads the delivery log and verifies signed webhooks, with TypeScript types and no dependencies.

npm install @mailsenpai/smtp-senpai

npmGitLabAll integrations

from installation to a received message

Use the Node.js API SDK when SMTP ports are blocked

The SDK requires Node.js 18.17 or later and a server environment with outbound HTTPS access. Install npm install @mailsenpai/smtp-senpai. Set SMTP_SENPAI_API_KEY, VERIFIED_FROM and TEST_TO in the environment; the sender must belong to your verified domain and the recipient must be a mailbox you control.

import { SmtpSenpai } from '@mailsenpai/smtp-senpai';

for (const key of ['SMTP_SENPAI_API_KEY', 'VERIFIED_FROM', 'TEST_TO']) {
  if (!process.env[key]) throw new Error(`Missing environment variable: ${key}`);
}
const client = new SmtpSenpai({ apiKey: process.env.SMTP_SENPAI_API_KEY });
try {
  const result = await client.send({
    from: process.env.VERIFIED_FROM,
    to: process.env.TEST_TO,
    subject: 'SMTP Senpai integration test',
    text: 'A test from the server-side Node.js SDK.'
  });
  console.log(result);
} catch (error) {
  console.error('API request failed:', error.status, error.apiMessage);
  process.exitCode = 1;
}

Save the example as test-mail.mjs and run node test-mail.mjs. Read the per-recipient results: a suppressed recipient can be reported as not sent without a thrown transport error. Verify the received message and its authentication headers. Never run this code in a browser or expose the key in a public bundle.

Check the published SDK locally before your first real send

On 19 October 2026 we installed the published @mailsenpai/smtp-senpai 1.0.0 package from npm with Node.js 24.19.0. A loopback HTTP check covered ESM import, text and HTML, Reply-To, attachments, mock message IDs and 401/403/429 errors without retries. A simulated 502 was retried once with the same idempotency key. Runnable local example and recorded result. No MailSenpai credentials, external API calls or real email were used. This is a controlled SDK check, not a production relay test or proof of inbox delivery; Nodemailer SMTP is a separate transport.

Read the error before retrying

An invalid-key error requires checking the saved key and account state. A sender-domain rejection requires verifying that domain. A quota or rate-limit response requires waiting for the relevant limit or reviewing the plan; a network timeout requires checking outbound connectivity. Avoid blind retries: they do not correct credentials or DNS. Keep credentials and customer information out of public logs.

Use the official package page, source and setup reference and API error and delivery-event documentation. Service logs are retained for 7 days on the free plan and 90 days on paid plans. A local application log may have different retention.

Frequently asked questions

I have an old Nodemailer version

Use host: 'relay.mailsenpai.com', port: 2525, secure: false, requireTLS: true. To choose port 587, use the same explicit configuration with port: 587 and omit service. Keep certificate validation enabled.

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

Start free: connect your software, send your real emails and check the log line by line. No card and no expiry.

Free, no card and no expiryFree plan