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