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