You create the architecture of an email system by working top-down through five decisions in order: define the trust boundaries between your users and the public internet, split routing from storage, choose how mail is queued and delivered, design authentication and policy enforcement at the edges, and only then pick products and topology for each tier. The key condition is that the design must survive partial failure — a queue that fills, a relay that gets blocklisted, or a storage node that goes read-only — without losing accepted mail. If you start by shopping for servers instead of drawing those boundaries, you'll usually end up rebuilding the perimeter later.

This is a design guide, not a product recommendation list. It assumes you're planning a system for an organization, a product that sends notification mail, or a small provider — roughly thousands to millions of messages a day, not a hyperscale consumer mailbox service. The reference date is November 2026; protocol behavior below reflects standards that are stable (SMTP, submission, IMAP, DMARC), while product names are mentioned only as categories.

Start With Scope, Volume, and Trust Boundaries

Architecture questions collapse into requirements questions. Before drawing anything, write down four numbers and one sentence.

The numbers: expected outbound volume per day and at peak hour, expected inbound volume, average and 95th-percentile message size (including attachments), and your acceptable delivery latency. A transactional sender pushing 200,000 messages a day at a 30-second peak burst has a very different queue design than a company mail server handling 5,000 messages a day for 400 employees. The sentence is your trust model: "Mail from internal users is authenticated and rate-limited; mail from the internet is untrusted and filtered; mail from our application servers is authenticated by credential and restricted by envelope domain." That single sentence determines where firewalls, authentication checks, and rate limits live.

Two scope traps deserve early attention. First, "email system" can mean the transport (how mail moves) or the store (how mail is kept and read). Most real systems need both, but they scale and fail differently, so treat them as separate tiers from the start. Second, outbound and inbound are different problems: outbound is about reputation, authentication, and throughput; inbound is about filtering, storage, and retrieval. A design that shares one component for both usually creates a feedback loop where a spam flood on inbound starves outbound delivery.

As a worked estimate: if you expect 1 million outbound messages a day with an average size of 60 KB, that's about 60 GB per day of spooled data if you queue everything before delivery, and roughly 1.8 TB per month of archive if you retain sent mail. Queue retention of three to five days at peak-hour multiples sets your disk sizing. Write these figures down; they'll reappear when you size the queue tier.

Draw the Five-Layer Reference Model

A durable email architecture separates five responsibilities. You can implement them in one process or ten, but the boundaries should exist on paper.

  1. Edge and ingress. This layer accepts connections from the internet (port 25 for inbound mail) and from authenticated internal clients (submission, usually ports 587 or 465). It terminates TLS, applies connection-level rate limits and blocklists, and decides which internal handler gets the message.

  2. Routing and policy. Here you resolve the envelope recipient domain, apply per-domain rules (relay to a smart host, deliver locally, reject unknown domains), enforce authentication results, and stamp headers. This is where DMARC evaluation and spam verdicts attach to the message.

  3. Queue and transport. The message is written to durable storage, then a delivery agent attempts handoff to the next hop — a local mailbox store or a remote MX. Retries, backoff schedules, bounce generation, and per-destination concurrency limits live here.

  4. Storage and mailbox access. Mailboxes persist messages and expose them via IMAP, POP3, or a web/API layer. Indexing, quota enforcement, and retention policies are part of this tier, not an afterthought.

  5. Supporting services. Authentication (user directory, submission credentials), DNS (MX, SPF, DKIM, DMARC records), monitoring, logging, and the outbound reputation feedback loop.

A useful check: for each layer, name the component that owns it and the interface it exposes. If you can't name both, the layer is a gap. In a small deployment, layers 1–3 may be a single mail transfer agent (MTA) such as Postfix or Exim, with layer 4 handled by Dovecot. In a larger one, layer 3 becomes a dedicated queue fleet and layer 4 shards across storage nodes.

Separate Inbound, Outbound, and Submission Paths

The most common architectural error is a single undifferentiated flow. Three paths should be distinct from the edge inward.

Inbound path: internet → MX edge (port 25) → filtering and policy → local delivery or relay. The MX edge should never accept authenticated user submission, and it should never relay to arbitrary destinations. Its only jobs are to accept mail for domains it's responsible for, filter it, and hand it to routing.

Submission path: authenticated users and application servers → submission listener (587/465, TLS and credentials required) → policy (sender authorization, rate limits, size limits) → queue → outbound. The critical design rule is that submission listeners require authentication, while port 25 listeners do not and must not be reachable from untrusted networks with relay permissions. If you skip that rule, you've built an open relay and will discover it via blocklisting.

