Skip to content
SELF-HOSTED MAIL OPERATIONS

Self-Hosted Email Infrastructure

Twelve authenticated mailboxes on two domains and a private mail hub with one login, scheduled sending, folders and attachments.

Workflow diagram for the self-hosted email infrastructure: DNS and authentication, mail server, inboxes and restore testing
TECHNICAL REFERENCE
CURRENT SCOPE

Operating · second domain added November 12

WHO IT'S FOR

Independent build

Mail infrastructure for my own business domain. Integration and operations work on established open-source software; no new mail server was written.

THE ENGINEERING

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.

Docker MailserverRoundcubeCaddyCloudflare DNSPostfix / Dovecot

BEFORE → AFTER

Real problems from this build, what I changed and the verified result.

  1. CASE 01
    Before

    The domain had no MX record and no mailboxes: buying the domain had been mistaken for getting email.

    After

    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.

    How I fixed it

    Checked the real DNS inventory, then added MX, SPF, DKIM, DMARC and matching reverse DNS for a dedicated mail host.

  2. CASE 02
    Before

    A new mail stack on a shared server could break the applications already running there.

    After

    20 deployed files matched; all 17 existing proxy files and 64 unrelated containers stayed unchanged.

    How I fixed it

    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.

  3. CASE 03
    Before

    An open relay or cross-account sender would let anyone send mail as the domain.

    After

    A fresh external review passed 22 of 22 selected account, TLS, sender-identity, relay and size checks.

    How I fixed it

    Required TLS authentication, tied outgoing identity to the signed-in account and rejected relay and spoofed senders.

Evidence reviewed: Google Doc case study updated November 15, 2026; open gates stated above