1mailx(1)                         User Commands                        mailx(1)
2
3
4

NAME

6       mailx - interactive message processing system
7

SYNOPSIS

9       mailx [-BdeHiInNURvV~] [-f [file | +folder]] [-T file]
10            [-u user]
11
12
13       mailx [-BdFintUv~] [-b bcc] [-c cc] [-h number]
14            [-r address] [-s subject] recipient...
15
16
17       /usr/ucb/mail ...
18
19
20       /usr/ucb/Mail ...
21
22

DESCRIPTION

24       The  mail  utilities listed above provide a comfortable, flexible envi‐
25       ronment for sending and receiving mail messages electronically.
26
27
28       When reading mail, the mail utilities provide  commands  to  facilitate
29       saving,  deleting,  and  responding to messages. When sending mail, the
30       mail utilities allow editing, reviewing and other modification  of  the
31       message as it is entered.
32
33
34       Incoming  mail  is  stored in a standard file for each user, called the
35       mailbox for that user. When the mail utilities are called to read  mes‐
36       sages,  the  mailbox is the default place to find them. As messages are
37       read, they are marked to be moved to  a  secondary  file  for  storage,
38       unless  specific action is taken, so that the messages need not be seen
39       again.This secondary file is called the mbox and is normally located in
40       the  user's  HOME  directory  (see  MBOX in ENVIRONMENT VARIABLES for a
41       description of this file). Messages can be  saved  in  other  secondary
42       files  named  by  the  user.  Messages remain in a secondary file until
43       forcibly removed.
44
45
46       The user can access a secondary file by using the -f  option.  Messages
47       in the secondary file can then be read or otherwise processed using the
48       same Commands as in the primary mailbox. This gives rise  within  these
49       pages to the notion of a current mailbox.
50

OPTIONS

52       On  the command line options start with a dash (−). Any other arguments
53       are taken to be destinations (recipients). If no recipients are  speci‐
54       fied, mailx attempts to read messages from the mailbox.
55
56       -B               Do not buffer standard input or standard output.
57
58
59       -b bcc           Set  the  blind carbon copy list to bcc. bcc should be
60                        enclosed in quotes if it contains more than one name.
61
62
63       -c cc            Set the carbon copy list to cc. cc should be  enclosed
64                        in quotes if it contains more than one name.
65
66
67       -d               Turn on debugging output. (Neither particularly inter‐
68                        esting nor recommended.)
69
70
71       -e               Test for the presence of mail.  mailx  prints  nothing
72                        and  exits  with  a successful return code if there is
73                        mail to read.
74
75
76       -F               Record the message in a file  named  after  the  first
77                        recipient.  Overrides the record variable, if set (see
78                        Internal Variables).
79
80
81       -f [file]        Read messages from file instead of mailbox. If no file
82                        is specified, the mbox is used.
83
84
85       -f [ +folder]    Use  the  file folder in the folder directory (same as
86                        the folder command). The name  of  this  directory  is
87                        listed in the folder variable.
88
89
90       -H               Print header summary only.
91
92
93       -h number        The number of network "hops" made so far. This is pro‐
94                        vided for network software to avoid infinite  delivery
95                        loops.  This option and its argument are passed to the
96                        delivery program.
97
98
99       -I               Include the newsgroup and article-id header lines when
100                        printing  mail  messages.  This option requires the -f
101                        option to be specified.
102
103
104       -i               Ignore interrupts. See also ignore in  Internal  Vari‐
105                        ables.
106
107
108       -N               Do not print initial header summary.
109
110
111       -n               Do  not initialize from the system default mailx.rc or
112                        Mail.rc file.  See USAGE.
113
114
115       -r address       Use address as the return address  when  invoking  the
116                        delivery  program.  All  tilde  commands are disabled.
117                        This option and its argument is passed to the delivery
118                        program.
119
120
121       -s subject       Set  the  Subject  header  field  to  subject. subject
122                        should be enclosed in quotes if it  contains  embedded
123                        white space.
124
125
126       -T file          Message-id and article-id header lines are recorded in
127                        file after the message is read. This option also  sets
128                        the -I option.
129
130
131       -t               Scan  the  input  for  To:,  Cc:, and Bcc: fields. Any
132                        recipients on the command line will be ignored.
133
134
135       -U               Convert UUCP-style addresses  to  internet  standards.
136                        Overrides the conv environment variable.
137
138
139       -u user          Read  user's mailbox. This is only effective if user's
140                        mailbox is not read protected.
141
142
143       -V               Print the mailx version number and exit.
144
145
146       -v               Pass the -v flag to sendmail(1M).
147
148
149       -~               Interpret tilde escapes in the input even if not read‐
150                        ing from a tty.
151
152

OPERANDS

154       The following operands are supported:
155
156       recipient    Addressee of message.
157
158

USAGE

