[BACK]Return to mail.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / mail

Annotation of src/usr.bin/mail/mail.1, Revision 1.30

1.30    ! deraadt     1: .\"    $OpenBSD: mail.1,v 1.29 2000/04/12 21:47:48 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
1.30    ! deraadt   278: .Pa /etc/mail/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.29      aaron     693: .Pf ( Ar without
                    694: the header)
1.16      millert   695: is saved.
1.1       deraadt   696: Extremely useful for such tasks as sending and receiving source
                    697: program text over the message system.
                    698: .It Ic xit
                    699: .Pq Ic x
                    700: A synonym for
1.22      aaron     701: .Ic exit .
1.1       deraadt   702: .It Ic z
1.19      aaron     703: .Nm mail
1.1       deraadt   704: presents message headers in windowfuls as described under the
                    705: .Ic headers
                    706: command.
                    707: You can move
                    708: .Nm mail Ns 's
                    709: attention forward to the next window with the
                    710: .Ic \&z
                    711: command.
                    712: Also, you can move to the previous window by using
1.22      aaron     713: .Ic \&z\&\- .
1.1       deraadt   714: .El
1.22      aaron     715: .Ss Tilde/escapes
1.1       deraadt   716: Here is a summary of the tilde escapes,
                    717: which are used when composing messages to perform
                    718: special functions.
                    719: Tilde escapes are only recognized at the beginning
                    720: of lines.
                    721: The name
1.22      aaron     722: .Dq tilde escape
1.1       deraadt   723: is somewhat of a misnomer since the actual escape character can be set
                    724: by the option
                    725: .Ic escape .
                    726: .Bl -tag -width Ds
                    727: .It Ic \&~! Ns Ar command
                    728: Execute the indicated shell command, then return to the message.
                    729: .It Ic \&~b Ns Ar name ...
                    730: Add the given names to the list of carbon copy recipients but do not make
                    731: the names visible in the Cc: line ("blind" carbon copy).
                    732: .It Ic \&~c Ns Ar name ...
                    733: Add the given names to the list of carbon copy recipients.
                    734: .It Ic \&~d
                    735: Read the file
1.22      aaron     736: .Pa dead.letter
1.1       deraadt   737: from your home directory into the message.
                    738: .It Ic \&~e
                    739: Invoke the text editor on the message collected so far.
                    740: After the
                    741: editing session is finished, you may continue appending text to the
                    742: message.
                    743: .It Ic \&~f Ns Ar messages
                    744: Read the named messages into the message being sent.
                    745: If no messages are specified, read in the current message.
                    746: Message headers currently being ignored (by the
                    747: .Ic ignore
                    748: or
                    749: .Ic retain
                    750: command) are not included.
1.5       millert   751: .ne li
1.1       deraadt   752: .It Ic \&~F Ns Ar messages
                    753: Identical to
                    754: .Ic \&~f ,
                    755: except all message headers are included.
                    756: .It Ic \&~h
                    757: Edit the message header fields by typing each one in turn and allowing
                    758: the user to append text to the end or modify the field by using the
                    759: current terminal erase and kill characters.
                    760: .It Ic \&~m Ns Ar messages
                    761: Read the named messages into the message being sent, indented by a
                    762: tab or by the value of
1.25      aaron     763: .Va indentprefix .
1.1       deraadt   764: If no messages are specified,
                    765: read the current message.
                    766: Message headers currently being ignored (by the
                    767: .Ic ignore
                    768: or
                    769: .Ic retain
                    770: command) are not included.
                    771: .It Ic \&~M Ns Ar messages
                    772: Identical to
                    773: .Ic \&~m ,
                    774: except all message headers are included.
                    775: .It Ic \&~p
                    776: Print out the message collected so far, prefaced by the message header
                    777: fields.
                    778: .It Ic \&~q
                    779: Abort the message being sent, copying the message to
