Some scripts to help with migrating between imap servers. Use at your own risk!
Requires python 3.6.
pip3 install -U --user "git+https://github.com/Tethik/imap-tools#egg=imap-tools"
Assuming you installed via pip.
Download an entire mailbox as follows (will ask for password via stdin):
imap-download <old server hostname> <email>
It will download all the emails into a folder
Then upload to the new server as follows:
imap-upload <new server hostname> <email>