Monday 2 August 2010

Spam Assasin

On Ubuntu 9.10 spamassassin can be easily be integrated on a per user basis by installing it with:

# apt-get install spamassassin

Next create your new email box by using your smtp email client.
Finally add the following to your .procmailrc

# Push all mail under 256k in size through spamassassin
# This will tag any mail deemed to be spam
:0fw: spamassassin.lock
* < 256000
spamassassin


# All mail tagged as spam is moved to "spam".
:0 w
* ^X-Spam-Status: Yes
/opt/imap/dmail username+spam     # dmail
#/usr/lib/dovecot/deliver -m spam # dovcot


# Work around procmail bug: any output on stderr will cause
# the "F" in "From" to be dropped. This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "
  :0 fhw
  sed -e '1s/^/F/'
}

I've used this with exim4, dovcot/dmesg, procmail.

1 comment: