procmail
[Top] [All Lists]

Re: Archiving mail

1997-11-12 13:54:26
Andreas Sikkema asked,

| Is there a way to get procmail save mail to a folder with a date in
| the name? I want procmail to save some mail to a folder that changes
| it's name every month.

Andreas, surely there's a way, but if you want to tell us what that way is,
we can't, because you've left a lot of information out.  I would need to ask
at least four more questions before giving you an answer:

1. Is the folder a plain file, a mail directory, or an MH-style directory?

2. Is this for particular items of mail or for your $DEFAULT?

3. How will the name of the month be incorporated into the name of the
folder?  The first three letters, the entire word, the two-digit decimal
numeral (01-12), the Roman numeral, the two-letter abbreviation, or some
other way I haven't guessed?  How will the designator for the month be
attached to any other word in the folder's name?  And if the month will be
inidicated by its name or an alphabetic abbreviation or the Roman numeral,
how should that be cased?

4. Should the name of the folder incorporate the year just in case last May's
folder is still not removed by next May 1 (for example)?  If so, do you want
all four digits of the year or just two?

There are answers for every possibility -- and you can get the current month
by extracting it from the From_ line; there is no need to run date -- but
posting them all would make the answer very long.

| Or do I need another app to do this?

Probably not, but we don't yet know exactly what you want.

For one of the simplest examples, say you want $DEFAULT, which is a plain
folder, to change every month by including the first three letters of the
month in lower case and not the year:

  lower_months=janfebmaraprmayjunjulaugsepoctnovdec
  :0
  * ^^From [^ ]+ +[^ ]+ +\/([ADJNO][a-u][c-v]|Ma[ry]|Sep|Feb)
  * $ lower_months ?? ()\/$\MATCH
  { DEFAULT=$DEFAULT$MATCH }

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