Last update April 5 2015!
I’ll try use the new Yahoo! Mail for a while but I need my old emails messages. I am a Gmail user and want to copy everything to Yahoo! Mail. After search a lot at Google I found imapsync. It is a Linux program that runs on the command line and can connect to a IMAP server and copy to another one.
I am a MAC user, so I don’t have Linux machines except servers I don’t want to install things I’ll use just once. So I created a Ubuntu 12.10 64 bits droplet at Digital Ocean and install dependencies and start to sync my emails messages. First we must install dependencies and after install the imapsync. Take a look:
apt-get update apt-get install libdigest-hmac-perl libdigest-hmac-perl libterm-readkey-perl libterm-readkey-perl libdate-manip-perl libdate-manip-perl libmail-imapclient-perl
Now lets install imapsync downloading the .deb file (version 1.315):
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/i/imapsync/imapsync_1.315+dfsg-1_all.deb dpkg -i imapsync_1.315+dfsg-1_all.deb
As I want to backup Gmail messages into Yahoo! Mail I must do the follow:
imapsync --host1 imap.gmail.com --user1 email@example.com --password1 ******** --host2 imap.mail.yahoo.com --user2 firstname.lastname@example.org --password2 ******* --syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --port1 993 --port2 993 --exclude "All Mail|Spam|Trash" --allowsizemismatch
Gmail to Google Apps
If you want to migrate a Gmail account to a Google Apps account this will solve your problem. It worked like a charm for me:
imapsync --host1 imap.gmail.com --port1 993 --user1 email@example.com --password1 ****** --ssl1 --host2 imap.gmail.com --port2 993 --user2 firstname.lastname@example.org --password2 ****** --ssl2 --syncinternaldates --split1 100 --split2 100 --authmech1 LOGIN --authmech2 LOGIN --allowsizemismatch --useheader Message-ID
Comments about some parameters:
- split1 100 and split2 100: Number of messages requests. The default value is 1000 but 100 is a good choice.
- allowsizemismatch: This options ignore different messages size. Is not present a lot os messages will be ignored because different size between both mail servers.
- useheader Message-ID: This option is necessary when transferring large folders. If not present the process will be killed and won’t be completed. Now you must wait. If you want you can copy the entire command to another one, like
run_imapsync and give it execute privilegies.
If you also want to let the process running, just run the following and be happy!
./run_imapsync >> /dev/null &
The & will run the process in background mode.
UPDATE Jan 20, 2013
Previously on this post I was using the version 1.315 of imapsync. But there is newer versions that are better than 1.315, that crashes sometimes without reason. Today (Jan 20, 2013), I found the version 1.518 that has some improves. You’ll find the imapsync in this site: http://imapsync.lamiral.info/, but you must to pay to download the newer version. BUT imapsync is for free in GitHub. Lets install the newer version (1.518). First we have to install another dependencies in Ubuntu (my Linux server):
apt-get install makepasswd rcs perl-doc libmail-imapclient-perl make
After you must clone the GIT repository from Github. The URL is https://github.com/imapsync/imapsync. First you have to install git (if not already installed):
apt-get install git-core git-doc git-svn git-gui gitk
Now we can clone the GIT repository:
git clone git://github.com/imapsync/imapsync.git
After that, enter inside the imapsync dir created and run make install:
cd imapsync make install
Ok! You’ll se something like this:
root@server:~/imapsync# make install perl -c imapsync imapsync syntax OK pod2man imapsync > imapsync.1 mkdir -p /usr/bin install imapsync /usr/bin/imapsync chmod 755 /usr/bin/imapsync mkdir -p /usr/share/man/man1 install imapsync.1 /usr/share/man/man1/imapsync.1 chmod 644 /usr/share/man/man1/imapsync.1
Now you have the newer version installed (1.518):
UPDATE Apr 25, 2014
Today I started a migration from Google Apps to Gmail and had some problems with my own post 🙂
I created a Digital Ocean droplet with Ubuntu 12.04 64 bits and I installed everything using
apt-get (check all needed packages on this hole post). After that I’ve cloned the GitHub repo and run
make install. That’s the problem. I have a problem like:
Can't locate File/Copy/Recursive.pm in @INC (@INC contains: ./W/Mail-IMAPClient-3.35/lib /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./imapsync line 568. BEGIN failed--compilation aborted at ./imapsync line 568.
So, we need here the ‘file-copy-recursive’ from Perl. It’s easy to install it:
apt-get install libfile-copy-recursive-perl
Just a tip! Let’s check if your Perl is with all packages Imapsync need:
perl -c imapsync
If you see the follow result everything is ok:
imapsync syntax OK
Now you can go inside the imapsync folder (cloned from GitHub), and run:
Thanks for reading!
Update Apr 5 2015
Thanks for @pgf67 for the contribution. Using the last
imapsync version (1.607) you must install some packages:
sudo apt-get install libio-tee-perl libunicode-string-perl