Annotation of src/usr.bin/mail/mail.1, Revision 1.24
1.24 ! aaron 1: .\" $OpenBSD: mail.1,v 1.23 1999/05/12 13:26:51 aaron Exp $
1.5 millert 2: .\"
1.1 deraadt 3: .\" Copyright (c) 1980, 1990, 1993
4: .\" The Regents of the University of California. All rights reserved.
5: .\"
6: .\" Redistribution and use in source and binary forms, with or without
7: .\" modification, are permitted provided that the following conditions
8: .\" are met:
9: .\" 1. Redistributions of source code must retain the above copyright
10: .\" notice, this list of conditions and the following disclaimer.
11: .\" 2. Redistributions in binary form must reproduce the above copyright
12: .\" notice, this list of conditions and the following disclaimer in the
13: .\" documentation and/or other materials provided with the distribution.
14: .\" 3. All advertising materials mentioning features or use of this software
15: .\" must display the following acknowledgement:
16: .\" This product includes software developed by the University of
17: .\" California, Berkeley and its contributors.
18: .\" 4. Neither the name of the University nor the names of its contributors
19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
1.5 millert 34: .\" @(#)mail.1 8.8 (Berkeley) 4/28/95
1.1 deraadt 35: .\"
1.5 millert 36: .Dd April 28, 1995
1.1 deraadt 37: .Dt MAIL 1
1.24 ! aaron 38: .Os
1.1 deraadt 39: .Sh NAME
1.7 millert 40: .Nm mail ,
41: .Nm mailx ,
42: .Nm Mail
1.1 deraadt 43: .Nd send and receive mail
44: .Sh SYNOPSIS
45: .Nm mail
46: .Op Fl iInv
47: .Op Fl s Ar subject
1.22 aaron 48: .Op Fl c Ar list
49: .Op Fl b Ar list
1.19 aaron 50: .Ar to-addr Op Ar ...
51: .Op Fl Ar sendmail-options Op Ar ...
1.1 deraadt 52: .Nm mail
53: .Op Fl iInNv
54: .Fl f
55: .Op Ar name
56: .Nm mail
57: .Op Fl iInNv
58: .Op Fl u Ar user
1.22 aaron 59: .Sh DESCRIPTION
1.19 aaron 60: .Nm mail
1.18 aaron 61: is an intelligent mail processing system which has
1.1 deraadt 62: a command syntax reminiscent of
63: .Xr \&ed 1
64: with lines replaced by messages.
65: .Bl -tag -width flag
66: .It Fl v
67: Verbose mode.
68: The details of
69: delivery are displayed on the user's terminal.
70: .It Fl i
71: Ignore tty interrupt signals.
72: This is
73: particularly useful when using
74: .Nm mail
75: on noisy phone lines.
76: .It Fl I
1.22 aaron 77: Forces
78: .Nm mail
79: to run in interactive mode, even when input is not a terminal.
80: In particular, the special
81: .Ic \&~
82: command character, used when sending mail, is only available interactively.
1.1 deraadt 83: .It Fl n
84: Inhibits reading
85: .Pa /etc/mail.rc
86: upon startup.
87: .It Fl N
1.22 aaron 88: Inhibits initial display of message headers
1.1 deraadt 89: when reading mail or editing a mail folder.
1.8 deraadt 90: .It Fl s Ar subject
1.1 deraadt 91: Specify subject on command line
92: (only the first argument after the
93: .Fl s
94: flag is used as a subject; be careful to quote subjects
1.22 aaron 95: containing spaces).
96: .It Fl c Ar list
1.1 deraadt 97: Send carbon copies to
98: .Ar list
99: of users.
1.22 aaron 100: .Ar list
101: should be a comma separated list of names.
102: .It Fl b Ar list
1.1 deraadt 103: Send blind carbon copies to
104: .Ar list .
1.22 aaron 105: .It Fl f Ar name
106: Read in the contents of your mailbox
107: (or the specified file
108: .Ar name )
109: for processing; when you quit,
1.1 deraadt 110: .Nm mail
111: writes undeleted messages back to this file.
1.8 deraadt 112: .It Fl u Ar user
1.1 deraadt 113: Is equivalent to:
114: .Pp
115: .Dl mail -f /var/mail/user
1.22 aaron 116: .Pp
117: except that locking is done.
1.1 deraadt 118: .El
1.10 deraadt 119: .Ss Startup actions
1.22 aaron 120: At startup time,
1.24 ! aaron 121: .Nm mail
1.10 deraadt 122: will execute commands in the system command files
1.24 ! aaron 123: .Pa /usr/share/misc/mail.rc ,
1.22 aaron 124: .Pa /usr/local/etc/mail.rc
1.10 deraadt 125: and
1.24 ! aaron 126: .Pa /etc/mail.rc
1.10 deraadt 127: in order unless explicitly told not to by using the
128: .Fl n
1.24 ! aaron 129: option. Next, the commands in the user's personal command file
! 130: .Pa ~/.mailrc
1.10 deraadt 131: are executed.
132: .Nm mail
133: then examines its command line options to determine whether the user
134: requested a new message to be sent or existing messages in a mailbox
135: to be examined.
1.1 deraadt 136: .Ss Sending mail
137: To send a message to one or more people,
138: .Nm mail
139: can be invoked with arguments which are the names of people to
140: whom the mail will be sent.
141: You are then expected to type in
142: your message, followed
1.22 aaron 143: by a control-D
144: .Pq Sq ^D
1.1 deraadt 145: at the beginning of a line.
1.18 aaron 146: The section below,
1.1 deraadt 147: .Ar Replying to or originating mail ,
148: describes some features of
149: .Nm mail
150: available to help you compose your letter.
151: .Pp
152: .Ss Reading mail
1.22 aaron 153: In normal usage,
1.1 deraadt 154: .Nm mail
155: is given no arguments and checks your mail out of the
156: post office, then
157: prints out a one line header of each message found.
1.22 aaron 158: The current message is initially set to the first message (numbered 1)
1.1 deraadt 159: and can be printed using the
160: .Ic print
161: command (which can be abbreviated
1.6 deraadt 162: .Ic p ) .
1.22 aaron 163: Moving among the messages is much like moving between lines in
164: .Xr ed 1 ;
165: you may use
166: .Ic \&+
1.1 deraadt 167: and
1.22 aaron 168: .Ic \&-
169: to shift forwards and backwards, or simply enter a message number to move
170: directly.
1.1 deraadt 171: .Pp
1.22 aaron 172: .Ss Disposing of mail
1.1 deraadt 173: After examining a message you can
174: .Ic delete
1.6 deraadt 175: .Pq Ic d
1.22 aaron 176: or
1.1 deraadt 177: .Ic reply
1.6 deraadt 178: .Pq Ic r
1.1 deraadt 179: to it.
180: Deletion causes the
181: .Nm mail
182: program to forget about the message.
183: This is not irreversible; the message can be
184: .Ic undeleted
1.6 deraadt 185: .Pq Ic u
1.1 deraadt 186: by giving its number, or the
187: .Nm mail
188: session can be aborted by giving the
189: .Ic exit
1.6 deraadt 190: .Pq Ic x
1.1 deraadt 191: command.
1.22 aaron 192: Deleted messages, however, will usually disappear, never to be seen again.
1.1 deraadt 193: .Pp
194: .Ss Specifying messages
195: Commands such as
196: .Ic print
197: and
198: .Ic delete
199: can be given a list of message numbers as arguments to apply
200: to a number of messages at once.
201: Thus
1.22 aaron 202: .Ic delete 1 2
1.1 deraadt 203: deletes messages 1 and 2, while
1.22 aaron 204: .Ic delete 1\-5
1.1 deraadt 205: deletes messages 1 through 5.
206: The special name
1.22 aaron 207: .Dq \&*
208: addresses all messages and
209: .Dq \&$
1.1 deraadt 210: addresses
211: the last message; thus the command
212: .Ic top
213: which prints the first few lines of a message could be used in
1.22 aaron 214: .Ic top \&*
1.1 deraadt 215: to print the first few lines of all messages.
216: .Pp
1.22 aaron 217: .Ss Replying to or originating mail
1.1 deraadt 218: You can use the
219: .Ic reply
220: command to
221: set up a response to a message, sending it back to the
222: person who it was from.
223: Text you then type in, up to an end-of-file,
224: defines the contents of the message.
225: While you are composing a message,
226: .Nm mail
1.22 aaron 227: treats lines beginning with the tilde
228: .Pq Sq ~
229: character specially.
1.1 deraadt 230: For instance, typing
1.22 aaron 231: .Ic ~m
1.1 deraadt 232: (alone on a line) will place a copy
1.22 aaron 233: of the current message into the response, right shifting it by a single
234: tab-stop (see
235: .Va indentprefix
1.1 deraadt 236: variable, below).
237: Other escapes will set up subject fields, add and delete recipients
238: to the message and allow you to escape to an editor to revise the
239: message or to a shell to run some commands.
240: (These options
241: are given in the summary below.)
242: .Pp
1.22 aaron 243: .Ss Ending a mail processing session
1.1 deraadt 244: You can end a
245: .Nm mail
246: session with the
247: .Ic quit
1.6 deraadt 248: .Pq Ic q
1.1 deraadt 249: command.
250: Messages which have been examined go to your
251: .Ar mbox
252: file unless they have been deleted in which case they are discarded.
1.22 aaron 253: Unexamined messages go back to the post office (see the
1.1 deraadt 254: .Fl f
255: option above).
256: .Pp
1.22 aaron 257: .Ss Personal and system wide distribution lists
1.15 aaron 258: It is also possible to create personal distribution lists so that,
1.1 deraadt 259: for instance, you can send mail to
260: .Dq Li cohorts
261: and have it go
262: to a group of people.
263: Such lists can be defined by placing a line like
264: .Pp
265: .Dl alias cohorts bill ozalp jkf mark kridle@ucbcory
266: .Pp
267: in the file
268: .Pa \&.mailrc
269: in your home directory.
270: The current list of such aliases can be displayed with the
271: .Ic alias
272: command in
1.22 aaron 273: .Nm mail .
1.1 deraadt 274: System wide distribution lists can be created by editing
275: .Pa /etc/aliases ,
1.22 aaron 276: (see
277: .Xr aliases 5
1.1 deraadt 278: and
1.22 aaron 279: .Xr sendmail 8 ) ;
1.1 deraadt 280: these are kept in a different syntax.
281: In mail you send, personal aliases will be expanded in mail sent
282: to others so that they will be able to
283: .Ic reply
284: to the recipients.
1.22 aaron 285: System wide aliases
1.1 deraadt 286: are not expanded when the mail is sent,
287: but any reply returned to the machine will have the system wide
288: alias expanded as all mail goes through
1.22 aaron 289: .Xr sendmail .
1.1 deraadt 290: .Pp
291: .Ss Network mail (ARPA, UUCP, Berknet)
292: See
293: .Xr mailaddr 7
294: for a description of network addresses.
295: .Pp
1.19 aaron 296: .Nm mail
1.1 deraadt 297: has a number of options which can be set in the
298: .Pa .mailrc
299: file to alter its behavior; thus
300: .Dq Li set askcc
301: enables the
302: .Ar askcc
303: feature.
304: (These options are summarized below.)
305: .Sh SUMMARY
1.22 aaron 306: (Adapted from the
1.24 ! aaron 307: .Dq Mail Reference Manual . )
1.1 deraadt 308: .Pp
309: Each command is typed on a line by itself, and may take arguments
310: following the command word.
311: The command need not be typed in its
1.22 aaron 312: entirety -- the first command which matches the typed prefix is used.
1.1 deraadt 313: For commands which take message lists as arguments, if no message
314: list is given, then the next message forward which satisfies the
315: command's requirements is used.
316: If there are no messages forward of
317: the current message, the search proceeds backwards, and if there are no
318: good messages at all,
319: .Nm mail
320: types
1.18 aaron 321: .Dq Li \&No applicable messages
1.1 deraadt 322: and
323: aborts the command.
324: .Bl -tag -width delete
325: .It Ic \&\-
326: Print out the preceding message.
327: If given a numeric
328: argument
1.22 aaron 329: .Ar n ,
1.1 deraadt 330: goes to the
1.22 aaron 331: .Ar n Ns th
1.1 deraadt 332: previous message and prints it.
333: .It Ic \&?
334: Prints a brief summary of commands.
335: .It Ic \&!
336: Executes the shell
337: (see
338: .Xr sh 1
339: and
340: .Xr csh 1 )
341: command which follows.
342: .It Ic Print
343: .Pq Ic P
344: Like
345: .Ic print
346: but also prints out ignored header fields.
347: See also
348: .Ic print ,
349: .Ic ignore
350: and
351: .Ic retain .
352: .It Ic Reply
353: .Pq Ic R
354: Reply to originator.
355: Does not reply to other
356: recipients of the original message.
357: .It Ic Type
358: .Pq Ic T
359: Identical to the
360: .Ic Print
361: command.
362: .It Ic alias
363: .Pq Ic a
1.23 aaron 364: With no arguments, prints out all currently defined aliases.
1.1 deraadt 365: With one
366: argument, prints out that alias.
367: With more than one argument, creates
368: a new alias or changes an old one.
369: .It Ic alternates
370: .Pq Ic alt
371: The
372: .Ic alternates
373: command is useful if you have accounts on several machines.
374: It can be used to inform
375: .Nm mail
376: that the listed addresses are really you.
377: When you
378: .Ic reply
379: to messages,
380: .Nm mail
381: will not send a copy of the message to any of the addresses
382: listed on the
383: .Ic alternates
384: list.
385: If the
386: .Ic alternates
387: command is given with no argument, the current set of alternate
388: names is displayed.
389: .It Ic chdir
390: .Pq Ic c
391: Changes the user's working directory to that specified, if given.
392: If
393: no directory is given, then changes to the user's login directory.
394: .It Ic copy
395: .Pq Ic co
396: The
397: .Ic copy
398: command does the same thing that
399: .Ic save
400: does, except that it does not mark the messages it
401: is used on for deletion when you quit.
402: .It Ic delete
403: .Pq Ic d
404: Takes a list of messages as argument and marks them all as deleted.
405: Deleted messages will not be saved in
1.22 aaron 406: .Ar mbox ,
1.1 deraadt 407: nor will they be available for most other commands.
408: .It Ic dp
409: (also
410: .Ic dt )
411: Deletes the current message and prints the next message.
412: If there is no next message,
413: .Nm mail
414: says
415: .Dq Li "at EOF" .
416: .It Ic edit
417: .Pq Ic e
418: Takes a list of messages and points the text editor at each one in
419: turn.
420: On return from the editor, the message is read back in.
421: .It Ic exit
422: .Pf ( Ic ex
423: or
424: .Ic x )
1.15 aaron 425: Effects an immediate return to the shell without
1.1 deraadt 426: modifying the user's system mailbox, his
427: .Ar mbox
428: file, or his edit file in
1.22 aaron 429: .Fl f .
1.1 deraadt 430: .It Ic file
431: .Pq Ic fi
432: The same as
1.22 aaron 433: .Ic folder .
1.1 deraadt 434: .It Ic folders
435: List the names of the folders in your folder directory.
436: .It Ic folder
437: .Pq Ic fo
438: The
439: .Ic folder
440: command switches to a new mail file or folder.
441: With no
442: arguments, it tells you which file you are currently reading.
443: If you give it an argument, it will write out changes (such
444: as deletions) you have made in the current file and read in
445: the new file.
446: Some special conventions are recognized for
447: the name.
448: # means the previous file, % means your system
449: mailbox, %user means user's system mailbox, & means
450: your
451: .Ar mbox
452: file, and
453: \&+\&folder means a file in your folder
454: directory.
455: .It Ic from
456: .Pq Ic f
457: Takes a list of messages and prints their message headers.
458: .It Ic headers
459: .Pq Ic h
460: Lists the current range of headers, which is an 18\-message group.
461: If
462: a
1.22 aaron 463: .Dq \&+
464: argument is given, the next 18\-message group is printed; if
1.1 deraadt 465: a
1.22 aaron 466: .Dq \&\-
1.1 deraadt 467: argument is given, the previous 18\-message group is printed.
468: .It Ic help
469: A synonym for
1.22 aaron 470: .Ic \&? .
1.5 millert 471: .ne li
1.1 deraadt 472: .It Ic hold
473: .Pf ( Ic ho ,
474: also
475: .Ic preserve )
476: Takes a message list and marks each
477: message therein to be saved in the
478: user's system mailbox instead of in
1.22 aaron 479: .Ar mbox .
1.1 deraadt 480: Does not override the
481: .Ic delete
482: command.
483: .It Ic ignore
484: Add the list of header fields named to the
485: .Ar ignored list .
486: Header fields in the ignore list are not printed
487: on your terminal when you print a message.
488: This
489: command is very handy for suppression of certain machine-generated
490: header fields.
491: The
492: .Ic Type
493: and
494: .Ic Print
495: commands can be used to print a message in its entirety, including
496: ignored fields.
1.5 millert 497: .It Ic inc
498: Incorporate any new messages that have arrived while mail
499: is being read.
500: The new messages are added to the end of the message list,
501: and the current message is reset to be the first new mail message.
1.14 aaron 502: This does not renumber the existing message list, nor
1.5 millert 503: does it cause any changes made so far to be saved.
1.1 deraadt 504: If
505: .Ic ignore
506: is executed with no arguments, it lists the current set of
507: ignored fields.
508: .It Ic mail
509: .Pq Ic m
510: Takes as argument login names and distribution group names and sends
511: mail to those people.
512: .It Ic mbox
513: Indicate that a list of messages be sent to
514: .Ic mbox
515: in your home directory when you quit.
516: This is the default
517: action for messages if you do
518: .Em not
519: have the
520: .Ic hold
521: option set.
1.4 deraadt 522: .It Ic more
523: .Pq Ic \mo
524: Takes a message list and invokes the pager on that list.
1.1 deraadt 525: .It Ic next
526: .Pq Ic n
1.15 aaron 527: (like
1.1 deraadt 528: .Ic \&+
529: or
530: .Tn CR )
531: Goes to the next message in sequence and types it.
532: With an argument list, types the next matching message.
533: .It Ic preserve
534: .Pq Ic pre
535: A synonym for
1.22 aaron 536: .Ic hold .
1.1 deraadt 537: .It Ic print
538: .Pq Ic p
539: Takes a message list and types out each message on the user's terminal.
540: .It Ic quit
541: .Pq Ic q
542: Terminates the session, saving all undeleted, unsaved messages in
543: the user's
544: .Ar mbox
545: file in his login directory, preserving all messages marked with
546: .Ic hold
547: or
548: .Ic preserve
549: or never referenced
550: in his system mailbox, and removing all other messages from his system
551: mailbox.
552: If new mail has arrived during the session, the message
553: .Dq Li "You have new mail"
554: is given.
555: If given while editing a
556: mailbox file with the
557: .Fl f
558: flag, then the edit file is rewritten.
1.15 aaron 559: A return to the shell is
1.18 aaron 560: effected, unless the rewrite of edit file fails, in which case the user
1.1 deraadt 561: can escape with the
562: .Ic exit
563: command.
564: .It Ic reply
565: .Pq Ic r
566: Takes a message list and sends mail to the sender and all
567: recipients of the specified message.
568: The default message must not be deleted.
569: .It Ic respond
570: A synonym for
1.22 aaron 571: .Ic reply .
1.1 deraadt 572: .It Ic retain
573: Add the list of header fields named to the
1.22 aaron 574: .Ar retained list .
1.1 deraadt 575: Only the header fields in the retain list
576: are shown on your terminal when you print a message.
577: All other header fields are suppressed.
578: The
579: .Ic Type
580: and
581: .Ic Print
582: commands can be used to print a message in its entirety.
583: If
584: .Ic retain
585: is executed with no arguments, it lists the current set of
586: retained fields.
587: .It Ic save
588: .Pq Ic s
589: Takes a message list and a filename and appends each message in
590: turn to the end of the file.
591: The filename in quotes, followed by the line
592: count and character count is echoed on the user's terminal.
593: .It Ic set
594: .Pq Ic se
595: With no arguments, prints all variable values.
596: Otherwise, sets
597: option.
598: Arguments are of the form
599: .Ar option=value
600: (no space before or after =) or
601: .Ar option .
602: Quotation marks may be placed around any part of the assignment statement to
603: quote blanks or tabs, i.e.
1.22 aaron 604: .Dq Li "set indentprefix=\*q->\*q" .
1.1 deraadt 605: .It Ic saveignore
606: .Ic Saveignore
607: is to
608: .Ic save
609: what
610: .Ic ignore
611: is to
612: .Ic print
613: and
1.22 aaron 614: .Ic type .
1.1 deraadt 615: Header fields thus marked are filtered out when
616: saving a message by
617: .Ic save
618: or when automatically saving to
1.22 aaron 619: .Ar mbox .
1.5 millert 620: .pl +1
1.1 deraadt 621: .It Ic saveretain
622: .Ic Saveretain
623: is to
624: .Ic save
625: what
626: .Ic retain
627: is to
628: .Ic print
629: and
1.22 aaron 630: .Ic type .
1.1 deraadt 631: Header fields thus marked are the only ones saved
632: with a message when saving by
633: .Ic save
634: or when automatically saving to
1.22 aaron 635: .Ar mbox .
1.1 deraadt 636: .Ic Saveretain
637: overrides
1.22 aaron 638: .Ic saveignore .
1.1 deraadt 639: .It Ic shell
640: .Pq Ic sh
641: Invokes an interactive version of the shell.
642: .It Ic size
643: Takes a message list and prints out the size in characters of each
644: message.
645: .It Ic source
646: The
647: .Ic source
648: command reads
649: commands from a file.
650: .It Ic top
651: Takes a message list and prints the top few lines of each.
652: The number of
653: lines printed is controlled by the variable
654: .Ic toplines
655: and defaults to five.
656: .It Ic type
657: .Pq Ic t
658: A synonym for
1.22 aaron 659: .Ic print .
1.1 deraadt 660: .It Ic unalias
661: Takes a list of names defined by
662: .Ic alias
663: commands and discards the remembered groups of users.
664: The group names
665: no longer have any significance.
666: .It Ic undelete
667: .Pq Ic u
668: Takes a message list and marks each message as
669: .Ic not
670: being deleted.
671: .It Ic unread
672: .Pq Ic U
673: Takes a message list and marks each message as
674: .Ic not
675: having been read.
676: .It Ic unset
677: Takes a list of option names and discards their remembered values;
678: the inverse of
1.22 aaron 679: .Ic set .
1.1 deraadt 680: .It Ic visual
681: .Pq Ic v
682: Takes a message list and invokes the display editor on each message.
683: .It Ic write
684: .Pq Ic w
685: Similar to
1.22 aaron 686: .Ic save ,
1.1 deraadt 687: except that
688: .Ic only
689: the message body
1.16 millert 690: .Po Ar without\
691: the header
692: .Pc
693: is saved.
1.1 deraadt 694: Extremely useful for such tasks as sending and receiving source
695: program text over the message system.
696: .It Ic xit
697: .Pq Ic x
698: A synonym for
1.22 aaron 699: .Ic exit .
1.1 deraadt 700: .It Ic z
1.19 aaron 701: .Nm mail
1.1 deraadt 702: presents message headers in windowfuls as described under the
703: .Ic headers
704: command.
705: You can move
706: .Nm mail Ns 's
707: attention forward to the next window with the
708: .Ic \&z
709: command.
710: Also, you can move to the previous window by using
1.22 aaron 711: .Ic \&z\&\- .
1.1 deraadt 712: .El
1.22 aaron 713: .Ss Tilde/escapes
1.1 deraadt 714: Here is a summary of the tilde escapes,
715: which are used when composing messages to perform
716: special functions.
717: Tilde escapes are only recognized at the beginning
718: of lines.
719: The name
1.22 aaron 720: .Dq tilde escape
1.1 deraadt 721: is somewhat of a misnomer since the actual escape character can be set
722: by the option
723: .Ic escape .
724: .Bl -tag -width Ds
725: .It Ic \&~! Ns Ar command
726: Execute the indicated shell command, then return to the message.
727: .It Ic \&~b Ns Ar name ...
728: Add the given names to the list of carbon copy recipients but do not make
729: the names visible in the Cc: line ("blind" carbon copy).
730: .It Ic \&~c Ns Ar name ...
731: Add the given names to the list of carbon copy recipients.
732: .It Ic \&~d
733: Read the file
1.22 aaron 734: .Pa dead.letter
1.1 deraadt 735: from your home directory into the message.
736: .It Ic \&~e
737: Invoke the text editor on the message collected so far.
738: After the
739: editing session is finished, you may continue appending text to the
740: message.
741: .It Ic \&~f Ns Ar messages
742: Read the named messages into the message being sent.
743: If no messages are specified, read in the current message.
744: Message headers currently being ignored (by the
745: .Ic ignore
746: or
747: .Ic retain
748: command) are not included.
1.5 millert 749: .ne li
1.1 deraadt 750: .It Ic \&~F Ns Ar messages
751: Identical to
752: .Ic \&~f ,
753: except all message headers are included.
754: .It Ic \&~h
755: Edit the message header fields by typing each one in turn and allowing
756: the user to append text to the end or modify the field by using the
757: current terminal erase and kill characters.
758: .It Ic \&~m Ns Ar messages
759: Read the named messages into the message being sent, indented by a
760: tab or by the value of
1.22 aaron 761: .Ar indentprefix .
1.1 deraadt 762: If no messages are specified,
763: read the current message.
764: Message headers currently being ignored (by the
765: .Ic ignore
766: or
767: .Ic retain
768: command) are not included.
769: .It Ic \&~M Ns Ar messages
770: Identical to
771: .Ic \&~m ,
772: except all message headers are included.
773: .It Ic \&~p
774: Print out the message collected so far, prefaced by the message header
775: fields.
776: .It Ic \&~q
777: Abort the message being sent, copying the message to
1.22 aaron 778: .Pa dead.letter
1.1 deraadt 779: in your home directory if
780: .Ic save
781: is set.
782: .It Ic \&~r Ns Ar filename
783: Read the named file into the message.
784: .It Ic \&~s Ns Ar string
785: Cause the named string to become the current subject field.
786: .It Ic \&~\&t Ns Ar name ...
787: Add the given names to the direct recipient list.
788: .It Ic \&~\&v
789: Invoke an alternate editor (defined by the
790: .Ev VISUAL
791: option) on the
792: message collected so far.
793: Usually, the alternate editor will be a
794: screen editor.
795: After you quit the editor, you may resume appending
796: text to the end of your message.
797: .It Ic \&~w Ns Ar filename
798: Write the message onto the named file.
799: .It Ic \&~\&| Ns Ar command
800: Pipe the message through the command as a filter.
801: If the command gives
802: no output or terminates abnormally, retain the original text of the
803: message.
804: The command
805: .Xr fmt 1
806: is often used as
807: .Ic command
808: to rejustify the message.
809: .It Ic \&~: Ns Ar mail-command
810: Execute the given mail command.
811: Not all commands, however, are allowed.
812: .It Ic \&~~ Ns Ar string
813: Insert the string of text in the message prefaced by a single ~.
814: If
815: you have changed the escape character, then you should double
816: that character in order to send it.
817: .El
1.22 aaron 818: .Ss Mail options
1.1 deraadt 819: Options are controlled via
820: .Ic set
821: and
822: .Ic unset
823: commands.
824: Options may be either binary, in which case it is only
825: significant to see whether they are set or not; or string, in which
826: case the actual value is of interest.
827: The binary options include the following:
828: .Bl -tag -width append
829: .It Ar append
830: Causes messages saved in
831: .Ar mbox
832: to be appended to the end rather than prepended.
833: This should always be set (perhaps in
834: .Pa /etc/mail.rc ) .
835: .It Ar ask, asksub
836: Causes
837: .Nm mail
838: to prompt you for the subject of each message you send.
839: If
840: you respond with simply a newline, no subject field will be sent.
1.5 millert 841: .ne li
1.1 deraadt 842: .It Ar askcc
843: Causes you to be prompted for additional carbon copy recipients at the
844: end of each message.
845: Responding with a newline indicates your
846: satisfaction with the current list.
1.5 millert 847: .It Ar autoinc
848: Causes new mail to be automatically incorporated when it arrives.
849: Setting this is similar to issuing the
850: .Ic inc
851: command at each prompt, except that the current message is not
852: reset when new mail arrives.
1.1 deraadt 853: .It Ar askbcc
854: Causes you to be prompted for additional blind carbon copy recipients at the
855: end of each message.
856: Responding with a newline indicates your
857: satisfaction with the current list.
858: .It Ar autoprint
859: Causes the
860: .Ic delete
861: command to behave like
862: .Ic dp
863: \- thus, after deleting a message, the next one will be typed
864: automatically.
865: .It Ar debug
866: Setting the binary option
867: .Ar debug
868: is the same as specifying
869: .Fl d
870: on the command line and causes
871: .Nm mail
872: to output all sorts of information useful for debugging
1.22 aaron 873: .Nm mail .
1.1 deraadt 874: .It Ar dot
875: The binary option
876: .Ar dot
877: causes
878: .Nm mail
879: to interpret a period alone on a line as the terminator
880: of a message you are sending.
881: .It Ar hold
882: This option is used to hold messages in the system mailbox
883: by default.
884: .It Ar ignore
885: Causes interrupt signals from your terminal to be ignored and echoed as
886: @'s.
887: .It Ar ignoreeof
888: An option related to
889: .Ar dot
890: is
891: .Ar ignoreeof
892: which makes
893: .Nm mail
894: refuse to accept a control-d as the end of a message.
895: .Ar Ignoreeof
896: also applies to
897: .Nm mail
898: command mode.
899: .It Ar metoo
900: Usually, when a group is expanded that contains the sender, the sender
901: is removed from the expansion.
902: Setting this option causes the sender
903: to be included in the group.
904: .It Ar noheader
905: Setting the option
906: .Ar noheader
907: is the same as giving the
908: .Fl N
909: flag on the command line.
910: .It Ar nosave
911: Normally, when you abort a message with two
912: .Tn RUBOUT
913: (erase or delete)
914: .Nm mail
915: copies the partial letter to the file
1.22 aaron 916: .Pa dead.letter
1.1 deraadt 917: in your home directory.
918: Setting the binary option
919: .Ar nosave
920: prevents this.
921: .It Ar Replyall
922: Reverses the sense of
923: .Ic reply
924: and
925: .Ic Reply
926: commands.
927: .It Ar quiet
928: Suppresses the printing of the version when first invoked.
929: .It Ar searchheaders
1.22 aaron 930: If this option is set, then a message-list specifier in the form
931: .Dq /x:y
932: will expand to all messages containing the substring
933: .Dq y
934: in the header
935: field
936: .Dq x .
937: The string search is case insensitive. If
938: .Dq x
939: is omitted, it will default to the
940: .Dq Subject
941: header field.
942: The form
943: .Dq /to:y
944: is a special case, and will expand
945: to all messages containing the substring
946: .Dq y
947: in the
948: .Dq To ,
949: .Dq Cc
950: or
951: .Dq Bcc
952: header fields.
953: The check for
954: .Dq to
955: is case sensitive, so that
956: .Dq /To:y
957: can be used to limit the search for
958: .Dq y
959: to just the
960: .Dq To:
961: field.
1.1 deraadt 962: .It Ar verbose
963: Setting the option
964: .Ar verbose
965: is the same as using the
966: .Fl v
967: flag on the command line.
968: When mail runs in verbose mode,
969: the actual delivery of messages is displayed on the user's
970: terminal.
971: .El
1.22 aaron 972: .Ss Option string values
1.1 deraadt 973: .Bl -tag -width Va
974: .It Ev EDITOR
975: Pathname of the text editor to use in the
976: .Ic edit
977: command and
978: .Ic \&~e
979: escape.
980: If not defined, then a default editor is used.
981: .It Ev LISTER
982: Pathname of the directory lister to use in the
983: .Ic folders
984: command.
985: Default is
986: .Pa /bin/ls .
987: .It Ev PAGER
988: Pathname of the program to use in the
989: .Ic more
990: command or when
991: .Ic crt
992: variable is set.
993: The default paginator
994: .Xr more 1
995: is used if this option is not defined.
996: .It Ev SHELL
997: Pathname of the shell to use in the
998: .Ic \&!
999: command and the
1000: .Ic \&~!
1001: escape.
1002: A default shell is used if this option is
1003: not defined.
1004: .It Ev VISUAL
1005: Pathname of the text editor to use in the
1006: .Ic visual
1007: command and
1008: .Ic \&~v
1009: escape.
1.5 millert 1010: .ne li
1.1 deraadt 1011: .It Va crt
1012: The valued option
1013: .Va crt
1014: is used as a threshold to determine how long a message must
1015: be before
1016: .Ev PAGER
1017: is used to read it.
1018: If
1019: .Va crt
1020: is set without a value,
1021: then the height of the terminal screen stored in the system
1022: is used to compute the threshold (see
1023: .Xr stty 1 ) .
1024: .It Ar escape
1025: If defined, the first character of this option gives the character to
1026: use in the place of ~ to denote escapes.
1027: .It Ar folder
1028: The name of the directory to use for storing folders of
1029: messages.
1.22 aaron 1030: If this name begins with a
1031: .Dq / ,
1.1 deraadt 1032: .Nm mail
1033: considers it to be an absolute pathname; otherwise, the
1034: folder directory is found relative to your home directory.
1035: .It Ev MBOX
1036: The name of the
1037: .Ar mbox
1038: file.
1039: It can be the name of a folder.
1040: The default is
1041: .Dq Li mbox
1042: in the user's home directory.
1043: .It Ar record
1044: If defined, gives the pathname of the file used to record all outgoing
1045: mail.
1046: If not defined, then outgoing mail is not so saved.
1047: .It Ar indentprefix
1.24 ! aaron 1048: String used by the
1.22 aaron 1049: .Ic \&~m
1050: tilde escape for indenting messages, in place of the normal tab character
1051: .Pq Sq ^I
1.1 deraadt 1052: Be sure to quote the value if it contains
1053: spaces or tabs.
1054: .It Ar toplines
1055: If defined, gives the number of lines of a message to be printed out
1056: with the
1057: .Ic top
1058: command; normally, the first five lines are printed.
1059: .El
1060: .Sh ENVIRONMENT
1.19 aaron 1061: .Nm mail
1.1 deraadt 1062: utilizes the
1.3 millert 1063: .Ev HOME ,
1064: .Ev LOGNAME ,
1.1 deraadt 1065: and
1066: .Ev USER
1067: environment variables.
1.12 millert 1068: .Pp
1069: If the
1070: .Ev MAIL
1071: environment variable is set, its value is used as the path to the
1072: user's mail spool.
1.1 deraadt 1073: .Sh FILES
1074: .Bl -tag -width /usr/share/misc/mail.*help -compact
1075: .It Pa /var/mail/*
1.22 aaron 1076: post office (unless overridden by the
1.12 millert 1077: .Ev MAIL
1.22 aaron 1078: environment variable)
1.1 deraadt 1079: .It ~/mbox
1.22 aaron 1080: user's old mail
1.1 deraadt 1081: .It ~/.mailrc
1.22 aaron 1082: file giving initial mail commands; can be overridden by setting the
1.5 millert 1083: .Ev MAILRC
1.22 aaron 1084: environment variable
1.1 deraadt 1085: .It Pa /tmp/R*
1.22 aaron 1086: temporary files
1.1 deraadt 1087: .It Pa /usr/share/misc/mail.*help
1.22 aaron 1088: help files
1.1 deraadt 1089: .It Pa /etc/mail.rc
1.22 aaron 1090: system initialization file
1.1 deraadt 1091: .El
1092: .Sh SEE ALSO
1093: .Xr fmt 1 ,
1.17 millert 1094: .Xr lockspool 1 ,
1.1 deraadt 1095: .Xr newaliases 1 ,
1096: .Xr vacation 1 ,
1097: .Xr aliases 5 ,
1098: .Xr mailaddr 7 ,
1.12 millert 1099: .Xr mail.local 8 ,
1.1 deraadt 1100: .Xr sendmail 8
1101: .Rs
1.22 aaron 1102: .%T "The Mail Reference Manual"
1.1 deraadt 1103: .Re
1104: .Sh HISTORY
1105: A
1106: .Nm mail
1107: command
1108: appeared in
1109: .At v6 .
1110: This man page is derived from
1111: .%T "The Mail Reference Manual"
1112: originally written by Kurt Shoens.
1113: .Sh BUGS
1114: There are some flags that are not documented here.
1115: Most are
1116: not useful to the general user.
1117: .Pp
1118: Usually,
1119: .Nm mail
1.11 deraadt 1120: and
1121: .Nm mailx
1122: are just links to
1.22 aaron 1123: .Nm Mail ,
1.1 deraadt 1124: which can be confusing.