More General posts
September 02, 2003
spam - bogofilter, qmail, and maildrop

I read my mail at home using the mail client in mozilla. I'm very happy with the Bayesian mail filtering it provides as it does a great job of distinguishing between spam and non spam. However, I thought I'd like to experiment with some server based filtering.

My first attempt is to use bogofilter to perform the mail clasification. In the future I'll probably try CRM114 as it claims an amazing accuracy. The only tricky part of the process so far was to work out how to get qmail to deliver the mail to my maildir after filtering with bogofilter.

I found various recipes through google for qmail and bogofilter but they all seemed to use separate accounts for spam and non spam email. What I wanted was to keep the folder structure that mozilla's junk mail filtering is using. My initial setup is very simple, all I do is use bogofilter to add an X-Bogosity header to the mail and then use maildrop to put it in my maildir inbox. This involves three files.

.qmail file that qmail uses to perform delivery. This just passes the incoming mail through preline to a script I wrote that invokes bogofilter and then maildrop.

|preline spam/qmail-bogofilter.sh

qmail-bogofilter.shscript. I need the LD_LIBRARY_PATH as BerkeleyDB isn't where it "should" be. Then just pass the message through bogofilter and then to maildrop for delivery according to the instructions in .mailfilter

export LD_LIBRARY_PATH=/usr/local/BerkeleyDB.4.0/lib
/usr/local/bin/bogofilter -p -3 | /usr/local/bin/maildrop

.mailfilter file that controls maildrop. At the moment very simple, it just puts the mail into the default folder.

to "$HOME/Maildir/"

Of course bogofilter makes mistakes from time to time, later I'll describe the python program I use to "train" it after I've manually (well, with mozilla's help) clasified the mail. In the future I'm planning on expanding the .mailfilter recipe so that spam is automatically delivered to the correct mailbox.

Posted by Alex at September 02, 2003 07:51 PM
Comments
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?