fetchmail / spamassassin
Written by Kai Dietrich   
Tuesday, 21 August 2007

I have a fetchmail->procmail->spamassasin->maildir mail-setup running on my local server.

This means, eMail is fetched by fetchmail, piped to procmail, then procmail pipes it through

spamassassin and in case the mail is not marked as spam it gets delivered to a maildir mailbox.

 

Well, now and then, some spams get through spamassassin. To improve the Bayesian filter module

I move these into a special folder and every few days a cronjob runs over this folder and makes

spamassassin learn these mails.

 

fetchmailnow.sh:

 

#!/bin/bash
/usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"

 

.procmailrc:

 

MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
 
# *snip* 
 
# start SpamAssassin rules:
        # lockfile -> only one spamassassin invokation at a time
        :0fw: spamassassin.lock
        * < 256000
        | spamassassin

        # pretty certain spam
        :0:
        * ^X-Spam-Status: Yes
        .Misc.Spam/

 

# end SpamAssassin rules

 

 

learn.sh: 


#!/bin/bash
MAILDIR="$HOME/Maildir"
SPAMFOLDER="$MAILDIR/.Misc.Junk/cur"

sa-learn --spam "$SPAMFOLDER/*"
rm $SPAMFOLDER/*
Last Updated ( Tuesday, 21 August 2007 )