procmail
[Top] [All Lists]

Re: copy attachments to two destinations - solved

2013-11-14 23:00:55
On Tue, Nov 12, 2013 at 11:08 PM, Eric Smith <es(_at_)fruitcom(_dot_)com> wrote:

This works fine for me albeit with some defensive overkill
{
...
:0wc:uudeview.lock
| /usr/bin/uudeview -i +a  -p /home/eric/ -e .html -e .txt -e .001 -
:0w:uudeview2.lock
| /usr/bin/uudeview -i -p /someplace -e .html -e .txt -e .001 -
:0
| for i in /_/*.zip;do unzip -f -d /else $i;done
}

I'm not sure what's supposed to happen with that last rule, but it's
going to eat anything that fails to uudeview.  You probably don't want
to run it as a delivering recipe.

Muses:
Now if only I could insert the date into the filename ...

The following reads the year and month out of the mbox-format "From
..." line.  If your messages are not being delivered in that format,
you'll have to parse some other header instead.  Most of the work is
converting a month name into a number.

# These are just silly defaults
YEAR=missing
MONTH=date

:0
* ^From .*(Sun|Mon|Tue|Wed|Thu|Fri|Sat) \/.*
{
 :0
 * 1^1 MATCH ?? Jan .*\/[12][09][0-9][0-9]^^
 * 2^1 MATCH ?? Feb .*\/[12][09][0-9][0-9]^^
 * 3^1 MATCH ?? Mar .*\/[12][09][0-9][0-9]^^
 * 4^1 MATCH ?? Apr .*\/[12][09][0-9][0-9]^^
 * 5^1 MATCH ?? May .*\/[12][09][0-9][0-9]^^
 * 6^1 MATCH ?? Jun .*\/[12][09][0-9][0-9]^^
 * 7^1 MATCH ?? Jul .*\/[12][09][0-9][0-9]^^
 * 8^1 MATCH ?? Aug .*\/[12][09][0-9][0-9]^^
 * 9^1 MATCH ?? Sep .*\/[12][09][0-9][0-9]^^
 * 10^1 MATCH ?? Oct .*\/[12][09][0-9][0-9]^^
 * 11^1 MATCH ?? Nov .*\/[12][09][0-9][0-9]^^
 * 12^1 MATCH ?? Dec .*\/[12][09][0-9][0-9]^^
 {
  YEAR=$MATCH
  MONTH=$=
 }

 :0
 * MONTH ?? ^^.^^
 { MONTH=0$MONTH }
}
____________________________________________________________
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