Annotation of src/usr.bin/mail/mail.1, Revision 1.56
1.56 ! jmc 1: .\" $OpenBSD: mail.1,v 1.55 2008/11/03 15:42:35 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.56 ! jmc 32: .Dd $Mdocdate: November 3 2008 $
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 .
716: .Bl -tag -width Ds
1.43 jmc 717: .It Ic ~b Ns Ar name ...
1.1 deraadt 718: Add the given names to the list of carbon copy recipients but do not make
719: the names visible in the Cc: line ("blind" carbon copy).
1.43 jmc 720: .It Ic ~c Ns Ar name ...
1.1 deraadt 721: Add the given names to the list of carbon copy recipients.
1.43 jmc 722: .It Ic ~d
1.1 deraadt 723: Read the file
1.22 aaron 724: .Pa dead.letter
1.1 deraadt 725: from your home directory into the message.
1.43 jmc 726: .It Ic ~e
1.1 deraadt 727: Invoke the text editor on the message collected so far.
728: After the
729: editing session is finished, you may continue appending text to the
730: message.
1.49 jmc 731: .It Ic ~F Ns Ar messages
732: Identical to
733: .Ic ~f ,
734: except all message headers are included.
1.43 jmc 735: .It Ic ~f Ns Ar messages
1.1 deraadt 736: Read the named messages into the message being sent.
737: If no messages are specified, read in the current message.
738: Message headers currently being ignored (by the
739: .Ic ignore
740: or
741: .Ic retain
742: command) are not included.
1.43 jmc 743: .It Ic ~h
1.1 deraadt 744: Edit the message header fields by typing each one in turn and allowing
745: the user to append text to the end or modify the field by using the
746: current terminal erase and kill characters.
1.49 jmc 747: .It Ic ~M Ns Ar messages
748: Identical to
749: .Ic ~m ,
750: except all message headers are included.
1.43 jmc 751: .It Ic ~m Ns Ar messages
1.1 deraadt 752: Read the named messages into the message being sent, indented by a
753: tab or by the value of
1.25 aaron 754: .Va indentprefix .
1.1 deraadt 755: If no messages are specified,
756: read 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.43 jmc 762: .It Ic ~p
1.1 deraadt 763: Print out the message collected so far, prefaced by the message header
764: fields.
1.43 jmc 765: .It Ic ~q
1.1 deraadt 766: Abort the message being sent, copying the message to
1.22 aaron 767: .Pa dead.letter
1.1 deraadt 768: in your home directory if
769: .Ic save
770: is set.
1.43 jmc 771: .It Ic ~r Ns Ar filename
1.1 deraadt 772: Read the named file into the message.
1.43 jmc 773: .It Ic ~s Ns Ar string
1.1 deraadt 774: Cause the named string to become the current subject field.
1.43 jmc 775: .It Ic ~t Ns Ar name ...
1.1 deraadt 776: Add the given names to the direct recipient list.
1.43 jmc 777: .It Ic ~v
1.1 deraadt 778: Invoke an alternate editor (defined by the
779: .Ev VISUAL
780: option) on the
781: message collected so far.
782: Usually, the alternate editor will be a
783: screen editor.
784: After you quit the editor, you may resume appending
785: text to the end of your message.
1.43 jmc 786: .It Ic ~w Ns Ar filename
1.1 deraadt 787: Write the message onto the named file.
1.55 martynas 788: .It Ic ~x
789: Abort the message being sent.
790: No message is copied to
791: .Pa ~/dead.letter ,
792: even if
793: .Ic save
794: is set.
1.56 ! jmc 795: .It Ic ~?
! 796: Prints a brief summary of tilde escapes.
! 797: .It Ic ~! Ns Ar command
! 798: Execute the indicated shell command, then return to the message.
1.43 jmc 799: .It Ic ~| Ns Ar command
1.1 deraadt 800: Pipe the message through the command as a filter.
801: If the command gives
802: no output or terminates abnormally, retain the original text of the
803: message.
804: The command
805: .Xr fmt 1
806: is often used as
807: .Ic command
808: to rejustify the message.
1.43 jmc 809: .It Ic ~: Ns Ar mail-command
1.1 deraadt 810: Execute the given mail command.
811: Not all commands, however, are allowed.
1.43 jmc 812: .It Ic ~~ Ns Ar string
1.1 deraadt 813: Insert the string of text in the message prefaced by a single ~.
814: If
815: you have changed the escape character, then you should double
816: that character in order to send it.
817: .El
1.22 aaron 818: .Ss Mail options
1.1 deraadt 819: Options are controlled via
820: .Ic set
821: and
822: .Ic unset
823: commands.
824: Options may be either binary, in which case it is only
825: significant to see whether they are set or not; or string, in which
826: case the actual value is of interest.
827: The binary options include the following:
828: .Bl -tag -width append
829: .It Ar append
830: Causes messages saved in
831: .Ar mbox
832: to be appended to the end rather than prepended.
833: This should always be set (perhaps in
834: .Pa /etc/mail.rc ) .
1.25 aaron 835: .It Ar ask , asksub
1.1 deraadt 836: Causes
837: .Nm mail
838: to prompt you for the subject of each message you send.
839: If
840: you respond with simply a newline, no subject field will be sent.
1.45 jmc 841: .It Ar askbcc
842: Causes you to be prompted for additional blind carbon copy recipients at the
843: end of each message.
844: Responding with a newline indicates your
845: satisfaction with the current list.
1.1 deraadt 846: .It Ar askcc
847: Causes you to be prompted for additional carbon copy recipients at the
848: end of each message.
849: Responding with a newline indicates your
850: satisfaction with the current list.
1.5 millert 851: .It Ar autoinc
852: Causes new mail to be automatically incorporated when it arrives.
853: Setting this is similar to issuing the
854: .Ic inc
855: command at each prompt, except that the current message is not
856: reset when new mail arrives.
1.1 deraadt 857: .It Ar autoprint
858: Causes the
859: .Ic delete
860: command to behave like
1.25 aaron 861: .Ic dp ;
862: thus, after deleting a message, the next one will be typed
1.1 deraadt 863: automatically.
864: .It Ar debug
865: Setting the binary option
866: .Ar debug
867: is the same as specifying
868: .Fl d
869: on the command line and causes
870: .Nm mail
871: to output all sorts of information useful for debugging
1.22 aaron 872: .Nm mail .
1.1 deraadt 873: .It Ar dot
874: The binary option
875: .Ar dot
876: causes
877: .Nm mail
878: to interpret a period alone on a line as the terminator
879: of a message you are sending.
880: .It Ar hold
881: This option is used to hold messages in the system mailbox
882: by default.
883: .It Ar ignore
884: Causes interrupt signals from your terminal to be ignored and echoed as
885: @'s.
886: .It Ar ignoreeof
887: An option related to
888: .Ar dot
889: is
890: .Ar ignoreeof
891: which makes
892: .Nm mail
1.36 millert 893: refuse to accept a control-D as the end of a message.
1.25 aaron 894: .Ar ignoreeof
1.1 deraadt 895: also applies to
896: .Nm mail
897: command mode.
1.45 jmc 898: .It Ar keep
899: Setting this option causes
900: .Nm
901: to truncate your system mailbox instead of deleting it
902: when it's empty.
903: .It Ar keepsave
904: Messages saved with the
905: .Ic save
906: command are not normally saved in
907: .Ar mbox
908: at quit time.
909: Use this option to retain those messages.
1.1 deraadt 910: .It Ar metoo
911: Usually, when a group is expanded that contains the sender, the sender
912: is removed from the expansion.
913: Setting this option causes the sender
914: to be included in the group.
915: .It Ar noheader
916: Setting the option
917: .Ar noheader
918: is the same as giving the
919: .Fl N
920: flag on the command line.
921: .It Ar nosave
1.36 millert 922: Normally, when you abort a message with two interrupt characters
923: (usually control-C),
1.1 deraadt 924: .Nm mail
925: copies the partial letter to the file
1.22 aaron 926: .Pa dead.letter
1.1 deraadt 927: in your home directory.
928: Setting the binary option
929: .Ar nosave
930: prevents this.
1.48 jmc 931: .It Ar quiet
932: Suppresses the printing of the version when first invoked.
1.1 deraadt 933: .It Ar Replyall
934: Reverses the sense of
935: .Ic reply
936: and
937: .Ic Reply
938: commands.
939: .It Ar searchheaders
1.22 aaron 940: If this option is set, then a message-list specifier in the form
941: .Dq /x:y
942: will expand to all messages containing the substring
1.45 jmc 943: .Sq y
1.22 aaron 944: in the header
945: field
1.45 jmc 946: .Sq x .
1.27 aaron 947: The string search is case insensitive.
948: If
1.45 jmc 949: .Sq x
1.22 aaron 950: is omitted, it will default to the
951: .Dq Subject
952: header field.
953: The form
954: .Dq /to:y
955: is a special case, and will expand
956: to all messages containing the substring
1.45 jmc 957: .Sq y
1.22 aaron 958: in the
959: .Dq To ,
960: .Dq Cc
961: or
962: .Dq Bcc
963: header fields.
964: The check for
965: .Dq to
966: is case sensitive, so that
967: .Dq /To:y
968: can be used to limit the search for
1.45 jmc 969: .Sq y
1.22 aaron 970: to just the
971: .Dq To:
972: field.
1.53 martynas 973: .It Ar skipempty
974: Don't send messages with an empty body.
1.1 deraadt 975: .It Ar verbose
976: Setting the option
977: .Ar verbose
978: is the same as using the
979: .Fl v
980: flag on the command line.
1.45 jmc 981: When
982: .Nm
983: runs in verbose mode,
1.1 deraadt 984: the actual delivery of messages is displayed on the user's
985: terminal.
986: .El
1.22 aaron 987: .Ss Option string values
1.1 deraadt 988: .Bl -tag -width Va
989: .It Ev EDITOR
990: Pathname of the text editor to use in the
991: .Ic edit
992: command and
1.43 jmc 993: .Ic ~e
1.1 deraadt 994: escape.
1.45 jmc 995: If not defined,
996: .Pa /usr/bin/ex
997: is used.
1.1 deraadt 998: .It Ev LISTER
999: Pathname of the directory lister to use in the
1000: .Ic folders
1001: command.
1002: Default is
1003: .Pa /bin/ls .
1.45 jmc 1004: .It Ev MBOX
1005: The name of the
1006: .Ar mbox
1007: file.
1008: It can be the name of a folder.
1009: The default is
1010: .Dq Li mbox
1011: in the user's home directory.
1.1 deraadt 1012: .It Ev PAGER
1013: Pathname of the program to use in the
1014: .Ic more
1.45 jmc 1015: command or when the
1.49 jmc 1016: .Ar crt
1.1 deraadt 1017: variable is set.
1018: The default paginator
1019: .Xr more 1
1020: is used if this option is not defined.
1021: .It Ev SHELL
1022: Pathname of the shell to use in the
1.41 jmc 1023: .Ic !\&
1.1 deraadt 1024: command and the
1.42 jmc 1025: .Ic ~!\&
1.1 deraadt 1026: escape.
1027: A default shell is used if this option is
1028: not defined.
1.52 martynas 1029: .It Ev TMPDIR
1030: Directory in which temporary files are stored.
1.1 deraadt 1031: .It Ev VISUAL
1032: Pathname of the text editor to use in the
1033: .Ic visual
1034: command and
1.43 jmc 1035: .Ic ~v
1.1 deraadt 1036: escape.
1.45 jmc 1037: If not defined,
1038: .Pa /usr/bin/vi
1039: is used.
1.49 jmc 1040: .It Ar crt
1.1 deraadt 1041: The valued option
1.49 jmc 1042: .Ar crt
1.1 deraadt 1043: is used as a threshold to determine how long a message must
1044: be before
1045: .Ev PAGER
1046: is used to read it.
1047: If
1.49 jmc 1048: .Ar crt
1.1 deraadt 1049: is set without a value,
1050: then the height of the terminal screen stored in the system
1051: is used to compute the threshold (see
1052: .Xr stty 1 ) .
1053: .It Ar escape
1054: If defined, the first character of this option gives the character to
1055: use in the place of ~ to denote escapes.
1056: .It Ar folder
1057: The name of the directory to use for storing folders of
1058: messages.
1.22 aaron 1059: If this name begins with a
1.25 aaron 1060: .Ql / ,
1.1 deraadt 1061: .Nm mail
1062: considers it to be an absolute pathname; otherwise, the
1063: folder directory is found relative to your home directory.
1064: .It Ar indentprefix
1.24 aaron 1065: String used by the
1.43 jmc 1066: .Ic ~m
1.22 aaron 1067: tilde escape for indenting messages, in place of the normal tab character
1.44 jmc 1068: .Pq Sq ^I .
1.1 deraadt 1069: Be sure to quote the value if it contains
1070: spaces or tabs.
1.45 jmc 1071: .It Ar record
1072: If defined, gives the pathname of the file used to record all outgoing
1073: mail.
1074: If not defined, then outgoing mail is not so saved.
1075: .It Ar screen
1076: Size of window of message headers for
1077: .Ic z .
1078: .It Ar sendmail
1079: Pathname to an alternative mail delivery system.
1.1 deraadt 1080: .It Ar toplines
1081: If defined, gives the number of lines of a message to be printed out
1082: with the
1083: .Ic top
1084: command; normally, the first five lines are printed.
1085: .El
1086: .Sh ENVIRONMENT
1.19 aaron 1087: .Nm mail
1.1 deraadt 1088: utilizes the
1.3 millert 1089: .Ev HOME ,
1090: .Ev LOGNAME ,
1.45 jmc 1091: .Ev MAIL ,
1092: .Ev MAILRC ,
1.1 deraadt 1093: and
1094: .Ev USER
1095: environment variables.
1.12 millert 1096: .Pp
1097: If the
1098: .Ev MAIL
1099: environment variable is set, its value is used as the path to the
1100: user's mail spool.
1.1 deraadt 1101: .Sh FILES
1102: .Bl -tag -width /usr/share/misc/mail.*help -compact
1103: .It Pa /var/mail/*
1.22 aaron 1104: post office (unless overridden by the
1.12 millert 1105: .Ev MAIL
1.22 aaron 1106: environment variable)
1.1 deraadt 1107: .It ~/mbox
1.22 aaron 1108: user's old mail
1.1 deraadt 1109: .It ~/.mailrc
1.22 aaron 1110: file giving initial mail commands; can be overridden by setting the
1.5 millert 1111: .Ev MAILRC
1.22 aaron 1112: environment variable
1.1 deraadt 1113: .It Pa /tmp/R*
1.22 aaron 1114: temporary files
1.1 deraadt 1115: .It Pa /usr/share/misc/mail.*help
1.22 aaron 1116: help files
1.1 deraadt 1117: .It Pa /etc/mail.rc
1.22 aaron 1118: system initialization file
1.1 deraadt 1119: .El
1120: .Sh SEE ALSO
1121: .Xr fmt 1 ,
1.17 millert 1122: .Xr lockspool 1 ,
1.1 deraadt 1123: .Xr vacation 1 ,
1124: .Xr aliases 5 ,
1125: .Xr mailaddr 7 ,
1.12 millert 1126: .Xr mail.local 8 ,
1.31 millert 1127: .Xr newaliases 8 ,
1.1 deraadt 1128: .Xr sendmail 8
1.43 jmc 1129: .Pp
1.48 jmc 1130: "Mail Reference Manual",
1.43 jmc 1131: .Pa /usr/share/doc/usd/07.mail/ .
1.1 deraadt 1132: .Sh HISTORY
1133: A
1134: .Nm mail
1.28 aaron 1135: command appeared in
1.34 mickey 1136: .At v3 .
1.48 jmc 1137: This man page is derived from the
1138: .%T "Mail Reference Manual"
1.1 deraadt 1139: originally written by Kurt Shoens.
1140: .Sh BUGS
1141: There are some flags that are not documented here.
1142: Most are
1143: not useful to the general user.
1144: .Pp
1145: Usually,
1146: .Nm mail
1.11 deraadt 1147: and
1148: .Nm mailx
1149: are just links to
1.22 aaron 1150: .Nm Mail ,
1.1 deraadt 1151: which can be confusing.