procmail
[Top] [All Lists]

Re: Archiving mail

1997-11-13 10:12:11
| Thu 97-11-13 Andreas Sikkema <sikke600(_at_)hio(_dot_)tem(_dot_)nhl(_dot_)nl> 
list.procmail
| 
| What I want is something like this:
| :c:
| * ^From: (_dot_)*introspective-digest(_at_)tcp(_dot_)com(_dot_)*
| 1997_11_introspective_digest
| 
| What I want to do is the the folder name should be created
| automatically. 

Alan't date.rc is exellent. An I made a lightwight one which is 
named pm-jadate.rc, which I started using instead of calling expensive
'date'. I updated my pm-tips.txt to include this; would it work for you?

jari

    6.2 Using dates

        Calling `date' in your procmail script _many_ times is not a good idea.
        Few times won't hurt, like below where we save one exra call.

            YYYY    = `date "+%Y"`
            MM      = `date "+%m"`
            DD      = `date "+%d"`

            :0
            * YYYY ?? ..\/..
            { YY = $MATCH }

            TODAY   = "$YYYY-$MM-$DD"       # ISO standard time: eg. 1997-12-01

        You can also look the date from the first received header that will
        be same each time in your system. That could be a good alternative
        if you receive lot of mail and thus extra shell call should be
        avoided. There is two date packages available:

        o   pm-jadate.rc -- Jari's Subroutine to parse "Tue, 31 Dec 1997"
        o   date.rc -- Alan's procmail-lib: parse DATE or from headers
            Resent-Date:, Date, and From

    Saving to monthly folders

            # Use any date method mentioned previously to get variables
            # YYY YY MM DD defined
            #
            # Archive digests monthy
            #
            :0 c:
            * ^From:.*\/mailing-list-digest(_at_)some(_dot_)net
            {
                MBOX = `echo $MATCH | sed -e 's/@.*//' `
                :0 :
                $YYYY-$MM-$MBOX
            }







<Prev in Thread] Current Thread [Next in Thread>