procmail
[Top] [All Lists]

Re: Variable substitution in condition

2003-02-27 13:00:03
At 22:37 2003-02-27 +0530, Vikram Goyal wrote:

A VAR is set by reading a list from a file. EX. VAR=foo|bar|abra|cad|
I want to expand it in a recipe. Like:

:0
* ^To.*(${VAR}).*

'man procmailrc' is your friend.  So is 'man procmailex'.

:0
* $ ^To:.*(${VAR})

Note three changes to your recipe:

Addition of '$' modifier flag to the condition line (see 'man procmailrc')

Addition of ':' header-field separator after 'To' - this makes it operate ONLY on the To: field, not some bogus crap like "Togetherness: fubar" or whatever (generally not a big concern, but unless you're trying to expand a match against other headers, it's best to truncate the header name). Failure to truncate certain header names sometimes leads to those "why is my recipe matching this message - the To: field doesn't match anything here" type queries.

Removal of '.*' from the tail end of the expression. It is wholly unnecessary - you'd include it only for MATCH expressions where you're trying to capture more of the text than what explicitly matches the more detailed portion of your regexp.

I know the whole line after '*' is sent literally.

Sent where?

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


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