Skip to content

Instantly share code, notes, and snippets.

View Soft-Bred's full-sized avatar
🍞
Bred

Jace Soft-Bred

🍞
Bred
View GitHub Profile
@karlcow
karlcow / blogpost.md
Created September 9, 2014 05:15
emlx to mbox for MacOSX. The Web site has disappeared so Here the code. http://web.archive.org/web/20130905074537/http://brownjava.org/2007/08/emlx2mboxpy.html

A week or so ago I decided I wanted to get all of my archived mail from Mac OS X's Mail.app into a more readable format. I was a bit surprised to find that ever since 10.4, Mac OS X stores its mail in an Apple-invented format called "EMLX" (well, this is what I'm calling it at least...each mail message is stored in a file that ends in ".emlx"). A very rough sketch of the file format:

  1. The first line of the file (beginning of the document to the first linefeed) is an ASCII-encoded number representing the size of the actual email message in bytes.
  2. Starting with the first byte after the linefeed is the email, exactly N bytes in size where N is the number of bytes specified in #1.
  3. From the end of the email message to the end of the .emlx file is an XML-encoded Apple PList containing metadata about the email message (presumably for spotlight).

I really don't care for the .emlx file format. The only application that's able to read it is Mail.app. Really the only reason for its existence is because Apple w