Master da Web
SMTP guide

Send email with Node.js and Nodemailer over authenticated SMTP

Nodemailer is the most common way to send email from Node.js. Point the transport at our SMTP with your sending key, and messages leave with your domain's DKIM, from Express, NestJS, Next.js or a worker.

The sandbox is free for everyone. Already run a cloud service with us? The free plan is yours too.

mail.mjs

import nodemailer from "nodemailer" const transporter = nodemailer.createTransport({  host: process.env.SMTP_HOST,  port: 587,  secure: false, // STARTTLS on 587; true only on 465  auth: { user: "apikey", pass: process.env.SMTP_PASSWORD },  pool: true,}) await transporter.sendMail({  from: '"My Store" <orders@yourdomain.com>',  to: "ana@example.com",  subject: "Order confirmed",  text: "Hi Ana! We received your order.",  html: "<p>Hi Ana! We received your order.</p>",})

SMTP_HOST and SMTP_PASSWORD are environment variables holding the panel's host and your sending key, the same ones a serverless app connected to email receives.

Node.js

Step by step: SMTP in Node.js

From a verified domain to the first delivered email, with the result of each send in the panel.

  1. 1

    Verify your domain

    Add the domain in the panel, under Email & SMTP, and publish the DNS records it shows.

  2. 2

    Create a sending key

    The key is the SMTP password. Keep it in a server environment variable, never in the front end.

  3. 3

    Install Nodemailer

    npm install nodemailer, and create the transport once, when the app starts.

  4. 4

    Send and follow up

    Call sendMail and see in the panel's Activity what happened to each recipient.

Beyond SMTP

What you get by sending with Master da Web

Delivery under your domain

DKIM with your domain's key, aligned SPF and DMARC: what Gmail, Yahoo and Microsoft check before they accept.

Per-recipient logs

Delivered, deferred, bounced or marked as spam, with the receiving server's full answer.

Webhooks and suppressions

Signed events in your system, and bounces and complaints taken off the list by themselves.

Free sandbox

A sandbox key captures messages so you can test without delivering anything to anyone.

What it costs

Plans from R$29.00 a month, with 10,000 emails included. If you run a cloud service with us, you start on the free plan, with 3,000 emails a month. The sandbox is free for everyone.

See plans and prices
Discover the SMTP & Email API
FAQ

Questions about SMTP in Node.js

What comes up most while setting it up.

Set up SMTP in Node.js today

Create your account, verify your domain and start testing today.