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