## Dropping Less Spam at ISP

From: "andrew cooke" <andrew@...>

Date: Sat, 4 Aug 2007 20:30:39 -0400 (CLT)

Earlier I described how I dropped spam at my ISP -
http://www.acooke.org/cute/DroppingMo0.html

I am now trying a new tactic.  Instead of dropping that spam, I collect it
and use it to train Spam Assassin.  At the same time, however, I don't
want to lose the big advantage that ISP filtering gave me - that if my
computer dies, or my connection goes down - I don't have a zillion extra

So what I needed was a way to enable the filter described above when I had
a backlog of messages.  Equivalently: a way to disable teh filter during
normal use.

I came up with the following.  It could be made slightly faster by using
procmail's scoring (ie using the number of emails directly), but I don't
think that's a significant problem and this approach also helps remind me
how to use variables...

This is the extra added to the ISP procmailrc (obvious linebreaks added
MANY = echo \$((\mailutil check /var/spool/mail/acooke | sed -e "s/^\$$[0-9]\\{1,99\\}\$$.*/\\1/" | sed -e "s/^No.*/0/"\ > 10)) :0 * ! MANY ?? 0 * ^(To|Cc|Bcc)[ :].*@acooke.org [rest of previous recipe follows] And then locally I have routing to sa-learn --spam etc. Seems to work! :o) Andrew ### Error in Regex From: "andrew cooke" <andrew@...> Date: Fri, 10 Aug 2007 10:42:52 -0400 (CLT) That should read MANY = echo \$((\mailutil check /var/spool/mail/acooke
| sed -e "s/^.*(\$$[0-9]\\{1,99\\}\$$.*/\\1/"
| sed -e "s/^No.*/0/"\ > 10))
Andrew