Menu

I built a disposable email service that runs on one Node.js file — no npm dependencies
📰

I built a disposable email service that runs on one Node.js file — no npm dependencies

DEV Community: node·Brown Connie·2 days ago
#dwLzG6ky
#devtonodejs#devto#dev#smtp#mail
Reading 0:00
15s threshold

Most "temp mail" sites are ad farms. I wanted one I could own, so I built it: a disposable inbox service where the entire server is a single Node.js file with zero npm dependencies.

Demo: https://howtageek.com

The constraint

I set one rule: no dependencies. No Express, no SMTP library, no ORM, no dotenv. Node 22 ships node:sqlite and node:net — that covers storage and SMTP. Everything else is the standard library.

That leaves three jobs:

Receive mail. An SMTP server on port 2527 speaking just enough of RFC 5321 to accept a message.

Parse it. MIME multipart, base64/quoted-printable bodies, headers that wrap across lines.

Store and serve it. SQLite for the inbox, server-rendered HTML for the UI, a sliding TTL that deletes expired messages.

The SMTP bit

The protocol is simpler than it looks. A session is a sequence of line-based commands:

EHLO client MAIL FROM : < sender @ example . com > RCPT TO : < random @ yourdomain . com > DATA . . . message bytes . . . .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.