Martin Probst's weblog

Migrating to Google Apps (copying IMAP mails)

Monday, October 29, 2007, 12:35 — 0 comments Edit

Now that Google has announced IMAP support for Gmail I’m migrating my email to Google Apps.

I’ve always had a HostEurope WebPack that provides some webspace, PHP, MySQL and IMAP. Some time ago I also ordered a virtual root server, to have some fun with rails, and a general space for experimentation. Then I wanted to take the webpack down as I didn’t need it anymore. But to be honest, I soon figured out that configuring and properly maintaining a whole email setup (MTA, IMAP, various spam filters, …) is indeed a lot of work.

So I moved all my email related stuff to Google Apps. So far it looks quite nice. It’s a bit strange that my regular Google user account didn’t integrate with the new one, but I simply dropped the old account.

Now I’m copying all my IMAP emails over to Google Mail. Surprisingly, I couldn’t find an easy to use, readily working script to copy IMAP messages from one host to another. There are several, but they seem to be either unmaintained, requiring obscure dependencies, or require bizarrely complicated setup.

So in a first class wheel reinvention act I wrote my own IMAP copy tool, in ruby; imapcopy.rb. Only dependency is highline for the password prompt, but if you don’t want that, you can easily adapt the code.

I really like it: it does everything I needed, doesn’t require any configuration, it only copies messages that are not present on the new host, and even prints a nice spinner ;-). Sample usage:

ruby imapcopy.rb user1@somehost.com user2@gmail.com@gmail.com
Password for user1@somehost.com:
Password for user2@gmail.com@gmail.com:
...

No comments.