How To Selectively Archive and Backup MBox/IMAP Mails Using ArchiveMail
Maybe some of your mailboxes are quite large (eg, over 10,000 messages) and they are taking a while to load in your mail reader. Perhaps they are taking up too much space on your disk. Archiving old messages to a separate, compressed mailbox is possible. Here’s a quick post on managing your mbox/imap mailboxes directly. Using this tool, you can move mail messages older than x days to a separate mbox file, or even to a compressed backup file.
What is Archivemail?
Archivemail is a tool written in Python for archiving and compressing old email in mailboxes. Archivemail can move specific and/or group of mbox/imap email messages older than the specified number of days to a separate mbox format mailbox that is compressed with gzip, or optionally just delete old email or simply archive it to separate mbox/imap file.
Here are several advantages of implementing archivemail:
1. Your mail reader will get a huge performance boost loading and reading your mail.
2. You will be taking up less disk space, since old mail will be compressed. (Mail usually compresses quite nicely.)
3. You won’t be confronted with semi-obsolete mail all the time.
Features overview
* Supports archiving IMAP, mbox, MH and Maildir format mailboxes.
* Old mail can be either archived or just deleted.
* The age in days that is considered old is configurable – it defaults to 180 days. You can also set an absolute limit date.
* Messages that are flagged important are not archived or deleted unless explicitely requested.
* Can be configured to preserve unread mail.
* Can be configured to only archive messages over a given byte size.
* Stores the compressed archive mailboxes in a directory of your choice, with an extension of your choice.
* Easy read-only testing, not touching your valuable data.
* Supports IMAPS/SSL.
* When archiving IMAP mailboxes, the message selection can be refined by extending the underlying IMAP SEARCH command with arbitrary search keys (you will have to cope with the raw IMAP protocol, though).
How To Install ArchiveMail in Fedora 9
Simply issue yum
# yum -y install archivemail
Sample usage of archivemail
To archive mails older than 10 days, simply
# archivemail -d 10 root
legend:
10 – number of past days
root – mbox/imap mail
Result:
root:
archived 133 of 540 message(s) (128.0kB of 142.6MB) in 13.3 seconds
The above archivemail command moves all mbox mails that is older than 10 days and store it to root_archive.tgz as a backup mbox file. If the archive file is already existing, archivemail simple appends any results to existing archivemail archive.
To archive mbox mails older than 2008-08-10
# archivemail -D “2008-08-10″ root
To specify destination folder when archiving mail, simply make use of -o parameter
# archivemail -d 30 root -o /root/archive
To delete all mails rather than archiving it, simply use archivemail as shown
# archivemail –delete -d 100 root
Use the above command with caution as it handling the mbox/imap mails directly.
To copy archived mails rather than archive it, simply
# archivemail -v –copy -d 360 mymail
By default, all archivemail output files are compressed and follow the format mailbox_archived.tgz file format. You can override the compression setting by issuing
# archivemail -d 15 root –no-compress
The above command does not compressed the file.
If you wish to execute an archivemail dry run, without actually arching mail, simply
# archivemail -v -n -d 15 mymail
All is done.
you can also grab the RSS feed or Subscribe to Techgurulive by Email
































