System Design: Disposable Email Service with Expiring Inboxes
Context
Design a production-grade disposable/temporary email service for web/mobile clients. Anonymous users can create randomized inbox addresses that auto-expire after a configurable TTL (e.g., 10–60 minutes). The service must receive messages via SMTP (including attachments) and expose a simple UI/API to view messages before expiry.
Requirements
Design the system to cover:
-
High-level architecture
-
DNS/MX records and Mail Transfer Agent (MTA)
-
SMTP ingress and acceptance policy
-
Message pipeline (parsing, scanning, storage)
-
Storage layers (metadata and blobs)
-
Data model and indexing for inboxes, messages, attachments
-
Address generation, TTL, and cleanup/GC
-
Spam filtering and abuse controls
-
Rate limiting, blocklists, greylisting, CAPTCHAs/PoW
-
Attachment handling and size limits
-
Privacy and data retention policies
-
Multi-tenant domains (e.g., multiple receiving domains/brands)
-
Observability (metrics, logs, tracing, SLOs)
-
Scaling and cost considerations
-
Key APIs
-
Create/refresh inbox, fetch messages/attachments
-
Consistency and durability trade-offs
-
Mitigations for hot inboxes and denial-of-service attacks
State assumptions if needed and justify key trade-offs.