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