Imapsync - IMAP synchronization, sync, copy or migration tool. Synchronise mailboxes between two imap servers.
First, you’ll need to install the epel repo (skip if you already have it):
# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
Now, use yum to install imapsync.
# yum install imapsync
Now that it’s installed, let’s print out the help file and take a look at all of the usefulness of imapsync:
# imapsync --help
Now let’s start a sync. Let’s just do one user first.
Create a file email_migration.sh
# vim email_migration.sh
Include the below lines into the file, and replace the email ID and password.
/usr/bin/imapsync \
--host1 old.mailserver.com --user1 test@domain.com --password1 mypasswd \
--host2 new.mailserver.com --user2 test@domain.com --password2 mypasswd
Make it executable:
# chmod +x email_migration.sh
Now run it!
# ./email_migration.sh
The migration will start now.