Kmail and spam filtering

Nigel Henry cave.dnb at tiscali.fr
Sun Jul 23 18:12:36 BST 2006


On Saturday 22 July 2006 23:01, Thierry de Coulon wrote:
> 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.

> 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.

Hi Thierry.  I'm still collecting spam at the moment, as ironically not much 
has come in today. Anyway I've had time to sort out some bits. I created 2 
new directories in Kmail, named "Spam", and "NoSpam". Then checked that db 
was installed, and it shows db4, so that was ok. Installed gls, and 
gls-devel, as it was suggested it might be usefull, then installed 
bogofilter-1.0.2 with no problems.

One query. I presume the special "spam" directory you setup while checking out 
that bogofilter was working ok, was in Kmail. If I create another directory 
named "spam" (lowercase), do I have to provide the complete path to it? 
(filter 3). So the path would be /home/ <user> /Mail/spam/cur . 
>
> 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 **********************

I think I will create an icon, and run bogolearn.sh from the desktop. In the 
UK the word bog applies to a WC, and as the spam is going to be sent down the 
tubes, I thought perhaps, an icon featuring a WC/lavatory pan/toilet/John, 
call it what you will, would be fitting.

I'll work on the bogolearn shellscript now while I'm waiting for the spam to 
build up. There are only a couple of slight changes to be made. Then when I 
have  enough spam, will setup the filters in Kmail.

Thanks for posting your setup.

Nigel.
>
> Thierry
___________________________________________________
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