2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\" This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH MAIL 1 "Jul 24, 2008"
14 mail, rmail \- read mail or send mail to users
19 \fBmail\fR [\fB-tw\fR] [\fB-m\fR \fImessage_type\fR] \fIrecipient\fR...
24 \fBrmail\fR [\fB-tw\fR] [\fB-m\fR \fImessage_type\fR] \fIrecipient\fR...
30 \fBmail\fR [\fB-ehpPqr\fR] [\fB-f\fR \fIfile\fR]
36 \fBmail\fR [\fB-x\fR \fIdebug_level\fR] [\fIother_mail_options\fR] \fIrecipient\fR...
42 A \fIrecipient\fR is usually a domain style address
43 ("\fIuser\fR@\fImachine\fR") or a user name recognized by \fBlogin\fR(1). When
44 \fIrecipient\fRs are named, \fBmail\fR assumes a message is being sent. It
45 reads from the standard input up to an end-of-file (Control-d) or, if reading
46 from a terminal device, until it reads a line consisting of just a period. When
47 either of those indicators is received, \fBmail\fR adds the \fIletter\fR to the
48 \fImailfile\fR for each \fIrecipient\fR.
51 A \fIletter\fR is composed of some \fIheader lines\fR followed by a blank line
52 followed by the \fImessage content\fR. The \fIheader lines\fR section of the
53 letter consists of one or more UNIX postmarks:
57 \fBFrom\fR \fIsender date_and_time\fR [\fBremote from\fR \fIremote_system_name\fR]
64 followed by one or more standardized message header lines of the form:
68 \fIkeyword-name\fR\fB:\fR [\fIprintable text\fR]
75 where \fIkeyword-name\fR is comprised of any printable, non-whitespace
76 characters other than colon (`\fB:\fR'). A \fBMIME-version:\fR header line
77 indicates that the message is formatted as described in RFC 2045. A
78 \fBContent-Length:\fR header line, indicating the number of bytes in the
79 \fImessage content\fR, is always present unless the letter consists of only
80 header lines with no message content. A \fBContent-Type:\fR header line that
81 describes the type of the \fImessage content\fR (such as text/plain,
82 application/octet-stream, and so on) is also present, unless the letter
83 consists of only header lines with no message content. Header lines may be
84 continued on the following line if that line starts with white space.
89 The following command-line arguments affect sending mail:
93 \fB\fB-m\fR \fImessage_type\fR\fR
96 A \fBMessage-Type:\fR line is added to the message header with the value of
106 A \fBTo:\fR line is added to the message header for each of the intended
116 A letter is sent to a remote recipient without waiting for the completion of
117 the remote transfer program.
122 If a letter is found to be undeliverable, it is returned to the sender with
123 diagnostics that indicate the location and nature of the failure. If \fBmail\fR
124 is interrupted during input, the message is saved in the file \fBdead.letter\fR
125 to allow editing and resending. \fBdead.letter\fR is always appended to, thus
126 preserving any previous contents. The initial attempt to append to (or create)
127 \fBdead.letter\fR is in the current directory. If this fails, \fBdead.letter\fR
128 is appended to (or created in) the user's login directory. If the second
129 attempt also fails, no \fBdead.letter\fR processing is done.
132 \fBrmail\fR only permits the sending of mail; Any application programs that
133 generate mail messages should be sure to invoke \fBrmail\fR rather than
134 \fBmail\fR for message transport and/or delivery.
137 If the local system has the Basic Networking Utilities installed, mail can be
138 sent to a recipient on a remote system. There are numerous ways to address mail
139 to recipients on remote systems depending on the transport mechanisms available
140 to the local system. The two most prevalent addressing schemes are Domain-style
145 \fBDomain-style addressing\fR
148 Remote recipients are specified by appending an `\fB@\fR' and domain (and
149 possibly sub-domain) information to the recipient name (such as
150 \fBuser@sf.att.com\fR). (The local system administrator should be consulted for
151 details on which addressing conventions are available on the local system.)
157 \fBUUCP-style addressing\fR
160 Remote recipients are specified by prefixing the recipient name with the remote
161 system name and an exclamation point, such as \fBsysa!user.\fR If \fBcsh\fR(1)
162 is the default shell, \fBsysa\e!user\fR should be used. A series of system
163 names separated by exclamation points can be used to direct a letter through an
164 extended network (such as \fBsysa!sysb!sysc!user\fR or
165 \fBsysa\e!sysb\e!sysc\e!user\fR).
171 The following command-line arguments affect reading mail:
178 Test for the presence of mail. \fBmail\fR prints nothing.
180 An exit status of \fB0\fR is returned if the user has mail. Otherwise, an exit
181 status of \fB1\fR is returned.
190 Similar to \fB-e\fR, but tests only for the presence of \fBnew\fR mail.
192 An exit status of \fB0\fR is returned if the user has new mail
193 to read, an exit status of \fB1\fR is returned if the user has no
194 mail, or an exit status of \fB2\fR is returned if the user has mail
195 which has already been read.
204 A window of headers are initially displayed rather than the latest message. The
205 display is followed by the \fB?\fR prompt.
214 All messages are printed without prompting for disposition.
223 All messages are printed with \fIall\fR header lines displayed, rather than the
224 default selective header line display.
233 \fBmail\fR terminates after interrupts. Normally an interrupt causes only the
234 termination of the message being printed.
243 Messages are printed in first-in, first-out order.
249 \fB\fB-f\fR \fIfile\fR\fR
252 \fBmail\fR uses \fIfile\fR (such as \fBmbox\fR) instead of the default
258 \fBmail\fR, unless otherwise influenced by command-line arguments, prints a
259 user's mail messages in last-in, first-out order. The default mode for printing
260 messages is to display only those header lines of immediate interest. These
261 include, but are not limited to, the UNIX \fBFrom\fR and \fB>From\fR postmarks,
262 \fBFrom:\fR, \fBDate:\fR, \fBSubject:\fR, and \fBContent-Length:\fR header
263 lines, and any recipient header lines such as \fBTo:\fR, \fBCc:\fR, \fBBcc:\fR,
264 and so forth. After the header lines have been displayed, \fBmail\fR displays
265 the contents (body) of the message only if it contains no unprintable
266 characters. Otherwise, \fBmail\fR issues a warning statement about the message
267 having binary content and \fBnot\fR display the content. This can be overridden
268 by means of the \fBp\fR command.
271 For each message, the user is prompted with a \fB?\fR and a line is read from
272 the standard input. The following commands are available to determine the
273 disposition of the message:
280 Print the number of the current message.
289 Print previous message.
295 \fB<new-line>,\fB+\fR, or \fBn\fR\fR
298 Print the next message.
304 \fB\fB!\fR\fIcommand\fR\fR
307 Escape to the shell to do \fIcommand\fR.
316 Print message that arrived during the \fBmail\fR session.
322 \fB\fBd\fR, or \fBdp\fR\fR
325 Delete the current message and print the next message.
331 \fB\fBd\fR \fIn\fR\fR
334 Delete message number \fIn\fR. Do not go on to next message.
343 Delete message and quit \fBmail\fR.
352 Display a window of headers around current message.
361 Display a window of headers around message number \fIn\fR.
370 Display headers of all messages in the user's \fImailfile\fR.
379 Display headers of messages scheduled for deletion.
385 \fB\fBm\fR [ \fIpersons\fR ]\fR
388 Mail (and delete) the current message to the named \fIpersons\fR.
397 Print message number \fIn\fR.
406 Print current message again, overriding any indications of binary (that is,
407 unprintable) content.
416 Override default brief mode and print current message again, displaying all
423 \fB\fBq\fR, or Control-d\fR
426 Put undeleted mail back in the \fImailfile\fR and quit \fBmail\fR.
432 \fB\fBr\fR [ \fIusers\fR ]\fR
435 Reply to the sender, and other \fIusers\fR, then delete the message.
441 \fB\fBs\fR [ \fIfiles\fR ]\fR
444 Save message in the named \fIfiles\fR (\fBmbox\fR is default) and delete the
451 \fB\fBu\fR [ \fIn\fR ]\fR
454 Undelete message number \fIn\fR (default is last read).
460 \fB\fBw\fR [ \fIfiles\fR ]\fR
463 Save message contents, without any header lines, in the named \fIfiles\fR
464 (\fBmbox\fR is default) and delete the message.
473 Put all mail back in the \fImailfile\fR unchanged and exit \fBmail\fR.
479 \fB\fBy\fR [ \fIfiles\fR ]\fR
482 Same as \fB-w\fR option.
491 Print a command summary.
496 When a user logs in, the presence of mail, if any, is usually indicated. Also,
497 notification is made if new mail arrives while using \fBmail\fR.
500 The permissions of \fImailfile\fR can be manipulated using \fBchmod\fR(1) in
501 two ways to alter the function of \fBmail\fR. The other permissions of the file
502 can be read-write (\fB0666\fR), read-only (\fB0664\fR), or neither read nor
503 write (\fB0660\fR) to allow different levels of privacy. If changed to other
504 than the default (mode \fB0660\fR), the file is preserved even when empty to
505 perpetuate the desired permissions. (The administrator can override this file
506 preservation using the \fBDEL_EMPTY_MAILFILE\fR option of \fBmailcnfg\fR.)
509 The group \fBID\fR of the mailfile must be \fBmail\fR to allow new messages to
510 be delivered, and the mailfile must be writable by group \fBmail\fR.
514 The following command-line arguments cause \fBmail\fR to provide debugging
519 \fB\fB-x\fR \fIdebug_level\fR\fR
522 \fBmail\fR creates a trace file containing debugging information.
527 The \fB-x\fR option causes \fBmail\fR to create a file named
528 \fB/tmp/MLDBG\fR\fIprocess_id\fR that contains debugging information relating
529 to how \fBmail\fR processed the current message. The absolute value of
530 \fIdebug_level\fR controls the verboseness of the debug information. \fB0\fR
531 implies no debugging. If \fIdebug_level\fR is greater than \fB0\fR, the debug
532 file is retained \fIonly\fR if \fBmail\fR encountered some problem while
533 processing the message. If \fIdebug_level\fR is less than \fB0\fR, the debug
534 file is always be retained. The \fIdebug_level\fR specified via \fB-x\fR
535 overrides any specification of \fBDEBUG\fR in \fB/etc/mail/mailcnfg\fR. The
536 information provided by the \fB-x\fR option is esoteric and is probably only
537 useful to system administrators.
538 .SS "Delivery Notification"
541 Several forms of notification are available for mail by including one of the
542 following lines in the message header.
545 \fBTransport-Options:\fR [ \fB/\fR\fIoptions\fR ]
548 \fBDefault-Options:\fR [ \fB/\fR\fIoptions\fR ]
551 \fB>To:\fR \fIrecipient\fR [ \fB/\fR\fIoptions\fR ]
554 Where the "/\fIoptions\fR" can be one or more of the following:
558 \fB\fB/delivery\fR\fR
561 Inform the sender that the message was successfully delivered to the
562 \fIrecipient\fR's mailbox.
568 \fB\fB/nodelivery\fR\fR
571 Do not inform the sender of successful deliveries.
580 Do not inform the sender of failed deliveries.
589 Inform the sender if mail delivery fails. Return the failed message to the
599 Same as \fB/return\fR except that the original message is not returned.
604 The default is \fB/nodelivery/return\fR. If contradictory options are used, the
605 first is recognized and later, conflicting, terms are ignored.
609 The following operand is supported for sending mail:
613 \fB\fIrecipient\fR\fR
616 A domain style address ("\fIuser\fR@\fImachine\fR") or user login name
617 recognized by \fBlogin\fR(1).
623 See \fBlargefile\fR(5) for the description of the behavior of \fBmail\fR and
624 \fBrmail\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
626 .SH ENVIRONMENT VARIABLES
629 See \fBenviron\fR(5) for descriptions of the following environment variables
630 that affect the execution of \fBmail\fR: \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and
638 Determine the timezone used with date and time strings.
644 The following exit values are returned:
651 Successful completion when the user had mail.
660 The user had no mail or an initialization error occurred.
669 An error occurred after initialization.
676 \fB\fBdead.letter\fR\fR
685 \fB\fB/etc/passwd\fR\fR
688 to identify sender and locate \fIrecipient\fRs
694 \fB\fB$HOME/mbox\fR\fR
706 variable containing path name of \fImailfile\fR
712 \fB\fB/tmp/MLDBG\fR*\fR
721 \fB\fB/var/mail/*.lock\fR\fR
724 lock for mail directory
730 \fB\fB/var/mail/:saved\fR\fR
733 directory for holding temp files to prevent loss of data in the event of a
740 \fB\fB/var/mail/\fIuser\fR\fR\fR
743 incoming mail for \fIuser\fR; that is, the \fImailfile\fR
749 \fB\fBvar/tmp/ma\fR*\fR
758 \fBchmod\fR(1), \fBcsh\fR(1), \fBlogin\fR(1), \fBmailx\fR(1),
759 \fBuuencode\fR(1), \fBvacation\fR(1), \fBwrite\fR(1), \fBattributes\fR(5),
760 \fBenviron\fR(5), \fBlargefile\fR(5)
763 \fISolaris Advanced User\&'s Guide\fR
767 The interpretation and resulting action taken because of the header lines
768 described in the Delivery Notifications section only occur if this version of
769 \fBmail\fR is installed on the system where the delivery (or failure) happens.
770 Earlier versions of \fBmail\fR might not support any types of delivery
774 Conditions sometimes result in a failure to remove a lock file.
777 After an interrupt, the next message might not be printed. Printing can be
778 forced by typing a \fBp\fR.