It is a common scenario for people to migrate their Gmail accounts to Apps mail accounts. There are more than many how-to guides and tutorials covering this direction of the migration. But how about the opposite.
There are many obvious reasons for someone to migrate (back) to Gmail from a Google Apps mail account. Google Apps mail is used by many organisations, schools, etc. Thus, when we leave from that organisation, it becomes a necessity to migrate all our emails elsewhere.

So lets jump into this quick tutorial on how to migrate all emails from Google Apps mail to Gmail. There are few other mechanisms suggested across the internet, but the one that works smoothly is using “imapsync”.
“imapsync” software is a command line tool allowing incremental and recursive IMAP transfers from one mailbox to another. It is useful for Gmail account migration or account backups.
IMPORTANT NOTE:
- “imapsync” was a free tool, but now the author is charging almost $45 for a copy. It is affordable for commercial use, but for personal use the price is an overkill.
- The earlier versions of this software can be found on the internet and still be used without copyright violations. (DOWNLOAD the earlier version for FREE).
- This guide is based on a Windows installation. The use can be easily adapted to Linux and other platforms as we will be compiling from the Perl source code and running the software. (Those who are on Linux, you could simply follow the install instructions with the download file).
Step 1: Install Perl
- Download and install “Strawberry Perl”. (Install to the default install location).
- Double-click and Run the “update_env.pl” batch file to add the environment variables.
Step 2: Setup the Prerequisites
- Open “CPAN Client” under Start Menu -> Programs -> Strawberry Perl -> Tools.
- Run the following commands individually:
- install Mail::IMAPClient
- install Digest::MD5
- install Term::ReadKey
- install IO::Socket::SSL
- If this presents a warning with “Net::SSLeay could not find a random number generator” and “Do you REALLY want to continue? [Default: no]“, give “yes” and continue.
- install Date::Manip
- install File::Spec
- install Digest::HMAC_MD5
- install PAR::Packer
- At this point you should be all set with the Perl setup and the following command should not give any errors.
- perl -mMail::IMAPClient -mDigest::MD5 -mTerm::ReadKey -mIO::Socket::SSL -mDate::Manip -mFile::Spec -mDigest::HMAC_MD5 -e ”
Step 3: Install ‘imapsync’
- Download the earlier version of ‘imapsync’ for free from here (or buy the latest version from here).
- Extract the downloaded file, if you can’t extract a tar.gz, use 7-Zip.
- Open the “build_exe” batch file in a Notepad and change the folder path to the extracted folder.
- Run the “build_exe” batch file.
- This should have created a “imapsync.exe”.
Step 4: Using ‘imapsync’
- Open “Command Prompt”.
- Change directory to the ‘imapsync’ folder.
- The basic ‘imapsync’ command is,
-
imapsync --host1 mail.oldserver.com --user1 theoden ^ --host2 mail.newserver.com --user2 'theoden@newserver.com'
- For Gmail, change the following command with your Apps mail login and Gmail login details.
-
imapsync ^ --host1 imap.gmail.com --port1 993 --ssl1 --authmech1 LOGIN ^ --user1 theuser@oldmail.com --password1 password4user1 ^ --host2 imap.gmail.com --port1 993 --ssl2 --authmech2 LOGIN ^ --user2 newuserid@gmail.com --password2 password4gmail ^ --split1 100 --split2 100 ^ --reconnectretry1 30 --reconnectretry2 30 ^ --noauthmd5 --noreleasecheck ^ --timeout 1200 --allowsizemismatch
- Paste the modified command into the Command Prompt, ‘imapsync‘ should sync you mail accounts accordingly.
- It could take, hours (or days) to complete the sync, based on your internet connection speed and the amount of email in your mailboxes.
- For more ‘imapsync’ command reference run,
-
imapsync --help
- Once the sync is complete, you could also setup a forward all mails to the new Gmail account from the old Google Apps mail account.
This guide can look a bit more technical and for the ‘geek-handed’. If you follow the steps it should be straight forward.
However, if you are afraid you might burn your computer by doing this, just ask your friendly geek-next-door, and s/he should be happy to help you.
Happy migrating back to Gmail…!






I am so glad you’ve included this tutorial on your site. I’ve been a Google Apps user since January 2008, but have been increasingly frustrated with each new “feature” Google rolls out that alienates the Google Apps userbase. We should be able to use services like YouTube and Profiles, among others, with our apps accounts. I am a diehard Google fan with Android phones, a tablet, a Logitech Revue and a heavy user of their services. Why do they have to mess with something good?
Anyway, rant aside, thanks. I’m trying it now to get my e-mail onto Gmail so the old and the new will be in one place. Then, I’ll forward everything going to my apps account to Gmail.
It doesn’t have to be this difficult.
I got as far as the Strawberry setup and changing the directory path in build_exe.bat, but I’m stuck at the next step. In CMD prompt, I tried to CD to IMAPsync as well as to IMAPsync-1.350 (I have it under c:\IMAPsync\imapsync-1.350), but can’t get any commands to work. It’s been decades since I used command prompts. Any pointers?
You can verify your Perl installation by:
If that is working, then for command prompt CD:
If this works, type the following and post the output here:
Your build_exe.bat should look like this: http://pastebin.com/vXgqVP3U
Let me know if it works and if not what is the error you are getting, I’ll see if I can be of any help.
Thank you very very much for this guide.
A small note for Windows 7 users, Run CMD and Perl as administrator to avoid errors. One of them is a missing DLL error.
Hello,
Since you built imapsync.exe (v1.350) you could also share it. The license permits that,
http://ks.lamiral.info/imapsync/COPYING
You can also find last releases gratis if someone shares it. I don’t but some people do. Just search for it.
Thanks Gilles…
The binaries are here : http://linux-france.unixtech.be/prj/imapsync/
Just look for imapsync.exe
That’s useful… Thanks…