Point Nodemailer's transport at the gateway's inbound server instead of your provider's own server.
const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: "smtp.adlerwacht.com", // see /introduction/smtp-relay
port: 587, // or 465
secure: false, // true for port 465, false for STARTTLS on 587
auth: {
user: "you@yourcompany.com",
pass: process.env.SMTP_PASSWORD,
},
});
await transporter.sendMail({
from: "you@yourcompany.com",
to: "recipient@example.com",
subject: "Test",
text: "Hello from the gateway.",
});
Load the password from an environment variable rather than hardcoding it in source.
This is the same change whether you're using Nodemailer directly or through a
framework built on top of it (NestJS's MailerModule, for example) — only the
underlying transport options change, not how you compose or send a message.