procmail
[Top] [All Lists]

Re: Recipe Help.

2003-12-06 18:10:09
There is probably something unique about the FIRST received header [...]
I could easily say

^Received:(.*\<)?from(.*)\.dsl.*mail.covisp.net

which would only match if the first Received line contained ".dsl"

He doesn't want to find the first received line that contains ".dsl", he
wants to find the first received line, and then determin if that contains
".dsl".  Also, he really means the wildcard "." there, not a literal dot,
because he's trying to match "adsl" or "sdsl" etc.

Generally:

----------
MAXSCORE=2147483647

:0
* $ -$NTH^0
* $ $MAXSCORE^0
* $ 1^1 ()\/$PATTERN
{ LOG="The $NTH occurrence of $PATTERN is: $MATCH
" }
----------

Where, for the newbies, ()\/ is the usual idiom for inserting the match
operator \/ at the beginning of a regex, because backslash is otherwise 
discarded when it appears as the first character of a regex.  (The rest
of the gobbledygook there is procmail scoring syntax; "man procmailsc"
and be prepared to understand some algebra.)

Of course if $NTH is 1, you can forget the scoring and do:

----------
:0
* ()\/$PATTERN
{ LOG="The first occurrence of $PATTERN is: $MATCH
" }
----------

So ...

----------
:0
* ^Received: \/.+
* MATCH ?? from \/.dsl
{ LOG="The first Received header contains: $MATCH
" }
----------


_______________________________________________
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>