Ralph SOBEK <sobek(_at_)irit(_dot_)fr> writes:
I need a complicated condition that has to be done by a
program using both headers and body. If the program exits without an
error, I would then like another program to do the action.
Is this possible with procmail? Here is what my script looks
like (names were changed to protect the innocent):
:0
* ^TOsobek
* ^Subject:.*test
{
:0 hbw
| $HOME/bin/check-abstract
:0 ahbw
| (formail -r -k -A"Precedence: junk" -A"X-Loop: sobek(_at_)irit(_dot_)fr" \
-i"Reply-To: foo(_at_)bar(_dot_)com" ; \
echo "Test Message" ; \
cat $HOME/mail/ack.txt ) | $SENDMAIL -t
}
Close: you left out the 'c' flag, and you need to decide what to do if the
program fails.
:0
* ^TOsobek
* ^Subject:.*test
{
# Run check-abstract on a copy of the message, checking its
# return-code.
:0 cw
| $HOME/bin/check-abstract
# If check-abstract succeeded, send out the reply.
:0 aw
| (formail -r -k -A"Precedence: junk" -A"X-Loop:
sobek(_at_)irit(_dot_)fr" \
-i"Reply-To: foo(_at_)bar(_dot_)com" ; \
echo "Test Message" ; cat $HOME/mail/ack.txt ) | \
$SENDMAIL $SENDMAILFLAGS -t
# If an error occurred, then you'll find ourselves here. You can
# do nothing, in which the processing will fall through to the
# rest of the procmailrc, or you can drop in a recipe to deal
# with the error in a more appropriate fashion.
}
Philip Guenther