Introduction
An mbox file is a whole mail folder in one text file: every message, one after another,
each in the same form as an EML file. It is the oldest
way of storing mail on Unix systems and is still widely used to move mail between
programs. Google Takeout exports Gmail as .mbox, Apple Mail exports each
mailbox as an .mbox folder with an mbox file inside, and Thunderbird keeps
each of its folders as an mbox file with no extension.
Structure
Each message starts with a separator line that begins From (the word, then
a space, with no colon), followed by the sender’s address and the date, for example
From alice@example.com Thu Jan 1 00:00:00 2026. The message’s header fields
and body follow, and a blank line ends it before the next separator.
Because a line starting From inside a body would look like a new message,
programs escape such lines by adding > in front. There are several
versions of the rules: mboxo escapes only From lines, mboxrd also escapes
lines that already start with >From so the change can be undone, and
mboxcl and mboxcl2 add a Content-Length field to give each message’s size
instead. Files do not say which version they use, so readers guess. The
separators and variants page gives the
rules of each, and the status fields mail programs add.
0From line sender and date1 line…Message header fields, empty line, bodyvaries…Empty line, then the next From line and messagerepeated
Not described
mbox was never standardised; the pages follow RFC 4155, mbox(5), Mutt and Thunderbird, and for
the four-variant family (mboxo, mboxrd, mboxcl, mboxcl2) Jonathan de Boyne Pollard's
description. The index files page covers
Thunderbird's .msf (Mork) summary files and Mutt's header cache.
Known, not yet covered
- Viewer: every message is found (the file is read once in windows, so any
size opens), listed in pages and opened in the email viewer, with the variant judged from
the evidence in the file and the quoting taken off to match. An MMDF mailbox (a first line
of four Control-A characters, which opens and closes every message) is read as a variant of
its own: its messages open in the email viewer without their delimiter lines, and text
between messages or a message that is never closed is reported. The 7-bit rule of RFC 4155
(messages are seven-bit characters; eight-bit data is encoded first) is a note in the
overview: it says how many messages hold bytes above 127 and where the first is, and it is
not counted as a problem, because many programs store 8-bit text as it arrived. Not covered:
the Mork
.msfand header-cache index files, separators that carry a date in another form than ctime (read as a body line unless a blank line comes before them), and the Mozilla X-Mozilla-Status fields (shown as ordinary header fields). A message's summary is read from its first 64 KB.
Unknown
- Reference: a rule that says which variant a given file is; nothing in the file says so, and the sources read give none (the variants page lists the hints the descriptions allow).
- Reference: the summary or index files of other mail programs, and where
Thunderbird takes a message's position in the mbox from (the
msgOffsetcolumn is marked obsolete in its source).
Links
Software
- Mozilla Thunderbird – free email program that keeps its folders as mbox files (Windows, macOS, Linux)
- Apple Mail – imports and exports mailboxes as mbox (macOS)
- Google Takeout – exports Gmail as mbox (web)
- Mutt – text-mode email program that reads mbox folders (macOS, Linux)
Developers
- mailbox – standard library module for mbox and other mailbox formats (Python)
Reference
- RFC 4155 – The application/mbox Media Type, which describes the common format