[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.62

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