I Rebuilt Our Email Infrastructure From Scratch — Here's What It Cost
We moved off SendGrid and Mailgun and built our own outbound stack on bare-metal Hetzner. The honest accounting of what it took.
Last year we ripped out our entire email service provider stack and replaced it with self-hosted Postfix on Hetzner bare metal. I want to tell you why we did it, what it actually cost, and whether you should consider the same move.
Short answer: probably not. Read on for why we did it anyway.
Why we left the ESPs
Email is core to what we do. Happierleads identifies anonymous website visitors, and the way most of our customers engage those visitors is by sending them email. If our email sending breaks, our product breaks. We needed end-to-end control over the deliverability stack.
ESPs are fine until they aren't. Shared IPs mean your reputation is downstream of every other tenant on the same pool. Throttle rules change without notice. Account suspensions happen with no appeal process. We had a 36-hour outage one Tuesday because someone else in our sender tier got blacklisted. Our customers didn't care whose fault it was. They cared that their meetings didn't book that day.
That outage was the call. I started building the replacement that weekend.
What we built
Five separate Postfix instances on a single Hetzner bare-metal box, each bound to its own IP. Dovecot for IMAP. A small Node.js control plane I wrote on top of it to manage domain provisioning, DKIM rotation, and per-mailbox warmup. Self-heal scripts that run every five minutes and reconcile the configured state with reality. Fail2ban. Custom monitoring.
Roughly 4,000 lines of code I'd never written before. I knew enough Postfix to be dangerous and exactly zero about Dovecot. The whole thing was a lot of late nights reading mailing list archives from 2008.
The actual cost
Engineering time: about three months of my own evenings and weekends. Maybe 200 hours total. If I was paying market rate for someone to do this, call it $40,000.
Server costs: under $100/month for the bare-metal box, plus a few dollars per IP per month. Compare that to what we were paying ESPs at the same send volume — well into four figures monthly.
Ongoing maintenance: maybe 2-3 hours a week, more in the first six months. Less now that the self-heal scripts catch most issues automatically.
Risk surface: enormous. If our server goes down, no email goes out anywhere. If a domain gets blacklisted, we deal with the recovery ourselves. There's no support ticket to file.
What it actually unlocked
The cost savings are real but they're not the point. The point was control. We can now route specific customer segments through specific IPs based on reputation. We can rotate sender domains automatically when one shows warning signs. We can warm up new IPs on our own schedule. We can do things that no ESP would let us do at any price.
Our deliverability improved by single-digit percent. That doesn't sound like much. At our send volume, it's the difference between a campaign hitting its number and missing it.
Should you do this?
Almost certainly not.
If email is not your moat, this is a terrible use of founder time. There are far easier ways to make money than figuring out why your DKIM is breaking at 2am. ESPs exist because they solve a hard problem well enough for 99% of companies. Use them.
The only reason to build this yourself is if you're already sure email is mission-critical to your product, you have the technical chops in-house, and you can afford to lose a quarter of founder time getting it right.
For us, that math worked. For most companies reading this, it won't.
What I'd do differently
I'd start with Postfix and skip Dovecot for the first version. I'd write the self-heal scripts on day one instead of waiting for the first incident to force them. I'd buy more IPs from a different subnet earlier — having all your IPs in the same /24 turns out to be a single point of failure when one of them gets flagged. And I'd document the whole thing in real time. We had to reverse-engineer half of our own setup six months later.
If you're considering doing this, hit reply and I'll tell you what to read first. It's a small list. Mostly old.
Talk next week,
— George