A four-container Docker stack that filters spam in any IMAP mailbox that supports IDLE. Designed to run 24/7 unattended on Unraid; never deletes mail, only IMAP MOVE. GitHub: https://github.com/marcelverdult/imap-spamfilter License: MIT Image: ghcr.io/marcelverdult/imap-spamfilter:latest (linux/amd64, linux/arm64) WHAT IT DOES • Connects to each configured IMAP account via IDLE, scores incoming mail via rspamd (Bayes + RBL + SPF/DKIM/DMARC + neural) • Three per-account modes promoted manually: shadow (log only) → flag (sets \Flagged) → move (relocates to Junk) • Bayesian learning from explicit user actions: - Move Inbox → Junk = learn as spam - Move Junk → Inbox = learn as ham - Copy known-good mail into Junk/Train-Ham = bulk ham training - Drop spam into Junk/Train-Spam = bulk spam training • Per-account Bayes namespaces, or pooled across mailboxes via shared bayes_user • Rate-limited, self-recovering safe mode, auto-restarting account threads, exponential backoff • Auto-detects junk/trash via RFC 6154 SPECIAL-USE, refuses to create core folders to avoid duplicate hierarchies • SQLite WAL state DB with periodic pruning; weekly VACUUM • Audit trail of every scan/move/learn decision in the events table FOUR CONTAINERS • spamfilter — the custom Python service (this repo) • spamfilter-rspamd — rspamd/rspamd:latest, scoring + Bayes • spamfilter-redis — redis:8-alpine, Bayes tokens + rate-limit state (AOF + RDB, capped 1 GB, noeviction) • spamfilter-unbound — mvance/unbound:latest, local DNS resolver for RBLs (avoids upstream rate-limits) All four communicate over a private spamnet docker network. INSTALL (manual until CA accepts) 1. SSH into Unraid and run the bootstrap once to lay down appdata + the rspamd controller password: curl -fsSL https://raw.githubusercontent.com/marcelverdult/imap-spamfilter/main/unraid/bootstrap.sh | bash 2. Docker tab → Add Container → paste each template URL below in turn. Apply. https://raw.githubusercontent.com/marcelverdult/imap-spamfilter/main/unraid/spamfilter-redis.xml https://raw.githubusercontent.com/marcelverdult/imap-spamfilter/main/unraid/spamfilter-unbound.xml https://raw.githubusercontent.com/marcelverdult/imap-spamfilter/main/unraid/spamfilter-rspamd.xml https://raw.githubusercontent.com/marcelverdult/imap-spamfilter/main/unraid/spamfilter.xml 3. Edit /mnt/user/appdata/spamfilter/accounts.yml with IMAP credentials. 4. Start spamfilter container. REQUESTING CA INCLUSION CA submission tracked at https://github.com/Squidly271/AppFeed/issues/31. Happy to address any feedback for inclusion. KEY DOCS • README: https://github.com/marcelverdult/imap-spamfilter#readme • Folder discovery + manual override: README "Folder discovery and naming" • Bayes pooling across accounts: README "Bayes identity" • Backups: works with KluthR's Appdata Backup plugin