dattier(_at_)wwa(_dot_)com (David W. Tamkin) writes:
Philip Guenther suggested to Ken Marsh as a way to count addressees,
| :0
| * -19^0
| * 1^0 ^(Resent-)?To:
| * 1^1 ^(Resent-)?To:.*,
| * 1^0 ^(Resent-)?Cc:
| * 1^1 ^(Resent-)?Cc:.*,
| {
| EXITCODE=77
| HOST
| }
I'm not sure that the third and fifth conditions will work properly.
Procmail looks for non-overlapping occurrences of the regexp. Since the
regexps are left-anchored, they can match at most once per header line.
Whoops, I should have tried that one out.
I can't think of an easy solution. Maybe this, but it assumes only one of
each header at most:
...
Okay, how about this instead:
# preset or unset some variables
R TOCOUNT=0 CCCOUNT=0
# set $R to be Resent- iff there are any headers that indicate this message
# as having been resent.
:0
* ^Resent-(From|Date|To|Cc|Message-Id):
{ R="Resent-" }
# Now pick out the proper To: header and play with it some.
:0
* $ ^${R}To:\/.*
* 1^0
* 1^1 MATCH ?? ,
{ TOCOUNT = $= }
# Ditto for Cc:
:0
* $ ^${R}Cc:\/.*
* 1^0
* 1^1 MATCH ?? ,
{ CCCOUNT = $= }
# Sum them up and substract the maximum number of addresses that is 'okay'
:0
* $ $TOCOUNT^0
* $ $CCCOUNT^0
* -19^0
{ EXITCODE=77 HOST }
How's that?
Philip Guenther