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; \fBuucp\fR(1C) uses \fBrmail\fR
133 as a security precaution. Any application programs that generate mail messages
134 should be sure to invoke \fBrmail\fR rather than \fBmail\fR for message
135 transport and/or delivery.
138 If the local system has the Basic Networking Utilities installed, mail can be
139 sent to a recipient on a remote system. There are numerous ways to address mail
140 to recipients on remote systems depending on the transport mechanisms available
141 to the local system. The two most prevalent addressing schemes are Domain-style
146 \fBDomain-style addressing\fR
149 Remote recipients are specified by appending an `\fB@\fR' and domain (and
150 possibly sub-domain) information to the recipient name (such as
151 \fBuser@sf.att.com\fR). (The local system administrator should be consulted for
152 details on which addressing conventions are available on the local system.)
158 \fBUUCP-style addressing\fR
161 Remote recipients are specified by prefixing the recipient name with the remote
162 system name and an exclamation point, such as \fBsysa!user.\fR If \fBcsh\fR(1)
163 is the default shell, \fBsysa\e!user\fR should be used. A series of system
164 names separated by exclamation points can be used to direct a letter through an
165 extended network (such as \fBsysa!sysb!sysc!user\fR or
166 \fBsysa\e!sysb\e!sysc\e!user\fR).
172 The following command-line arguments affect reading mail:
179 Test for the presence of mail. \fBmail\fR prints nothing.
181 An exit status of \fB0\fR is returned if the user has mail. Otherwise, an exit
182 status of \fB1\fR is returned.
191 Similar to \fB-e\fR, but tests only for the presence of \fBnew\fR mail.
193 An exit status of \fB0\fR is returned if the user has new mail
194 to read, an exit status of \fB1\fR is returned if the user has no
195 mail, or an exit status of \fB2\fR is returned if the user has mail
196 which has already been read.
205 A window of headers are initially displayed rather than the latest message. The
206 display is followed by the \fB?\fR prompt.
215 All messages are printed without prompting for disposition.
224 All messages are printed with \fIall\fR header lines displayed, rather than the
225 default selective header line display.
234 \fBmail\fR terminates after interrupts. Normally an interrupt causes only the
235 termination of the message being printed.
244 Messages are printed in first-in, first-out order.
250 \fB\fB-f\fR \fIfile\fR\fR
253 \fBmail\fR uses \fIfile\fR (such as \fBmbox\fR) instead of the default
259 \fBmail\fR, unless otherwise influenced by command-line arguments, prints a
260 user's mail messages in last-in, first-out order. The default mode for printing
261 messages is to display only those header lines of immediate interest. These
262 include, but are not limited to, the UNIX \fBFrom\fR and \fB>From\fR postmarks,
263 \fBFrom:\fR, \fBDate:\fR, \fBSubject:\fR, and \fBContent-Length:\fR header
264 lines, and any recipient header lines such as \fBTo:\fR, \fBCc:\fR, \fBBcc:\fR,
265 and so forth. After the header lines have been displayed, \fBmail\fR displays
266 the contents (body) of the message only if it contains no unprintable
267 characters. Otherwise, \fBmail\fR issues a warning statement about the message
268 having binary content and \fBnot\fR display the content. This can be overridden
269 by means of the \fBp\fR command.
272 For each message, the user is prompted with a \fB?\fR and a line is read from
273 the standard input. The following commands are available to determine the
274 disposition of the message:
281 Print the number of the current message.
290 Print previous message.
296 \fB<new-line>,\fB+\fR, or \fBn\fR\fR
299 Print the next message.
305 \fB\fB!\fR\fIcommand\fR\fR
308 Escape to the shell to do \fIcommand\fR.
317 Print message that arrived during the \fBmail\fR session.
323 \fB\fBd\fR, or \fBdp\fR\fR
326 Delete the current message and print the next message.
332 \fB\fBd\fR \fIn\fR\fR
335 Delete message number \fIn\fR. Do not go on to next message.
344 Delete message and quit \fBmail\fR.
353 Display a window of headers around current message.
362 Display a window of headers around message number \fIn\fR.
371 Display headers of all messages in the user's \fImailfile\fR.
380 Display headers of messages scheduled for deletion.
386 \fB\fBm\fR [ \fIpersons\fR ]\fR
389 Mail (and delete) the current message to the named \fIpersons\fR.
398 Print message number \fIn\fR.
407 Print current message again, overriding any indications of binary (that is,
408 unprintable) content.
417 Override default brief mode and print current message again, displaying all
424 \fB\fBq\fR, or Control-d\fR
427 Put undeleted mail back in the \fImailfile\fR and quit \fBmail\fR.
433 \fB\fBr\fR [ \fIusers\fR ]\fR
436 Reply to the sender, and other \fIusers\fR, then delete the message.
442 \fB\fBs\fR [ \fIfiles\fR ]\fR
445 Save message in the named \fIfiles\fR (\fBmbox\fR is default) and delete the
452 \fB\fBu\fR [ \fIn\fR ]\fR
455 Undelete message number \fIn\fR (default is last read).
461 \fB\fBw\fR [ \fIfiles\fR ]\fR
464 Save message contents, without any header lines, in the named \fIfiles\fR
465 (\fBmbox\fR is default) and delete the message.
474 Put all mail back in the \fImailfile\fR unchanged and exit \fBmail\fR.
480 \fB\fBy\fR [ \fIfiles\fR ]\fR
483 Same as \fB-w\fR option.
492 Print a command summary.
497 When a user logs in, the presence of mail, if any, is usually indicated. Also,
498 notification is made if new mail arrives while using \fBmail\fR.
501 The permissions of \fImailfile\fR can be manipulated using \fBchmod\fR(1) in
502 two ways to alter the function of \fBmail\fR. The other permissions of the file
503 can be read-write (\fB0666\fR), read-only (\fB0664\fR), or neither read nor
504 write (\fB0660\fR) to allow different levels of privacy. If changed to other
505 than the default (mode \fB0660\fR), the file is preserved even when empty to
506 perpetuate the desired permissions. (The administrator can override this file
507 preservation using the \fBDEL_EMPTY_MAILFILE\fR option of \fBmailcnfg\fR.)
510 The group \fBID\fR of the mailfile must be \fBmail\fR to allow new messages to
511 be delivered, and the mailfile must be writable by group \fBmail\fR.
515 The following command-line arguments cause \fBmail\fR to provide debugging
520 \fB\fB-x\fR \fIdebug_level\fR\fR
523 \fBmail\fR creates a trace file containing debugging information.
528 The \fB-x\fR option causes \fBmail\fR to create a file named
529 \fB/tmp/MLDBG\fR\fIprocess_id\fR that contains debugging information relating
530 to how \fBmail\fR processed the current message. The absolute value of
531 \fIdebug_level\fR controls the verboseness of the debug information. \fB0\fR
532 implies no debugging. If \fIdebug_level\fR is greater than \fB0\fR, the debug
533 file is retained \fIonly\fR if \fBmail\fR encountered some problem while
534 processing the message. If \fIdebug_level\fR is less than \fB0\fR, the debug
535 file is always be retained. The \fIdebug_level\fR specified via \fB-x\fR
536 overrides any specification of \fBDEBUG\fR in \fB/etc/mail/mailcnfg\fR. The
537 information provided by the \fB-x\fR option is esoteric and is probably only
538 useful to system administrators.
539 .SS "Delivery Notification"
542 Several forms of notification are available for mail by including one of the
543 following lines in the message header.
546 \fBTransport-Options:\fR [ \fB/\fR\fIoptions\fR ]
549 \fBDefault-Options:\fR [ \fB/\fR\fIoptions\fR ]
552 \fB>To:\fR \fIrecipient\fR [ \fB/\fR\fIoptions\fR ]
555 Where the "/\fIoptions\fR" can be one or more of the following:
559 \fB\fB/delivery\fR\fR
562 Inform the sender that the message was successfully delivered to the
563 \fIrecipient\fR's mailbox.
569 \fB\fB/nodelivery\fR\fR
572 Do not inform the sender of successful deliveries.
581 Do not inform the sender of failed deliveries.
590 Inform the sender if mail delivery fails. Return the failed message to the
600 Same as \fB/return\fR except that the original message is not returned.
605 The default is \fB/nodelivery/return\fR. If contradictory options are used, the
606 first is recognized and later, conflicting, terms are ignored.
610 The following operand is supported for sending mail:
614 \fB\fIrecipient\fR\fR
617 A domain style address ("\fIuser\fR@\fImachine\fR") or user login name
618 recognized by \fBlogin\fR(1).
624 See \fBlargefile\fR(5) for the description of the behavior of \fBmail\fR and
625 \fBrmail\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
627 .SH ENVIRONMENT VARIABLES
630 See \fBenviron\fR(5) for descriptions of the following environment variables
631 that affect the execution of \fBmail\fR: \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and
639 Determine the timezone used with date and time strings.
645 The following exit values are returned:
652 Successful completion when the user had mail.
661 The user had no mail or an initialization error occurred.
670 An error occurred after initialization.
677 \fB\fBdead.letter\fR\fR
686 \fB\fB/etc/passwd\fR\fR
689 to identify sender and locate \fIrecipient\fRs
695 \fB\fB$HOME/mbox\fR\fR
707 variable containing path name of \fImailfile\fR
713 \fB\fB/tmp/MLDBG\fR*\fR
722 \fB\fB/var/mail/*.lock\fR\fR
725 lock for mail directory
731 \fB\fB/var/mail/:saved\fR\fR
734 directory for holding temp files to prevent loss of data in the event of a
741 \fB\fB/var/mail/\fIuser\fR\fR\fR
744 incoming mail for \fIuser\fR; that is, the \fImailfile\fR
750 \fB\fBvar/tmp/ma\fR*\fR
759 \fBchmod\fR(1), \fBcsh\fR(1), \fBlogin\fR(1), \fBmailx\fR(1), \fBuucp\fR(1C),
760 \fBuuencode\fR(1C), \fBvacation\fR(1), \fBwrite\fR(1), \fBattributes\fR(5),
761 \fBenviron\fR(5), \fBlargefile\fR(5)
764 \fISolaris Advanced User\&'s Guide\fR
768 The interpretation and resulting action taken because of the header lines
769 described in the Delivery Notifications section only occur if this version of
770 \fBmail\fR is installed on the system where the delivery (or failure) happens.
771 Earlier versions of \fBmail\fR might not support any types of delivery
775 Conditions sometimes result in a failure to remove a lock file.
778 After an interrupt, the next message might not be printed. Printing can be
779 forced by typing a \fBp\fR.