This document describes the format traditionally used by Unix hosts to store mail messages locally. mbox files typically reside in the system's mail spool, under various names in users' Mail directories, and under the name mbox in users' home directories.
An mbox is a text file containing an arbitrary number of e-mail messages. Each message consists of a postmark, followed by an e-mail message formatted according to RFC 822. The file format is line-oriented. Lines are separated by line feed characters (ASCII 10).
A postmark line consists of the four characters "From", followed by a space character, followed by the message's envelope sender address, followed by whitespace, and followed by a time stamp. The sender address is expected to be an addrspec as defined in appendix D of RFC 822.
The date is expected to be formatted according to the following syntax (represented in the augmented Backus-Naur formalism used by RFC 822):
mbox-date | = | weekday month day time [ timezone ] year |
weekday | = | "Mon" / "Tue" / "Wed" / "Thu" / "Fri" |
/ "Sat" / "Sun" | ||
month | = | "Jan" / "Feb" / "Mar" / "Apr" / "May" |
/ "Jun" / "Jul" / "Aug" / "Sep" | ||
/ "Oct" / "Nov" / "Dec" | ||
day | = | 1*2DIGIT |
time | = | 1*2DIGIT ":" 1*2DIGIT [ ":" 1*2DIGIT ] |
timezone | = | ( "+" / "-" ) 4DIGIT |
year | = | ( 4DIGIT / 2DIGIT ) |
For compatibility reasons with legacy software, two-digit years greater than or equal to 70 should be interpreted as the years 1970+, while two-digit years less than 70 should be interpreted as the years 2000-2069.
Software reading files in this format should also be prepared to accept non-numeric timezone information such as "CET DST" for Central European Time, dailight saving time.
Example:
In order to avoid mis-interpretation of lines in message bodies which begin with the four characters "From", followed by a space character, the character ">" is commonly prepended in front of such lines.
Since mbox files are frequently accessed by multiple programs in parallel, mbox files should generally not be accessed without locking.
Three different locking mechanisms (and combinations thereof) are in general use:
If multiple methods are combined, implementors should make sure to use the non-blocking variants of the fcntl(2) and flock(2) sytem calls in order to avoid deadlocks.
If multiple methods are combined, an mbox file must not be considered to have been successfully locked before all individual locks were obtained. When one of the individual locking methods fails, an application should release all locks it acquired successfully, and restart the entire locking procedure from the beginning, after a suitable delay.
The locking mechanism used on a particular system is a matter of local policy, and should be consistently used by all applications installed on the system which access mbox files. Failure to do so may result in loss of e-mail data, and in corrupted mbox files.
elm(1), fcntl(2), flock(2), link(2), local(8), mail(1), maildir(5), mail.local(8), mutt(1), mutt_dotlock(1), pine(1), procmail(1), sendmail(8)
D. Crocker, Standard for the format of ARPA Internet text messages, RFC 822
M. R. Horton, UUCP mail interchange format standard, RFC 976
The present document was written by Thomas Roessler <[email protected]>.
The mbox format occured in Version 6 AT&T Unix.
A variant of this format was documented in RFC 976.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |