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