160   Starting Mail
161       At   startup   time,   mailx   executes   the   system   startup   file
162       /etc/mail/mailx.rc. If invoked as mail or Mail, the system startup file
163       /etc/mail/Mail.rc is used instead.
164
165
166       The  system  startup  file  sets   up initial display options and alias
167       lists and assigns values to some internal  variables.  These  variables
168       are flags and valued parameters which are set and cleared using the set
169       and unset commands. See Internal Variables.
170
171
172       With the  following  exceptions,  regular  commands  are  legal  inside
173       startup files: !, Copy, edit, followup, Followup, hold, mail, preserve,
174       reply, Reply, shell, and visual. An error in the  startup  file  causes
175       the remaining lines in the file to be ignored.
176
177
178       After  executing  the  system startup file,  the mail utilities execute
179       the optional personal startup file $HOME/.mailrc, wherein the user  can
180       override  the  values  of  the  internal variables as set by the system
181       startup file.
182
183
184       If the -n option is specified, however, the mail utilities do not  exe‐
185       cute the system startup file.
186
187
188       Many system administrators include the commands
189
190         set appenddeadletter
191         unset replyall
192         unset pipeignore
193
194
195
196
197       in  the system startup files (to be compatible with past Solaris behav‐
198       ior), but this does not meet standards requirements for mailx.  To  get
199       standard  behavior for mailx, users should use the -n option or include
200       the following commands in a personal startup file:
201
202         unset appenddeadletter
203         set replyall
204         set pipeignore
205
206
207
208
209       When reading mail, the mail utilities are in  command  mode.  A  header
210       summary  of  the  first  several  messages  is displayed, followed by a
211       prompt indicating the mail utilities can accept regular  commands  (see
212       Commands  below).  When  sending  mail, the mail utilities are in input
213       mode. If no subject is specified on the command line,  and  the  asksub
214       variable is set, a prompt for the subject is printed.
215
216
217       As  the message is typed, the mail utilities read the message and store
218       it in a temporary file. Commands may be entered  by  beginning  a  line
219       with the tilde (~) escape character followed by a single command letter
220       and optional arguments. See Tilde Escapes for a summary of  these  com‐
221       mands.
222
223   Reading Mail
224       Each  message is assigned a sequential number, and there is at any time
225       the notion of a current message, marked by a right angle bracket (>) in
226       the  header  summary.  Many  commands take an optional list of messages
227       (message-list) to operate on.  In most cases, the  current  message  is
228       set  to  the  highest-numbered message in the list after the command is
229       finished executing.
230
231
232       The default for message-list is the current message. A message-list  is
233       a list of message identifiers separated by spaces, which may include:
234
235       n          Message number n.
236
237
238       .          The current message.
239
240
241       ^          The first undeleted message.
242
243
244       $          The last message.
245
246
247       *          All messages.
248
249
250       +          The next undeleted message.
251
252
253       The previous undeleted message.
254
255
256       nm        An inclusive range of message numbers.
257
258
259       user       All messages from user.
260
261
262       /string    All messages with string in the Subject line (case ignored).
263
264
265       :c         All messages of type c, where c is one of:
266
267                  d    deleted messages
268
269
270                  n    new messages
271
272
273                  o    old messages
274
275
276                  r    read messages
277
278
279                  u    unread messages
280
281                  Notice  that  the  context of the command determines whether
282                  this type of message specification makes sense.
283
284
285
286       Other arguments are usually arbitrary strings whose  usage  depends  on
287       the command involved. Filenames, where expected, are expanded using the
288       normal shell conventions (see sh(1)). Special characters are recognized
289       by certain commands and are documented with the commands below.
290
291   Sending Mail
292       Recipients  listed  on  the  command  line may be of three types: login
293       names, shell commands, or alias groups. Login names may be any  network
294       address,  including  mixed  network  addressing. If mail is found to be
295       undeliverable, an attempt is made to return it to the sender's mailbox.
296       If  the recipient name begins with a pipe symbol ( | ), the rest of the
297       name is taken to be a shell command to pipe the message  through.  This
298       provides  an  automatic interface with any program that reads the stan‐
299       dard input, such as lp(1) for recording outgoing mail on  paper.  Alias
300       groups are set by the alias command (see Commands below) or in a system
301       startup file (for example, $HOME/.mailrc). Aliases are lists of recipi‐
302       ents of any type.
303
304   Forwarding Mail
305       To  forward  a specific message, include it in a message to the desired
306       recipients with the ~f or ~m tilde escapes. See Tilde Escapes below. To
307       forward mail automatically, add a comma-separated list of addresses for
308       additional recipients to the .forward file in your home directory. This
309       is different from the format of the alias command, which takes a space-
310       separated list instead. Note: Forwarding addresses must  be  valid,  or
311       the messages will "bounce." You cannot, for instance, reroute your mail
312       to a new host by forwarding it to your new address if  it  is  not  yet
313       listed in the NIS aliases domain.
314
315   Commands
316       Regular commands are of the form
317
318         [ command ] [ message-list ] [ arguments ]
319
320
321
322
323       In  input  mode,  commands  are  recognized  by  the  escape character,
324       tilde(~), and lines not treated as commands are taken as input for  the
325       message.  If  no command is specified in command mode, next is assumed.
326       The following is a complete list of mailx commands:
327
328       !shell-command
329
330           Escape to the shell. See SHELL in ENVIRONMENT VARIABLES.
331
332
333       # comment
334
335           NULL command (comment). Useful in mailrc files.
336
337
338       =
339
340           Print the current message number.
341
342
343       ?
344
345           Prints a summary of commands.
346
347
348       alias alias name ...
349       group alias name ...
350
351           Declare an alias for the given names.  The  names  are  substituted
352           when  alias is used as a recipient. Useful in the mailrc file. With
353           no arguments, the command displays the list of defined aliases.
354
355
356       alternates name ...
357
358           Declare a list of alternate names for your login.  When  responding
359           to  a  message, these names are removed from the list of recipients
360           for the response. With no arguments,  print  the  current  list  of
361           alternate names. See also allnet in Internal Variables.
362
363
364       cd [directory]
365       chdir [directory]
366
367           Change directory. If directory is not specified, $HOME is used.
368
369
370       copy [file]
371       copy [message-list] file
372
373           Copy  messages  to  the file without marking the messages as saved.
374           Otherwise equivalent to the save command.
375
376
377       Copy [message-list]
378
379           Save the specified messages in a file whose name  is  derived  from
380           the author of the message to be saved, without marking the messages
381           as saved. Otherwise equivalent to the Save command.
382
383
384       delete [message-list]
385
386           Delete messages from the mailbox. If autoprint  is  set,  the  next
387           message  after  the last one deleted is printed (see Internal Vari‐
388           ables).
389
390
391       discard [header-field...]
392       ignore [header-field...]
393
394           Suppress printing of the specified header  fields  when  displaying
395           messages  on  the  screen.  Examples of header fields to ignore are
396           Status and Received. The fields are included when  the  message  is
397           saved,  unless  the  alwaysignore  variable is set. The More, Page,
398           Print, and Type commands override this command.  If  no  header  is
399           specified,  the  current  list  of  header  fields being ignored is
400           printed. See also the undiscard and unignore commands.
401
402
403       dp [message-list]
404       dt [message-list]
405
406           Delete the specified messages from the mailbox and print  the  next
407           message  after the last one deleted. Roughly equivalent to a delete
408           command followed by a print command.
409
410
411       echo string ...
412
413           Echo the given strings (like echo(1)).
414
415
416       edit [message-list]
417
418           Edit the given messages. Each message is placed in a temporary file
419           and  the program named by the EDITOR variable is invoked to edit it
420           (see ENVIRONMENT VARIABLES). Default editor is ed(1).
421
422
423       exit
424       xit
425
426           Exit from mailx, without changing  the  mailbox.  No  messages  are
427           saved in the mbox (see also quit).
428
429
430       field [message-list] header-file
431
432           Display the value of the header field in the specified message.
433
434
435       file [file]
436       folder [file]
437
438           Quit  from  the  current file of messages and read in the specified
439           file. Several special characters are recognized when used  as  file
440           names:
441
442           %        the current mailbox.
443
444
445           %user    the mailbox for user.
446
447
448           #        the previous mail file.
449
450
451           &        the current mbox.
452
453
454           +file    The  named  file  in  the  folder directory (listed in the
455                    folder variable).
456
457           With no arguments, print the name of the current mail file, and the
458           number of messages and characters it contains.
459
460
461       folders
462
463           Print  the  names  of  the files in the directory set by the folder
464           variable (see Internal Variables).
465
466
467       Followup [message]
468
469           Respond to a message, recording the response in a file  whose  name
470           is  derived  from  the  author of the message. Overrides the record
471           variable, if set. If the replyall variable is set, the  actions  of
472           Followup  and  followup  are reversed. See also the followup, Save,
473           and Copy commands and outfolder  in  Internal  Variables,  and  the
474           Starting Mail section in USAGE above.
475
476
477       followup [message-list]
478
479           Respond  to the first message in the message-list, sending the mes‐
480           sage to the author of each message in the message-list. The subject
481           line  is  taken from the first message and the response is recorded
482           in a file whose name is derived from the author of the  first  mes‐
483           sage.  If the replyall variable is set, the actions of followup and
484           Followup are reversed. See also the Followup, Save, and  Copy  com‐
485           mands  and  outfolder  in Internal Variables, and the Starting Mail
486           section in USAGE above.
487
488
489       from [message-list]
490
491           Print the header summary for the specified messages. If no messages
492           are specified, print the header summary for the current message.
493
494
495       group alias name ...
496       alias alias name ...
497
498           Declare  an  alias  for  the given names. The names are substituted
499           when alias is used as a recipient. Useful in the mailrc file.
500
501
502       headers [message]
503
504           Print the page of headers which includes the message specified. The
505           screen  variable  sets the number of headers per page (see Internal
506           Variables). See also the z command.
507
508
509       help
510
511           Print a summary of commands.
512
513
514       hold [message-list]
515       preserve [message-list]
516
517           Hold the specified messages in the mailbox.
518
519
520       if s | r | t
521       mail-commands
522
523       else
524       mail-commands
525
526       endif
527
528           Conditional execution, where s executes following mail-commands, up
529           to  an  else or endif, if the program is in send mode, r causes the
530           mail-commands to be executed only in receive mode, and t causes the
531           mail-commands to be executed only if mailx is being run from a ter‐
532           minal. Useful in the mailrc file.
533
534
535       inc
536
537           Incorporate messages that arrive while you are reading  the  system
538           mailbox. The new messages are added to the message list in the cur‐
539           rent mail session. This command does not commit changes made during
540           the session, and prior messages are not renumbered.
541
542
543       ignore [header-field ...]
544       discard [header-field ...]
545
546           Suppress  printing  of  the specified header fields when displaying
547           messages on the screen. Examples of header  fields  to  ignore  are
548           Status  and  Cc. All fields are included when the message is saved.
549           The More, Page, Print and Type commands override this  command.  If
550           no  header  is  specified,  the current list of header fields being
551           ignored is printed. See also the undiscard and unignore commands.
552
553
554       list
555
556           Print all commands available. No explanation is given.
557
558
559       load
560
561           [message] file The specified message is replaced by the message  in
562           the named file. file should contain a single mail message including
563           mail headers (as saved by the save command).
564
565
566       mail recipient ...
567
568           Mail a message to the specified recipients.
569
570
571       Mail recipient
572
573           Mail a message to the specified recipients, and record it in a file
574           whose name is derived from the author of the message. Overrides the
575           record variable, if set. See also the Save and  Copy  commands  and
576           outfolder in Internal Variables.
577
578
579       mbox [message-list]
580
581           Arrange  for the given messages to end up in the standard mbox save
582           file when mailx terminates normally. See MBOX in ENVIRONMENT  VARI‐
583           ABLES  for  a  description of this file. See also the exit and quit
584           commands.
585
586
587       more [message-list]
588       page [message-list]
589
590           Print the specified messages. If crt is set,  the  messages  longer
591           than  the  number  of lines specified by the crt variable are paged
592           through the command specified by the PAGER  variable.  The  default
593           command  is  pg(1) or if the bsdcompat variable is set, the default
594           is more(1). See ENVIRONMENT VARIABLES. Same as the print  and  type
595           commands.
596
597
598       More [message-list]
599       Page [message-list]
600
601           Print  the  specified  messages on the screen, including all header
602           fields. Overrides suppression of fields by the ignore command. Same
603           as the Print and Type commands.
604
605
606       new [message-list]
607       New [message-list]
608       unread [message-list]
609       Unread
610
611           [message-list]  Take  a  message  list and mark each message as not
612           having been read.
613
614
615       next [message]
616
617           Go to the next message matching message. If  message  is  not  sup‐
618           plied,  this command finds the next message that was not deleted or
619           saved. A message-list may be specified, but in this case the  first
620           valid  message in the list is the only one used. This is useful for
621           jumping to the next message from a specific user,  since  the  name
622           would  be  taken as a command in the absence of a real command. See
623           the discussion of message-list above for a description of  possible
624           message specifications.
625
626
627       pipe [message-list] [shell-command]
628       | [message-list] [shell-command]
629
630           Pipe  the  message  through the given shell-command. The message is
631           treated as if it were read. If no arguments are given, the  current
632           message  is piped through the command specified by the value of the
633           cmd variable. If the page variable is set, a form feed character is
634           inserted after each message (see Internal Variables).
635
636
637       preserve [message-list]
638       hold [message-list]
639
640           Preserve the specified messages in the mailbox.
641
642
643       print [message-list]
644       type [message-list]
645
646           Print  the  specified  messages. If crt is set, the messages longer
647           than the number of lines specified by the crt  variable  are  paged
648           through  the  command  specified by the PAGER variable. The default
649           command is pg(1) or if the bsdcompat variable is set,  the  default
650           is  more(1).  See  ENVIRONMENT VARIABLES. Same as the more and page
651           commands.
652
653
654       Print [message-list]
655       Type [message-list]
656
657           Print the specified messages on the screen,  including  all  header
658           fields.  Overrides  suppression  of  fields  by the ignore command.
659           Same as the More and Page commands.
660
661
662       put [file]
663       put [message-list] file
664
665           Save the specified message in the given file. Use the same  conven‐
666           tions as the print command for which header fields are ignored.
667
668
669       Put [file]
670       Put [message-list] file
671
672           Save the specified message in the given file. Overrides suppression
673           of fields by the ignore command.
674
675
676       quit
677
678           Exit from mailx, storing messages that were read in mbox and unread
679           messages  in  the mailbox. Messages that have been explicitly saved
680           in a file are deleted unless the keepsave variable is set.
681
682
683       reply [message-list]
684       respond [message-list]
685       replysender [message-list]
686
687           Send a response to the author of each message in the  message-list.
688           The subject line is taken from the first message.  If record is set
689           to a file, a copy of the reply  is  added  to  that  file.  If  the
690           replyall   variable  is  set,  the  actions  of  Reply/Respond  and
691           reply/respond are reversed. The replysender command is not affected
692           by  the  replyall variable, but sends each reply only to the sender
693           of each message. See the Starting Mail section in USAGE above.
694
695
696       Reply [message]
697       Respond [message]
698       replyall [message]
699
700           Reply to the specified message, including all other  recipients  of
701           that  message.   If the variable record is set to a file, a copy of
702           the reply added to that file. If the replyall variable is set,  the
703           actions  of  Reply/Respond  and  reply/respond  are  reversed.  The
704           replyall command is not affected  by  the  replyall  variable,  but
705           always  sends  the  reply to all recipients of the message. See the
706           Starting Mail section in USAGE above.
707
708
709       retain
710
711           Add the list of header fields named to the retained list. Only  the
712           header  fields  in  the retain list are shown on your terminal when
713           you print a message. All other header fields are  suppressed.   The
714           set  of  retained  fields specified by the retain command overrides
715           any list of ignored fields specified by  the  ignore  command.  The
716           Type  and  Print  commands  can  be  used to print a message in its
717           entirety. If retain is executed with no  arguments,  it  lists  the
718           current set of retained fields.
719
720
721       Save [message-list]
722
723           Save  the  specified  messages in a file whose name is derived from
724           the author of the first message. The name of the file is  taken  to
725           be  the author's name with all network addressing stripped off. See
726           also the Copy, followup, and Followup  commands  and  outfolder  in
727           Internal Variables.
728
729
730       save [file]
731       save [message-list] file
732
733           Save  the specified messages in the given file. The file is created
734           if it does not exist. The file defaults to  mbox.  The  message  is
735           deleted  from  the mailbox when mailx terminates unless keepsave is
736           set (see also Internal Variables and the exit and quit commands).
737
738
739       set
740       set variable
741       set variable=string
742       set variable=number
743
744           Define a variable. To assign a  value  to  variable,  separate  the
745           variable  name  from  the  value  by an `=' (there must be no space
746           before or after the `='). A variable may be given a  null,  string,
747           or numeric value. To embed SPACE characters within a value, enclose
748           it in quotes.
749
750           With no arguments, set displays all defined variables and any  val‐
751           ues  they  might  have. See Internal Variables for a description of
752           all predefined mail variables.
753
754
755       shell
756
757           Invoke an interactive shell. See also SHELL  in  ENVIRONMENT  VARI‐
758           ABLES.
759
760
761       size [message-list]
762
763           Print the size in characters of the specified messages.
764
765
766       source file
767
768           Read commands from the given file and return to command mode.
769
770
771       top [message-list]
772
773           Print  the top few lines of the specified messages. If the toplines
774           variable is set, it is taken as the number of lines to  print  (see
775           Internal Variables). The default is 5.
776
777
778       touch [message-list]
779
780           Touch the specified messages. If any message in message-list is not
781           specifically saved in a file, it is placed in the mbox, or the file
782           specified  in  the  MBOX environment variable, upon normal termina‐
783           tion. See exit and quit.
784
785
786       Type [message-list]
787       Print [message-list]
788
789           Print the specified messages on the screen,  including  all  header
790           fields. Overrides suppression of fields by the ignore command.
791
792
793       type [message-list]
794       print [message-list]
795
796           Print  the  specified  messages. If crt is set, the messages longer
797           than the number of lines specified by the crt  variable  are  paged
798           through  the  command  specified by the PAGER variable. The default
799           command is pg(1). See ENVIRONMENT VARIABLES.
800
801
802       unalias [alias] ...
803       ungroup [alias] ...
804
805           Remove the definitions of the specified aliases.
806
807
808       undelete [message-list]
809
810           Restore the specified deleted messages. Will only restore  messages
811           deleted  in the current mail session. If autoprint is set, the last
812           message of those restored is printed (see Internal Variables).
813
814
815       undiscard [header-field...]
816       unignore [header-field...]
817
818           Remove the specified header fields from the list being ignored.  If
819           no  header fields are specified, all header fields are removed from
820           the list being ignored.
821
822
823       unretain [header-field...]
824
825           Remove the specified header fields from the list being retained. If
826           no  header fields are specified, all header fields are removed from
827           the list being retained.
828
829
830       unread [message-list]
831       Unread [message-list] Same as the new command.
832
833
834
835
836       unset variable...
837
838           Erase the specified variables. If the variable  was  imported  from
839           the environment (that is, an environment variable or exported shell
840           variable), it cannot be unset from within mailx.
841
842
843       version
844
845           Print the current version and release date of the mailx utility.
846
847
848       visual [message-list]
849
850           Edit the given messages with a  screen  editor.  Each  messages  is
851           placed  in  a  temporary  file  and the program named by the VISUAL
852           variable is invoked to edit it (see ENVIRONMENT VARIABLES).  Notice
853           that the default visual editor is vi.
854
855
856       write [message-list] file
857
858           Write  the  given  messages on the specified file, minus the header
859           and trailing blank line. Otherwise equivalent to the save command.
860
861
862       xit
863       exit
864
865           Exit from mailx, without changing  the  mailbox.  No  messages  are
866           saved in the mbox (see also quit).
867
868
869       z[+|]
870
871           Scroll  the header display forward or backward one screen−full. The
872           number of headers displayed is set  by  the  screen  variable  (see
873           Internal Variables).
874
875
876   Tilde Escapes
877       The  following tilde escape commands can be used when composing mail to
878       send. These may be entered only from input mode, by  beginning  a  line
879       with  the  tilde escape character (~). See escape in Internal Variables
880       for changing this  special  character.  The  escape  character  can  be
881       entered as text by typing it twice.
882
883       ~!shell-command        Escape  to the shell. If present, run shell-com‐
884                              mand.
885
886
887       ~.                     Simulate end of file (terminate message input).
888
889
890       ~:mail-command         Perform the command-level  request.  Valid  only
891       ~_mail-command         when sending a message while reading mail.
892
893
894       ~?                     Print a summary of tilde escapes.
895
896
897       ~A                     Insert  the  autograph string Sign into the mes‐
898                              sage (see Internal Variables).
899
900
901       ~a                     Insert the autograph string sign into  the  mes‐
902                              sage (see Internal Variables).
903
904
905       ~b name ...            Add  the  names  to  the blind carbon copy (Bcc)
906                              list. This is like the carbon  copy  (Cc)  list,
907                              except  that  the  names in the Bcc list are not
908                              shown in the header of the mail message.
909
910
911       ~c name ...            Add the names to the carbon copy (Cc) list.
912
913
914       ~d                     Read in the dead-letter file. See DEAD in  ENVI‐
915                              RONMENT  VARIABLES  for  a  description  of this
916                              file.
917
918
919       ~e                     Invoke the editor on the  partial  message.  See
920                              also EDITOR in ENVIRONMENT VARIABLES.
921
922
923       ~f [message-list]      Forward  the  specified  message, or the current
924                              message being read. Valid only  when  sending  a
925                              message  while  reading  mail.  The messages are
926                              inserted into the message without alteration (as
927                              opposed to the ~m escape).
928
929
930       ~F [message-list]      Forward  the  specified  message, or the current
931                              message being read, including all header fields.
932                              Overrides  the  suppression  of  fields  by  the
933                              ignore command.
934
935
936       ~h                     Prompt for Subject line  and  To,  Cc,  and  Bcc
937                              lists. If the field is displayed with an initial
938                              value, it may be edited as if you had just typed
939                              it.
940
941
942       ~i variable            Insert  the value of the named variable into the
943                              text of the message. For example, ~A is  equiva‐
944                              lent to `~i Sign.' Environment variables set and
945                              exported in the shell are also accessible by ~i.
946
947
948       ~m [message-list]      Insert the listed messages, or the current  mes‐
949                              sage being read into the letter. Valid only when
950                              sending a message while reading mail.  The  text
951                              of  the message is shifted to the right, and the
952                              string contained in the indentprefix variable is
953                              inserted  as  the  leftmost  characters  of each
954                              line. If indentprefix is not set, a TAB  charac‐
955                              ter is inserted into each line.
956
957
958       ~M [message-list]      Insert  the listed messages, or the current mes‐
959                              sage being read, including  the  header  fields,
960                              into  the letter. Valid only when sending a mes‐
961                              sage while reading mail. The text of the message
962                              is  shifted  to  the  right, and the string con‐
963                              tained in the indentprefix variable is  inserted
964                              as  the  leftmost  characters  of  each line. If
965                              indentprefix is not  set,  a  TAB  character  is
966                              inserted  into each line. Overrides the suppres‐
967                              sion of fields by the ignore command.
968
969
970       ~p                     Print the message being entered.
971
972
973       ~q                     Quit from input mode by simulating an interrupt.
974                              If the body of the message is not null, the par‐
975                              tial message is saved in dead-letter.  See  DEAD
976                              in  ENVIRONMENT  VARIABLES  for a description of
977                              this file.
978
979
980       ~R                     Mark message for return receipt.
981
982
983       ~r file                Read in the  specified  file.  If  the  argument
984       ~< file                begins  with  an exclamation point (!), the rest
985       ~< ! shell-command     of the string is taken  as  an  arbitrary  shell
986                              command  and is executed, with the standard out‐
987                              put inserted into the message.
988
989
990       ~s string ...          Set the subject line to string.
991
992
993       ~t name ...            Add the given names to the To list.
994
995
996       ~v                     Invoke a preferred screen editor on the  partial
997                              message. The default visual editor is vi(1). See
998                              also VISUAL in ENVIRONMENT VARIABLES.
999
1000
1001       ~w file                Write the message into the given  file,  without
1002                              the header.
1003
1004
1005       ~x                     Exit  as with ~q except the message is not saved
1006                              in dead-letter.
1007
1008
1009       ~| shell-command       Pipe the body of the message through  the  given
1010                              shell-command.  If  the  shell-command returns a
1011                              successful exit status, the output of  the  com‐
1012                              mand replaces the message.
1013
1014
1015   Internal Variables
1016       The  following  variables  are internal variables. They may be imported
1017       from the execution environment or set using  the  set  command  at  any
1018       time. The unset command may be used to erase variables.
1019
1020       allnet                    All network names whose last component (login
1021                                 name) match are treated  as  identical.  This
1022                                 causes  the  message-list  message specifica‐
1023                                 tions  to  behave  similarly.   Disabled   by
1024                                 default.  See also the alternates command and
1025                                 the metoo and fuzzymatch variables.
1026
1027
1028       alwaysignore              Ignore header fields with ignore  everywhere,
1029                                 not  just  during  print or type. Affects the
1030                                 save, Save, copy, Copy, top, pipe, and  write
1031                                 commands,  and  the  ~m and ~f tilde escapes.
1032                                 Enabled by default.
1033
1034
1035       append                    Upon termination, append messages to the  end
1036                                 of  the mbox file instead of prepending them.
1037                                 Although disabled by default, append  is  set
1038                                 in the system startup file (which can be sup‐
1039                                 pressed with the -n command line option).
1040
1041
1042       appenddeadletter          Append to the  deadletter  file  rather  than
1043                                 overwrite  it. Although disabled by  default,
1044                                 appenddeadletter is  frequently  set  in  the
1045                                 system  startup  file.  See  Starting Mail in
1046                                 USAGE above.
1047
1048
1049       askbcc                    Prompt for the Bcc list after the Subject  is
1050                                 entered if it is not specified on the command
1051                                 line with the -b option. Disabled by default.
1052
1053
1054       askcc                     Prompt for the Cc list after the  Subject  is
1055                                 entered if it is not specified on the command
1056                                 line with the -c option. Disabled by default.
1057
1058
1059       asksub                    Prompt for subject if it is not specified  on
1060                                 the  command line with the -s option. Enabled
1061                                 by default.
1062
1063
1064       autoinc                   Automatically incorporate new  messages  into
1065                                 the  current session as they arrive. This has
1066                                 an affect similar to issuing the inc  command
1067                                 every  time  the command prompt is displayed.
1068                                 Disabled by default, but autoinc  is  set  in
1069                                 the default system startup file for mailx; it
1070                                 is   not    set    for    /usr/ucb/mail    or
1071                                 /usr/ucb/Mail.
1072
1073
1074       autoprint                 Enable  automatic  printing of messages after
1075                                 delete and  undelete  commands.  Disabled  by
1076                                 default.
1077
1078
1079       bang                      Enable   the  special-casing  of  exclamation
1080                                 points (!) in shell escape command  lines  as
1081                                 in vi(1). Disabled by default.
1082
1083
1084       bsdcompat                 Set automatically if mailx is invoked as mail
1085                                 or    Mail.    Causes    mailx     to     use
1086                                 /etc/mail/Mail.rc as the system startup file.
1087                                 Changes the default pager to more(1).
1088
1089
1090       cmd=shell-command         Set the default command for the pipe command.
1091                                 No default value.
1092
1093
1094       conv=conversion           Convert   uucp  addresses  to  the  specified
1095                                 address style, which can be either:
1096
1097                                 internet    This  requires  a  mail  delivery
1098                                             program  conforming to the RFC822
1099                                             standard  for   electronic   mail
1100                                             addressing.
1101
1102
1103                                 optimize    Remove  loops in uucp(1C) address
1104                                             paths (typically generated by the
1105                                             reply  command).  No rerouting is
1106                                             performed; mail has no  knowledge
1107                                             of UUCP routes or connections.
1108
1109                                 Conversion  is  disabled by default. See also
1110                                 sendmail(1M) and the -U command-line option.
1111
1112
1113       crt[=number]              Pipe messages having more than  number  lines
1114                                 through the command specified by the value of
1115                                 the PAGER variable  (  pg(1)  or  more(1)  by
1116                                 default).  If  number  is  not specified, the
1117                                 current window  size  is  used.  Disabled  by
1118                                 default.
1119
1120
1121       debug                     Enable  verbose  diagnostics  for  debugging.
1122                                 Messages  are  not  delivered.  Disabled   by
1123                                 default.
1124
1125
1126       dot                       Take  a  period  on  a line by itself, or EOF
1127                                 during input from a terminal as  end-of-file.
1128                                 Disabled  by  default,  but dot is set in the
1129                                 system startup file (which can be  suppressed
1130                                 with the -n command line option).
1131
1132
1133       fcc                       By default, mailx will treat any address con‐
1134                                 taining a slash ("/") character  as  a  local
1135                                 "send  to  file"  address.  By unsetting this
1136                                 option, this behavior is disabled. Enabled by
1137                                 default.
1138
1139
1140       flipr                     Reverse  the  effect of the followup/Followup
1141                                 and reply/Reply command pairs.  If both flipr
1142                                 and  replyall  are  set,  the effect is as if
1143                                 neither was set.
1144
1145
1146       from                      Extract the author listed in the header  sum‐
1147                                 mary  from  the  From:  header instead of the
1148                                 UNIX From line. Enabled by default.
1149
1150
1151       fuzzymatch                The from command searches for  messages  from
1152                                 the  indicated  sender.  By default, the full
1153                                 sender address must be specified. By  setting
1154                                 this  option, only a sub-string of the sender
1155                                 address  need  be  specified.   Disabled   by
1156                                 default.
1157
1158
1159       escape=c                  Substitute  c  for  the  ~  escape character.
1160                                 Takes effect with next message sent.
1161
1162
1163       folder=directory          The directory for saving standard mail files.
1164                                 User-specified  file  names  beginning with a
1165                                 plus (+) are expanded by preceding  the  file
1166                                 name  with  this directory name to obtain the
1167                                 real file name. If directory does  not  start
1168                                 with  a  slash (/), $HOME is prepended to it.
1169                                 There is no default for the folder  variable.
1170                                 See also outfolder below.
1171
1172
1173       header                    Enable  printing  of  the header summary when
1174                                 entering mailx. Enabled by default.
1175
1176
1177       hold                      Preserve all messages that are  read  in  the
1178                                 mailbox  instead of putting them in the stan‐
1179                                 dard mbox save file. Disabled by default.
1180
1181
1182       ignore                    Ignore interrupts  while  entering  messages.
1183                                 Handy  for  noisy  dial-up lines. Disabled by
1184                                 default.
1185
1186
1187       ignoreeof                 Ignore  end-of-file  during  message   input.
1188                                 Input must be terminated by a period (.) on a
1189                                 line by itself or by the ~. command. See also
1190                                 dot above. Disabled by default.
1191
1192
1193       indentprefix=string       When  indentprefix  is set, string is used to
1194                                 mark indented lines  from  messages  included
1195                                 with ~m. The default is a TAB character.
1196
1197
1198       keep                      When  the  mailbox  is  empty, truncate it to
1199                                 zero length instead of removing it.  Disabled
1200                                 by default.
1201
1202
1203       iprompt=string            The  specified  prompt  string  is  displayed
1204                                 before each line on input is  requested  when
1205                                 sending a message.
1206
1207
1208       keepsave                  Keep  messages  that have been saved in other
1209                                 files in  the  mailbox  instead  of  deleting
1210                                 them. Disabled by default.
1211
1212
1213       makeremote                When replying to all recipients of a message,
1214                                 if an address  does  not  include  a  machine
1215                                 name,  it  is  assumed  to be relative to the
1216                                 sender of the message.  Normally  not  needed
1217                                 when dealing with hosts that support RFC822.
1218
1219
1220       metoo                     If  your login appears as a recipient, do not
1221                                 delete it from the list. Disabled by default.
1222
1223
1224       mustbang                  Force all mail addresses to be in  bang  for‐
1225                                 mat.
1226
1227
1228       onehop                    When  responding to a message that was origi‐
1229                                 nally sent to several recipients,  the  other
1230                                 recipient addresses are normally forced to be
1231                                 relative to the originating author's  machine
1232                                 for  the  response. This flag disables alter‐
1233                                 ation of the recipients' addresses, improving
1234                                 efficiency  in  a  network where all machines
1235                                 can send directly to all other machines (that
1236                                 is, one hop away). Disabled by default.
1237
1238
1239       outfolder                 Locate the files used to record outgoing mes‐
1240                                 sages  in  the  directory  specified  by  the
1241                                 folder variable unless the path name is abso‐
1242                                 lute. Disabled by default. See  folder  above
1243                                 and  the  Save,  Copy, followup, and Followup
1244                                 commands.
1245
1246
1247       page                      Used with the pipe command to insert  a  form
1248                                 feed  after  each  message  sent  through the
1249                                 pipe. Disabled by default.
1250
1251
1252       pipeignore                Omit ignored header when  outputting  to  the
1253                                 pipe  command.  Although disabled by default,
1254                                 pipeignore is frequently set  in  the  system
1255                                 startup  file.  See  Starting  Mail  in USAGE
1256                                 above.
1257
1258
1259       postmark                  Your "real name" to be included in  the  From
1260                                 line  of  messages you send.  By default this
1261                                 is derived from the  comment  field  in  your
1262                                 passwd(4) file entry.
1263
1264
1265       prompt=string             Set   the  command  mode  prompt  to  string.
1266                                 Default is "? ", unless the  bsdcompat  vari‐
1267                                 able is set, then the default is "&".
1268
1269
1270       quiet                     Refrain from printing the opening message and
1271                                 version  when  entering  mailx.  Disabled  by
1272                                 default.
1273
1274
1275       record=file               Record all outgoing mail in file. Disabled by
1276                                 default. See also outfolder above.
1277
1278
1279       replyall                  Reverse the effect of the reply and Reply and
1280                                 followup  and Followup commands. Although set
1281                                 by default,  replayall is frequently unset in
1282                                 the system startup file. See flipr and Start‐
1283                                 ing Mail in USAGE above.
1284
1285
1286       returnaddr=string         The default sender address  is  that  of  the
1287                                 current  user.  This  variable can be used to
1288                                 set  the  sender  address  to  any  arbitrary
1289                                 value. Set with caution.
1290
1291
1292       save                      Enable  saving  of messages in dead-letter on
1293                                 interrupt or delivery error. See DEAD  for  a
1294                                 description of this file. Enabled by default.
1295
1296
1297       screen=number             Sets  the number of lines in a screen-full of
1298                                 headers for the headers command. number  must
1299                                 be a positive number.
1300
1301                                 The  default is set according to baud rate or
1302                                 window size. With a baud rate less than 1200,
1303                                 number defaults to 5, if baud rate is exactly
1304                                 1200, it defaults to 10. If you are in a win‐
1305                                 dow,  number  defaults  to the default window
1306                                 size minus 4. Otherwise, the default is 20.
1307
1308
1309       sendmail=shell-command    Alternate command  for  delivering  messages.
1310                                 Note:  In  addition  to  the expected list of
1311                                 recipients, mail also passes the -i  and  -m,
1312                                 flags  to  the command. Since these flags are
1313                                 not appropriate to other  commands,  you  may
1314                                 have  to  use a shell script that strips them
1315                                 from the arguments list before  invoking  the
1316                                 desired command. Default is /usr/bin/rmail.
1317
1318
1319       sendwait                  Wait  for  background mailer to finish before
1320                                 returning. Disabled by default.
1321
1322
1323       showname                  Causes the message header display to show the
1324                                 sender's  real  name  (if  known) rather than
1325                                 their mail address. Disabled by default,  but
1326                                 showname  is  set  in  the /etc/mail/mailx.rc
1327                                 system startup file for mailx.
1328
1329
1330       showto                    When displaying the header  summary  and  the
1331                                 message  is  from  you, print the recipient's
1332                                 name instead of the author's name.
1333
1334
1335       sign=string               The variable inserted into the text of a mes‐
1336                                 sage  when  the  ~a  (autograph)  command  is
1337                                 given. No  default  (see  also  ~i  in  Tilde
1338                                 Escapes).
1339
1340                                 `
1341
1342
1343       Sign=string               The variable inserted into the text of a mes‐
1344                                 sage  when  the  ~A  command  is  given.   No
1345                                 default (see also ~i in Tilde Escapes).
1346
1347
1348       toplines=number           The  number  of lines of header to print with
1349                                 the top command. Default is 5.
1350
1351
1352       verbose                   Invoke sendmail(1M) with the -v flag.
1353
1354
1355       translate                 The name  of  a  program  to  translate  mail
1356                                 addresses.    The   program   receives   mail
1357                                 addresses as arguments. The program produces,
1358                                 on  the standard output, lines containing the
1359                                 following data, in this order:
1360
1361                                     o      the postmark for the  sender  (see
1362                                            the postmark variable)
1363
1364                                     o      translated mail addresses, one per
1365                                            line, corresponding  to  the  pro‐
1366                                            gram's arguments.  Each translated
1367                                            address will  replace  the  corre‐
1368                                            sponding  address in the mail mes‐
1369                                            sage being sent.
1370
1371                                     o      a line containing only "y" or "n".
1372                                            if  the line contains "y" the user
1373                                            will be asked to confirm that  the
1374                                            message should be sent.
1375                                 The  translate  program  will  be invoked for
1376                                 each mail message to be sent. If the  program
1377                                 exits  with  a non-zero exit status, or fails
1378                                 to produce enough output, the message is  not
1379                                 sent.
1380
1381
1382   Large File Behavior
1383       See  largefile(5)  for  the  description  of the behavior of mailx when
1384       encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
1385

