After months of servicing an email account which kept requiring me to delete emails to free up space I finally decided to make the switch to Google Apps and take advantage of GMail and apps for businesses.
The setup process of Google Apps was very straight forward however the process of migrating email from one account to the other proved frustrating at best. Google Apps has a built in migration tool but because it was unable to verify the ssl certificate on the other server it wouldn’t continue the process.
Step 2 was to try an app on the Google Apps marketplace called Carbo. This was happy enough to connect to the other server and even started bringing in the emails, but after importing email 90/2878 I got an email saying it was complete. Trying to restart the process to try again proved useless as I had used my 1 and only free migration.
Back to the drawing board and I found a perl script which has been recommended called imapsync. While this was a little more manual than I would have liked, it actually worked beautifully and all mail was imported successfully. Below I’ll outline exactly what needed to be done…
Running it on Debian 7 was apparently ‘not easy’ according to the install notes. But in reality there were only a few commands that were needed to be run.
sudo apt-get install libauthen-ntlm-perl libcrypt-ssleay-perl libdigest-hmac-perl libfile-copy-recursive-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmail-imapclient-perl libmodule-scandeps-perl libnet-ssleay-perl libpar-packer-perl libterm-readkey-perl libtest-pod-perl libtest-simple-perl libunicode-string-perl liburi-perl
BashThis will install all the perl dependencies that are needed.
cpan Data::Uniqid
BashWe manually need to install this perl dependency because debian doesn’t have a package available for it yet.
Next either clone or download the imapsync zip from its github site.
git clone https://github.com/imapsync/imapsync.git
cd imapsync
sudo make install
BashAnd finally run the sync with the following (making sure you change the bits in <>):
imapsync --syncinternaldates --host1 <host1> --port1 993 --ssl1 --user1 <user1> --password1 <pass1> --host2 imap.gmail.com --port2 993 --ssl2 --user2 <[email protected]m> --password2 <pass2> --useheader 'Message-Id' --skipsize --noauthmd5 --reconnectretry1 1 --reconnectretry2 1
BashIt’s as easy as that!