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. Also, install required Python modules using CPAN on your system.

Step 2 – Install Imapsync

After completing the installation of required packages. Download latest imapsync code from its official Github repository on your local system. Navigate to newly cloned repository and install it with the following commands on your system. 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. 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