procmail
[Top] [All Lists]

Re: scored weighting, and aborting questions.

1997-01-13 13:52:52
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.

I can't think of an easy solution.  Maybe this, but it assumes only one of
each header at most:

 TOLINE CCLINE RESENTTOLINE RESENTCCLINE # make sure they're unset to start

 :0
 * ^To:\/.*
 { TOLINE=$MATCH }

 :0
 * ^Cc:\/.*
 { CCLINE=$MATCH }

 :0
 * ^Resent-To:\/.*
 { RESENTTOLINE=$MATCH }

 :0
 * ^Resent-Cc:\/.*
 { RESENTCCLINE=$MATCH }

 :0
 * 1^0 TOLINE ?? .
 * 1^1 TOLINE ?? ,
 * 1^0 RESENTTOLINE ?? .
 * 1^1 RESENTTOLINE ?? ,
 * 1^0 CCLINE ?? .
 * 1^1 CCLINE ?? ,
 * 1^0 RESENTCCLINE ?? .
 * 1^1 RESENTCCLINE ?? ,
 * -19^0
 { EXITCODE=77 HOST }

Actually, I think Ken said "more than 20", so perhaps the weight in the last
condition should be -20, but that's a separate issue.

I wish the sendmail trick of setting EXITCODE and missetting (or unsetting)
HOST worked with Smail, which runs here, but unfortunately it doesn't.