Recovering emails from defunct IMAP account I have an IMAP account within Mail.app which was recently “killed” (moved to a different provider to be precise). Unfortunately, I was not able to do a backup beforehand, because I received the admin’s notification about the upcoming infrastructure change too late.

Actually, I didn't suspect any big issue moving the messages from the mailboxes from the old to the new server (after all, Mail.app seems to be caching all messages for offline reading anyways). But this assumption was probably too simple. I made the following attempts:


My old email mailboxes were still in Mail.app, but showing the 'warning' badge to indicate that the server was no longer working. So I simply set up the new email account in Mail.app and kept the old one in parallel. I tried dragging my emails from the old to the new mailboxes -- and just nothing happened.
I located the directory which contained my account’s mailboxes in the file system (~/Library/Mail/V4/SOME-UUID) and copied this as a backup. I then deleted the no-longer working email account. I used Mail.app’s import feature and was able to import all messages into a local mailbox. Yay. I then wanted to re-upload these messages to my new IMAP account and the following happened:
When dragging a mailbox’ messages (e.g. content of “Archive”) to my new IMAP account, seemingly all messages are moved to the server. But double-checking results shows: Only messages WITHOUT attachments are copied, and all my emails which had one or more files attached are simply lost (they no longer show up in the local mailbox either)


Is there any chance to clean up this mess and get my messages back on the server?

Observations about the backup so far:


emails without attachments seem to be saved as .emlx file
in contrast, email with attachments are saved as .partial.emlx
My solution at the end: I wrote a tool to convert the .emlx and .partial.emlx files to .eml files. I re-imported these .eml files into Mail.app and was able to upload them to my new IMAP mail account.

In case anyone should encounter the same challenge, here’s my converter (Node.js-based):

https://github.com/qqilihq/partial-emlx-converter