procmail
[Top] [All Lists]

Re: Splitting based on month/year

2000-02-08 23:32:49
Email Archive <archive(_at_)securityinsight(_dot_)com> writes:
I am trying to archive all my email for a hundred or so 
email lists I archive into seperate files based on month
and year. I am having some problems though. When running against
a mbox file I get messages like:

procmail: Skipped "Dec 21 20:53:14 1999"
...
Looks like one line per email in the file. Nothing is showing up
in the appropriate files.

What am i doing wrong? I am kinda new to all this procmail 
so go easy on me.. I looked over the FAQ but couldnt figure out
what was wrong. Also since my .procmailrc is huge already just matching
list addresses is there a way I can put this recepie into a function or
something or another file and include it in each mailing list recepie
without having to have the same dozen lines over and over in the
.procmailrc for each mailing list? I hope to use these seperate split up
mail files to archive out to mhonarc. 

Thanks.. Mike

  :0
  * ^*sun-managers
  {
     :0
     * ^From [^ ]+  \/.+
     FROM_=$MATCH
...

  #....Many other email lists with the exact same recepie.

  :0:
  $DIR/Unknown

You forgot to put braces around the assignment to FROM_.  Without them
it looks like mailbox action.  After variable expansion that looks
something like:

        FROM_=Tue Dev 21 20:53:14 1999

Procmail delivers the message to the mailbox FROM_=Tue.  When it
discovers that that either doesn't exist or is just file (created by
previous message processed by this recipe) it no longer makes sense to
have multiple folders in the action line, so it skips the rest of the
expanded line.  Thus the "Skipped" messages.  The solution is thus to
wrap the assignment in braces.  You'll find a bunch of files in $MAILDIR
that should probably be deleted that have names FROM_=Sun, FROM_=Mon,
FROM_=Tue, etc.

Your comment "Many other email lists with the exact same recepie [sic]"
would suggest that you factor the extracting of the month and year to
before all the recipe that might use that information.  Since it doesn't
use any external programs it should be relatively cheap CPU-wise, so
that should hold you back from moving it up and out.

Also, that regexp for matching messages to sun-managers is probably not
what you want.  It'll match any message which has "sun-managers" in the
header, period.  The "^*" is actually superfluous and doesn't affect what
the condition matches.  If that's really what you want, then just write:

        :0
        * sun-managers
        ...

It would probably be better to restrict this to matching certain headers
(say, To:, Cc:, X-Mailing-List:, and From:), but that's your call.

Philip Guenther

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