What Is an EMLX File? The Apple Mail Message Format, and How to Open and Fix One
An EMLX file is one email from Apple Mail, and an email that opens is not always an email that is complete. Jump to your question below, or work through it in order.
What Is an EMLX File? One saved email, and not a document
Short answer
An EMLX file is one email saved by Apple Mail on a Mac. It has a byte count, the message in MIME form and a short property list. Apple has published no specification, per the Library of Congress.
We tested 12 good EMLX files and made 27 damaged EMLX files from one. The emlx library refused 22 of them, and our copy of the Thunderbird import logic read 12 with no error but with lost flags or changed text.
To open EMLX files, read how to open EMLX files. To check one, read the first line check. If yours will not open, begin with the ten causes.
An EMLX file is one email saved by Apple Mail. It starts with a byte count, then has the message in MIME form and ends with a short property list of flags. Mail stores messages as numbered EMLX files, one per message. Few other programs read them.
Picture a Mac user who copies Mail folders to backup drives and sends them to you. The folders have files with numbers for names, like 12345.emlx. Without Apple Mail, few programs know that ending. EMLX files are messages, but not in a form other programs expect.
The Library of Congress says Apple introduced EMLX files in 2005, with Mail version 2 on Mac OS X Tiger (10.4). It calls EMLX a proprietary variation of EML and says no formal standard is published. PRONOM lists it as fmt/2055 and gives the same date.
EMLX files are simple to describe and easy to break. Line 1 is a number. The next bytes are the message, and that number says how many. A property list follows. One wrong digit stops some readers, and the study below shows how others fail.
FileInfo says an EMLX file does not store attachments. Our EMLX files did. Their message part is a full MIME message, and they contained attachments of 3,000 bytes and 1,500,000 bytes. Posters at Apple Communities say Mail splits some messages into separate files, so both views have something behind them.
Who sends you EMLX files
EMLX files reach you in Mail folders that Mac users copy, in backups and in cases that examiners work on. Treat one like any email you did not expect. It can contain links, remote images and attachments. Read the safety section first.
Three questions start most readers off. Is your EMLX file complete? Which program reads it? Do you need the flags, or only the message? The first answer comes from the check section, and the last one from the flags section.
EMLX file facts at a glance
| Property | Value |
|---|---|
| Meaning | One email saved by Apple Mail, with a byte count line before it and a property list after it. |
| Ending |
.emlx, and .partial and .emlxpart for messages that Mail stores in parts.
|
| Made by | Apple Mail, since Mail 2 on Mac OS X 10.4 in 2005. |
| Starts with | Digits and a line break. Our count lines had from 3 to 7 digits. |
| Stores | One MIME message with its attachments when Mail stores them inside, then an XML property list. |
| Plist keys |
Our 12 good EMLX files showed flags, date-received, date-last-viewed, conversation-id and remote-id.
|
| Media type |
message/ at the Library of Congress. None of the four databases we checked lists .emlx.
|
| Opens in | Apple Mail on a Mac. Vendors say their Windows viewers also open EMLX files. |
| Safe to open | Reading an EMLX file with a tool is safe. The message inside can still contain links and attachments. |
Wrong page? One email as message text is an EML file. Many emails in one file are an MBOX file, and Outlook messages are MSG files.
What Is Inside an EMLX File? A count, a message and a property list
Every EMLX file is a count line, a MIME message and a property list, in that order. The count says how many bytes the message has. Our 4,977 byte test file has a 5 byte count line, a 4,678 byte message and a 294 byte plist.
Our smallest EMLX file shows all three parts. Line 1 is 323. The next 323 bytes are the message, which ends with the words Please reply by Friday. The property list starts at the next byte. The listing shows the file in full.
323
Subject: Trial balance
From: Alex Rivera <alex@example.com>
To: Sam Lee <sam@example.com>
Date: Fri, 27 Oct 2023 10:03:30 +0200
Message-ID: <28c7ce04a4df@example.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
The trial balance is ready for review.
Please reply by Friday.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>date-received</key>
<integer>1698393810</integer>
<key>flags</key>
<integer>8623685697</integer>
</dict>
</plist>
| Part | What it is and what we saw |
|---|---|
| Count line | Digits and a line break. The number counts message bytes and nothing else. Ours read from 192 to 2,026,943. |
| Message | A MIME message of exactly that many bytes, with headers, a blank line, a body and parts. It is the text of an EML file. Our script copied it out byte for byte for 8 of 8 EMLX files we made. |
| Property list | An XML property list. Our 12 good EMLX files had 2 to 5 keys, and the plist took 285 to 483 bytes. |
| Where it starts | Right after the last message byte. The plist began there in all 12 good EMLX files, and every check on this page relies on it. |
RFC 5322 defines message text. EMLX files follow its rules, so headers, the blank line and the body work as they do in an EML message. The Library of Congress record also relates EMLX to MBOX, because Mail stores mailboxes as folders of numbered files.
What the count line really counts
The count is in bytes and not in letters. Our UTF-8 test message has 334 characters and 342 bytes, because letters like é and ☕ take more than one byte. A count made from letters is wrong for any message with accents.
A count is not a checksum. Nothing in an EMLX file checks it against the message, so readers that trust the number cut messages in the wrong place and give no warning.
Why there is no signature
Many formats start with fixed bytes. An EMLX file starts with digits that change from file to file. A tool has to read line 1, jump ahead by that many bytes and look for <?xml. The National Archives entry lists no extension or media type, so detection by structure is the only sure way.
A text editor can break it. EMLX files look like text, so people open them in an editor. Saving can change line ends, add a byte order mark or change the message length. The emlx library refused 4 of our 5 edited copies for that reason.
What Do the Flags in an EMLX File Mean? Read, answered, flagged and 28 more bits
The flags number in an EMLX file stores message status as bits. Bit 0 is read, bit 2 is answered, bit 4 is flagged and bit 8 is forwarded. Bits 10 to 15 count attachments, and bits 16 to 22 store priority.
Every good EMLX file we tested has an odd flags number, so bit 0 is set and the message counts as read. Our file with flags of 1 means read and nothing else. The next figure draws the bits as one number.
| Bit | Meaning |
|---|---|
| 0 | Read |
| 1 | Deleted |
| 2 | Answered |
| 3 | Encrypted |
| 4 | Flagged |
| 5 | Recent |
| 6 | Draft |
| 7 | Initial. A comment in the Thunderbird source says it is no longer used. |
| 8 | Forwarded |
| 9 | Redirected |
| 10 to 15 | Attachment count, 6 bits |
| 16 to 22 | Priority level, 7 bits |
| 23 | Signed |
| 24 | Junk |
| 25 | Not junk |
| 26 to 28 | Font size change, 3 bits |
| 29 | Junk mail level recorded |
| 30 | Highlight text in the message list |
| 31 | Unused |
Names come from a header file in Thunderbird source code and from emlx library 1.0.4, which list the same bits in the same order. A Thunderbird comment credits a 2005 blog post by jwz. Apple has published no list, so treat this table as a working guide.
How to read the flags with Python
Shift the number right by the bit position and keep the last bit. The next script reads five fields from the flags of a test file in the emlx library. Its output shows a message that is read and has no attachments.
flags = 8623489089
read = flags & 1
answered = (flags >> 2) & 1
flagged = (flags >> 4) & 1
forwarded = (flags >> 8) & 1
attachments = (flags >> 10) & 0x3F
print(read, answered, flagged, forwarded, attachments)
1 0 0 0 0
What the public files show
Four of our 12 good EMLX files came from public test sets. All four have bits 0, 25 and 33 set. No list we found names bit 33, and bit 34 is set in one file. Three of the four also have bit 6, which lists call draft, although they are test messages.
One public EMLX file has all six attachment bits set, which reads as 63. The emlx library deletes that value and leaves a comment that it does not know why. Treat an attachment count of 63 as unknown and not as 63 attachments.
What Thunderbird takes from the flags
Thunderbird import code reads four bits. They are read, answered, flagged and forwarded. It treats a flags value of 0 as a failure and sets no status. We changed the flags to 0 in one EMLX file and to 1 in another. The emlx library, our Thunderbird copy and our script read both without a problem.
Where Do You Meet EMLX Files? The Mail folder, backups and split messages
You meet EMLX files in Mail folders on a Mac, in backups of those folders and in copies sent by Mac users. Mail also uses .partial and .emlxpart files for messages it stores in parts. The ending .emlx alone names a single message.
Mail keeps EMLX files in one folder. The table lists where they come from and what we could check. We had no copy of an actual Mail folder, so the layout rests on the sources named in every row.
| Kind | What it is |
|---|---|
| The Mail folder | Mail keeps one numbered .emlx file per message under the Library folder of a user. The Library of Congress and FileInfo both name that path. Source: Library of Congress and FileInfo. |
| Backups | A backup drive keeps the same EMLX files as the Mail folder, and a Mac user can send you that copy. Source: Our advice. |
| .partial.emlx | A poster at Apple Communities says it stores the original message headers. Apple documents no such file. Source: Apple Communities. |
| .emlxpart | The same poster says it stores an encoded attachment. FileInfo lists the ending and does not describe it. Source: Apple Communities and FileInfo. |
| Mailbox exports | Mail exports a mailbox as an .mbox package, and not as EMLX files. Apple lists mbox as the export format. Source: Apple. |
Messages that Mail stores in parts
A poster at Apple Communities describes a .partial file with the original headers and an .emlxpart file with the encoded attachment. A second Apple Communities thread says messages with attachments can be stored this way, in the same Messages folder or in a separate Attachments folder.
We could not test this. Our EMLX files keep attachments inside the message, and a reader that opens only an .emlx file would miss an attachment that Mail stored elsewhere. Commenters in that thread advise exporting messages instead of copying files out of the Library folder.
What the databases say about the ending
A media type names a file for browsers and servers. We looked up .emlx in the Library of Congress record, in PRONOM and in four file type lists. The table shows what they say.
| Source | Result |
|---|---|
| Library of Congress |
Lists the media type message/ and the macOS type identifier com.
|
| PRONOM | Lists fmt/2055 with no extension and no media type. |
| Four databases |
Debian media-types 10.1.0, shared-mime-info 2.4, Python mimetypes and mime-db 1.54.0 all lack an entry for .emlx.
|
A download is not a message. No database we checked lists .emlx, so a browser can only save EMLX files. Open one with a viewer or convert it, because a browser shows nothing.
What Did We Find in 27 Damaged EMLX Files? One wrong number stopped the library every time
We tested 12 good EMLX files and made 27 damaged EMLX files from one. The emlx library refused 22 of them. Our copy of Thunderbird import logic read 12 with no error but with lost flags or changed text. Deleting the count line and the plist by hand worked on 22.
Few EMLX files are public, so we built our own. We wrote 8 good EMLX files in Python with the same three part layout, and we used 4 public EMLX files from emlx library and Apache Tika test sets. Apple Mail made none of the 8, so they show the layout and not Mail habits.
Then we damaged one 4,977 byte EMLX file in 27 ways, in four groups. We changed count lines, edited messages, damaged property lists and cut files. We read every copy five ways and checked it with our 58 line script.
The five ways are emlx library for Python, a Python copy of Thunderbird import logic, a rename to .eml and two edits by hand. One edit deletes line 1. The other deletes line 1 and the plist.
| Test | Result |
|---|---|
| emlx library | Version 1.0.4 for Python. It read all 12 good EMLX files and refused 22 of 27 damaged ones. In 15 of the 22 cases the error says only Invalid file, and it never says which part broke. |
| Thunderbird logic | Our Python rewrite of Thunderbird import code. It read all 12 good EMLX files. On damaged ones it was right on 6, refused 9, lost flags on 9 and cut text on 3. Those 12 gave no error. |
| Rename to .eml | Python's email parser read 0 of 12 good EMLX files. The number on line 1 ends the headers, so Subject and From came out empty. It was right on 2 of 27 damaged ones. |
| Delete line 1 | Remove only line 1. It was right on 5 of 12 good EMLX files, the ones with several parts, where the plist falls after the last boundary. It was right on 22 of 27 damaged ones, which all come from a multipart file. |
| Delete both | Remove line 1 and the plist by hand. It was right on 12 of 12 good EMLX files and on 22 of 27 damaged ones. It missed five where line 1 or the message itself was gone. |
| Our script | Passed all 12 good EMLX files. It failed 19 damaged ones, warned on 4 and passed 4. The four passes were the four that are valid. |
Read the grid by column. Green means the message came out right. Amber means it came out without flags. Gray is an error, and red is wrong text with no error. Red is worst, because nothing warns you.
Where the readers disagree
Both readers agree on 5 damaged EMLX files. Spaces before the count, a CR LF after it, a longer subject with a fixed count and two changed flags all read fine. Our Thunderbird copy also read the one with a blank line before the count.
The two hand edits did best, and for a clear reason. They ignore the number, so a wrong count cannot hurt them. They work only when the message is complete, and the five misses were EMLX files without line 1, with a blank line 1 or cut short.
Why an off by one count matters
We also moved the count by 1 in all 12 good EMLX files, up and down, for 24 more copies. The emlx library refused all 24. Our Thunderbird copy read none of them right. It changed the text of 14 and dropped the flags of 10, with no error.
Single part messages lose their last byte when the count is 1 too small and gain the first plist byte when it is 1 too big. Multipart messages hide the change inside their closing boundary, so only the flags suffer. Our script failed all 24.
Read the study with care. It shows what five readers and one script do with our EMLX files. All 27 damaged ones come from one small multipart file, and we made 8 of the 12 good ones ourselves. The Thunderbird column is our rewrite of its code. We did not start Apple Mail, Thunderbird or a Windows viewer.
What Does Our Expert Say About EMLX Files? A note from Neeraj Singh on checking the first line
Check line 1 before you trust an EMLX file. It takes a second, and it shows if the count matches the message and if the plist starts where the count ends. Converting EMLX files comes after that check and not before it.
Expert insight
“An EMLX file looks like plain text, so people edit it. One wrong number on the first line breaks it. In our tests a count that was off by one stopped the emlx library every time. The Thunderbird logic read the same files with lost flags or cut text and no error. Check the first line, and keep the original.”
Why the first line comes first
Most readers trust the count and say nothing when it is wrong. In our tests Thunderbird logic cut the text of 3 damaged EMLX files and dropped the flags of 9, and it gave no sign. A check of the count against the plist position is the one step that names the problem, and the check script does it.
The check has a limit. A pass proves that all three parts agree. It does not prove that the email is the one that was sent. The four copies that passed our script include one with an edited subject.
Copy the file before you touch it. Write down the SHA256 hash of the original and edit only a copy. The hash shows later which EMLX file you received, and a repair then cannot damage the evidence.
How Do You Open EMLX Files? Mac, Windows and Python
Open EMLX files with Apple Mail on a Mac, with a viewer on Windows or by converting them to EML first. Apple Mail reads its own files. Vendors list Windows viewers, and a short Python script reads any complete file without Apple Mail.
FileInfo's program list lists Apple Mail and a text editor for the Mac, and viewers and converters for Windows and Android. We tested on Linux, so the table marks what we tested and what we did not. Reading an EMLX file and repairing one are different jobs, and the next sections cover both.
| Program | What it does |
|---|---|
| Apple Mail | The program that makes EMLX files. Apple's page says File > Import Mailboxes reads Apple Mail mailboxes, and Mailbox > Export Mailbox writes .mbox packages. |
| Text editor | FileInfo says EMLX files are text. Our 12 good ones read as text. Do not save, because a saved file can break the count. |
| SysTools EMLX Viewer | A Windows viewer. The vendor says it opens EMLX files without an email client and loads files from a folder. We did not test it. |
| Freeviewer EMLX Viewer | A Windows viewer. The vendor says it opens EMLX files without Apple Mail and that the free version previews. We did not test it. |
| emlx library | A Python module that reads complete EMLX files on any system. It read all 12 of our good ones and refused 22 of 27 damaged ones. |
| Thunderbird | Its import tool for Apple Mail reads EMLX files, and its source code is public. Our copy of that logic read 12 of 12 good EMLX files. We did not start Thunderbird. |
Open EMLX files on a Mac
Apple Mail opens EMLX files that it made. To move mail to another Mac, Apple's Mail guide says to export mailboxes and import them again. Those steps use .mbox packages and not loose EMLX files, and the page does not mention EMLX at all.
We did not test Apple Mail with any of our EMLX files, so we cannot say how it treats a damaged one. Copy a file before you open it.
Open EMLX files on Windows
Without Apple Mail you need a viewer or a conversion. Two vendors list Windows viewers for EMLX files on their pages. The cards show what every page says, and we tested neither program.
SysTools EMLX Viewer
Opens EMLX files without an email client, loads files from a folder and searches them
Freeviewer EMLX Viewer
Opens EMLX files from Apple Mail on Windows and shows messages with their attachments
SysTools says its viewer loads EMLX files from a folder, searches them and shows Hex, MIME, header and HTML views. It says the free version reads EMLX files and that saving attachments needs the Pro version.
Freeviewer says its viewer shows messages with attachments, opens damaged EMLX files and previews in the free version. Its page names a 250 MB limit in one place and no limit in its FAQ, so check your file size first.
Viewers show, they do not fix. A viewer opens messages. An EMLX file with a wrong count can still fail in it, so read the first line before you blame the viewer.
Open EMLX files with Python
Install the emlx library with pip install emlx. It reads the count, message and plist. It decodes flags into names. The script prints the subject, flags and text of an EMLX file we made.
import emlx
m = emlx.read('g08_noid.emlx')
print(m.headers['Subject'])
print(m.flags)
print(repr(m.text))
Short note
{'read': True}
'Short body.\n'
The library refuses an EMLX file with a wrong count, as the study shows. If it raises an error, check line 1 and fix the count with our repair script.
How Do You Check an EMLX File? Read the count, find the plist, then the message
Check an EMLX file with our 58 line script. It reads line 1, jumps ahead by that many bytes, looks for the plist and then reads the message. It stops at the first failure and says where the plist starts, so you can fix the count.
The script uses only Python's own modules. On a good EMLX file it prints one line. The listing shows the command and result for the 621 byte file from the structure section.
python3 check_emlx.py g01_plain.emlx
result: ok
The figure follows the order of the checks. The first two are about the count line. The third compares the count with the actual plist position, and the fourth reads the plist. The damage test lists ten causes behind the numbers.
Check EMLX files with Python
The script allows spaces before the count and a CR LF after it, because both read fine in our tests. It fails on a byte order mark, a blank first line, a count of 0 and a count past the end. Then it looks for the plist, parses it and reads the message headers.
"""Check the structure of an EMLX file. Reads only. Usage: python3 check_emlx.py file.emlx"""
import email, plistlib, re, sys
from email import policy
def check(data):
out = []
def bad(level, text): out.append((level, text))
if data[:3] == b'\xef\xbb\xbf':
bad('warn', 'file starts with a byte order mark')
m = re.match(rb'[ \t]*(\d+)[ \t]*\r?\n', data)
if not m:
bad('fail', 'first line is not a byte count')
return out
n, start = int(m.group(1)), m.end()
if n == 0:
bad('fail', 'byte count is 0')
return out
if start + n > len(data):
bad('fail', 'byte count %d goes past the end of the file (%d bytes after the first line)' % (n, len(data) - start))
return out
if m.group(0).endswith(b'\r\n'):
bad('warn', 'first line ends in CR LF')
rest = data[start + n:]
if not rest.startswith(b'<?xml'):
found = re.search(rb'<\?xml[^>]*\?>\s*<!DOCTYPE plist', data[start:])
if found:
bad('fail', 'no plist at byte %d. The plist starts at byte %d, so the count is %d %s' % (n, found.start(), abs(found.start() - n), 'too small' if found.start() > n else 'too big'))
else:
bad('fail', 'no plist after the message')
return out
try:
pl = plistlib.loads(rest)
if not isinstance(pl.get('flags', 0), int):
bad('warn', 'flags is not a number')
except Exception as e:
bad('warn', 'plist does not parse (%s)' % type(e).__name__)
pl = None
tail = rest[rest.rfind(b'</plist>') + 8:] if b'</plist>' in rest else b''
if tail.strip():
bad('warn', '%d bytes follow the plist' % len(tail))
msg = email.message_from_bytes(data[start:start + n], policy=policy.default)
if not any(msg[h] for h in ('from', 'date', 'subject')):
bad('warn', 'message has none of From, Date or Subject')
for d in msg.defects:
bad('warn', 'message defect: ' + type(d).__name__)
for part in msg.walk():
for d in part.defects:
bad('warn', 'message defect: ' + type(d).__name__)
return out
if __name__ == '__main__':
res = check(open(sys.argv[1], 'rb').read())
for level, text in res:
print(level.upper(), text)
print('result:', 'fail' if any(l == 'fail' for l, _ in res) else 'warn' if res else 'ok')
sys.exit(2 if any(l == 'fail' for l, _ in res) else 1 if res else 0)
Here is what it printed for four damaged EMLX files. The first has a count that is 1 too small. The second is cut in half. The third has a plist cut in half, and the fourth has a CR LF after the count.
python3 check_emlx.py c01.emlx
FAIL no plist at byte 4677. The plist starts at byte 4678, so the count is 1 too small
result: fail
python3 check_emlx.py c25.emlx
FAIL byte count 4678 goes past the end of the file (2483 bytes after the first line)
result: fail
python3 check_emlx.py c19.emlx
WARN plist does not parse (ExpatError)
result: warn
python3 check_emlx.py c11.emlx
WARN first line ends in CR LF
result: warn
The first listing names the actual plist start. That is the number a repair needs. The second shows an EMLX file that lost half of its message, and no repair brings that back. The last two draw only warnings, because the message is complete.
What the script found in 27 damaged EMLX files
| Result | Cases |
|---|---|
| Failed, refused (19) | Line 1 is not a number (6 files), the count is 0 or goes past the end (4) or the plist is not where the count ends (9). The emlx library refused all 19. |
| Warned, refused (3) | The plist is cut in half, followed by 4,096 junk bytes or missing its last 100 bytes. The message is complete in all three, and the library still refuses these EMLX files. |
| Warned, read (1) | The count line ends in CR LF. Every reader we tried handled it. |
| Passed, read (4) | Spaces before the count, a longer subject with a fixed count and flags set to 0 or to 1. The emlx library read all four EMLX files. |
The script checks structure and does not scan for malware. It cannot show if an email is genuine. It follows the stricter reader on one point, because it fails an EMLX file with a blank line before the count, which Thunderbird logic reads.
Check an EMLX file by eye
You can do the main check in a terminal. Read line 1, then ask grep for the plist byte position. That position minus the length of line 1 and its line break must equal the count. The listing shows the result for the 621 byte file.
head -n 1 g01_plain.emlx
323
grep -b -o -a '<?xml' g01_plain.emlx
327:<?xml
Line 1 has 3 digits and a line break, which is 4 bytes. The plist starts at byte 327. Then 327 minus 4 is 323, which is the count. We tested this on Linux with GNU grep and did not try it on a Mac.
A pass is not a promise. A good first line means all three parts agree. It does not mean the email is the one that was sent. Our EMLX file with an edited subject and a fixed count passed.
Are EMLX Files Safe to Open? Reading is safe, and the email inside is an email
Reading an EMLX file is safe. Opening the email inside it is the same risk as opening any email. A reader lists bytes and starts nothing, but the message can contain links, remote images and attachments, so judge the sender before you open anything.
The ending says nothing about safety. EMLX files are stored emails, and their safety depends on who wrote them. The table lists what to check, and every row ends with its source.
| Check | What to do |
|---|---|
| The sender | An EMLX file is a saved email. Links and attachments in it work like those in any email, so open nothing you did not expect. Source: Our advice. |
| Reading | The emlx library, our Thunderbird copy, our two scripts and the by hand edits only read bytes. We used them on 39 EMLX files, and every SHA256 hash was the same afterward. Source: Our tests. |
| The plist | It stores numbers and dates and no program. Read it with a library you trust, and do it on a copy. Source: Our advice. |
| Remote images | An HTML message can load images from the internet when a viewer shows it. That lets the sender know you opened it. Switch remote content off if the viewer has the option. Source: Our advice. |
| Attachments | An attachment is a file inside the message. Judge it by its own type and not by the email around it. Source: Our advice. |
| Viewers | Vendors say their viewers open EMLX files without Apple Mail. We tested none. Try a viewer on a copy and read the limits of its free version first. Source: Vendor pages. |
Why a reader is safer than a viewer
A reader prints what it finds. A viewer builds the email on screen, with its formatting and its images. We checked 39 EMLX files before and after every reader and script. The SHA256 hash of every file was the same.
Use a reader first when you are not sure what a file is. Read the headers as text. Look at the sender and subject. Then decide. Keep the original untouched.
Why you should read the first line
A file that ends in .emlx can be anything. A good EMLX file begins with digits and a line break, and then message headers like From or Subject. Our script checks line 1, and a text editor shows it too.
A name is not a promise. Files called invoice.emlx or scan.emlx are only names. Check where one came from, hash it and read it as text before you open any attachment.
Why Will Your EMLX File Not Open? Ten causes, and what to do about every one
Most EMLX files that will not open fail for one of ten reasons. Check line 1 first. A wrong count, a missing first line, a byte order mark and changed line ends stop the emlx library. A damaged plist stops it too, even when the message is complete.
We damaged one EMLX file in 27 ways. The emlx library refused 22 of the damaged EMLX files. Fourteen had a problem with the count or line 1, 5 had a plist problem and 3 were cut. The other 5 read fine, and 4 of them passed our script.
Read the table slowly. Every row lists the EMLX files that broke, and the number in brackets matches the cause. The fixes work on a copy. A reader that says nothing about a broken count is no sign that an EMLX file is good.
| Cause | Result and fix |
|---|---|
| The wrong program (1) | Outside Apple Mail, a program needs a reader for EMLX files. A double click shows nothing useful. Fix: Use a viewer, the emlx library or our converter on a copy. |
| A count that is off (2) | Counts that were 1 or 50 too small or too big made the emlx library refuse 4 EMLX files, and two edited subjects did the same. Our Thunderbird copy read all 6 with lost flags or cut text. Fix: Rebuild the count with the repair script. |
| A count that is not a number (3) | A count of 0, 99999999, -5 or abc made both readers refuse all 4 EMLX files. Fix: Rebuild the count from the plist position. |
| The first line is gone (4) | One EMLX file with no count line and one with a blank line before it were refused by the emlx library. Thunderbird logic read only the blank line one. Fix: Add the count, or remove the blank line. |
| A byte order mark (5) |
An editor added three bytes at the start, and both readers refused the EMLX file. Fix: Remove the bytes ef bb bf and check the count.
|
| Changed line ends (6) | Every line end became CR LF, the message grew by 75 bytes and the count went stale. The library refused it, and Thunderbird logic cut the text. Fix: Rebuild the count. |
| A missing plist (7) | One EMLX file had no plist and one had text in its place. The library refused both, and Thunderbird logic read the message without flags. Fix: Convert the message to EML. The flags are lost. |
| A damaged plist (8) | A plist cut in half, 4,096 junk bytes after it and a lost end all made the library refuse the EMLX file. The message was complete in all three. Fix: Convert the message to EML. The flags are lost. |
| A cut file (9) | An EMLX file cut in half, cut to its first line or cut to 3 bytes broke every reader. Fix: Get a new copy from the sender or from a backup. No tool brings back cut text. |
| Parts stored elsewhere (10) |
Posters at Apple Communities say Mail can store a message as a .partial file and an .emlxpart file. A reader that opens one file shows an incomplete message. We could not test this. Fix: Export the mailbox from Apple Mail, as the posters advise.
|
Fix a wrong count
A wrong count is the cause you meet most when people edit EMLX files. The count says where the message ends, and the plist must start there. Our repair script finds the plist and writes the number that fits. The listing shows an EMLX file with a count that was 50 too big.
first line before: 4728
first line after: 4678
result: ok
A repair works because the plist begins right after the message in all 12 good EMLX files. A file where that is not true needs a hand check. The next sections list the steps in order and what to send to a helper.
Repair steps in the order we would try them
We tested the steps on Python 3 on Linux. We did not test them on a Mac, and we tested no EMLX file from an actual Mail folder.
- Copy the EMLX file, write its SHA256 hash and work on the copy.
- Open it as text and read the first line. It must contain digits and nothing else, with no byte order mark before them.
- Check the EMLX file with our script and read the first failure.
- If the script names the plist position, rebuild the count with the repair script.
- If the plist is damaged or gone, convert the message to EML. The flags are lost, so write them down first if you have them.
- If the EMLX file is cut, get a new copy from the sender or a backup.
- Open the result in the program you wanted, and keep the original.
What to send the sender or a helper
Short messages get faster answers. Include the details below. Send the output of the check script too, because its first line names the problem.
Subject: EMLX file will not open
File: the name, the size in bytes and the SHA256 hash
First line: the digits at the start of the file
Check: the output of check_emlx.py
System: Mac or Windows, and the name of the program
What happens: the exact words of the error
Source: where the EMLX file came from and when it was copied
What no repair can fix
Do not try random repair sites. A site that offers to fix any email file for free can keep the upload, and the file contains your mail. Try the steps above first, and ask the sender for a new copy.
How Do You Convert an EMLX File? EML, MBOX and a repair for the count
Convert EMLX files to EML by cutting out the message by its byte count, and to MBOX by adding the messages to one mailbox. Both drop the flags. Our 35 line script does both, and it can rebuild a wrong count first.
Two kinds of work belong here. One copies the message out of an EMLX file. The other repairs line 1 so that a reader accepts the file. Choose by what you need next. The table lists what we found.
| Type | Finding and source |
|---|---|
| EMLX to EML | Cut the message out by the count. Our script copied it byte for byte for 8 of 8 EMLX files we made, and 4 public ones parsed to the same message. The flags are dropped. Source: Our tests. |
| EMLX to MBOX | Our script wrote 12 messages into one mbox of 2,039,223 bytes. Python's mailbox module counted all 12. The flags are dropped. Mail's own export writes .mbox packages. Source: Our tests and Apple. |
| Fix the count | The repair script rebuilt an EMLX file with the right message and flags for 19 of 27 damaged ones. With a direct cut by the count, the message came out for 24 of 27. Source: Our tests. |
| EMLX to PDF | We tested no route to PDF. Source: Our tests. |
| EMLX to PST | We tested no route to PST. Our PST guide covers the Outlook side. Source: Our tests. |
| EMLX to TXT | FileInfo says you can rename an EMLX file to .txt to read it. Our 12 good ones read as text that way. Source: FileInfo. |
Convert EMLX files to EML
The message part of an EMLX file is already an EML file. The script reads line 1 and returns that many bytes. The listing shows the script in full. It reads the files you name and writes new ones, and it never changes an EMLX file.
"""Convert EMLX to EML, EMLX to MBOX, and repair a wrong byte count. Reads only the file you name."""
import mailbox, os, re, sys
PLIST = re.compile(rb'<\?xml[^>]*\?>\s*<!DOCTYPE plist')
def to_eml(data):
nl = data.index(b'\n')
n = int(data[:nl].strip())
return data[nl + 1:nl + 1 + n]
def repair(data):
"""Rebuild the first line from where the plist really starts."""
data = data.lstrip(b'\xef\xbb\xbf \t\r\n')
m = PLIST.search(data)
if not m:
raise ValueError('no plist found, cannot repair')
nl = data.find(b'\n')
first = data[:nl] if nl >= 0 else data
start = nl + 1 if (nl >= 0 and b':' not in first and nl < m.start()) else 0
return b'%d\n' % (m.start() - start) + data[start:]
def to_mbox(paths, out):
box = mailbox.mbox(out)
box.lock()
for p in paths:
box.add(mailbox.mboxMessage(to_eml(open(p, 'rb').read())))
box.flush(); box.unlock(); box.close()
if __name__ == '__main__':
for p in sys.argv[1:]:
open(os.path.splitext(p)[0] + '.eml', 'wb').write(to_eml(open(p, 'rb').read()))
Use to_eml for one EMLX file, to_mbox for many EMLX files and repair when the count is wrong. From a terminal, python3 convert_emlx.py a.emlx writes a.eml next to the original.
Fix a wrong count
A repair rebuilds line 1 from the place where the plist starts. On 27 damaged EMLX files it gave a readable file with the right message and flags for 19. Five had no plist to find, and 3 had a damaged plist that the library still refused.
The message itself came out right for 22 damaged EMLX files after a repair. A direct cut by the count added two more, the ones without a plist. Only the 3 cut files lost the message. A repair cannot bring back text that is not in the file.
Convert EMLX files to MBOX
Python's mailbox module writes the mbox. The listing converts two EMLX files to one mailbox. Our test of 12 EMLX files gave 12 messages, and the mbox opened with the same module. Apple's Mail page lists the mbox format as the way to import mail from Windows or UNIX computers.
from convert_emlx import to_mbox
to_mbox(['a.emlx', 'b.emlx'], 'mail.mbox')
Keep the flags
Neither conversion keeps the plist. Read the flags first with the flags script and write them down. Thunderbird import code copies four of them, which are read, answered, flagged and forwarded, into its own status header.
Keep the EMLX file. An EML file does not keep the flags, dates or plist keys. Hash your EMLX file, write the hash in your log and keep it as the original.
EMLX or EML: What Is the Difference? Also MBOX, MSG, PST and EMLXPART
An EMLX file is the Apple Mail form of one email. An EML file is the same email as message text, an MBOX file stores many emails and Outlook uses MSG and PST. The message in an EMLX file is an EML file with a count before it and a plist after it.
The names are easy to mix up, and the files do different jobs. The table lists near neighbors of EMLX files. Every row ends with its source.
| Format | What it is |
|---|---|
| EMLX | One email saved by Apple Mail, with a count line before it and a plist after it. Source: Library of Congress. |
| EML | One email as message text. The message part of an EMLX file is an EML file. Source: Our EML guide. |
| MBOX | Many emails in one file. Apple Mail exports mailboxes as .mbox packages. Source: Apple. |
| MSG | One email saved by Outlook. Source: Our MSG guide. |
| PST | An Outlook data file for many messages and folders. Source: Our PST guide. |
| EMLXPART | The ending that Mail uses for an encoded attachment stored beside its message, per one poster. Source: Apple Communities. |
Which one do you need
All of these formats use the message layout that the Internet message standard defines, apart from Outlook's own MSG and PST. EMLX files add a count and a plist around it. That is why a converter has so little to do.
Why a renamed file fails as EML
A tip that circulates online says to rename an EMLX file to .eml. In our test, Python's parser read 0 of 12 good EMLX files that way. The number on line 1 is not a header, so the headers end at once and the parser finds no sender or subject.
We did not try Outlook or Thunderbird on a renamed file. Cut the count line and the plist first, and then the file is a normal EML file. The guide to EML files shows how to open the result.
What Is the EMLX File Format Made Of? The facts we could check, and where they came from
EMLX files have no published specification. The facts come from the Library of Congress, PRONOM, Apple's Mail guide, FileInfo, two Apple Communities threads and our checks of 12 good EMLX files and 27 damaged ones.
| Part | What we could check |
|---|---|
| Maker | Apple. It appeared in 2005 with Mail 2 on Mac OS X 10.4 (Tiger), per the Library of Congress and PRONOM. |
| Kind | Text in our 12 good EMLX files. A count line, a MIME message and an XML property list, in that order. |
| Count line | Digits and a line break. The number is the byte length of the message. |
| Specification | None published, per the Library of Congress. RFC 5322 covers the message text. |
| Plist keys |
flags, date-received, date-last-viewed, conversation-id and remote-id in our 12 good EMLX files.
|
| Flags | A number of bits. Bit 0 is read, bit 2 answered, bit 4 flagged and bit 8 forwarded. The four public files also set bit 33. |
| Endings |
.emlx, and .partial and .emlxpart per posters at Apple Communities. FileInfo lists .emlxpart.
|
| Media type |
message/ and com at the Library of Congress. None of the four databases we checked lists .emlx.
|
| Detection |
No signature at byte 0. PRONOM lists fmt/2055 with no extension. Our script reads the first line and looks for <?xml.
|
| Related formats | EML (which it modifies) and MBOX, per the Library of Congress. |
| Our tests | 12 good EMLX files, 27 damaged ones, five readers and one script on Linux. |
About the values we list
Facts about EMLX structure come from the Library of Congress record and from our files. Flag names come from Thunderbird source code and the emlx library, which agree. Where a source is thin, as with split files, the table says whose claim it is.
Where sources differ, we say so. FileInfo says an EMLX file does not store attachments, and our EMLX files did. The vendor page for Freeviewer names two different size limits. We list both views and mark which one we tested.
What we left out
We did not start Apple Mail on a Mac, so we cannot say how it treats a damaged EMLX file. We did not start Thunderbird or a Windows viewer. We had no copy of an actual Mail folder, and we made 8 of our 12 good EMLX files ourselves.
Our 27 damaged EMLX files come from one small multipart file, so they show what can happen and not how common it is. We tested no route to PDF or PST. We name no price, and the vendor pages name none we could use.
Sources checked
For the format, see the Library of Congress description and the PRONOM entry. For the ending, see the FileInfo page for EMLX. For import and export, see Apple's page on mailboxes.
For split files and folders, see the Apple Communities threads on recovering parts and the storage structure. For the message text, see the RFC 5322 text. Every count and label came from the files and scripts in our research folder.
Frequently Asked Questions About EMLX Files
What is an EMLX file?
An EMLX file is one email saved by Apple Mail on a Mac. It starts with a byte count, then has the message in MIME form and ends with a short property list of flags. Apple has published no specification.
How do I open an EMLX file?
Apple Mail opens EMLX files that it made. On Windows you need a viewer, or you convert the file to EML first. A text editor shows the content, but do not save the file, because an editor can break the byte count.
Can I open an EMLX file on Windows?
Windows has no Apple Mail, so you need a viewer or a conversion for EMLX files. SysTools and Freeviewer list Windows viewers on their pages, and we tested neither. Our Python script cuts the message out as an EML file, which most programs read.
What is the difference between EMLX and EML?
An EML file is one email as message text. An EMLX file is the same message with a byte count before it and a property list after it. Remove those two parts and the message is an EML file.
What is the number at the start of an EMLX file?
It is the byte length of the message that follows. The count covers the message only, not the plist. A count that is off by one stopped the emlx library on all 24 EMLX files we changed, so keep it exact.
What do the flags in an EMLX file mean?
The flags number in an EMLX file stores message status as bits. Bit 0 is read, bit 2 is answered, bit 4 is flagged and bit 8 is forwarded. Bits 10 to 15 store an attachment count. Apple has published no list.
Where does Apple Mail keep EMLX files?
Apple Mail keeps EMLX files as numbered files in the Mail folder inside the Library folder of the user. The Library of Congress and FileInfo both name that path. We did not test an actual Mail folder, so we cannot describe its inner layout.
How do I convert an EMLX file to EML?
Read the first line, then take that many bytes after it. Our 35 line Python script does this and wrote the same message for all 12 good EMLX files. It drops the flags, so write them down first.
Can I convert an EMLX file to PDF or PST?
We tested no route to either format. Convert the file to EML first, which keeps the message. Then use a program that reads EML for the next step. Check that program on a copy before you trust it with the original.
Why does my EMLX file say invalid or will not open?
The usual cause is a wrong byte count on the first line. In our tests, a damaged plist, a byte order mark, changed line ends and a cut file also stopped the emlx library. Use a check script, then rebuild the count.
What are partial.emlx and emlxpart files?
Posters at Apple Communities say a partial.emlx file stores the original message headers and an emlxpart file stores an encoded attachment. Apple has not documented them. A reader that opens only one file can show an incomplete message.
Is an EMLX file safe to open?
Reading one with a tool is safe, and our readers changed none of 39 EMLX files. The email inside can still contain links, remote images and attachments. Judge the sender, work on a copy and open no attachment you did not expect.
Still Stuck With an EMLX File? Seven routes out, depending on what went wrong
Check the first line and the count first. The ten causes list what to try in order.
Compare the size and the hash with the source. The repair steps show the order.
Is it one email as message text? The page on EML files shows how to open the format inside every EMLX file.
Is it many emails in one file? The page on MBOX files covers mailboxes in one file and the programs that read them.
Is it an Outlook message? The page on MSG files explains Outlook's single message format.
Is it an Outlook data file? The page on PST files covers Outlook data files and how to open them.
Is it a file type you do not know? Browse the file extension resource library, or send it to us on the submit a file type page.