Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Migrate emails from one server to another using imapsync  (Read 1356 times)

0 Members and 1 Guest are viewing this topic.

nandulalr

  • Guest
Migrate emails from one server to another using imapsync
« on: May 28, 2018, 02:14:03 am »
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):
Code: [Select]
# 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.
Code: [Select]
# 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:
Code: [Select]
# imapsync --help

Now let’s start a sync. Let’s just do one user first.

Create a file email_migration.sh
Code: [Select]
# vim email_migration.sh

Include the below lines into the file, and replace the email ID and password.
Code: [Select]
/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:
Code: [Select]
# chmod +x email_migration.sh

Now run it!
Code: [Select]
# ./email_migration.sh

The migration will start now.