https://onezeronull.com/2019/03/05/migrate-all-your-messages-to-gmail-or-other-mail-account-using-imapsync/
Migrate all your messages to Gmail or other mail account using imapsync