mbox was never standardised as one format.
RFC 4155 (2005) registered the
application/mbox media type, described the common ground and defined a
default format. The variants below are described in Mutt’s
mbox(5) manual
page and manual; the status flags come from Mutt’s parse.c and
Thunderbird’s nsMsgMessageFlags.idl. All were read 2026-11-12. Each
message inside is an RFC 5322 message; mbox(5) says
lines are separated by line feeds, and RFC 4155’s default format requires a single
line feed, never CR LF.
The From_ line
Every message starts with a separator line: the four characters
From, a space, the envelope sender, white space, then a time stamp in
the form C’s asctime() prints:
From alice@example.com Thu Nov 12 21:30:00 2026
- The sender is an
addr-specaddress taken from the envelope. - RFC 4155’s default format puts the UTC time when the message was received, with
no time zone. RFC 4155 notes that other programs write local time and other forms;
mbox(5) says readers should accept two-digit years (70 and up meaning 19xx, below
70 meaning 20xx) and zone names such as
CET DST. - In the default format each message ends with an empty line, so every message after the first is preceded by two line ends; the file ends when no more data or separator lines follow.
Variants
| Variant | Message ends | Escaping of From lines in bodies |
|---|---|---|
| mboxo | At the next From_ line | Only plain From lines at the start of a body line get a > in front. A line that already read >From is left alone, so it is unquoted wrongly on reading. |
| mboxrd | At the next From_ line | Already-quoted lines (>From , >>From , …) get one more > too, so reading can remove exactly one. |
| mboxcl | As mboxo, with a Content-Length field giving the number of bytes in the body | As mboxo, so any mboxo reader can read it. |
| mboxcl2 | No From_ scanning: a Content-Length header gives the length of the body in bytes, added when the message is stored | None: messages are written and read exactly as they are. |
| MMDF | Each message is surrounded by lines of four Control-A characters | None: the delimiter line opens a message and the same line closes it, and no From line is special. The viewer reads a file whose first line is four Control-A characters this way, pairing the lines in order; Mutt’s manual notes that four Control-A characters may also appear in bodies, and a body that holds such a line is cut at it (the viewer reports text between messages, or a last message that is never closed). |
Nothing in the file says which variant it is. RFC 4155 lists the other habits it
found: some programs escape From lines only after a blank line or
when they look like a separator, some add second escapes, and some do not escape
at all; its default format prescribes no escaping.
The family as Jonathan de Boyne Pollard describes it
From his Frequently Given Answer "mbox" is a family of several mutually incompatible mailbox formats (2004, 2010) and Jamie Zawinski's 1996 usenet article on the Content-Length format (archive copy), read 2026-11-13. The names mboxo, mboxrd, mboxcl and mboxcl2 come from 1996 (Daniel J. Bernstein, Rahul Dhesi and others), as the English Wikipedia article on mbox says.
- Common to all. All messages are in one file, new ones appended. Each message is preceded by a
Fromline (five characters, letter F, r, o, m and a space) and followed by a blank line; the rest of the line does not decide whether it is a From_ line. By convention it continues with the envelope sender (MAILER-DAEMONif none; spaces in the name replaced by hyphens) and the delivery date inasctime()form (day name, month, day, time, year; best read as UTC). The lines before and after a message bracket it and are not a divider: the first message has no blank line before it, the last has no From_ line after it. Messages may contain blank lines, so the blank line is never searched for. A file whose first line is not a From_ line is undefined, and so is delivery of a message with no final newline (tools either store it as is or add one). - mboxo ("original" System V format): irreversible quoting. Any line in the header or body that begins
Fromgets a>prepended (1,$s/^From />&/), so a>Fromline in an original message cannot be told apart on reading. The next message is found by scanning for the next From_ line; when reading, the trailing blank line is dropped. Postfix of 2004 still used it. - mboxrd (named after Rahul Dhesi; qmail switched to it on 1996-03-02): reversible quoting. Any line that begins with zero or more
>followed byFromgets one more>(1,$s/^>*From />&/); on reading a line with one or more>thenFromloses one (1,$s/^>(>*From )/\1/). Message boundaries are found as in mboxo. - mboxcl (one of the "new" System V formats): quotes like mboxo (irreversibly), but the start of the next message is found from a
Content-Lengthheader giving the length of the body, after quoting, in bytes, which is added when the message is stored. The treatment of a message that already has one is undefined (best practice: remove it before delivery). With noContent-Lengththe next message cannot be located reliably; some tools then fall back to From_ scanning. Several differing headers cannot be resolved. The trailing blank line is dropped when reading. - mboxcl2 (the other "new" System V format): no quoting at all; the message is stored and read as it stands, and
Content-Length(the body length in bytes, added at storing) locates the next message. The same undefined cases as mboxcl, but without From_ scanning there is no fallback at all: a message with noContent-Lengthmakes the next message unfindable. - Consequences. mboxcl and mboxcl2 readers cannot reliably read mboxo or mboxrd files (a
Content-Lengthalready in an original message is preserved untouched by mboxo and mboxrd and may be wrong). mboxo and mboxrd readers cannot reliably read mboxcl2 files, and delivering to an mboxcl2 file with an mboxo or mboxrd tool corrupts it so that every later message is lost. An mboxrd reader restores more messages of an mboxo file than an mboxo reader does (a plainFromis more likely than>Fromin real mail), but not all; an mboxo reader damages fewer messages if the writer was also mboxo. Zawinski calls the Content-Length format non-portable and easily corrupted and says the only safe way to read the BSD format is to treat a line startingFromafter a blank line or at the start of the file as the divider, not to check what follows it. - Which variant? Neither source gives a test; both say that tools support different members of the family, often without saying which, and that care is needed when different tools share a file. What can be said from the descriptions:
Content-Lengthheaders that match the body lengths point to mboxcl or mboxcl2; only in mboxcl2 areFromlines in bodies left unquoted; only in mboxrd do>>Fromlines occur by design.
RFC 4155: application/mbox
RFC 4155 registers the media
type application/mbox with one optional parameter, format,
default default (the format of its Appendix A); a receiver that sees an
unknown format value should treat the data as
application/octet-stream. New values are registered with IANA and need a
complete published description. The default format:
- Each message follows RFC 2822 syntax, except that lines end in a single LF (the rule applies to the file as transferred).
- Messages are seven-bit characters in an eight-bit stream: eight-bit data must be encoded and tagged first.
- Headers must be fully qualified (real domain names, MIME for extended characters).
- A separator line precedes each message:
From, a space, the sender's addr-spec, a space, a UTC receive time inctimeform without a zone, then the line end. An empty line ends each message. - No escaping of body lines starting
Fromis defined; readers must parse full separator lines.
The text lists what it found in the wild: untagged eight-bit text in a local
character set, local time stamp and address forms, unencoded binary or BinHex and
UUencode data, files that join several mbox files or were edited by several clients
that each wrote their own separator, platform line ends, and the four From escaping
habits in Variants. Its magic number is the leading
From followed by printable text, but not every file conforms. The
.mbox extension is only sometimes used, and no Macintosh type code is
known. Because an mbox attached to a message could merge with a local mbox, a message
carrying application/mbox must use a non-transparent transfer encoding
(base64 or quoted-printable), at least for the separator lines. The RFC points to the
qmail mbox(5) page as the most authoritative description of variants and recommends
multipart/digest where it can be used instead.
Status headers
mbox(5) says many mail programs put a Status: field in each message
to show which have been read. The letters below are the ones Mutt reads:
| Field | Letters or bits |
|---|---|
Status | R read, O old, r replied. |
X-Status | A replied, F flagged, D deleted. |
X-Mozilla-Status, X-Mozilla-Status2 | Thunderbird’s message flags (the low and high halves): 0x0001 read, 0x0002 replied, 0x0004 marked, 0x0008 expunged (removed at the next compaction), 0x0010 subject had Re:, 0x0020 elided, 0x0040 feed message, 0x0080 offline, 0x0100 watched, 0x0200 sender authenticated, 0x0400 partial, 0x0800 queued, 0x1000 forwarded, 0x2000 redirected, 0xE000 priority (the source says this is no longer used); 0x10000 new, 0x40000 ignored thread, 0x200000 IMAP deleted, 0x400000 and 0x800000 delivery-report needed and sent, 0x1000000 template, 0x0E000000 labels, 0x10000000 has attachments. Elided, new and offline are runtime flags that are not written (RuntimeOnly in the IDL). The IDL names no flag at 0x20000, 0x80000 or 0x100000, and says that 0x8000000, 0x20000000 and 0x40000000 are view flags (is-thread, dummy, has-children) not to be used. The three label bits hold the message label; the three priority bits are kept in the IDL but unused. The IDL also has processing flags (ClassifyJunk 1, ClassifyTraits 2, TraitsDone 4, FiltersDone 8, FilterToMove 0x10, NotReportedClassified 0x20), which are not part of these headers. |
Locking
mbox(5) gives three locking methods, used alone or together: fcntl
(advised over NFS), flock (mostly BSD), and a dot lock, where a program
makes a temporary file in the same folder, hard-links it as
name.lock, checks the link with stat, and later deletes
name.lock to unlock. When several are combined, the file is locked only
once all of them are held. Which method a system uses is local policy, and every
program on it must use the same one.