Running a self-hosted email server across 12 domains for a media company — the architecture, challenges, and why I'd do it again.
When I joined Prachyam Studios as the primary technical hire, the company was running Google Workspace across multiple domains. Twelve domains, a growing team, per-user-per-domain pricing. The cost was climbing and the control was minimal — when something broke, the debugging surface was a web dashboard.
I proposed Mailcow: a Docker-based mail server with a full admin UI, Rspamd for spam filtering, ClamAV for attachment scanning, and DKIM/DMARC/SPF baked into the setup. The migration was a real project — not a weekend task — but the savings were immediate and the operational knowledge was the kind you can't buy from a managed service.
Six RackNerd VPS servers, twelve custom sending domains, Mailcow running as a Docker Compose stack on each server. One server handled inbound MX and IMAP for the team. A separate outbound relay handled bulk sends. The split matters: you never want your marketing IP reputation bleeding into the deliverability of transactional mail.
Each domain got its own DKIM key, SPF record, and DMARC policy. The DNS provisioning was scripted — given a domain name, the script outputs the full set of records to publish. That script saved a lot of manual work when adding the third, fourth, and fifth domains to the stack.
The monitoring layer was Rspamd's web interface plus a custom Grafana dashboard reading from Postfix logs and DMARC aggregate reports. DMARC reports are ZIP-compressed XML files that Gmail, Microsoft, and Yahoo send to the address in your _dmarc record. I wrote a ~400-line Rust parser that ingested these into SQLite and rendered pass/fail rates per IP per day in Grafana. When a new IP started failing DMARC alignment, I could see it within 24 hours and fix it before deliverability degraded.
About ~20 million emails processed across all domains and campaigns. 99.9% uptime — the only downtime was planned maintenance windows. Zero IP blacklistings across the entire period. Zero successful spam or phishing incidents that reached inboxes. Total VPS cost: approximately ₹14,000/year (~$151) for six servers and twelve domains. The Mailchimp alternative for the same marketing volume would have been a custom enterprise quote — my estimate puts it around ₹2.78cr (~$300k), medium confidence given the dataset sat well above Mailchimp's published contact caps.
The math drove the decision. The operational knowledge was the unexpected dividend.
There's no managed service that gives you the debugging surface you get from running Postfix directly. When a user reports that a password reset email didn't arrive, I can trace the exact path of that message — Postfix queue, delivery attempt, bounce processing — in under five minutes. With a managed service, you're reading dashboard summaries and opening support tickets.
The race-condition bug that caused transactional emails to sit in queue for over an hour behind bulk marketing sends — that's documented in detail in Mailcow Deep Dive #3. The DMARC alignment failure that had SPF and DKIM both passing while DMARC failed — that's in Deep Dive #2. Both of those were debugging sessions you only get to have when you own the stack.
Yes, with different timing. The right time to build your own mail stack is before you're under delivery pressure. Set it up when volume is low, let the IP reputation mature, understand the failure modes in a low-stakes environment. By the time you need to send at volume, the infrastructure should be boring.
The wrong time is when someone asks "when can we send the first campaign?" and you're still configuring DKIM.
Email is the oldest production protocol most engineers have never had to understand. Understanding it — not at the "I enabled SPF" level but at the "I know why this specific email is being deferred and what to do about it" level — makes you better at debugging any system where authentication and trust are on the line.
Karanveer Singh Shaktawat
Full Stack Engineer & Infrastructure Architect
I build production systems across web, mobile, and infrastructure — then document what went wrong and why.
Pick what you want to hear about — I'll only email when it's worth it.
Did this resonate?
The full story of building a self-hosted email stack across 12 domains and 6 servers at Prachyam Studios — the architecture, the hard lessons, and why I'd do it again.
How a bulk marketing campaign starved transactional email at Prachyam Studios — and how I fixed it by understanding Postfix queue internals and building a priority queue on top of Mailcow.
Self-hosting is not about being cheap or contrarian. It's about understanding your stack, owning your data, and building a certain kind of engineering judgment that you can't get any other way.