You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Thomas Harold <th...@nybeta.com> on 2014/01/24 18:37:17 UTC

Re: How to filter out spam messages?

On 12/30/2013 8:27 AM, Timothy Murphy wrote:
> I'm running what I take to be a standard
> postfix/amavis/clamav/dovecot/spamassassin setup
> on my newly-installed CentOS-6.5 server.
> As far as I can see, the setup is working ok,
> except that spam - marked as such - is getting through
> to my email client (KMail under Fedora-20).
> I'm not clear which program should be filtering out the spam?

Server-side sieve rules work best with later versions of dovecot (2.2 or 
later) for shoving spam into the Junk folder.

Notes:

- If the user is retrieving mail via POP3, they will never see messages 
in the Junk folder, unless they login with an IMAP client.

- Users could also choose to "trust SpamAssassin headers" and move 
messages into their (local or mailbox) Junk folder by customizing their 
mail client.

On our CentOS6 server, we move all spam that scores higher then 8.0 into 
the Junk folder of the user's IMAP mailbox.  The sieve rule looks like:

# cat /usr/local/etc/dovecot/sieve/before/90-sortspam.sieve
require ["comparator-i;ascii-numeric","fileinto","relational"];

# Definite spam gets shoved into the "Junk" folder in IMAP
# Currently defined as a Spam Assassin score of 8.0 or higher
if allof (
     header :contains "X-Spam-Flag" "YES",
     exists "X-Spam-Score"
     ) {
     if allof (
         not header :contains "X-Spam-Score" "-",
         header :value "ge" :comparator "i;ascii-numeric" 
["X-Spam-Score"] ["8"]
         ) {
         fileinto "Junk";
         stop;
     }
}

Note that after editing a file like that, you need to compile it into a 
"svbin" file.  The .svnbin file has to be world readable.

# /usr/local/bin/sievec 90-sortspam.sieve 90-sortspam.svbin