📄 mbox.man
字号:
'\" t.\" -*-nroff-*-.\".\" Copyright (C) 2000 Thomas Roessler <roessler@does-not-exist.org>.\".\" This document is in the public domain and may be distributed and.\" changed arbitrarily..\".TH mbox 5 "February 19th, 2002" Unix "User Manuals".\".SH NAMEmbox \- Format for mail message storage..\".SH DESCRIPTIONThis document describes the format traditionally used by Unix hoststo store mail messages locally..B mboxfiles typically reside in the system's mail spool, under variousnames in users' Mail directories, and under the name.B mboxin users' home directories..PPAn.B mboxis a text file containing an arbitrary number of e-mail messages.Each message consists of a postmark, followed by an e-mail messageformatted according to \fBRFC822\fP, \fBRFC2822\fP. The file formatis line-oriented. Lines are separated by line feed characters (ASCII 10)..PPA postmark line consists of the four characters "From", followed bya space character, followed by the message's envelope senderaddress, followed by whitespace, and followed by a time stamp. Thisline is often called From_ line..PPThe sender address is expected to be.B addr-specas defined in \fBRFC2822\fP 3.4.1. The date is expected to be.B date-timeas defined in \fBRFC2822\fP 3.3.For compatibility reasons with legacy software, two-digit yearsgreater than or equal to 70 should be interpreted as the years1970+, while two-digit years less than 70 should be interpreted asthe years 2000-2069. Software reading files in this format shouldalso be prepared to accept non-numeric timezone information such as"CET DST" for Central European Time, daylight saving time..PPExample:.IP "" 1>From example@example.com Fri Jun 23 02:56:55 2000.PPIn order to avoid misinterpretation of lines in message bodieswhich begin with the four characters "From", followed by a spacecharacter, the mail delivery agent must quote any occurrenceof "From " at the start of a body line..spThere are two different quoting schemes, the first (\fBMBOXO\fP) onlyquotes plain "From " lines in the body by prepending a '>' to theline; the second (\fBMBOXRD\fP) also quotes already quoted "From "lines by prepending a '>' (i.e. ">From ", ">>From ", ...). The laterhas the advantage that lines like.IP "" 1>From the command line you can use the '-p' option.PParen't dequoted wrongly as a \fBMBOXRD\fP-MDA would turn the lineinto.IP "" 1>>From the command line you can use the '-p' option.PPbefore storing it. Besides \fBMBOXO\fP and \fBMBOXRD\fP there is also\fBMBOXCL\fP which is \fBMBOXO\fP with a "Content-Length:"-field with thenumber of bytes in the message body; some MUAs (like.BR mutt (1))do automatically transform \fBMBOXO\fP mailboxes into \fBMBOXCL\fP ones whenever they write them back as \fBMBOXCL\fP can be read by any \fBMBOXO\fP-MUAwithout any problems..PPIf the modification-time (usually determined via.BR stat (2))of a nonempty.B mboxfile is greater than the access-time the file has new mail. Many MUAsplace a Status: header in each message to indicate which messages havealready been read..\".SH LOCKINGSince.B mboxfiles are frequently accessed by multiple programs in parallel,.B mboxfiles should generally not be accessed without locking..PPThree different locking mechanisms (and combinations thereof) are ingeneral use:.IP "\(bu".BR fcntl (2)locking is mostly used on recent, POSIX-compliant systems. Use ofthis locking method is, in particular, advisable if.B mboxfiles are accessed through the Network File System (NFS), since itseems the only way to reliably invalidate NFS clients' caches..IP "\(bu".BR flock (2)locking is mostly used on BSD-based systems..IP "\(bu"Dotlocking is used on all kinds of systems. In order to lock an.B mboxfile named \fIfolder\fR, an application first creates a temporary filewith a unique name in the directory in which the\fIfolder\fR resides. The application then tries to use the.BR link (2)system call to create a hard link named \fIfolder.lock\fRto the temporary file. The success of the.BR link (2)system call should be additionally verified using.BR stat (2)calls. If the link has succeeded, the mail folder is considereddotlocked. The temporary file can then safely be unlinked..IP ""In order to release the lock, an application just unlinks the\fIfolder.lock\fR file..PPIf multiple methods are combined, implementors should make sure touse the non-blocking variants of the.BR fcntl (2)and.BR flock (2)system calls in order to avoid deadlocks..PPIf multiple methods are combined, an.B mboxfile must not be considered to have been successfully locked beforeall individual locks were obtained. When one of the individuallocking methods fails, an application should release all locks itacquired successfully, and restart the entire locking procedure fromthe beginning, after a suitable delay..PPThe locking mechanism used on a particular system is a matter oflocal policy, and should be consistently used by all applicationsinstalled on the system which access.B mboxfiles. Failure to do so may result in loss of e-mail data, and incorrupted.B mboxfiles..\".SH FILES.IR /var/spool/mail/$LOGNAME.RS\fB$LOGNAME\fP's incoming mail folder..RE.PP.IR $HOME/mbox.RSuser's archived mail messages, in his \fB$HOME\fP directory..RE.PP.IR $HOME/Mail/.RSA directory in user's \fB$HOME\fP directory which is commonly used to hold.B mboxformat folders..RE.PP.\".SH "SEE ALSO".BR mutt (1),.BR fcntl (2),.BR flock (2),.BR link (2),.BR stat (2),.BR maildir (5),.BR mmdf (5),.BR RFC822 ,.BR RFC976 ,.BR RFC2822.\".SH AUTHORThomas Roessler <roessler@does-not-exist.org>, Urs Janssen <urs@tin.org>.\".SH HISTORYThe.B mboxformat occurred in Version 6 AT&T Unix..brA variant of this format was documented in \fBRFC976\fP.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -