---
title: "Send email from Express over SMTP"
description: "Nodemailer from an Express route."
url: https://www.unitpost.com/guides/smtp/express
section: SMTP
updated: 2026-08-28
---
# Send email from Express 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 from Express over SMTP

> Nodemailer from an Express route.

Send from an Express route with Nodemailer pointed at Unitpost. Keep the key in env, not in the repo.

### 1. Install Nodemailer

```bash
npm install nodemailer
```

### 2. Send from a route

```javascript
import express from "express";
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,
  },
});

const app = express();
app.post("/send", async (_req, res) => {
  await transporter.sendMail({
    from: "you@yourdomain.com",
    to: "customer@example.com",
    subject: "Hello from Express",
    html: "<p>Sent via SMTP.</p>",
  });
  res.json({ ok: true });
});
```

### 3. Verify delivery

Confirm in Activity.

## Related

- [Send email from Python over SMTP](https://www.unitpost.com/guides/smtp/python): stdlib smtplib — no framework required.
- [Send email from Flask over SMTP](https://www.unitpost.com/guides/smtp/flask): Flask-Mail pointed at Unitpost.
- [Send email from FastAPI over SMTP](https://www.unitpost.com/guides/smtp/fastapi): smtplib from a FastAPI dependency.
