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