• Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install and Use Imapsync on Ubuntu & Debian

Written by Rahul, Updated on February 22, 2021

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

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

10 Comments

  1. Avatar Cédric Barthe Reply
    November 26, 2020 at 3:50 pm

    Same for me today on ubuntu 20.04, had to install the following too :

    sudo cpanm Crypt::OpenSSL::RSA Encode::IMAPUTF7 File::Tail JSON::WebToken::Crypt::RSA Regexp::Common Encode::IMAPUTF7 Test::Deep

    So the following lien is enough for installing all perl modules in one time :

    sudo cpanm Mail::IMAPClient JSON::WebToken Test::MockObject Unicode::String Data::Uniqid Crypt::OpenSSL::RSA Encode::IMAPUTF7 File::Tail JSON::WebToken::Crypt::RSA Regexp::Common Encode::IMAPUTF7 Test::Deep

    • Avatar Bevan Reply
      January 6, 2021 at 3:50 am

      Debian 10:
      apt-get install apt-file; apt-file update
      cpanm Encode::IMAPUTF7 File::Tail LWP::UserAgent Regexp::Common Test::Deep

      Add these before make install as well.

  2. Avatar Wendy Reply
    June 29, 2020 at 8:23 pm

    I had the same problem. Make sure you run everything as root (via sudo). I got stuck because Crypt::OpenSSL::RSA would not install because Crypt::OpenSSL::Random was not installed. I was finally able to install that after running:

    sudo apt-get install libssl-dev

    Run ‘sudo cpanm Crypt::OpenSSL::Random’ and ‘sudo cpanm Crypt::OpenSSL::RSA’ after that.

    I was finally able to get successful build after that. You may encounter other issues. Running ‘make -d’ will give more info about where the build is failing. I also ran ‘sh -x INSTALL.d/prerequisites_imapsync’ to help track things down. Hope this helps.

    Wendy

    • Avatar Ali Hassan Reply
      August 18, 2020 at 5:59 am

      Hi Wendy,
      I hope you are doing well. I have followed all steps to install imapsync. When i enter imapsync then imapsync: command not found error is showing. Kindly help me to sort out this issue. Thanks

    • Avatar Per Mejdal Rasmussen Reply
      February 21, 2021 at 9:25 am

      Th e autor should really test the guide with a clean install. the packages “ssl” and “libssl-dev” are missing

      To recover:
      sudo apt-get install gcc
      sudo apt-get install libssl-dev
      sudo cpanm Crypt::OpenSSL::Random –force
      sudo cpanm Crypt::OpenSSL::RSA –force
      sudo make clean
      sudo make install

      • Rahul Rahul Reply
        February 22, 2021 at 8:15 am

        Thank you!

        Tutorial has been updated with your suggestions.

  3. Avatar Portátiles de ocasión Reply
    November 7, 2019 at 2:36 pm

    Hy, thx for this tuto.
    I try in Linux Mint 19.2.

    The installation is missing various packages of cpan:

    Failure: Not found Perl module File::Tail
    Failure: Not found Perl module Package::Stash::XS
    Failure: Not found Perl module Regexp::Common
    Failure: Not found Perl module Test::Deep

    to install it:
    sudo cpanm File::Tail Package::Stash::XS Regexp::Common Test::Deep

    and ready, to me it already works correct.
    Thx.

  4. Avatar Emanuele Bruno Reply
    October 9, 2019 at 11:58 am

    take a look to this link:
    https://github.com/imapsync/imapsync/blob/master/INSTALL.d/INSTALL.Debian.txt

  5. Avatar Simon Reply
    June 21, 2019 at 6:08 pm

    Hello,

    I hope you can still answer my question. Done everything you suggested but an error came up with installing IMAP. Here is the error I get:

    ~/imapsync$ sudo make install
    cat: ./VERSION_EXE: Aucun fichier ou dossier de ce type
    sh INSTALL.d/prerequisites_imapsync
    $SHELL says /bin/bash
    $0 gives INSTALL.d/prerequisites_imapsync
    ps -ef gives root 7503 7484 0 14:05 pts/1 00:00:00 sh INSTALL.d/prerequisites_imapsync
    Distributor ID: Debian
    Description: Debian GNU/Linux 9.9 (stretch)
    Release: 9.9
    Codename: stretch
    Linux Ark 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 GNU/Linux
    Ok: Found Perl 5.24.1
    Ok: Found make GNU Make 4.1
    Ok: Found Perl module App::cpanminus
    Ok: Found Perl module Authen::NTLM
    Ok: Found Perl module CGI
    Ok: Found Perl module Compress::Zlib
    Failure: Not found Perl module Crypt::OpenSSL::RSA
    Ok: Found Perl module Data::Dumper
    Ok: Found Perl module Data::Uniqid
    Ok: Found Perl module Digest::HMAC
    Ok: Found Perl module Digest::HMAC_MD5
    Ok: Found Perl module Digest::MD5
    Ok: Found Perl module Dist::CheckConflicts
    Ok: Found Perl module Encode::Byte
    Ok: Found Perl module File::Copy::Recursive
    Ok: Found Perl module IO::Socket::INET
    Ok: Found Perl module IO::Socket::INET6
    Ok: Found Perl module IO::Socket::SSL
    Ok: Found Perl module IO::Tee
    Ok: Found Perl module JSON
    Ok: Found Perl module JSON::WebToken
    Failure: Not found Perl module JSON::WebToken::Crypt::RSA
    Ok: Found Perl module HTML::Entities
    Ok: Found Perl module LWP::UserAgent
    Ok: Found Perl module Mail::IMAPClient
    Ok: Found Perl module Module::Implementation
    Ok: Found Perl module Module::Runtime
    Ok: Found Perl module Module::ScanDeps
    Ok: Found Perl module Net::SSLeay
    Ok: Found Perl module Package::Stash
    Ok: Found Perl module Package::Stash::XS
    Ok: Found Perl module PAR::Packer
    Ok: Found Perl module Parse::RecDescent
    Ok: Found Perl module Pod::Usage
    Ok: Found Perl module Readonly
    Failure: Not found Perl module Regexp::Common
    Ok: Found Perl module Sys::MemInfo
    Ok: Found Perl module Term::ReadKey
    Ok: Found Perl module Test::Fatal
    Ok: Found Perl module Test::Mock::Guard
    Ok: Found Perl module Test::MockObject
    Ok: Found Perl module Test::More
    Ok: Found Perl module Test::Pod
    Ok: Found Perl module Test::Requires
    Ok: Found Perl module Test::NoWarnings
    Ok: Found Perl module Test::Deep
    Ok: Found Perl module Test::Warn
    Ok: Found Perl module Try::Tiny
    Ok: Found Perl module Unicode::String
    Ok: Found Perl module URI::Escape

    What you have to do before using imapsync:
    Install Perl module Crypt::OpenSSL::RSA
    Install Perl module JSON::WebToken::Crypt::RSA
    Install Perl module Regexp::Common
    Here is a cpanm command to install missing Perl modules:
    cpanm Crypt::OpenSSL::RSA JSON::WebToken::Crypt::RSA Regexp::Common
    Makefile:99 : la recette pour la cible « testp » a échouée
    make: *** [testp] Erreur 1

    Some modules/librairies seem to be missing. Any advice.

    Thanks.

    Simon

    • Avatar Edison Reply
      October 17, 2019 at 2:12 pm

      Execute this command

      sudo cpanm File::Tail CGI Crypt::OpenSSL::RSA JSON::WebToken::Crypt::RSA Regexp::Common Test::Deep

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Debian 10
  • Download Ubuntu 20.04 LTS – DVD ISO Images
  • Linux Run Commands As Another User
  • How to Check PHP Version (Apache/Nginx/CLI)
  • How To Install and Configure GitLab on Ubuntu 20.04
  • How to Install PyCharm on Ubuntu 20.04
  • How to Check Ubuntu Version with Command or Script
  • How to Set all directories to 755 And all files to 644
© 2013-2021 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy