|
|
1.1 root 1: '\"macro stdmacro
2: .if n .pH g1.mail %W% of %G%
3: .nr X
4: .if \nX=0 .ds x} mail 1 "Essential Utilities" "\&"
5: .if \nX=1 .ds x} mail 1 "Essential Utilities"
6: .if \nX=2 .ds x} mail 1 "" "\&"
7: .if \nX=3 .ds x} mail "" "" "\&"
8: .TH \*(x}
9: .SH NAME
10: \f4mail\f1, \f4rmail\f1 \- read mail or send mail to users
11: .SH SYNOPSIS
12: .SS Sending mail:
13: .PP
14: \f4mail\f1
15: [
16: \f4\-tw\f1
17: ] [
18: \f4\-m\f1
19: .I message_type
20: ]
21: \f2recipient . . .\f1
22: .PP
23: \f4rmail\f1
24: [
25: \f4\-tw\f1
26: ] [
27: \f4\-m\f1
28: .I message_type
29: ]
30: \f2recipient . . .\f1
31: .PP
32: .SS Reading mail:
33: .PP
34: \f4mail\f1
35: [
36: \f4\-ehpPqr\f1
37: ] [
38: \f4\-f\f1
39: \f2file\f1
40: ]
41: .PP
42: .SS Forwarding mail:
43: .PP
44: \f4mail \-F\fP \f2recipient . . .\f1
45: .PP
46: .SS Debugging:
47: .PP
48: \f4mail\fP [ \f4\-x\fP\f2debug_level\fP ] [ \f2other_mail_options\fP ]
49: \f2recipient . . .\f1
50: .PP
51: \f4mail\f1
52: \f4\-T\f1
53: .I mailsurr_file
54: \f2recipient . . .\f1
55: .SH DESCRIPTION
56: .PP
57: A
58: .I recipient\^
59: is usually a user name recognized by
60: \f4login\fP(1).
61: When
62: .I recipients\^
63: are named,
64: \f4mail\fP
65: assumes a message is being sent
66: (except in the case of the \f4\-F\fP option).
67: It reads from the standard input up to an end-of-file
68: (cntrl-d) or,
69: if reading from a terminal device,
70: until it reads a line consisting of just a period.
71: When either of those indicators is received,
72: \f4mail\fP
73: adds the
74: .I letter\^
75: to the
76: .I mailfile
77: for each
78: .IR recipient .
79: .PP
80: A \f2letter\fP is composed of some \f2header lines\fP followed by a blank
81: line followed by the \f2message content\fP.
82: The \f2header lines\fP section of the letter consists of one or more UNIX
83: postmarks:
84: .sp .5
85: .RS
86: \f4From\f1 \f2sender date_and_time\f1 [\f4remote from\f1 \f2remote_system_name\f1]
87: .RE
88: .sp .5
89: followed by one or more standardized message header lines of the form:
90: .sp .5
91: .RS
92: \f2keyword-name\f4\f4:\f1 [\f2printable text\f1]
93: .RE
94: .sp .5
95: where \f2keyword-name\fP is comprised of any printable,
96: non-whitespace, characters other than colon (`:').
97: A \f4Content-Length:\fP header line,
98: indicating the number of bytes in the \f2message content\fP will always be
99: present.
100: A \f4Content-Type:\fP header line that describes the type of the
101: \f2message content\fP (such as text, binary, multipart, etc.) will always
102: be present unless the letter consists of only header lines with no message
103: content.
104: Header lines may be contined on the following line if that line starts with
105: white space.
106: .SS Sending mail:
107: .PP
108: The following command-line arguments affect SENDING mail:
109: .PD 0
110: .TP
111: \f4\-m\f1
112: causes a \f4Message-Type:\fP line to be added to the message header with
113: the value of \f2message_type\fP.
114: .TP
115: \f4\-t\f1
116: causes a \f4To:\f1 line to be added to the message header
117: for each of the intended recipients.
118: .TP
119: \f4\-w\f1
120: causes a letter to be sent to a remote recipient without waiting for the
121: completion of the remote transfer program.
122: .PD
123: .PP
124: If a letter is found to be undeliverable, it is returned to the
125: sender with diagnostics that indicate the location and nature of the
126: failure.
127: If
128: \f4mail\fP
129: is interrupted during input,
130: the message is saved in the file
131: \f4dead.letter\f1
132: to allow editing and resending.
133: \f4dead.letter\f1
134: is always appended to,
135: thus preserving any previous contents.
136: The initial attempt to append to (or create) \f4dead.letter\fP will be in the
137: current directory.
138: If this fails, \f4dead.letter\fP will be appended to (or created in) the user's
139: login directory.
140: If the second attempt also fails, no \f4dead.letter\fP processing will be
141: done.
142: .PP
143: \f4rmail\fP
144: only permits the sending of mail;
145: \f4uucp\fP(1C)
146: uses
147: \f4rmail\fP
148: as a security precaution.
149: Any application programs that generate mail messages should be sure to
150: invoke \f4rmail\fP rather than \f4mail\fP for message transport and/or
151: delivery.
152: .PP
153: If the local system has the
154: Basic Networking Utilities installed,
155: mail may be sent to a recipient on a remote system.
156: There are numerous ways to address mail to recipients on remote systems
157: depending on the transport mechanisms available to the local system.
158: The two most prevalent addressing schemes are UUCP-style and
159: Domain-style.
160: With UUCP-style addressing,
161: remote recipients are specified
162: by prefixing the recipient name with the remote system name and
163: an exclamation point (such as sysa!user).
164: A series of system names separated by exclamation points
165: can be used to direct a letter through an extended
166: network (such as \f4sysa!sysb!sysc!user\f1).
167: With Domain-style addressing,
168: remote recipients are specified by appending an `\f4@\f1' and domain (and
169: possibly sub-domain) information to the recipient name
170: (such as \[email protected]\f1).
171: (The local System Administrator should be consulted for details on which
172: addressing conventions are available on the local system.)
173: .PP
174: .SS Reading Mail:
175: .PP
176: The following command-line arguments affect READING mail:
177: .PD 0
178: .TP
179: \f4\-e\f1
180: causes mail not to be printed.
181: An exit value of 0 is returned if the user has mail;
182: otherwise, an exit value of 1 is returned.
183: .TP
184: \f4\-h\f1
185: causes a window of headers to be initially displayed rather than the latest
186: message. The display is followed by the `\f4?\f1' prompt.
187: .TP
188: \f4\-p\f1
189: causes all messages to be printed without prompting for disposition.
190: .TP
191: \f4\-P\f1
192: causes all messages to be printed with \f2all\fP header lines displayed,
193: rather than the default selective header line display.
194: .TP
195: \f4\-q\f1
196: causes
197: \f4mail\fP
198: to terminate after interrupts.
199: Normally an interrupt causes only the
200: termination of the message being printed.
201: .TP
202: \f4\-r\f1
203: causes messages to be printed in first-in, first-out order.
204: .TP
205: \f\B\-f\fP\0\f2file\fP
206: causes
207: \f4mail\fP
208: to use
209: .I file\^
210: (such as
211: \f4mbox\f1)
212: instead of the default
213: .IR mailfile .
214: .PD
215: .PP
216: \f4mail\fP,
217: unless otherwise influenced by command-line arguments,
218: prints a user's mail messages
219: in last-in, first-out order.
220: The default mode for printing messages is to display only
221: those header lines of immediate interest.
222: These include, but are not limited to,
223: the UNIX \f4From\fP and \f4>From\fP postmarks,
224: \f4From:\fP,
225: \f4Date:\fP,
226: \f4Subject:\fP,
227: and \f4Content-Length:\fP header lines,
228: and any recipient header lines such as
229: \f4To:\fP,
230: \f4Cc:\fP,
231: \f4Bcc:\fP,
232: etc.
233: After the header lines have been displayed,
234: \f4mail\fP will display the contents (body) of the message only if it
235: contains no unprintable characters.
236: Otherwise, \f4mail\fP will issue a warning statement about the message
237: having binary content and \f4not\fP display the content.
238: (This may be overridden via the \f4p\fP command. See below.)
239: .PP
240: For each message,
241: the user is prompted with a
242: \f4?\f1,
243: and a line is read from the standard input.
244: The following commands are available
245: to determine the disposition of the message:
246: .PD
247: .TP 21
248: \f4#\f1
249: Print the number of the current message.
250: .TP
251: \f4\-\f1
252: Print previous message.
253: .TP
254: <new-line>, \f4+\f1, or \f4n\f1
255: Print the next message.
256: .TP
257: \f4!\f2command\^\f1
258: Escape to the shell to do
259: .IR command .
260: .TP
261: \f4a\f1
262: Print message that arrived during the \f4mail\fP session.
263: .TP
264: \f4d\f1, or \f4dp\f1
265: Delete the current message and print the next message.
266: .TP
267: \f4d \f2n\fP\f1
268: Delete message number \f2n\fP. Do not go on to next message.
269: .TP
270: \f4dq\f1
271: Delete message and quit \f4mail\fP.
272: .TP
273: \f4h\f1
274: Display a window of headers around current message.
275: .TP
276: \f4h \f2n\fP\f1
277: Display a window of headers around message number \f2n\fP.
278: .TP
279: \f4h a\f1
280: Display headers of all messages in the user's \f2mailfile\f1.
281: .TP
282: \f4h d\f1
283: Display headers of messages scheduled for deletion.
284: .TP
285: \f4m\fP [ \f2persons\^\fP ]
286: Mail (and delete) the current message to the named
287: \f2person\f1(\f2s\f1).
288: .TP
289: .I n
290: Print message number \f2n\fP.
291: .TP
292: \f4p\f1
293: Print current message again,
294: overriding any indications of binary (that is, unprintable) content.
295: .TP
296: \f4P\f1
297: Override default brief mode and print current message again,
298: displaying all header lines.
299: .TP
300: \f4q\f1, or cntrl-\s-1D\s+1
301: Put undeleted mail back in the
302: .I mailfile\^
303: and quit \f4mail\fP.
304: .TP
305: \f4r\f1 [ \f2users\^\fP ]
306: Reply to the sender, and other \f2user(s)\f1, then delete the
307: message.
308: .TP
309: \f4s\fP [ \f2files\^\fP ]
310: Save message in the named
311: \f2file\f1(\f2s\f1)\^
312: \f1(\f4mbox\f1
313: is default) and delete the message.
314: .TP
315: \f4u\f1 [ \f2n\fP ]
316: Undelete message number \f2n\fP (default is last read).
317: .TP
318: \f4w\fP [ \f2files\^\fP ]
319: Save message contents, without any header lines,
320: in the named
321: .I files\^
322: \f1(\f4mbox\f1
323: is default) and delete the message.
324: .TP
325: \f4x\f1
326: Put all mail back in the
327: .I mailfile\^
328: unchanged and exit \f4mail\fP.
329: .TP
330: \f4y\fP [ \f2files\^\fP ]
331: Same as save.
332: .TP
333: \f4?\f1
334: Print a command summary.
335: .PD
336: .PP
337: When a user logs in, the presence of mail,
338: if any,
339: is usually indicated.
340: Also,
341: notification is made if new mail arrives while using
342: \f4mail\fP.
343: .PP
344: The permissions of
345: .I mailfile\^
346: may be manipulated using \f4chgrp\fP in two ways to alter the function of
347: \f4mail\fP.
348: The other
349: permissions of the file may be read-write (0666), read-only (0664),
350: or neither read nor write (0660) to allow different levels of privacy.
351: If changed to other than the default (mode 0660), the file will be preserved
352: even when empty to perpetuate the desired permissions.
353: (The administrator may override this file preservation using the
354: \f4DEL_EMPTY_MAILFILE\fP option of \f4mailcnfg\fP.)
355: .P
356: The group id of the mailfile must be \f4mail\f1
357: to allow new messages to
358: be delivered, and the mailfile must be writable by group \f4mail\f1.
359: .SS Forwarding mail:
360: .PP
361: The following command-line argument affects FORWARDING of mail:
362: .sp .5
363: .PD 0
364: .TP
365: \f4\-F\fP\0\f2recipients\fP
366: Causes all incoming mail to be forwarded to
367: .IR recipients .\^
368: The mailbox must be empty.
369: .PD
370: .PP
371: The \f4\-F\fP option causes the \f2mailfile\fP to contain
372: a first line of:
373: .sp .5
374: .RS
375: \f4Forward to\f1 \f2recipient\^. . .\f1
376: .RE
377: .sp .5
378: Thereafter, all mail sent to the owner of the
379: .I mailfile\^
380: will be forwarded to each
381: .IR recipient .
382: .PP
383: An \f4Auto-Forwarded-From: ...\f1 line
384: will be added to the forwarded message's header.
385: This is especially useful
386: in a multi-machine environment
387: to forward all a person's mail to a single machine,
388: and to keep the recipient informed if the mail
389: has been forwarded.
390: .PP
391: Installation and removal of forwarding is done with the
392: \f4\-F\f1
393: invocation option.
394: To forward all your mail to \f4systema!user\f1 enter:
395: .sp .5
396: .RS
397: \f4mail -F\0systema!user\f1
398: .sp .5
399: .RE
400: .PP
401: To forward to more than one recipient enter:
402: .sp .5
403: .RS
404: \f4mail \-F\0"user1,[email protected],systemc!systemd!user3"\f1
405: .sp .5
406: .RE
407: .PP
408: Note that when more than one recipient is specified, the entire list
409: should be enclosed in double quotes so that it may all be
410: interpreted as the operand of the \f4\-F\f1 option.
411: The list can be up to 1024 bytes; either commas or white space can
412: be used to separate users.
413: .PP
414: If the first character of any forwarded-to recipient name is the pipe
415: symbol (`\(bv'),
416: the remainder of the line will be interpreted as a command to pipe the
417: current mail message to.
418: The command, known as a \f2Personal Surrogate\fP,
419: will be executed in the environment of the recipient of the
420: message (that is, basename of the \f2mailfile\fP).
421: For example, if the mailfile is \f4/var/mail/foo\f1,
422: \f4foo\fP will be looked up in \f4/etc/passwd\f1
423: to determine the correct user\s-1ID\s+1, group\s-1ID\s+1, and \f4HOME\f1 directory.
424: The command's environment will be set to contain only
425: \f4HOME\f1, \f4LOGNAME\f1, \f4TZ\f1, \f4PATH\f1
426: (= \f4/usr/bin:\f1), and \f4SHELL\f1 (= \f4/bin/sh\f1),
427: and the command will execute in the recipient's \f4HOME\f1 directory.
428: If the message recipient cannot be found in /etc/passwd,
429: the command will not be executed and a non-delivery notification with
430: appropriate diagnostics will be sent to the message's originator.
431: .PP
432: After the pipe symbol, escaped double quotes should be used
433: to have strings with embedded whitespace be considered as single arguments
434: to the command being executed.
435: No shell syntax or
436: metacharacters may be used unless the command specified is \f4/bin/sh\f1.
437: For example,
438: .sp .5
439: .RS
440: \f4mail\0\-F\0"\(bv/bin/sh \-c \e"shell_command_line\e""\f1
441: .RE
442: .sp .5
443: will work, but is not advised since using double quotes and
444: backslashes within the shell_command_line is difficult to do correctly and
445: becomes tedious \f4very\fP quickly.
446: .PP
447: Certain %keywords are allowed within the piped-to command specification
448: and will be textually substituted for \f2before\fP the command line is
449: executed.
450: .sp .5
451: .PD 0
452: .TP
453: \f4%R\fP
454: Return path to the message originator.
455: .TP
456: \f4%c\fP
457: Value of the \f4Content-Type:\f1 header line if present.
458: .TP
459: \f4%S\fP
460: Value of the \f4Subject:\f1 header line if present.
461: .PD
462: .PP
463: If the command being piped to exits with any non-zero value,
464: \f4mail\fP will assume that message delivery failed and will generate a
465: non-delivery notification to the message's originator. It is allowable to
466: forward mail to other recipients \f4and\fP pipe it to a command,
467: as in
468: .sp .5
469: .RS
470: \f4mail \-F\0"carol,joe,\(bvmyvacationprog %R"\f1
471: .RE
472: .PP
473: Two UNIX System facilities that use the forwarding of
474: messages to commands are \f4notify\fP(1),
475: which causes asynchronous notification of new mail,
476: and \f4vacation\fP(1),
477: which provides an auto-answer capability for messages when the recipient
478: will be unavailable for an extended period of time.
479: .PP
480: To remove forwarding enter:
481: .sp .5
482: .RS
483: \f4mail \-F\0"\^"\f1
484: .RE
485: .PP
486: The pair of double quotes is mandatory to set a NULL argument for
487: the \-F option.
488: .PP
489: In order for forwarding to work properly the
490: .I mailfile\^
491: should have \f4mail\fP as group ID,
492: and the group permission should be read-write.
493: .PP
494: \f4mail\fP will exit with a return code of \f40\fP if forwarding was
495: successfully installed or removed.
496: .SS Debugging:
497: .PP
498: The following command-line arguments cause \f4mail\fP to provide
499: DEBUGGING information:
500: .sp .5
501: .PD 0
502: .TP 22
503: \f4\-T\fP\0\f2mailsurr_file
504: causes \f4mail\fP to display how it will parse and interpret
505: the \f4mailsurr\fP file.
506: .TP
507: \f4\-x\fP\f2debug_level\fP
508: causes \f4mail\fP to create a trace file containing debugging information.
509: .PD
510: .PP
511: The \f4\-T\fP option requires an argument that will be taken as the
512: pathname of a test \f4mailsurr\f1 file.
513: If NULL (as in \f4\-T ""\f1),
514: the system \f4mailsurr\f1 file will be used.
515: To use, type '\f4mail\fP \f4\-T\fP \f2test_file\0recipient\fP' and some trivial
516: message (like "testing"),
517: followed by a line with either just a dot (`.') or a cntrl-D.
518: The result of using the \f4\-T\f1 option will be displayed on standard output and
519: show the inputs and resulting transformations as \f4mailsurr\fP is
520: processed by the \f4mail\fP command for the indicated recipient.
521: Mail messages will never actually be sent or delivered when
522: the \f4\-T\f1 option is used.
523: .PP
524: The \f4\-x\f1 option causes \f4mail\fP to create a file named
525: \f4/tmp/MLDBG\f2process_id\f1 that contains debugging information
526: relating to how \f4mail\fP processed the current message.
527: The absolute value of \f2debug_level\f1 controls the verboseness
528: of the debug information.
529: Zero implies no debugging.
530: If \f2debug_level\f1 is greater than zero,
531: the debug file will be retained \f4only\f1 if \f4mail\fP encountered some
532: problem while processing the message.
533: If \f2debug_level\fP is less than zero the debug file will always be retained.
534: The \f2debug_level\f1 specified via \f4\-x\f1 overrides any specification
535: of \f4DEBUG\f1 in \f4/etc/mail/mailcnfg\f1.
536: The information provided by the \f4\-x\f1 option is esoteric and is
537: probably only useful to System Administrators.
538: The output produced by the \f4\-x\f1 option is a superset
539: of that provided by the \f4\-T\f1 option.
540: .SS Delivery Notification
541: Several forms of notification are available for mail by
542: including one of the following lines in the message header.
543: .PP
544: \f4Transport-Options:\f1 [ \f4/\f2options\f1 ]
545: .sp .2
546: \f4Default-Options:\f1 [ \f4/\f2options\f1 ]
547: .sp .2
548: \f4>To:\f1 \f2recipient\f1 [ \f4/\f2options\f1 ]
549: .PP
550: Where the ``/\f2options\f1'' may be one or more of the following:
551: .TP 12
552: \f4/delivery\f1
553: Inform the sender that the message was successfully delivered to the
554: \f2recipient\f1's mailbox.
555: .TP
556: \f4/nodelivery\f1
557: Do not inform the sender of successful deliveries.
558: .TP
559: \f4/ignore\f1
560: Do not inform the sender of \f4un\f1successful deliveries.
561: .TP
562: \f4/return\f1
563: Inform the sender if mail delivery fails.
564: Return the failed message to the sender.
565: .TP
566: \f4/report\f1
567: Same as \f4/return\f1 except that
568: the original message is not returned.
569: .PP
570: The default is \f4/nodelivery/return\f1.
571: If contradictory options are used, the first will
572: be recognized and later, conflicting, terms will be ignored.
573: .SH FILES
574: .PD 0
575: .TP 20
576: \f4dead.letter\f1
577: unmailable text
578: .TP
579: \f4/etc/passwd\f1
580: to identify sender and locate recipients
581: .TP
582: \f4/etc/mail/mailsurr\f1
583: routing / name translation information
584: .TP
585: \f4/etc/mail/mailcnfg\f1
586: initialization information
587: .TP
588: .SM
589: \f4$HOME\*S/mbox\f1
590: saved mail
591: .TP
592: .SM
593: \f4$MAIL\*S\f1
594: variable containing path name of
595: .I mailfile\^
596: .TP
597: \f4/tmp/ma\f1\(**
598: temporary file
599: .TP
600: \f4/tmp/MLDBG\f1\(**
601: debug trace file
602: .TP
603: \f4/var/mail/\f1\(**\f4.lock\f1
604: lock for mail directory
605: .TP
606: \f4/var/mail/:saved\f1
607: directory for holding temp files to prevent loss of data in the event of a
608: system crash.
609: .TP
610: \f4/var/mail/\f1\f2user\f1
611: incoming mail for \f2user\fP;
612: that is, the
613: .I mailfile\^
614: .PD
615: .SH SEE ALSO
616: \f4chmod\fP(1),
617: \f4login\fP(1),
618: \f4mailx\fP(1),
619: \f4notify\fP(1),
620: \f4write\fP(1),
621: \f4vacation\fP(1)
622: .sp .2
623: \f4mail_pipe\fP(1M),
624: \f4mailsurr\fP(4),
625: \f4mailcnfg\fP(4) in the \f2System Administrator's Reference Manual\f1.
626: .br
627: .IR "User\'s Guide" .
628: .SH NOTES
629: The "Forward to recipient" feature may result in a loop.
630: Local loops (messages sent to \f4usera\f1, which are forwarded to
631: \f4userb\f1, which are forwarded to \f4usera\f1) will be detected
632: immediately. Remote loops (mail sent to \f4sys1!usera\fP1 which is forwarded
633: to \f4sys2!userb\f1, which is forwarded to \f4sys1!usera\f1) will also be
634: detected, but only after the message has exceeded the built-in hop count
635: limit of 20.
636: Both cases of forwarding loops will result in a non-delivery
637: notification being sent to the message originator.
638: .PP
639: As a security precaution, the equivalent of a \f4chmod s+g\f1 is performed on
640: the \f2mailfile\fP whenever forwarding is activated via the \f4\-F\fP
641: option,
642: and a \f4chmod s\(mig\fP is done when forwarding is removed via the
643: \f4\-F\fP option.
644: If the set\s-1GID\s+1 mode bit is not set when \f4mail\fP
645: attempts to forward an incoming message to a command,
646: the operation will fail and a non-delivery report with appropriate
647: diagnostics will be sent to the message's originator.
648: .PP
649: The interpretation and resulting action taken because of the
650: header lines described in the Delivery Notifications section
651: above will only occur if this version of \f4mail\fP is installed
652: on the system where the delivery (or failure) happens.
653: Earlier versions of \f4mail\fP may not support any types
654: of delivery notification.
655: .PP
656: Conditions sometimes result
657: in a failure to remove a lock file.
658: .PP
659: After an interrupt, the next message may not be printed;
660: printing may be forced by typing a
661: \f4p\f1.
662: .Ee
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.