Work Cloud & Systems
Self-Hosted Email Infrastructure
Twelve authenticated mailboxes on two domains and a private mail hub with one login, scheduled sending, folders and attachments.

What was built
A domain had been registered without any mailbox service. I set up five separate authenticated mailboxes with sending, receiving and HTTPS webmail on an existing virtual server, using Docker Mailserver (Postfix, Dovecot, Rspamd), Roundcube and Caddy, with Cloudflare DNS. The work added MX, SPF, DKIM, DMARC and matching reverse DNS, TLS-only submission and IMAP, relay and cross-account sender blocking, an encrypted off-server backup and an isolated five-account restore. Deployment matched 20 owned files while all 17 existing proxy files and 64 unrelated containers stayed unchanged. The October 21 review passed 22 of 22 external protocol, authentication and denial checks; 16 owner diagnostics passed SPF, DKIM and DMARC across three Gmail destinations, and all 25 later sends were reconciled against live Sent folders (23 accepted, 2 failed). On November 2 a sixth mailbox and a private web hub went live: one login with an authenticator code for all six, a Gmail-style folder list with search, replies from the receiving mailbox, sending at the recipient's local time with per-mailbox caps, a do-not-contact list, duplicate checks and one follow-up, up to 25 recipients and file attachments. The two hub releases passed 56 and then 98 tests with fresh reviews, matched their source file for file on the server, and an isolated restore of the hub database passed 14 of 14 checks. On November 12 a second domain was added with six more mailboxes, keeping the existing accounts, keys and hub jobs: all six passed IMAP and SMTP logins, one scheduled test from each reached an owner Gmail Inbox with SPF, DKIM and DMARC passing for the new domain, and an encrypted off-server copy of all twelve accounts was restored in isolation with every login and inbox count intact. It runs on a single host, so it is not highly available. External alerts, automatic off-server backups, image vulnerability scanning and full disaster recovery remain open; authentication results do not guarantee inbox placement.
Problems solved along the way
- Problem
- The domain had no MX record and no mailboxes: buying the domain had been mistaken for getting email.
- Fix
- Checked the real DNS inventory, then added MX, SPF, DKIM, DMARC and matching reverse DNS for a dedicated mail host.
- Result
- Twelve inboxes on two domains send and receive; the original five passed SPF, DKIM and DMARC at three Gmail destinations, the sixth reached the Inbox on November 2, and the six on the second domain did so on November 12.
- Problem
- A new mail stack on a shared server could break the applications already running there.
- Fix
- Picked a dedicated unused subnet after Docker's default address pools ran out, kept webmail behind the existing proxy and compared files and containers before and after.
- Result
- 20 deployed files matched; all 17 existing proxy files and 64 unrelated containers stayed unchanged.
- Problem
- An open relay or cross-account sender would let anyone send mail as the domain.
- Fix
- Required TLS authentication, tied outgoing identity to the signed-in account and rejected relay and spoofed senders.
- Result
- A fresh external review passed 22 of 22 selected account, TLS, sender-identity, relay and size checks.