Reference implementation on AWS
Every AWS service Mail uses in Sypnia Cloud, and how.
Read this diagram as text
The API runs on Lambda behind CloudFront; the SMTP relay runs on ECS Fargate behind a Network Load Balancer, because SMTP needs long TCP connections. The sender and the event receiver are Lambda functions. Amazon SES sends and receives; its events go through SNS to SQS. Postgres on RDS holds the state and S3 holds bodies, attachments and raw inbound messages.
| Service | Used for |
|---|---|
| Amazon SES | sending (SendRawEmail), DKIM signing with Easy DKIM, a configuration set per domain, one tenant per customer (its own reputation and automatic pause), receipt rules for inbound and mailboxes, virus and spam verdicts |
| SNS → SQS | SES events (delivery, bounce, complaint, open, click) into a queue the event receiver reads, with a dead-letter queue |
| Lambda | the API, the sender (triggered every few seconds and by new e-mails), the event receiver, the webhook dispatcher, the inbound parser |
| ECS Fargate + NLB | the SMTP relay on ports 587 and 465 |
| CloudFront | mail.api.sypnia.com and the tracking links |
| RDS for PostgreSQL | the sypnia_mail schema, including the mailbox store: inboxes, conversations, messages, folders, labels and search |
| S3 | bodies, attachments and raw inbound messages, with lifecycle rules for retention, encrypted with KMS |
| EventBridge Scheduler | scheduled e-mails and the daily warm-up step |
| KMS | encryption of storage and of webhook secrets |
| CloudWatch | metrics, alarms on bounce and complaint rates per sending domain |
Region
Everything above runs in us-east-2 (Ohio), a region reserved for customers’ mail. Amazon SES counts reputation, reviews and pauses per account and per region, so customers’ sending can never pause Sypnia’s own e-mails, which go out from another region. us-east-2 was chosen because it offers SES sending, the SMTP interface, email receiving and tenant management, and it sits next to the rest of Sypnia Cloud in us-east-1. See Reputation for how each customer is isolated within the region.
Mailboxes
Mailboxes are built on the same pieces: SES receiving writes each message to S3, a Lambda parses it into the mailbox store in Postgres (with full-text search), and the webmail, the API and MCP read from there. Replies go out through the sender like any other e-mail. IMAP and SMTP submission for mail apps run on a mail server (Stalwart) on ECS next to the relay; the design decisions explain the trade-off.