# junkfilter # a junk email filter system for procmail # Copyright 2003 Gregory Sutter # # $Id: junkfilter.bmf,v 2.1 2003/12/01 11:32:44 gsutter Exp $ # # Please read the file "README" and the page # http://junkfilter.zer0.org/ before using junkfilter. # This is junkfilter.bmf, which calls the Bayesian Mail Filter # (http://bmf.sf.net/) # FYI: The bmf program has imperfect RFC 2822 email header parsing, # and will sometimes reorder multiline headers. It also fails to # recognize _body_ lines beginning with "From " and will append its # spam report headers to such lines. Harmless but annoying. JFSEC=bmf # check for X-Spam-Flag: header and capture if present :0 * ^X-Spam-Flag:[ ]*\/.* { JFXSF=$MATCH } # check for X-Spam-Status: header and capture if present :0 * ^X-Spam-Status:[ ]*\/.* { JFXSS=$MATCH } # call bmf in passthrough mode :0 fw | bmf -p # show the bmf score and required score if it's a match. :0 * ^X-Spam-Status: Yes.*[ ]hits=\/[.0-9]+[ ]+required=[.0-9]+ { JFMATCH="$JFSEC: score=$MATCH" INCLUDERC=$JFDIR/junkfilter.match } # remove bmf-generated headers. :0 fw | formail -I X-Spam-Flag -I X-Spam-Status # replace original X-Spam-Status header if there was one. :0 fw * $ $JFXSS^0 | formail -I X-Spam-Status: $JFXSS # replace original X-Spam-Flag header if there was one. :0 fw * $ $JFXSF^0 | formail -I X-Spam-Flag: $JFXSF JFSEC # EOF junkfilter.bmf