Messaging & realtime
Transactional email - the receiver decides
Why getting an email into the inbox is a negotiation with a receiver whose rules you cannot see.
The first act plays here. Owned once with credits, never a subscription.
What this board gets wrong on purpose
The tension
The three records that decide whether any of this works - SPF, DKIM and DMARC - live in DNS, which has no canary, no test, no rollback and no alarm attached to it. A rotated DKIM key or an SPF include that quietly exceeded ten lookups breaks one hundred per cent of sending with a green build and a silent pipeline, and the first signal is a complaint rate three days later. The board makes it worse in two ways it draws honestly: marketing and transactional mail share one IP pool, so a campaign that crosses Gmail's 0.1% complaint threshold throttles the password resets too; and the suppression list, the only brake on that, is fed by an asynchronous feedback loop that is lossy by design - a complaint we never receive is an address we keep mailing.
Practise this as an interview
Take Transactional email - the receiver decides as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.
Start here
Why this design
Sending email is a queue and a retry loop; getting it into an inbox is a negotiation with a receiver that decides on rules it does not publish. Interviewers use this system to see whether you treat deliverability - authentication in DNS, suppression, IP reputation, bounce and complaint handling - as architecture rather than ops trivia. Real teams learn it the hard way: a forgotten SPF include or a marketing campaign over Gmail’s 0.1% complaint threshold stops the password resets with every dashboard green.
What you will learn
- Why the suppression check happens before the queue, fails closed, and is the one table you can never prune or lose.
- How SPF, DKIM and DMARC work together, why they live in DNS outside any deploy pipeline, and how to rotate a DKIM key without a gap.
- Why 4xx and 5xx must be handled differently: capped, jittered backoff bounded by a bounce deadline versus immediate permanent suppression.
- Why IP warm-up and reputation are per (IP, receiving domain), and why sharing one pool between marketing and transactional mail is a mistake.
- How 40M emails a day comes to only about 500 sends/s on average with a scheduled 6x campaign peak - and why storing template version plus variables instead of rendered HTML saves 113x storage.
- How bounces, ARF complaints and DMARC aggregate reports flow back, asynchronously and lossily, to close the loop.
How to read this board
- Diagram, top row left to right, one message going out: COMPOSE · WHAT WE MAY SEND, AND TO WHOM (render, classify, suppression check), then QUEUE AND SIGN (send queue, DKIM signer, deferred queue).
- Then OUT · OUR PART ENDS AT THE HANDSHAKE (MTA pool per domain, sending IPs, DNS records) and SOMEBODY ELSE'S RULES (the receiving MTA and the recipient).
- Then the bottom band, WHAT COMES BACK · HOURS TO DAYS LATER, read right to left: DMARC reports, bounces and complaints, the event stream, and the wire back into the suppression list. Press play for the eight-step walkthrough.
- Page 1 · Requirements - the questions to ask first (streams, domains, bounce deadline) and the latency, complaint-rate and no-silent-loss targets.
- Pages 2 and 3 · Capacity and Storage - 463 sends/s average, a 2,918/s campaign peak, 25% complaint-rate headroom, and the 400 B versus 45 KB body decision.
- Page 4 · Availability - DNS as the single point of failure, the suppression list failing closed, and why inbox placement has no SLA.
- Page 5 · How it works - one message from API to inbox and back; Page 6 · Deployment - regions, DNS changes as a ritual, rollback by cache expiry.
- Finally the DATA MODEL at the bottom: five tables, and why the 72 GB suppressions table is the irreplaceable one.
1 · Requirements
Ask these before drawing anything
- Transactional only, or marketing too? If both, the first real design decision is whether they share IPs, and the honest answer is that they must not.
- Do we own the sending domain, or are we sending on behalf of customers? Customer domains mean per-customer DKIM keys, per-customer DNS instructions, and a support burden bigger than the system.
- What is the latency promise? A password reset in 10 seconds and a weekly digest are different systems sharing a queue at their peril.
- Do we store the rendered body? It is the difference between 16 GB a day and 1.8 TB a day - see the storage page.
- What is the bounce deadline: how long may a deferred message keep retrying before delivering it is worse than dropping it? A password reset landing four hours late is a security event.
- Are we required to track opens and clicks? Pixel tracking is a second traffic pattern, a privacy question, and increasingly a lie - Apple Mail Privacy Protection preloads images and fabricates opens.
- Who owns unsubscribe, and does it apply across streams? A one-click unsubscribe from marketing must not stop a receipt.
- What is the compliance retention on message content and on consent records? They are different answers and both belong in the schema.
Functional
- Accept a send request, render a versioned per-locale template, and deliver it.
- Never send to a suppressed address, and check that before queueing.
- Sign every message with DKIM and send from an IP whose SPF and DMARC alignment is correct.
- Retry 4xx deferrals with capped exponential backoff; never retry a 5xx.
- Process DSN bounces, ARF complaints and feedback-loop reports, and suppress accordingly.
- Warm new IPs gradually, per receiving domain.
- Record every outcome per message, per attempt.
- Ingest DMARC aggregate reports and surface authentication failures.
Non-functional
- Transactional: p95 accept-to-first-SMTP-attempt under 5 seconds.
- Marketing: a 20M-recipient campaign fully handed over within 2 hours.
- 99.95% availability for accepting a send. Delivery to the inbox is not an availability target and cannot be one.
- Exactly-once semantics at the address level via an idempotency key - a duplicated password reset is a security problem, not an annoyance.
- Complaint rate below 0.1% per receiving domain, which is a hard architectural constraint, not a marketing KPI: above it, Gmail throttles everything from the IP.
- No message is lost silently. Every message reaches a terminal state and that state is recorded.
Out of scope
- Inbound mail, parsing and threading - a different system entirely.
- Campaign composition, audience selection and A/B assignment.
- The MTA software itself; assume a hardened off-the-shelf one.
The rest of this board
Available on Tier Slate
This page publishes the question. The answer — 5 more written pages, an 8-step narrated walkthrough and a 5-table schema — is the board itself, and it opens in Tierslate.
- 5written pages
- 8walkthrough steps
- 5tables35 columns
5 pages behind this one
- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan