Selfhosted email server : bad folder name for Rspamd Sieve configuration
Summary
Spam emails not scanned by Rspamd when moved to Spam IMAP folder, or tagged as spam.
Description
When a user moves an email to his Spam IMAP folder or tag it as spam, it should trigger a scan+learn by Rspamd.
The same applies when an email is going back from Spam folder, or tagged as ham.
What is the current behavior?
Actually, no Sieve action is triggered.
What is the improved behavior?
One of SPAM/HAM Sieve action should be triggered, launching rspamc to scan+learn email.
What does it bring?
Ability to train Rspamd Bayes filters.
Examples
30+ similar spam emails should be automatically treated as spam.
Validation
Starting with https://gitlab.e.foundation/e/infra/ecloud-selfhosting/-/blob/master/config/mail/dovecot/90-sieve.conf (current version for NC20).
Within mailserver
container, add a /etc/dovecot/conf.d/99-debug.conf
with mail_debug = yes
inside, then throw doveadm reload
.
Then, watching logs with docker-compose logs --tail 10 --follow mailserver
, move a spam email from any folder to the Spam folder.
The log should show Sieve be triggered (for example "imapsieve: mailbox Spam: COPY event" or "imapsieve: mailbox INBOX: FLAG event (changed flags: Junk)", but no action taken.
Looking at 90-sieve.conf
, we can see that INBOX.Spam
is incorrect : we use a flat model for this folder, not a hierarchical (although the "." separator is OK as we use Maildir namespace).
Changing the folder name to Spam
, reloading Dovecot, testing again, we should see something like "imapsieve: Matched static mailbox rule [1]" in the logs, as well as the scan+learn script launched.
Don't forget to rename 99-debug.conf ;)
Checklist
- [ ] License
-
Translations -
Documentation -
Test plan