Shifting your email hosts and don’t know how to migrate the emails to the new server? Here today we will guide you how easy it is to migrate emails over IMAP. This entire process is made simple by free and open source tool called imapsync. Credits to the developer Gilles LAMIRAL for creating such a great tool.
Imapsync is an IMAP transfers tool. The purpose of imapsync is to migrate IMAP accounts or to backup IMAP accounts. IMAP is one of the three current standard protocols to access mailboxes, the two other are POP3 and HTTP with webmails. Imapsync runs on Windows, Linux, Mac OS X. Before we start working with the tool we need to first install it on our system.
Installation on CentOS 6/7
1. Log in to the root user.
2. Install access to the Epel repository via yum:
yum install epel-release
3. Then install imapsync and its dependencies:
yum install imapsync
Installation on Debian 9 Stretch
1. Log in to the root user.
2. Add the following repo in /etc/apt/sources.list to install imapsync dependencies.
deb http://deb.debian.org/debian stretch main contrib
3. Install the following imapsync dependencies
apt install -y \ libjson-webtoken-perl \ libauthen-ntlm-perl \ libcgi-pm-perl \ libcrypt-openssl-rsa-perl \ libdata-uniqid-perl \ libfile-copy-recursive-perl \ libio-socket-inet6-perl \ libio-socket-ssl-perl \ libio-tee-perl \ libhtml-parser-perl \ libjson-webtoken-perl \ libmail-imapclient-perl \ libparse-recdescent-perl \ libmodule-scandeps-perl \ libreadonly-perl \ libregexp-common-perl \ libsys-meminfo-perl \ libterm-readkey-perl \ libtest-mockobject-perl \ libtest-pod-perl \ libunicode-string-perl \ liburi-perl \ libwww-perl \ libtest-nowarnings-perl \ libtest-deep-perl \ libtest-warn-perl \ make \ cpanminus
Migration
Imapsync tool follows a certain pattern/syntax for emails transfer which includes the following things.
host1: IMAP Source Server Name or IP Address
user1: Source Login Email
password1: Source Login Password
host2: IMAP Destination Server Name or IP Address
user2: Destination Login Email
password2: Destination Login Password
Pattern/Syntax
./imapsync \
--host1
mail.rootadminz.com \
--user1
test1@rootadminz.com \
--password1
"secret1" \
--host2
mail.example.com \
--user2
test1@example.com \
--password2
"secret2"
Values will be changed as per the requirements.