]> git.pld-linux.org Git - packages/man-pages.git/blame - mbox.5
- separated POSIX man pages, rel. 1
[packages/man-pages.git] / mbox.5
CommitLineData
62cc9d3e
JB
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
13mbox \- Format for mail message storage.
14.SH DESCRIPTION
15.PP
16This document describes the format traditionally used by Unix hosts
17to store mail messages locally.
18.B mbox
19files typically reside in the system's mail spool, under various
20names in users'
21.B Mail
22directories, and under the name
23.B mbox
24in users' home directories.
25.PP
26An
27.B mbox
28is a text file containing an arbitrary number of e-mail messages.
29Each message consists of a postmark, followed by an e-mail message
30formatted according to RFC 822. The file format is line-oriented.
31Lines are separated by line feed characters (ASCII 10).
32.PP
33A postmark line consists of the four characters "From", followed by
34a space character, followed by the message's envelope sender
35address, followed by whitespace, and followed by a time stamp. This
36line is often called From_ line. The sender address is expected to be
37an
38.B addrspec
39as defined in appendix D of RFC 822.
40.PP
41The date is expected to be formatted according to the following
42syntax (represented in the augmented Backus-Naur formalism used by
43RFC 822):
44.PP
45.TS
46lll.
47mbox-date = weekday month day time [ timezone ] year
48weekday = "Mon" / "Tue" / "Wed" / "Thu" / "Fri"
49 / "Sat" / "Sun"
50month = "Jan" / "Feb" / "Mar" / "Apr" / "May"
51 / "Jun" / "Jul" / "Aug" / "Sep"
52 / "Oct" / "Nov" / "Dec"
53day = 1*2DIGIT
54time = 1*2DIGIT ":" 1*2DIGIT [ ":" 1*2DIGIT ]
55timezone = ( "+" / "-" ) 4DIGIT
56year = ( 4DIGIT / 2DIGIT )
57.TE
58.PP
59For compatibility reasons with legacy software, two-digit years
60greater than or equal to 70 should be interpreted as the years
611970+, while two-digit years less than 70 should be interpreted as
62the years 2000-2069.
63.PP
64Software reading files in this format should also be prepared to
65accept non-numeric timezone information such as "CET DST" for
66Central European Time, dailight saving time.
67.PP
68Example:
69.IP "" 1
70From roessler@does-not-exist.org Fri Jun 23 02:56:55 2000
71.PP
72.\" should quote or must quote?
73In order to avoid mis-interpretation of lines in message bodies
74which begin with the four characters "From", followed by a space
75character, the mail delivery agent should quote any occurrence
76of "From " at the start of a body line.
77.sp
78There are two different quoting schemes, the first (mboxo) only
79quotes plain "From " lines in the body by prepending a '>' to the
80line; the second (mboxrd) also quotes allready quoted "From " lines
81by prepending a '>' (i.e. ">From ", ">>From ", ...). The later has
82the advantage that lines like
83.PP
84.RS
85>From the command line you can use the '-p' option
86.RE
87.PP
88arn't dequoted wrongly as a mboxrd-MDA would turn the line
89into
90.PP
91.RS
92>>From the command line you can use the '-p' option
93.RE
94.PP
95before storing it.
96.SH
97LOCKING
98.PP
99Since
100.B mbox
101files are frequently accessed by multiple programs in parallel,
102.B mbox
103files should generally not be accessed without locking.
104.PP
105Three different locking mechanisms (and combinations thereof) are in
106general use:
107.IP "\(bu"
108.BR fcntl (2)
109locking is mostly used on recent, POSIX-compliant systems. Use of
110this locking method is, in particular, advisable if
111.B mbox
112files are accessed through the Network File System (NFS), since it
113seems the only way to reliably invalidate NFS clients' caches.
114.IP "\(bu"
115.BR flock (2)
116locking is mostly used on BSD-based systems.
117.IP "\(bu"
118Dotlocking is used on all kinds of systems. In order to lock an
119.B mbox
120file named
121.IR folder ,
122an application first creates a temporary file with a unique
123name in the directory in which the
124.I folder
125resides. The application then tries to use the
126.BR link (2)
127system call to create a hard link named
128.IB folder .lock
129to the temporary file. The success of the
130.BR link (2)
131system call should be additionally verified using
132.BR stat (2)
133calls. If the link has succeeded, the mail folder is considered
134dotlocked. The temporary file can then safely be unlinked.
135.IP ""
136In order to release the lock, an application just unlinks the
137.IB folder .lock
138file.
139.PP
140If multiple methods are combined, implementors should make sure to
141use the non-blocking variants of the
142.BR fcntl (2)
143and
144.BR flock (2)
145sytem calls in order to avoid deadlocks.
146.PP
147If multiple methods are combined, an
148.B mbox
149file must not be considered to have been successfully locked before
150all individual locks were obtained. When one of the individual
151locking methods fails, an application should release all locks it
152acquired successfully, and restart the entire locking procedure from
153the beginning, after a suitable delay.
154.PP
155The locking mechanism used on a particular system is a matter of
156local policy, and should be consistently used by all applications
157installed on the system which access
158.B mbox
159files. Failure to do so may result in loss of e-mail data, and in
160corrupted
161.B mbox
162files.
163.SH
164FILES
165.IP "/var/spool/mail/\fIuser\fP"
166.IR user 's
167incoming mail folder.
168.IP "~\fIuser\fP/mbox"
169.IR user 's
170archived mail messages, in his home directory.
171.IP "~\fIuser\fP/Mail/"
172A directory in
173.IR user 's
174home directory which is commonly used to hold
175.B mbox
176format folders.
177.SH
178SEE 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
194D. Crocker, Standard for the format of ARPA Internet text messages,
195RFC 822
196.PP
197M. R. Horton, UUCP mail interchange format standard, RFC 976
198.SH
199AUTHOR
200.PP
201The present document was written by Thomas Roessler
202<roessler@does-not-exist.org>.
203.SH
204HISTORY
205.PP
206The
207.B mbox
208format occured in Version 6 AT&T Unix.
209.PP
210A variant of this format was documented in RFC 976.
This page took 0.056126 seconds and 4 git commands to generate.