procmail
[Top] [All Lists]

Re: Prioritizing matching of "best" header

2004-09-11 06:59:25
Bob George wrote:

While working on my mailing list sorting rules, I wanted to grab a
header that would uniquely identify each list on a consistent basis. I
want to extract a unique string, based on a match of the "best" header .
I started with this scoring rule, mistakenly thinking the order of my
recipe lines was significant:

:0
* 9876543210^0 ^Delivered-To: mailing list \/.*
* 9876543210^0 ^List-Id: +\/.*
* 9876543210^0 ^List-Unsubscribe: \/.*@
* 9876543210^0 ^(X-)?Sender: \/.*
* 1^0 ^From: +\/.*
{ [...]

You were not mistaken. That's exactly what should happen there. The order of the condition lines will take precedence over the order of appearance in the headers of the message. Put the most reliable headers' conditions first, and you should be fine.

In experimenting and re-reading man procmailsc, it's (now) clear that
the FIRST matching header causes the rest to be skipped.

When you code it like that, the first condition that matches causes the rest of the conditions to be skipped, and that's exactly what you want.

The problem is that different messages from the same group may have
several headers that match, in unpredictable order, so the same list
may yield different identifying strings in $MATCH.

That should not come up. The code you have there sets its own priorities, overriding the earliest-in-the-text precedence that procmail would have used if you had a condition like this:

* ^(Delivered-To|List-(Id|Unsubscribe)|(X-)?Sender): \/.+

where the order of appearance of header lines in the message itself would matter.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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