procmail
[Top] [All Lists]

Re: priorities of ( )

1998-04-29 13:52:43


Simple question

If the Header ABC exists then I want to use it, if it doesn't exist then I  
want to use XYZ but I don't ever want to use XYZ if ABC exists in the same  
message

Right now I have two recipes, which are identical except the first one  
checks for ABC and the second for XYZ

Will

* ^(ABC|XYZ)

always prefer ABC and only use XYZ if ABC doesn't exist, or will it use XYZ  
if it comes first (higher in the headers)?

It will catch whichever comes first in the headers (or body if you have
the B flag).

Try this (the prototype for which I first saw in a post from Philip
Guenther) to set ENV_FROM to the address in the Return-Path: header if
it exists, and failing that from the address in the From_ header, and
failing that, to "not found". Be sure to replace each \t by a real tab,
and remove the comments which appear in the condition lines. I use a
preprocessor to do that and some other simple transformations. This
takes advantage of MATCH being set even for a NOT FOUND condition.

   :0                                 ## no flags required
   * ! ^return-path:[ \t]*\/[^ \t].*  ## prefer this header
   * ! ^from[ \t]*\/[^ \t]+           ## note +, not .*
   { MATCH="not found" }              ## or MATCH, or MATCH=NIL, or ...
   ENV_FROM=$MATCH                    ## use as you will

-- 
Rik Kabel          Old enough to be an adult              
rik(_at_)netcom(_dot_)com

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