mark david mcCreary <mdm(_at_)internet-tools(_dot_)com> writes:
I have a recipe that works in most cases. It's goal is to see if the
contents of the subject line is equal to the envelope sender address.
I am using ?? to compare the 2 variables. Works most of the time, fails with
SUBJECT=davidhobbes(_at_)abc(_dot_)com
SENDER=dhobbes(_at_)abc(_dot_)com
:0 fh
* $SUBJECT ?? $SENDER
| formail -rt \
-A"X-Unsubscribe: change(_at_)internet-tools(_dot_)com" \
-I "Subject: Address in Subject line is same as From line" \
; sed -e "s/\$LIST/$BASELIST/g" \
-e "s/\$SENDER/$SENDER/g" \
-e "s/\$DOMAIN/$DOMAIN/g" \
-e "s/\$SUBJECT/$SUBJECTLINE/g" \
<change_err_2.msg
Short of using the shell test function, is there a way within
Procmail to compare variables for equalness ?
Yes; you need to anchor the regexp against both the start and end of
the string and you need to escape any regexp special characters in the
variable in the regexp. ^^ will do the anchoring, while $\variable
instead of $variable will do the escaping:
:0 fh
* SUBJECT ?? $ ^^$\SENDER^^
| formail -rt \
-A "X-Unsubscribe: change(_at_)internet-tools(_dot_)com" \
-I "Subject: Address in Subject line is same as From line" \
; sed -e "s/\$LIST/$BASELIST/g" \
-e "s/\$SENDER/$SENDER/g" \
-e "s/\$DOMAIN/$DOMAIN/g" \
-e "s/\$SUBJECT/$SUBJECTLINE/g" \
<change_err_2.msg
Note that the first '$' in the condition isn't being used to expand
the SUBJECT variable, but rather as a flag indicating that the rest
of the condition line should have variable and command expansions
performed. In order to make that clear, I suggest either moving it
to after the "variable ??" part, or at least separating it with a space
from the rest of the condition, ala
* $ SUBJECT ?? ^^$\SENDER^^
Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail