"Wesley W. Garland" <wes(_at_)kingston(_dot_)airpost(_dot_)com> writes:
I'm trying to make a generic procmail recipe file which can be used
across multiple users with different preferences for how to forward
mail, where to forward it, etc..
The key is that the data for how to do these things arrives in environment
variables - eg, if I want to forward a message based on the from field,
a regex is supplied in $FROM-EXP.
By passing procmail the '-p' argument, it will preserve the
environment, thus making those variables availible in the rcfile. I'll
note that you can't use -p with delivery mode (-d), and that the
variable you name above "$FROM-EXP" would not be accessible because of
the '-' in it. Environment variable names must match the regexp
^[A-Z_][A-Z_0-9]*$
Anything else is inaccessible from the shell(s), procmail, and many
other programs. I'd suggest using "$FROM_EXP" instead.
To actually use the variables now passed in, prefix the regexp in the
condition with a "$", to tell procmail to perform variable expansion on
the rest of the condition:
:0
* $ ^From: $FROM_EXP
|some-program
Philip Guenther