mime-types.c: (just) (satisfy) scan-build
[s-mailx.git] / nail.1
blob2df08bcd579c78e3caeff5bbbb07f5d24f1181d5
1 .\"@ nail.1 - S-nail(1) reference manual.
2 .\"
3 .\" Copyright (c) 2000-2008 Gunnar Ritter, Freiburg i. Br., Germany.
4 .\" Copyright (c) 2012 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
5 .\"
6 .\" Copyright (c) 1980, 1990, 1993
7 .\"      The Regents of the University of California.  All rights reserved.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"--MKREL-START--
34 .\"@ S-nail(1): v14.9.0-rc1 / 2017-07-01
35 .Dd July 01, 2017
36 .ds VV \\%v14.9.0-rc1
37 .\"--MKREL-END--
38 .\"--MKMAN-START--
39 .ds UU \\%S-NAIL
40 .ds UA \\%S-nail
41 .ds uA \\%s-nail
42 .ds UR \\%s-nail.rc
43 .\"--MKMAN-END--
44 .\" --BEGINSTRIP--
45 .\"
46 .\" If not ~/.mailrc, it breaks POSIX compatibility.  And adjust main.c.
47 .ds ur \\%~/.mailrc
48 .ds OB [Obsolete]
49 .ds OP [Option]
50 .ds IN [v15-compat]
51 .ds OU [no v15-compat]
52 .ds ID [v15 behaviour may differ]
53 .ds NQ [Only new quoting rules]
54 .ds BO (Boolean)
55 .ds RO (Read-only)
57 .Dt "\*(UU" 1
58 .Os
59 .Mx -enable
62 .Sh NAME
63 .Nm \*(UA \%[\*(VV]
64 .Nd send and receive Internet mail
67 .\" .Sh SYNOPSIS {{{
68 .Sh SYNOPSIS
70 .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
71 .Nm \*(uA
72 .Fl h | Fl Fl help
73 .Pp
74 .Nm \*(uA
75 .Bk -words
76 .Op Fl BdEFinv~#
77 .Op Fl \&: Ar spec
78 .Op Fl A Ar account
79 .Op : Ns Fl a Ar attachment Ns \&:
80 .Op : Ns Fl b Ar bcc-addr Ns \&:
81 .Op : Ns Fl c Ar cc-addr Ns \&:
82 .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
83 .Op Fl r Ar from-addr
84 .Oo : Ns
85 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
86 .Pf \&: Oc
87 .Op Fl s Ar subject
88 .Op : Ns Fl X Ar cmd Ns \&:
89 .Op Fl \&.
90 .Pf : Ar to-addr Ns \&:
91 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
92 .Ek
93 .Pp
94 .Nm \*(uA
95 .Bk -words
96 .Op Fl BdEeHiNnRv~#
97 .Op Fl \&: Ar spec
98 .Op Fl A Ar account
99 .Op Fl L Ar spec
100 .Op Fl r Ar from-addr
101 .Oo : Ns
102 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
103 .Pf \&: Oc
104 .Op Fl u Ar user
105 .Op : Ns Fl X Ar cmd Ns \&:
106 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
108 .Nm \*(uA
109 .Bk -words
110 .Op Fl BdEeHiNnRv~#
111 .Op Fl \&: Ar spec
112 .Op Fl A Ar account
113 .Fl f
114 .Op Fl L Ar spec
115 .Op Fl r Ar from-addr
116 .Oo : Ns
117 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
118 .Pf \&: Oc
119 .Op : Ns Fl X Ar cmd Ns \&:
120 .Op Ar file
121 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
123 .\" }}}
126 .Mx -toc -tree html pdf ps xhtml
129 .\" .Sh DESCRIPTION {{{
130 .Sh DESCRIPTION
132 .Bd -filled -compact -offset indent
133 .Sy Compatibility note:
134 S-nail (\*(UA) will wrap up into \%S-mailx in v15.0 (circa 2018).
135 Backward incompatibility has to be expected \(en
136 .Sx COMMANDS
137 will use
138 .Sx "Shell-style argument quoting"
139 rules, for example, and shell metacharacters will become meaningful.
140 New and old behaviour is flagged \*(IN and \*(OU, and setting
141 .Va v15-compat ,
142 one of the many
143 .Sx "INTERNAL VARIABLES" ,
144 will choose new behaviour when applicable.
145 \*(OB flags what will vanish, and enabling
146 .Fl d
148 .Fl v
149 enables obsoletion warnings.
153 \*(UA provides a simple and friendly environment for sending and
154 receiving mail.
155 It is intended to provide the functionality of the POSIX
156 .Xr mailx 1
157 command, but is MIME capable and optionally offers extensions for
158 line editing, S/MIME, SMTP and POP3, among others.
159 \*(UA divides incoming mail into its constituent messages and allows
160 the user to deal with them in any order.
161 It offers many
162 .Sx COMMANDS
164 .Sx "INTERNAL VARIABLES"
165 for manipulating messages and sending mail.
166 It provides the user simple editing capabilities to ease the composition
167 of outgoing messages, and increasingly powerful and reliable
168 non-interactive scripting capabilities.
170 .\" .Ss "Options" {{{
171 .Ss "Options"
173 .Bl -tag -width ".It Fl BaNg"
175 .It Fl \&: Ar spec
176 Explicitly control which of the
177 .Sx "Resource files"
178 shall be loaded: if the letter
179 .Ql s
180 is (case-insensitively) part of the
181 .Ar spec
182 then the system wide
183 .Pa \*(UR
184 is loaded, likewise the letter
185 .Ql u
186 controls loading of the user's personal
187 .Pa \*(ur
188 file, whereas the letters
189 .Ql -
191 .Ql /
192 explicitly forbid loading of any resource files.
193 This option should be used by scripts: to avoid environmental noise they
194 should
195 .Dq detach
196 from any configuration files and create a script-local environment,
197 explicitly setting any of the desired
198 .Sx "INTERNAL VARIABLES"
200 .Fl S .
201 This option overrides
202 .Fl n .
205 .It Fl A Ar account
206 Executes an
207 .Ic account
208 command for the given user email
209 .Ar account
210 after program startup is complete (all resource files are loaded, any
211 .Fl S
212 setting is being established; only
213 .Fl X
214 commands have not been evaluated yet).
215 Being a special incarnation of
216 .Ic define Ns d
217 macros for the purpose of bundling longer-lived
218 .Ic set Ns
219 tings, activating such an email account also switches to the accounts
220 .Mx -sx
221 .Sx "primary system mailbox"
222 (most likely the
223 .Va inbox ) .
226 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
227 Attach
228 .Ar file
229 to the message (for compose mode opportunities refer to
230 .Ic ~@
232 .Ic ~^ ) .
233 .Sx "Filename transformations"
234 (also see
235 .Ic file )
236 will be performed, but shell word expansion is restricted to the tilde
237 .Ql ~ .
238 Shall
239 .Ar file
240 not be accessible but contain a
241 .Ql =
242 character, then anything before the
243 .Ql =
244 will be used as the filename, anything thereafter as a character set
245 specification.
247 If an input character set is specified,
248 .Mx -ix "character set specification"
249 but no output character set, then the given input character set is fixed
250 as-is, and no conversion will be applied;
251 giving the empty string or the special string hyphen-minus
252 .Ql -
253 will be treated as if
254 .Va ttycharset
255 has been specified (the default).
257 If an output character set has also been given then the conversion will
258 be performed exactly as specified and on-the-fly, not considering the
259 file's type and content.
260 As an exception, if the output character set is specified as the empty
261 string or hyphen-minus
262 .Ql - ,
263 then the default conversion algorithm (see
264 .Sx "Character sets" )
265 is applied (therefore no conversion is performed on-the-fly,
266 .Ar file
267 will be MIME-classified and its contents will be inspected first) \(em
268 without support for character set conversions
269 .Pf ( Va features
270 does not include the term
271 .Ql +iconv )
272 only this argument is supported.
274 .It Fl B
275 (\*(OB: \*(UA will always use line-buffered output, to gain
276 line-buffered input even in batch mode enable batch mode via
277 .Fl # . )
280 .It Fl b Ar addr
281 Send a blind carbon copy to
282 .Ar addr Ns
283 ess, if the
284 .Ic set Ns
285 ting of
286 .Va expandaddr ,
287 one of the
288 .Sx "INTERNAL VARIABLES" ,
289 allows.
290 The option may be used multiple times.
291 Also see the section
292 .Sx "On sending mail, and non-interactive mode" .
295 .It Fl c Ar addr
296 Send carbon copies to the given receiver, if so allowed by
297 .Va expandaddr .
298 May be used multiple times.
301 .It Fl d
302 .Ic set
303 the internal variable
304 .Va debug
305 which enables debug messages and disables message delivery,
306 among others; effectively turns almost any operation into a dry-run.
309 .It Fl E
310 .Ic set
311 .Va skipemptybody
312 and thus discard messages with an empty message part body.
313 This command line option is \*(OB.
316 .It Fl e
317 Just check if mail is present (in the system
318 .Va inbox
319 or the one specified via
320 .Fl f ) :
321 if yes, return an exit status of zero, a non-zero value otherwise.
322 To restrict the set of mails to consider in this evaluation a message
323 specification can be added with the option
324 .Fl L .
327 .It Fl F
328 Save the message to send in a file named after the local part of the
329 first recipient's address (instead of in
330 .Va record Ns ).
333 .It Fl f
334 Read in the contents of the user's
335 .Mx -sx
336 .Sx "secondary mailbox"
337 .Ev MBOX
338 (or the specified file) for processing;
339 when \*(UA is quit, it writes undeleted messages back to this file
340 (but be aware of the
341 .Va hold
342 option).
343 The optional
344 .Ar file
345 argument will undergo some special
346 .Sx "Filename transformations"
347 (also see
348 .Ic file ) .
349 Note that
350 .Ar file
351 is not a argument to the flag
352 .Fl \&\&f ,
353 but is instead taken from the command line after option processing has
354 been completed.
355 In order to use a
356 .Ar file
357 that starts with a hyphen-minus, prefix with a relative path, as in
358 .Ql ./-hyphenbox.mbox .
361 .It Fl H
362 Display a summary of
363 .Ic headers
364 and exit; a configurable summary view is available via the
365 .Fl L
366 option.
369 .It Fl h
370 Show a short usage summary.
373 .It Fl i
374 .Ic set
375 .Va ignore
376 to ignore tty interrupt signals.
379 .It Fl L Ar spec
380 Display a summary of
381 .Ic headers
382 of all messages that match the given
383 .Ar spec ,
384 then exit.
385 See the section
386 .Sx "Specifying messages"
387 for the format of
388 .Ar spec .
389 If the
390 .Fl e
391 option has been given in addition no header summary is produced,
392 but \*(UA will instead indicate via its exit status whether
393 .Ar spec
394 matched any messages
395 .Pf ( Ql 0 )
396 or not
397 .Pf ( Ql 1 ) ;
398 note that any verbose output is suppressed in this mode and must instead
399 be enabled explicitly (e.g., by using the option
400 .Fl v ) .
403 .It Fl M Ar type
404 Special send mode that will flag standard input with the MIME
405 .Ql Content-Type:
406 set to the given
407 .Ar type
408 and use it as the main message body.
409 \*(ID Using this option will bypass processing of
410 .Va message-inject-head ,
411 .Va signature
413 .Va message-inject-tail .
414 Also see
415 .Fl q , m , t .
418 .It Fl m Ar file
419 Special send mode that will MIME classify the specified
420 .Ar file
421 and use it as the main message body.
422 \*(ID Using this option will bypass processing of
423 .Va message-inject-head ,
424 .Va signature
426 .Va message-inject-tail .
427 Also see
428 .Fl q , M , t .
431 .It Fl N
432 inhibit the initial display of message headers when reading mail or
433 editing a mailbox
434 .Ic folder
435 by calling
436 .Ic unset
437 for the internal variable
438 .Va header .
441 .It Fl n
442 Standard flag that inhibits reading the system wide
443 .Pa \*(UR
444 upon startup.
445 The option
446 .Fl \&:
447 allows more control over the startup sequence; also see
448 .Sx "Resource files" .
451 .It Fl q Ar file
452 Special send mode that will initialize the message body with the
453 contents of the specified
454 .Ar file ,
455 which may be standard input
456 .Ql -
457 only in non-interactive context.
458 Also see
459 .Fl M , m , t .
462 .It Fl R
463 Any mailbox
464 .Ic folder
465 opened will be in read-only mode.
469 .It Fl r Ar from-addr
470 The source address that appears in the
471 .Ql From:
472 .Pf ( Va from )
473 header of a message (or in the
474 .Ql Sender:
475 .Pf ( Va sender )
476 header if the former contains multiple addresses) is not used for
477 relaying and delegating a message over the wire via SMTP, but instead an
478 envelope will enwrap the message content and provide the necessary
479 information (i.e., the RFC 5321 reverse-path, also used to report, e.g.,
480 delivery errors) to transmit the message to its destination(s).
481 Whereas said headers and internal variables will be used by \*(UA to
482 create the envelope if the built-in SMTP
483 .Va mta
484 (Mail-Transfer-Agent) is used, a file-based MTA will instead use the
485 identity of the message-originating user.
487 This command line option can be used to specify the reverse-path, to be
488 passed to a file-based
489 .Va mta
490 when a message is sent, via
491 .Fl \&\&f Ar from-addr .
492 Shall
493 .Ar from-addr
494 include a user name, then the address components will be separated and
495 the name part will be passed to a file-based
496 .Va mta
497 individually via
498 .Fl \&\&F Ar name .
499 The given
500 .Ar from-addr
501 is also assigned to the internal variable
502 .Va from .
503 Many default installations and sites disallow explicit overriding of the
504 user identity which could be adjusted by this option, unless either
505 .Va mta
506 has been configured accordingly, or the user is member of a group with
507 special privileges, respectively.
509 If an empty string is passed as
510 .Ar from-addr
511 then the content of the variable
512 .Va from
513 (or, if that contains multiple addresses,
514 .Va sender )
515 will be evaluated and used for this purpose whenever the file-based
516 .Va mta
517 is contacted.
518 Note that \*(UA by default, without
519 .Fl \&\&r
520 that is, neither passes
521 .Fl \&\&f
523 .Fl \&\&F
524 command line options to a file-based MTA by itself, unless this
525 automatic deduction is enforced by
526 .Ic set Ns
527 ing the internal variable
528 .Va r-option-implicit .
532 .It Fl S Ar var Ns Op = Ns value
533 .Ic set
534 the internal
535 .Ar var Ns
536 iable and, in case of a non-boolean variable which has a value, assign
537 .Ar value
538 to it.
539 Even though
540 .Sx "INTERNAL VARIABLES"
541 .Ic \&\&set
543 .Fl S
544 may be overwritten from within resource files,
545 the command line setting will be reestablished after all resource files
546 have been loaded in the order they have been given on the command line.
547 (\*(ID In the future such a setting may be in frozen state during startup.)
550 .It Fl s Ar subject
551 Specify the subject of the message to be sent.
552 Newline (NL) and carriage-return (CR) bytes are invalid and will be
553 normalized to space (SP) characters.
556 .It Fl t
557 The message given (on standard input) is expected to contain, separated
558 from the message body by an empty line, a message header with
559 .Ql To: ,
560 .Ql Cc: ,
562 .Ql Bcc:
563 fields giving its recipients, which will be added to any recipients
564 specified on the command line.
565 If a message subject is specified via
566 .Ql Subject:
567 then it will be used in favour of one given on the command line.
569 Also understood are
570 .Ql Reply-To:
571 (possibly overriding
572 .Va replyto ) ,
573 .Ql Sender:
574 .Pf ( Va sender ) ,
575 .Ql From:
576 .Pf ( Va from
577 and / or option
578 .Fl r ) .
579 .Ql Message-ID: ,
580 .Ql In-Reply-To: ,
581 .Ql References:
583 .Ql Mail-Followup-To: ,
584 by default created automatically dependent on message context, will
585 be used if specified (a special address massage will however still occur
586 for the latter).
587 Any other custom header field (also see
588 .Va customhdr ,
589 .Ic ~^ )
590 is passed through entirely
591 unchanged, and in conjunction with the option
592 .Fl ~
593 it is possible to embed
594 .Sx "COMMAND ESCAPES" .
595 Also see
596 .Fl M , m , q .
599 .It Fl u Ar user
600 Initially read the
601 .Mx -sx
602 .Sx "primary system mailbox"
604 .Ar user ,
605 appropriate privileges presumed; effectively identical to
606 .Ql Fl \&\&f Ns \0%user .
609 .It Fl V
610 Show \*(UA's
611 .Va version
612 and exit.
613 The command
614 .Ic version
615 will also show the list of
616 .Va features :
617 .Ql $ \*(uA -Xversion -Xx .
620 .It Fl v
621 .Ic set Ns
622 ting the internal variable
623 .Va verbose
624 enables display of some informational context messages.
625 Using it twice increases the level of verbosity.
628 .It Fl X Ar cmd
629 Add the given (or multiple for a multiline argument)
630 .Ar cmd
631 to the list of commands to be executed,
632 as a last step of program startup, before normal operation starts.
633 This is the only possibility to execute commands in non-interactive mode
634 when reading startup files is actively prohibited.
635 The commands will be evaluated as a unit, just as via
636 .Ic source .
637 Correlates with
638 .Fl #
640 .Va errexit .
643 .It Fl ~
644 Enable
645 .Sx "COMMAND ESCAPES"
646 in compose mode even in non-interactive use cases.
647 This can be used to, e.g., automatically format the composed message
648 text before sending the message:
649 .Bd -literal -offset indent
650 $ ( echo 'line    one. Word.     Word2.';\e
651     echo '~| /usr/bin/fmt -tuw66' ) |\e
652   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
656 .It Fl #
657 Enables batch mode: standard input is made line buffered, the complete
658 set of (interactive) commands is available, processing of
659 .Sx "COMMAND ESCAPES"
660 is enabled in compose mode, and diverse
661 .Sx "INTERNAL VARIABLES"
662 are adjusted for batch necessities, exactly as if done via
663 .Fl S :
664 .Va emptystart ,
665 .Pf no Va errexit ,
666 .Pf no Va header ,
667 .Pf no Va posix ,
668 .Va quiet ,
669 .Va sendwait ,
670 .Va typescript-mode
671 as well as
672 .Ev MAIL ,
673 .Ev MBOX
675 .Va inbox
676 (the latter three to
677 .Pa /dev/null ) .
678 The following prepares an email message in a batched dry run:
679 .Bd -literal -offset indent
680 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
681   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
685 .It Fl \&.
686 This flag forces termination of option processing in order to prevent
687 .Dq option injection
688 (attacks).
689 It also forcefully puts \*(UA into send mode, see
690 .Sx "On sending mail, and non-interactive mode" .
694 Any given
695 .Bk -words
696 .Ar to-addr ...
698 argument, as well as all receivers established by the command line options
699 .Fl b
701 .Fl c ,
702 are subject to checks established via
703 .Va expandaddr ,
704 one of the
705 .Sx "INTERNAL VARIABLES" .
706 .Bk -words
707 .Op Ar mta-option ...
709 arguments that are given at the end of the command line after a
710 .Ql --
711 separator will be passed through to a file-based
712 .Va mta
713 (Mail-Transfer-Agent) and persist for an entire (interactive) session
714 \(en if the setting of the internal variable
715 .Va expandargv
716 allows their recognition; no such constraints apply to the variable
717 .Va mta-arguments .
718 .\" }}}
720 .\" .Ss "A starter" {{{
721 .Ss "A starter"
723 \*(UA is a direct descendant of
725 Mail, a successor of the Research
727 mail which
728 .Dq was there from the start
729 according to
730 .Sx HISTORY .
731 It thus represents the user side of the
733 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
734 traditionally taken by
735 .Xr sendmail 8 ,
736 and most MTAs provide a binary of this name for compatibility purposes.
737 If the \*(OPal SMTP
738 .Va mta
739 is included in the
740 .Va features
741 of \*(UA then the system side is not a mandatory precondition for mail
742 delivery.
745 Because \*(UA strives for compliance with POSIX
746 .Xr mailx 1
747 it is likely that some configuration settings have to be adjusted before
748 using it is a smooth experience.
749 The default global
750 .Pa \*(UR
751 resource file bends those standard imposed settings of the
752 .Sx "INTERNAL VARIABLES"
753 a bit towards more user friendliness and safety, however, e.g., it
754 .Ic set Ns s
755 .Va hold
757 .Va keepsave
758 in order to suppress the automatic moving of messages to the
759 .Mx -sx
760 .Sx "secondary mailbox"
761 .Ev MBOX
762 that would otherwise occur (see
763 .Sx "Message states" ) ,
765 .Va keep
766 to not remove empty system (MBOX) mailbox files in order not to mangle
767 file permissions when files eventually get recreated \(en
768 \*(UA will remove all empty (MBOX) mailbox files unless this variable is
769 set whenever
770 .Ev POSIXLY_CORRECT
771 mode has been enabled.
772 The file mode creation mask is explicitly managed via
773 .Va umask ,
774 symbolic links will not be followed when opening files for writing,
775 sufficient system support provided.
778 It also enables
779 .Va sendwait
780 in order to synchronize \*(UA with the exit status report of the used
781 .Va mta
782 when sending mails.
784 .Ic set Ns
786 .Va emptystart
787 to enter interactive startup even if the initial mailbox is empty,
788 .Va editheaders
789 to allow editing of headers as well as
790 .Va fullnames
791 to not strip down addresses in compose mode, and
792 .Va quote
793 to include the message that is being responded to when
794 .Ic reply Ns
795 ing.
796 The section
797 .Sx EXAMPLES
798 contains some more complete configuration examples.
799 .\" }}}
801 .\" .Ss "On sending mail, and non-interactive mode" {{{
802 .Ss "On sending mail, and non-interactive mode"
804 To send a message to one or more people, using a local or a built-in
805 .Va mta
806 (Mail-Transfer-Agent) transport to actually deliver the generated mail
807 message, \*(UA can be invoked with arguments which are the names of
808 people to whom the mail will be sent, and the command line options
809 .Fl b
811 .Fl c
812 can be used to add (blind) carbon copy receivers:
814 .Bd -literal -offset indent
815 # Via sendmail(1)
816 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
818 # But... try it in an isolated dry-run mode (-d) first
819 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
820    -b bcc@exam.ple -c cc@exam.ple \e
821    -. '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
823 # With SMTP
824 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
825     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
826     -S from=scriptreply@exam.ple \e
827     -a /etc/mail.rc \e
828     -. eric@exam.ple
832 If standard input is a terminal rather than the message to be sent,
833 the user is expected to type in the message contents.
834 In this compose mode \*(UA treats lines beginning with the character
835 .Ql ~
836 special \(en these are so-called
837 .Sx "COMMAND ESCAPES" ,
838 which can be used to read in files, process shell commands, add and edit
839 attachments and more; e.g., the command escape
840 .Ic ~e
841 will start the text editor to revise the message in its current state,
842 .Ic ~h
843 allows editing of the most important message headers, with
844 .Ic ~^
845 custom headers can be created (more specifically than with
846 .Va customhdr ) .
847 .Ic ~?
848 gives an overview of most other available command escapes.
849 Typing
850 .Ql control-D
851 .Pf ( Ql ^D )
852 at the beginning of an empty line leaves compose mode and causes the
853 message to be sent, whereas typing
854 .Ql control-C
855 .Pf ( Ql ^C )
856 twice will abort the current letter (saving its contents in the file
857 denoted by
858 .Ev DEAD
859 unless
860 .Pf no Va save
861 is set).
864 A number of
865 .Sx ENVIRONMENT
867 .Sx "INTERNAL VARIABLES"
868 can be used to alter default behavior.
869 E.g., messages are sent asynchronously, without supervision, unless the
870 internal variable
871 .Va sendwait
872 is set, therefore send errors will not be recognizable until then.
873 .Ic set Ns
874 ting (also via
875 .Fl S )
876 .Va editalong
877 will automatically startup a text editor when compose mode is entered,
878 .Va editheaders
879 allows editing of headers additionally to plain body content, whereas
880 .Va askcc
882 .Va askbcc
883 will cause the user to be prompted actively for (blind) carbon-copy
884 recipients, respectively, if the given list is empty.
887 Especially when using public mail provider accounts with the SMTP
888 .Va mta
889 it is often necessary to set
890 .Va from
891 and/or
892 .Va hostname
893 (even finer control via
894 .Va smtp-hostname ) ,
895 which (even if empty) also causes creation of
896 .Ql Message-ID:
898 .Ql Content-ID:
899 header fields unless
900 .Va stealthmua
901 is set; saving a copy of sent messages in a
902 .Va record
903 mailbox may be desirable \(en as for most mailbox
904 .Ic file
905 targets the value will undergo
906 .Sx "Filename transformations" .
907 Defining user email
908 .Ic account Ns s
909 for the purpose of arranging a complete environment of settings that can
910 be switched to with a single command or command line option may be
911 useful (the section
912 .Sx EXAMPLES
913 contains example configurations for sending messages via some of the
914 well-known public mail providers and also gives a compact overview on
915 how to setup a secure SSL/TLS environment).
916 Performing some
917 .Fl d
919 .Va debug
920 sandbox dry-run tests first will prove correctness.
923 The section
924 .Sx "On URL syntax and credential lookup"
925 will spread light on the different ways of how to specify user email
926 account credentials, the
927 .Ql USER@HOST
928 variable chains, and accessing protocol-specific resources,
929 the section
930 .Sx "Character sets"
931 goes into the details of character encodings, and how to use them for
932 interpreting the input data given in
933 .Va ttycharset
934 and representing messages and MIME part contents in
935 .Va sendcharsets ,
936 and reading the section
937 .Sx "The mime.types files"
938 should help to understand how the MIME-type of outgoing attachments are
939 classified, and what can be done for fine-tuning.
940 Over the wire an intermediate, configurable content-transfer-encoding
941 .Pf ( Va mime-encoding )
942 may be applied to the raw message part data.
945 Message recipients (as specified on the command line or defined in
946 .Ql To: ,
947 .Ql Cc:
949 .Ql Bcc: )
950 may not only be email addressees but can also be names of mailboxes and
951 even complete shell command pipe specifications.
952 If the variable
953 .Va expandaddr
954 is not set then only network addresses (see
955 .Xr mailaddr 7
956 for a description of mail addresses) and plain user names (including MTA
957 aliases) may be used, other types will be filtered out, giving a warning
958 message.
959 The command
960 .Ic addrcodec
961 can be used to generate standard compliant network addresses.
963 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
964 .\" grep the latter for the complete picture
966 If the variable
967 .Va expandaddr
968 is set then extended recipient addresses will optionally be accepted:
969 Any name which starts with a vertical bar
970 .Ql |
971 character specifies a command pipe \(en the command string following the
972 .Ql |
973 is executed and the message is sent to its standard input;
974 Likewise, any name that starts with the character solidus
975 .Ql /
976 or the character sequence dot solidus
977 .Ql ./
978 is treated as a file, regardless of the remaining content;
979 likewise a name that solely consists of a hyphen-minus
980 .Ql - .
981 Any other name which contains a commercial at
982 .Ql @
983 character is treated as a network address;
984 Any other name which starts with a plus sign
985 .Ql +
986 character specifies a mailbox name;
987 Any other name which contains a solidus
988 .Ql /
989 character but no exclamation mark
990 .Ql \&!
991 or percent sign
992 .Ql %
993 character before also specifies a mailbox name;
994 What remains is treated as a network address.
996 .Bd -literal -offset indent
997 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
998 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
999 $ echo safe | LC_ALL=C \e
1000     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
1001       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1002       -. bob@exam.ple
1006 It is possible to create personal distribution lists via the
1007 .Ic alias
1008 command, so that, for instance, the user can send mail to
1009 .Ql cohorts
1010 and have it go to a group of people.
1011 These aliases have nothing in common with the system wide aliases that
1012 may be used by the MTA, which are subject to the
1013 .Ql name
1014 constraint of
1015 .Va expandaddr
1016 and are often tracked in a file
1017 .Pa /etc/aliases
1018 (and documented in
1019 .Xr aliases 5
1021 .Xr sendmail 1 ) .
1022 Personal aliases will be expanded by \*(UA before the message is sent,
1023 and are thus a convenient alternative to specifying each addressee by
1024 itself; they correlate with the active set of
1025 .Ic alternates
1026 and are subject to
1027 .Va metoo
1028 filtering.
1031 .Dl alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox
1034 .Va on-compose-enter , on-compose-leave
1036 .Va on-compose-cleanup
1037 hook variables may be set to
1038 .Ic define Ns
1039 d macros to automatically adjust some settings dependent
1040 on receiver, sender or subject contexts, and via the
1041 .Va on-compose-splice
1042 as well as
1043 .Va on-compose-splice-shell
1044 variables, the former also to be set to a
1045 .Ic define Ns
1046 d macro, increasingly powerful mechanisms to perform automated message
1047 adjustments are available.
1048 (\*(ID These hooks work for commands which newly create messages, namely
1049 .Ic forward , mail , reply
1050 and variants;
1051 .Ic resend
1053 .Ic Resend
1054 for now provide only the hooks
1055 .Va on-resend-enter
1057 .Va on-resend-cleanup . )
1060 To avoid environmental noise scripts should
1061 .Dq detach
1062 \*(UA from any configuration files and create a script-local
1063 environment, ideally with the command line options
1064 .Fl \&:
1065 to disable any configuration file in conjunction with repetitions of
1066 .Fl S
1067 to specify variables:
1069 .Bd -literal -offset indent
1070 $ env LC_ALL=C \*(uA -:/ \e
1071     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1072     -Sexpandaddr=fail,-all,failinvaddr \e
1073     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1074     -S from=scriptreply@exam.ple \e
1075     -s 'Subject to go' -a attachment_file \e
1076     -. 'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1077     < content_file
1081 As shown, scripts can
1082 .Dq fake
1083 a locale environment, the above specifies the all-compatible 7-bit clean
1084 .Ev LC_ALL
1085 .Dq C ,
1086 but will nonetheless take and send UTF-8 in the message text by using
1087 .Va ttycharset .
1088 In interactive mode, which is introduced in the next section, messages
1089 can be sent by calling the
1090 .Ic mail
1091 command with a list of recipient addresses:
1093 .Bd -literal -offset indent
1094 $ \*(uA -d -Squiet -Semptystart
1095 "/var/spool/mail/user": 0 messages
1096 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1098 ? # Will do the right thing (tm)
1099 ? m rec1@exam.ple rec2@exam.ple
1101 .\" }}}
1103 .\" .Ss "On reading mail, and interactive mode" {{{
1104 .Ss "On reading mail, and interactive mode"
1106 When invoked without addressees \*(UA enters interactive mode in which
1107 mails may be read.
1108 When used like that the user's system
1109 .Va inbox
1110 (see the command
1111 .Ic file
1112 for an in-depth description of the different mailbox types that exist)
1113 is read in and a one line header of each message therein is displayed.
1114 The visual style of this summary of
1115 .Ic headers
1116 can be adjusted through the variable
1117 .Va headline
1118 and the possible sorting criterion via
1119 .Va autosort .
1120 Scrolling through
1121 .Va screen Ns
1122 fuls of
1123 .Ic headers
1124 can be performed with the command
1125 .Ic z .
1126 If the initially opened mailbox is empty \*(UA will instead exit
1127 immediately (after displaying a message) unless the variable
1128 .Va emptystart
1129 is set.
1132 At the
1133 .Va prompt
1134 the command
1135 .Ic list
1136 will give a listing of all available commands and
1137 .Ic help
1138 will give a summary of some common ones.
1139 If the \*(OPal documentation strings are available one can type
1140 .Ql help X
1141 .Pf "(or " Ql ?X )
1142 and see the actual expansion of
1143 .Ql X
1144 and what its purpose is, i.e., commands can be abbreviated
1145 (note that POSIX defines some abbreviations, so that the alphabetical
1146 order of commands does not necessarily relate to the abbreviations; it is
1147 however possible to define overwrites with
1148 .Ic commandalias ) .
1149 These commands can also produce a more
1150 .Va verbose
1151 output.
1154 Messages are given numbers (starting at 1) which uniquely identify
1155 messages; the current message \(en the
1156 .Dq dot
1157 \(en will either be the first new message, or the first unread message,
1158 or the first message of the mailbox; the internal variable
1159 .Va showlast
1160 will instead cause usage of the last message for this purpose.
1161 The command
1162 .Ic headers
1163 will display a
1164 .Va screen Ns
1165 ful of header summaries containing the
1166 .Dq dot ,
1167 whereas
1168 .Ic from
1169 will display only the summaries of the given messages, defaulting to the
1170 .Dq dot .
1173 Message content can be displayed with the command
1174 .Ic type
1175 .Pf ( Ql t ,
1176 alias
1177 .Ic print ) .
1178 Here the variable
1179 .Va crt
1180 controls whether and when \*(UA will use the configured
1181 .Ev PAGER
1182 for display instead of directly writing to the user terminal
1183 .Va screen ,
1184 the sole difference to the command
1185 .Ic more ,
1186 which will always use the
1187 .Ev PAGER .
1188 The command
1189 .Ic top
1190 will instead only show the first
1191 .Va toplines
1192 of a message (maybe even compressed if
1193 .Va topsqueeze
1194 is set).
1195 Message display experience may improve by setting and adjusting
1196 .Va mime-counter-evidence ,
1197 and also see
1198 .Sx "HTML mail and MIME attachments" .
1201 By default the current message
1202 .Pf ( Dq dot )
1203 is displayed, but like with many other commands it is possible to give
1204 a fancy message specification (see
1205 .Sx "Specifying messages" ) ,
1206 e.g.,
1207 .Ql t:u
1208 will display all unread messages,
1209 .Ql t.
1210 will display the
1211 .Dq dot ,
1212 .Ql t 1 5
1213 will type the messages 1 and 5,
1214 .Ql t 1-5
1215 will type the messages 1 through 5, and
1216 .Ql t-
1218 .Ql t+
1219 will display the last and the next message, respectively.
1220 The command
1221 .Ic search
1222 (a more substantial alias for
1223 .Ic from )
1224 will display a header summary of the given message specification list
1225 instead of their content, e.g., the following will search for subjects:
1228 .Dl from "'@Some subject to search for'"
1231 In the default setup all header fields of a message will be
1232 .Ic type Ns
1233 d, but fields can be white- or blacklisted for a variety of
1234 applications by using the command
1235 .Ic headerpick ,
1236 e.g., to restrict display to a very restricted set:
1237 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1238 In order to display all header fields of a message regardless of
1239 currently active ignore or retain lists, use the commands
1240 .Ic Type
1242 .Ic Top ;
1243 .Ic Show
1244 will show the raw message content.
1245 Note that historically the global
1246 .Pa \*(UR
1247 not only adjusts the list of displayed headers, but also sets
1248 .Va crt .
1251 Dependent upon the configuration a line editor (see the section
1252 .Sx "On terminal control and line editor" )
1253 aims at making user experience with the many
1254 .Sx COMMANDS
1255 a bit nicer.
1256 When reading the system
1257 .Va inbox
1258 or when
1259 .Fl f
1261 .Ic file )
1262 specified a mailbox explicitly prefixed with the special
1263 .Ql %:
1264 modifier (propagating the mailbox to a
1265 .Mx -sx
1266 .Sx "primary system mailbox" ) ,
1267 then messages which have been read will be moved to a
1268 .Mx -sx
1269 .Sx "secondary mailbox" ,
1270 the users
1271 .Ev MBOX
1272 file, automatically when the mailbox is left, either by changing the
1273 active mailbox or by quitting \*(UA (also see
1274 .Sx "Message states" )
1275 \(en this automatic moving from a system or primary to the secondary
1276 mailbox is not performed when the variable
1277 .Va hold
1278 is set.
1279 Messages can also be explicitly
1280 .Ic move Ns
1281 d to other mailboxes, whereas
1282 .Ic copy
1283 keeps the original message.
1284 .Ic write
1285 can be used to write out data content of specific parts of messages.
1288 After examining a message the user can
1289 .Ic reply Ql r
1290 to the sender and all recipients (which will also be placed in
1291 .Ql To:
1292 unless
1293 .Va recipients-in-cc
1294 is set) or
1295 .Ic Reply Ql R
1296 exclusively to the sender(s).
1297 .Ic forward Ns
1298 ing a message will allow editing the new message: the original message
1299 will be contained in the message body, adjusted according to
1300 .Ic headerpick .
1301 When replying to or forwarding a message recipient addresses will be
1302 stripped from comments and names unless the internal variable
1303 .Va fullnames
1304 is set.
1305 It is possible to
1306 .Ic resend
1308 .Ic Resend
1309 messages: the former will add a series of
1310 .Ql Resent-
1311 headers, whereas the latter will not; different to newly created
1312 messages editing is not possible and no copy will be saved even with
1313 .Va record
1314 unless the additional variable
1315 .Va record-resent
1316 is set.
1317 Of course messages can also be
1318 .Ic delete Ql d ,
1319 but can spring into existence again via
1320 .Ic undelete
1321 or when the \*(UA session is ended via the
1322 .Ic exit Ql x
1323 command.
1326 To end a mail processing session one may either issue
1327 .Ic quit Ql q
1328 to cause a full program exit, which possibly includes
1329 automatic moving of read messages to the
1330 .Mx -sx
1331 .Sx "secondary mailbox"
1332 .Ev MBOX
1333 as well as updating the \*(OPal line editor
1334 .Va history-file ,
1335 or use the command
1336 .Ic exit Ql x
1337 instead in order to prevent any of these actions.
1338 .\" }}}
1340 .\" .Ss "HTML mail and MIME attachments" {{{
1341 .Ss "HTML mail and MIME attachments"
1343 Messages which are HTML-only become more and more common and of course
1344 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1345 Mail Extensions) parts for, e.g., attachments.
1346 To get a notion of MIME types, \*(UA will first read
1347 .Sx "The mime.types files"
1348 (as configured and allowed by
1349 .Va mimetypes-load-control ) ,
1350 and then add onto that types registered directly with
1351 .Ic mimetype .
1352 It (normally) has a default set of types built-in, too.
1353 To improve interaction with faulty MIME part declarations which are
1354 often seen in real-life messages, setting
1355 .Va mime-counter-evidence
1356 will allow \*(UA to verify the given assertion and possibly provide
1357 an alternative MIME type.
1360 Whereas \*(UA \*(OPally supports a simple HTML-to-text converter for
1361 HTML messages, it cannot handle MIME types other than plain text itself.
1362 Instead programs need to become registered to deal with specific MIME
1363 types or file extensions.
1364 These programs may either prepare plain text versions of their input in
1365 order to enable \*(UA to integrate their output neatlessly in its own
1366 message visualization (a mode which is called
1367 .Cd copiousoutput ) ,
1368 or display the content themselves, for example in an external graphical
1369 window: such handlers will only be considered by and for the command
1370 .Ic mimeview .
1373 To install a handler program for a specific MIME type an according
1374 .Va pipe-TYPE/SUBTYPE
1375 variable needs to be set; to instead define a handler for a specific
1376 file extension the respective
1377 .Va pipe-EXTENSION
1378 variable can be used \(en these handlers take precedence.
1379 \*(OPally \*(UA supports mail user agent configuration as defined in
1380 RFC 1524; this mechanism (see
1381 .Sx "The Mailcap files" )
1382 will be queried for display or quote handlers if none of the former two
1383 .\" TODO v15-compat "will be" -> "is"
1384 did; it will be the sole source for handlers of other purpose.
1385 A last source for handlers is the MIME type definition itself, when
1386 a (\*(UA specific) type-marker was registered with the command
1387 .Ic mimetype
1388 (which many built-in MIME types do).
1391 E.g., to display a HTML message inline (that is, converted to a more
1392 fancy plain text representation than the built-in converter is capable to
1393 produce) with either of the text-mode browsers
1394 .Xr lynx 1
1396 .Xr elinks 1 ,
1397 teach \*(UA about MathML documents and make it display them as plain
1398 text, and to open PDF attachments in an external PDF viewer,
1399 asynchronously and with some other magic attached:
1401 .Bd -literal -offset indent
1402 if [ "$features" !@ +filter-html-tagsoup ]
1403   #set pipe-text/html='@* elinks -force-html -dump 1'
1404   set pipe-text/html='@* lynx -stdin -dump -force_html'
1405   # Display HTML as plain text instead
1406   #set pipe-text/html=@
1407 endif
1408 mimetype @ application/mathml+xml mathml
1409 wysh set pipe-application/pdf='@&=@ \e
1410   trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1411   trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1412   mupdf "${MAILX_FILENAME_TEMPORARY}"'
1414 .\" }}}
1416 .\" .Ss "Mailing lists" {{{
1417 .Ss "Mailing lists"
1419 \*(UA offers some support to ease handling of mailing lists.
1420 The command
1421 .Ic mlist
1422 promotes all given arguments to known mailing lists, and
1423 .Ic mlsubscribe
1424 sets their subscription attribute, creating them first as necessary.
1425 (On the other hand
1426 .Ic unmlsubscribe
1427 does not
1428 .Ic unmlist
1429 automatically, but only resets the subscription attribute.)
1430 Using the commands without arguments will show (a subset of) all
1431 currently defined mailing lists.
1433 .Va headline
1434 format
1435 .Ql \&%T
1436 can be used to mark out messages with configured list addresses
1437 in the header display.
1440 \*(OPally mailing lists may also be specified as (extended) regular
1441 expressions, which allows matching of many addresses with a single
1442 expression.
1443 However, all fully qualified list addresses are matched via a fast
1444 dictionary, whereas expressions are placed in (a) list(s) which is
1445 (are) matched sequentially.
1447 .Bd -literal -offset indent
1448 set followup-to followup-to-honour=ask-yes reply-to-honour=ask-yes
1449 wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1450 mlsubscribe a4@b4.c4 exact@lists.c3
1454 The variable
1455 .Va followup-to-honour
1456 will ensure that a
1457 .Ql Mail-\:Followup-\:To:
1458 header is honoured when the message is being replied to (via
1459 .Ic reply
1461 .Ic Lreply )
1463 .Va followup-to
1464 controls whether this header is created when sending mails; it will be
1465 created automatically for a couple of reasons, too, like when the
1466 special
1467 .Dq mailing list specific
1468 respond command
1469 .Ic Lreply
1470 is used, when
1471 .Ic reply
1472 is used to respond to a message with its
1473 .Ql Mail-Followup-To:
1474 being honoured etc.
1477 A difference in between the handling of known and subscribed lists is
1478 that the address of the sender is usually not part of a generated
1479 .Ql Mail-Followup-To:
1480 when addressing the latter, whereas it is for the former kind of lists.
1481 Usually because there are exceptions: say, if multiple lists are
1482 addressed and not all of them are subscribed lists.
1484 For convenience \*(UA will, temporarily, automatically add a list
1485 address that is presented in the
1486 .Ql List-To:
1487 header of a message that is being responded to to the list of known
1488 mailing lists.
1489 Shall that header have existed \*(UA will instead, dependent on the
1490 variable
1491 .Va reply-to-honour ,
1492 use an also set
1493 .Ql Reply-To:
1494 for this purpose in order to accept a list administrators' wish that
1495 is supposed to have been manifested like that (but only if it provides
1496 a single address which resides on the same domain as what is stated in
1497 .Ql List-To: ) .
1498 .\" }}}
1500 .\" .Ss "Resource files" {{{
1501 .Ss "Resource files"
1503 Upon startup \*(UA reads in several resource files:
1505 .Bl -tag -width ".It Pa BaNg"
1507 .It Pa \*(UR
1508 System wide initialization file.
1509 Reading of this file can be suppressed, either by using the
1510 .Fl \&:
1511 (and according argument) or
1512 .Fl n
1513 command line options, or by setting the
1514 .Sx ENVIRONMENT
1515 variable
1516 .Ev MAILX_NO_SYSTEM_RC .
1519 .It Pa \*(ur
1520 File giving initial commands.
1521 A different file can be chosen by setting the
1522 .Sx ENVIRONMENT
1523 variable
1524 .Ev MAILRC .
1525 Reading of this file can be suppressed with the
1526 .Fl \&:
1527 command line option.
1529 .It Va mailx-extra-rc
1530 Can be used to define an optional startup file to be read after all
1531 other resource files.
1532 It can be used to specify settings that are not understood by other
1533 .Xr mailx 1
1534 implementations, for example.
1535 This variable is only honoured when defined in a resource file, e.g.,
1536 it is one of the
1537 .Sx "INTERNAL VARIABLES" .
1541 The content of these files is interpreted as follows:
1544 .Bl -bullet -compact
1546 The whitespace characters space, tabulator and newline,
1547 as well as those defined by the variable
1548 .Va ifs ,
1549 are removed from the beginning and end of input lines.
1551 Empty lines are ignored.
1553 Any other line is interpreted as a command.
1554 It may be spread over multiple input lines if the newline character is
1555 .Dq escaped
1556 by placing a reverse solidus character
1557 .Ql \e
1558 as the last character of the line; whereas any leading whitespace of
1559 follow lines is ignored, trailing whitespace before a escaped newline
1560 remains in the input.
1562 If the line (content) starts with the number sign
1563 .Ql #
1564 then it is a comment-command \(en a real command! \(en and also ignored.
1565 This command is the only form of comment that is understood.
1569 Unless \*(UA is about to enter interactive mode syntax errors that occur
1570 while loading these files are treated as errors and cause program exit.
1571 More files with syntactically equal content can be
1572 .Ic source Ns ed .
1573 The following, saved in a file, would be an examplary content:
1575 .Bd -literal -offset indent
1576  # This line is a comment command.  And y\e
1577     es, it is really continued here.
1578 set debug \e
1579     verbose
1580     set editheaders
1582 .\" }}}
1584 .\" .Ss "Character sets" {{{
1585 .Ss "Character sets"
1587 \*(OP \*(UA detects the character set of the terminal by using
1588 mechanisms that are controlled by the
1589 .Ev LC_CTYPE
1591 .Ev LC_ALL ,
1593 .Ev LANG ,
1594 in that order; see there) environment variable, the internal variable
1595 .Va ttycharset
1596 will be set to the detected terminal character set accordingly,
1597 and will thus show up in the output of commands like, e.g.,
1598 .Ic set
1600 .Ic varshow .
1603 However, the user may give a value for
1604 .Va ttycharset
1605 during startup, so that it is possible to send mail in a completely
1606 .Dq faked
1607 locale environment, an option which can be used to generate and send,
1608 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
1609 .Ql LC_ALL=C
1610 environment (an example of this can be found in the section
1611 .Sx "On sending mail, and non-interactive mode" ) .
1612 Changing the value does not mean much beside that, because several
1613 aspects of the real character set are implied by the locale environment
1614 of the system, which stays unaffected by
1615 .Va ttycharset .
1618 If the \*(OPal character set conversion capabilities are not available
1619 .Pf ( Va features
1620 does not include the term
1621 .Ql +iconv ) ,
1622 then
1623 .Va ttycharset
1624 will be the only supported character set,
1625 it is simply assumed that it can be used to exchange 8-bit messages
1626 (over the wire an intermediate configurable content-transfer-encoding,
1627 .Va mime-encoding ,
1628 may be applied),
1629 and the rest of this section does not apply;
1630 it may however still be necessary to explicitly set it if automatic
1631 detection fails, since in that case it defaults to
1632 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
1633 LATIN1 a.k.a. ISO-8859-1.
1636 \*(OP When reading messages, their text is converted into
1637 .Va ttycharset
1638 as necessary in order to display them on the users terminal.
1639 Unprintable characters and invalid byte sequences are detected
1640 and replaced by proper substitution characters.
1641 Character set mappings for source character sets can be established with
1642 the command
1643 .Ic charsetalias ,
1644 which may be handy to work around faulty character set catalogues (e.g.,
1645 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
1646 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
1647 Also see
1648 .Va charset-unknown-8bit
1649 to deal with another hairy aspect of message interpretation.
1652 When sending messages all their parts and attachments are classified.
1653 Whereas no character set conversion is performed on those parts which
1654 appear to be binary data,
1655 the character set being used must be declared within the MIME header of
1656 an outgoing text part if it contains characters that do not conform to
1657 the set of characters that are allowed by the email standards.
1658 Permissible values for character sets used in outgoing messages can be
1659 declared using the
1660 .Va sendcharsets
1661 variable, and
1662 .Va charset-8bit ,
1663 which defines a catch-all last-resort fallback character set that is
1664 implicitly appended to the list of character sets in
1665 .Va sendcharsets .
1668 When replying to a message and the variable
1669 .Va reply-in-same-charset
1670 is set then the character set of the message being replied to is tried
1671 first (after mapping via
1672 .Ic charsetalias ) .
1673 And it is also possible to make \*(UA work even more closely related to
1674 the current locale setting automatically by using the variable
1675 .Va sendcharsets-else-ttycharset ,
1676 please see there for more information.
1679 All the specified character sets are tried in order unless the
1680 conversion of the part or attachment succeeds.
1681 If none of the tried (8-bit) character sets is capable to represent the
1682 content of the part or attachment,
1683 then the message will not be sent and its text will optionally be
1684 .Va save Ns d
1686 .Ev DEAD .
1687 In general, if a message saying
1688 .Dq cannot convert from a to b
1689 appears, either some characters are not appropriate for the currently
1690 selected (terminal) character set,
1691 or the needed conversion is not supported by the system.
1692 In the first case, it is necessary to set an appropriate
1693 .Ev LC_CTYPE
1694 locale and/or the variable
1695 .Va ttycharset .
1698 The best results are usually achieved when \*(UA is run in a UTF-8
1699 locale on an UTF-8 capable terminal, in which case the full Unicode
1700 spectrum of characters is available.
1701 In this setup characters from various countries can be displayed,
1702 while it is still possible to use more simple character sets for sending
1703 to retain maximum compatibility with older mail clients.
1706 On the other hand the POSIX standard defines a locale-independent 7-bit
1707 .Dq portable character set
1708 that should be used when overall portability is an issue, the even more
1709 restricted subset named
1710 .Dq portable filename character set
1711 consists of A-Z, a-z, 0-9, period
1712 .Ql \&. ,
1713 underscore
1714 .Ql _
1715 and hyphen-minus
1716 .Ql - .
1717 .\" }}}
1719 .\" .Ss "Message states" {{{
1720 .Ss "Message states"
1722 \*(UA differentiates in between several different message states;
1723 the current state will be reflected in header summary displays if
1724 .Va headline
1725 is configured to do so (via the internal variable
1726 .Va attrlist ) ,
1727 and messages can also be selected and be acted upon depending on their
1728 state (see
1729 .Sx "Specifying messages" ) .
1730 When operating on the system
1731 .Va inbox ,
1732 or in any other
1733 .Mx -sx
1734 .Sx "primary system mailbox" ,
1735 special actions, like the automatic moving of messages to the
1736 .Mx -sx
1737 .Sx "secondary mailbox"
1738 .Ev MBOX ,
1739 may be applied when the mailbox is left (also implicitly via
1740 a successful exit of \*(UA, but not if the special command
1741 .Ic exit
1742 is used) \(en however, because this may be irritating to users which
1743 are used to
1744 .Dq more modern
1745 mail-user-agents, the default global
1746 .Pa \*(UR
1747 sets the internal
1748 .Va hold
1750 .Va keepsave
1751 variables in order to suppress this behaviour.
1753 .Bl -hang -width ".It Ql new"
1754 .It Ql new
1755 Message has neither been viewed nor moved to any other state.
1756 Such messages are retained even in the
1757 .Mx -sx
1758 .Sx "primary system mailbox" .
1760 .It Ql unread
1761 Message has neither been viewed nor moved to any other state, but the
1762 message was present already when the mailbox has been opened last:
1763 Such messages are retained even in the
1764 .Mx -sx
1765 .Sx "primary system mailbox" .
1767 .It Ql read
1768 The message has been processed by one of the following commands:
1769 .Ic ~f ,
1770 .Ic ~m ,
1771 .Ic ~F ,
1772 .Ic ~M ,
1773 .Ic copy ,
1774 .Ic mbox ,
1775 .Ic next ,
1776 .Ic pipe  ,
1777 .Ic Print ,
1778 .Ic print ,
1779 .Ic top ,
1780 .Ic Type ,
1781 .Ic type ,
1782 .Ic undelete .
1783 The commands
1784 .Ic dp
1786 .Ic dt
1787 will always try to automatically
1788 .Dq step
1790 .Ic type
1792 .Dq next
1793 logical message, and may thus mark multiple messages as read, the
1794 .Ic delete
1795 command will do so if  the internal variable
1796 .Va autoprint
1797 is set.
1798 Except when the
1799 .Ic exit
1800 command is used, messages that are in a
1801 .Mx -sx
1802 .Sx "primary system mailbox"
1803 and are in
1804 .Ql read
1805 state when the mailbox is left will be saved in the
1806 .Mx -sx
1807 .Sx "secondary mailbox"
1808 .Ev MBOX
1809 unless the internal variable
1810 .Va hold
1811 it set.
1813 .It Ql deleted
1814 The message has been processed by one of the following commands:
1815 .Ic delete ,
1816 .Ic dp ,
1817 .Ic dt .
1818 Only
1819 .Ic undelete
1820 can be used to access such messages.
1822 .It Ql preserved
1823 The message has been processed by a
1824 .Ic preserve
1825 command and it will be retained in its current location.
1827 .It Ql saved
1828 The message has been processed by one of the following commands:
1829 .Ic save
1831 .Ic write .
1832 Unless when the
1833 .Ic exit
1834 command is used, messages that are in a
1835 .Mx -sx
1836 .Sx "primary system mailbox"
1837 and are in
1838 .Ql saved
1839 state when the mailbox is left will be deleted; they will be saved in the
1840 .Mx -sx
1841 .Sx "secondary mailbox"
1842 .Ev MBOX
1843 when the internal variable
1844 .Va keepsave
1845 is set.
1849 In addition to these message states, flags which otherwise have no
1850 technical meaning in the mail system except allowing special ways of
1851 addressing them when
1852 .Sx "Specifying messages"
1853 can be set on messages.
1854 These flags are saved with messages and are thus persistent, and are
1855 portable between a set of widely used MUAs.
1857 .Bl -hang -width ".It Ic answered"
1858 .It Ic answered
1859 Mark messages as having been answered.
1860 .It Ic draft
1861 Mark messages as being a draft.
1862 .It Ic flag
1863 Mark messages which need special attention.
1865 .\" }}}
1867 .\" .Ss "Specifying messages" {{{
1868 .Ss "Specifying messages"
1870 Commands such as
1871 .Ic from ,
1872 .Ic type
1874 .Ic delete
1875 can be given a list of message numbers as arguments to apply to a number
1876 of messages at once.
1877 Thus
1878 .Ql delete 1 2
1879 deletes messages 1 and 2,
1880 whereas
1881 .Ql delete 1-5
1882 will delete the messages 1 through 5.
1883 In sorted or threaded mode (see the
1884 .Ic sort
1885 command),
1886 .Ql delete 1-5
1887 will delete the messages that are located between (and including)
1888 messages 1 through 5 in the sorted/threaded order, as shown in the
1889 .Ic headers
1890 summary.
1891 The following special message names exist:
1894 .Bl -tag -width ".It Ar BaNg"
1895 .It Ar \&.
1896 The current message, the so-called
1897 .Dq dot .
1899 .It Ar \&;
1900 The message that was previously the current message.
1902 .It Ar \&,
1903 The parent message of the current message,
1904 that is the message with the Message-ID given in the
1905 .Ql In-Reply-To:
1906 field or the last entry of the
1907 .Ql References:
1908 field of the current message.
1910 .It Ar -
1911 The next previous undeleted message,
1912 or the next previous deleted message for the
1913 .Ic undelete
1914 command.
1915 In sorted/threaded mode,
1916 the next previous such message in the sorted/threaded order.
1918 .It Ar +
1919 The next undeleted message,
1920 or the next deleted message for the
1921 .Ic undelete
1922 command.
1923 In sorted/threaded mode,
1924 the next such message in the sorted/threaded order.
1926 .It Ar ^
1927 The first undeleted message,
1928 or the first deleted message for the
1929 .Ic undelete
1930 command.
1931 In sorted/threaded mode,
1932 the first such message in the sorted/threaded order.
1934 .It Ar $
1935 The last message.
1936 In sorted/threaded mode,
1937 the last message in the sorted/threaded order.
1939 .It Ar & Ns Ar x
1940 In threaded mode,
1941 selects the message addressed with
1942 .Ar x ,
1943 where
1944 .Ar x
1945 is any other message specification,
1946 and all messages from the thread that begins at it.
1947 Otherwise it is identical to
1948 .Ar x .
1950 .Ar x
1951 is omitted,
1952 the thread beginning with the current message is selected.
1954 .It Ar *
1955 All messages.
1956 .It Ar `
1957 All messages that were included in the
1958 .Sx "Message list arguments"
1959 of the previous command.
1961 .It Ar x-y
1962 An inclusive range of message numbers.
1963 Selectors that may also be used as endpoints include any of
1964 .Ar .;-+^$ .
1966 .It Ar address
1967 A case-insensitive
1968 .Dq any substring matches
1969 search against the
1970 .Ql From:
1971 header, which will match addresses (too) even if
1972 .Va showname
1973 is set (and POSIX says
1974 .Dq any address as shown in a header summary shall be matchable in this form ) ;
1975 However, if the
1976 .Va allnet
1977 variable is set, only the local part of the address is evaluated
1978 for the comparison, not ignoring case, and the setting of
1979 .Va showname
1980 is completely ignored.
1981 For finer control and match boundaries use the
1982 .Ql @
1983 search expression.
1985 .It Ar / Ns Ar string
1986 All messages that contain
1987 .Ar string
1988 in the subject field (case ignored).
1989 See also the
1990 .Va searchheaders
1991 variable.
1993 .Ar string
1994 is empty,
1995 the string from the previous specification of that type is used again.
1997 .It Xo Op Ar @ Ns Ar name-list Ns
1998 .Ar @ Ns Ar expr
2000 All messages that contain the given case-insensitive search
2001 .Ar expr Ns
2002 ession; if the \*(OPal regular expression (see
2003 .Xr re_format 7 )
2004 support is available
2005 .Ar expr
2006 will be interpreted as (an extended) one if any of the
2007 .Dq magical
2008 (extended) regular expression characters is seen: in this case this
2009 should match strings correctly which are in the locale
2010 .Ev LC_CTYPE
2011 encoding.
2012 If the optional
2013 .Ar @ Ns Ar name-list
2014 part is missing, the search is restricted to the subject field body,
2015 but otherwise
2016 .Ar name-list
2017 specifies a comma-separated list of header fields to search, as in
2019 .Dl '@to,from,cc@Someone i ought to know'
2021 In order to search for a string that includes a
2022 .Ql @
2023 (commercial at) character the
2024 .Ar name-list
2025 is effectively non-optional, but may be given as the empty string.
2026 Some special header fields may be abbreviated:
2027 .Ql f ,
2028 .Ql t ,
2029 .Ql c ,
2030 .Ql b
2032 .Ql s
2033 will match
2034 .Ql From ,
2035 .Ql To ,
2036 .Ql Cc ,
2037 .Ql Bcc
2039 .Ql Subject ,
2040 respectively and case-insensitively.
2041 The special names
2042 .Ql header
2044 .Ql <
2045 can be used to search in (all of) the header(s) of the message, and the
2046 special names
2047 .Ql body
2049 .Ql >
2051 .Ql text
2053 .Ql =
2054 can be used to perform full text searches \(en whereas the former
2055 searches only the body, the latter also searches the message header.
2057 This message specification performs full text comparison, but even with
2058 regular expression support it is almost impossible to write a search
2059 expression that savely matches only a specific address domain.
2060 To request that the content of the header is treated as a list of
2061 addresses, and to strip those down to the plain email address which the
2062 search expression is to be matched against, prefix the header name
2063 (abbreviation) with a tilde
2064 .Ql ~ :
2066 .Dl @~f@@a\e.safe\e.domain\e.match$
2068 .It Ar :c
2069 All messages of state
2070 .Ql c ,
2071 where
2072 .Ql c
2073 is one or multiple of the following colon modifiers:
2075 .Bl -tag -compact -width ".It Ar :M"
2076 .It Ar n
2077 .Ql new
2078 messages.
2079 .It Ar o
2080 Old messages (any not in state
2081 .Ql read
2083 .Ql new ) .
2084 .It Ar u
2085 .Ql unread
2086 messages.
2087 .It Ar d
2088 .Ql deleted
2089 messages (for the
2090 .Ic undelete
2092 .Ic from
2093 commands only).
2094 .It Ar r
2095 .Ql read
2096 messages.
2097 .It Ar f
2098 .Ic flag Ns
2099 ged messages.
2100 .It Ar a
2101 .Ic answered
2102 messages (cf. the variable
2103 .Va markanswered ) .
2104 .It Ar t
2105 Messages marked as
2106 .Ic draft .
2107 .It Ar s
2108 \*(OP Messages classified as spam (see
2109 .Sx "Handling spam" . )
2110 .It Ar S
2111 \*(OP Messages with unsure spam classification.
2117 \*(OP IMAP-style SEARCH expressions may also be used.
2118 This addressing mode is available with all types of mailbox
2119 .Ic folder Ns
2120 s; \*(UA will perform the search locally as necessary.
2121 Strings must be enclosed by double quotes
2122 .Ql \&"
2123 in their entirety if they contain whitespace or parentheses;
2124 within the quotes, only reverse solidus
2125 .Ql \e
2126 is recognized as an escape character.
2127 All string searches are case-insensitive.
2128 When the description indicates that the
2129 .Dq envelope
2130 representation of an address field is used,
2131 this means that the search string is checked against both a list
2132 constructed as
2134 .Bd -literal -offset indent
2135 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2139 for each address,
2140 and the addresses without real names from the respective header field.
2141 These search expressions can be nested using parentheses, see below for
2142 examples.
2145 .Bl -tag -compact -width ".It Ar _n_u"
2146 .It Ar ( criterion )
2147 All messages that satisfy the given
2148 .Ar criterion .
2149 .It Ar ( criterion1 criterion2 ... criterionN )
2150 All messages that satisfy all of the given criteria.
2152 .It Ar ( or criterion1 criterion2 )
2153 All messages that satisfy either
2154 .Ar criterion1
2156 .Ar criterion2 ,
2157 or both.
2158 To connect more than two criteria using
2159 .Ql or
2160 specifications have to be nested using additional parentheses,
2161 as with
2162 .Ql (or a (or b c)) ,
2163 since
2164 .Ql (or a b c)
2165 really means
2166 .Ql ((a or b) and c) .
2167 For a simple
2168 .Ql or
2169 operation of independent criteria on the lowest nesting level,
2170 it is possible to achieve similar effects by using three separate
2171 criteria, as with
2172 .Ql (a) (b) (c) .
2174 .It Ar ( not criterion )
2175 All messages that do not satisfy
2176 .Ar criterion .
2177 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2178 All messages that contain
2179 .Ar string
2180 in the envelope representation of the
2181 .Ql Bcc:
2182 field.
2183 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2184 All messages that contain
2185 .Ar string
2186 in the envelope representation of the
2187 .Ql Cc:
2188 field.
2189 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2190 All messages that contain
2191 .Ar string
2192 in the envelope representation of the
2193 .Ql From:
2194 field.
2195 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2196 All messages that contain
2197 .Ar string
2198 in the
2199 .Ql Subject:
2200 field.
2201 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2202 All messages that contain
2203 .Ar string
2204 in the envelope representation of the
2205 .Ql To:
2206 field.
2207 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2208 All messages that contain
2209 .Ar string
2210 in the specified
2211 .Ql Name:
2212 field.
2213 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2214 All messages that contain
2215 .Ar string
2216 in their body.
2217 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2218 All messages that contain
2219 .Ar string
2220 in their header or body.
2221 .It Ar ( larger size )
2222 All messages that are larger than
2223 .Ar size
2224 (in bytes).
2225 .It Ar ( smaller size )
2226 All messages that are smaller than
2227 .Ar size
2228 (in bytes).
2230 .It Ar ( before date )
2231 All messages that were received before
2232 .Ar date ,
2233 which must be in the form
2234 .Ql d[d]-mon-yyyy ,
2235 where
2236 .Ql d
2237 denotes the day of the month as one or two digits,
2238 .Ql mon
2239 is the name of the month \(en one of
2240 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2242 .Ql yyyy
2243 is the year as four digits, e.g.,
2244 .Ql 28-Dec-2012 .
2246 .It Ar ( on date )
2247 All messages that were received on the specified date.
2248 .It Ar ( since date )
2249 All messages that were received since the specified date.
2250 .It Ar ( sentbefore date )
2251 All messages that were sent on the specified date.
2252 .It Ar ( senton date )
2253 All messages that were sent on the specified date.
2254 .It Ar ( sentsince date )
2255 All messages that were sent since the specified date.
2256 .It Ar ()
2257 The same criterion as for the previous search.
2258 This specification cannot be used as part of another criterion.
2259 If the previous command line contained more than one independent
2260 criterion then the last of those criteria is used.
2262 .\" }}}
2264 .\" .Ss "On URL syntax and credential lookup" {{{
2265 .Ss "On URL syntax and credential lookup"
2267 \*(IN For accessing protocol-specific resources usage of Uniform
2268 Resource Locators (URL, RFC 1738) has become omnipresent.
2269 \*(UA expects and understands URLs in the following form;
2270 parts in brackets
2271 .Ql []
2272 denote optional parts, optional either because there also exist other
2273 ways to define the information in question or because support of the
2274 part is protocol-specific (e.g.,
2275 .Ql /path
2276 is used by the local maildir and the IMAP protocol, but not by POP3);
2277 If any of
2278 .Ql USER
2280 .Ql PASSWORD
2281 are specified they must be given in URL percent encoded form (RFC 3986;
2282 the command
2283 .Ic urlcodec
2284 may be helpful):
2287 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
2290 Note that these \*(UA URLs most often do not conform to any real
2291 standard, but instead represent a normalized variant of RFC 1738 \(en
2292 they are not used in data exchange but only meant as a compact,
2293 easy-to-use way of defining and representing information in
2294 a well-known notation.
2297 Many internal variables of \*(UA exist in multiple versions, called
2298 variable chains for the rest of this document: the plain
2299 .Ql variable
2300 as well as
2301 .Ql variable-HOST
2303 .Ql variable-USER@HOST .
2304 Here
2305 .Ql HOST
2306 indeed means
2307 .Ql server:port
2308 if a
2309 .Ql port
2310 had been specified in the respective URL, otherwise it refers to the plain
2311 .Ql server .
2312 Also,
2313 .Ql USER
2314 is not truly the
2315 .Ql USER
2316 that had been found when doing the user chain lookup as is described
2317 below, i.e., this
2318 .Ql USER
2319 will never be in URL percent encoded form, whether it came from an URL
2320 or not; i.e., variable chain name extensions of
2321 .Sx "INTERNAL VARIABLES"
2322 must not be URL percent encoded.
2325 For example, whether an hypothetical URL
2326 .Ql smtp://hey%3Ayou@our.house
2327 had been given that includes a user, or whether the URL was
2328 .Ql smtp://our.house
2329 and the user had been found differently, to lookup the variable chain
2330 .Va smtp-use-starttls
2331 \*(UA first looks for whether
2332 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
2333 is defined, then whether
2334 .Ql smtp-\:use-\:starttls-\:our.house
2335 exists before finally ending up looking at the plain variable itself.
2338 \*(UA obeys the following logic scheme when dealing with the
2339 necessary credential information of an account:
2341 .Bl -bullet
2343 If no
2344 .Ql USER
2345 has been given in the URL the variables
2346 .Va user-HOST
2348 .Va user
2349 are looked up; if no such variable(s) can be found then \*(UA will,
2350 when enforced by the \*(OPal variables
2351 .Va netrc-lookup-HOST
2353 .Va netrc-lookup ,
2354 search the users
2355 .Pa .netrc
2356 file for a
2357 .Ql HOST
2358 specific entry which provides a
2359 .Ql login
2360 name: this lookup will only succeed if unambiguous (one possible matching
2361 entry for
2362 .Ql HOST ) .
2363 It is possible to load encrypted
2364 .Pa .netrc
2365 files via
2366 .Va netrc-pipe .
2368 If there is still no
2369 .Ql USER
2370 then \*(UA will fall back to the user who is supposed to run \*(UA,
2371 the identity of which has been fixated during \*(UA startup and is
2372 known to be a valid user on the current host.
2375 Authentication: unless otherwise noted this will lookup the
2376 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
2377 variable chain, falling back to a protocol-specific default should this
2378 have no success.
2381 If no
2382 .Ql PASSWORD
2383 has been given in the URL, then if the
2384 .Ql USER
2385 has been found through the \*(OPal
2386 .Va netrc-lookup
2387 that may have already provided the password, too.
2388 Otherwise the variable chain
2389 .Va password-USER@HOST , password-HOST , password
2390 is looked up and used if existent.
2392 Afterwards the complete \*(OPal variable chain
2393 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
2394 is looked up.
2395 If set, the
2396 .Pa .netrc
2397 cache is searched for a password only (multiple user accounts for
2398 a single machine may exist as well as a fallback entry without user
2399 but with a password).
2401 If at that point there is still no password available, but the
2402 (protocols') chosen authentication type requires a password, then in
2403 interactive mode the user will be prompted on the terminal.
2407 .Sy Note:
2408 S/MIME verification works relative to the values found in the
2409 .Ql From:
2411 .Ql Sender: )
2412 header field(s), which means that the values of
2413 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
2415 .Va smime-sign-message-digest
2416 will not be looked up using the
2417 .Ql USER
2419 .Ql HOST
2420 chains from above but instead use the corresponding values from the
2421 message that is being worked on.
2422 In unusual cases multiple and different
2423 .Ql USER
2425 .Ql HOST
2426 combinations may therefore be involved \(en on the other hand those
2427 unusual cases become possible.
2428 The usual case is as short as:
2431 .Dl set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
2432 .Dl \ \ \ \ smime-sign smime-sign-cert=+smime.pair
2435 The section
2436 .Sx EXAMPLES
2437 contains complete example configurations.
2438 .\" }}}
2440 .\" .Ss "On terminal control and line editor" {{{
2441 .Ss "On terminal control and line editor"
2443 \*(OP Terminal control will be realized through one of the standard
2445 libraries, either the
2446 .Lb libtermcap ,
2447 or, alternatively, the
2448 .Lb libterminfo ,
2449 both of which will be initialized to work with the environment variable
2450 .Ev TERM .
2451 Terminal control will enhance or enable interactive usage aspects, e.g.,
2452 .Sx "Coloured display" ,
2453 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2454 byte-sequences of keys like the cursor and function keys.
2455 The internal variable
2456 .Va termcap
2457 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2458 \*(UA may also become a full-screen application by entering the
2459 so-called ca-mode and switching to an alternative \*(UA-exclusive screen
2460 shall the terminal support it and the internal variable
2461 .Va termcap-ca-mode
2462 has been set explicitly.
2463 Actual interaction with the chosen library can be disabled completely by
2464 setting the internal variable
2465 .Va termcap-disable ;
2466 .Va termcap
2467 will be queried regardless, even if the \*(OPal support for the
2468 libraries has not been enabled at configuration time.
2471 \*(OP The built-in \*(UA Mailx-Line-Editor (MLE) should work in all
2472 environments which comply to the ISO C standard
2473 .St -isoC-amd1 ,
2474 and will support wide glyphs if possible (the necessary functionality
2475 had been removed from ISO C, but was included in
2476 .St -xpg4 ) .
2477 Prevent usage of a line editor in interactive mode by setting the
2478 internal variable
2479 .Va line-editor-disable .
2480 Especially if the \*(OPal terminal control support is missing setting
2481 entries in the internal variable
2482 .Va termcap
2483 will help shall the MLE misbehave, see there for more.
2484 The MLE can support a little bit of
2485 .Ic colour .
2488 \*(OP If the
2489 .Ic history
2490 feature is available then input from line editor prompts will be saved
2491 in a history list that can be searched in and be expanded from.
2492 Such saving can be prevented by prefixing input with any amount of
2493 whitespace.
2494 Aspects of history, like allowed content and maximum size, as well as
2495 whether history shall be saved persistently, can be configured with the
2496 internal variables
2497 .Va history-file ,
2498 .Va history-gabby ,
2499 .Va history-gabby-persist
2501 .Va history-size .
2504 The MLE supports a set of editing and control commands.
2505 By default (as) many (as possible) of these will be assigned to a set of
2506 single-letter control codes, which should work on any terminal (and can
2507 be generated by holding the
2508 .Dq control
2509 key while pressing the key of desire, e.g.,
2510 .Ql control-D ) .
2511 If the \*(OPal
2512 .Ic bind
2513 command is available then the MLE commands can also be accessed freely
2514 by assigning the command name, which is shown in parenthesis in the list
2515 below, to any desired key-sequence, and the MLE will instead and also use
2516 .Ic bind
2517 to establish its built-in key bindings
2518 (more of them if the \*(OPal terminal control is available),
2519 an action which can then be suppressed completely by setting
2520 .Va line-editor-no-defaults .
2521 .Sx "Shell-style argument quoting"
2522 notation is used in the following;
2523 combinations not mentioned either cause job control signals or do not
2524 generate a (unique) keycode:
2528 .Bl -tag -compact -width ".It Ql Ba"
2529 .It Ql \ecA
2530 Go to the start of the line
2532 .Pf ( Cd mle-go-home ) .
2534 .It Ql \ecB
2535 Move the cursor backward one character
2537 .Pf ( Cd mle-go-bwd ) .
2539 .It Ql \ecD
2540 Forward delete the character under the cursor;
2541 quits \*(UA if used on the empty line unless the internal variable
2542 .Va ignoreeof
2543 is set
2545 .Pf ( Cd mle-del-fwd ) .
2547 .It Ql \ecE
2548 Go to the end of the line
2550 .Pf ( Cd mle-go-end ) .
2552 .It Ql \ecF
2553 Move the cursor forward one character
2555 .Pf ( Cd mle-go-fwd ) .
2557 .It Ql \ecG
2558 Cancel current operation, full reset.
2559 If there is an active history search or tabulator expansion then this
2560 command will first reset that, reverting to the former line content;
2561 thus a second reset is needed for a full reset in this case
2563 .Pf ( Cd mle-reset ) .
2565 .It Ql \ecH
2566 Backspace: backward delete one character
2568 .Pf ( Cd mle-del-bwd ) .
2570 .It Ql \ecI
2571 \*(NQ
2572 Horizontal tabulator:
2573 try to expand the word before the cursor, supporting the usual
2574 .Sx "Filename transformations"
2576 .Pf ( Cd mle-complete ) .
2577 This is affected by
2578 .Cd mle-quote-rndtrip .
2580 .It Ql \ecJ
2581 Newline:
2582 commit the current line
2584 .Pf ( Cd mle-commit ) .
2586 .It Ql \ecK
2587 Cut all characters from the cursor to the end of the line
2589 .Pf ( Cd mle-snarf-end ) .
2591 .It Ql \ecL
2592 Repaint the line
2594 .Pf ( Cd mle-repaint ) .
2596 .It Ql \ecN
2597 \*(OP Go to the next history entry
2599 .Pf ( Cd mle-hist-fwd ) .
2601 .It Ql \ecO
2602 (\*(OPally context-dependent) Invokes the command
2603 .Ic dt .
2605 .It Ql \ecP
2606 \*(OP Go to the previous history entry
2608 .Pf ( Cd mle-hist-bwd ) .
2610 .It Ql \ecQ
2611 Toggle roundtrip mode shell quotes, where produced,
2612 on and off
2614 .Pf ( Cd mle-quote-rndtrip ) .
2615 This setting is temporary, and will be forgotten once the command line
2616 is committed; also see
2617 .Ic shcodec .
2619 .It Ql \ecR
2620 \*(OP Complete the current line from (the remaining) older history entries
2622 .Pf ( Cd mle-hist-srch-bwd ) .
2624 .It Ql \ecS
2625 \*(OP Complete the current line from (the remaining) newer history entries
2627 .Pf ( Cd mle-hist-srch-fwd ) .
2629 .It Ql \ecT
2630 Paste the snarf buffer
2632 .Pf ( Cd mle-paste ) .
2634 .It Ql \ecU
2635 The same as
2636 .Ql \ecA
2637 followed by
2638 .Ql \ecK
2640 .Pf ( Cd mle-snarf-line ) .
2642 .It Ql \ecV
2643 Prompts for a Unicode character (its hexadecimal number) to be inserted
2645 .Pf ( Cd mle-prompt-char ) .
2646 Note this command needs to be assigned to a single-letter control code
2647 in order to become recognized and executed during input of
2648 a key-sequence (only three single-letter control codes can be used for
2649 that shortcut purpose); this control code is special-treated and cannot
2650 be part of any other sequence, because any occurrence will perform the
2651 .Cd mle-prompt-char
2652 function immediately.
2654 .It Ql \ecW
2655 Cut the characters from the one preceding the cursor to the preceding
2656 word boundary
2658 .Pf ( Cd mle-snarf-word-bwd ) .
2660 .It Ql \ecX
2661 Move the cursor forward one word boundary
2663 .Pf ( Cd mle-go-word-fwd ) .
2665 .It Ql \ecY
2666 Move the cursor backward one word boundary
2668 .Pf ( Cd mle-go-word-bwd ) .
2670 .It Ql \ec[
2671 Escape: reset a possibly used multibyte character input state machine
2672 and \*(OPally a lingering, incomplete key binding
2674 .Pf ( Cd mle-cancel ) .
2675 This command needs to be assigned to a single-letter control code in
2676 order to become recognized and executed during input of a key-sequence
2677 (only three single-letter control codes can be used for that shortcut
2678 purpose).
2679 This control code may also be part of a multi-byte sequence, but if
2680 a sequence is active and the very control code is currently also an
2681 expected input, then it will first be consumed by the active sequence.
2683 .It Ql \ec\e
2684 (\*(OPally context-dependent) Invokes the command
2685 .Ql Ic z Ns + .
2687 .It Ql \ec]
2688 (\*(OPally context-dependent) Invokes the command
2689 .Ql Ic z Ns $ .
2691 .It Ql \ec^
2692 (\*(OPally context-dependent) Invokes the command
2693 .Ql Ic z Ns 0 .
2695 .It Ql \ec_
2696 Cut the characters from the one after the cursor to the succeeding word
2697 boundary
2699 .Pf ( Cd mle-snarf-word-fwd ) .
2701 .It Ql \ec?
2702 Backspace:
2703 .Cd mle-del-bwd .
2705 .It \(en
2707 .Cd mle-fullreset :
2708 in difference to
2709 .Cd mle-reset
2710 this will immediately reset a possibly active search etc.
2712 .It \(en
2714 .Cd mle-bell :
2715 ring the audible bell.
2717 .\" }}}
2719 .\" .Ss "Coloured display" {{{
2720 .Ss "Coloured display"
2722 \*(OP \*(UA can be configured to support a coloured display and font
2723 attributes by emitting ANSI / ISO 6429 SGR (select graphic rendition)
2724 escape sequences.
2725 Usage of colours and font attributes solely depends upon the
2726 capability of the detected terminal type that is defined by the
2727 environment variable
2728 .Ev TERM
2729 and which can be fine-tuned by the user via the internal variable
2730 .Va termcap .
2733 On top of what \*(UA knows about the terminal the boolean variable
2734 .Va colour-pager
2735 defines whether the actually applicable colour and font attribute
2736 sequences should also be generated when output is going to be paged
2737 through the external program defined by the environment variable
2738 .Ev PAGER
2739 (also see
2740 .Va crt Ns
2742 This is not enabled by default because different pager programs need
2743 different command line switches or other configuration in order to
2744 support those sequences.
2745 \*(UA however knows about some widely used pagers and in a clean
2746 environment it is often enough to simply set
2747 .Va colour-pager ;
2748 please refer to that variable for more on this topic.
2751 If the variable
2752 .Va colour-disable
2753 is set then any active usage of colour and font attribute sequences
2754 is suppressed, but without affecting possibly established
2755 .Ic colour
2756 mappings.
2759 To define and control colours and font attributes a single multiplexer
2760 command family exists:
2761 .Ic colour
2762 shows or defines colour mappings for the given colour type (e.g.,
2763 monochrome) and
2764 .Ic uncolour
2765 can be used to remove mappings of a given colour type.
2766 Since colours are only available in interactive mode, it may make
2767 sense to conditionalize the colour setup by encapsulating it with
2768 .Ic if :
2770 .Bd -literal -offset indent
2771 if terminal && $features =@ +colour
2772   colour iso  view-msginfo  ft=bold,fg=green
2773   colour iso  view-header   ft=bold,fg=red   "from,subject"
2774   colour iso  view-header   fg=red
2776   uncolour iso view-header  from,subject
2777   colour iso  view-header   ft=bold,fg=magenta,bg=cyan
2778   colour 256  view-header   ft=bold,fg=208,bg=230 subject,from
2779   colour mono view-header   ft=bold
2780   colour mono view-header   ft=bold,ft=reverse subject,from
2781 endif
2783 .\" }}}
2784 .\" }}} (DESCRIPTION)
2787 .\" .Sh COMMANDS {{{
2788 .Sh COMMANDS
2790 Each command is typed on a line by itself,
2791 and may take arguments following the command word.
2792 An unquoted reverse solidus
2793 .Ql \e
2794 at the end of a command line
2795 .Dq escapes
2796 the newline character: it is discarded and the next line of input is
2797 used as a follow-up line, with all leading whitespace removed;
2798 once the entire command line is completed, the processing that is
2799 documented in the following, after removal of the whitespace characters
2800 .Cm space , tabulator , newline
2801 as well as those defined by the variable
2802 .Va ifs
2803 from the beginning and end of the line, begins.
2804 Placing any whitespace characters at the beginning of a line will
2805 prevent a possible addition of the command line to the \*(OPal history.
2808 Apart from this generic cleanup mechanism \*(UA uses command-specific
2809 syntax rules for command line arguments, documented in the following.
2810 This is a completely different approach to the
2811 .Xr sh 1 Ns
2812 ell, which implements a standardized (programming) language, and
2813 performs several successive transformation steps after decomposing the
2814 given command line into tokens following standardized syntax guidelines.
2815 E.g., in the following code snippets of otherwise identical meaning,
2816 a shell will see zero arguments, whereas \*(UA sees one, unless an
2817 additional expansion is explicitly used:
2819 .Bd -literal -offset indent
2820 $ cat > t.sh << '___'; cat > t.rc << '___'
2821 x() { echo $#; }
2822 set --
2823 x "$@"
2825 define x {
2826   echo $#
2828 vpospar set
2829 call x "$@"
2830 eval call x "$@"
2832 $ sh t.sh; \*(uA -X'source t.rc' -Xx
2839 Command names may be abbreviated, in which case the first command that
2840 matches the given prefix will be used.
2841 The command
2842 .Ic list
2843 can be used to show the list of all commands, either alphabetically
2844 sorted or in prefix search order (these do not match, also because the
2845 POSIX standard prescribes a set of abbreviations).
2846 \*(OPally the command
2847 .Ic help
2849 .Ic \&? ) ,
2850 when given an argument, will show a documentation string for the
2851 command matching the expanded argument, as in
2852 .Ql ?t ,
2853 which should be a shorthand of
2854 .Ql ?type ;
2855 with these documentation strings both commands support a more
2856 .Va verbose
2857 listing mode which includes the argument type of the command and other
2858 information which applies; a handy suggestion might thus be:
2860 .Bd -literal -offset indent
2861 ? define __xv {
2862   # Before v15: need to enable sh(1)ell-style on _entire_ line!
2863   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
2865 ? commandalias xv '\ecall __xv'
2866 ? xv help set
2869 .\" .Ss "Command modifiers" {{{
2870 .Ss "Command modifiers"
2872 Commands may be prefixed by one or multiple command modifiers.
2874 .Bl -bullet
2876 The modifier reverse solidus
2878 .Cm \e ,
2879 to be placed first, prevents
2880 .Ic commandalias
2881 expansions on the remains of the line, e.g.,
2882 .Ql \eecho
2883 will always evaluate the command
2884 .Ic echo ,
2885 even if an (command)alias of the same name exists.
2886 .Ic commandalias
2887 content may itself contain further command modifiers, including
2888 an initial reverse solidus to prevent further expansions.
2891 The modifier
2893 .Cm ignerr
2894 indicates that any error generated by the following command should be
2895 ignored by the state machine and not cause a program exit with enabled
2896 .Va errexit
2897 or for the standardized exit cases in
2898 .Ev POSIXLY_CORRECT
2899 mode.
2900 .Va \&? ,
2901 one of the
2902 .Sx "INTERNAL VARIABLES" ,
2903 will be set to the real exit status of the command regardless.
2906 Some commands support the
2908 .Cm vput
2909 modifier: if used, they expect the name of a variable, which can itself
2910 be a variable, i.e., shell expansion is applied, as their first
2911 argument, and will place their computation result in it instead of the
2912 default location (it is usually written to standard output).
2914 The given name will be tested for being a valid
2915 .Xr sh 1
2916 variable name, and may therefore only consist of upper- and lowercase
2917 characters, digits, and the underscore; the hyphen-minus may be used as
2918 a non-portable extension; digits may not be used as first, hyphen-minus
2919 may not be used as last characters.
2920 In addition the name may either not be one of the known
2921 .Sx "INTERNAL VARIABLES" ,
2922 or must otherwise refer to a writable (non-boolean) value variable.
2923 The actual put operation may fail nonetheless, e.g., if the variable
2924 expects a number argument only a number will be accepted.
2925 Any error during these operations causes the command as such to fail,
2926 and the error number
2927 .Va \&!
2928 will be set to
2929 .Va ^ERR Ns -NOTSUP ,
2930 the exit status
2931 .Va \&?
2932 should be set to
2933 .Ql -1 .
2936 Last, but not least, the modifier
2938 .Cm wysh
2939 can be used for some old and established commands to choose the new
2940 .Sx "Shell-style argument quoting"
2941 rules over the traditional
2942 .Sx "Old-style argument quoting" .
2944 .\" }}}
2946 .\" .Ss "Message list arguments" {{{
2947 .Ss "Message list arguments"
2949 Some commands expect arguments that represent messages (actually
2950 their symbolic message numbers), as has been documented above under
2951 .Sx "Specifying messages"
2952 already.
2953 If no explicit message list has been specified, the next message
2954 forward that satisfies the command's requirements will be used,
2955 and if there are no messages forward of the current message,
2956 the search proceeds backwards;
2957 if there are no good messages at all to be found, an error message is
2958 shown and the command is aborted.
2959 .\" }}}
2961 .\" .Ss "Old-style argument quoting" {{{
2962 .Ss "Old-style argument quoting"
2964 \*(ID This section documents the old, traditional style of quoting
2965 non-message-list arguments to commands which expect this type of
2966 arguments: whereas still used by the majority of such commands, the new
2967 .Sx "Shell-style argument quoting"
2968 may be available even for those via
2969 .Cm wysh ,
2970 one of the
2971 .Sx "Command modifiers" .
2972 Nonetheless care must be taken, because only new commands have been
2973 designed with all the capabilities of the new quoting rules in mind,
2974 which can, e.g., generate control characters.
2977 .Bl -bullet -offset indent
2979 An argument can be enclosed between paired double-quotes
2980 .Ql """argument"""
2982 single-quotes
2983 .Ql 'argument' ;
2984 any whitespace, shell word expansion, or reverse solidus characters
2985 (except as described next) within the quotes are treated literally as
2986 part of the argument.
2987 A double-quote will be treated literally within single-quotes and vice
2988 versa.
2989 Inside such a quoted string the actually used quote character can be
2990 used nonetheless by escaping it with a reverse solidus
2991 .Ql \e ,
2992 as in
2993 .Ql """y\e""ou""" .
2996 An argument that is not enclosed in quotes, as above, can usually still
2997 contain space characters if those spaces are reverse solidus escaped, as in
2998 .Ql you\e are .
3001 A reverse solidus outside of the enclosing quotes is discarded
3002 and the following character is treated literally as part of the argument.
3004 .\" }}}
3006 .\" .Ss "Shell-style argument quoting" {{{
3007 .Ss "Shell-style argument quoting"
3009 Commands which don't expect message-list arguments use
3010 .Xr sh 1 Ns
3011 ell-style, and therefore POSIX standardized, argument parsing and
3012 quoting rules.
3013 \*(ID Most new commands only support these new rules and are flagged
3014 \*(NQ, some elder ones can use them with the command modifier
3015 .Cm wysh ;
3016 in the future only this type of argument quoting will remain.
3019 A command line is parsed from left to right and an input token is
3020 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3021 Metacharacters are vertical bar
3022 .Cm \&| ,
3023 ampersand
3024 .Cm & ,
3025 semicolon
3026 .Cm \&; ,
3027 as well as all characters from the variable
3028 .Va ifs ,
3029 and / or
3030 .Cm space , tabulator , newline .
3031 The additional metacharacters left and right parenthesis
3032 .Cm \&( , \&)
3033 and less-than and greater-than signs
3034 .Cm < , >
3035 that the
3036 .Xr sh 1
3037 supports are not used, and are treated as ordinary characters: for one
3038 these characters are a vivid part of email addresses, and it seems
3039 highly unlikely that their function will become meaningful to \*(UA.
3041 .Bd -filled -offset indent
3042 .Sy Compatibility note:
3043 \*(ID Please note that even many new-style commands do not yet honour
3044 .Va ifs
3045 to parse their arguments: whereas the
3046 .Xr sh 1 Ns
3047 ell is a language with syntactic elements of clearly defined semantics,
3048 \*(UA parses entire input lines and decides on a per-command base what
3049 to do with the rest of the line.
3050 This also means that whenever an unknown command is seen all that \*(UA
3051 can do is cancellation of the processing of the remains of the line.
3053 It also often depends on an actual subcommand of a multiplexer command
3054 how the rest of the line should be treated, and until v15 we are not
3055 capable to perform this deep inspection of arguments.
3056 Nonetheless, at least the following commands which work with positional
3057 parameters fully support
3058 .Va ifs
3059 for an almost shell-compatible field splitting:
3060 .Ic call , call_if , read , vpospar , xcall .
3064 Any unquoted number sign
3065 .Ql #
3066 at the beginning of a new token starts a comment that extends to the end
3067 of the line, and therefore ends argument processing.
3068 An unquoted dollar sign
3069 .Ql $
3070 will cause variable expansion of the given name, which must be a valid
3071 .Xr sh 1 Ns
3072 ell-style variable name (see
3073 .Cm vput ) :
3074 .Sx "INTERNAL VARIABLES"
3075 as well as
3076 .Sx ENVIRONMENT
3077 (shell) variables can be accessed through this mechanism, brace
3078 enclosing the name is supported (i.e., to subdivide a token).
3081 Whereas the metacharacters
3082 .Cm space , tabulator , newline
3083 only complete an input token, vertical bar
3084 .Cm \&| ,
3085 ampersand
3086 .Cm &
3087 and semicolon
3088 .Cm \&;
3089 also act as control operators and perform control functions.
3090 For now supported is semicolon
3091 .Cm \&; ,
3092 which terminates a single command, therefore sequencing the command line
3093 and making the remainder of the line a subject to reevaluation.
3094 With sequencing, multiple command argument types and quoting rules may
3095 therefore apply to a single line, which can become problematic before
3096 v15: e.g., the first of the following will cause surprising results.
3099 .Dl ? echo one; set verbose; echo verbose=$verbose.
3100 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3103 Quoting is a mechanism that will remove the special meaning of
3104 metacharacters and reserved words, and will prevent expansion.
3105 There are four quoting mechanisms: the escape character, single-quotes,
3106 double-quotes and dollar-single-quotes:
3109 .Bl -bullet -offset indent
3111 The literal value of any character can be preserved by preceding it
3112 with the escape character reverse solidus
3113 .Ql \e .
3116 Arguments which are enclosed in
3117 .Ql 'single-\:quotes'
3118 retain their literal value.
3119 A single-quote cannot occur within single-quotes.
3122 The literal value of all characters enclosed in
3123 .Ql \(dqdouble-\:quotes\(dq
3124 is retained, with the exception of dollar sign
3125 .Ql $ ,
3126 which will cause variable expansion, as above, backquote (grave accent)
3127 .Ql ` ,
3128 (which not yet means anything special), reverse solidus
3129 .Ql \e ,
3130 which will escape any of the characters dollar sign
3131 .Ql $
3132 (to prevent variable expansion), backquote (grave accent)
3133 .Ql ` ,
3134 double-quote
3135 .Ql \(dq
3136 (to prevent ending the quote) and reverse solidus
3137 .Ql \e
3138 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3139 but has no special meaning otherwise.
3142 Arguments enclosed in
3143 .Ql $'dollar-\:single-\:quotes'
3144 extend normal single quotes in that reverse solidus escape sequences are
3145 expanded as follows:
3147 .Bl -tag -compact -width "Ql \eNNN"
3148 .It Ql \ea
3149 bell control character (ASCII and ISO-10646 BEL).
3150 .It Ql \eb
3151 backspace control characer (ASCII and ISO-10646 BS).
3152 .It Ql \eE
3153 escape control character (ASCII and ISO-10646 ESC).
3154 .It Ql \ee
3155 escape control character.
3156 .It Ql \ef
3157 form feed control character (ASCII and ISO-10646 FF).
3158 .It Ql \en
3159 line feed control character (ASCII and ISO-10646 LF).
3160 .It Ql \er
3161 carriage return control character (ASCII and ISO-10646 CR).
3162 .It Ql \et
3163 horizontal tabulator control character (ASCII and ISO-10646 HT).
3164 .It Ql \ev
3165 vertical tabulator control character (ASCII and ISO-10646 VT).
3166 .It Ql \e\e
3167 emits a reverse solidus character.
3168 .It Ql \e'
3169 single quote.
3170 .It Ql \e"
3171 double quote (escaping is optional).
3172 .It Ql \eNNN
3173 eight-bit byte with the octal value
3174 .Ql NNN
3175 (one to three octal digits), optionally prefixed by an additional
3176 .Ql 0 .
3177 A 0 byte will suppress further output for the quoted argument.
3178 .It Ql \exHH
3179 eight-bit byte with the hexadecimal value
3180 .Ql HH
3181 (one or two hexadecimal characters).
3182 A 0 byte will suppress further output for the quoted argument.
3183 .It Ql \eUHHHHHHHH
3184 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3185 .Ql HHHHHHHH
3186 (one to eight hexadecimal digits) \(em note that Unicode defines the
3187 maximum codepoint ever to be supported as
3188 .Ql 0x10FFFF
3189 (in planes of
3190 .Ql 0xFFFF
3191 characters each).
3192 This escape is only supported in locales that support Unicode (see
3193 .Sx "Character sets" ) ,
3194 in other cases the sequence will remain unexpanded unless the given code
3195 point is ASCII compatible or can be represented in the current locale.
3196 The character NUL will suppress further output for the quoted argument.
3197 .It Ql \euHHHH
3198 Identical to
3199 .Ql \eUHHHHHHHH
3200 except it takes only one to four hexadecimal digits.
3201 .It Ql \ecX
3202 Emits the non-printable (ASCII and compatible) C0 control codes
3203 0 (NUL) to 31 (US), and 127 (DEL).
3204 Printable representations of ASCII control codes can be created by
3205 mapping them to a different part of the ASCII character set, which is
3206 possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is
3207 .Ql 7 + 64 = 71 = G .
3208 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3209 .Ic vexpr ) ,
3210 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3211 .Ql ? vexpr ^ 127 64 .
3213 Whereas historically circumflex notation has often been used for
3214 visualization purposes of control codes, e.g.,
3215 .Ql ^G ,
3216 the reverse solidus notation has been standardized:
3217 .Ql \ecG .
3218 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3219 as shown above (e.g.,
3220 .Ql \ea ,
3221 .Ql \en ,
3222 .Ql \et ) :
3223 whenever such an alias exists it will be used for display purposes.
3224 The control code NUL
3225 .Pf ( Ql \ec@ ,
3226 a non-standard extension) will suppress further output for the remains
3227 of the token (which may extend beyond the current quote), or, depending
3228 on the context, the remains of all arguments for the current command.
3229 .It Ql \e$NAME
3230 Non-standard extension: expand the given variable name, as above.
3231 Brace enclosing the name is supported.
3232 .It Ql \e`{command}
3233 Not yet supported, just to raise awareness: Non-standard extension.
3238 Caveats:
3240 .Bd -literal -offset indent
3241 echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3242 echo Quotes ${HOME} and tokens differ! # comment
3243 echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3245 .\" }}}
3247 .\" .Ss "Raw data arguments for codec commands" {{{
3248 .Ss "Raw data arguments for codec commands"
3250 A special set of commands, which all have the string
3251 .Dq codec
3252 in their name, e.g.,
3253 .Ic addrcodec ,
3254 .Ic shcodec ,
3255 .Ic urlcodec ,
3256 take raw string data as input, which means that the content of the
3257 command input line is passed completely unexpanded and otherwise
3258 unchanged: like this the effect of the actual codec is visible without
3259 any noise of possible shell quoting rules etc., i.e., the user can input
3260 one-to-one the desired or questionable data.
3261 To gain a level of expansion, the entire command line can be
3262 .Ic eval Ns
3263 uated first, e.g.,
3265 .Bd -literal -offset indent
3266 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3267 ? echo $res
3268 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3269 ? shcodec d $res
3270 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3271 ? eval shcodec d $res
3272 /usr/Sch\[:o]nes Wetter/heute.txt
3274 .\" }}}
3276 .\" .Ss "Filename transformations" {{{
3277 .Ss "Filename transformations"
3279 Filenames, where expected, and unless documented otherwise, are
3280 subsequently subject to the following filename transformations, in
3281 sequence:
3283 .Bl -bullet -offset indent
3285 If the given name is a registered
3286 .Ic shortcut ,
3287 it will be replaced with the expanded shortcut.
3290 The filename is matched against the following patterns or strings:
3292 .Bl -hang -compact -width ".Ar %user"
3293 .It Ar #
3294 (Number sign) is expanded to the previous file.
3295 .It Ar %
3296 (Percent sign) is replaced by the invoking
3297 .Mx -ix "primary system mailbox"
3298 user's primary system mailbox, which either is the (itself expandable)
3299 .Va inbox
3300 if that is set, the standardized absolute pathname indicated by
3301 .Ev MAIL
3302 if that is set, or a built-in compile-time default otherwise.
3303 .It Ar %user
3304 Expands to the primary system mailbox of
3305 .Ar user
3306 (and never the value of
3307 .Va inbox ,
3308 regardless of its actual setting).
3309 .It Ar &
3310 (Ampersand) is replaced with the invoking users
3311 .Mx -ix "secondary mailbox"
3312 secondary mailbox, the
3313 .Ev MBOX .
3314 .It Ar +file
3315 Refers to a
3316 .Ar file
3317 in the
3318 .Va folder
3319 directory (if that variable is set).
3320 .It Ar %:filespec
3321 Expands to the same value as
3322 .Ar filespec ,
3323 but has special meaning when used with, e.g., the command
3324 .Ic file :
3325 the file will be treated as a primary system mailbox by, e.g., the
3326 .Ic mbox
3328 .Ic save
3329 commands, meaning that messages that have been read in the current
3330 session will be moved to the
3331 .Ev MBOX
3332 mailbox instead of simply being flagged as read.
3336 Meta expansions are applied to the resulting filename, as applicable to
3337 the resulting file access protocol (also see
3338 .Sx "On URL syntax and credential lookup" ) .
3339 If the fully expanded filename results in multiple pathnames and the
3340 command is expecting only one file, an error results.
3342 For the file-protocol, a leading tilde
3343 .Ql ~
3344 character will be replaced by the expansion of
3345 .Ev HOME ,
3346 except when followed by a valid user name, in which case the home
3347 directory of the given user is used instead.
3349 In addition a shell expansion as if specified in double-quotes (see
3350 .Sx "Shell-style argument quoting" )
3351 is applied, so that any occurrence of
3352 .Ql $VARIABLE
3354 .Ql ${VARIABLE} )
3355 will be replaced by the expansion of the variable, if possible;
3356 .Sx "INTERNAL VARIABLES"
3357 as well as
3358 .Sx ENVIRONMENT
3359 (shell) variables can be accessed through this mechanism.
3361 In interactive context, in order to allow simple value acceptance (via
3362 .Dq ENTER ) ,
3363 arguments will usually be displayed in a properly quoted form, e.g., a file
3364 .Ql diet\e is \ecurd.txt
3365 may be displayed as
3366 .Ql 'diet\e is \ecurd.txt' .
3368 .\" }}}
3370 .\" .Ss "Commands" {{{
3371 .Ss "Commands"
3373 The following commands are available:
3375 .Bl -tag -width ".It Ic BaNg"
3379 .It Ic \&!
3380 Executes the
3381 .Ev SHELL
3382 command which follows, replacing unescaped exclamation marks with the
3383 previously executed command if the internal variable
3384 .Va bang
3385 is set.
3386 This command supports
3387 .Cm vput
3388 as documented in
3389 .Sx "Command modifiers" ,
3390 and manages the error number
3391 .Va \&! .
3392 A 0 or positive exit status
3393 .Va \&?
3394 reflects the exit status of the command, negative ones that
3395 an error happened before the command was executed, or that the program
3396 did not exit cleanly, but, e.g., due to a signal: the error number is
3397 .Va ^ERR Ns -CHILD ,
3398 then.
3401 In conjunction with the
3402 .Cm vput
3403 modifier the following special cases exist:
3404 a negative exit status occurs if the collected data could not be stored
3405 in the given variable, which is a
3406 .Va ^ERR Ns -NOTSUP
3407 error that should otherwise not occur.
3408 .Va ^ERR Ns -CANCELED
3409 indicates that no temporary file could be created to collect the command
3410 output at first glance.
3411 In case of catchable out-of-memory situations
3412 .Va ^ERR Ns -NOMEM
3413 will occur and \*(UA will try to store the empty string, just like with
3414 all other detected error conditions.
3418 .It Ic #
3419 The comment-command causes the entire line to be ignored.
3420 .Sy Note:
3421 this really is a normal command which' purpose is to discard its
3422 arguments, not a
3423 .Dq comment-start
3424 indicating special character, which means that, e.g., trailing comments
3425 on a line are not possible.
3428 .It Ic +
3429 Goes to the next message in sequence and types it
3430 (like
3431 .Dq ENTER ) .
3434 .It Ic -
3435 Display the preceding message, or the n'th previous message if given
3436 a numeric argument n.
3439 .It Ic =
3440 Show the current message number (the
3441 .Dq dot ) .
3444 .It Ic \&?
3445 Show a brief summary of commands.
3446 \*(OP Given an argument a synopsis for the command in question is
3447 shown instead; commands can be abbreviated in general and this command
3448 can be used to see the full expansion of an abbreviation including the
3449 synopsis, try, e.g.,
3450 .Ql ?h ,
3451 .Ql ?hel
3453 .Ql ?help
3454 and see how the output changes.
3455 This mode also supports a more
3456 .Va verbose
3457 output, which will provide the informations documented for
3458 .Ic list .
3461 .It Ic \&|
3462 A synonym for the
3463 .Ic pipe
3464 command.
3468 .It Ic account , unaccount
3469 (ac, una) Creates, selects or lists (an) account(s).
3470 Accounts are special incarnations of
3471 .Ic define Ns d
3472 macros and group commands and variable settings which together usually
3473 arrange the environment for the purpose of creating an email account.
3474 Different to normal macros settings which are covered by
3475 .Ic localopts
3476 \(en here by default enabled! \(en will not be reverted before the
3477 .Ic account
3478 is changed again.
3479 The special account
3480 .Ql null
3481 (case-insensitive) always exists, and all but it can be deleted by the
3482 latter command, and in one operation with the special name
3483 .Ql * .
3485 Without arguments a listing of all defined accounts is shown.
3486 With one argument the given account is activated: the system
3487 .Va inbox
3488 of that account will be activated (as via
3489 .Ic file ) ,
3490 a possibly installed
3491 .Va folder-hook
3492 will be run, and the internal variable
3493 .Va account
3494 will be updated.
3495 The two argument form is identical to defining a macro as via
3496 .Ic define :
3497 .Bd -literal -offset indent
3498 account myisp {
3499   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3500   set from='(My Name) myname@myisp.example'
3501   set mta=smtp://mylogin@smtp.myisp.example
3507 .It Ic addrcodec
3508 Perform email address codec transformations on raw-data argument, rather
3509 according to email standards (RFC 5322; \*(ID will furtherly improve).
3510 Supports
3511 .Cm vput
3512 (see
3513 .Sx "Command modifiers" ) ,
3514 and manages the error number
3515 .Va \&! .
3516 The first argument must be either
3517 .Ar [+[+[+]]]e[ncode] ,
3518 .Ar d[ecode]
3520 .Ar s[kin] ,
3521 and specifies the operation to perform on the rest of the line.
3524 Decoding will show how a standard-compliant MUA will display the given
3525 argument, which should be an email address.
3526 Please be aware that most MUAs have difficulties with the address
3527 standards, and vary wildly when (comments) in parenthesis,
3528 .Dq double-quoted
3529 strings, or quoted-pairs, as below, become involved.
3530 \*(ID \*(UA currently does not perform decoding when displaying addresses.
3533 Skinning is identical to decoding but only outputs the plain address,
3534 without any string, comment etc. components.
3535 Another difference is that it may fail with the error number
3536 .Va \&!
3537 set to
3538 .Va ^ERR Ns -INVAL
3539 if decoding fails to find a(n) (valid) email address, in which case the
3540 unmodified input will be output again.
3543 Encoding supports four different modes, lesser automated versions can be
3544 chosen by prefixing one, two or three plus signs: the standard imposes
3545 a special meaning on some characters, which thus have to be transformed
3546 to so-called quoted-pairs by pairing them with a reverse solidus
3547 .Ql \e
3548 in order to remove the special meaning; this might change interpretation
3549 of the entire argument from what has been desired, however!
3550 Specify one plus sign to remark that parenthesis shall be left alone,
3551 two for not turning double quotation marks into quoted-pairs, and three
3552 for also leaving any user-specified reverse solidus alone.
3553 The result will always be valid, if a successful exit status is reported.
3554 \*(ID Addresses need to be specified in between angle brackets
3555 .Ql < ,
3556 .Ql >
3557 if the construct becomes more difficult, otherwise the current parser
3558 will fail; it is not smart enough to guess right.
3560 .Bd -literal -offset indent
3561 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
3562 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3563 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3564 "Hey, you", \e out\e there <diet@exam.ple>
3565 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3566 diet@exam.ple
3572 .It Ic alias , unalias
3573 (a, una) Aliases are a method of creating personal distribution lists
3574 that map a single alias name to none to multiple real receivers;
3575 these aliases become expanded after message composing is completed.
3576 The latter command removes the given list of aliases, the special name
3577 .Ql *
3578 will discard all existing aliases.
3579 The former command shows all currently defined aliases when used without
3580 arguments, and with one argument the expansion of the given alias.
3581 With more than one argument, creates or appends to the alias name given
3582 as the first argument the remaining arguments.
3583 Alias names are restricted to alphabetic characters, digits, the
3584 underscore, hyphen-minus, the number sign, colon, commercial at and
3585 period, the last character can also be the dollar sign:
3586 .Ql [[:alnum:]_#:@.-]+$? .
3589 .It Ic alternates
3590 (alt) Manage a list of alternate addresses or names of the active user,
3591 members of which will be removed from recipient lists.
3592 Without arguments the current set of alternates is displayed, otherwise
3593 the set of alternate names is replaced by the given arguments, and the
3594 internal variable
3595 .Va alternates
3596 is updated accordingly.
3597 As an extension, if one argument is given and that is the hyphen-minus
3598 .Ql -
3599 then the set of alternates is removed.
3600 There is a set of implicit alternates which is formed of the values of
3601 .Ev LOGNAME ,
3602 .Va from ,
3603 .Va sender
3605 .Va replyto .
3609 .It Ic answered , unanswered
3610 Take a message lists and mark each message as having been answered,
3611 having not been answered, respectively.
3612 Messages will be marked answered when being
3613 .Ic reply Ns d
3614 to automatically if the
3615 .Va markanswered
3616 variable is set.
3617 See the section
3618 .Sx "Message states" .
3623 .It Ic bind , unbind
3624 \*(OP\*(NQ The bind command extends the MLE (see
3625 .Sx "On terminal control and line editor" )
3626 with freely configurable key bindings.
3627 The latter command removes from the given context the given key binding,
3628 both of which may be specified as a wildcard
3629 .Ql * ,
3630 so that, e.g.,
3631 .Ql unbind * *
3632 will remove all bindings of all contexts.
3633 Due to initialization order unbinding will not work for built-in key
3634 bindings upon program startup, however: please use
3635 .Va line-editor-no-defaults
3636 for this purpose instead.
3639 With one argument the former command shows all key bindings for the
3640 given context, specifying an asterisk
3641 .Ql *
3642 will show the bindings of all contexts; a more verbose listing will be
3643 produced if either of
3644 .Va debug
3646 .Va verbose
3647 are set.
3648 With two or more arguments a binding is (re)established:
3649 the first argument is the context to which the binding shall apply,
3650 the second argument is a comma-separated list of the
3651 .Dq keys
3652 which form the binding, and any remaining arguments form the expansion.
3653 To indicate that a binding shall not be auto-committed, but that the
3654 expansion shall instead be furtherly editable by the user, a commercial at
3655 .Ql @
3656 (that will be removed) can be placed last in the expansion, from which
3657 leading and trailing whitespace will finally be removed.
3658 Reverse solidus cannot be used as the last character of expansion.
3661 Contexts define when a binding applies, i.e., a binding will not be seen
3662 unless the context for which it is defined for is currently active.
3663 This is not true for the shared binding
3664 .Ql base ,
3665 which is the foundation for all other bindings and as such always
3666 applies, its bindings, however, only apply secondarily.
3667 The available contexts are the shared
3668 .Ql base ,
3670 .Ql default
3671 context which is used in all not otherwise documented situations, and
3672 .Ql compose ,
3673 which applies to compose mode only.
3676 .Dq Keys
3677 which form the binding are specified as a comma-separated list of
3678 byte-sequences, where each list entry corresponds to one key(press).
3679 \*(OPally a list entry may, indicated by a leading colon character
3680 .Ql \&: ,
3681 also refer to the name of a terminal capability;
3682 several dozen names will be compiled into \*(UA and may be specified
3683 either by their
3684 .Xr terminfo 5 ,
3685 or, if existing, by their
3686 .Xr termcap 5
3687 name, regardless of the actually used terminal control library.
3688 It is however possible to use any capability, as long as the name is
3689 resolvable by the control library or defined in the internal variable
3690 .Va termcap .
3691 Input sequences are not case-normalized, so that an exact match is
3692 required to update or remove a binding.
3693 Examples:
3695 .Bd -literal -offset indent
3696 bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
3697 bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
3698 bind default $'\ecA',:khome,w 'echo An editable binding@'
3699 bind default a,b,c rm -rf / @  # Another editable binding
3700 bind default :kf1 File %
3701 bind compose :kf1 ~e
3705 Note that the entire comma-separated list is first parsed (over) as a
3706 shell-token with whitespace as the field separator, before being parsed
3707 and expanded for real with comma as the field separator, therefore
3708 whitespace needs to be properly quoted, see
3709 .Sx "Shell-style argument quoting" .
3710 Using Unicode reverse solidus escape sequences renders a binding
3711 defunctional if the locale does not support Unicode (see
3712 .Sx "Character sets" ) ,
3713 and using terminal capabilities does so if no terminal control support
3714 is (currently) available.
3717 The following terminal capability names are built-in and can be used in
3718 .Xr terminfo 5
3719 or (if available) the two-letter
3720 .Xr termcap 5
3721 notation regardless of the actually used library.
3722 See the respective manual for a list of capabilities.
3723 The program
3724 .Xr infocmp 1
3725 can be used to show all the capabilities of
3726 .Ev TERM
3727 or the given terminal type;
3728 using the
3729 .Fl \&\&x
3730 flag will also show supported (non-standard) extensions.
3733 .Bl -tag -compact -width kcuuf_or_kcuuf
3734 .It Cd kbs Ns \0or Cd kb
3735 Backspace.
3736 .It Cd kdch1 Ns \0or Cd kD
3737 Delete character.
3738 .It Cd kDC Ns \0or Cd *4
3739 \(em shifted variant.
3740 .It Cd kel Ns \0or Cd kE
3741 Clear to end of line.
3742 .It Cd kext Ns \0or Cd @9
3743 Exit.
3744 .It Cd kich1 Ns \0or Cd kI
3745 Insert character.
3746 .It Cd kIC Ns \0or Cd #3
3747 \(em shifted variant.
3748 .It Cd khome Ns \0or Cd kh
3749 Home.
3750 .It Cd kHOM Ns \0or Cd #2
3751 \(em shifted variant.
3752 .It Cd kend Ns \0or Cd @7
3753 End.
3754 .It Cd knp Ns \0or Cd kN
3755 Next page.
3756 .It Cd kpp Ns \0or Cd kP
3757 Previous page.
3758 .It Cd kcub1 Ns \0or Cd kl
3759 Left cursor (with more modifiers: see below).
3760 .It Cd kLFT Ns \0or Cd #4
3761 \(em shifted variant.
3762 .It Cd kcuf1 Ns \0or Cd kr
3763 Right cursor (ditto).
3764 .It Cd kRIT Ns \0or Cd %i
3765 \(em shifted variant.
3766 .It Cd kcud1 Ns \0or Cd kd
3767 Down cursor (ditto).
3768 .It Cd kDN
3769 \(em shifted variant (only terminfo).
3770 .It Cd kcuu1 Ns \0or Cd ku
3771 Up cursor (ditto).
3772 .It Cd kUP
3773 \(em shifted variant (only terminfo).
3774 .It Cd kf0 Ns \0or Cd k0
3775 Function key 0.
3776 Add one for each function key up to
3777 .Cd kf9
3779 .Cd k9 ,
3780 respectively.
3781 .It Cd kf10 Ns \0or Cd k;
3782 Function key 10.
3783 .It Cd kf11 Ns \0or Cd F1
3784 Function key 11.
3785 Add one for each function key up to
3786 .Cd kf19
3788 .Cd F9 ,
3789 respectively.
3793 Some terminals support key-modifier combination extensions, e.g.,
3794 .Ql Alt+Shift+xy .
3795 For example, the delete key,
3796 .Cd kdch1 :
3797 in its shifted variant, the name is mutated to
3798 .Cd  kDC ,
3799 then a number is appended for the states
3800 .Ql Alt
3801 .Pf ( Cd kDC3 ) ,
3802 .Ql Shift+Alt
3803 .Pf ( Cd kDC4 ) ,
3804 .Ql Control
3805 .Pf ( Cd kDC5 ) ,
3806 .Ql Shift+Control
3807 .Pf ( Cd kDC6 ) ,
3808 .Ql Alt+Control
3809 .Pf ( Cd kDC7 ) ,
3810 finally
3811 .Ql Shift+Alt+Control
3812 .Pf ( Cd kDC8 ) .
3813 The same for the left cursor key,
3814 .Cd kcub1 :
3815 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
3818 It is advisable to use an initial escape or other control character (e.g.,
3819 .Ql \ecA )
3820 for bindings which describe user key combinations (as opposed to purely
3821 terminal capability based ones), in order to avoid ambiguities whether
3822 input belongs to key sequences or not; it also reduces search time.
3823 Adjusting
3824 .Va bind-timeout
3825 may help shall keys and sequences be falsely recognized.
3829 .It Ic call
3830 \*(NQ Calls the given macro, which must have been created via
3831 .Ic define ,
3832 otherwise a
3833 .Va ^ERR Ns -NOENT
3834 error occurs.
3835 Parameters given to macros are implicitly local to the macro's scope, and
3836 may be accessed via special (positional) parameters, e.g.,
3837 .Va 1 ,
3838 .Va * ,
3839 .Va @ ,
3840 .Va # .
3841 The positional parameters may be removed by
3842 .Ic shift Ns
3843 ing them off the stack (exceeding the supported number of arguments
3844 results in a
3845 .Va ^ERR Ns -OVERFLOW ) ,
3846 and are otherwise controllable via
3847 .Ic vpospar .
3848 Macro execution can be terminated at any time by calling
3849 .Ic return .
3851 Calling macros recursively will at some time excess the stack size
3852 limit, causing a hard program abortion; if recursively calling a macro
3853 is the last command of the current macro, consider to use the command
3854 .Ic xcall ,
3855 which will first release all resources of the current macro before
3856 replacing the current macro with the called one.
3857 Numeric and string operations can be performed via
3858 .Ic vexpr ,
3860 .Ic eval
3861 may be helpful to recreate argument lists.
3862 .Bd -literal -offset indent
3863 define exmac {
3864   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
3865   return 1000 0
3867 call exmac Hello macro exmac!
3871 .It Ic call_if
3872 Identical to
3873 .Ic call
3874 if the given macro has been created via
3875 .Ic define ,
3876 but doesn't fail nor warn if the macro doesn't exist.
3879 .It Ic cd
3880 (ch) Change the working directory to
3881 .Ev HOME
3882 or the given argument.
3883 Synonym for
3884 .Ic chdir .
3887 .It Ic certsave
3888 \*(OP Only applicable to S/MIME signed messages.
3889 Takes a message list and a filename and saves the certificates
3890 contained within the message signatures to the named file in both
3891 human-readable and PEM format.
3892 The certificates can later be used to send encrypted messages to the
3893 respective message senders by setting
3894 .Va smime-encrypt-USER@HOST
3895 variables.
3899 .It Ic charsetalias , uncharsetalias
3900 \*(NQ Manage (character set conversion) character set alias mappings,
3901 as documented in the section
3902 .Sx "Character sets" .
3903 Character set aliases are expanded recursively, but no expansion is
3904 performed on values of the user-settable variables, e.g.,
3905 .Va charset-8bit .
3906 These are effectively no-operations if character set conversion
3907 is not available (i.e., no
3908 .Ql +iconv
3910 .Va features ) .
3911 Without arguments the list of all currently defined aliases is shown,
3912 with one argument the expansion of the given alias.
3913 Otherwise all given arguments are treated as pairs of character sets and
3914 their desired target alias name, creating new or changing already
3915 existing aliases, as necessary.
3917 The latter deletes all aliases given as arguments, the special argument
3918 .Ql *
3919 will remove all aliases.
3922 .It Ic chdir
3923 (ch) Change the working directory to
3924 .Ev HOME
3925 or the given argument.
3926 Synonym for
3927 .Ic cd .
3931 .It Ic collapse , uncollapse
3932 Only applicable to threaded mode.
3933 Takes a message list and makes all replies to these messages invisible
3934 in header summaries, except for
3935 .Ql new
3936 messages and the
3937 .Dq dot .
3938 Also when a message with collapsed replies is displayed,
3939 all of these are automatically uncollapsed.
3940 The latter command undoes collapsing.
3945 .It Ic colour , uncolour
3946 \*(OP\*(NQ Manage colour mappings of and for a
3947 .Sx "Coloured display" .
3948 The type of colour is given as the (case-insensitive) first argument,
3949 which must be one of
3950 .Ql 256
3951 for 256-colour terminals,
3952 .Ql 8 ,
3953 .Ql ansi
3955 .Ql iso
3956 for the standard 8-colour ANSI / ISO 6429 color palette and
3957 .Ql 1
3959 .Ql mono
3960 for monochrome terminals.
3961 Monochrome terminals cannot deal with colours, but only (some) font
3962 attributes.
3965 Without further arguments the list of all currently defined mappings
3966 for the given colour type is shown (as a special case giving
3967 .Ql all
3969 .Ql *
3970 will show the mappings of all types).
3971 Otherwise the second argument defines the mappable slot, and the third
3972 argument a (comma-separated list of) colour and font attribute
3973 specification(s), and the optional fourth argument can be used to
3974 specify a precondition: if conditioned mappings exist they are tested in
3975 (creation) order unless a (case-insensitive) match has been found, and
3976 the default mapping (if any has been established) will only be chosen as
3977 a last resort.
3978 The types of precondition available depend on the mappable slot (see
3979 .Sx "Coloured display"
3980 for some examples), the following of which exist:
3983 Mappings prefixed with
3984 .Ql mle-
3985 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
3986 .Sx "On terminal control and line editor" )
3987 and do not support preconditions.
3989 .Bl -tag -compact -width view-partinfo
3990 .It Ar mle-position
3991 This mapping is used for the position indicator that is visible when
3992 a line cannot be fully displayed on the screen.
3993 .It Ar mle-prompt
3994 Used for the
3995 .Va prompt .
3999 Mappings prefixed with
4000 .Ql sum-
4001 are used in header summaries, and they all understand the preconditions
4002 .Ql dot
4003 (the current message) and
4004 .Ql older
4005 for elder messages (only honoured in conjunction with
4006 .Va datefield-markout-older ) .
4008 .Bl -tag -compact -width view-partinfo
4009 .It Ar sum-dotmark
4010 This mapping is used for the
4011 .Dq dotmark
4012 that can be created with the
4013 .Ql %>
4015 .Ql %<
4016 formats of the variable
4017 .Va headline .
4018 .It Ar sum-header
4019 For the complete header summary line except the
4020 .Dq dotmark
4021 and the thread structure.
4022 .It Ar sum-thread
4023 For the thread structure which can be created with the
4024 .Ql %i
4025 format of the variable
4026 .Va headline .
4030 Mappings prefixed with
4031 .Ql view-
4032 are used when displaying messages.
4034 .Bl -tag -compact -width view-partinfo
4035 .It Ar view-from_
4036 This mapping is used for so-called
4037 .Ql From_
4038 lines, which are MBOX file format specific header lines.
4039 .It Ar view-header
4040 For header lines.
4041 A comma-separated list of headers to which the mapping applies may be
4042 given as a precondition; if the \*(OPal regular expression support is
4043 available then if any of the
4044 .Dq magical
4045 (extended) regular expression characters is seen the precondition will
4046 be evaluated as (an extended) one.
4047 .It Ar view-msginfo
4048 For the introductional message info line.
4049 .It Ar view-partinfo
4050 For MIME part info lines.
4054 The following (case-insensitive) colour definitions and font attributes
4055 are understood, multiple of which can be specified in a comma-separated
4056 list:
4058 .Bl -tag -width ft=
4059 .It Ar ft=
4060 a font attribute:
4061 .Ql bold ,
4062 .Ql reverse
4064 .Ql underline .
4065 It is possible (and often applicable) to specify multiple font
4066 attributes for a single mapping.
4068 .It Ar fg=
4069 foreground colour attribute:
4070 .Ql black ,
4071 .Ql blue ,
4072 .Ql green ,
4073 .Ql red ,
4074 .Ql brown ,
4075 .Ql magenta ,
4076 .Ql cyan
4078 .Ql white .
4079 To specify a 256-color mode a decimal number colour specification in
4080 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4082 .Bl -tag -compact -width "999 - 999"
4083 .It 0 - 7
4084 the standard ISO 6429 colors, as above.
4085 .It 8 - 15
4086 high intensity variants of the standard colors.
4087 .It 16 - 231
4088 216 colors in tuples of 6.
4089 .It 232 - 255
4090 grayscale from black to white in 24 steps.
4092 .Bd -literal -offset indent
4093 #!/bin/sh -
4094 fg() { printf "\e033[38;5;${1}m($1)"; }
4095 bg() { printf "\e033[48;5;${1}m($1)"; }
4097 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4098 printf "\e033[0m\en"
4100 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4101 printf "\e033[0m\en"
4104 .It Ar bg=
4105 background colour attribute (see
4106 .Cd fg=
4107 for possible values).
4111 The command
4112 .Ic \&uncolour
4113 will remove for the given colour type (the special type
4114 .Ql *
4115 selects all) the given mapping; if the optional precondition argument is
4116 given only the exact tuple of mapping and precondition is removed.
4117 The special name
4118 .Ql *
4119 will remove all mappings (no precondition allowed), thus
4120 .Ql uncolour * *
4121 will remove all established mappings.
4126 .It Ic commandalias , uncommandalias
4127 \*(NQ Define or list, and remove, respectively, command aliases.
4128 An (command)alias can be used everywhere a normal command can be used,
4129 but always takes precedence: any arguments that are given to the command
4130 alias are joined onto the alias expansion, and the resulting string
4131 forms the command line that is, in effect, executed.
4132 The latter command removes all given aliases, the special name
4133 .Ql *
4134 will remove all existing aliases.
4135 When used without arguments the former shows a list of all currently
4136 known aliases, with one argument only the expansion of the given one.
4138 With two or more arguments a command alias is defined or updated: the
4139 first argument is the name under which the remaining command line should
4140 be accessible, the content of which can be just about anything.
4141 An alias may itself expand to another alias, but to avoid expansion loops
4142 further expansion will be prevented if an alias refers to itself or if
4143 an expansion depth limit is reached.
4144 Explicit expansion prevention via reverse solidus
4145 .Cm \e ,
4146 one of the
4147 .Sx "Command modifiers" .
4148 .Bd -literal -offset indent
4149 ? commandalias xx
4150 \*(uA: `commandalias': no such alias: xx
4151 ? commandalias xx echo hello,
4152 ? commandalias xx
4153 commandalias xx 'echo hello,'
4154 ? xx
4155 hello,
4156 ? xx world
4157 hello, world
4161 .It Ic Copy
4162 (C) Copy messages to files whose names are derived from the author of
4163 the respective message and do not mark them as being saved;
4164 otherwise identical to
4165 .Ic Save .
4168 .It Ic copy
4169 (c) Copy messages to the named file and do not mark them as being saved;
4170 otherwise identical to
4171 .Ic save .
4174 .It Ic cwd
4175 Show the name of the current working directory, as reported by
4176 .Xr getcwd 3 .
4177 Supports
4178 .Cm vput
4179 (see
4180 .Sx "Command modifiers" ) .
4181 The return status is tracked via
4182 .Va \&! .
4185 .It Ic Decrypt
4186 \*(OP For unencrypted messages this command is identical to
4187 .Ic Copy ;
4188 Encrypted messages are first decrypted, if possible, and then copied.
4191 .It Ic decrypt
4192 \*(OP For unencrypted messages this command is identical to
4193 .Ic copy ;
4194 Encrypted messages are first decrypted, if possible, and then copied.
4198 .It Ic define , undefine
4199 Without arguments the current list of macros, including their content,
4200 is shown, otherwise a macro is defined, replacing an existing macro of
4201 the same name.
4202 A macro definition is a sequence of commands in the following form:
4203 .Bd -literal -offset indent
4204 define name {
4205   command1
4206   command2
4207   ...
4208   commandN
4212 A defined macro can be invoked explicitly by using the
4213 .Ic call
4215 .Ic ~
4216 commands, or implicitly if a macro hook is triggered, e.g., a
4217 .Va folder-hook .
4218 It is possible to localize adjustments, like creation, deletion and
4219 modification of
4220 .Sx "INTERNAL VARIABLES" ,
4221 by using the
4222 .Ic localopts
4223 command; the scope which is localized depends on how (i.e.,
4224 .Dq as what :
4225 normal macro, folder hook, hook,
4226 .Ic account
4227 switch) the macro is invoked.
4228 Execution of a macro body can be stopped from within by calling
4229 .Ic return .
4230 Inside a
4231 .Ic call Ns
4232 ed macro, given positional parameters can be
4233 .Ic shift Ns
4236 The latter command deletes the given macro, the special name
4237 .Ql *
4238 will discard all existing macros.
4239 Creation and deletion of (a) macro(s) can be performed from within
4240 a running macro.
4244 .It Ic delete , undelete
4245 (d, u) Marks the given message list as being or not being
4246 .Ql deleted ,
4247 respectively; if no argument has been specified then the usual search
4248 for a visible message is performed, as documented for
4249 .Sx "Message list arguments" ,
4250 showing only the next input prompt if the search fails.
4251 Deleted messages will neither be saved in the
4252 .Mx -sx
4253 .Sx "secondary mailbox"
4254 .Ev MBOX
4255 nor will they be available for most other commands.
4256 If the
4257 .Va autoprint
4258 variable is set, the new
4259 .Dq dot
4260 or the last message restored, respectively, is automatically
4261 .Ic type Ns
4262 d; also see
4263 .Ic dp ,
4264 .Ic dt .
4267 .It Ic discard
4268 (di) Identical to
4269 .Ic ignore .
4270 Superseded by the multiplexer
4271 .Ic headerpick .
4275 .It Ic dp , dt
4276 Delete the given messages and automatically
4277 .Ic type
4278 the new
4279 .Dq dot
4280 if one exists, regardless of the setting of
4281 .Va autoprint .
4284 .It Ic dotmove
4285 Move the
4286 .Dq dot
4287 up or down by one message when given
4288 .Ql +
4290 .Ql -
4291 argument, respectively.
4295 .It Ic draft , undraft
4296 Take message lists and mark each given message as being draft, or not
4297 being draft, respectively, as documented in the section
4298 .Sx "Message states" .
4301 .It Ic echo
4302 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4303 newline, whereas the otherwise identical
4304 .Ic echon
4305 does not.
4306 .Sx "Shell-style argument quoting"
4307 is used,
4308 .Sx "Filename transformations"
4309 are applied to the expanded arguments.
4312 .It Ic echoerr
4313 \*(NQ Identical to
4314 .Ic echo
4315 except that is echoes to standard error.
4316 Also see
4317 .Ic echoerrn .
4318 In interactive sessions the \*(OPal message ring queue for
4319 .Ic errors
4320 will be used instead, if available.
4323 .It Ic echon
4324 \*(NQ Identical to
4325 .Ic echo ,
4326 but does not write a trailing newline.
4329 .It Ic echoerrn
4330 \*(NQ Identical to
4331 .Ic echoerr ,
4332 but does not write a trailing newline.
4335 .It Ic edit
4336 (e) Point the text editor (as defined in
4337 .Ev EDITOR )
4338 at each message from the given list in turn.
4339 Modified contents are discarded unless the
4340 .Va writebackedited
4341 variable is set, and are not used unless the mailbox can be written to
4342 and the editor returns a successful exit status.
4345 .It Ic elif
4346 Part of the
4347 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4348 conditional \(em if the condition of a preceding
4349 .Ic if
4350 was false, check the following condition and execute the following block
4351 if it evaluates true.
4354 .It Ic else
4355 (el) Part of the
4356 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4357 conditional \(em if none of the conditions of the preceding
4358 .Ic if
4360 .Ic elif
4361 commands was true, the
4362 .Ic else
4363 block is executed.
4366 .It Ic endif
4367 (en) Marks the end of an
4368 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4369 conditional execution block.
4373 .It Ic environ
4374 \*(NQ \*(UA has a strict notion about which variables are
4375 .Sx "INTERNAL VARIABLES"
4376 and which are managed in the program
4377 .Sx ENVIRONMENT .
4378 Since some of the latter are a vivid part of \*(UAs functioning,
4379 however, they are transparently integrated into the normal handling of
4380 internal variables via
4381 .Ic set
4383 .Ic unset .
4384 To integrate other environment variables of choice into this
4385 transparent handling, and also to export internal variables into the
4386 process environment where they normally are not, a
4387 .Ql link
4388 needs to become established with this command, as in, e.g.,
4391 .Dl environ link PERL5LIB from TZ
4394 Afterwards changing such variables with
4395 .Ic set
4396 will cause automatic updates of the program environment, and therefore
4397 be inherited by newly created child processes.
4398 Sufficient system support provided (it was in BSD as early as 1987, and
4399 is standardized since Y2K) removing such variables with
4400 .Ic unset
4401 will remove them also from the program environment, but in any way
4402 the knowledge they ever have been
4403 .Ql link Ns
4404 ed will be lost.
4405 Note this implies that
4406 .Ic localopts
4407 may cause loss of links.
4410 The command
4411 .Ql unlink
4412 will remove an existing link, but leaves the variables as such intact.
4413 Additionally the subcommands
4414 .Ql set
4416 .Ql unset
4417 are provided, which work exactly the same as the documented commands
4418 .Ic set
4420 .Ic unset ,
4421 but (additionally) link the variable(s) with the program environment and
4422 thus immediately export them to, or remove them from (if possible),
4423 respectively, the program environment.
4427 .It Ic errors
4428 \*(OP Since \*(UA uses the console as a user interface it can happen
4429 that messages scroll by too fast to become recognized.
4430 An error message ring queue is available which stores duplicates of any
4431 error message and notifies the user in interactive sessions whenever
4432 a new error has occurred.
4433 The queue is finite: if its maximum size is reached any new message
4434 replaces the eldest.
4435 The command
4436 .Ic errors
4437 can be used to manage this message queue: if given
4438 .Ar show
4439 or no argument the queue will be displayed and cleared,
4440 .Ar clear
4441 will only clear all messages from the queue.
4444 .It Ic eval
4445 \*(NQ Construct a command by concatenating the arguments, separated with
4446 a single space character, and then evaluate the result.
4447 This command passes through the exit status
4448 .Va \&?
4449 and error number
4450 .Va \&!
4451 of the evaluated command; also see
4452 .Ic call .
4453 .Bd -literal -offset indent
4454 define xxx {
4455   echo "xxx arg <$1>"
4456   shift
4457   if [ $# > 0 ]
4458     \excall xxx "$@"
4459   endif
4461 define yyy {
4462   eval "$@ ' ball"
4464 call yyy '\ecall xxx' "b\e$'\et'u ' "
4465 call xxx arg <b      u>
4466 call xxx arg <  >
4467 call xxx arg <ball>
4471 .It Ic exit
4472 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4473 any saving of messages in the
4474 .Mx -sx
4475 .Sx "secondary mailbox"
4476 .Ev MBOX
4477 as well as a possibly tracked line editor history file.
4478 The optional status number argument will be passed through to
4479 .Xr exit 3 .
4480 \*(ID For now it can happen that the given status will be overwritten,
4481 later this will only occur if a later error needs to be reported onto an
4482 otherwise success indicating status.
4485 .It Ic File
4486 (Fi) Like
4487 .Ic file ,
4488 but open the mailbox read-only.
4492 .It Ic file
4493 (fi) The file command switches to a new mailbox.
4494 Without arguments it shows status information of the current mailbox.
4495 If an argument is given, it will write out changes (such as deletions)
4496 the user has made, open a new mailbox, update the internal variables
4497 .Va mailbox-resolved
4499 .Va mailbox-display ,
4500 and optionally display a summary of
4501 .Ic headers
4502 if the variable
4503 .Va header
4504 is set.
4507 .Sx "Filename transformations"
4508 will be applied to the
4509 .Ar name
4510 argument, and
4511 .Ql protocol://
4512 prefixes are understood, e.g.,
4513 .Ql maildir:///tmp/mdirbox :
4514 if a protocol prefix is used the mailbox type is fixated and neither
4515 the auto-detection (read on) nor the
4516 .Va newfolders
4517 mechanisms apply.
4518 \*(OPally URLs can also be used to access network resources, see
4519 .Sx "On URL syntax and credential lookup" :
4522 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4523 .Dl \*(OU protocol://[user@]host[:port][/path]
4526 \*(OPally supported network protocols are
4527 .Ar pop3
4528 (POP3) and
4529 .Ar pop3s
4530 (POP3 with SSL/TLS encrypted transport),
4531 .Ar [/path]
4532 part is valid only for IMAP; there it defaults to
4533 .Ar INBOX .
4534 Network URLs require a special encoding as documented in the said section.
4537 If the resulting file protocol (MBOX database)
4538 .Ar name
4539 is located on a local filesystem then the list of all registered
4540 .Ic filetype Ns
4541 s is traversed in order to see whether a transparent intermediate
4542 conversion step is necessary to handle the given mailbox, in which case
4543 \*(UA will use the found hook to load and save data into and from
4544 a temporary file, respectively.
4545 Changing hooks will not affect already opened mailboxes.
4546 For example, the following creates hooks for the
4547 .Xr gzip 1
4548 compression tool and a combined compressed and encrypted format:
4550 .Bd -literal -offset indent
4551 filetype \e
4552   gzip 'gzip -dc' 'gzip -c' \e
4553   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4557 MBOX database files are generally locked during file operations in order
4558 to avoid inconsistencies due to concurrent modifications.
4559 \*(OPal Mailbox files which \*(UA treats as the system
4560 .Va inbox
4561 .Pf ( Ev MAIL ) ,
4563 .Mx -sx
4564 .Sx "primary system mailbox" Ns
4565 es in general will also be protected by so-called dotlock files, the
4566 traditional way of mail spool file locking: for any file
4567 .Ql a
4568 a lock file
4569 .Ql a.lock
4570 will be created for the duration of the synchronization \(em
4571 as necessary a privilege-separated dotlock child process will be used
4572 to accommodate for necessary privilege adjustments in order to create
4573 the dotlock file in the same directory
4574 and with the same user and group identities as the file of interest.
4577 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4578 files, but it will detect invalid message boundaries in this mode and
4579 complain (even more with
4580 .Va debug )
4581 if any is seen: in this case
4582 .Va mbox-rfc4155
4583 can be used to create a valid MBOX database from the invalid input.
4586 If no protocol has been fixated, and
4587 .Ar name
4588 refers to a directory with the subdirectories
4589 .Ql tmp ,
4590 .Ql new
4592 .Ql cur ,
4593 then it is treated as a folder in
4594 .Dq Maildir
4595 format.
4596 \*(ID Also, if no protocol has been fixated and no existing file has
4597 been found, the variable
4598 .Va newfolders
4599 controls the format of mailboxes yet to be created.
4604 .It Ic filetype , unfiletype
4605 \*(NQ Define or list, and remove, respectively, file handler hooks,
4606 which provide (shell) commands that enable \*(UA to load and save MBOX
4607 files from and to files with the registered file extensions;
4608 it will use an intermediate temporary file to store the plain data.
4609 The latter command removes the hooks for all given extensions,
4610 .Ql *
4611 will remove all existing handlers.
4613 When used without arguments the former shows a list of all currently
4614 defined file hooks, with one argument the expansion of the given alias.
4615 Otherwise three arguments are expected, the first specifying the file
4616 extension for which the hook is meant, and the second and third defining
4617 the load- and save commands, respectively, to deal with the file type,
4618 both of which must read from standard input and write to standard
4619 output.
4620 Changing hooks will not affect already opened mailboxes (\*(ID except below).
4621 \*(ID For now too much work is done, and files are oftened read in twice
4622 where once would be sufficient: this can cause problems if a filetype is
4623 changed while such a file is opened; this was already so with the
4624 built-in support of .gz etc. in Heirloom, and will vanish in v15.
4625 \*(ID For now all handler strings are passed to the
4626 .Ev SHELL for evaluation purposes; in the future a
4627 .Ql \&!
4628 prefix to load and save commands may mean to bypass this shell instance:
4629 placing a leading space will avoid any possible misinterpretations.
4630 .Bd -literal -offset indent
4631 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
4632   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
4633   zst 'zstd -dc' 'zstd -19 -zc' \e
4634   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4635 set record=+sent.zst.pgp
4640 .It Ic flag , unflag
4641 Take message lists and mark the messages as being flagged, or not being
4642 flagged, respectively, for urgent/special attention.
4643 See the section
4644 .Sx "Message states" .
4647 .It Ic folder
4648 (fold) The same as
4649 .Ic file .
4652 .It Ic folders
4653 With no arguments, list the names of the folders in the folder directory.
4654 With an existing folder as an argument,
4655 lists the names of folders below the named folder.
4658 .It Ic Followup
4659 (F) Similar to
4660 .Ic Respond ,
4661 but saves the message in a file named after the local part of the first
4662 recipient's address (instead of in
4663 .Va record Ns ).
4666 .It Ic followup
4667 (fo) Similar to
4668 .Ic respond ,
4669 but saves the message in a file named after the local part of the first
4670 recipient's address (instead of in
4671 .Va record Ns ).
4674 .It Ic followupall
4675 Similar to
4676 .Ic followup ,
4677 but responds to all recipients regardless of the
4678 .Va flipr
4679 variable.
4682 .It Ic followupsender
4683 Similar to
4684 .Ic Followup ,
4685 but responds to the sender only regardless of the
4686 .Va flipr
4687 variable.
4690 .It Ic Forward
4691 Similar to
4692 .Ic forward ,
4693 but saves the message in a file named after the local part of the
4694 recipient's address (instead of in
4695 .Va record Ns ).
4698 .It Ic forward
4699 Takes a message and the address of a recipient
4700 and forwards the message to him.
4701 The text of the original message is included in the new one,
4702 with the value of the
4703 .Va forward-header-inject
4704 variable preceding it.
4705 To filter the included header fields to the desired subset use the
4706 .Ql forward
4707 slot of the white- and blacklisting command
4708 .Ic headerpick .
4709 Only the first part of a multipart message is included unless
4710 .Va forward-as-attachment ,
4711 and recipient addresses will be stripped from comments, names etc.
4712 unless the internal variable
4713 .Va fullnames
4714 is set .
4717 .It Ic from
4718 (f) Takes a list of message specifications and displays a summary of
4719 their message headers, exactly as via
4720 .Ic headers .
4721 An alias of this command is
4722 .Ic search .
4723 Also see
4724 .Sx "Specifying messages" .
4726 .It Ic Fwd
4727 \*(OB Alias for
4728 .Ic Forward .
4730 .It Ic fwd
4731 \*(OB Alias for
4732 .Ic forward .
4734 .It Ic fwdignore
4735 \*(OB Superseded by the multiplexer
4736 .Ic headerpick .
4738 .It Ic fwdretain
4739 \*(OB Superseded by the multiplexer
4740 .Ic headerpick .
4742 .It Ic ghost , unghost
4743 \*(OB Replaced by
4744 .Ic commandalias ,
4745 .Ic uncommandalias .
4749 .It Ic headerpick , unheaderpick
4750 \*(NQ Multiplexer command to manage white- and blacklisting
4751 selections of header fields for a variety of applications.
4752 Without arguments the set of contexts that have settings is displayed.
4753 When given arguments, the first argument is the context to which the
4754 command applies, one of (case-insensitively)
4755 .Ql type
4756 for display purposes (via, e.g.,
4757 .Ic type ) ,
4758 .Ql save
4759 for selecting which headers shall be stored persistently when
4760 .Ic save ,
4761 .Ic copy ,
4762 .Ic move
4763 or even
4764 .Ic decrypt Ns
4765 ing messages (note that MIME related etc. header fields should not be
4766 ignored in order to not destroy usability of the message in this case),
4767 .Ql forward
4768 for stripping down messages when
4769 .Ic forward Ns
4770 ing message (has no effect if
4771 .Va forward-as-attachment
4772 is set), and
4773 .Ql top
4774 for defining user-defined set of fields for the command
4775 .Ic top .
4778 The current settings of the given context are displayed if only the
4779 first argument is given.
4780 A second argument denotes the type of restriction that is to be chosen,
4781 it may be (a case-insensitive prefix of)
4782 .Ql retain
4784 .Ql ignore
4785 for white- and blacklisting purposes, respectively.
4786 Establishing a whitelist suppresses inspection of the corresponding
4787 blacklist.
4788 If no further argument is given the current settings of the given type
4789 will be displayed, otherwise the remaining arguments specify header
4790 fields, which \*(OPally may be given as regular expressions, to be be
4791 added to the given type.
4792 The special wildcard field (asterisk,
4793 .Ql * )
4794 will establish a (fast) shorthand setting which covers all fields.
4796 The latter command always takes three or more arguments and can be used
4797 to remove fields from the given type of list of the given context, the
4798 special argument
4799 .Ql *
4800 will remove all fields.
4804 .It Ic headers
4805 (h) Show the current group of headers, the size of which depends on
4806 the variable
4807 .Va screen
4808 and the style of which can be adjusted with the variable
4809 .Va headline .
4810 If a message-specification is given the group of headers containing the
4811 first message therein is shown and the message at the top of the screen
4812 becomes the new
4813 .Dq dot .
4816 .It Ic help
4817 (hel) A synonym for
4818 .Ic \&? .
4821 .It Ic history
4822 \*(OP Either
4823 .Ar show
4824 (this mode also supports a more
4825 .Va verbose
4826 output) or
4827 .Ar clear
4828 the list of history entries;
4829 a decimal
4830 .Ar NUMBER
4831 argument selects and evaluates the respective history entry,
4832 which will become the new history top; a negative number is used as an
4833 offset to the current command, e.g.,
4834 .Ql -1
4835 will select the last command, the history top.
4836 The default mode if no arguments are given is
4837 .Ar show .
4840 .It Ic hold
4841 (ho, also
4842 .Ic preserve )
4843 Takes a message list and marks each message therein to be saved in the
4844 user's system
4845 .Va inbox
4846 instead of in the
4847 .Mx -sx
4848 .Sx "secondary mailbox"
4849 .Ev MBOX .
4850 Does not override the
4851 .Ic delete
4852 command.
4853 \*(UA deviates from the POSIX standard with this command, because a
4854 .Ic next
4855 command issued after
4856 .Ic hold
4857 will display the following message, not the current one.
4861 .It Ic if
4862 (i) Part of the nestable
4863 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4864 conditional execution construct \(em if the given condition is true then
4865 the encapsulated block is executed.
4866 The POSIX standards supports the (case-insensitive) conditions
4867 .Ql r Ns
4868 eceive
4870 .Ql s Ns
4871 end, all remaining conditions are non-portable extensions.
4872 (Be aware that a faulty condition skips all following branches until
4873 .Ic endif . )
4874 \*(ID These commands do not yet use
4875 .Sx "Shell-style argument quoting"
4876 and therefore do not know about input tokens, so that syntax
4877 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
4878 all conditions bracket group wise and consider the tokens, representing
4879 values and operators, therein, which also means that variables will
4880 already have been expanded at that time (just like in the shell).
4882 .Bd -literal -offset indent
4883 if receive
4884   commands ...
4885 else
4886   commands ...
4887 endif
4891 The (case-insensitive) condition
4892 .Ql t Ns
4893 erminal will evaluate to true if the standard input is a terminal, i.e.,
4894 in interactive sessions.
4895 Another condition can be any boolean value (see the section
4896 .Sx "INTERNAL VARIABLES"
4897 for textual boolean representations) to mark an enwrapped block as
4898 .Dq never execute
4900 .Dq always execute .
4903 \*(ID (In v15
4904 .Sx "Shell-style argument quoting"
4905 will be used, and this command will simply interpret expanded tokens.)
4906 It is possible to check
4907 .Sx "INTERNAL VARIABLES"
4908 as well as
4909 .Sx ENVIRONMENT
4910 variables for existence or compare their expansion against a user given
4911 value or another variable by using the
4912 .Ql $
4913 .Pf ( Dq variable next )
4914 conditional trigger character;
4915 a variable on the right hand side may be signalled using the same
4916 mechanism.
4917 Variable names may be enclosed in a pair of matching braces.
4918 When this mode has been triggered, several operators are available:
4921 Integer operators treat the arguments on the left and right hand side of
4922 the operator as integral numbers and compare them arithmetically.
4923 It is an error if any of the operands is not a valid integer, an empty
4924 argument (which implies it had been quoted) is treated as if it were 0.
4925 Available operators are
4926 .Ql -lt
4927 (less than),
4928 .Ql -le
4929 (less than or equal to),
4930 .Ql -eq
4931 (equal),
4932 .Ql -ne
4933 (not equal),
4934 .Ql -ge
4935 (greater than or equal to), and
4936 .Ql -gt
4937 (greater than).
4940 String data operators compare the left and right hand side according to
4941 their textual content.
4942 Unset variables are treated as the empty string.
4943 The behaviour of string operators can be adjusted by prefixing the
4944 operator with the modifier trigger commercial at
4945 .Ql @ ,
4946 followed by none to multiple modifiers: for now supported is
4947 .Ql i ,
4948 which turns the comparison into a case-insensitive one: this is
4949 implied if no modifier follows the trigger.
4952 Available string operators are
4953 .Ql <
4954 (less than),
4955 .Ql <=
4956 (less than or equal to),
4957 .Ql ==
4958 (equal),
4959 .Ql !=
4960 (not equal),
4961 .Ql >=
4962 (greater than or equal to),
4963 .Ql >
4964 (greater than),
4965 .Ql =%
4966 (is substring of) and
4967 .Ql !%
4968 (is not substring of).
4969 By default these operators work on bytes and (therefore) do not take
4970 into account character set specifics.
4971 If the case-insensitivity modifier has been used, case is ignored
4972 according to the rules of the US-ASCII encoding, i.e., bytes are
4973 still compared.
4976 When the \*(OPal regular expression support is available, the additional
4977 string operators
4978 .Ql =~
4980 .Ql !~
4981 can be used.
4982 They treat the right hand side as an extended regular expression that is
4983 matched according to the active locale (see
4984 .Sx "Character sets" ) ,
4985 i.e., character sets should be honoured correctly.
4988 Conditions can be joined via AND-OR lists (where the AND operator is
4989 .Ql &&
4990 and the OR operator is
4991 .Ql || ) ,
4992 which have equal precedence and will be evaluated with left
4993 associativity, thus using the same syntax that is known for the
4994 .Xr sh 1 .
4995 It is also possible to form groups of conditions and lists by enclosing
4996 them in pairs of brackets
4997 .Ql [\ \&.\&.\&.\ ] ,
4998 which may be interlocked within each other, and also be joined via
4999 AND-OR lists.
5002 The results of individual conditions and entire groups may be modified
5003 via unary operators: the unary operator
5004 .Ql \&!
5005 will reverse the result.
5007 .Bd -literal -offset indent
5008 if $debug
5009   echo *debug* is set
5010 endif
5011 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
5012   echo *ttycharset* is UTF-8, the former case-sensitive!
5013 endif
5014 set t1=one t2=one
5015 if [ "${t1}" == "${t2}" ]
5016   echo These two variables are equal
5017 endif
5018 # This is a string test, -ge has been added for v14.9.0
5019 if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm\&.*" ]
5020   echo ..in an X terminal
5021 endif
5022 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5023     [ "$verbose" != '' ] ] ]
5024   echo Noisy, noisy
5025 endif
5026 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5027   echo Left associativity, as is known from the shell
5028 endif
5029 if ! ! true && ! [ ! "$debug" && ! "$verbose" ]
5030   echo Unary operator support
5031 endif
5036 .It Ic ignore
5037 (ig) Identical to
5038 .Ic discard .
5039 Superseded by the multiplexer
5040 .Ic headerpick .
5043 .It Ic list
5044 Shows the names of all available commands, alphabetically sorted.
5045 If given any non-whitespace argument the list will be shown in the order
5046 in which command prefixes are searched.
5047 \*(OP In conjunction with a set variable
5048 .Va verbose
5049 additional information will be provided for each command: the argument
5050 type will be indicated, the documentation string will be shown,
5051 and the set of command flags will show up:
5053 .Bl -tag -compact -width ".It Ql BaNg"
5054 .It Ql "vput modifier"
5055 command supports the command modifier
5056 .Cm vput .
5057 .It Ql "errno in *!*"
5058 the error number is tracked in
5059 .Va \&! .
5060 .It Ql "needs box"
5061 commands needs an active mailbox, a
5062 .Ic file .
5063 .It Ql "ok: batch or interactive"
5064 command may only be used in interactive or
5065 .Fl #
5066 batch mode.
5067 .It Ql "ok: send mode"
5068 command can be used in send mode.
5069 .It Ql "not ok: compose mode"
5070 command is not available when in compose mode.
5071 .It Ql "not ok: during startup"
5072 command cannot be used during program startup, e.g., while loading
5073 .Sx "Resource files" .
5074 .It Ql "ok: in subprocess"
5075 command is allowed to be used when running in a subprocess instance,
5076 e.g., from within a macro that is called via
5077 .Va on-compose-splice .
5081 .It Ic localopts
5082 This command can be used to localize changes to variables, meaning that
5083 their state will be reverted to the former one once the covered scope
5084 is left.
5085 It can only be used inside of macro definition blocks introduced by
5086 .Ic account
5088 .Ic define ,
5089 and is interpreted as a boolean (string, see
5090 .Sx "INTERNAL VARIABLES" ) ;
5092 .Dq covered scope
5093 of an account is left once it is switched off again.
5094 .Bd -literal -offset indent
5095 define temporary_settings {
5096   set possibly_global_option1
5097   localopts on
5098   set local_option1
5099   set local_option2
5100   localopts off
5101   set possibly_global_option2
5105 .Sy Note
5106 that this setting
5107 .Dq stacks up :
5108 i.e., if
5109 .Ql macro1
5110 enables change localization and calls
5111 .Ql macro2 ,
5112 which explicitly resets localization, then any value changes within
5113 .Ql macro2
5114 will still be reverted by
5115 .Ql macro1 !
5116 \*(ID Once the outermost level, the one which enabled localization
5117 first, is left, but no earlier, all adjustments will be unrolled.
5118 \*(ID Likewise worth knowing, if in this example
5119 .Ql macro2
5120 changes to a different
5121 .Ic account
5122 which sets some variables that are yet covered by localizations, their
5123 scope will be extended, and in fact leaving the
5124 .Ic account
5125 will (thus) restore settings in (likely) global scope which actually
5126 were defined in a local, private context.
5129 .It Ic Lreply
5130 Reply to messages that come in via known
5131 .Pf ( Ic mlist )
5132 or subscribed
5133 .Pf ( Ic mlsubscribe )
5134 mailing lists, or pretend to do so (see
5135 .Sx "Mailing lists" ) :
5136 on top of the usual
5137 .Ic reply
5138 functionality this will actively resort and even remove message
5139 recipients in order to generate a message that is supposed to be sent to
5140 a mailing list.
5141 For example it will also implicitly generate a
5142 .Ql Mail-Followup-To:
5143 header if that seems useful, regardless of the setting of the variable
5144 .Va followup-to .
5145 For more documentation please refer to
5146 .Sx "On sending mail, and non-interactive mode" .
5149 .It Ic Mail
5150 Similar to
5151 .Ic mail ,
5152 but saves the message in a file named after the local part of the first
5153 recipient's address (instead of in
5154 .Va record Ns ).
5157 .It Ic mail
5158 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5159 or asks on standard input if none were given;
5160 then collects the remaining mail content and sends it out.
5161 For more documentation please refer to
5162 .Sx "On sending mail, and non-interactive mode" .
5165 .It Ic mbox
5166 (mb) The given message list is to be sent to the
5167 .Mx -sx
5168 .Sx "secondary mailbox"
5169 .Ev MBOX
5170 when \*(UA is quit; this is the default action unless the variable
5171 .Va hold
5172 is set.
5173 \*(ID This command can only be used in a
5174 .Mx -sx
5175 .Sx "primary system mailbox" .
5179 .It Ic mimetype , unmimetype
5180 Without arguments the content of the MIME type cache will displayed;
5181 a more verbose listing will be produced if either of
5182 .Va debug
5184 .Va verbose
5185 are set.
5186 When given arguments they will be joined, interpreted as shown in
5187 .Sx "The mime.types files"
5188 (also see
5189 .Sx "HTML mail and MIME attachments" ) ,
5190 and the resulting entry will be added (prepended) to the cache.
5191 In any event MIME type sources are loaded first as necessary \(en
5192 .Va mimetypes-load-control
5193 can be used to fine-tune which sources are actually loaded.
5195 The latter command deletes all specifications of the given MIME type, thus
5196 .Ql ? unmimetype text/plain
5197 will remove all registered specifications for the MIME type
5198 .Ql text/plain .
5199 The special name
5200 .Ql *
5201 will discard all existing MIME types, just as will
5202 .Ql reset ,
5203 but which also reenables cache initialization via
5204 .Va mimetypes-load-control .
5208 .It Ic mlist , unmlist
5209 The latter command removes all given mailing-lists, the special name
5210 .Ql *
5211 can be used to remove all registered lists.
5212 The former will list all currently defined mailing lists (and their
5213 attributes, if any) when used without arguments; a more verbose listing
5214 will be produced if either of
5215 .Va debug
5217 .Va verbose
5218 are set.
5219 Otherwise all given arguments will be added and henceforth be recognized
5220 as mailing lists.
5221 If the \*(OPal regular expression support is available then mailing
5222 lists may also be specified as (extended) regular expressions (see
5223 .Xr re_format 7
5224 for more on those).
5227 .It Ic mimeview
5228 \*(ID Only available in interactive mode, this command allows to display
5229 MIME parts which require external MIME handler programs to run which do
5230 not integrate in \*(UAs normal
5231 .Ic type
5232 output (see
5233 .Sx "HTML mail and MIME attachments" ) .
5234 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5235 The user will be asked for each non-text part of the given message in
5236 turn whether the registered handler shall be used to display the part.
5240 .It Ic mlsubscribe , unmlsubscribe
5241 The latter command removes the subscription attribute from all given
5242 mailing-lists, the special name
5243 .Ql *
5244 can be used to do so for any registered list.
5245 The former will list all currently defined mailing lists which have
5246 a subscription attribute when used without arguments; a more verbose
5247 listing will be produced if either of
5248 .Va debug
5250 .Va verbose
5251 are set.
5252 Otherwise this attribute will be set for all given mailing lists,
5253 newly creating them as necessary (as via
5254 .Ic mlist ) .
5255 Also see
5256 .Va followup-to .
5259 .It Ic Move
5260 Similar to
5261 .Ic move ,
5262 but moves the messages to a file named after the local part of the
5263 sender address of the first message (instead of in
5264 .Va record Ns ).
5267 .It Ic move
5268 Acts like
5269 .Ic copy
5270 but marks the messages for deletion if they were transferred
5271 successfully.
5274 .It Ic More
5275 Like
5276 .Ic more ,
5277 but also displays header fields which would not pass the
5278 .Ic headerpick
5279 selection, and all MIME parts.
5280 Identical to
5281 .Ic Page .
5284 .It Ic more
5285 Invokes the
5286 .Ev PAGER
5287 on the given messages, even in non-interactive mode and as long as the
5288 standard output is a terminal.
5289 Identical to
5290 .Ic page .
5293 .It Ic netrc
5294 \*(OP When used without arguments or if
5295 .Ar show
5296 has been given the content of the
5297 .Pa .netrc
5298 cache is shown, loading it first as necessary.
5299 If the argument is
5300 .Ar load
5301 then the cache will only be initialized and
5302 .Ar clear
5303 will remove its contents.
5304 Note that \*(UA will try to load the file only once, use
5305 .Ql Ic \&\&netrc Ns \:\0\:clear
5306 to unlock further attempts.
5308 .Va netrc-lookup ,
5309 .Va netrc-pipe
5310 and the section
5311 .Sx "On URL syntax and credential lookup" ;
5312 the section
5313 .Sx "The .netrc file"
5314 documents the file format in detail.
5317 .It Ic newmail
5318 Checks for new mail in the current folder without committing any changes
5319 before.
5320 If new mail is present, a message is shown.
5321 If the
5322 .Va header
5323 variable is set,
5324 the headers of each new message are also shown.
5325 This command is not available for all mailbox types.
5328 .It Ic next
5329 (n) (like
5330 .Ql +
5332 .Dq ENTER )
5333 Goes to the next message in sequence and types it.
5334 With an argument list, types the next matching message.
5337 .It Ic New
5338 Same as
5339 .Ic Unread .
5342 .It Ic new
5343 Same as
5344 .Ic unread .
5347 .It Ic noop
5348 If the current folder is accessed via a network connection, a
5349 .Dq NOOP
5350 command is sent, otherwise no operation is performed.
5353 .It Ic Page
5354 Like
5355 .Ic page ,
5356 but also displays header fields which would not pass the
5357 .Ic headerpick
5358 selection, and all MIME parts.
5359 Identical to
5360 .Ic More .
5363 .It Ic page
5364 Invokes the
5365 .Ev PAGER
5366 on the given messages, even in non-interactive mode and as long as the
5367 standard output is a terminal.
5368 Identical to
5369 .Ic more .
5372 .It Ic Pipe
5373 Like
5374 .Ic pipe
5375 but also pipes header fields which would not pass the
5376 .Ic headerpick
5377 selection, and all parts of MIME
5378 .Ql multipart/alternative
5379 messages.
5382 .It Ic pipe
5383 (pi) Takes a message list and a shell command
5384 and pipes the messages through the command.
5385 Without an argument the current message is piped through the command
5386 given by the
5387 .Va cmd
5388 variable.
5389 If the
5390 .Va page
5391 variable is set,
5392 every message is followed by a formfeed character.
5395 .It Ic preserve
5396 (pre) A synonym for
5397 .Ic hold .
5400 .It Ic Print
5401 (P) Alias for
5402 .Ic Type .
5405 .It Ic print
5406 (p) Research
5408 equivalent of
5409 .Ic type .
5412 .It Ic quit
5413 (q) Terminates the session, saving all undeleted, unsaved messages in
5414 the current
5415 .Mx -sx
5416 .Sx "secondary mailbox"
5417 .Ev MBOX ,
5418 preserving all messages marked with
5419 .Ic hold
5421 .Ic preserve
5422 or never referenced in the system
5423 .Va inbox ,
5424 and removing all other messages from the
5425 .Mx -sx
5426 .Sx "primary system mailbox" .
5427 If new mail has arrived during the session,
5428 the message
5429 .Dq You have new mail
5430 will be shown.
5431 If given while editing a mailbox file with the command line option
5432 .Fl f ,
5433 then the edit file is rewritten.
5434 A return to the shell is effected,
5435 unless the rewrite of edit file fails,
5436 in which case the user can escape with the exit command.
5437 The optional status number argument will be passed through to
5438 .Xr exit 3 .
5439 \*(ID For now it can happen that the given status will be overwritten,
5440 later this will only occur if a later error needs to be reported onto an
5441 otherwise success indicating status.
5444 .It Ic read
5445 \*(NQ Read a line from standard input, or the channel set active via
5446 .Ic readctl ,
5447 and assign the data, which will be splitted as indicated by
5448 .Va ifs ,
5449 to the given variables.
5450 The variable names are checked by the same rules as documented for
5451 .Cm vput ,
5452 and the same error codes will be seen in
5453 .Va \&! ;
5454 the exit status
5455 .Va \&?
5456 indicates the number of bytes read, it will be
5457 .Ql -1
5458 with the error number
5459 .Va \&!
5460 set to
5461 .Va ^ERR Ns -BADF
5462 in case of I/O errors, or
5463 .Va ^ERR Ns -NONE
5464 upon End-Of-File.
5465 If there are more fields than variables, assigns successive fields to the
5466 last given variable.
5467 If there are less fields than variables, assigns the empty string to the
5468 remains.
5469 .Bd -literal -offset indent
5470 ? read a b c
5471    H  e  l  l  o
5472 ? echo "<$a> <$b> <$c>"
5473 <H> <e> <l  l  o>
5474 ? wysh set ifs=:; read a b c;unset ifs
5475 hey2.0,:"'you    ",:world!:mars.:
5476 ? echo $?/$^ERRNAME / <$a><$b><$c>
5477 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5481 .It Ic readctl
5482 \*(NQ Manages input channels for
5483 .Ic read ,
5484 to be used to avoid complicated or impracticable code, like calling
5485 .Ic \&\&read
5486 from within a macro in non-interactive mode.
5487 Without arguments, or when the first argument is
5488 .Cm show ,
5489 a listing of all known channels is printed.
5490 Channels can otherwise be
5491 .Cm create Ns
5492 d, and existing channels can be
5493 .Cm set
5494 active and
5495 .Cm remove Ns
5496 d by giving the string used for creation.
5498 The channel name is expected to be a file descriptor number, or,
5499 if parsing the numeric fails, an input file name that undergoes
5500 .Sx "Filename transformations" .
5501 E.g. (this example requires a modern shell):
5502 .Bd -literal -offset indent
5503 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
5504   LC_ALL=C \*(uA -R#
5505 hey, you
5506 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
5507   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
5508 hey, you
5511 .It Ic redirect
5512 \*(OB Same as
5513 .Ic resend .
5515 .It Ic Redirect
5516 \*(OB Same as
5517 .Ic Resend .
5520 .It Ic remove
5521 Removes the named files or directories.
5522 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
5523 type specific removal will be performed, deleting the complete mailbox.
5524 The user is asked for confirmation in interactive mode.
5527 .It Ic rename
5528 Takes the name of an existing folder
5529 and the name for the new folder
5530 and renames the first to the second one.
5531 Both folders must be of the same type.
5534 .It Ic Reply
5535 (R) Replies to only the sender of each message of the given message
5536 list, by using the first message as the template to quote, for the
5537 .Ql Subject:
5538 etc.
5539 .Va flipr
5540 will exchange this command with
5541 .Ic reply .
5542 Unless the internal variable
5543 .Va fullnames
5544 is set the recipient address will be stripped from comments, names etc.
5547 .It Ic reply
5548 (r) Take a message and group-responds to it by addressing the sender
5549 and all recipients, subject to
5550 .Ic alternates
5551 processing.
5552 .Va followup-to ,
5553 .Va followup-to-honour ,
5554 .Va reply-to-honour
5555 as well as
5556 .Va recipients-in-cc
5557 influence response behaviour.
5558 Unless the internal variable
5559 .Va fullnames
5560 is set recipient addresses will be stripped from comments, names etc.
5562 .Va flipr
5563 is set the commands
5564 .Ic Reply
5566 .Ic reply
5567 are exchanged.
5568 The command
5569 .Ic Lreply
5570 offers special support for replying to mailing lists.
5571 For more documentation please refer to
5572 .Sx "On sending mail, and non-interactive mode" .
5575 .It Ic replyall
5576 Similar to
5577 .Ic reply ,
5578 but initiates a group-reply regardless of the value of
5579 .Va flipr .
5582 .It Ic replysender
5583 Similar to
5584 .Ic Reply ,
5585 but responds to the sender only regardless of the value of
5586 .Va flipr .
5589 .It Ic Resend
5590 Like
5591 .Ic resend ,
5592 but does not add any header lines.
5593 This is not a way to hide the sender's identity,
5594 but useful for sending a message again to the same recipients.
5597 .It Ic resend
5598 Takes a list of messages and a user name
5599 and sends each message to the named user.
5600 .Ql Resent-From:
5601 and related header fields are prepended to the new copy of the message.
5602 Saving in
5603 .Va record
5604 is only performed if
5605 .Va record-resent
5606 is set.
5609 .It Ic Respond
5610 Same as
5611 .Ic Reply .
5614 .It Ic respond
5615 Same as
5616 .Ic reply .
5619 .It Ic respondall
5620 Same as
5621 .Ic replyall .
5624 .It Ic respondsender
5625 Same as
5626 .Ic replysender .
5629 .It Ic retain
5630 (ret) Superseded by the multiplexer
5631 .Ic headerpick .
5634 .It Ic return
5635 Only available inside the scope of a
5636 .Ic define Ns
5637 d macro or an
5638 .Ic account ,
5639 this will stop evaluation of any further macro content, and return
5640 execution control to the caller.
5641 The two optional parameters must be specified as positive decimal
5642 numbers and default to the value 0:
5643 the first argument specifies the signed 32-bit return value (stored in
5644 .Va \&?
5645 and later extended to signed 64-bit),
5646 the second the signed 32-bit error number (stored in
5647 .Va \&! ) .
5648 As documented for
5649 .Va \&?
5650 a non-0 exit status may cause the program to exit.
5653 .It Ic Save
5654 (S) Similar to
5655 .Ic save,
5656 but saves the messages in a file named after the local part of the
5657 sender of the first message instead of (in
5658 .Va record
5659 and) taking a filename argument; the variable
5660 .Va outfolder
5661 is inspected to decide on the actual storage location.
5664 .It Ic save
5665 (s) Takes a message list and a filename and appends each message in turn
5666 to the end of the file.
5667 If no filename is given, the
5668 .Mx -sx
5669 .Sx "secondary mailbox"
5670 .Ev MBOX
5671 is used.
5672 The filename in quotes, followed by the generated character count
5673 is echoed on the user's terminal.
5674 If editing a
5675 .Mx -sx
5676 .Sx "primary system mailbox"
5677 the messages are marked for deletion.
5678 .Sx "Filename transformations"
5679 will be applied.
5681 .It Ic savediscard
5682 \*(OB Superseded by the multiplexer
5683 .Ic headerpick .
5685 .It Ic saveignore
5686 \*(OB Superseded by the multiplexer
5687 .Ic headerpick .
5689 .It Ic saveretain
5690 \*(OB Superseded by the multiplexer
5691 .Ic headerpick .
5694 .It Ic search
5695 Takes a message specification (list) and displays a header summary of
5696 all matching messages, as via
5697 .Ic headers .
5698 This command is an alias of
5699 .Ic from .
5700 Also see
5701 .Sx "Specifying messages" .
5704 .It Ic seen
5705 Takes a message list and marks all messages as having been read.
5710 .It Ic set , unset
5711 (se, \*(NQ uns) The latter command will delete all given variables,
5712 the former, when used without arguments, will show all variables which
5713 are currently known to \*(UA; this will not automatically link-in
5714 .Sx ENVIRONMENT
5715 variables which are known to \*(UA even if they exist in the program
5716 environment: only explicit addressing of variables, e.g., via
5717 .Ic varshow ,
5718 using a variable in a
5719 .Ic if
5720 condition or a string passed to
5721 .Ic echo ,
5722 or via program-internal use cases will perform this task.
5723 A more verbose listing will be produced if
5724 either of
5725 .Va debug
5727 .Va verbose
5728 are set.
5731 Otherwise the given variables (and arguments) are set or adjusted.
5732 Arguments are of the form
5733 .Ql name=value
5734 (no space before or after
5735 .Ql = ) ,
5736 or plain
5737 .Ql name
5738 if there is no value, i.e., a boolean variable.
5739 \*(ID In conjunction with the
5740 .Cm wysh
5741 command prefix
5742 .Sx "Shell-style argument quoting"
5743 can be used to quote arguments as necessary.
5744 \*(ID Otherwise quotation marks may be placed around any part of the
5745 assignment statement to quote blanks or tabs.
5748 .Dl wysh set indentprefix=' -> '
5751 If an argument begins with
5752 .Ql no ,
5753 as in
5754 .Ql set nosave ,
5755 the effect is the same as invoking the
5756 .Ic unset
5757 command with the remaining part of the variable
5758 .Pf ( Ql unset save ) .
5762 .Ql name
5763 that is known to map to an environment variable will automatically cause
5764 updates in the program environment (unsetting a variable in the
5765 environment requires corresponding system support) \(em use the command
5766 .Ic environ
5767 for further environmental control.
5768 Also see
5769 .Ic varedit ,
5770 .Ic varshow
5771 and the sections
5772 .Sx "INTERNAL VARIABLES"
5774 .Sx ENVIRONMENT .
5778 .It Ic shcodec
5779 Apply shell quoting rules to the given raw-data arguments.
5780 Supports
5781 .Cm vput
5782 (see
5783 .Sx "Command modifiers" ) ,
5784 The first argument specifies the operation:
5785 .Ar [+]e[ncode]
5787 .Ar d[ecode]
5788 cause shell quoting to be applied to the remains of the line, and
5789 expanded away thereof, respectively.
5790 If the former is prefixed with a plus-sign, the quoted result will not
5791 be roundtrip enabled, and thus can be decoded only in the very same
5792 environment that was used to perform the encode; also see
5793 .Cd mle-quote-rndtrip .
5794 If the coding operation fails the error number
5795 .Va \&!
5796 is set to
5797 .Va ^ERR Ns -CANCELED ,
5798 and the unmodified input is used as the result; the error number may
5799 change again due to output or result storage errors.
5802 .It Ic shell
5803 (sh) Invokes an interactive version of the shell,
5804 and returns its exit status.
5808 .It Ic shortcut , unshortcut
5809 Without arguments the list of all currently defined shortcuts is
5810 shown, with one argument the expansion of the given shortcut.
5811 Otherwise all given arguments are treated as pairs of shortcuts and
5812 their expansions, creating new or changing already existing shortcuts,
5813 as necessary.
5814 The latter command will remove all given shortcuts, the special name
5815 .Ql *
5816 will remove all registered shortcuts.
5819 .It Ic shift
5820 Shift the positional parameter stack (starting at
5821 .Va 1 )
5822 by the given number (which must be an unsigned, positive, decimal),
5823 or 1 if no argument has been given.
5824 It is an error if the value exceeds the number of positional parameters.
5825 If the given number is 0, no action is performed, successfully.
5826 The stack as such can be managed via
5827 .Ic vpospar .
5828 Note this command will fail in
5829 .Ic account
5830 and hook macros unless the positional parameter stack has been
5831 explicitly created in the current context via
5832 .Ic vpospar .
5835 .It Ic show
5836 Like
5837 .Ic type ,
5838 but performs neither MIME decoding nor decryption, so that the raw
5839 message text is shown.
5842 .It Ic size
5843 (si) Shows the size in characters of each message of the given
5844 message-list.
5847 .It Ic sleep
5848 \*(NQ Sleep for the specified number of seconds (and optionally
5849 milliseconds), by default interruptably.
5850 If a third argument is given the sleep will be uninterruptible,
5851 otherwise the error number
5852 .Va \&!
5853 will be set to
5854 .Va ^ERR Ns -INTR
5855 if the sleep has been interrupted.
5856 The command will fail and the error number will be
5857 .Va ^ERR Ns -OVERFLOW
5858 if the given duration(s) overflow the time datatype, and
5859 .Va ^ERR Ns -INVAL
5860 if the given durations are no valid integers.
5865 .It Ic sort , unsort
5866 The latter command disables sorted or threaded mode, returns to normal
5867 message order and, if the
5868 .Va header
5869 variable is set,
5870 displays a header summary.
5871 The former command shows the current sorting criterion when used without
5872 an argument, but creates a sorted representation of the current folder
5873 otherwise, and changes the
5874 .Ic next
5875 command and the addressing modes such that they refer to messages in
5876 the sorted order.
5877 Message numbers are the same as in regular mode.
5878 If the
5879 .Va header
5880 variable is set,
5881 a header summary in the new order is also displayed.
5882 Automatic folder sorting can be enabled by setting the
5883 .Va autosort
5884 variable, as in, e.g.,
5885 .Ql set autosort=thread .
5886 Possible sorting criterions are:
5889 .Bl -tag -compact -width "subject"
5890 .It Ar date
5891 Sort the messages by their
5892 .Ql Date:
5893 field, that is by the time they were sent.
5894 .It Ar from
5895 Sort messages by the value of their
5896 .Ql From:
5897 field, that is by the address of the sender.
5898 If the
5899 .Va showname
5900 variable is set, the sender's real name (if any) is used.
5901 .It Ar size
5902 Sort the messages by their size.
5903 .It spam
5904 \*(OP Sort the message by their spam score, as has been classified by
5905 .Ic spamrate .
5906 .It Ar status
5907 Sort the messages by their message status.
5908 .It Ar subject
5909 Sort the messages by their subject.
5910 .It Ar thread
5911 Create a threaded display.
5912 .It Ar to
5913 Sort messages by the value of their
5914 .Ql To:
5915 field, that is by the address of the recipient.
5916 If the
5917 .Va showname
5918 variable is set, the recipient's real name (if any) is used.
5923 .It Ic source
5924 \*(NQ (so) The source command reads commands from the given file.
5925 .Sx "Filename transformations"
5926 will be applied.
5927 If the given expanded argument ends with a vertical bar
5928 .Ql |
5929 then the argument will instead be interpreted as a shell command and
5930 \*(UA will read the output generated by it.
5931 Interpretation of commands read is stopped when an error is encountered.
5932 \*(ID Note that
5933 .Ic \&\&source
5934 cannot be used from within macros that execute as
5935 .Va folder-hook Ns s
5937 .Ic account Ns s ,
5938 i.e., it can only be called from macros that were
5939 .Ic call Ns ed .
5942 .It Ic source_if
5943 \*(NQ The difference to
5944 .Ic source
5945 (beside not supporting pipe syntax aka shell command input) is that
5946 this command will not generate an error nor warn if the given file
5947 argument cannot be opened successfully.
5950 .It Ic spamclear
5951 \*(OP Takes a list of messages and clears their
5952 .Ql is-spam
5953 flag.
5956 .It Ic spamforget
5957 \*(OP Takes a list of messages and causes the
5958 .Va spam-interface
5959 to forget it has ever used them to train its Bayesian filter.
5960 Unless otherwise noted the
5961 .Ql is-spam
5962 flag of the message is inspected to chose whether a message shall be
5963 forgotten to be
5964 .Dq ham
5966 .Dq spam .
5969 .It Ic spamham
5970 \*(OP Takes a list of messages and informs the Bayesian filter of the
5971 .Va spam-interface
5972 that they are
5973 .Dq ham .
5974 This also clears the
5975 .Ql is-spam
5976 flag of the messages in question.
5979 .It Ic spamrate
5980 \*(OP Takes a list of messages and rates them using the configured
5981 .Va spam-interface ,
5982 without modifying the messages, but setting their
5983 .Ql is-spam
5984 flag as appropriate; because the spam rating headers are lost the rate
5985 will be forgotten once the mailbox is left.
5986 Refer to the manual section
5987 .Sx "Handling spam"
5988 for the complete picture of spam handling in \*(UA.
5991 .It Ic spamset
5992 \*(OP Takes a list of messages and sets their
5993 .Ql is-spam
5994 flag.
5997 .It Ic spamspam
5998 \*(OP Takes a list of messages and informs the Bayesian filter of the
5999 .Va spam-interface
6000 that they are
6001 .Dq spam .
6002 This also sets the
6003 .Ql is-spam
6004 flag of the messages in question.
6006 .It Ic thread
6007 \*(OB The same as
6008 .Ql sort thread
6009 (consider using a
6010 .Ql commandalias
6011 as necessary).
6014 .It Ic Top
6015 Like
6016 .Ic top
6017 but always uses the
6018 .Ic headerpick
6019 .Ql type
6020 slot for white- and blacklisting header fields.
6023 .It Ic top
6024 (to) Takes a message list and types out the first
6025 .Va toplines
6026 lines of each message on the users' terminal.
6027 Unless a special selection has been established for the
6028 .Ql top
6029 slot of the
6030 .Ic headerpick
6031 command, the only header fields that are displayed are
6032 .Ql From: ,
6033 .Ql To: ,
6034 .Ql CC: ,
6036 .Ql Subject: .
6037 .Ic Top
6038 will always use the
6039 .Ql type
6040 .Ic headerpick
6041 selection instead.
6042 It is possible to apply compression to what is displayed by setting
6043 .Va topsqueeze .
6044 Messages are decrypted and converted to the terminal character set
6045 if necessary.
6048 .It Ic touch
6049 (tou) Takes a message list and marks the messages for saving in the
6050 .Mx -sx
6051 .Sx "secondary mailbox"
6052 .Ev MBOX .
6053 \*(UA deviates from the POSIX standard with this command,
6054 as a following
6055 .Ic next
6056 command will display the following message instead of the current one.
6059 .It Ic Type
6060 (T) Like
6061 .Ic type
6062 but also displays header fields which would not pass the
6063 .Ic headerpick
6064 selection, and all visualizable parts of MIME
6065 .Ql multipart/alternative
6066 messages.
6069 .It Ic type
6070 (t) Takes a message list and types out each message on the users terminal.
6071 The display of message headers is selectable via
6072 .Ic headerpick .
6073 For MIME multipart messages, all parts with a content type of
6074 .Ql text ,
6075 all parts which have a registered MIME type handler (see
6076 .Sx "HTML mail and MIME attachments" )
6077 which produces plain text output, and all
6078 .Ql message
6079 parts are shown, others are hidden except for their headers.
6080 Messages are decrypted and converted to the terminal character set
6081 if necessary.
6082 The command
6083 .Ic mimeview
6084 can be used to display parts which are not displayable as plain text.
6086 .It Ic unaccount
6088 .Ic account .
6090 .It Ic unalias
6091 (una) See
6092 .Ic alias .
6094 .It Ic unanswered
6096 .Ic answered .
6098 .It Ic unbind
6100 .Ic bind .
6102 .It Ic uncollapse
6104 .Ic collapse .
6106 .It Ic uncolour
6108 .Ic colour .
6110 .It Ic undefine
6112 .Ic define .
6114 .It Ic undelete
6116 .Ic delete .
6118 .It Ic undraft
6120 .Ic draft .
6122 .It Ic unflag
6124 .Ic flag .
6126 .It Ic unfwdignore
6127 \*(OB Superseded by the multiplexer
6128 .Ic headerpick .
6130 .It Ic unfwdretain
6131 \*(OB Superseded by the multiplexer
6132 .Ic headerpick .
6135 .It Ic unignore
6136 Superseded by the multiplexer
6137 .Ic headerpick .
6139 .It Ic unmimetype
6141 .Ic mimetype .
6143 .It Ic unmlist
6145 .Ic mlist .
6147 .It Ic unmlsubscribe
6149 .Ic mlsubscribe .
6152 .It Ic Unread
6153 Same as
6154 .Ic unread .
6157 .It Ic unread
6158 Takes a message list and marks each message as not having been read.
6161 .It Ic unretain
6162 Superseded by the multiplexer
6163 .Ic headerpick .
6165 .It Ic unsaveignore
6166 \*(OB Superseded by the multiplexer
6167 .Ic headerpick .
6169 .It Ic unsaveretain
6170 \*(OB Superseded by the multiplexer
6171 .Ic headerpick .
6173 .It Ic unset
6174 \*(NQ (uns) See
6175 .Ic set .
6177 .It Ic unshortcut
6179 .Ic shortcut .
6181 .It Ic unsort
6183 .Ic short .
6185 .It Ic unthread
6186 \*(OB
6187 Same as
6188 .Ic unsort .
6191 .It Ic urlcodec
6192 Perform URL percent codec operations on the raw-data argument, rather
6193 according to RFC 3986.
6194 Supports
6195 .Cm vput
6196 (see
6197 .Sx "Command modifiers" ) ,
6198 and manages the error number
6199 .Va \&! .
6200 This is a character set agnostic and thus locale dependent operation,
6201 and it may decode bytes which are invalid in the current
6202 .Va ttycharset .
6203 \*(ID This command does not about URLs beside that.
6205 The first argument specifies the operation:
6206 .Ar e[ncode]
6208 .Ar d[ecode]
6209 perform plain URL percent en- and decoding, respectively.
6210 .Ar p[ath]enc[ode]
6212 .Ar p[ath]dec[ode]
6213 perform a slightly modified operation which should be better for
6214 pathnames: it does not allow a tilde
6215 .Ql ~ ,
6216 and will neither accept hyphen-minus
6217 .Ql -
6218 nor dot
6219 .Ql .
6220 as an initial character.
6221 The remains of the line form the URL data which is to be converted.
6222 If the coding operation fails the error number
6223 .Va \&!
6224 is set to
6225 .Va ^ERR Ns -CANCELED ,
6226 and the unmodified input is used as the result; the error number may
6227 change again due to output or result storage errors.
6230 .It Ic varedit
6231 \*(NQ Edit the values of or create the given variable(s) in the
6232 .Ev EDITOR .
6233 Boolean variables cannot be edited, and variables can also not be
6234 .Ic unset
6235 with this command.
6238 .It Ic varshow
6239 \*(NQ This command produces the same output as the listing mode of
6240 .Ic set ,
6241 including
6242 .Va verbose Ns
6243 ity adjustments, but only for the given variables.
6246 .It Ic verify
6247 \*(OP Takes a message list and verifies each message.
6248 If a message is not a S/MIME signed message,
6249 verification will fail for it.
6250 The verification process checks if the message was signed using a valid
6251 certificate,
6252 if the message sender's email address matches one of those contained
6253 within the certificate,
6254 and if the message content has been altered.
6257 .It Ic version
6258 Shows the
6259 .Va version
6261 .Va features
6262 of \*(UA.
6266 .It Ic vexpr
6267 \*(NQ Evaluate arguments according to a given operator.
6268 This is a multiplexer command which can be used to perform signed 64-bit
6269 numeric calculations as well as byte string and string operations.
6270 It uses polish notation, i.e., the operator is the first argument and
6271 defines the number and type, and the meaning of the remaining arguments.
6272 An empty argument is replaced with a 0 if a number is expected.
6273 Supports
6274 .Cm vput
6275 (see
6276 .Sx "Command modifiers" ) .
6279 The result that is shown in case of errors is always
6280 .Ql -1
6281 for usage errors and numeric operations, and the empty string for byte
6282 string and string operations;
6283 if the latter two fail to provide result data for
6284 .Dq soft
6285 errors, e.g., when a search operation failed, they also set the
6286 .Va \&!
6287 error number to
6288 .Va ^ERR Ns -NODATA .
6289 Except when otherwise noted numeric arguments are parsed as signed 64-bit
6290 numbers, and errors will be reported in the error number
6291 .Va \&!
6292 as the numeric error
6293 .Va ^ERR Ns -RANGE .
6296 Numeric operations work on one or two signed 64-bit integers.
6297 One integer is expected by assignment (equals sign
6298 .Ql = ) ,
6299 which does nothing but parsing the argument, thus detecting validity and
6300 possible overflow conditions, and unary not (tilde
6301 .Ql ~ ) ,
6302 which creates the bitwise complement.
6303 Two integers are used by addition (plus sign
6304 .Ql + ) ,
6305 subtraction (hyphen-minus
6306 .Ql - ) ,
6307 multiplication (asterisk
6308 .Ql * ) ,
6309 division (solidus
6310 .Ql / )
6311 and modulo (percent sign
6312 .Ql % ) ,
6313 as well as for the bitwise operators logical or (vertical bar
6314 .Ql | ,
6315 to be quoted) ,
6316 bitwise and (ampersand
6317 .Ql \&& ,
6318 to be quoted) ,
6319 bitwise xor (circumflex
6320 .Ql ^ ) ,
6321 the bitwise signed left- and right shifts
6322 .Pf ( Ql << ,
6323 .Ql >> ) ,
6324 as well as for the unsigned right shift
6325 .Ql >>> .
6328 All numeric operators can be suffixed with a commercial at
6329 .Ql @ ,
6330 e.g.,
6331 .Ql *@ :
6332 this will turn the operation into a saturated one, which means that
6333 overflow errors and division and modulo by zero are no longer reported
6334 via the exit status, but the result will linger at the minimum or
6335 maximum possible value, instead of overflowing (or trapping).
6336 This is true also for the argument parse step.
6337 For the bitwise shifts, the saturated maximum is 63.
6338 Any catched overflow will be reported via the error number
6339 .Va \&!
6341 .Va ^ERR Ns -OVERFLOW .
6344 Character set agnostic string functions have no notion of locale
6345 settings and character sets.
6346 There is
6347 .Ql file-expand ,
6348 which performs the usual
6349 .Sx "Filename transformations"
6350 on its argument, and
6351 .Ql random ,
6352 which generates a random string of the given length, or of
6353 .Dv \&\&PATH_MAX
6354 bytes (a constant from
6355 .Pa /usr/include )
6356 if the value 0 is given; the random string will be base64url encoded
6357 according to RFC 4648, and thus be usable as a (portable) filename.
6360 Byte string operations work on 8-bit bytes and have no notion of locale
6361 settings and character sets, effectively assuming ASCII data.
6362 Operations that take one argument are
6363 .Ql length ,
6364 which queries the length of the given argument, and
6365 .Ql hash ,
6366 which calculates the Chris Torek hash of the given argument.
6369 Byte string operations with two or more arguments are
6370 .Ql find ,
6371 which byte-searches in the first for the second argument, and shows the
6372 resulting 0-based offset shall it have been found,
6373 .Ql ifind ,
6374 which is identical to
6375 .Ql find ,
6376 but works case-insensitively according to the rules of the ASCII
6377 character set.
6378 .Ql substring
6379 will show a substring of its first argument:
6380 the second argument is the 0-based starting offset, the optional third
6381 argument can be used to specify the length of the desired substring,
6382 by default the entire string is used;
6383 this operation tries to work around faulty arguments (set
6384 .Va verbose
6385 for error logs), but reports them via the error number
6386 .Va \&!
6388 .Va ^ERR Ns -OVERFLOW .
6391 String operations work, sufficient support provided, according to the
6392 active user's locale encoding and character set (see
6393 .Sx "Character sets" ) .
6394 There is the one argument operation
6395 .Ql makeprint ,
6396 which (one-way) converts the argument to something safely printable on
6397 the terminal.
6400 \*(OP
6401 .Ql regex
6402 is a string operation that will try to match the first argument with the
6403 regular expression given as the second argument, as does
6404 .Ql iregex ,
6405 but which is case-insensitive.
6406 If the optional third argument has been given then instead of showing
6407 the match offset a replacement operation is performed:
6408 the third argument is treated as if specified via dollar-single-quote
6409 (see
6410 .Sx "Shell-style argument quoting" ) ,
6411 and any occurrence of a positional parameter, e.g.,
6412 .Va 1 ,
6413 is replaced by the corresponding match group of the regular expression.
6415 .Bd -literal -offset indent
6416 ? vexpr -@ +1 -9223372036854775808
6417 ? vput vexpr res ir bananarama (.*)NanA(.*) '\e${1}au\e$2'
6418 ? echo $0 $res
6423 .It Ic vpospar
6424 \*(NQ Manage the positional parameter stack (see
6425 .Va 1 , # , * , @
6426 as well as
6427 .Ic shift ) .
6428 If the first argument is
6429 .Ql clear ,
6430 then the positional parameter stack of the current context, or the
6431 global one, if there is none, is cleared.
6432 If it is
6433 .Ql set ,
6434 then the remaining arguments will be used to (re)create the stack,
6435 if the parameter stack size limit is excessed an
6436 .Va ^ERR Ns -OVERFLOW
6437 error will occur.
6440 If the first argument is
6441 .Ql quote ,
6442 a round-trip capable representation of the stack contents is created,
6443 with each quoted parameter separated from each other with the first
6444 character of
6445 .Va ifs ,
6446 and followed by the first character of
6447 .Va if-ws ,
6448 if that is not empty and not identical to the first.
6449 If that results in no separation at all a
6450 .Cm space
6451 character is used.
6452 This mode supports
6453 .Cm vput
6454 (see
6455 .Sx "Command modifiers" ) .
6456 I.e., the subcommands
6457 .Ql set
6459 .Ql quote
6460 can be used (in conjunction with
6461 .Ic eval )
6462 to (re)create an argument stack from and to a single variable losslessly.
6464 .Bd -literal -offset indent
6465 ? vpospar set hey, "'you    ", world!
6466 ? echo $#: <${1}><${2}><${3}>
6467 ? vput vpospar x quote
6468 ? vpospar clear
6469 ? echo $#: <${1}><${2}><${3}>
6470 ? eval vpospar set ${x}
6471 ? echo $#: <${1}><${2}><${3}>
6476 .It Ic visual
6477 (v) Takes a message list and invokes the display editor on each message.
6478 Modified contents are discarded unless the
6479 .Va writebackedited
6480 variable is set, and are not used unless the mailbox can be written to
6481 and the editor returns a successful exit status.
6484 .It Ic write
6485 (w) For conventional messages the body without all headers is written.
6486 The original message is never marked for deletion in the originating
6487 mail folder.
6488 The output is decrypted and converted to its native format as necessary.
6489 If the output file exists, the text is appended.
6490 If a message is in MIME multipart format its first part is written to
6491 the specified file as for conventional messages, handling of the remains
6492 depends on the execution mode.
6493 No special handling of compressed files is performed.
6495 In interactive mode the user is consecutively asked for the filenames of
6496 the processed parts.
6497 For convience saving of each part may be skipped by giving an empty
6498 value, the same result as writing it to
6499 .Pa /dev/null .
6500 Shell piping the part content by specifying a leading vertical bar
6501 .Ql |
6502 character for the filename is supported.
6503 Other user input undergoes the usual
6504 .Sx "Filename transformations" ,
6505 and contents of the destination file are overwritten if the file
6506 previously existed.
6508 \*(ID In non-interactive mode any part which does not specify a filename
6509 is ignored, and suspicious parts of filenames of the remaining parts are
6510 URL percent encoded (as via
6511 .Ic urlencode )
6512 to prevent injection of malicious character sequences, resulting in
6513 a filename that will be written into the current directory.
6514 Existing files will not be overwritten, instead the part number or
6515 a dot are appended after a number sign
6516 .Ql #
6517 to the name until file creation succeeds (or fails due to other
6518 reasons).
6521 .It Ic xcall
6522 \*(NQ The sole difference to
6523 .Ic call
6524 is that the new macro is executed in place of the current one, which
6525 will not regain control; all resources of the current macro will be
6526 released before control is given to the replacer.
6527 Note this implies that
6528 .Ic localopts
6529 may become cleaned up if the teared down macro context is the outermost
6530 level of the cleanup stack.
6531 If this command is not used from within a
6532 .Ic call Ns
6533 ed macro it will silently be (a more expensive variant of)
6534 .Ic call .
6537 .It Ic xit
6538 (x) A synonym for
6539 .Ic exit .
6542 .It Ic z
6543 \*(NQ \*(UA presents message headers in
6544 .Va screen Ns
6545 fuls as described under the
6546 .Ic headers
6547 command.
6548 Without arguments this command scrolls to the next window of messages,
6549 likewise if the argument is
6550 .Ql + .
6551 An argument of
6552 .Ql -
6553 scrolls to the last,
6554 .Ql ^
6555 scrolls to the first, and
6556 .Ql $
6557 to the last
6558 .Va \&\&screen
6559 of messages.
6560 A number argument prefixed by
6561 .Ql +
6563 .Ql \-
6564 indicates that the window is calculated in relation to the current
6565 position, and a number without a prefix specifies an absolute position.
6568 .It Ic Z
6569 \*(NQ Similar to
6570 .Ic z ,
6571 but scrolls to the next or previous window that contains at least one
6572 .Ql new
6574 .Ic flag Ns
6575 ged message.
6577 .\" }}}
6578 .\" }}}
6581 .\" .Sh COMMAND ESCAPES {{{
6582 .Sh "COMMAND ESCAPES"
6584 Here is a summary of the command escapes available in compose mode,
6585 which are used to perform special functions when composing messages.
6586 Command escapes are only recognized at the beginning of lines, and
6587 consist of a trigger (escape) and a command character.
6588 The actual escape character can be set via the internal variable
6589 .Va escape ,
6590 it defaults to the tilde
6591 .Ql ~ .
6592 Otherwise ignored whitespace characters following the escape character
6593 will prevent a possible addition of the command line to the \*(OPal
6594 history.
6597 Unless otherwise noted all compose mode commands ensure proper updates
6598 of the variables which represent the error number
6599 .Va \&!
6600 and the exit status
6601 .Va \&? .
6602 If the variable
6603 .Va errexit
6604 is set they will, unless stated otherwise, error out message compose
6605 mode if an operation fails.
6606 It is however possible to place the character hyphen-minus
6607 .Ql -
6608 after (possible whitespace following) the escape character, which has an
6609 effect equivalent to the command modifier
6610 .Cm vput .
6613 .Bl -tag -width ".It Ic BaNg"
6615 .It Ic ~~ Ar string
6616 Insert the string of text in the message prefaced by a single
6617 .Ql ~ .
6618 (If the escape character has been changed,
6619 that character must be doubled instead.)
6622 .It Ic ~! Ar command
6623 Execute the indicated shell
6624 .Ar command
6625 which follows, replacing unescaped exclamation marks with the previously
6626 executed command if the internal variable
6627 .Va bang
6628 is set, then return to the message.
6631 .It Ic ~.
6632 Same effect as typing the end-of-file character.
6635 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
6636 Execute the given \*(UA command.
6637 Not all commands, however, are allowed.
6640 .It Ic ~?
6641 Write a summary of command escapes.
6644 .It Ic ~< Ar filename
6645 Identical to
6646 .Ic ~r .
6649 .It Ic ~<! Ar command
6650 .Ar command
6651 is executed using the shell.
6652 Its standard output is inserted into the message.
6655 .It Ic ~@ Op Ar filename...
6656 Append or edit the list of attachments.
6657 Does not manage the error number
6658 .Va \&!
6659 and the exit status
6660 .Va \&? ,
6661 (please use
6662 .Ic ~^
6663 instead if this is a concern).
6664 A list of
6665 .Ar filename
6666 arguments is expected as shell tokens (see
6667 .Sx "Shell-style argument quoting" ;
6668 any token-separating commas are ignored), to be
6669 interpreted as documented for the command line option
6670 .Fl a ,
6671 with the message number exception as below.
6672 Without
6673 .Ar filename
6674 arguments the attachment list is edited, entry by entry;
6675 if a filename is left empty, that attachment is deleted from the list;
6676 once the end of the list is reached either new attachments may be
6677 entered or the session can be quit by committing an empty
6678 .Dq new
6679 attachment.
6680 For each mode, if a given filename solely consists of the number sign
6681 .Ql #
6682 followed by a valid message number of the currently active mailbox, then
6683 the given message is attached as a MIME
6684 .Ql message/rfc822
6685 part (the number sign is the shell comment character and must be quoted).
6688 .It Ic ~A
6689 Inserts the string contained in the
6690 .Va Sign
6691 variable (same as
6692 .Ql Ic ~i Ns \0Sign ) .
6693 \*(OB The escape sequences tabulator
6694 .Ql \et
6695 and newline
6696 .Ql \en
6697 are understood (use the
6698 .Cm wysh
6699 prefix when
6700 .Ic set Ns
6701 ting the variable(s) instead).
6704 .It Ic ~a
6705 Inserts the string contained in the
6706 .Va sign
6707 variable (same as
6708 .Ql Ic ~i Ns \0sign ) .
6709 \*(OB The escape sequences tabulator
6710 .Ql \et
6711 and newline
6712 .Ql \en
6713 are understood (use the
6714 .Cm wysh
6715 prefix when
6716 .Ic set Ns
6717 ting the variable(s) instead).
6720 .It Ic ~b Ar name ...
6721 Add the given names to the list of blind carbon copy recipients.
6724 .It Ic ~c Ar name ...
6725 Add the given names to the list of carbon copy recipients.
6728 .It Ic ~d
6729 Read the file specified by the
6730 .Ev DEAD
6731 variable into the message.
6734 .It Ic ~e
6735 Invoke the text editor on the message collected so far.
6736 After the editing session is finished,
6737 the user may continue appending text to the message.
6740 .It Ic ~F Ar messages
6741 Read the named messages into the message being sent, including all
6742 message headers and MIME parts.
6743 If no messages are specified, read in the current message.
6746 .It Ic ~f Ar messages
6747 Read the named messages into the message being sent.
6748 If no messages are specified, read in the current message.
6749 Strips down the list of header fields according to the
6750 .Ql type
6751 white- and blacklist selection of
6752 .Ic headerpick .
6753 For MIME multipart messages,
6754 only the first displayable part is included.
6757 .It Ic ~H
6758 Edit the message header fields
6759 .Ql From: ,
6760 .Ql Reply-To:
6762 .Ql Sender:
6763 by typing each one in turn and allowing the user to edit the field.
6764 The default values for these fields originate from the
6765 .Va from , replyto
6767 .Va sender
6768 variables.
6771 .It Ic ~h
6772 Edit the message header fields
6773 .Ql To: ,
6774 .Ql Cc: ,
6775 .Ql Bcc:
6777 .Ql Subject:
6778 by typing each one in turn and allowing the user to edit the field.
6781 .It Ic ~i Ar variable
6782 Insert the value of the specified variable into the message,
6783 adding a newline character at the end.
6784 The message remains unaltered if the variable is unset or empty.
6785 \*(OB The escape sequences tabulator
6786 .Ql \et
6787 and newline
6788 .Ql \en
6789 are understood (use the
6790 .Cm wysh
6791 prefix when
6792 .Ic set Ns
6793 ting the variable(s) instead).
6796 .It Ic ~M Ar messages
6797 Read the named messages into the message being sent,
6798 indented by
6799 .Va indentprefix .
6800 If no messages are specified, read the current message, the
6801 .Dq dot .
6804 .It Ic ~m Ar messages
6805 Read the named messages into the message being sent,
6806 indented by
6807 .Va indentprefix .
6808 If no messages are specified, read the current message.
6809 Strips down the list of header fields according to the
6810 .Ql type
6811 white- and blacklist selection of
6812 .Ic headerpick .
6813 For MIME multipart messages,
6814 only the first displayable part is included.
6817 .It Ic ~p
6818 Display the message collected so far,
6819 prefaced by the message header fields
6820 and followed by the attachment list, if any.
6823 .It Ic ~q
6824 Abort the message being sent,
6825 copying it to the file specified by the
6826 .Ev DEAD
6827 variable if
6828 .Va save
6829 is set.
6832 .It Ic ~R Ar filename
6833 Identical to
6834 .Ic ~r ,
6835 but indent each line that has been read by
6836 .Va indentprefix .
6839 .It Ic ~r Ar filename Op Ar HERE-delimiter
6840 Read the named file, object to the usual
6841 .Sx "Filename transformations" ,
6842 into the message; if (the expanded)
6843 .Ar filename
6844 is the hyphen-minus
6845 .Ql -
6846 then standard input is used, e.g., for pasting purposes.
6847 Only in this latter mode
6848 .Ar HERE-delimiter
6849 may be given: if it is data will be read in until the given
6850 .Ar HERE-delimiter
6851 is seen on a line by itself, and encountering EOF is an error; the
6852 .Ar HERE-delimiter
6853 is a required argument in non-interactive mode; if it is single-quote
6854 quoted then the pasted content will not be expanded, \*(ID otherwise
6855 a future version of \*(UA may perform shell-style expansion on the content.
6858 .It Ic ~s Ar string
6859 Cause the named string to become the current subject field.
6860 Newline (NL) and carriage-return (CR) bytes are invalid and will be
6861 normalized to space (SP) characters.
6864 .It Ic ~t Ar name ...
6865 Add the given name(s) to the direct recipient list.
6868 .It Ic ~U Ar messages
6869 Read in the given / current message(s) excluding all headers, indented by
6870 .Va indentprefix .
6873 .It Ic ~u Ar messages
6874 Read in the given / current message(s), excluding all headers.
6877 .It Ic ~v
6878 Invoke an alternate editor (defined by the
6879 .Ev VISUAL
6880 environment variable) on the message collected so far.
6881 Usually, the alternate editor will be a screen editor.
6882 After the editor is quit,
6883 the user may resume appending text to the end of the message.
6886 .It Ic ~w Ar filename
6887 Write the message onto the named file, which is object to the usual
6888 .Sx "Filename transformations" .
6889 If the file exists,
6890 the message is appended to it.
6893 .It Ic ~x
6894 Same as
6895 .Ic ~q ,
6896 except that the message is not saved at all.
6899 .It Ic ~| Ar command
6900 Pipe the message through the specified filter command.
6901 If the command gives no output or terminates abnormally,
6902 retain the original text of the message.
6903 E.g., the command
6904 .Xr fmt 1
6905 is often used as a rejustifying filter.
6909 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
6910 Low-level command meant for scripted message access, i.e., for
6911 .Va on-compose-splice-shell
6913 .Va on-compose-splice .
6914 The used protocol is likely subject to changes, and therefore the
6915 mentioned hooks receive the used protocol version as an initial line.
6916 In general the first field of a response line represents a status code
6917 which specifies whether a command was successful or not, whether result
6918 data is to be expected, and if, the format of the result data.
6919 Does not manage the error number
6920 .Va \&!
6921 and the exit status
6922 .Va \&? ,
6923 because errors are reported via the protocol
6924 (hard errors like I/O failures cannot be handled).
6925 This command has read-only access to several virtual pseudo headers in
6926 the \*(UA private namespace, which may not exist (except for the first):
6930 .Bl -tag -compact -width ".It Va BaNg"
6931 .It Ql Mailx-Command:
6932 The name of the command that generates the message, one of
6933 .Ql mail ,
6934 .Ql reply ,
6935 .Ql forward ,
6936 .Ql resend .
6938 .It Ql Mailx-Raw-To:
6939 .It Ql Mailx-Raw-Cc:
6940 .It Ql Mailx-Raw-Bcc:
6941 Represent the frozen initial state of these headers before any
6942 transformation (e.g.,
6943 .Ic alias ,
6944 .Ic alternates ,
6945 .Va recipients-in-cc
6946 etc.) took place.
6948 .It Ql Mailx-Orig-From:
6949 .It Ql Mailx-Orig-To:
6950 .It Ql Mailx-Orig-Cc:
6951 .It Ql Mailx-Orig-Bcc:
6952 The values of said headers of the original message which has been
6953 addressed by any of
6954 .Ic reply , forward , resend .
6958 The status codes are:
6962 .Bl -tag -compact -width ".It Ql _210_"
6963 .It Ql 210
6964 Status ok; the remains of the line are the result.
6966 .It Ql 211
6967 Status ok; the rest of the line is optionally used for more status.
6968 What follows are lines of result addresses, terminated by an empty line.
6969 The address lines consist of two fields, the first of which is the
6970 plain address, e.g.,
6971 .Ql bob@exam.ple ,
6972 separated by a single ASCII SP space from the second which contains the
6973 unstripped address, even if that is identical to the first field, e.g.,
6974 .Ql (Lovely) Bob <bob@exam.ple> .
6975 (All the input, including the empty line, must be consumed before
6976 further commands can be issued.)
6978 .It Ql 212
6979 Status ok; the rest of the line is optionally used for more status.
6980 What follows are lines of furtherly unspecified string content,
6981 terminated by an empty line.
6982 .Sy All the input,
6983 including the empty line, must be consumed before further commands can
6984 be issued!
6986 .It Ql 500
6987 Syntax error; invalid command.
6989 .It Ql 501
6990 Syntax error in parameters or arguments.
6992 .It Ql 505
6993 Error: an argument fails verification.
6994 For example an invalid address has been specified, or an attempt was
6995 made to modify anything in \*(UAs own namespace.
6997 .It Ql 506
6998 Error: an otherwise valid argument is rendered invalid due to context.
6999 For example, a second address is added to a header which may consist of
7000 a single address only.
7005 If a command indicates failure then the message will have remained
7006 unmodified.
7007 Most commands can fail with
7008 .Ql 500
7009 if required arguments are missing (false command usage).
7010 The following (case-insensitive) commands are supported:
7013 .Bl -hang -width ".It Cm header"
7014 .It Cm header
7015 This command allows listing, inspection, and editing of message headers.
7016 Header name case is not normalized, and case-insensitive comparison
7017 should be used when matching names.
7018 The second argument specifies the subcommand to apply, one of:
7020 .Bl -hang -width ".It Cm remove"
7021 .It Cm list
7022 Without a third argument a list of all yet existing headers is given via
7023 .Ql 210 ;
7024 this command is the default command of
7025 .Cm header
7026 if no second argument has been given.
7027 A third argument restricts output to the given header only, which may
7028 fail with
7029 .Ql 501
7030 if no such field is defined.
7032 .It Cm show
7033 Shows the content of the header given as the third argument.
7034 Dependent on the header type this may respond with
7035 .Ql 211
7037 .Ql 212 ;
7038 any failure results in
7039 .Ql 501 .
7041 .It Cm remove
7042 This will remove all instances of the header given as the third
7043 argument, reporting
7044 .Ql 210
7045 upon success,
7046 .Ql 501
7047 if no such header can be found, and
7048 Ql 505
7049 on \*(UA namespace violations.
7051 .It Cm remove-at
7052 This will remove from the header given as the third argument the
7053 instance at the list position (counting from one!) given with the fourth
7054 argument, reporting
7055 .Ql 210
7056 upon success or
7057 .Ql 505
7058 if the list position argument is not a number or on \*(UA namespace
7059 violations, and
7060 .Ql 501
7061 if no such header instance exists.
7063 .It Cm insert
7064 Create a new or an additional instance of the header given in the third
7065 argument, with the header body content as given in the fourth argument
7066 (the remains of the line).
7067 It may return
7068 .Ql 501
7069 if the third argument specifies a free-form header field name that is
7070 invalid, or if body content extraction fails to succeed,
7071 .Ql 505
7072 if any extracted address does not pass syntax and/or security checks or
7073 on \*(UA namespace violations, and
7074 .Ql 506
7075 to indicate prevention of excessing a single-instance header \(em note that
7076 .Ql Subject:
7077 can be appended to (a space separator will be added automatically first).
7079 .Ql 210
7080 is returned upon success, followed by the name of the header and the list
7081 position of the newly inserted instance.
7082 The list position is always 1 for single-instance header fields.
7083 All free-form header fields are managed in a single list.
7087 .It Cm attachment
7088 This command allows listing, removal and addition of message attachments.
7089 The second argument specifies the subcommand to apply, one of:
7091 .Bl -hang -width ".It Cm remove"
7092 .It Cm list
7093 List all attachments via
7094 .Ql 212 ,
7095 or report
7096 .Ql 501
7097 if no attachments exist.
7098 This command is the default command of
7099 .Cm attachment
7100 if no second argument has been given.
7102 .It Cm remove
7103 This will remove the attachment given as the third argument, and report
7104 .Ql 210
7105 upon success or
7106 .Ql 501
7107 if no such attachment can be found.
7108 If there exists any path component in the given argument, then an exact
7109 match of the path which has been used to create the attachment is used
7110 directly, but if only the basename of that path matches then all
7111 attachments are traversed to find an exact match first, and the removal
7112 occurs afterwards; if multiple basenames match, a
7113 .Ql 506
7114 error occurs.
7115 Message attachments are treated as absolute pathnames.
7117 If no path component exists in the given argument, then all attachments
7118 will be searched for
7119 .Ql filename=
7120 parameter matches as well as for matches of the basename of the path
7121 which has been used when the attachment has been created; multiple
7122 matches result in a
7123 .Ql 506 .
7125 .It Cm remove-at
7126 This will interpret the third argument as a number and remove the
7127 attachment at that list position (counting from one!), reporting
7128 .Ql 210
7129 upon success or
7130 .Ql 505
7131 if the argument is not a number or
7132 .Ql 501
7133 if no such attachment exists.
7135 .It Cm insert
7136 Adds the attachment given as the third argument, specified exactly as
7137 documented for the command line option
7138 .Fl a ,
7139 and supporting the message number extension as documented for
7140 .Ic ~@ .
7141 This reports
7142 .Ql 210
7143 upon success, with the index of the new attachment following,
7144 .Ql 505
7145 if the given file cannot be opened,
7146 .Ql 506
7147 if an on-the-fly performed character set conversion fails, otherwise
7148 .Ql 501
7149 is reported; this is also reported if character set conversion is
7150 requested but not available.
7152 .It Cm attribute
7153 This uses the same search mechanism as described for
7154 .Cm remove
7155 and prints any known attributes of the first found attachment via
7156 .Ql 212
7157 upon success or
7158 .Ql 501
7159 if no such attachment can be found.
7160 The attributes are written as lines of keyword and value tuples, the
7161 keyword being separated from the rest of the line with an ASCII SP space
7162 character.
7164 .It Cm attribute-at
7165 This uses the same search mechanism as described for
7166 .Cm remove-at
7167 and is otherwise identical to
7168 .Cm attribute .
7170 .It Cm attribute-set
7171 This uses the same search mechanism as described for
7172 .Cm remove ,
7173 and will assign the attribute given as the fourth argument, which is
7174 expected to be a value tuple of keyword and other data, separated by
7175 a ASCII SP space or TAB tabulator character.
7176 If the value part is empty, then the given attribute is removed, or
7177 reset to a default value if existence of the attribute is crucial.
7179 It returns via
7180 .Ql 210
7181 upon success, with the index of the found attachment following,
7182 .Ql 505
7183 for message attachments or if the given keyword is invalid, and
7184 .Ql 501
7185 if no such attachment can be found.
7186 The following keywords may be used (case-insensitively):
7188 .Bl -hang -compact -width ".It Ql filename"
7189 .It Ql filename
7190 Sets the filename of the MIME part, i.e., the name that is used for
7191 display and when (suggesting a name for) saving (purposes).
7192 .It Ql content-description
7193 Associate some descriptive information to the attachment's content, used
7194 in favour of the plain filename by some MUAs.
7195 .It Ql content-id
7196 May be used for uniquely identifying MIME entities in several contexts;
7197 this expects a special reference address format as defined in RFC 2045
7198 and generates a
7199 .Ql 505
7200 upon address content verification failure.
7201 .It Ql content-type
7202 Defines the media type/subtype of the part, which is managed
7203 automatically, but can be overwritten.
7204 .It Ql content-disposition
7205 Automatically set to the string
7206 .Ql attachment .
7209 .It Cm attribute-set-at
7210 This uses the same search mechanism as described for
7211 .Cm remove-at
7212 and is otherwise identical to
7213 .Cm attribute-set .
7219 .\" }}}
7222 .\" .Sh INTERNAL VARIABLES {{{
7223 .Sh "INTERNAL VARIABLES"
7225 Internal \*(UA variables are controlled via the
7226 .Ic set
7228 .Ic unset
7229 commands; prefixing a variable name with the string
7230 .Ql no
7231 and calling
7232 .Ic set
7233 has the same effect as using
7234 .Ic unset :
7235 .Ql unset crt
7237 .Ql set nocrt
7238 do the same thing.
7239 Creation or editing of variables can be performed in the
7240 .Ev EDITOR
7241 with the command
7242 .Ic varedit .
7243 .Ic varshow
7244 will give more insight on the given variable(s), and
7245 .Ic set ,
7246 when called without arguments, will show a listing of all variables.
7247 Both commands support a more
7248 .Va verbose
7249 listing mode.
7250 Some well-known variables will also become inherited from the
7251 program
7252 .Sx ENVIRONMENT
7253 implicitly, others can be explicitly imported with the command
7254 .Ic environ
7255 and henceforth share said properties.
7258 Two different kind of internal variables exist.
7259 There are boolean variables, which can only be in one of the two states
7260 .Dq set
7262 .Dq unset ,
7263 and value variables with a(n optional) string value.
7264 For the latter proper quoting is necessary upon assignment time, the
7265 introduction of the section
7266 .Sx COMMANDS
7267 documents the supported quoting rules.
7269 .Bd -literal -offset indent
7270 wysh set one=val\e 1 two="val 2" \e
7271     three='val "3"' four=$'val \e'4\e''; \e
7272 varshow one two three four; \e
7273 unset one two three four
7277 Dependent upon the actual option the string values will be interpreted
7278 as numbers, colour names, normal text etc., but there also exists
7279 a special kind of string value, the
7280 .Dq boolean string ,
7281 which must either be a decimal integer (in which case
7282 .Ql 0
7283 is false and
7284 .Ql 1
7285 and any other value is true) or any of the (case-insensitive) strings
7286 .Ql off ,
7287 .Ql no ,
7288 .Ql n
7290 .Ql false
7291 for a false boolean and
7292 .Ql on ,
7293 .Ql yes ,
7294 .Ql y
7296 .Ql true
7297 for a true boolean; a special kind of boolean string is the
7298 .Dq quadoption ,
7299 which is a boolean string that can optionally be prefixed with the
7300 (case-insensitive) term
7301 .Ql ask- ,
7302 as in
7303 .Ql ask-yes ,
7304 which causes prompting of the user in interactive mode, with the given
7305 boolean as the default value.
7307 .\" .Ss "Initial settings" {{{
7308 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7309 .Ss "Initial settings"
7311 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7312 variable settings:
7313 .Pf no Va allnet ,
7314 .Pf no Va append ,
7315 .Va asksub ,
7316 .Pf no Va askbcc ,
7317 .Pf no Va autoprint ,
7318 .Pf no Va bang ,
7319 .Pf no Va cmd ,
7320 .Pf no Va crt ,
7321 .Pf no Va debug ,
7322 .Pf no Va dot ,
7323 .Va escape
7324 set to
7325 .Ql ~ ,
7326 .Pf no Va flipr ,
7327 .Pf no Va folder ,
7328 .Va header ,
7329 .Pf no Va hold ,
7330 .Pf no Va ignore ,
7331 .Pf no Va ignoreeof ,
7332 .Pf no Va keep ,
7333 .Pf no Va keepsave ,
7334 .Pf no Va metoo ,
7335 .Pf no Va outfolder ,
7336 .Pf no Va page ,
7337 .Va prompt
7338 set to
7339 .Ql ?\0 ,
7340 .Pf no Va quiet ,
7341 .Pf no Va record ,
7342 .Va save ,
7343 .Pf no Va sendwait ,
7344 .Pf no Va showto ,
7345 .Pf no Va Sign ,
7346 .Pf no Va sign ,
7347 .Va toplines
7348 set to
7349 .Ql 5 .
7352 Notes: \*(UA does not support the
7353 .Pf no Va onehop
7354 variable \(en use command line options or
7355 .Va mta-arguments
7356 to pass options through to a
7357 .Va mta .
7358 And the default global
7359 .Pa \*(UR
7360 file, which is loaded unless the
7361 .Fl \&:
7362 (with according argument) or
7363 .Fl n
7364 command line options have been used, or the
7365 .Ev MAILX_NO_SYSTEM_RC
7366 environment variable is set (see
7367 .Sx "Resource files" )
7368 bends those initial settings a bit, e.g., it sets the variables
7369 .Va hold ,
7370 .Va keepsave
7372 .Va keep ,
7373 to name a few, establishes a default
7374 .Ic headerpick
7375 selection etc., and should thus be taken into account.
7376 .\" }}}
7378 .\" .Ss "Variables" {{{
7379 .Ss "Variables"
7381 .Bl -tag -width ".It Va BaNg"
7384 .It Va \&?
7385 \*(RO The exit status of the last command, or the
7386 .Ic return
7387 value of the macro
7388 .Ic call Ns
7389 ed last.
7390 This status has a meaning in the state machine: in conjunction with
7391 .Va errexit
7392 any non-0 exit status will cause a program exit, and in
7393 .Ev POSIXLY_CORRECT
7394 mode any error while loading (any of the) resource files will have the
7395 same effect.
7396 .Cm ignerr ,
7397 one of the
7398 .Sx "Command modifiers" ,
7399 can be used to instruct the state machine to ignore errors.
7402 .It Va \&!
7403 \*(RO The current error number
7404 .Pf ( Xr errno 3 ) ,
7405 which is set after an error occurred; it is also available via
7406 .Va ^ERR ,
7407 and the error name and documentation string can be queried via
7408 .Va ^ERRNAME
7410 .Va ^ERRDOC .
7411 \*(ID This machinery is new and the error number is only really usable
7412 if a command explicitly states that it manages the variable
7413 .Va \&! ,
7414 for others errno will be used in case of errors, or
7415 .Va ^ERR Ns -INVAL
7416 if that is 0: it thus may or may not reflect the real error.
7417 The error number may be set with the command
7418 .Ic return .
7422 .It Va ^
7423 \*(RO This is a multiplexer variable which performs dynamic expansion of
7424 the requested state or condition, of which there are:
7427 .Bl -tag -compact -width ".It Va BaNg"
7431 .It Va ^ERR , ^ERRDOC , ^ERRNAME
7432 The number, documentation, and name of the current
7433 .Xr errno 3 ,
7434 respectively, which is usually set after an error occurred.
7435 \*(ID This machinery is new and is usually reliable only if a command
7436 explicitly states that it manages the variable
7437 .Va \&! ,
7438 which is effectively identical to
7439 .Va \&\&^ERR .
7440 Each of those variables can be suffixed with a hyphen minus followed by
7441 a name or number, in which case the expansion refers to the given error.
7442 Note this is a direct mapping of (a subset of) the system error values:
7443 .Bd -literal -offset indent
7444 define work {
7445   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
7446   vput vexpr i + "$1" 1
7447   if [ $i -lt 16 ]
7448     \excall work $i
7449   end
7451 call work 0
7457 .It Va *
7458 \*(RO Expands all positional parameters (see
7459 .Va 1 ) ,
7460 separated by a space character.
7461 \*(ID The special semantics of the equally named special parameter of the
7462 .Xr sh 1
7463 are not yet supported.
7466 .It Va @
7467 \*(RO Expands all positional parameters (see
7468 .Va 1 ) ,
7469 separated by a space character.
7470 If placed in double quotation marks, each positional parameter is
7471 properly quoted to expand to a single parameter again.
7474 .It Va #
7475 \*(RO Expands to the number of positional parameters in decimal.
7478 .It Va \&0
7479 \*(RO Inside the scope of a
7480 .Ic define Ns
7481 d and
7482 .Ic call Ns
7483 ed macro this expands to the name of the calling macro, or to the empty
7484 string if the macro is running from top-level.
7485 For the \*(OPal regular expression search and replace operator of
7486 .Ic vexpr
7487 this expands to the entire matching expression.
7488 It represents the program name in global context.
7491 .It Va 1
7492 \*(RO Access of the positional parameter stack.
7493 All further parameters can be accessed with this syntax, too, e.g.,
7494 .Ql 2 ,
7495 .Ql 3
7496 etc.; positional parameters can be shifted off the stack by calling
7497 .Ic shift .
7498 The parameter stack contains, e.g., the arguments of a
7499 .Ic call Ns
7501 .Ic define Ns
7502 d macro, the matching groups of the \*(OPal regular expression search
7503 and replace expression of
7504 .Ic vexpr ,
7505 and can be explicitly created or overwritten with the command
7506 .Ic vpospar .
7509 .It Va account
7510 \*(RO Is set to the active
7511 .Ic account .
7514 .It Va add-file-recipients
7515 \*(BO When file or pipe recipients have been specified,
7516 mention them in the corresponding address fields of the message instead
7517 of silently stripping them from their recipient list.
7518 By default such addressees are not mentioned.
7521 .It Va allnet
7522 \*(BO Causes only the local part to be evaluated
7523 when comparing addresses.
7526 .It Va alternates
7527 \*(RO Is set to the list of
7528 .Ic alternates .
7531 .It Va append
7532 \*(BO Causes messages saved in the
7533 .Mx -sx
7534 .Sx "secondary mailbox"
7535 .Ev MBOX
7536 to be appended to the end rather than prepended.
7537 This should always be set.
7540 .It Va ask
7541 \*(BO Causes \*(UA to prompt for the subject of each message sent.
7542 If the user responds with simply a newline,
7543 no subject field will be sent.
7546 .It Va askatend
7547 \*(BO Causes the prompts for
7548 .Ql Cc:
7550 .Ql Bcc:
7551 lists to appear after the message has been edited.
7554 .It Va askattach
7555 \*(BO If set, \*(UA asks for files to attach at the end of each message,
7556 shall the list be found empty at that time.
7557 An empty line finalizes the list.
7560 .It Va askcc
7561 \*(BO Causes the user to be prompted for carbon copy recipients
7562 (at the end of each message if
7563 .Va askatend
7565 .Va bsdcompat
7566 are set) shall the list be found empty (at that time).
7567 An empty line finalizes the list.
7570 .It Va askbcc
7571 \*(BO Causes the user to be prompted for blind carbon copy
7572 recipients (at the end of each message if
7573 .Va askatend
7575 .Va bsdcompat
7576 are set) shall the list be found empty (at that time).
7577 An empty line finalizes the list.
7580 .It Va asksign
7581 \*(BO\*(OP Causes the user to be prompted if the message is to be
7582 signed at the end of each message.
7584 .Va smime-sign
7585 variable is ignored when this variable is set.
7588 .It Va asksub
7589 \*(BO Alternative name for
7590 .Va ask .
7593 .It Va attrlist
7594 A sequence of characters to display in the
7595 .Ql attribute
7596 column of the
7597 .Va headline
7598 as shown in the display of
7599 .Ic headers ;
7600 each for one type of messages (see
7601 .Sx "Message states" ) ,
7602 with the default being
7603 .Ql NUROSPMFAT+\-$~
7605 .Ql NU\ \ *HMFAT+\-$~
7606 if the
7607 .Va bsdflags
7608 variable is set, in the following order:
7610 .Bl -tag -compact -width ".It Ql _"
7611 .It Ql N
7612 new.
7613 .It Ql U
7614 unread but old.
7615 .It Ql R
7616 new but read.
7617 .It Ql O
7618 read and old.
7619 .It Ql S
7620 saved.
7621 .It Ql P
7622 preserved.
7623 .It Ql M
7624 mboxed.
7625 .It Ql F
7626 flagged.
7627 .It Ql A
7628 answered.
7629 .It Ql T
7630 draft.
7631 .It Ql +
7632 start of a collapsed thread.
7633 .It Ql -
7634 an uncollapsed thread (TODO ignored for now).
7635 .It Ql $
7636 classified as spam.
7637 .It Ql ~
7638 classified as possible spam.
7643 .It Va autobcc
7644 Specifies a list of recipients to which a blind carbon copy of each
7645 outgoing message will be sent automatically.
7648 .It Va autocc
7649 Specifies a list of recipients to which a carbon copy of each outgoing
7650 message will be sent automatically.
7653 .It Va autocollapse
7654 \*(BO Causes threads to be collapsed automatically when threaded mode
7655 is entered (see the
7656 .Ic collapse
7657 command).
7660 .It Va autoprint
7661 \*(BO Enable automatic
7662 .Ic type Ns
7663 ing of a(n existing)
7664 .Dq successive
7665 message after
7666 .Ic delete
7668 .Ic undelete
7669 commands, e.g., the message that becomes the new
7670 .Dq dot
7671 is shown automatically, as via
7672 .Ic dp
7674 .Ic dt .
7676 .It Va autothread
7677 \*(BO\*(OB Causes threaded mode (see the
7678 .Ic thread
7679 command) to be entered automatically when a folder is opened.
7680 The same as
7681 .Ql autosort=thread .
7684 .It Va autosort
7685 Causes sorted mode (see the
7686 .Ic sort
7687 command) to be entered automatically with the value of this variable as
7688 sorting method when a folder is opened, e.g.,
7689 .Ql set autosort=thread .
7692 .It Va bang
7693 \*(BO Enables the substitution of all not (reverse-solidus) escaped
7694 exclamation mark
7695 .Ql \&!
7696 characters by the contents of the last executed command for the
7697 .Ic \&!
7698 shell escape command and
7699 .Ic ~! ,
7700 one of the compose mode
7701 .Sx "COMMAND ESCAPES" .
7702 If this variable is not set no reverse solidus stripping is performed.
7704 .It Va batch-exit-on-error
7705 \*(OB\*(BO Predecessor of
7706 .Va errexit .
7709 .It Va bind-timeout
7710 \*(OP Terminals generate multi-byte sequences for certain forms of
7711 input, for example for function and other special keys.
7712 Some terminals however do not write these multi-byte sequences as
7713 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
7714 This variable specifies the timeout in milliseconds that the MLE (see
7715 .Sx "On terminal control and line editor" )
7716 waits for more bytes to arrive unless it considers a sequence
7717 .Dq complete .
7718 The default is 200.
7721 .It Va bsdcompat
7722 \*(BO Sets some cosmetical features to traditional BSD style;
7723 has the same affect as setting
7724 .Va askatend
7725 and all other variables prefixed with
7726 .Ql bsd ;
7727 it also changes the behaviour of
7728 .Va emptystart
7729 (which does not exist in BSD).
7732 .It Va bsdflags
7733 \*(BO Changes the letters shown in the first column of a header
7734 summary to traditional BSD style.
7737 .It Va bsdheadline
7738 \*(BO Changes the display of columns in a header summary to traditional
7739 BSD style.
7742 .It Va bsdmsgs
7743 \*(BO Changes some informational messages to traditional BSD style.
7746 .It Va bsdorder
7747 \*(BO Causes the
7748 .Ql Subject:
7749 field to appear immediately after the
7750 .Ql To:
7751 field in message headers and with the
7752 .Ic ~h
7753 .Sx "COMMAND ESCAPES" .
7757 .It Va build-os , build-osenv
7758 \*(RO The operating system \*(UA has been build for, usually taken from
7759 .Xr uname 1
7761 .Ql uname -s
7763 .Ql uname -srm ,
7764 respectively, the former being lowercased.
7767 .It Va charset-7bit
7768 The value that should appear in the
7769 .Ql charset=
7770 parameter of
7771 .Ql Content-Type:
7772 MIME header fields when no character set conversion of the message data
7773 was performed.
7774 This defaults to US-ASCII, and the chosen character set should be
7775 US-ASCII compatible.
7778 .It Va charset-8bit
7779 \*(OP The default 8-bit character set that is used as an implicit last
7780 member of the variable
7781 .Va sendcharsets .
7782 This defaults to UTF-8 if character set conversion capabilities are
7783 available, and to ISO-8859-1 otherwise, in which case the only supported
7784 character set is
7785 .Va ttycharset
7786 and this variable is effectively ignored.
7787 Refer to the section
7788 .Sx "Character sets"
7789 for the complete picture of character set conversion in \*(UA.
7792 .It Va charset-unknown-8bit
7793 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
7794 .Dq upgrade
7795 the content of a mail message by using a character set with the name
7796 .Ql unknown-8bit .
7797 Because of the unclassified nature of this character set \*(UA will not
7798 be capable to convert this character set to any other character set.
7799 If this variable is set any message part which uses the character set
7800 .Ql unknown-8bit
7801 is assumed to really be in the character set given in the value,
7802 otherwise the (final) value of
7803 .Va charset-8bit
7804 is used for this purpose.
7806 This variable will also be taken into account if a MIME type (see
7807 .Sx "The mime.types files" )
7808 of a MIME message part that uses the
7809 .Ql binary
7810 character set is forcefully treated as text.
7813 .It Va cmd
7814 The default value for the
7815 .Ic pipe
7816 command.
7819 .It Va colour-disable
7820 \*(BO\*(OP Forcefully disable usage of colours.
7821 Also see the section
7822 .Sx "Coloured display" .
7825 .It Va colour-pager
7826 \*(BO\*(OP Whether colour shall be used for output that is paged through
7827 .Ev PAGER .
7828 Note that pagers may need special command line options, e.g.,
7829 .Xr less 1
7830 requires the option
7831 .Fl \&\&R
7833 .Xr lv 1
7834 the option
7835 .Fl \&\&c
7836 in order to support colours.
7837 Often doing manual adjustments is unnecessary since \*(UA may perform
7838 adjustments dependent on the value of the environment variable
7839 .Ev PAGER
7840 (see there for more).
7844 .It Va contact-mail , contact-web
7845 \*(RO Addresses for contact per email and web, respectively, e.g., for
7846 bug reports, suggestions, or help regarding \*(UA.
7847 The former can be used directly:
7848 .Ql ? eval mail $contact-mail .
7851 .It Va crt
7852 In a(n interactive) terminal session, then if this valued variable is
7853 set it will be used as a threshold to determine how many lines the given
7854 output has to span before it will be displayed via the configured
7855 .Ev PAGER ;
7856 Usage of the
7857 .Ev PAGER
7858 can be forced by setting this to the value
7859 .Ql 0 ,
7860 setting it without a value will deduce the current height of the
7861 terminal screen to compute the treshold (see
7862 .Ev LINES ,
7863 .Va screen
7865 .Xr stty 1 ) .
7866 \*(ID At the moment this uses the count of lines of the message in wire
7867 format, which, dependent on the
7868 .Va mime-encoding
7869 of the message, is unrelated to the number of display lines.
7870 (The software is old and historically the relation was a given thing.)
7873 .It Va customhdr
7874 Define a set of custom headers to be injected into newly composed or
7875 forwarded messages; it is also possible to create custom headers in
7876 compose mode with
7877 .Ic ~^ ,
7878 which can be automated by setting one of the hooks
7879 .Va on-compose-splice
7881 .Va on-compose-splice-shell .
7882 The value is interpreted as a comma-separated list of custom headers to
7883 be injected, to include commas in the header bodies escape them with
7884 reverse solidus.
7885 \*(ID Overwriting of automatically managed headers is neither supported
7886 nor prevented.
7888 .Dl set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
7891 .It Va datefield
7892 Controls the appearance of the
7893 .Ql %d
7894 date and time format specification of the
7895 .Va headline
7896 variable, that is used, for example, when viewing the summary of
7897 .Ic headers .
7898 If unset, then the local receiving date is used and displayed
7899 unformatted, otherwise the message sending
7900 .Ql Date: .
7901 It is possible to assign a
7902 .Xr strftime 3
7903 format string and control formatting, but embedding newlines via the
7904 .Ql %n
7905 format is not supported, and will result in display errors.
7906 The default is
7907 .Ql %Y-%m-%d %H:%M ,
7908 and also see
7909 .Va datefield-markout-older .
7912 .It Va datefield-markout-older
7913 Only used in conjunction with
7914 .Va datefield .
7915 Can be used to create a visible distinction of messages dated more than
7916 a day in the future, or older than six months, a concept comparable to the
7917 .Fl \&\&l
7918 option of the POSIX utility
7919 .Xr ls 1 .
7920 If set to the empty string, then the plain month, day and year of the
7921 .Ql Date:
7922 will be displayed, but a
7923 .Xr strftime 3
7924 format string to control formatting can be assigned.
7925 The default is
7926 .Ql %Y-%m-%d .
7929 .It Va debug
7930 \*(BO Enables debug messages and obsoletion warnings, disables the
7931 actual delivery of messages and also implies
7932 .Pf no Va record
7933 as well as
7934 .Pf no Va save .
7937 .It Va disposition-notification-send
7938 \*(BO\*(OP Emit a
7939 .Ql Disposition-Notification-To:
7940 header (RFC 3798) with the message.
7941 This requires the
7942 .Va from
7943 variable to be set.
7944 .\" TODO .It Va disposition-notification-send-HOST
7945 .\"Overrides
7946 .\".Va disposition-notification-send
7947 .\" for SMTP accounts on a specific host.
7948 .\" TODO .It Va disposition-notification-send-USER@HOST
7949 .\"Overrides
7950 .\".Va disposition-notification-send
7951 .\"for a specific account.
7954 .It Va dot
7955 \*(BO When dot is set, a period
7956 .Ql \&.
7957 on a line by itself during message input in (interactive or batch
7958 .Fl # )
7959 compose mode will be treated as end-of-message (in addition to the
7960 normal end-of-file condition).
7961 This behaviour is implied in
7962 .Va posix
7963 mode with a set
7964 .Va ignoreeof .
7967 .It Va dotlock-ignore-error
7968 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
7969 .Mx -sx
7970 .Sx "primary system mailbox" Ns
7971 es (see, e.g., the notes on
7972 .Sx "Filename transformations" ,
7973 as well as the documentation of
7974 .Ic file )
7975 will be protected with so-called dotlock files\(emthe traditional mail
7976 spool file locking method\(emin addition to system file locking.
7977 Because \*(UA ships with a privilege-separated dotlock creation program
7978 that should always be able to create such a dotlock file there is no
7979 good reason to ignore dotlock file creation errors, and thus these are
7980 fatal unless this variable is set.
7983 .It Va editalong
7984 \*(BO If this variable is set then the editor is started automatically
7985 when a message is composed in interactive mode, as if the
7986 .Ic ~e
7987 .Sx "COMMAND ESCAPES"
7988 had been specified.
7990 .Va editheaders
7991 variable is implied for this automatically spawned editor session.
7994 .It Va editheaders
7995 \*(BO When a message is edited while being composed,
7996 its header is included in the editable text.
7998 .Ql To: ,
7999 .Ql Cc: ,
8000 .Ql Bcc: ,
8001 .Ql Subject: ,
8002 .Ql From: ,
8003 .Ql Reply-To:
8005 .Ql Sender:
8006 fields are accepted within the header, other fields are ignored.
8009 .It Va emptystart
8010 \*(BO When entering interactive mode \*(UA normally writes
8011 .Dq \&No mail for user
8012 and exits immediately if a mailbox is empty or does not exist.
8013 If this variable is set \*(UA starts even with an empty or non-existent
8014 mailbox (the latter behaviour furtherly depends upon
8015 .Va bsdcompat ,
8016 though).
8019 .It Va errexit
8020 \*(BO Let each command with a non-0 exit status, including every
8021 .Ic call Ns
8022 ed macro which
8023 .Ic return Ns
8024 s a non-0 status, cause a program exit unless prefixed by
8025 .Cm ignerr
8026 (see
8027 .Sx "Command modifiers" ) ;
8028 please refer to the variable
8029 .Va \&?
8030 for more on this topic.
8033 .It Va escape
8034 The first character of this value defines the escape character for
8035 .Sx "COMMAND ESCAPES"
8036 in compose mode.
8037 The default value is the character tilde
8038 .Ql ~ .
8039 If set to the empty string, command escapes are disabled.
8042 .It Va expandaddr
8043 If not set then file and command pipeline targets are not allowed,
8044 and any such address will be filtered out, giving a warning message.
8045 If set without a value then all possible recipient address
8046 specifications will be accepted \(en see the section
8047 .Sx "On sending mail, and non-interactive mode"
8048 for more on this.
8049 To accept them, but only in interactive mode, or when tilde commands
8050 were enabled explicitly by using one of the command line options
8051 .Fl ~
8053 .Fl # ,
8054 set this to the (case-insensitive) value
8055 .Ql restrict
8056 (it actually acts like
8057 .Ql restrict,-all,+name,+addr ,
8058 so that care for ordering issues must be taken) .
8060 In fact the value is interpreted as a comma-separated list of values.
8061 If it contains
8062 .Ql fail
8063 then the existence of disallowed specifications is treated as a hard
8064 send error instead of only filtering them out.
8065 The remaining values specify whether a specific type of recipient
8066 address specification is allowed (optionally indicated by a plus sign
8067 .Ql +
8068 prefix) or disallowed (prefixed with a hyphen-minus
8069 .Ql - ) .
8070 The value
8071 .Ql all
8072 addresses all possible address specifications,
8073 .Ql file
8074 file targets,
8075 .Ql pipe
8076 command pipeline targets,
8077 .Ql name
8078 plain user names and (MTA) aliases (\*(OB
8079 .Ql noalias
8080 may be used as an alternative syntax to
8081 .Ql -name )
8083 .Ql addr
8084 network addresses.
8085 These kind of values are interpreted in the given order, so that
8086 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8087 will cause hard errors for any non-network address recipient address
8088 unless \*(UA is in interactive mode or has been started with the
8089 .Fl ~
8091 .Fl #
8092 command line option; in the latter case(s) any address may be used, then.
8094 Historically invalid network addressees are silently stripped off.
8095 To change this and ensure that any encountered invalid email address
8096 instead causes a hard error, ensure the string
8097 .Ql failinvaddr
8098 is an entry in the above list.
8099 Setting this automatically enables network addressees
8100 (it actually acts like
8101 .Ql failinvaddr,+addr ,
8102 so that care for ordering issues must be taken) .
8105 .It Va expandargv
8106 Unless this variable is set additional
8107 .Va mta
8108 (Mail-Transfer-Agent)
8109 arguments from the command line, as can be given after a
8110 .Fl \&\&-
8111 separator, are ignored due to safety reasons.
8112 However, if set to the special (case-insensitive) value
8113 .Ql fail ,
8114 then the presence of additional MTA arguments is treated as a hard
8115 error that causes \*(UA to exit with failure status.
8116 A lesser strict variant is the otherwise identical
8117 .Ql restrict ,
8118 which does accept such arguments in interactive mode, or if tilde
8119 commands were enabled explicitly by using one of the command line options
8120 .Fl ~
8122 .Fl # .
8125 .It Va features
8126 \*(RO String giving a list of features \*(UA, preceded with a plus sign
8127 .Ql +
8128 if the feature is available, and a hyphen-minus
8129 .Ql -
8130 otherwise.
8131 The output of the command
8132 .Ic version
8133 will include this information.
8136 .It Va flipr
8137 \*(BO This setting reverses the meanings of a set of reply commands,
8138 turning the lowercase variants, which by default address all recipients
8139 included in the header of a message
8140 .Pf ( Ic reply , respond , followup )
8141 into the uppercase variants, which by default address the sender only
8142 .Pf ( Ic Reply , Respond , Followup )
8143 and vice versa.
8144 The commands
8145 .Ic replysender , respondsender , followupsender
8146 as well as
8147 .Ic replyall , respondall , followupall
8148 are not affected by the current setting of
8149 .Va flipr .
8152 .It Va folder
8153 The default path under which mailboxes are to be saved:
8154 filenames that begin with the plus sign
8155 .Ql +
8156 will have the plus sign replaced with the value of this variable if set,
8157 otherwise the plus sign will remain unchanged when doing
8158 .Sx "Filename transformations" ;
8159 also see
8160 .Ic file
8161 for more on this topic.
8162 The value supports a subset of transformations itself, and if the
8163 non-empty value does not start with a solidus
8164 .Ql / ,
8165 then the value of
8166 .Ev HOME
8167 will be prefixed automatically.
8168 Once the actual value is evaluated first, the internal variable
8169 .Va folder-resolved
8170 will be updated for caching purposes.
8173 .It Va folder-hook
8174 This variable can be set to the name of a
8175 .Ic define Ns d
8176 macro which will be called whenever a
8177 .Ic file
8178 is opened.
8179 The macro will also be invoked when new mail arrives,
8180 but message lists for commands executed from the macro
8181 only include newly arrived messages then.
8182 .Ic localopts
8183 are activated by default in a folder hook, causing the covered settings
8184 to be reverted once the folder is left again.
8186 .Sy \*(ID:
8187 Macro behaviour, including option localization, will change in v15.
8188 One should be aware of that and possibly embed version checks in the
8189 used resource file(s).
8192 .It Va folder-hook-FOLDER
8193 Overrides
8194 .Va folder-hook
8195 for a folder named
8196 .Ql FOLDER .
8197 Unlike other folder specifications, the fully expanded name of a folder,
8198 without metacharacters, is used to avoid ambiguities.
8199 However, if the mailbox resides under
8200 .Va folder
8201 then the usual
8202 .Ql +
8203 specification is tried in addition, e.g., if
8204 .Va \&\&folder
8206 .Dq mail
8207 (and thus relative to the user's home directory) then
8208 .Pa /home/usr1/mail/sent
8209 will be tried as
8210 .Ql folder-hook-/home/usr1/mail/sent
8211 first, but then followed by
8212 .Ql folder-hook-+sent .
8215 .It Va folder-resolved
8216 \*(RO Set to the fully resolved path of
8217 .Va folder
8218 once that evaluation has occurred; rather internal.
8221 .It Va followup-to
8222 \*(BO Controls whether a
8223 .Ql Mail-Followup-To:
8224 header is generated when sending messages to known mailing lists.
8225 Also see
8226 .Va followup-to-honour
8227 and the commands
8228 .Ic mlist , mlsubscribe , reply
8230 .Ic Lreply .
8233 .It Va followup-to-honour
8234 Controls whether a
8235 .Ql Mail-Followup-To:
8236 header is honoured when group-replying to a message via
8237 .Ic reply
8239 .Ic Lreply .
8240 This is a quadoption; if set without a value it defaults to
8241 .Dq yes .
8242 Also see
8243 .Va followup-to
8244 and the commands
8245 .Ic mlist
8247 .Ic mlsubscribe .
8250 .It Va forward-as-attachment
8251 \*(BO Original messages are normally sent as inline text with the
8252 .Ic forward
8253 command,
8254 and only the first part of a multipart message is included.
8255 With this setting enabled messages are sent as unmodified MIME
8256 .Ql message/rfc822
8257 attachments with all of their parts included.
8260 .It Va forward-inject-head
8261 The string to put before the text of a message with the
8262 .Ic forward
8263 command instead of the default
8264 .Dq -------- Original Message -------- .
8265 No heading is put if it is set to the empty string.
8266 This variable is ignored if the
8267 .Va forward-as-attachment
8268 variable is set.
8271 .It Va from
8272 The address (or a list of addresses) to put into the
8273 .Ql From:
8274 field of the message header, quoting RFC 5322:
8275 the author(s) of the message, that is, the mailbox(es) of the person(s)
8276 or system(s) responsible for the writing of the message.
8277 When
8278 .Ic reply Ns
8279 ing to messages these addresses are handled as if they were in the
8280 .Ic alternates
8281 list.
8283 If the machine's hostname is not valid at the Internet (for example at
8284 a dialup machine) then either this variable or
8285 .Va hostname
8286 (\*(IN and with a defined SMTP protocol in
8287 .Va mta
8288 .Va smtp-hostname
8289 adds even more fine-tuning capabilities),
8290 have to be set.
8292 .Va \&\&from
8293 contains more than one address,
8294 setting the
8295 .Va sender
8296 variable is required (according to the standard RFC 5322).
8298 If a file-based MTA is used, then
8299 .Va from
8300 (or, if that contains multiple addresses,
8301 .Va sender )
8302 can nonetheless be enforced to appear as the envelope sender address at
8303 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8304 .Fl r
8305 command line option (with an empty argument; see there for the complete
8306 picture on this topic), or by setting the internal variable
8307 .Va r-option-implicit .
8310 .It Va fullnames
8311 \*(BO When replying to or forwarding a message \*(UA normally removes
8312 the comment and name parts of email addresses.
8313 If this variable is set such stripping is not performed,
8314 and comments, names etc. are retained.
8316 .It Va fwdheading
8317 \*(OB Predecessor of
8318 .Va forward-inject-head .
8321 .It Va header
8322 \*(BO Causes the header summary to be written at startup and after
8323 commands that affect the number of messages or the order of messages in
8324 the current
8325 .Ic folder .
8326 Unless in
8327 .Ev POSIXLY_CORRECT
8328 mode a header summary will also be displayed on folder changes.
8329 The command line option
8330 .Fl N
8331 can be used to set
8332 .Pf no Va header .
8336 .It Va headline
8337 A format string to use for the summary of
8338 .Ic headers ,
8339 similar to the ones used for
8340 .Xr printf 3
8341 formats.
8342 Format specifiers in the given string start with a percent sign
8343 .Ql %
8344 and may be followed by an optional decimal number indicating the field
8345 width \(em if that is negative, the field is to be left-aligned.
8346 Valid format specifiers are:
8349 .Bl -tag -compact -width ".It Ql _%%_"
8350 .It Ql %%
8351 A plain percent sign.
8352 .It Ql %>
8353 .Dq Dotmark :
8354 a space character but for the current message
8355 .Pf ( Dq dot ) ,
8356 for which it expands to
8357 .Ql > .
8358 .It Ql %<
8359 .Dq Dotmark :
8360 a space character but for the current message
8361 .Pf ( Dq dot ) ,
8362 for which it expands to
8363 .Ql < .
8364 .It Ql %$
8365 \*(OP The spam score of the message, as has been classified via the
8366 command
8367 .Ic spamrate .
8368 Shows only a replacement character if there is no spam support.
8369 .It Ql %a
8370 Message attribute character (status flag); the actual content can be
8371 adjusted by setting
8372 .Va attrlist .
8373 .It Ql %d
8374 The date found in the
8375 .Ql From:
8376 header of the message when
8377 .Va datefield
8378 is set (the default), otherwise the date when the message was received.
8379 Formatting can be controlled by assigning a
8380 .Xr strftime 3
8381 format string to
8382 .Va datefield .
8383 .It Ql %e
8384 The indenting level in threaded mode.
8385 .It Ql %f
8386 The address of the message sender.
8387 .It Ql %i
8388 The message thread tree structure.
8389 (Note that this format does not support a field width.)
8390 .It Ql %l
8391 The number of lines of the message, if available.
8392 .It Ql %m
8393 Message number.
8394 .It Ql %o
8395 The number of octets (bytes) in the message, if available.
8396 .It Ql %s
8397 Message subject (if any).
8398 .It Ql %S
8399 Message subject (if any) in double quotes.
8400 .It Ql \&%T
8401 Message recipient flags: is the addressee of the message a known or
8402 subscribed mailing list \(en see
8403 .Ic mlist
8405 .Ic mlsubscribe .
8406 .It Ql %t
8407 The position in threaded/sorted order.
8410 The default is
8411 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
8413 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
8415 .Va bsdcompat
8416 is set.
8417 Also see
8418 .Va attrlist
8420 .Va headline-bidi .
8424 .It Va headline-bidi
8425 Bidirectional text requires special treatment when displaying headers,
8426 because numbers (in dates or for file sizes etc.) will not affect the
8427 current text direction, in effect resulting in ugly line layouts when
8428 arabic or other right-to-left text is to be displayed.
8429 On the other hand only a minority of terminals is capable to correctly
8430 handle direction changes, so that user interaction is necessary for
8431 acceptable results.
8432 Note that extended host system support is required nonetheless, e.g.,
8433 detection of the terminal character set is one precondition;
8434 and this feature only works in an Unicode (i.e., UTF-8) locale.
8436 In general setting this variable will cause \*(UA to encapsulate text
8437 fields that may occur when displaying
8438 .Va headline
8439 (and some other fields, like dynamic expansions in
8440 .Va prompt )
8441 with special Unicode control sequences;
8442 it is possible to fine-tune the terminal support level by assigning
8443 a value:
8444 no value (or any value other than
8445 .Ql 1 ,
8446 .Ql 2
8448 .Ql 3 )
8449 will make \*(UA assume that the terminal is capable to properly deal
8450 with Unicode version 6.3, in which case text is embedded in a pair of
8451 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
8452 characters.
8453 In addition no space on the line is reserved for these characters.
8455 Weaker support is chosen by using the value
8456 .Ql 1
8457 (Unicode 6.3, but reserve the room of two spaces for writing the control
8458 sequences onto the line).
8459 The values
8460 .Ql 2
8462 .Ql 3
8463 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
8464 again reserves room for two spaces in addition.
8467 .It Va history-file
8468 \*(OP If a line editor is available then this can be set to
8469 name the (expandable) path of the location of a permanent history file.
8470 Also see
8471 .Va history-size .
8474 .It Va history-gabby
8475 \*(BO\*(OP Add more entries to the history as is normally done.
8478 .It Va history-gabby-persist
8479 \*(BO\*(OP \*(UA's own MLE will not save the additional
8480 .Va history-gabby
8481 entries in persistent storage unless this variable is set.
8482 On the other hand it will not loose the knowledge of whether
8483 a persistent entry was gabby or not.
8484 Also see
8485 .Va history-file .
8488 .It Va history-size
8489 \*(OP Setting this variable imposes a limit on the number of concurrent
8490 history entries.
8491 If set to the value 0 then no further history entries will be added, and
8492 loading and incorporation of the
8493 .Va history-file
8494 upon program startup can also be suppressed by doing this.
8495 Runtime changes will not be reflected, but will affect the number of
8496 entries saved to permanent storage.
8499 .It Va hold
8500 \*(BO This setting controls whether messages are held in the system
8501 .Va inbox ,
8502 and it is set by default.
8505 .It Va hostname
8506 Use this string as hostname when expanding local addresses instead of
8507 the value obtained from
8508 .Xr uname 3
8510 .Xr getaddrinfo 3 .
8511 It is used, e.g., in
8512 .Ql Message-ID:
8514 .Ql From:
8515 fields, as well as when generating
8516 .Ql Content-ID:
8517 MIME part related unique ID fields.
8518 Setting it to the empty string will cause the normal hostname to be
8519 used, but nonetheless enables creation of said ID fields.
8520 \*(IN in conjunction with the built-in SMTP
8521 .Va mta
8522 .Va smtp-hostname
8523 also influences the results:
8524 one should produce some test messages with the desired combination of
8525 .Va \&\&hostname ,
8526 and/or
8527 .Va from ,
8528 .Va sender
8529 etc. first.
8532 .It Va idna-disable
8533 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
8534 names according to the rules of IDNA (internationalized domain names
8535 for applications).
8536 Since the IDNA code assumes that domain names are specified with the
8537 .Va ttycharset
8538 character set, an UTF-8 locale charset is required to represent all
8539 possible international domain names (before conversion, that is).
8542 .It Va ifs
8543 The input field separator that is used (\*(ID by some functions) to
8544 determine where to split input data.
8546 .Bl -tag -compact -width ".It MMM"
8547 .It 1.
8548 Unsetting is treated as assigning the default value,
8549 .Ql \& \et\en .
8550 .It 2.
8551 If set to the empty value, no field splitting will be performed.
8552 .It 3.
8553 If set to a non-empty value, all whitespace characters are extracted
8554 and assigned to the variable
8555 .Va ifs-ws .
8558 .Bl -tag -compact -width ".It MMM"
8559 .It a.
8560 .Va \&\&ifs-ws
8561 will be ignored at the beginning and end of input.
8562 Diverging from POSIX shells default whitespace is removed in addition,
8563 which is owed to the entirely different line content extraction rules.
8564 .It b.
8565 Each occurrence of a character of
8566 .Va \&\&ifs
8567 will cause field-splitting, any adjacent
8568 .Va \&\&ifs-ws
8569 characters will be skipped.
8573 .It Va ifs-ws
8574 \*(RO Automatically deduced from the whitespace characters in
8575 .Va ifs .
8578 .It Va ignore
8579 \*(BO Ignore interrupt signals from the terminal while entering
8580 messages; instead echo them as
8581 .Ql @
8582 characters and discard the current line.
8585 .It Va ignoreeof
8586 \*(BO Ignore end-of-file conditions
8587 .Pf ( Ql control-D )
8588 in compose mode on message input and in interactive command input.
8589 If set an interactive command input session can only be left by
8590 explicitly using one of the commands
8591 .Ic exit
8593 .Ic quit ,
8594 and message input in compose mode can only be terminated by entering
8595 a period
8596 .Ql \&.
8597 on a line by itself or by using the
8598 .Ic ~.
8599 .Sx "COMMAND ESCAPES" ;
8600 Setting this implies the behaviour that
8601 .Va dot
8602 describes in
8603 .Va posix
8604 mode.
8607 .It Va inbox
8608 If this is set to a non-empty string it will specify the users
8609 .Mx -sx
8610 .Sx "primary system mailbox" ,
8611 overriding
8612 .Ev MAIL
8613 and the system-dependent default, and (thus) be used to replace
8614 .Ql %
8615 when doing
8616 .Sx "Filename transformations" ;
8617 also see
8618 .Ic file
8619 for more on this topic.
8620 The value supports a subset of transformations itself.
8623 .It Va indentprefix
8624 String used by the
8625 .Ic ~m , ~M
8627 .Ic ~R
8628 .Sx "COMMAND ESCAPES"
8629 and by the
8630 .Va quote
8631 option for indenting messages,
8632 in place of the normal tabulator character
8633 .Ql ^I ,
8634 which is the default.
8635 Be sure to quote the value if it contains spaces or tabs.
8638 .It Va keep
8639 \*(BO If set, an empty
8640 .Mx -sx
8641 .Sx "primary system mailbox"
8642 file is not removed.
8643 Note that, in conjunction with
8644 .Ev POSIXLY_CORRECT
8645 any empty file will be removed unless this variable is set.
8646 This may improve the interoperability with other mail user agents
8647 when using a common folder directory, and prevents malicious users
8648 from creating fake mailboxes in a world-writable spool directory.
8649 \*(ID Only local regular (MBOX) files are covered, Maildir or other
8650 mailbox types will never be removed, even if empty.
8653 .It Va keep-content-length
8654 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
8655 be told to keep the
8656 .Ql Content-Length:
8658 .Ql Lines:
8659 header fields that some MUAs generate by setting this variable.
8660 Since \*(UA does neither use nor update these non-standardized header
8661 fields (which in itself shows one of their conceptual problems),
8662 stripping them should increase interoperability in between MUAs that
8663 work with with same mailbox files.
8664 Note that, if this is not set but
8665 .Va writebackedited ,
8666 as below, is, a possibly performed automatic stripping of these header
8667 fields already marks the message as being modified.
8668 \*(ID At some future time \*(UA will be capable to rewrite and apply an
8669 .Va mime-encoding
8670 to modified messages, and then those fields will be stripped silently.
8673 .It Va keepsave
8674 \*(BO When a message is saved it is usually discarded from the
8675 originating folder when \*(UA is quit.
8676 This setting causes all saved message to be retained.
8679 .It Va line-editor-disable
8680 \*(BO Turn off any enhanced line editing capabilities (see
8681 .Sx "On terminal control and line editor"
8682 for more).
8685 .It Va line-editor-no-defaults
8686 \*(BO\*(OP Do not establish any default key binding.
8689 .It Va log-prefix
8690 Error log message prefix string
8691 .Pf ( Ql "\*(uA: " ) .
8694 .It Va mailbox-display
8695 \*(RO The name of the current mailbox
8696 .Pf ( Ic file ) ,
8697 possibly abbreviated for display purposes.
8700 .It Va mailbox-resolved
8701 \*(RO The fully resolved path of the current mailbox.
8704 .It Va mailx-extra-rc
8705 An additional startup file that is loaded as the last of the
8706 .Sx "Resource files" .
8707 Use this file for commands that are not understood by other POSIX
8708 .Xr mailx 1
8709 implementations, i.e., mostly anything which is not covered by
8710 .Sx "Initial settings" .
8713 .It Va markanswered
8714 \*(BO When a message is replied to and this variable is set,
8715 it is marked as having been
8716 .Ic answered .
8717 See the section
8718 .Sx "Message states" .
8721 .It Va mbox-rfc4155
8722 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
8723 POSIX rules for detecting message boundaries (so-called
8724 .Ql From_
8725 lines) due to compatibility reasons, instead of the stricter rules that
8726 have been standardized in RFC 4155.
8727 This behaviour can be switched to the stricter RFC 4155 rules by
8728 setting this variable.
8729 (This is never necessary for any message newly generated by \*(UA,
8730 it only applies to messages generated by buggy or malicious MUAs, or may
8731 occur in old MBOX databases: \*(UA itself will choose a proper
8732 .Va mime-encoding
8733 to avoid false interpretation of
8734 .Ql From_
8735 content lines in the MBOX database.)
8737 This may temporarily be handy when \*(UA complains about invalid
8738 .Ql From_
8739 lines when opening a MBOX: in this case setting this variable and
8740 re-opening the mailbox in question may correct the result.
8741 If so, copying the entire mailbox to some other file, as in
8742 .Ql copy * SOME-FILE ,
8743 will perform proper, all-compatible
8744 .Ql From_
8745 quoting for all detected messages, resulting in a valid MBOX mailbox.
8746 Finally the variable can be unset again:
8747 .Bd -literal -offset indent
8748 define mboxfix {
8749   localopts yes; wysh set mbox-rfc4155;\e
8750     wysh File "${1}"; eval copy * "${2}"
8752 call mboxfix /tmp/bad.mbox /tmp/good.mbox
8756 .It Va memdebug
8757 \*(BO Internal development variable.
8760 .It Va message-id-disable
8761 \*(BO By setting this variable the generation of
8762 .Ql Message-ID:
8763 can be completely suppressed, effectively leaving this task up to the
8764 .Va mta
8765 (Mail-Transfer-Agent) or the SMTP server.
8766 (According to RFC 5321 a SMTP server is not required to add this
8767 field by itself, so it should be ensured that it accepts messages without
8768 .Ql Message-ID . )
8769 This variable also affects automatic generation of
8770 .Va Content-ID:
8771 MIME header fields.
8774 .It Va message-inject-head
8775 A string to put at the beginning of each new message.
8776 The escape sequences tabulator
8777 .Ql \et
8778 and newline
8779 .Ql \en
8780 are understood.
8783 .It Va message-inject-tail
8784 A string to put at the end of each new message.
8785 The escape sequences tabulator
8786 .Ql \et
8787 and newline
8788 .Ql \en
8789 are understood.
8792 .It Va metoo
8793 \*(BO Usually, when an
8794 .Ic alias
8795 expansion contains the sender, the sender is removed from the expansion.
8796 Setting this option suppresses these removals.
8797 Note that a set
8798 .Va metoo
8799 also causes a
8800 .Ql -m
8801 option to be passed through to the
8802 .Va mta
8803 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
8804 this flag, no MTA is known which does not support it (for historical
8805 compatibility).
8808 .It Va mime-allow-text-controls
8809 \*(BO When sending messages, each part of the message is MIME-inspected
8810 in order to classify the
8811 .Ql Content-Type:
8813 .Ql Content-Transfer-Encoding:
8814 (see
8815 .Va mime-encoding )
8816 that is required to send this part over mail transport, i.e.,
8817 a computation rather similar to what the
8818 .Xr file 1
8819 command produces when used with the
8820 .Ql --mime
8821 option.
8823 This classification however treats text files which are encoded in
8824 UTF-16 (seen for HTML files) and similar character sets as binary
8825 octet-streams, forcefully changing any
8826 .Ql text/plain
8828 .Ql text/html
8829 specification to
8830 .Ql application/octet-stream :
8831 If that actually happens a yet unset charset MIME parameter is set to
8832 .Ql binary ,
8833 effectively making it impossible for the receiving MUA to automatically
8834 interpret the contents of the part.
8836 If this variable is set, and the data was unambiguously identified as
8837 text data at first glance (by a
8838 .Ql .txt
8840 .Ql .html
8841 file extension), then the original
8842 .Ql Content-Type:
8843 will not be overwritten.
8846 .It Va mime-alternative-favour-rich
8847 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
8848 HTML) will be preferred in favour of included plain text versions when
8849 displaying messages, provided that a handler exists which produces
8850 output that can be (re)integrated into \*(UA's normal visual display.
8851 (E.g., at the time of this writing some newsletters ship their full
8852 content only in the rich HTML part, whereas the plain text part only
8853 contains topic subjects.)
8856 .It Va mime-counter-evidence
8857 Normally the
8858 .Ql Content-Type:
8859 field is used to decide how to handle MIME parts.
8860 Some MUAs, however, do not use
8861 .Sx "The mime.types files"
8862 (also see
8863 .Sx "HTML mail and MIME attachments" )
8864 or a similar mechanism to correctly classify content, but specify an
8865 unspecific MIME type
8866 .Pf ( Ql application/octet-stream )
8867 even for plain text attachments.
8868 If this variable is set then \*(UA will try to re-classify such MIME
8869 message parts, if possible, for example via a possibly existing
8870 attachment filename.
8871 A non-empty value may also be given, in which case a number is expected,
8872 actually a carrier of bits.
8873 Creating the bit-carrying number is a simple addition:
8874 .Bd -literal -offset indent
8875 ? !echo Value should be set to $((2 + 4 + 8))
8876 Value should be set to 14
8879 .Bl -bullet -compact
8881 If bit two is set (2) then the detected
8882 .Ic mimetype
8883 will be carried along with the message and be used for deciding which
8884 MIME handler is to be used, for example;
8885 when displaying such a MIME part the part-info will indicate the
8886 overridden content-type by showing a plus sign
8887 .Ql + .
8889 If bit three is set (4) then the counter-evidence is always produced
8890 and a positive result will be used as the MIME type, even forcefully
8891 overriding the parts given MIME type.
8893 If bit four is set (8) then as a last resort the actual content of
8894 .Ql application/octet-stream
8895 parts will be inspected, so that data which looks like plain text can be
8896 treated as such.
8900 .It Va mime-encoding
8901 The MIME
8902 .Ql Content-Transfer-Encoding
8903 to use in outgoing text messages and message parts, where applicable.
8904 (7-bit clean text messages are sent as-is, without a transfer encoding.)
8905 Valid values are:
8907 .Bl -tag -compact -width ".It Ql _%%_"
8908 .It Ql 8bit
8909 .Pf (Or\0 Ql 8b . )
8910 8-bit transport effectively causes the raw data be passed through
8911 unchanged, but may cause problems when transferring mail messages over
8912 channels that are not ESMTP (RFC 1869) compliant.
8913 Also, several input data constructs are not allowed by the
8914 specifications and may cause a different transfer-encoding to be used.
8915 .It Ql quoted-printable
8916 .Pf (Or\0 Ql qp . )
8917 Quoted-printable encoding is 7-bit clean and has the property that ASCII
8918 characters are passed through unchanged, so that an english message can
8919 be read as-is; it is also acceptible for other single-byte locales that
8920 share many characters with ASCII, like, e.g., ISO-8859-1.
8921 The encoding will cause a large overhead for messages in other character
8922 sets: e.g., it will require up to twelve (12) bytes to encode a single
8923 UTF-8 character of four (4) bytes.
8924 .It Ql base64
8925 .Pf (Or\0 Ql b64 . )
8926 The default encoding, it is 7-bit clean and will always be used for
8927 binary data.
8928 This encoding has a constant input:output ratio of 3:4, regardless of
8929 the character set of the input data it will encode three bytes of input
8930 to four bytes of output.
8931 This transfer-encoding is not human readable without performing
8932 a decoding step.
8936 .It Va mimetypes-load-control
8937 Can be used to control which of
8938 .Sx "The mime.types files"
8939 are loaded: if the letter
8940 .Ql u
8941 is part of the option value, then the user's personal
8942 .Pa ~/.mime.types
8943 file will be loaded (if it exists); likewise the letter
8944 .Ql s
8945 controls loading of the system wide
8946 .Pa /etc/mime.types ;
8947 directives found in the user file take precedence, letter matching is
8948 case-insensitive.
8949 If this variable is not set \*(UA will try to load both files.
8950 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
8951 but they will be matched last (the order can be listed via
8952 .Ic mimetype ) .
8954 More sources can be specified by using a different syntax: if the
8955 value string contains an equals sign
8956 .Ql =
8957 then it is instead parsed as a comma-separated list of the described
8958 letters plus
8959 .Ql f=FILENAME
8960 pairs; the given filenames will be expanded and loaded, and their
8961 content may use the extended syntax that is described in the section
8962 .Sx "The mime.types files" .
8963 Directives found in such files always take precedence (are prepended to
8964 the MIME type cache).
8968 .It Va mta
8969 To choose an alternate Mail-Transfer-Agent, set this option to either
8970 the full pathname of an executable (optionally prefixed with a
8971 .Ql file://
8972 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
8974 .Dl smtps?://[user[:password]@]server[:port]
8976 (\*(OU:
8977 .Ql [smtp://]server[:port] . )
8978 The default has been chosen at compie time.
8979 All supported data transfers are executed in child processes, which
8980 run asynchronously, and without supervision, unless either the
8981 .Va sendwait
8982 or the
8983 .Va verbose
8984 variable is set.
8985 If such a child receives a TERM signal, it will abort and
8986 .Va save
8987 the message to
8988 .Ev DEAD ,
8989 if so configured.
8992 For a file-based MTA it may be necessary to set
8993 .Va mta-argv0
8994 in in order to choose the right target of a modern
8995 .Xr mailwrapper 8
8996 environment.
8997 It will be passed command line arguments from several possible sources:
8998 from the variable
8999 .Va mta-arguments
9000 if set, from the command line if given and the variable
9001 .Va expandargv
9002 allows their use.
9003 Argument processing of the MTA will be terminated with a
9004 .Fl \&\&-
9005 separator.
9008 The otherwise occurring implicit usage of the following MTA command
9009 line arguments can be disabled by setting the boolean variable
9010 .Va mta-no-default-arguments
9011 (which will also disable passing
9012 .Fl \&\&-
9013 to the MTA):
9014 .Fl \&\&i
9015 (for not treating a line with only a dot
9016 .Ql \&.
9017 character as the end of input),
9018 .Fl \&\&m
9019 (shall the variable
9020 .Va metoo
9021 be set) and
9022 .Fl \&\&v
9023 (if the
9024 .Va verbose
9025 variable is set); in conjunction with the
9026 .Fl r
9027 command line option \*(UA will also (not) pass
9028 .Fl \&\&f
9029 as well as possibly
9030 .Fl \&\&F .
9033 \*(OP \*(UA can send mail over SMTP network connections to a single
9034 defined SMTP smarthost, the access URL of which has to be assigned to
9035 .Va mta .
9036 To use this mode it is helpful to read
9037 .Sx "On URL syntax and credential lookup" .
9038 It may be necessary to set the
9039 .Va smtp-hostname
9040 variable in order to use a specific combination of
9041 .Va from ,
9042 .Va hostname
9044 .Va mta
9045 with some mail providers.
9048 .Bl -bullet -compact
9050 The plain SMTP protocol (RFC 5321) that normally lives on the
9051 server port 25 and requires setting the
9052 .Va smtp-use-starttls
9053 variable to enter a SSL/TLS encrypted session state.
9054 Assign a value like \*(IN
9055 .Ql smtp://[user[:password]@]server[:port]
9056 (\*(OU
9057 .Ql smtp://server[:port] )
9058 to choose this protocol.
9060 The so-called SMTPS which is supposed to live on server port 465
9061 and is automatically SSL/TLS secured.
9062 Unfortunately it never became a standardized protocol and may thus not
9063 be supported by your hosts network service database
9064 \(en in fact the port number has already been reassigned to other
9065 protocols!
9067 SMTPS is nonetheless a commonly offered protocol and thus can be
9068 chosen by assigning a value like \*(IN
9069 .Ql smtps://[user[:password]@]server[:port]
9070 (\*(OU
9071 .Ql smtps://server[:port] ) ;
9072 due to the mentioned problems it is usually necessary to explicitly
9073 specify the port as
9074 .Ql :465 ,
9075 however.
9077 Finally there is the SUBMISSION protocol (RFC 6409), which usually
9078 lives on server port 587 and is practically identically to the SMTP
9079 protocol from \*(UA's point of view beside that; it requires setting the
9080 .Va smtp-use-starttls
9081 variable to enter a SSL/TLS secured session state.
9082 Assign a value like \*(IN
9083 .Ql submission://[user[:password]@]server[:port]
9084 (\*(OU
9085 .Ql submission://server[:port] ) .
9090 .It Va mta-arguments
9091 Arguments to pass through to a file-based
9092 .Va mta
9093 can be given via this variable, which is parsed according to
9094 .Sx "Shell-style argument quoting"
9095 into an array of arguments, and which will be joined onto MTA options
9096 from other sources, and then passed individually to the MTA:
9098 .Dl wysh set mta-arguments='-t -X \&"/tmp/my log\&"'
9101 .It Va mta-no-default-arguments
9102 \*(BO Unless this variable is set \*(UA will pass some well known
9103 standard command line options to a file-based
9104 .Va mta
9105 (Mail-Transfer-Agent), see there for more.
9108 .It Va mta-argv0
9109 Many systems use a so-called
9110 .Xr mailwrapper 8
9111 environment to ensure compatibility with
9112 .Xr sendmail 1 .
9113 This works by inspecting the name that was used to invoke the mail
9114 delivery system.
9115 If this variable is set then the mailwrapper (the program that is
9116 actually executed when calling the file-based
9117 .Va mta )
9118 will treat its contents as that name.
9119 The default is
9120 .Ql sendmail .
9122 .Mx Va netrc-lookup
9123 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
9124 \*(BO\*(IN\*(OP Used to control usage of the users
9125 .Pa .netrc
9126 file for lookup of account credentials, as documented in the section
9127 .Sx "On URL syntax and credential lookup"
9128 and for the command
9129 .Ic netrc ;
9130 the section
9131 .Sx "The .netrc file"
9132 documents the file format.
9133 Also see
9134 .Va netrc-pipe .
9137 .It Va netrc-pipe
9138 \*(IN\*(OP When
9139 .Pa .netrc
9140 is loaded (see
9141 .Ic netrc
9143 .Va netrc-lookup )
9144 then \*(UA will read the output of a shell pipe instead of the users
9145 .Pa .netrc
9146 file if this variable is set (to the desired shell command).
9147 This can be used to, e.g., store
9148 .Pa .netrc
9149 in encrypted form:
9151 .Dl set netrc-pipe='gpg -qd ~/.netrc.pgp'
9154 .It Va newfolders
9155 If this variable has the value
9156 .Ql maildir ,
9157 newly created local folders will be in Maildir instead of MBOX format.
9160 .It Va newmail
9161 Checks for new mail in the current folder each time the prompt is shown.
9162 A Maildir folder must be re-scanned to determine if new mail has arrived.
9163 If this variable is set to the special value
9164 .Ql nopoll
9165 then a Maildir folder will not be rescanned completely, but only
9166 timestamp changes are detected.
9169 .It Va outfolder
9170 \*(BO Causes the filename given in the
9171 .Va record
9172 variable
9173 and the sender-based filenames for the
9174 .Ic Copy
9176 .Ic Save
9177 commands to be interpreted relative to the directory given in the
9178 .Va folder
9179 variable rather than to the current directory,
9180 unless it is set to an absolute pathname.
9183 .It Va on-compose-cleanup
9184 Macro hook which will be called after the message has been sent (or not,
9185 in case of failures), as the very last step before unrolling compose mode
9186 .Ic localopts .
9187 This hook is run even in case of fatal errors, and it is advisable to
9188 perform only absolutely necessary actions, like cleaning up
9189 .Ic alternates ,
9190 for example.
9191 For compose mode hooks that may affect the message content please see
9192 .Va on-compose-enter , on-compose-leave , on-compose-splice .
9193 \*(ID This hook exists only because
9194 .Ic alias , alternates , commandalias , shortcut ,
9195 to name a few, are currently not covered by
9196 .Ic localopts
9197 or a similar mechanism: any changes applied in compose mode will
9198 continue to be in effect thereafter.
9202 .It Va on-compose-enter , on-compose-leave
9203 Macro hooks which will be called before compose mode is entered,
9204 and after composing has been finished (but before the
9205 .Va signature
9206 is injected, etc.), respectively.
9207 .Ic localopts
9208 are enabled for these hooks, causing any setting to be forgotten after
9209 the message has been sent;
9210 .Va on-compose-cleanup
9211 can be used to perform any other necessary cleanup.
9212 The following (read-only) variables will be set temporarily during
9213 execution of the macros to represent the according message headers, or
9214 the empty string for non-existent; they correspond to accoding virtual
9215 temporary message headers that can be accessed via
9216 .Ic ~^ ,
9217 one of the
9218 .Sx "COMMAND ESCAPES" :
9220 .Bl -tag -compact -width ".It Va mailx_subject"
9221 .It Va mailx-command
9222 The command that generates the message.
9223 .It Va mailx-subject
9224 The subject.
9225 .It Va mailx-from
9226 .Va from .
9227 .It Va mailx-sender
9228 .Va sender .
9229 .It Va mailx-to , mailx-cc , mailx-bcc
9230 The list of receiver addresses as a space-separated list.
9231 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
9232 The list of receiver addresses before any mangling (due to, e.g.,
9233 .Ic alternates ,
9234 .Ic alias
9235 .Va recipients-in-cc )
9236 as a space-separated list.
9237 .It Va mailx-orig-from
9238 When replying, forwarding or resending, this will be set to the
9239 .Ql From:
9240 of the given message.
9241 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
9242 When replying, forwarding or resending, this will be set to the
9243 receivers of the given message.
9249 .It Va on-compose-splice , on-compose-splice-shell
9250 These hooks run once the normal compose mode is finished, but before the
9251 .Va on-compose-leave
9252 macro hook is called, the
9253 .Va signature
9254 is injected etc.
9255 Both hooks will be executed in a subprocess, with their input and output
9256 connected to \*(UA such that they can act as if they would be an
9257 interactive user.
9258 The difference in between them is that the latter is a
9259 .Ev SHELL
9260 command, whereas the former is a normal \*(UA macro, but which is
9261 restricted to a small set of commands (the
9262 .Va verbose
9263 output of, e.g.,
9264 .Ic list
9265 will indicate said capability).
9266 .Ic localopts
9267 are enabled for these hooks (in the parent process), causing any setting
9268 to be forgotten after the message has been sent;
9269 .Va on-compose-cleanup
9270 can be used to perform other cleanup as necessary.
9273 During execution of these hooks \*(UA will temporarily forget whether it
9274 has been started in interactive mode, (a restricted set of)
9275 .Sx "COMMAND ESCAPES"
9276 will always be available, and for guaranteed reproducibilities sake
9277 .Va escape
9279 .Va ifs
9280 will be set to their defaults.
9281 The compose mode command
9282 .Ic ~^
9283 has been especially designed for scriptability (via these hooks).
9284 The first line the hook will read on its standard input is the protocol
9285 version of said command escape, currently
9286 .Dq 0 0 1 :
9287 backward incompatible protocol changes have to be expected.
9290 Care must be taken to avoid deadlocks and other false control flow:
9291 if both involved processes wait for more input to happen at the
9292 same time, or one doesn't expect more input but the other is stuck
9293 waiting for consumption of its output, etc.
9294 There is no automatic synchronization of the hook: it will not be
9295 stopped automatically just because it, e.g., emits
9296 .Ql ~x .
9297 The hooks will however receive a termination signal if the parent enters
9298 an error condition.
9299 \*(ID Protection against and interaction with signals is not yet given;
9300 it is likely that in the future these scripts will be placed in an
9301 isolated session, which is signalled in its entirety as necessary.
9303 .Bd -literal -offset indent
9304 wysh set on-compose-splice-shell=$'\e
9305   read version;\e
9306   printf "hello $version!  Headers: ";\e
9307   echo \e'~^header list\e';\e
9308   read status result;\e
9309   echo "status=$status result=$result";\e
9310   '
9312 set on-compose-splice=ocsm
9313 define ocsm {
9314   read ver
9315   echo Splice protocol version is $ver
9316   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
9317   if [ "$es" != 2 ]
9318     echoerr 'Cannot read header list'; echo '~x'; xit
9319   endif
9320   if [ "$hl" @i!@ ' cc' ]
9321     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
9322       vput vexpr es substring "${es}" 0 1
9323     if [ "$es" != 2 ]
9324       echoerr 'Cannot insert Cc: header'; echo '~x'
9325     endif
9326   endif
9332 .It Va on-resend-cleanup
9333 \*(ID Identical to
9334 .Va on-compose-cleanup ,
9335 but is only triggered by
9336 .Ic resend .
9339 .It Va on-resend-enter
9340 \*(ID Identical to
9341 .Va on-compose-enter ,
9342 but is only triggered by
9343 .Ic resend .
9346 .It Va page
9347 \*(BO If set, each message feed through the command given for
9348 .Ic pipe
9349 is followed by a formfeed character
9350 .Ql \ef .
9352 .Mx Va password
9353 .It Va password-USER@HOST , password-HOST , password
9354 \*(IN Variable chain that sets a password, which is used in case none has
9355 been given in the protocol and account-specific URL;
9356 as a last resort \*(UA will ask for a password on the user's terminal if
9357 the authentication method requires a password.
9358 Specifying passwords in a startup file is generally a security risk;
9359 the file should be readable by the invoking user only.
9361 .It Va password-USER@HOST
9362 \*(OU (see the chain above for \*(IN)
9363 Set the password for
9364 .Ql USER
9365 when connecting to
9366 .Ql HOST .
9367 If no such variable is defined for a host,
9368 the user will be asked for a password on standard input.
9369 Specifying passwords in a startup file is generally a security risk;
9370 the file should be readable by the invoking user only.
9373 .It Va piperaw
9374 \*(BO Send messages to the
9375 .Ic pipe
9376 command without performing MIME and character set conversions.
9380 .It Va pipe-TYPE/SUBTYPE
9381 When a MIME message part of type
9382 .Ql TYPE/SUBTYPE
9383 (case-insensitive) is displayed or quoted,
9384 its text is filtered through the value of this variable interpreted as
9385 a shell command.
9386 Note that only parts which can be displayed inline as plain text (see
9387 .Cd copiousoutput )
9388 are displayed unless otherwise noted, other MIME parts will only be
9389 considered by and for the command
9390 .Ic mimeview .
9391 The special value commercial at
9392 .Ql @
9393 forces interpretation of the message part as plain text, e.g.,
9394 .Ql set pipe-application/xml=@
9395 will henceforth display XML
9396 .Dq as is .
9397 (The same could also be achieved by adding a MIME type marker with the
9398 .Ic mimetype
9399 command.
9400 And \*(OPally MIME type handlers may be defined via
9401 .Sx "The Mailcap files"
9402 \(em these directives,
9403 .Cd copiousoutput
9404 has already been used, should be referred to for further documentation.
9407 The commercial at
9408 .Ql @
9409 can in fact be used as a trigger character to adjust usage and behaviour
9410 of a following shell command specification more thoroughly by appending
9411 more special characters which refer to further mailcap directives, e.g.,
9412 the following hypothetical command specification could be used:
9414 .Bd -literal -offset indent
9415 set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
9419 .Bl -tag -compact -width ".It Ql __"
9420 .It Ql *
9421 The command produces plain text to be integrated in \*(UAs output:
9422 .Cd copiousoutput .
9424 .It Ql #
9425 If set the handler will not be invoked when a message is to be quoted,
9426 but only when it will be displayed:
9427 .Cd x-mailx-noquote .
9429 .It Ql &
9430 Run the command asynchronously, i.e., without blocking \*(UA:
9431 .Cd x-mailx-async .
9433 .It Ql \&!
9434 The command must be run on an interactive terminal, \*(UA will
9435 temporarily release the terminal to it:
9436 .Cd needsterminal .
9438 .It Ql +
9439 Request creation of a zero-sized temporary file, the absolute pathname
9440 of which will be made accessible via the environment variable
9441 .Ev MAILX_FILENAME_TEMPORARY :
9442 .Cd x-mailx-tmpfile .
9443 If given twice then the file will be unlinked automatically by \*(UA
9444 when the command loop is entered again at latest:
9445 .Cd x-mailx-tmpfile-unlink .
9447 .It Ql =
9448 Normally the MIME part content is passed to the handler via standard
9449 input; if this flag is set then the data will instead be written into
9450 .Ev MAILX_FILENAME_TEMPORARY
9451 .Pf ( Cd x-mailx-tmpfile-fill ) ,
9452 the creation of which is implied; note however that in order to cause
9453 deletion of the temporary file you still have to use two plus signs
9454 .Ql ++
9455 explicitly!
9457 .It Ql @
9458 To avoid ambiguities with normal shell command content you can use
9459 another commercial at to forcefully terminate interpretation of
9460 remaining characters.
9461 (Any character not in this list will have the same effect.)
9465 Some information about the MIME part to be displayed is embedded into
9466 the environment of the shell command:
9469 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
9471 .It Ev MAILX_CONTENT
9472 The MIME content-type of the part, if known, the empty string otherwise.
9475 .It Ev MAILX_CONTENT_EVIDENCE
9477 .Va mime-counter-evidence
9478 includes the carry-around-bit (2), then this will be set to the detected
9479 MIME content-type; not only then identical to
9480 .Ev \&\&MAILX_CONTENT
9481 otherwise.
9484 .It Ev MAILX_FILENAME
9485 The filename, if any is set, the empty string otherwise.
9488 .It Ev MAILX_FILENAME_GENERATED
9489 A random string.
9492 .It Ev MAILX_FILENAME_TEMPORARY
9493 If temporary file creation has been requested through the command prefix
9494 this variable will be set and contain the absolute pathname of the
9495 temporary file.
9500 .It Va pipe-EXTENSION
9501 This is identical to
9502 .Va pipe-TYPE/SUBTYPE
9503 except that
9504 .Ql EXTENSION
9505 (normalized to lowercase using character mappings of the ASCII charset)
9506 names a file extension, e.g.,
9507 .Ql xhtml .
9508 Handlers registered using this method take precedence.
9510 .Mx Va pop3-auth
9511 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
9512 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
9513 The only possible value as of now is
9514 .Ql plain ,
9515 which is thus the default.
9518 .Mx Va pop3-bulk-load
9519 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
9520 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
9521 the messages, and only requests the message bodies on user request.
9522 For the POP3 protocol this means that the message headers will be
9523 downloaded twice.
9524 If this variable is set then \*(UA will download only complete messages
9525 from the given POP3 server(s) instead.
9527 .Mx Va pop3-keepalive
9528 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
9529 \*(OP POP3 servers close the connection after a period of inactivity;
9530 the standard requires this to be at least 10 minutes,
9531 but practical experience may vary.
9532 Setting this variable to a numeric value greater than
9533 .Ql 0
9534 causes a
9535 .Ql NOOP
9536 command to be sent each value seconds if no other operation is performed.
9538 .Mx Va pop3-no-apop
9539 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
9540 \*(BO\*(OP Unless this variable is set the
9541 .Ql APOP
9542 authentication method will be used when connecting to a POP3 server that
9543 advertises support.
9544 The advantage of
9545 .Ql APOP
9546 is that the password is not sent in clear text over the wire and that
9547 only a single packet is sent for the user/password tuple.
9548 Note that
9549 .Va pop3-no-apop-HOST
9550 requires \*(IN.
9552 .Mx Va pop3-use-starttls
9553 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
9554 \*(BO\*(OP Causes \*(UA to issue a
9555 .Ql STLS
9556 command to make an unencrypted POP3 session SSL/TLS encrypted.
9557 This functionality is not supported by all servers,
9558 and is not used if the session is already encrypted by the POP3S method.
9559 Note that
9560 .Va pop3-use-starttls-HOST
9561 requires \*(IN.
9565 .It Va posix
9566 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
9567 where that deviates from standardized behaviour.
9568 It will be set implicitly before the
9569 .Sx "Resource files"
9570 are loaded if the environment variable
9571 .Ev POSIXLY_CORRECT
9572 is set, and adjusting any of those two will be reflected by the other
9573 one implicitly.
9574 The following behaviour is covered and enforced by this mechanism:
9577 .Bl -bullet -compact
9579 In non-interactive mode, any error encountered while loading resource
9580 files during program startup will cause a program exit, whereas in
9581 interactive mode such errors will stop loading of the currently loaded
9582 (stack of) file(s, i.e., recursively).
9583 These exits can be circumvented on a per-command base by using
9584 .Cm ignerr ,
9585 one of the
9586 .Sx "Command modifiers" ,
9587 for each command which shall be allowed to fail.
9590 Setting
9591 .Va ignoreeof
9592 implies the behaviour described by
9593 .Va dot .
9596 The variable
9597 .Va keep
9598 is extended to cover any empty mailbox, not only empty
9599 .Mx -sx
9600 .Sx "primary system mailbox" Ns
9601 es: they will be removed when they are left in empty state otherwise.
9604 Upon changing the active
9605 .Ic file
9606 no summary of
9607 .Ic headers
9608 will be displayed even if
9609 .Va header
9610 is set.
9615 .It Va print-alternatives
9616 \*(BO When a MIME message part of type
9617 .Ql multipart/alternative
9618 is displayed and it contains a subpart of type
9619 .Ql text/plain ,
9620 other parts are normally discarded.
9621 Setting this variable causes all subparts to be displayed,
9622 just as if the surrounding part was of type
9623 .Ql multipart/mixed .
9626 .It Va prompt
9627 The string used as a prompt in interactive mode.
9628 Whenever the variable is evaluated the value is expanded as via
9629 dollar-single-quote expansion (see
9630 .Sx "Shell-style argument quoting" ) .
9631 This (post-assignment, i.e., second) expansion can be used to embed
9632 status information, for example
9633 .Va \&? ,
9634 .Va \&! ,
9635 .Va account
9637 .Va mailbox-display .
9639 In order to embed characters which should not be counted when
9640 calculating the visual width of the resulting string, enclose the
9641 characters of interest in a pair of reverse solidus escaped brackets:
9642 .Ql \e[\eE[0m\e] ;
9643 a slot for coloured prompts is also available with the \*(OPal command
9644 .Ic colour .
9645 Prompting may be prevented by setting this to the null string
9646 (a.k.a.\|
9647 .Ql set noprompt ) .
9650 .It Va prompt2
9651 This string is used for secondary prompts, but is otherwise identical to
9652 .Va prompt .
9653 The default is
9654 .Ql ..\0 .
9657 .It Va quiet
9658 \*(BO Suppresses the printing of the version when first invoked.
9661 .It Va quote
9662 If set, \*(UA starts a replying message with the original message
9663 prefixed by the value of the variable
9664 .Va indentprefix .
9665 Normally, a heading consisting of
9666 .Dq Fromheaderfield wrote:
9667 is put before the quotation.
9668 If the string
9669 .Ql noheading
9670 is assigned to the
9671 .Va \&\&quote
9672 variable, this heading is omitted.
9673 If the string
9674 .Ql headers
9675 is assigned, only the headers selected by the
9676 .Ql type
9677 .Ic headerpick
9678 selection are put above the message body,
9679 thus
9680 .Va \&\&quote
9681 acts like an automatic
9682 .Pf ` Ic ~m Ns '
9683 .Sx "COMMAND ESCAPES"
9684 command, then.
9685 If the string
9686 .Ql allheaders
9687 is assigned, all headers are put above the message body and all MIME
9688 parts are included, making
9689 .Va \&\&quote
9690 act like an automatic
9691 .Pf ` Ic ~M Ns '
9692 command; also see
9693 .Va quote-as-attachment .
9696 .It Va quote-as-attachment
9697 \*(BO Add the original message in its entirety as a
9698 .Ql message/rfc822
9699 MIME attachment when replying to a message.
9700 Note this works regardless of the setting of
9701 .Va quote .
9704 .It Va quote-fold
9705 \*(OP Can be set in addition to
9706 .Va indentprefix .
9707 Setting this turns on a more fancy quotation algorithm in that leading
9708 quotation characters are compressed and overlong lines are folded.
9709 .Va \&\&quote-fold
9710 can be set to either one or two (space separated) numeric values,
9711 which are interpreted as the maximum (goal) and the minimum line length,
9712 respectively, in a spirit rather equal to the
9713 .Xr fmt 1
9714 program, but line-, not paragraph-based.
9715 If not set explicitly the minimum will reflect the goal algorithmically.
9716 The goal cannot be smaller than the length of
9717 .Va indentprefix
9718 plus some additional pad.
9719 Necessary adjustments take place silently.
9722 .It Va r-option-implicit
9723 \*(BO Setting this option evaluates the contents of
9724 .Va from
9725 (or, if that contains multiple addresses,
9726 .Va sender )
9727 and passes the results onto the used (file-based) MTA as described for the
9728 .Fl r
9729 option (empty argument case).
9732 .It Va recipients-in-cc
9733 \*(BO When doing a
9734 .Ic reply ,
9735 the original
9736 .Ql From:
9738 .Ql To:
9739 are by default merged into the new
9740 .Ql To: .
9741 If this variable is set, only the original
9742 .Ql From:
9743 ends in the new
9744 .Ql To: ,
9745 the rest is merged into
9746 .Ql Cc: .
9749 .It Va record
9750 Unless this variable is defined, no copies of outgoing mail will be saved.
9751 If defined it gives the pathname, subject to the usual
9752 .Sx "Filename transformations" ,
9753 of a folder where all new, replied-to or forwarded messages are saved:
9754 when saving to this folder fails the message is not sent, but instead
9755 .Va save Ns
9756 d to
9757 .Ev DEAD .
9758 The standard defines that relative (fully expanded) paths are to be
9759 interpreted relative to the current directory
9760 .Pf ( Ic cwd ) ,
9761 to force interpretation relative to
9762 .Va folder
9763 .Va outfolder
9764 needs to be set in addition.
9767 .It Va record-files
9768 \*(BO If this variable is set the meaning of
9769 .Va record
9770 will be extended to cover messages which target only file and pipe
9771 recipients (see
9772 .Va expandaddr ) .
9773 These address types will not appear in recipient lists unless
9774 .Va add-file-recipients
9775 is also set.
9778 .It Va record-resent
9779 \*(BO If this variable is set the meaning of
9780 .Va record
9781 will be extended to also cover the
9782 .Ic resend
9784 .Ic Resend
9785 commands.
9788 .It Va reply-in-same-charset
9789 \*(BO If this variable is set \*(UA first tries to use the same
9790 character set of the original message for replies.
9791 If this fails, the mechanism described in
9792 .Sx "Character sets"
9793 is evaluated as usual.
9796 .It Va reply-strings
9797 Can be set to a comma-separated list of (case-insensitive according to
9798 ASCII rules) strings which shall be recognized in addition to the
9799 built-in strings as
9800 .Ql Subject:
9801 reply message indicators \(en built-in are
9802 .Ql Re: ,
9803 which is mandated by RFC 5322, as well as the german
9804 .Ql Aw: ,
9805 .Ql Antw: ,
9806 and the
9807 .Ql Wg:
9808 which often has been seen in the wild;
9809 I.e., the separating colon has to be specified explicitly.
9812 .It Va replyto
9813 A list of addresses to put into the
9814 .Ql Reply-To:
9815 field of the message header.
9816 Members of this list are handled as if they were in the
9817 .Ic alternates
9818 list.
9821 .It Va reply-to-honour
9822 Controls whether a
9823 .Ql Reply-To:
9824 header is honoured when replying to a message via
9825 .Ic reply
9827 .Ic Lreply .
9828 This is a quadoption; if set without a value it defaults to
9829 .Dq yes .
9832 .It Va rfc822-body-from_
9833 \*(BO This variable can be used to force displaying a so-called
9834 .Ql From_
9835 line for messages that are embedded into an envelope mail via the
9836 .Ql message/rfc822
9837 MIME mechanism, for more visual convenience.
9840 .It Va save
9841 \*(BO Enable saving of (partial) messages in
9842 .Ev DEAD
9843 upon interrupt or delivery error.
9846 .It Va screen
9847 The number of lines that represents a
9848 .Dq screenful
9849 of lines, used in
9850 .Ic headers
9851 summary display,
9852 .Ic from
9853 .Ic search Ns
9854 ing, message
9855 .Ic top Ns
9856 line display and scrolling via
9857 .Ic z .
9858 If this variable is not set \*(UA falls back to a calculation based upon
9859 the detected terminal window size and the baud rate: the faster the
9860 terminal, the more will be shown.
9861 Overall screen dimensions and pager usage is influenced by the
9862 environment variables
9863 .Ev COLUMNS
9865 .Ev LINES
9866 and the variable
9867 .Va crt .
9870 .It Va searchheaders
9871 \*(BO Expand message-list specifiers in the form
9872 .Ql /x:y
9873 to all messages containing the substring
9874 .Dq y
9875 in the header field
9876 .Ql x .
9877 The string search is case insensitive.
9880 .It Va sendcharsets
9881 \*(OP A comma-separated list of character set names that can be used in
9882 outgoing internet mail.
9883 The value of the variable
9884 .Va charset-8bit
9885 is automatically appended to this list of character sets.
9886 If no character set conversion capabilities are compiled into \*(UA then
9887 the only supported charset is
9888 .Va ttycharset .
9889 Also see
9890 .Va sendcharsets-else-ttycharset
9891 and refer to the section
9892 .Sx "Character sets"
9893 for the complete picture of character set conversion in \*(UA.
9896 .It Va sendcharsets-else-ttycharset
9897 \*(BO\*(OP If this variable is set, but
9898 .Va sendcharsets
9899 is not, then \*(UA acts as if
9900 .Va sendcharsets
9901 had been set to the value of the variable
9902 .Va ttycharset .
9903 In effect this combination passes through the message data in the
9904 character set of the current locale encoding:
9905 therefore mail message text will be (assumed to be) in ISO-8859-1
9906 encoding when send from within a ISO-8859-1 locale, and in UTF-8
9907 encoding when send from within an UTF-8 locale.
9909 The 8-bit fallback
9910 .Va charset-8bit
9911 never comes into play as
9912 .Va ttycharset
9913 is implicitly assumed to be 8-bit and capable to represent all files the
9914 user may specify (as is the case when no character set conversion
9915 support is available in \*(UA and the only supported character set is
9916 .Va ttycharset :
9917 .Sx "Character sets" ) .
9918 This might be a problem for scripts which use the suggested
9919 .Ql LC_ALL=C
9920 setting, since in this case the character set is US-ASCII by definition,
9921 so that it is better to also override
9922 .Va ttycharset ,
9923 then.
9926 .It Va sender
9927 An address that is put into the
9928 .Ql Sender:
9929 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
9930 responsible for the actual transmission of the message.
9931 This field should normally not be used unless the
9932 .Va from
9933 field contains more than one address, on which case it is required.
9935 .Va \&\&sender
9936 address is handled as if it were in the
9937 .Ic alternates
9938 list; also see
9939 .Fl r ,
9940 .Va r-option-implicit .
9942 .It Va sendmail
9943 \*(OB Predecessor of
9944 .Va mta .
9946 .It Va sendmail-arguments
9947 \*(OB Predecessor of
9948 .Va mta-arguments .
9950 .It Va sendmail-no-default-arguments
9951 \*(OB\*(BO Predecessor of
9952 .Va mta-no-default-arguments .
9954 .It Va sendmail-progname
9955 \*(OB Predecessor of
9956 .Va mta-argv0 .
9959 .It Va sendwait
9960 \*(BO When sending a message wait until the
9961 .Va mta
9962 (including the built-in SMTP one) exits before accepting further commands.
9963 .Sy Only
9964 with this variable set errors reported by the MTA will be recognizable!
9965 If the MTA returns a non-zero exit status,
9966 the exit status of \*(UA will also be non-zero.
9969 .It Va showlast
9970 \*(BO This setting causes \*(UA to start at the last message
9971 instead of the first one when opening a mail folder.
9974 .It Va showname
9975 \*(BO Causes \*(UA to use the sender's real name instead of the plain
9976 address in the header field summary and in message specifications.
9979 .It Va showto
9980 \*(BO Causes the recipient of the message to be shown in the header
9981 summary if the message was sent by the user.
9984 .It Va Sign
9985 The string to expand
9986 .Ic ~A
9987 to (see
9988 .Sx "COMMAND ESCAPES" ) .
9991 .It Va sign
9992 The string to expand
9993 .Ic ~a
9994 to (see
9995 .Sx "COMMAND ESCAPES" ) .
9998 .It Va signature
9999 Must correspond to the name of a readable file if set.
10000 The file's content is then appended to each singlepart message
10001 and to the first part of each multipart message.
10002 Be warned that there is no possibility to edit the signature for an
10003 individual message.
10006 .It Va skipemptybody
10007 \*(BO If an outgoing message does not contain any text in its first or
10008 only message part, do not send it but discard it silently (see also the
10009 command line option
10010 .Fl E ) .
10014 .It Va smime-ca-dir , smime-ca-file
10015 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10016 Enhanced Mail) format as a directory and a file, respectively, for the
10017 purpose of verification of S/MIME signed messages.
10018 It is possible to set both, the file will be loaded immediately, the
10019 directory will be searched whenever no match has yet been found.
10020 The set of CA certificates which are built into the SSL/TLS library can
10021 be explicitly turned off by setting
10022 .Va smime-ca-no-defaults ,
10023 and further fine-tuning is possible via
10024 .Va smime-ca-flags .
10027 .It Va smime-ca-flags
10028 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10029 storage, and the certificate verification that is used.
10030 The actual values and their meanings are documented for
10031 .Va ssl-ca-flags .
10034 .It Va smime-ca-no-defaults
10035 \*(BO\*(OP Do not load the default CA locations that are built into the
10036 used to SSL/TLS library to verify S/MIME signed messages.
10038 .Mx Va smime-cipher
10039 .It Va smime-cipher-USER@HOST , smime-cipher
10040 \*(OP Specifies the cipher to use when generating S/MIME encrypted
10041 messages (for the specified account).
10042 RFC 5751 mandates a default of
10043 .Ql aes128
10044 (AES-128 CBC).
10045 Possible values are (case-insensitive and) in decreasing cipher strength:
10046 .Ql aes256
10047 (AES-256 CBC),
10048 .Ql aes192
10049 (AES-192 CBC),
10050 .Ql aes128
10051 (AES-128 CBC),
10052 .Ql des3
10053 (DES EDE3 CBC, 168 bits; default if
10054 .Ql aes128
10055 is not available) and
10056 .Ql des
10057 (DES CBC, 56 bits).
10059 The actually available cipher algorithms depend on the cryptographic
10060 library that \*(UA uses.
10061 \*(OP Support for more cipher algorithms may be available through
10062 dynamic loading via, e.g.,
10063 .Xr EVP_get_cipherbyname 3
10064 (OpenSSL) if \*(UA has been compiled to support this.
10067 .It Va smime-crl-dir
10068 \*(OP Specifies a directory that contains files with CRLs in PEM format
10069 to use when verifying S/MIME messages.
10072 .It Va smime-crl-file
10073 \*(OP Specifies a file that contains a CRL in PEM format to use when
10074 verifying S/MIME messages.
10077 .It Va smime-encrypt-USER@HOST
10078 \*(OP If this variable is set, messages send to the given receiver are
10079 encrypted before sending.
10080 The value of the variable must be set to the name of a file that
10081 contains a certificate in PEM format.
10083 If a message is sent to multiple recipients,
10084 each of them for whom a corresponding variable is set will receive an
10085 individually encrypted message;
10086 other recipients will continue to receive the message in plain text
10087 unless the
10088 .Va smime-force-encryption
10089 variable is set.
10090 It is recommended to sign encrypted messages, i.e., to also set the
10091 .Va smime-sign
10092 variable.
10095 .It Va smime-force-encryption
10096 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
10099 .It Va smime-sign
10100 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
10101 and include the user's certificate as a MIME attachment.
10102 Signing a message enables a recipient to verify that the sender used
10103 a valid certificate,
10104 that the email addresses in the certificate match those in the message
10105 header and that the message content has not been altered.
10106 It does not change the message text,
10107 and people will be able to read the message as usual.
10108 Also see
10109 .Va smime-sign-cert , smime-sign-include-certs
10111 .Va smime-sign-message-digest .
10113 .Mx Va smime-sign-cert
10114 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
10115 \*(OP Points to a file in PEM format.
10116 For the purpose of signing and decryption this file needs to contain the
10117 user's private key, followed by his certificate.
10119 For message signing
10120 .Ql USER@HOST
10121 is always derived from the value of
10122 .Va from
10123 (or, if that contains multiple addresses,
10124 .Va sender ) .
10125 For the purpose of encryption the recipient's public encryption key
10126 (certificate) is expected; the command
10127 .Ic certsave
10128 can be used to save certificates of signed messages (the section
10129 .Sx "Signed and encrypted messages with S/MIME"
10130 gives some details).
10131 This mode of operation is usually driven by the specialized form.
10133 When decrypting messages the account is derived from the recipient
10134 fields
10135 .Pf ( Ql To:
10137 .Ql Cc: )
10138 of the message, which are searched for addresses for which such
10139 a variable is set.
10140 \*(UA always uses the first address that matches,
10141 so if the same message is sent to more than one of the user's addresses
10142 using different encryption keys, decryption might fail.
10144 For signing and decryption purposes it is possible to use encrypted
10145 keys, and the pseudo-host(s)
10146 .Ql USER@HOST.smime-cert-key
10147 for the private key
10148 (and
10149 .Ql USER@HOST.smime-cert-cert
10150 for the certificate stored in the same file)
10151 will be used for performing any necessary password lookup,
10152 therefore the lookup can be automatized via the mechanisms described in
10153 .Sx "On URL syntax and credential lookup" .
10154 For example, the hypothetical address
10155 .Ql bob@exam.ple
10156 could be driven with a private key / certificate pair path defined in
10157 .Va \&\&smime-sign-cert-bob@exam.ple ,
10158 and needed passwords would then be looked up via the pseudo hosts
10159 .Ql bob@exam.ple.smime-cert-key
10160 (and
10161 .Ql bob@exam.ple.smime-cert-cert ) .
10162 To include intermediate certificates, use
10163 .Va smime-sign-include-certs .
10165 .Mx Va smime-sign-include-certs
10166 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
10167 \*(OP If used, this is supposed to a consist of a comma-separated list
10168 of files, each of which containing a single certificate in PEM format to
10169 be included in the S/MIME message in addition to the
10170 .Va smime-sign-cert
10171 certificate.
10172 This can be used to include intermediate certificates of the certificate
10173 authority, in order to allow the receiver's S/MIME implementation to
10174 perform a verification of the entire certificate chain, starting from
10175 a local root certificate, over the intermediate certificates, down to the
10176 .Va smime-sign-cert .
10177 Even though top level certificates may also be included in the chain,
10178 they won't be used for the verification on the receiver's side.
10180 For the purpose of the mechanisms involved here,
10181 .Ql USER@HOST
10182 refers to the content of the internal variable
10183 .Va from
10184 (or, if that contains multiple addresses,
10185 .Va sender ) .
10186 The pseudo-host
10187 .Ql USER@HOST.smime-include-certs
10188 will be used for performing password lookups for these certificates,
10189 shall they have been given one, therefore the lookup can be automatized
10190 via the mechanisms described in
10191 .Sx "On URL syntax and credential lookup" .
10193 .Mx Va smime-sign-message-digest
10194 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
10195 \*(OP Specifies the message digest to use when signing S/MIME messages.
10196 RFC 5751 mandates a default of
10197 .Ql sha1 .
10198 Possible values are (case-insensitive and) in decreasing cipher strength:
10199 .Ql sha512 ,
10200 .Ql sha384 ,
10201 .Ql sha256 ,
10202 .Ql sha224
10204 .Ql md5 .
10206 The actually available message digest algorithms depend on the
10207 cryptographic library that \*(UA uses.
10208 \*(OP Support for more message digest algorithms may be available
10209 through dynamic loading via, e.g.,
10210 .Xr EVP_get_digestbyname 3
10211 (OpenSSL) if \*(UA has been compiled to support this.
10212 Remember that for this
10213 .Ql USER@HOST
10214 refers to the variable
10215 .Va from
10216 (or, if that contains multiple addresses,
10217 .Va sender ) .
10219 .It Va smtp
10220 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
10221 .Va mta .
10222 \*(ID For compatibility reasons a set
10223 .Va smtp
10224 is used in preference of
10225 .Va mta .
10227 .Mx Va smtp-auth
10228 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
10229 \*(OP Variable chain that controls the SMTP
10230 .Va mta
10231 authentication method, possible values are
10232 .Ql none
10233 (\*(OU default),
10234 .Ql plain
10235 (\*(IN default),
10236 .Ql login
10237 as well as the \*(OPal methods
10238 .Ql cram-md5
10240 .Ql gssapi .
10242 .Ql none
10243 method does not need any user credentials,
10244 .Ql gssapi
10245 requires a user name and all other methods require a user name and
10246 a password.
10247 See \*(IN
10248 .Va mta ,
10249 .Va user
10251 .Va password
10252 (\*(OU
10253 .Va smtp-auth-password
10255 .Va smtp-auth-user ) .
10256 Note that
10257 .Va smtp-auth-HOST
10258 is \*(IN.
10259 \*(OU: Note for
10260 .Va smtp-auth-USER@HOST :
10261 may override dependent on sender address in the variable
10262 .Va from .
10264 .It Va smtp-auth-password
10265 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
10266 If the authentication method requires a password, but neither
10267 .Va smtp-auth-password
10268 nor a matching
10269 .Va smtp-auth-password-USER@HOST
10270 can be found,
10271 \*(UA will ask for a password on the user's terminal.
10273 .It Va smtp-auth-password-USER@HOST
10274 \*(OU Overrides
10275 .Va smtp-auth-password
10276 for specific values of sender addresses, dependent upon the variable
10277 .Va from .
10279 .It Va smtp-auth-user
10280 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
10281 If the authentication method requires a user name, but neither
10282 .Va smtp-auth-user
10283 nor a matching
10284 .Va smtp-auth-user-USER@HOST
10285 can be found,
10286 \*(UA will ask for a user name on the user's terminal.
10288 .It Va smtp-auth-user-USER@HOST
10289 \*(OU Overrides
10290 .Va smtp-auth-user
10291 for specific values of sender addresses, dependent upon the variable
10292 .Va from .
10295 .It Va smtp-hostname
10296 \*(OP\*(IN Normally \*(UA uses the variable
10297 .Va from
10298 to derive the necessary
10299 .Ql USER@HOST
10300 information in order to issue a
10301 .Ql MAIL FROM:<>
10302 SMTP
10303 .Va mta
10304 command.
10305 Setting
10306 .Va smtp-hostname
10307 can be used to use the
10308 .Ql USER
10309 from the SMTP account
10310 .Pf ( Va mta
10311 or the
10312 .Va user
10313 variable chain)
10314 and the
10315 .Ql HOST
10316 from the content of this variable (or, if that is the empty string,
10317 .Va hostname
10318 or the local hostname as a last resort).
10319 This often allows using an address that is itself valid but hosted by
10320 a provider other than which (in
10321 .Va from )
10322 is about to send the message.
10323 Setting this variable also influences generated
10324 .Ql Message-ID:
10326 .Ql Content-ID:
10327 header fields.
10329 .Mx Va smtp-use-starttls
10330 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
10331 \*(BO\*(OP Causes \*(UA to issue a
10332 .Ql STARTTLS
10333 command to make an SMTP
10334 .Va mta
10335 session SSL/TLS encrypted, i.e., to enable transport layer security.
10339 .It Va spam-interface
10340 \*(OP In order to use any of the spam-related commands (like, e.g.,
10341 .Ic spamrate )
10342 the desired spam interface must be defined by setting this variable.
10343 Please refer to the manual section
10344 .Sx "Handling spam"
10345 for the complete picture of spam handling in \*(UA.
10346 All or none of the following interfaces may be available:
10348 .Bl -tag -width ".It Ql _ilte_"
10349 .It Ql spamc
10350 Interaction with
10351 .Xr spamc 1
10352 from the
10353 .Xr spamassassin 1
10354 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
10355 suite.
10356 Different to the generic filter interface \*(UA will automatically add
10357 the correct arguments for a given command and has the necessary
10358 knowledge to parse the program's output.
10359 A default value for
10360 .Va spamc-command
10361 will have been compiled into the \*(UA binary if
10362 .Xr spamc 1
10363 has been found in
10364 .Ev PATH
10365 during compilation.
10366 Shall it be necessary to define a specific connection type (rather than
10367 using a configuration file for that), the variable
10368 .Va spamc-arguments
10369 can be used as in, e.g.,
10370 .Ql -d server.example.com -p 783 .
10371 It is also possible to specify a per-user configuration via
10372 .Va spamc-user .
10373 Note that this interface does not inspect the
10374 .Ql is-spam
10375 flag of a message for the command
10376 .Ic spamforget .
10378 .It Ql filter
10379 generic spam filter support via freely configurable hooks.
10380 This interface is meant for programs like
10381 .Xr bogofilter 1
10382 and requires according behaviour in respect to the hooks' exit
10383 status for at least the command
10384 .Ic spamrate
10385 .Pf ( Ql 0
10386 meaning a message is spam,
10387 .Ql 1
10388 for non-spam,
10389 .Ql 2
10390 for unsure and any other return value indicating a hard error);
10391 since the hooks can include shell code snippets diverting behaviour
10392 can be intercepted as necessary.
10393 The hooks are
10394 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
10395   spamfilter-rate
10397 .Va spamfilter-spam ;
10398 the manual section
10399 .Sx "Handling spam"
10400 contains examples for some programs.
10401 The process environment of the hooks will have the variable
10402 .Ev MAILX_FILENAME_GENERATED
10403 set.
10404 Note that spam score support for
10405 .Ic spamrate
10406 is not supported unless the \*(OPtional regular expression support is
10407 available and the
10408 .Va spamfilter-rate-scanscore
10409 variable is set.
10414 .It Va spam-maxsize
10415 \*(OP Messages that exceed this size will not be passed through to the
10416 configured
10417 .Va spam-interface .
10418 If unset or 0, the default of 420000 bytes is used.
10421 .It Va spamc-command
10422 \*(OP The path to the
10423 .Xr spamc 1
10424 program for the
10425 .Ql spamc
10426 .Va spam-interface .
10427 Note that the path is not expanded, but used
10428 .Dq as is .
10429 A fallback path will have been compiled into the \*(UA binary if the
10430 executable had been found during compilation.
10433 .It Va spamc-arguments
10434 \*(OP Even though \*(UA deals with most arguments for the
10435 .Ql spamc
10436 .Va spam-interface
10437 automatically, it may at least sometimes be desirable to specify
10438 connection-related ones via this variable, e.g.,
10439 .Ql -d server.example.com -p 783 .
10442 .It Va spamc-user
10443 \*(OP Specify a username for per-user configuration files for the
10444 .Ql spamc
10445 .Va spam-interface .
10446 If this is set to the empty string then \*(UA will use the name of the
10447 current
10448 .Va user .
10455 .It Va spamfilter-ham , spamfilter-noham , \
10456   spamfilter-nospam , spamfilter-rate , spamfilter-spam
10457 \*(OP Command and argument hooks for the
10458 .Ql filter
10459 .Va spam-interface .
10460 The manual section
10461 .Sx "Handling spam"
10462 contains examples for some programs.
10465 .It Va spamfilter-rate-scanscore
10466 \*(OP Because of the generic nature of the
10467 .Ql filter
10468 .Va spam-interface
10469 spam scores are not supported for it by default, but if the \*(OPnal
10470 regular expression support is available then setting this variable can
10471 be used to overcome this restriction.
10472 It is interpreted as follows: first a number (digits) is parsed that
10473 must be followed by a semicolon
10474 .Ql \&;
10475 and an extended regular expression.
10476 Then the latter is used to parse the first output line of the
10477 .Va spamfilter-rate
10478 hook, and, in case the evaluation is successful, the group that has been
10479 specified via the number is interpreted as a floating point scan score.
10483 .It Va ssl-ca-dir , ssl-ca-file
10484 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10485 Enhanced Mail) format as a directory and a file, respectively, for the
10486 purpose of verification of SSL/TLS server certificates.
10487 It is possible to set both, the file will be loaded immediately, the
10488 directory will be searched whenever no match has yet been found.
10489 The set of CA certificates which are built into the SSL/TLS library can
10490 be explicitly turned off by setting
10491 .Va ssl-ca-no-defaults ,
10492 and further fine-tuning is possible via
10493 .Va ssl-ca-flags ;
10494 also see
10495 .Xr SSL_CTX_load_verify_locations 3
10496 for more information.
10497 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
10498 establishing TLS connections to servers identified with hostnames.
10502 .It Va ssl-ca-flags
10503 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10504 storage, and the certificate verification that is used (also see
10505 .Va ssl-verify ) .
10506 The value is expected to consist of a comma-separated list of
10507 configuration directives, with any intervening whitespace being ignored.
10508 The directives directly map to flags that can be passed to
10509 .Xr X509_STORE_set_flags 3 ,
10510 which are usually defined in a file
10511 .Pa openssl/x509_vfy.h ,
10512 and the availability of which depends on the used SSL/TLS library
10513 version: a directive without mapping is ignored (error log subject to
10514 .Va debug ) .
10515 Directives currently understood (case-insensitively) include:
10518 .Bl -tag -compact -width ".It Cd BaNg"
10519 .It Cd no-alt-chains
10520 If the initial chain is not trusted, do not attempt to build an
10521 alternative chain.
10522 Setting this flag will make OpenSSL certificate verification match that
10523 of older OpenSSL versions, before automatic building and checking of
10524 alternative chains has been implemented; also see
10525 .Cd trusted-first .
10526 .It Cd no-check-time
10527 Do not check certificate/CRL validity against current time.
10528 .It Cd partial-chain
10529 By default partial, incomplete chains which cannot be verified up to the
10530 chain top, a self-signed root certificate, will not verify.
10531 With this flag set, a chain succeeds to verify if at least one signing
10532 certificate of the chain is in any of the configured trusted stores of
10533 CA certificates.
10534 The OpenSSL manual page
10535 .Xr SSL_CTX_load_verify_locations 3
10536 gives some advise how to manage your own trusted store of CA certificates.
10537 .It Cd strict
10538 Disable workarounds for broken certificates.
10539 .It Cd trusted-first
10540 Try building a chain using issuers in the trusted store first to avoid
10541 problems with server-sent legacy intermediate certificates.
10542 Newer versions of OpenSSL support alternative chain checking and enable
10543 it by default, resulting in the same behaviour; also see
10544 .Cd no-alt-chains .
10549 .It Va ssl-ca-no-defaults
10550 \*(BO\*(OP Do not load the default CA locations that are built into the
10551 used to SSL/TLS library to verify SSL/TLS server certificates.
10553 .Mx Va ssl-cert
10554 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
10555 \*(OP Variable chain that sets the filename for a SSL/TLS client
10556 certificate required by some servers.
10557 This is a direct interface to the
10558 .Ql Certificate
10559 slot of the
10560 .Xr SSL_CONF_cmd 3
10561 function of the OpenSSL library, if available.
10563 .Mx Va ssl-cipher-list
10564 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
10565 \*(OP Specifies a list of ciphers for SSL/TLS connections.
10566 This is a direct interface to the
10567 .Ql CipherString
10568 slot of the
10569 .Xr SSL_CONF_cmd 3
10570 function of the OpenSSL library, if available; see
10571 .Xr ciphers 1
10573 .Xr SSL_CTX_set_cipher_list 3
10574 for more information.
10575 By default \*(UA does not set a list of ciphers, in effect using a
10576 .Va ssl-protocol
10577 specific cipher (protocol standards ship with a list of acceptable
10578 ciphers), possibly cramped to what the actually used SSL/TLS library
10579 supports \(en the manual section
10580 .Sx "An example configuration"
10581 also contains a SSL/TLS use case.
10584 .It Va ssl-config-file
10585 \*(OP If this variable is set \*(UA will call
10586 .Xr CONF_modules_load_file 3
10587 to allow OpenSSL to be configured according to the host system wide
10588 security settings.
10589 If a non-empty value is given then this will be used to specify the
10590 configuration file to be used instead of the global OpenSSL default;
10591 note that in this case it is an error if the file cannot be loaded.
10592 The application name will always be passed as
10593 .Dq \*(uA .
10595 .Mx Va ssl-curves
10596 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
10597 \*(OP Specifies a list of supported curves for SSL/TLS connections.
10598 This is a direct interface to the
10599 .Ql Curves
10600 slot of the
10601 .Xr SSL_CONF_cmd 3
10602 function of the OpenSSL library, if available; see
10603 .Xr SSL_CTX_set1_curves_list 3
10604 for more information.
10605 By default \*(UA does not set a list of curves.
10609 .It Va ssl-crl-dir , ssl-crl-file
10610 \*(OP Specify a directory / a file, respectively that contains a CRL in
10611 PEM format to use when verifying SSL/TLS server certificates.
10613 .Mx Va ssl-key
10614 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
10615 \*(OP Variable chain that sets the filename for the private key of
10616 a SSL/TLS client certificate.
10617 If unset, the name of the certificate file is used.
10618 The file is expected to be in PEM format.
10619 This is a direct interface to the
10620 .Ql PrivateKey
10621 slot of the
10622 .Xr SSL_CONF_cmd 3
10623 function of the OpenSSL library, if available.
10625 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
10626 \*(OB\*(OP Please use the newer and more flexible
10627 .Va ssl-protocol
10628 instead: if both values are set,
10629 .Va ssl-protocol
10630 will take precedence!
10631 Can be set to the following values, the actually used
10632 .Va ssl-protocol
10633 specification to which it is mapped is shown in parenthesis:
10634 .Ql tls1.2
10635 .Pf ( Ql -ALL, TLSv1.2 ) ,
10636 .Ql tls1.1
10637 .Pf ( Ql -ALL, TLSv1.1 ) ,
10638 .Ql tls1
10639 .Pf ( Ql -ALL, TLSv1 )
10641 .Ql ssl3
10642 .Pf ( Ql -ALL, SSLv3 ) ;
10643 the special value
10644 .Ql auto
10645 is mapped to
10646 .Ql ALL, -SSLv2
10647 and thus includes the SSLv3 protocol.
10648 Note that SSLv2 is no longer supported at all.
10650 .Mx Va ssl-protocol
10651 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
10652 \*(OP Specify the used SSL/TLS protocol.
10653 This is a direct interface to the
10654 .Ql Protocol
10655 slot of the
10656 .Xr SSL_CONF_cmd 3
10657 function of the OpenSSL library, if available;
10658 otherwise an \*(UA internal parser is used which understands the
10659 following subset of (case-insensitive) command strings:
10660 .Ql SSLv3 ,
10661 .Ql TLSv1 ,
10662 .Ql TLSv1.1
10664 .Ql TLSv1.2 ,
10665 as well as the special value
10666 .Ql ALL .
10667 Multiple specifications may be given via a comma-separated list which
10668 ignores any whitespace.
10669 An optional
10670 .Ql +
10671 plus sign prefix will enable a protocol, a
10672 .Ql -
10673 hyphen-minus prefix will disable it, so that
10674 .Ql -ALL, TLSv1.2
10675 will enable only the TLSv1.2 protocol.
10677 It depends upon the used TLS/SSL library which protocols are actually
10678 supported and which protocols are used if
10679 .Va ssl-protocol
10680 is not set, but note that SSLv2 is no longer supported at all and
10681 actively disabled.
10682 Especially for older protocols explicitly securing
10683 .Va ssl-cipher-list
10684 may be worthwile, see
10685 .Sx "An example configuration" .
10688 .It Va ssl-rand-egd
10689 \*(OP Gives the pathname to an entropy daemon socket, see
10690 .Xr RAND_egd 3 .
10691 Not all SSL/TLS libraries support this.
10694 .It Va ssl-rand-file
10695 \*(OP Gives the filename to a file with random entropy data, see
10696 .Xr RAND_load_file 3 .
10697 If this variable is not set, or set to the empty string, or if the
10698 .Sx "Filename transformations"
10699 fail, then
10700 .Xr RAND_file_name 3
10701 will be used to create the filename if, and only if,
10702 .Xr RAND_status 3
10703 documents that the SSL PRNG is not yet sufficiently seeded.
10704 If \*(UA successfully seeded the SSL PRNG then it will update the file
10705 .Pf ( Xr RAND_write_file 3 ) .
10706 This variable is only used if
10707 .Va ssl-rand-egd
10708 is not set (or not supported by the SSL/TLS library).
10710 .Mx Va ssl-verify
10711 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
10712 \*(OP Variable chain that sets the action to be performed if an error
10713 occurs during SSL/TLS server certificate validation against the
10714 specified or default trust stores
10715 .Va ssl-ca-dir ,
10716 .Va ssl-ca-file ,
10717 or the SSL/TLS library built-in defaults (unless usage disallowed via
10718 .Va ssl-ca-no-defaults ) ,
10719 and as fine-tuned via
10720 .Va ssl-ca-flags .
10721 Valid (case-insensitive) values are
10722 .Ql strict
10723 (fail and close connection immediately),
10724 .Ql ask
10725 (ask whether to continue on standard input),
10726 .Ql warn
10727 (show a warning and continue),
10728 .Ql ignore
10729 (do not perform validation).
10730 The default is
10731 .Ql ask .
10734 .It Va stealthmua
10735 If only set without an assigned value, then this setting inhibits the
10736 generation of the
10737 .Ql Message-ID: ,
10738 .Ql Content-ID:
10740 .Ql User-Agent:
10741 header fields that include obvious references to \*(UA.
10742 There are two pitfalls associated with this:
10743 First, the message id of outgoing messages is not known anymore.
10744 Second, an expert may still use the remaining information in the header
10745 to track down the originating mail user agent.
10746 If set to the value
10747 .Ql noagent ,
10748 then the mentioned
10749 .Ql Message-ID:
10751 .Ql Content-ID:
10752 suppression does not occur.
10756 .It Va termcap
10757 (\*(OP) This specifies a comma-separated list of
10758 .Lb libterminfo
10759 and/or
10760 .Lb libtermcap
10761 capabilities (see
10762 .Sx "On terminal control and line editor" ,
10763 escape commas with reverse solidus) to be used to overwrite or define
10764 entries.
10765 .Sy Note
10766 this variable will only be queried once at program startup and can
10767 thus only be specified in resource files or on the command line.
10770 String capabilities form
10771 .Ql cap=value
10772 pairs and are expected unless noted otherwise.
10773 Numerics have to be notated as
10774 .Ql cap#number
10775 where the number is expected in normal decimal notation.
10776 Finally, booleans do not have any value but indicate a true or false
10777 state simply by being defined or not; this indeed means that \*(UA
10778 does not support undefining an existing boolean.
10779 String capability values will undergo some expansions before use:
10780 for one notations like
10781 .Ql ^LETTER
10782 stand for
10783 .Ql control-LETTER ,
10784 and for clarification purposes
10785 .Ql \eE
10786 can be used to specify
10787 .Ql escape
10788 (the control notation
10789 .Ql ^[
10790 could lead to misreadings when a left bracket follows, which it does for
10791 the standard CSI sequence);
10792 finally three letter octal sequences, as in
10793 .Ql \e061 ,
10794 are supported.
10795 To specify that a terminal supports 256-colours, and to define sequences
10796 that home the cursor and produce an audible bell, one might write:
10798 .Bd -literal -offset indent
10799 set termcap='Co#256,home=\eE[H,bel=^G'
10803 The following terminal capabilities are or may be meaningful for the
10804 operation of the built-in line editor or \*(UA in general:
10807 .Bl -tag -compact -width ".It Cd yay"
10808 .\" HAVE_COLOUR
10809 .It Cd colors Ns \0or Cd Co
10810 .Cd max_colors :
10811 numeric capability specifying the maximum number of colours.
10812 Note that \*(UA does not actually care about the terminal beside that,
10813 but always emits ANSI / ISO 6429 escape sequences.
10815 .\" HAVE_TERMCAP
10816 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
10817 .Cd exit_ca_mode
10819 .Cd enter_ca_mode ,
10820 respectively: exit and enter the alternative screen ca-mode,
10821 effectively turning \*(UA into a fullscreen application.
10822 This must be enabled explicitly by setting
10823 .Va termcap-ca-mode .
10825 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
10826 .Cd keypad_xmit
10828 .Cd keypad_local ,
10829 respectively: enable and disable the keypad.
10830 This is always enabled if available, because it seems even keyboards
10831 without keypads generate other key codes for, e.g., cursor keys in that
10832 case, and only if enabled we see the codes that we are interested in.
10834 .It Cd ed Ns \0or Cd cd
10835 .Cd clr_eos :
10836 clear the screen.
10838 .It Cd clear Ns \0or Cd cl
10839 .Cd clear_screen :
10840 clear the screen and home cursor.
10841 (Will be simulated via
10842 .Cd ho
10843 plus
10844 .Cd cd . )
10846 .It Cd home Ns \0or Cd ho
10847 .Cd cursor_home :
10848 home cursor.
10850 .\" HAVE_MLE
10851 .It Cd el Ns \0or Cd ce
10852 .Cd clr_eol :
10853 clear to the end of line.
10854 (Will be simulated via
10855 .Cd ch
10856 plus repetitions of space characters.)
10858 .It Cd hpa Ns \0or Cd ch
10859 .Cd column_address :
10860 move the cursor (to the given column parameter) in the current row.
10861 (Will be simulated via
10862 .Cd cr
10863 plus
10864 .Cd nd . )
10866 .It Cd cr
10867 .Cd carriage_return :
10868 move to the first column in the current row.
10869 The default built-in fallback is
10870 .Ql \er .
10872 .It Cd cub1 Ns \0or Cd le
10873 .Cd cursor_left :
10874 move the cursor left one space (non-destructively).
10875 The default built-in fallback is
10876 .Ql \eb .
10878 .It Cd cuf1 Ns \0or Cd nd
10879 .Cd cursor_right :
10880 move the cursor right one space (non-destructively).
10881 The default built-in fallback is
10882 .Ql \eE[C ,
10883 which is used by most terminals.
10884 Less often occur
10885 .Ql \eEC
10887 .Ql \eEOC .
10891 Many more capabilities which describe key-sequences are documented for
10892 .Ic bind .
10896 .It Va termcap-ca-mode
10897 \*(OP Allow usage of the
10898 .Cd exit_ca_mode
10900 .Cd enter_ca_mode
10901 terminal capabilities, effectively turning \*(UA into a fullscreen
10902 application, as documented for
10903 .Va termcap .
10904 .Sy Note
10905 this variable will only be queried once at program startup and can
10906 thus only be specified in resource files or on the command line.
10909 .It Va termcap-disable
10910 \*(OP Disable any interaction with a terminal control library.
10911 If set only some generic fallback built-ins and possibly the content of
10912 .Va termcap
10913 describe the terminal to \*(UA.
10914 .Sy Note
10915 this variable will only be queried once at program startup and can
10916 thus only be specified in resource files or on the command line.
10919 .It Va toplines
10920 If defined, gives the number of lines of a message to be displayed
10921 with the command
10922 .Ic top ;
10923 if unset, the first five lines are printed, if set to 0 the variable
10924 .Va screen
10925 is inspected.
10926 If the value is negative then its absolute value will be used for
10927 unsigned right shifting (see
10928 .Ic vexpr )
10930 .Va screen
10931 height.
10934 .It Va topsqueeze
10935 \*(BO If set then the
10936 .Ic top
10937 command series will strip adjacent empty lines and quotations.
10940 .It Va ttycharset
10941 The character set of the terminal \*(UA operates on,
10942 and the one and only supported character set that \*(UA can use if no
10943 character set conversion capabilities have been compiled into it,
10944 in which case it defaults to ISO-8859-1 unless it can deduce a value
10945 from the locale specified in the
10946 .Ev LC_CTYPE
10947 environment variable (if supported, see there for more).
10948 It defaults to UTF-8 if conversion is available.
10949 Refer to the section
10950 .Sx "Character sets"
10951 for the complete picture about character sets.
10954 .It Va typescript-mode
10955 \*(BO A special multiplex variable that disables all variables and
10956 settings which result in behaviour that interferes with running \*(UA in
10957 .Xr script 1 ,
10958 e.g., it sets
10959 .Va colour-disable ,
10960 .Va line-editor-disable
10961 and (before startup completed only)
10962 .Va termcap-disable .
10963 Unsetting it does not restore the former state of the covered settings.
10966 .It Va umask
10967 For a safety-by-default policy \*(UA sets its process
10968 .Xr umask 2
10970 .Ql 0077 ,
10971 but this variable can be used to override that:
10972 set it to an empty value to do not change the (current) setting,
10973 otherwise the process file mode creation mask is updated to the new value.
10974 Child processes inherit the process file mode creation mask.
10976 .Mx Va user
10977 .It Va user-HOST , user
10978 \*(IN Variable chain that sets a global fallback user name, which is
10979 used in case none has been given in the protocol and account-specific
10980 URL.
10981 This variable defaults to the name of the user who runs \*(UA.
10984 .It Va v15-compat
10985 \*(BO Setting this enables upward compatibility with \*(UA
10986 version 15.0 in respect to which configuration options are available and
10987 how they are handled.
10988 This manual uses \*(IN and \*(OU to refer to the new and the old way of
10989 doing things, respectively.
10992 .It Va verbose
10993 \*(BO This setting, also controllable via the command line option
10994 .Fl v ,
10995 causes \*(UA to be more verbose, e.g., it will display obsoletion
10996 warnings and SSL/TLS certificate chains.
10997 Even though marked \*(BO this option may be set twice in order to
10998 increase the level of verbosity even more, in which case even details of
10999 the actual message delivery and protocol conversations are shown.
11000 A single
11001 .Pf no Va verbose
11002 is sufficient to disable verbosity as such.
11009 .It Va version , version-date , version-major , version-minor , version-update
11010 \*(RO \*(UA version information: the first variable contains a string
11011 containing the complete version identification, the latter three contain
11012 only digits: the major, minor and update version numbers.
11013 The date is in ISO 8601 notation.
11014 The output of the command
11015 .Ic version
11016 will include this information.
11019 .It Va writebackedited
11020 If this variable is set messages modified using the
11021 .Ic edit
11023 .Ic visual
11024 commands are written back to the current folder when it is quit;
11025 it is only honoured for writable folders in MBOX format, though.
11026 Note that the editor will be pointed to the raw message content in that
11027 case, i.e., neither MIME decoding nor decryption will have been
11028 performed, and proper RFC 4155
11029 .Ql From_
11030 quoting of newly added or edited content is also left as an excercise to
11031 the user.
11033 .\" }}} (Variables)
11034 .\" }}} (INTERNAL VARIABLES)
11037 .\" .Sh ENVIRONMENT {{{
11038 .Sh ENVIRONMENT
11040 The term
11041 .Dq environment variable
11042 should be considered an indication that these variables are either
11043 standardized as vivid parts of process environments, or that they are
11044 commonly found in there.
11045 The process environment is inherited from the
11046 .Xr sh 1
11047 once \*(UA is started, and unless otherwise explicitly noted handling of
11048 the following variables transparently integrates into that of the
11049 .Sx "INTERNAL VARIABLES"
11050 from \*(UA's point of view.
11051 This means that, e.g., they can be managed via
11052 .Ic set
11054 .Ic unset ,
11055 causing automatic program environment updates (to be inherited by
11056 newly created child processes).
11059 In order to transparently integrate other environment variables equally
11060 they need to be imported (linked) with the command
11061 .Ic environ .
11062 This command can also be used to set and unset non-integrated
11063 environment variables from scratch, sufficient system support provided.
11064 The following example, applicable to a POSIX shell, sets the
11065 .Ev COLUMNS
11066 environment variable for \*(UA only, and beforehand exports the
11067 .Ev EDITOR
11068 in order to affect any further processing in the running shell:
11070 .Bd -literal -offset indent
11071 $ EDITOR="vim -u ${HOME}/.vimrc"
11072 $ export EDITOR
11073 $ COLUMNS=80 \*(uA -R
11076 .Bl -tag -width ".It Ev BaNg"
11078 .It Ev COLUMNS
11079 The user's preferred width in column positions for the terminal screen
11080 or window.
11081 Queried and used once on program startup, actively managed for child
11082 processes and the MLE (see
11083 .Sx "On terminal control and line editor" )
11084 in interactive mode thereafter.
11085 Ignored in non-interactive mode, which always uses 80 columns.
11088 .It Ev DEAD
11089 The name of the (mailbox)
11090 .Ic file
11091 to use for saving aborted messages if
11092 .Va save
11093 is set; this defaults to
11094 .Pa dead.letter
11095 in the user's
11096 .Ev HOME
11097 directory.
11098 If the variable
11099 .Va debug
11100 is set no output will be generated, otherwise the contents of the file
11101 will be replaced.
11104 .It Ev EDITOR
11105 Pathname of the text editor to use in the
11106 .Ic edit
11107 command and
11108 .Ic ~e
11109 .Sx "COMMAND ESCAPES" .
11110 A default editor is used if this value is not defined.
11113 .It Ev HOME
11114 The user's home directory.
11115 This variable is only used when it resides in the process environment.
11120 .It Ev LC_ALL , LC_CTYPE , LANG
11121 \*(OP The (names in lookup order of the)
11122 .Xr locale 7
11123 (and / or see
11124 .Xr setlocale 3 )
11125 which indicates the used
11126 .Sx "Character sets" .
11127 Runtime changes trigger automatic updates of the entire locale system,
11128 updating and overwriting also a
11129 .Va ttycharset
11130 set by the user.
11133 .It Ev LINES
11134 The user's preferred number of lines on a page or the vertical screen
11135 or window size in lines.
11136 Queried and used once on program startup, actively managed for child
11137 processes in interactive mode thereafter.
11138 Ignored in non-interactive mode, which always uses 24 lines.
11141 .It Ev LISTER
11142 Pathname of the directory lister to use in the
11143 .Ic folders
11144 command when operating on local mailboxes.
11145 Default is
11146 .Xr ls 1
11147 (path search through
11148 .Ev SHELL ) .
11151 .It Ev LOGNAME
11152 Upon startup \*(UA will actively ensure that this variable refers to the
11153 name of the user who runs \*(UA, in order to be able to pass a verified
11154 name to any newly created child process.
11157 .It Ev MAIL
11158 Is used as the users
11159 .Mx -sx
11160 .Sx "primary system mailbox"
11161 unless
11162 .Va inbox
11163 is set.
11164 This is assumed to be an absolute pathname.
11167 .It Ev MAILCAPS
11168 \*(OP Overrides the default path search for
11169 .Sx "The Mailcap files" ,
11170 which is defined in the standard RFC 1524 as
11171 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
11172 .\" TODO we should have a mailcaps-default virtual RDONLY option!
11173 (\*(UA makes it a configuration option, however.)
11174 Note this is not a search path, but a path search.
11177 .It Ev MAILRC
11178 Is used as a startup file instead of
11179 .Pa \*(ur
11180 if set.
11181 When \*(UA scripts are invoked on behalf of other users,
11182 either this variable should be set to
11183 .Pa /dev/null
11184 or the
11185 .Fl \&:
11186 command line option should be used in order to avoid side-effects from
11187 reading their configuration files.
11188 This variable is only used when it resides in the process environment.
11191 .It Ev MAILX_NO_SYSTEM_RC
11192 If this variable is set then reading of
11193 .Pa \*(UR
11194 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
11195 had been started up with the option
11196 .Fl \&:
11197 (and according argument) or
11198 .Fl n .
11199 This variable is only used when it resides in the process environment.
11202 .It Ev MBOX
11203 The name of the users
11204 .Mx -sx
11205 .Sx "secondary mailbox"
11206 file.
11207 A logical subset of the special
11208 .Sx "Filename transformations"
11209 (also see
11210 .Ic file )
11211 are supported.
11212 The default is
11213 .Pa ~/mbox .
11214 Traditionally this MBOX is used as the file to save messages from the
11215 .Mx -sx
11216 .Sx "primary system mailbox"
11217 that have been read.
11218 Also see
11219 .Sx "Message states" .
11222 .It Ev NETRC
11223 \*(IN\*(OP This variable overrides the default location of the user's
11224 .Pa ~/.netrc
11225 file.
11228 .It Ev PAGER
11229 Pathname of the program to use for backing the command
11230 .Ic more ,
11231 and when the
11232 .Va crt
11233 variable enforces usage of a pager for output.
11234 The default paginator is
11235 .Xr more 1
11236 (path search through
11237 .Ev SHELL ) .
11239 \*(UA inspects the contents of this variable: if its contains the string
11240 .Dq less
11241 then a non-existing environment variable
11242 .Va LESS
11243 will be set to
11244 .Ql FRXi ,
11245 .Ql FRi
11247 .Ql Ri ,
11248 dependent on whether terminal control support is available and whether
11249 that supports full (alternative) screen mode or not (also see
11250 .Sx "On terminal control and line editor" ) .
11251 Likewise for
11252 .Dq lv
11253 .Va LV
11254 will optionally be set to
11255 .Dq -c .
11256 Alse see
11257 .Va colour-pager .
11260 .It Ev PATH
11261 A colon-separated list of directories that is searched by the shell when
11262 looking for commands, e.g.,
11263 .Ql /bin:/usr/bin:/usr/local/bin .
11266 .It Ev POSIXLY_CORRECT
11267 This variable is automatically looked for upon startup, see
11268 .Va posix
11269 for more.
11272 .It Ev SHELL
11273 The shell to use for the commands
11274 .Ic \&! ,
11275 .Ic shell ,
11277 .Ic ~!
11278 .Sx "COMMAND ESCAPES"
11279 and when starting subprocesses.
11280 A default shell is used if this environment variable is not defined.
11283 .It Ev SOURCE_DATE_EPOCH
11284 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
11285 used in place of the current time.
11286 This variable is looked up upon program startup, and its existence will
11287 switch \*(UA to a completely reproducible mode which causes
11288 deterministic random numbers, a special fixed (non-existent?)
11289 .Ev LOGNAME
11290 and more to be used and set.
11291 It is to be used during development or by software packagers.
11292 \*(ID Currently an invalid setting is only ignored, rather than causing
11293 a program abortion.
11295 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
11298 .It Ev TERM
11299 \*(OP The terminal type for which output is to be prepared.
11300 For extended colour and font control please refer to
11301 .Sx "Coloured display" ,
11302 and for terminal management in general to
11303 .Sx "On terminal control and line editor" .
11306 .It Ev TMPDIR
11307 Used as directory for temporary files instead of
11308 .Pa /tmp ,
11309 if set.
11310 This variable is only used when it resides in the process environment,
11311 but \*(UA will ensure at startup that this environment variable is
11312 updated to contain a usable temporary directory.
11315 .It Ev USER
11316 Identical to
11317 .Ev LOGNAME
11318 (see there), but this variable is not standardized, should therefore not
11319 be used, and is only corrected if already set.
11322 .It Ev VISUAL
11323 Pathname of the text editor to use in the
11324 .Ic visual
11325 command and
11326 .Ic ~v
11327 .Sx "COMMAND ESCAPES" .
11329 .\" }}}
11332 .\" .Sh FILES {{{
11333 .Sh FILES
11335 .Bl -tag -width ".It Pa BaNg"
11336 .It Pa \*(ur
11337 File giving initial commands.
11339 .It Pa \*(UR
11340 System wide initialization file.
11343 .It Pa ~/.mailcap
11344 \*(OP Personal MIME type handler definition file, see
11345 .Sx "The Mailcap files" .
11346 This location is part of the RFC 1524 standard search path, which is
11347 a configuration option and can be overridden via
11348 .Ev MAILCAPS .
11351 .It Pa /etc/mailcap
11352 \*(OP System wide MIME type handler definition file, see
11353 .Sx "The Mailcap files" .
11354 This location is part of the RFC 1524 standard search path, which is
11355 a configuration option and can be overridden via
11358 .It Pa ~/mbox
11359 The default value for
11360 .Ev MBOX .
11361 The actually used path is a configuration option.
11364 .It Pa ~/.mime.types
11365 Personal MIME types, see
11366 .Sx "The mime.types files" .
11367 The actually used path is a configuration option.
11370 .It Pa /etc/mime.types
11371 System wide MIME types, see
11372 .Sx "The mime.types files" .
11373 The actually used path is a configuration option.
11376 .It Pa ~/.netrc
11377 \*(IN\*(OP The default location of the users
11378 .Pa .netrc
11379 file \(en the section
11380 .Sx "The .netrc file"
11381 documents the file format.
11382 The actually used path is a configuration option and can be overridden via
11383 .Ev NETRC .
11386 .It Pa /dev/null
11387 The data sink
11388 .Xr null 4 .
11389 The actually used path is a compile-time constant.
11392 .\" .Ss "The mime.types files" {{{
11393 .Ss "The mime.types files"
11395 As stated in
11396 .Sx "HTML mail and MIME attachments"
11397 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
11398 media types in order to classify message and attachment content.
11399 One source for them are
11400 .Pa mime.types
11401 files, the loading of which can be controlled by setting the variable
11402 .Va mimetypes-load-control .
11403 Another is the command
11404 .Ic mimetype ,
11405 which also offers access to \*(UAs MIME type cache.
11406 .Pa mime.types
11407 files have the following syntax:
11409 .Bd -literal -offset indent
11410 type/subtype extension [extension ...]
11411 # E.g., text/html html htm
11415 where
11416 .Ql type/subtype
11417 define the MIME media type, as standardized in RFC 2046:
11418 .Ql type
11419 is used to declare the general type of data, while the
11420 .Ql subtype
11421 specifies a specific format for that type of data.
11422 One or multiple filename
11423 .Ql extension Ns
11424 s, separated by whitespace, can be bound to the media type format.
11425 Comments may be introduced anywhere on a line with a number sign
11426 .Ql # ,
11427 causing the remaining line to be discarded.
11429 \*(UA also supports an extended, non-portable syntax in especially
11430 crafted files, which can be loaded via the alternative value syntax of
11431 .Va mimetypes-load-control ,
11432 and prepends an optional
11433 .Ql type-marker :
11436 .Dl [type-marker ]type/subtype extension [extension ...]
11439 The following type markers are supported:
11442 .Bl -tag -compact -width ".It Ar _n_u"
11443 .It Ar @
11444 Treat message parts with this content as plain text.
11445 .It Ar @t
11446 The same as plain
11447 .Ar @ .
11448 .It Ar @h
11449 Treat message parts with this content as HTML tagsoup.
11450 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
11451 the content as plain text instead.
11452 .It Ar @H
11453 Likewise
11454 .Ar @h ,
11455 but instead of falling back to plain text require an explicit content
11456 handler to be defined.
11460 Further reading:
11461 for sending messages:
11462 .Ic mimetype ,
11463 .Va mime-allow-text-controls ,
11464 .Va mimetypes-load-control .
11465 For reading etc. messages:
11466 .Sx "HTML mail and MIME attachments" ,
11467 .Sx "The Mailcap files" ,
11468 .Ic mimetype ,
11469 .Va mime-counter-evidence ,
11470 .Va mimetypes-load-control ,
11471 .Va pipe-TYPE/SUBTYPE ,
11472 .Va pipe-EXTENSION .
11473 .\" }}}
11475 .\" .Ss "The Mailcap files" {{{
11476 .Ss "The Mailcap files"
11478 .\" TODO MAILCAP DISABLED
11479 .Sy This feature is not available in v14.9.0, sorry!
11480 RFC 1524 defines a
11481 .Dq User Agent Configuration Mechanism
11482 which \*(UA \*(OPally supports (see
11483 .Sx "HTML mail and MIME attachments" ) .
11484 It defines a file format to be used to inform mail user agent programs
11485 about the locally-installed facilities for handling various data
11486 formats, i.e., about commands and how they can be used to display, edit
11487 et cetera MIME part contents, as well as a default path search that
11488 includes multiple possible locations of
11489 .Dq mailcap
11490 files and the
11491 .Ev MAILCAPS
11492 environment variable that can be used to overwrite that (repeating here
11493 that it is not a search path, but instead a path search specification).
11494 Any existing files will be loaded in sequence, appending any content to
11495 the list of MIME type handler directives.
11498 .Dq Mailcap
11499 files consist of a set of newline separated entries.
11500 Comment lines start with a number sign
11501 .Ql #
11502 (in the first column!) and are ignored.
11503 Empty lines are also ignored.
11504 All other lines form individual entries that must adhere to the syntax
11505 described below.
11506 To extend a single entry (not comment) its line can be continued on
11507 follow lines if newline characters are
11508 .Dq escaped
11509 by preceding them with the reverse solidus character
11510 .Ql \e .
11511 The standard does not specify how leading whitespace of follow lines
11512 is to be treated, therefore \*(UA retains it.
11515 .Dq Mailcap
11516 entries consist of a number of semicolon
11517 .Ql \&;
11518 separated fields, and the reverse solidus
11519 .Ql \e
11520 character can be used to escape any following character including
11521 semicolon and itself.
11522 The first two fields are mandatory and must occur in the specified
11523 order, the remaining fields are optional and may appear in any order.
11524 Leading and trailing whitespace of content is ignored (removed).
11527 The first field defines the MIME
11528 .Ql TYPE/SUBTYPE
11529 the entry is about to handle (case-insensitively, and no reverse solidus
11530 escaping is possible in this field).
11531 If the subtype is specified as an asterisk
11532 .Ql *
11533 the entry is meant to match all subtypes of the named type, e.g.,
11534 .Ql audio/*
11535 would match any audio type.
11536 The second field defines the shell command which shall be used to
11537 .Dq display
11538 MIME parts of the given type; it is implicitly called the
11539 .Cd view
11540 command.
11543 For data
11544 .Dq consuming
11545 shell commands message (MIME part) data is passed via standard input
11546 unless the given shell command includes one or more instances of the
11547 (unquoted) string
11548 .Ql %s ,
11549 in which case these instances will be replaced with a temporary filename
11550 and the data will have been stored in the file that is being pointed to.
11551 Likewise, for data
11552 .Dq producing
11553 shell commands data is assumed to be generated on standard output unless
11554 the given command includes (one ore multiple)
11555 .Ql %s .
11556 In any case any given
11557 .Ql %s
11558 format is replaced with a(n already) properly quoted filename.
11559 Note that when a command makes use of a temporary file via
11560 .Ql %s
11561 then \*(UA will remove it again, as if the
11562 .Cd x-mailx-tmpfile ,
11563 .Cd x-mailx-tmpfile-fill
11565 .Cd x-mailx-tmpfile-unlink
11566 flags had been set; see below for more.
11569 The optional fields either define a shell command or an attribute (flag)
11570 value, the latter being a single word and the former being a keyword
11571 naming the field followed by an equals sign
11572 .Ql =
11573 succeeded by a shell command, and as usual for any
11574 .Dq Mailcap
11575 content any whitespace surrounding the equals sign will be removed, too.
11576 Optional fields include the following:
11579 .Bl -tag -width ".It Cd BaNg"
11580 .It Cd compose
11581 A program that can be used to compose a new body or body part in the
11582 given format.
11583 (Currently unused.)
11585 .It Cd composetyped
11586 Similar to the
11587 .Cd compose
11588 field, but is to be used when the composing program needs to specify the
11589 .Ql Content-type:
11590 header field to be applied to the composed data.
11591 (Currently unused.)
11593 .It Cd edit
11594 A program that can be used to edit a body or body part in the given
11595 format.
11596 (Currently unused.)
11598 .It Cd print
11599 A program that can be used to print a message or body part in the given
11600 format.
11601 (Currently unused.)
11603 .It Cd test
11604 Specifies a program to be run to test some condition, e.g., the machine
11605 architecture, or the window system in use, to determine whether or not
11606 this mailcap entry applies.
11607 If the test fails, a subsequent mailcap entry should be sought; also see
11608 .Cd x-mailx-test-once .
11611 .It Cd needsterminal
11612 This flag field indicates that the given shell command must be run on
11613 an interactive terminal.
11614 \*(UA will temporarily release the terminal to the given command in
11615 interactive mode, in non-interactive mode this entry will be entirely
11616 ignored; this flag implies
11617 .Cd x-mailx-noquote .
11620 .It Cd copiousoutput
11621 A flag field which indicates that the output of the
11622 .Cd view
11623 command will be an extended stream of textual output that can be
11624 (re)integrated into \*(UA's normal visual display.
11625 It is mutually exclusive with
11626 .Cd needsterminal .
11628 .It Cd textualnewlines
11629 A flag field which indicates that this type of data is line-oriented and
11630 that, if encoded in
11631 .Ql base64 ,
11632 all newlines should be converted to canonical form (CRLF) before
11633 encoding, and will be in that form after decoding.
11634 (Currently unused.)
11636 .It Cd nametemplate
11637 This field gives a filename format, in which
11638 .Ql %s
11639 will be replaced by a random string, the joined combination of which
11640 will be used as the filename denoted by
11641 .Ev MAILX_FILENAME_TEMPORARY .
11642 One could specify that a GIF file being passed to an image viewer should
11643 have a name ending in
11644 .Ql .gif
11645 by using
11646 .Ql nametemplate=%s.gif .
11647 Note that \*(UA ignores the name template unless that solely specifies
11648 a filename suffix that consists of (ASCII) alphabetic and numeric
11649 characters, the underscore and dot only.
11651 .It Cd x11-bitmap
11652 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
11653 icon to be used to visually denote the presence of this kind of data.
11654 This field is not used by \*(UA.
11656 .It Cd description
11657 A textual description that describes this type of data.
11660 .It Cd x-mailx-even-if-not-interactive
11661 An extension flag test field \(em by default handlers without
11662 .Cd copiousoutput
11663 are entirely ignored in non-interactive mode, but if this flag is set
11664 then their use will be considered.
11665 It is an error if this flag is set for commands that use the flag
11666 .Cd needsterminal .
11669 .It Cd x-mailx-noquote
11670 An extension flag field that indicates that even a
11671 .Cd copiousoutput
11672 .Cd view
11673 command shall not be used to generate message quotes
11674 (as it would be by default).
11677 .It Cd x-mailx-async
11678 Extension flag field that denotes that the given
11679 .Cd view
11680 command shall be executed asynchronously, without blocking \*(UA.
11681 Cannot be used in conjunction with
11682 .Cd needsterminal .
11685 .It Cd x-mailx-test-once
11686 Extension flag which denotes whether the given
11687 .Cd test
11688 command shall be evaluated once only and the (boolean) result be cached.
11689 This is handy if some global unchanging condition is to be queried, like
11690 .Dq running under the X Window System .
11693 .It Cd x-mailx-tmpfile
11694 Extension flag field that requests creation of a zero-sized temporary
11695 file, the name of which is to be placed in the environment variable
11696 .Ev MAILX_FILENAME_TEMPORARY .
11697 It is an error to use this flag with commands that include a
11698 .Ql %s
11699 format.
11702 .It Cd x-mailx-tmpfile-fill
11703 Normally the MIME part content is passed to the handler via standard
11704 input; if this flag is set then the data will instead be written into
11705 the implied
11706 .Cd x-mailx-tmpfile .
11707 In order to cause deletion of the temporary file you will have to set
11708 .Cd x-mailx-tmpfile-unlink
11709 explicitly!
11710 It is an error to use this flag with commands that include a
11711 .Ql %s
11712 format.
11715 .It Cd x-mailx-tmpfile-unlink
11716 Extension flag field that requests that the temporary file shall be
11717 deleted automatically when the command loop is entered again at latest.
11718 (Do not use this for asynchronous handlers.)
11719 It is an error to use this flag with commands that include a
11720 .Ql %s
11721 format, or in conjunction with
11722 .Cd x-mailx-async ,
11723 or without also setting
11724 .Cd x-mailx-tmpfile
11726 .Cd x-mailx-tmpfile-fill .
11729 .It Cd x-mailx-tmpfile-keep
11730 Using the string
11731 .Ql %s
11732 implies the three tmpfile related flags above, but if you want, e.g.,
11733 .Cd x-mailx-async
11734 and deal with the temporary file yourself, you can add in this flag to
11735 forcefully ignore
11736 .Cd x-mailx-tmpfile-unlink .
11741 The standard includes the possibility to define any number of additional
11742 entry fields, prefixed by
11743 .Ql x- .
11744 Flag fields apply to the entire
11745 .Dq Mailcap
11746 entry \(em in some unusual cases, this may not be desirable, but
11747 differentiation can be accomplished via separate entries, taking
11748 advantage of the fact that subsequent entries are searched if an earlier
11749 one does not provide enough information.
11750 E.g., if a
11751 .Cd view
11752 command needs to specify the
11753 .Cd needsterminal
11754 flag, but the
11755 .Cd compose
11756 command shall not, the following will help out the latter (with enabled
11757 .Va debug
11758 or an increased
11759 .Va verbose
11760 level \*(UA will show information about handler evaluation):
11762 .Bd -literal -offset indent
11763 application/postscript; ps-to-terminal %s; needsterminal
11764 application/postscript; ps-to-terminal %s; compose=idraw %s
11768 In fields any occurrence of the format string
11769 .Ql %t
11770 will be replaced by the
11771 .Ql TYPE/SUBTYPE
11772 specification.
11773 Named parameters from the
11774 .Ql Content-type:
11775 field may be placed in the command execution line using
11776 .Ql %{
11777 followed by the parameter name and a closing
11778 .Ql }
11779 character.
11780 The entire parameter should appear as a single command line argument,
11781 regardless of embedded spaces; thus:
11783 .Bd -literal -offset indent
11784 # Message
11785 Content-type:  multipart/mixed; boundary=42
11787 # Mailcap file
11788 multipart/*; /usr/local/bin/showmulti \e
11789   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
11791 # Executed shell command
11792 /usr/local/bin/showmulti multipart/mixed 42
11796 .\" TODO v15: Mailcap: %n,%F
11797 Note that \*(UA does not support handlers for multipart MIME parts as
11798 shown in this example (as of today).
11799 \*(UA does not support the additional formats
11800 .Ql %n
11802 .Ql %F .
11803 An example file, also showing how to properly deal with the expansion of
11804 .Ql %s ,
11805 which includes any quotes that are necessary to make it a valid shell
11806 argument by itself and thus will cause undesired behaviour when placed
11807 in additional user-provided quotes:
11809 .Bd -literal -offset indent
11810 # Comment line
11811 text/richtext; richtext %s; copiousoutput
11813 text/x-perl; perl -cWT %s
11815 application/pdf; \e
11816   infile=%s\e; \e
11817     trap "rm -f ${infile}" EXIT\e; \e
11818     trap "exit 75" INT QUIT TERM\e; \e
11819     mupdf %s; \e
11820   x-mailx-async; x-mailx-tmpfile-keep
11822 application/*; echo "This is \e"%t\e" but \e
11823     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
11824   copiousoutput; x-mailx-noquote
11828 Further reading:
11829 .Sx "HTML mail and MIME attachments" ,
11830 .Sx "The mime.types files" ,
11831 .Ic mimetype ,
11832 .Ev MAILCAPS ,
11833 .Va mime-counter-evidence ,
11834 .Va pipe-TYPE/SUBTYPE ,
11835 .Va pipe-EXTENSION .
11836 .\" }}}
11838 .\" .Ss "The .netrc file" {{{
11839 .Ss "The .netrc file"
11842 .Pa .netrc
11843 file contains user credentials for machine accounts.
11844 The default location in the user's
11845 .Ev HOME
11846 directory may be overridden by the
11847 .Ev NETRC
11848 environment variable.
11849 The file consists of space, tabulator or newline separated tokens.
11850 \*(UA implements a parser that supports a superset of the original BSD
11851 syntax, but users should nonetheless be aware of portability glitches
11852 of that file format, shall their
11853 .Pa .netrc
11854 be usable across multiple programs and platforms:
11857 .Bl -bullet -compact
11859 BSD does not support single, but only double quotation marks, e.g.,
11860 .Ql password="pass with spaces" .
11862 BSD (only?) supports escaping of single characters via a reverse solidus
11863 (e.g., a space can be escaped via
11864 .Ql \e\0 ) ,
11865 in- as well as outside of a quoted string.
11867 BSD does not require a final quotation mark of the last user input token.
11869 The original BSD (Berknet) parser also supported a format which allowed
11870 tokens to be separated with commas \(en whereas at least Hewlett-Packard
11871 still seems to support this syntax, \*(UA does not!
11873 As a non-portable extension some widely-used programs support
11874 shell-style comments: if an input line starts, after any amount of
11875 whitespace, with a number sign
11876 .Ql # ,
11877 then the rest of the line is ignored.
11879 Whereas other programs may require that the
11880 .Pa .netrc
11881 file is accessible by only the user if it contains a
11882 .Cd password
11883 token for any other
11884 .Cd login
11885 than
11886 .Dq anonymous ,
11887 \*(UA will always require these strict permissions.
11891 Of the following list of supported tokens \*(UA only uses (and caches)
11892 .Cd machine ,
11893 .Cd login
11895 .Cd password .
11896 At runtime the command
11897 .Ic netrc
11898 can be used to control \*(UA's
11899 .Pa .netrc
11900 cache.
11902 .Bl -tag -width ".It Cd BaNg"
11903 .It Cd machine Ar name
11904 The hostname of the entries' machine, lowercase-normalized by \*(UA
11905 before use.
11906 Any further file content, until either end-of-file or the occurrence
11907 of another
11908 .Cd machine
11909 or a
11910 .Cd default
11911 first-class token is bound (only related) to the machine
11912 .Ar name .
11914 As an extension that should not be the cause of any worries
11915 \*(UA supports a single wildcard prefix for
11916 .Ar name :
11917 .Bd -literal -offset indent
11918 machine *.example.com login USER password PASS
11919 machine pop3.example.com login USER password PASS
11920 machine smtp.example.com login USER password PASS
11923 which would match
11924 .Ql xy.example.com
11925 as well as
11926 .Ql pop3.example.com ,
11927 but neither
11928 .Ql example.com
11930 .Ql local.smtp.example.com .
11931 Note that in the example neither
11932 .Ql pop3.example.com
11934 .Ql smtp.example.com
11935 will be matched by the wildcard, since the exact matches take
11936 precedence (it is however faster to specify it the other way around).
11938 .It Cd default
11939 This is the same as
11940 .Cd machine
11941 except that it is a fallback entry that is used shall none of the
11942 specified machines match; only one default token may be specified,
11943 and it must be the last first-class token.
11945 .It Cd login Ar name
11946 The user name on the remote machine.
11948 .It Cd password Ar string
11949 The user's password on the remote machine.
11951 .It Cd account Ar string
11952 Supply an additional account password.
11953 This is merely for FTP purposes.
11955 .It Cd macdef Ar name
11956 Define a macro.
11957 A macro is defined with the specified
11958 .Ar name ;
11959 it is formed from all lines beginning with the next line and continuing
11960 until a blank line is (consecutive newline characters are) encountered.
11961 (Note that
11962 .Cd macdef
11963 entries cannot be utilized by multiple machines, too, but must be
11964 defined following the
11965 .Ic machine
11966 they are intended to be used with.)
11967 If a macro named
11968 .Ar init
11969 exists, it is automatically run as the last step of the login process.
11970 This is merely for FTP purposes.
11972 .\" }}}
11974 .\" }}}
11977 .\" .Sh EXAMPLES {{{
11978 .Sh EXAMPLES
11980 .\" .Ss "An example configuration" {{{
11981 .Ss "An example configuration"
11983 .Bd -literal -offset indent
11984 # This example assumes v15.0 compatibility mode
11985 set v15-compat
11987 # Request strict transport security checks!
11988 set ssl-verify=strict
11990 # Where are the up-to-date SSL certificates?
11991 # (Since we manage up-to-date ones explicitly, do not use any,
11992 # possibly outdated, default certificates shipped with OpenSSL)
11993 #set ssl-ca-dir=/etc/ssl/certs
11994 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
11995 set ssl-ca-no-defaults
11996 #set ssl-ca-flags=partial-chain
11997 wysh set smime-ca-file="${ssl-ca-file}" \e
11998   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
12000 # Do not use protocols older than TLS v1.2.
12001 # Change this only when the remote server does not support it:
12002 # maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
12003 # such explicit exceptions, then, e.g.
12004 #   set ssl-protocol-exam.ple='-ALL,+TLSv1.1'
12005 set ssl-protocol='-ALL,+TLSv1.2'
12007 # Explicitly define the list of ciphers, which may improve security,
12008 # especially with protocols older than TLS v1.2.  See ciphers(1).
12009 # Including "@STRENGTH" will sort the final list by algorithm strength.
12010 # In reality it is possibly best to only use ssl-cipher-list-HOST
12011 # (or -USER@HOST), as necessary, again..
12012 set ssl-cipher-list=TLSv1.2:!aNULL:!eNULL:@STRENGTH
12013 # - TLSv1.2:!aNULL:!eNULL:\e
12014 #     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
12015 #     DHE-RSA-AES256-SHA:@STRENGTH
12016 # -ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH
12017 # Especially with TLSv1.3 curves selection may be desired:
12018 #set ssl-curves=P-521:P-384:P-256
12020 # Essential setting: select allowed character sets
12021 set sendcharsets=utf-8,iso-8859-1
12023 # A very kind option: when replying to a message, first try to
12024 # use the same encoding that the original poster used herself!
12025 set reply-in-same-charset
12027 # When replying, do not merge From: and To: of the original message
12028 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
12029 set recipients-in-cc
12031 # When sending messages, wait until the Mail-Transfer-Agent finishs.
12032 # Only like this you will be able to see errors reported through the
12033 # exit status of the MTA (including the built-in SMTP one)!
12034 set sendwait
12036 # Only use built-in MIME types, no mime.types(5) files
12037 set mimetypes-load-control
12039 # Default directory where we act in (relative to $HOME)
12040 set folder=mail
12041 # A leading "+" (often) means: under *folder*
12042 # *record* is used to save copies of sent messages
12043 set MBOX=+mbox.mbox DEAD=+dead.txt \e
12044   record=+sent.mbox record-files record-resent
12046 # Make "file mymbox" and "file myrec" go to..
12047 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
12049 # Not really optional, e.g., for S/MIME
12050 set from='Your Name <address@exam.ple>'
12052 # It may be necessary to set hostname and/or smtp-hostname
12053 # if the "SERVER" of mta and "domain" of from do not match.
12054 # The `urlencode' command can be used to encode USER and PASS
12055 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
12056   smtp-auth=login/plain... \e
12057   smtp-use-starttls
12059 # Never refuse to start into interactive mode, and more
12060 set emptystart \e
12061   colour-pager crt= \e
12062   followup-to followup-to-honour=ask-yes \e
12063   history-file=+.\*(uAhist history-size=-1 history-gabby \e
12064   mime-counter-evidence=0xE \e
12065   prompt='?\e?!\e![\e${account}#\e${mailbox-display}]? ' \e
12066   reply-to-honour=ask-yes \e
12067   umask=
12069 # Only include the selected header fields when typing messages
12070 headerpick type retain from_ date from to cc subject \e
12071   message-id mail-followup-to reply-to
12072 # ...when forwarding messages
12073 headerpick forward retain subject date from to cc
12074 # ...when saving message, etc.
12075 #headerpick save ignore ^Original-.*$ ^X-.*$
12077 # Some mailing lists
12078 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
12079 mlsubscribe '^xfans@xfans\e.xyz$'
12081 # Handle a few file extensions (to store MBOX databases)
12082 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
12083   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
12084   zst 'zstd -dc' 'zstd -19 -zc' \e
12085   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
12087 # A real life example of a very huge free mail provider
12088 # Instead of directly placing content inside `account',
12089 # we `define' a macro: like that we can switch "accounts"
12090 # from within *on-compose-splice*, for example!
12091 define XooglX {
12092   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
12093   set from='Your Name <address@examp.ple>'
12094   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
12096 account XooglX {
12097   \ecall XooglX
12100 # Here is a pretty large one which does not allow sending mails
12101 # if there is a domain name mismatch on the SMTP protocol level,
12102 # which would bite us if the value of from does not match, e.g.,
12103 # for people who have a sXXXXeforge project and want to speak
12104 # with the mailing list under their project account (in from),
12105 # still sending the message through their normal mail provider
12106 define XandeX {
12107   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12108   set from='Your Name <address@exam.ple>'
12109   set mta=smtps://USER:PASS@smtp.yaXXex.ru:465 \e
12110     hostname=yaXXex.com smtp-hostname=
12112 account XandeX {
12113   \ecall Xandex
12116 # Create some new commands so that, e.g., `ls /tmp' will..
12117 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
12118 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
12120 # We do not support gpg(1) directly yet.  But simple --clearsign'd
12121 # message parts can be dealt with as follows:
12122 define V {
12123   localopts yes
12124   wysh set pipe-text/plain=$'@*#++=@\e
12125     < "${MAILX_FILENAME_TEMPORARY}" awk \e
12126         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
12127       BEGIN{done=0}\e
12128       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
12129         if(done++ != 0)\e
12130           next;\e
12131         print "--- GPG --verify ---";\e
12132         system("gpg --verify " TMPFILE " 2>&1");\e
12133         print "--- GPG --verify ---";\e
12134         print "";\e
12135         next;\e
12136       }\e
12137       /^-----BEGIN PGP SIGNATURE-----/,\e
12138           /^-----END PGP SIGNATURE-----/{\e
12139         next;\e
12140       }\e
12141       {print}\e
12142     \e''
12143     print
12145 commandalias V '\e'call V
12149 When storing passwords in
12150 .Pa \*(ur
12151 appropriate permissions should be set on this file with
12152 .Ql $ chmod 0600 \*(ur .
12153 If the \*(OPal
12154 .Va netrc-lookup
12155 is available user credentials can be stored in the central
12156 .Pa .netrc
12157 file instead; e.g., here is a different version of the example account
12158 that sets up SMTP and POP3:
12160 .Bd -literal -offset indent
12161 define XandeX {
12162   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12163   set from='Your Name <address@exam.ple>'
12164   set netrc-lookup
12165   # Load an encrypted ~/.netrc by uncommenting the next line
12166   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
12168   set mta=smtps://smtp.yXXXXx.ru:465 \e
12169       smtp-hostname= hostname=yXXXXx.com
12170   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
12171   commandalias xp fi pop3s://pop.yXXXXx.ru
12173 account XandeX {
12174   \ecall XandeX
12179 and, in the
12180 .Pa .netrc
12181 file:
12183 .Bd -literal -offset indent
12184 machine *.yXXXXx.ru login USER password PASS
12188 This configuration should now work just fine:
12191 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
12192 .\" }}}
12194 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
12195 .Ss "Signed and encrypted messages with S/MIME"
12197 \*(OP S/MIME provides two central mechanisms:
12198 message signing and message encryption.
12199 A signed message contains some data in addition to the regular text.
12200 The data can be used to verify that the message was sent using a valid
12201 certificate, that the sender's address in the message header matches
12202 that in the certificate, and that the message text has not been altered.
12203 Signing a message does not change its regular text;
12204 it can be read regardless of whether the recipient's software is able to
12205 handle S/MIME.
12208 It is thus usually possible to sign all outgoing messages if so desired.
12209 Encryption, in contrast, makes the message text invisible for all people
12210 except those who have access to the secret decryption key.
12211 To encrypt a message, the specific recipient's public encryption key
12212 must be known.
12213 It is therefore not possible to send encrypted mail to people unless their
12214 key has been retrieved from either previous communication or public key
12215 directories.
12216 A message should always be signed before it is encrypted.
12217 Otherwise, it is still possible that the encrypted message text is
12218 altered.
12221 A central concept to S/MIME is that of the certification authority (CA).
12222 A CA is a trusted institution that issues certificates.
12223 For each of these certificates it can be verified that it really
12224 originates from the CA, provided that the CA's own certificate is
12225 previously known.
12226 A set of CA certificates is usually delivered with OpenSSL and installed
12227 on your system.
12228 If you trust the source of your OpenSSL software installation,
12229 this offers reasonable security for S/MIME on the Internet.
12230 Otherwise set
12231 .Va smime-ca-no-defaults
12232 to avoid using the default certificate and point
12233 .Va smime-ca-file
12234 and/or
12235 .Va smime-ca-dir
12236 to a trusted pool of certificates.
12237 In general, a certificate cannot be more secure than the method its CA
12238 certificate has been retrieved with.
12241 The first thing you need for participating in S/MIME message exchange is
12242 your personal certificate, including a private key.
12243 The certificate contains public information, in particular your name and
12244 your email address(es), and the public key that is used by others to
12245 encrypt messages for you,
12246 and to verify signed messages they supposedly received from you.
12247 The certificate is included in each signed message you send.
12248 The private key must be kept secret.
12249 It is used to decrypt messages that were previously encrypted with your
12250 public key, and to sign messages.
12253 For personal use it is recommended that you get a S/MIME certificate
12254 from one of the major CAs on the Internet using your WWW browser.
12255 Many CAs offer such certificates for free.
12256 There is also
12257 .Lk https://www.CAcert.org
12258 which issues client and server certificates to members of their
12259 community for free; their root certificate
12260 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
12261 is often not in the default set of trusted CA root certificates, though,
12262 which means you will have to download their root certificate separately
12263 and ensure it is part of our S/MIME certificate validation chain by
12264 including it in
12265 .Va smime-ca-dir
12266 or as a vivid member of the
12267 .Va smime-ca-file .
12268 But let us take a step-by-step tour on how to setup S/MIME with
12269 a certificate from CAcert.org despite this situation!
12272 First of all you will have to become a member of the CAcert.org
12273 community, simply by registrating yourself via the web interface.
12274 Once you are, create and verify all email addresses you want to be able
12275 to create signed and encrypted messages for/with using the corresponding
12276 entries of the web interface.
12277 Now ready to create S/MIME certificates, so let us create a new
12278 .Dq client certificate ,
12279 ensure to include all email addresses that should be covered by the
12280 certificate in the following web form, and also to use your name as the
12281 .Dq common name .
12284 Create a private key and a certificate request on your local computer
12285 (please see the manual pages of the used commands for more in-depth
12286 knowledge on what the used arguments etc. do):
12289 .Dl openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
12292 Afterwards copy-and-paste the content of
12293 .Dq creq.pem
12294 into the certificate-request (CSR) field of the web form on the
12295 CAcert.org website (you may need to unfold some
12296 .Dq advanced options
12297 to see the corresponding text field).
12298 This last step will ensure that your private key (which never left your
12299 box) and the certificate belong together (through the public key that
12300 will find its way into the certificate via the certificate-request).
12301 You are now ready and can create your CAcert certified certificate.
12302 Download and store or copy-and-paste it as
12303 .Dq pub.crt .
12306 Yay.
12307 In order to use your new S/MIME setup a combined private key/public key
12308 (certificate) file has to be created:
12311 .Dl cat key.pem pub.crt > ME@HERE.com.paired
12314 This is the file \*(UA will work with.
12315 If you have created your private key with a passphrase then \*(UA will
12316 ask you for it whenever a message is signed or decrypted.
12317 Set the following variables to henceforth use S/MIME (setting
12318 .Va smime-ca-file
12319 is of interest for verification only):
12321 .Bd -literal -offset indent
12322 set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
12323   smime-sign-cert=ME@HERE.com.paired \e
12324   smime-sign-message-digest=SHA256 \e
12325   smime-sign
12329 From each signed message you send, the recipient can fetch your
12330 certificate and use it to send encrypted mail back to you.
12331 Accordingly if somebody sends you a signed message, you can do the same,
12332 and use the
12333 .Ic verify
12334 command to check the validity of the certificate.
12337 Variables of interest for S/MIME signing:
12338 .Va smime-ca-dir ,
12339 .Va smime-ca-file ,
12340 .Va smime-ca-flags ,
12341 .Va smime-ca-no-defaults ,
12342 .Va smime-crl-dir ,
12343 .Va smime-crl-file ,
12344 .Va smime-sign ,
12345 .Va smime-sign-cert ,
12346 .Va smime-sign-include-certs
12348 .Va smime-sign-message-digest .
12351 After it has been verified save the certificate via
12352 .Ic certsave
12353 and tell \*(UA that it should use it for encryption for further
12354 communication with that somebody:
12356 .Bd -literal -offset indent
12357 certsave FILENAME
12358 set smime-encrypt-USER@HOST=FILENAME \e
12359     smime-cipher-USER@HOST=AES256
12363 Additional variables of interest for S/MIME en- and decryption:
12364 .Va smime-cipher
12366 .Va smime-encrypt-USER@HOST .
12369 You should carefully consider if you prefer to store encrypted messages
12370 in decrypted form.
12371 If you do, anybody who has access to your mail folders can read them,
12372 but if you do not, you might be unable to read them yourself later if
12373 you happen to lose your private key.
12375 .Ic decrypt
12376 command saves messages in decrypted form, while the
12377 .Ic save , copy ,
12379 .Ic move
12380 commands leave them encrypted.
12383 Note that neither S/MIME signing nor encryption applies to message
12384 subjects or other header fields yet.
12385 Thus they may not contain sensitive information for encrypted messages,
12386 and cannot be trusted even if the message content has been verified.
12387 When sending signed messages,
12388 it is recommended to repeat any important header information in the
12389 message text.
12390 .\" }}}
12392 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
12393 .Ss "Using CRLs with S/MIME or SSL/TLS"
12395 \*(OP Certification authorities (CAs) issue certificate revocation
12396 lists (CRLs) on a regular basis.
12397 These lists contain the serial numbers of certificates that have been
12398 declared invalid after they have been issued.
12399 Such usually happens because the private key for the certificate has
12400 been compromised,
12401 because the owner of the certificate has left the organization that is
12402 mentioned in the certificate, etc.
12403 To seriously use S/MIME or SSL/TLS verification,
12404 an up-to-date CRL is required for each trusted CA.
12405 There is otherwise no method to distinguish between valid and
12406 invalidated certificates.
12407 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
12408 the Internet, so they have to be retrieved by some external mechanism.
12411 \*(UA accepts CRLs in PEM format only;
12412 CRLs in DER format must be converted, like, e.\|g.:
12415 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
12418 To tell \*(UA about the CRLs, a directory that contains all CRL files
12419 (and no other files) must be created.
12421 .Va smime-crl-dir
12423 .Va ssl-crl-dir
12424 variables, respectively, must then be set to point to that directory.
12425 After that, \*(UA requires a CRL to be present for each CA that is used
12426 to verify a certificate.
12427 .\" }}}
12429 .\" .Ss "Handling spam" {{{
12430 .Ss "Handling spam"
12432 \*(OP \*(UA can make use of several spam interfaces for the purpose of
12433 identification of, and, in general, dealing with spam messages.
12434 A precondition of most commands in order to function is that the
12435 .Va spam-interface
12436 variable is set to one of the supported interfaces.
12437 Once messages have been identified as spam their (volatile)
12438 .Ql is-spam
12439 state can be prompted: the
12440 .Ql Ar :s
12442 .Ql Ar :S
12443 message specifications will address respective messages and their
12444 .Va attrlist
12445 entries will be used when displaying the
12446 .Va headline
12447 in the header display.
12449 .Bl -bullet
12451 .Ic spamrate
12452 rates the given messages and sets their
12453 .Ql is-spam
12454 flag accordingly.
12455 If the spam interface offers spam scores those can also be displayed in
12456 the header display by including the
12457 .Ql %$
12458 format in the
12459 .Va headline
12460 variable.
12462 .Ic spamham ,
12463 .Ic spamspam
12465 .Ic spamforget
12466 will interact with the Bayesian filter of the chosen interface and learn
12467 the given messages as
12468 .Dq ham
12470 .Dq spam ,
12471 respectively; the last command can be used to cause
12472 .Dq unlearning
12473 of messages; it adheres to their current
12474 .Ql is-spam
12475 state and thus reverts previous teachings.
12477 .Ic spamclear
12479 .Ic spamset
12480 will simply set and clear, respectively, the mentioned volatile
12481 .Ql is-spam
12482 message flag, without any interface interaction.
12487 .Xr spamassassin 1
12488 based
12489 .Va spam-interface
12490 .Ql spamc
12491 requires a running instance of the
12492 .Xr spamd 1
12493 server in order to function, started with the option
12494 .Fl -allow-tell
12495 shall Bayesian filter learning be possible.
12497 .Bd -literal -offset indent
12498 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
12499 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
12500     --daemonize [--local] [--allow-tell]
12504 Thereafter \*(UA can make use of these interfaces:
12506 .Bd -literal -offset indent
12507 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
12508     -Sspamc-command=/usr/local/bin/spamc \e
12509     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
12511 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
12512     -Sspamc-command=/usr/local/bin/spamc \e
12513     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
12517 Using the generic filter approach allows usage of programs like
12518 .Xr bogofilter 1 .
12519 Here is an example, requiring it to be accessible via
12520 .Ev PATH :
12522 .Bd -literal -offset indent
12523 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
12524     -Sspamfilter-ham="bogofilter -n" \e
12525     -Sspamfilter-noham="bogofilter -N" \e
12526     -Sspamfilter-nospam="bogofilter -S" \e
12527     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
12528     -Sspamfilter-spam="bogofilter -s" \e
12529     -Sspamfilter-rate-scanscore="1;^(.+)$"
12533 Because messages must exist on local storage in order to be scored (or
12534 used for Bayesian filter training), it is possibly a good idea to
12535 perform the local spam check last:
12537 .Bd -literal -offset indent
12538 define spamdelhook {
12539   # Server side DCC
12540   spamset (header x-dcc-brand-metrics "bulk")
12541   # Server-side spamassassin(1)
12542   spamset (header x-spam-flag "YES")
12543   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
12544   move :S +maybe-spam
12545   spamrate :u
12546   del :s
12547   move :S +maybe-spam
12549 set folder-hook-FOLDER=spamdelhook
12553 See also the documentation for the variables
12554 .Va spam-interface , spam-maxsize ,
12555 .Va spamc-command , spamc-arguments , spamc-user ,
12556 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
12557   spamfilter-rate
12559 .Va spamfilter-rate-scanscore .
12560 .\" }}}
12561 .\" }}} (Examples)
12564 .\" .Sh "FAQ" {{{
12565 .Sh "FAQ"
12567 In general it is a good idea to turn on
12568 .Va debug
12569 .Pf ( Fl d )
12570 and / or
12571 .Va verbose
12572 .Pf ( Fl v ,
12573 twice) if something does not work well.
12574 Very often a diagnostic message can be produced that leads to the
12575 problems' solution.
12577 .\" .Ss "\*(UA shortly hangs on startup" {{{
12578 .Ss "\*(UA shortly hangs on startup"
12580 This can have two reasons, one is the necessity to wait for a file lock
12581 and cannot be helped, the other being that \*(UA calls the function
12582 .Xr uname 2
12583 in order to query the nodename of the box (sometimes the real one is
12584 needed instead of the one represented by the internal variable
12585 .Va hostname ) .
12586 One may have varying success by ensuring that the real hostname and
12587 .Ql localhost
12588 have entries in
12589 .Pa /etc/hosts ,
12590 or, more generally, that the name service is properly setup \(en
12591 and does
12592 .Xr hostname 1
12593 return the expected value?
12594 Does this local hostname have a domain suffix?
12595 RFC 6762 standardized the link-local top-level domain
12596 .Ql .local ,
12597 try again after adding an (additional) entry with this extension.
12598 .\" }}}
12600 .\" .Ss "I cannot login to Google mail aka GMail" {{{
12601 .Ss "I cannot login to Google mail aka GMail"
12603 Since 2014 some free service providers classify programs as
12604 .Dq less secure
12605 unless they use a special authentification method (OAuth 2.0) which
12606 was not standardized for non-HTTP protocol authentication token query
12607 until August 2015 (RFC 7628).
12610 Different to Kerberos / GSSAPI, which is developed since the mid of the
12611 1980s, where a user can easily create a local authentication ticket for
12612 her- and himself with the locally installed
12613 .Xr kinit 1
12614 program, that protocol has no such local part but instead requires
12615 a world-wide-web query to create or fetch a token; since there is no
12616 local cache this query would have to be performed whenever \*(UA is
12617 invoked (in interactive sessions situation may differ).
12620 \*(UA does not support OAuth.
12621 Because of this it is necessary to declare \*(UA a
12622 .Dq less secure app
12623 (on the providers account web page) in order to read and send mail.
12624 However, it also seems possible to take the following steps instead:
12627 .Bl -enum -compact
12629 give the provider the number of a mobile phone,
12631 enable
12632 .Dq 2-Step Verification ,
12634 create an application specific password (16 characters), and
12636 use that special password instead of the real Google account password in
12637 \*(UA (for more on that see the section
12638 .Sx "On URL syntax and credential lookup" ) .
12640 .\" }}}
12642 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
12643 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
12645 It can happen that the terminal library (see
12646 .Sx "On terminal control and line editor",
12647 .Ic bind ,
12648 .Va termcap )
12649 reports different codes than the terminal really sends, in which case
12650 \*(UA will tell that a key binding is functional, but will not be able to
12651 recognize it because the received data does not match anything expected.
12653 .Va verbose
12654 listing of
12655 .Ic bind Ns
12656 ings will show the byte sequences that are expected.
12659 To overcome the situation, use, e.g., the program
12660 .Xr cat 1 ,
12661 in conjunction with the command line option
12662 .Fl \&\&v ,
12663 if available, to see the byte sequences which are actually produced
12664 by keypresses, and use the variable
12665 .Va termcap
12666 to make \*(UA aware of them.
12667 E.g., the terminal this is typed on produces some false sequences, here
12668 an example showing the shifted home key:
12670 .Bd -literal -offset indent
12671 ? set verbose
12672 ? bind*
12673 # 1B 5B=[ 31=1 3B=; 32=2 48=H
12674   bind base :kHOM z0
12675 ? x
12676 $ cat -v
12677 ^[[H
12678 ? \*(uA -v -Stermcap='kHOM=\eE[H'
12679 ? bind*
12680 # 1B 5B=[ 48=H
12681   bind base :kHOM z0
12683 .\" }}}
12684 .\" }}}
12687 .\" .Sh "IMAP CLIENT" {{{
12688 .Sh "IMAP CLIENT"
12690 \*(OPally there is IMAP client support available.
12691 This part of the program is obsolete and will vanish in v15 with the
12692 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
12693 and makes excessive use of signal based long code jumps.
12694 Support can hopefully be readded later based on a new-style I/O, with
12695 SysV signal handling.
12696 In fact the IMAP support had already been removed from the codebase, but
12697 was reinstantiated on user demand: in effect the IMAP code is at the
12698 level of \*(UA v14.8.16 (with
12699 .Ic imapcodec
12700 being the sole exception), and should be treated with some care.
12703 IMAP uses the
12704 .Ql imap://
12706 .Ql imaps://
12707 protocol prefixes, and an IMAP-based
12708 .Va folder
12709 may be used.
12710 IMAP URLs (paths) undergo inspections and possible transformations
12711 before use (and the command
12712 .Ic imapcodec
12713 can be used to manually apply them to any given argument).
12714 Hierarchy delimiters are normalized, a step which is configurable via the
12715 .Va imap-delim
12716 variable chain, but defaults to the first seen delimiter otherwise.
12717 \*(UA supports internationalised IMAP names, and en- and decodes the
12718 names from and to the
12719 .Va ttycharset
12720 as necessary and possible.
12721 If a mailbox name is expanded (see
12722 .Sx "Filename transformations" )
12723 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
12724 mailboxes below the
12725 .Va folder
12726 target box, while folder names prefixed by `@' refer to folders below
12727 the hierarchy base.
12730 Note: some IMAP servers do not accept the creation of mailboxes in
12731 the hierarchy base, but require that they are created as subfolders of
12732 `INBOX' \(en with such servers a folder name of the form
12734 .Dl imaps://mylogin@imap.myisp.example/INBOX.
12736 should be used (the last character is the server's hierarchy
12737 delimiter).
12738 The following IMAP-specific commands exist:
12741 .Bl -tag -width ".It Ic BaNg"
12743 .It Ic cache
12744 Only applicable to cached IMAP mailboxes;
12745 takes a message list and reads the specified messages into the IMAP
12746 cache.
12749 .It Ic connect
12750 If operating in disconnected mode on an IMAP mailbox,
12751 switch to online mode and connect to the mail server while retaining
12752 the mailbox status.
12753 See the description of the
12754 .Va disconnected
12755 variable for more information.
12758 .It Ic disconnect
12759 If operating in online mode on an IMAP mailbox,
12760 switch to disconnected mode while retaining the mailbox status.
12761 See the description of the
12762 .Va disconnected
12763 variable for more.
12764 A list of messages may optionally be given as argument;
12765 the respective messages are then read into the cache before the
12766 connection is closed, thus
12767 .Ql disco *
12768 makes the entire mailbox available for disconnected use.
12771 .It Ic imap
12772 Sends command strings directly to the current IMAP server.
12773 \*(UA operates always in IMAP `selected state' on the current mailbox;
12774 commands that change this will produce undesirable results and should be
12775 avoided.
12776 Useful IMAP commands are:
12777 .Bl -tag -offset indent -width ".Ic getquotearoot"
12778 .It create
12779 Takes the name of an IMAP mailbox as an argument and creates it.
12780 .It getquotaroot
12781 (RFC 2087) Takes the name of an IMAP mailbox as an argument
12782 and prints the quotas that apply to the mailbox.
12783 Not all IMAP servers support this command.
12784 .It namespace
12785 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
12786 the Other User's Namespaces and the Shared Namespaces.
12787 Each namespace type is printed in parentheses;
12788 if there are multiple namespaces of the same type,
12789 inner parentheses separate them.
12790 For each namespace a prefix and a hierarchy separator is listed.
12791 Not all IMAP servers support this command.
12795 .It Ic imapcodec
12796 Perform IMAP path transformations.
12797 Supports
12798 .Cm vput
12799 (see
12800 .Sx "Command modifiers" ) ,
12801 and manages the error number
12802 .Va \&! .
12803 The first argument specifies the operation:
12804 .Ar e[ncode]
12805 normalizes hierarchy delimiters (see
12806 .Va imap-delim )
12807 and converts the strings from the locale
12808 .Va ttycharset
12809 to the internationalized variant used by IMAP,
12810 .Ar d[ecode]
12811 performs the reverse operation.
12816 The following IMAP-specific internal variables exist:
12819 .Bl -tag -width ".It Va BaNg"
12821 .It Va disconnected
12822 \*(BO When an IMAP mailbox is selected and this variable is set,
12823 no connection to the server is initiated.
12824 Instead, data is obtained from the local cache (see
12825 .Va imap-cache Ns
12827 Mailboxes that are not present in the cache
12828 and messages that have not yet entirely been fetched from the server
12829 are not available;
12830 to fetch all messages in a mailbox at once,
12831 the command
12832 .No ` Ns Li copy * /dev/null Ns '
12833 can be used while still in connected mode.
12834 Changes that are made to IMAP mailboxes in disconnected mode are queued
12835 and committed later when a connection to that server is made.
12836 This procedure is not completely reliable since it cannot be guaranteed
12837 that the IMAP unique identifiers (UIDs) on the server still match the
12838 ones in the cache at that time.
12839 Data is saved to
12840 .Ev DEAD
12841 when this problem occurs.
12843 .It Va disconnected-USER@HOST
12844 The specified account is handled as described for the
12845 .Va disconnected
12846 variable above,
12847 but other accounts are not affected.
12849 .Mx Va imap-auth
12850 .It Va imap-auth-USER@HOST , imap-auth
12851 Sets the IMAP authentication method.
12852 Valid values are `login' for the usual password-based authentication
12853 (the default),
12854 `cram-md5', which is a password-based authentication that does not send
12855 the password over the network in clear text,
12856 and `gssapi' for GSS-API based authentication.
12859 .It Va imap-cache
12860 Enables caching of IMAP mailboxes.
12861 The value of this variable must point to a directory that is either
12862 existent or can be created by \*(UA.
12863 All contents of the cache can be deleted by \*(UA at any time;
12864 it is not safe to make assumptions about them.
12866 .Mx Va imap-delim
12867 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
12868 The hierarchy separator used by the IMAP server.
12869 Whenever an IMAP path is specified it will undergo normalization.
12870 One of the normalization steps is the squeezing and adjustment of
12871 hierarchy separators.
12872 If this variable is set, any occurrence of any character of the given
12873 value that exists in the path will be replaced by the first member of
12874 the value; an empty value will cause the default to be used, it is
12875 .Ql /. .
12876 If not set, we will reuse the first hierarchy separator character that
12877 is discovered in a user-given mailbox name.
12879 .Mx Va imap-keepalive
12880 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
12881 IMAP servers may close the connection after a period of
12882 inactivity; the standard requires this to be at least 30 minutes,
12883 but practical experience may vary.
12884 Setting this variable to a numeric `value' greater than 0 causes
12885 a `NOOP' command to be sent each `value' seconds if no other operation
12886 is performed.
12889 .It Va imap-list-depth
12890 When retrieving the list of folders on an IMAP server, the
12891 .Ic folders
12892 command stops after it has reached a certain depth to avoid possible
12893 infinite loops.
12894 The value of this variable sets the maximum depth allowed.
12895 The default is 2.
12896 If the folder separator on the current IMAP server is a slash `/',
12897 this variable has no effect and the
12898 .Ic folders
12899 command does not descend to subfolders.
12901 .Mx Va imap-use-starttls
12902 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
12903 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
12904 IMAP session SSL/TLS encrypted.
12905 This functionality is not supported by all servers,
12906 and is not used if the session is already encrypted by the IMAPS method.
12908 .\" }}}
12911 .\" .Sh "SEE ALSO" {{{
12912 .Sh "SEE ALSO"
12914 .Xr bogofilter 1 ,
12915 .Xr gpg 1 ,
12916 .Xr more 1 ,
12917 .Xr newaliases 1 ,
12918 .Xr openssl 1 ,
12919 .Xr sendmail 1 ,
12920 .Xr sh 1 ,
12921 .Xr spamassassin 1 ,
12922 .Xr iconv 3 ,
12923 .Xr setlocale 3 ,
12924 .Xr aliases 5 ,
12925 .Xr termcap 5 ,
12926 .Xr terminfo 5 ,
12927 .Xr locale 7 ,
12928 .Xr mailaddr 7 ,
12929 .Xr re_format 7 ,
12930 .Xr mailwrapper 8 ,
12931 .Xr sendmail 8
12932 .\" }}}
12935 .\" .Sh HISTORY {{{
12936 .Sh HISTORY
12938 M. Douglas McIlroy writes in his article
12939 .Dq A Research UNIX Reader: Annotated Excerpts \
12940 from the Programmer's Manual, 1971-1986
12941 that a
12942 .Xr mail 1
12943 command already appeared in First Edition
12945 in 1971:
12947 .Bd -ragged -offset indent
12948 Electronic mail was there from the start.
12949 Never satisfied with its exact behavior, everybody touched it at one
12950 time or another: to assure the safety of simultaneous access, to improve
12951 privacy, to survive crashes, to exploit uucp, to screen out foreign
12952 freeloaders, or whatever.
12953 Not until v7 did the interface change (Thompson).
12954 Later, as mail became global in its reach, Dave Presotto took charge and
12955 brought order to communications with a grab-bag of external networks
12956 (v8).
12961 Mail was written in 1978 by Kurt Shoens and developed as part of the
12964 distribution until 1995.
12965 Mail has then seen further development in open source
12967 variants, noticeably by Christos Zoulas in
12968 .Pf Net Bx .
12969 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
12970 Ritter in the years 2000 until 2008.
12971 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
12972 This man page is derived from
12973 .Dq The Mail Reference Manual
12974 that was originally written by Kurt Shoens.
12975 .\" }}}
12978 .Sh AUTHORS
12980 .An "Kurt Shoens" ,
12981 .An "Edward Wang" ,
12982 .An "Keith Bostic" ,
12983 .An "Christos Zoulas" ,
12984 .An "Gunnar Ritter" ,
12985 .An "Steffen Nurpmeso" .
12988 The variables
12989 .Va contact-mail
12991 .Va contact-web
12992 provide contact addresses:
12994 .\" v15-compat: drop eval as `mail' will expand variable?
12995 .Dl ? echo $contact-web; eval mail $contact-mail
12998 .\" .Sh CAVEATS {{{
12999 .Sh CAVEATS
13001 \*(ID Interrupting an operation via
13002 .Dv \&\&SIGINT
13004 .Ql control-C
13005 from anywhere else but a command prompt is very problematic and likely
13006 to leave the program in an undefined state: many library functions
13007 cannot deal with the
13008 .Fn siglongjmp 3
13009 that this software (still) performs; even though efforts have been taken
13010 to address this, no sooner but in v15 it will have been worked out:
13011 interruptions have not been disabled in order to allow forceful breakage
13012 of hanging network connections, for example (all this is unrelated to
13013 .Va ignore ) .
13016 The SMTP and POP3 protocol support of \*(UA is very basic.
13017 Also, if it fails to contact its upstream SMTP server, it will not make
13018 further attempts to transfer the message at a later time (setting
13019 .Va save
13021 .Va sendwait
13022 may be useful).
13023 If this is a concern, it might be better to set up a local SMTP server
13024 that is capable of message queuing.
13025 .\" }}}
13028 .Sh BUGS
13030 After deleting some message of a POP3 mailbox the header summary falsely
13031 claims that there are no messages to display, one needs to perform
13032 a scroll or dot movement to restore proper state.
13034 In threaded display a power user may encounter crashes very
13035 occasionally (this is may and very).
13037 The file
13038 .Pa TODO
13039 in the source repository lists future directions.
13040 .\" s-ts-mode