procmail
[Top] [All Lists]

Re: Need to clear out inbox with procmail

2008-07-21 12:15:46
On Mon, 21 Jul 2008, Nathan Brown wrote:
I supposed that I could open up the script and see if i can
get it to accept STDIN...

VARNAME=<STDIN>;  :-)

Yes, the upload.sh is just a script that contains the path to the perl
script and the command line argument (which is the path to the mbox).

Presuming you are doing this so that you can have multiple addresses
behave this way, you could still directly execute the PERL script that
does the work and pass it the mbox name as a parameter on the procmail
recipe 'action' line.....

:0
* ^TO(_dot_)*upload(_at_)example(_dot_)com
| /usr/local/bin/realperlupload.pl /pathto/mbox

And now that Holger pointed it out, yes, the syntax in your original
example was incorrect. A recipe has "one and only one" action line. So
the mail would be delivered to the folder, and the second recipe within
the braces would only execute when the first recipe's condition fails.

To do it "your way", you would need:

:0 c
* ^TO(_dot_)*upload(_at_)example(_dot_)com
/pathto/mbox

:0
* ^TO(_dot_)*upload(_at_)example(_dot_)com
| /usr/local/bin/upload.sh /pathto/mbox

....and I would recommend a 'sleep' command at the beginning of the script
to give the delivery to /pathto/mbox time to complete. Carbon copy
recipes are run in parallel....

But really, reading from STDIN is the way to handle this requirement....

- Charles


____________________________________________________________
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