Migrating and/or backing up your email (IMAP) account

posted by Allan@TechCrammer @ 2:25pm, Monday 5 January 2009.

When I worked for a customer support help desk one of the requests I would get was "Please provide me a backup of my email files". Either they just wanted to free up space through archiving, or to migrate to another email server completely.

It was hard to explain that if I just gave you a "backup" of the files, say for instance in a "tar" format, that you probably wouldn't be able to do much with these. IMAP has its own internal database for flags (seen, unsen, dates, etc) so unless you were just looking at more of a disaster recovery plan, I would not recommend just tar'ing the files and preferably doing an IMAP level synchronisation.

Nowadays our email providers give us gigabytes of storage, though it still may happen that you find yourself wanting to migrate years worth of messages and folders from your current IMAP account to a different provider.

There are an assortment of ways and software to do this, though I have personally used a Perl based script called plainly enough IMAPSYNC to do the work for quite awhile. The link below is to the Open Source site at Freshmeat where you can download it.

http://freshmeat.net/projects/imapsync/

After installing, you can simply run your process from the command line. There are alot of options, though for a basic run, you will need to know a few things; such as the old/new IMAP server and the old/new passwords. Below is a sample I would run within the same network. If going outside you may want to enable the secure  methods.

imapsync --noauthmd5 --subscribe --syncinternaldates --host1 imap1.domain.com --user1 username1 --password1 'password1' --host2 imap2.domain.com --user2 username2 --password2 'password2'

There is a verbose output which shows processes along the way. I have used this to transfer mailboxes from an old system to a new one with around 100GB in a weekend. The first time it runs it will obviously pull all files, the when you run again it will "synch" them. Think of how you already use "rsync" with your regular files. Though with this process you keep all your message flags (seen, unseen, dates, etc) and looks just like your old mailbox.

Anyway there are probably alot of these scripts out there, though I know this one worked well for us and being written in Perl was great it we ever needed to understand what it does underneath the hood, though never had to update anything.

"Synch" On,
Allan


  • Del.icio.us
  • Digg
  • Technorati
  • Blinklist
  • Furl
  • Reddit
  • Facebook

Comments

Submit Your Comment

You are not logged in.

Log In