On Wed, Jan 31, 2007 at 10:16:38AM +0000, Dave wrote:
I want to test two values (from address and reply to address) but
procmail doesnt accept normal if statements.
It has these funny things instead, called "conditions." :-)
the normal if statement would be:
if ($REPLYTO == $SENTFROM)
do something
else
do something different
I tried adding it to procmail like so:
if ($REPLYTO == $SENTFROM)
:0f
* ^Subject:\/.*
| formail -i "Subject: [REPLY ADDRESS MATCHED] $MATCH"
else
:0f
* ^Subject:\/.*
You surely don't need to run the same condition twice.
| formail -i "Subject: [REPLY ADDRESS MISMATCH] $MATCH"
Perhaps a good start would be a read of the man pages, including
"man procmailrc" and "man procmailex" most specifically. :-)
However, here's one way. It looks like you already saved
$REPLYTO and $SENTFROM, so that makes things easy:
MATCH # initialize unset
:0 fw hi
* ^Subject:\/.*
* $ REPLYTO ?? ^^$\SENTFROM^^
| formail -i "Subject: [REPLY ADDRESS MATCHED] $MATCH"
:0 E fw hi
| formail -i "Subject: [REPLY ADDRESS MISMATCH] $MATCH"
Be aware that there might be a a missing Subject:
header or it might be empty (null) but present.
In that case, your new Subject: created with formail
will end with a space. If you don't initialize MATCH
to unset or to null, you'd even get a false Subject line
in the case of no or null Subject on the incoming mail.
(Depends on whether MATCH already contains something from
up above.)
You might think about capturing the Subject: separately
(as you apparently did with Reply-To and so on) up above.
That would make this recipe a lot less kludgy.
You wouldn't need the condition with the Subject match at all.
Dallman
____________________________________________________________
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