Penguin
Annotated edit history of Mail(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 ----
2 __NAME__
3
4
5 mail, mailx, Mail - send and receive mail
6 __SYNOPSIS__
7
8
9 mail [[-ieInv] [[-s subject] [[-a header] [[-c cc-addr] [[-b
10 bcc-addr] to-addr [[...] [[-sendmail-options
11 [[...]]
12
13
14 mail [[-ieInNv] -f [[name]
15
16
17 mail [[-ieInNv] [[-u user]
18 __DESCRIPTION__
19
20
21 mail is an intelligent mail processing system which has a
22 command syntax reminiscent of ed(1) with lines
23 replaced by messages.
24
25
26 The options are as follows:
27 -v Verbose mode. The details of delivery are displayedon the user's terminal.
28
29
30 -iIgnore tty interrupt signals. This is particularlyuseful when using mail on noisy phone lines.-IForces mail to run in interactive mode, even wheninput is not a terminal. In particular, the special~ command character, used when sending mail, is onlyavailable interactively.-nInhibits reading /etc/mail.rc upon startup.
31
32
33 -N
34 Inhibits initial display of message headers when reading
35 mail or editing a mail folder.
36
37
38 -s subject
39 Specify subject on command line (only the first argu- ment
40 after the -s flag is used as a subject; be care- ful to
41 quote subjects containing spaces).
42
43
44 -c list
45 Send carbon copies to list of users. list should be a comma
46 separated list of names.
47
48
49 -a
50 Specify additional header fields on the command line such as
51
52
53 -e
54 Don't send empty mails. If the body is empty skip the
55 mail.
56
57
58 -b list
59 Send blind carbon copies to list.
60
61
62 -f name
63 Read in the contents of your mailbox (or the speci- fied
64 file name) for processing; when you quit, mail writes
65 undeleted messages back to this file.
66
67
68 -u user
69 Is equivalent to:
70
71
72 mail -f /var/mail/user
73
74
75 except that locking is done.
76
77
78 __Startup actions__
79 At startup time, mail will execute commands in the system
80 command file /etc/mail.rc unless explicitly told
81 not to by using the -n option. Next, the commands in the
82 user's per- sonal command file ~/.mailrc are
83 executed. mail then exam- ines its command line options to
84 determine whether the user requested a new message to be
85 sent or existing messages in a mailbox to be
86 examined.
87
88
89 __Sending mail__
90 To send a message to one or more people, mail can be invoked
91 with arguments which are the names of people to whom the
92 mail will be sent. You are then expected to type in your
93 message, followed by a control-D (^D) at the beginning of a
94 line. The section below, Replying to or originating mail,
95 describes some features of mail available to help you com-
96 pose your letter.
97
98
99 __Reading mail__
100 In normal usage, mail is given no arguments and checks your
101 mail out of the post office, then prints out a one line
102 header of each message found. The current message is ini-
103 tially set to the first message (numbered 1) and can be
104 printed using the print command (which can be abbreviated
105 p). Moving among the messages is much like moving between
106 lines in ed(1); you may use + and - to shift
107 forwards and backwards, or simply enter a message number to
108 move directly.
109
110
111 __Disposing of mail__
112 After examining a message you can delete (d) or reply (r) to
113 it. Deletion causes the mail program to forget about the
114 message. This is not irreversible; the message can be
115 undeleted (u) by giving its number, or the mail session can
116 be aborted by giving the exit (x) command. Deleted mes-
117 sages, however, will usually disappear, never to be seen
118 again.
119
120
121 __Specifying messages__
122 Commands such as print and delete can be given a list of
123 message numbers as arguments to apply to a number of mes-
124 sages at once. Thus delete 1 2 deletes messages 1 and 2,
125 while delete 1-5 deletes messages 1 through 5. The special
126 name addresses all messages and $ addresses the last mes-
127 sage; thus the command top which prints the first few lines
128 of a message could be used in top to print the first few
129 lines of all messages.
130
131
132 __Replying to or originating mail__
133 You can use the reply command to set up a response to a mes-
134 sage, sending it back to the person who it was from. Text
135 you then type in, up to an end-of-file, defines the contents
136 of the message. While you are composing a message, mail
137 treats lines beginning with the tilde (~) character spe-
138 cially. For instance, typing ~m (alone on a line) will place
139 a copy of the current message into the response, right
140 shifting it by a single tab-stop (see ''indentprefix''
141 variable, below). Other escapes will set up subject fields,
142 add and delete recipients to the message and allow you to
143 escape to an editor to revise the message or to a shell to
144 run some commands. (These options are given in the summary
145 below.)
146
147
148 __Ending a mail processing session__
149 You can end a mail session with the quit (q) command. Mes-
150 sages which have been examined go to your mbox file unless
151 they have been deleted in which case they are discarded.
152 Unexamined messages go back to the post office (see the -f
153 option above).
154
155
156 __Personal and system wide distribution lists__
157 It is also possible to create personal distribution lists so
158 that, for instance, you can send mail to
159 ``cohorts'' and have it go to a group of people.
160 Such lists can be defined by placing a line
161 like
162
163
164 alias cohorts bill ozalp jkf mark
165 kridle@ucbcory
166
167
168 in the file .mailrc in your home directory. The
169 current list of such aliases can be displayed with the alias
170 command in mail. System wide distribution lists can be
171 created by editing /etc/aliases, (see
172 aliases(5) and sendmail(8)); these are
173 kept in a different syntax. In mail you send, personal
174 aliases will be expanded in mail sent to others so that they
175 will be able to reply to the recipients. System wide aliases
176 are not expanded when the mail is sent, but any reply
177 returned to the machine will have the system wide alias
178 expanded as all mail goes through
179 sendmail.
180
181
182 __Network mail (ARPA, UUCP, Berknet)__
183 See mailaddr(7) for a description of network
184 addresses.
185
186
187 mail has a number of options which can be set in the
188 .mailrc file to alter its behavior; thus set askcc
189 enables the askcc feature. (These options are summarized
190 below.)
191
192
193 __SUMMARY__
194
195
196 (Adapted from the ``Mail Reference Manual''.)
197
198
199 Each command is typed on a line by itself, and may take
200 arguments following the command word. The command need not
201 be typed in its entirety -- the first command which matches
202 the typed prefix is used. For commands which take message
203 lists as arguments, if no message list is given, then the
204 next message forward which satisfies the command's require-
205 ments is used. If there are no messages forward of the cur-
206 rent message, the search proceeds backwards, and if there
207 are no good messages at all, mail types ``No applicable
208 messages'' and aborts the command.
209 - Print out the preceding message. If given a numericargument n, goes to the nth previous message andprints it.
210
211
212 ?Prints a brief summary of commands.!Executes the shell (see sh(1) and csh(1)) command which follows.
213
214
215 Print
216 (P) Like print but also prints out ignored header fields.
217 See also print, ignore and retain.
218
219
220 Reply
221 (R) Reply to originator. Does not reply to other recipients
222 of the original message.
223
224
225 Type
226 (T) Identical to the Print command.
227
228
229 alias
230 (a) With no arguments, prints out all currently defined
231 aliases. With one argument, prints out that alias. With more
232 than one argument, creates a new alias or changes an old
233 one.
234
235
236 alternates
237 (alt) The alternates command is useful if you have accounts
238 on several machines. It can be used to inform mail that the
239 listed addresses are really you. When you reply to messages,
240 mail will not send a copy of the message to any of the
241 addresses listed on the alternates list. If the alternates
242 command is given with no argument, the current set of
243 alternate names is displayed.
244
245
246 chdir
247 (c) Changes the user's working directory to that specified,
248 if given. If no directory is given, then changes to the
249 user's login directory.
250
251
252 copy
253 (co) The copy command does the same thing that save does,
254 except that it does not mark the messages it is used on for
255 deletion when you quit.
256
257
258 delete
259 (d) Takes a list of messages as argument and marks them all
260 as deleted. Deleted messages will not be saved in mbox, nor
261 will they be available for most other commands.
262
263
264 dp
265 (also dt) Deletes the current message and prints the next
266 message. If there is no next message, mail says ``at
267 EOF''.
268
269
270 edit
271 (e) Takes a list of messages and points the text edi- tor at
272 each one in turn. On return from the editor, the message is
273 read back in.
274
275
276 exit
277 (ex or x) Effects an immediate return to the shell without
278 modifying the user's system mailbox, his mbox file, or his
279 edit file in -f.
280
281
282 file
283 (fi) The same as folder.
284
285
286 folders
287 List the names of the folders in your folder direc-
288 tory.
289
290
291 folder
292 (fo) The folder command switches to a new mail file or
293 folder. With no arguments, it tells you which file you are
294 currently reading. If you give it an argument, it will write
295 out changes (such as dele- tions) you have made in the
296 current file and read in the new file. Some special
297 conventions are recog- nized for the name. # means the
298 previous file, % means your system mailbox, %user means
299 user's system mailbox,
300
301
302 from
303 (f) Takes a list of messages and prints their message
304 headers.
305
306
307 headers
308 (h) Lists the current range of headers, which is an
309 18-message group. If a + argument is given, the
310 next 18-message group is printed; if a - argument
311 is given, the previous 18-message group is
312 printed.
313
314
315 help
316 A synonym for ?.
317
318
319 hold
320 (ho, also preserve) Takes a message list and marks each
321 message therein to be saved in the user's system mailbox
322 instead of in mbox. Does not override the delete
323 command.
324
325
326 ignore
327 Add the list of header fields named to the ignored list.
328 Header fields in the ignore list are not printed on your
329 terminal when you print a message. This command is very
330 handy for suppression of certain machine-generated header
331 fields. The Type and Print commands can be used to print a
332 message in its entirety, including ignored fields. If ignore
333 is executed with no arguments, it lists the current set of
334 ignored fields.
335
336
337 inc
338 Incorporate any new messages that have arrived while mail is
339 being read. The new messages are added to the end of the
340 message list, and the current message is reset to be the
341 first new mail message. This does not renumber the existing
342 message list, nor does it cause any changes made so far to
343 be saved.
344
345
346 mail
347 (m) Takes as argument login names and distribution group
348 names and sends mail to those people.
349
350
351 mbox
352 Indicate that a list of messages be sent to mbox in your
353 home directory when you quit. This is the default action for
354 messages if you do ''not'' have the hold option
355 set.
356
357
358 more
359 (mo) Takes a message list and invokes the pager on that
360 list.
361
362
363 next
364 (n) (like + or CR ) Goes to the next message
365 in sequence and types it. With an argument list, types the
366 next matching message.
367
368
369 preserve
370 (pre) A synonym for hold.
371
372
373 print
374 (p) Takes a message list and types out each message on the
375 user's terminal.
376
377
378 quit
379 (q) Terminates the session, saving all undeleted, unsaved
380 messages in the user's mbox file in his login directory,
381 preserving all messages marked with hold or preserve or
382 never referenced in his system mail- box, and removing all
383 other messages from his system mailbox. If new mail has
384 arrived during the session, the message ``You have new
385 mail'' is given. If given while editing a mailbox file
386 with the -f flag, then the edit file is rewritten. A return
387 to the shell is effected, unless the rewrite of edit file
388 fails, in which case the user can escape with the exit
389 command.
390
391
392 reply
393 (r) Takes a message list and sends mail to the sender and
394 all recipients of the specified message. The default message
395 must not be deleted.
396
397
398 respond
399 A synonym for reply.
400
401
402 retain
403 Add the list of header fields named to the retained list.
404 Only the header fields in the retain list are shown on your
405 terminal when you print a message. All other header fields
406 are suppressed. The Type and Print commands can be used to
407 print a message in its entirety. If retain is executed with
408 no arguments, it lists the current set of retained
409 fields.
410
411
412 save
413 (s) Takes a message list and a filename and appends each
414 message in turn to the end of the file. The filename in
415 quotes, followed by the line count and character count is
416 echoed on the user's terminal.
417
418
419 set
420 (se) With no arguments, prints all variable values.
421 Otherwise, sets option. Arguments are of the form
422 option=value (no space before or after =) or option.
423 Quotation marks may be placed around any part of the
424 assignment statement to quote blanks or tabs, i.e., set
425 indentprefix=
426
427
428 saveignore
429 saveignore is to save what ignore is to print and type.
430 Header fields thus marked are filtered out when saving a
431 message by save or when automatically saving to
432 mbox.
433
434
435 saveretain
436 saveretain is to save what retain is to print and type.
437 Header fields thus marked are the only ones saved with a
438 message when saving by save or when automatically saving to
439 mbox. saveretain overrides saveignore.
440
441
442 shell
443 (sh) Invokes an interactive version of the
444 shell.
445
446
447 size
448 Takes a message list and prints out the size in char- acters
449 of each message.
450
451
452 source
453 The source command reads commands from a file.
454
455
456 top
457 Takes a message list and prints the top few lines of each.
458 The number of lines printed is controlled by the variable
459 toplines and defaults to five.
460
461
462 type
463 (t) A synonym for print.
464
465
466 unalias
467 Takes a list of names defined by alias commands and discards
468 the remembered groups of users. The group names no longer
469 have any significance.
470
471
472 undelete
473 (u) Takes a message list and marks each message as not being
474 deleted.
475
476
477 unread
478 (U) Takes a message list and marks each message as not
479 having been read.
480
481
482 unset
483 Takes a list of option names and discards their remembered
484 values; the inverse of set.
485
486
487 visual
488 (v) Takes a message list and invokes the display edi- tor on
489 each message.
490
491
492 write
493 (w) Similar to save, except that only the message body
494 (without the header) is saved. Extremely useful for such
495 tasks as sending and receiving source pro- gram text over
496 the message system.
497
498
499 xit
500 (x) A synonym for exit.
501
502
503 z
504 mail presents message headers in windowfuls as described
505 under the headers command. You can move mail's attention
506 forward to the next window with the z command. Also, you can
507 move to the previous window by using z-.
508
509
510 __Tilde/escapes__
511 Here is a summary of the tilde escapes, which are used when
512 composing messages to perform special functions. Tilde
513 escapes are only recognized at the beginning of lines. The
514 name ``tilde escape'' is somewhat of a misnomer since the
515 actual escape character can be set by the option
516 escape.
517
518
519 ~!command
520 Execute the indicated shell command, then return to the
521 message.
522
523
524 ~bname ...
525 Add the given names to the list of carbon copy recip- ients
526 but do not make the names visible in the Cc: line
527 (
528
529
530 ~cname ...
531 Add the given names to the list of carbon copy recip-
532 ients.
533
534
535 ~d
536 Read the file dead.letter from your home directory
537 into the message.
538
539
540 ~e
541 Invoke the text editor on the message collected so far.
542 After the editing session is finished, you may continue
543 appending text to the message.
544
545
546 ~fmessages
547 Read the named messages into the message being sent. If no
548 messages are specified, read in the current message. Message
549 headers currently being ignored (by the ignore or retain
550 command) are not included.
551
552
553 ~Fmessages
554 Identical to ~f, except all message headers are
555 included.
556
557
558 ~h
559 Edit the message header fields by typing each one in turn
560 and allowing the user to append text to the end or modify
561 the field by using the current terminal erase and kill
562 characters.
563
564
565 ~mmessages
566 Read the named messages into the message being sent,
567 indented by a tab or by the value of ''indentprefix''. If
568 no messages are specified, read the current mes- sage.
569 Message headers currently being ignored (by the ignore or
570 retain command) are not included.
571
572
573 ~Mmessages
574 Identical to ~m, except all message headers are
575 included.
576
577
578 ~p
579 Print out the message collected so far, prefaced by the
580 message header fields.
581
582
583 ~q
584 Abort the message being sent, copying the message to
585 dead.letter in your home directory if save is
586 set.
587
588
589 ~Rstring
590 Use string as the Reply-To field.
591
592
593 ~rfilename
594 Read the named file into the message.
595
596
597 ~sstring
598 Cause the named string to become the current subject
599 field.
600
601
602 ~tname ...
603 Add the given names to the direct recipient
604 list.
605
606
607 ~v
608 Invoke an alternate editor (defined by the VISUAL
609 option) on the message collected so far. Usually, the
610 alternate editor will be a screen editor. After you quit the
611 editor, you may resume appending text to the end of your
612 message.
613
614
615 ~wfilename
616 Write the message onto the named file.
617
618
619 ~|command
620 Pipe the message through the command as a filter. If the
621 command gives no output or terminates abnormally, retain the
622 original text of the message. The command fmt(1) is
623 often used as command to rejustify the mes-
624 sage.
625
626
627 ~:mail-command
628 Execute the given mail command. Not all commands, however,
629 are allowed.
630
631
632 ~~string
633 Insert the string of text in the message prefaced by a
634 single ~. If you have changed the escape charac- ter, then
635 you should double that character in order to send
636 it.
637
638
639 __Mail options__
640 Options are controlled via set and unset commands. Options
641 may be either binary, in which case it is only significant
642 to see whether they are set or not; or string, in which case
643 the actual value is of interest. The binary options include
644 the following:
645
646
647 append
648 Causes messages saved in mbox to be appended to the end
649 rather than prepended. This should always be set (perhaps in
650 /etc/mail.rc).
651
652
653 ask, asksub
654 Causes mail to prompt you for the subject of each message
655 you send. If you respond with simply a new- line, no subject
656 field will be sent.
657
658
659 askcc
660 Causes you to be prompted for additional carbon copy
661 recipients at the end of each message. Responding with a
662 newline indicates your satisfaction with the current
663 list.
664
665
666 autoinc
667 Causes new mail to be automatically incorporated when it
668 arrives. Setting this is similar to issuing the inc command
669 at each prompt, except that the current message is not reset
670 when new mail arrives.
671
672
673 askbcc
674 Causes you to be prompted for additional blind carbon copy
675 recipients at the end of each message. Respond- ing with a
676 newline indicates your satisfaction with the current
677 list.
678
679
680 autoprint
681 Causes the delete command to behave like dp; thus, after
682 deleting a message, the next one will be typed
683 automatically.
684
685
686 debug
687 Setting the binary option debug is the same as speci- fying
688 -d on the command line and causes mail to out- put all sorts
689 of information useful for debugging mail.
690
691
692 dot
693 The binary option dot causes mail to interpret a period
694 alone on a line as the terminator of a message you are
695 sending.
696
697
698 hold
699 This option is used to hold messages in the system mailbox
700 by default.
701
702
703 ignore
704 Causes interrupt signals from your terminal to be ignored
705 and echoed as @'s.
706
707
708 ignoreeof
709 An option related to dot is ignoreeof which makes mail
710 refuse to accept a control-d as the end of a message.
711 ignoreeof also applies to mail command mode.
712
713
714 metoo
715 Usually, when a group is expanded that contains the sender,
716 the sender is removed from the expansion. Setting this
717 option causes the sender to be included in the
718 group.
719
720
721 noheader
722 Setting the option noheader is the same as giving the -N
723 flag on the command line.
724
725
726 nosave
727 Normally, when you abort a message with two
728 RUBOUT (erase or delete) mail copies the
729 partial letter to the file dead.letter in your home
730 directory. Setting the binary option nosave prevents
731 this.
732
733
734 Replyall
735 Reverses the sense of reply and Reply commands.
736
737
738 quiet
739 Suppresses the printing of the version when first
740 invoked.
741
742
743 searchheaders
744 If this option is set, then a message-list specifier in the
745 form ``/x:y'' will expand to all messages con- taining the
746 substring ``y'' in the header field ``x''. The string search
747 is case insensitive. If ``x'' is omitted, it will default to
748 the ``Subject'' header field. The form ``/to:y'' is a
749 special case, and will expand to all messages containing the
750 sub- string ``y'' in the ``To'', ``Cc'' or ``Bcc'' header
751 fields. The check for ``to'' is case sensitive, so that
752 ``/To:y'' can be used to limit the search for ``y'' to just
753 the ``To:'' field.
754
755
756 verbose
757 Setting the option verbose is the same as using the -v flag
758 on the command line. When mail runs in ver- bose mode, the
759 actual delivery of messages is dis- played on the user's
760 terminal.
761
762
763 __Option string values__
764
765
766 EDITOR Pathname of the text editor to use in the
767 edit command and ~e escape. If not defined, then a default
768 editor is used.
769
770
771 LISTER
772 Pathname of the directory lister to use in the folders
773 command. Default is /bin/ls.
774
775
776 PAGER
777 Pathname of the program to use in the more com- mand or when
778 crt variable is set. The default paginator more(1)
779 is used if this option is not defined.
780
781
782 REPLYTO
783 If set, will be used to initialize the Reply-To field for
784 outgoing messages.
785
786
787 SHELL
788 Pathname of the shell to use in the ! command and the ~!
789 escape. A default shell is used if this option is not
790 defined.
791
792
793 VISUAL
794 Pathname of the text editor to use in the visual command and
795 ~v escape.
796
797
798 ''crt''
799 The valued option ''crt'' is used as a threshold to
800 determine how long a message must be before PAGER
801 is used to read it. If ''crt'' is set with- out a value,
802 then the height of the terminal screen stored in the system
803 is used to compute the threshold (see
804 stty(1)).
805
806
807 escape
808 If defined, the first character of this option gives the
809 character to use in the place of ~ to denote
810 escapes.
811
812
813 folder
814 The name of the directory to use for storing folders of
815 messages. If this name begins with a /, mail
816 considers it to be an absolute path- name; otherwise, the
817 folder directory is found relative to your home
818 directory.
819
820
821 MBOX
822 The name of the mbox file. It can be the name of a folder.
823 The default is ``mbox'' in the user's home
824 directory.
825
826
827 record
828 If defined, gives the pathname of the file used to record
829 all outgoing mail. If not defined, then outgoing mail is not
830 so saved.
831
832
833 indentprefix
834 String used by the ~m tilde escape for indent- ing messages,
835 in place of the normal tab char- acter (^I) Be sure to quote
836 the value if it contains spaces or tabs.
837
838
839 toplines
840 If defined, gives the number of lines of a mes- sage to be
841 printed out with the top command; normally, the first five
842 lines are printed.
843
844
845 __ENVIRONMENT__
846
847
848 mail utilizes the HOME, LOGNAME,
849 USER, SHELL, DEAD,
850 PAGER, LISTER, EDITOR,
851 VISUAL, REPLYTO and MBOX
852 environment vari- ables.
853
854
855 If the MAIL environment variable is set, its value
856 is used as the path to the user's mail spool.
857 __FILES__
858 /var/mail/
859 post office (unless overridden by the MAIL
860 environment
861 variable)
862
863
864 ~/mbox
865 user's old mail
866 ~/.mailrc
867 file giving initial mail com- mands; can be overridden by
868 set- ting the MAILRC environment vari- able
869 /tmp/R
870 temporary files
871 /usr/share/mailx/mail.help
872 help files
873 /etc/mail.rc
874 system initialization file
875
876
877 __SEE ALSO__
878
879
880 fmt(1), lockspool(1),
881 newaliases(1), vacation(1),
882 aliases(5), mailaddr(7),
883 mail.local(8), newaliases(8),
884 sendmail(8)
885 '' The Mail Reference Manual''.
886 __HISTORY__
887
888
889 A mail command appeared in Version 3 AT
890 . This man page is derived from ''The Mail
891 Reference Manual'' originally written by Kurt
892 Shoens.
893 __BUGS__
894
895
896 There are some flags that are not documented here. Most are
897 not useful to the general user.
898
899
900 Usually, Mail and mailx are just links to mail, which can be confusing.
901
902
903 BSD September 12, 1999 1
904 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.