loki-mailgate is the receiving half of the fleet email standard: one
public address per app on its own host (hello@<app host>), no mail server
or mailbox per app.
- Receive-only SMTP on :25 (smtp-server). Routes by apps.conf (Loki's live
copy, refreshed by every deploy, plus the one installed beside it), so a
new site gets mail after the next deploy with no step here. Accepts only
hello@, postmaster@ and abuse@; refuses everything else at SMTP time, so
it never bounces and cannot relay.
- SPF / DKIM / DMARC checked (mailauth); failures are marked, not dropped.
- Spooled to disk before "250", then POSTed to
http://127.0.0.1:<port>/api/mail/inbound signed with the fleet key
MAIL_INBOUND_SECRET (mail-kit 0.2 inbound contract), retried with backoff
until the app says 2xx. Delivered mail is pruned after 14 days: the app's
own retention governs its copy.
- Bundled to one file; a systemd unit with CAP_NET_BIND_SERVICE as ubuntu,
ProtectSystem=strict; install-mailgate.sh creates the secret and its own
STARTTLS key and opens 25/tcp; the manual Mailgate workflow tests,
bundles and installs. test:mailgate joins verify.
Checked end to end against the bundle: hello@skif accepted and delivered
with a valid signature; another mailbox and an unknown host refused 550.
Claude-Session: https://claude.ai/code/session_01TTH5cy8bKmEqzdTyAsbbT8
Co-authored-by: Claude <noreply@anthropic.com>