How sexfrance/imap-server works
Cybertemp IMAP Server accepts standard IMAP clients, authenticates access, and serves mailbox operations and filtered email from PostgreSQL. The principal flow is connection handling → login and subscription validation → mailbox selection and command execution → email retrieval, filtering, and response. The README also documents inbox management and cached domain checks. Runtime logic is concentrated in src/main.rs; excerpts show PostgreSQL authentication/email queries, Supabase ban requests, and optional at-rest decryption. Other documented command wiring is not fully visible in the sampled source.
Main entry points: main.rs IMAP commands · schema.sql PostgreSQL · encryption.rs At-rest encryption
Components 16
IMAP runtime
- Connection listener
src/main.rs - Connection handler
src/main.rs - IMAP commands
src/main.rs
Access controls
- Token authentication
src/main.rs - Subscription check
src/main.rs - Domain validation
src/main.rs - Ban enforcement
src/main.rs - Domain cache
src/main.rs
Mailbox and mail
- Inbox management
src/main.rs - Email retrieval
src/main.rs - Email filtering
src/main.rs - MIME extraction
src/main.rs - At-rest encryption
src/encryption.rs
Other components
- IMAP client
- PostgreSQL
SQL/schema.sql - Supabase API
Connections 20
- IMAP client → Connection listener: connects
- Connection listener → Connection handler: spawns handler
- Connection handler → IMAP client: serves IMAP
- Connection handler → Token authentication: checks login
- Token authentication → PostgreSQL: queries tokens
- Token authentication → Subscription check: validates access
- Subscription check → PostgreSQL: reads user status
- Connection handler → IMAP commands: dispatches commands
- IMAP commands → Inbox management: manages mailboxes
- IMAP commands → Domain validation: checks domains
- Domain validation → Domain cache: uses cached domains
- Domain validation → Supabase API: fetches domains
- IMAP commands → Ban enforcement: checks bans
- Ban enforcement → Supabase API: queries bans
- Ban enforcement → PostgreSQL: uses local bans
- IMAP commands → Email retrieval: loads mailbox
- Email retrieval → PostgreSQL: reads emails
- Email retrieval → At-rest encryption: decrypts payloads
- IMAP commands → Email filtering: filters results
- IMAP commands → MIME extraction: extracts text