Facebook X (Twitter) Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook X (Twitter) Instagram
    TecAdmin
    You are at:Home»Mail Servers»How to Install and Use Imapsync on Ubuntu & Debian

    How to Install and Use Imapsync on Ubuntu & Debian

    By RahulFebruary 22, 20213 Mins Read

    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

    Email imapsync mail mailbox
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Validate Email Addresses in Python (Using Regular Expressions)

    Postfix: Configure SASL Authentication for Remote SMTP

    Postfix: Configure SASL Authentication for Remote SMTP

    Installing SendEmail Command Line SMTP Client

    How to Install and Use SendEmail on Linux

    View 15 Comments

    15 Comments

    1. Ariq on July 10, 2023 4:02 am

      i’ve following your instruction and need 2 more packages to be installed:
      – apt install apt-file
      and
      -apt install libtest-most-perl

      before executing sudo make install command. Please update the tutorial, thanks for the guide!

      Reply
    2. Steven on September 1, 2021 12:34 pm

      Needed to also install the following:
      sudo apt-get install libwww-perl

      // run test
      pi@raspberrypi:~/imapsync $ pwd
      /home/pi/imapsync
      pi@raspberrypi:~/imapsync $ ./imapsync –testslive

      Reply
    3. Bruno Martins on June 28, 2021 10:27 am

      I have followed all instructions, even those in the comments but still…

      Ok: Found cpanm cpanm (App::cpanminus) version 1.7044 (/usr/bin/cpanm)
      make: *** [Makefile:99: testp] Error 1

      Reply
    4. P. on May 28, 2021 8:48 am

      I needed these packages too, May 2021, Ubuntu 20.04
      sudo apt-get install -y libregexp-common-perl libfile-tail-perl libencode-imaputf7-perl

      Reply
    5. andrea on March 7, 2021 4:34 pm

      hello
      I need to migrate my exchange server to office 365… what’s the best command?

      Reply
    6. Cédric Barthe on November 26, 2020 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

      Reply
      • Bevan on January 6, 2021 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.

        Reply
    7. Wendy on June 29, 2020 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

      Reply
      • Ali Hassan on August 18, 2020 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

        Reply
      • Per Mejdal Rasmussen on February 21, 2021 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

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

          Thank you!

          Tutorial has been updated with your suggestions.

          Reply
    8. Portátiles de ocasión on November 7, 2019 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.

      Reply
    9. Emanuele Bruno on October 9, 2019 11:58 am

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

      Reply
    10. Simon on June 21, 2019 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

      Reply
      • Edison on October 17, 2019 2:12 pm

        Execute this command

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

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Difference Between Full Virtualization vs Paravirtualization
    • Virtualization vs. Containerization: A Comparative Analysis
    • Using .env Files in Django
    • Using .env File in FastAPI
    • Setting Up Email Notifications for Django Error Reporting
    Facebook X (Twitter) Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.