Installation of Imapsync
Imapsync tools is vailable for various plateform. Use one the the following tutorial as per your operating system.
Install and Use Imapsync on Ubuntu & Debian Install and Use Imapsync on CentOS & Fedora
For installation on other platforms visit here.
Transfer Mailboxes with Imapsync
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. Reference:
https://imapsync.lamiral.info/ https://github.com/imapsync/imapsync