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