ENVIRONMENT VARIABLES

1387       See environ(5) for descriptions of the following environment  variables
1388       that  affect  the  execution  of  mailx: HOME, LANG, LC_CTYPE, LC_TIME,
1389       LC_MESSAGES, NLSPATH, and TERM.
1390
1391       DEAD          The name of the file in which to save partial letters  in
1392                     case of untimely interrupt. Default is $HOME/dead.letter.
1393
1394
1395       EDITOR        The  command  to run when the edit or ~e command is used.
1396                     Default is ed(1).
1397
1398
1399       LISTER        The command (and options) to use when  listing  the  con‐
1400                     tents of the folder directory. The default is ls(1).
1401
1402
1403       MAIL          The  name of the initial mailbox file to read (in lieu of
1404                     the   standard   system   mailbox).   The   default    is
1405                     /var/mail/username .
1406
1407
1408       MAILRC        The name of the startup file.  Default is $HOME/.mailrc.
1409
1410
1411       MAILX_HEAD    The  specified string is included at the beginning of the
1412                     body of each message that is sent.
1413
1414
1415       MAILX_TAIL    The specified string is included at the end of  the  body
1416                     of each message that is sent.
1417
1418
1419       MBOX          The  name  of  the  file to save messages which have been
1420                     read. The exit command overrides this function,  as  does
1421                     saving  the  message explicitly in another file.  Default
1422                     is $HOME/mbox.
1423
1424
1425       PAGER         The command to use as a  filter  for  paginating  output.
1426                     This  can also be used to specify the options to be used.
1427                     Default is pg(1), or if the bsdcompat  variable  is  set,
1428                     the default is more(1). See Internal Variables.
1429
1430
1431       SHELL         The  name  of a preferred command interpreter. Default is
1432                     sh(1).
1433
1434
1435       VISUAL        The name of a preferred screen editor.  Default is vi(1).
1436
1437

