---
title: "Send email with Nodemailer over SMTP"
description: "createTransport pointed at Unitpost — Node, Next.js, or NestJS."
url: https://www.unitpost.com/guides/smtp/nodemailer
section: SMTP
updated: 2026-08-28
---
# Send email with Nodemailer over SMTP

## Connection settings

- **Host**: smtp.unitpost.com
- **Username**: unitpost (always this literal value)
- **Password**: Your Unitpost API key (must carry emails:send)
- **Port (STARTTLS)**: 587 (or 2587 if blocked)
- **Port (implicit TLS)**: 465 (or 2465 if blocked)
- **From address**: Any address on a verified domain

## Send email with Nodemailer over SMTP

> createTransport pointed at Unitpost — Node, Next.js, or NestJS.

Nodemailer is not deprecated. Create a transport with createTransport, point it at smtp.unitpost.com on port 587 (STARTTLS) or 465 (implicit TLS), and send from a verified domain. Port 25 is blocked on most clouds — don't use it. The same transport works in Express, Next.js, and NestJS.

### 1. Install Nodemailer

Add it to your Node.js project (Node 18+). The package is actively maintained.

```bash
npm install nodemailer
```

### 2. Create a transport

Point `createTransport` at `smtp.unitpost.com`. Use port 587 with `secure: false` for STARTTLS, or port 465 with `secure: true` for implicit TLS. The username is always `unitpost`; the password is your API key with `emails:send`.

```javascript
import nodemailer from "nodemailer";

const transporter = nodemailer.createTransport({
  host: "smtp.unitpost.com",
  port: 587,
  secure: false,
  requireTLS: true,
  auth: {
    user: "unitpost",
    pass: process.env.UNITPOST_API_KEY,
  },
});
```

> Port 25 vs 587: 25 is the legacy submission port and is blocked by AWS, GCP, and most VPS providers. 587 with STARTTLS is what you want. 465 is implicit TLS if 587 is filtered.

### 3. Send an email

The `from` address must be on a domain you've verified in Unitpost. This is the same `sendMail` call in a Next.js Route Handler or a NestJS provider.

```javascript
await transporter.sendMail({
  from: "you@yourdomain.com",
  to: "customer@example.com",
  subject: "Hello from Unitpost",
  html: "<h1>Welcome!</h1><p>Sent via SMTP.</p>",
});
```

### 4. Verify it in the dashboard

Open Activity in your Unitpost dashboard — the message appears alongside API sends, with delivery, open, and click status. Framework-specific walkthroughs: Next.js (/guides/smtp/nextjs), NestJS (/guides/smtp/nestjs), Express (/guides/smtp/express).

## Related

- [Send Supabase auth email over SMTP](https://www.unitpost.com/guides/smtp/supabase): Magic links and confirmations from your verified domain.
- [Send WordPress email over SMTP](https://www.unitpost.com/guides/smtp/wordpress): WP Mail SMTP pointed at Unitpost instead of PHP mail().
- [Send Auth0 email over SMTP](https://www.unitpost.com/guides/smtp/auth0): Verification, welcome, and reset mail from your domain.
