Unlike the Internet protocols used for the exchange of email, the format used for the storage of email has never been formally defined through the RFC standardization mechanism and has been entirely left to the developer of an email client. However, the POSIX standard defined a loose framework in conjunction with the mailx program. In 2005, the application/mbox media type was standardized as RFC 4155, which hinted that mbox stores mailbox messages in their original Internet Message (RFC 2822) format, except for the used newline character, seven-bit clean data storage, and the requirement that each newly added message is terminated with a completely empty line within the mbox database.23
Because more than one messages are stored in a single file, some form of file locking is needed to avoid the corruption that can result from two or more processes modifying the mailbox simultaneously. This could happen if a network email delivery program delivers a new message at the same time as a mail reader is deleting an existing message.
Various mutually incompatible mechanisms have been used by different mbox formats to enable message file locking, including fcntl() and lockf(). This does not work well with network mounted file systems, such as the Network File System (NFS), which is why traditionally Unix used additional "dot lock" files, which could be created atomically even over NFS.
Mbox files should also be locked while they are being read. Otherwise, the reader may see corrupted message contents if another process is modifying the mbox at the same time, even though no actual file corruption occurs.
In open source development, it is common to send patches in the diff format to a mailing list for discussion. The diff format allows for irrelevant "headers", such as mbox data, to be added.45 Version control systems like git have support for generating mbox-formatted patches and for sending them to the list as emails in a thread.67
Hall, E., ed. (September 2005). "Request for Comments: 4155 – The application/mbox Media Type". Internet Engineering Task Force. Archived from the original on 17 May 2021. Retrieved 17 May 2021. https://datatracker.ietf.org/doc/html/rfc4155 ↩
Resnick, P., ed. (April 2001). "Request for Comments: 2822 – Internet Message Format". Internet Engineering Task Force. Archived from the original on 31 March 2023. Retrieved 17 May 2021. https://datatracker.ietf.org/doc/html/rfc2822 ↩
"Submitting patches: the essential guide to getting your code into the kernel — The Linux Kernel documentation". www.kernel.org. Archived from the original on 2019-10-27. Retrieved 2020-03-03. https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html ↩
Randal, Allison; Sugalski, Dan; Tötsch, Leopold (2003). "Patch submission". Perl 6 Essentials. O'Reilly Media, Inc. p. 14. ISBN 978-0-596-00499-6. 978-0-596-00499-6 ↩
"Git - git-format-patch Documentation". git-scm.com. Archived from the original on 2020-03-07. Retrieved 2020-03-03. https://git-scm.com/docs/git-format-patch ↩
"Git - git-send-email Documentation". git-scm.com. Archived from the original on 2020-02-21. Retrieved 2020-03-03. https://git-scm.com/docs/git-send-email ↩