Outbound path: queue → outbound delivery agents → destination MX, with retry and bounce handling. This path is where reputation management lives: per-domain DKIM signing, envelope alignment, and feedback loops for complaints.

Why separate them physically or at least logically? Failure isolation and policy clarity. An inbound spam storm shouldn't consume submission worker slots, and an outbound queue jammed by one destination's greylisting shouldn't delay inbound delivery. Separate queues per destination domain also prevent head-of-line blocking — a common failure where one slow recipient domain stalls messages to everyone else.

Design the Queue and Delivery Mechanism

The queue is the heart of reliability. Everything upstream of it can be stateless; the queue is where durability is promised. Design it around three properties.

Durability before acknowledgment. The SMTP rule is that a 250 response after the DATA phase commits you to delivery attempts. In practice: write the message to durable storage (filesystem with fsync, or a database with synchronous commit) before returning success, or accept the risk of losing mail on crash. Most MTAs spool to disk in a maildir-style queue and acknowledge after write. If you build a custom component, make the write-then-acknowledge ordering explicit in code review.

Retry with bounded backoff. A standard approach is retrying temporary failures (4xx responses, connection timeouts) with increasing intervals — commonly minutes, then tens of minutes, then hours — and giving up after a configured window (often 3–5 days) with a bounce to the sender. Bound the total queue lifetime; an unbounded queue becomes a disk-filling liability. Also cap per-destination concurrency and per-sender rate so one domain can't monopolize workers.

Bounce and delay handling. Generate delivery status notifications (DSNs) for permanent failures and final timeouts. Track per-destination failure rates; a sudden spike in 5xx responses from one domain often means your sending IP or domain reputation changed, which is a signal for the outbound reputation loop rather than a transport bug.

For sizing, estimate queue depth as peak-hour volume multiplied by your retry window in hours, times a safety factor. At 50,000 messages per peak hour and a 72-hour retry window, that's up to 3.6 million queued messages in the worst case — a number that argues for sharded queue storage and per-shard workers rather than one gigantic spool directory.

Place Authentication at the Edges

Email authentication isn't a single checkbox; it's three mechanisms at different points in the flow, plus one reporting mechanism.

SPF authorizes sending IPs for a domain and is checked by the receiving edge against the SMTP connection's IP. It breaks on forwarding, so treat SPF as a coarse gate, not a verdict.

DKIM signs messages cryptographically with a domain key published in DNS. Sign at the point where the message leaves your control — the outbound path — after any header rewriting (footers, subject tagging) is complete. Signing before a component modifies the body invalidates the signature.

DMARC ties SPF and DKIM to the From domain and tells receivers what to do when both fail (none, quarantine, reject), plus where to send aggregate reports. Publish a policy record for every sending domain, and consume the aggregate reports; they're how you find unauthorized senders and misconfigured applications.

Architecturally, this means: the inbound edge evaluates SPF and DKIM and attaches results as headers; policy layer applies DMARC; outbound path signs everything it emits and enforces alignment between the envelope and header From domains. Keep the signing keys in a controlled store with rotation procedures, and log which key signed which message. A common failure is an application server injecting mail through a path that bypasses signing, producing a stream of unaligned messages that damages domain reputation.

Store Mailboxes and Expose Access

Storage design choices determine user experience and operational cost more than any other tier.

Format and layout. Maildir-style one-file-per-message storage is simple, crash-tolerant, and easy to back up incrementally; it struggles with very large folders and cross-folder search. Database-backed stores (index plus blob) scale better for search and quotas but need careful transaction design. Many systems use a hybrid: metadata and indexes in a database, message bodies in object storage or files, with references between them.

Access protocols. IMAP remains the standard for client sync and supports server-side search and flags; POP3 is a download-and-delete niche; a web or HTTP API layer serves your own clients and integrations. Whichever you choose, define concurrency limits per mailbox and per connection, because sync storms after an outage are a classic capacity event.

Quotas, retention, and deletion. Decide per-mailbox quotas, retention for trash and spam, and legal-hold behavior before launch. Deletion semantics matter: soft delete with a recovery window is friendlier than immediate purge, but it multiplies storage. Account for index size — typically a meaningful fraction of message volume — in capacity planning.

Backup and restore. Backups must be restorable per mailbox, not just per volume, and restore time is part of your recovery objective. Test a mailbox-level restore before you need it.

Handle Scale, Filtering, and Failure Modes

At scale, filtering and failure handling become architectural, not operational, concerns.

