Introduction:
The other day I was asked to install a completely new email server and transfer all the email accounts from the old mail server to the new one. I noticed that since the new mail server was using a different mail INBOX format I had to do some research and found this really good tool to do exactly what I needed called: imapsync

Installing the tool:
This tool programmed in Perl and is not free. It can be bought at http://imapsync.lamiral.info/.
Note: It does a great job and it’s really worth its price when you think of the time and hassle saved by using it.
You will probably need to install some extra needed Perl Modules as follows:

cpan App::cpanminus
cpanm IO::Tee
cpanm Mail::IMAPClient
cpanm Unicode::String
cpanm Sys::MemInfo
cpanm File::Tail

Using the tool:
Example 1: Copying all the mails in folder INBOX from jim account on localhost to another server with the same credentials:
– First we do a dry-run to see what will be transferred when I run it normally:

imapsync --dry \
      --host1 localhost          --user1 jim --password1 'secret1' --folder INBOX --tls2 \
      --host2 mail.myserver2.com --user2 jim --password2 'secret1' --nofoldersizes --nofoldersizesatend

Example 2: Copying all the mails and folders(no dry-run) from account martin@myserver1.com on localhost to a new account on another server with different credentials:

imapsync \
   --host1 localhost --user1 martin@myserver1.com --password1 secret1 \
   --host2 mail.myserver2.com --user2 martin@myserver2.com --password2 secret2
%d bloggers like this: