Ed Jones wrote:
Hello all.
I'm running procmail to sort my incoming mail into different mailboxes
(pretty much the standard use for procmail!).
I'd like to start archiving mail from these mailboxes after a certain period
(perhaps a month). Obviously, I could simply write a cron script to move the
whole mailbox file to another location, compress it and touch a new mailbox
file with appropriate permissions, but that would be a bit messy -
especially if I need to read the messages again.
So how can I move messages from one mailbox to another after they've been
delivered? I can't see how I could invoke procmail from a cron job to read
individual messages in a mailbox to check their received date - am I trying
to use the wrong tool?
Look forward to your replies.
Ed
If you use maildir format it's trivial. Just move files over a certain age
to the new location.
If you use mbox format it's much more complicated. You need to be aware of
proper file locking, or stop mail delivery and mail reading while you do
your housekeeping. You can use formail to scan the mbox file and send
individual messages to standard output with the -s option, you can then
process them as you want. There's also
archivemail.sourceforge.net, but I've
never tried it.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw(a)ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555