How to Install and Use Imapsync on Ubuntu & Debian

Channel: Linux
Abstract: Memory/biggest message ratio-78373 bytes (-76.536 KiB)

Imapsync is an IMAP transfer tool used for copying emails from one IMAP server to another IMAP server. This article will help you to install imapsync on Ubuntu, Debian, and Linuxmint systems and transfer all your Mailboxes and emails between two IMAP servers.

  • Read this => How To Install Postfix Mail Server on Ubuntu
Step 1 – Prerequisites

Let’s start with the installation of the required packages for imapsync. Here is a long list of Perl libraries and other packages to install on your system.

sudo apt-get install git rcs make makepasswd cpanminus

sudo apt-get install gcc libssl-dev libauthen-ntlm-perl \ 
     libclass-load-perl libcrypt-ssleay-perl liburi-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-ssleay-perl libpar-packer-perl \
     libreadonly-perl libsys-meminfo-perl libterm-readkey-perl \
     libtest-fatal-perl libtest-mock-guard-perl libtest-pod-perl \
     libtest-requires-perl libtest-simple-perl libunicode-string-perl  

Also, install required Python modules using CPAN on your system.

sudo cpanm Crypt::OpenSSL::RSA Crypt::OpenSSL::Random --force
sudo cpanm Mail::IMAPClient JSON::WebToken Test::MockObject 
sudo cpanm Unicode::String Data::Uniqid
Step 2 – Install Imapsync

After completing the installation of required packages. Download latest imapsync code from its official Github repository on your local system.

git clone https://github.com/imapsync/imapsync.git

Navigate to newly cloned repository and install it with the following commands on your system.

cd imapsync
mkdir -p dist
sudo make install

At this stage, your system is ready to migrate all data from one email account to another email accounts using IMAP.

Step 3 – Transfer Emails with IMAP

So you are ready for migration. Before migration make sure both accounts have IMAP running and accessible from your system. After that use following command syntax.

imapsync --host1 imap.source.example.com  \
	   --user1 [email protected] 	    \
	   --password1 S0urcePassw0rd  	    \
	   --ssl1			    \
	   --host2 imap.dest.example.com    \
	   --user2 [email protected] 	    \
	   --password2 Dest1nat10NPassw0rd  \
	   --ssl2

The command will take a long time as per the size of your source Mailbox. After completing all process, you will see a long list of output. Check the output to find if any error occurred during transfer. Below is the small part of the result.

  • Read this => 5 Ways to Send Email From Linux Command Line
Transfer started at Thu May 11 11:45:37 2017
PID is 4969
...
...
...
Total bytes transferred           : 78373 (76.536 KiB)
Total bytes duplicate host1       : 0 (0.000 KiB)
Total bytes duplicate host2       : 0 (0.000 KiB)
Total bytes skipped               : 0 (0.000 KiB)
Total bytes error                 : 0 (0.000 KiB)
Message rate                      : 0.1 messages/s
Average bandwidth rate            : 3.0 KiB/s
Memory consumption                : 217.0 MiB
Biggest message                   : 57947 bytes (56.589 KiB)
Memory/biggest message ratio      : 3927.0
Start difference host2 - host1    : -2 messages, -78373 bytes (-76.536 KiB)
Final difference host2 - host1    : 0 messages, 0 bytes (0.000 KiB)
Detected 0 errors

Reference:

  • https://imapsync.lamiral.info/
  • https://github.com/imapsync/imapsync

Ref From: tecadmin

Related articles