How to Migrate Mails with IMAP Sync on Ubuntu 18.04 / 20.04 & CentOS 7

How to Migrate Mails with IMAP Sync on Ubuntu 18.04 / Ubuntu 20.04 and CentOS 7

IMAPSYNC is an open-source IMAP transfer tool that is used to migrate emails from one IMAP server to another. It supports macOS, Linux, and Windows. It is a command-line-based tool. IMAPSYNC only migrates emails, not contacts, events, etc. For CentOS, the IMAPSYNC package is directly available on the CentOS repositories but for Ubuntu, we need to use the git repository to download and install the IMAPSYNC package. In This Tutorial, We Will Learn How to Migrate Mails with IMAP Sync on Ubuntu 18.04 / 20.04 & CentOS 7

Install Imapsync on Ubuntu 18.04 / 20.04

  • Before IMAPSYNC installation, install all the dependencies with the following command.
sudo apt-get install libauthen-ntlm-perl libclass-load-perl libcrypt-ssleay-perl libdata-uniqid-perl libdigest-hmac-perl libdist-checkconflicts-perl libfile-copy-recursive-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmail-imapclient-perl libmodule-scandeps-perl libnet-dbus-perl libnet-ssleay-perl libpar-packer-perl libreadonly-perl libregexp-common-perl libsys-meminfo-perl libterm-readkey-perl libtest-fatal-perl libtest-mock-guard-perl libtest-mockobject-perl libtest-pod-perl libtest-requires-perl libtest-simple-perl libunicode-string-perl liburi-perl libtest-nowarnings-perl libtest-deep-perl libtest-warn-perl make cpanminus -y
  • Install Git package
sudo apt install git -y
  • From git, download the IMAPSYNC package.
git clone https://github.com/imapsync/imapsync.git
  • First, compile the IMAPSYNC package. To compile, run the following command.
cd imapsync
mkdir dist
  • Install the IMAPSYNC package.
sudo make install
  • To check the IMAPSYNC version, run the following command.
imapsync -v

Read Also: How to Set Up SSH Key-Based Authentication on Ubuntu 20.04

Install Imapsync on CentOS 7

  • IMAPSYNC package is available in the EPEL repository. To install the EPEL repository, run the following command.
sudo yum install epel-release -y
  • To install the IMAPSYNC package, run the following command.
sudo yum install imapsync -y
  • To check the IMAPSYNC version, run the following command.
imapsync -v

Transfer Emails with the IMAPSYNC tool

imapsync --host1 Source_Server --user1  Source_Email  --password1 Source_Email_Password --host2 Destination_server --user2 Destination_Email   --password2 Destination_Email_Password

Source_Server – Mention the IP address of the Source server.

Source_Email – Mention the Source email address.

Source_Email_Password – Mention the password of the Source mail account

Destination_server – Mention the IP address of the destination server.

Destination_Email – Mention the Destination email address.

Destination_Email_Password – Mention the password of the Destination mail account.

For example:-

imapsync --host1 190.132.XX.XX2 --user1 [email protected]  --password1 dsdsd23@dkd --host2 190.132.XX2.XX --user2 [email protected]   --password2 dsdsd23@dkd

Conclusion – Migrate Mails with IMAP Sync

In this tutorial, we have learned how to install and use IMAPSYNC on Ubuntu 18.04/20.04 and CentOS. IMAPSYNC is one of the popular tools for mail migration. With the help of this tool, we can easily migrate emails from one server to another.

If you guys have any queries, let me know in the comments section.