On 14 Nov 2013, at 21:57 , Bart Schaefer
<barton(_dot_)schaefer(_at_)gmail(_dot_)com> wrote:
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
This is the recipe I have to rewrite the "Date:" header based on the received
header. It may be useful
WEEKDAYS = '(S(un|at)|Mon|T(ue|hu)|Wed|Fri)'
MONTHS = '(J(an|u[ln])|Feb|Ma[ry]|A(pr|ug)|Sep|Oct|Nov|Dec)'
WHICHRECVD = 'by [^ ]*(mail.)?covisp.net'
YEARS = '(199[0-9]|20[0-9][0-9])'
TIMESTAMP = '([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]'
RCVD_STAMP = "$WEEKDAYS, [0-9]+ $MONTHS $YEARS $TIMESTAMP"
:0
* $ ^Received:.*$WHICHRECVD.*\/$RCVD_STAMP
{ xDATE = "$MATCH" }
:0
{
# From: Sun, 02 Mar 2003 08:29:12
# To: Sun Mar 2 08:29:12 2003
:0
* $ xDATE ?? ^^\/$WEEKDAYS
{ ENVELOPE = "<$CLEANFROM> $MATCH" }
:0
* $ xDATE ?? ^^$WEEKDAYS, +[0-9]+ \/$MONTHS
{ ENVELOPE = "$ENVELOPE $MATCH"
MYMONTH=$MATCH
}
:0
* $ xDATE ?? ^^$WEEKDAYS, +\/[0-9]+
{ ENVELOPE = "$ENVELOPE $MATCH" }
:0
* $ xDATE ?? ()\/$TIMESTAMP
{ ENVELOPE = "$ENVELOPE $MATCH" }
:0
* $ xDATE ?? $MONTHS \/$YEARS
{ ENVELOPE = "$ENVELOPE $MATCH"
MYYEAR=$MATCH
}
# Make sure the $ENVELOPE matches the desired format
# If it does, rewrite the From_
:0 fhw
* $ ENVELOPE ?? $WEEKDAYS $MONTHS [0-9]+ $TIMESTAMP $YEARS^^
| sed "s,^\(From \).*,\1$ENVELOPE,"
# And add a header showing we've altered the message
:0 afw
| formail -i"X-Date-Munge: SUCCESS"
# Otherwise, show that the attempt failed.
:0 efw
| formail -i"X-Date-Munge: FAILED"
MONTHSTRING=Jan01Feb02Mar03Apr04May05Jun06Jul07Aug08Sep09Oct10Nov11Dec12
:0
* $ MONTHSTRING ?? $MYMONTH\/..
{ MYMONTH=$MATCH }
MYDATE=$MYYEAR-$MYMONTH
# If the message is not from the current month and year, mark it read
:0fw
* 9876543210^0 ! $MYYEAR ?? $CYEAR
* 9876543210^0 ! $MYMONTH ?? $CMONTH
| formail -I"Status: RO"
}
: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 }
}
--
This wasn't a proper land. The sky was blue, not flaming with all the
colours of the aurora. And time was passing. To a creature not born
subject to time, it was a sensation not unakin to falling. --Lords and
Ladies
____________________________________________________________
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