News
Linux: Archive mail with imapsync on Courier-IMAP
I've been looking for a way to archive my mail and keep it readable from my email client. I work with evolution on a local Courier-IMAP server, running on my server.
Finally found it through imapsync. This one program is able to login your IMAP account, parse through your IMAP folder and move mail to another IMAP account if it matches certain criteria. I wanted to move mail that's older than 1 year. So I made an extra IMAP account 'archive' and had imapsync move my old mail items there.
The command looks as follows:
imapsync --host1 mail.olympus.home --user1 james@mail.olympus.home --passfile1 /etc/courier/mailarchive/james --authmech1 LOGIN --host2 mail.olympus.home --user2 archive@mail.olympus.home --passfile2 /etc/courier/mailarchive/archive --authmech2 LOGIN --minage 365 --syncinternaldates --syncacls -nofoldersizes --delete --expunge --expunge1
Only when running this the second time, it expunges the moved mail from the source account. Further it got stuck on one mail message (with a 108 Mb attachment) ending the process with "Out of memory". I moved that message manually, before running imapsync again.
And adding this command to my crontab makes mail archiving easy. I still have to watch out for concurrent IMAP access, but setting the cron entry on moment when I'm not working, solves that problem for me as well.
Imapsync can be found at http://www.linux-france.org/prj/.


No comments posted yet.
Only logged in users are allowed to comment. Register or log in.