1.22      aaron     780: .Pa dead.letter
1.1       deraadt   781: in your home directory if
                    782: .Ic save
                    783: is set.
                    784: .It Ic \&~r Ns Ar filename
                    785: Read the named file into the message.
                    786: .It Ic \&~s Ns Ar string
                    787: Cause the named string to become the current subject field.
                    788: .It Ic \&~\&t Ns Ar name ...
                    789: Add the given names to the direct recipient list.
                    790: .It Ic \&~\&v
                    791: Invoke an alternate editor (defined by the
                    792: .Ev VISUAL
                    793: option) on the
                    794: message collected so far.
                    795: Usually, the alternate editor will be a
                    796: screen editor.
                    797: After you quit the editor, you may resume appending
                    798: text to the end of your message.
                    799: .It Ic \&~w Ns Ar filename
                    800: Write the message onto the named file.
                    801: .It Ic \&~\&| Ns Ar command
                    802: Pipe the message through the command as a filter.
                    803: If the command gives
                    804: no output or terminates abnormally, retain the original text of the
                    805: message.
                    806: The command
                    807: .Xr fmt 1
                    808: is often used as
                    809: .Ic command
                    810: to rejustify the message.
                    811: .It Ic \&~: Ns Ar mail-command
                    812: Execute the given mail command.
                    813: Not all commands, however, are allowed.
                    814: .It Ic \&~~ Ns Ar string
                    815: Insert the string of text in the message prefaced by a single ~.
                    816: If
                    817: you have changed the escape character, then you should double
                    818: that character in order to send it.
                    819: .El
1.22      aaron     820: .Ss Mail options
1.1       deraadt   821: Options are controlled via
                    822: .Ic set
                    823: and
                    824: .Ic unset
                    825: commands.
                    826: Options may be either binary, in which case it is only
                    827: significant to see whether they are set or not; or string, in which
                    828: case the actual value is of interest.
                    829: The binary options include the following:
                    830: .Bl -tag -width append
                    831: .It Ar append
                    832: Causes messages saved in
                    833: .Ar mbox
                    834: to be appended to the end rather than prepended.
                    835: This should always be set (perhaps in
                    836: .Pa /etc/mail.rc ) .
1.25      aaron     837: .It Ar ask , asksub
1.1       deraadt   838: Causes
                    839: .Nm mail
                    840: to prompt you for the subject of each message you send.
                    841: If
                    842: you respond with simply a newline, no subject field will be sent.
1.5       millert   843: .ne li
1.1       deraadt   844: .It Ar askcc
                    845: Causes you to be prompted for additional carbon copy recipients at the
                    846: end of each message.
                    847: Responding with a newline indicates your
                    848: satisfaction with the current list.
1.5       millert   849: .It Ar autoinc
                    850: Causes new mail to be automatically incorporated when it arrives.
                    851: Setting this is similar to issuing the
                    852: .Ic inc
                    853: command at each prompt, except that the current message is not
                    854: reset when new mail arrives.
1.1       deraadt   855: .It Ar askbcc
                    856: Causes you to be prompted for additional blind carbon copy recipients at the
                    857: end of each message.
                    858: Responding with a newline indicates your
                    859: satisfaction with the current list.
                    860: .It Ar autoprint
                    861: Causes the
                    862: .Ic delete
                    863: command to behave like
1.25      aaron     864: .Ic dp ;
                    865: thus, after deleting a message, the next one will be typed
1.1       deraadt   866: automatically.
                    867: .It Ar debug
                    868: Setting the binary option
                    869: .Ar debug
                    870: is the same as specifying
                    871: .Fl d
                    872: on the command line and causes
                    873: .Nm mail
                    874: to output all sorts of information useful for debugging
1.22      aaron     875: .Nm mail .
1.1       deraadt   876: .It Ar dot
                    877: The binary option
                    878: .Ar dot
                    879: causes
                    880: .Nm mail
                    881: to interpret a period alone on a line as the terminator
                    882: of a message you are sending.
                    883: .It Ar hold
                    884: This option is used to hold messages in the system mailbox
                    885: by default.
                    886: .It Ar ignore
                    887: Causes interrupt signals from your terminal to be ignored and echoed as
                    888: @'s.
                    889: .It Ar ignoreeof
                    890: An option related to
                    891: .Ar dot
                    892: is
                    893: .Ar ignoreeof
                    894: which makes
                    895: .Nm mail
                    896: refuse to accept a control-d as the end of a message.
