Step1
Install imapsync on old or new server, you could also install it on your computer if your running Linux . Since imapsync establish connection between old and new imap server to sync the emails you could use any machine that can run imapsync to move emails from one server to another.
On Ubuntu
apt-get install imapsync
On Centos
yum install imapsync
Step 2
Run the below command replacing details that match your old and new server,Remember to create email account on new server so that there is a empty mailbox to sync with old server mail box
/usr/bin/imapsync \
–host1 old.imapserver.com –user1 username@yourdomain.com –password1 password-for-the-account \
–host2 new.imapserver.com –user2 username@yourdomain.com –password2 password-for-the-account
Having trouble moving emails to new server?, Let us move the emails to new server for you at just $40 per domain Get Started