I used imapsync to migrate my server and it worked fine. I installed it locally on a Debian 11 proxmox VM, One thing to watch out for is with specific special characters in the password name. You needed to use a different way to quote either using a single ‘ or “ or combination of both.
I’ll give imapsync a try. The only problem I see is the 3GB limit (the account I need to transfer has more than 5GB). But maybe I can reduce its size deleting old messages.
I have done this recently. I used Thunderbird. I connected using pop to my email hosted in cPanel and smtp to my MIAB server. Then I simply copied and pasted emails between the two.