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