DEV Community

Brown Connie
Brown Connie

Posted on

TempBox: A Self-Hosted Temp Mail Service in One File (~1k LOC)

Every few weeks someone on r/selfhosted asks for a lightweight temp-mail box. Most self-hosted options bring an entire mail stack with them (Postfix + Dovecot + a PHP UI, or a 12-container Docker compose).

TempBox takes the opposite approach: one file, ~1k lines of Node.js 22 - node:http + node:sqlite + a hand-rolled SMTP server. No dependencies, no framework, no ORM.

  • Every visit gets a real inbox for 10 minutes
  • Mail is delivered straight into SQLite and rendered in a sandboxed iframe
  • Runs behind any reverse proxy; SMTP on any port

Live demo: https://howtageek.com

The catch we hit (worth knowing if you self-host mail): Postfix validated every recipient against virtual_mailbox_table, so random addresses returned 550 user unknown - TempBox domains need to be relay-only, not virtual. Full write-up: https://howtageek.com/blog/receive-email-on-vps-without-mail-server

What would you add to a one-file mail toy?

Top comments (0)