Re: [Exim] filtering (bogofilter)

Top Page
Delete this message
Reply to this message
Author: W M Brelsford
Date:  
To: exim-users
Subject: Re: [Exim] filtering (bogofilter)
On Sat Nov 23 2002 at 12:46 PM +0100, Kenneth Johansson wrote:
> It dose look like going to procmail is the only option. It's just
> that I have all my filtering rules in exim format :(


I recently set it up in my .forward (also wanted to stay within
exim). It requires a small setuid (or setgid) program bogofilt to
access the exim spool directory -- see the previous thread on
"$message_filename ?".

    if "${run{<path>/bogofilt $message_id}{s}}" is s
     then    unseen pipe "bogofilter -s"
        deliver spam
     else    unseen pipe "bogofilter -h"
     endif


bogofilt simply runs a shell script bogofilt.sh, which includes:

    cd /var/spool/exim/input &&
        { sed '1,/^$/d; s/^[0-9][^ ]*  *//' "$1-H"
          sed '1s/.*//; s/^From />&/' "$1-D"
          } | bogofilter


The sed scripts rebuild the message and protect "^From " lines;
simply cat-ing the files might be sufficient.

--
Bill Brelsford
k2di2@???