New procmail recipe
"Todd A. Jacobs" <[email protected]> Tue, 14 Nov 2006 04:06:08 -0800
| Newsgroups | gmane.mail.spam.hashcash |
|---|---|
| Message-ID | <[email protected]> |
# Capture the hostname, and escape any periods so the value can be used
# in regular expressions.
MYDOMAIN=`hostname -d | sed 's%\.%\\.%g'`
# Process hashcash-stamped emails. Don't just validate it; include the
# results in the email headers. This is partly for debugging, but it
# also provides more tokens for Bayesian filters such as bogofilter to
# use in differentiating spam vs. ham.
:0
* $^X-Hashcash: .*\/[^:]+@${MYDOMAIN}
{
# Hashcash sends its output to stderr, so we capture it and then
# ensure that every line but the first is indented in order to
# comply with RFC 822.
RESULT=`hashcash -cvMXdp 1d -b20 -f $HOME/hashcash.db -r $MATCH 2>&1 | \
sed -e '1!s/^/\t\t /'`
# Filter successful mail through formail, and append the results.
:0Afw
| formail -i "X-Hashcash-Validated: yes" \
-i "X-Hashcash-Result: $RESULT"
# If the hashcash stamp is invalid, append the results and let further
# filtering take place.
:0Efw
| formail -i "X-Hashcash-Validated: no" \
-i "X-Hashcash-Result: $RESULT"
# Deliver the mail, bypassing further filtering. Disable this if you
# still want to do further processing (e.g. Bayesian filtering)
# before delivery.
:0:
$DEFAULT
}
--
Unabashedly littering the information superhighway with detritus like
this for over 15 years now.