Skip to content

Reference implementation on AWS

Every AWS service Mail uses in Sypnia Cloud, and how.

Applies to Cloud
View as Markdown
On this page
  1. Region
  2. Mailboxes
Figure. Sypnia Mail on AWS: the API and the relay, the sender, SES and the event path back.
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.

ServiceUsed for
Amazon SESsending (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 → SQSSES events (delivery, bounce, complaint, open, click) into a queue the event receiver reads, with a dead-letter queue
Lambdathe API, the sender (triggered every few seconds and by new e-mails), the event receiver, the webhook dispatcher, the inbound parser
ECS Fargate + NLBthe SMTP relay on ports 587 and 465
CloudFrontmail.api.sypnia.com and the tracking links
RDS for PostgreSQLthe sypnia_mail schema, including the mailbox store: inboxes, conversations, messages, folders, labels and search
S3bodies, attachments and raw inbound messages, with lifecycle rules for retention, encrypted with KMS
EventBridge Schedulerscheduled e-mails and the daily warm-up step
KMSencryption of storage and of webhook secrets
CloudWatchmetrics, 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.

  1. Region
  2. Mailboxes

    Search pages, sections and terms