]> git.pld-linux.org Git - packages/man-pages.git/blob - mbox.5
- separated POSIX man pages, rel. 1
[packages/man-pages.git] / mbox.5
1 '\" t
2 .\" -*-nroff-*-
3 .\"
4 .\"
5 .\"     Copyright (C) 2000 Thomas Roessler <roessler@does-not-exist.org>
6 .\"
7 .\"     This document is in the public domain and may be distributed and
8 .\"     changed arbitrarily.
9 .\"
10 .TH mbox 5 "August 2000" Unix "User Manuals"
11 .SH NAME
12 .PP
13 mbox \- Format for mail message storage.
14 .SH DESCRIPTION
15 .PP
16 This document describes the format traditionally used by Unix hosts
17 to store mail messages locally.
18 .B mbox
19 files typically reside in the system's mail spool, under various
20 names in users'
21 .B Mail
22 directories, and under the name
23 .B mbox
24 in users' home directories.
25 .PP
26 An
27 .B mbox
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).
32 .PP
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
37 an
38 .B addrspec
39 as defined in appendix D of RFC 822.
40 .PP
41 The date is expected to be formatted according to the following
42 syntax (represented in the augmented Backus-Naur formalism used by
43 RFC 822):
44 .PP
45 .TS
46 lll.
47 mbox-date        =      weekday month day time [ timezone ] year
48 weekday  =      "Mon" / "Tue" / "Wed" / "Thu" / "Fri"
49                 / "Sat" / "Sun"
50 month    =      "Jan" / "Feb" / "Mar" / "Apr" / "May"
51                 / "Jun" / "Jul" / "Aug" / "Sep"
52                 / "Oct" / "Nov" / "Dec"
53 day      =      1*2DIGIT
54 time     =      1*2DIGIT ":" 1*2DIGIT [ ":" 1*2DIGIT ]
55 timezone         =      ( "+" / "-" ) 4DIGIT
56 year     =      ( 4DIGIT / 2DIGIT )
57 .TE
58 .PP
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
62 the years 2000-2069.
63 .PP
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.
67 .PP
68 Example:
69 .IP "" 1
70 From roessler@does-not-exist.org Fri Jun 23 02:56:55 2000
71 .PP
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.
77 .sp
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
83 .PP
84 .RS
85 >From the command line you can use the '-p' option
86 .RE
87 .PP
88 arn't dequoted wrongly as a mboxrd-MDA would turn the line
89 into
90 .PP
91 .RS
92 >>From the command line you can use the '-p' option
93 .RE
94 .PP
95 before storing it.
96 .SH
97 LOCKING
98 .PP
99 Since
100 .B mbox
101 files are frequently accessed by multiple programs in parallel,
102 .B mbox
103 files should generally not be accessed without locking.
104 .PP
105 Three different locking mechanisms (and combinations thereof) are in
106 general use:
107 .IP "\(bu"
108 .BR fcntl (2)
109 locking is mostly used on recent, POSIX-compliant systems. Use of
110 this locking method is, in particular, advisable if
111 .B mbox
112 files are accessed through the Network File System (NFS), since it
113 seems the only way to reliably invalidate NFS clients' caches.
114 .IP "\(bu"
115 .BR flock (2)
116 locking is mostly used on BSD-based systems.
117 .IP "\(bu"
118 Dotlocking is used on all kinds of systems. In order to lock an
119 .B mbox
120 file named
121 .IR folder ,
122 an application first creates a temporary file with a unique
123 name in the directory in which the
124 .I folder
125 resides. The application then tries to use the
126 .BR link (2)
127 system call to create a hard link named
128 .IB folder .lock
129 to the temporary file. The success of the
130 .BR link (2)
131 system call should be additionally verified using
132 .BR stat (2)
133 calls. If the link has succeeded, the mail folder is considered
134 dotlocked. The temporary file can then safely be unlinked.
135 .IP ""
136 In order to release the lock, an application just unlinks the
137 .IB folder .lock
138 file.
139 .PP
140 If multiple methods are combined, implementors should make sure to
141 use the non-blocking variants of the
142 .BR fcntl (2)
143 and
144 .BR flock (2)
145 sytem calls in order to avoid deadlocks.
146 .PP
147 If multiple methods are combined, an
148 .B mbox
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.
154 .PP
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
158 .B mbox
159 files. Failure to do so may result in loss of e-mail data, and in
160 corrupted
161 .B mbox
162 files.
163 .SH
164 FILES
165 .IP "/var/spool/mail/\fIuser\fP"
166 .IR user 's
167 incoming mail folder.
168 .IP "~\fIuser\fP/mbox"
169 .IR user 's
170 archived mail messages, in his home directory.
171 .IP "~\fIuser\fP/Mail/"
172 A directory in
173 .IR user 's
174 home directory which is commonly used to hold
175 .B mbox
176 format folders.
177 .SH
178 SEE ALSO
179 .PP
180 .BR elm (1),
181 .BR fcntl (2),
182 .BR flock (2),
183 .BR link (2),
184 .BR local (8),
185 .BR mail (1),
186 .BR maildir (5),
187 .BR mail.local (8),
188 .BR mutt (1),
189 .BR mutt_dotlock (1),
190 .BR pine (1),
191 .BR procmail (1),
192 .BR sendmail (8)
193 .PP
194 D. Crocker, Standard for the format of ARPA Internet text messages,
195 RFC 822
196 .PP
197 M. R. Horton, UUCP mail interchange format standard, RFC 976
198 .SH
199 AUTHOR
200 .PP
201 The present document was written by Thomas Roessler
202 <roessler@does-not-exist.org>.
203 .SH
204 HISTORY
205 .PP
206 The
207 .B mbox
208 format occured in Version 6 AT&T Unix.
209 .PP
210 A variant of this format was documented in RFC 976.
This page took 0.071308 seconds and 3 git commands to generate.