Design an Email Service
MediumSystem design · Communication
Design an outbound email service used for transactional mail (password resets, receipts) and marketing campaigns. Scale: 50M messages/day with campaign bursts of thousands per second. Transactional mail must be attempted within seconds; campaigns can take hours. Cover accepting and rendering messages from templates, queues and per-recipient-domain sending, retries and bounces, suppression and unsubscribe handling, and protecting sender reputation. Inbound email and building a mail server from scratch are out of scope.
Requirements
- Separate transactional from bulk traffic so campaigns never delay a password reset
- Respect receiving providers' rate limits with per-destination-domain sending and backoff
- Handle soft and hard bounces and complaints, and honour suppression and unsubscribes
- Sending must be idempotent: a retried API call must not email the recipient twice