procmail
[Top] [All Lists]

Re: Environment variables in conditions.

2004-08-25 07:06:33
Chris Johnson wrote:

     I've looked everywhere I can find for this one.  No definitive
answer yet.  I know there are certain macros like TO_, TO,
FROM_MAILER, etc. that can go in conditions.

Interruption: none of those are valid macros; the valid macros that look like them all have an initial caret. Back to your question ...

     Is it possible at all to put an environment variable in a
condition's regular expression?

Yes. It's in the procmailrc(5) man page. Put an extra dollar sign at the beginning of the condition, like so:

 # make sure my email address is in the To: header
 * $ ^To:.*$LOGNAME@

That will make procmail do variable substitution (for later dollar signs) and command substitution (for backquotes) on the condition before using it.

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