1.25      aaron     897: .Ar ignoreeof
1.1       deraadt   898: also applies to
                    899: .Nm mail
                    900: command mode.
                    901: .It Ar metoo
                    902: Usually, when a group is expanded that contains the sender, the sender
                    903: is removed from the expansion.
                    904: Setting this option causes the sender
                    905: to be included in the group.
                    906: .It Ar noheader
                    907: Setting the option
                    908: .Ar noheader
                    909: is the same as giving the
                    910: .Fl N
                    911: flag on the command line.
                    912: .It Ar nosave
                    913: Normally, when you abort a message with two
                    914: .Tn RUBOUT
                    915: (erase or delete)
                    916: .Nm mail
                    917: copies the partial letter to the file
1.22      aaron     918: .Pa dead.letter
1.1       deraadt   919: in your home directory.
                    920: Setting the binary option
                    921: .Ar nosave
                    922: prevents this.
                    923: .It Ar Replyall
                    924: Reverses the sense of
                    925: .Ic reply
                    926: and
                    927: .Ic Reply
                    928: commands.
                    929: .It Ar quiet
                    930: Suppresses the printing of the version when first invoked.
                    931: .It Ar searchheaders
1.22      aaron     932: If this option is set, then a message-list specifier in the form
                    933: .Dq /x:y
                    934: will expand to all messages containing the substring
                    935: .Dq y
                    936: in the header
                    937: field
                    938: .Dq x .
1.27      aaron     939: The string search is case insensitive.
                    940: If
1.22      aaron     941: .Dq x
                    942: is omitted, it will default to the
                    943: .Dq Subject
                    944: header field.
                    945: The form
                    946: .Dq /to:y
                    947: is a special case, and will expand
                    948: to all messages containing the substring
                    949: .Dq y
                    950: in the
                    951: .Dq To ,
                    952: .Dq Cc
                    953: or
                    954: .Dq Bcc
                    955: header fields.
                    956: The check for
                    957: .Dq to
                    958: is case sensitive, so that
                    959: .Dq /To:y
                    960: can be used to limit the search for
                    961: .Dq y
                    962: to just the
                    963: .Dq To:
                    964: field.
1.1       deraadt   965: .It Ar verbose
                    966: Setting the option
                    967: .Ar verbose
                    968: is the same as using the
                    969: .Fl v
                    970: flag on the command line.
                    971: When mail runs in verbose mode,
                    972: the actual delivery of messages is displayed on the user's
                    973: terminal.
                    974: .El
1.22      aaron     975: .Ss Option string values
1.1       deraadt   976: .Bl -tag -width Va
                    977: .It Ev EDITOR
                    978: Pathname of the text editor to use in the
                    979: .Ic edit
                    980: command and
                    981: .Ic \&~e
                    982: escape.
                    983: If not defined, then a default editor is used.
                    984: .It Ev LISTER
                    985: Pathname of the directory lister to use in the
                    986: .Ic folders
                    987: command.
                    988: Default is
                    989: .Pa /bin/ls .
                    990: .It Ev PAGER
                    991: Pathname of the program to use in the
                    992: .Ic more
                    993: command or when
                    994: .Ic crt
                    995: variable is set.
                    996: The default paginator
                    997: .Xr more 1
                    998: is used if this option is not defined.
                    999: .It Ev SHELL
                   1000: Pathname of the shell to use in the
                   1001: .Ic \&!
                   1002: command and the
                   1003: .Ic \&~!
                   1004: escape.
                   1005: A default shell is used if this option is
                   1006: not defined.
                   1007: .It Ev VISUAL
                   1008: Pathname of the text editor to use in the
                   1009: .Ic visual
                   1010: command and
                   1011: .Ic \&~v
                   1012: escape.
1.5       millert  1013: .ne li
1.1       deraadt  1014: .It Va crt
                   1015: The valued option
                   1016: .Va crt
                   1017: is used as a threshold to determine how long a message must
                   1018: be before
                   1019: .Ev PAGER
                   1020: is used to read it.
                   1021: If
                   1022: .Va crt
                   1023: is set without a value,
                   1024: then the height of the terminal screen stored in the system
                   1025: is used to compute the threshold (see
                   1026: .Xr stty 1 ) .
                   1027: .It Ar escape
                   1028: If defined, the first character of this option gives the character to
                   1029: use in the place of ~ to denote escapes.
                   1030: .It Ar folder
                   1031: The name of the directory to use for storing folders of
                   1032: messages.
