I had been toying with the idea of moving my hosted emails off the Dreamhost servers and into the hands of Google. My main reason was that I was in fact using IMAP for all my emails and as great as it was, both squirrelmail and roundcube weren’t the best web based email clients. They were just a bit clumsy when loading up tens of thousands of emails and the search wasn’t nearly usable.
I ended up finding Josh Janicek’s blog. It was a great write up of the whole process. The only difference was that I had a huge amount of emails to transfer and doing it through any desktop client (mapping both old and new accounts and dragging and dropping the emails) wasn’t going to happen. I tried through Outlook and Thunderbird but they sat and didn’t respond. Apple Mail did a very reasonable job, but the issue was that it took days, during which time, more mail came in, and then I would have no idea if duplicates would be recreated if I dragged them over again.
My requirements were to:
- Sync over 10 gigs of emails
- Sync multiple email accounts
- Make sure its repeatable up to the very last moment before I cut over DNS servers
- Learn something new
I then found IMAPSync. This tool is great to migrate emails from IMAP to IMAP servers. It also handles folders quite well in that, I could run multiple instances across different folders.
For instance, this is the normal command to sync ALL of your emails and folders:
./imapsync –host1 emailserver.dreamhost.com –user1 myemail@myemail.com –passfile1 myemailpasswordfile –host2 imap.gmail.com –user2 myemail@myemail.com –port2 993 –ssl2 –passfile2 myemailpasswordfile2
This is one to include any folders that include “WORK”:
./imapsync –host1 imapemailserver.dreamhost.com –user1 myemail@myemail.com –passfile1 myemailpasswordfile –host2 imap.gmail.com –user2 myemail@myemail.com –port2 993 –ssl2 –passfile2 myemailpasswordfile2 –include “WORK”
Subsequently, you could have a separate folder and migrate the other folders (thus removing the overlap) at the same time:
./imapsync –host1 imapemailserver.dreamhost.com –user1 myemail@myemail.com –passfile1 myemailpasswordfile –host2 imap.gmail.com –user2 myemail@myemail.com –port2 993 –ssl2 –passfile2 myemailpasswordfile2 –exclude “WORK”
Now specifically for Dreamhost (if you are running it from their servers), they do not have the latest version of IMAPClient installed so you will receive the following on running it:
$ ./imapsync
Mail::IMAPClient version 3.29 required–this is only version 3.25 at ./imapsync line 570.
BEGIN failed–compilation aborted at ./imapsync line 570.
The way around this is to use “i3” in the same directory. Inside the bundle from imapsync is the appropriate IMAPClient version and i3 references it so replace ./imapsync with ./i3 and you’re good to go!
./i3 –host1 imapemailserver.dreamhost.com –user1 myemail@myemail.com –passfile1 myemailpasswordfile –host2 imap.gmail.com –user2 myemail@myemail.com –port2 993 –ssl2 –passfile2 myemailpasswordfile2
Note: I don’t own the image – just taken from Google Image Search and here.
2 Comments