If you ever face the problem, that you have to migrate one imap account to another, you can use either the lame way of open both accounts in Outlook, Thunderbird, etc. or you can use this useful tool called imapsync.
You have to pay to download Imapsync (http://imapsync.lamiral.info/), but as it comes with a NOLIMIT license, you may also just download it from GitHub and compile it yourself, which I will explain in the following manual.
First install git
aptitude install git
Now you can clone the GIT repository
git clone https://github.com/imapsync/imapsync.git
To compile your own programm you need some tools if you havent them
aptitude install make
and we need to install some required perl modules
aptitude install libmail-imapclient-perl libterm-readkey-perl libio-socket-ssl-perl libdigest-hmac-perl liburi-perl libfile-copy-recursive-perl libio-tee-perl libunicode-string-perl libauthen-ntlm-perl
After that we can enter the previously downloaded GIT repository and run make install
cd imapsync make install
Finally we are done with the setup and we are ready to use imapsync
A simple migration from one account to another can be done by
imapsync --host1 <servername source> --user1 <username> --pasword1 <password> --host2 <servername destination> --user2 <username> --password2 <password>