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