I started to think about extending my spam filters, and, inspired by
spamassassin, I wanted to use a weighted scoring technique. I wanted to
keep as much as possible in procmail/formail (I don't know Perl :-).
However, I ran into a problem when I wanted to accumulate the score over
several recipes.
Here is an example:
LIMIT=20
# this checks the header only
:0 Df
* 2^1.5 (!|?|\*|\$)
* 10^1 ^(SUBJECT|TO|FROM|DATE)
| formail -A"X-Score: $="
# do some checks in the body as well
:0 Bf
* 20^1 (flame|sex)
| formail -A "X-Score: $="
# file as spam if accumulated score is more than 50
:0:
* -1^1 ! ? add -f $LIMIT
* 1^1 ! ? add -f `formail -x"X-Score:"`
spam
Perhaps something like this:
# this checks the header only
:0 Df
* 2^1.5 (!|?|\*|\$)
* 10^1 ^(SUBJECT|TO|FROM|DATE)
| formail -A"X-Score: $="
HEADSCORE = $=
# do some checks in the body as well
:0 Bf
* 20^1 (flame|sex)
| formail -A "X-Score: $="
BODYSCORE = $=
:0:
* -50^0
*$ $HEADSCORE^0
*$ $BODYSCORE^0
spam
The HEADSCORE variable is set to the score generated by the first
recipe. BODYSCORE is set to the score generated by the second recipe.
The third recipe unconditionally adds together -50, $HEADSCORE and
$BODYSCORE and if the total is greater than zero, delivers to the spam
mailbox.
Hope that helps,
Martin
--
Martin McCarthy /</ PGP key available
`Procmail Companion' \>\ http://www.ancient-scotland.co.uk
Addison Wesley /</ http://www.ehabitat.demon.co.uk
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail