You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Bayesian spam training (sa-learn) that is supposed to happen when users move messages to/from the Spam folder does not work. The dovecot-antispam plugin silently fails to intercept IMAP MOVE operations on Dovecot 2.3.x, which means sa-learn is never called for most users.
Root Cause
Mail-in-a-Box uses the dovecot-antispam plugin (configured in setup/spamassassin.sh) to trigger sa-learn when messages are moved to/from the Spam folder. This plugin was last updated in 2017 and was designed for Dovecot 2.2.x.
Dovecot 2.3.x (shipped with Ubuntu 22.04) added native support for the IMAP MOVE command (RFC 6851). Modern IMAP clients — including Thunderbird, Apple Mail, and most mobile clients — use MOVE rather than COPY + expunge. The dovecot-antispam plugin only hooks into COPY operations, so it never sees MOVE and never triggers sa-learn.
The plugin loads without errors and appears in doveconf -n, making the problem completely silent.
How to Reproduce
Move a message into the Spam folder using any modern IMAP client
Check sa-learn --dump magic — the nspam counter does not increment
Instead, copy (not move) a message to Spam (e.g. Ctrl+drag)
Check sa-learn --dump magic again — the counter does increment
This confirms the plugin works for COPY but not MOVE.
Impact
Bayesian spam training is effectively non-functional for all MIAB users who use IMAP clients that default to MOVE (which is virtually all modern clients). The shared Bayes database never learns from user actions, so spam filtering does not improve over time.
This also affects #2560, which identified additional problems with the antispam setup but did not identify this as the primary cause.
Proposed Fix
Replace the deprecated dovecot-antispam plugin with IMAPSieve, which is Dovecot's officially supported replacement (documentation). IMAPSieve properly intercepts both COPY and MOVE operations and is actively maintained.
This would involve:
Removing dovecot-antispam from apt_install in setup/spamassassin.sh
Removing the 99-local-spampd.conf antispam plugin config
Removing the sed lines that enable the antispam plugin in 20-imap.conf / 20-pop3.conf
Adding IMAPSieve configuration: imap_sieve plugin, sieve scripts for report-spam/report-ham, and shell wrappers that call sa-learn
Summary
The Bayesian spam training (sa-learn) that is supposed to happen when users move messages to/from the Spam folder does not work. The
dovecot-antispamplugin silently fails to intercept IMAP MOVE operations on Dovecot 2.3.x, which meanssa-learnis never called for most users.Root Cause
Mail-in-a-Box uses the
dovecot-antispamplugin (configured insetup/spamassassin.sh) to triggersa-learnwhen messages are moved to/from the Spam folder. This plugin was last updated in 2017 and was designed for Dovecot 2.2.x.Dovecot 2.3.x (shipped with Ubuntu 22.04) added native support for the IMAP
MOVEcommand (RFC 6851). Modern IMAP clients — including Thunderbird, Apple Mail, and most mobile clients — useMOVErather thanCOPY+ expunge. Thedovecot-antispamplugin only hooks intoCOPYoperations, so it never seesMOVEand never triggerssa-learn.The plugin loads without errors and appears in
doveconf -n, making the problem completely silent.How to Reproduce
sa-learn --dump magic— thenspamcounter does not incrementsa-learn --dump magicagain — the counter does incrementThis confirms the plugin works for COPY but not MOVE.
Impact
Bayesian spam training is effectively non-functional for all MIAB users who use IMAP clients that default to MOVE (which is virtually all modern clients). The shared Bayes database never learns from user actions, so spam filtering does not improve over time.
This also affects #2560, which identified additional problems with the antispam setup but did not identify this as the primary cause.
Proposed Fix
Replace the deprecated
dovecot-antispamplugin with IMAPSieve, which is Dovecot's officially supported replacement (documentation). IMAPSieve properly intercepts both COPY and MOVE operations and is actively maintained.This would involve:
dovecot-antispamfromapt_installinsetup/spamassassin.sh99-local-spampd.confantispam plugin configsedlines that enable the antispam plugin in20-imap.conf/20-pop3.confimap_sieveplugin, sieve scripts for report-spam/report-ham, and shell wrappers that callsa-learnI'd be happy to prepare a PR for this.