Skip to content
/ emlx2eml Public

Convert internal EMLX representation of Apple Mail.app to a more standard EML format

License

Notifications You must be signed in to change notification settings

LRGH/emlx2eml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

emlx2eml

Convert internal EMLX representation of Apple Mail.app to a more standard EML format

Rationale

I had to write this script to recover e-mails from a backup. For most e-mails, you can simply import the EMLX file in Mail.app, because the EMLX file contains the complete e-mail with its attachments. But for some e-mails (usually in a file named xxx.partial.emlx) the attachments are not in the EMLX file, they are stored elsewhere and the EMLX file contains an empty MIME part with a X-Apple-Content-Lengthheader. The problem is that when you import such a partial EMLX file in Mail.app, the attachments are not imported.

I guess that it is a bug of Mail.app, but this led me to want to be able to recover all my e-mails stored in ~/Library/Mail/V4, independently of the limitations that Apple puts on their software.

Usage

To create in /tmp/mail one EML file for each of your e-mails, just type mkdir /tmp/mail; emlx2eml.py ~/Library/Mail/V4 /tmp/mail.

If you want to recover only one e-mail, the syntax is emlx2eml.py /path/to/file.partial.emlx /tmp/mail.

Limitations

There are three TODO in the source code:

  • An EMLX file includes some metadata in a property list at the end of the file. My script ignores this metadata. The main consequence is that the flags (e.g. read/unread) are not recovered by my script. I think that it is a minor issue but I welcome requests (or pull requests) if someone misses this metadata.
  • EMLX files don't keep the value of the "envelope from" (the values given to the SMTP server before sending the content of the e-mail). My script generates a value independently of the content of the e-mail. This could be improved.
  • Sometimes e-mail attachments have no filename. When Apple's Mail.app stores these attachments in the Attachments directory, it generates a filename. This is not documented and my script can only generate this filename for e-mails similar to mine: French localization, attachments of type calendar, PNG, GIF, JPEG or EML. This is probably the most annoying limitation of my script. I need external feedback to find what filenames are generated by Mail.app, especially when OSX is in another language than French.

About

Convert internal EMLX representation of Apple Mail.app to a more standard EML format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages