Magic Spam Filter

This is a free spam filter based on Bayesian principles with some extra additions to make it work more efficiently and reduce all those false positives and negatives.

Currently it is only sketchily documented for implementation on a suitable Unix system.

Instructions:

cd ~/mail

mkdir filter

mkdir backup

cd filter

Download alllrn.tar.gz.

tar xfpvz alllrn.tar.gz

Edit procmailrc.example if you want to change number of backup files, or name of spam file.

Edit the start of lrn.c, changing the arrays "char *goodf[]" and "char *badf[]" to point to your non-spam mail folders and spam mail folders respectively. The spam folders should match those in procmailrc.example. Typically the non-spam mail folders will be /var/spool/mail/$USER and $HOME/mail/saved-messages, and the spam mail folders will be $HOME/mail/SPAM and $HOME/mail/AMBERSPAM. (Replace these environment variables $USER and $HOME by their actual values before inserting them into lrn.c.) These arrays should be 0-terminated (as shown by the current entries).

make

./lrn
(This creates a file, wdata.act, of words and their weights.)

cp procmailrc.example ~/.procmailrc

Edit your crontab file to run ./lrn every now and again. E.g., add the line

05 06 * * 7 cd /home/$HOME/mail/filter; nice -19 ./lrn >> learnoutput 2>&1
(Replace $HOME by its actual value.)

(If you don't have a crontab file, make a file, mycron, with the above line and type crontab mycron.)





Back to homepage