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