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

NAME

6       mailx - send and receive Internet mail
7

SYNOPSIS

9       mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-
10              addr] [-r from-addr] [-h hops] [-A account] [-S vari‐
11              able[=value]] to-addr . . .
12       mailx [-BDdeEHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f
13              [name]
14       mailx [-BDdeEinNRv~] [-A account] [-S variable[=value]] [-u user]
15

DESCRIPTION

17       Mailx is an intelligent mail processing system,  which  has  a  command
18       syntax  reminiscent  of  ed(1)  with lines replaced by messages.  It is
19       based on Berkeley Mail 8.1, is intended to provide the functionality of
20       the  POSIX  mailx  command, and offers extensions for MIME, IMAP, POP3,
21       SMTP, and S/MIME.  Mailx provides  enhanced  features  for  interactive
22       use,  such  as  caching  and  disconnected  operation for IMAP, message
23       threading, scoring, and filtering.  It is also usable as a  mail  batch
24       language, both for sending and receiving mail.
25
26       The following options are accepted:
27
28       -A name
29              Executes  an  account  command  (see  below)  for name after the
30              startup files have been read.
31
32       -a file
33              Attach the given file to the message.
34
35       -B     Make standard input and standard output line-buffered.
36
37       -b address
38              Send blind carbon copies to list.  List should be a  comma-sepa‐
39              rated list of names.
40
41       -c address
42              Send carbon copies to list of users.
43
44       -D     Start  in disconnected mode; see the description for the discon‐
45              nected variable option.
46
47       -d     Enables debugging messages and disables the actual  delivery  of
48              messages.  Unlike -v, this option is intended for mailx develop‐
49              ment only.
50
51       -e     Just check if mail is present in the system  mailbox.   If  yes,
52              return an exit status of zero, else, a non-zero value.
53
54       -E     If an outgoing message does not contain any text in its first or
55              only message part, do not  send  it  but  discard  it  silently,
56              effectively   setting  the  skipemptybody  variable  at  program
57              startup.  This is  useful  for  sending  messages  from  scripts
58              started by cron(8).
59
60       -f [file]
61              Read  in the contents of the user's mbox (or the specified file)
62              for processing; when mailx is quit, it writes undeleted messages
63              back  to this file.  The string file is handled as described for
64              the folder command below.
65
66       -F     Save the message to send in a file named after the local part of
67              the first recipient's address.
68
69       -H     Print header summaries for all messages and exit.
70
71       -h hops
72              Invoke  sendmail  with the specified hop count.  This option has
73              no effect when SMTP is used for sending mail.
74
75       -i     Ignore tty interrupt signals.  This is particularly useful  when
76              using mailx on noisy phone lines.
77
78       -I     Shows  the  `Newsgroup:'  or  `Article-Id:' fields in the header
79              summary.  Only applicable in combination with -f.
80
81       -n     Inhibits reading /etc/mail.rc upon startup.  This option  should
82              be activated for mailx scripts that are invoked on more than one
83              machine, because the contents of that file  may  differ  between
84              them.
85
86       -N     Inhibits  the  initial  display  of message headers when reading
87              mail or editing a mail folder.
88
89       -q file
90              Start the message with the contents of the specified file.   May
91              be given in send mode only.
92
93       -r address
94              Sets  the From address. Overrides any from variable specified in
95              environment or startup files.  Tilde escapes are disabled.   The
96              -r  address options are passed to the mail transfer agent unless
97              SMTP is used.  This option exists for compatibility only; it  is
98              recommended to set the from variable directly instead.
99
100       -R     Opens any folders read-only.
101
102       -s subject
103              Specify  subject  on command line (only the first argument after
104              the -s flag is used as a subject; be careful to  quote  subjects
105              containing spaces).
106
107       -S variable[=value]
108              Sets  the  internal  option  variable  and,  in case of a string
109              option, assigns value to it.  Note, that when setting from vari‐
110              able,  domain  name of host is automatically added if value does
111              not contain any.  If you want to enter from address with owner's
112              name,  you can use, for example, following format: -S "from=Sys‐
113              tem User <DoNotReply>"
114
115       -T name
116              Writes the `Message-Id:' and `Article-Id:' header fields of each
117              message  read  in  the file name.  Implies -I.  Compressed files
118              are handled as described for the folder command below.
119
120       -t     The message to be sent is expected to contain a  message  header
121              with  `To:',  `Cc:',  or  `Bcc:'  fields  giving its recipients.
122              Recipients specified on the command line are ignored.
123
124       -u user
125              Reads the mailbox of the given user name.
126
127       -v     Verbose mode.  The details of  delivery  are  displayed  on  the
128              user's terminal.
129
130       -V     Print mailx's version and exit.
131
132       -~     Enable tilde escapes even if not in interactive mode.
133
134   Sending mail
135       To  send  a  message  to  one or more people, mailx can be invoked with
136       arguments which are the names of people to whom the mail will be  sent.
137       The  user is then expected to type in his message, followed by an `con‐
138       trol-D' at the beginning of a line.  The section below Replying  to  or
139       originating  mail,  describes  some features of mailx available to help
140       when composing letters.
141
142   Reading mail
143       In normal usage mailx is given no arguments and checks the user's  mail
144       out  of the post office, then prints out a one line header of each mes‐
145       sage found.  The current message is initially the first  message  (num‐
146       bered 1) and can be printed using the print command which can be abbre‐
147       viated `p').  The user can move among the messages  much  as  he  moves
148       between  lines in ed(1), with the commands `+' and `-' moving backwards
149       and forwards, and simple numbers.
150
151   Disposing of mail
152       After examining a message the user can delete `d') the message or reply
153       `r') to it.  Deletion causes the mailx program to forget about the mes‐
154       sage.  This is not irreversible; the message can be undeleted  `u')  by
155       giving  its  number,  or the mailx session can be aborted by giving the
156       exit `x') command.  Deleted messages will, however,  usually  disappear
157       never to be seen again.
158
159   Specifying messages
160       Commands  such  as print and delete can be given a list of message num‐
161       bers as arguments to apply to a  number  of  messages  at  once.   Thus
162       `delete  1 2' deletes messages 1 and 2, while `delete 1-5' deletes mes‐
163       sages 1 through 5.  In sorted or threaded mode (see the sort and thread
164       commands),  `delete  1-5' deletes the messages that are located between
165       (and including) messages 1 through 5 in the sorted/threaded  order,  as
166       shown  in  the  header  summary.   The  following special message names
167       exist:
168
169       :n     All new messages.
170
171       :o     All old messages (any not in state read or new).
172
173       :u     All unread messages.
174
175       :d     All deleted messages (for the undelete command).
176
177       :r     All read messages.
178
179       :f     All `flagged' messages.
180
181       :a     All answered messages (cf. the markanswered variable).
182
183       :t     All messages marked as draft.
184
185       :k     All `killed' messages.
186
187       :j     All messages classified as junk.
188
189       .      The current message.
190
191       ;      The message that was previously the current message.
192
193       ,      The parent message of the current message, that is  the  message
194              with  the  Message-ID  given  in the `In-Reply-To:' field or the
195              last entry of the `References:' field of the current message.
196
197       -      The next  previous  undeleted  message,  or  the  next  previous
198              deleted  message  for  the undelete command.  In sorted/threaded
199              mode, the next previous  such  message  in  the  sorted/threaded
200              order.
201
202       +      The  next undeleted message, or the next deleted message for the
203              undelete command.  In sorted/threaded mode, the next  such  mes‐
204              sage in the sorted/threaded order.
205
206       ^      The  first  undeleted  message, or the first deleted message for
207              the undelete command.  In sorted/threaded mode, the  first  such
208              message in the sorted/threaded order.
209
210       $      The  last message.  In sorted/threaded mode, the last message in
211              the sorted/threaded order.
212
213       &x     In threaded mode, selects the message addressed with x, where  x
214              is  any  other  message specification, and all messages from the
215              thread that begins at it.  Otherwise, it is identical to x.   If
216              x  is  omitted, the thread beginning with the current message is
217              selected.
218
219       *      All messages.
220
221       `      All messages that were included in the message list for the pre‐
222              vious command.
223
224       /string
225              All  messages  that  contain  string  in the subject field (case
226              ignored).  See also the searchheaders variable.   If  string  is
227              empty,  the  string from the previous specification of that type
228              is used again.
229
230       address
231              All messages from address.  By default, this is a case-sensitive
232              search  for  the complete email address.  If the allnet variable
233              is set, only the local part of the addresses  is  evaluated  for
234              the  comparison.   Otherwise  if the showname variable is set, a
235              case-sensitive search for the complete real name of a sender  is
236              performed.  The IMAP-style (from address) expression can be used
237              instead if substring matches are desired.
238
239       (criterion)
240              All messages that satisfy the given IMAP-style SEARCH criterion.
241              This addressing mode is available with all types of folders; for
242              folders not located on IMAP servers, or for  servers  unable  to
243              execute  the  SEARCH  command,  mailx  will  perform  the search
244              locally.  Strings must be enclosed by double quotes `"' in their
245              entirety  if they contain white space or parentheses; within the
246              quotes, only backslash `\' is recognized as an escape character.
247              All  string searches are case-insensitive.  When the description
248              indicates that the `envelope' representation of an address field
249              is  used,  this  means that the search string is checked against
250              both a list constructed as
251
252              ("real name" "source-route" "local-part" "domain-part")
253
254              for each address, and the addresses without real names from  the
255              respective header field.  Criteria can be nested using parenthe‐
256              ses.
257
258       (criterion1 criterion2 ... criterionN)
259              All messages that satisfy all of the given criteria.
260
261       (or criterion1 criterion2)
262              All messages that satisfy either criterion1  or  criterion2,  or
263              both.  To connect more than two criteria using `or', (or) speci‐
264              fications have to be nested  using  additional  parentheses,  as
265              with  `(or a (or b c))';  `(or a b c)'  means  ((a or b) and c).
266              For a simple `or' operation of independent criteria on the  low‐
267              est  nesting level, it is possible to achieve similar effects by
268              using three separate criteria, as with `(a) (b) (c)'.
269
270       (not criterion)
271              All messages that do not satisfy criterion.
272
273       (bcc string)
274              All messages that contain string in the  `envelope'  representa‐
275              tion of the Bcc: field.
276
277       (cc string)
278              All  messages  that contain string in the `envelope' representa‐
279              tion of the Cc: field.
280
281       (from string)
282              All messages that contain string in the  `envelope'  representa‐
283              tion of the From: field.
284
285       (subject string)
286              All messages that contain string in the Subject: field.
287
288       (to string)
289              All  messages  that contain string in the `envelope' representa‐
290              tion of the To: field.
291
292       (header name string)
293              All messages that contain string in the specified Name: field.
294
295       (body string)
296              All messages that contain string in their body.
297
298       (text string)
299              All messages that contain string in their header or body.
300
301       (larger size)
302              All messages that are larger than size (in bytes).
303
304       (smaller size)
305              All messages that are smaller than size (in bytes).
306
307       (before date)
308              All messages that were received before date; date must be in the
309              form d[d]-mon-yyyy, where d[d] is the day of the month as one or
310              two digits, mon is the name of the month—one  of  `Jan',  `Feb',
311              `Mar',  `Apr',  `May', `Jun', `Jul', `Aug', `Sep', `Oct', `Nov',
312              or  `Dec',  and  yyyy  is  the  year  as   four   digits;   e.g.
313              "30-Aug-2004".
314
315       (on date)
316              All messages that were received on the specified date.
317
318       (since date)
319              All messages that were received since the specified date.
320
321       (sentbefore date)
322              All messages that were sent on the specified date.
323
324       (senton date)
325              All messages that were sent on the specified date.
326
327       (sentsince date)
328              All messages that were sent since the specified date.
329
330       ()     The  same criterion as for the previous search.  This specifica‐
331              tion cannot be used as part of another criterion.  If the previ‐
332              ous  command line contained more than one independent criterion,
333              the last of those criteria is used.
334
335       A practical method to read a set of messages is to issue a from command
336       with  the  search criteria first to check for appropriate messages, and
337       to read each single message then by typing ``' repeatedly.
338
339   Replying to or originating mail
340       The reply command can be used to set up a response to a message,  send‐
341       ing  it  back  to  the  person who it was from.  Text the user types in
342       then, up to an end-of-file, defines the contents of the message.  While
343       the  user is composing a message, mailx treats lines beginning with the
344       character `~' specially.  For instance, typing `~m' (alone on  a  line)
345       will place a copy of the current message into the response right shift‐
346       ing it by a tabstop (see indentprefix variable, below).  Other  escapes
347       will  set  up subject fields, add and delete recipients to the message,
348       attach files to it and allow the user to escape to an editor to  revise
349       the  message  or  to  a shell to run some commands.  (These options are
350       given in the summary below.)
351
352   Ending a mail processing session
353       The user can end a mailx session with the quit (`q') command.  Messages
354       which  have  been  examined go to the user's mbox file unless they have
355       been deleted in which case they are discarded.  Unexamined messages  go
356       back to the post office.  (See the -f option above).
357
358   Personal and systemwide distribution lists
359       It  is  also  possible to create a personal distribution lists so that,
360       for instance, the user can send mail to `cohorts' and have it go  to  a
361       group of people.  Such lists can be defined by placing a line like
362
363               alias cohorts bill ozalp jkf mark kridle@ucbcory
364
365       in  the file .mailrc in the user's home directory.  The current list of
366       such aliases can be displayed with the alias command in mailx.   System
367       wide  distribution  lists  can  be created by editing /etc/aliases, see
368       aliases(5) and sendmail(8); these are kept in a different  syntax.   In
369       mail  the user sends, personal aliases will be expanded in mail sent to
370       others so that they will be able to reply to  the  recipients.   System
371       wide  aliases  are  not  expanded  when the mail is sent, but any reply
372       returned to the machine will have the system wide alias expanded as all
373       mail goes through sendmail.
374
375   Recipient address specifications
376       If  the expandaddr option is not set (the default), recipient addresses
377       must be names of local mailboxes or Internet mail addresses.
378
379       If the expandaddr option is set, the following  rules  apply:  When  an
380       address  is  used to name a recipient (in any of To, Cc, or Bcc), names
381       of local mail folders and pipes to external commands can also be speci‐
382       fied;  the  message  text  is then written to them.  The rules are: Any
383       name which starts with a `|' character specifies a  pipe,  the  command
384       string  following  the  `|'  is executed and the message is sent to its
385       standard input; any other  name  which  contains  a  `@'  character  is
386       treated as a mail address; any other name which starts with a `+' char‐
387       acter specifies a folder name; any other  name  which  contains  a  `/'
388       character  but  no `!'  or `%' character before also specifies a folder
389       name; what remains is treated as a mail  address.   Compressed  folders
390       are handled as described for the folder command below.
391
392   Network mail (Internet / ARPA, UUCP, Berknet)
393       See  mailaddr(7)  for  a description of network addresses.  Mailx has a
394       number of options which can be set in the .mailrc  file  to  alter  its
395       behavior;  thus  `set askcc' enables the askcc feature.  (These options
396       are summarized below).
397
398   MIME types
399       For any outgoing attachment, mailx tries to determine the content type.
400       It  does this by reading MIME type files whose lines have the following
401       syntax:
402
403               type/subtype      extension [extension . . .]
404
405       where type/subtype are strings describing the file contents, and exten‐
406       sion  is  the part of a filename starting after the last dot.  Any line
407       not immediately beginning  with  an  ASCII  alphabetical  character  is
408       ignored  by  mailx.  If there is a match with the extension of the file
409       to attach, the given type/subtype pair is used.  Otherwise, or  if  the
410       filename  has  no  extension,  the content types text/plain or applica‐
411       tion/octet-stream are used, the first for text  or  international  text
412       files,  the  second  for  any  file that contains formatting characters
413       other than newlines and horizontal tabulators.
414
415   Character sets
416       Mailx normally detects the character set  of  the  terminal  using  the
417       LC_CTYPE  locale  setting.  If the locale cannot be used appropriately,
418       the ttycharset variable should be set to  provide  an  explicit  value.
419       When  reading messages, their text is converted to the terminal charac‐
420       ter set if possible.  Unprintable characters and illegal byte sequences
421       are  detected and replaced by Unicode substitute characters or question
422       marks unless the print-all-chars is set at initialization time.
423
424       The character set for outgoing messages is not necessarily the same  as
425       the  one  used  on  the terminal.  If an outgoing text message contains
426       characters not representable in US-ASCII, the character set being  used
427       must be declared within its header.  Permissible values can be declared
428       using the sendcharsets variable, separated by commas; mailx tries  each
429       of the values in order and uses the first appropriate one.  If the mes‐
430       sage contains characters that cannot be represented in any of the given
431       character  sets,  the  message  will  not be sent, and its text will be
432       saved to the `dead.letter' file.  Messages that contain NUL  bytes  are
433       not converted.
434
435       Outgoing  attachments  are  converted  if  they are plain text.  If the
436       sendcharsets variable contains more than one character set name, the ~@
437       tilde escape will ask for the character sets for individual attachments
438       if it is invoked without arguments.
439
440       Best results are usually achieved when mailx is run in a  UTF-8  locale
441       on  a  UTF-8  capable terminal.  In this setup, characters from various
442       countries can be displayed, while it is still possible to use more sim‐
443       ple  character  sets  for  sending to retain maximum compatibility with
444       older mail clients.
445
446   Commands
447       Each command is typed on a line by itself, and may take arguments  fol‐
448       lowing the command word.  The command need not be typed in its entirety
449       – the first command which matches the typed prefix is used.   For  com‐
450       mands  which  take  message  lists  as arguments, if no message list is
451       given, then the next message  forward  which  satisfies  the  command's
452       requirements  is used.  If there are no messages forward of the current
453       message, the search proceeds backwards, and if there are no  good  mes‐
454       sages at all, mailx types `applicable messages' and aborts the command.
455       If the command begins with a # sign, the line is ignored.
456
457       The arguments to commands can be quoted, using the following methods:
458
459       ·      An argument can be enclosed between paired double-quotes  ""  or
460              single-quotes  '';  any  white  space,  shell word expansion, or
461              backslash characters within the quotes are treated literally  as
462              part  of the argument.  A double-quote will be treated literally
463              within single-quotes and vice versa. These special properties of
464              the quote marks occur only when they are paired at the beginning
465              and end of the argument.
466
467       ·      A backslash outside of the enclosing quotes is discarded and the
468              following  character  is  treated literally as part of the argu‐
469              ment.
470
471       ·      An unquoted backslash at the end of a command line is  discarded
472              and the next line continues the command.
473
474       Filenames,  where  expected, are subjected to the following transforma‐
475       tions, in sequence:
476
477       ·      If the filename begins with  an  unquoted  plus  sign,  and  the
478              folder  variable  is  defined, the plus sign will be replaced by
479              the value of the folder variable followed by  a  slash.  If  the
480              folder variable is unset or is set to null, the filename will be
481              unchanged.
482
483       ·      Shell word expansions are applied to the filename.  If more than
484              a single pathname results from this expansion and the command is
485              expecting one file, an error results.
486
487       The following commands are provided:
488
489       -      Print out the preceding message.  If given a numeric argument n,
490              goes to the n'th previous message and prints it.
491
492       ?      Prints a brief summary of commands.
493
494       !      Executes the shell (see sh(1) and csh(1)) command which follows.
495
496       |      A synonym for the pipe command.
497
498       account
499              (ac)  Creates, selects or lists an email account.  An account is
500              formed by a group of commands, primarily of those to  set  vari‐
501              ables.   With  two  arguments, of which the second is a `{', the
502              first argument gives an account name, and  the  following  lines
503              create  a  group  of commands for that account until a line con‐
504              taining a single `}' appears.  With one argument, the previously
505              created  group of commands for the account name is executed, and
506              a folder command is executed for the system mailbox or inbox  of
507              that account.  Without arguments, the list of accounts and their
508              contents are printed.  As an example,
509
510                  account myisp {
511                      set folder=imaps://mylogin@imap.myisp.example
512                      set record=+Sent
513                      set from="myname@myisp.example (My Name)"
514                      set smtp=smtp.myisp.example
515                  }
516
517              creates an account named `myisp' which can later be selected  by
518              specifying `account myisp'.
519
520       alias  (a) With no arguments, prints out all currently-defined aliases.
521              With one argument, prints out that alias.  With  more  than  one
522              argument, creates a new alias or changes an old one.
523
524       alternates
525              (alt)  The alternates command is useful if the user has accounts
526              on several machines.  It can be used to inform  mailx  that  the
527              listed  addresses  all  belong  to  the  invoking user.  When he
528              replies to messages, mailx will not send a copy of  the  message
529              to  any  of the addresses listed on the alternates list.  If the
530              alternates command is given with no argument, the current set of
531              alternate names is displayed.
532
533       answered
534              (ans)  Takes  a  message list and marks each message as a having
535              been answered.  This mark has no technical meaning in  the  mail
536              system;  it just causes messages to be marked in the header sum‐
537              mary, and makes them specially addressable.
538
539       cache  Only applicable to cached IMAP mailboxes; takes a  message  list
540              and reads the specified messages into the IMAP cache.
541
542       call   Calls a macro (see the define command).
543
544       cd     Same as chdir.
545
546       certsave
547              Only applicable to S/MIME signed messages.  Takes a message list
548              and a file name and saves the certificates contained within  the
549              message  signatures to the named file in both human-readable and
550              PEM  format.   The  certificates  can  later  be  used  to  send
551              encrypted  messages  to the messages' originators by setting the
552              smime-encrypt-user@host variable.
553
554       chdir  (ch) Changes the user's working directory to that specified,  if
555              given.   If  no  directory  is given, then changes to the user's
556              login directory.
557
558       classify
559              (cl) Takes a list of messages and examines  their  contents  for
560              characteristics of junk mail using Bayesian filtering.  Messages
561              considered to be junk are then marked as such.   The  junk  mail
562              database is not changed.
563
564       collapse
565              (coll)  Only  applicable to threaded mode.  Takes a message list
566              and makes all replies to these messages invisible in header sum‐
567              maries, unless they are in state `new'.
568
569       connect
570              (conn)  If  operating  in  disconnected mode on an IMAP mailbox,
571              switch to online mode and  connect  to  the  mail  server  while
572              retaining  the  mailbox status.  See the description of the dis‐
573              connected variable for more information.
574
575       copy   (c) The copy command does the same thing that save does,  except
576              that  it  does  not mark the messages it is used on for deletion
577              when the user quits.  Compressed files and  IMAP  mailboxes  are
578              handled as described for the folder command.
579
580       Copy   (C)  Similar  to  copy,  but  saves the messages in a file named
581              after the local part of the sender address of the first message.
582
583       decrypt
584              (dec) For unencrypted messages, this  command  is  identical  to
585              copy.   Encrypted messages are first decrypted, if possible, and
586              then copied.
587
588       Decrypt
589              (Dec) Similar to decrypt, but saves the messages in a file named
590              after the local part of the sender address of the first message.
591
592       define (def) Defines a macro.  A macro definition is a sequence of com‐
593              mands in the following form:
594
595                  define name {
596                      command1
597                      command2
598                      ...
599                      commandN
600                  }
601
602              Once defined, a macro can be explicitly invoked using  the  call
603              command, or can be implicitly invoked by setting the folder-hook
604              or folder-hook-fullname variables.
605
606       defines
607              Prints the currently defined macros including their contents.
608
609       delete (d) Takes a list of messages as argument and marks them  all  as
610              deleted.   Deleted  messages will not be saved in mbox, nor will
611              they be available for most other commands.
612
613       discard
614              Same as ignore.
615
616       disconnect
617              (disco) If operating in online mode on an IMAP  mailbox,  switch
618              to  disconnected  mode  while retaining the mailbox status.  See
619              the description of the disconnected variable for  more  informa‐
620              tion.   A  list of messages may optionally be given as argument;
621              the respective messages are then read into the cache before  the
622              connection  is  closed.  Thus `disco *' makes the entire current
623              mailbox available for disconnected use.
624
625       dp or dt
626              Deletes the current message and prints  the  next  message.   If
627              there is no next message, mailx says `at EOF'.
628
629       draft  Takes  a  message  list and marks each message as a draft.  This
630              mark has no technical meaning in the mail system; it just causes
631              messages to be marked in the header summary, and makes them spe‐
632              cially addressable.
633
634       echo   Echoes its arguments, resolving special names as documented  for
635              the  folder  command.   The  escape  sequences `\a', `\b', `\c',
636              `\f', `\n', `\r', `\t', `\v', `\\', and `\0num' are  interpreted
637              as with the echo(1) command.
638
639       edit   (e)  Takes a list of messages and points the text editor at each
640              one in turn.  Modified contents are discarded unless the  write‐
641              backedited variable is set.
642
643       else   Marks the end of the then-part of an if statement and the begin‐
644              ning of the part to take effect  if  the  condition  of  the  if
645              statement is false.
646
647       endif  Marks the end of an if statement.
648
649       exit   (ex or x) Effects an immediate return to the Shell without modi‐
650              fying the user's system mailbox, his mbox file, or his edit file
651              in -f.
652
653       file   (fi) The same as folder.
654
655       flag   (fl)  Takes  a  message list and marks the messages as `flagged'
656              for urgent/special attention.  This mark has no technical  mean‐
657              ing  in  the  mail  system;  it just causes messages to be high‐
658              lighted in the header summary, and makes them specially address‐
659              able.
660
661       folders
662              With  no  arguments, list the names of the folders in the folder
663              directory.  With an existing folder as an argument,  lists  then
664              names of folders below the named folder; e.g. the command `fold‐
665              ers @' lists the folders on the base level of the  current  IMAP
666              server.  See also the imap-list-depth variable.
667
668       folder (fold) The folder command switches to a new mail file or folder.
669              With no arguments, it tells the user which file he is  currently
670              reading.   If  an  argument  is given, it will write out changes
671              (such as deletions) the user has made in the  current  file  and
672              read  in  the new file.  Some special conventions are recognized
673              for the name.  # means the previous file, % means  the  invoking
674              user's  system  mailbox,  %user  means  user's system mailbox, &
675              means the invoking user's mbox file, and +file means a  file  in
676              the  folder  directory.  %:filespec expands to the same value as
677              filespec, but the file is handled as a system mailbox  e. g.  by
678              the  mbox  and  save  commands.   If the name matches one of the
679              strings defined with the shortcut command, it is replaced by its
680              long  form  and expanded.  If the name ends with .gz or .bz2, it
681              is treated as compressed with gzip(1) or bzip2(1), respectively.
682              Likewise, if name does not exist, but either name.gz or name.bz2
683              exists, the compressed file is used.  If name refers to a direc‐
684              tory  with  the  subdirectories  `tmp',  `new', and `cur', it is
685              treated as a folder in maildir format.  A name of the form
686
687                     protocol://[user@]host[:port][/file]
688
689              is taken as an Internet mailbox  specification.   The  supported
690              protocols  are  currently  imap  (IMAP  v4r1),  imaps (IMAP with
691              SSL/TLS encryption), pop3 (POP3), and pop3s (POP3  with  SSL/TLS
692              encryption).  If user contains special characters, in particular
693              `/' or `%', they must be escaped in URL notation,  as  `%2F'  or
694              `%25'.   The  optional  file part applies to IMAP only; if it is
695              omitted, the default `INBOX' is used.  If mailx is connected  to
696              an  IMAP server, a name of the form @mailbox refers to the mail‐
697              box on that server.  If the `folder' variable refers to an  IMAP
698              account,  the  special  name  `%'  selects  the  `INBOX' on that
699              account.
700
701       Followup
702              (F) Similar to Respond, but saves the message in  a  file  named
703              after the local part of the first recipient's address.
704
705       followup
706              (fo)  Similar  to respond, but saves the message in a file named
707              after the local part of the first recipient's address.
708
709       followupall
710              Similar to followup, but responds to all  recipients  regardless
711              of the flipr and Replyall variables.
712
713       followupsender
714              Similar  to Followup, but responds to the sender only regardless
715              of the flipr and Replyall variables.
716
717       forward
718              (fwd) Takes a message and the address of a  recipient  and  for‐
719              wards  the  message to him.  The text of the original message is
720              included in the new one, with the value of the fwdheading  vari‐
721              able printed before.  The fwdignore and fwdretain commands spec‐
722              ify which header fields are included in the new  message.   Only
723              the  first  part  of  a multipart message is included unless the
724              forward-as-attachment option is set.
725
726       Forward
727              (Fwd) Similar to forward, but saves the message in a file  named
728              after the local part of the recipient's address.
729
730       from   (f)  Takes  a list of messages and prints their message headers,
731              piped through the pager if  the  output  does  not  fit  on  the
732              screen.
733
734       fwdignore
735              Specifies which header fields are to be ignored with the forward
736              command.  This command has no effect when the forward-as-attach‐
737              ment option is set.
738
739       fwdretain
740              Specifies  which  header fields are to be retained with the for‐
741              ward command.  fwdretain overrides fwdignore.  This command  has
742              no effect when the forward-as-attachment option is set.
743
744       good   (go) Takes a list of messages and marks all of them as not being
745              junk mail.  Data from these messages is then inserted  into  the
746              junk mail database for future classification.
747
748       headers
749              (h)  Lists  the current range of headers, which is an 18-message
750              group.  If a `+' argument is given,  then  the  next  18-message
751              group  is  printed, and if a `-' argument is given, the previous
752              18-message group is printed.
753
754       help   A synonym for ?.
755
756       hold   (ho, also preserve) Takes a message list and marks each  message
757              therein  to  be saved in the user's system mailbox instead of in
758              mbox.  Does not override the  delete  command.   mailx  deviates
759              from  the  POSIX standard with this command, as a `next' command
760              issued after `hold' will display the following message, not  the
761              current one.
762
763       if     Commands  in mailx's startup files can be executed conditionally
764              depending on whether the user is sending or receiving mail  with
765              the if command.  For example:
766
767                      if receive
768                              commands . . .
769                      endif
770
771              An else form is also available:
772
773                      if receive
774                              commands . . .
775                      else
776                              commands . . .
777                      endif
778
779              Note  that  the  only  allowed conditions are receive, send, and
780              term (execute command if standard input is a tty).
781
782       ignore Add the list of header fields named to the ignored list.  Header
783              fields in the ignore list are not printed on the terminal when a
784              message is printed.  This command is very handy for  suppression
785              of  certain machine-generated header fields.  The Type and Print
786              commands can be used to print a message in its entirety, includ‐
787              ing ignored fields.  If ignore is executed with no arguments, it
788              lists the current set of ignored fields.
789
790       imap   Sends command strings  directly  to  the  current  IMAP  server.
791              Mailx  operates  always  in  IMAP  selected state on the current
792              mailbox; commands that  change  this  will  produce  undesirable
793              results and should be avoided.  Useful IMAP commands are:
794
795              create Takes the name of an IMAP mailbox as an argument and cre‐
796                     ates it.
797
798              getquotaroot
799                     Takes the name of an IMAP  mailbox  as  an  argument  and
800                     prints  the  quotas  that  apply to the mailbox.  Not all
801                     IMAP servers support this command.
802
803              namespace
804                     Takes no arguments and prints  the  Personal  Namespaces,
805                     the  Other  User's Namespaces, and the Shared Namespaces.
806                     Each namespace type is printed in parentheses;  if  there
807                     are multiple namespaces of the same type, inner parenthe‐
808                     ses separate them.  For each namespace, a namespace  pre‐
809                     fix  and  a  hierarchy separator is listed.  Not all IMAP
810                     servers support this command.
811
812       inc    Same as newmail.
813
814       junk   (j) Takes a list of messages and marks all of them as junk mail.
815              Data  from  these  messages  is then inserted into the junk mail
816              database for future classification.
817
818       kill   (k) Takes a list of messages and `kills' them.  Killed  messages
819              are not printed in header summaries, and are ignored by the next
820              command.  The kill command also sets the score of  the  messages
821              to negative infinity, so that subsequent score commands will not
822              unkill them again.  Killing is only effective  for  the  current
823              session on a folder; when it is quit, all messages are automati‐
824              cally unkilled.
825
826       list   Prints the names of all available commands.
827
828       Mail   (M) Similar to mail, but saves the message in a file named after
829              the local part of the first recipient's address.
830
831       mail   (m)  Takes  as argument login names and distribution group names
832              and sends mail to those people.
833
834       mbox   Indicate that a list of messages be sent to mbox in  the  user's
835              home  directory  when mailx is quit.  This is the default action
836              for messages if unless the hold option is set.   mailx  deviates
837              from  the  POSIX standard with this command, as a `next' command
838              issued after `mbox' will display the following message, not  the
839              current one.
840
841       move   (mv) Acts like copy, but marks the messages for deletion if they
842              were transferred successfully.
843
844       Move   (Mv) Similar to move, but moves the messages  to  a  file  named
845              after the local part of the sender address of the first message.
846
847       newmail
848              Checks for new mail in the current folder without committing any
849              changes before.  If new mail is present, a message  is  printed.
850              If  the  header variable is set, the headers of each new message
851              are also printed.
852
853       next   (n) like + or CR) Goes to the next message in sequence and types
854              it.  With an argument list, types the next matching message.
855
856       New    Same as unread.
857
858       new    Same as unread.
859
860       online Same as connect.
861
862       noop   If  the  current  folder is located on an IMAP or POP3 server, a
863              NOOP command is sent.  Otherwise, no operation is performed.
864
865       Pipe   (Pi) Like pipe but also pipes  ignored  header  fields  and  all
866              parts of MIME multipart/alternative messages.
867
868       pipe   (pi) Takes a message list and a shell command and pipes the mes‐
869              sages through the command.  Without  an  argument,  the  current
870              message  is piped through the command given by the cmd variable.
871              If the  page variable is set, every message  is  followed  by  a
872              formfeed character.
873
874       preserve
875              (pre) A synonym for hold.
876
877       Print  (P) Like print but also prints out ignored header fields and all
878              parts of MIME multipart/alternative messages.  See  also  print,
879              ignore, and retain.
880
881       print  (p)  Takes  a  message  list  and  types out each message on the
882              user's terminal.  If the message is a  MIME  multipart  message,
883              all  parts with a content type of `text' or `message' are shown,
884              the other are hidden except for  their  headers.   Messages  are
885              decrypted  and converted to the terminal character set if neces‐
886              sary.
887
888       probability
889              (prob) For each word given as argument, the contents of its junk
890              mail database entry are printed.
891
892       quit   (q)  Terminates  the session, saving all undeleted, unsaved mes‐
893              sages in the user's mbox file in his login directory, preserving
894              all messages marked with hold or preserve or never referenced in
895              his system mailbox, and removing all  other  messages  from  his
896              system mailbox.  If new mail has arrived during the session, the
897              message `You have new mail' is given.  If given while editing  a
898              mailbox  file with the -f flag, then the edit file is rewritten.
899              A return to the Shell is effected, unless the  rewrite  of  edit
900              file fails, in which case the user can escape with the exit com‐
901              mand.
902
903       redirect
904              (red) Same as resend.
905
906       Redirect
907              (Red) Same as Resend.
908
909       remove (rem) Removes the named folders.  The user is asked for  confir‐
910              mation in interactive mode.
911
912       rename (ren)  Takes the name of an existing folder and the name for the
913              new folder and renames the first to the second one.  Both  fold‐
914              ers  must be of the same type and must be located on the current
915              server for IMAP.
916
917       Reply  (R) Reply to originator.  Does not reply to other recipients  of
918              the original message.
919
920       reply  (r)  Takes  a  message list and sends mail to the sender and all
921              recipients of the specified message.  The default  message  must
922              not be deleted.
923
924       replyall
925              Similar  to  reply, but responds to all recipients regardless of
926              the flipr and Replyall variables.
927
928       replysender
929              Similar to Reply, but responds to the sender only regardless  of
930              the flipr and Replyall variables.
931
932       Resend Like  resend,  but does not add any header lines.  This is not a
933              way to hide the sender's identity, but useful for sending a mes‐
934              sage again to the same recipients.
935
936       resend Takes  a list of messages and a user name and sends each message
937              to the named user.  `Resent-From:' and related header fields are
938              prepended to the new copy of the message.
939
940       Respond
941              Same as Reply.
942
943       respond
944              Same as reply.
945
946       respondall
947              Same as replyall.
948
949       respondsender
950              Same as replysender.
951
952       retain Add  the list of header fields named to the retained list.  Only
953              the header fields in the retain list are shown on  the  terminal
954              when  a  message  is  printed.  All other header fields are sup‐
955              pressed.  The Type and Print commands can be  used  to  print  a
956              message  in  its  entirety.  If retain is executed with no argu‐
957              ments, it lists the current set of retained fields.
958
959       Save   (S) Similar to save, but saves the  messages  in  a  file  named
960              after  the local part of the sender of the first message instead
961              of taking a filename argument.
962
963       save   (s) Takes a message list and a filename and appends each message
964              in  turn  to  the end of the file.  If no filename is given, the
965              mbox file is used.  The filename in quotes, followed by the line
966              count  and character count is echoed on the user's terminal.  If
967              editing a system mailbox, the messages are marked for  deletion.
968              Compressed files and IMAP mailboxes are handled as described for
969              the -f command line option above.
970
971       savediscard
972              Same as saveignore.
973
974       saveignore
975              Saveignore is to save what ignore is to print and type.   Header
976              fields  thus  marked  are  filtered out when saving a message by
977              save or when automatically saving to mbox.  This command  should
978              only be applied to header fields that do not contain information
979              needed to decode the message, as MIME  content  fields  do.   If
980              saving  messages  on  an  IMAP account, ignoring fields makes it
981              impossible to copy the data directly on the server, thus  opera‐
982              tion usually becomes much slower.
983
984       saveretain
985              Saveretain  is to save what retain is to print and type.  Header
986              fields thus marked are the only ones saved with a  message  when
987              saving by save or when automatically saving to mbox.  Saveretain
988              overrides saveignore.  The use of this command is strongly  dis‐
989              couraged  since  it  may  strip header fields that are needed to
990              decode the message correctly.
991
992       score  (sc) Takes a message list and a floating point number  and  adds
993              the  number  to  the  score of each given message.  All messages
994              start at score 0 when a folder is opened.  When the score  of  a
995              message  becomes  negative,  it  is  `killed'  with  the effects
996              described for the kill command; otherwise  if  it  was  negative
997              before  and  becomes  positive,  it  is `unkilled'.  Scores only
998              refer to the currently opened instance of a folder.
999
1000       set    (se) With  no  arguments,  prints  all  variable  values,  piped
1001              through  the  pager  if  the  output does not fit on the screen.
1002              Otherwise, sets option.  Arguments are of the form  option=value
1003              (no  space before or after =) or option.  Quotation marks may be
1004              placed around any part of  the  assignment  statement  to  quote
1005              blanks  or  tabs,  i.e. `set indentprefix="->"'.  If an argument
1006              begins with no, as in `set nosave', the effect is  the  same  as
1007              invoking  the unset command with the remaining part of the vari‐
1008              able (`unset save').
1009
1010       seen   Takes a message list and marks all messages as having been read.
1011
1012       shell  (sh) Invokes an interactive version of the shell.
1013
1014       shortcut
1015              Defines a  shortcut  name  and  its  string  for  expansion,  as
1016              described  for the folder command.  With no arguments, a list of
1017              defined shortcuts is printed.
1018
1019       show   (Sh) Like print, but performs neither MIME decoding nor  decryp‐
1020              tion so that the raw message text is shown.
1021
1022       size   Takes  a  message  list and prints out the size in characters of
1023              each message.
1024
1025       sort   Create a sorted representation of the current folder, and change
1026              the  next  command and the addressing modes such that they refer
1027              to messages in the sorted order.  Message numbers are  the  same
1028              as  in  regular  mode.   If the header variable is set, a header
1029              summary in the new order is also printed.  Possible sorting cri‐
1030              teria are:
1031
1032              date   Sort  the messages by their `Date:' field, that is by the
1033                     time they were sent.
1034
1035              from   Sort messages by the value of their `From:'  field,  that
1036                     is  by  the address of the sender.  If the showname vari‐
1037                     able is set, the sender's real name (if any) is used.
1038
1039              size   Sort the messages by their size.
1040
1041              score  Sort the messages by their score.
1042
1043              status Sort the messages by their  message  status  (new,  read,
1044                     old, etc.).
1045
1046              subject
1047                     Sort the messages by their subject.
1048
1049              thread Create a threaded order, as with the thread command.
1050
1051              to     Sort  messages by the value of their `To:' field, that is
1052                     by the address of the recipient.  If the  showname  vari‐
1053                     able is set, the recipient's real name (if any) is used.
1054
1055              If  no  argument  is  given,  the  current  sorting criterion is
1056              printed.
1057
1058       source The source command reads commands from a file.
1059
1060       thread (th) Create a threaded representation  of  the  current  folder,
1061              i.e.  indent  messages that are replies to other messages in the
1062              header display, and change the next command and  the  addressing
1063              modes  such  that  they refer to messages in the threaded order.
1064              Message numbers are the same as  in  unthreaded  mode.   If  the
1065              header  variable  is  set, a header summary in threaded order is
1066              also printed.
1067
1068       top    Takes a message list and prints the top few lines of each.   The
1069              number  of  lines printed is controlled by the variable toplines
1070              and defaults to five.
1071
1072       touch  Takes a message list and marks the messages for  saving  in  the
1073              mbox  file.   mailx  deviates  from the POSIX standard with this
1074              command, as a `next' command issued after  `mbox'  will  display
1075              the following message, not the current one.
1076
1077       Type   (T) Identical to the Print command.
1078
1079       type   (t) A synonym for print.
1080
1081       unalias
1082              Takes a list of names defined by alias commands and discards the
1083              remembered groups of users.  The group names no longer have  any
1084              significance.
1085
1086       unanswered
1087              Takes  a  message list and marks each message as not having been
1088              answered.
1089
1090       uncollapse
1091              (unc) Only applicable to threaded mode.  Takes  a  message  list
1092              and  makes  the  message and all replies to it visible in header
1093              summaries again.  When a message becomes the current message, it
1094              is  automatically  made  visible.  Also when a message with col‐
1095              lapsed replies is printed, all of these are automatically uncol‐
1096              lapsed.
1097
1098       undef  Undefines each of the named macros.  It is not an error to use a
1099              name that does not  belong  to  one  of  the  currently  defined
1100              macros.
1101
1102       undelete
1103              (u)  Takes  a  message  list and marks each message as not being
1104              deleted.
1105
1106       undraft
1107              Takes a message list and marks each message as a draft.
1108
1109       unflag Takes a message  list  and  marks  each  message  as  not  being
1110              `flagged'.
1111
1112       unfwdignore
1113              Removes  the  header field names from the list of ignored fields
1114              for the forward command.
1115
1116       unfwdretain
1117              Removes the header field names from the list of retained  fields
1118              for the forward command.
1119
1120       ungood Takes  a  message  list  and undoes the effect of a good command
1121              that was previously applied on exactly these messages.
1122
1123       unignore
1124              Removes the header field names from the list of ignored fields.
1125
1126       unjunk Takes a message list and undoes the effect  of  a  junk  command
1127              that was previously applied on exactly these messages.
1128
1129       unkill Takes  a message list and `unkills' each message.  Also sets the
1130              score of the messages to 0.
1131
1132       Unread Same as unread.
1133
1134       unread (U) Takes a message list and marks each message  as  not  having
1135              been read.
1136
1137       unretain
1138              Removes the header field names from the list of retained fields.
1139
1140       unsaveignore
1141              Removes  the  header field names from the list of ignored fields
1142              for saving.
1143
1144       unsaveretain
1145              Removes the header field names from the list of retained  fields
1146              for saving.
1147
1148       unset  Takes  a list of option names and discards their remembered val‐
1149              ues; the inverse of set.
1150
1151       unshortcut
1152              Deletes the shortcut names given as arguments.
1153
1154       unsort Disable sorted or threaded mode (see the sort  and  thread  com‐
1155              mands),  return to normal message order and, if the header vari‐
1156              able is set, print a header summary.
1157
1158       unthread
1159              (unth) Same as unsort.
1160
1161       verify (verif) Takes a message list and verifies each  message.   If  a
1162              message  is not an S/MIME signed message, verification will fail
1163              for it.  The verification process  checks  if  the  message  was
1164              signed  using a valid certificate, if the message sender's email
1165              address matches one of those contained within  the  certificate,
1166              and if the message content has been altered.
1167
1168       visual (v)  Takes a message list and invokes the display editor on each
1169              message.  Modified contents  are  discarded  unless  the  write‐
1170              backedited variable is set.
1171
1172       write  (w)  For  conventional messages, the body without all headers is
1173              written.  The output is decrypted and converted  to  its  native
1174              format,  if  necessary.   If the output file exists, the text is
1175              appended.—If a message is in MIME multipart  format,  its  first
1176              part  is  written to the specified file as for conventional mes‐
1177              sages, and the user is asked for a filename to save  each  other
1178              part;  if  the  contents  of the first part are not to be saved,
1179              `write /dev/null' can be used.  For the  second  and  subsequent
1180              parts,  if  the  filename given starts with a `|' character, the
1181              part is piped through the remainder of the filename  interpreted
1182              as  a shell command.  In non-interactive mode, only the parts of
1183              the multipart message that have a filename  given  in  the  part
1184              header  are written, the other are discarded.  The original mes‐
1185              sage is never  marked  for  deletion  in  the  originating  mail
1186              folder.   For  attachments, the contents of the destination file
1187              are overwritten if the file previously existed.  No special han‐
1188              dling of compressed files is performed.
1189
1190       xit    (x) A synonym for exit.
1191
1192       z      Mailx  presents message headers in windowfuls as described under
1193              the headers command.  The z command scrolls to the  next  window
1194              of  messages.   If an argument is given, it specifies the window
1195              to use.  A number prefixed by `+' or `-' indicates that the win‐
1196              dow is calculated in relation to the current position.  A number
1197              without a prefix specifies an absolute window number, and a  `$'
1198              lets mailx scroll to the last window of messages.
1199
1200       Z      Similar  to  z,  but scrolls to the next or previous window that
1201              contains at least one new or `flagged' message.
1202
1203   Tilde escapes
1204       Here is a summary of the tilde escapes, which are used  when  composing
1205       messages  to  perform special functions.  Tilde escapes are only recog‐
1206       nized at the beginning of lines.  The name `tilde escape'  is  somewhat
1207       of  a  misnomer  since  the  actual  escape character can be set by the
1208       option escape.
1209
1210       ~!command
1211              Execute the indicated shell command, then return to the message.
1212
1213       ~.     Same effect as typing the end-of-file character.
1214
1215       ~<filename
1216              Identical to ~r.
1217
1218       ~<!command
1219              Command is executed using the shell.   Its  standard  output  is
1220              inserted into the message.
1221
1222       ~@ [filename . . . ]
1223              With  no  arguments,  edit the attachment list.  First, the user
1224              can edit all existing attachment data.  If an attachment's  file
1225              name  is  left  empty, that attachment is deleted from the list.
1226              When the end of the attachment list is reached, mailx  will  ask
1227              for  further attachments, until an empty file name is given.  If
1228              filename arguments are specified, all of them  are  appended  to
1229              the  end  of the attachment list.  Filenames which contain white
1230              space can only be specified with the first method  (no  filename
1231              arguments).
1232
1233       ~A     Inserts  the  string contained in the Sign variable (same as `~i
1234              Sign').  The escape sequences `\t' (tabulator)  and  `\n'  (new‐
1235              line) are understood.
1236
1237       ~a     Inserts  the  string contained in the sign variable (same as `~i
1238              sign').  The escape sequences `\t' (tabulator)  and  `\n'  (new‐
1239              line) are understood.
1240
1241       ~bname . . .
1242              Add the given names to the list of carbon copy recipients but do
1243              not make the names visible  in  the  Cc:  line  (`blind'  carbon
1244              copy).
1245
1246       ~cname . . .
1247              Add the given names to the list of carbon copy recipients.
1248
1249       ~d     Read  the file `dead.letter' from the user's home directory into
1250              the message.
1251
1252       ~e     Invoke the text editor on the message collected so  far.   After
1253              the editing session is finished, the user may continue appending
1254              text to the message.
1255
1256       ~fmessages
1257              Read the named messages into the message being sent.  If no mes‐
1258              sages are specified, read in the current message.  Message head‐
1259              ers currently being ignored (by the ignore  or  retain  command)
1260              are  not  included.  For MIME multipart messages, only the first
1261              printable part is included.
1262
1263       ~Fmessages
1264              Identical to ~f, except all message headers and all  MIME  parts
1265              are included.
1266
1267       ~h     Edit  the  message header fields `To:', `Cc:', `Bcc:', and `Sub‐
1268              ject:' by typing each one in  turn  and  allowing  the  user  to
1269              append  text to the end or modify the field by using the current
1270              terminal erase and kill characters.
1271
1272       ~H     Edit the message header fields `From:', `Reply-To:',  `Sender:',
1273              and `Organization:' in the same manner as described for ~h.  The
1274              default  values  for  these  fields  originate  from  the  from,
1275              replyto,  and ORGANIZATION variables.  If this tilde command has
1276              been used, changing the variables has no effect on  the  current
1277              message anymore.
1278
1279       ~ivariable
1280              Insert  the  value  of  the  specified variable into the message
1281              adding a newline character at the end.  If the variable is unset
1282              or  empty,  the message remains unaltered.  The escape sequences
1283              `\t' (tabulator) and `\n' (newline) are understood.
1284
1285       ~mmessages
1286              Read the named messages into the message being sent, indented by
1287              a tab or by the value of indentprefix.  If no messages are spec‐
1288              ified, read the  current  message.   Message  headers  currently
1289              being  ignored  (by  the  ignore  or  retain  command)  are  not
1290              included.  For MIME multipart messages, only the first printable
1291              part is included.
1292
1293       ~Mmessages
1294              Identical  to  ~m, except all message headers and all MIME parts
1295              are included.
1296
1297       ~p     Print out the message collected so far, prefaced by the  message
1298              header  fields  and followed by the attachment list, if any.  If
1299              the message text is longer than the screen  size,  it  is  piped
1300              through the pager.
1301
1302       ~q     Abort  the message being sent, copying the message to `dead.let‐
1303              ter' in the user's home directory if save is set.
1304
1305       ~rfilename
1306              Read the named file into the message.
1307
1308       ~sstring
1309              Cause the named string to become the current subject field.
1310
1311       ~tname . . .
1312              Add the given names to the direct recipient list.
1313
1314       ~v     Invoke an alternate editor (defined by the VISUAL option) on the
1315              message collected so far.  Usually, the alternate editor will be
1316              a screen editor.  After the editor is quit, the user may  resume
1317              appending text to the end of the message.
1318
1319       ~wfilename
1320              Write  the message onto the named file.  If the file exists, the
1321              message is appended to it.
1322
1323       ~x     Same as ~q,  except  that  the  message  is  not  saved  to  the
1324              `dead.letter' file.
1325
1326       ~|command
1327              Pipe  the  message through the command as a filter.  If the com‐
1328              mand gives no output or terminates abnormally, retain the origi‐
1329              nal  text  of  the message.  The command fmt(1) is often used as
1330              command to rejustify the message.
1331
1332       ~:mailx-command
1333              Execute the given mailx command.  Not all commands, however, are
1334              allowed.
1335
1336       ~_mailx-command
1337              Identical to ~:.
1338
1339       ~~string
1340              Insert the string of text in the message prefaced by a single ~.
1341              If the escape character has been changed, that character must be
1342              doubled in order to send it at the beginning of a line.
1343
1344   Variable options
1345       Options  are  controlled  via set and unset commands, see their entries
1346       for a syntax description.  An option is also set if  it  is  passed  to
1347       mailx  as  part  of the environment (this is not restricted to specific
1348       variables as in the POSIX standard).  A value given in a  startup  file
1349       overrides a value imported from the environment, but it is not possible
1350       to unset an environment variable in a startup  file.   Options  may  be
1351       either binary, in which case it is only significant to see whether they
1352       are set or not; or string, in which case the actual value is of  inter‐
1353       est.
1354
1355   Binary options
1356       The binary options include the following:
1357
1358       allnet Causes  only  the  local  part  to  be  evaluated when comparing
1359              addresses.
1360
1361       append Causes messages saved in mbox to be appended to the  end  rather
1362              than prepended.  This should always be set.
1363
1364       ask or asksub
1365              Causes mailx to prompt for the subject of each message sent.  If
1366              the user responds with simply a newline, no subject  field  will
1367              be sent.
1368
1369       askatend
1370              Causes  the  prompts  for `Cc:' and `Bcc:' lists to appear after
1371              the message has been edited.
1372
1373       askattach
1374              If set, mailx asks for files to attach at the end of  each  mes‐
1375              sage.   Responding  with  a  newline indicates not to include an
1376              attachment.
1377
1378       askcc  Causes the user to be prompted for additional carbon copy recip‐
1379              ients  (at  the  end of each message if askatend or bsdcompat is
1380              set).  Responding with a newline indicates the user's  satisfac‐
1381              tion with the current list.
1382
1383       askbcc Causes  the user to be prompted for additional blind carbon copy
1384              recipients (at the end of each message if askatend or  bsdcompat
1385              is  set).  Responding with a newline indicates the user's satis‐
1386              faction with the current list.
1387
1388       asksign
1389              Causes the user to be prompted if the message is to be signed at
1390              the  end  of  each  message.  The smime-sign variable is ignored
1391              when this variable is set.
1392
1393       autocollapse
1394              Causes threads to be collapsed automatically when threaded  mode
1395              is entered (see the collapse command).
1396
1397       autoinc
1398              Same as newmail.
1399
1400       autoprint
1401              Causes the delete command to behave like dp - thus, after delet‐
1402              ing a message, the next one will be typed automatically.
1403
1404       autothread
1405              Causes threaded mode (see the  thread  command)  to  be  entered
1406              automatically when a folder is opened.
1407
1408       bang   Enables  the  substitution  of  `!'  by the contents of the last
1409              command line in shell escapes.
1410
1411       bsdannounce
1412              Causes automatic display of a header summary after  executing  a
1413              folder command.
1414
1415       bsdcompat
1416              Sets  some cosmetical features to traditional BSD style; has the
1417              same affect as setting `askatend' and all other  variables  pre‐
1418              fixed  with  `bsd',  setting  prompt  to  `& ', and changing the
1419              default pager to more.
1420
1421       bsdflags
1422              Changes the letters printed in the first column of a header sum‐
1423              mary to traditional BSD style.
1424
1425       bsdheadline
1426              Changes  the  display  of  columns in a header summary to tradi‐
1427              tional BSD style.
1428
1429       bsdmsgs
1430              Changes some informational messages to traditional BSD style.
1431
1432       bsdorder
1433              Causes the `Subject:' field  to  appear  immediately  after  the
1434              `To:' field in message headers and with the ~h tilde command.
1435
1436       bsdset Changes  the output format of the set command to traditional BSD
1437              style.
1438
1439       chained-junk-tokens
1440              Normally, the Bayesian junk mail filter  bases  its  classifica‐
1441              tions  on  single  word tokens extracted from messages.  If this
1442              option is set, adjacent words are combined to pairs,  which  are
1443              then used as additional tokens.  This usually improves the accu‐
1444              racy of the filter, but also increases the  junk  mail  database
1445              five- to tenfold.
1446
1447       datefield
1448              The date in a header summary is normally the date of the mailbox
1449              `From ' line of the message.  If this variable is set, the  date
1450              as given in the `Date:' header field is used, converted to local
1451              time.
1452
1453       debug  Prints debugging messages and disables the  actual  delivery  of
1454              messages.   Unlike  verbose,  this  option is intended for mailx
1455              development only.
1456
1457       disconnected
1458              When an IMAP mailbox is selected and this variable  is  set,  no
1459              connection  to  the  server  is  initiated.   Instead,  data  is
1460              obtained from the local cache (see imap-cache).  Mailboxes  that
1461              are  not  present  in  the  cache and messages that have not yet
1462              entirely been fetched from the  server  are  not  available;  to
1463              fetch  all  messages  in  a mailbox at once, the command `copy *
1464              /dev/null' can be used while still in online mode.  Changes that
1465              are  made  to IMAP mailboxes in disconnected mode are queued and
1466              committed later when a connection to that server  is  opened  in
1467              online mode.  This procedure is not completely reliable since it
1468              cannot be guaranteed that the IMAP unique identifiers (UIDs)  on
1469              the server still match the ones in the cache at that time.  Data
1470              is saved to `dead.letter' when this problem occurs.
1471
1472       disconnected-user@host
1473              The specified account is handled as described  for  the  discon‐
1474              nected variable above, but other accounts are not affected.
1475
1476       dot    The  binary  option dot causes mailx to interpret a period alone
1477              on a line as the terminator of a message the user is sending.
1478
1479       editheaders
1480              When a message is edited while being  composed,  its  header  is
1481              included  in  the  editable  text.   `To:', `Cc:', `Bcc:', `Sub‐
1482              ject:', `From:',  `Reply-To:',  `Sender:',  and  'Organization:'
1483              fields are accepted within the header, other fields are ignored.
1484
1485       emptybox
1486              If  set, an empty mailbox file is not removed.  This may improve
1487              the interoperability with other mail user agents  when  using  a
1488              common folder directory.
1489
1490       emptystart
1491              If  the  mailbox  is  empty,  mailx normally prints `No mail for
1492              user' and exits immediately.   If  this  option  is  set,  mailx
1493              starts even with an empty mailbox.
1494
1495       expandaddr
1496              Causes mailx to expand message recipient addresses, as explained
1497              in the section, Recipient address specifications.
1498
1499       flipr  Exchanges the Respond with the respond commands and vice-versa.
1500
1501       forward-as-attachment
1502              Original messages are normally sent as inline text with the for‐
1503              ward  command, and only the first part of a multipart message is
1504              included.  With this option, messages  are  sent  as  MIME  mes‐
1505              sage/rfc822  attachments,  and  all of their parts are included.
1506              The fwdignore and fwdretain options are ignored  when  the  for‐
1507              ward-as-attachment option is set.
1508
1509       fullnames
1510              When  replying  to a message, mailx normally removes the comment
1511              parts of email addresses, which by convention contain  the  full
1512              names  of  the recipients.  If this variable is set, such strip‐
1513              ping is not performed, and comments are retained.
1514
1515       header Causes the header summary to be written  at  startup  and  after
1516              commands that affect the number of messages or the order of mes‐
1517              sages in the current folder; enabled by default.
1518
1519       hold   This option is used to hold messages in the  system  mailbox  by
1520              default.
1521
1522       ignore Causes  interrupt  signals  from  the terminal to be ignored and
1523              echoed as @'s.
1524
1525       ignoreeof
1526              An option related to dot is ignoreeof which makes  mailx  refuse
1527              to  accept  a control-d as the end of a message.  Ignoreeof also
1528              applies to mailx command mode.
1529
1530       imap-use-starttls
1531              Causes mailx to issue a STARTTLS command to make an  unencrypted
1532              IMAP  session SSL/TLS encrypted.  This functionality is not sup‐
1533              ported by all servers, and is not used if the session is already
1534              encrypted by the IMAPS method.
1535
1536       imap-use-starttls-user@host
1537              Activates imap-use-starttls for a specific account.
1538
1539       keep   This  option  causes mailx to truncate the user's system mailbox
1540              instead of deleting it when it is empty.  This should always  be
1541              set,  since  it prevents malicious users from creating fake mail
1542              folders in a world-writable spool directory.
1543
1544       keepsave
1545              When a message is saved, it is usually discarded from the origi‐
1546              nating  folder  when  mailx is quit.  Setting this option causes
1547              all saved message to be retained.
1548
1549       markanswered
1550              When a message is replied to and this variable  is  set,  it  is
1551              marked  as  having  been  answered.   This mark has no technical
1552              meaning in the mail system; it just causes messages to be marked
1553              in the header summary, and makes them specially addressable.
1554
1555       metoo  Usually,  when a group is expanded that contains the sender, the
1556              sender is removed  from  the  expansion.   Setting  this  option
1557              causes the sender to be included in the group.
1558
1559       newmail
1560              Checks  for  new mail in the current folder each time the prompt
1561              is printed.  For IMAP mailboxes, the server is then  polled  for
1562              new  mail,  which may result in delayed operation if the connec‐
1563              tion to the server is slow.  A maildir folder must be re-scanned
1564              to determine if new mail has arrived.
1565
1566              If  this  variable  is  set to the special value nopoll, an IMAP
1567              server is not actively asked for new  mail,  but  new  mail  may
1568              still be detected and announced with any other IMAP command that
1569              is sent to the server.  A maildir folder is not scanned then.
1570
1571              In any case, the IMAP server may send notifications  about  mes‐
1572              sages that have been deleted on the server by another process or
1573              client.  In this case, `Expunged n messages' is printed  regard‐
1574              less of this variable, and message numbers may have changed.
1575
1576       noheader
1577              Setting the option noheader is the same as giving the -N flag on
1578              the command line.
1579
1580       outfolder
1581              Causes the filename given in the record variable and the sender-
1582              based filenames for the Copy and Save commands to be interpreted
1583              relative to the directory given in the  folder  variable  rather
1584              than to the current directory unless it is an absolute pathname.
1585
1586       page   If  set, each message the pipe command prints out is followed by
1587              a formfeed character.
1588
1589       piperaw
1590              Send messages to the pipe command without  performing  MIME  and
1591              character set conversions.
1592
1593       pop3-use-apop
1594              If  this variable is set, the APOP authentication method is used
1595              when a connection to a POP3 server is initiated.  The  advantage
1596              of  this  method over the usual USER/PASS authentication is that
1597              the password is not sent over the network in  clear  text.   The
1598              connection  fails  if  the server does not support the APOP com‐
1599              mand.
1600
1601       pop3-use-apop-user@host
1602              Enables pop3-use-apop for a specific account.
1603
1604       pop3-use-starttls
1605              Causes mailx to issue a STLS command to make an unencrypted POP3
1606              session  SSL/TLS encrypted.  This functionality is not supported
1607              by all servers, and is  not  used  if  the  session  is  already
1608              encrypted by the POP3S method.
1609
1610       pop3-use-starttls-user@host
1611              Activates pop3-use-starttls for a specific account.
1612
1613       print-all-chars
1614              This  option  causes  all characters to be considered printable.
1615              It is only effective if given in  a  startup  file.   With  this
1616              option  set,  some  character  sequences in messages may put the
1617              user's terminal in an undefined state when  printed;  it  should
1618              only be used as a last resort if no working system locale can be
1619              found.
1620
1621       print-alternatives
1622              When a MIME message part of type multipart/alternative  is  dis‐
1623              played and it contains a subpart of type text/plain, other parts
1624              are normally discarded.  Setting this variable causes  all  sub‐
1625              parts  to  be  displayed, just as if the surrounding part was of
1626              type multipart/mixed.
1627
1628       quiet  Suppresses the printing of the version when first invoked.
1629
1630       record-resent
1631              If both this variable and  the  record  variable  are  set,  the
1632              resend and Resend commands save messages to the record folder as
1633              it is normally only done for newly composed messages.
1634
1635       reply-in-same-charset
1636              If this variable is set, mailx first tries to use the same char‐
1637              acter  set  of the original message for replies.  If this fails,
1638              the sendcharsets variable is evaluated as usual.
1639
1640       Replyall
1641              Reverses the sense of reply and Reply commands.
1642
1643       save   When the user aborts a message with two RUBOUT (interrupt  char‐
1644              acters)  mailx  copies the partial letter to the file `dead.let‐
1645              ter' in the home directory.  This option is set by default.
1646
1647       searchheaders
1648              If this option is set, then a message-list specifier in the form
1649              `/x:y'  will expand to all messages containing the substring `y'
1650              in the header field `x'.  The string search is case insensitive.
1651
1652       sendwait
1653              When sending a message, wait until the mail transfer agent exits
1654              before  accepting  further commands.  If the mail transfer agent
1655              returns a non-zero exit status, the exit status  of  mailx  will
1656              also be non-zero.
1657
1658       showlast
1659              Setting  this  option  causes mailx to start at the last message
1660              instead of the first one when opening a mail folder.
1661
1662       showname
1663              Causes mailx to use the sender's real name instead of the  plain
1664              address  in  the  header field summary and in message specifica‐
1665              tions.
1666
1667       showto Causes the recipient of the message to be shown  in  the  header
1668              summary if the message was sent by the user.
1669
1670       skipemptybody
1671              If an outgoing message does not contain any text in its first or
1672              only message part, do not send it but discard it  silently  (see
1673              also the -E option).
1674
1675       smime-force-encryption
1676              Causes mailx to refuse sending unencrypted messages.
1677
1678       smime-sign
1679              If  this  variable  is  set, outgoing messages are S/MIME signed
1680              with the user's private key.  Signing a message enables a recip‐
1681              ient  to  verify  that the sender used a valid certificate, that
1682              the email addresses in the certificate match those in  the  mes‐
1683              sage  header, and that the message content has not been altered.
1684              It does not change the message text, and people will be able  to
1685              read the message as usual.
1686
1687       smime-no-default-ca
1688              Do  not  load  the  default  CA  locations when verifying S/MIME
1689              signed messages.  Only applicable if  S/MIME  support  is  built
1690              using OpenSSL.
1691
1692       smtp-use-starttls
1693              Causes mailx to issue a STARTTLS command to make an SMTP session
1694              SSL/TLS  encrypted.   Not  all  servers  support  this  command;
1695              because of common implementation defects, it cannot be automati‐
1696              cally determined whether a server supports it or not.
1697
1698       ssl-no-default-ca
1699              Do not load the default CA locations to  verify  SSL/TLS  server
1700              certificates.  Only applicable if SSL/TLS support is built using
1701              OpenSSL.
1702
1703       ssl-v2-allow
1704              Accept  SSLv2  connections.   These  are  normally  not  allowed
1705              because this protocol version is insecure.
1706
1707       stealthmua
1708              Inhibits  the  generation of the `Message-Id:' and `User-Agent:'
1709              header fields that include obvious references to  mailx.   There
1710              are  two pitfalls associated with this: First, the message id of
1711              outgoing messages is not known anymore.  Second, an  expert  may
1712              still  use the remaining information in the header to track down
1713              the originating mail user agent.
1714
1715       verbose
1716              Setting the option verbose is the same as using the -v  flag  on
1717              the  command  line.  When mailx runs in verbose mode, details of
1718              the actual message delivery and protocol conversations for IMAP,
1719              POP3, and SMTP, as well as of other internal processes, are dis‐
1720              played on the user's terminal, This is sometimes useful to debug
1721              problems.   Mailx prints all data that is sent to remote servers
1722              in clear texts, including passwords, so  care  should  be  taken
1723              that  no  unauthorized option can view the screen if this option
1724              is enabled.
1725
1726       writebackedited
1727              If this variable is set, messages modified  using  the  edit  or
1728              visual  commands  are written back to the current folder when it
1729              is quit.  This is only possible for  writable  folders  in  mbox
1730              format.   Setting  this variable also disables MIME decoding and
1731              decryption for the editing commands.
1732
1733   String Options
1734       The string options include the following:
1735
1736       attrlist
1737              A sequence of characters to print in the `attribute' column of a
1738              header  summary,  each for one type of messages in the following
1739              order: new, unread but old, new but read, read and  old,  saved,
1740              preserved,  mboxed, flagged, answered, draft, killed, start of a
1741              collapsed thread, collapsed, classified as junk.  The default is
1742              `NUROSPMFATK+-J',  or  `NU  *HMFATK+-J' if bsdflags or the SYSV3
1743              environment variable are set.
1744
1745       autobcc
1746              Specifies a list of recipients to which a blind carbon  copy  of
1747              each outgoing message will be sent automatically.
1748
1749       autocc Specifies  a  list  of recipients to which a carbon copy of each
1750              outgoing message will be sent automatically.
1751
1752       autosort
1753              Causes sorted mode (see the sort command) to be entered automat‐
1754              ically  with  the  value of this option as sorting method when a
1755              folder is opened.
1756
1757       cmd    The default value for the pipe command.
1758
1759       crt    The valued option crt is used as a threshold  to  determine  how
1760              long  a message must be before PAGER is used to read it.  If crt
1761              is set without a value, then the height of the  terminal  screen
1762              stored  in  the  system  is  used  to compute the threshold (see
1763              stty(1)).
1764
1765       DEAD   The name of the file to use for saving aborted  messages.   This
1766              defaults to `dead.letter' in the user's home directory.
1767
1768       EDITOR Pathname  of  the  text editor to use in the edit command and ~e
1769              escape.  If not defined, then a default editor is used.
1770
1771       encoding
1772              The default MIME encoding to use in outgoing text  messages  and
1773              message  parts.  Valid values are 8bit or quoted-printable.  The
1774              default is 8bit.  In case the mail transfer system is not  ESMTP
1775              compliant, quoted-printable should be used instead.  If there is
1776              no need to encode a message, 7bit transfer mode is used, without
1777              regard  to  the  value  of this variable.  Binary data is always
1778              encoded in base64 mode.
1779
1780       escape If defined, the first character of this option gives the charac‐
1781              ter to use in the place of ~ to denote escapes.
1782
1783       folder The  name  of  the  directory to use for storing folders of mes‐
1784              sages.  All folder names that begin  with  `+'  refer  to  files
1785              below  that directory.  If the directory name begins with a `/',
1786              mailx considers it to be an absolute  pathname;  otherwise,  the
1787              folder directory is found relative to the user's home directory.
1788
1789              The  directory name may also refer to an IMAP account; any names
1790              that begin with  `+'  then  refer  to  IMAP  mailboxes  on  that
1791              account.  An IMAP folder is normally given in the form
1792
1793                  imaps://mylogin@imap.myisp.example
1794
1795              In this case, the `+' and `@' prefixes for folder names have the
1796              same effect (see the folder command).
1797
1798              Some IMAP servers do not accept the creation of mailboxes in the
1799              hierarchy base; they require that they are created as subfolders
1800              of `INBOX'.  With such servers, a folder name of the form
1801
1802                  imaps://mylogin@imap.myisp.example/INBOX.
1803
1804              should be used (the last character  is  the  server's  hierarchy
1805              delimiter).   Folder  names  prefixed  by `+' will then refer to
1806              folders below `INBOX', while folder names prefixed by `@'  refer
1807              to  folders  below  the  hierarchy base.  See the imap namespace
1808              command for a method to detect the appropriate prefix and delim‐
1809              iter.
1810
1811       folder-hook
1812              When a folder is opened and this variable is set, the macro cor‐
1813              responding to the value of this variable is executed.  The macro
1814              is  also  invoked  when  new mail arrives, but message lists for
1815              commands executed from the macro only include newly arrived mes‐
1816              sages then.
1817
1818       folder-hook-fullname
1819              When  a folder named fullname is opened, the macro corresponding
1820              to the value of this variable is executed.  Unlike other  folder
1821              specifications,  the  fully  expanded  name of a folder, without
1822              metacharacters, is used to avoid ambiguities.  The macro  speci‐
1823              fied with folder-hook is not executed if this variable is effec‐
1824              tive for a folder (unless it is explicitly  invoked  within  the
1825              called macro).
1826
1827       from   The  address  (or  a  list of addresses) to put into the `From:'
1828              field of the message header.  If replying to  a  message,  these
1829              addresses  are  handled  as if they were in the alternates list.
1830              If the machine's hostname is not  valid  at  the  Internet  (for
1831              example  at  a dialup machine), either this variable or hostname
1832              have to be set to get correct Message-ID header fields.  If from
1833              contains more than one address, the sender variable must also be
1834              set.
1835
1836       fwdheading
1837              The string to print before the text of a message with  the  for‐
1838              ward command (unless the forward-as-attachment variable is set).
1839              Defaults to ``-------- Original Message --------'' if unset.  If
1840              it is set to the empty string, no heading is printed.
1841
1842       headline
1843              A format string to use for the header summary, similar to printf
1844              formats.  A `%' character introduces a format specifier.  It may
1845              be  followed  by  a  number  indicating the field width.  If the
1846              field is a number, the width may be  negative,  which  indicates
1847              that it is to be left-aligned.  Valid format specifiers are:
1848
1849
1850                  %a    Message attributes.
1851                  %c    The score of the message.
1852                  %d    The date when the message was received.
1853                  %e    The indenting level in threaded mode.
1854                  %f    The address of the message sender.
1855                  %i    The message thread structure.
1856                  %l    The number of lines of the message.
1857                  %m    Message number.
1858                  %o    The number of octets (bytes) in the message.
1859                  %s    Message subject (if any).
1860                  %S    Message subject (if any) in double quotes.
1861                  %t    The position in threaded/sorted order.
1862                  %>    A `>' for the current message, otherwise ` '.
1863                  %<    A `<' for the current message, otherwise ` '.
1864                  %%    A `%' character.
1865
1866              The     default    is    `%>%a%m %18f %16d %4l/%-5o %i%s',    or
1867              `%>%a%m %20f  %16d %3l/%-5o %i%S' if bsdcompat is set.
1868
1869       hostname
1870              Use this string  as  hostname  when  expanding  local  addresses
1871              instead of the value obtained from uname(2) and getaddrinfo(3).
1872
1873       imap-auth
1874              Sets  the  IMAP authentication method.  Valid values are `login'
1875              for  the  usual  password-based  authentication  (the  default),
1876              `cram-md5',  which  is a password-based authentication that does
1877              not send the password over the network in clear text, and  `gss‐
1878              api' for GSSAPI-based authentication.
1879
1880       imap-auth-user@host
1881              Sets the IMAP authentication method for a specific account.
1882
1883       imap-cache
1884              Enables  caching  of IMAP mailboxes.  The value of this variable
1885              must point to a directory that is either existent or can be cre‐
1886              ated  by  mailx.   All  contents  of the cache can be deleted by
1887              mailx at any time; it is not  safe  to  make  assumptions  about
1888              them.
1889
1890       imap-keepalive
1891              IMAP servers may close the connection after a period of inactiv‐
1892              ity; the standard requires this to be at least 30  minutes,  but
1893              practical  experience  may  vary.   Setting  this  variable to a
1894              numeric value greater than 0 causes a NOOP command  to  be  sent
1895              each value seconds if no other operation is performed.
1896
1897       imap-list-depth
1898              When retrieving the list of folders on an IMAP server, the fold‐
1899              ers command stops after it has reached a certain depth to  avoid
1900              possible  infinite  loops.   The value of this variable sets the
1901              maximum depth allowed.  The default is 2.  If the folder separa‐
1902              tor on the current IMAP server is a slash `/', this variable has
1903              no effect, and the folders command does not descend to  subfold‐
1904              ers.
1905
1906       indentprefix
1907              String  used by the `~m' and `~M' tilde escapes and by the quote
1908              option for indenting messages, in place of the normal tab  char‐
1909              acter (^I).  Be sure to quote the value if it contains spaces or
1910              tabs.
1911
1912       junkdb The location of the junk mail database.  The string  is  treated
1913              like a folder name, as described for the folder command.
1914
1915              The  files in the junk mail database are normally stored in com‐
1916              press(1) format for saving space.  If processing time is consid‐
1917              ered  more important, uncompress(1) can be used to store them in
1918              plain form.  Mailx will then work using the uncompressed files.
1919
1920       LISTER Pathname of the directory lister to use in the  folders  command
1921              when operating on local mailboxes.  Default is /bin/ls.
1922
1923       MAIL   Is  used  as  the  user's mailbox, if set.  Otherwise, a system-
1924              dependent default is used.  Can be a protocol:// string (see the
1925              folder command for more information).
1926
1927       MAILX_HEAD
1928              A  string  to  put  at  the  beginning of each new message.  The
1929              escape sequences `\t' (tabulator) and `\n' (newline) are  under‐
1930              stood.
1931
1932       MAILX_TAIL
1933              A  string  to  put  at  the end of each new message.  The escape
1934              sequences `\t' (tabulator) and `\n' (newline) are understood.
1935
1936       maximum-unencoded-line-length
1937              Messages that contain lines longer than the value of this  vari‐
1938              able  are  encoded in quoted-printable even if they contain only
1939              ASCII characters.  The maximum effective value is 950.   If  set
1940              to  0,  all ASCII text messages are encoded in quoted-printable.
1941              S/MIME signed messages are always  encoded  in  quoted-printable
1942              regardless of the value of this variable.
1943
1944       MBOX   The name of the mbox file.  It can be the name of a folder.  The
1945              default is `mbox' in the user's home directory.
1946
1947       NAIL_EXTRA_RC
1948              The name of an optional startup file to be read after ~/.mailrc.
1949              This variable is ignored if it is imported from the environment;
1950              it has an effect only if it is set in /etc/mail.rc or  ~/.mailrc
1951              to    allow    bypassing    the   configuration   with   e.   g.
1952              `MAILRC=/dev/null'.  Use this file for  commands  that  are  not
1953              understood by other mailx implementations.
1954
1955       newfolders
1956              If  this  variable  has  the  value maildir, newly created local
1957              folders will be in maildir format.
1958
1959       nss-config-dir
1960              A directory that contains the files certN.db  to  retrieve  cer‐
1961              tificates,  keyN.db  to  retrieve  private  keys, and secmod.db,
1962              where N is a  digit.   These  are  usually  taken  from  Mozilla
1963              installations,    so    an    appropriate    value    might   be
1964              `~/.mozilla/firefox/default.clm'.  Mailx opens these files read-
1965              only  and does not modify them.  However, if the files are modi‐
1966              fied by Mozilla while mailx is running, it  will  print  a  `Bad
1967              database'  message.   It  may  be  necessary to create copies of
1968              these files that are  exclusively  used  by  mailx  then.   Only
1969              applicable  if S/MIME and SSL/TLS support is built using Network
1970              Security Services (NSS).
1971
1972       ORGANIZATION
1973              The value to put into the `Organization:' field of  the  message
1974              header.
1975
1976       PAGER  Pathname  of  the program to use in the more command or when crt
1977              variable is set.  The default paginator pg(1) or, in BSD compat‐
1978              ibility mode, more(1) is used if this option is not defined.
1979
1980       password-user@host
1981              Set  the  password for user when connecting to host.  If no such
1982              variable is defined for a host, the user will  be  asked  for  a
1983              password  on  standard input.  Specifying passwords in a startup
1984              file is generally a security risk, the file should  be  readable
1985              by the invoking user only.
1986
1987       pipe-content/subcontent
1988              When a MIME message part of content/subcontent type is displayed
1989              or it is replied to, its text is filtered through the  value  of
1990              this variable interpreted as a shell command.  Special care must
1991              be taken when using such commands as mail viruses  may  be  dis‐
1992              tributed  by  this  method; if messages of type application/x-sh
1993              were filtered through the shell, for example, a  message  sender
1994              could  easily execute arbitrary code on the system mailx is run‐
1995              ning on.
1996
1997       pop3-keepalive
1998              POP3 servers may close the connection after a period of inactiv‐
1999              ity;  the  standard requires this to be at least 10 minutes, but
2000              practical experience may  vary.   Setting  this  variable  to  a
2001              numeric  value  greater  than 0 causes a NOOP command to be sent
2002              each value seconds if no other operation is performed.
2003
2004       prompt The string printed when a  command  is  accepted.   Defaults  to
2005              `? ', or to `& ' if the bsdcompat variable is set.
2006
2007       quote  If  set,  mailx starts a replying message with the original mes‐
2008              sage prefixed by the value of the variable  indentprefix.   Nor‐
2009              mally,  a  heading  consisting  of  `Fromheaderfield  wrote:' is
2010              printed before  the  quotation.   If  the  string  noheading  is
2011              assigned to the quote variable, this heading is omitted.  If the
2012              string  headers  is  assigned,  the  headers  selected  by   the
2013              ignore/retain  commands are printed above the message body, thus
2014              quote acts like an automatic ~m command  then.   If  the  string
2015              allheaders  is  assigned, all headers are printed above the mes‐
2016              sage body, and all MIME parts are included, thus quote acts like
2017              an automatic ~M command then.
2018
2019       record If  defined, gives the pathname of the folder used to record all
2020              outgoing mail.  If not defined, then outgoing  mail  is  not  so
2021              saved.   When  saving  to  this folder fails, the message is not
2022              sent but saved to the `dead.letter' file instead.
2023
2024       replyto
2025              A list of addresses to put into the  `Reply-To:'  field  of  the
2026              message  header.   If  replying to a message, such addresses are
2027              handled as if they were in the alternates list.
2028
2029       screen When mailx initially prints the message headers,  it  determines
2030              the  number  to  print  by looking at the speed of the terminal.
2031              The faster the terminal, the more it prints.  This option  over‐
2032              rides  this  calculation  and specifies how many message headers
2033              are printed.  This number is also used for scrolling with the  z
2034              command.
2035
2036       sendcharsets
2037              A  comma-separated  list of character set names that can be used
2038              in Internet mail.  When a message that contains  characters  not
2039              representable  in  US-ASCII is prepared for sending, mailx tries
2040              to convert its text to each of the given character sets in order
2041              and uses the first appropriate one.  The default is `utf-8'.
2042
2043              Character  sets  assigned  to this variable should be ordered in
2044              ascending complexity.  That is, the list should start with  e.g.
2045              `iso-8859-1'  for  compatibility  with older mail clients, might
2046              contain some other language-specific character sets, and  should
2047              end with `utf-8' to handle messages that combine texts in multi‐
2048              ple languages.
2049
2050       sender An address that is put into the `Sender:' field of outgoing mes‐
2051              sages.   This  field needs not normally be present.  It is, how‐
2052              ever, required if the  `From:'  field  contains  more  than  one
2053              address.   It  can  also  be used to indicate that a message was
2054              sent on behalf of somebody other; in this case,  `From:'  should
2055              contain  the  address of the person that took responsibility for
2056              the message, and `Sender:' should contain  the  address  of  the
2057              person  that  actually  sent the message.  The sender address is
2058              handled as if it were in the alternates list.
2059
2060       sendmail
2061              To use an alternate mail delivery system, set this option to the
2062              full  pathname  of the program to use.  This should be used with
2063              care.
2064
2065       SHELL  Pathname of the shell to use in the ! command and the ~! escape.
2066              A default shell is used if this option is not defined.
2067
2068
2069       Sign   A string for use with the ~A command.
2070
2071       sign   A string for use with the ~a command.
2072
2073       signature
2074              Must  correspond  to  the name of a readable file if set.
2075              The file's content is then appended  to  each  singlepart
2076              message  and to the first part of each multipart message.
2077              Be warned that there is no possibility to edit the signa‐
2078              ture for an individual message.
2079
2080       smime-ca-dir
2081              Specifies  a directory with CA certificates for verifica‐
2082              tion of S/MIME signed messages.  The format is  the  same
2083              as  described  in SSL_CTX_load_verify_locations(3).  Only
2084              applicable if S/MIME support is built using OpenSSL.
2085
2086       smime-ca-file
2087              Specifies a file with CA certificates for verification of
2088              S/MIME  signed  messages.   The  format  is  the  same as
2089              described  in   SSL_CTX_load_verify_locations(3).    Only
2090              applicable if S/MIME support is built using OpenSSL.
2091
2092       smime-cipher-user@host
2093              Specifies   a   cipher  to  use  when  generating  S/MIME
2094              encrypted messages  for  user@host.   Valid  ciphers  are
2095              rc2-40 (RC2 with 40 bits), rc2-64 (RC2 with 64 bits), des
2096              (DES, 56 bits) and des-ede3 (3DES,  112/168  bits).   The
2097              default  is 3DES.  It is not recommended to use the other
2098              ciphers unless a recipient's client is actually unable to
2099              handle  3DES  since they are comparatively weak; but even
2100              so, the recipient should upgrade his software in  prefer‐
2101              ence.
2102
2103       smime-crl-file
2104              Specifies a file that contains a CRL in PEM format to use
2105              when  verifying  S/MIME  messages.   Only  applicable  if
2106              S/MIME support is built using OpenSSL.
2107
2108       smime-crl-dir
2109              Specifies  a  directory  that contains files with CRLs in
2110              PEM format to use when verifying S/MIME  messages.   Only
2111              applicable if S/MIME support is built using OpenSSL.
2112
2113       smime-encrypt-user@host
2114              If  this  variable  is  set,  messages  to  user@host are
2115              encrypted before sending.  If  S/MIME  support  is  built
2116              using  OpenSSL,  the value of the variable must be set to
2117              the name of a file that contains  a  certificate  in  PEM
2118              format.   If S/MIME support is built using NSS, the value
2119              of this variable is ignored, but if multiple certificates
2120              for user@host are available, the smime-nickname-user@host
2121              variable should be set.  Otherwise a certificate for  the
2122              recipient is automatically retrieved from the certificate
2123              database, if possible.
2124
2125              If a message is sent to multiple recipients, each of them
2126              for  whom a corresponding variable is set will receive an
2127              individually encrypted  message;  other  recipients  will
2128              continue  to receive the message in plain text unless the
2129              smime-force-encryption variable is  set.   It  is  recom‐
2130              mended  to  sign encrypted messages, i.e. to also set the
2131              smime-sign variable.
2132
2133       smime-nickname-user@host
2134              Specifies the nickname of a certificate to be  used  when
2135              encrypting  messages  for user@host .  Only applicable if
2136              S/MIME support is built using NSS.
2137
2138       smime-sign-cert
2139              Points to a file in PEM format that contains  the  user's
2140              private  key  as  well as his certificate.  Both are used
2141              with S/MIME for signing and  decrypting  messages.   Only
2142              applicable if S/MIME support is built using OpenSSL.
2143
2144       smime-sign-cert-user@host
2145              Overrides  smime-sign-cert  for  the  specific addresses.
2146              When signing messages and the value of the from  variable
2147              is  set  to  user@host,  the specific file is used.  When
2148              decrypting messages, their recipient fields (To: and Cc:)
2149              are  searched  for addresses for which such a variable is
2150              set.  Mailx always uses the first address  that  matches,
2151              so  if  the  same message is sent to more than one of the
2152              user's addresses using different encryption keys, decryp‐
2153              tion  might  fail.   Only applicable if S/MIME support is
2154              built using OpenSSL.
2155
2156       smime-sign-nickname
2157              Specifies that the named certificate be used for  signing
2158              mail.  If this variable is not set, but a single certifi‐
2159              cate matching the current from address is  found  in  the
2160              database,  that one is used automatically.  Only applica‐
2161              ble if S/MIME support is built using NSS.
2162
2163       smime-sign-nickname-user@host
2164              Overrides smime-sign-nickname  for  a  specific  address.
2165              Only applicable if S/MIME support is built using NSS.
2166
2167       smtp   Normally,  mailx invokes sendmail(8) directly to transfer
2168              messages.  If the smtp variable is set, a SMTP connection
2169              to  the server specified by the value of this variable is
2170              used instead.  If the SMTP server does not use the  stan‐
2171              dard port, a value of server:port can be given, with port
2172              as a name or as a number.
2173
2174              There are two possible methods to get  SSL/TLS  encrypted
2175              SMTP sessions: First, the STARTTLS command can be used to
2176              encrypt a session after it has been initiated, but before
2177              any    user-related    data    has    been    sent;   see
2178              smtp-use-starttls above.   Second,  some  servers  accept
2179              sessions that are encrypted from their beginning on. This
2180              mode is configured by assigning smtps://server[:port]  to
2181              the smtp variable.
2182
2183              The  SMTP transfer is executed in a child process; unless
2184              either the sendwait or the verbose variable is set,  this
2185              process  runs asynchronously.  If it receives a TERM sig‐
2186              nal, it will abort and save the message to the `dead.let‐
2187              ter' file.
2188
2189       smtp-auth
2190              Sets  the SMTP authentication method.  If set to `login',
2191              or if unset and smtp-auth-user  is  set,  AUTH  LOGIN  is
2192              used.   If  set  to `cram-md5', AUTH CRAM-MD5 is used; if
2193              set to `plain', AUTH PLAIN is used.  Otherwise,  no  SMTP
2194              authentication is performed.
2195
2196       smtp-auth-user@host
2197              Overrides   smtp-auth   for  specific  values  of  sender
2198              addresses, depending on the from variable.
2199
2200       smtp-auth-password
2201              Sets the global password for SMTP AUTH.   Both  user  and
2202              password  have  to be given for AUTH LOGIN and AUTH CRAM-
2203              MD5.
2204
2205       smtp-auth-password-user@host
2206              Overrides  smtp-auth-password  for  specific  values   of
2207              sender addresses, depending on the from variable.
2208
2209       smtp-auth-user
2210              Sets  the  global user name for SMTP AUTH.  Both user and
2211              password have to be given for AUTH LOGIN and  AUTH  CRAM-
2212              MD5.
2213
2214              If this variable is set but neither smtp-auth-password or
2215              a matching  smtp-auth-password-user@host  can  be  found,
2216              mailx will as for a password on the user's terminal.
2217
2218       smtp-auth-user-user@host
2219              Overrides  smtp-auth-user  for  specific values of sender
2220              addresses, depending on the from variable.
2221
2222       ssl-ca-dir
2223              Specifies a directory with CA certificates for  verifica‐
2224              tion     of    SSL/TLS    server    certificates.     See
2225              SSL_CTX_load_verify_locations(3)  for  more  information.
2226              Only   applicable  if  SSL/TLS  support  is  built  using
2227              OpenSSL.
2228
2229       ssl-ca-file
2230              Specifies a file with CA certificates for verification of
2231              SSL/TLS   server   certificates.   See  SSL_CTX_load_ver‐
2232              ify_locations(3) for more information.   Only  applicable
2233              if SSL/TLS support is built using OpenSSL.
2234
2235       ssl-cert
2236              Sets  the  file  name  for  a  SSL/TLS client certificate
2237              required by some servers.   Only  applicable  if  SSL/TLS
2238              support is built using OpenSSL.
2239
2240       ssl-cert-user@host
2241              Sets  an  account-specific file name for a SSL/TLS client
2242              certificate required by some servers.  Overrides ssl-cert
2243              for  the  specified  account.  Only applicable if SSL/TLS
2244              support is built using OpenSSL.
2245
2246       ssl-cipher-list
2247              Specifies a list of ciphers for SSL/TLS connections.  See
2248              ciphers(1)  for  more  information.   Only  applicable if
2249              SSL/TLS support is built using OpenSSL.
2250
2251       ssl-crl-file
2252              Specifies a file that contains a CRL in PEM format to use
2253              when  verifying SSL/TLS server certificates.  Only appli‐
2254              cable if SSL/TLS support is built using OpenSSL.
2255
2256       ssl-crl-dir
2257              Specifies a directory that contains files  with  CRLs  in
2258              PEM  format to use when verifying SSL/TLS server certifi‐
2259              cates.  Only applicable if SSL/TLS support is built using
2260              OpenSSL.
2261
2262       ssl-key
2263              Sets  the  file  name  for  the  private key of a SSL/TLS
2264              client certificate.  If unset, the name of  the  certifi‐
2265              cate  file  is  used.   The file is expected to be in PEM
2266              format.  Only applicable  if  SSL/TLS  support  is  built
2267              using OpenSSL.
2268
2269       ssl-key-user@host
2270              Sets an account-specific file name for the private key of
2271              a SSL/TLS client certificate.  Overrides ssl-key for  the
2272              specified account.  Only applicable if SSL/TLS support is
2273              built using OpenSSL.
2274
2275       ssl-method
2276              Selects a SSL/TLS  protocol  version;  valid  values  are
2277              `ssl2',  `ssl3',  and  `tls1'.   If  unset, the method is
2278              selected automatically, if possible.
2279
2280       ssl-method-user@host
2281              Overrides ssl-method for a specific account.
2282
2283       ssl-rand-egd
2284              Gives the pathname  to  an  entropy  daemon  socket,  see
2285              RAND_egd(3).
2286
2287       ssl-rand-file
2288              Gives  the  pathname  to  a  file  with entropy data, see
2289              RAND_load_file(3).   If  the  file  is  a  regular   file
2290              writable  by the invoking user, new data is written to it
2291              after it has been loaded.   Only  applicable  if  SSL/TLS
2292              support is built using OpenSSL.
2293
2294       ssl-verify
2295              Sets the action to be performed if an error occurs during
2296              SSL/TLS server certificate validation.  Valid values  are
2297              `strict'  (fail  and close connection immediately), `ask'
2298              (ask whether  to  continue  on  standard  input),  `warn'
2299              (print  a warning and continue), `ignore' (do not perform
2300              validation).  The default is `ask'.
2301
2302       ssl-verify-user@host
2303              Overrides ssl-verify for a specific account.
2304
2305       toplines
2306              If defined, gives the number of lines of a message to  be
2307              printed  out  with  the  top command; normally, the first
2308              five lines are printed.
2309
2310       ttycharset
2311              The character set of  the  terminal  mailx  operates  on.
2312              There  is  normally  no  need  to set this variable since
2313              mailx can determine this automatically by looking at  the
2314              LC_CTYPE  locale  setting; if this succeeds, the value is
2315              assigned at startup and will be displayed by the set com‐
2316              mand.   Note that this is not necessarily a character set
2317              name that can be used in Internet messages.
2318
2319       VISUAL Pathname of the text editor to use in the visual  command
2320              and ~v escape.
2321

ENVIRONMENT VARIABLES

2323       Besides  the variables described above, mailx uses the following
2324       environment strings:
2325
2326       HOME   The user's home directory.
2327
2328       LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES
2329              See locale(7).
2330
2331       MAILRC Is used as startup file  instead  of  ~/.mailrc  if  set.
2332              When  mailx scripts are invoked on behalf of other users,
2333              this variable should be set to `/dev/null' to avoid side-
2334              effects from reading their configuration files.
2335
2336       NAILRC If this variable is set and MAILRC is not set, it is read
2337              as startup file.
2338
2339       SYSV3  Changes the letters printed in  the  first  column  of  a
2340              header summary.
2341
2342       TMPDIR Used as directory for temporary files instead of /tmp, if
2343              set.
2344

FILES

2346       ~/.mailrc
2347              File giving initial commands.
2348
2349       /etc/mail.rc
2350              System wide initialization file.
2351
2352       ~/.mime.types
2353              Personal MIME types.
2354
2355       /etc/mime.types
2356              System wide MIME types.
2357

EXAMPLES

2359   Getting started
2360       The mailx command has two distinct usages, according to  whether
2361       one  wants  to send or receive mail.  Sending mail is simple: to
2362       send  a  message  to  a  user  whose  email  address  is,   say,
2363       <bill@host.example>, use the shell command:
2364
2365           $ mailx bill@host.example
2366
2367       then  type  your  message.   Mailx will prompt you for a message
2368       subject first; after that, lines typed by you form the  body  of
2369       the message.  When you reach the end of the message, type an EOT
2370       (control-d) at the beginning of a line, which will  cause  mailx
2371       to echo `EOT' and return you to the shell.
2372
2373       If,  while  you are composing the message you decide that you do
2374       not wish to send it after all, you can abort the letter  with  a
2375       RUBOUT.   Typing  a single RUBOUT causes mailx to print `(Inter‐
2376       rupt -- one more to  kill  letter)'.   Typing  a  second  RUBOUT
2377       causes  mailx to save your partial letter on the file `dead.let‐
2378       ter' in your home directory and abort the letter.  Once you have
2379       sent  mail  to  someone,  there is no way to undo the act, so be
2380       careful.
2381
2382       If you want to send the same message to  several  other  people,
2383       you can list their email addresses on the command line.  Thus,
2384
2385           $ mailx sam@workstation.example bob@server.example
2386           Subject: Fees
2387           Tuition fees are due next Friday.  Don't forget!
2388           <Control-d>
2389           EOT
2390           $
2391
2392       will   send  the  reminder  to  <sam@workstation.example>.   and
2393       <bob@server.example>.
2394
2395       To read your mail, simply type
2396
2397           $ mailx
2398
2399       Mailx will respond by typing its version  number  and  date  and
2400       then listing the messages you have waiting.  Then it will type a
2401       prompt and await your command.  The messages are  assigned  num‐
2402       bers  starting  with 1—you refer to the messages with these num‐
2403       bers.  Mailx keeps track of which messages are  new  (have  been
2404       sent  since you last read your mail) and read (have been read by
2405       you).  New messages have an N next to them in the header listing
2406       and old, but unread messages have a U next to them.  Mailx keeps
2407       track of new/old and read/unread messages by  putting  a  header
2408       field called Status into your messages.
2409
2410       To  look  at a specific message, use the type command, which may
2411       be abbreviated to simply t .  For example, if you had  the  fol‐
2412       lowing messages:
2413
2414           O 1 drfoo@myhost.example Wed Sep  1 19:52  18/631 "Fees"
2415           O 2 sam@friends.example  Thu Sep  2 00:08  30/895
2416
2417       you could examine the first message by giving the command:
2418
2419           type 1
2420
2421       which might cause mailx to respond with, for example:
2422
2423           Message  1:
2424           From drfoo@myhost.example Wed Sep  1 19:52:25 2004
2425           Subject: Fees
2426           Status: R
2427
2428           Tuition fees are due next Wednesday.  Don't forget!
2429
2430
2431       Many mailx commands that operate on messages take a message num‐
2432       ber as an argument like the type command.  For  these  commands,
2433       there  is  a  notion  of  a current message.  When you enter the
2434       mailx program, the current message is initially  the  first  (or
2435       the  first  recent)  one.   Thus, you can often omit the message
2436       number and use, for example,
2437
2438           t
2439
2440       to type the current message.  As a further  shorthand,  you  can
2441       type a message by simply giving its message number.  Hence,
2442
2443           1
2444
2445       would type the first message.
2446
2447       Frequently, it is useful to read the messages in your mailbox in
2448       order, one after another.  You can  read  the  next  message  in
2449       mailx  by  simply  typing a newline.  As a special case, you can
2450       type a newline as your first command to mailx to type the  first
2451       message.
2452
2453       If,  after  typing  a  message,  you  wish to immediately send a
2454       reply, you can do so with the reply command.  This command, like
2455       type,  takes a message number as an argument.  mailx then begins
2456       a message addressed to the user who sent you the  message.   You
2457       may then type in your letter in reply, followed by a <control-d>
2458       at the beginning of a line, as before.
2459
2460       Note that mailx copies the subject header from the original mes‐
2461       sage.   This is useful in that correspondence about a particular
2462       matter will tend to retain the same subject heading,  making  it
2463       easy to recognize.  If there are other header fields in the mes‐
2464       sage, like `Cc:', the information found will also be used.
2465
2466       Sometimes you will receive a message that has been sent to  sev‐
2467       eral  people  and  wish to reply only to the person who sent it.
2468       Reply with a capital R replies to a message, but sends a copy to
2469       the sender only.
2470
2471       If you wish, while reading your mail, to send a message to some‐
2472       one, but not as a reply to one of your messages,  you  can  send
2473       the message directly with the mail command, which takes as argu‐
2474       ments the names of the recipients you  wish  to  send  to.   For
2475       example, to send a message to <frank@machine.example>, you would
2476       do:
2477
2478           mail frank@machine.example
2479
2480       To delete a message from the mail folder, you can use the delete
2481       command.  In addition to not saving deleted messages, mailx will
2482       not let you type them, either.  The effect is to make  the  mes‐
2483       sage disappear altogether, along with its number.
2484
2485       Many  features  of mailx can be tailored to your liking with the
2486       set command.  The  set  command  has  two  forms,  depending  on
2487       whether  you  are  setting  a  binary option or a valued option.
2488       Binary options are either on or off.   For  example,  the  askcc
2489       option informs mailx that each time you send a message, you want
2490       it to prompt you for a `Cc:' header, to be included in the  mes‐
2491       sage.  To set the askcc option, you would type
2492
2493           set askcc
2494
2495       Valued  options  are  values  which  mailx uses to adapt to your
2496       tastes.  For example, the record option  tells  mailx  where  to
2497       save messages sent by you, and is specified by
2498
2499           set record=Sent
2500
2501       for example.  Note that no spaces are allowed in set record=Sent
2502       .
2503
2504       Mailx includes a simple facility for maintaining groups of  mes‐
2505       sages together in folders.  To use the folder facility, you must
2506       tell mailx where you wish to keep your folders.  Each folder  of
2507       messages  will  be  a single file.  For convenience, all of your
2508       folders are kept in a single directory  of  your  choosing.   To
2509       tell  mailx  where  your  folder directory is, put a line of the
2510       form
2511
2512           set folder=letters
2513
2514       in your .mailrc file.  If, as in the example above, your  folder
2515       directory does not begin with a `/', mailx will assume that your
2516       folder directory is to be found starting from your  home  direc‐
2517       tory.
2518
2519       Anywhere  a  file  name  is expected, you can use a folder name,
2520       preceded with `+'.  For example, to put a message into a  folder
2521       with the save command, you can use:
2522
2523           save +classwork
2524
2525       to  save  the  current  message in the classwork folder.  If the
2526       classwork folder does not yet exist, it will be  created.   Note
2527       that messages which are saved with the save command are automat‐
2528       ically removed from your system mailbox.
2529
2530       In order to make a copy of a message in a folder without causing
2531       that  message  to  be  removed from your system mailbox, use the
2532       copy command, which is identical in all other  respects  to  the
2533       save command.
2534
2535       The  folder  command can be used to direct mailx to the contents
2536       of a different folder.  For example,
2537
2538           folder +classwork
2539
2540       directs mailx to read the contents of the classwork folder.  All
2541       of the commands that you can use on your system mailbox are also
2542       applicable to folders, including type, delete,  and  reply.   To
2543       inquire which folder you are currently editing, use simply:
2544
2545           folder
2546
2547       To list your current set of folders, use the folders command.
2548
2549       Finally, the help command is available to print out a brief sum‐
2550       mary of the most important mailx commands.
2551
2552       While typing in a message to be sent to others, it is often use‐
2553       ful to be able to invoke the text editor on the partial message,
2554       print the message, execute a shell command,  or  do  some  other
2555       auxiliary  function.   Mailx provides these capabilities through
2556       tilde escapes , which consist of a tilde (~) at the beginning of
2557       a line, followed by a single character which indicates the func‐
2558       tion to be performed.  For example, to print  the  text  of  the
2559       message so far, use:
2560
2561           ~p
2562
2563       which  will  print a line of dashes, the recipients of your mes‐
2564       sage, and the text of the message so far.  A list  of  the  most
2565       important tilde escapes is available with `~?'.
2566
2567   IMAP or POP3 client setup
2568       First  you  need the following data from your ISP: the host name
2569       of the IMAP or POP3 server, user  name  and  password  for  this
2570       server, and a notice whether the server uses SSL/TLS encryption.
2571       Assuming the host name is `server.myisp.example' and  your  user
2572       name for that server is `mylogin', you can refer to this account
2573       using the folder command or -f command line option with
2574
2575           imaps://mylogin@server.myisp.example
2576
2577       (This string is not necessarily the same as your  Internet  mail
2578       address.)   You  can  replace  `imaps://'  with `imap://' if the
2579       server does not support SSL/TLS.  (If SSL/TLS support  is  built
2580       using NSS, the nss-config-dir variable must be set before a con‐
2581       nection  can  be  initiated,  see  above).   Use  `pop3s://'  or
2582       `pop3://'  if  the  server  does not offer IMAP.  You should use
2583       IMAP if you can, though; first because it requires fewer network
2584       operations  than  POP3 to get the contents of the mailbox and is
2585       thus faster; and second because  message  attributes  are  main‐
2586       tained by the IMAP server, so you can easily distinguish new and
2587       old messages each time you connect.  Even if the server does not
2588       accept  IMAPS  or POP3S connections, it is possible that it sup‐
2589       ports the STARTTLS method to make a  session  SSL/TLS  encrypted
2590       after  the  initial  connection  has  been performed, but before
2591       authentication begins.  The only reliable method to see if  this
2592       works is to try it; enter one of
2593
2594           set imap-use-starttls
2595           set pop3-use-starttls
2596
2597       before you initiate the connection.
2598
2599       As  you  probably  want messages to be deleted from this account
2600       after saving them, prefix it with `%:'.   The  shortcut  command
2601       can  be used to avoid typing that many characters every time you
2602       want to connect:
2603
2604           shortcut myisp %:imaps://mylogin@server.myisp.example
2605
2606       You might want to put this string into a startup file.   As  the
2607       shortcut command is specific to this implementation of mailx and
2608       will confuse other implementations, it should  not  be  used  in
2609       ~/.mailrc, instead, put
2610
2611           set NAIL_EXTRA_RC=~/.nailrc
2612
2613       in ~/.mailrc and create a file ~/.nailrc containing the shortcut
2614       command above.  You can  then  access  your  remote  mailbox  by
2615       invoking  `mailx  -f myisp' on the command line, or by executing
2616       `fi myisp' within mailx.
2617
2618       If you want to use more than one IMAP mailbox on a server, or if
2619       you  want  to  use  the  IMAP  server  for mail storage too, the
2620       account command (which is also mailx-specific) is more appropri‐
2621       ate  than  the  shortcut  command.  You can put the following in
2622       ~/.nailrc:
2623
2624           account myisp {
2625               set folder=imaps://mylogin@server.myisp.example
2626               set record=+Sent MBOX=+mbox outfolder
2627           }
2628
2629       and can then access incoming mail for this account  by  invoking
2630       `mailx -A myisp' on the command line, or by executing `ac myisp'
2631       within mailx.  After that, a command like `copy 1  +otherfolder'
2632       will  refer  to  otherfolder on the IMAP server.  In particular,
2633       `fi &' will change to the mbox folder, and `fi +Sent' will  show
2634       your  recorded  sent mail, with both folders located on the IMAP
2635       server.
2636
2637       Mailx will ask you for a password string each time  you  connect
2638       to  a  remote account.  If you can reasonably trust the security
2639       of your workstation, you can give this password in  the  startup
2640       file as
2641
2642           set password-mylogin@server.myisp.example="SECRET"
2643
2644       You  should  change  the  permissions  of this file to 0600, see
2645       chmod(1).
2646
2647       Mailx supports different authentication methods  for  both  IMAP
2648       and  POP3.  If Kerberos is used at your location, you can try to
2649       activate GSSAPI-based authentication by
2650
2651           set imap-auth=gssapi
2652
2653       The advantage of this method is that mailx does not need to know
2654       your  password at all, nor needs to send sensitive data over the
2655       network.  Otherwise, the options
2656
2657           set imap-auth=cram-md5
2658           set pop3-use-apop
2659
2660       for IMAP and POP3, respectively,  offer  authentication  methods
2661       that  avoid to send the password in clear text over the network,
2662       which is especially important if SSL/TLS cannot be used.  If the
2663       server  does not offer any of these authentication methods, con‐
2664       ventional user/password based authentication must be  used.   It
2665       is  sometimes helpful to set the verbose option when authentica‐
2666       tion problems occur.  Mailx will display all data  sent  to  the
2667       server  in  clear text on the screen with this option, including
2668       passwords.  You should thus take care that no unauthorized  per‐
2669       son can look at your terminal when this option is set.
2670
2671       If  you  regularly  use  the  same  workstation  to  access IMAP
2672       accounts, you can greatly enhance performance by enabling  local
2673       caching  of  IMAP messages.  For any message that has been fully
2674       or partially fetched from the server, a local copy is  made  and
2675       is  used  when  the  message  is accessed again, so most data is
2676       transferred over the network once  only.   To  enable  the  IMAP
2677       cache, select a local directory name and put
2678
2679           set imap-cache=~/localdirectory
2680
2681       in  the  startup  file.   All files within that directory can be
2682       overwritten or deleted by mailx at any time, so you  should  not
2683       use the directory to store other information.
2684
2685       Once the cache contains some messages, it is not strictly neces‐
2686       sary anymore to open a connection to the IMAP server  to  access
2687       them.   When  mailx  is  invoked with the -D option, or when the
2688       disconnected variable is set, only cached data is used  for  any
2689       folder  you  open.   Messages  that have not yet been completely
2690       cached are not available then, but all  other  messages  can  be
2691       handled  as  usual.   Changes  made to IMAP mailboxes in discon‐
2692       nected mode are committed to the IMAP server  next  time  it  is
2693       used  in  online  mode.  Synchronizing the local status with the
2694       status on the server is thus partially within your  responsibil‐
2695       ity;  if you forget to initiate a connection to the server again
2696       before you leave your location, changes made on one  workstation
2697       are  not  available on others.  Also if you alter IMAP mailboxes
2698       from a workstation while uncommitted changes are  still  pending
2699       on  another, the latter data may become invalid.  The same might
2700       also happen because of  internal  server  status  changes.   You
2701       should  thus carefully evaluate this feature in your environment
2702       before you rely on it.
2703
2704       Many servers will close the connection after a short  period  of
2705       inactivity. Use one of
2706
2707           set pop3-keepalive=30
2708           set imap-keepalive=240
2709
2710       to  send a keepalive message each 30 seconds for POP3, or each 4
2711       minutes for IMAP.
2712
2713       If you encounter problems connecting to a  SSL/TLS  server,  try
2714       the  ssl-rand-egd  and  ssl-rand-file variables (see the OpenSSL
2715       FAQ for more information) or specify the protocol  version  with
2716       ssl-method.   Contact  your ISP if you need a client certificate
2717       or if verification of the  server  certificate  fails.   If  the
2718       failed  certificate is indeed valid, fetch its CA certificate by
2719       executing the shell command
2720
2721           $ openssl s_client </dev/null -showcerts -connect \
2722                  server.myisp.example:imaps 2>&1 | tee log
2723
2724       (see s_client(1)) and put it into the file specified  with  ssl-
2725       ca-file.   The  data  you need is located at the end of the cer‐
2726       tificate chain within (and including)  the  `BEGIN  CERTIFICATE'
2727       and `END CERTIFICATE' lines.  (Note that it is possible to fetch
2728       a forged certificate by this method.  You  can  only  completely
2729       rely  on  the authenticity of the CA certificate if you fetch it
2730       in a way that is trusted by other means, such as  by  personally
2731       receiving the certificate on storage media.)
2732
2733   Creating a score file or message filter
2734       The scoring commands are best separated from other configuration
2735       for clarity, and are mostly mailx specific.  It is  thus  recom‐
2736       mended  to put them in a separate file that is sourced from your
2737       NAIL_EXTRA_RC as follows:
2738
2739           source ~/.scores
2740
2741       The .scores file could then look as follows:
2742
2743           define list {
2744               score (subject "important discussion") +10
2745               score (subject "annoying discussion") -10
2746               score (from "nicefellow@goodnet") +15
2747               score (from "badguy@poornet") -5
2748               move (header x-spam-flag "+++++") +junk
2749           }
2750           set folder-hook-imap://user@host/public.list=list
2751
2752       In this scheme, you would see any  mail  from  `nicefellow@good‐
2753       net',  even  if  the surrounding discussion is annoying; but you
2754       normally would not see mail  from  `badguy@poornet',  unless  he
2755       participates  in  the  important  discussion.  Messages that are
2756       marked with five or more plus characters in their  `X-Spam-Flag'
2757       field  (inserted  by  some  server-side  filtering software) are
2758       moved to the folder `junk' in the folder directory.
2759
2760       Be aware that all criteria in () lead to substring  matches,  so
2761       you would also score messages from e.g. `notsobadguy@poornetmak‐
2762       ers' negative here.  It is possible to select addresses  exactly
2763       using "address" message specifications, but these cannot be exe‐
2764       cuted remotely and will thus cause all headers to be  downloaded
2765       from IMAP servers while looking for matches.
2766
2767       When  searching  messages on an IMAP server, best performance is
2768       usually achieved by sending as many criteria as possible in  one
2769       large  ()  specification, because each single such specification
2770       will result in a separate network operation.
2771
2772   Activating the Bayesian filter
2773       The Bayesian junk mail filter works by examining the words  con‐
2774       tained  in messages.  You decide yourself what a good and what a
2775       bad message is.  Thus the resulting filter is your very personal
2776       one;  once  it is correctly set up, it will filter only messages
2777       similar to those previously specified by you.
2778
2779       To use the Bayesian filter, a location for the junk  mail  data‐
2780       base must be defined first:
2781
2782           set junkdb=~/.junkdb
2783
2784       The  junk  mail database does not contain actual words extracted
2785       from messages, but hashed representations of  them.   A  foreign
2786       person  who  can  read  the database could only examine the fre‐
2787       quency of previously known words in your mail.
2788
2789       If you have sufficient disk space (several 10 MB) available,  it
2790       is recommended that you set the chained-junk-tokens option.  The
2791       filter will then also consider two-word  tokens,  improving  its
2792       accuracy.
2793
2794       A  set of good messages and junk messages must now be available;
2795       it is also possible to use the incoming new  messages  for  this
2796       purpose,  although  it  will  of course take some time until the
2797       filter becomes useful then.  Do not underestimate the amount  of
2798       statistical  data  needed;  some  hundred messages are typically
2799       necessary to get satisfactory results, and  many  thousand  mes‐
2800       sages for best operation.  You have to pass the good messages to
2801       the good command, and the junk messages to the junk command.  If
2802       you ever accidentally mark a good message as junk or vice-versa,
2803       call the ungood or unjunk command to correct this.
2804
2805       Once a reasonable amount of statistics has been  collected,  new
2806       messages  can be classified automatically.  The classify command
2807       marks all messages that the filter considers to be junk, but  it
2808       does  not  perform  any action on them by default.  It is recom‐
2809       mended that you move these messages into a separate folder  just
2810       for  the case that false positives occur, or to pass them to the
2811       junk command later again to further improve the junk mail  data‐
2812       base.   To  automatically move incoming junk messages every time
2813       the inbox is opened, put lines  like  the  following  into  your
2814       .scores  file (or whatever name you gave to the file in the last
2815       example):
2816
2817           define junkfilter {
2818               classify (smaller 20000) :n
2819               move :j +junk
2820           }
2821           set folder-hook-imap://user@host/INBOX=junkfilter
2822
2823       If you set the verbose option before running the  classify  com‐
2824       mand,  mailx  prints  the words it uses for calculating the junk
2825       status along with their  statistical  probabilities.   This  can
2826       help you to find out why some messages are not classified as you
2827       would like them to be.  To see the statistical probability of  a
2828       given word, use the probability command.
2829
2830       If  a junk message was not recognized as such, use the junk com‐
2831       mand to correct this.  Also if you encounter a false positive (a
2832       good  message  that  was wrongly classified as junk), pass it to
2833       the good command.
2834
2835       Since the classify command must examine the entire text  of  all
2836       new  messages in the respective folder, this will also cause all
2837       of them to be downloaded from the IMAP server.  You should  thus
2838       restrict  the  size  of  messages  for  automatic filtering.  If
2839       server-based filtering is also available, you might try if  that
2840       works for you first.
2841
2842   Reading HTML mail
2843       You  need either the w3m or lynx utility or another command-line
2844       web browser that can write plain text to standard output.
2845
2846           set pipe-text/html="w3m -dump -T text/html"
2847
2848       or
2849
2850           set pipe-text/html="lynx -dump -force_html /dev/stdin"
2851
2852       will then cause HTML message parts to be converted into  a  more
2853       friendly form.
2854
2855   Viewing PDF attachments
2856       Most  PDF  viewers do not accept input directly from a pipe.  It
2857       is thus necessary to store the attachment in a  temporary  file,
2858       as with
2859
2860           set pipe-application/pdf="cat >/tmp/mailx$$.pdf; \
2861                  acroread /tmp/mailx$$.pdf; rm /tmp/mailx$$.pdf"
2862
2863       Note  that  security  defects are discovered in PDF viewers from
2864       time to time.  Automatical command execution like this can  com‐
2865       promise  your  system  security,  in  particular if you stay not
2866       always informed about such issues.
2867
2868   Signed and encrypted messages with S/MIME
2869       S/MIME provides two central mechanisms: message signing and mes‐
2870       sage  encryption.   A signed message contains some data in addi‐
2871       tion to the regular text.  The data can be used to  verify  that
2872       the  message  was  sent  using  a  valid  certificate,  that the
2873       sender's address in the message header matches that in the  cer‐
2874       tificate, and that the message text has not been altered.  Sign‐
2875       ing a message does not change its regular text; it can  be  read
2876       regardless of whether the recipient's software is able to handle
2877       S/MIME.  It is thus usually possible to sign all  outgoing  mes‐
2878       sages  if so desired.—Encryption, in contrast, makes the message
2879       text invisible for all people except those who  have  access  to
2880       the  secret  decryption key.  To encrypt a message, the specific
2881       recipient's public encryption key must be known.  It is thus not
2882       possible  to  send encrypted mail to people unless their key has
2883       been retrieved from either previous communication or public  key
2884       directories.   A  message  should  always be signed before it is
2885       encrypted.  Otherwise, it is still possible that  the  encrypted
2886       message text is altered.
2887
2888       A central concept to S/MIME is that of the certification author‐
2889       ity (CA).  A CA is a trusted institution  that  issues  certifi‐
2890       cates.   For each of these certificates, it can be verified that
2891       it really originates from the CA, provided  that  the  CA's  own
2892       certificate  is  previously  known.  A set of CA certificates is
2893       usually delivered with OpenSSL and installed on your system.  If
2894       you trust the source of your OpenSSL software installation, this
2895       offers reasonable security for S/MIME on the Internet.  In  gen‐
2896       eral, a certificate cannot be more secure than the method its CA
2897       certificate has been retrieved with, though.  Thus if you  down‐
2898       load  a CA certificate from the Internet, you can only trust the
2899       messages you verify using that certificate as much as you  trust
2900       the download process.
2901
2902       The  first  thing  you  need for participating in S/MIME message
2903       exchange is your personal certificate, including a private  key.
2904       The  certificate contains public information, in particular your
2905       name and your email address, and the public key that is used  by
2906       others  to  encrypt  messages for you, and to verify signed mes‐
2907       sages they supposedly received from  you.   The  certificate  is
2908       included  in each signed message you send.  The private key must
2909       be kept secret.  It is used to decrypt messages that were previ‐
2910       ously encrypted with your public key, and to sign messages.
2911
2912       For  personal  use, it is recommended that you get a S/MIME cer‐
2913       tificate from one of the major CAs on the  Internet  using  your
2914       WWW  browser.  (Many CAs offer such certificates for free.)  You
2915       will usually receive a combined certificate and private  key  in
2916       PKCS#12  format  which  mailx does not directly accept if S/MIME
2917       support is built using OpenSSL.  To convert it  to  PEM  format,
2918       use the following shell command:
2919
2920           $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts \
2921               -nodes
2922
2923       If you omit the -nodes parameter, you can specifiy an additional
2924       PEM pass phrase for protecting the private key.  Mailx will then
2925       ask  you  for  that pass phrase each time it signs or decrypts a
2926       message.  You can then use
2927
2928           set smime-sign-cert-myname@myisp.example=cert.pem
2929
2930       to make this private key and certificate known to mailx.
2931
2932       If S/MIME support is built using NSS, the PKCS#12 file  must  be
2933       installed  using  Mozilla  (provided  that nss-config-dir is set
2934       appropriately, see above), and no further  action  is  necessary
2935       unless multiple user certificates for the same email address are
2936       installed.  In this case, the smime-sign-nickname  variable  has
2937       to be set appropriately.
2938
2939       You can now sign outgoing messages.  Just use
2940
2941           set smime-sign
2942
2943       to do so.
2944
2945       From  each signed message you send, the recipient can fetch your
2946       certificate and use it to  send  encrypted  mail  back  to  you.
2947       Accordingly  if  somebody sends you a signed message, you can do
2948       the same.  First use the verify command to check the validity of
2949       the  certificate.  After that, retrieve the certificate and tell
2950       mailx that it should use it for encryption:
2951
2952           certsave filename
2953           set smime-encrypt-user@host=filename
2954
2955       If S/MIME support is built using NSS, the saved certificate must
2956       be  installed  using  Mozilla.   The value of the smime-encrypt-
2957       user@host is ignored then, but if multiple certificates for  the
2958       recipient  are  available, the smime-nickname-user@host variable
2959       must be set.
2960
2961       You should carefully consider if you prefer to  store  encrypted
2962       messages  in  decrypted form.  If you do, anybody who has access
2963       to your mail folders can read them, but if you do not, you might
2964       be unable to read them yourself later if you happen to lose your
2965       private key.  The decrypt command saves  messages  in  decrypted
2966       form,  while  the  save,  copy,  and  move  commands  leave them
2967       encrypted.
2968
2969       Note that neither S/MIME signing nor encryption applies to  mes‐
2970       sage subjects or other header fields.  Thus they may not contain
2971       sensitive information for  encrypted  messages,  and  cannot  be
2972       trusted  even  if  the  message content has been verified.  When
2973       sending signed messages, it is recommended to repeat any  impor‐
2974       tant header information in the message text.
2975
2976   Using CRLs with S/MIME or SSL/TLS
2977       Certification  authorities  (CAs)  issue  certificate revocation
2978       lists (CRLs) on a regular basis.  These lists contain the serial
2979       numbers  of  certificates  that have been declared invalid after
2980       they have been issued.  Such usually happens because the private
2981       key  for the certificate has been compromised, because the owner
2982       of the certificate has left the organization that  is  mentioned
2983       in  the  certificate,  etc.   To seriously use S/MIME or SSL/TLS
2984       verification, an up-to-date CRL is required for each trusted CA.
2985       There  is  otherwise  no method to distinguish between valid and
2986       invalidated certificates.  Mailx currently offers  no  mechanism
2987       to fetch CRLs, or to access them on the Internet, so you have to
2988       retrieve them by some external mechanism.
2989
2990       If S/MIME and SSL/TLS support are  built  using  OpenSSL,  mailx
2991       accepts CRLs in PEM format only; CRLs in DER format must be con‐
2992       verted, e.g. with the shell command
2993
2994           $ openssl crl -inform DER -in crl.der -out crl.pem
2995
2996       To tell mailx about the CRLs, a directory that contains all  CRL
2997       files  (and  no other files) must be created.  The smime-crl-dir
2998       or ssl-crl-dir variables, respectively,  must  then  be  set  to
2999       point to that directory.  After that, mailx requires a CRL to be
3000       present for each CA that is used to verify a certificate.
3001
3002       If S/MIME and SSL/TLS support are built using NSS, CRLs  can  be
3003       imported  in  Mozilla applications (provided that nss-config-dir
3004       is set appropriately).
3005
3006   Sending mail from scripts
3007       If you want to send mail from scripts, you must  be  aware  that
3008       mailx  reads  the  user's  configuration  files  by default.  So
3009       unless your script is only intended for your  own  personal  use
3010       (as  e.g.  a  cron job), you need to circumvent this by invoking
3011       mailx like
3012
3013           MAILRC=/dev/null mailx -n
3014
3015       You then need to create  a  configuration  for  mailx  for  your
3016       script.  This can be done by either pointing the MAILRC variable
3017       to a custom configuration file, or by passing the  configuration
3018       in  environment  variables.   Since  many  of  the configuration
3019       options are not valid shell variables, the env command is useful
3020       in this situation.  An invocation could thus look like
3021
3022           env MAILRC=/dev/null from=scriptreply@domain smtp=host \
3023                 smtp-auth-user=login smtp-auth-password=secret \
3024                 smtp-auth=login mailx -n -s "subject" \
3025                 -a attachment_file recipient@domain <content_file
3026

SEE ALSO

3028       fmt(1),  newaliases(1), openssl(1), pg(1), more(1), vacation(1),
3029       ssl(3), aliases(5), locale(7), mailaddr(7), sendmail(8)
3030

NOTES

3032       Variables in the environment passed to mailx cannot be unset.
3033
3034       The character set conversion relies on  the  iconv(3)  function.
3035       Its  functionality  differs  widely  between  the various system
3036       environments mailx runs on.  If the message `Cannot convert from
3037       a  to  b'  appears,  either  some  characters within the message
3038       header or text are not appropriate for  the  currently  selected
3039       terminal  character  set,  or  the needed conversion is not sup‐
3040       ported by the system.  In the first case, it is necessary to set
3041       an  appropriate  LC_CTYPE  locale (e.g. en_US) or the ttycharset
3042       variable.  In the second case, the sendcharsets  and  ttycharset
3043       variables must be set to the same value to inhibit character set
3044       conversion.  If iconv() is  not  available  at  all,  the  value
3045       assigned  to  sendcharsets  must match the character set that is
3046       used on the terminal.
3047
3048       Mailx expects input text to be in Unix format, with lines  sepa‐
3049       rated  by newline (^J, \n) characters only.  Non-Unix text files
3050       that use carriage return (^M, \r) characters in addition will be
3051       treated  as binary data; to send such files as text, strip these
3052       characters e. g. by
3053
3054              tr -d '\015' <input | mailx . . .
3055
3056       or fix the tools that generate them.
3057
3058       Limitations with IMAP mailboxes are: It is not possible to  edit
3059       messages,  but  it  is  possible to append them.  Thus to edit a
3060       message, create a local copy of it,  edit  it,  append  it,  and
3061       delete  the  original.  The line count for the header display is
3062       only appropriate if the entire message has been downloaded  from
3063       the  server.   The  marking of messages as `new' is performed by
3064       the IMAP server; use of the exit command instead  of  quit  will
3065       not  cause  it to be reset, and if the autoinc/newmail variables
3066       are unset, messages that arrived during a session will not be in
3067       state  `new'  anymore  when the folder is opened again.  Also if
3068       commands queued in disconnected mode  are  committed,  the  IMAP
3069       server  will  delete  the  `new'  flag  for  all messages in the
3070       changed folder, and new messages will appear as unread  when  it
3071       is  selected  for viewing later.  The `flagged', `answered', and
3072       `draft' attributes are usually permanent, but some IMAP  servers
3073       are  known  to  drop them without notification.  Message numbers
3074       may change with IMAP every time before the prompt is printed  if
3075       mailx  is notified by the server that messages have been deleted
3076       by some other client or process.  In this case, `Expunged n mes‐
3077       sages' is printed, and message numbers may have changed.
3078
3079       Limitations  with POP3 mailboxes are: It is not possible to edit
3080       messages, they can only be copied and deleted.  The  line  count
3081       for the header display is only appropriate if the entire message
3082       has been downloaded from the server.  The status field of a mes‐
3083       sage  is  maintained  by  the  server  between connections; some
3084       servers do not update it at all, and with a  server  that  does,
3085       the  `exit'  command  will  not  cause  the message status to be
3086       reset.  The `newmail' command and the `newmail' variable have no
3087       effect.   It  is  not possible to rename or to remove POP3 mail‐
3088       boxes.
3089
3090       If a RUBOUT (interrupt) is typed while an IMAP or POP3 operation
3091       is  in  progress,  mailx  will  wait  until the operation can be
3092       safely aborted, and will then return to  the  command  loop  and
3093       print  the  prompt  again.   When a second RUBOUT is typed while
3094       mailx is waiting for the operation to  complete,  the  operation
3095       itself  will  be canceled.  In this case, data that has not been
3096       fetched yet will have to be fetched before the next command  can
3097       be  performed.   If  the canceled operation was using an SSL/TLS
3098       encrypted channel, an error  in  the  SSL  transport  will  very
3099       likely result, and the connection is no longer usable.
3100
3101       As  mailx is a mail user agent, it provides only basic SMTP ser‐
3102       vices.  If it fails to contact its upstream SMTP server, it will
3103       not  make  further  attempts  to transfer the message at a later
3104       time, and it does not leave other information about this  condi‐
3105       tion  than  an error message on the terminal and a `dead.letter'
3106       file.  This is usually not a  problem  if  the  SMTP  server  is
3107       located in the same local network as the computer on which mailx
3108       is run.  However, care should  be  taken  when  using  a  remote
3109       server  of  an  ISP;  it  might be better to set up a local SMTP
3110       server then which just acts as a proxy.
3111
3112       Mailx    immediately    contacts    the    SMTP    server    (or
3113       /usr/lib/sendmail) even when operating in disconnected mode.  It
3114       would not make much sense for mailx to defer outgoing mail since
3115       SMTP servers usually provide much more elaborated delay handling
3116       than mailx could perform as a client.  Thus the recommended set‐
3117       up for sending mail in disconnected mode is to configure a local
3118       SMTP server such that it sends  outgoing  mail  as  soon  as  an
3119       external  network  connection is available again, i.e. to advise
3120       it to do that from a network startup script.
3121
3122       The junk mail filter follows the concepts developed by Paul Gra‐
3123       ham   in  his  articles,  ``A  Plan  for  Spam'',  August  2002,
3124       <http://www.paulgraham.com/spam.html>,  and  ``Better   Bayesian
3125       Filtering'',                    January                    2003,
3126       <http://www.paulgraham.com/better.html>.  Chained tokens are due
3127       to a paper by Jonathan A. Zdziarski, ``Advanced Language Classi‐
3128       fication    using    Chained    Tokens'',     February     2004,
3129       <http://www.nuclearelephant.com/papers/chained.html>.
3130
3131       A  mail  command appeared in Version 1 AT&T Unix.  Berkeley Mail
3132       was written in 1978 by Kurt Shoens.  This man  page  is  derived
3133       from  from  The Mail Reference Manual originally written by Kurt
3134       Shoens.  Heirloom Mailx enhancements are  maintained  and  docu‐
3135       mented by Gunnar Ritter.
3136
3137       Portions of this text are reprinted and reproduced in electronic
3138       form from IEEE Std 1003.1, 2003 Edition, Standard  for  Informa‐
3139       tion  Technology  — Operating System Interface (POSIX), The Open
3140       Group Base Specifications Issue 6, Copyright © 2001-2003 by  the
3141       Institute  of  Electrical and Electronics Engineers, Inc and The
3142       Open Group. In the event of any discrepancy between this version
3143       and  the original IEEE and The Open Group Standard, the original
3144       IEEE and The Open Group Standard is the  referee  document.  The
3145       original     Standard     can     be    obtained    online    at
3146       http://www.opengroup.org/unix/online.html .   Redistribution  of
3147       this  material  is  permitted  so  long  as  this notice remains
3148       intact.
3149
3150
3151
3152Heirloom mailx 12.5                 10/9/10                           MAILX(1)
Impressum