Database Schema
MailPort uses three tables (collections in MongoDB). They are created automatically on first request — no manual migration needed.
Field names are identical across databases; the snake_case names below are the relational form.
senders — senders
Each row is an independent sending channel with its own endpoint, keys, and recipient domain allowlist.
Index: unique index on pid.
Upgrade note: the 8 columns added after v0.1.0 (
http_*/oauth_*) are added automatically when the app starts — existing databases need no manual migration.
sender_keys — sender API keys
A sender may hold multiple 32-char keys, each independently enabled, disabled, or revoked.
Index: sender_id.
send_logs — send logs
Every endpoint call is recorded, success or failure.
Indexes: (sender_id, created_at DESC) compound, status.
Differences by database
For MongoDB, deleting a sender also removes its keys and logs in the same operation, since MongoDB has no foreign keys.
Security notes
- SMTP passwords, OAuth client secrets / refresh tokens, and API keys are stored as
v1:-prefixed AES-256-GCM ciphertext. MAILPORT_SECRETis the only decryption path and is never written to the database or logs.- The log table never records message bodies or plaintext keys.
- The health endpoint reports only presence of configuration, never any credentials.