EXIT STATUS

1439       When the  -e  option  is  specified,  the  following  exit  values  are
1440       returned:
1441
1442       0     Mail was found.
1443
1444
1445       >0    Mail was not found or an error occurred.
1446
1447
1448
1449       Otherwise, the following exit values are returned:
1450
1451       0     Successful  completion.  Notice that this status implies that all
1452             messages were sent, but it gives no assurances that any  of  them
1453             were actually delivered.
1454
1455
1456       >0    An error occurred
1457
1458

FILES

1460       $HOME/.mailrc
1461
1462            personal startup file
1463
1464
1465       $HOME/mbox
1466
1467           secondary storage file
1468
1469
1470       $HOME/.Maillock
1471
1472           lock file to prevent multiple writers of system mailbox
1473
1474
1475       /etc/mail/mailx.rc
1476
1477           optional system startup file for mailx only
1478
1479
1480       /etc/mail/Mail.rc
1481
1482           BSD  compatibility  system-wide  startup file for /usr/ucb/mail and
1483           /usr/ucb/Mail
1484
1485
1486       /tmp/R[emqsx]*
1487
1488           temporary files
1489
1490
1491       /usr/share/lib/mailx/mailx.help*
1492
1493           help message files
1494
1495
1496       /var/mail/*
1497
1498           post office directory
1499
1500

ATTRIBUTES

1502       See attributes(5) for descriptions of the following attributes:
1503
1504
1505
1506
1507       ┌─────────────────────────────┬─────────────────────────────┐
1508       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
1509       ├─────────────────────────────┼─────────────────────────────┤
1510       │Availability                 │SUNWcsu                      │
1511       ├─────────────────────────────┼─────────────────────────────┤
1512       │Interface Stability          │Standard                     │
1513       └─────────────────────────────┴─────────────────────────────┘
1514

SEE ALSO

1516       biff(1B),  echo(1),  ed(1),  ex(1),  fmt(1),  lp(1),  ls(1),   mail(1),
1517       mail(1B),  mailcompat(1), more(1), pg(1), sh(1), uucp(1C), vacation(1),
1518       vi(1),    newaliases(1M),    sendmail(1M),    aliases(4),    passwd(4),
1519       attributes(5), environ(5), largefile(5), standards(5)
1520

NOTES

1522       Where  shell-command  is  shown  as  valid,  arguments  are  not always
1523       allowed. Experimentation is recommended.
1524
1525
1526       Internal variables imported from the execution  environment  cannot  be
1527       unset.
1528
1529
1530       The  full  internet addressing is not fully supported by mailx. The new
1531       standards need some time to settle down.
1532
1533
1534       Replies do not always generate correct return addresses.  Try resending
1535       the errant reply with onehop set.
1536
1537
1538       mailx  does not lock your record file. So, if you use a record file and
1539       send two or more messages simultaneously, lines from the  messages  may
1540       be interleaved in the record file.
1541
1542
1543       The  format  for the alias command is a space-separated list of recipi‐
1544       ents, while  the  format  for  an  alias  in  either  the  .forward  or
1545       /etc/aliases is a comma-separated list.
1546
1547
1548       To read mail on a workstation running Solaris 1.x when your mail server
1549       is running Solaris 2.x, first execute the mailcompat(1) program.
1550
1551
1552
1553SunOS 5.11                        19 Sep 2001                         mailx(1)
Impressum