Filtering pipeline. Inbound mail passes a sequence: connection checks (blocklists, rate limits), authentication evaluation, content analysis (spam scoring, malware scanning in a sandbox or scanner service), then policy actions (deliver, quarantine, reject). Keep each stage independently scalable and make the verdict auditable — store why a message was quarantined. Run attachment scanning out-of-band when possible so large attachments don't stall the SMTP session.

Sharding and isolation. Shard mailboxes by user or domain so one noisy tenant doesn't degrade others. Isolate queues per destination domain and per customer. Use separate fleets for inbound and outbound so each scales on its own signal.

Named failure modes to design against. Open relay: port 25 reachable with relay permissions. Check by attempting an unauthenticated relay from an external network; a 550 rejection is the expected result. Queue disk exhaustion: unbounded retries fill the spool. Mitigate with lifetime caps and alerting at 70% queue-disk usage. Backscatter: bounces sent to forged senders. Mitigate by rejecting at SMTP time during the session where possible instead of accepting-then-bouncing. Reputation collapse: one compromised application credential sends spam and your domain lands on blocklists. Mitigate with per-application credentials, rate limits, and DMARC reporting. Thundering-herd reconnects: after an outage, all clients reconnect at once. Mitigate with jittered retry guidance and connection limits.

Observability. Instrument per-stage counters (accepted, rejected, queued, delivered, deferred, bounced), queue depth by destination, delivery latency percentiles, and authentication pass rates. These are the signals that tell you which layer is failing.

Validate the Design Before You Build

You can check most of an email architecture on paper and with a test harness before committing to a build.

Prerequisite: a written scope statement (volume, paths, trust model) and the layer diagram with named owners per layer.

1: Walk the three paths end to end. For inbound, submission, and outbound, list every component a message touches and the interface between each pair. Any path that touches the same listener with the same permissions as another is a design defect. 2: Run the open-relay check. From an external network, attempt to relay a message to an unrelated domain through your port 25 listener without authentication. Expected result: rejection at RCPT time. If it's accepted, stop and fix the listener policy before anything else. 3: Verify authentication alignment. Send a test message through the submission path and inspect the received headers at a test inbox: SPF pass, DKIM pass with the expected selector and domain, DMARC pass with alignment. Repeat for a message injected by each application integration. 4: Force a queue failure. Stop the downstream delivery agent and send a batch of test messages. Confirm they spool durably, retries occur with increasing intervals, and queue depth alerts fire. Restart and confirm delivery resumes without duplicates. 5: Test a destination-domain stall. Point one queue worker at a non-responsive test MX and confirm other destinations continue delivering. This verifies per-destination isolation. 6: Restore one mailbox from backup. Time it and confirm message flags, folders, and attachments survive. 7: Review key and credential custody. Confirm DKIM private keys are accessible only to the signing component and that submission credentials are per-application, rotatable, and logged.

Success criteria: all three paths pass their checks, no unauthenticated relay is possible, queue depth alarms trigger before disk pressure, and a single mailbox restore completes within your recovery objective. Stop condition: if authentication alignment fails on an application path you don't control, or if you cannot make the relay check fail closed, bring in a messaging or security specialist before proceeding — these are perimeter defects that compound with volume.

Frequently Asked Questions

Can I run the whole thing as one MTA plus one storage service? For a few hundred users and modest volume, yes — a single MTA handling inbound, submission, and outbound, plus a mail store, is a legitimate architecture if the listeners are configured with distinct policies. The five-layer model still applies; you've just collapsed layers onto fewer processes. Revisit the split when queue jams or filtering load start affecting submission latency.

Where should spam filtering sit if I use a cloud filtering service? Change the MX records to point at the filtering provider, which then relays clean mail to your inbound edge. That moves the connection-level filtering outward but keeps authentication evaluation and local policy with you. Keep the ability to bypass the provider for troubleshooting, and make sure the provider's relay is authenticated so your edge doesn't accept mail from anyone claiming to be it.

How do I handle outbound mail from multiple applications without sharing credentials? Issue a distinct submission credential per application, restrict each to its own envelope sender domain, apply per-credential rate limits, and log the credential identity on every queued message. When one application misbehaves, you can throttle or revoke it without touching the others, and DMARC reports will show you which stream is unaligned.

Does IPv6 change the architecture? It changes edge configuration more than design: publish AAAA records for MX hosts, ensure your edge listens and rate-limits on IPv6, and confirm outbound reputation is tracked per address family — blocklists and reputation systems can treat IPv4 and IPv6 sending separately. Test both families on the open-relay and authentication checks.