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