I show you a solution I made to massively migrate emails from an old imscp server to aaPanel.
On the internet I found many questions but little information on how to migrate accounts from another Roundcube server
All you have to do is make a backup of the internal dovecot folders. For this, we previously create the accounts and everything necessary for the emails in aaPanel to work normally.
1- In imscp, enter the Backup folder via FTP or filemanager and download the file:
mail-backup-examplemail.com-2021.03.24-23-48
2- Access through the file manager to:
root dir/www/vmail/examplemail.com/exampleaccount
Create a folder and save the content inside, to be able to restore in case of failure, presumably the mail does not have received mails even since it is a new account, otherwise what is currently in the new trays will be lost.
Upload, unzip the above recovered from IMSCP, in my case do not copy the hidden folders "those that start with dot"
Ready, when you start Roundcube you should be able to see the recovered emails.
Keep in mind that Roundcube also uses a database, if you do not create the account and everything in advance it will not work.
Greetings