I was recently asked in our forums about archivemail, a python script that helps archive old email. After further research, I found that it is supported, and in this article I’ll give you some details on how to setup and use it if it sounds like something you may find useful.
For official documentation for archivemail, please see the archivemail sourceforge page.
- Download archivemail via https://sourceforge.net/projects/archivemail/files/
- Using your File Manager within cPanel, upload the .tar.gz file (archivemail-0.9.0.tar.gz) to your cgi-bin. After uploading, use the File Manager to then extract the file (right click the file and choose extract).
- To make the directory structure easier to remember, I’ve renamed the new archivemail-0.9.0 folder to archivemail.
Examples of Usage
archivemail will need to be ran using a cron job. For more help running a cron job, please see: How to run a cron job.
When looking at the examples below, please note these settings:
email address to archive: [email protected]
email for [email protected] is stored at /home/inmoti6/mail/inmotiontesting.com/brad
cPanel username: inmoti6
path to archivemail: /home/inmoti6/public_html/cgi-bin/archivemail/archivemail
I have setup the cron jobs to email me the output, which is presented below. To prevent receiving status emails, please use the -q flag.
Turns on quiet mode. Do not print any statistics about how many messages were archived. This should be used if you are running archivemail from cron.
Archive email older than 1 year
The command to run (the cron job)
/home/inmoti6/public_html/cgi-bin/archivemail/archivemail -nd 365 /home/inmoti6/mail/inmotiontesting.com/brad
This command would archive emails older than 365 days. The n flag means just to test the command, but don’t actually archive any emails.
I would have archived 0 of 13 message(s) (0B of 68.0kB) in 0.1 seconds
Archive email older than 3 days
The Command to run (the cron job)
/home/inmoti6/public_html/cgi-bin/archivemail/archivemail -d 3 /home/inmoti6/mail/inmotiontesting.com/brad
This command archives emails older than 3 days.
archived 13 of 13 message(s) (68.0kB of 68.0kB) in 0.0 seconds
The archived messages can be found here:
The email is actually archived in Mbox format. MBox stores all of your email in one single file. From our reading, there is unfortunately not an option to change the format the emails are stored in. Our servers no longer use mbox format for storing email, so you’ll need another program to actually read the archived email.
You can use notepad to open the file and read your emails. A quick search online shows there are several programs you can use to read / convert the email, many of which seem to require purchase though. We did find that Windows MBox Viewer seemed to work quite well, however we have not used it extensively.