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