Skip to main content
How to install imapsync and use it to migrate emails

How to install imapsync and use it to migrate emails

Recently, we came across a migration task where I need to migrate bulk emails from one email service provider to another. The issue was we had very limited access to the accounts – means we just had the login credentials for the email accounts. Our search for a tool to efficiently migrating this end up in “ImapSync”. So, this article is mainly aimed to give you an idea about ImapSync and how to install imapsync and use it to migrate emails.

What is ImapSync?

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, webmails are often tied to an IMAP server.

How to install imapsync and use it to migrate emails

Installing ImapSync

The imapsync tool is a CLI tool, and so you can install on Linux, simply by running:

CentOS:

yum install imapsync

Note: imapsync is provided EPEL repo. So, please enable it first if you get “No package found” error.

Check: How to Enable EPEL Repository in RHEL or CentOS 7.x/6.x/5.x

 

Ubuntu:

Install dependencies:

sudo apt-get install makepasswd rcs perl-doc libio-tee-perl git libmail-imapclient-perl libdigest-md5-file-perl libterm-readkey-perl libfile-copy-recursive-perl build-essential make automake libunicode-string-perl

Install modules from CPAN:

sudo cpanm JSON::WebToken Test::MockObject Unicode::String Data::Uniqid

Clone git repository:

cd $HOME
git clone git://github.com/imapsync/imapsync.git --depth 1

Build and install:

cd imapsync
mkdir dist
sudo make install

That’s it. You have installed ImapSync on your system. You can check the version of imapsync using the following command.

imapsync -v

Syncing emails between servers

The syntax for syncing emails from server1 to server2, both using SSL.

imapsync --host1 server1 -user1 [email protected] --password1 user1password --ssl1  --host2 server2 --user2 [email protected] --password2 user2password --ssl2

The above command will sync all emails from host1 to host2 and will give you real-time progress about the transfer. The amazing fact about imapsync is that if the connection suddenly drops, you can run the code again, and it will pick up from where it left.

See Also:

The Official ImapSync Website.

Thanks for reading. Please leave a comment below if you have any queries.

How to install imapsync and use it to migrate emails
4.1 (82.86%) 7 votes

GeeksAlive

TheGeeksAlive is all about Linux, Server Administration, Web Hosting and other Open Source Technologies.