Linux Mail Server Architecture: SMTP, DNS and the Complete Message Path
Build the mental model needed to trace an email from DNS lookup and SMTP acceptance through policy, queue, mailbox delivery and retrieval.
21 ordered lessons that move from foundations into implementation, troubleshooting, architecture decisions, security, cost control, and operational readiness.
Build the mental model needed to trace an email from DNS lookup and SMTP acceptance through policy, queue, mailbox delivery and retrieval.
Install Postfix from approved repositories, establish configuration ownership, validate syntax, trace a local message and preserve a rollback checkpoint.
Turn the local Postfix baseline into a deliberately reachable SMTP endpoint with verified DNS, reverse DNS, firewall scope and SELinux evidence.
Build the shared identity data layer for virtual domains, users and aliases without embedding administrative database credentials in mail services.
Wire the virtual-mail database into Postfix and prove domain class, recipient existence and alias expansion before accepting Internet mail. The lesson treats empty results, lookup errors and ambiguous answers as different operational states.
Postfix must distinguish domains it owns, domains it relays for, and ordinary remote destinations before choosing a delivery transport.
The master daemon creates Postfix listeners and delivery processes; service overrides keep Internet SMTP separate from authenticated user submission.
Dovecot verifies mailbox credentials and maps virtual users to stable storage identities without creating a Linux account for every address.
TLS protects submission credentials in transit while SASL proves which account may relay; neither control replaces sender-identity authorization.
LMTP gives Postfix a per-recipient final-delivery result while Dovecot applies mailbox, quota and Sieve logic under the correct virtual identity.
DKIM signs selected outbound messages and verifies inbound signatures without claiming that a valid signature makes content safe.
SPF evaluates the connecting IP against the envelope MAIL FROM or HELO domain; it does not authenticate the visible From header.
DMARC evaluates alignment between visible From and authenticated SPF or DKIM domains, then applies the published domain policy and produces reporting data.
Authentication integration must preserve trusted result order, distinguish inbound verification from outbound signing and expose evidence without treating authentication as inbox placement. The integrated evidence includes HELO and envelope MAIL FROM results from the SPF policy service.
Filtering combines many weak signals into policy and invokes antivirus separately; it needs a quarantine and false-positive workflow, not only a reject score.
Header and body checks handle deterministic local policy but do not parse complex MIME as safely as a dedicated filtering engine.
Sieve performs server-side filing and vacation actions during Dovecot delivery; quota must return consistent SMTP and IMAP evidence.
The queue is durable work with distinct incoming, active, deferred, hold and corrupt states; operators must target exact messages rather than use broad deletion.
Mail monitoring connects acceptance, delay components, enhanced status, queue age and destination behavior instead of counting only sent and bounced messages.
A production mail server needs least privilege, relay and abuse controls, patching, secret rotation, backups, restore tests and monitoring across every daemon.
A mail migration succeeds when behavior, queue ownership, aliases, domains, routes, authentication and delivery are proven equivalent or deliberately changed with rollback.