Re: return to sender recipe

Richard Reina <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
Sean ,

Thank you very much for the help.  I tried:

:0
* ^FROM:.*
* ^Subject:[    ]*\/[^  ].*
{
       SUBJECT=$MATCH

}

:0
* ? perl -e 'require "/home/richard/.pmdir/test_subject.pl";
test_subj("$SUBJECT");'

And it is effectively executing test_subject.pl, but it's not passing on the
subject.

As far as what the recipe needs to do, thanks for offering to help. I
believe I'm almost there but here is a more precise description of what I
want it to do and where I am.

1)Pass the subject as a scalar to the perl script (as attempted above)
2) trap the return value returned by test_subject.pl if it's "1" reject the
message. This part seems to work well for that:

|( formail -rI"From: Responses will be automatically discarded <
[email protected]>"; \
   echo "Your mail has been administratively rejected."; \
   echo "No valid P.O. Number. Please resubmit with valid P.O." \
 ) | /usr/sbin/ssmtp -oi -t

If the return value is "0" then put the message in a payables folder or if
possible strip off the attachments and save them according to the PO name (
I can easily have that returned as the second scalar back from
test_subject.pl): 2341-1.pdf, 2341-2.pdf, etc. I'm not sure if the last item
is something that procmail can do.  I was planning to use ripmime.

Thank you very much for all the help so far.  I am very grateful.

Richard


2010/12/20 Professional Software Engineering <[email protected]>

> At 09:38 2010-12-20, Richard Reina wrote:
>
>> I got it too work. Needed the full path to ssmtp.
>>
>> Now, if I can just figure out how to pass the subject to a perl script so
>> it can be test against valid POs in a database.
>>
>
> I can't help but think you should sit down and write out everything you
> need this script to do, and just ask someone here to finish writing it for
> you...
>
>
> # this will extract the subject (removing leading whitespace, though you
> # could easily deal with that within your perl script)
> SUBJECT=""
> :0
> * ^Subject:[    ]*\/[^  ].*
> {
>        SUBJECT=$MATCH
> }
>
> # this will pass the subject to your perl script, using the return value
> # to determine if the procmail recipe should take some further action.
> :0
> * ? /path/to/some/script.pl "$SUBJECT"
> {
>        # do something (such as sending your "there's no PO number" notice)
>
> }
>
> ---
>  Sean B. Straw / Professional Software Engineering
>
>  Procmail disclaimer: <
> http://www.professional.org/procmail/disclaimer.html>
>  Please DO NOT carbon me on list replies.  I'll get my copy from the list.
>
> ____________________________________________________________
> procmail mailing list   Procmail homepage: http://www.procmail.org/
> [email protected]
> http://mailman.rwth-aachen.de/mailman/listinfo/procmail
>

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.