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