[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bogofilter feeback to mail server



On Sat, 2003-02-22 at 16:35, Kevin Coyner wrote:

> Has anyone come up with a good way of getting that spam back to the mail
> server so that bogofilter can be run against it to update the files
> goodlist.db and spamlist.db?

What I do is I have some special IMAP folders for handling spam.  I have
Spam/Reg, Spam/Detected and Spam/NonReg folders.  When bogofilter
receives an email that it thinks is spam it files it into Spam/Detected.

When Spam slips through bogofilter undetected I simply grab the email in
my email client and drop it into the Spam/Reg folder to "register" it. 
When Nonspam gets marked as Spam (rare) I drag it into the Spam/NonReg
to make bogofilter smarter.  I regularly copy my good mail into
Spam/NonReg as well so that bogofilter gets a regular feeding of new
"clean" mail.

I have a cron job on the server that runs once per hour and handles
registering the emails for me.  Since I use Maildir format every email
is an individual file making my job particularly easy.  Here's roughly
what my cronjob looks like:

---- script begins ----
#!/bin/sh
# Registers spam and non-spam with bogofilter automatically

for dir in $HOME/Maildir/.Spam.Reg.cur $HOME/Maildir/.Spam.Reg.new
do
    find $dir -type f 2>/dev/null | while read file; do
        bogofilter -s < $file && rm  $file
    done
done

for dir in $HOME/Maildir/.Spam.NonReg.cur $HOME/Maildir/.Spam.NonReg.new
do
    find $dir -type f 2>/dev/null | while read file; do
        bogofilter -n < $file && rm $file
    done
done

---- script ends ----

What I particularly like about my solution is that it works with any
IMAP email client.  I can use webmail, outlook, kmail, evolution, etc.
and my spam detection/training mechanism is completely integrated.

-- 
Fraser Campbell <fraser@wehave.net>                http://wehave.net/
Brampton, Ontario, Canada                   Linux 2.4.20 AuthenticAMD





Reply to: