1.\" $OpenBSD: mail.1,v 1.83 2022/03/31 17:27:25 naddy 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: March 31 2022 $ 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, 460.Ar mbox 461file, or 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 the 585.Ar mbox 586file in the user's login directory, preserving all messages marked with 587.Ic hold 588or 589.Ic preserve 590or never referenced in the user's system mailbox, 591and removing all other messages from the user's system mailbox. 592If new mail has arrived during the session, the message 593.Dq Li "You have new mail" 594is given. 595If given while editing a 596mailbox file with the 597.Fl f 598flag, then the edit file is rewritten. 599A return to the shell is 600effected, unless the rewrite of edit file fails, in which case the user 601can escape with the 602.Ic exit 603command. 604.It Ic Reply 605.Pq Ic R 606Reply to originator. 607Does not reply to other 608recipients of the original message. 609.It Ic reply 610.Pq Ic r 611Takes a message list and sends mail to the sender and all 612recipients of the specified message. 613The default message must not be deleted. 614.It Ic respond 615A synonym for 616.Ic reply . 617.It Ic retain 618Add the list of header fields named to the 619.Ar retained list . 620Only the header fields in the retain list 621are shown on your terminal when you print a message. 622All other header fields are suppressed. 623The 624.Ic Type 625and 626.Ic Print 627commands can be used to print a message in its entirety. 628If 629.Ic retain 630is executed with no arguments, it lists the current set of 631retained fields. 632.It Ic save 633.Pq Ic s 634Takes a message list and a filename and appends each message in 635turn to the end of the file. 636The filename in quotes, followed by the line 637count and character count is echoed on the user's terminal. 638.It Ic saveignore 639.Ic saveignore 640is to 641.Ic save 642what 643.Ic ignore 644is to 645.Ic print 646and 647.Ic type . 648Header fields thus marked are filtered out when 649saving a message by 650.Ic save 651or when automatically saving to 652.Ar mbox . 653.It Ic saveretain 654.Ic saveretain 655is to 656.Ic save 657what 658.Ic retain 659is to 660.Ic print 661and 662.Ic type . 663Header fields thus marked are the only ones saved 664with a message when saving by 665.Ic save 666or when automatically saving to 667.Ar mbox . 668.Ic saveretain 669overrides 670.Ic saveignore . 671.It Ic set 672.Pq Ic se 673With no arguments, prints all variable values. 674Otherwise, sets 675option. 676Arguments are of the form 677.Ar option=value 678(no space before or after =) or 679.Ar option . 680Quotation marks may be placed around any part of the assignment statement to 681quote blanks or tabs, i.e., 682.Ic set indentprefix="->" . 683.It Ic shell 684.Pq Ic sh 685Invokes an interactive version of the shell. 686.It Ic size 687Takes a message list and prints out the size in characters of each 688message. 689.It Ic source 690The 691.Ic source 692command reads 693commands from a file. 694.It Ic top 695Takes a message list and prints the top few lines of each. 696The number of 697lines printed is controlled by the variable 698.Ic toplines 699and defaults to five. 700.It Ic Type 701.Pq Ic T 702Identical to the 703.Ic Print 704command. 705.It Ic type 706.Pq Ic t 707A synonym for 708.Ic print . 709.It Ic unalias 710Takes a list of names defined by 711.Ic alias 712commands and discards the remembered groups of users. 713The group names 714no longer have any significance. 715.It Ic undelete 716.Pq Ic u 717Takes a message list and marks each message as not being deleted. 718.It Ic unread 719.Pq Ic U 720Takes a message list and marks each message as not having been read. 721.It Ic unset 722Takes a list of option names and discards their remembered values; 723the inverse of 724.Ic set . 725.It Ic visual 726.Pq Ic v 727Takes a message list and invokes the display editor on each message. 728.It Ic write 729.Pq Ic w 730Similar to 731.Ic save , 732except that 733.Ic only 734the message body 735(without the header) 736is saved. 737Extremely useful for such tasks as sending and receiving source 738program text over the message system. 739.It Ic xit 740.Pq Ic x 741A synonym for 742.Ic exit . 743.It Ic z 744.Nm mail 745presents message headers in windowfuls as described under the 746.Ic headers 747command. 748You can move 749.Nm mail Ns 's 750attention forward to the next window with the 751.Ic z 752command. 753Also, you can move to the previous window by using 754.Ic z- . 755.El 756.Ss Tilde/escapes 757Here is a summary of the tilde escapes, 758which are used when composing messages to perform 759special functions. 760Tilde escapes are only recognized at the beginning 761of lines. 762The name 763.Dq tilde escape 764is somewhat of a misnomer since the actual escape character can be set 765by the option 766.Ic escape . 767.Pp 768.Bl -tag -width Ds -compact 769.It Ic ~b Ns Ar name ... 770Add the given names to the list of carbon copy recipients but do not make 771the names visible in the Cc: line ("blind" carbon copy). 772.Pp 773.It Ic ~c Ns Ar name ... 774Add the given names to the list of carbon copy recipients. 775.Pp 776.It Ic ~d 777Read the file 778.Pa dead.letter 779from your home directory into the message. 780.Pp 781.It Ic ~e 782Invoke the text editor on the message collected so far. 783After the 784editing session is finished, you may continue appending text to the 785message. 786.Pp 787.It Ic ~F Ns Ar messages 788Identical to 789.Ic ~f , 790except all message headers are included. 791.Pp 792.It Ic ~f Ns Ar messages 793Read the named messages into the message being sent. 794If no messages are specified, read in the current message. 795Message headers currently being ignored (by the 796.Ic ignore 797or 798.Ic retain 799command) are not included. 800.Pp 801.It Ic ~h 802Edit the message header fields by typing each one in turn and allowing 803the user to append text to the end or modify the field by using the 804current terminal erase and kill characters. 805.Pp 806.It Ic ~M Ns Ar messages 807Identical to 808.Ic ~m , 809except all message headers are included. 810.Pp 811.It Ic ~m Ns Ar messages 812Read the named messages into the message being sent, indented by a 813tab or by the value of 814.Va indentprefix . 815If no messages are specified, 816read the current message. 817Message headers currently being ignored (by the 818.Ic ignore 819or 820.Ic retain 821command) are not included. 822.Pp 823.It Ic ~p 824Print out the message collected so far, prefaced by the message header 825fields. 826.Pp 827.It Ic ~q 828Abort the message being sent, copying the message to 829.Pa dead.letter 830in your home directory if 831.Ic save 832is set. 833.Pp 834.It Ic ~r Ns Ar filename 835.It Ic ~< Ns Ar filename 836Read the named file into the message. 837.Pp 838.It Ic ~s Ns Ar string 839Cause the named string to become the current subject field. 840.Pp 841.It Ic ~t Ns Ar name ... 842Add the given names to the direct recipient list. 843.Pp 844.It Ic ~v 845Invoke an alternate editor (defined by the 846.Ev VISUAL 847option) on the 848message collected so far. 849Usually, the alternate editor will be a 850screen editor. 851After you quit the editor, you may resume appending 852text to the end of your message. 853.Pp 854.It Ic ~w Ns Ar filename 855Write the message onto the named file. 856.Pp 857.It Ic ~x 858Abort the message being sent. 859No message is copied to 860.Pa ~/dead.letter , 861even if 862.Ic save 863is set. 864.Pp 865.It Ic ~? 866Prints a brief summary of tilde escapes. 867.Pp 868.It Ic ~! Ns Ar command 869Execute the indicated shell command, then return to the message. 870.Pp 871.It Ic ~| Ns Ar command 872Pipe the message through the command as a filter. 873If the command gives 874no output or terminates abnormally, retain the original text of the 875message. 876The command 877.Xr fmt 1 878is often used as 879.Ic command 880to rejustify the message. 881.Pp 882.It Ic ~: Ns Ar mail-command 883.It Ic ~_ Ns Ar mail-command 884Execute the given mail command. 885Not all commands, however, are allowed. 886.Pp 887.It Ic ~~ Ns Ar string 888Insert the string of text in the message prefaced by a single ~. 889If 890you have changed the escape character, then you should double 891that character in order to send it. 892.Pp 893.It Ic ~. 894Simulate end of file on input. 895.El 896.Ss Mail options 897A number of options can be set in the 898.Pa .mailrc 899file to alter the behavior of 900.Nm , 901controlled via the 902.Ic set 903and 904.Ic unset 905commands. 906Options may be either binary, in which case it is only 907significant to see whether they are set or not; or string, in which 908case the actual value is of interest. 909The binary options include the following: 910.Bl -tag -width append 911.It Ar append 912Causes messages saved in 913.Ar mbox 914to be appended to the end rather than prepended. 915This should always be set (perhaps in 916.Pa /etc/mail.rc ) . 917.It Ar ask , asksub 918Causes 919.Nm mail 920to prompt you for the subject of each message you send. 921If 922you respond with simply a newline, no subject field will be sent. 923.It Ar askbcc 924Causes you to be prompted for additional blind carbon copy recipients at the 925end of each message. 926Responding with a newline indicates your 927satisfaction with the current list. 928.It Ar askcc 929Causes you to be prompted for additional carbon copy recipients at the 930end of each message. 931Responding with a newline indicates your 932satisfaction with the current list. 933.It Ar autoinc 934Causes new mail to be automatically incorporated when it arrives. 935Setting this is similar to issuing the 936.Ic inc 937command at each prompt, except that the current message is not 938reset when new mail arrives. 939.It Ar autoprint 940Causes the 941.Ic delete 942command to behave like 943.Ic dp ; 944thus, after deleting a message, the next one will be typed 945automatically. 946.It Ar debug 947Setting the binary option 948.Ar debug 949is the same as specifying 950.Fl d 951on the command line and causes 952.Nm mail 953to output all sorts of information useful for debugging 954.Nm mail . 955.It Ar dot 956The binary option 957.Ar dot 958causes 959.Nm mail 960to interpret a period alone on a line as the terminator 961of a message you are sending. 962.It Ar expandaddr 963Causes 964.Nm mail 965to expand message recipient addresses, as explained in the section 966.Sx Recipient address specifications . 967.It Ar from 968Causes 969.Nm mail 970to use the specified sender address in the 971.Dq From: 972field of the message header. 973A stripped down version of the address is also used in the message envelope. 974If unset, the message will not include an explicit sender address and 975a default value will be added by the MTA, typically 976.Dq user@host . 977This value can be overridden by specifying the 978.Fl r 979flag on the command line. 980.It Ar hold 981This option is used to hold messages in the system mailbox 982by default. 983.It Ar ignore 984Causes interrupt signals from your terminal to be ignored and echoed as 985@'s. 986.It Ar ignoreeof 987An option related to 988.Ar dot 989is 990.Ar ignoreeof 991which makes 992.Nm mail 993refuse to accept a control-D as the end of a message. 994.Ar ignoreeof 995also applies to 996.Nm mail 997command mode. 998.It Ar keep 999Setting this option causes 1000.Nm 1001to truncate your system mailbox instead of deleting it 1002when it's empty. 1003.It Ar keepsave 1004Messages saved with the 1005.Ic save 1006command are not normally saved in 1007.Ar mbox 1008at quit time. 1009Use this option to retain those messages. 1010.It Ar metoo 1011Usually, when a group is expanded that contains the sender, the sender 1012is removed from the expansion. 1013Setting this option causes the sender 1014to be included in the group. 1015.It Ar noheader 1016Setting the option 1017.Ar noheader 1018is the same as giving the 1019.Fl N 1020flag on the command line. 1021.It Ar nosave 1022Normally, when you abort a message with two interrupt characters 1023(usually control-C), 1024.Nm mail 1025copies the partial letter to the file 1026.Pa dead.letter 1027in your home directory. 1028Setting the binary option 1029.Ar nosave 1030prevents this. 1031.It Ar quiet 1032Suppresses the printing of the version when first invoked. 1033.It Ar Replyall 1034Reverses the sense of 1035.Ic reply 1036and 1037.Ic Reply 1038commands. 1039.It Ar searchheaders 1040If this option is set, then a message-list specifier in the form 1041.Dq /x:y 1042will expand to all messages containing the substring 1043.Sq y 1044in the header 1045field 1046.Sq x . 1047The string search is case insensitive. 1048If 1049.Sq x 1050is omitted, it will default to the 1051.Dq Subject 1052header field. 1053The form 1054.Dq /to:y 1055is a special case, and will expand 1056to all messages containing the substring 1057.Sq y 1058in the 1059.Dq To , 1060.Dq Cc 1061or 1062.Dq Bcc 1063header fields. 1064The check for 1065.Dq to 1066is case sensitive, so that 1067.Dq /To:y 1068can be used to limit the search for 1069.Sq y 1070to just the 1071.Dq To: 1072field. 1073.It Ar skipempty 1074Don't send messages with an empty body. 1075.It Ar verbose 1076Setting the option 1077.Ar verbose 1078is the same as using the 1079.Fl v 1080flag on the command line. 1081When 1082.Nm 1083runs in verbose mode, 1084the actual delivery of messages is displayed on the user's 1085terminal. 1086.El 1087.Ss Option string values 1088.Bl -tag -width Va 1089.It Ev EDITOR 1090Pathname of the text editor to use in the 1091.Ic edit 1092command and 1093.Ic ~e 1094escape. 1095If not defined, 1096.Pa /usr/bin/ex 1097is used. 1098.It Ev LISTER 1099Pathname of the directory lister to use in the 1100.Ic folders 1101command. 1102Default is 1103.Pa /bin/ls . 1104.It Ev MBOX 1105The name of the 1106.Ar mbox 1107file. 1108It can be the name of a folder. 1109The default is 1110.Dq Li mbox 1111in the user's home directory. 1112.It Ev PAGER 1113Pathname of the program to use in the 1114.Ic more 1115command or when the 1116.Ar crt 1117variable is set. 1118The default paginator 1119.Xr more 1 1120is used if this option is not defined. 1121.It Ev SHELL 1122Pathname of the shell to use in the 1123.Ic !\& 1124command and the 1125.Ic ~!\& 1126escape. 1127A default shell is used if this option is 1128not defined. 1129.It Ev VISUAL 1130Pathname of the text editor to use in the 1131.Ic visual 1132command and 1133.Ic ~v 1134escape. 1135If not defined, 1136.Pa /usr/bin/vi 1137is used. 1138.It Ar crt 1139The valued option 1140.Ar crt 1141is used as a threshold to determine how long a message must 1142be before 1143.Ev PAGER 1144is used to read it. 1145If 1146.Ar crt 1147is set without a value, 1148then the height of the terminal screen stored in the system 1149is used to compute the threshold (see 1150.Xr stty 1 ) . 1151.It Ar escape 1152If defined, the first character of this option gives the character to 1153use in the place of ~ to denote escapes. 1154.It Ar folder 1155The name of the directory to use for storing folders of 1156messages. 1157If this name begins with a 1158.Ql / , 1159.Nm mail 1160considers it to be an absolute pathname; otherwise, the 1161folder directory is found relative to your home directory. 1162.It Ar indentprefix 1163String used by the 1164.Ic ~m 1165tilde escape for indenting messages, in place of the normal tab character 1166.Pq Sq ^I . 1167Be sure to quote the value if it contains 1168spaces or tabs. 1169.It Ar record 1170If defined, gives the pathname of the file used to record all outgoing 1171mail. 1172If not defined, then outgoing mail is not so saved. 1173.It Ar screen 1174Size of window of message headers for 1175.Ic z . 1176.It Ar sendmail 1177Pathname to an alternative mail delivery system. 1178.It Ar toplines 1179If defined, gives the number of lines of a message to be printed out 1180with the 1181.Ic top 1182command; normally, the first five lines are printed. 1183.El 1184.Sh ENVIRONMENT 1185.Nm mail 1186utilizes the 1187.Ev HOME , 1188.Ev LOGNAME , 1189.Ev MAIL , 1190.Ev MAILRC , 1191and 1192.Ev USER 1193environment variables. 1194.Pp 1195If the 1196.Ev MAIL 1197environment variable is set, its value is used as the path to the 1198user's mail spool. 1199.Sh FILES 1200.Bl -tag -width /usr/share/misc/mail.*help -compact 1201.It Pa /var/mail/* 1202post office (unless overridden by the 1203.Ev MAIL 1204environment variable) 1205.It Pa ~/mbox 1206user's old mail 1207.It Pa ~/.mailrc 1208file giving initial mail commands; can be overridden by setting the 1209.Ev MAILRC 1210environment variable 1211.It Pa /tmp/R* 1212temporary files 1213.It Pa /usr/share/misc/mail.*help 1214help files 1215.It Pa /etc/mail.rc 1216system initialization file 1217.El 1218.Sh EXIT STATUS 1219.Ex -std mail 1220.Sh SEE ALSO 1221.Xr fmt 1 , 1222.Xr lockspool 1 , 1223.Xr vacation 1 , 1224.Xr aliases 5 , 1225.Xr mail.local 8 , 1226.Xr newaliases 8 , 1227.Xr sendmail 8 , 1228.Xr smtpd 8 1229.Rs 1230.\" 4.4BSD USD:7 1231.%A Kurt Shoens 1232.%T Mail Reference Manual 1233.%B 4.4BSD User's Supplementary Documents (USD) 1234.Re 1235.Sh STANDARDS 1236The 1237.Nm mailx 1238utility is compliant with the 1239.St -p1003.1-2008 1240specification. 1241.Pp 1242The flags 1243.Op Fl iNnu 1244are marked by 1245.St -p1003.1-2008 1246as being optional. 1247.Pp 1248The flags 1249.Op Fl eFH 1250are marked by 1251.St -p1003.1-2008 1252as being optional, 1253and are not supported by this implementation of 1254.Nm mailx . 1255.Pp 1256The flags 1257.Op Fl bcdEIrv 1258are extensions to the specification. 1259.Sh HISTORY 1260A 1261.Nm mail 1262command appeared in 1263.At v1 . 1264This man page is derived from the 1265.%T "Mail Reference Manual" 1266originally written by Kurt Shoens. 1267.Sh BUGS 1268Usually, 1269.Nm mail 1270and 1271.Nm mailx 1272are just links to 1273.Nm Mail , 1274which can be confusing. 1275