Kmail and spam filtering

Thierry de Coulon tcoulon at decoulon.ch
Sat Jul 22 22:01:41 BST 2006


On Saturday 22 July 2006 22.16, Nigel Henry wrote:

>
> I DL'd Bogofilter 1.0.2, and 1.0.3, and read through a lot of the FAQs, and
> have just found some HOWTOs for Bogofilter and Kmail, on Google.
>
> Thanks.  Nigel.

I hope you get it working.

In short, here is how it works for me:

I set up three filters in kmail:

1) filter "bogoheader" set to:

match all of the following

<any header>           matches regular expression              .*

remove header             X-Bogosity
remove header            X-attachments

2) filter "bogofilter" set to:

match all of the following

<any header>           matches regular expression              .*

Pipe through         bogofilter  -epv

3) filter "bogofilter_is_spam" set to:

X-Bogosity    contains   YES

move to   <whatever you like>

I first chose to move "spam" to a special directory to check them, but now 
that I know it works well they are moved directly to trash, and that is 
emptied automaticaly.

I also set two mail directories (spam and NonSpam) where I put spam messages 
that got through (and when training in NonSpam examples for good messages). I 
then wait until "spam" contains around 100 spams and run the folowing script 
(I use it under the name bogolearn.sh from my home directory). You must of 
course check the info in the first part and adapt it to your settings:

************************ bogolearn.sh***************************
#!/bin/sh
# train bogofilter with new spam and non-spam
BOGOFILTER="/usr/bin/bogofilter";
MAILDIR="/home/<user>/Mail"
GOODDIR="NonSpam/cur";
SPAMDIR="spam/cur";
GOODLIST="goodlist";
SPAMLIST="badlist";

cd $MAILDIR/$SPAMDIR;
echo Spam:
for i in *; do
if [ -z "`grep -e " $i " $MAILDIR/$SPAMLIST`" ]; then
echo Processing Mail ID \#$i;
bogofilter -s -v < $i ;
echo " $i " >> $MAILDIR/$SPAMLIST;
fi
done;

cd $MAILDIR/$GOODDIR;
echo NonSpam:
for i in *; do
if [ -z "`grep -e " $i " $MAILDIR/$GOODLIST`" ]; then
echo Processing Mail ID \#$i;
bogofilter -n -v < $i ;
echo " $i " >> $MAILDIR/$GOODLIST;
fi
done;
*********************** end bogolearn.sh **********************

That's it. I tried spamassassin but it's fairly slow if you check your mail 
once or twice a day.
The first couple of spam-filtering with bogofilter will probably be rather 
poor - put what got through in "spam" and run bogolearn. In my experience, 
filtering results get good very soon and remain so.

Thierry


-- 
Stupidity is like a fractal; universal and infinitely repetitive.
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list