[Exim] Bogofilter: Using anti-spam Bogofilter with Exim 4

Top Page
Delete this message
Reply to this message
Author: John Masinter
Date:  
To: exim-users
Subject: [Exim] Bogofilter: Using anti-spam Bogofilter with Exim 4
I've experimented with the code contributed by the kind people
posting on this subject before me, mainly Konstantin Starodubtsev.
Below is what works best for me with Exim 4.

Note: All this does is add the "X-Bogosity" header to all incoming
mail. It is up to the mail client to filter out any mail who's
"X-Bogosity" header contains "Yes" indicated that the message is spam.

Add the following to your exim "configure" file, then HUP exim.

#-----------------------------------------------------------
# Bogofilter will add X-Bogosity header to all incoming mail.
# This usually goes right after the dns_lookup router and
# before any local deliver routers. Location is important!
bogo_router:
    domains = +local_domains
    no_verify
    condition = ${if !eq {$received_protocol}{bogodone} {1}{0}}
    driver = accept
    transport = bogo_transport



#------------------------------------------------
# Bogofilter will add X-Bogosity header to all incoming mail.
# This can go anywhere in the transport section, usually at
# the very end after address_reply
bogo_transport:
    driver = pipe
    command = /usr/local/sbin/exim -oMr bogodone -bS
    use_bsmtp = true
    transport_filter = /usr/local/bin/bogofilter -d /usr/local/etc -p -e -u
    return_fail_output = true
    log_output = true
    return_path_add = false



Some debugging hints:
* make sure you specify the entire and correct path to bogofilter
and its data directory, as shown above in the "transport_file" line.
* make sure that bogofilters datafiles are readable (usually by everyone)
and if using the "-u" writable by the mail process
* don't forget to init bogofilter by feeding in a bunch of spams
using "-s"
* See the bogofilter web site for details on its installation and flags
http://bogofilter.sourceforge.net/

I saved up some 2000 spam e-mails to initialize bogofilter and now
it seems to be near %99 accurate. Life without spam is great!
Hope this helps someone!