On Tue, 26 Oct 1999, Laura Henry wrote:
I want to filter junk messages sent out to long lists of recipients. Is
there a way to tell procmail to reject/bounce any e-mail that has a "To:" or
"Cc:" header which contains (say) more than a hundred occurrences of the "@"
symbol (and hence e-mail addresses)?
I stole this one from the list, I think - even has the creators name on
it! ;)
# No large headers, ie where you and several hundred (ok 46) people
# are listed in the TO or CC headers
:0
{
MAX_COMMAS=45
#
# From David W. Tamkin <dattier(_at_)wwa(_dot_)com>
#
:0h
* ^Resent-(To|Cc):
ADDRESSES=|formail -czxResent-To: -xResent-Cc:
:0Eh
ADDRESSES=|formail -czxTo: -xCc: -xApparently-To:
# Now, the number of addressees should be the number of non-empty
# lines (procmail always sees an extra empty line at the end of a
# search area) plus the number of commas; this will still overcount
# if someone has a comma inside a name comment (thus MAX_COMMAS
# instead of MAX_ADDRESSES).
:0
* 1^1 ADDRESSES ?? ^.+$
* 1^1 ADDRESSES ?? ,
* $-${MAX_COMMAS}^0
| $FORMAIL -A"X-Sorted: Spam" >>$SPAMFOLDER
}
As you can see I filter all this stuff to a folder that I check
periodically. Has worked like a charm for me.
--
---------------------------------+-------------------------------------+
Kimmo Jaskari | ÅLCOM - Ålands Datakommunikation Ab |
E-mail: kimmo(_at_)alcom(_dot_)aland(_dot_)fi |
http://www.alcom.aland.fi |
http://www.alcom.aland.fi/kimmo | Phone: +358-(0)18-12122 |
---------------------------------+-------------------------------------+