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. This
36 line is often called From_ line. The sender address is expected to be
39 as defined in appendix D of RFC 822.
41 The date is expected to be formatted according to the following
42 syntax (represented in the augmented Backus-Naur formalism used by
47 mbox-date = weekday month day time [ timezone ] year
48 weekday = "Mon" / "Tue" / "Wed" / "Thu" / "Fri"
50 month = "Jan" / "Feb" / "Mar" / "Apr" / "May"
51 / "Jun" / "Jul" / "Aug" / "Sep"
52 / "Oct" / "Nov" / "Dec"
54 time = 1*2DIGIT ":" 1*2DIGIT [ ":" 1*2DIGIT ]
55 timezone = ( "+" / "-" ) 4DIGIT
56 year = ( 4DIGIT / 2DIGIT )
59 For compatibility reasons with legacy software, two-digit years
60 greater than or equal to 70 should be interpreted as the years
61 1970+, while two-digit years less than 70 should be interpreted as
64 Software reading files in this format should also be prepared to
65 accept non-numeric timezone information such as "CET DST" for
66 Central European Time, dailight saving time.
70 From roessler@does-not-exist.org Fri Jun 23 02:56:55 2000
72 .\" should quote or must quote?
73 In order to avoid mis-interpretation of lines in message bodies
74 which begin with the four characters "From", followed by a space
75 character, the mail delivery agent should quote any occurrence
76 of "From " at the start of a body line.
78 There are two different quoting schemes, the first (mboxo) only
79 quotes plain "From " lines in the body by prepending a '>' to the
80 line; the second (mboxrd) also quotes allready quoted "From " lines
81 by prepending a '>' (i.e. ">From ", ">>From ", ...). The later has
82 the advantage that lines like
85 >From the command line you can use the '-p' option
88 arn't dequoted wrongly as a mboxrd-MDA would turn the line
92 >>From the command line you can use the '-p' option
101 files are frequently accessed by multiple programs in parallel,
103 files should generally not be accessed without locking.
105 Three different locking mechanisms (and combinations thereof) are in
109 locking is mostly used on recent, POSIX-compliant systems. Use of
110 this locking method is, in particular, advisable if
112 files are accessed through the Network File System (NFS), since it
113 seems the only way to reliably invalidate NFS clients' caches.
116 locking is mostly used on BSD-based systems.
118 Dotlocking is used on all kinds of systems. In order to lock an
122 an application first creates a temporary file with a unique
123 name in the directory in which the
125 resides. The application then tries to use the
127 system call to create a hard link named
129 to the temporary file. The success of the
131 system call should be additionally verified using
133 calls. If the link has succeeded, the mail folder is considered
134 dotlocked. The temporary file can then safely be unlinked.
136 In order to release the lock, an application just unlinks the
140 If multiple methods are combined, implementors should make sure to
141 use the non-blocking variants of the
145 sytem calls in order to avoid deadlocks.
147 If multiple methods are combined, an
149 file must not be considered to have been successfully locked before
150 all individual locks were obtained. When one of the individual
151 locking methods fails, an application should release all locks it
152 acquired successfully, and restart the entire locking procedure from
153 the beginning, after a suitable delay.
155 The locking mechanism used on a particular system is a matter of
156 local policy, and should be consistently used by all applications
157 installed on the system which access
159 files. Failure to do so may result in loss of e-mail data, and in
165 .IP "/var/spool/mail/\fIuser\fP"
167 incoming mail folder.
168 .IP "~\fIuser\fP/mbox"
170 archived mail messages, in his home directory.
171 .IP "~\fIuser\fP/Mail/"
174 home directory which is commonly used to hold
189 .BR mutt_dotlock (1),
194 D. Crocker, Standard for the format of ARPA Internet text messages,
197 M. R. Horton, UUCP mail interchange format standard, RFC 976
201 The present document was written by Thomas Roessler
202 <roessler@does-not-exist.org>.
208 format occured in Version 6 AT&T Unix.
210 A variant of this format was documented in RFC 976.