PageRenderTime 25ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/usr.bin/mail/mail.1

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