1.\" $NetBSD: mail.1,v 1.64 2018/05/23 01:03:46 christos 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 May 22, 2018 33.Dt MAIL 1 34.Os 35.Sh NAME 36.Nm mail , 37.Nm mailx 38.Nd send and receive mail 39.Sh SYNOPSIS 40.Nm 41.Op Fl EIinv 42.Op Fl a Ar file 43.Op Fl b Ar bcc-addr 44.Op Fl c Ar cc-addr 45.Op Fl r Ar rcfile 46.Op Fl s Ar subject 47.Ar to-addr ... 48.Op - Ar sendmail-flags 49.Nm 50.Op Fl EIiNnv 51.Op Fl H Ns Op colon-modifier 52.Fl f 53.Op Ar name 54.Nm 55.Op Fl EIiNnv 56.Op Fl H Ns Op colon-modifier 57.Op Fl u Ar user 58.Sh DESCRIPTION 59.Nm 60is an intelligent mail processing system, which has 61a command syntax reminiscent of 62.Xr \&ed 1 63with lines replaced by messages. 64.Pp 65.Bl -tag -width flag 66.It Fl a 67Attach 68.Ar file 69to the message. 70.It Fl b 71Send blind carbon copies to 72.Ar list . 73List should be a comma-separated list of names. 74.It Fl c 75Send carbon copies to 76.Ar list 77of users. 78.It Fl E 79Don't send messages with an empty body. 80This is useful for piping errors from cron scripts. 81.It Fl f 82Read in the contents of your 83.Ar mbox 84(or the specified file) 85for processing; when you 86.Ic quit , 87.Nm 88writes undeleted messages back to this file. 89.It Fl H 90Print the header summaries and exit. 91The optional colon-modifier string must begin with a 92.Ql \&: 93and be followed by one or more of the characters described in the 94.Sx Specifying messages 95section below. 96E.g., 97.Do 98.Nm 99.Fl H Ns :n 100.Dc 101will display just new message headers. 102.It Fl I 103Forces mail to run in interactive mode even when 104input isn't a terminal. 105In particular, the 106.Ic \&~ 107special 108character when sending mail is only active in interactive mode. 109.It Fl i 110Ignore tty interrupt signals. 111This is particularly useful when using 112.Nm 113on noisy phone lines. 114.It Fl N 115Inhibits the initial display of message headers 116when reading mail or editing a mail folder. 117.It Fl n 118Inhibits reading 119.Pa /etc/mail.rc 120upon startup. 121.It Fl r 122Specify an alternate user rcfile to load. 123This overrides the value specified in the environment variable 124.Ev MAILRC 125which in turn overrides the default 126.Pa ~/.mailrc 127file. 128.It Fl s 129Specify subject on command line 130(only the first argument after the 131.Fl s 132flag is used as a subject; be careful to quote subjects 133containing spaces.) 134.It Fl u 135Is equivalent to: 136.Pp 137.Dl mail -f /var/mail/user 138.It Fl v 139Verbose mode. 140The details of delivery are displayed on the user's terminal. 141.El 142.Ss Sending mail 143To send a message to one or more people, 144.Nm 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 your message, followed by a 148.Ql control-D 149at the beginning of a line. 150.Pp 151Any flags following the list of recipients, will be passed, together 152with their arguments, directly to 153.Xr sendmail 1 . 154For example to change your 155.Dv From 156address to 157.Dv somebody@somewhere.net 158you can specify: 159.Pp 160.Dl mail recipient -f somebody@somewhere.net 161.Pp 162To prevent multiple copies of a message being sent to the same 163address, duplicate addresses (after alias expansion) are removed from 164the 165.Ar bcc-addr , 166.Ar cc-addr , 167and 168.Ar to-addr 169lists. 170In addition, addresses on the 171.Ar cc-addr 172and 173.Ar to-addr 174lists are removed if they occur on the 175.Ar bcc-addr 176list and addresses on the 177.Ar cc-addr 178list are removed if they occur on the 179.Ar to-addr 180list. 181If the 182.Ar to-addr 183list is empty after these deletions, most systems will insert the line 184.Dq To: undisclosed recipients:; . 185.Pp 186The section below 187.Sx Replying to or originating mail , 188describes some features of 189.Nm 190available to help you compose your letter. 191.Ss Reading mail 192In normal usage 193.Nm 194is given no arguments and checks your mail out of the post office, 195then prints out a one line header of each message found. 196The current message is initially the first message (numbered 1) 197and can be printed using the 198.Ic print 199command (which can be abbreviated 200.Ic p ) . 201You can move among the messages much as you move between lines in 202.Xr \&ed 1 , 203with the commands 204.Ic \&+ 205and 206.Ic \&\- 207moving backwards and forwards, and simple numbers. 208.Ss Disposing of mail 209After examining a message you can 210.Ic delete 211.Pq Ic d 212the message or 213.Ic reply 214.Pq Ic r 215to it. 216Deletion causes the 217.Nm 218program to forget about the message. 219This is not irreversible; the message can be 220.Ic undeleted 221.Pq Ic u 222by giving its number, or the 223.Nm 224session can be aborted by giving the 225.Ic exit 226.Pq Ic x 227command. 228Deleted messages will, however, usually disappear never to be seen again. 229.Ss Specifying messages 230Many commands (e.g., 231.Ic delete , 232.Ic from , 233and 234.Ic print ) 235accept a list of messages as an argument. 236Messages may be specified by their message number, by a range of 237messages, or by a pattern string matching certain fields in the header 238as described below. 239These message 240.Dq specs 241may be combined by the usual binary boolean operations 242.Ql & , 243.Ql \&| , 244and 245.Ql \&^ , 246which denote, respectively, a logical 247.Dq and , 248.Dq or , 249and 250.Dq xor . 251Logical expressions may be grouped with parentheses 252.Ql \&( 253and 254.Ql \&) 255and 256negated with 257.Ql \&! . 258If the binary operator is missing between two message specs, it is 259assumed to be a 260.Ql \&| . 261This is for simplicity, backwards compatibility, and also to to 262facilitate using the 263.Ql \&| 264symbol to denote a pipe. 265(See 266.Ar enable-pipes . ) 267.Pp 268Besides the obvious (base10) message numbers, the characters 269.Ql \&^ , 270.Ql \&- , 271.Ql \&. , 272.Ql \&+ , 273and 274.Ql \&$ 275denote, respectively, the first message, the message before the 276.Dq dot 277.Pq the current message , 278the 279.Dq dot 280message, the message following the 281.Dq dot , 282and the last message. 283.Pp 284A 285.Dq message range 286consists of two message numbers separated by a 287.Ql \&- . 288A 289.Ql \&* 290denotes all messages and is equivalent to 291.Ql ^-$ . 292.Pp 293A pattern is a string (not beginning with any of the above special 294characters). 295If it does not begin with a 296.Ql \&/ , 297it is compared with the senders address. 298If it begins with a 299.Ql \&/ , 300and 301.Ar searchheaders 302is not defined, the remainder of the string is compared with the 303subject field. 304(See 305.Ar searchheaders 306for searching other header fields or the message body.) 307If 308.Ar regex-search 309is not defined, then the comparison is a simple case insensitive 310substring match. 311(See 312.Ar regex-search 313for regular expression matches.) 314.Pp 315A list of messages may be restricted by a 316.Dq colon-modifier 317string, i.e., a 318.Ql \&: 319followed by one or more of the characters: 320.Bd -literal -offset indent 321d deleted 322e edited 323m mboxed 324n new 325o old 326p preserved 327r read 328s saved 329t tagged 330u unread and not new 331! invert the meaning of the colon-modifiers 332.Ed 333.Pp 334If there are no address specifications other than colon-modifiers, 335the colon-modifiers apply to all messages. 336Thus 337.Dq Li from netbsd :n 338would display the headers of all new messages with 339.Ql netbsd 340in the sender's address, while 341.Dq Li from :!r 342and 343.Dq Li from :nu 344would both display all new and unread messages. 345Multiple colon-modifiers may be specified and a single 346.Ql \&: 347with no letters following indicates the colon-modifier from the 348preceding command. 349.Pp 350For example: 351.Bd -literal -offset indent 352from 1 12 3-5 353.Ed 354.Pp 355would display the headers from messages 1, 3, 4, 5, and 12. 356.Bd -literal -offset indent 357from anon & ( /foo | /bar ) 358.Ed 359.Pp 360would display all headers that had 361.Ql anon 362in the sender's address and either 363.Ql foo 364or 365.Ql bar 366in the subject line. 367.Pp 368Generally, commands cannot select messages that are not displayed, 369such as deleted or hidden messages, the exception being the 370.Ic undelete 371command. 372.Ss Replying to or originating mail 373You can use the 374.Ic reply 375command to set up a response to a message, sending it back to the 376person who it was from. 377Text you then type in, up to an end-of-file, 378defines the contents of the message. 379While you are composing a message, 380.Nm 381treats lines beginning with the character 382.Ic \&~ 383specially. 384For instance, typing 385.Ic \&~m 386(alone on a line) will place a copy 387of the current message into the response right shifting it by a tab stop 388(see 389.Em indentprefix 390variable, below). 391Other escapes will set up subject fields, add and delete recipients 392to the message, and allow you to escape to an editor to revise the 393message or to a shell to run some commands. 394(These options are given in the summary below.) 395.Ss Ending a mail processing session 396You can end a 397.Nm 398session with the 399.Ic quit 400.Pq Ic q 401command. 402Messages which have been examined go to your 403.Ar mbox 404file unless they have been deleted in which case they are discarded. 405Unexamined messages go back to the post office. 406(See the 407.Fl f 408option above). 409.Ss Personal and system wide distribution lists 410It is also possible to create a personal distribution lists so that, 411for instance, you can send mail to 412.Dq Li cohorts 413and have it go 414to a group of people. 415Such lists can be defined by placing a line like 416.Pp 417.Dl alias cohorts bill ozalp jkf mark kridle@ucbcory 418.Pp 419in the file 420.Pa \&.mailrc 421in your home directory. 422The current list of such aliases can be displayed with the 423.Ic alias 424command in 425.Nm . 426System wide distribution lists can be created by editing 427.Pa /etc/mail/aliases , 428see 429.Xr aliases 5 430and 431.Xr sendmail 1 ; 432these are kept in a different syntax. 433In mail you send, personal aliases will be expanded in mail sent 434to others so that they will be able to 435.Ic reply 436to the recipients. 437System wide 438.Ic aliases 439are not expanded when the mail is sent, 440but any reply returned to the machine will have the system wide 441alias expanded as all mail goes through 442.Xr sendmail 1 . 443.Ss Network mail (ARPA, UUCP, Berknet) 444See 445.Xr mailaddr 7 446for a description of network addresses. 447.Pp 448.Nm 449has a number of options which can be set in the 450.Pa .mailrc 451file to alter its behavior; thus 452.Dq Li set askcc 453enables the 454.Ar askcc 455feature. 456(These options are summarized below.) 457.Sh SUMMARY 458(Adapted from the 459.Dq Mail Reference Manual ) 460.Pp 461Each command is typed on a line by itself, and may take arguments 462following the command word. 463The command need not be typed in its 464entirety \- the first command which matches the typed prefix is used. 465For commands which take message lists as arguments, if no message 466list is given, then the next message forward which satisfies the 467command's requirements is used. 468If there are no messages forward of the current message, the search 469proceeds backwards, and if there are no good messages at all, 470.Nm 471types 472.Dq Li \&No applicable messages 473and aborts the command. 474.Bl -tag -width delete 475.It Ic \&! 476Executes the shell 477(see 478.Xr sh 1 479and 480.Xr csh 1 ) 481command which follows. 482.It Ic \&\- 483Print out the preceding message. 484If given a numeric 485argument 486.Ar n , 487goes to the 488.Ar n Ap th 489previous message and prints it. 490.It Ic \&= 491With no argument, it displays the current message number. 492Otherwise, set the current message number to its first argument. 493.It Ic \&? 494Prints a brief summary of commands. 495.It Ic \&| 496Pipe the current message body through the shell 497(see 498.Xr sh 1 499and 500.Xr csh 1 ) 501command which follows. 502.It Ic Detach 503Like 504.Ic detach 505but also saves MIME parts that don't have a filename associated with 506them. 507For the unnamed parts, a filename is suggested containing the message 508and part numbers, and the subtype. 509.It Ic Header 510.Pq Ic H 511Specify or show additional header fields. 512This is intended for adding extra header fields like 513.Dq Reply-To: 514or 515.Dq X-Organization: 516to the header. 517For example: 518.Bd -literal -offset 0 519 Header X-Mailer: NetBSD mail(1) 9.1 520.Ed 521.Pp 522would add the 523.Dq X-Mailer: NetBSD mail(1) 9.1 524line to the message header. 525Without any arguments, the extra header fields are displayed. 526With only a header name (including the 527.Sq \&: ) , 528it will delete all extra header fields with that name. 529Note: Although some syntax checking is done on the header line, care 530should be taken to ensure that it complies with RFC 2821 and 2822. 531Also, the extra header lines are not currently displayed by the 532.Ic \&~h 533tilde command when sending mail (use 534.Ic \&~:Header 535to see them). 536.It Ic More 537.Pq Ic M 538Like 539.Ic more 540but also prints out ignored header fields. 541.It Ic Page 542.Pq Ic \&Pa 543A synonym for 544.Ic More . 545.It Ic Print 546.Pq Ic P 547Like 548.Ic print 549but also prints out ignored header fields. 550See also 551.Ic print , 552.Ic more , 553.Ic page , 554.Ic type , 555.Ic view , 556.Ic ignore , 557and 558.Ic retain . 559.It Ic Reply 560.Pq Ic R 561Reply to originator. 562Does not reply to other recipients of the original message. 563(See 564.Ic reply . ) 565.It Ic Save 566.Pq Ic S 567Same as 568.Ic save 569except that all header fields are saved ignoring the 570.Ic saveignore 571or 572.Ic saveretain 573lists. 574.It Ic Type 575.Pq Ic T 576Identical to the 577.Ic Print 578command. 579.It Ic View 580.Pq Ic V 581Like 582.Ic Print 583but has the opposite MIME decoding behavior. 584(See the 585.Ar mime-decode-message 586variable.) 587.It Ic alias 588.Pq Ic a 589With no arguments, prints out all currently-defined aliases. 590With one argument, prints out that alias. 591With more than one argument, creates 592a new alias or changes an old one. 593.It Ic alternates 594.Pq Ic alt 595The 596.Ic alternates 597command is useful if you have accounts on several machines. 598It can be used to inform 599.Nm 600that the listed addresses are really you. 601When you 602.Ic reply 603to messages, 604.Nm 605will not send a copy of the message to any of the addresses 606listed on the 607.Ic alternates 608list. 609If the 610.Ic alternates 611command is given with no argument, the current set of alternative 612names is displayed. 613.It Ic bounce 614Takes a list of messages and prompts for an address to bounce the 615messages to. 616If no message is specified, the current message is used. 617All the original header fields are preserved except for the 618.Ql Delivered-To , 619.Ql X-Original-To 620and 621.Ql Status 622fields. 623The new 624.Ql To 625field contains the bounce address(es) plus any addresses in the old 626.Ql To 627field minus the user's local address and any on the alternates list. 628(See the 629.Ic alternates 630command.) 631.It Ic chdir 632.Pq Ic c 633Changes the user's working directory to that specified, if given. 634If no directory is given, then changes to the user's login directory. 635.It Ic copy 636.Pq Ic co 637The 638.Ic copy 639command does the same thing that 640.Ic save 641does, except that it does not mark the messages it 642is used on for deletion when you quit. 643.It Ic deldups 644Delete duplicate messages based on their 645.Ql Message-Id 646field, keeping the first one in the current sort order. 647This can be useful with replies to a mailing list that are also CCed 648to a subscriber. 649(The same thing can also be accomplished with the threading and 650tagging commands.) 651.It Ic delete 652.Pq Ic d 653Takes a list of messages as an argument and marks them all as deleted. 654Deleted messages will not be saved in 655.Ar mbox , 656nor will they be available for most other commands. 657.It Ic detach 658Takes a message list followed by a target directory as arguments, 659decodes each MIME part in the message list, and saves it in the target 660directory. 661If the message list is empty, use the current message. 662If the directory is not specified, use the directory specified by 663.Ar mime-detach-dir 664variable and, if that is empty, default to the directory 665.Nm 666was started in. 667For each MIME part in the message list, the filename is displayed for 668confirmation or changes. 669If an empty name is entered, the part is skipped. 670If the filename already exists, the user will be prompted before 671overwriting it. 672(See the 673.Ar mime-detach-batch 674and 675.Ar mime-detach-overwrite 676variables to change this behavior.) 677Only MIME parts with an associated filename in the 678.Ql Content-Type 679or 680.Ql Content-Disposition 681fields are decoded. 682(See 683.Ic Detach 684to detach all parts.) 685The MIME extension hooks and character set conversion are ignored. 686.It Ic dp 687(also 688.Ic dt ) 689Deletes the current message and prints the next message. 690If there is no next message, 691.Nm 692says 693.Dq Li "at EOF" . 694.It Ic down 695Go down one level in the thread. 696If given a message number, it descends the thread below that message, 697otherwise it descends from the current message (dot). 698.It Ic edit 699.Pq Ic e 700Takes a list of messages and points the text editor at each one in 701turn. 702On return from the editor, the message is read back in. 703.It Ic else 704Switch the command execution condition set by the previous 705.Ic if , 706.Ic ifdef , 707or 708.Ic ifndef 709command. 710.It Ic endif 711Terminate an 712.Ic if , 713.Ic ifdef , 714or 715.Ic ifndef 716command. 717.It Ic exit 718.Po Ic ex 719or 720.Ic x 721.Pc 722Effects an immediate return to the Shell without 723modifying the user's system mailbox, his 724.Ar mbox 725file, or his edit file in 726.Fl f . 727.It Ic expandaddr 728If unset (the default), recipient addresses must be names of local mailboxes 729or Internet mail addresses. 730If set, shell expansion of existing mailbox names will be performed. 731.It Ic expose 732Expose the thread structure so all messages appear in header listings. 733(See 734.Ar hide 735for the inverse.) 736The default header prompt will indent each header line one space for 737each level in the threading. 738The 739.Dq Li "%?* ?" 740format string does this. 741.It Ic file 742.Pq Ic fi 743The same as 744.Ic folder . 745.It Ic flatten 746For each message number in the argument list, or the current thread if 747no message list is given, promote all exposed children to the same 748thread level. 749.It Ic folders 750List the names of the folders in your folder directory. 751.It Ic folder 752.Pq Ic fo 753The 754.Ic folder 755command switches to a new mail file or folder. 756With no arguments, it tells you which file you are currently reading. 757If you give it an argument, it will write out changes (such 758as deletions) you have made in the current file and read in 759the new file. 760Some special conventions are recognized for the name. 761.Ql # 762means the previous file, 763.Ql % 764means your system mailbox, 765.Ql %user 766means user's system mailbox, 767.Ql & 768means your 769.Ar mbox 770file, and 771.Ql +file 772means a file in your folder directory. 773.It Ic forward 774Takes a list of messages and prompts for an address (or addresses) to 775forward each message to. 776If no message list is specified, the current message is used. 777The mail editor is run for each message allowing the user to enter a 778message that will precede the forward message. 779The message is sent as a multipart/mixed MIME encoded message. 780All header fields except the 781.Ql Status 782field are included. 783.It Ic from 784.Pq Ic f 785Takes a list of messages and prints their message headers. 786.It Ic headers 787.Pq Ic h 788Lists the current range of headers, which is an 18\-message group. 789If a 790.Ql \&+ 791argument is given, then the next 18\-message group is printed, and 792if a 793.Ql \&\- 794argument is given, the previous 18\-message group is printed. 795.It Ic help 796A synonym for 797.Ic \&? 798.It Ic hide 799Collapse the threads so that only the head of each thread is shown, 800hiding the subthreads. 801(See 802.Ar expose 803for the inverse.) 804.It Ic hidetags 805Restrict the display to untagged messages. 806In threaded mode, subthreads that connect directly to an untagged 807message are also displayed, including tagged messages in the 808connecting chain. 809.It Ic hidethreads 810The same as 811.Ar hide . 812.It Ic hold 813.Po Ic ho , 814also 815.Ic preserve 816.Pc 817Takes a message list and marks each message therein to be saved in 818the user's system mailbox instead of in 819.Ar mbox . 820Does not override the 821.Ic delete 822command. 823.It Ic if 824Execute commands that follow depending on the operating mode. 825The current supported modes are 826.Ql receiving , 827.Ql sending , 828and 829.Ql headersonly . 830For example, one use might be something like: 831.Bd -literal -offset 0 832if headersonly 833 set header-format="%P%Q%3i %-21.20f %m/%d %R %3K \e"%q\e"" 834else 835 set header-format="%P%Q%?& ?%3i %-21.20f %a %b %e %R %3K/%-5O \e"%q\e"" 836endif 837.Ed 838.It Ic ifdef 839Execute commands that follow if the specified variable is defined. 840Note: This includes environment variables. 841.It Ic ifndef 842Execute commands that follow if the specified variable is not 843defined. 844.It Ic ignore 845Add the list of header fields named to the 846.Ar ignored list . 847Header fields in the ignore list are not printed 848on your terminal when you print a message. 849This command is very handy for suppression of certain machine-generated 850header fields. 851The 852.Ic Type 853and 854.Ic Print 855commands can be used to print a message in its entirety, including 856ignored fields. 857If 858.Ic ignore 859is executed with no arguments, it lists the current set of 860ignored fields. 861.It Ic inc 862Incorporate any new messages that have arrived while mail 863is being read. 864The new messages are added to the end of the message list, 865and the current message is reset to be the first new mail message. 866This does not renumber the existing message list, nor does 867it cause any changes made so far to be saved. 868.It Ic invtags 869Invert the tags on a list of messages or the current message if none 870are given. 871Note: this will not affect any currently deleted messages. 872.It Ic mail 873.Pq Ic m 874Takes as argument login names and distribution group names and sends 875mail to those people. 876.It Ic mbox 877Indicate that a list of messages be sent to 878.Ic mbox 879in your home directory when you quit. 880This is the default action for messages if you do 881.Em not 882have the 883.Ic hold 884option set. 885.It Ic mkread 886.Pq Ic mk 887Takes a message list and marks each message as 888having been read. 889.It Ic more 890.Pq Ic \&mo 891Takes a message list and invokes the pager on that list. 892.It Ic next 893.Pf ( Ic n , 894like 895.Ic \&+ 896or 897.Tn CR ) 898Goes to the next message in sequence and types it. 899With an argument list, types the next matching message. 900.It Ic page 901.Pq Ic pa 902A synonym for 903.Ic more . 904.It Ic preserve 905.Pq Ic pre 906A synonym for 907.Ic hold . 908.It Ic print 909.Pq Ic p 910Takes a message list and types out each message on the user's terminal. 911.It Ic quit 912.Pq Ic q 913Terminates the session, saving all undeleted, unsaved messages in 914the user's 915.Ar mbox 916file in his login directory, preserving all messages marked with 917.Ic hold 918or 919.Ic preserve 920or never referenced in his system mailbox, and removing all other 921messages from his system mailbox. 922If new mail has arrived during the session, the message 923.Dq Li "You have new mail" 924is given. 925If given while editing a mailbox file with the 926.Fl f 927flag, then the edit file is rewritten. 928A return to the Shell is effected, unless the rewrite of edit file 929fails, in which case the user can escape with the 930.Ic exit 931command. 932.It Ic reply 933.Pq Ic r 934Takes a message list and sends mail to the sender and all 935recipients of the specified message. 936The default message must not be deleted. 937(See the 938.Ic Reply 939command and the 940.Ar Replyall 941variable.) 942.It Ic respond 943A synonym for 944.Ic reply . 945.It Ic retain 946Add the list of header fields named to the 947.Ar retained list . 948Only the header fields in the retained list 949are shown on your terminal when you print a message. 950All other header fields are suppressed. 951The 952.Ic Type 953and 954.Ic Print 955commands can be used to print a message in its entirety. 956If 957.Ic retain 958is executed with no arguments, it lists the current set of 959retained fields. 960.Ic Retain 961overrides 962.Ic save . 963.It Ic reverse 964Reverse the order of the messages in at the current thread level. 965This is completely equivalent to 966.Dq Li sort \&! . 967.It Ic save 968.Pq Ic s 969Takes a message list and a filename and appends each message in 970turn to the end of the file. 971The filename in quotes, followed by the line 972count and character count is echoed on the user's terminal. 973.It Ic set 974.Pq Ic se 975With no arguments, prints all variable values. 976Otherwise, sets option. 977Arguments are of the form 978.Ar option=value 979(no space before or after =) or 980.Ar option . 981Quotation marks may be placed around any part of the assignment 982statement to quote blanks or tabs, i.e. 983.Dq Li "set indentprefix=\*q->\*q" 984Inside single quotes everything is parsed literally, including 985.Sq \e 986escaped characters. 987Inside double quotes 988.Sq \e 989character escapes are interpreted. 990This is an extension as POSIX specifies that 991.Sq \e 992should be left uninterpreted for both single and double quoted strings. 993.It Ic saveignore 994.Ic Saveignore 995is to 996.Ic save 997what 998.Ic ignore 999is to 1000.Ic print 1001and 1002.Ic type . 1003Header fields thus marked are filtered out when 1004saving a message by 1005.Ic save 1006or when automatically saving to 1007.Ar mbox . 1008.\" .pl +1 1009.It Ic saveretain 1010.Ic Saveretain 1011is to 1012.Ic save 1013what 1014.Ic retain 1015is to 1016.Ic print 1017and 1018.Ic type . 1019Header fields thus marked are the only ones saved 1020with a message when saving by 1021.Ic save 1022or when automatically saving to 1023.Ar mbox . 1024.Ic Saveretain 1025overrides 1026.Ic saveignore . 1027.It Ic shell 1028.Pq Ic sh 1029Invokes an interactive version of the shell. 1030.It Ic show 1031.Pq Ic sho 1032Takes a list of variables and prints out their values in the form 1033.Ar option=value . 1034If the list is empty, all variable values are shown. 1035.It Ic showtags 1036Display all current messages, tagged or not, unless they are in a 1037hidden thread. 1038.It Ic showthreads 1039The same as 1040.Ar expose . 1041.It Ic size 1042Takes a message list and prints out the size in characters of each 1043message. 1044.It Ic smopts 1045Takes an 1046.Dq address-spec 1047followed by the sendmail flags that should be used when sending mail 1048to an address that matches that 1049.Dq address-spec . 1050If no sendmail flags are specified, then list the sendmail flags in 1051effect for the 1052.Dq address-spec . 1053If the 1054.Dq address-spec 1055is also omitted, then list all 1056.Ic smopts 1057settings. 1058The 1059.Dq address-spec 1060may be an alias, address, domain (beginning with a 1061.Ql \&@ ) , 1062or subdomain 1063(beginning with a 1064.Ql \&. ) . 1065If mail is sent to multiple users, the sendmail flags are 1066used only if the flags are the same for each recipients. 1067If 1068.Ar smopts-verify 1069is set, then you will be asked to verify the sendmail flags (if there 1070are any) before the mail is sent. 1071Address matching is case insensitive and done from most specific to 1072least. 1073.Pp 1074For example if 1075you have: 1076.Bd -literal -offset indent 1077smopts mylist -F "List Maintainer" 1078smopts @NetBSD.org -f anon@somewhere.net -F "Anon Ymous" 1079smopts friend@NetBSD.org "" 1080.Ed 1081.Pp 1082then mail sent to any of the addresses that the 1083.Ql mylist 1084alias expands to would have the sender's name set to 1085.Ql List Maintainer . 1086Mail sent to anyone at NetBSD.org other than 1087.Ql friend@NetBSD.org 1088would look like it was sent from 1089.Ql anon@somewhere.net 1090by 1091.Ql Anon Ymous . 1092Mail sent to 1093.Ql friend@NetBSD.org 1094would not have any sendmail flags set (unless they are set by the 1095.Ic \&~h 1096escape). 1097.It Ic sort 1098With no argument, 1099.Ic sort 1100does nothing. 1101Otherwise it will sort based on the header field name given as an 1102argument. 1103A few names are special: 1104.Bd -literal -offset indent 1105blines sort based on the number of body lines. 1106hlines sort on the number of header lines. 1107tlines sort on the total number of lines. 1108size sort on the message size 1109sday sent day (ignores the hour/min/sec) 1110rday received day (ignores the hour/min/sec) 1111sdate sent date 1112rdate received date 1113subject sort on the subject, ignoring "Re:" prefixes. 1114from sort on the sender's address. 1115.Ed 1116.Pp 1117The check for these special names is case sensitive while the header 1118field name comparisons are case insensitive, so changing the case on 1119any of these special names will sort based on the header field 1120ignoring the special keyword. 1121.Pp 1122There are also three modifiers which may precede the argument: 1123.Bd -literal -offset indent 1124\&! reverse the sorting order. 1125\&^ case insensitive sorting. 1126\&- skin the field (removing RFC 822 comments and 1127 keep the address). 1128.Ed 1129.Pp 1130The same keywords and modifiers also apply to threading. 1131(See the 1132.Ic thread 1133command.) 1134.Pp 1135Note: 1136.Ic sort 1137has no effect on the threading, sorting only on the heads 1138of the threads if threads exist. 1139.Pp 1140.It Ic source 1141The 1142.Ic source 1143command reads commands from a file. 1144.It Ic tag 1145Tag a list of messages or the current message if none are given. 1146In hidden thread mode, the entire thread will be tagged, i.e., 1147.Ic tag 1148is recursive 1149.It Ic tagbelow 1150Tag all messages of the current thread below the level of the 1151current message (dot) or the supplied message number if given. 1152.It Ic thread 1153By default this threads the current message list based on the 1154.Ql In-Reply-To 1155and 1156.Ql References 1157header fields (intended for this purpose by RFC 2822). 1158If given an argument, it will thread on that header field name 1159instead. 1160The same field keywords and modifiers recognized by the sort command 1161are also recognized here. 1162Display of the threads is controlled by the 1163.Ic hide 1164and 1165.Ic expose 1166commands; navigation of threads is done with the 1167.Ic down , 1168.Ic up , 1169and 1170.Ic tset 1171commands. 1172.Pp 1173If 1174.Ar recursive-commands 1175is defined, many commands (e.g., 1176.Ic print ) 1177act on the entire thread (when it is hidden), otherwise they act on 1178just the current message. 1179.Pp 1180Note: the 1181.Ql In-Reply-To 1182and 1183.Ql Reference 1184header fields are necessary to do threading correctly. 1185This version of 1186.Nm 1187now emits these header fields when replying. 1188.It Ic top 1189Takes a message list and prints the top few lines of each. 1190The number of lines printed is controlled by the variable 1191.Ic toplines 1192and defaults to five. 1193.It Ic tset 1194Set the current thread (thread set) so that the supplied message 1195number (or the current message if no argument is given) is at the top 1196level of the current thread. 1197.It Ic type 1198.Pq Ic t 1199A synonym for 1200.Ic print . 1201.It Ic unalias 1202Takes a list of names defined by 1203.Ic alias 1204commands and discards the remembered groups of users. 1205The group names no longer have any significance. 1206.It Ic undelete 1207.Pq Ic u 1208Takes a message list and marks each message as 1209.Ic not 1210being deleted. 1211.It Ic unread 1212.Pq Ic unr 1213Takes a message list and marks each message as 1214.Em not 1215having been read. 1216.It Ic unset 1217Takes a list of option names and discards their remembered values; 1218the inverse of 1219.Ic set . 1220.It Ic unsmopts 1221Takes a list of 1222.Dq address-specs 1223defined by 1224.Ic smopts 1225commands and discards them from the smopts database. 1226.It Ic untag 1227Untag a list of messages or the current message if none are given. 1228Like the 1229.Ic tag 1230command, 1231.Ic untag 1232is recursive on hidden threads. 1233.It Ic unthread 1234Undo all threading and sorting, restoring the original display order, 1235i.e., the order in the mail file. 1236.It Ic up 1237Go up one level in the thread. 1238This also takes an optional (positive) argument to go up multiple 1239levels in the thread. 1240.It Ic view 1241.Pq Ic vie 1242Like 1243.Ic print 1244but has the opposite MIME decoding behavior. 1245(See the 1246.Ar mime-decode-message 1247variable.) 1248.It Ic visual 1249.Pq Ic v 1250Takes a message list and invokes the display editor on each message. 1251.It Ic write 1252.Pq Ic w 1253Similar to 1254.Ic save , 1255except that 1256.Em only 1257the message body 1258.Em ( without 1259the header) is saved. 1260Extremely useful for such tasks as sending and receiving source 1261program text over the message system. 1262.It Ic xit 1263.Pq Ic x 1264A synonym for 1265.Ic exit . 1266.It Ic z 1267.Nm 1268presents message headers in windowfuls as described under the 1269.Ic headers 1270command. 1271You can move 1272.Nm Ns Ap s 1273attention forward to the next window with the 1274.Ic \&z 1275command. 1276Also, you can move to the previous window by using 1277.Ic \&z\&\- . 1278.El 1279.Ss Tilde/Escapes 1280Here is a summary of the tilde escapes, which are used when composing 1281messages to perform special functions. 1282Tilde escapes are only recognized at the beginning of lines. 1283The name 1284.Dq Em tilde\ escape 1285is somewhat of a misnomer since the actual escape character can be set 1286by the option 1287.Ic escape . 1288.Bl -tag -width Ds 1289.It Ic \&~! Ns Ar command 1290Execute the indicated shell command, then return to the message. 1291.It Ic \&~@ Op Ar filelist 1292Add the files in the white-space delimited 1293.Ar filelist 1294to the attachment list. 1295If 1296.Ar filelist 1297is omitted, edit the attachment list, possibly appending to it: For 1298each file in the list the user is prompted to change its attachment 1299data. 1300Changing the filename to empty will delete it from the list. 1301Upon reaching the end of the attachment list, the user is prompted for 1302additional files to attach until an empty filename is given. 1303Filenames containing white-space can only be added in this 1304.Dq edit 1305mode. 1306.It Ic \&~a 1307Inserts the autograph string from the sign= option into the message. 1308.It Ic \&~A 1309Inserts the autograph string from the Sign= option into the message. 1310.It Ic \&~b Ns Ar name ... 1311Add the given names to the list of carbon copy recipients but do not make 1312the names visible in the Cc: line 1313.Dq ( blind 1314carbon copy). 1315.It Ic \&~c Ns Ar name ... 1316Add the given names to the list of carbon copy recipients. 1317.It Ic \&~d 1318Read the file 1319.Dq Pa dead.letter 1320from your home directory into the message. 1321.It Ic \&~e 1322Invoke the text editor on the message collected so far. 1323After the editing session is finished, you may continue appending 1324text to the message. 1325.It Ic \&~f Ns Ar messages 1326Read the named messages into the message being sent. 1327If no messages are specified, read in the current message. 1328Message headers currently being ignored (by the 1329.Ic ignore 1330or 1331.Ic retain 1332command) are not included. 1333.It Ic \&~ 1334Identical to 1335.Ic \&~f , 1336except all message headers are included. 1337.It Ic \&~h 1338Edit the message header fields, and the options passed to sendmail (the 1339.Li Smopts ) , 1340by typing each one in turn and allowing the user to append text to the 1341end or modify the field by using the current terminal erase and kill 1342characters. 1343If 1344.Xr editline 3 1345support is included, then that line editor is used. 1346.It Ic \&~i Ns Ar string 1347Inserts the value of the named option into the text of the message. 1348.It Ic \&~m Ns Ar messages 1349Read the named messages into the message being sent, indented by a 1350tab or by the value of 1351.Ar indentprefix . 1352If no messages are specified, read the current message. 1353Message headers currently being ignored (by the 1354.Ic ignore 1355or 1356.Ic retain 1357command) are not included. 1358.It Ic \&~M Ns Ar messages 1359Identical to 1360.Ic \&~m , 1361except all message headers are included. 1362.It Ic \&~p 1363Print out the message collected so far, prefaced by the message header 1364fields. 1365.It Ic \&~q 1366Abort the message being sent, copying the message to 1367.Dq Pa dead.letter 1368in your home directory if 1369.Ic save 1370is set. 1371.It Ic \&~x 1372Exits as with \&~q, except the message is not saved in 1373.Dq Pa dead.letter . 1374.It Ic \&~r Ns Ar filename 1375.It Ic \&~< Ns Ar filename 1376Reads the named file into the message. 1377If the argument begins with 1378.Ql \&! , 1379the rest of the string is taken as an arbitrary system command and is 1380executed, with the standard output inserted into the message. 1381.It Ic \&~s Ns Ar string 1382Cause the named string to become the current subject field. 1383.It Ic \&~\&t Ns Ar name ... 1384Add the given names to the direct recipient list. 1385.It Ic \&~\&v 1386Invoke an alternative editor (defined by the 1387.Ev VISUAL 1388option) on the message collected so far. 1389Usually, the alternative editor will be a screen editor. 1390After you quit the editor, you may resume appending 1391text to the end of your message. 1392.It Ic \&~w Ns Ar filename 1393Write the message onto the named file. 1394.It Ic \&~\&| Ns Ar command 1395Pipe the message body through the command as a filter. 1396If the command gives no output or terminates abnormally, retain the 1397original text of the message. 1398The command 1399.Xr fmt 1 1400is often used as 1401.Ic command 1402to rejustify the message. 1403.It Ic \&~: Ns Ar mail-command 1404Execute the given mail command. 1405Not all commands, however, are allowed. 1406.It Ic \&~~ Ns Ar string 1407Insert the string of text in the message prefaced by a single ~. 1408If you have changed the escape character, then you should double 1409that character in order to send it. 1410.El 1411.Ss Mail Options 1412Options are controlled via 1413.Ic set 1414and 1415.Ic unset 1416commands. 1417Options may be either binary, in which case it is only 1418significant to see whether they are set or not; or string, in which 1419case the actual value is of interest. 1420The binary options include the following: 1421.Bl -tag -width append 1422.It Ar append 1423Causes messages saved in 1424.Ar mbox 1425to be appended to the end rather than prepended. 1426This should always be set (perhaps in 1427.Pa /etc/mail.rc ) . 1428.It Ar ask , Ar asksub 1429Causes 1430.Nm 1431to prompt you for the subject of each message you send. 1432If you respond with simply a newline, no subject field will be sent. 1433.It Ar askcc 1434Causes you to be prompted for additional carbon copy recipients at 1435the end of each message. 1436Responding with a newline indicates your 1437satisfaction with the current list. 1438.It Ar autoinc 1439Causes new mail to be automatically incorporated when it arrives. 1440Setting this is similar to issuing the 1441.Ic inc 1442command at each prompt, except that the current message is not 1443reset when new mail arrives. 1444.It Ar askbcc 1445Causes you to be prompted for additional blind carbon copy recipients 1446at the end of each message. 1447Responding with a newline indicates your 1448satisfaction with the current list. 1449.It Ar autoprint 1450Causes the 1451.Ic delete 1452command to behave like 1453.Ic dp 1454\- thus, after deleting a message, the next one will be typed 1455automatically. 1456.It Va crt 1457If 1458.Va crt 1459is set, then the 1460.Ev PAGER 1461will be used for the 1462.Ic print , 1463.Ic Print , 1464.Ic type , 1465and 1466.Ic Type 1467commands. 1468Normally these commands do not invoke the pager. 1469(See 1470.Va page-also . ) 1471.It Ar debug 1472Setting the binary option 1473.Ar debug 1474is the same as specifying 1475.Fl d 1476on the command line and causes 1477.Nm 1478to output all sorts of information useful for debugging 1479.Nm . 1480.It Ar dot 1481The binary option 1482.Ar dot 1483causes 1484.Nm 1485to interpret a period alone on a line as the terminator 1486of a message you are sending. 1487.It Ar enable-pipes 1488If defined, the output of most commands can be piped into a shell 1489command or redirected to a file. 1490The pipe/redirection is signaled by the first occurrence of a 1491.Ql \&| 1492or 1493.Ql > 1494character that is not in a quoted string or in a parenthetical 1495group. 1496This character terminates the mail command line and the remaining 1497string is passed to the shell. 1498For example, assuming normal headers, something like 1499.Bd -literal -offset indent 1500 from john@ | fgrep -i ' "Re:' | wc 1501.Ed 1502.Pp 1503could be used to count how may replies were made by senders with 1504.Ql john@ 1505in their address and 1506.Bd -literal -offset indent 1507 from john@ >> /tmp/john 1508.Ed 1509.Pp 1510would append all the headers from such senders to /tmp/john. 1511.Pp 1512Note: With piping enabled, you cannot use the 1513.Ql \&| 1514as a logical 1515.Dq or 1516operator outside of a parenthetical group. 1517This should not be a problem as it is the default logical operator. 1518(See the 1519.Sx Specifying messages 1520section.) 1521.It Ar hold 1522This option is used to hold messages in the system mailbox 1523by default. 1524.It Ar ignore 1525Causes interrupt signals from your terminal to be ignored and echoed as 1526@'s. 1527.It Ar metoo 1528Usually, when a group is expanded that contains the sender, the sender 1529is removed from the expansion. 1530Setting this option causes the sender to be included in the group. 1531.It Ar mime-attach-list 1532If set, the command line flag 1533.Fl a 1534will accept a whitespace delimited list of files. 1535Otherwise, its argument is interpreted as a single filename. 1536Warning: If enabled, care must be taken to properly quote files that 1537contain whitespace, both from the shell and from this second expansion 1538done by 1539.Nm . 1540.It Ar mime-decode-header 1541If set, decode the headers along with the body when 1542.Ar mime-decode-message 1543is set. 1544The header decode follows the same rules as the body (see 1545.Ar mime-decode-message ) . 1546.It Ar mime-decode-insert 1547When inserting 1548a message into the mail buffer 1549.Po Ic \&~f 1550or 1551.Ic \&~F 1552.Pc , 1553the text inserted will be decoded according to the settings of the 1554.Ar mime-decode-message 1555and 1556.Ar mime-decode-header 1557variables. 1558.It Ar mime-decode-message 1559If set, the 1560.Ic More , 1561.Ic more , 1562.Ic Page , 1563.Ic page , 1564.Ic Print , 1565.Ic print , 1566.Ic Type , 1567and 1568.Ic type 1569commands will display decoded the MIME messages. 1570Otherwise, they display the undecoded message. 1571Recall that the 1572.Ic View 1573and 1574.Ic view 1575commands always have the opposite MIME decoding behavior from these 1576commands. 1577.It Ar mime-decode-quote 1578When quoting 1579a message into the mail buffer 1580.Po Ic \&~m 1581or 1582.Ic \&~M 1583.Pc , 1584the text inserted will be decoded according to the settings of the 1585.Ar mime-decode-message 1586and 1587.Ar mime-decode-header 1588variables. 1589.It Ar mime-detach-batch 1590If set, the detach command does not prompt for anything 1591.Po unless 1592.Ar mime-detach-overwrite 1593is set to 1594.Ql ask 1595.Pc , 1596overwriting target files depending on the setting of 1597.Ar mime-detach-overwrite . 1598.It Ar noheader 1599Setting the option 1600.Ar noheader 1601is the same as giving the 1602.Fl N 1603flag on the command line. 1604.It Ar nosave 1605Normally, when you abort a message with two 1606.Tn RUBOUT 1607(erase or delete) 1608.Nm 1609copies the partial letter to the file 1610.Dq Pa dead.letter 1611in your home directory. 1612Setting the binary option 1613.Ar nosave 1614prevents this. 1615.It Ar page-also 1616A comma or whitespace delimited list of additional commands to page. 1617The comparisons are case insensitive, so if 1618.Ic view 1619is in the list, both 1620.Ic view 1621and 1622.Ic View 1623will page. 1624.It Ar pager-off 1625If set, disable the pager on all commands. 1626.It Ar quiet 1627Suppresses the printing of the version when first invoked. 1628.It Ar recursive-commands 1629When defined, and threading is in effect, the following commands 1630operate on the entire thread (if it is 1631.Dq hidden ) 1632rather than just the top displayed message of the thread: 1633.Bd -literal -offset indent 1634More Page Print Type View more page print type view 1635top 1636Save copy save write 1637Detach detach 1638delete dp dt 1639undelete 1640hold preserve 1641mbox mkread touch unread 1642tag untag invtags 1643.Ed 1644.Pp 1645If not defined, or if the threads are 1646.Dq exposed , 1647commands behave exactly as they do in non-threaded mode, i.e., each 1648operates on individual messages. 1649.It Ar Replyall 1650Reverses the sense of 1651.Ic reply 1652and 1653.Ic Reply 1654commands. 1655.It Ar searchheaders 1656If this option is set, then a message-list specifier in the form 1657.Dq /x:y 1658will expand to all messages containing the substring 1659.Dq y 1660in the header field 1661.Dq x . 1662The string search is case insensitive. 1663If 1664.Dq x 1665is omitted, it will default to the 1666.Ql Subject 1667header field. 1668If 1669.Dq y 1670is omitted, only those messages that contain the field 1671.Dq x 1672will be matched. 1673The three forms 1674.Dq /from:y , 1675.Dq /to:y , 1676and 1677.Dq /body:y 1678are special. 1679The first will match all messages which contain the substring 1680.Dq y 1681in the headline (which is added locally at receipt time and begins 1682with 1683.Dq From \& ) . 1684The second will match all messages containing the substring 1685.Dq y 1686in the 1687.Ql To , 1688.Ql Cc , 1689or 1690.Ql Bcc 1691header fields. 1692The third will match all messages which contain the substring 1693.Dq y 1694in a line of the message body. 1695The check for 1696.Dq from , 1697.Dq to , 1698and 1699.Dq body 1700is case sensitive, so that 1701.Dq /From:y 1702and 1703.Dq /To:y 1704can be used to search the 1705.Ql From 1706and 1707.Ql To 1708fields, respectively. 1709(See also 1710.Ar "regex-search" . ) 1711.It Ar smopts-verify 1712Verify the sendmail options used on outgoing mail if they were obtained from a 1713.Ar smopts 1714match. 1715This has no effect if there are no sendmail flags or if the flags 1716were set by the 1717.Ic \&~h 1718escape. 1719.It Ar verbose 1720Setting the option 1721.Ar verbose 1722is the same as using the 1723.Fl v 1724flag on the command line. 1725When mail runs in verbose mode, the actual delivery of messages is 1726displayed on the user's terminal. 1727.El 1728.Ss Option String Values 1729.Bl -tag -width Va 1730.It Ev EDITOR 1731Pathname of the text editor to use in the 1732.Ic edit 1733command and 1734.Ic \&~e 1735escape. 1736If not defined, then a default editor is used. 1737.It Ev LISTER 1738Pathname of the directory lister to use in the 1739.Ic folders 1740command. 1741Default is 1742.Pa /bin/ls . 1743.It Ev PAGER 1744Pathname of the program to use in the 1745.Ic more 1746command or when 1747.Ic crt 1748variable is set. 1749The default paginator 1750.Xr more 1 1751is used if this option is not defined. 1752.It Ev SHELL 1753Pathname of the shell to use in the 1754.Ic \&! 1755command and the 1756.Ic \&~! 1757escape. 1758A default shell is used if this option is not defined. 1759.It Ev VISUAL 1760Pathname of the text editor to use in the 1761.Ic visual 1762command and 1763.Ic \&~v 1764escape. 1765.It Ar el-completion-keys 1766A comma or space delimited list of keys to do 1767.Xr editline 3 1768completion. 1769For example 1770.Nm set el-completion-keys=^I,^D 1771will bind completion to both the tab and CTRL-D keys. 1772(Requires 1773.Xr editline 3 1774support.) 1775.It Ar el-editor 1776The line editing mode: must be 1777.Ql emacs 1778or 1779.Ql vi . 1780If unset, editing is not enabled. 1781(Requires 1782.Xr editline 3 1783support.) 1784.It Ar el-history-size 1785The number of lines of history to remember. 1786If unset, history is not enable. 1787(Requires 1788.Xr editline 3 1789support.) 1790.It Ar escape 1791If defined, the first character of this option gives the character to 1792use in the place of 1793.Ic \&~ 1794to denote escapes. 1795.It Ar folder 1796The name of the directory to use for storing folders of 1797messages. 1798If this name begins with a 1799.Ql / , 1800.Nm 1801considers it to be an absolute pathname; otherwise, the 1802folder directory is found relative to your home directory. 1803.It Ar header-format 1804If set, use this format string when displaying headers in command 1805mode. 1806The format string supports the following conversions in addition to 1807those of 1808.Xr strftime 3 : 1809.Pp 1810.Bl -tag -width ".Ar \&%?key?" -compact 1811.It Ar \&%?key? 1812The header field with name 1813.Ql key . 1814Note: if key[0] is 1815.Ql \&- , 1816ignore the 1817.Ql \&- 1818and extract the address 1819portion of the field (i.e., 1820.Dq skin 1821the field). 1822.It Ar \&%?*string? 1823If the depth is 1824.Ar n , 1825substitute 1826.Ql string 1827.Ar n 1828times. 1829This is intended to be used when displaying an 1830.Dq exposed thread . 1831.It Ar \&%?&string? 1832Like 1833.Ar \&%?*string? , 1834but uses the depth relative to the current depth rather than the 1835absolute depth. 1836.It Ar \&%J 1837The number of header lines in the message. 1838.It Ar \&%K 1839The number of body lines in the message. 1840.It Ar \&%L 1841The total number of lines in the message. 1842.It Ar \&%N 1843The sender's full name (as in the 1844.Ql From 1845or 1846.Ql Sender 1847fields). 1848.It Ar \&%O 1849The message size. 1850.It Ar \&%P 1851The current 1852.Dq dot 1853.Pq Sq > 1854message. 1855.It Ar \&%Q 1856The message status flag. 1857.It Ar \&%Z 1858The time zone name (if it exists). 1859.It Ar \&%f 1860The email address of sender. 1861.It Ar \&%i 1862The message number. 1863.It Ar \&%n 1864The sender's login name (taken from the address). 1865.It Ar \&%q 1866The subject. 1867.It Ar \&%t 1868The total number of messages. 1869.It Ar \&%z 1870The GMT offset (if found). 1871.El 1872.Pp 1873If the format string begins with 1874.Ql "\&%??" 1875then the date will be extracted from the headline. 1876Otherwise it will be extracted from the 1877.Ql Date 1878header falling back to the headline if that extraction fails. 1879For example, the default format is: 1880.Bd -literal -offset 0 1881set header-format=\&"\&%??%P%Q%?* ?%3i \&%-21.20f \&%a \&%b \&%e \&%R \&%3K/%-5O \&\e"%q\e"" 1882.Ed 1883.Pp 1884Note 1: The message status flag 1885.Ql \&%Q 1886will display the single character 1887.Ql \&+ 1888for the parent of a subthread. 1889This will be overwritten by a 1890.Ql T , 1891.Ql E , 1892.Ql \&* , 1893.Ql P , 1894.Ql U , 1895.Ql N , 1896.Ql M 1897indicating, respectively, a tagged, modified, saved, preserved, 1898unread, new, or modified message, in that order with the last matching 1899condition being the one displayed. 1900In the case of hidden threads, the entire subthread is searched and 1901the letters above will be displayed in lower case if the property is 1902that of a hidden child with the case 1903.Ql \&* 1904being displayed as 1905.Ql & . 1906.Pp 1907Note 2: 1908.Ar \&%n 1909and 1910.Ar \&%t 1911as used by 1912.Xr strftime 3 1913were redundant with \et and \en, respectively, so nothing is lost 1914using them here. 1915.It Ar ignoreeof 1916An option related to 1917.Ar dot 1918is 1919.Ar ignoreeof 1920which makes 1921.Nm 1922refuse to accept a 1923.Ql control-D 1924as the end of a message. 1925If given a numeric argument 1926.Ar n , 1927a 1928.Ql control-D 1929will be accepted after 1930.Ar n 1931tries. 1932.Ar Ignoreeof 1933also applies to 1934.Nm 1935command mode. 1936.It Ar indentpreamble 1937If set, this format string will be inserted before quoting a message 1938.Po Ic \&~m 1939or 1940.Ic \&~M 1941.Pc . 1942The format syntax is the same as for 1943.Ar header-format . 1944For example, the following: 1945.Bd -literal -offset 0 1946set indentpreamble= 1947 \&"On \&%b \&%e \&%T, \&%Y \&%z (%Z), \&%n (%.50N) wrote:\en-- Subject: \&%.65q\en" 1948.Ed 1949.Pp 1950would insert something like 1951.Bd -literal -offset 0 1952On Oct 27 11:00:07, 2006 -0400 (EDT), anon (Anon Ymous) wrote: 1953-- Subject: suggestions for mail(1) 1954.Ed 1955.Pp 1956before the quoted message. 1957.It Ar indentprefix 1958String used by the 1959.Ic ~m 1960and 1961.Ic ~M 1962tilde escapes for indenting messages, in place of 1963the normal tab character 1964.Pq Sq ^I . 1965Be sure to quote the value if it contains 1966spaces or tabs. 1967.It Ar indentpostscript 1968If set, this format string will be inserted after quoting a message 1969.Po Ic \&~m 1970or 1971.Ic \&~M 1972.Pc . 1973The format syntax is the same as for 1974.Ar header-format . 1975For example, the following: 1976.Bd -literal -offset 0 1977set indentpostscript="-- End of excerpt from \&%.50N" 1978.Ed 1979.Pp 1980would insert something like 1981.Bd -literal -offset 0 1982-- End of excerpt from Anon Ymous 1983.Ed 1984.Pp 1985after the quoted message. 1986.It Ar mime-body-TYPE-SUBTYPE 1987MIME-hook for the body of a MIME block of 1988.Ql "Content-Type: TYPE/SUBTYPE" . 1989(See 1990.Sy MIME Enhancements 1991below.) 1992.It Ar mime-charset 1993Convert 1994.Ql "Content-type: text" 1995messages to this character set or 1996.Ql us-ascii 1997if the value is empty. 1998If unset, no character set conversion is done. 1999.It Ar mime-detach-dir 2000The directory to detach files to if the 2001.Ar detach 2002command is given no arguments. 2003(See 2004.Ar detach . ) 2005.It Ar mime-detach-overwrite 2006This controls overwriting of existing files by the detach command. 2007If set to 2008.Ql ask 2009the user will be prompted before overwriting a file. 2010If set to 2011.Ql yes , 2012or to the empty string, existing target files will be overwritten. 2013If set to 2014.Ql no , 2015no target files will be overwritten. 2016.It Ar mime-encode-message 2017If set, encode the body of the message as required. 2018Typically, this is just an issue of whether 2019.Ql quoted-printable 2020encoding is used or not. 2021If it has a value, then use it to determine the encoding type. 2022Allowed values are 2023.Ql 7bit , 2024.Ql 8bit , 2025.Ql binary , 2026.Ql quoted-printable , 2027or 2028.Ql base64 . 2029.It Ar mime-head-TYPE-SUBTYPE 2030MIME-hook for the header of a MIME block of 2031.Ql "Content-Type: TYPE/SUBTYPE" . 2032(See 2033.Sy MIME Enhancements 2034below.) 2035.It Ar mime-hook-TYPE-SUBTYPE 2036MIME-hook for MIME block of 2037.Ql "Content-Type: TYPE/SUBTYPE" . 2038(See 2039.Sy MIME Enhancements 2040below.) 2041.It Ev MBOX 2042The name of the 2043.Ar mbox 2044file. 2045It can be the name of a folder. 2046The default is 2047.Dq Li mbox 2048in the user's home directory. 2049.It Ar prompt 2050If defined, it specifies the prompt to use when in command mode. 2051Otherwise, the default 2052.Ql & 2053is used. 2054The format syntax is the same as for 2055.Ar header-format . 2056.It Ar record 2057If defined, gives the pathname of the file used to record all outgoing 2058mail. 2059If not defined, then outgoing mail is not so saved. 2060.It Ar regex-search 2061If set, regular expression searches are used, instead of simple case 2062insensitive substring matches, when determining message lists by 2063searching sender names, subjects, or header fields (if 2064.Ar searchheaders 2065is defined); see the 2066.Sx Specifying messages 2067section. 2068The value of the variable is a space or comma delimited list of 2069options. 2070Valid options are 2071.Ql icase 2072to do case insensitive searches, 2073.Ql extended 2074to use extended (rather than basic) regular expressions, and 2075.Ql nospec 2076to turn off all special character meanings and do literal string 2077searches. 2078Note that 2079.Ql extended 2080and 2081.Ql nospec 2082are not compatible (see 2083.Xr regcomp 3 ) . 2084.It Ar ReplyAsRecipient 2085This is used when replying to email (see the 2086.Ic reply 2087or 2088.Ic Reply 2089commands). 2090It is useful if you have multiple email addresses and wish to ensure 2091that replies respect them. 2092If set, grab the email address(es) from the 2093.Ql To 2094field of the message being replied to. 2095If there is only one such address, and if it does not match any 2096address in the value of 2097.Ar ReplyAsRecipient 2098(a comma or space delimited list of addresses, possibly empty), then 2099use this address in the 2100.Ql From 2101field of the reply. 2102This is accomplished by passing the address to 2103.Xr sendmail 1 2104with the 2105.Fl f 2106option. 2107Note: the sendmail options can be edited with the 2108.Ic \&~h 2109escape. 2110(See also the 2111.Ic smopts 2112command.) 2113.It Ar toplines 2114If defined, gives the number of lines of a message to be printed out 2115with the 2116.Ic top 2117command; normally, the first five lines are printed. 2118.El 2119.Ss MIME Enhancements 2120A MIME message is (recursively) divided into a series of MIME parts 2121that can be thought of as sub-messages, each with a header and body. 2122When MIME support is enabled (by setting 2123.Ar mime-decode-message ) , 2124.Nm 2125splits a message into a series of its smallest MIME parts and 2126processes those parts as if they were messages themselves, passing the 2127header and body through a pipeline of the form: 2128.Pp 2129.Dl mail -> MIME-decoder -> MIME-hook -> pager -> screen 2130.Pp 2131The 2132.Em MIME-decoder 2133decodes 2134.Ql base64 2135or 2136.Ql quoted-printable 2137encoding and is enabled according to the 2138.Ql Content-Transfer-Encoding 2139of the part. 2140The 2141.Em MIME-hook 2142is an external program to further process the part (see below). 2143The 2144.Em pager 2145is the program that pages the message 2146(see 2147.Ev PAGER ) . 2148Any of these intermediate pipe stages may be missing and/or different 2149for the head and body of each MIME part. 2150Certain 2151.Ql Content-Types 2152may disable the entire pipeline (e.g., 2153.Ql application/octet ) . 2154.Pp 2155The 2156.Em MIME-hook 2157stage is not present unless one of the following variables is set: 2158.Bd -literal -offset indent 2159mime-hook-TYPE-SUBTYPE applies to the entire MIME part 2160mime-head-TYPE-SUBTYPE applies to the header of the MIME part 2161mime-body-TYPE-SUBTYPE applies to the body of the MIME part 2162.Ed 2163.Pp 2164where TYPE and SUBTYPE are the 2165.Ql Content-Type 2166type and subtype 2167(respectively) of the MIME part to which the hook applies. 2168If the 2169.Dq -SUBTYPE 2170is missing, any subtype is matched. 2171The value of these variables has the format: 2172.Bd -filled -offset indent 2173.Op Ar flags 2174.Ar command 2175.Ed 2176.Pp 2177where the 2178.Ar command 2179is expected to read from stdin and write to stdout, and the possible 2180flags are 2181.Bl -tag -width Ds -offset indent 2182.It ! 2183Execute 2184.Ar command 2185in a sub-shell rather than doing an 2186.Xr exec 3 2187(see 2188.Va SHELL ) . 2189.It + 2190Use this hook when selecting the part to display in a 2191.Ql multipart/alternative 2192block. 2193Multipart blocks contain 2194.Dq alternative 2195versions with the same information, in increasing order of preference 2196(and decoding complexity). 2197The last one the mail agent understands is the one to be displayed. 2198This is typically used for sending a message in both 2199.Dq plain text 2200and 2201.Dq html , 2202but more complex subtypes are also possible. 2203.It - 2204Do not decode before executing 2205.Ar command . 2206.El 2207.Pp 2208If your 2209.Ar command 2210begins with one of these flags, precede it with a space to signal the 2211end of the flags. 2212.Pp 2213WARNING: automatically running a program is a potential security risk 2214if that program has bugs, so be careful what you run. 2215.Pp 2216.Em Examples : 2217View all 2218.Ql "Content-Type: image/jpeg" 2219parts with 2220.Xr xv 1 2221(assuming it is installed): 2222.Pp 2223.Dl set mime-body-image-jpeg="/usr/pkg/bin/xv -" 2224.Pp 2225Decode all 2226.Ql "Content-Type: images/*" 2227blocks with 2228.Xr uudeview 1 2229(assuming it is installed), placing the results in 2230.Pa /tmp : 2231.Pp 2232.Dl set mime-hook-image="-/usr/pkg/bin/uudeview -p /tmp -i -a +o -q -" 2233.Pp 2234Read all 2235.Ql "Content-Type: text/html" 2236parts using 2237.Xr lynx 1 2238(assuming it is installed) and add this support to 2239.Ql multipart/alternative 2240blocks: 2241.Pp 2242.Bd -literal -offset indent 2243set mime-body-text-html="+/usr/pkg/bin/lynx -force_html -dump -stdin" 2244.Ed 2245.Sh ENVIRONMENT 2246.Nm 2247uses the 2248.Ev HOME , 2249.Ev TMPDIR , 2250and 2251.Ev USER 2252environment variables. 2253.Sh FILES 2254.Bl -tag -width /usr/share/misc/mail.*help -compact 2255.It Pa /var/mail/* 2256Post office. 2257This can be overwritten by setting the 2258.Ev MAIL 2259environment variable. 2260.It ~/mbox 2261User's old mail. 2262This can be overwritten by setting the 2263.Ev MBOX 2264environment variable. 2265.It ~/.mailrc 2266File giving initial mail commands. 2267This can be overridden by setting the 2268.Ev MAILRC 2269environment variable. 2270.It Pa /tmp/mail.R* 2271Temporary files. 2272.It Pa /usr/share/misc/mail.*help 2273Help files. 2274.It Pa /etc/mail.rc 2275System initialization file. 2276.El 2277.Sh SEE ALSO 2278.Xr fmt 1 , 2279.Xr newaliases 1 , 2280.Xr sendmail 1 , 2281.Xr vacation 1 , 2282.Xr aliases 5 , 2283.Xr mailaddr 7 2284and 2285.Rs 2286.%T "The Mail Reference Manual" 2287.Re 2288.Sh HISTORY 2289A 2290.Nm 2291command 2292appeared in 2293.At v6 . 2294This man page is derived from 2295.Dq The Mail Reference Manual 2296originally written by Kurt Shoens. 2297.Sh BUGS 2298There are some flags and commands that are not documented here. 2299Most are not useful to the general user. 2300.Pp 2301Historically, 2302.Nm 2303was just a link to 2304.Nm Mail , 2305which was confusing. 2306.Nm Mail 2307has been removed in 2308.Nx 9 . 2309.Pp 2310The name of the 2311.Ic alternates 2312list is incorrect English (it should be 2313.Dq alternatives ) , 2314but is retained for compatibility. 2315.Pp 2316There must be sufficient space on $TMPDIR for various temporary files. 2317.Pp 2318If an unrecoverable character set conversion error occurs (during 2319display), the message is truncated and a warning is printed. 2320This seems to be rare, but probably the remainder of the message 2321should be printed without conversion. 2322.Pp 2323The internal sh-like parser is not terribly sh-like. 2324.Pp 2325Selecting messages by their content (i.e., with 2326.Ql /body: ) 2327is rather slow. 2328