Annotation of src/usr.bin/mail/mail.1, Revision 1.79
1.79 ! schwarze 1: .\" $OpenBSD: mail.1,v 1.78 2017/05/29 12:50:33 jmc Exp $
1.5 millert 2: .\"
1.1 deraadt 3: .\" Copyright (c) 1980, 1990, 1993
4: .\" The Regents of the University of California. All rights reserved.
5: .\"
6: .\" Redistribution and use in source and binary forms, with or without
7: .\" modification, are permitted provided that the following conditions
8: .\" are met:
9: .\" 1. Redistributions of source code must retain the above copyright
10: .\" notice, this list of conditions and the following disclaimer.
11: .\" 2. Redistributions in binary form must reproduce the above copyright
12: .\" notice, this list of conditions and the following disclaimer in the
13: .\" documentation and/or other materials provided with the distribution.
1.37 millert 14: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 15: .\" may be used to endorse or promote products derived from this software
16: .\" without specific prior written permission.
17: .\"
18: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28: .\" SUCH DAMAGE.
29: .\"
1.5 millert 30: .\" @(#)mail.1 8.8 (Berkeley) 4/28/95
1.1 deraadt 31: .\"
1.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.79 ! schwarze 361: entirety \(em 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.79 ! schwarze 562: or CR)
1.1 deraadt 563: Goes to the next message in sequence and types it.
564: With an argument list, types the next matching message.
565: .It Ic preserve
566: .Pq Ic pre
567: A synonym for
1.22 aaron 568: .Ic hold .
1.49 jmc 569: .It Ic Print
570: .Pq Ic P
571: Like
572: .Ic print
573: but also prints out ignored header fields.
574: See also
575: .Ic print ,
576: .Ic ignore ,
577: and
578: .Ic retain .
1.1 deraadt 579: .It Ic print
580: .Pq Ic p
581: Takes a message list and types out each message on the user's terminal.
582: .It Ic quit
583: .Pq Ic q
584: Terminates the session, saving all undeleted, unsaved messages in
585: the user's
586: .Ar mbox
587: file in his login directory, preserving all messages marked with
588: .Ic hold
589: or
590: .Ic preserve
591: or never referenced
592: in his system mailbox, and removing all other messages from his system
593: mailbox.
594: If new mail has arrived during the session, the message
595: .Dq Li "You have new mail"
596: is given.
597: If given while editing a
598: mailbox file with the
599: .Fl f
600: flag, then the edit file is rewritten.
1.15 aaron 601: A return to the shell is
1.18 aaron 602: effected, unless the rewrite of edit file fails, in which case the user
1.1 deraadt 603: can escape with the
604: .Ic exit
605: command.
1.49 jmc 606: .It Ic Reply
607: .Pq Ic R
608: Reply to originator.
609: Does not reply to other
610: recipients of the original message.
1.1 deraadt 611: .It Ic reply
612: .Pq Ic r
613: Takes a message list and sends mail to the sender and all
614: recipients of the specified message.
615: The default message must not be deleted.
616: .It Ic respond
617: A synonym for
1.22 aaron 618: .Ic reply .
1.1 deraadt 619: .It Ic retain
620: Add the list of header fields named to the
1.22 aaron 621: .Ar retained list .
1.1 deraadt 622: Only the header fields in the retain list
623: are shown on your terminal when you print a message.
624: All other header fields are suppressed.
625: The
626: .Ic Type
627: and
628: .Ic Print
629: commands can be used to print a message in its entirety.
630: If
631: .Ic retain
632: is executed with no arguments, it lists the current set of
633: retained fields.
634: .It Ic save
635: .Pq Ic s
636: Takes a message list and a filename and appends each message in
637: turn to the end of the file.
638: The filename in quotes, followed by the line
639: count and character count is echoed on the user's terminal.
640: .It Ic saveignore
1.25 aaron 641: .Ic saveignore
1.1 deraadt 642: is to
643: .Ic save
644: what
645: .Ic ignore
646: is to
647: .Ic print
648: and
1.22 aaron 649: .Ic type .
1.1 deraadt 650: Header fields thus marked are filtered out when
651: saving a message by
652: .Ic save
653: or when automatically saving to
1.22 aaron 654: .Ar mbox .
1.1 deraadt 655: .It Ic saveretain
1.25 aaron 656: .Ic saveretain
1.1 deraadt 657: is to
658: .Ic save
659: what
660: .Ic retain
661: is to
662: .Ic print
663: and
1.22 aaron 664: .Ic type .
1.1 deraadt 665: Header fields thus marked are the only ones saved
666: with a message when saving by
667: .Ic save
668: or when automatically saving to
1.22 aaron 669: .Ar mbox .
1.25 aaron 670: .Ic saveretain
1.1 deraadt 671: overrides
1.22 aaron 672: .Ic saveignore .
1.45 jmc 673: .It Ic set
674: .Pq Ic se
675: With no arguments, prints all variable values.
676: Otherwise, sets
677: option.
678: Arguments are of the form
679: .Ar option=value
680: (no space before or after =) or
681: .Ar option .
682: Quotation marks may be placed around any part of the assignment statement to
683: quote blanks or tabs, i.e.,
684: .Ic set indentprefix="->" .
1.1 deraadt 685: .It Ic shell
686: .Pq Ic sh
687: Invokes an interactive version of the shell.
688: .It Ic size
689: Takes a message list and prints out the size in characters of each
690: message.
691: .It Ic source
692: The
693: .Ic source
694: command reads
695: commands from a file.
696: .It Ic top
697: Takes a message list and prints the top few lines of each.
698: The number of
699: lines printed is controlled by the variable
700: .Ic toplines
701: and defaults to five.
1.49 jmc 702: .It Ic Type
703: .Pq Ic T
704: Identical to the
705: .Ic Print
706: command.
1.1 deraadt 707: .It Ic type
708: .Pq Ic t
709: A synonym for
1.22 aaron 710: .Ic print .
1.1 deraadt 711: .It Ic unalias
712: Takes a list of names defined by
713: .Ic alias
714: commands and discards the remembered groups of users.
715: The group names
716: no longer have any significance.
717: .It Ic undelete
718: .Pq Ic u
1.49 jmc 719: Takes a message list and marks each message as not being deleted.
1.1 deraadt 720: .It Ic unread
721: .Pq Ic U
1.49 jmc 722: Takes a message list and marks each message as not having been read.
1.1 deraadt 723: .It Ic unset
724: Takes a list of option names and discards their remembered values;
725: the inverse of
1.22 aaron 726: .Ic set .
1.1 deraadt 727: .It Ic visual
728: .Pq Ic v
729: Takes a message list and invokes the display editor on each message.
730: .It Ic write
731: .Pq Ic w
732: Similar to
1.22 aaron 733: .Ic save ,
1.1 deraadt 734: except that
735: .Ic only
736: the message body
1.49 jmc 737: (without the header)
1.16 millert 738: is saved.
1.1 deraadt 739: Extremely useful for such tasks as sending and receiving source
740: program text over the message system.
741: .It Ic xit
742: .Pq Ic x
743: A synonym for
1.22 aaron 744: .Ic exit .
1.1 deraadt 745: .It Ic z
1.19 aaron 746: .Nm mail
1.1 deraadt 747: presents message headers in windowfuls as described under the
748: .Ic headers
749: command.
750: You can move
751: .Nm mail Ns 's
752: attention forward to the next window with the
1.43 jmc 753: .Ic z
1.1 deraadt 754: command.
755: Also, you can move to the previous window by using
1.43 jmc 756: .Ic z- .
1.1 deraadt 757: .El
1.22 aaron 758: .Ss Tilde/escapes
1.1 deraadt 759: Here is a summary of the tilde escapes,
760: which are used when composing messages to perform
761: special functions.
762: Tilde escapes are only recognized at the beginning
763: of lines.
764: The name
1.22 aaron 765: .Dq tilde escape
1.1 deraadt 766: is somewhat of a misnomer since the actual escape character can be set
767: by the option
768: .Ic escape .
1.58 martynas 769: .Pp
770: .Bl -tag -width Ds -compact
1.43 jmc 771: .It Ic ~b Ns Ar name ...
1.1 deraadt 772: Add the given names to the list of carbon copy recipients but do not make
773: the names visible in the Cc: line ("blind" carbon copy).
1.58 martynas 774: .Pp
1.43 jmc 775: .It Ic ~c Ns Ar name ...
1.1 deraadt 776: Add the given names to the list of carbon copy recipients.
1.58 martynas 777: .Pp
1.43 jmc 778: .It Ic ~d
1.1 deraadt 779: Read the file
1.22 aaron 780: .Pa dead.letter
1.1 deraadt 781: from your home directory into the message.
1.58 martynas 782: .Pp
1.43 jmc 783: .It Ic ~e
1.1 deraadt 784: Invoke the text editor on the message collected so far.
785: After the
786: editing session is finished, you may continue appending text to the
787: message.
1.58 martynas 788: .Pp
1.49 jmc 789: .It Ic ~F Ns Ar messages
790: Identical to
791: .Ic ~f ,
792: except all message headers are included.
1.58 martynas 793: .Pp
1.43 jmc 794: .It Ic ~f Ns Ar messages
1.1 deraadt 795: Read the named messages into the message being sent.
796: If no messages are specified, read in the current message.
797: Message headers currently being ignored (by the
798: .Ic ignore
799: or
800: .Ic retain
801: command) are not included.
1.58 martynas 802: .Pp
1.43 jmc 803: .It Ic ~h
1.1 deraadt 804: Edit the message header fields by typing each one in turn and allowing
805: the user to append text to the end or modify the field by using the
806: current terminal erase and kill characters.
1.58 martynas 807: .Pp
1.49 jmc 808: .It Ic ~M Ns Ar messages
809: Identical to
810: .Ic ~m ,
811: except all message headers are included.
1.58 martynas 812: .Pp
1.43 jmc 813: .It Ic ~m Ns Ar messages
1.1 deraadt 814: Read the named messages into the message being sent, indented by a
815: tab or by the value of
1.25 aaron 816: .Va indentprefix .
1.1 deraadt 817: If no messages are specified,
818: read the current message.
819: Message headers currently being ignored (by the
820: .Ic ignore
821: or
822: .Ic retain
823: command) are not included.
1.58 martynas 824: .Pp
1.43 jmc 825: .It Ic ~p
1.1 deraadt 826: Print out the message collected so far, prefaced by the message header
827: fields.
1.58 martynas 828: .Pp
1.43 jmc 829: .It Ic ~q
1.1 deraadt 830: Abort the message being sent, copying the message to
1.22 aaron 831: .Pa dead.letter
1.1 deraadt 832: in your home directory if
833: .Ic save
834: is set.
1.58 martynas 835: .Pp
1.43 jmc 836: .It Ic ~r Ns Ar filename
1.58 martynas 837: .It Ic ~< Ns Ar filename
1.1 deraadt 838: Read the named file into the message.
1.58 martynas 839: .Pp
1.43 jmc 840: .It Ic ~s Ns Ar string
1.1 deraadt 841: Cause the named string to become the current subject field.
1.58 martynas 842: .Pp
1.43 jmc 843: .It Ic ~t Ns Ar name ...
1.1 deraadt 844: Add the given names to the direct recipient list.
1.58 martynas 845: .Pp
1.43 jmc 846: .It Ic ~v
1.1 deraadt 847: Invoke an alternate editor (defined by the
848: .Ev VISUAL
849: option) on the
850: message collected so far.
851: Usually, the alternate editor will be a
852: screen editor.
853: After you quit the editor, you may resume appending
854: text to the end of your message.
1.58 martynas 855: .Pp
1.43 jmc 856: .It Ic ~w Ns Ar filename
1.1 deraadt 857: Write the message onto the named file.
1.58 martynas 858: .Pp
1.55 martynas 859: .It Ic ~x
860: Abort the message being sent.
861: No message is copied to
862: .Pa ~/dead.letter ,
863: even if
864: .Ic save
865: is set.
1.58 martynas 866: .Pp
1.56 jmc 867: .It Ic ~?
868: Prints a brief summary of tilde escapes.
1.58 martynas 869: .Pp
1.56 jmc 870: .It Ic ~! Ns Ar command
871: Execute the indicated shell command, then return to the message.
1.58 martynas 872: .Pp
1.43 jmc 873: .It Ic ~| Ns Ar command
1.1 deraadt 874: Pipe the message through the command as a filter.
875: If the command gives
876: no output or terminates abnormally, retain the original text of the
877: message.
878: The command
879: .Xr fmt 1
880: is often used as
881: .Ic command
882: to rejustify the message.
1.58 martynas 883: .Pp
1.43 jmc 884: .It Ic ~: Ns Ar mail-command
1.58 martynas 885: .It Ic ~_ Ns Ar mail-command
1.1 deraadt 886: Execute the given mail command.
887: Not all commands, however, are allowed.
1.58 martynas 888: .Pp
1.43 jmc 889: .It Ic ~~ Ns Ar string
1.1 deraadt 890: Insert the string of text in the message prefaced by a single ~.
891: If
892: you have changed the escape character, then you should double
893: that character in order to send it.
1.58 martynas 894: .Pp
895: .It Ic ~.
896: Simulate end of file on input.
1.1 deraadt 897: .El
1.22 aaron 898: .Ss Mail options
1.78 jmc 899: A number of options can be set in the
900: .Pa .mailrc
901: file to alter the behavior of
902: .Nm ,
903: controlled via the
1.1 deraadt 904: .Ic set
905: and
906: .Ic unset
907: commands.
908: Options may be either binary, in which case it is only
909: significant to see whether they are set or not; or string, in which
910: case the actual value is of interest.
911: The binary options include the following:
912: .Bl -tag -width append
913: .It Ar append
914: Causes messages saved in
915: .Ar mbox
916: to be appended to the end rather than prepended.
917: This should always be set (perhaps in
918: .Pa /etc/mail.rc ) .
1.25 aaron 919: .It Ar ask , asksub
1.1 deraadt 920: Causes
921: .Nm mail
922: to prompt you for the subject of each message you send.
923: If
924: you respond with simply a newline, no subject field will be sent.
1.45 jmc 925: .It Ar askbcc
926: Causes you to be prompted for additional blind carbon copy recipients at the
927: end of each message.
928: Responding with a newline indicates your
929: satisfaction with the current list.
1.1 deraadt 930: .It Ar askcc
931: Causes you to be prompted for additional carbon copy recipients at the
932: end of each message.
933: Responding with a newline indicates your
934: satisfaction with the current list.
1.5 millert 935: .It Ar autoinc
936: Causes new mail to be automatically incorporated when it arrives.
937: Setting this is similar to issuing the
938: .Ic inc
939: command at each prompt, except that the current message is not
940: reset when new mail arrives.
1.1 deraadt 941: .It Ar autoprint
942: Causes the
943: .Ic delete
944: command to behave like
1.25 aaron 945: .Ic dp ;
946: thus, after deleting a message, the next one will be typed
1.1 deraadt 947: automatically.
948: .It Ar debug
949: Setting the binary option
950: .Ar debug
951: is the same as specifying
952: .Fl d
953: on the command line and causes
954: .Nm mail
955: to output all sorts of information useful for debugging
1.22 aaron 956: .Nm mail .
1.1 deraadt 957: .It Ar dot
958: The binary option
959: .Ar dot
960: causes
961: .Nm mail
962: to interpret a period alone on a line as the terminator
963: of a message you are sending.
1.69 millert 964: .It Ar expandaddr
965: Causes
966: .Nm mail
967: to expand message recipient addresses, as explained in the section
968: .Sx Recipient address specifications .
1.73 millert 969: .It Ar from
970: Causes
971: .Nm mail
972: to use the specified sender address in the
973: .Dq From:
974: field of the message header.
975: A stripped down version of the address is also used in the message envelope.
976: If unset, the message will not include an explicit sender address and
977: a default value will be added by the MTA, typically
978: .Dq user@host .
979: This value can be overridden by specifying the
980: .Fl r
981: flag on the command line.
1.1 deraadt 982: .It Ar hold
983: This option is used to hold messages in the system mailbox
984: by default.
985: .It Ar ignore
986: Causes interrupt signals from your terminal to be ignored and echoed as
987: @'s.
988: .It Ar ignoreeof
989: An option related to
990: .Ar dot
991: is
992: .Ar ignoreeof
993: which makes
994: .Nm mail
1.36 millert 995: refuse to accept a control-D as the end of a message.
1.25 aaron 996: .Ar ignoreeof
1.1 deraadt 997: also applies to
998: .Nm mail
999: command mode.
1.45 jmc 1000: .It Ar keep
1001: Setting this option causes
1002: .Nm
1003: to truncate your system mailbox instead of deleting it
1004: when it's empty.
1005: .It Ar keepsave
1006: Messages saved with the
1007: .Ic save
1008: command are not normally saved in
1009: .Ar mbox
1010: at quit time.
1011: Use this option to retain those messages.
1.1 deraadt 1012: .It Ar metoo
1013: Usually, when a group is expanded that contains the sender, the sender
1014: is removed from the expansion.
1015: Setting this option causes the sender
1016: to be included in the group.
1017: .It Ar noheader
1018: Setting the option
1019: .Ar noheader
1020: is the same as giving the
1021: .Fl N
1022: flag on the command line.
1023: .It Ar nosave
1.36 millert 1024: Normally, when you abort a message with two interrupt characters
1025: (usually control-C),
1.1 deraadt 1026: .Nm mail
1027: copies the partial letter to the file
1.22 aaron 1028: .Pa dead.letter
1.1 deraadt 1029: in your home directory.
1030: Setting the binary option
1031: .Ar nosave
1032: prevents this.
1.48 jmc 1033: .It Ar quiet
1034: Suppresses the printing of the version when first invoked.
1.1 deraadt 1035: .It Ar Replyall
1036: Reverses the sense of
1037: .Ic reply
1038: and
1039: .Ic Reply
1040: commands.
1041: .It Ar searchheaders
1.22 aaron 1042: If this option is set, then a message-list specifier in the form
1043: .Dq /x:y
1044: will expand to all messages containing the substring
1.45 jmc 1045: .Sq y
1.22 aaron 1046: in the header
1047: field
1.45 jmc 1048: .Sq x .
1.27 aaron 1049: The string search is case insensitive.
1050: If
1.45 jmc 1051: .Sq x
1.22 aaron 1052: is omitted, it will default to the
1053: .Dq Subject
1054: header field.
1055: The form
1056: .Dq /to:y
1057: is a special case, and will expand
1058: to all messages containing the substring
1.45 jmc 1059: .Sq y
1.22 aaron 1060: in the
1061: .Dq To ,
1062: .Dq Cc
1063: or
1064: .Dq Bcc
1065: header fields.
1066: The check for
1067: .Dq to
1068: is case sensitive, so that
1069: .Dq /To:y
1070: can be used to limit the search for
1.45 jmc 1071: .Sq y
1.22 aaron 1072: to just the
1073: .Dq To:
1074: field.
1.53 martynas 1075: .It Ar skipempty
1076: Don't send messages with an empty body.
1.1 deraadt 1077: .It Ar verbose
1078: Setting the option
1079: .Ar verbose
1080: is the same as using the
1081: .Fl v
1082: flag on the command line.
1.45 jmc 1083: When
1084: .Nm
1085: runs in verbose mode,
1.1 deraadt 1086: the actual delivery of messages is displayed on the user's
1087: terminal.
1088: .El
1.22 aaron 1089: .Ss Option string values
1.1 deraadt 1090: .Bl -tag -width Va
1091: .It Ev EDITOR
1092: Pathname of the text editor to use in the
1093: .Ic edit
1094: command and
1.43 jmc 1095: .Ic ~e
1.1 deraadt 1096: escape.
1.45 jmc 1097: If not defined,
1098: .Pa /usr/bin/ex
1099: is used.
1.1 deraadt 1100: .It Ev LISTER
1101: Pathname of the directory lister to use in the
1102: .Ic folders
1103: command.
1104: Default is
1105: .Pa /bin/ls .
1.45 jmc 1106: .It Ev MBOX
1107: The name of the
1108: .Ar mbox
1109: file.
1110: It can be the name of a folder.
1111: The default is
1112: .Dq Li mbox
1113: in the user's home directory.
1.1 deraadt 1114: .It Ev PAGER
1115: Pathname of the program to use in the
1116: .Ic more
1.45 jmc 1117: command or when the
1.49 jmc 1118: .Ar crt
1.1 deraadt 1119: variable is set.
1120: The default paginator
1121: .Xr more 1
1122: is used if this option is not defined.
1123: .It Ev SHELL
1124: Pathname of the shell to use in the
1.41 jmc 1125: .Ic !\&
1.1 deraadt 1126: command and the
1.42 jmc 1127: .Ic ~!\&
1.1 deraadt 1128: escape.
1129: A default shell is used if this option is
1130: not defined.
1131: .It Ev VISUAL
1132: Pathname of the text editor to use in the
1133: .Ic visual
1134: command and
1.43 jmc 1135: .Ic ~v
1.1 deraadt 1136: escape.
1.45 jmc 1137: If not defined,
1138: .Pa /usr/bin/vi
1139: is used.
1.49 jmc 1140: .It Ar crt
1.1 deraadt 1141: The valued option
1.49 jmc 1142: .Ar crt
1.1 deraadt 1143: is used as a threshold to determine how long a message must
1144: be before
1145: .Ev PAGER
1146: is used to read it.
1147: If
1.49 jmc 1148: .Ar crt
1.1 deraadt 1149: is set without a value,
1150: then the height of the terminal screen stored in the system
1151: is used to compute the threshold (see
1152: .Xr stty 1 ) .
1153: .It Ar escape
1154: If defined, the first character of this option gives the character to
1155: use in the place of ~ to denote escapes.
1156: .It Ar folder
1157: The name of the directory to use for storing folders of
1158: messages.
1.22 aaron 1159: If this name begins with a
1.25 aaron 1160: .Ql / ,
1.1 deraadt 1161: .Nm mail
1162: considers it to be an absolute pathname; otherwise, the
1163: folder directory is found relative to your home directory.
1164: .It Ar indentprefix
1.24 aaron 1165: String used by the
1.43 jmc 1166: .Ic ~m
1.22 aaron 1167: tilde escape for indenting messages, in place of the normal tab character
1.44 jmc 1168: .Pq Sq ^I .
1.1 deraadt 1169: Be sure to quote the value if it contains
1170: spaces or tabs.
1.45 jmc 1171: .It Ar record
1172: If defined, gives the pathname of the file used to record all outgoing
1173: mail.
1174: If not defined, then outgoing mail is not so saved.
1175: .It Ar screen
1176: Size of window of message headers for
1177: .Ic z .
1178: .It Ar sendmail
1179: Pathname to an alternative mail delivery system.
1.1 deraadt 1180: .It Ar toplines
1181: If defined, gives the number of lines of a message to be printed out
1182: with the
1183: .Ic top
1184: command; normally, the first five lines are printed.
1185: .El
1186: .Sh ENVIRONMENT
1.19 aaron 1187: .Nm mail
1.1 deraadt 1188: utilizes the
1.3 millert 1189: .Ev HOME ,
1190: .Ev LOGNAME ,
1.45 jmc 1191: .Ev MAIL ,
1192: .Ev MAILRC ,
1.1 deraadt 1193: and
1194: .Ev USER
1195: environment variables.
1.12 millert 1196: .Pp
1197: If the
1198: .Ev MAIL
1199: environment variable is set, its value is used as the path to the
1200: user's mail spool.
1.1 deraadt 1201: .Sh FILES
1202: .Bl -tag -width /usr/share/misc/mail.*help -compact
1203: .It Pa /var/mail/*
1.22 aaron 1204: post office (unless overridden by the
1.12 millert 1205: .Ev MAIL
1.22 aaron 1206: environment variable)
1.75 sobrado 1207: .It Pa ~/mbox
1.22 aaron 1208: user's old mail
1.75 sobrado 1209: .It Pa ~/.mailrc
1.22 aaron 1210: file giving initial mail commands; can be overridden by setting the
1.5 millert 1211: .Ev MAILRC
1.22 aaron 1212: environment variable
1.1 deraadt 1213: .It Pa /tmp/R*
1.22 aaron 1214: temporary files
1.1 deraadt 1215: .It Pa /usr/share/misc/mail.*help
1.22 aaron 1216: help files
1.1 deraadt 1217: .It Pa /etc/mail.rc
1.22 aaron 1218: system initialization file
1.1 deraadt 1219: .El
1.60 jmc 1220: .Sh EXIT STATUS
1221: .Ex -std mail
1.1 deraadt 1222: .Sh SEE ALSO
1223: .Xr fmt 1 ,
1.17 millert 1224: .Xr lockspool 1 ,
1.1 deraadt 1225: .Xr vacation 1 ,
1226: .Xr aliases 5 ,
1.12 millert 1227: .Xr mail.local 8 ,
1.31 millert 1228: .Xr newaliases 8 ,
1.65 jmc 1229: .Xr sendmail 8 ,
1230: .Xr smtpd 8
1.57 jmc 1231: .Sh STANDARDS
1232: The
1233: .Nm mailx
1234: utility is compliant with the
1235: .St -p1003.1-2008
1236: specification.
1237: .Pp
1238: The flags
1.62 jmc 1239: .Op Fl iNnu
1240: are marked by
1241: .St -p1003.1-2008
1242: as being optional.
1243: .Pp
1244: The flags
1245: .Op Fl eFH
1246: are marked by
1247: .St -p1003.1-2008
1248: as being optional,
1.64 jmc 1249: and are not supported by this implementation of
1.62 jmc 1250: .Nm mailx .
1251: .Pp
1252: The flags
1.74 jmc 1253: .Op Fl bcdEIrv
1.62 jmc 1254: are extensions to the specification.
1.1 deraadt 1255: .Sh HISTORY
1256: A
1257: .Nm mail
1.28 aaron 1258: command appeared in
1.34 mickey 1259: .At v3 .
1.48 jmc 1260: This man page is derived from the
1261: .%T "Mail Reference Manual"
1.1 deraadt 1262: originally written by Kurt Shoens.
1263: .Sh BUGS
1264: Usually,
1265: .Nm mail
1.11 deraadt 1266: and
1267: .Nm mailx
1268: are just links to
1.22 aaron 1269: .Nm Mail ,
1.1 deraadt 1270: which can be confusing.