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