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

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