imapsync software is a command line tool allowing incremental and recursive imap transfers from one mailbox to another, both anywhere on the internet or in your local network.

imapsync is useful for imap account migration or imap account backup.

First, create same mailbox on the new mail server.

Then, install imapsync on CentOS 6 or 7.

yum install imapsync

NOTE: hostname address should be IMAP SERVER ADDRESS.

imapsync –host1 old-hostname –port1 993 -ssl1 –user1 –password1 password-of-old-emailid –host2 new-hostname –port2 993 -ssl2 –user2 –password2 password-of-new-emailid

imapsync –host1 –port1 993 -ssl1 –user1 –password1 q1w2e3r4 –host2 –port2 993 -ssl2 –user2 –password2 q1w2e3r4