1MAILX(1) User Commands MAILX(1)
2
3
4
6 mailx - send and receive Internet mail
7
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
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.
110
111 -T name
112 Writes the `Message-Id:' and `Article-Id:' header fields of each
113 message read in the file name. Implies -I. Compressed files
114 are handled as described for the folder command below.
115
116 -t The message to be sent is expected to contain a message header
117 with `To:', `Cc:', or `Bcc:' fields giving its recipients.
118 Recipients specified on the command line are ignored.
119
120 -u user
121 Reads the mailbox of the given user name.
122
123 -v Verbose mode. The details of delivery are displayed on the
124 user's terminal.
125
126 -V Print mailx's version and exit.
127
128 -~ Enable tilde escapes even if not in interactive mode.
129
130 Sending mail
131 To send a message to one or more people, mailx can be invoked with
132 arguments which are the names of people to whom the mail will be sent.
133 The user is then expected to type in his message, followed by an `con‐
134 trol-D' at the beginning of a line. The section below Replying to or
135 originating mail, describes some features of mailx available to help
136 when composing letters.
137
138 Reading mail
139 In normal usage mailx is given no arguments and checks the user's mail
140 out of the post office, then prints out a one line header of each mes‐
141 sage found. The current message is initially the first message (num‐
142 bered 1) and can be printed using the print command which can be abbre‐
143 viated `p'). The user can move among the messages much as he moves
144 between lines in ed(1), with the commands `+' and `-' moving backwards
145 and forwards, and simple numbers.
146
147 Disposing of mail
148 After examining a message the user can delete `d') the message or reply
149 `r') to it. Deletion causes the mailx program to forget about the mes‐
150 sage. This is not irreversible; the message can be undeleted `u') by
151 giving its number, or the mailx session can be aborted by giving the
152 exit `x') command. Deleted messages will, however, usually disappear
153 never to be seen again.
154
155 Specifying messages
156 Commands such as print and delete can be given a list of message num‐
157 bers as arguments to apply to a number of messages at once. Thus
158 `delete 1 2' deletes messages 1 and 2, while `delete 1-5' deletes mes‐
159 sages 1 through 5. In sorted or threaded mode (see the sort and thread
160 commands), `delete 1-5' deletes the messages that are located between
161 (and including) messages 1 through 5 in the sorted/threaded order, as
162 shown in the header summary. The following special message names
163 exist:
164
165 :n All new messages.
166
167 :o All old messages (any not in state read or new).
168
169 :u All unread messages.
170
171 :d All deleted messages (for the undelete command).
172
173 :r All read messages.
174
175 :f All `flagged' messages.
176
177 :a All answered messages (cf. the markanswered variable).
178
179 :t All messages marked as draft.
180
181 :k All `killed' messages.
182
183 :j All messages classified as junk.
184
185 . The current message.
186
187 ; The message that was previously the current message.
188
189 , The parent message of the current message, that is the message
190 with the Message-ID given in the `In-Reply-To:' field or the
191 last entry of the `References:' field of the current message.
192
193 - The next previous undeleted message, or the next previous
194 deleted message for the undelete command. In sorted/threaded
195 mode, the next previous such message in the sorted/threaded
196 order.
197
198 + The next undeleted message, or the next deleted message for the
199 undelete command. In sorted/threaded mode, the next such mes‐
200 sage in the sorted/threaded order.
201
202 ^ The first undeleted message, or the first deleted message for
203 the undelete command. In sorted/threaded mode, the first such
204 message in the sorted/threaded order.
205
206 $ The last message. In sorted/threaded mode, the last message in
207 the sorted/threaded order.
208
209 &x In threaded mode, selects the message addressed with x, where x
210 is any other message specification, and all messages from the
211 thread that begins at it. Otherwise, it is identical to x. If
212 x is omitted, the thread beginning with the current message is
213 selected.
214
215 * All messages.
216
217 ` All messages that were included in the message list for the pre‐
218 vious command.
219
220 /string
221 All messages that contain string in the subject field (case
222 ignored). See also the searchheaders variable. If string is
223 empty, the string from the previous specification of that type
224 is used again.
225
226 address
227 All messages from address. By default, this is a case-sensitive
228 search for the complete email address. If the allnet variable
229 is set, only the local part of the addresses is evaluated for
230 the comparison. Otherwise if the showname variable is set, a
231 case-sensitive search for the complete real name of a sender is
232 performed. The IMAP-style (from address) expression can be used
233 instead if substring matches are desired.
234
235 (criterion)
236 All messages that satisfy the given IMAP-style SEARCH criterion.
237 This addressing mode is available with all types of folders; for
238 folders not located on IMAP servers, or for servers unable to
239 execute the SEARCH command, mailx will perform the search
240 locally. Strings must be enclosed by double quotes `"' in their
241 entirety if they contain white space or parentheses; within the
242 quotes, only backslash `\' is recognized as an escape character.
243 All string searches are case-insensitive. When the description
244 indicates that the `envelope' representation of an address field
245 is used, this means that the search string is checked against
246 both a list constructed as
247
248 ("real name" "source-route" "local-part" "domain-part")
249
250 for each address, and the addresses without real names from the
251 respective header field. Criteria can be nested using parenthe‐
252 ses.
253
254 (criterion1 criterion2 ... criterionN)
255 All messages that satisfy all of the given criteria.
256
257 (or criterion1 criterion2)
258 All messages that satisfy either criterion1 or criterion2, or
259 both. To connect more than two criteria using `or', (or) speci‐
260 fications have to be nested using additional parentheses, as
261 with `(or a (or b c))'; `(or a b c)' means ((a or b) and c).
262 For a simple `or' operation of independent criteria on the low‐
263 est nesting level, it is possible to achieve similar effects by
264 using three separate criteria, as with `(a) (b) (c)'.
265
266 (not criterion)
267 All messages that do not satisfy criterion.
268
269 (bcc string)
270 All messages that contain string in the `envelope' representa‐
271 tion of the Bcc: field.
272
273 (cc string)
274 All messages that contain string in the `envelope' representa‐
275 tion of the Cc: field.
276
277 (from string)
278 All messages that contain string in the `envelope' representa‐
279 tion of the From: field.
280
281 (subject string)
282 All messages that contain string in the Subject: field.
283
284 (to string)
285 All messages that contain string in the `envelope' representa‐
286 tion of the To: field.
287
288 (header name string)
289 All messages that contain string in the specified Name: field.
290
291 (body string)
292 All messages that contain string in their body.
293
294 (text string)
295 All messages that contain string in their header or body.
296
297 (larger size)
298 All messages that are larger than size (in bytes).
299
300 (smaller size)
301 All messages that are smaller than size (in bytes).
302
303 (before date)
304 All messages that were received before date; date must be in the
305 form d[d]-mon-yyyy, where d[d] is the day of the month as one or
306 two digits, mon is the name of the month—one of `Jan', `Feb',
307 `Mar', `Apr', `May', `Jun', `Jul', `Aug', `Sep', `Oct', `Nov',
308 or `Dec', and yyyy is the year as four digits; e.g.
309 "30-Aug-2004".
310
311 (on date)
312 All messages that were received on the specified date.
313
314 (since date)
315 All messages that were received since the specified date.
316
317 (sentbefore date)
318 All messages that were sent on the specified date.
319
320 (senton date)
321 All messages that were sent on the specified date.
322
323 (sentsince date)
324 All messages that were sent since the specified date.
325
326 () The same criterion as for the previous search. This specifica‐
327 tion cannot be used as part of another criterion. If the previ‐
328 ous command line contained more than one independent criterion,
329 the last of those criteria is used.
330
331 A practical method to read a set of messages is to issue a from command
332 with the search criteria first to check for appropriate messages, and
333 to read each single message then by typing ``' repeatedly.
334
335 Replying to or originating mail
336 The reply command can be used to set up a response to a message, send‐
337 ing it back to the person who it was from. Text the user types in
338 then, up to an end-of-file, defines the contents of the message. While
339 the user is composing a message, mailx treats lines beginning with the
340 character `~' specially. For instance, typing `~m' (alone on a line)
341 will place a copy of the current message into the response right shift‐
342 ing it by a tabstop (see indentprefix variable, below). Other escapes
343 will set up subject fields, add and delete recipients to the message,
344 attach files to it and allow the user to escape to an editor to revise
345 the message or to a shell to run some commands. (These options are
346 given in the summary below.)
347
348 Ending a mail processing session
349 The user can end a mailx session with the quit (`q') command. Messages
350 which have been examined go to the user's mbox file unless they have
351 been deleted in which case they are discarded. Unexamined messages go
352 back to the post office. (See the -f option above).
353
354 Personal and systemwide distribution lists
355 It is also possible to create a personal distribution lists so that,
356 for instance, the user can send mail to `cohorts' and have it go to a
357 group of people. Such lists can be defined by placing a line like
358
359 alias cohorts bill ozalp jkf mark kridle@ucbcory
360
361 in the file .mailrc in the user's home directory. The current list of
362 such aliases can be displayed with the alias command in mailx. System
363 wide distribution lists can be created by editing /etc/aliases, see
364 aliases(5) and sendmail(8); these are kept in a different syntax. In
365 mail the user sends, personal aliases will be expanded in mail sent to
366 others so that they will be able to reply to the recipients. System
367 wide aliases are not expanded when the mail is sent, but any reply
368 returned to the machine will have the system wide alias expanded as all
369 mail goes through sendmail.
370
371 Recipient address specifications
372 When an address is used to name a recipient (in any of To, Cc, or Bcc),
373 names of local mail folders and pipes to external commands can also be
374 specified; the message text is then written to them. The rules are:
375 Any name which starts with a `|' character specifies a pipe, the com‐
376 mand string following the `|' is executed and the message is sent to
377 its standard input; any other name which contains a `@' character is
378 treated as a mail address; any other name which starts with a `+' char‐
379 acter specifies a folder name; any other name which contains a `/'
380 character but no `!' or `%' character before also specifies a folder
381 name; what remains is treated as a mail address. Compressed folders
382 are handled as described for the folder command below.
383
384 Network mail (Internet / ARPA, UUCP, Berknet)
385 See mailaddr(7) for a description of network addresses. Mailx has a
386 number of options which can be set in the .mailrc file to alter its
387 behavior; thus `set askcc' enables the askcc feature. (These options
388 are summarized below).
389
390 MIME types
391 For any outgoing attachment, mailx tries to determine the content type.
392 It does this by reading MIME type files whose lines have the following
393 syntax:
394
395 type/subtype extension [extension . . .]
396
397 where type/subtype are strings describing the file contents, and exten‐
398 sion is the part of a filename starting after the last dot. Any line
399 not immediately beginning with an ASCII alphabetical character is
400 ignored by mailx. If there is a match with the extension of the file
401 to attach, the given type/subtype pair is used. Otherwise, or if the
402 filename has no extension, the content types text/plain or applica‐
403 tion/octet-stream are used, the first for text or international text
404 files, the second for any file that contains formatting characters
405 other than newlines and horizontal tabulators.
406
407 Character sets
408 Mailx normally detects the character set of the terminal using the
409 LC_CTYPE locale setting. If the locale cannot be used appropriately,
410 the ttycharset variable should be set to provide an explicit value.
411 When reading messages, their text is converted to the terminal charac‐
412 ter set if possible. Unprintable characters and illegal byte sequences
413 are detected and replaced by Unicode substitute characters or question
414 marks unless the print-all-chars is set at initialization time.
415
416 The character set for outgoing messages is not necessarily the same as
417 the one used on the terminal. If an outgoing text message contains
418 characters not representable in US-ASCII, the character set being used
419 must be declared within its header. Permissible values can be declared
420 using the sendcharsets variable, separated by commas; mailx tries each
421 of the values in order and uses the first appropriate one. If the mes‐
422 sage contains characters that cannot be represented in any of the given
423 character sets, the message will not be sent, and its text will be
424 saved to the `dead.letter' file. Messages that contain NUL bytes are
425 not converted.
426
427 Outgoing attachments are converted if they are plain text. If the
428 sendcharsets variable contains more than one character set name, the ~@
429 tilde escape will ask for the character sets for individual attachments
430 if it is invoked without arguments.
431
432 Best results are usually achieved when mailx is run in a UTF-8 locale
433 on a UTF-8 capable terminal. In this setup, characters from various
434 countries can be displayed, while it is still possible to use more sim‐
435 ple character sets for sending to retain maximum compatibility with
436 older mail clients.
437
438 Commands
439 Each command is typed on a line by itself, and may take arguments fol‐
440 lowing the command word. The command need not be typed in its entirety
441 – the first command which matches the typed prefix is used. For com‐
442 mands which take message lists as arguments, if no message list is
443 given, then the next message forward which satisfies the command's
444 requirements is used. If there are no messages forward of the current
445 message, the search proceeds backwards, and if there are no good mes‐
446 sages at all, mailx types `applicable messages' and aborts the command.
447 If the command begins with a # sign, the line is ignored.
448
449 The arguments to commands can be quoted, using the following methods:
450
451 · An argument can be enclosed between paired double-quotes "" or
452 single-quotes ''; any white space, shell word expansion, or
453 backslash characters within the quotes are treated literally as
454 part of the argument. A double-quote will be treated literally
455 within single-quotes and vice versa. These special properties of
456 the quote marks occur only when they are paired at the beginning
457 and end of the argument.
458
459 · A backslash outside of the enclosing quotes is discarded and the
460 following character is treated literally as part of the argu‐
461 ment.
462
463 · An unquoted backslash at the end of a command line is discarded
464 and the next line continues the command.
465
466 Filenames, where expected, are subjected to the following transforma‐
467 tions, in sequence:
468
469 · If the filename begins with an unquoted plus sign, and the
470 folder variable is defined, the plus sign will be replaced by
471 the value of the folder variable followed by a slash. If the
472 folder variable is unset or is set to null, the filename will be
473 unchanged.
474
475 · Shell word expansions are applied to the filename. If more than
476 a single pathname results from this expansion and the command is
477 expecting one file, an error results.
478
479 The following commands are provided:
480
481 - Print out the preceding message. If given a numeric argument n,
482 goes to the n'th previous message and prints it.
483
484 ? Prints a brief summary of commands.
485
486 ! Executes the shell (see sh(1) and csh(1)) command which follows.
487
488 | A synonym for the pipe command.
489
490 account
491 (ac) Creates, selects or lists an email account. An account is
492 formed by a group of commands, primarily of those to set vari‐
493 ables. With two arguments, of which the second is a `{', the
494 first argument gives an account name, and the following lines
495 create a group of commands for that account until a line con‐
496 taining a single `}' appears. With one argument, the previously
497 created group of commands for the account name is executed, and
498 a folder command is executed for the system mailbox or inbox of
499 that account. Without arguments, the list of accounts and their
500 contents are printed. As an example,
501
502 account myisp {
503 set folder=imaps://mylogin@imap.myisp.example
504 set record=+Sent
505 set from="myname@myisp.example (My Name)"
506 set smtp=smtp.myisp.example
507 }
508
509 creates an account named `myisp' which can later be selected by
510 specifying `account myisp'.
511
512 alias (a) With no arguments, prints out all currently-defined aliases.
513 With one argument, prints out that alias. With more than one
514 argument, creates a new alias or changes an old one.
515
516 alternates
517 (alt) The alternates command is useful if the user has accounts
518 on several machines. It can be used to inform mailx that the
519 listed addresses all belong to the invoking user. When he
520 replies to messages, mailx will not send a copy of the message
521 to any of the addresses listed on the alternates list. If the
522 alternates command is given with no argument, the current set of
523 alternate names is displayed.
524
525 answered
526 (ans) Takes a message list and marks each message as a having
527 been answered. This mark has no technical meaning in the mail
528 system; it just causes messages to be marked in the header sum‐
529 mary, and makes them specially addressable.
530
531 cache Only applicable to cached IMAP mailboxes; takes a message list
532 and reads the specified messages into the IMAP cache.
533
534 call Calls a macro (see the define command).
535
536 cd Same as chdir.
537
538 certsave
539 Only applicable to S/MIME signed messages. Takes a message list
540 and a file name and saves the certificates contained within the
541 message signatures to the named file in both human-readable and
542 PEM format. The certificates can later be used to send
543 encrypted messages to the messages' originators by setting the
544 smime-encrypt-user@host variable.
545
546 chdir (ch) Changes the user's working directory to that specified, if
547 given. If no directory is given, then changes to the user's
548 login directory.
549
550 classify
551 (cl) Takes a list of messages and examines their contents for
552 characteristics of junk mail using Bayesian filtering. Messages
553 considered to be junk are then marked as such. The junk mail
554 database is not changed.
555
556 collapse
557 (coll) Only applicable to threaded mode. Takes a message list
558 and makes all replies to these messages invisible in header sum‐
559 maries, unless they are in state `new'.
560
561 connect
562 (conn) If operating in disconnected mode on an IMAP mailbox,
563 switch to online mode and connect to the mail server while
564 retaining the mailbox status. See the description of the dis‐
565 connected variable for more information.
566
567 copy (c) The copy command does the same thing that save does, except
568 that it does not mark the messages it is used on for deletion
569 when the user quits. Compressed files and IMAP mailboxes are
570 handled as described for the folder command.
571
572 Copy (C) Similar to copy, but saves the messages in a file named
573 after the local part of the sender address of the first message.
574
575 decrypt
576 (dec) For unencrypted messages, this command is identical to
577 copy. Encrypted messages are first decrypted, if possible, and
578 then copied.
579
580 Decrypt
581 (Dec) Similar to decrypt, but saves the messages in a file named
582 after the local part of the sender address of the first message.
583
584 define (def) Defines a macro. A macro definition is a sequence of com‐
585 mands in the following form:
586
587 define name {
588 command1
589 command2
590 ...
591 commandN
592 }
593
594 Once defined, a macro can be explicitly invoked using the call
595 command, or can be implicitly invoked by setting the folder-hook
596 or folder-hook-fullname variables.
597
598 defines
599 Prints the currently defined macros including their contents.
600
601 delete (d) Takes a list of messages as argument and marks them all as
602 deleted. Deleted messages will not be saved in mbox, nor will
603 they be available for most other commands.
604
605 discard
606 Same as ignore.
607
608 disconnect
609 (disco) If operating in online mode on an IMAP mailbox, switch
610 to disconnected mode while retaining the mailbox status. See
611 the description of the disconnected variable for more informa‐
612 tion. A list of messages may optionally be given as argument;
613 the respective messages are then read into the cache before the
614 connection is closed. Thus `disco *' makes the entire current
615 mailbox available for disconnected use.
616
617 dp or dt
618 Deletes the current message and prints the next message. If
619 there is no next message, mailx says `at EOF'.
620
621 draft Takes a message list and marks each message as a draft. This
622 mark has no technical meaning in the mail system; it just causes
623 messages to be marked in the header summary, and makes them spe‐
624 cially addressable.
625
626 echo Echoes its arguments, resolving special names as documented for
627 the folder command. The escape sequences `\a', `\b', `\c',
628 `\f', `\n', `\r', `\t', `\v', `\\', and `\0num' are interpreted
629 as with the echo(1) command.
630
631 edit (e) Takes a list of messages and points the text editor at each
632 one in turn. Modified contents are discarded unless the write‐
633 backedited variable is set.
634
635 else Marks the end of the then-part of an if statement and the begin‐
636 ning of the part to take effect if the condition of the if
637 statement is false.
638
639 endif Marks the end of an if statement.
640
641 exit (ex or x) Effects an immediate return to the Shell without modi‐
642 fying the user's system mailbox, his mbox file, or his edit file
643 in -f.
644
645 file (fi) The same as folder.
646
647 flag (fl) Takes a message list and marks the messages as `flagged'
648 for urgent/special attention. This mark has no technical mean‐
649 ing in the mail system; it just causes messages to be high‐
650 lighted in the header summary, and makes them specially address‐
651 able.
652
653 folders
654 With no arguments, list the names of the folders in the folder
655 directory. With an existing folder as an argument, lists then
656 names of folders below the named folder; e.g. the command `fold‐
657 ers @' lists the folders on the base level of the current IMAP
658 server. See also the imap-list-depth variable.
659
660 folder (fold) The folder command switches to a new mail file or folder.
661 With no arguments, it tells the user which file he is currently
662 reading. If an argument is given, it will write out changes
663 (such as deletions) the user has made in the current file and
664 read in the new file. Some special conventions are recognized
665 for the name. # means the previous file, % means the invoking
666 user's system mailbox, %user means user's system mailbox, &
667 means the invoking user's mbox file, and +file means a file in
668 the folder directory. %:filespec expands to the same value as
669 filespec, but the file is handled as a system mailbox e. g. by
670 the mbox and save commands. If the name matches one of the
671 strings defined with the shortcut command, it is replaced by its
672 long form and expanded. If the name ends with .gz or .bz2, it
673 is treated as compressed with gzip(1) or bzip2(1), respectively.
674 Likewise, if name does not exist, but either name.gz or name.bz2
675 exists, the compressed file is used. If name refers to a direc‐
676 tory with the subdirectories `tmp', `new', and `cur', it is
677 treated as a folder in maildir format. A name of the form
678
679 protocol://[user@]host[:port][/file]
680
681 is taken as an Internet mailbox specification. The supported
682 protocols are currently imap (IMAP v4r1), imaps (IMAP with
683 SSL/TLS encryption), pop3 (POP3), and pop3s (POP3 with SSL/TLS
684 encryption). If user contains special characters, in particular
685 `/' or `%', they must be escaped in URL notation, as `%2F' or
686 `%25'. The optional file part applies to IMAP only; if it is
687 omitted, the default `INBOX' is used. If mailx is connected to
688 an IMAP server, a name of the form @mailbox refers to the mail‐
689 box on that server. If the `folder' variable refers to an IMAP
690 account, the special name `%' selects the `INBOX' on that
691 account.
692
693 Followup
694 (F) Similar to Respond, but saves the message in a file named
695 after the local part of the first recipient's address.
696
697 followup
698 (fo) Similar to respond, but saves the message in a file named
699 after the local part of the first recipient's address.
700
701 followupall
702 Similar to followup, but responds to all recipients regardless
703 of the flipr and Replyall variables.
704
705 followupsender
706 Similar to Followup, but responds to the sender only regardless
707 of the flipr and Replyall variables.
708
709 forward
710 (fwd) Takes a message and the address of a recipient and for‐
711 wards the message to him. The text of the original message is
712 included in the new one, with the value of the fwdheading vari‐
713 able printed before. The fwdignore and fwdretain commands spec‐
714 ify which header fields are included in the new message. Only
715 the first part of a multipart message is included unless the
716 forward-as-attachment option is set.
717
718 Forward
719 (Fwd) Similar to forward, but saves the message in a file named
720 after the local part of the recipient's address.
721
722 from (f) Takes a list of messages and prints their message headers,
723 piped through the pager if the output does not fit on the
724 screen.
725
726 fwdignore
727 Specifies which header fields are to be ignored with the forward
728 command. This command has no effect when the forward-as-attach‐
729 ment option is set.
730
731 fwdretain
732 Specifies which header fields are to be retained with the for‐
733 ward command. fwdretain overrides fwdignore. This command has
734 no effect when the forward-as-attachment option is set.
735
736 good (go) Takes a list of messages and marks all of them as not being
737 junk mail. Data from these messages is then inserted into the
738 junk mail database for future classification.
739
740 headers
741 (h) Lists the current range of headers, which is an 18-message
742 group. If a `+' argument is given, then the next 18-message
743 group is printed, and if a `-' argument is given, the previous
744 18-message group is printed.
745
746 help A synonym for ?.
747
748 hold (ho, also preserve) Takes a message list and marks each message
749 therein to be saved in the user's system mailbox instead of in
750 mbox. Does not override the delete command. mailx deviates
751 from the POSIX standard with this command, as a `next' command
752 issued after `hold' will display the following message, not the
753 current one.
754
755 if Commands in mailx's startup files can be executed conditionally
756 depending on whether the user is sending or receiving mail with
757 the if command. For example:
758
759 if receive
760 commands . . .
761 endif
762
763 An else form is also available:
764
765 if receive
766 commands . . .
767 else
768 commands . . .
769 endif
770
771 Note that the only allowed conditions are receive, send, and
772 term (execute command if standard input is a tty).
773
774 ignore Add the list of header fields named to the ignored list. Header
775 fields in the ignore list are not printed on the terminal when a
776 message is printed. This command is very handy for suppression
777 of certain machine-generated header fields. The Type and Print
778 commands can be used to print a message in its entirety, includ‐
779 ing ignored fields. If ignore is executed with no arguments, it
780 lists the current set of ignored fields.
781
782 imap Sends command strings directly to the current IMAP server.
783 Mailx operates always in IMAP selected state on the current
784 mailbox; commands that change this will produce undesirable
785 results and should be avoided. Useful IMAP commands are:
786
787 create Takes the name of an IMAP mailbox as an argument and cre‐
788 ates it.
789
790 getquotaroot
791 Takes the name of an IMAP mailbox as an argument and
792 prints the quotas that apply to the mailbox. Not all
793 IMAP servers support this command.
794
795 namespace
796 Takes no arguments and prints the Personal Namespaces,
797 the Other User's Namespaces, and the Shared Namespaces.
798 Each namespace type is printed in parentheses; if there
799 are multiple namespaces of the same type, inner parenthe‐
800 ses separate them. For each namespace, a namespace pre‐
801 fix and a hierarchy separator is listed. Not all IMAP
802 servers support this command.
803
804 inc Same as newmail.
805
806 junk (j) Takes a list of messages and marks all of them as junk mail.
807 Data from these messages is then inserted into the junk mail
808 database for future classification.
809
810 kill (k) Takes a list of messages and `kills' them. Killed messages
811 are not printed in header summaries, and are ignored by the next
812 command. The kill command also sets the score of the messages
813 to negative infinity, so that subsequent score commands will not
814 unkill them again. Killing is only effective for the current
815 session on a folder; when it is quit, all messages are automati‐
816 cally unkilled.
817
818 list Prints the names of all available commands.
819
820 Mail (M) Similar to mail, but saves the message in a file named after
821 the local part of the first recipient's address.
822
823 mail (m) Takes as argument login names and distribution group names
824 and sends mail to those people.
825
826 mbox Indicate that a list of messages be sent to mbox in the user's
827 home directory when mailx is quit. This is the default action
828 for messages if unless the hold option is set. mailx deviates
829 from the POSIX standard with this command, as a `next' command
830 issued after `mbox' will display the following message, not the
831 current one.
832
833 move (mv) Acts like copy, but marks the messages for deletion if they
834 were transferred successfully.
835
836 Move (Mv) Similar to move, but moves the messages to a file named
837 after the local part of the sender address of the first message.
838
839 newmail
840 Checks for new mail in the current folder without committing any
841 changes before. If new mail is present, a message is printed.
842 If the header variable is set, the headers of each new message
843 are also printed.
844
845 next (n) like + or CR) Goes to the next message in sequence and types
846 it. With an argument list, types the next matching message.
847
848 New Same as unread.
849
850 new Same as unread.
851
852 online Same as connect.
853
854 noop If the current folder is located on an IMAP or POP3 server, a
855 NOOP command is sent. Otherwise, no operation is performed.
856
857 Pipe (Pi) Like pipe but also pipes ignored header fields and all
858 parts of MIME multipart/alternative messages.
859
860 pipe (pi) Takes a message list and a shell command and pipes the mes‐
861 sages through the command. Without an argument, the current
862 message is piped through the command given by the cmd variable.
863 If the page variable is set, every message is followed by a
864 formfeed character.
865
866 preserve
867 (pre) A synonym for hold.
868
869 Print (P) Like print but also prints out ignored header fields and all
870 parts of MIME multipart/alternative messages. See also print,
871 ignore, and retain.
872
873 print (p) Takes a message list and types out each message on the
874 user's terminal. If the message is a MIME multipart message,
875 all parts with a content type of `text' or `message' are shown,
876 the other are hidden except for their headers. Messages are
877 decrypted and converted to the terminal character set if neces‐
878 sary.
879
880 probability
881 (prob) For each word given as argument, the contents of its junk
882 mail database entry are printed.
883
884 quit (q) Terminates the session, saving all undeleted, unsaved mes‐
885 sages in the user's mbox file in his login directory, preserving
886 all messages marked with hold or preserve or never referenced in
887 his system mailbox, and removing all other messages from his
888 system mailbox. If new mail has arrived during the session, the
889 message `You have new mail' is given. If given while editing a
890 mailbox file with the -f flag, then the edit file is rewritten.
891 A return to the Shell is effected, unless the rewrite of edit
892 file fails, in which case the user can escape with the exit com‐
893 mand.
894
895 redirect
896 (red) Same as resend.
897
898 Redirect
899 (Red) Same as Resend.
900
901 remove (rem) Removes the named folders. The user is asked for confir‐
902 mation in interactive mode.
903
904 rename (ren) Takes the name of an existing folder and the name for the
905 new folder and renames the first to the second one. Both fold‐
906 ers must be of the same type and must be located on the current
907 server for IMAP.
908
909 Reply (R) Reply to originator. Does not reply to other recipients of
910 the original message.
911
912 reply (r) Takes a message list and sends mail to the sender and all
913 recipients of the specified message. The default message must
914 not be deleted.
915
916 replyall
917 Similar to reply, but responds to all recipients regardless of
918 the flipr and Replyall variables.
919
920 replysender
921 Similar to Reply, but responds to the sender only regardless of
922 the flipr and Replyall variables.
923
924 Resend Like resend, but does not add any header lines. This is not a
925 way to hide the sender's identity, but useful for sending a mes‐
926 sage again to the same recipients.
927
928 resend Takes a list of messages and a user name and sends each message
929 to the named user. `Resent-From:' and related header fields are
930 prepended to the new copy of the message.
931
932 Respond
933 Same as Reply.
934
935 respond
936 Same as reply.
937
938 respondall
939 Same as replyall.
940
941 respondsender
942 Same as replysender.
943
944 retain Add the list of header fields named to the retained list. Only
945 the header fields in the retain list are shown on the terminal
946 when a message is printed. All other header fields are sup‐
947 pressed. The Type and Print commands can be used to print a
948 message in its entirety. If retain is executed with no argu‐
949 ments, it lists the current set of retained fields.
950
951 Save (S) Similar to save, but saves the messages in a file named
952 after the local part of the sender of the first message instead
953 of taking a filename argument.
954
955 save (s) Takes a message list and a filename and appends each message
956 in turn to the end of the file. If no filename is given, the
957 mbox file is used. The filename in quotes, followed by the line
958 count and character count is echoed on the user's terminal. If
959 editing a system mailbox, the messages are marked for deletion.
960 Compressed files and IMAP mailboxes are handled as described for
961 the -f command line option above.
962
963 savediscard
964 Same as saveignore.
965
966 saveignore
967 Saveignore is to save what ignore is to print and type. Header
968 fields thus marked are filtered out when saving a message by
969 save or when automatically saving to mbox. This command should
970 only be applied to header fields that do not contain information
971 needed to decode the message, as MIME content fields do. If
972 saving messages on an IMAP account, ignoring fields makes it
973 impossible to copy the data directly on the server, thus opera‐
974 tion usually becomes much slower.
975
976 saveretain
977 Saveretain is to save what retain is to print and type. Header
978 fields thus marked are the only ones saved with a message when
979 saving by save or when automatically saving to mbox. Saveretain
980 overrides saveignore. The use of this command is strongly dis‐
981 couraged since it may strip header fields that are needed to
982 decode the message correctly.
983
984 score (sc) Takes a message list and a floating point number and adds
985 the number to the score of each given message. All messages
986 start at score 0 when a folder is opened. When the score of a
987 message becomes negative, it is `killed' with the effects
988 described for the kill command; otherwise if it was negative
989 before and becomes positive, it is `unkilled'. Scores only
990 refer to the currently opened instance of a folder.
991
992 set (se) With no arguments, prints all variable values, piped
993 through the pager if the output does not fit on the screen.
994 Otherwise, sets option. Arguments are of the form option=value
995 (no space before or after =) or option. Quotation marks may be
996 placed around any part of the assignment statement to quote
997 blanks or tabs, i.e. `set indentprefix="->"'. If an argument
998 begins with no, as in `set nosave', the effect is the same as
999 invoking the unset command with the remaining part of the vari‐
1000 able (`unset save').
1001
1002 seen Takes a message list and marks all messages as having been read.
1003
1004 shell (sh) Invokes an interactive version of the shell.
1005
1006 shortcut
1007 Defines a shortcut name and its string for expansion, as
1008 described for the folder command. With no arguments, a list of
1009 defined shortcuts is printed.
1010
1011 show (Sh) Like print, but performs neither MIME decoding nor decryp‐
1012 tion so that the raw message text is shown.
1013
1014 size Takes a message list and prints out the size in characters of
1015 each message.
1016
1017 sort Create a sorted representation of the current folder, and change
1018 the next command and the addressing modes such that they refer
1019 to messages in the sorted order. Message numbers are the same
1020 as in regular mode. If the header variable is set, a header
1021 summary in the new order is also printed. Possible sorting cri‐
1022 teria are:
1023
1024 date Sort the messages by their `Date:' field, that is by the
1025 time they were sent.
1026
1027 from Sort messages by the value of their `From:' field, that
1028 is by the address of the sender. If the showname vari‐
1029 able is set, the sender's real name (if any) is used.
1030
1031 size Sort the messages by their size.
1032
1033 score Sort the messages by their score.
1034
1035 status Sort the messages by their message status (new, read,
1036 old, etc.).
1037
1038 subject
1039 Sort the messages by their subject.
1040
1041 thread Create a threaded order, as with the thread command.
1042
1043 to Sort messages by the value of their `To:' field, that is
1044 by the address of the recipient. If the showname vari‐
1045 able is set, the recipient's real name (if any) is used.
1046
1047 If no argument is given, the current sorting criterion is
1048 printed.
1049
1050 source The source command reads commands from a file.
1051
1052 thread (th) Create a threaded representation of the current folder,
1053 i.e. indent messages that are replies to other messages in the
1054 header display, and change the next command and the addressing
1055 modes such that they refer to messages in the threaded order.
1056 Message numbers are the same as in unthreaded mode. If the
1057 header variable is set, a header summary in threaded order is
1058 also printed.
1059
1060 top Takes a message list and prints the top few lines of each. The
1061 number of lines printed is controlled by the variable toplines
1062 and defaults to five.
1063
1064 touch Takes a message list and marks the messages for saving in the
1065 mbox file. mailx deviates from the POSIX standard with this
1066 command, as a `next' command issued after `mbox' will display
1067 the following message, not the current one.
1068
1069 Type (T) Identical to the Print command.
1070
1071 type (t) A synonym for print.
1072
1073 unalias
1074 Takes a list of names defined by alias commands and discards the
1075 remembered groups of users. The group names no longer have any
1076 significance.
1077
1078 unanswered
1079 Takes a message list and marks each message as not having been
1080 answered.
1081
1082 uncollapse
1083 (unc) Only applicable to threaded mode. Takes a message list
1084 and makes the message and all replies to it visible in header
1085 summaries again. When a message becomes the current message, it
1086 is automatically made visible. Also when a message with col‐
1087 lapsed replies is printed, all of these are automatically uncol‐
1088 lapsed.
1089
1090 undef Undefines each of the named macros. It is not an error to use a
1091 name that does not belong to one of the currently defined
1092 macros.
1093
1094 undelete
1095 (u) Takes a message list and marks each message as not being
1096 deleted.
1097
1098 undraft
1099 Takes a message list and marks each message as a draft.
1100
1101 unflag Takes a message list and marks each message as not being
1102 `flagged'.
1103
1104 unfwdignore
1105 Removes the header field names from the list of ignored fields
1106 for the forward command.
1107
1108 unfwdretain
1109 Removes the header field names from the list of retained fields
1110 for the forward command.
1111
1112 ungood Takes a message list and undoes the effect of a good command
1113 that was previously applied on exactly these messages.
1114
1115 unignore
1116 Removes the header field names from the list of ignored fields.
1117
1118 unjunk Takes a message list and undoes the effect of a junk command
1119 that was previously applied on exactly these messages.
1120
1121 unkill Takes a message list and `unkills' each message. Also sets the
1122 score of the messages to 0.
1123
1124 Unread Same as unread.
1125
1126 unread (U) Takes a message list and marks each message as not having
1127 been read.
1128
1129 unretain
1130 Removes the header field names from the list of retained fields.
1131
1132 unsaveignore
1133 Removes the header field names from the list of ignored fields
1134 for saving.
1135
1136 unsaveretain
1137 Removes the header field names from the list of retained fields
1138 for saving.
1139
1140 unset Takes a list of option names and discards their remembered val‐
1141 ues; the inverse of set.
1142
1143 unshortcut
1144 Deletes the shortcut names given as arguments.
1145
1146 unsort Disable sorted or threaded mode (see the sort and thread com‐
1147 mands), return to normal message order and, if the header vari‐
1148 able is set, print a header summary.
1149
1150 unthread
1151 (unth) Same as unsort.
1152
1153 verify (verif) Takes a message list and verifies each message. If a
1154 message is not an S/MIME signed message, verification will fail
1155 for it. The verification process checks if the message was
1156 signed using a valid certificate, if the message sender's email
1157 address matches one of those contained within the certificate,
1158 and if the message content has been altered.
1159
1160 visual (v) Takes a message list and invokes the display editor on each
1161 message. Modified contents are discarded unless the write‐
1162 backedited variable is set.
1163
1164 write (w) For conventional messages, the body without all headers is
1165 written. The output is decrypted and converted to its native
1166 format, if necessary. If the output file exists, the text is
1167 appended.—If a message is in MIME multipart format, its first
1168 part is written to the specified file as for conventional mes‐
1169 sages, and the user is asked for a filename to save each other
1170 part; if the contents of the first part are not to be saved,
1171 `write /dev/null' can be used. For the second and subsequent
1172 parts, if the filename given starts with a `|' character, the
1173 part is piped through the remainder of the filename interpreted
1174 as a shell command. In non-interactive mode, only the parts of
1175 the multipart message that have a filename given in the part
1176 header are written, the other are discarded. The original mes‐
1177 sage is never marked for deletion in the originating mail
1178 folder. For attachments, the contents of the destination file
1179 are overwritten if the file previously existed. No special han‐
1180 dling of compressed files is performed.
1181
1182 xit (x) A synonym for exit.
1183
1184 z Mailx presents message headers in windowfuls as described under
1185 the headers command. The z command scrolls to the next window
1186 of messages. If an argument is given, it specifies the window
1187 to use. A number prefixed by `+' or `-' indicates that the win‐
1188 dow is calculated in relation to the current position. A number
1189 without a prefix specifies an absolute window number, and a `$'
1190 lets mailx scroll to the last window of messages.
1191
1192 Z Similar to z, but scrolls to the next or previous window that
1193 contains at least one new or `flagged' message.
1194
1195 Tilde escapes
1196 Here is a summary of the tilde escapes, which are used when composing
1197 messages to perform special functions. Tilde escapes are only recog‐
1198 nized at the beginning of lines. The name `tilde escape' is somewhat
1199 of a misnomer since the actual escape character can be set by the
1200 option escape.
1201
1202 ~!command
1203 Execute the indicated shell command, then return to the message.
1204
1205 ~. Same effect as typing the end-of-file character.
1206
1207 ~<filename
1208 Identical to ~r.
1209
1210 ~<!command
1211 Command is executed using the shell. Its standard output is
1212 inserted into the message.
1213
1214 ~@ [filename . . . ]
1215 With no arguments, edit the attachment list. First, the user
1216 can edit all existing attachment data. If an attachment's file
1217 name is left empty, that attachment is deleted from the list.
1218 When the end of the attachment list is reached, mailx will ask
1219 for further attachments, until an empty file name is given. If
1220 filename arguments are specified, all of them are appended to
1221 the end of the attachment list. Filenames which contain white
1222 space can only be specified with the first method (no filename
1223 arguments).
1224
1225 ~A Inserts the string contained in the Sign variable (same as `~i
1226 Sign'). The escape sequences `\t' (tabulator) and `\n' (new‐
1227 line) are understood.
1228
1229 ~a Inserts the string contained in the sign variable (same as `~i
1230 sign'). The escape sequences `\t' (tabulator) and `\n' (new‐
1231 line) are understood.
1232
1233 ~bname . . .
1234 Add the given names to the list of carbon copy recipients but do
1235 not make the names visible in the Cc: line (`blind' carbon
1236 copy).
1237
1238 ~cname . . .
1239 Add the given names to the list of carbon copy recipients.
1240
1241 ~d Read the file `dead.letter' from the user's home directory into
1242 the message.
1243
1244 ~e Invoke the text editor on the message collected so far. After
1245 the editing session is finished, the user may continue appending
1246 text to the message.
1247
1248 ~fmessages
1249 Read the named messages into the message being sent. If no mes‐
1250 sages are specified, read in the current message. Message head‐
1251 ers currently being ignored (by the ignore or retain command)
1252 are not included. For MIME multipart messages, only the first
1253 printable part is included.
1254
1255 ~Fmessages
1256 Identical to ~f, except all message headers and all MIME parts
1257 are included.
1258
1259 ~h Edit the message header fields `To:', `Cc:', `Bcc:', and `Sub‐
1260 ject:' by typing each one in turn and allowing the user to
1261 append text to the end or modify the field by using the current
1262 terminal erase and kill characters.
1263
1264 ~H Edit the message header fields `From:', `Reply-To:', `Sender:',
1265 and `Organization:' in the same manner as described for ~h. The
1266 default values for these fields originate from the from,
1267 replyto, and ORGANIZATION variables. If this tilde command has
1268 been used, changing the variables has no effect on the current
1269 message anymore.
1270
1271 ~ivariable
1272 Insert the value of the specified variable into the message
1273 adding a newline character at the end. If the variable is unset
1274 or empty, the message remains unaltered. The escape sequences
1275 `\t' (tabulator) and `\n' (newline) are understood.
1276
1277 ~mmessages
1278 Read the named messages into the message being sent, indented by
1279 a tab or by the value of indentprefix. If no messages are spec‐
1280 ified, read the current message. Message headers currently
1281 being ignored (by the ignore or retain command) are not
1282 included. For MIME multipart messages, only the first printable
1283 part is included.
1284
1285 ~Mmessages
1286 Identical to ~m, except all message headers and all MIME parts
1287 are included.
1288
1289 ~p Print out the message collected so far, prefaced by the message
1290 header fields and followed by the attachment list, if any. If
1291 the message text is longer than the screen size, it is piped
1292 through the pager.
1293
1294 ~q Abort the message being sent, copying the message to `dead.let‐
1295 ter' in the user's home directory if save is set.
1296
1297 ~rfilename
1298 Read the named file into the message.
1299
1300 ~sstring
1301 Cause the named string to become the current subject field.
1302
1303 ~tname . . .
1304 Add the given names to the direct recipient list.
1305
1306 ~v Invoke an alternate editor (defined by the VISUAL option) on the
1307 message collected so far. Usually, the alternate editor will be
1308 a screen editor. After the editor is quit, the user may resume
1309 appending text to the end of the message.
1310
1311 ~wfilename
1312 Write the message onto the named file. If the file exists, the
1313 message is appended to it.
1314
1315 ~x Same as ~q, except that the message is not saved to the
1316 `dead.letter' file.
1317
1318 ~|command
1319 Pipe the message through the command as a filter. If the com‐
1320 mand gives no output or terminates abnormally, retain the origi‐
1321 nal text of the message. The command fmt(1) is often used as
1322 command to rejustify the message.
1323
1324 ~:mailx-command
1325 Execute the given mailx command. Not all commands, however, are
1326 allowed.
1327
1328 ~_mailx-command
1329 Identical to ~:.
1330
1331 ~~string
1332 Insert the string of text in the message prefaced by a single ~.
1333 If the escape character has been changed, that character must be
1334 doubled in order to send it at the beginning of a line.
1335
1336 Variable options
1337 Options are controlled via set and unset commands, see their entries
1338 for a syntax description. An option is also set if it is passed to
1339 mailx as part of the environment (this is not restricted to specific
1340 variables as in the POSIX standard). A value given in a startup file
1341 overrides a value imported from the environment. Options may be either
1342 binary, in which case it is only significant to see whether they are
1343 set or not; or string, in which case the actual value is of interest.
1344
1345 Binary options
1346 The binary options include the following:
1347
1348 allnet Causes only the local part to be evaluated when comparing
1349 addresses.
1350
1351 append Causes messages saved in mbox to be appended to the end rather
1352 than prepended. This should always be set.
1353
1354 ask or asksub
1355 Causes mailx to prompt for the subject of each message sent. If
1356 the user responds with simply a newline, no subject field will
1357 be sent.
1358
1359 askatend
1360 Causes the prompts for `Cc:' and `Bcc:' lists to appear after
1361 the message has been edited.
1362
1363 askattach
1364 If set, mailx asks for files to attach at the end of each mes‐
1365 sage. Responding with a newline indicates not to include an
1366 attachment.
1367
1368 askcc Causes the user to be prompted for additional carbon copy recip‐
1369 ients (at the end of each message if askatend or bsdcompat is
1370 set). Responding with a newline indicates the user's satisfac‐
1371 tion with the current list.
1372
1373 askbcc Causes the user to be prompted for additional blind carbon copy
1374 recipients (at the end of each message if askatend or bsdcompat
1375 is set). Responding with a newline indicates the user's satis‐
1376 faction with the current list.
1377
1378 asksign
1379 Causes the user to be prompted if the message is to be signed at
1380 the end of each message. The smime-sign variable is ignored
1381 when this variable is set.
1382
1383 autocollapse
1384 Causes threads to be collapsed automatically when threaded mode
1385 is entered (see the collapse command).
1386
1387 autoinc
1388 Same as newmail.
1389
1390 autoprint
1391 Causes the delete command to behave like dp - thus, after delet‐
1392 ing a message, the next one will be typed automatically.
1393
1394 autothread
1395 Causes threaded mode (see the thread command) to be entered
1396 automatically when a folder is opened.
1397
1398 bang Enables the substitution of `!' by the contents of the last
1399 command line in shell escapes.
1400
1401 bsdannounce
1402 Causes automatic display of a header summary after executing a
1403 folder command.
1404
1405 bsdcompat
1406 Sets some cosmetical features to traditional BSD style; has the
1407 same affect as setting `askatend' and all other variables pre‐
1408 fixed with `bsd', setting prompt to `& ', and changing the
1409 default pager to more.
1410
1411 bsdflags
1412 Changes the letters printed in the first column of a header sum‐
1413 mary to traditional BSD style.
1414
1415 bsdheadline
1416 Changes the display of columns in a header summary to tradi‐
1417 tional BSD style.
1418
1419 bsdmsgs
1420 Changes some informational messages to traditional BSD style.
1421
1422 bsdorder
1423 Causes the `Subject:' field to appear immediately after the
1424 `To:' field in message headers and with the ~h tilde command.
1425
1426 bsdset Changes the output format of the set command to traditional BSD
1427 style.
1428
1429 chained-junk-tokens
1430 Normally, the Bayesian junk mail filter bases its classifica‐
1431 tions on single word tokens extracted from messages. If this
1432 option is set, adjacent words are combined to pairs, which are
1433 then used as additional tokens. This usually improves the accu‐
1434 racy of the filter, but also increases the junk mail database
1435 five- to tenfold.
1436
1437 datefield
1438 The date in a header summary is normally the date of the mailbox
1439 `From ' line of the message. If this variable is set, the date
1440 as given in the `Date:' header field is used, converted to local
1441 time.
1442
1443 debug Prints debugging messages and disables the actual delivery of
1444 messages. Unlike verbose, this option is intended for mailx
1445 development only.
1446
1447 disconnected
1448 When an IMAP mailbox is selected and this variable is set, no
1449 connection to the server is initiated. Instead, data is
1450 obtained from the local cache (see imap-cache). Mailboxes that
1451 are not present in the cache and messages that have not yet
1452 entirely been fetched from the server are not available; to
1453 fetch all messages in a mailbox at once, the command `copy *
1454 /dev/null' can be used while still in online mode. Changes that
1455 are made to IMAP mailboxes in disconnected mode are queued and
1456 committed later when a connection to that server is opened in
1457 online mode. This procedure is not completely reliable since it
1458 cannot be guaranteed that the IMAP unique identifiers (UIDs) on
1459 the server still match the ones in the cache at that time. Data
1460 is saved to `dead.letter' when this problem occurs.
1461
1462 disconnected-user@host
1463 The specified account is handled as described for the discon‐
1464 nected variable above, but other accounts are not affected.
1465
1466 dot The binary option dot causes mailx to interpret a period alone
1467 on a line as the terminator of a message the user is sending.
1468
1469 editheaders
1470 When a message is edited while being composed, its header is
1471 included in the editable text. `To:', `Cc:', `Bcc:', `Sub‐
1472 ject:', `From:', `Reply-To:', `Sender:', and 'Organization:'
1473 fields are accepted within the header, other fields are ignored.
1474
1475 emptybox
1476 If set, an empty mailbox file is not removed. This may improve
1477 the interoperability with other mail user agents when using a
1478 common folder directory.
1479
1480 emptystart
1481 If the mailbox is empty, mailx normally prints `No mail for
1482 user' and exits immediately. If this option is set, mailx
1483 starts even with an empty mailbox.
1484
1485 flipr Exchanges the Respond with the respond commands and vice-versa.
1486
1487 forward-as-attachment
1488 Original messages are normally sent as inline text with the for‐
1489 ward command, and only the first part of a multipart message is
1490 included. With this option, messages are sent as MIME mes‐
1491 sage/rfc822 attachments, and all of their parts are included.
1492 The fwdignore and fwdretain options are ignored when the for‐
1493 ward-as-attachment option is set.
1494
1495 fullnames
1496 When replying to a message, mailx normally removes the comment
1497 parts of email addresses, which by convention contain the full
1498 names of the recipients. If this variable is set, such strip‐
1499 ping is not performed, and comments are retained.
1500
1501 header Causes the header summary to be written at startup and after
1502 commands that affect the number of messages or the order of mes‐
1503 sages in the current folder; enabled by default.
1504
1505 hold This option is used to hold messages in the system mailbox by
1506 default.
1507
1508 ignore Causes interrupt signals from the terminal to be ignored and
1509 echoed as @'s.
1510
1511 ignoreeof
1512 An option related to dot is ignoreeof which makes mailx refuse
1513 to accept a control-d as the end of a message. Ignoreeof also
1514 applies to mailx command mode.
1515
1516 imap-use-starttls
1517 Causes mailx to issue a STARTTLS command to make an unencrypted
1518 IMAP session SSL/TLS encrypted. This functionality is not sup‐
1519 ported by all servers, and is not used if the session is already
1520 encrypted by the IMAPS method.
1521
1522 imap-use-starttls-user@host
1523 Activates imap-use-starttls for a specific account.
1524
1525 keep This option causes mailx to truncate the user's system mailbox
1526 instead of deleting it when it is empty. This should always be
1527 set, since it prevents malicious users from creating fake mail
1528 folders in a world-writable spool directory.
1529
1530 keepsave
1531 When a message is saved, it is usually discarded from the origi‐
1532 nating folder when mailx is quit. Setting this option causes
1533 all saved message to be retained.
1534
1535 markanswered
1536 When a message is replied to and this variable is set, it is
1537 marked as having been answered. This mark has no technical
1538 meaning in the mail system; it just causes messages to be marked
1539 in the header summary, and makes them specially addressable.
1540
1541 metoo Usually, when a group is expanded that contains the sender, the
1542 sender is removed from the expansion. Setting this option
1543 causes the sender to be included in the group.
1544
1545 newmail
1546 Checks for new mail in the current folder each time the prompt
1547 is printed. For IMAP mailboxes, the server is then polled for
1548 new mail, which may result in delayed operation if the connec‐
1549 tion to the server is slow. A maildir folder must be re-scanned
1550 to determine if new mail has arrived.
1551
1552 If this variable is set to the special value nopoll, an IMAP
1553 server is not actively asked for new mail, but new mail may
1554 still be detected and announced with any other IMAP command that
1555 is sent to the server. A maildir folder is not scanned then.
1556
1557 In any case, the IMAP server may send notifications about mes‐
1558 sages that have been deleted on the server by another process or
1559 client. In this case, `Expunged n messages' is printed regard‐
1560 less of this variable, and message numbers may have changed.
1561
1562 noheader
1563 Setting the option noheader is the same as giving the -N flag on
1564 the command line.
1565
1566 outfolder
1567 Causes the filename given in the record variable and the sender-
1568 based filenames for the Copy and Save commands to be interpreted
1569 relative to the directory given in the folder variable rather
1570 than to the current directory unless it is an absolute pathname.
1571
1572 page If set, each message the pipe command prints out is followed by
1573 a formfeed character.
1574
1575 piperaw
1576 Send messages to the pipe command without performing MIME and
1577 character set conversions.
1578
1579 pop3-use-apop
1580 If this variable is set, the APOP authentication method is used
1581 when a connection to a POP3 server is initiated. The advantage
1582 of this method over the usual USER/PASS authentication is that
1583 the password is not sent over the network in clear text. The
1584 connection fails if the server does not support the APOP com‐
1585 mand.
1586
1587 pop3-use-apop-user@host
1588 Enables pop3-use-apop for a specific account.
1589
1590 pop3-use-starttls
1591 Causes mailx to issue a STLS command to make an unencrypted POP3
1592 session SSL/TLS encrypted. This functionality is not supported
1593 by all servers, and is not used if the session is already
1594 encrypted by the POP3S method.
1595
1596 pop3-use-starttls-user@host
1597 Activates pop3-use-starttls for a specific account.
1598
1599 print-all-chars
1600 This option causes all characters to be considered printable.
1601 It is only effective if given in a startup file. With this
1602 option set, some character sequences in messages may put the
1603 user's terminal in an undefined state when printed; it should
1604 only be used as a last resort if no working system locale can be
1605 found.
1606
1607 print-alternatives
1608 When a MIME message part of type multipart/alternative is dis‐
1609 played and it contains a subpart of type text/plain, other parts
1610 are normally discarded. Setting this variable causes all sub‐
1611 parts to be displayed, just as if the surrounding part was of
1612 type multipart/mixed.
1613
1614 quiet Suppresses the printing of the version when first invoked.
1615
1616 record-resent
1617 If both this variable and the record variable are set, the
1618 resend and Resend commands save messages to the record folder as
1619 it is normally only done for newly composed messages.
1620
1621 reply-in-same-charset
1622 If this variable is set, mailx first tries to use the same char‐
1623 acter set of the original message for replies. If this fails,
1624 the sendcharsets variable is evaluated as usual.
1625
1626 Replyall
1627 Reverses the sense of reply and Reply commands.
1628
1629 save When the user aborts a message with two RUBOUT (interrupt char‐
1630 acters) mailx copies the partial letter to the file `dead.let‐
1631 ter' in the home directory. This option is set by default.
1632
1633 searchheaders
1634 If this option is set, then a message-list specifier in the form
1635 `/x:y' will expand to all messages containing the substring `y'
1636 in the header field `x'. The string search is case insensitive.
1637
1638 sendwait
1639 When sending a message, wait until the mail transfer agent exits
1640 before accepting further commands. If the mail transfer agent
1641 returns a non-zero exit status, the exit status of mailx will
1642 also be non-zero.
1643
1644 showlast
1645 Setting this option causes mailx to start at the last message
1646 instead of the first one when opening a mail folder.
1647
1648 showname
1649 Causes mailx to use the sender's real name instead of the plain
1650 address in the header field summary and in message specifica‐
1651 tions.
1652
1653 showto Causes the recipient of the message to be shown in the header
1654 summary if the message was sent by the user.
1655
1656 skipemptybody
1657 If an outgoing message does not contain any text in its first or
1658 only message part, do not send it but discard it silently (see
1659 also the -E option).
1660
1661 smime-force-encryption
1662 Causes mailx to refuse sending unencrypted messages.
1663
1664 smime-sign
1665 If this variable is set, outgoing messages are S/MIME signed
1666 with the user's private key. Signing a message enables a recip‐
1667 ient to verify that the sender used a valid certificate, that
1668 the email addresses in the certificate match those in the mes‐
1669 sage header, and that the message content has not been altered.
1670 It does not change the message text, and people will be able to
1671 read the message as usual.
1672
1673 smime-no-default-ca
1674 Do not load the default CA locations when verifying S/MIME
1675 signed messages. Only applicable if S/MIME support is built
1676 using OpenSSL.
1677
1678 smtp-use-starttls
1679 Causes mailx to issue a STARTTLS command to make an SMTP session
1680 SSL/TLS encrypted. Not all servers support this command;
1681 because of common implementation defects, it cannot be automati‐
1682 cally determined whether a server supports it or not.
1683
1684 ssl-no-default-ca
1685 Do not load the default CA locations to verify SSL/TLS server
1686 certificates. Only applicable if SSL/TLS support is built using
1687 OpenSSL.
1688
1689 ssl-v2-allow
1690 Accept SSLv2 connections. These are normally not allowed
1691 because this protocol version is insecure.
1692
1693 stealthmua
1694 Inhibits the generation of the `Message-Id:' and `User-Agent:'
1695 header fields that include obvious references to mailx. There
1696 are two pitfalls associated with this: First, the message id of
1697 outgoing messages is not known anymore. Second, an expert may
1698 still use the remaining information in the header to track down
1699 the originating mail user agent.
1700
1701 verbose
1702 Setting the option verbose is the same as using the -v flag on
1703 the command line. When mailx runs in verbose mode, details of
1704 the actual message delivery and protocol conversations for IMAP,
1705 POP3, and SMTP, as well as of other internal processes, are dis‐
1706 played on the user's terminal, This is sometimes useful to debug
1707 problems. Mailx prints all data that is sent to remote servers
1708 in clear texts, including passwords, so care should be taken
1709 that no unauthorized option can view the screen if this option
1710 is enabled.
1711
1712 writebackedited
1713 If this variable is set, messages modified using the edit or
1714 visual commands are written back to the current folder when it
1715 is quit. This is only possible for writable folders in mbox
1716 format. Setting this variable also disables MIME decoding and
1717 decryption for the editing commands.
1718
1719 String Options
1720 The string options include the following:
1721
1722 attrlist
1723 A sequence of characters to print in the `attribute' column of a
1724 header summary, each for one type of messages in the following
1725 order: new, unread but old, new but read, read and old, saved,
1726 preserved, mboxed, flagged, answered, draft, killed, start of a
1727 collapsed thread, collapsed, classified as junk. The default is
1728 `NUROSPMFATK+-J', or `NU *HMFATK+-J' if bsdflags or the SYSV3
1729 environment variable are set.
1730
1731 autobcc
1732 Specifies a list of recipients to which a blind carbon copy of
1733 each outgoing message will be sent automatically.
1734
1735 autocc Specifies a list of recipients to which a carbon copy of each
1736 outgoing message will be sent automatically.
1737
1738 autosort
1739 Causes sorted mode (see the sort command) to be entered automat‐
1740 ically with the value of this option as sorting method when a
1741 folder is opened.
1742
1743 cmd The default value for the pipe command.
1744
1745 crt The valued option crt is used as a threshold to determine how
1746 long a message must be before PAGER is used to read it. If crt
1747 is set without a value, then the height of the terminal screen
1748 stored in the system is used to compute the threshold (see
1749 stty(1)).
1750
1751 DEAD The name of the file to use for saving aborted messages. This
1752 defaults to `dead.letter' in the user's home directory.
1753
1754 EDITOR Pathname of the text editor to use in the edit command and ~e
1755 escape. If not defined, then a default editor is used.
1756
1757 encoding
1758 The default MIME encoding to use in outgoing text messages and
1759 message parts. Valid values are 8bit or quoted-printable. The
1760 default is 8bit. In case the mail transfer system is not ESMTP
1761 compliant, quoted-printable should be used instead. If there is
1762 no need to encode a message, 7bit transfer mode is used, without
1763 regard to the value of this variable. Binary data is always
1764 encoded in base64 mode.
1765
1766 escape If defined, the first character of this option gives the charac‐
1767 ter to use in the place of ~ to denote escapes.
1768
1769 folder The name of the directory to use for storing folders of mes‐
1770 sages. All folder names that begin with `+' refer to files
1771 below that directory. If the directory name begins with a `/',
1772 mailx considers it to be an absolute pathname; otherwise, the
1773 folder directory is found relative to the user's home directory.
1774
1775 The directory name may also refer to an IMAP account; any names
1776 that begin with `+' then refer to IMAP mailboxes on that
1777 account. An IMAP folder is normally given in the form
1778
1779 imaps://mylogin@imap.myisp.example
1780
1781 In this case, the `+' and `@' prefixes for folder names have the
1782 same effect (see the folder command).
1783
1784 Some IMAP servers do not accept the creation of mailboxes in the
1785 hierarchy base; they require that they are created as subfolders
1786 of `INBOX'. With such servers, a folder name of the form
1787
1788 imaps://mylogin@imap.myisp.example/INBOX.
1789
1790 should be used (the last character is the server's hierarchy
1791 delimiter). Folder names prefixed by `+' will then refer to
1792 folders below `INBOX', while folder names prefixed by `@' refer
1793 to folders below the hierarchy base. See the imap namespace
1794 command for a method to detect the appropriate prefix and delim‐
1795 iter.
1796
1797 folder-hook
1798 When a folder is opened and this variable is set, the macro cor‐
1799 responding to the value of this variable is executed. The macro
1800 is also invoked when new mail arrives, but message lists for
1801 commands executed from the macro only include newly arrived mes‐
1802 sages then.
1803
1804 folder-hook-fullname
1805 When a folder named fullname is opened, the macro corresponding
1806 to the value of this variable is executed. Unlike other folder
1807 specifications, the fully expanded name of a folder, without
1808 metacharacters, is used to avoid ambiguities. The macro speci‐
1809 fied with folder-hook is not executed if this variable is effec‐
1810 tive for a folder (unless it is explicitly invoked within the
1811 called macro).
1812
1813 from The address (or a list of addresses) to put into the `From:'
1814 field of the message header. If replying to a message, these
1815 addresses are handled as if they were in the alternates list.
1816 If the machine's hostname is not valid at the Internet (for
1817 example at a dialup machine), either this variable or hostname
1818 have to be set to get correct Message-ID header fields. If from
1819 contains more than one address, the sender variable must also be
1820 set.
1821
1822 fwdheading
1823 The string to print before the text of a message with the for‐
1824 ward command (unless the forward-as-attachment variable is set).
1825 Defaults to ``-------- Original Message --------'' if unset. If
1826 it is set to the empty string, no heading is printed.
1827
1828 headline
1829 A format string to use for the header summary, similar to printf
1830 formats. A `%' character introduces a format specifier. It may
1831 be followed by a number indicating the field width. If the
1832 field is a number, the width may be negative, which indicates
1833 that it is to be left-aligned. Valid format specifiers are:
1834
1835
1836 %a Message attributes.
1837 %c The score of the message.
1838 %d The date when the message was received.
1839 %e The indenting level in threaded mode.
1840 %f The address of the message sender.
1841 %i The message thread structure.
1842 %l The number of lines of the message.
1843 %m Message number.
1844 %o The number of octets (bytes) in the message.
1845 %s Message subject (if any).
1846 %S Message subject (if any) in double quotes.
1847 %t The position in threaded/sorted order.
1848 %> A `>' for the current message, otherwise ` '.
1849 %< A `<' for the current message, otherwise ` '.
1850 %% A `%' character.
1851
1852 The default is `%>%a%m %18f %16d %4l/%-5o %i%s', or
1853 `%>%a%m %20f %16d %3l/%-5o %i%S' if bsdcompat is set.
1854
1855 hostname
1856 Use this string as hostname when expanding local addresses
1857 instead of the value obtained from uname(2) and getaddrinfo(3).
1858
1859 imap-auth
1860 Sets the IMAP authentication method. Valid values are `login'
1861 for the usual password-based authentication (the default),
1862 `cram-md5', which is a password-based authentication that does
1863 not send the password over the network in clear text, and `gss‐
1864 api' for GSSAPI-based authentication.
1865
1866 imap-auth-user@host
1867 Sets the IMAP authentication method for a specific account.
1868
1869 imap-cache
1870 Enables caching of IMAP mailboxes. The value of this variable
1871 must point to a directory that is either existent or can be cre‐
1872 ated by mailx. All contents of the cache can be deleted by
1873 mailx at any time; it is not safe to make assumptions about
1874 them.
1875
1876 imap-keepalive
1877 IMAP servers may close the connection after a period of inactiv‐
1878 ity; the standard requires this to be at least 30 minutes, but
1879 practical experience may vary. Setting this variable to a
1880 numeric value greater than 0 causes a NOOP command to be sent
1881 each value seconds if no other operation is performed.
1882
1883 imap-list-depth
1884 When retrieving the list of folders on an IMAP server, the fold‐
1885 ers command stops after it has reached a certain depth to avoid
1886 possible infinite loops. The value of this variable sets the
1887 maximum depth allowed. The default is 2. If the folder separa‐
1888 tor on the current IMAP server is a slash `/', this variable has
1889 no effect, and the folders command does not descend to subfold‐
1890 ers.
1891
1892 indentprefix
1893 String used by the `~m' and `~M' tilde escapes and by the quote
1894 option for indenting messages, in place of the normal tab char‐
1895 acter (^I). Be sure to quote the value if it contains spaces or
1896 tabs.
1897
1898 junkdb The location of the junk mail database. The string is treated
1899 like a folder name, as described for the folder command.
1900
1901 The files in the junk mail database are normally stored in com‐
1902 press(1) format for saving space. If processing time is consid‐
1903 ered more important, uncompress(1) can be used to store them in
1904 plain form. Mailx will then work using the uncompressed files.
1905
1906 LISTER Pathname of the directory lister to use in the folders command
1907 when operating on local mailboxes. Default is /bin/ls.
1908
1909 MAIL Is used as the user's mailbox, if set. Otherwise, a system-
1910 dependent default is used. Can be a protocol:// string (see the
1911 folder command for more information).
1912
1913 MAILX_HEAD
1914 A string to put at the beginning of each new message. The
1915 escape sequences `\t' (tabulator) and `\n' (newline) are under‐
1916 stood.
1917
1918 MAILX_TAIL
1919 A string to put at the end of each new message. The escape
1920 sequences `\t' (tabulator) and `\n' (newline) are understood.
1921
1922 maximum-unencoded-line-length
1923 Messages that contain lines longer than the value of this vari‐
1924 able are encoded in quoted-printable even if they contain only
1925 ASCII characters. The maximum effective value is 950. If set
1926 to 0, all ASCII text messages are encoded in quoted-printable.
1927 S/MIME signed messages are always encoded in quoted-printable
1928 regardless of the value of this variable.
1929
1930 MBOX The name of the mbox file. It can be the name of a folder. The
1931 default is `mbox' in the user's home directory.
1932
1933 NAIL_EXTRA_RC
1934 The name of an optional startup file to be read after ~/.mailrc.
1935 This variable is ignored if it is imported from the environment;
1936 it has an effect only if it is set in /etc/mail.rc or ~/.mailrc
1937 to allow bypassing the configuration with e. g.
1938 `MAILRC=/dev/null'. Use this file for commands that are not
1939 understood by other mailx implementations.
1940
1941 newfolders
1942 If this variable has the value maildir, newly created local
1943 folders will be in maildir format.
1944
1945 nss-config-dir
1946 A directory that contains the files certN.db to retrieve cer‐
1947 tificates, keyN.db to retrieve private keys, and secmod.db,
1948 where N is a digit. These are usually taken from Mozilla
1949 installations, so an appropriate value might be
1950 `~/.mozilla/firefox/default.clm'. Mailx opens these files read-
1951 only and does not modify them. However, if the files are modi‐
1952 fied by Mozilla while mailx is running, it will print a `Bad
1953 database' message. It may be necessary to create copies of
1954 these files that are exclusively used by mailx then. Only
1955 applicable if S/MIME and SSL/TLS support is built using Network
1956 Security Services (NSS).
1957
1958 ORGANIZATION
1959 The value to put into the `Organization:' field of the message
1960 header.
1961
1962 PAGER Pathname of the program to use in the more command or when crt
1963 variable is set. The default paginator pg(1) or, in BSD compat‐
1964 ibility mode, more(1) is used if this option is not defined.
1965
1966 password-user@host
1967 Set the password for user when connecting to host. If no such
1968 variable is defined for a host, the user will be asked for a
1969 password on standard input. Specifying passwords in a startup
1970 file is generally a security risk, the file should be readable
1971 by the invoking user only.
1972
1973 pipe-content/subcontent
1974 When a MIME message part of content/subcontent type is displayed
1975 or it is replied to, its text is filtered through the value of
1976 this variable interpreted as a shell command. Special care must
1977 be taken when using such commands as mail viruses may be dis‐
1978 tributed by this method; if messages of type application/x-sh
1979 were filtered through the shell, for example, a message sender
1980 could easily execute arbitrary code on the system mailx is run‐
1981 ning on.
1982
1983 pop3-keepalive
1984 POP3 servers may close the connection after a period of inactiv‐
1985 ity; the standard requires this to be at least 10 minutes, but
1986 practical experience may vary. Setting this variable to a
1987 numeric value greater than 0 causes a NOOP command to be sent
1988 each value seconds if no other operation is performed.
1989
1990 prompt The string printed when a command is accepted. Defaults to
1991 `? ', or to `& ' if the bsdcompat variable is set.
1992
1993 quote If set, mailx starts a replying message with the original mes‐
1994 sage prefixed by the value of the variable indentprefix. Nor‐
1995 mally, a heading consisting of `Fromheaderfield wrote:' is
1996 printed before the quotation. If the string noheading is
1997 assigned to the quote variable, this heading is omitted. If the
1998 string headers is assigned, the headers selected by the
1999 ignore/retain commands are printed above the message body, thus
2000 quote acts like an automatic ~m command then. If the string
2001 allheaders is assigned, all headers are printed above the mes‐
2002 sage body, and all MIME parts are included, thus quote acts like
2003 an automatic ~M command then.
2004
2005 record If defined, gives the pathname of the folder used to record all
2006 outgoing mail. If not defined, then outgoing mail is not so
2007 saved. When saving to this folder fails, the message is not
2008 sent but saved to the `dead.letter' file instead.
2009
2010 replyto
2011 A list of addresses to put into the `Reply-To:' field of the
2012 message header. If replying to a message, such addresses are
2013 handled as if they were in the alternates list.
2014
2015 screen When mailx initially prints the message headers, it determines
2016 the number to print by looking at the speed of the terminal.
2017 The faster the terminal, the more it prints. This option over‐
2018 rides this calculation and specifies how many message headers
2019 are printed. This number is also used for scrolling with the z
2020 command.
2021
2022 sendcharsets
2023 A comma-separated list of character set names that can be used
2024 in Internet mail. When a message that contains characters not
2025 representable in US-ASCII is prepared for sending, mailx tries
2026 to convert its text to each of the given character sets in order
2027 and uses the first appropriate one. The default is `utf-8'.
2028
2029 Character sets assigned to this variable should be ordered in
2030 ascending complexity. That is, the list should start with e.g.
2031 `iso-8859-1' for compatibility with older mail clients, might
2032 contain some other language-specific character sets, and should
2033 end with `utf-8' to handle messages that combine texts in multi‐
2034 ple languages.
2035
2036 sender An address that is put into the `Sender:' field of outgoing mes‐
2037 sages. This field needs not normally be present. It is, how‐
2038 ever, required if the `From:' field contains more than one
2039 address. It can also be used to indicate that a message was
2040 sent on behalf of somebody other; in this case, `From:' should
2041 contain the address of the person that took responsibility for
2042 the message, and `Sender:' should contain the address of the
2043 person that actually sent the message. The sender address is
2044 handled as if it were in the alternates list.
2045
2046 sendmail
2047 To use an alternate mail delivery system, set this option to the
2048 full pathname of the program to use. This should be used with
2049 care.
2050
2051 SHELL Pathname of the shell to use in the ! command and the ~! escape.
2052 A default shell is used if this option is not defined.
2053
2054
2055 Sign A string for use with the ~A command.
2056
2057 sign A string for use with the ~a command.
2058
2059 signature
2060 Must correspond to the name of a readable file if set.
2061 The file's content is then appended to each singlepart
2062 message and to the first part of each multipart message.
2063 Be warned that there is no possibility to edit the signa‐
2064 ture for an individual message.
2065
2066 smime-ca-dir
2067 Specifies a directory with CA certificates for verifica‐
2068 tion of S/MIME signed messages. The format is the same
2069 as described in SSL_CTX_load_verify_locations(3). Only
2070 applicable if S/MIME support is built using OpenSSL.
2071
2072 smime-ca-file
2073 Specifies a file with CA certificates for verification of
2074 S/MIME signed messages. The format is the same as
2075 described in SSL_CTX_load_verify_locations(3). Only
2076 applicable if S/MIME support is built using OpenSSL.
2077
2078 smime-cipher-user@host
2079 Specifies a cipher to use when generating S/MIME
2080 encrypted messages for user@host. Valid ciphers are
2081 rc2-40 (RC2 with 40 bits), rc2-64 (RC2 with 64 bits), des
2082 (DES, 56 bits) and des-ede3 (3DES, 112/168 bits). The
2083 default is 3DES. It is not recommended to use the other
2084 ciphers unless a recipient's client is actually unable to
2085 handle 3DES since they are comparatively weak; but even
2086 so, the recipient should upgrade his software in prefer‐
2087 ence.
2088
2089 smime-crl-file
2090 Specifies a file that contains a CRL in PEM format to use
2091 when verifying S/MIME messages. Only applicable if
2092 S/MIME support is built using OpenSSL.
2093
2094 smime-crl-dir
2095 Specifies a directory that contains files with CRLs in
2096 PEM format to use when verifying S/MIME messages. Only
2097 applicable if S/MIME support is built using OpenSSL.
2098
2099 smime-encrypt-user@host
2100 If this variable is set, messages to user@host are
2101 encrypted before sending. If S/MIME support is built
2102 using OpenSSL, the value of the variable must be set to
2103 the name of a file that contains a certificate in PEM
2104 format. If S/MIME support is built using NSS, the value
2105 of this variable is ignored, but if multiple certificates
2106 for user@host are available, the smime-nickname-user@host
2107 variable should be set. Otherwise a certificate for the
2108 recipient is automatically retrieved from the certificate
2109 database, if possible.
2110
2111 If a message is sent to multiple recipients, each of them
2112 for whom a corresponding variable is set will receive an
2113 individually encrypted message; other recipients will
2114 continue to receive the message in plain text unless the
2115 smime-force-encryption variable is set. It is recom‐
2116 mended to sign encrypted messages, i.e. to also set the
2117 smime-sign variable.
2118
2119 smime-nickname-user@host
2120 Specifies the nickname of a certificate to be used when
2121 encrypting messages for user@host . Only applicable if
2122 S/MIME support is built using NSS.
2123
2124 smime-sign-cert
2125 Points to a file in PEM format that contains the user's
2126 private key as well as his certificate. Both are used
2127 with S/MIME for signing and decrypting messages. Only
2128 applicable if S/MIME support is built using OpenSSL.
2129
2130 smime-sign-cert-user@host
2131 Overrides smime-sign-cert for the specific addresses.
2132 When signing messages and the value of the from variable
2133 is set to user@host, the specific file is used. When
2134 decrypting messages, their recipient fields (To: and Cc:)
2135 are searched for addresses for which such a variable is
2136 set. Mailx always uses the first address that matches,
2137 so if the same message is sent to more than one of the
2138 user's addresses using different encryption keys, decryp‐
2139 tion might fail. Only applicable if S/MIME support is
2140 built using OpenSSL.
2141
2142 smime-sign-nickname
2143 Specifies that the named certificate be used for signing
2144 mail. If this variable is not set, but a single certifi‐
2145 cate matching the current from address is found in the
2146 database, that one is used automatically. Only applica‐
2147 ble if S/MIME support is built using NSS.
2148
2149 smime-sign-nickname-user@host
2150 Overrides smime-sign-nickname for a specific address.
2151 Only applicable if S/MIME support is built using NSS.
2152
2153 smtp Normally, mailx invokes sendmail(8) directly to transfer
2154 messages. If the smtp variable is set, a SMTP connection
2155 to the server specified by the value of this variable is
2156 used instead. If the SMTP server does not use the stan‐
2157 dard port, a value of server:port can be given, with port
2158 as a name or as a number.
2159
2160 There are two possible methods to get SSL/TLS encrypted
2161 SMTP sessions: First, the STARTTLS command can be used to
2162 encrypt a session after it has been initiated, but before
2163 any user-related data has been sent; see
2164 smtp-use-starttls above. Second, some servers accept
2165 sessions that are encrypted from their beginning on. This
2166 mode is configured by assigning smtps://server[:port] to
2167 the smtp variable.
2168
2169 The SMTP transfer is executed in a child process; unless
2170 either the sendwait or the verbose variable is set, this
2171 process runs asynchronously. If it receives a TERM sig‐
2172 nal, it will abort and save the message to the `dead.let‐
2173 ter' file.
2174
2175 smtp-auth
2176 Sets the SMTP authentication method. If set to `login',
2177 or if unset and smtp-auth-user is set, AUTH LOGIN is
2178 used. If set to `cram-md5', AUTH CRAM-MD5 is used; if
2179 set to `plain', AUTH PLAIN is used. Otherwise, no SMTP
2180 authentication is performed.
2181
2182 smtp-auth-user@host
2183 Overrides smtp-auth for specific values of sender
2184 addresses, depending on the from variable.
2185
2186 smtp-auth-password
2187 Sets the global password for SMTP AUTH. Both user and
2188 password have to be given for AUTH LOGIN and AUTH CRAM-
2189 MD5.
2190
2191 smtp-auth-password-user@host
2192 Overrides smtp-auth-password for specific values of
2193 sender addresses, depending on the from variable.
2194
2195 smtp-auth-user
2196 Sets the global user name for SMTP AUTH. Both user and
2197 password have to be given for AUTH LOGIN and AUTH CRAM-
2198 MD5.
2199
2200 If this variable is set but neither smtp-auth-password or
2201 a matching smtp-auth-password-user@host can be found,
2202 mailx will as for a password on the user's terminal.
2203
2204 smtp-auth-user-user@host
2205 Overrides smtp-auth-user for specific values of sender
2206 addresses, depending on the from variable.
2207
2208 ssl-ca-dir
2209 Specifies a directory with CA certificates for verifica‐
2210 tion of SSL/TLS server certificates. See
2211 SSL_CTX_load_verify_locations(3) for more information.
2212 Only applicable if SSL/TLS support is built using
2213 OpenSSL.
2214
2215 ssl-ca-file
2216 Specifies a file with CA certificates for verification of
2217 SSL/TLS server certificates. See SSL_CTX_load_ver‐
2218 ify_locations(3) for more information. Only applicable
2219 if SSL/TLS support is built using OpenSSL.
2220
2221 ssl-cert
2222 Sets the file name for a SSL/TLS client certificate
2223 required by some servers. Only applicable if SSL/TLS
2224 support is built using OpenSSL.
2225
2226 ssl-cert-user@host
2227 Sets an account-specific file name for a SSL/TLS client
2228 certificate required by some servers. Overrides ssl-cert
2229 for the specified account. Only applicable if SSL/TLS
2230 support is built using OpenSSL.
2231
2232 ssl-cipher-list
2233 Specifies a list of ciphers for SSL/TLS connections. See
2234 ciphers(1) for more information. Only applicable if
2235 SSL/TLS support is built using OpenSSL.
2236
2237 ssl-crl-file
2238 Specifies a file that contains a CRL in PEM format to use
2239 when verifying SSL/TLS server certificates. Only appli‐
2240 cable if SSL/TLS support is built using OpenSSL.
2241
2242 ssl-crl-dir
2243 Specifies a directory that contains files with CRLs in
2244 PEM format to use when verifying SSL/TLS server certifi‐
2245 cates. Only applicable if SSL/TLS support is built using
2246 OpenSSL.
2247
2248 ssl-key
2249 Sets the file name for the private key of a SSL/TLS
2250 client certificate. If unset, the name of the certifi‐
2251 cate file is used. The file is expected to be in PEM
2252 format. Only applicable if SSL/TLS support is built
2253 using OpenSSL.
2254
2255 ssl-key-user@host
2256 Sets an account-specific file name for the private key of
2257 a SSL/TLS client certificate. Overrides ssl-key for the
2258 specified account. Only applicable if SSL/TLS support is
2259 built using OpenSSL.
2260
2261 ssl-method
2262 Selects a SSL/TLS protocol version; valid values are
2263 `ssl2', `ssl3', and `tls1'. If unset, the method is
2264 selected automatically, if possible.
2265
2266 ssl-method-user@host
2267 Overrides ssl-method for a specific account.
2268
2269 ssl-rand-egd
2270 Gives the pathname to an entropy daemon socket, see
2271 RAND_egd(3).
2272
2273 ssl-rand-file
2274 Gives the pathname to a file with entropy data, see
2275 RAND_load_file(3). If the file is a regular file
2276 writable by the invoking user, new data is written to it
2277 after it has been loaded. Only applicable if SSL/TLS
2278 support is built using OpenSSL.
2279
2280 ssl-verify
2281 Sets the action to be performed if an error occurs during
2282 SSL/TLS server certificate validation. Valid values are
2283 `strict' (fail and close connection immediately), `ask'
2284 (ask whether to continue on standard input), `warn'
2285 (print a warning and continue), `ignore' (do not perform
2286 validation). The default is `ask'.
2287
2288 ssl-verify-user@host
2289 Overrides ssl-verify for a specific account.
2290
2291 toplines
2292 If defined, gives the number of lines of a message to be
2293 printed out with the top command; normally, the first
2294 five lines are printed.
2295
2296 ttycharset
2297 The character set of the terminal mailx operates on.
2298 There is normally no need to set this variable since
2299 mailx can determine this automatically by looking at the
2300 LC_CTYPE locale setting; if this succeeds, the value is
2301 assigned at startup and will be displayed by the set com‐
2302 mand. Note that this is not necessarily a character set
2303 name that can be used in Internet messages.
2304
2305 VISUAL Pathname of the text editor to use in the visual command
2306 and ~v escape.
2307
2309 Besides the variables described above, mailx uses the following
2310 environment strings:
2311
2312 HOME The user's home directory.
2313
2314 LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES
2315 See locale(7).
2316
2317 MAILRC Is used as startup file instead of ~/.mailrc if set.
2318 When mailx scripts are invoked on behalf of other users,
2319 this variable should be set to `/dev/null' to avoid side-
2320 effects from reading their configuration files.
2321
2322 NAILRC If this variable is set and MAILRC is not set, it is read
2323 as startup file.
2324
2325 SYSV3 Changes the letters printed in the first column of a
2326 header summary.
2327
2328 TMPDIR Used as directory for temporary files instead of /tmp, if
2329 set.
2330
2332 ~/.mailrc
2333 File giving initial commands.
2334
2335 /etc/mail.rc
2336 System wide initialization file.
2337
2338 ~/.mime.types
2339 Personal MIME types.
2340
2341 /etc/mime.types
2342 System wide MIME types.
2343
2345 Getting started
2346 The mailx command has two distinct usages, according to whether
2347 one wants to send or receive mail. Sending mail is simple: to
2348 send a message to a user whose email address is, say,
2349 <bill@host.example>, use the shell command:
2350
2351 $ mailx bill@host.example
2352
2353 then type your message. Mailx will prompt you for a message
2354 subject first; after that, lines typed by you form the body of
2355 the message. When you reach the end of the message, type an EOT
2356 (control-d) at the beginning of a line, which will cause mailx
2357 to echo `EOT' and return you to the shell.
2358
2359 If, while you are composing the message you decide that you do
2360 not wish to send it after all, you can abort the letter with a
2361 RUBOUT. Typing a single RUBOUT causes mailx to print `(Inter‐
2362 rupt -- one more to kill letter)'. Typing a second RUBOUT
2363 causes mailx to save your partial letter on the file `dead.let‐
2364 ter' in your home directory and abort the letter. Once you have
2365 sent mail to someone, there is no way to undo the act, so be
2366 careful.
2367
2368 If you want to send the same message to several other people,
2369 you can list their email addresses on the command line. Thus,
2370
2371 $ mailx sam@workstation.example bob@server.example
2372 Subject: Fees
2373 Tuition fees are due next Friday. Don't forget!
2374 <Control-d>
2375 EOT
2376 $
2377
2378 will send the reminder to <sam@workstation.example>. and
2379 <bob@server.example>.
2380
2381 To read your mail, simply type
2382
2383 $ mailx
2384
2385 Mailx will respond by typing its version number and date and
2386 then listing the messages you have waiting. Then it will type a
2387 prompt and await your command. The messages are assigned num‐
2388 bers starting with 1—you refer to the messages with these num‐
2389 bers. Mailx keeps track of which messages are new (have been
2390 sent since you last read your mail) and read (have been read by
2391 you). New messages have an N next to them in the header listing
2392 and old, but unread messages have a U next to them. Mailx keeps
2393 track of new/old and read/unread messages by putting a header
2394 field called Status into your messages.
2395
2396 To look at a specific message, use the type command, which may
2397 be abbreviated to simply t . For example, if you had the fol‐
2398 lowing messages:
2399
2400 O 1 drfoo@myhost.example Wed Sep 1 19:52 18/631 "Fees"
2401 O 2 sam@friends.example Thu Sep 2 00:08 30/895
2402
2403 you could examine the first message by giving the command:
2404
2405 type 1
2406
2407 which might cause mailx to respond with, for example:
2408
2409 Message 1:
2410 From drfoo@myhost.example Wed Sep 1 19:52:25 2004
2411 Subject: Fees
2412 Status: R
2413
2414 Tuition fees are due next Wednesday. Don't forget!
2415
2416
2417 Many mailx commands that operate on messages take a message num‐
2418 ber as an argument like the type command. For these commands,
2419 there is a notion of a current message. When you enter the
2420 mailx program, the current message is initially the first (or
2421 the first recent) one. Thus, you can often omit the message
2422 number and use, for example,
2423
2424 t
2425
2426 to type the current message. As a further shorthand, you can
2427 type a message by simply giving its message number. Hence,
2428
2429 1
2430
2431 would type the first message.
2432
2433 Frequently, it is useful to read the messages in your mailbox in
2434 order, one after another. You can read the next message in
2435 mailx by simply typing a newline. As a special case, you can
2436 type a newline as your first command to mailx to type the first
2437 message.
2438
2439 If, after typing a message, you wish to immediately send a
2440 reply, you can do so with the reply command. This command, like
2441 type, takes a message number as an argument. mailx then begins
2442 a message addressed to the user who sent you the message. You
2443 may then type in your letter in reply, followed by a <control-d>
2444 at the beginning of a line, as before.
2445
2446 Note that mailx copies the subject header from the original mes‐
2447 sage. This is useful in that correspondence about a particular
2448 matter will tend to retain the same subject heading, making it
2449 easy to recognize. If there are other header fields in the mes‐
2450 sage, like `Cc:', the information found will also be used.
2451
2452 Sometimes you will receive a message that has been sent to sev‐
2453 eral people and wish to reply only to the person who sent it.
2454 Reply with a capital R replies to a message, but sends a copy to
2455 the sender only.
2456
2457 If you wish, while reading your mail, to send a message to some‐
2458 one, but not as a reply to one of your messages, you can send
2459 the message directly with the mail command, which takes as argu‐
2460 ments the names of the recipients you wish to send to. For
2461 example, to send a message to <frank@machine.example>, you would
2462 do:
2463
2464 mail frank@machine.example
2465
2466 To delete a message from the mail folder, you can use the delete
2467 command. In addition to not saving deleted messages, mailx will
2468 not let you type them, either. The effect is to make the mes‐
2469 sage disappear altogether, along with its number.
2470
2471 Many features of mailx can be tailored to your liking with the
2472 set command. The set command has two forms, depending on
2473 whether you are setting a binary option or a valued option.
2474 Binary options are either on or off. For example, the askcc
2475 option informs mailx that each time you send a message, you want
2476 it to prompt you for a `Cc:' header, to be included in the mes‐
2477 sage. To set the askcc option, you would type
2478
2479 set askcc
2480
2481 Valued options are values which mailx uses to adapt to your
2482 tastes. For example, the record option tells mailx where to
2483 save messages sent by you, and is specified by
2484
2485 set record=Sent
2486
2487 for example. Note that no spaces are allowed in set record=Sent
2488 .
2489
2490 Mailx includes a simple facility for maintaining groups of mes‐
2491 sages together in folders. To use the folder facility, you must
2492 tell mailx where you wish to keep your folders. Each folder of
2493 messages will be a single file. For convenience, all of your
2494 folders are kept in a single directory of your choosing. To
2495 tell mailx where your folder directory is, put a line of the
2496 form
2497
2498 set folder=letters
2499
2500 in your .mailrc file. If, as in the example above, your folder
2501 directory does not begin with a `/', mailx will assume that your
2502 folder directory is to be found starting from your home direc‐
2503 tory.
2504
2505 Anywhere a file name is expected, you can use a folder name,
2506 preceded with `+'. For example, to put a message into a folder
2507 with the save command, you can use:
2508
2509 save +classwork
2510
2511 to save the current message in the classwork folder. If the
2512 classwork folder does not yet exist, it will be created. Note
2513 that messages which are saved with the save command are automat‐
2514 ically removed from your system mailbox.
2515
2516 In order to make a copy of a message in a folder without causing
2517 that message to be removed from your system mailbox, use the
2518 copy command, which is identical in all other respects to the
2519 save command.
2520
2521 The folder command can be used to direct mailx to the contents
2522 of a different folder. For example,
2523
2524 folder +classwork
2525
2526 directs mailx to read the contents of the classwork folder. All
2527 of the commands that you can use on your system mailbox are also
2528 applicable to folders, including type, delete, and reply. To
2529 inquire which folder you are currently editing, use simply:
2530
2531 folder
2532
2533 To list your current set of folders, use the folders command.
2534
2535 Finally, the help command is available to print out a brief sum‐
2536 mary of the most important mailx commands.
2537
2538 While typing in a message to be sent to others, it is often use‐
2539 ful to be able to invoke the text editor on the partial message,
2540 print the message, execute a shell command, or do some other
2541 auxiliary function. Mailx provides these capabilities through
2542 tilde escapes , which consist of a tilde (~) at the beginning of
2543 a line, followed by a single character which indicates the func‐
2544 tion to be performed. For example, to print the text of the
2545 message so far, use:
2546
2547 ~p
2548
2549 which will print a line of dashes, the recipients of your mes‐
2550 sage, and the text of the message so far. A list of the most
2551 important tilde escapes is available with `~?'.
2552
2553 IMAP or POP3 client setup
2554 First you need the following data from your ISP: the host name
2555 of the IMAP or POP3 server, user name and password for this
2556 server, and a notice whether the server uses SSL/TLS encryption.
2557 Assuming the host name is `server.myisp.example' and your user
2558 name for that server is `mylogin', you can refer to this account
2559 using the folder command or -f command line option with
2560
2561 imaps://mylogin@server.myisp.example
2562
2563 (This string is not necessarily the same as your Internet mail
2564 address.) You can replace `imaps://' with `imap://' if the
2565 server does not support SSL/TLS. (If SSL/TLS support is built
2566 using NSS, the nss-config-dir variable must be set before a con‐
2567 nection can be initiated, see above). Use `pop3s://' or
2568 `pop3://' if the server does not offer IMAP. You should use
2569 IMAP if you can, though; first because it requires fewer network
2570 operations than POP3 to get the contents of the mailbox and is
2571 thus faster; and second because message attributes are main‐
2572 tained by the IMAP server, so you can easily distinguish new and
2573 old messages each time you connect. Even if the server does not
2574 accept IMAPS or POP3S connections, it is possible that it sup‐
2575 ports the STARTTLS method to make a session SSL/TLS encrypted
2576 after the initial connection has been performed, but before
2577 authentication begins. The only reliable method to see if this
2578 works is to try it; enter one of
2579
2580 set imap-use-starttls
2581 set pop3-use-starttls
2582
2583 before you initiate the connection.
2584
2585 As you probably want messages to be deleted from this account
2586 after saving them, prefix it with `%:'. The shortcut command
2587 can be used to avoid typing that many characters every time you
2588 want to connect:
2589
2590 shortcut myisp %:imaps://mylogin@server.myisp.example
2591
2592 You might want to put this string into a startup file. As the
2593 shortcut command is specific to this implementation of mailx and
2594 will confuse other implementations, it should not be used in
2595 ~/.mailrc, instead, put
2596
2597 set NAIL_EXTRA_RC=~/.nailrc
2598
2599 in ~/.mailrc and create a file ~/.nailrc containing the shortcut
2600 command above. You can then access your remote mailbox by
2601 invoking `mailx -f myisp' on the command line, or by executing
2602 `fi myisp' within mailx.
2603
2604 If you want to use more than one IMAP mailbox on a server, or if
2605 you want to use the IMAP server for mail storage too, the
2606 account command (which is also mailx-specific) is more appropri‐
2607 ate than the shortcut command. You can put the following in
2608 ~/.nailrc:
2609
2610 account myisp {
2611 set folder=imaps://mylogin@server.myisp.example
2612 set record=+Sent MBOX=+mbox outfolder
2613 }
2614
2615 and can then access incoming mail for this account by invoking
2616 `mailx -A myisp' on the command line, or by executing `ac myisp'
2617 within mailx. After that, a command like `copy 1 +otherfolder'
2618 will refer to otherfolder on the IMAP server. In particular,
2619 `fi &' will change to the mbox folder, and `fi +Sent' will show
2620 your recorded sent mail, with both folders located on the IMAP
2621 server.
2622
2623 Mailx will ask you for a password string each time you connect
2624 to a remote account. If you can reasonably trust the security
2625 of your workstation, you can give this password in the startup
2626 file as
2627
2628 set password-mylogin@server.myisp.example="SECRET"
2629
2630 You should change the permissions of this file to 0600, see
2631 chmod(1).
2632
2633 Mailx supports different authentication methods for both IMAP
2634 and POP3. If Kerberos is used at your location, you can try to
2635 activate GSSAPI-based authentication by
2636
2637 set imap-auth=gssapi
2638
2639 The advantage of this method is that mailx does not need to know
2640 your password at all, nor needs to send sensitive data over the
2641 network. Otherwise, the options
2642
2643 set imap-auth=cram-md5
2644 set pop3-use-apop
2645
2646 for IMAP and POP3, respectively, offer authentication methods
2647 that avoid to send the password in clear text over the network,
2648 which is especially important if SSL/TLS cannot be used. If the
2649 server does not offer any of these authentication methods, con‐
2650 ventional user/password based authentication must be used. It
2651 is sometimes helpful to set the verbose option when authentica‐
2652 tion problems occur. Mailx will display all data sent to the
2653 server in clear text on the screen with this option, including
2654 passwords. You should thus take care that no unauthorized per‐
2655 son can look at your terminal when this option is set.
2656
2657 If you regularly use the same workstation to access IMAP
2658 accounts, you can greatly enhance performance by enabling local
2659 caching of IMAP messages. For any message that has been fully
2660 or partially fetched from the server, a local copy is made and
2661 is used when the message is accessed again, so most data is
2662 transferred over the network once only. To enable the IMAP
2663 cache, select a local directory name and put
2664
2665 set imap-cache=~/localdirectory
2666
2667 in the startup file. All files within that directory can be
2668 overwritten or deleted by mailx at any time, so you should not
2669 use the directory to store other information.
2670
2671 Once the cache contains some messages, it is not strictly neces‐
2672 sary anymore to open a connection to the IMAP server to access
2673 them. When mailx is invoked with the -D option, or when the
2674 disconnected variable is set, only cached data is used for any
2675 folder you open. Messages that have not yet been completely
2676 cached are not available then, but all other messages can be
2677 handled as usual. Changes made to IMAP mailboxes in discon‐
2678 nected mode are committed to the IMAP server next time it is
2679 used in online mode. Synchronizing the local status with the
2680 status on the server is thus partially within your responsibil‐
2681 ity; if you forget to initiate a connection to the server again
2682 before you leave your location, changes made on one workstation
2683 are not available on others. Also if you alter IMAP mailboxes
2684 from a workstation while uncommitted changes are still pending
2685 on another, the latter data may become invalid. The same might
2686 also happen because of internal server status changes. You
2687 should thus carefully evaluate this feature in your environment
2688 before you rely on it.
2689
2690 Many servers will close the connection after a short period of
2691 inactivity. Use one of
2692
2693 set pop3-keepalive=30
2694 set imap-keepalive=240
2695
2696 to send a keepalive message each 30 seconds for POP3, or each 4
2697 minutes for IMAP.
2698
2699 If you encounter problems connecting to a SSL/TLS server, try
2700 the ssl-rand-egd and ssl-rand-file variables (see the OpenSSL
2701 FAQ for more information) or specify the protocol version with
2702 ssl-method. Contact your ISP if you need a client certificate
2703 or if verification of the server certificate fails. If the
2704 failed certificate is indeed valid, fetch its CA certificate by
2705 executing the shell command
2706
2707 $ openssl s_client </dev/null -showcerts -connect \
2708 server.myisp.example:imaps 2>&1 | tee log
2709
2710 (see s_client(1)) and put it into the file specified with ssl-
2711 ca-file. The data you need is located at the end of the cer‐
2712 tificate chain within (and including) the `BEGIN CERTIFICATE'
2713 and `END CERTIFICATE' lines. (Note that it is possible to fetch
2714 a forged certificate by this method. You can only completely
2715 rely on the authenticity of the CA certificate if you fetch it
2716 in a way that is trusted by other means, such as by personally
2717 receiving the certificate on storage media.)
2718
2719 Creating a score file or message filter
2720 The scoring commands are best separated from other configuration
2721 for clarity, and are mostly mailx specific. It is thus recom‐
2722 mended to put them in a separate file that is sourced from your
2723 NAIL_EXTRA_RC as follows:
2724
2725 source ~/.scores
2726
2727 The .scores file could then look as follows:
2728
2729 define list {
2730 score (subject "important discussion") +10
2731 score (subject "annoying discussion") -10
2732 score (from "nicefellow@goodnet") +15
2733 score (from "badguy@poornet") -5
2734 move (header x-spam-flag "+++++") +junk
2735 }
2736 set folder-hook-imap://user@host/public.list=list
2737
2738 In this scheme, you would see any mail from `nicefellow@good‐
2739 net', even if the surrounding discussion is annoying; but you
2740 normally would not see mail from `badguy@poornet', unless he
2741 participates in the important discussion. Messages that are
2742 marked with five or more plus characters in their `X-Spam-Flag'
2743 field (inserted by some server-side filtering software) are
2744 moved to the folder `junk' in the folder directory.
2745
2746 Be aware that all criteria in () lead to substring matches, so
2747 you would also score messages from e.g. `notsobadguy@poornetmak‐
2748 ers' negative here. It is possible to select addresses exactly
2749 using "address" message specifications, but these cannot be exe‐
2750 cuted remotely and will thus cause all headers to be downloaded
2751 from IMAP servers while looking for matches.
2752
2753 When searching messages on an IMAP server, best performance is
2754 usually achieved by sending as many criteria as possible in one
2755 large () specification, because each single such specification
2756 will result in a separate network operation.
2757
2758 Activating the Bayesian filter
2759 The Bayesian junk mail filter works by examining the words con‐
2760 tained in messages. You decide yourself what a good and what a
2761 bad message is. Thus the resulting filter is your very personal
2762 one; once it is correctly set up, it will filter only messages
2763 similar to those previously specified by you.
2764
2765 To use the Bayesian filter, a location for the junk mail data‐
2766 base must be defined first:
2767
2768 set junkdb=~/.junkdb
2769
2770 The junk mail database does not contain actual words extracted
2771 from messages, but hashed representations of them. A foreign
2772 person who can read the database could only examine the fre‐
2773 quency of previously known words in your mail.
2774
2775 If you have sufficient disk space (several 10 MB) available, it
2776 is recommended that you set the chained-junk-tokens option. The
2777 filter will then also consider two-word tokens, improving its
2778 accuracy.
2779
2780 A set of good messages and junk messages must now be available;
2781 it is also possible to use the incoming new messages for this
2782 purpose, although it will of course take some time until the
2783 filter becomes useful then. Do not underestimate the amount of
2784 statistical data needed; some hundred messages are typically
2785 necessary to get satisfactory results, and many thousand mes‐
2786 sages for best operation. You have to pass the good messages to
2787 the good command, and the junk messages to the junk command. If
2788 you ever accidentally mark a good message as junk or vice-versa,
2789 call the ungood or unjunk command to correct this.
2790
2791 Once a reasonable amount of statistics has been collected, new
2792 messages can be classified automatically. The classify command
2793 marks all messages that the filter considers to be junk, but it
2794 does not perform any action on them by default. It is recom‐
2795 mended that you move these messages into a separate folder just
2796 for the case that false positives occur, or to pass them to the
2797 junk command later again to further improve the junk mail data‐
2798 base. To automatically move incoming junk messages every time
2799 the inbox is opened, put lines like the following into your
2800 .scores file (or whatever name you gave to the file in the last
2801 example):
2802
2803 define junkfilter {
2804 classify (smaller 20000) :n
2805 move :j +junk
2806 }
2807 set folder-hook-imap://user@host/INBOX=junkfilter
2808
2809 If you set the verbose option before running the classify com‐
2810 mand, mailx prints the words it uses for calculating the junk
2811 status along with their statistical probabilities. This can
2812 help you to find out why some messages are not classified as you
2813 would like them to be. To see the statistical probability of a
2814 given word, use the probability command.
2815
2816 If a junk message was not recognized as such, use the junk com‐
2817 mand to correct this. Also if you encounter a false positive (a
2818 good message that was wrongly classified as junk), pass it to
2819 the good command.
2820
2821 Since the classify command must examine the entire text of all
2822 new messages in the respective folder, this will also cause all
2823 of them to be downloaded from the IMAP server. You should thus
2824 restrict the size of messages for automatic filtering. If
2825 server-based filtering is also available, you might try if that
2826 works for you first.
2827
2828 Reading HTML mail
2829 You need either the w3m or lynx utility or another command-line
2830 web browser that can write plain text to standard output.
2831
2832 set pipe-text/html="w3m -dump -T text/html"
2833
2834 or
2835
2836 set pipe-text/html="lynx -dump -force_html /dev/stdin"
2837
2838 will then cause HTML message parts to be converted into a more
2839 friendly form.
2840
2841 Viewing PDF attachments
2842 Most PDF viewers do not accept input directly from a pipe. It
2843 is thus necessary to store the attachment in a temporary file,
2844 as with
2845
2846 set pipe-application/pdf="cat >/tmp/mailx$$.pdf; \
2847 acroread /tmp/mailx$$.pdf; rm /tmp/mailx$$.pdf"
2848
2849 Note that security defects are discovered in PDF viewers from
2850 time to time. Automatical command execution like this can com‐
2851 promise your system security, in particular if you stay not
2852 always informed about such issues.
2853
2854 Signed and encrypted messages with S/MIME
2855 S/MIME provides two central mechanisms: message signing and mes‐
2856 sage encryption. A signed message contains some data in addi‐
2857 tion to the regular text. The data can be used to verify that
2858 the message was sent using a valid certificate, that the
2859 sender's address in the message header matches that in the cer‐
2860 tificate, and that the message text has not been altered. Sign‐
2861 ing a message does not change its regular text; it can be read
2862 regardless of whether the recipient's software is able to handle
2863 S/MIME. It is thus usually possible to sign all outgoing mes‐
2864 sages if so desired.—Encryption, in contrast, makes the message
2865 text invisible for all people except those who have access to
2866 the secret decryption key. To encrypt a message, the specific
2867 recipient's public encryption key must be known. It is thus not
2868 possible to send encrypted mail to people unless their key has
2869 been retrieved from either previous communication or public key
2870 directories. A message should always be signed before it is
2871 encrypted. Otherwise, it is still possible that the encrypted
2872 message text is altered.
2873
2874 A central concept to S/MIME is that of the certification author‐
2875 ity (CA). A CA is a trusted institution that issues certifi‐
2876 cates. For each of these certificates, it can be verified that
2877 it really originates from the CA, provided that the CA's own
2878 certificate is previously known. A set of CA certificates is
2879 usually delivered with OpenSSL and installed on your system. If
2880 you trust the source of your OpenSSL software installation, this
2881 offers reasonable security for S/MIME on the Internet. In gen‐
2882 eral, a certificate cannot be more secure than the method its CA
2883 certificate has been retrieved with, though. Thus if you down‐
2884 load a CA certificate from the Internet, you can only trust the
2885 messages you verify using that certificate as much as you trust
2886 the download process.
2887
2888 The first thing you need for participating in S/MIME message
2889 exchange is your personal certificate, including a private key.
2890 The certificate contains public information, in particular your
2891 name and your email address, and the public key that is used by
2892 others to encrypt messages for you, and to verify signed mes‐
2893 sages they supposedly received from you. The certificate is
2894 included in each signed message you send. The private key must
2895 be kept secret. It is used to decrypt messages that were previ‐
2896 ously encrypted with your public key, and to sign messages.
2897
2898 For personal use, it is recommended that you get a S/MIME cer‐
2899 tificate from one of the major CAs on the Internet using your
2900 WWW browser. (Many CAs offer such certificates for free.) You
2901 will usually receive a combined certificate and private key in
2902 PKCS#12 format which mailx does not directly accept if S/MIME
2903 support is built using OpenSSL. To convert it to PEM format,
2904 use the following shell command:
2905
2906 $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts \
2907 -nodes
2908
2909 If you omit the -nodes parameter, you can specifiy an additional
2910 PEM pass phrase for protecting the private key. Mailx will then
2911 ask you for that pass phrase each time it signs or decrypts a
2912 message. You can then use
2913
2914 set smime-sign-cert-myname@myisp.example=cert.pem
2915
2916 to make this private key and certificate known to mailx.
2917
2918 If S/MIME support is built using NSS, the PKCS#12 file must be
2919 installed using Mozilla (provided that nss-config-dir is set
2920 appropriately, see above), and no further action is necessary
2921 unless multiple user certificates for the same email address are
2922 installed. In this case, the smime-sign-nickname variable has
2923 to be set appropriately.
2924
2925 You can now sign outgoing messages. Just use
2926
2927 set smime-sign
2928
2929 to do so.
2930
2931 From each signed message you send, the recipient can fetch your
2932 certificate and use it to send encrypted mail back to you.
2933 Accordingly if somebody sends you a signed message, you can do
2934 the same. First use the verify command to check the validity of
2935 the certificate. After that, retrieve the certificate and tell
2936 mailx that it should use it for encryption:
2937
2938 certsave filename
2939 set smime-encrypt-user@host=filename
2940
2941 If S/MIME support is built using NSS, the saved certificate must
2942 be installed using Mozilla. The value of the smime-encrypt-
2943 user@host is ignored then, but if multiple certificates for the
2944 recipient are available, the smime-nickname-user@host variable
2945 must be set.
2946
2947 You should carefully consider if you prefer to store encrypted
2948 messages in decrypted form. If you do, anybody who has access
2949 to your mail folders can read them, but if you do not, you might
2950 be unable to read them yourself later if you happen to lose your
2951 private key. The decrypt command saves messages in decrypted
2952 form, while the save, copy, and move commands leave them
2953 encrypted.
2954
2955 Note that neither S/MIME signing nor encryption applies to mes‐
2956 sage subjects or other header fields. Thus they may not contain
2957 sensitive information for encrypted messages, and cannot be
2958 trusted even if the message content has been verified. When
2959 sending signed messages, it is recommended to repeat any impor‐
2960 tant header information in the message text.
2961
2962 Using CRLs with S/MIME or SSL/TLS
2963 Certification authorities (CAs) issue certificate revocation
2964 lists (CRLs) on a regular basis. These lists contain the serial
2965 numbers of certificates that have been declared invalid after
2966 they have been issued. Such usually happens because the private
2967 key for the certificate has been compromised, because the owner
2968 of the certificate has left the organization that is mentioned
2969 in the certificate, etc. To seriously use S/MIME or SSL/TLS
2970 verification, an up-to-date CRL is required for each trusted CA.
2971 There is otherwise no method to distinguish between valid and
2972 invalidated certificates. Mailx currently offers no mechanism
2973 to fetch CRLs, or to access them on the Internet, so you have to
2974 retrieve them by some external mechanism.
2975
2976 If S/MIME and SSL/TLS support are built using OpenSSL, mailx
2977 accepts CRLs in PEM format only; CRLs in DER format must be con‐
2978 verted, e.g. with the shell command
2979
2980 $ openssl crl -inform DER -in crl.der -out crl.pem
2981
2982 To tell mailx about the CRLs, a directory that contains all CRL
2983 files (and no other files) must be created. The smime-crl-dir
2984 or ssl-crl-dir variables, respectively, must then be set to
2985 point to that directory. After that, mailx requires a CRL to be
2986 present for each CA that is used to verify a certificate.
2987
2988 If S/MIME and SSL/TLS support are built using NSS, CRLs can be
2989 imported in Mozilla applications (provided that nss-config-dir
2990 is set appropriately).
2991
2992 Sending mail from scripts
2993 If you want to send mail from scripts, you must be aware that
2994 mailx reads the user's configuration files by default. So
2995 unless your script is only intended for your own personal use
2996 (as e.g. a cron job), you need to circumvent this by invoking
2997 mailx like
2998
2999 MAILRC=/dev/null mailx -n
3000
3001 You then need to create a configuration for mailx for your
3002 script. This can be done by either pointing the MAILRC variable
3003 to a custom configuration file, or by passing the configuration
3004 in environment variables. Since many of the configuration
3005 options are not valid shell variables, the env command is useful
3006 in this situation. An invocation could thus look like
3007
3008 env MAILRC=/dev/null from=scriptreply@domain smtp=host \
3009 smtp-auth-user=login smtp-auth-password=secret \
3010 smtp-auth=login mailx -n -s "subject" \
3011 -a attachment_file recipient@domain <content_file
3012
3014 fmt(1), newaliases(1), openssl(1), pg(1), more(1), vacation(1),
3015 ssl(3), aliases(5), locale(7), mailaddr(7), sendmail(8)
3016
3018 Variables in the environment passed to mailx cannot be unset.
3019
3020 The character set conversion relies on the iconv(3) function.
3021 Its functionality differs widely between the various system
3022 environments mailx runs on. If the message `Cannot convert from
3023 a to b' appears, either some characters within the message
3024 header or text are not appropriate for the currently selected
3025 terminal character set, or the needed conversion is not sup‐
3026 ported by the system. In the first case, it is necessary to set
3027 an appropriate LC_CTYPE locale (e.g. en_US) or the ttycharset
3028 variable. In the second case, the sendcharsets and ttycharset
3029 variables must be set to the same value to inhibit character set
3030 conversion. If iconv() is not available at all, the value
3031 assigned to sendcharsets must match the character set that is
3032 used on the terminal.
3033
3034 Mailx expects input text to be in Unix format, with lines sepa‐
3035 rated by newline (^J, \n) characters only. Non-Unix text files
3036 that use carriage return (^M, \r) characters in addition will be
3037 treated as binary data; to send such files as text, strip these
3038 characters e. g. by
3039
3040 tr -d '\015' <input | mailx . . .
3041
3042 or fix the tools that generate them.
3043
3044 Limitations with IMAP mailboxes are: It is not possible to edit
3045 messages, but it is possible to append them. Thus to edit a
3046 message, create a local copy of it, edit it, append it, and
3047 delete the original. The line count for the header display is
3048 only appropriate if the entire message has been downloaded from
3049 the server. The marking of messages as `new' is performed by
3050 the IMAP server; use of the exit command instead of quit will
3051 not cause it to be reset, and if the autoinc/newmail variables
3052 are unset, messages that arrived during a session will not be in
3053 state `new' anymore when the folder is opened again. Also if
3054 commands queued in disconnected mode are committed, the IMAP
3055 server will delete the `new' flag for all messages in the
3056 changed folder, and new messages will appear as unread when it
3057 is selected for viewing later. The `flagged', `answered', and
3058 `draft' attributes are usually permanent, but some IMAP servers
3059 are known to drop them without notification. Message numbers
3060 may change with IMAP every time before the prompt is printed if
3061 mailx is notified by the server that messages have been deleted
3062 by some other client or process. In this case, `Expunged n mes‐
3063 sages' is printed, and message numbers may have changed.
3064
3065 Limitations with POP3 mailboxes are: It is not possible to edit
3066 messages, they can only be copied and deleted. The line count
3067 for the header display is only appropriate if the entire message
3068 has been downloaded from the server. The status field of a mes‐
3069 sage is maintained by the server between connections; some
3070 servers do not update it at all, and with a server that does,
3071 the `exit' command will not cause the message status to be
3072 reset. The `newmail' command and the `newmail' variable have no
3073 effect. It is not possible to rename or to remove POP3 mail‐
3074 boxes.
3075
3076 If a RUBOUT (interrupt) is typed while an IMAP or POP3 operation
3077 is in progress, mailx will wait until the operation can be
3078 safely aborted, and will then return to the command loop and
3079 print the prompt again. When a second RUBOUT is typed while
3080 mailx is waiting for the operation to complete, the operation
3081 itself will be canceled. In this case, data that has not been
3082 fetched yet will have to be fetched before the next command can
3083 be performed. If the canceled operation was using an SSL/TLS
3084 encrypted channel, an error in the SSL transport will very
3085 likely result, and the connection is no longer usable.
3086
3087 As mailx is a mail user agent, it provides only basic SMTP ser‐
3088 vices. If it fails to contact its upstream SMTP server, it will
3089 not make further attempts to transfer the message at a later
3090 time, and it does not leave other information about this condi‐
3091 tion than an error message on the terminal and a `dead.letter'
3092 file. This is usually not a problem if the SMTP server is
3093 located in the same local network as the computer on which mailx
3094 is run. However, care should be taken when using a remote
3095 server of an ISP; it might be better to set up a local SMTP
3096 server then which just acts as a proxy.
3097
3098 Mailx immediately contacts the SMTP server (or
3099 /usr/lib/sendmail) even when operating in disconnected mode. It
3100 would not make much sense for mailx to defer outgoing mail since
3101 SMTP servers usually provide much more elaborated delay handling
3102 than mailx could perform as a client. Thus the recommended set‐
3103 up for sending mail in disconnected mode is to configure a local
3104 SMTP server such that it sends outgoing mail as soon as an
3105 external network connection is available again, i.e. to advise
3106 it to do that from a network startup script.
3107
3108 The junk mail filter follows the concepts developed by Paul Gra‐
3109 ham in his articles, ``A Plan for Spam'', August 2002,
3110 <http://www.paulgraham.com/spam.html>, and ``Better Bayesian
3111 Filtering'', January 2003,
3112 <http://www.paulgraham.com/better.html>. Chained tokens are due
3113 to a paper by Jonathan A. Zdziarski, ``Advanced Language Classi‐
3114 fication using Chained Tokens'', February 2004,
3115 <http://www.nuclearelephant.com/papers/chained.html>.
3116
3117 A mail command appeared in Version 1 AT&T Unix. Berkeley Mail
3118 was written in 1978 by Kurt Shoens. This man page is derived
3119 from from The Mail Reference Manual originally written by Kurt
3120 Shoens. Heirloom Mailx enhancements are maintained and docu‐
3121 mented by Gunnar Ritter.
3122
3123 Portions of this text are reprinted and reproduced in electronic
3124 form from IEEE Std 1003.1, 2003 Edition, Standard for Informa‐
3125 tion Technology — Operating System Interface (POSIX), The Open
3126 Group Base Specifications Issue 6, Copyright © 2001-2003 by the
3127 Institute of Electrical and Electronics Engineers, Inc and The
3128 Open Group. In the event of any discrepancy between this version
3129 and the original IEEE and The Open Group Standard, the original
3130 IEEE and The Open Group Standard is the referee document. The
3131 original Standard can be obtained online at
3132 http://www.opengroup.org/unix/online.html . Redistribution of
3133 this material is permitted so long as this notice remains
3134 intact.
3135
3136
3137
3138Heirloom mailx 12.5 10/9/10 MAILX(1)