1mail(1)                          User Commands                         mail(1)
2
3
4

NAME

6       mail, rmail - read mail or send mail to users
7

SYNOPSIS

9   Sending Mail
10       mail [-tw] [-m message_type] recipient...
11
12
13       rmail [-tw] [-m message_type] recipient...
14
15
16   Reading Mail
17       mail [-ehpPqr] [-f file]
18
19
20   Debugging
21       mail [-x debug_level] [other_mail_options] recipient...
22
23

DESCRIPTION

25       A  recipient  is  usually  a domain style address ("user@machine") or a
26       user name recognized by  login(1).  When  recipients  are  named,  mail
27       assumes a message is being sent. It reads from the standard input up to
28       an end-of-file (Control-d) or, if reading from a terminal device, until
29       it reads a line consisting of just a period. When either of those indi‐
30       cators is received, mail adds the  letter  to  the  mailfile  for  each
31       recipient.
32
33
34       A letter is composed of some header lines followed by a blank line fol‐
35       lowed by the message content. The header lines section  of  the  letter
36       consists of one or more UNIX postmarks:
37
38         From sender date_and_time [remote from remote_system_name]
39
40
41
42
43       followed by one or more standardized message header lines of the form:
44
45         keyword-name: [printable text]
46
47
48
49
50       where  keyword-name is comprised of any printable, non-whitespace char‐
51       acters other than colon (`:'). A MIME-version:  header  line  indicates
52       that  the  message  is  formatted  as described in RFC 2045. A Content-
53       Length: header line, indicating the number of bytes in the message con‐
54       tent, is always present unless the letter consists of only header lines
55       with no message content. A Content-Type: header line that describes the
56       type  of  the  message  content (such as text/plain, application/octet-
57       stream, and so on) is also present, unless the letter consists of  only
58       header  lines with no message content. Header lines may be continued on
59       the following line if that line starts with white space.
60

OPTIONS

62   Sending Mail
63       The following command-line arguments affect sending mail:
64
65       -m message_type    A Message-Type: line is added to the message  header
66                          with the value of message_type.
67
68
69       -t                 A  To:  line is added to the message header for each
70                          of the intended recipients.
71
72
73       -w                 A letter is sent to a remote recipient without wait‐
74                          ing  for  the completion of the remote transfer pro‐
75                          gram.
76
77
78
79       If a letter is found to be undeliverable, it is returned to the  sender
80       with  diagnostics that indicate the location and nature of the failure.
81       If mail is interrupted during input, the message is saved in  the  file
82       dead.letter  to  allow  editing  and  resending.  dead.letter is always
83       appended to, thus preserving any previous contents. The initial attempt
84       to  append  to  (or create) dead.letter is in the current directory. If
85       this fails, dead.letter is appended to (or created in) the user's login
86       directory.  If the second attempt also fails, no dead.letter processing
87       is done.
88
89
90       rmail only permits the sending of mail; uucp(1C) uses rmail as a  secu‐
91       rity  precaution.  Any application programs that generate mail messages
92       should be sure to invoke rmail rather than mail for  message  transport
93       and/or delivery.
94
95
96       If  the local system has the Basic Networking Utilities installed, mail
97       can be sent to a recipient on a remote system. There are numerous  ways
98       to address mail to recipients on remote systems depending on the trans‐
99       port mechanisms available to the local system. The two  most  prevalent
100       addressing schemes are Domain-style and UUCP-style.
101
102       Domain-style addressing    Remote recipients are specified by appending
103                                  an `@' and domain (and possibly  sub-domain)
104                                  information  to  the recipient name (such as
105                                  user@sf.att.com). (The local system adminis‐
106                                  trator  should  be  consulted for details on
107                                  which addressing conventions  are  available
108                                  on the local system.)
109
110
111       UUCP-style addressing      Remote recipients are specified by prefixing
112                                  the recipient name with  the  remote  system
113                                  name  and  an  exclamation  point,  such  as
114                                  sysa!user. If csh(1) is the  default  shell,
115                                  sysa\!user  should be used. A series of sys‐
116                                  tem names separated  by  exclamation  points
117                                  can  be  used  to direct a letter through an
118                                  extended       network       (such        as
119                                  sysa!sysb!sysc!user                       or
120                                  sysa\!sysb\!sysc\!user).
121
122
123   Reading Mail
124       The following command-line arguments affect reading mail:
125
126       -e         Test for the presence of mail. mail prints nothing.
127
128                  An exit status of 0 is returned if the user has mail. Other‐
129                  wise, an exit status of 1 is returned.
130
131
132       -E         Similar to -e, but tests only for the presence of new mail.
133
134                  An   exit   status   of  0  is  returned if the user has new
135                  mail  to read,  an exit status  of  1  is  returned  if  the
136                  user   has  no  mail,   or  an  exit status of 2 is returned
137                  if the user has mail which has already been read.
138
139
140       -h         A window of headers are initially displayed rather than  the
141                  latest message. The display is followed by the ? prompt.
142
143
144       -p         All messages are printed without prompting for disposition.
145
146
147       -P         All  messages  are  printed with all header lines displayed,
148                  rather than the default selective header line display.
149
150
151       -q         mail terminates  after  interrupts.  Normally  an  interrupt
152                  causes only the termination of the message being printed.
153
154
155       -r         Messages are printed in first-in, first-out order.
156
157
158       -f file    mail  uses  file (such as mbox) instead of the default mail‐
159                  file.
160
161
162
163       mail, unless otherwise influenced by command-line arguments,  prints  a
164       user's  mail messages in last-in, first-out order. The default mode for
165       printing messages is to display only those header  lines  of  immediate
166       interest.  These  include,  but  are  not limited to, the UNIX From and
167       >From postmarks, From:, Date:,  Subject:,  and  Content-Length:  header
168       lines,  and  any  recipient header lines such as To:, Cc:, Bcc:, and so
169       forth. After the header lines have been displayed,  mail  displays  the
170       contents (body) of the message only if it contains no unprintable char‐
171       acters. Otherwise, mail issues a warning statement  about  the  message
172       having binary content and not display the content. This can be overrid‐
173       den by means of the p command.
174
175
176       For each message, the user is prompted with a ? and a line is read from
177       the  standard  input. The following commands are available to determine
178       the disposition of the message:
179
180       #                     Print the number of the current message.
181
182
183       Print previous message.
184
185
186       <new-line>,+, or n    Print the next message.
187
188
189       !command              Escape to the shell to do command.
190
191
192       a                     Print message that arrived during the  mail  ses‐
193                             sion.
194
195
196       d, or dp              Delete  the  current  message  and print the next
197                             message.
198
199
200       d n                   Delete message number n. Do not  go  on  to  next
201                             message.
202
203
204       dq                    Delete message and quit mail.
205
206
207       h                     Display  a  window of headers around current mes‐
208                             sage.
209
210
211       hn                    Display a window of headers around message number
212                             n.
213
214
215       h a                   Display  headers  of  all  messages in the user's
216                             mailfile.
217
218
219       h d                   Display headers of messages scheduled  for  dele‐
220                             tion.
221
222
223       m [ persons ]         Mail  (and  delete)  the  current  message to the
224                             named persons.
225
226
227       n                     Print message number n.
228
229
230       p                     Print current message again, overriding any indi‐
231                             cations of binary (that is, unprintable) content.
232
233
234       P                     Override  default  brief  mode  and print current
235                             message again, displaying all header lines.
236
237
238       q, or Control-d       Put undeleted mail back in the mailfile and  quit
239                             mail.
240
241
242       r [ users ]           Reply to the sender, and other users, then delete
243                             the message.
244
245
246       s [ files ]           Save message in the named files (mbox is default)
247                             and delete the message.
248
249
250       u [ n ]               Undelete message number n (default is last read).
251
252
253       w [ files ]           Save  message contents, without any header lines,
254                             in the named files (mbox is default)  and  delete
255                             the message.
256
257
258       x                     Put  all  mail back in the mailfile unchanged and
259                             exit mail.
260
261
262       y [ files ]           Same as -w option.
263
264
265       ?                     Print a command summary.
266
267
268
269       When a user logs in, the presence of mail, if  any,  is  usually  indi‐
270       cated. Also, notification is made if new mail arrives while using mail.
271
272
273       The  permissions  of  mailfile can be manipulated using chmod(1) in two
274       ways to alter the function of mail. The other permissions of  the  file
275       can  be  read-write (0666), read-only (0664), or neither read nor write
276       (0660) to allow different levels of privacy. If changed to  other  than
277       the  default (mode 0660), the file is preserved even when empty to per‐
278       petuate the desired permissions. (The administrator can  override  this
279       file preservation using the DEL_EMPTY_MAILFILE option of mailcnfg.)
280
281
282       The  group  ID of the mailfile must be mail to allow new messages to be
283       delivered, and the mailfile must be writable by group mail.
284
285   Debugging
286       The following command-line arguments cause mail  to  provide  debugging
287       information:
288
289       -x debug_level    mail creates a trace file containing debugging infor‐
290                         mation.
291
292
293
294       The -x option causes mail to create a file  named  /tmp/MLDBGprocess_id
295       that  contains debugging information relating to how mail processed the
296       current message. The absolute value of debug_level  controls  the  ver‐
297       boseness   of  the  debug  information.  0  implies  no  debugging.  If
298       debug_level is greater than 0, the debug file is retained only if  mail
299       encountered  some  problem while processing the message. If debug_level
300       is less than 0, the debug file is always be retained.  The  debug_level
301       specified   via   -x   overrides   any   specification   of   DEBUG  in
302       /etc/mail/mailcnfg. The information provided by the -x option  is  eso‐
303       teric and is probably only useful to system administrators.
304
305   Delivery Notification
306       Several  forms  of notification are available for mail by including one
307       of the following lines in the message header.
308
309
310       Transport-Options: [ /options ]
311
312
313       Default-Options: [ /options ]
314
315
316       >To: recipient [ /options ]
317
318
319       Where the "/options" can be one or more of the following:
320
321       /delivery      Inform the sender  that  the  message  was  successfully
322                      delivered to the recipient's mailbox.
323
324
325       /nodelivery    Do not inform the sender of successful deliveries.
326
327
328       /ignore        Do not inform the sender of failed deliveries.
329
330
331       /return        Inform  the  sender  if  mail delivery fails. Return the
332                      failed message to the sender.
333
334
335       /report        Same as /return except that the original message is  not
336                      returned.
337
338
339
340       The  default  is /nodelivery/return. If contradictory options are used,
341       the first is recognized and later, conflicting, terms are ignored.
342

OPERANDS

344       The following operand is supported for sending mail:
345
346       recipient    A domain style address ("user@machine") or user login name
347                    recognized by login(1).
348
349

USAGE

351       See  largefile(5) for the description of the behavior of mail and rmail
352       when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
353

ENVIRONMENT VARIABLES

355       See environ(5) for descriptions of the following environment  variables
356       that affect the execution of mail: LC_CTYPE, LC_MESSAGES, and NLSPATH.
357
358       TZ    Determine the timezone used with date and time strings.
359
360

EXIT STATUS

362       The following exit values are returned:
363
364       0     Successful completion when the user had mail.
365
366
367       1     The user had no mail or an initialization error occurred.
368
369
370       >1    An error occurred after initialization.
371
372

FILES

374       dead.letter         unmailable text
375
376
377       /etc/passwd         to identify sender and locate recipients
378
379
380       $HOME/mbox          saved mail
381
382
383       $MAIL               variable containing path name of mailfile
384
385
386       /tmp/MLDBG*         debug trace file
387
388
389       /var/mail/*.lock    lock for mail directory
390
391
392       /var/mail/:saved    directory for holding temp files to prevent loss of
393                           data in the event of a system crash
394
395
396       /var/mail/user      incoming mail for user; that is, the mailfile
397
398
399       var/tmp/ma*         temporary file
400
401

ATTRIBUTES

403       See attributes(5) for descriptions of the following attributes:
404
405
406
407
408       ┌─────────────────────────────┬─────────────────────────────┐
409       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
410       ├─────────────────────────────┼─────────────────────────────┤
411       │Availability                 │SUNWcsu                      │
412       └─────────────────────────────┴─────────────────────────────┘
413

SEE ALSO

415       chmod(1), csh(1), login(1),  mailx(1),  uucp(1C),  uuencode(1C),  vaca‐
416       tion(1), write(1), attributes(5), environ(5), largefile(5)
417
418
419       Solaris Advanced User's Guide
420

NOTES

422       The  interpretation  and  resulting  action taken because of the header
423       lines described in the Delivery Notifications  section  only  occur  if
424       this  version of mail is installed on the system where the delivery (or
425       failure) happens. Earlier versions of mail might not support any  types
426       of delivery notification.
427
428
429       Conditions sometimes result in a failure to remove a lock file.
430
431
432       After an interrupt, the next message might not be printed. Printing can
433       be forced by typing a p.
434
435
436
437SunOS 5.11                        24 Jul 2008                          mail(1)
Impressum