Most modern mail tooling is two binaries with a UI on top

·2 min read ·#postfix#smtp#imap#linux#email

Recently I configured a multi-tenant mail server from scratch for OmniDimension. It now handles 200k+ emails a day in production.

What’s wild about Postfix: it was written at IBM in 1998 by Wietse Venema, who still maintains it today, now at Google. Twenty-eight years on, it ships with every Linux distro, is the default MTA on macOS Server, and is still the standard for serious mail infrastructure. The latest stable shipped a couple of days ago.

Architecturally it’s beautiful. More than twenty small daemons cooperating as a pipeline, each with one narrow responsibility: SMTP intake, queue management, address rewriting, local delivery, and so on. Most run with reduced privileges, shut down when idle, and get auto-restarted by a master process on failure. Pure Unix philosophy applied to mail. I picked it because it was the obvious tool. Turns out that’s the same reason everyone else does.

The stack#

Outbound is the easy half. AWS SES handles warm IPs, DKIM signing, deliverability, the whole bulk-sender stack. Publish a few DNS records and you’re sending.

Inbound is where the real work was. Two open-source daemons, each doing one job:

  • Postfix sits on port 25 accepting SMTP from the internet. When Gmail replies to one of our campaigns, it hits our box. Postfix matches the recipient to a customer domain, then writes the email as a file to that customer’s mailbox on disk.
  • Dovecot sits on port 143 serving IMAP. It doesn’t receive mail. It just reads the files Postfix wrote and exposes them cleanly to anything that wants to read the mailbox.

Our backend connects to Dovecot, pulls new replies, threads them back to the original campaign, and triggers downstream workflows. Multi-tenant from day one: per-domain virtual mailboxes, catch-all routing, isolated maildirs per customer.

What it taught me#

The genuinely new thing for me was understanding how mail delivery works at a lower level. SMTP hands the message off on port 25, the MTA writes it to disk, and IMAP picks it up from there. Two separate protocols, glued together by the filesystem.

The other thing that hit me: most “modern” mail tooling is really just these two binaries with a UI bolted on top. And running your own mail server is far less intimidating than you’d think.

You can read more about the Postfix architecture in its overview. Thank you, Wietse Venema, for building it.


This started as a post on LinkedIn.