procmail
[Top] [All Lists]

Can anyone help fixing a recipe?

2014-10-29 13:34:25
I've been using the recipe below and it does what I want except one thing.
If the conditional that begins with
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
test_subject($ENV{SUBJECT});'
receives a "0" as the exit code of the perl script it executes the formail
and ssmtp command which is what I want.  The problem is that the recipe
continues executing.  I would like it to stop if the condition is met (
exit code "0"). That is if the test_subject() subroutine exits with a zero,
I wan't it to return the email with formail and ssmtp and then STOP. Can
anyone tell me what I am doing wrong?

#grab the from
FROM=""
:0
* ^FROM:.*
* ^From:[    ]*\/[^  ].*
{
       FROM=$MATCH
}
#grab the subject
SUBJECT=""
:0
* ^FROM:.*
* ^Subject:[    ]*\/[^  ].*
{
       SUBJECT=$MATCH
}
:0 W # send to test_subject.pl to check for PO no.
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
test_subject($ENV{SUBJECT});'
|( formail -rI"From: No Reply <fpls545(_at_)gmail(_dot_)com>"; \
  echo "Your mail has been returned."; \
  echo "It was NOT received because it does not contain a valid Load Number
in the subject"; \
  echo "Please resubmit with the PO Number (see Rate Confirmation) in the
subject line."; \
  ) | /usr/sbin/ssmtp -oi -t;

:0 W # VALID PO NO test it to make sure it was not already processessed and
or paid
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
test_if_billed($ENV{SUBJECT},$ENV{FROM});'
work # already billed

:0 ifw  # has not been billed rip & save attachements

|ripmime -i - -d /home/richard/.pmdir/attachments/ &&\
/usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
rename_att($ENV{SUBJECT}); exit(0)'

:0 A
invoices
____________________________________________________________
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
<Prev in Thread] Current Thread [Next in Thread>