3 mbox \- file containing mail messages
5 The most common format for storage of mail messages is
10 is a single file containing zero or more mail messages.
16 line, continues with a series of
19 and ends with a blank line.
22 line means any line that begins with the characters
26 From god@heaven.af.mil Sat Jan 3 01:05:34 1996
28 Return-Path: <god@heaven.af.mil>
30 Delivered-To: djb@silverton.berkeley.edu
32 Date: 3 Jan 1996 01:05:34 -0000
34 From: God <god@heaven.af.mil>
36 To: djb@silverton.berkeley.edu (D. J. Bernstein)
40 How's that mail system project coming along?
45 The final line is a completely blank line (no spaces or tabs).
46 Notice that blank lines may also appear elsewhere in the message.
50 line always looks like
56 is one word, without spaces or tabs;
57 it is usually the envelope sender of the message.
59 is the delivery date of the message.
60 It always contains exactly 24 characters in
64 is optional; it may contain arbitrary information.
68 line and the blank line is a message in RFC 822 format,
74 .SH "HOW A MESSAGE IS DELIVERED"
75 Here is how a program appends a message to an
81 line given the message's envelope sender and the current date.
82 If the envelope sender is empty (i.e., if this is a bounce message),
86 If the envelope sender contains spaces, tabs, or newlines,
87 the program replaces them with hyphens.
89 The program then copies the message, applying
93 ensures that the resulting lines are not
96 the program prepends a
109 Finally the program appends a blank line to the message.
110 If the last line of the message was a partial line,
111 it writes two newlines;
112 otherwise it writes one.
113 .SH "HOW A MESSAGE IS READ"
114 A reader scans through an
121 line marks the beginning of a message.
122 The reader should not attempt to take advantage of the fact that every
124 line (past the beginning of the file)
125 is preceded by a blank line.
127 Once the reader finds a message,
128 it extracts a (possibly corrupted) envelope sender
129 and delivery date out of the
132 It then reads until the next
134 line or end of file, whichever comes first.
135 It strips off the final blank line
143 The result is an RFC 822 message.
144 .SH "COMMON MBOX VARIANTS"
145 There are many variants of
148 The variant described above is
150 format, popularized by Rahul Dhesi in June 1995.
159 As a result it is impossible to tell whether
162 From: djb@silverton.berkeley.edu (D. J. Bernstein)
164 To: god@heaven.af.mil
168 >From now through August I'll be doing beta testing.
170 Thanks for your interest.
173 was quoted in the original message.
176 reader will always strip off the quoting.
181 format, but includes a Content-Length field with the
182 number of bytes in the message.
189 These formats are used by SVR4 mailers.
191 cannot be read safely by
194 .SH "UNSPECIFIED DETAILS"
195 There are many locking mechanisms for
201 on systems that have it, otherwise
204 The delivery date in a
206 line does not specify a time zone.
208 always creates the delivery date in GMT
211 files can be safely transported from one time zone to another.
213 If the mtime on a nonempty
215 file is greater than the atime,
216 the file has new mail.
217 If the mtime is smaller than the atime,
218 the new mail has been read.
219 If the atime equals the mtime,
220 there is no way to tell whether the file has new mail,
223 takes much less than a second to run.
224 One solution is for a mail reader to artificially set the
225 atime to the mtime plus 1.
226 Then the file has new mail if and only if the atime is
227 less than or equal to the mtime.
229 Some mail readers place
231 fields in each message to indicate which messages have been read.