5 .\" Copyright (C) 2000 Thomas Roessler <roessler@does-not-exist.org>
7 .\" This document is in the public domain and may be distributed and
8 .\" changed arbitrarily.
10 .TH mbox 5 "August 2000" Unix "User Manuals"
13 mbox \- Format for mail message storage.
16 This document describes the format traditionally used by Unix hosts
17 to store mail messages locally.
19 files typically reside in the system's mail spool, under various
22 directories, and under the name
24 in users' home directories.
28 is a text file containing an arbitrary number of e-mail messages.
29 Each message consists of a postmark, followed by an e-mail message
30 formatted according to RFC 822. The file format is line-oriented.
31 Lines are separated by line feed characters (ASCII 10).
33 A postmark line consists of the four characters "From", followed by
34 a space character, followed by the message's envelope sender
35 address, followed by whitespace, and followed by a time stamp. The
36 sender address is expected to be an
38 as defined in appendix D of RFC 822.
40 The date is expected to be formatted according to the following
41 syntax (represented in the augmented Backus-Naur formalism used by
46 mbox-date = weekday month day time [ timezone ] year
47 weekday = "Mon" / "Tue" / "Wed" / "Thu" / "Fri"
49 month = "Jan" / "Feb" / "Mar" / "Apr" / "May"
50 / "Jun" / "Jul" / "Aug" / "Sep"
51 / "Oct" / "Nov" / "Dec"
53 time = 1*2DIGIT ":" 1*2DIGIT [ ":" 1*2DIGIT ]
54 timezone = ( "+" / "-" ) 4DIGIT
55 year = ( 4DIGIT / 2DIGIT )
58 For compatibility reasons with legacy software, two-digit years
59 greater than or equal to 70 should be interpreted as the years
60 1970+, while two-digit years less than 70 should be interpreted as
63 Software reading files in this format should also be prepared to
64 accept non-numeric timezone information such as "CET DST" for
65 Central European Time, dailight saving time.
69 From roessler@does-not-exist.org Fri Jun 23 02:56:55 2000
71 In order to avoid mis-interpretation of lines in message bodies
72 which begin with the four characters "From", followed by a space
73 character, the character ">" is commonly prepended in front of such
80 files are frequently accessed by multiple programs in parallel,
82 files should generally not be accessed without locking.
84 Three different locking mechanisms (and combinations thereof) are in
88 locking is mostly used on recent, POSIX-compliant systems. Use of
89 this locking method is, in particular, advisable if
91 files are accessed through the Network File System (NFS), since it
92 seems the only way to reliably invalidate NFS clients' caches.
95 locking is mostly used on BSD-based systems.
97 Dotlocking is used on all kinds of systems. In order to lock an
101 an application first creates a temporary file with a unique
102 name in the directory in which the
104 resides. The application then tries to use the
106 system call to create a hard link named
108 to the temporary file. The success of the
110 system call should be additionally verified using
112 calls. If the link has succeeded, the mail folder is considered
113 dotlocked. The temporary file can then safely be unlinked.
115 In order to release the lock, an application just unlinks the
119 If multiple methods are combined, implementors should make sure to
120 use the non-blocking variants of the
124 sytem calls in order to avoid deadlocks.
126 If multiple methods are combined, an
128 file must not be considered to have been successfully locked before
129 all individual locks were obtained. When one of the individual
130 locking methods fails, an application should release all locks it
131 acquired successfully, and restart the entire locking procedure from
132 the beginning, after a suitable delay.
134 The locking mechanism used on a particular system is a matter of
135 local policy, and should be consistently used by all applications
136 installed on the system which access
138 files. Failure to do so may result in loss of e-mail data, and in
144 .IP "/var/spool/mail/\fIuser\fP"
146 incoming mail folder.
147 .IP "~\fIuser\fP/mbox"
149 archived mail messages, in his home directory.
150 .IP "~\fIuser\fP/Mail/"
153 home directory which is commonly used to hold
168 .BR mutt_dotlock (1),
173 D. Crocker, Standard for the format of ARPA Internet text messages,
176 M. R. Horton, UUCP mail interchange format standard, RFC 976
180 The present document was written by Thomas Roessler
181 <roessler@does-not-exist.org>.
187 format occured in Version 6 AT&T Unix.
189 A variant of this format was documented in RFC 976.