21 Jul 20:38
Re: Need to clear out inbox with procmail
From: Charles Gregory <cgregory <at> hwcn.org>
Subject: Re: Need to clear out inbox with procmail
Newsgroups: gmane.mail.procmail
Date: 2008-07-21 18:38:42 GMT
Subject: Re: Need to clear out inbox with procmail
Newsgroups: gmane.mail.procmail
Date: 2008-07-21 18:38:42 GMT
Nathan replied privately. Presume he meant to post to list.... On Mon, 21 Jul 2008, Nathan Brown wrote: > What would be the proper way to write that out? Just take out the line where > it's delivered and leave the rest the same? :0 * ^TO.*upload <at> example.com | /usr/local/bin/upload.sh Your script will receive the mail on 'standard input' (STDIN). .... procmail will consider this a 'delivering' recipe...
> 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.*upload <at> example.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.*upload <at> example.com
/pathto/mbox
:0
* ^TO.*upload <at> example.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
RSS Feed