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