1.22      aaron    1033: If this name begins with a
1.25      aaron    1034: .Ql / ,
1.1       deraadt  1035: .Nm mail
                   1036: considers it to be an absolute pathname; otherwise, the
                   1037: folder directory is found relative to your home directory.
                   1038: .It Ev MBOX
                   1039: The name of the
                   1040: .Ar mbox
                   1041: file.
                   1042: It can be the name of a folder.
                   1043: The default is
                   1044: .Dq Li mbox
                   1045: in the user's home directory.
                   1046: .It Ar record
                   1047: If defined, gives the pathname of the file used to record all outgoing
                   1048: mail.
                   1049: If not defined, then outgoing mail is not so saved.
                   1050: .It Ar indentprefix
1.24      aaron    1051: String used by the
1.22      aaron    1052: .Ic \&~m
                   1053: tilde escape for indenting messages, in place of the normal tab character
                   1054: .Pq Sq ^I
1.1       deraadt  1055: Be sure to quote the value if it contains
                   1056: spaces or tabs.
                   1057: .It Ar toplines
                   1058: If defined, gives the number of lines of a message to be printed out
                   1059: with the
                   1060: .Ic top
                   1061: command; normally, the first five lines are printed.
                   1062: .El
                   1063: .Sh ENVIRONMENT
1.19      aaron    1064: .Nm mail
1.1       deraadt  1065: utilizes the
1.3       millert  1066: .Ev HOME ,
                   1067: .Ev LOGNAME ,
1.1       deraadt  1068: and
                   1069: .Ev USER
                   1070: environment variables.
1.12      millert  1071: .Pp
                   1072: If the
                   1073: .Ev MAIL
                   1074: environment variable is set, its value is used as the path to the
                   1075: user's mail spool.
1.1       deraadt  1076: .Sh FILES
                   1077: .Bl -tag -width /usr/share/misc/mail.*help -compact
                   1078: .It Pa /var/mail/*
1.22      aaron    1079: post office (unless overridden by the
1.12      millert  1080: .Ev MAIL
1.22      aaron    1081: environment variable)
1.1       deraadt  1082: .It ~/mbox
1.22      aaron    1083: user's old mail
1.1       deraadt  1084: .It ~/.mailrc
1.22      aaron    1085: file giving initial mail commands; can be overridden by setting the
1.5       millert  1086: .Ev MAILRC
1.22      aaron    1087: environment variable
1.1       deraadt  1088: .It Pa /tmp/R*
1.22      aaron    1089: temporary files
1.1       deraadt  1090: .It Pa /usr/share/misc/mail.*help
1.22      aaron    1091: help files
1.1       deraadt  1092: .It Pa /etc/mail.rc
1.22      aaron    1093: system initialization file
1.1       deraadt  1094: .El
                   1095: .Sh SEE ALSO
                   1096: .Xr fmt 1 ,
1.17      millert  1097: .Xr lockspool 1 ,
1.1       deraadt  1098: .Xr newaliases 1 ,
                   1099: .Xr vacation 1 ,
                   1100: .Xr aliases 5 ,
                   1101: .Xr mailaddr 7 ,
1.12      millert  1102: .Xr mail.local 8 ,
1.1       deraadt  1103: .Xr sendmail 8
                   1104: .Rs
1.22      aaron    1105: .%T "The Mail Reference Manual"
1.1       deraadt  1106: .Re
                   1107: .Sh HISTORY
                   1108: A
                   1109: .Nm mail
1.28      aaron    1110: command appeared in
                   1111: .At v5 .
1.1       deraadt  1112: This man page is derived from
                   1113: .%T "The Mail Reference Manual"
                   1114: originally written by Kurt Shoens.
                   1115: .Sh BUGS
                   1116: There are some flags that are not documented here.
                   1117: Most are
                   1118: not useful to the general user.
                   1119: .Pp
                   1120: Usually,
                   1121: .Nm mail
1.11      deraadt  1122: and
                   1123: .Nm mailx
                   1124: are just links to
1.22      aaron    1125: .Nm Mail ,
1.1       deraadt  1126: which can be confusing.