Format:mbox
| Magic | From (ASCII 'From ' with a trailing space) at offset 0 |
|---|---|
| Extensions | .mbox, none (Unix mail spool) |
| Endianness | n/a (text) |
| On this wiki | Facts · Code · Notes · Topics |
Single-file mail folders where each message follows a 'From ' separator line: mboxo, mboxrd (quoting of body lines starting with From), mboxcl (adds Content-Length) and the MMDF variant with four Control-A separator lines.
The mbox family stores a whole mail folder as one text file with LF line endings. Facts below are from the mbox(5) and mmdf(5) manual pages shipped in the neomutt repository (docs/mbox.5, docs/mmdf.5) and from neomutt's mbox/mbox.c (GPL-2.0).
Structure
Each message starts with a postmark line (the From_ line): the four characters From, a space, the envelope sender address, whitespace and a time stamp in asctime form. The RFC 822 / 2822 message follows. A message ends where the next line starting with From appears. A blank line before the separator is conventionally a delimiter and is not part of the message (neomutt subtracts one byte for it when it computes a body length).
Variants
| Variant | Rule |
|---|---|
| mboxo | A body line beginning with From is quoted by prepending >. Already quoted lines are not changed, so the round trip is lossy.
|
| mboxrd | Like mboxo but also lines that are >From , >>From and so on get one more >, so the quoting is reversible.
|
| mboxcl | mboxo plus a Content-Length: header with the body size in bytes; a reader can skip the body without scanning (the manual says it reads in any mboxo reader).
|
| mboxcl2 | Unverified here: like mboxcl but without From-quoting. |
| MMDF | No quoting. Each message is enclosed between lines consisting of four Control-A characters (0x01 0x01 0x01 0x01) and LF. |
neomutt recognises a folder by its first line: it begins with From for mbox, or equals the MMDF separator for MMDF (mbox/mbox.c, type probe near line 1600). Without a valid From_ line it cannot tell mbox from other text.
Practical notes for readers
- Many clients add a
Status:(andX-Status:) header with read flags; mbox files are changed in place, so new mail is detected by modification time greater than access time (manual page). Locking uses fcntl, flock or dotlock files. - An index kept beside the folder (for example Thunderbird's .msf, see Format:Thunderbird MSF (Mork)) stores the byte offset of each message, which is why editing an mbox behind the client's back breaks it.
- Compare Format:Maildir (one file per message). See Technique:Identifying mail and message stores.
Code & repositories
- https://github.com/neomutt/neomutt @
897cc57b36af55a6c13ec718cd3c95c39391bf6f· license: GPL-2.0-or-later (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
NeoMutt mail client: mbox/mbox.c parses mbox and MMDF folders, maildir/message.c builds and parses Maildir flags, docs/mbox.5 and docs/mmdf.5 describe the formats.
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-19