procmail
[Top] [All Lists]

Re: Ignoring Received headers when matching

2001-03-17 19:21:17
Mark asked,

| For example, say I want to match on the word "bulk" however
| one of received headers as bulkmail.com in it. I want to totally
| ignore it. I don't want to say something like:
| 
| * bulk
| * !^ Received:.*bulk
| 
| What will happen is if bulk is in the message but also in the Received
| header it won't match. What I want is if it is in either the body
| or header (not looking at the Received header) to match on it.

  :0 other_flags
  * 9876543210^0 B ?? bulk
  * 1^1 ^.*bulk
  * -1^1 ^Received:.*bulk
  action

Explanation: if "bulk" appears anywhere in the body, score the supremum
(which makes procmail skip any remaining weighted conditions) and run the
action.  Otherwise, score 1 for each header line that includes the word
(note, only one point per line, hence the "^.*" -- if the regexp were just
the word alone, it would score one point for every time the word appeared,
even more than once in a header line, and that would be a problem if it
appears more than once in a Received: header).  Then subtract 1 for every
Received: header that has the word.  If the result is positive (total header
lines with the word outnumber Received: lines with the word; i.e., the word
appears in a header line other than Received:), run the action.

This way might be simpler to understand: it differs in effect from the
previous in that it keeps reading to the end even if it has already found
the word in the body, which theoretically is inefficient:

 :0 flags
 * 1^1 HB ?? ^.*bulk
 * -1^1 ^Received:.*bulk
 action

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>