← Back to architecture

Email

cross-cutting backend service · mail delivery

The platform's post office: the single place that knows how to compose an email and send it over SMTP. Modules don't know about the mail server — they hand it “send an invite to so-and-so”, and the transport takes the settings, renders the template, and delivers.

Architecture

Production line — left to right
consumers
Invitationinvite
Password resetreset
Testtest
Security alertsv2alerts
Email
The platform's post office
composetemplate + language → MIME
senddelivery over SMTP
send_invite · send_password_reset · send_test
Inline synchronous · in-request
test only
timeout verdict right away
writes last_test_ok / last_test_at
Queue · SAQ asynchronous · background
invite · reset · bulk
retries · backoff throttling idempotency · job_id
the consumer responds instantly
SMTPaiosmtplib
inbox
smtp_settings
singleton in core, secret as ciphertext. Password — AES-256-GCM; transport readiness — the is_available() predicate. Data model.
the crypto core decrypts the password at send time; it also owns the flow mechanics.
the SMTP settings screen and the “Test connection” button — triggers inline.
the platform's shared worker (SAQ over Redis) runs the queue.
stack aiosmtplib SAQ Jinja2 email / MIME Pydantic Settings Mailpit · dev

Workzone Design

Detailed module design decisions.