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