Re: copy attachments to two destinations - solved

Eric Smith <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
Bart Schaefer wrote on Fri-15-Nov 13  5:57AM
> > 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.
Indeed this is the last rule (of many) in the stanza, so its job
is to unzip any zipped attachments and then to eat the mail.

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

Thanks Bart for this nice code, but the uudeview does not give the option
to rename attachments, so I will use your rule combined with perl's
MIME::Parser instead, which does allow renaming.

Eric

> 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 }
> }
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.