Kmail and bogofilter

Until recently I’ve been using Kmail as mail client together with SpamAssassin as a spam fight solution, but the problem was that spamassassin freeze KMail while it scans the messages. After a little bit of research I’ve decided to switch to bogofilter (which plays very nice with KMail and it doesn’t freeze it). Installing bogofilter was as easy as :

  • cd /usr/ports/mail/bogofilter
    make install clean

In order to have bogofilter doing the job you will need to train it. To do that you need to make two folders, Spam and NotSpam, in which you will put the messages that you consider as being spam and in the other one the messsages that aren’t spam. After you put about 300 emails in each folder you will need to build the db :

  • nice find ~/.kde/share/apps/kmail/mail/Spam -type f -print | xargs bogofilter -vvv -s -B && nice find ~.kde/share/apps/kmail/mail/NotSpam -type f -print | xargs bogofilter -vvv -n -B

All you need to do now is create 3 Filters in kmail :

This first filter is the one that removes any X-Bogosity or X-Attachments in the header that a ISP,.. might have put in there. Then sends the email thru (pipe) bogofilter to process it and make a determination if Ham or Spam or Unsure.

bogo filter 1

bogo filter 2

This 2nd filter looks at the processed email header for what Bogofilter put in there (see below). It is looking for the word Spam in the X-Bogosity part of the header. If so move it to the Trash folder, that way I can look at it and make sure it is correct. If it doesn’t catch it then it will end up in my Inbox.
Note: I just got caught by this: The X-Bogosity has changed in bogofilter. It use to put a Yes, No in the header. Now it puts Spam, Ham or Unsure. So if you have an older version, change Spam, to Yes

bogo filter 3

bogo filter 4

To use this last filter click on the email and select Apply Filter and choose this filter (ClearBogosity). It will clear the header and move it to bogoSpam folder cleaned up.

bogo filter 5

bogo filter 6

That is about it. Follow this and bogofilter and you will become good friends when you see the email from the scumbucket spammers go straight to the trash.

[ad#post]