I'm running CentOS-7 on my home server, and have setup postfix + dovecot + spamassassin. Everything seems to be working fine, except that while spam is being marked as ***Spam***, it is ending up in ~/Maildir/cur/ .
I'd like to divert it to ~/Maildir/.Spam/ (where I can examine it with sa-learn). What is the simplest way to do this?
Once upon a time, Timothy Murphy gayleard@eircom.net said:
I'd like to divert it to ~/Maildir/.Spam/ (where I can examine it with sa-learn). What is the simplest way to do this?
I do that with sieve. Install dovecot-pigeonhole, add sieve to the Dovecot lda/lmtp protocol list (this assumes you are using Dovecot for local delivery), then add a sieve_before entry in the plugin section to point to a global sieve script. I use this one (to filter based on a header):
if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; }
Don't forget to compile your sieve script. Also, if you filter on a header, you may need to double the filter (put the same thing twice) due to a old Dovecot bug that Red Hat has not yet fixed:
https://bugzilla.redhat.com/show_bug.cgi?id=1224496