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.
0From line sender and date1 line…Message header fields, empty line, bodyvaries…Empty line, then the next From line and messagerepeated
Links
Software
- Mozilla Thunderbird (Windows, macOS, Linux)
- Apple Mail, which imports and exports mbox (macOS)
- Google Takeout, which exports Gmail as mbox
- Mutt (macOS, Linux)
Developers
- mailbox, Python standard library module for mbox and other mailbox formats
Reference
- RFC 4155, The application/mbox Media Type