I have a very large personal mail archive that I want to import into Apples Mail.app. Until now, I've kept this archive in a Cyrus IMAP server. The archive consists of several hundreds of IMAP folders and subfolders. I want to keep the entire structure when moving it to Mail.app. I've tried a similar migration with a smaller archive some time ago and ended up creating all folders and moving all messages manually because I was unable to find a way to automatically migrate the entire folder structure. Is there a better solution to this? Is there a built-in function or a third-party add-on that can handle this?
Just add it as another account. Mail will then syncronize itself to the IMAP server thus keeping the same structure. See Apple support document. The Account needs to be set up with the option Keep copies of messages for offline viewing set to All messages - either with or without attachments.
Once the sync has finished then all the mails will be available to Mail.app even if there is no connection to the IMAP server.