On Fri, 8 Jun 2007, Stephen Allen wrote:
SA> Precursor... according to the procmail help I've read, there can only be
SA> one action per recipe. Do I assume that this constitutes one action?
SA>
SA> :0
SA> * Some condition
SA> {
SA> Some action
SA> Another action
SA> }
SA>
Absolutely not.
SA> If this the case can one of those actions be to set a variable for use
SA> later in the recipe?
Variables can be set outside recipes and are not action lines. For
multiple actions, you could do something like this:
FROMHEADER=`formail -c -rtz -x To:`
SPAMSTATUS_HEADER="X-Mundungus-Spamcheck-Status: "
REWHITELIST=${HOME}/.procmail/rewhite.list
# Is from: in the regular expression whitelist?
# This recipe is first for testing it out
:0
* ? echo "${FROMHEADER}" | grep -E -is -f "${REWHITELIST}"
{
# Replace the marker
:0 fhwa
| formail -I "${SPAMSTATUS_HEADER}#2010 from: in the regular expression white
list ($$)"
:0:
${DEFAULT}
}
Check out ":0 E" and the like in procmailrc as well.
You can set a variable following a conditions like this:
: 0
* ^^From[ ]+\/[^ ]+
{ FROM_HEADER=$MATCH }
You could, of course, have:
:0
* ? echo "${FROMHEADER}" | grep -E -is -f "${REWHITELIST}"
{
VARIABLEEXAMPLE="some stuff goes in here"
# Replace the marker
:0 fhwa
| formail -I "${SPAMSTATUS_HEADER}#2010 from: in the regular expression white
list ($$)"
:0:
${DEFAULT}
}
Which is probably the type of mixture of variables and actions you are
after.
--
Alan
( Please do not email me AS WELL as replying to the list. Please
address personal email to alan+1@ as lists@ is not read. A
password autoresponder may be invoked if this email is very old. )
____________________________________________________________
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