promail and spamassassin

18 May

I use Webmin to configure Postfix, Webmin makes configuring Postfix even
easier. You can still hand edit the config files if you want, Webmin
leaves any hand editing alone.

I then have SpamAssassin running in daemon mode using spamd/spamc.

In my /etc/procmail file I have the following entries:

PATH=/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
PMDIR=$HOME/tmp
LOGFILE=/root/tmp/log
UMASK=111

:0fw
* < 256000
* !^X-Loop: spamchecked
| formail -A “X-Loop: spamchecked” | spamc
:0
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
/dev/null

:0
* ^X-Spam-Status: Yes
/home/spam/Maildir/

The first rule doesn’t Spam check the mail if it is over 256k, doesn’t
check it if it already has been checked (indicated by the X-Loop), adds
in the X-Loop, and then checks it for Spam.

The second rule deletes the mail if it gets a score of 15 or above. Be
careful with this one if you do it for a Real Estate office. The users
that mail them are not very bright and they have lots of info about
Mortgages etc. One legit e-mail scored 14.6.

The third rule puts the mail to the IMAP mailbox of the user ‘spam’, if
it is considered Spam. Do not use !spam@localhost, that will cause it to
loop.

The /etc/procmail file (note there is no dot when it is in /etc) is the
global filter that everything will go through first. The users can still
have their own ~/.procmail files to do their own filtering as well.