main(): tweaks
[s-mailx.git] / nail.1
blob538c974dc9db8ba52e880fed65373d940980b736
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-pre4 / 2017-04-13
35 .Dd April 13, 2017
36 .ds VV \\%v14.9.0-pre4
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 .Nm \*(uA
74 .Bk -words
75 .Op Fl BdEFintv~
76 .Op Fl \&: Ar spec
77 .Op Fl A Ar account
78 .Op : Ns Fl a Ar attachment Ns \&:
79 .Op : Ns Fl b Ar bcc-addr Ns \&:
80 .Op : Ns Fl c Ar cc-addr Ns \&:
81 .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
82 .Op Fl r Ar from-addr
83 .Oo : Ns
84 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
85 .Pf \&: Oc
86 .Op Fl s Ar subject
87 .Op : Ns Fl X Ar cmd Ns \&:
88 .Op Fl \&.
89 .Pf : Ar to-addr Ns \&:
90 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
91 .Ek
92 .Nm \*(uA
93 .Bk -words
94 .Op Fl BdEeHiNnRv~
95 .Op Fl \&: Ar spec
96 .Op Fl A Ar account
97 .Op Fl L Ar spec
98 .Op Fl r Ar from-addr
99 .Oo : Ns
100 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
101 .Pf \&: Oc
102 .Op Fl u Ar user
103 .Op : Ns Fl X Ar cmd Ns \&:
104 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
106 .Nm \*(uA
107 .Bk -words
108 .Op Fl BdEeHiNnRv~#
109 .Op Fl \&: Ar spec
110 .Op Fl A Ar account
111 .Fl f
112 .Op Fl L Ar spec
113 .Op Fl r Ar from-addr
114 .Oo : Ns
115 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
116 .Pf \&: Oc
117 .Op : Ns Fl X Ar cmd Ns \&:
118 .Op Ar file
119 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
121 .\" }}}
124 .Mx -toc -tree html pdf ps xhtml
127 .\" .Sh DESCRIPTION {{{
128 .Sh DESCRIPTION
130 .Bd -filled -compact -offset indent
131 .Sy Compatibility note:
132 S-nail (\*(UA) will wrap up into \%S-mailx in v15.0 (circa 2018).
133 Backward incompatibility has to be expected \(en
134 .Sx COMMANDS
135 will use
136 .Sx "Shell-style argument quoting"
137 rules, for example, and shell metacharacters will become meaningful.
138 New and old behaviour is flagged \*(IN and \*(OU, and setting
139 .Va v15-compat ,
140 one of the many
141 .Sx "INTERNAL VARIABLES" ,
142 will choose new behaviour when applicable.
143 \*(OB flags what will vanish, and enabling
144 .Fl d
146 .Fl v
147 enables obsoletion warnings.
151 \*(UA provides a simple and friendly environment for sending and
152 receiving mail.
153 It is intended to provide the functionality of the POSIX
154 .Xr mailx 1
155 command, but is MIME capable and optionally offers extensions for
156 line editing, S/MIME, SMTP and POP3, among others.
157 \*(UA divides incoming mail into its constituent messages and allows
158 the user to deal with them in any order.
159 It offers many
160 .Sx COMMANDS
162 .Sx "INTERNAL VARIABLES"
163 for manipulating messages and sending mail.
164 It provides the user simple editing capabilities to ease the composition
165 of outgoing messages, and increasingly powerful and reliable
166 non-interactive scripting capabilities.
168 .\" .Ss "Options" {{{
169 .Ss "Options"
171 .Bl -tag -width ".It Fl BaNg"
173 .It Fl \&: Ar spec
174 Explicitly control which of the
175 .Sx "Resource files"
176 shall be loaded: if the letter
177 .Ql s
178 is (case-insensitively) part of the
179 .Ar spec
180 then the system wide
181 .Pa \*(UR
182 is loaded, likewise the letter
183 .Ql u
184 controls loading of the user's personal
185 .Pa \*(ur
186 file, whereas the letters
187 .Ql -
189 .Ql /
190 explicitly forbid loading of any resource files.
191 This option should be used by scripts: to avoid environmental noise they
192 should
193 .Dq detach
194 from any configuration files and create a script-local environment,
195 explicitly setting any of the desired
196 .Sx "INTERNAL VARIABLES"
198 .Fl S .
199 This option overrides
200 .Fl n .
203 .It Fl A Ar account
204 Executes an
205 .Ic account
206 command for the given user email
207 .Ar account
208 after program startup is complete (all resource files are loaded, any
209 .Fl S
210 setting is being established; only
211 .Fl X
212 commands have not been evaluated yet).
213 Being a special incarnation of
214 .Ic define Ns d
215 macros for the purpose of bundling longer-lived settings, activating
216 such an email account also switches to the accounts
217 .Mx -sx
218 .Sx "primary system mailbox"
219 (most likely the
220 .Va inbox ) .
223 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
224 Attach
225 .Ar file
226 to the message (for compose mode opportunities refer to
227 .Ic ~@
229 .Ic ~^ ) .
230 .Sx "Filename transformations"
231 (also see
232 .Ic file )
233 will be performed, but shell word expansion is restricted to the tilde
234 .Ql ~ .
235 Shall
236 .Ar file
237 not be accessible but contain a
238 .Ql =
239 character, then anything before the
240 .Ql =
241 will be used as the filename, anything thereafter as a character set
242 specification.
244 If an input character set is specified,
245 .Mx -ix "character set specification"
246 but no output character set, then the given input character set is fixed
247 as-is, and no conversion will be applied;
248 giving the special string hyphen-minus
249 .Ql -
250 will be treated as if
251 .Va ttycharset
252 has been specified (the default).
253 If an output character set has also been given then the conversion will
254 be performed exactly as specified and on-the-fly, not considering the
255 file's type and content.
256 As an exception, if the output character set is specified as hyphen-minus
257 .Ql - ,
258 then the default conversion algorithm (see
259 .Sx "Character sets" )
260 is applied (therefore no conversion is performed on-the-fly,
261 .Ar file
262 will be MIME-classified and its contents will be inspected first).
263 It is an error to specify anything but
264 .Ql -
265 if no character set conversion is available
266 .Pf ( Va features
267 does not include the term
268 .Ql +iconv ) .
271 .It Fl B
272 (\*(OB: \*(UA will always use line-buffered output, to gain
273 line-buffered input even in batch mode enable batch mode via
274 .Fl # . )
277 .It Fl b Ar addr
278 Send a blind carbon copy to
279 .Ar addr Ns
280 ess, if the setting of
281 .Va expandaddr ,
282 one of the
283 .Sx "INTERNAL VARIABLES" ,
284 allows.
285 The option may be used multiple times.
286 Also see the section
287 .Sx "On sending mail, and non-interactive mode" .
290 .It Fl c Ar addr
291 Send carbon copies to the given receiver, if so allowed by
292 .Va expandaddr .
293 May be used multiple times.
296 .It Fl d
297 .Ic set
298 the internal variable
299 .Va debug
300 which enables debug messages and disables message delivery,
301 among others; effectively turns almost any operation into a dry-run.
304 .It Fl E
305 .Ic set
306 .Va skipemptybody
307 and thus discard messages with an empty message part body.
308 This command line option is \*(OB.
311 .It Fl e
312 Just check if mail is present (in the system
313 .Va inbox
314 or the one specified via
315 .Fl f ) :
316 if yes, return an exit status of zero, a non-zero value otherwise.
317 To restrict the set of mails to consider in this evaluation a message
318 specification can be added with the option
319 .Fl L .
322 .It Fl F
323 Save the message to send in a file named after the local part of the
324 first recipient's address (instead of in
325 .Va record Ns ).
328 .It Fl f
329 Read in the contents of the user's
330 .Mx -sx
331 .Sx "secondary mailbox"
332 .Ev MBOX
333 (or the specified file) for processing;
334 when \*(UA is quit, it writes undeleted messages back to this file
335 (but be aware of the
336 .Va hold
337 option).
338 The optional
339 .Ar file
340 argument will undergo some special
341 .Sx "Filename transformations"
342 (also see
343 .Ic file ) .
344 Note that
345 .Ar file
346 is not a argument to the flag
347 .Fl \&\&f ,
348 but is instead taken from the command line after option processing has
349 been completed.
350 In order to use a
351 .Ar file
352 that starts with a hyphen-minus, prefix with a relative path, as in
353 .Ql ./-hyphenbox.mbox .
356 .It Fl H
357 Display a summary of
358 .Ic headers
359 and exit; a configurable summary view is available via the
360 .Fl L
361 option.
364 .It Fl h
365 Show a short usage summary.
368 .It Fl i
369 .Ic set
370 .Va ignore
371 to ignore tty interrupt signals.
374 .It Fl L Ar spec
375 Display a summary of
376 .Ic headers
377 of all messages that match the given
378 .Ar spec ,
379 then exit.
380 See the section
381 .Sx "Specifying messages"
382 for the format of
383 .Ar spec .
384 If the
385 .Fl e
386 (\*(OB or
387 .Fl H )
388 option has been given in addition no header summary is produced,
389 but \*(UA will instead indicate via its exit status whether
390 .Ar spec
391 matched any messages
392 .Pf ( Ql 0 )
393 or not
394 .Pf ( Ql 1 ) ;
395 note that any verbose output is suppressed in this mode and must instead
396 be enabled explicitly (e.g., by using the option
397 .Fl v ) .
400 .It Fl M Ar type
401 Special send mode that will flag standard input with the MIME
402 .Ql Content-Type:
403 set to the given
404 .Ar type
405 and use it as the main message body.
406 \*(ID Using this option will bypass processing of
407 .Va message-inject-head ,
408 .Va signature
410 .Va message-inject-tail .
411 Also see
412 .Fl q , m , t .
415 .It Fl m Ar file
416 Special send mode that will MIME classify the specified
417 .Ar file
418 and use it as the main message body.
419 \*(ID Using this option will bypass processing of
420 .Va message-inject-head ,
421 .Va signature
423 .Va message-inject-tail .
424 Also see
425 .Fl q , M , t .
428 .It Fl N
429 inhibit the initial display of message headers when reading mail or
430 editing a mail folder by calling
431 .Ic unset
432 for the internal variable
433 .Va header .
436 .It Fl n
437 Standard flag that inhibits reading the system wide
438 .Pa \*(UR
439 upon startup.
440 The option
441 .Fl \&:
442 allows more control over the startup sequence; also see
443 .Sx "Resource files" .
446 .It Fl q Ar file
447 Special send mode that will initialize the message body with the
448 contents of the specified
449 .Ar file ,
450 which may be standard input
451 .Ql -
452 only in non-interactive context.
453 Also see
454 .Fl M , m , t .
457 .It Fl R
458 Any folder opened will be in read-only mode.
462 .It Fl r Ar from-addr
463 The source address that appears in the
464 .Ql From:
465 .Pf ( Va from )
466 header of a message (or in the
467 .Ql Sender:
468 .Pf ( Va sender )
469 header if the former contains multiple addresses) is not used for
470 relaying and delegating a message over the wire via SMTP, but instead an
471 envelope will enwrap the message content and provide the necessary
472 information (i.e., the RFC 5321 reverse-path, also used to report, e.g.,
473 delivery errors) to transmit the message to its destination(s).
474 Whereas said headers and internal variables will be used by \*(UA to
475 create the envelope if the builtin SMTP
476 .Va mta
477 (Mail-Transfer-Agent) is used, a file-based MTA will instead use the
478 identity of the message-originating user.
480 This command line option can be used to specify the reverse-path, to be
481 passed to a file-based
482 .Va mta
483 when a message is sent, via
484 .Ql -f Ar from-addr .
485 Shall
486 .Ar from-addr
487 include a user name, then the address components will be separated and
488 the name part will be passed to a file-based
489 .Va mta
490 individually via
491 .Ql -F Ar name .
492 The given
493 .Ar from-addr
494 is also assigned to the internal variable
495 .Va from .
496 Many default installations and sites disallow explicit overriding of the
497 user identity which could be adjusted by this option, unless either
498 .Va mta
499 has been configured accordingly, or the user is member of a group with
500 special privileges, respectively.
502 If an empty string is passed as
503 .Ar from-addr
504 then the content of the variable
505 .Va from
506 (or, if that contains multiple addresses,
507 .Va sender )
508 will be evaluated and used for this purpose whenever the file-based
509 .Va mta
510 is contacted.
511 Note that \*(UA by default, without
512 .Fl \&\&r
513 that is, neither passes
514 .Fl \&\&f
516 .Fl \&\&F
517 command line options to a file-based MTA by itself, unless this
518 automatic deduction is enforced by
519 .Ic set Ns
520 ing the internal variable
521 .Va r-option-implicit .
525 .It Fl S Ar var Ns Op = Ns value
526 .Ic set
527 the internal
528 .Ar var Ns
529 iable and, in case of a non-boolean variable which has a value, assign
530 .Ar value
531 to it.
532 Even though
533 .Sx "INTERNAL VARIABLES"
534 .Ic \&\&set
536 .Fl S
537 may be overwritten from within resource files,
538 the command line setting will be reestablished after all resource files
539 have been loaded in the order they have been given on the command line.
542 .It Fl s Ar subject
543 Specify the subject of the message to be sent.
544 Newline (NL) and carriage-return (CR) bytes are invalid and will be
545 normalized to space (SP) characters.
548 .It Fl t
549 The message given (on standard input) is expected to contain, separated
550 from the message body by an empty line, a message header with
551 .Ql To: ,
552 .Ql Cc: ,
554 .Ql Bcc:
555 fields giving its recipients, which will be added to any recipients
556 specified on the command line.
557 If a message subject is specified via
558 .Ql Subject:
559 then it will be used in favour of one given on the command line.
561 Also understood are
562 .Ql Reply-To:
563 (possibly overriding
564 .Va replyto ) ,
565 .Ql Sender:
566 .Pf ( Va sender ) ,
567 .Ql From:
568 .Pf ( Va from
569 and / or option
570 .Fl r ) .
571 .Ql Message-ID: ,
572 .Ql In-Reply-To: ,
573 .Ql References:
575 .Ql Mail-Followup-To: ,
576 by default created automatically dependent on message context, will
577 be used if specified (a special address massage will however still occur
578 for the latter).
579 Any other custom header field (also see
580 .Va customhdr ,
581 .Ic ~^ )
582 is passed through entirely
583 unchanged, and in conjunction with the option
584 .Fl ~
585 it is possible to embed
586 .Sx "COMMAND ESCAPES" .
587 Also see
588 .Fl M , m , q .
591 .It Fl u Ar user
592 Initially read the
593 .Mx -sx
594 .Sx "primary system mailbox"
596 .Ar user ,
597 appropriate privileges presumed; effectively identical to
598 .Ql -f %user .
601 .It Fl V
602 Show \*(UA's
603 .Va version
604 and exit.
605 The command
606 .Ic version
607 will also show the list of
608 .Va features :
609 .Ql $ \*(uA -Xversion -Xx .
612 .It Fl v
613 .Ic set Ns
614 ting the internal variable
615 .Va verbose
616 enables display of some informational context messages.
617 Using it twice increases the level of verbosity.
620 .It Fl X Ar cmd
621 Add the given (or multiple for a multiline argument)
622 .Ar cmd
623 to the list of commands to be executed,
624 as a last step of program startup, before normal operation starts.
625 This is the only possibility to execute commands in non-interactive mode
626 when reading startup files is actively prohibited.
627 The commands will be evaluated as a unit, just as via
628 .Ic source .
629 Correlates with
630 .Fl #
632 .Va errexit .
635 .It Fl ~
636 Enable
637 .Sx "COMMAND ESCAPES"
638 in compose mode even in non-interactive use cases.
639 This can be used to, e.g., automatically format the composed message
640 text before sending the message:
641 .Bd -literal -offset indent
642 $ ( echo 'line    one. Word.     Word2.';\e
643     echo '~| /usr/bin/fmt -tuw66' ) |\e
644   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
648 .It Fl #
649 Enables batch mode: standard input is made line buffered, the complete
650 set of (interactive) commands is available, processing of
651 .Sx "COMMAND ESCAPES"
652 is enabled in compose mode, and diverse
653 .Sx "INTERNAL VARIABLES"
654 are adjusted for batch necessities, exactly as if done via
655 .Fl S :
656 .Va emptystart ,
657 .Pf no Va errexit ,
658 .Pf no Va header ,
659 .Pf no Va posix ,
660 .Va quiet ,
661 .Va sendwait ,
662 .Va typescript-mode
663 as well as
664 .Ev MAIL ,
665 .Ev MBOX
667 .Va inbox
668 (the latter three to
669 .Pa /dev/null ) .
670 The following prepares an email message in a batched dry run:
671 .Bd -literal -offset indent
672 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
673   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
677 .It Fl \&.
678 This flag forces termination of option processing in order to prevent
679 .Dq option injection
680 (attacks).
681 It also forcefully puts \*(UA into send mode, see
682 .Sx "On sending mail, and non-interactive mode" .
686 Any given
687 .Bk -words
688 .Ar to-addr ...
690 argument, as well as all receivers established by the command line options
691 .Fl b
693 .Fl c ,
694 are subject to checks established via
695 .Va expandaddr ,
696 one of the
697 .Sx "INTERNAL VARIABLES" .
698 .Bk -words
699 .Op Ar mta-option ...
701 arguments that are given at the end of the command line after a
702 .Ql --
703 separator will be passed through to a file-based
704 .Va mta
705 (Mail-Transfer-Agent) and persist for an entire (interactive) session
706 \(en if the setting of the internal variable
707 .Va expandargv
708 allows their recognition; no such constraints apply to the variable
709 .Va mta-arguments .
710 .\" }}}
712 .\" .Ss "A starter" {{{
713 .Ss "A starter"
715 \*(UA is a direct descendant of
717 Mail, a successor of the Research
719 mail which
720 .Dq was there from the start
721 according to
722 .Sx HISTORY .
723 It thus represents the user side of the
725 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
726 traditionally taken by
727 .Xr sendmail 8 ,
728 and most MTAs provide a binary of this name for compatibility purposes.
729 If the \*(OPal SMTP
730 .Va mta
731 is included in the
732 .Va features
733 of \*(UA then the system side is not a mandatory precondition for mail
734 delivery.
737 Because \*(UA strives for compliance with POSIX
738 .Xr mailx 1
739 it is likely that some configuration settings have to be adjusted before
740 using it is a smooth experience.
741 The default global
742 .Pa \*(UR
743 resource file bends those standard imposed settings of the
744 .Sx "INTERNAL VARIABLES"
745 a bit towards more user friendliness and safety, however, e.g., it
746 .Ic set Ns s
747 .Va hold
749 .Va keepsave
750 in order to suppress the automatic moving of messages to the
751 .Mx -sx
752 .Sx "secondary mailbox"
753 .Ev MBOX
754 that would otherwise occur (see
755 .Sx "Message states" ) ,
757 .Va keep
758 to not remove empty system (MBOX) mailbox files in order not to mangle
759 file permissions when files eventually get recreated \(en
760 \*(UA will remove all empty (MBOX) mailbox files unless this variable is
761 set whenever
762 .Ev POSIXLY_CORRECT
763 mode has been enabled.
764 The file mode creation mask is explicitly managed via
765 .Va umask .
768 It also enables
769 .Va sendwait
770 in order to synchronize \*(UA with the exit status report of the used
771 .Va mta
772 when sending mails.
773 It sets
774 .Va emptystart
775 to enter interactive startup even if the initial mailbox is empty,
776 .Va editheaders
777 to allow editing of headers as well as
778 .Va fullnames
779 to not strip down addresses in compose mode, and
780 .Va quote
781 to include the message that is being responded to when
782 .Ic reply Ns
783 ing.
784 The section
785 .Sx EXAMPLES
786 contains some more complete configuration examples.
787 .\" }}}
789 .\" .Ss "On sending mail, and non-interactive mode" {{{
790 .Ss "On sending mail, and non-interactive mode"
792 To send a message to one or more people, using a local or a builtin
793 .Va mta
794 (Mail-Transfer-Agent) transport to actually deliver the generated mail
795 message, \*(UA can be invoked with arguments which are the names of
796 people to whom the mail will be sent, and the command line options
797 .Fl b
799 .Fl c
800 can be used to add (blind) carbon copy receivers:
802 .Bd -literal -offset indent
803 # Via sendmail(1)
804 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
806 # But... try it in an isolated dry-run mode (-d) first
807 $ LC_ALL=C \*(uA -d -:/ -Ssendwait \e
808    -b bcc@exam.ple -c cc@exam.ple \e
809    -. '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
811 # With SMTP
812 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait \e
813     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
814     -S from=scriptreply@exam.ple \e
815     -a /etc/mail.rc \e
816     -. eric@exam.ple
820 If standard input is a terminal rather than the message to be sent,
821 the user is expected to type in the message contents.
822 In this compose mode \*(UA treats lines beginning with the character
823 .Ql ~
824 special \(en these are so-called
825 .Sx "COMMAND ESCAPES" ,
826 which can be used to read in files, process shell commands, add and edit
827 attachments and more; e.g., the command escape
828 .Ic ~e
829 will start the text editor to revise the message in its current state,
830 .Ic ~h
831 allows editing of the most important message headers, with
832 .Ic ~^
833 custom headers can be created (more specifically than with
834 .Va customhdr ) .
835 .Ic ~?
836 gives an overview of most other available command escapes.
837 Typing
838 .Ql control-D
839 .Pf ( Ql ^D )
840 at the beginning of an empty line leaves compose mode and causes the
841 message to be sent, whereas typing
842 .Ql control-C
843 .Pf ( Ql ^C )
844 twice will abort the current letter (saving its contents in the file
845 denoted by
846 .Ev DEAD
847 unless
848 .Pf no Va save
849 is set).
852 A number of
853 .Sx ENVIRONMENT
855 .Sx "INTERNAL VARIABLES"
856 can be used to alter default behavior.
857 E.g., messages are sent asynchronously, without supervision, unless the
858 internal variable
859 .Va sendwait
860 is set, therefore send errors will not be recognizable until then.
861 .Ic set Ns
862 ting (also via
863 .Fl S )
864 .Va editalong
865 will automatically startup a text editor when compose mode is entered,
866 .Va editheaders
867 allows editing of headers additionally to plain body content, whereas
868 .Va askcc
870 .Va askbcc
871 will cause the user to be prompted actively for (blind) carbon-copy
872 recipients, respectively, if the given list is empty.
873 .Va on-compose-enter
875 .Va on-compose-leave
876 hook variables may be set to
877 .Ic define Ns
878 d macros to automatically adjust some settings dependent
879 on receiver, sender or subject contexts, and via the
880 .Va on-compose-splice-shell
881 as well as
882 .Va on-compose-splice
883 variables, the latter also to be set to a
884 .Ic define Ns
885 d macro, increasingly powerful mechanisms to perform automated message
886 adjustments are available.
889 Especially for using public mail provider accounts with the SMTP
890 .Va mta
891 it is often necessary to set
892 .Va from
893 and/or
894 .Va hostname
895 (even finer control via
896 .Va smtp-hostname ) ,
897 which (even if empty) also causes creation of
898 .Ql Message-ID:
900 .Ql Content-ID:
901 header fields unless
902 .Va stealthmua
903 is set; saving a copy of sent messages in a
904 .Va record
905 mailbox may be desirable \(en as for most mailbox
906 .Ic file
907 targets the value will undergo
908 .Sx "Filename transformations" .
909 Defining user email
910 .Ic account Ns s
911 for the purpose of arranging a complete environment of settings that can
912 be switched to with a single command or command line option may be
913 useful (the section
914 .Sx EXAMPLES
915 contains example configurations for sending messages via some of the
916 well-known public mail providers and also gives a compact overview on
917 how to setup a secure SSL/TLS environment).
918 Performing some
919 .Fl d
921 .Va debug
922 sandbox dry-run tests first will prove correctness.
925 The section
926 .Sx "On URL syntax and credential lookup"
927 will spread light on the different ways of how to specify user email
928 account credentials, the
929 .Ql USER@HOST
930 variable chains, and accessing protocol-specific resources,
931 the section
932 .Sx "Character sets"
933 goes into the details of character encodings, and how to use them for
934 interpreting the input data given in
935 .Va ttycharset
936 and representing messages and MIME part contents in
937 .Va sendcharsets ,
938 and reading the section
939 .Sx "The mime.types files"
940 should help to understand how the MIME-type of outgoing attachments are
941 classified, and what can be done for fine-tuning.
942 Over the wire an intermediate, configurable
943 .Pf content-transfer-\: Va encoding
944 may be applied to the raw message part data.
947 Message recipients (as specified on the command line or defined in
948 .Ql To: ,
949 .Ql Cc:
951 .Ql Bcc: )
952 may not only be email addressees but can also be names of mailboxes and
953 even complete shell command pipe specifications.
954 If the variable
955 .Va expandaddr
956 is not set then only network addresses (see
957 .Xr mailaddr 7
958 for a description of mail addresses) and plain user names (including MTA
959 aliases) may be used, other types will be filtered out, giving a warning
960 message.
961 The command
962 .Ic addrcodec
963 can be used to generate standard compliant network addresses.
965 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
966 .\" grep the latter for the complete picture
968 If the variable
969 .Va expandaddr
970 is set then extended recipient addresses will optionally be accepted:
971 Any name which starts with a vertical bar
972 .Ql |
973 character specifies a command pipe \(en the command string following the
974 .Ql |
975 is executed and the message is sent to its standard input;
976 Likewise, any name that starts with the character solidus
977 .Ql /
978 or the character sequence dot solidus
979 .Ql ./
980 is treated as a file, regardless of the remaining content;
981 likewise a name that solely consists of a hyphen-minus
982 .Ql - .
983 Any other name which contains a commercial at
984 .Ql @
985 character is treated as a network address;
986 Any other name which starts with a plus sign
987 .Ql +
988 character specifies a mailbox name;
989 Any other name which contains a solidus
990 .Ql /
991 character but no exclamation mark
992 .Ql \&!
993 or percent sign
994 .Ql %
995 character before also specifies a mailbox name;
996 What remains is treated as a network address.
998 .Bd -literal -offset indent
999 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1000 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1001 $ echo safe | LC_ALL=C \e
1002     \*(uA -:/ -Sv15-compat -Ssendwait \e
1003       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1004       -. bob@exam.ple
1008 It is possible to create personal distribution lists via the
1009 .Ic alias
1010 command, so that, for instance, the user can send mail to
1011 .Ql cohorts
1012 and have it go to a group of people.
1013 These aliases have nothing in common with the system wide aliases that
1014 may be used by the MTA, which are subject to the
1015 .Ql name
1016 constraint of
1017 .Va expandaddr
1018 and are often tracked in a file
1019 .Pa /etc/aliases
1020 (and documented in
1021 .Xr aliases 5
1023 .Xr sendmail 1 ) .
1024 Personal aliases will be expanded by \*(UA before the message is sent,
1025 and are thus a convenient alternative to specifying each addressee by
1026 itself; they correlate with the active set of
1027 .Ic alternates
1028 and are subject to
1029 .Va metoo
1030 filtering.
1033 .Dl alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox
1036 To avoid environmental noise scripts should
1037 .Dq detach
1038 \*(UA from any configuration files and create a script-local
1039 environment, ideally with the command line options
1040 .Fl \&:
1041 to disable any configuration file in conjunction with repetitions of
1042 .Fl S
1043 to specify variables:
1045 .Bd -literal -offset indent
1046 $ env LC_ALL=C \*(uA -:/ \e
1047     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1048     -Sexpandaddr=fail,-all,failinvaddr \e
1049     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1050     -S from=scriptreply@exam.ple \e
1051     -s 'Subject to go' -a attachment_file \e
1052     -. 'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1053     < content_file
1057 As shown, scripts can
1058 .Dq fake
1059 a locale environment, the above specifies the all-compatible 7-bit clean
1060 .Ev LC_ALL
1061 .Dq C ,
1062 but will nonetheless take and send UTF-8 in the message text by using
1063 .Va ttycharset .
1064 In interactive mode, which is introduced in the next section, messages
1065 can be sent by calling the
1066 .Ic mail
1067 command with a list of recipient addresses \(em the semantics are
1068 completely identical to non-interactive message sending:
1070 .Bd -literal -offset indent
1071 $ \*(uA -d -Squiet -Semptystart
1072 "/var/spool/mail/user": 0 messages
1073 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1074 ? # Will do the right thing (tm)
1075 ? m rec1@exam.ple rec2@exam.ple
1077 .\" }}}
1079 .\" .Ss "On reading mail, and interactive mode" {{{
1080 .Ss "On reading mail, and interactive mode"
1082 When invoked without addressees \*(UA enters interactive mode in which
1083 mails may be read.
1084 When used like that the user's system
1085 .Va inbox
1086 (see the command
1087 .Ic file
1088 for an in-depth description of the different mailbox types that exist)
1089 is read in and a one line header of each message therein is displayed.
1090 The visual style of this summary of
1091 .Ic headers
1092 can be adjusted through the variable
1093 .Va headline
1094 and the possible sorting criterion via
1095 .Va autosort .
1096 Scrolling through
1097 .Va screen Ns
1098 fuls of
1099 .Ic headers
1100 can be performed with the command
1101 .Ic z .
1102 If the initially opened mailbox is empty \*(UA will instead exit
1103 immediately (after displaying a message) unless the variable
1104 .Va emptystart
1105 is set.
1108 At the
1109 .Va prompt
1110 the command
1111 .Ic list
1112 will give a listing of all available commands and
1113 .Ic help
1114 will give a summary of some common ones.
1115 If the \*(OPal documentation strings are available one can type
1116 .Ql help X
1117 .Pf "(or " Ql ?X )
1118 and see the actual expansion of
1119 .Ql X
1120 and what its purpose is, i.e., commands can be abbreviated
1121 (note that POSIX defines some abbreviations, so that the alphabetical
1122 order of commands does not necessarily relate to the abbreviations; it is
1123 however possible to define overwrites with
1124 .Ic commandalias ) .
1125 These commands can also produce a more
1126 .Va verbose
1127 output.
1130 Messages are given numbers (starting at 1) which uniquely identify
1131 messages; the current message \(en the
1132 .Dq dot
1133 \(en will either be the first new message, or the first unread message,
1134 or the first message of the mailbox; the internal variable
1135 .Va showlast
1136 will instead cause usage of the last message for this purpose.
1137 The command
1138 .Ic headers
1139 will display a
1140 .Va screen Ns
1141 ful of header summaries containing the
1142 .Dq dot ,
1143 whereas
1144 .Ic from
1145 will display only the summaries of the given messages, defaulting to the
1146 .Dq dot .
1149 Message content can be displayed with the command
1150 .Ic type
1151 .Pf ( Ql t ,
1152 alias
1153 .Ic print ) .
1154 Here the variable
1155 .Va crt
1156 controls whether and when \*(UA will use the configured
1157 .Ev PAGER
1158 for display instead of directly writing to the user terminal
1159 .Va screen ,
1160 the sole difference to the command
1161 .Ic more ,
1162 which will always use the
1163 .Ev PAGER .
1164 The command
1165 .Ic top
1166 will instead only show the first
1167 .Va toplines
1168 of a message (maybe even compressed if
1169 .Va topsqueeze
1170 is set).
1171 Message display experience may improve by setting and adjusting
1172 .Va mime-counter-evidence ,
1173 and also see
1174 .Sx "HTML mail and MIME attachments" .
1177 By default the current message
1178 .Pf ( Dq dot )
1179 is displayed, but like with many other commands it is possible to give
1180 a fancy message specification (see
1181 .Sx "Specifying messages" ) ,
1182 e.g.,
1183 .Ql t:u
1184 will display all unread messages,
1185 .Ql t.
1186 will display the
1187 .Dq dot ,
1188 .Ql t 1 5
1189 will type the messages 1 and 5,
1190 .Ql t 1-5
1191 will type the messages 1 through 5, and
1192 .Ql t-
1194 .Ql t+
1195 will display the last and the next message, respectively.
1196 The command
1197 .Ic search
1198 (a more substantial alias for
1199 .Ic from )
1200 will display a header summary of the given message specification list
1201 instead of their content, e.g., the following will search for subjects:
1204 .Dl from "'@Some subject to search for'"
1207 In the default setup all header fields of a message will be
1208 .Ic type Ns
1209 d, but fields can be white- or blacklisted for a variety of
1210 applications by using the command
1211 .Ic headerpick ,
1212 e.g., to restrict display to a very restricted set:
1213 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1214 In order to display all header fields of a message regardless of
1215 currently active ignore or retain lists, use the commands
1216 .Ic Type
1218 .Ic Top ;
1219 .Ic Show
1220 will show the raw message content.
1221 Note that historically the global
1222 .Pa \*(UR
1223 not only adjusts the list of displayed headers, but also sets
1224 .Va crt .
1227 Dependent upon the configuration a line editor (see the section
1228 .Sx "On terminal control and line editor" )
1229 aims at making user experience with the many
1230 .Sx COMMANDS
1231 a bit nicer.
1232 When reading the system
1233 .Va inbox
1234 or when
1235 .Fl f
1237 .Ic file )
1238 specified a mailbox explicitly prefixed with the special
1239 .Ql %:
1240 modifier (propagating the mailbox to a
1241 .Mx -sx
1242 .Sx "primary system mailbox" ) ,
1243 then messages which have been read will be moved to a
1244 .Mx -sx
1245 .Sx "secondary mailbox" ,
1246 the users
1247 .Ev MBOX
1248 file, automatically when the mailbox is left, either by changing the
1249 active mailbox or by quitting \*(UA (also see
1250 .Sx "Message states" )
1251 \(en this automatic moving from a system or primary to the secondary
1252 mailbox is not performed when the variable
1253 .Va hold
1254 is set.
1255 Messages can also be explicitly
1256 .Ic move Ns
1257 d to other mailboxes, whereas
1258 .Ic copy
1259 keeps the original message.
1260 .Ic write
1261 can be used to write out data content of specific parts of messages.
1264 After examining a message the user can
1265 .Ic reply Ql r
1266 to the sender and all recipients (which will also be placed in
1267 .Ql To:
1268 unless
1269 .Va recipients-in-cc
1270 is set) or
1271 .Ic Reply Ql R
1272 exclusively to the sender(s).
1273 Messages can be
1274 .Ic forward Ns
1275 ed (shorter alias is
1276 .Ic fwd Ns ).
1277 When replying to or forwarding a message recipient addresses will be
1278 stripped from comments and names unless the internal variable
1279 .Va fullnames
1280 is set.
1281 It is possible to
1282 .Ic resend
1284 .Ic Resend
1285 messages: the former will add a series of
1286 .Ql Resent-
1287 headers, whereas the latter will not; different to newly created
1288 messages these will not save even with
1289 .Va record
1290 unless the additional variable
1291 .Va record-resent
1292 is set.
1293 Of course messages can also be
1294 .Ic delete Ql d ,
1295 but can spring into existence again via
1296 .Ic undelete
1297 or when the \*(UA session is ended via the
1298 .Ic exit Ql x
1299 command.
1302 To end a mail processing session one may either issue
1303 .Ic quit Ql q
1304 to cause a full program exit, which possibly includes
1305 automatic moving of read messages to the
1306 .Mx -sx
1307 .Sx "secondary mailbox"
1308 .Ev MBOX
1309 as well as updating the \*(OPal line editor
1310 .Va history-file ,
1311 or use the command
1312 .Ic exit Ql x
1313 instead in order to prevent any of these actions.
1314 .\" }}}
1316 .\" .Ss "HTML mail and MIME attachments" {{{
1317 .Ss "HTML mail and MIME attachments"
1319 Messages which are HTML-only get more and more common and of course many
1320 messages come bundled with a bouquet of MIME attachments.
1321 Whereas \*(UA \*(OPally supports a simple HTML-to-text converter to deal
1322 with HTML messages (see
1323 .Sx "The mime.types files" ) ,
1324 it normally cannot deal with any of these itself, but instead programs
1325 need to become registered to deal with specific MIME types or file
1326 extensions.
1327 These programs may either prepare plain text versions of their input
1328 in order to enable \*(UA to display the content on the terminal,
1329 or display the content themselves, for example in a graphical window.
1332 To install an external handler program for a specific MIME type set an
1333 according
1334 .Va pipe-TYPE/SUBTYPE
1335 variable; to instead define a handler for a specific file extension set
1336 the respective
1337 .Va pipe-EXTENSION
1338 variable \(en these handlers take precedence.
1339 \*(OPally \*(UA supports mail user agent configuration as defined in
1340 RFC 1524; this mechanism, documented in the section
1341 .Sx "The Mailcap files" ,
1342 will be queried for display or quote handlers if none of the former two
1343 .\" TODO v15-compat "will be" -> "is"
1344 did; it will be the sole source for handlers of other purpose.
1345 A last source for handlers may be the MIME type definition itself, if
1346 the \*(UA specific type-marker extension was used when defining the type
1347 with the command
1348 .Ic mimetype .
1349 (Many of the builtin MIME types do so by default.)
1352 The variable
1353 .Va mime-counter-evidence
1354 can be set to improve dealing with faulty MIME part declarations as are
1355 often seen in real-life messages.
1356 E.g., to display a HTML message inline (that is, converted to a more
1357 fancy plain text representation than the builtin converter is capable to
1358 produce) with either of the text-mode browsers
1359 .Xr lynx 1
1361 .Xr elinks 1 ,
1362 teach \*(UA about MathML documents and make it display them as plain
1363 text, and to open PDF attachments in an external PDF viewer,
1364 asynchronously and with some other magic attached:
1366 .Bd -literal -offset indent
1367 if [ "$features" !@ +filter-html-tagsoup ]
1368   #set pipe-text/html='elinks -force-html -dump 1'
1369   set pipe-text/html='lynx -stdin -dump -force_html'
1370   # Display HTML as plain text instead
1371   #set pipe-text/html=@
1372 endif
1373 mimetype '@ application/mathml+xml mathml'
1374 wysh set pipe-application/pdf='@&=@ \e
1375   trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1376   trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1377   mupdf "${MAILX_FILENAME_TEMPORARY}"'
1381 Note: special care must be taken when using such commands as mail
1382 viruses may be distributed by this method: if messages of type
1383 .Ql application/x-sh
1384 or files with the extension
1385 .Ql .sh
1386 were blindly filtered through the shell, for example, a message sender
1387 could easily execute arbitrary code on the system \*(UA is running on.
1388 For more on MIME, also in respect to sending of messages, see the
1389 sections
1390 .Sx "The mime.types files" ,
1391 .Sx "The Mailcap files"
1392 and the command
1393 .Ic mimetype .
1394 .\" }}}
1396 .\" .Ss "Mailing lists" {{{
1397 .Ss "Mailing lists"
1399 \*(UA offers some support to ease handling of mailing lists.
1400 The command
1401 .Ic mlist
1402 promotes all given arguments to known mailing lists, and
1403 .Ic mlsubscribe
1404 sets their subscription attribute, creating them first as necessary.
1405 (On the other hand
1406 .Ic unmlsubscribe
1407 does not
1408 .Ic unmlist
1409 automatically, but only resets the subscription attribute.)
1410 Using the commands without arguments will show (a subset of) all
1411 currently defined mailing lists.
1413 .Va headline
1414 format
1415 .Ql \&%T
1416 can be used to mark out messages with configured list addresses
1417 in the header display.
1420 \*(OPally mailing lists may also be specified as (extended) regular
1421 expressions, which allows matching of many addresses with a single
1422 expression.
1423 However, all fully qualified list addresses are matched via a fast
1424 dictionary, whereas expressions are placed in (a) list(s) which is
1425 (are) matched sequentially.
1427 .Bd -literal -offset indent
1428 set followup-to followup-to-honour=ask-yes reply-to-honour=ask-yes
1429 wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1430 mlsubscribe a4@b4.c4 exact@lists.c3
1434 The variable
1435 .Va followup-to-honour
1436 will ensure that a
1437 .Ql Mail-\:Followup-\:To:
1438 header is honoured when the message is being replied to (via
1439 .Ic reply
1441 .Ic Lreply )
1443 .Va followup-to
1444 controls whether this header is created when sending mails; it will be
1445 created automatically for a couple of reasons, too, like when the
1446 special
1447 .Dq mailing list specific
1448 respond command
1449 .Ic Lreply
1450 is used, when
1451 .Ic reply
1452 is used to respond to a message with its
1453 .Ql Mail-Followup-To:
1454 being honoured etc.
1457 A difference in between the handling of known and subscribed lists is
1458 that the address of the sender is usually not part of a generated
1459 .Ql Mail-Followup-To:
1460 when addressing the latter, whereas it is for the former kind of lists.
1461 Usually because there are exceptions: say, if multiple lists are
1462 addressed and not all of them are subscribed lists.
1464 For convenience \*(UA will, temporarily, automatically add a list
1465 address that is presented in the
1466 .Ql List-To:
1467 header of a message that is being responded to to the list of known
1468 mailing lists.
1469 Shall that header have existed \*(UA will instead, dependent on the
1470 variable
1471 .Va reply-to-honour ,
1472 use an also set
1473 .Ql Reply-To:
1474 for this purpose in order to accept a list administrators' wish that
1475 is supposed to have been manifested like that (but only if it provides
1476 a single address which resides on the same domain as what is stated in
1477 .Ql List-To: ) .
1478 .\" }}}
1480 .\" .Ss "Resource files" {{{
1481 .Ss "Resource files"
1483 Upon startup \*(UA reads in several resource files:
1485 .Bl -tag -width ".It Pa BaNg"
1487 .It Pa \*(UR
1488 System wide initialization file.
1489 Reading of this file can be suppressed, either by using the
1490 .Fl \&:
1491 (and according argument) or
1492 .Fl n
1493 command line options, or by setting the
1494 .Sx ENVIRONMENT
1495 variable
1496 .Ev MAILX_NO_SYSTEM_RC .
1499 .It Pa \*(ur
1500 File giving initial commands.
1501 A different file can be chosen by setting the
1502 .Sx ENVIRONMENT
1503 variable
1504 .Ev MAILRC .
1505 Reading of this file can be suppressed with the
1506 .Fl \&:
1507 command line option.
1509 .It Va mailx-extra-rc
1510 Can be used to define an optional startup file to be read after all
1511 other resource files.
1512 It can be used to specify settings that are not understood by other
1513 .Xr mailx 1
1514 implementations, for example.
1515 This variable is only honoured when defined in a resource file, e.g.,
1516 it is one of the
1517 .Sx "INTERNAL VARIABLES" .
1521 The content of these files is interpreted as follows:
1524 .Bl -bullet -compact
1526 The whitespace characters space, tabulator and newline,
1527 as well as those defined by the variable
1528 .Va ifs ,
1529 are removed from the beginning and end of input lines.
1531 Empty lines are ignored.
1533 Any other line is interpreted as a command.
1534 It may be spread over multiple input lines if the newline character is
1535 .Dq escaped
1536 by placing a reverse solidus character
1537 .Ql \e
1538 as the last character of the line; whereas any leading whitespace of
1539 follow lines is ignored, trailing whitespace before a escaped newline
1540 remains in the input.
1542 If the line (content) starts with the number sign
1543 .Ql #
1544 then it is a comment-command \(en a real command! \(en and also ignored.
1545 This command is the only form of comment that is understood.
1549 Unless \*(UA is about to enter interactive mode syntax errors that occur
1550 while loading these files are treated as errors and cause program exit.
1551 More files with syntactically equal content can be
1552 .Ic source Ns ed .
1553 The following, saved in a file, would be an examplary content:
1555 .Bd -literal -offset indent
1556  # This line is a comment command.  And y\e
1557     es, it is really continued here.
1558 set debug \e
1559     verbose
1560     set editheaders
1562 .\" }}}
1564 .\" .Ss "Character sets" {{{
1565 .Ss "Character sets"
1567 \*(OP \*(UA detects the character set of the terminal by using
1568 mechanisms that are controlled by the
1569 .Ev LC_CTYPE
1570 locale setting
1571 (the manual for
1572 .Xr setlocale 3
1573 should give an overview): the \*(UA internal variable
1574 .Va ttycharset
1575 will be set to the detected terminal character set accordingly,
1576 and will thus show up in the output of the commands
1577 .Ic set
1579 .Ic varshow .
1582 However, a user supplied
1583 .Va ttycharset
1584 value is not overwritten by this detection mechanism.
1585 I.e., it is actually possible to send mail in a completely
1586 .Dq faked
1587 locale environment, an option which can be used to generate and send,
1588 e.g., UTF-8 input data in a
1589 .Ql LC_ALL=C
1590 environment (an example of this can be found in the section
1591 .Sx "On sending mail, and non-interactive mode" ) .
1592 Changing the value does not mean much beside that, because several
1593 aspects of the real character set are implied by the locale environment
1594 of the system, which stays unaffected by
1595 .Va ttycharset .
1598 If no character set conversion capabilities have been compiled into
1599 \*(UA
1600 .Pf ( Va features
1601 does not include the term
1602 .Ql +iconv ) ,
1603 then
1604 .Va ttycharset
1605 will be the only supported character set,
1606 it is simply assumed that it can be used to exchange 8-bit messages
1607 (over the wire an intermediate
1608 .Pf content-transfer-\: Va encoding
1609 may be applied),
1610 and the rest of this section does not apply;
1611 it may however still be necessary to explicitly set it if automatic
1612 detection fails, since in that case it defaults to the mentioned
1613 .\" (Keep in SYNC: ./nail.1:"Character sets", ./nail.h:CHARSET_*!)
1614 ISO-8859-1.
1617 When reading messages, their text is converted into
1618 .Va ttycharset
1619 as necessary in order to display them on the users terminal.
1620 Unprintable characters and invalid byte sequences are detected
1621 and replaced by proper substitution characters.
1622 Character set mappings for source character sets can be established with
1623 the command
1624 .Ic charsetalias ,
1625 which may be handy to work around faulty character set catalogues (e.g.,
1626 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
1627 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
1628 Also see
1629 .Va charset-unknown-8bit
1630 to deal with another hairy aspect of message interpretation.
1633 When sending messages all their parts and attachments are classified.
1634 Whereas no character set conversion is performed on those parts which
1635 appear to be binary data,
1636 the character set being used must be declared within the MIME header of
1637 an outgoing text part if it contains characters that do not conform to
1638 the set of characters that are allowed by the email standards.
1639 Permissible values for character sets can be declared using the
1640 .Va sendcharsets
1641 variable, and
1642 .Va charset-8bit ,
1643 which defines a catch-all last-resort fallback character set that is
1644 implicitly appended to the list of character sets in
1645 .Va sendcharsets .
1648 When replying to a message and the variable
1649 .Va reply-in-same-charset
1650 is set then the character set of the message being replied to is tried
1651 first (after mapping via
1652 .Ic charsetalias ) .
1653 And it is also possible to make \*(UA work even more closely related to
1654 the current locale setting automatically by using the variable
1655 .Va sendcharsets-else-ttycharset ,
1656 please see there for more information.
1659 All the specified character sets are tried in order unless the
1660 conversion of the part or attachment succeeds.
1661 If none of the tried (8-bit) character sets is capable to represent the
1662 content of the part or attachment,
1663 then the message will not be sent and its text will optionally be
1664 .Va save Ns d
1666 .Ev DEAD .
1667 In general, if the message
1668 .Dq Cannot convert from a to b
1669 appears, either some characters are not appropriate for the currently
1670 selected (terminal) character set,
1671 or the needed conversion is not supported by the system.
1672 In the first case, it is necessary to set an appropriate
1673 .Ev LC_CTYPE
1674 locale and/or the variable
1675 .Va ttycharset .
1678 The best results are usually achieved when \*(UA is run in a UTF-8
1679 locale on a UTF-8 capable terminal, in which case the full Unicode
1680 spectrum of characters is available.
1681 In this setup characters from various countries can be displayed,
1682 while it is still possible to use more simple character sets for sending
1683 to retain maximum compatibility with older mail clients.
1686 On the other hand the POSIX standard defines a locale-independent 7-bit
1687 .Dq portable character set
1688 that should be used when overall portability is an issue, the even more
1689 restricted subset named
1690 .Dq portable filename character set
1691 consisting of A-Z, a-z, 0-9, period
1692 .Ql \&. ,
1693 underscore
1694 .Ql _
1695 and hyphen-minus
1696 .Ql - .
1697 .\" }}}
1699 .\" .Ss "Message states" {{{
1700 .Ss "Message states"
1702 \*(UA differentiates in between several different message states;
1703 the current state will be reflected in header summary displays if
1704 .Va headline
1705 is configured to do so (via the internal variable
1706 .Va attrlist ) ,
1707 and messages can also be selected and be acted upon depending on their
1708 state (see
1709 .Sx "Specifying messages" ) .
1710 When operating on the system
1711 .Va inbox ,
1712 or in any other
1713 .Mx -sx
1714 .Sx "primary system mailbox" ,
1715 special actions, like the automatic moving of messages to the
1716 .Mx -sx
1717 .Sx "secondary mailbox"
1718 .Ev MBOX ,
1719 may be applied when the mailbox is left (also implicitly via
1720 a successful exit of \*(UA, but not if the special command
1721 .Ic exit
1722 is used) \(en however, because this may be irritating to users which
1723 are used to
1724 .Dq more modern
1725 mail-user-agents, the default global
1726 .Pa \*(UR
1727 sets the internal
1728 .Va hold
1730 .Va keepsave
1731 variables in order to suppress this behaviour.
1733 .Bl -hang -width ".It Ql new"
1734 .It Ql new
1735 Message has neither been viewed nor moved to any other state.
1736 Such messages are retained even in the
1737 .Mx -sx
1738 .Sx "primary system mailbox" .
1740 .It Ql unread
1741 Message has neither been viewed nor moved to any other state, but the
1742 message was present already when the mailbox has been opened last:
1743 Such messages are retained even in the
1744 .Mx -sx
1745 .Sx "primary system mailbox" .
1747 .It Ql read
1748 The message has been processed by one of the following commands:
1749 .Ic ~f ,
1750 .Ic ~m ,
1751 .Ic ~F ,
1752 .Ic ~M ,
1753 .Ic copy ,
1754 .Ic mbox ,
1755 .Ic next ,
1756 .Ic pipe  ,
1757 .Ic Print ,
1758 .Ic print ,
1759 .Ic top ,
1760 .Ic Type ,
1761 .Ic type ,
1762 .Ic undelete .
1763 The commands
1764 .Ic dp
1766 .Ic dt
1767 will always try to automatically
1768 .Dq step
1770 .Ic type
1772 .Dq next
1773 logical message, and may thus mark multiple messages as read, the
1774 .Ic delete
1775 command will do so if  the internal variable
1776 .Va autoprint
1777 is set.
1778 Except when the
1779 .Ic exit
1780 command is used, messages that are in a
1781 .Mx -sx
1782 .Sx "primary system mailbox"
1783 and are in
1784 .Ql read
1785 state when the mailbox is left will be saved in the
1786 .Mx -sx
1787 .Sx "secondary mailbox"
1788 .Ev MBOX
1789 unless the internal variable
1790 .Va hold
1791 it set.
1793 .It Ql deleted
1794 The message has been processed by one of the following commands:
1795 .Ic delete ,
1796 .Ic dp ,
1797 .Ic dt .
1798 Only
1799 .Ic undelete
1800 can be used to access such messages.
1802 .It Ql preserved
1803 The message has been processed by a
1804 .Ic preserve
1805 command and it will be retained in its current location.
1807 .It Ql saved
1808 The message has been processed by one of the following commands:
1809 .Ic save
1811 .Ic write .
1812 Unless when the
1813 .Ic exit
1814 command is used, messages that are in a
1815 .Mx -sx
1816 .Sx "primary system mailbox"
1817 and are in
1818 .Ql saved
1819 state when the mailbox is left will be deleted; they will be saved in the
1820 .Mx -sx
1821 .Sx "secondary mailbox"
1822 .Ev MBOX
1823 when the internal variable
1824 .Va keepsave
1825 is set.
1829 In addition to these message states, flags which otherwise have no
1830 technical meaning in the mail system except allowing special ways of
1831 addressing them when
1832 .Sx "Specifying messages"
1833 can be set on messages.
1834 These flags are saved with messages and are thus persistent, and are
1835 portable between a set of widely used MUAs.
1837 .Bl -hang -width ".It Ic answered"
1838 .It Ic answered
1839 Mark messages as having been answered.
1840 .It Ic draft
1841 Mark messages as being a draft.
1842 .It Ic flag
1843 Mark messages which need special attention.
1845 .\" }}}
1847 .\" .Ss "Specifying messages" {{{
1848 .Ss "Specifying messages"
1850 Commands such as
1851 .Ic from ,
1852 .Ic type
1854 .Ic delete
1855 can be given a list of message numbers as arguments to apply to a number
1856 of messages at once.
1857 Thus
1858 .Ql delete 1 2
1859 deletes messages 1 and 2,
1860 whereas
1861 .Ql delete 1-5
1862 will delete the messages 1 through 5.
1863 In sorted or threaded mode (see the
1864 .Ic sort
1865 command),
1866 .Ql delete 1-5
1867 will delete the messages that are located between (and including)
1868 messages 1 through 5 in the sorted/threaded order, as shown in the
1869 .Ic headers
1870 summary.
1871 The following special message names exist:
1874 .Bl -tag -width ".It Ar BaNg"
1875 .It Ar \&.
1876 The current message, the so-called
1877 .Dq dot .
1879 .It Ar \&;
1880 The message that was previously the current message.
1882 .It Ar \&,
1883 The parent message of the current message,
1884 that is the message with the Message-ID given in the
1885 .Ql In-Reply-To:
1886 field or the last entry of the
1887 .Ql References:
1888 field of the current message.
1890 .It Ar -
1891 The next previous undeleted message,
1892 or the next previous deleted message for the
1893 .Ic undelete
1894 command.
1895 In sorted/threaded mode,
1896 the next previous such message in the sorted/threaded order.
1898 .It Ar +
1899 The next undeleted message,
1900 or the next deleted message for the
1901 .Ic undelete
1902 command.
1903 In sorted/threaded mode,
1904 the next such message in the sorted/threaded order.
1906 .It Ar ^
1907 The first undeleted message,
1908 or the first deleted message for the
1909 .Ic undelete
1910 command.
1911 In sorted/threaded mode,
1912 the first such message in the sorted/threaded order.
1914 .It Ar $
1915 The last message.
1916 In sorted/threaded mode,
1917 the last message in the sorted/threaded order.
1919 .It Ar & Ns Ar x
1920 In threaded mode,
1921 selects the message addressed with
1922 .Ar x ,
1923 where
1924 .Ar x
1925 is any other message specification,
1926 and all messages from the thread that begins at it.
1927 Otherwise it is identical to
1928 .Ar x .
1930 .Ar x
1931 is omitted,
1932 the thread beginning with the current message is selected.
1934 .It Ar *
1935 All messages.
1936 .It Ar `
1937 All messages that were included in the
1938 .Sx "Message list arguments"
1939 of the previous command.
1941 .It Ar x-y
1942 An inclusive range of message numbers.
1943 Selectors that may also be used as endpoints include any of
1944 .Ar .;-+^$ .
1946 .It Ar address
1947 A case-insensitive
1948 .Dq any substring matches
1949 search against the
1950 .Ql From:
1951 header, which will match addresses (too) even if
1952 .Va showname
1953 is set (and POSIX says
1954 .Dq any address as shown in a header summary shall be matchable in this form ) ;
1955 However, if the
1956 .Va allnet
1957 variable is set, only the local part of the address is evaluated
1958 for the comparison, not ignoring case, and the setting of
1959 .Va showname
1960 is completely ignored.
1961 For finer control and match boundaries use the
1962 .Ql @
1963 search expression.
1965 .It Ar / Ns Ar string
1966 All messages that contain
1967 .Ar string
1968 in the subject field (case ignored).
1969 See also the
1970 .Va searchheaders
1971 variable.
1973 .Ar string
1974 is empty,
1975 the string from the previous specification of that type is used again.
1977 .It Xo Op Ar @ Ns Ar name-list Ns
1978 .Ar @ Ns Ar expr
1980 All messages that contain the given case-insensitive search
1981 .Ar expr Ns
1982 ession; if the \*(OPal regular expression (see
1983 .Xr re_format 7 )
1984 support is available
1985 .Ar expr
1986 will be interpreted as (an extended) one if any of the
1987 .Dq magical
1988 (extended) regular expression characters is seen: in this case this
1989 should match strings correctly which are in the locale
1990 .Ev LC_CTYPE
1991 encoding.
1992 If the optional
1993 .Ar @ Ns Ar name-list
1994 part is missing, the search is restricted to the subject field body,
1995 but otherwise
1996 .Ar name-list
1997 specifies a comma-separated list of header fields to search, as in
1999 .Dl '@to,from,cc@Someone i ought to know'
2001 In order to search for a string that includes a
2002 .Ql @
2003 (commercial at) character the
2004 .Ar name-list
2005 is effectively non-optional, but may be given as the empty string.
2006 Some special header fields may be abbreviated:
2007 .Ql f ,
2008 .Ql t ,
2009 .Ql c ,
2010 .Ql b
2012 .Ql s
2013 will match
2014 .Ql From ,
2015 .Ql To ,
2016 .Ql Cc ,
2017 .Ql Bcc
2019 .Ql Subject ,
2020 respectively and case-insensitively.
2021 The special names
2022 .Ql header
2024 .Ql <
2025 can be used to search in (all of) the header(s) of the message, and the
2026 special names
2027 .Ql body
2029 .Ql >
2031 .Ql text
2033 .Ql =
2034 can be used to perform full text searches \(en whereas the former
2035 searches only the body, the latter also searches the message header.
2037 This message specification performs full text comparison, but even with
2038 regular expression support it is almost impossible to write a search
2039 expression that savely matches only a specific address domain.
2040 To request that the content of the header is treated as a list of
2041 addresses, and to strip those down to the plain email address which the
2042 search expression is to be matched against, prefix the header name
2043 (abbreviation) with a tilde
2044 .Ql ~ :
2046 .Dl @~f@@a\e.safe\e.domain\e.match$
2048 .It Ar :c
2049 All messages of state
2050 .Ql c ,
2051 where
2052 .Ql c
2053 is one or multiple of the following colon modifiers:
2055 .Bl -tag -compact -width ".It Ar :M"
2056 .It Ar n
2057 .Ql new
2058 messages.
2059 .It Ar o
2060 Old messages (any not in state
2061 .Ql read
2063 .Ql new ) .
2064 .It Ar u
2065 .Ql unread
2066 messages.
2067 .It Ar d
2068 .Ql deleted
2069 messages (for the
2070 .Ic undelete
2072 .Ic from
2073 commands only).
2074 .It Ar r
2075 .Ql read
2076 messages.
2077 .It Ar f
2078 .Ic flag Ns
2079 ged messages.
2080 .It Ar a
2081 .Ic answered
2082 messages (cf. the variable
2083 .Va markanswered ) .
2084 .It Ar t
2085 Messages marked as
2086 .Ic draft .
2087 .It Ar s
2088 \*(OP Messages classified as spam (see
2089 .Sx "Handling spam" . )
2090 .It Ar S
2091 \*(OP Messages with unsure spam classification.
2097 \*(OP IMAP-style SEARCH expressions may also be used.
2098 This addressing mode is available with all types of folders;
2099 \*(UA will perform the search locally as necessary.
2100 Strings must be enclosed by double quotes
2101 .Ql \&"
2102 in their entirety if they contain whitespace or parentheses;
2103 within the quotes, only reverse solidus
2104 .Ql \e
2105 is recognized as an escape character.
2106 All string searches are case-insensitive.
2107 When the description indicates that the
2108 .Dq envelope
2109 representation of an address field is used,
2110 this means that the search string is checked against both a list
2111 constructed as
2113 .Bd -literal -offset indent
2114 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2118 for each address,
2119 and the addresses without real names from the respective header field.
2120 These search expressions can be nested using parentheses, see below for
2121 examples.
2124 .Bl -tag -compact -width ".It Ar _n_u"
2125 .It Ar ( criterion )
2126 All messages that satisfy the given
2127 .Ar criterion .
2128 .It Ar ( criterion1 criterion2 ... criterionN )
2129 All messages that satisfy all of the given criteria.
2131 .It Ar ( or criterion1 criterion2 )
2132 All messages that satisfy either
2133 .Ar criterion1
2135 .Ar criterion2 ,
2136 or both.
2137 To connect more than two criteria using
2138 .Ql or
2139 specifications have to be nested using additional parentheses,
2140 as with
2141 .Ql (or a (or b c)) ,
2142 since
2143 .Ql (or a b c)
2144 really means
2145 .Ql ((a or b) and c) .
2146 For a simple
2147 .Ql or
2148 operation of independent criteria on the lowest nesting level,
2149 it is possible to achieve similar effects by using three separate
2150 criteria, as with
2151 .Ql (a) (b) (c) .
2153 .It Ar ( not criterion )
2154 All messages that do not satisfy
2155 .Ar criterion .
2156 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2157 All messages that contain
2158 .Ar string
2159 in the envelope representation of the
2160 .Ql Bcc:
2161 field.
2162 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2163 All messages that contain
2164 .Ar string
2165 in the envelope representation of the
2166 .Ql Cc:
2167 field.
2168 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2169 All messages that contain
2170 .Ar string
2171 in the envelope representation of the
2172 .Ql From:
2173 field.
2174 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2175 All messages that contain
2176 .Ar string
2177 in the
2178 .Ql Subject:
2179 field.
2180 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2181 All messages that contain
2182 .Ar string
2183 in the envelope representation of the
2184 .Ql To:
2185 field.
2186 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2187 All messages that contain
2188 .Ar string
2189 in the specified
2190 .Ql Name:
2191 field.
2192 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2193 All messages that contain
2194 .Ar string
2195 in their body.
2196 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2197 All messages that contain
2198 .Ar string
2199 in their header or body.
2200 .It Ar ( larger size )
2201 All messages that are larger than
2202 .Ar size
2203 (in bytes).
2204 .It Ar ( smaller size )
2205 All messages that are smaller than
2206 .Ar size
2207 (in bytes).
2209 .It Ar ( before date )
2210 All messages that were received before
2211 .Ar date ,
2212 which must be in the form
2213 .Ql d[d]-mon-yyyy ,
2214 where
2215 .Ql d
2216 denotes the day of the month as one or two digits,
2217 .Ql mon
2218 is the name of the month \(en one of
2219 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2221 .Ql yyyy
2222 is the year as four digits, e.g.,
2223 .Ql 28-Dec-2012 .
2225 .It Ar ( on date )
2226 All messages that were received on the specified date.
2227 .It Ar ( since date )
2228 All messages that were received since the specified date.
2229 .It Ar ( sentbefore date )
2230 All messages that were sent on the specified date.
2231 .It Ar ( senton date )
2232 All messages that were sent on the specified date.
2233 .It Ar ( sentsince date )
2234 All messages that were sent since the specified date.
2235 .It Ar ()
2236 The same criterion as for the previous search.
2237 This specification cannot be used as part of another criterion.
2238 If the previous command line contained more than one independent
2239 criterion then the last of those criteria is used.
2241 .\" }}}
2243 .\" .Ss "On URL syntax and credential lookup" {{{
2244 .Ss "On URL syntax and credential lookup"
2246 \*(IN For accessing protocol-specific resources usage of Uniform
2247 Resource Locators (URL, RFC 1738) has become omnipresent.
2248 \*(UA expects and understands URLs in the following form;
2249 parts in brackets
2250 .Ql []
2251 denote optional parts, optional either because there also exist other
2252 ways to define the information in question or because support of the
2253 part is protocol-specific (e.g.,
2254 .Ql /path
2255 is used by the local maildir and the IMAP protocol, but not by POP3);
2256 If any of
2257 .Ql USER
2259 .Ql PASSWORD
2260 are specified they must be given in URL percent encoded form (RFC 3986;
2261 the command
2262 .Ic urlcodec
2263 may be helpful):
2266 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
2269 Note that these \*(UA URLs most often do not conform to any real
2270 standard, but instead represent a normalized variant of RFC 1738 \(en
2271 they are not used in data exchange but only meant as a compact,
2272 easy-to-use way of defining and representing information in
2273 a well-known notation.
2276 Many internal variables of \*(UA exist in multiple versions, called
2277 variable chains for the rest of this document: the plain
2278 .Ql variable
2279 as well as
2280 .Ql variable-HOST
2282 .Ql variable-USER@HOST .
2283 Here
2284 .Ql HOST
2285 indeed means
2286 .Ql server:port
2287 if a
2288 .Ql port
2289 had been specified in the respective URL, otherwise it refers to the plain
2290 .Ql server .
2291 Also,
2292 .Ql USER
2293 is not truly the
2294 .Ql USER
2295 that had been found when doing the user chain lookup as is described
2296 below, i.e., this
2297 .Ql USER
2298 will never be in URL percent encoded form, whether it came from an URL
2299 or not; i.e., variable chain name extensions of
2300 .Sx "INTERNAL VARIABLES"
2301 must not be URL percent encoded.
2304 For example, whether an hypothetical URL
2305 .Ql smtp://hey%3Ayou@our.house
2306 had been given that includes a user, or whether the URL was
2307 .Ql smtp://our.house
2308 and the user had been found differently, to lookup the variable chain
2309 .Va smtp-use-starttls
2310 \*(UA first looks for whether
2311 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
2312 is defined, then whether
2313 .Ql smtp-\:use-\:starttls-\:our.house
2314 exists before finally ending up looking at the plain variable itself.
2317 \*(UA obeys the following logic scheme when dealing with the
2318 necessary credential information of an account:
2320 .Bl -bullet
2322 If no
2323 .Ql USER
2324 has been given in the URL the variables
2325 .Va user-HOST
2327 .Va user
2328 are looked up; if no such variable(s) can be found then \*(UA will,
2329 when enforced by the \*(OPal variables
2330 .Va netrc-lookup-HOST
2332 .Va netrc-lookup ,
2333 search the users
2334 .Pa .netrc
2335 file for a
2336 .Ql HOST
2337 specific entry which provides a
2338 .Ql login
2339 name: this lookup will only succeed if unambiguous (one possible matching
2340 entry for
2341 .Ql HOST ) .
2342 It is possible to load encrypted
2343 .Pa .netrc
2344 files via
2345 .Va netrc-pipe .
2347 If there is still no
2348 .Ql USER
2349 then \*(UA will fall back to the user who is supposed to run \*(UA,
2350 the identity of which has been fixated during \*(UA startup and is
2351 known to be a valid user on the current host.
2354 Authentication: unless otherwise noted this will lookup the
2355 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
2356 variable chain, falling back to a protocol-specific default should this
2357 have no success.
2360 If no
2361 .Ql PASSWORD
2362 has been given in the URL, then if the
2363 .Ql USER
2364 has been found through the \*(OPal
2365 .Va netrc-lookup
2366 that may have already provided the password, too.
2367 Otherwise the variable chain
2368 .Va password-USER@HOST , password-HOST , password
2369 is looked up and used if existent.
2371 Afterwards the complete \*(OPal variable chain
2372 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
2373 is looked up.
2374 If set, the
2375 .Pa .netrc
2376 cache is searched for a password only (multiple user accounts for
2377 a single machine may exist as well as a fallback entry without user
2378 but with a password).
2380 If at that point there is still no password available, but the
2381 (protocols') chosen authentication type requires a password, then in
2382 interactive mode the user will be prompted on the terminal.
2386 .Sy Note:
2387 S/MIME verification works relative to the values found in the
2388 .Ql From:
2390 .Ql Sender: )
2391 header field(s), which means that the values of
2392 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
2394 .Va smime-sign-message-digest
2395 will not be looked up using the
2396 .Ql USER
2398 .Ql HOST
2399 chains from above but instead use the corresponding values from the
2400 message that is being worked on.
2401 In unusual cases multiple and different
2402 .Ql USER
2404 .Ql HOST
2405 combinations may therefore be involved \(en on the other hand those
2406 unusual cases become possible.
2407 The usual case is as short as:
2410 .Dl set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
2411 .Dl \ \ \ \ smime-sign smime-sign-cert=+smime.pair
2414 The section
2415 .Sx EXAMPLES
2416 contains complete example configurations.
2417 .\" }}}
2419 .\" .Ss "On terminal control and line editor" {{{
2420 .Ss "On terminal control and line editor"
2422 \*(OP Terminal control will be realized through one of the standard
2424 libraries, either the
2425 .Lb libtermcap ,
2426 or, alternatively, the
2427 .Lb libterminfo ,
2428 both of which will be initialized to work with the environment variable
2429 .Ev TERM .
2430 Terminal control will enhance or enable interactive usage aspects, e.g.,
2431 .Sx "Coloured display" ,
2432 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2433 byte-sequences of keys like the cursor and function keys, and which will
2434 automatically enter the so-called
2435 .Dq ca-mode
2436 alternative screen shall the terminal support it.
2437 The internal variable
2438 .Va termcap
2439 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2440 Actual interaction with the chosen library can be disabled completely by
2441 setting the internal variable
2442 .Va termcap-disable ;
2443 .Va termcap
2444 will be queried regardless, even if the \*(OPal support for the
2445 libraries has not been enabled at configuration time.
2448 \*(OP The builtin \*(UA Mailx-Line-Editor (MLE) should work in all
2449 environments which comply to the ISO C standard
2450 .St -isoC-amd1 ,
2451 and will support wide glyphs if possible (the necessary functionality
2452 had been removed from ISO C, but was included in
2453 .St -xpg4 ) .
2454 Prevent usage of a line editor in interactive mode by setting the
2455 internal variable
2456 .Va line-editor-disable .
2457 Especially if the \*(OPal terminal control support is missing setting
2458 entries in the internal variable
2459 .Va termcap
2460 will help shall the MLE misbehave, see there for more.
2461 The MLE can support a little bit of
2462 .Ic colour .
2465 \*(OP If the
2466 .Ic history
2467 feature is available then input from line editor prompts will be saved
2468 in a history list that can be searched in and be expanded from.
2469 Such saving can be prevented by prefixing input with any amount of
2470 whitespace.
2471 Aspects of history, like allowed content and maximum size, as well as
2472 whether history shall be saved persistently, can be configured with the
2473 internal variables
2474 .Va history-file ,
2475 .Va history-gabby ,
2476 .Va history-gabby-persist
2478 .Va history-size .
2481 The MLE supports a set of editing and control commands.
2482 By default (as) many (as possible) of these will be assigned to a set of
2483 single-letter control codes, which should work on any terminal (and can
2484 be generated by holding the
2485 .Dq control
2486 key while pressing the key of desire, e.g.,
2487 .Ql control-D ) .
2488 If the \*(OPal
2489 .Ic bind
2490 command is available then the MLE commands can also be accessed freely
2491 by assigning the command name, which is shown in parenthesis in the list
2492 below, to any desired key-sequence, and the MLE will instead and also use
2493 .Ic bind
2494 to establish its builtin key bindings
2495 (more of them if the \*(OPal terminal control is available),
2496 an action which can then be suppressed completely by setting
2497 .Va line-editor-no-defaults .
2498 .Sx "Shell-style argument quoting"
2499 notation is used in the following;
2500 combinations not mentioned either cause job control signals or do not
2501 generate a (unique) keycode:
2505 .Bl -tag -compact -width ".It Ql Ba"
2506 .It Ql \ecA
2507 Go to the start of the line
2509 .Pf ( Cd mle-go-home ) .
2511 .It Ql \ecB
2512 Move the cursor backward one character
2514 .Pf ( Cd mle-go-bwd ) .
2516 .It Ql \ecD
2517 Forward delete the character under the cursor;
2518 quits \*(UA if used on the empty line unless the internal variable
2519 .Va ignoreeof
2520 is set
2522 .Pf ( Cd mle-del-fwd ) .
2524 .It Ql \ecE
2525 Go to the end of the line
2527 .Pf ( Cd mle-go-end ) .
2529 .It Ql \ecF
2530 Move the cursor forward one character
2532 .Pf ( Cd mle-go-fwd ) .
2534 .It Ql \ecG
2535 Cancel current operation, full reset.
2536 If there is an active history search or tabulator expansion then this
2537 command will first reset that, reverting to the former line content;
2538 thus a second reset is needed for a full reset in this case
2540 .Pf ( Cd mle-reset ) .
2542 .It Ql \ecH
2543 Backspace: backward delete one character
2545 .Pf ( Cd mle-del-bwd ) .
2547 .It Ql \ecI
2548 \*(NQ
2549 Horizontal tabulator:
2550 try to expand the word before the cursor, supporting the usual
2551 .Sx "Filename transformations"
2553 .Pf ( Cd mle-complete ) .
2554 This is affected by
2555 .Cd mle-quote-rndtrip .
2557 .It Ql \ecJ
2558 Newline:
2559 commit the current line
2561 .Pf ( Cd mle-commit ) .
2563 .It Ql \ecK
2564 Cut all characters from the cursor to the end of the line
2566 .Pf ( Cd mle-snarf-end ) .
2568 .It Ql \ecL
2569 Repaint the line
2571 .Pf ( Cd mle-repaint ) .
2573 .It Ql \ecN
2574 \*(OP Go to the next history entry
2576 .Pf ( Cd mle-hist-fwd ) .
2578 .It Ql \ecO
2579 (\*(OPally context-dependent) Invokes the command
2580 .Ql Ic dt .
2582 .It Ql \ecP
2583 \*(OP Go to the previous history entry
2585 .Pf ( Cd mle-hist-bwd ) .
2587 .It Ql \ecQ
2588 Toggle roundtrip mode shell quotes, where produced,
2589 on and off
2591 .Pf ( Cd mle-quote-rndtrip ) .
2592 This setting is temporary, and will be forgotten once the command line
2593 is committed; also see
2594 .Ic shcodec .
2596 .It Ql \ecR
2597 \*(OP Complete the current line from (the remaining) older history entries
2599 .Pf ( Cd mle-hist-srch-bwd ) .
2601 .It Ql \ecS
2602 \*(OP Complete the current line from (the remaining) newer history entries
2604 .Pf ( Cd mle-hist-srch-fwd ) .
2606 .It Ql \ecT
2607 Paste the snarf buffer
2609 .Pf ( Cd mle-paste ) .
2611 .It Ql \ecU
2612 The same as
2613 .Ql \ecA
2614 followed by
2615 .Ql \ecK
2617 .Pf ( Cd mle-snarf-line ) .
2619 .It Ql \ecV
2620 Prompts for a Unicode character (its hexadecimal number) to be inserted
2622 .Pf ( Cd mle-prompt-char ) .
2623 Note this command needs to be assigned to a single-letter control code
2624 in order to become recognized and executed during input of
2625 a key-sequence (only three single-letter control codes can be used for
2626 that shortcut purpose); this control code is special-treated and cannot
2627 be part of any other sequence, because any occurrence will perform the
2628 .Cd mle-prompt-char
2629 function immediately.
2631 .It Ql \ecW
2632 Cut the characters from the one preceding the cursor to the preceding
2633 word boundary
2635 .Pf ( Cd mle-snarf-word-bwd ) .
2637 .It Ql \ecX
2638 Move the cursor forward one word boundary
2640 .Pf ( Cd mle-go-word-fwd ) .
2642 .It Ql \ecY
2643 Move the cursor backward one word boundary
2645 .Pf ( Cd mle-go-word-bwd ) .
2647 .It Ql \ec[
2648 Escape: reset a possibly used multibyte character input state machine
2649 and \*(OPally a lingering, incomplete key binding
2651 .Pf ( Cd mle-cancel ) .
2652 This command needs to be assigned to a single-letter control code in
2653 order to become recognized and executed during input of a key-sequence
2654 (only three single-letter control codes can be used for that shortcut
2655 purpose).
2656 This control code may also be part of a multi-byte sequence, but if
2657 a sequence is active and the very control code is currently also an
2658 expected input, then it will first be consumed by the active sequence.
2660 .It Ql \ec\e
2661 (\*(OPally context-dependent) Invokes the command
2662 .Ql Ic z Ns + .
2664 .It Ql \ec]
2665 (\*(OPally context-dependent) Invokes the command
2666 .Ql Ic z Ns $ .
2668 .It Ql \ec^
2669 (\*(OPally context-dependent) Invokes the command
2670 .Ql Ic z Ns 0 .
2672 .It Ql \ec_
2673 Cut the characters from the one after the cursor to the succeeding word
2674 boundary
2676 .Pf ( Cd mle-snarf-word-fwd ) .
2678 .It Ql \ec?
2679 Backspace:
2680 .Cd mle-del-bwd .
2682 .It \(en
2684 .Cd mle-fullreset :
2685 in difference to
2686 .Cd mle-reset
2687 this will immediately reset a possibly active search etc.
2689 .It \(en
2691 .Cd mle-bell :
2692 ring the audible bell.
2694 .\" }}}
2696 .\" .Ss "Coloured display" {{{
2697 .Ss "Coloured display"
2699 \*(OP \*(UA can be configured to support a coloured display and font
2700 attributes by emitting ANSI / ISO 6429 SGR (select graphic rendition)
2701 escape sequences.
2702 Usage of colours and font attributes solely depends upon the
2703 capability of the detected terminal type that is defined by the
2704 environment variable
2705 .Ev TERM
2706 and which can be fine-tuned by the user via the internal variable
2707 .Va termcap .
2710 On top of what \*(UA knows about the terminal the boolean variable
2711 .Va colour-pager
2712 defines whether the actually applicable colour and font attribute
2713 sequences should also be generated when output is going to be paged
2714 through the external program defined by the environment variable
2715 .Ev PAGER
2716 (also see
2717 .Va crt Ns
2719 This is not enabled by default because different pager programs need
2720 different command line switches or other configuration in order to
2721 support those sequences.
2722 \*(UA however knows about some widely used pagers and in a clean
2723 environment it is often enough to simply set
2724 .Va colour-pager ;
2725 please refer to that variable for more on this topic.
2728 If the variable
2729 .Va colour-disable
2730 is set then any active usage of colour and font attribute sequences
2731 is suppressed, but without affecting possibly established
2732 .Ic colour
2733 mappings.
2736 To define and control colours and font attributes a single multiplexer
2737 command family exists:
2738 .Ic colour
2739 shows or defines colour mappings for the given colour type (e.g.,
2740 monochrome) and
2741 .Ic uncolour
2742 can be used to remove mappings of a given colour type.
2743 Since colours are only available in interactive mode, it may make
2744 sense to conditionalize the colour setup by encapsulating it with
2745 .Ic if :
2747 .Bd -literal -offset indent
2748 if terminal && $features =@ +colour
2749   colour iso  view-msginfo  ft=bold,fg=green
2750   colour iso  view-header   ft=bold,fg=red   "from,subject"
2751   colour iso  view-header   fg=red
2753   uncolour iso view-header  from,subject
2754   colour iso  view-header   ft=bold,fg=magenta,bg=cyan
2755   colour 256  view-header   ft=bold,fg=208,bg=230 subject,from
2756   colour mono view-header   ft=bold
2757   colour mono view-header   ft=bold,ft=reverse subject,from
2758 endif
2760 .\" }}}
2761 .\" }}} (DESCRIPTION)
2764 .\" .Sh COMMANDS {{{
2765 .Sh COMMANDS
2767 Each command is typed on a line by itself,
2768 and may take arguments following the command word.
2769 An unquoted reverse solidus
2770 .Ql \e
2771 at the end of a command line
2772 .Dq escapes
2773 the newline character: it is discarded and the next line of input is
2774 used as a follow-up line, with all leading whitespace removed;
2775 once the entire command line is completed, the processing that is
2776 documented in the following, after removal of the whitespace characters
2777 .Cm space , tabulator , newline
2778 as well as those defined by the variable
2779 .Va ifs
2780 from the beginning and end of the line, begins.
2783 Command names may be abbreviated, in which case the first command that
2784 matches the given prefix will be used.
2785 The command
2786 .Ic list
2787 can be used to show the list of all commands, either alphabetically
2788 sorted or in prefix search order (these do not match, also because the
2789 POSIX standard prescribes a set of abbreviations).
2790 \*(OPally the command
2791 .Ic help
2793 .Ic \&? ) ,
2794 when given an argument, will show a documentation string for the
2795 command matching the expanded argument, as in
2796 .Ql ?t ,
2797 which should be a shorthand of
2798 .Ql ?type ;
2799 with these documentation strings both commands support a more
2800 .Va verbose
2801 listing mode which includes the argument type of the command and other
2802 information which applies; a handy suggestion might thus be:
2804 .Bd -literal -offset indent
2805 ? define __xv {
2806   # Before v15: need to enable sh(1)ell-style on _entire_ line!
2807   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
2809 ? commandalias xv '\ecall __xv'
2810 ? xv help set
2813 .\" .Ss "Command modifiers" {{{
2814 .Ss "Command modifiers"
2816 Commands may be prefixed by one or multiple command modifiers.
2818 .Bl -bullet
2820 The modifier reverse solidus
2822 .Cm \e ,
2823 to be placed first, prevents
2824 .Ic commandalias
2825 expansions on the remains of the line, e.g.,
2826 .Ql \eecho
2827 will always evaluate the command
2828 .Ic echo ,
2829 even if an (command)alias of the same name exists.
2830 .Ic commandalias
2831 content may itself contain further command modifiers, including
2832 an initial reverse solidus to prevent further expansions.
2835 The modifier
2837 .Cm ignerr
2838 indicates that any error generated by the following command should be
2839 ignored by the state machine and not cause a program exit with enabled
2840 .Va errexit
2841 or for the standardized exit cases in
2842 .Ev POSIXLY_CORRECT
2843 mode.
2844 .Va \&? ,
2845 one of the
2846 .Sx "INTERNAL VARIABLES" ,
2847 will be set to the real exit status of the command regardless.
2850 Some commands support the
2852 .Cm vput
2853 modifier: if used, they expect the name of a variable, which can itself
2854 be a variable, i.e., shell expansion is applied, as their first
2855 argument, and will place their computation result in it instead of the
2856 default location (it is usually written to standard output).
2857 The given name will be tested for being a valid
2858 .Xr sh 1
2859 variable name, and may therefore only consist of upper- and lowercase
2860 characters, digits, and the underscore; the hyphen-minus may be used as
2861 a non-portable extension; digits may not be used as first, hyphen-minus
2862 may not be used as last characters.
2863 In addition the name may either not be one of the known
2864 .Sx "INTERNAL VARIABLES" ,
2865 or must otherwise refer to a writable (non-boolean) value variable.
2866 The actual put operation may fail nonetheless, e.g., if the variable
2867 expects a number argument only a number will be accepted.
2868 Any error during these operations causes the command as such to fail,
2869 and the error number
2870 .Va \&!
2871 will be set to
2872 .Va ^ERR Ns -NOTSUP .
2875 Last, but not least, the modifier
2877 .Cm wysh
2878 can be used for some old and established commands to choose the new
2879 .Sx "Shell-style argument quoting"
2880 rules over the traditional
2881 .Sx "Old-style argument quoting" .
2883 .\" }}}
2885 .\" .Ss "Message list arguments" {{{
2886 .Ss "Message list arguments"
2888 Some commands expect arguments that represent messages (actually
2889 their symbolic message numbers), as has been documented above under
2890 .Sx "Specifying messages"
2891 already.
2892 If no explicit message list has been specified, the next message
2893 forward that satisfies the command's requirements will be used,
2894 and if there are no messages forward of the current message,
2895 the search proceeds backwards;
2896 if there are no good messages at all to be found, an error message is
2897 shown and the command is aborted.
2898 .\" }}}
2900 .\" .Ss "Old-style argument quoting" {{{
2901 .Ss "Old-style argument quoting"
2903 \*(ID This section documents the old, traditional style of quoting
2904 non-message-list arguments to commands which expect this type of
2905 arguments: whereas still used by the majority of such commands, the new
2906 .Sx "Shell-style argument quoting"
2907 may be available even for those via
2908 .Cm wysh ,
2909 one of the
2910 .Sx "Command modifiers" .
2911 Nonetheless care must be taken, because only new commands have been
2912 designed with all the capabilities of the new quoting rules in mind,
2913 which can, e.g., generate control characters.
2916 .Bl -bullet -offset indent
2918 An argument can be enclosed between paired double-quotes
2919 .Ql """argument"""
2921 single-quotes
2922 .Ql 'argument' ;
2923 any whitespace, shell word expansion, or reverse solidus characters
2924 (except as described next) within the quotes are treated literally as
2925 part of the argument.
2926 A double-quote will be treated literally within single-quotes and vice
2927 versa.
2928 Inside such a quoted string the actually used quote character can be
2929 used nonetheless by escaping it with a reverse solidus
2930 .Ql \e ,
2931 as in
2932 .Ql """y\e""ou""" .
2935 An argument that is not enclosed in quotes, as above, can usually still
2936 contain space characters if those spaces are reverse solidus escaped, as in
2937 .Ql you\e are .
2940 A reverse solidus outside of the enclosing quotes is discarded
2941 and the following character is treated literally as part of the argument.
2943 .\" }}}
2945 .\" .Ss "Shell-style argument quoting" {{{
2946 .Ss "Shell-style argument quoting"
2948 Commands which don't expect message-list arguments use
2949 .Xr sh 1 Ns
2950 ell-style, and therefore POSIX standardized, argument parsing and
2951 quoting rules.
2952 \*(ID Most new commands only support these new rules and are flagged
2953 \*(NQ, some elder ones can use them with the command modifier
2954 .Cm wysh ;
2955 in the future only this type of argument quoting will remain.
2958 A command line is parsed from left to right and an input token is
2959 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
2960 Metacharacters are vertical bar
2961 .Cm \&| ,
2962 ampersand
2963 .Cm & ,
2964 semicolon
2965 .Cm \&; ,
2966 as well as all characters from the variable
2967 .Va ifs ,
2968 and / or
2969 .Cm space , tabulator , newline .
2970 The additional metacharacters left and right parenthesis
2971 .Cm \&( , \&)
2972 and less-than and greater-than signs
2973 .Cm < , >
2974 that the
2975 .Xr sh 1
2976 supports are not used, and are treated as ordinary characters: for one
2977 these characters are a vivid part of email addresses, and it seems
2978 highly unlikely that their function will become meaningful to \*(UA.
2980 .Bd -filled -offset indent
2981 .Sy Compatibility note:
2982 \*(ID Please note that many even new-style commands do not yet honour
2983 .Va ifs
2984 to parse their arguments: whereas the
2985 .Xr sh 1 Ns
2986 ell is a language with syntactic elements of clearly defined semantics,
2987 \*(UA parses entire input lines and decides on a per-command base what
2988 to do with the rest of the line.
2989 Often it even depends on subcommands how the rest of the line should be
2990 treated, and until v15 we are not capable to perform this deep
2991 inspection of arguments.
2992 Nonetheless, at least the following commands which work with positional
2993 parameters fully support
2994 .Va ifs
2995 for an almost shell-compatible field splitting:
2996 .Ic call , call_if , read , vpospar , xcall .
3000 Any unquoted number sign
3001 .Ql #
3002 at the beginning of a new token starts a comment that extends to the end
3003 of the line, and therefore ends argument processing.
3004 An unquoted dollar sign
3005 .Ql $
3006 will cause variable expansion of the given name, which must be a valid
3007 .Xr sh 1 Ns
3008 ell-style variable name (see
3009 .Cm vput ) :
3010 .Sx "INTERNAL VARIABLES"
3011 as well as
3012 .Sx ENVIRONMENT
3013 (shell) variables can be accessed through this mechanism, brace
3014 enclosing the name is supported (i.e., to subdivide a token).
3017 Whereas the metacharacters
3018 .Cm space , tabulator , newline
3019 only complete an input token, vertical bar
3020 .Cm \&| ,
3021 ampersand
3022 .Cm &
3023 and semicolon
3024 .Cm \&;
3025 also act as control operators and perform control functions.
3026 For now supported is semicolon
3027 .Cm \&; ,
3028 which terminates a single command, therefore sequencing the command line
3029 and making the remainder of the line a subject to reevaluation.
3030 With sequencing, multiple command argument types and quoting rules may
3031 therefore apply to a single line, which can become problematic before
3032 v15: e.g., the first of the following will cause surprising results.
3035 .Dl ? echo one; set verbose; echo verbose=$verbose.
3036 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3039 Quoting is a mechanism that will remove the special meaning of
3040 metacharacters and reserved words, and will prevent expansion.
3041 There are four quoting mechanisms: the escape character, single-quotes,
3042 double-quotes and dollar-single-quotes:
3045 .Bl -bullet -offset indent
3047 The literal value of any character can be preserved by preceding it
3048 with the escape character reverse solidus
3049 .Ql \e .
3052 Arguments which are enclosed in
3053 .Ql 'single-\:quotes'
3054 retain their literal value.
3055 A single-quote cannot occur within single-quotes.
3058 The literal value of all characters enclosed in
3059 .Ql \(dqdouble-\:quotes\(dq
3060 is retained, with the exception of dollar sign
3061 .Ql $ ,
3062 which will cause variable expansion, as above, backquote (grave accent)
3063 .Ql ` ,
3064 (which not yet means anything special), reverse solidus
3065 .Ql \e ,
3066 which will escape any of the characters dollar sign
3067 .Ql $
3068 (to prevent variable expansion), backquote (grave accent)
3069 .Ql ` ,
3070 double-quote
3071 .Ql \(dq
3072 (to prevent ending the quote) and reverse solidus
3073 .Ql \e
3074 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3075 but has no special meaning otherwise.
3078 Arguments enclosed in
3079 .Ql $'dollar-\:single-\:quotes'
3080 extend normal single quotes in that reverse solidus escape sequences are
3081 expanded as follows:
3083 .Bl -tag -compact -width "Ql \eNNN"
3084 .It Ql \ea
3085 alerts (bell).
3086 .It Ql \eb
3087 emits a backspace.
3088 .It Ql \eE
3089 an escape character.
3090 .It Ql \ee
3091 an escape character.
3092 .It Ql \ef
3093 form feed.
3094 .It Ql \en
3095 new line.
3096 .It Ql \er
3097 carriage return.
3098 .It Ql \et
3099 horizontal tab.
3100 .It Ql \ev
3101 vertical tab.
3102 .It Ql \e\e
3103 emits a reverse solidus character.
3104 .It Ql \e'
3105 single quote.
3106 .It Ql \e"
3107 double quote (escaping is optional).
3108 .It Ql \eNNN
3109 eight-bit byte with the octal value
3110 .Ql NNN
3111 (one to three octal digits), optionally prefixed by an additional
3112 .Ql 0 .
3113 A 0 byte will suppress further output for the quoted argument.
3114 .It Ql \exHH
3115 eight-bit byte with the hexadecimal value
3116 .Ql HH
3117 (one or two hexadecimal characters).
3118 A 0 byte will suppress further output for the quoted argument.
3119 .It Ql \eUHHHHHHHH
3120 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3121 .Ql HHHHHHHH
3122 (one to eight hexadecimal digits) \(em note that Unicode defines the
3123 maximum codepoint ever to be supported as
3124 .Ql 0x10FFFF
3125 (in planes of
3126 .Ql 0xFFFF
3127 characters each).
3128 This escape is only supported in locales which support Unicode (see
3129 .Sx "Character sets" ) ,
3130 in other cases the sequence will remain unexpanded unless the given code
3131 point is ASCII compatible or can be represented in the current locale.
3132 The character NUL will suppress further output for the quoted argument.
3133 .It Ql \euHHHH
3134 Identical to
3135 .Ql \eUHHHHHHHH
3136 except it takes only one to four hexadecimal digits.
3137 .It Ql \ecX
3138 Emits the non-printable (ASCII and compatible) C0 control codes
3139 0 (NUL) to 31 (US), and 127 (DEL).
3140 Printable representations of ASCII control codes can be created by
3141 mapping them to a different part of the ASCII character set, which is
3142 possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is
3143 .Ql 7 + 64 = 71 = G .
3144 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3145 .Ic vexpr ) ,
3146 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3147 .Ql ? vexpr ^ 127 64 .
3149 Whereas historically circumflex notation has often been used for
3150 visualization purposes of control codes, e.g.,
3151 .Ql ^G ,
3152 the reverse solidus notation has been standardized:
3153 .Ql \ecG .
3154 Some control codes also have standardized (ISO 10646, ISO C) aliases,
3155 as shown above (e.g.,
3156 .Ql \ea ,
3157 .Ql \en ,
3158 .Ql \et ) :
3159 whenever such an alias exists it will be used for display purposes.
3160 The control code NUL
3161 .Pf ( Ql \ec@ ,
3162 a non-standard extension) will suppress further output for the remains
3163 of the token (which may extend beyond the current quote), or, depending
3164 on the context, the remains of all arguments for the current command.
3165 .It Ql \e$NAME
3166 Non-standard extension: expand the given variable name, as above.
3167 Brace enclosing the name is supported.
3168 .It Ql \e`{command}
3169 Not yet supported, just to raise awareness: Non-standard extension.
3174 Caveats:
3176 .Bd -literal -offset indent
3177 echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3178 echo Quotes ${HOME} and tokens differ! # comment
3179 echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3181 .\" }}}
3183 .\" .Ss "Raw data arguments for codec commands" {{{
3184 .Ss "Raw data arguments for codec commands"
3186 A special set of commands, which all have the string
3187 .Dq codec
3188 in their name, e.g.,
3189 .Ic addrcodec ,
3190 .Ic shcodec ,
3191 .Ic urlcodec ,
3192 take raw string data as input, which means that the content of the
3193 command input line is passed completely unexpanded and otherwise
3194 unchanged: like this the effect of the actual codec is visible without
3195 any noise of possible shell quoting rules etc., i.e., the user can input
3196 one-to-one the desired or questionable data.
3197 To gain a level of expansion, the entire command line can be
3198 .Ic eval Ns
3199 uated first, e.g.,
3201 .Bd -literal -offset indent
3202 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3203 ? echo $res
3204 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3205 ? shcodec d $res
3206 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3207 ? eval shcodec d $res
3208 /usr/Sch\[:o]nes Wetter/heute.txt
3210 .\" }}}
3212 .\" .Ss "Filename transformations" {{{
3213 .Ss "Filename transformations"
3215 Filenames, where expected, and unless documented otherwise, are
3216 subsequently subject to the following filename transformations, in
3217 sequence:
3219 .Bl -bullet -offset indent
3221 If the given name is a registered
3222 .Ic shortcut ,
3223 it will be replaced with the expanded shortcut.
3226 The filename is matched against the following patterns or strings:
3228 .Bl -hang -compact -width ".Ar %user"
3229 .It Ar #
3230 (Number sign) is expanded to the previous file.
3231 .It Ar %
3232 (Percent sign) is replaced by the invoking
3233 .Mx -ix "primary system mailbox"
3234 user's primary system mailbox, which either is the (itself expandable)
3235 .Va inbox
3236 if that is set, the standardized absolute pathname indicated by
3237 .Ev MAIL
3238 if that is set, or a builtin compile-time default otherwise.
3239 .It Ar %user
3240 Expands to the primary system mailbox of
3241 .Ar user
3242 (and never the value of
3243 .Va inbox ,
3244 regardless of its actual setting).
3245 .It Ar &
3246 (Ampersand) is replaced with the invoking users
3247 .Mx -ix "secondary mailbox"
3248 secondary mailbox, the
3249 .Ev MBOX .
3250 .It Ar +file
3251 Refers to a
3252 .Ar file
3253 in the
3254 .Va folder
3255 directory (if that variable is set).
3256 .It Ar %:filespec
3257 Expands to the same value as
3258 .Ar filespec ,
3259 but has special meaning when used with, e.g., the command
3260 .Ic file :
3261 the file will be treated as a primary system mailbox by, e.g., the
3262 .Ic mbox
3264 .Ic save
3265 commands, meaning that messages that have been read in the current
3266 session will be moved to the
3267 .Ev MBOX
3268 mailbox instead of simply being flagged as read.
3272 Meta expansions are applied to the resulting filename, as applicable to
3273 the resulting file access protocol (also see
3274 .Sx "On URL syntax and credential lookup" ) .
3275 If the fully expanded filename results in multiple pathnames and the
3276 command is expecting only one file, an error results.
3278 For the file-protocol, a leading tilde
3279 .Ql ~
3280 character will be replaced by the expansion of
3281 .Ev HOME ,
3282 except when followed by a valid user name, in which case the home
3283 directory of the given user is used instead.
3285 Any occurrence of
3286 .Ql $VARIABLE
3288 .Ql ${VARIABLE} )
3289 will be replaced by the expansion of the variable, if possible;
3290 .Sx "INTERNAL VARIABLES"
3291 as well as
3292 .Sx ENVIRONMENT
3293 (shell) variables can be accessed through this mechanism, and the usual
3294 escape mechanism has to be applied to prevent interpretation.
3296 In interactive context, in order to allow simple value acceptance (via
3297 .Dq ENTER ) ,
3298 arguments will usually be displayed in a properly quoted form, e.g., a file
3299 .Ql diet\e is \ecurd.txt
3300 may be displayed as
3301 .Ql 'diet\e is \ecurd.txt' .
3303 .\" }}}
3305 .\" .Ss "Commands" {{{
3306 .Ss "Commands"
3308 The following commands are available:
3310 .Bl -tag -width ".It Ic BaNg"
3312 .It Ic \&!
3313 Executes the
3314 .Ev SHELL
3315 command which follows, replacing unescaped exclamation marks with the
3316 previously executed command if the internal variable
3317 .Va bang
3318 is set.
3319 Supports
3320 .Cm vput
3321 (see
3322 .Sx "Command modifiers" ) ,
3323 and sets the error number
3324 .Va \&!
3326 .Va ^ERR Ns -CANCELED
3327 if the temporary file which is used to collect the standard output of
3328 the command for usage by
3329 .Cm vput
3330 cannot be created (also causing an empty result).
3333 .It Ic #
3334 The comment-command causes the entire line to be ignored.
3335 .Sy Note:
3336 this really is a normal command which' purpose is to discard its
3337 arguments, not a
3338 .Dq comment-start
3339 indicating special character, which means that, e.g., trailing comments
3340 on a line are not possible.
3343 .It Ic +
3344 Goes to the next message in sequence and types it
3345 (like
3346 .Dq ENTER ) .
3349 .It Ic -
3350 Display the preceding message, or the n'th previous message if given
3351 a numeric argument n.
3354 .It Ic =
3355 Show the current message number (the
3356 .Dq dot ) .
3359 .It Ic \&?
3360 Show a brief summary of commands.
3361 \*(OP Given an argument a synopsis for the command in question is
3362 shown instead; commands can be abbreviated in general and this command
3363 can be used to see the full expansion of an abbreviation including the
3364 synopsis, try, e.g.,
3365 .Ql ?h ,
3366 .Ql ?hel
3368 .Ql ?help
3369 and see how the output changes.
3370 This mode also supports a more
3371 .Va verbose
3372 output, which will provide the informations documented for
3373 .Ic list .
3376 .It Ic \&|
3377 A synonym for the
3378 .Ic pipe
3379 command.
3383 .It Ic account , unaccount
3384 (ac, una) Creates, selects or lists (an) account(s).
3385 Accounts are special incarnations of
3386 .Ic define Ns d
3387 macros and group commands and variable settings which together usually
3388 arrange the environment for the purpose of creating an email account.
3389 Different to normal macros settings which are covered by
3390 .Ic localopts
3391 \(en here by default enabled! \(en will not be reverted before the
3392 .Ic account
3393 is changed again.
3394 The special account
3395 .Ql null
3396 (case-insensitive) always exists, and all but it can be deleted by the
3397 latter command, and in one operation with the special name
3398 .Ql * .
3400 Without arguments a listing of all defined accounts is shown.
3401 With one argument the given account is activated: the system
3402 .Va inbox
3403 of that account will be activated (as via
3404 .Ic file ) ,
3405 a possibly installed
3406 .Va folder-hook
3407 will be run, and the internal variable
3408 .Va account
3409 will be updated.
3410 The two argument form is identical to defining a macro as via
3411 .Ic define :
3412 .Bd -literal -offset indent
3413 account myisp {
3414   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3415   set from='(My Name) myname@myisp.example'
3416   set mta=smtp://mylogin@smtp.myisp.example
3422 .It Ic addrcodec
3423 Perform email address codec transformations on raw-data argument, rather
3424 according to email standards (RFC 5322; \*(ID will furtherly improve).
3425 Supports
3426 .Cm vput
3427 (see
3428 .Sx "Command modifiers" ) ,
3429 and manages the error number
3430 .Va \&! .
3431 The first argument must be either
3432 .Ar [+[+[+]]]e[ncode] ,
3433 .Ar d[ecode]
3435 .Ar s[kin] ,
3436 and specifies the operation to perform on the rest of the line.
3439 Decoding will show how a standard-compliant MUA will display the given
3440 argument, which should be an email address.
3441 Please be aware that most MUAs have difficulties with the address
3442 standards, and vary wildly when (comments) in parenthesis,
3443 .Dq double-quoted
3444 strings, or quoted-pairs, as below, become involved.
3445 \*(ID \*(UA currently does not perform decoding when displaying addresses.
3448 Skinning is identical to decoding but only outputs the plain address,
3449 without any string, comment etc. components.
3450 Another difference is that it may fail with the error number
3451 .Va \&!
3452 set to
3453 .Va ^ERR Ns -INVAL
3454 if decoding fails to find a(n) (valid) email address, in which case the
3455 unmodified input will be output again.
3458 Encoding supports four different modes, lesser automated versions can be
3459 chosen by prefixing one, two or three plus signs: the standard imposes
3460 a special meaning on some characters, which thus have to be transformed
3461 to so-called quoted-pairs by pairing them with a reverse solidus
3462 .Ql \e
3463 in order to remove the special meaning; this might change interpretation
3464 of the entire argument from what has been desired, however!
3465 Specify one plus sign to remark that parenthesis shall be left alone,
3466 two for not turning double quotation marks into quoted-pairs, and three
3467 for also leaving any user-specified reverse solidus alone.
3468 The result will always be valid, if a successful exit status is reported.
3469 \*(ID Addresses need to be specified in between angle brackets
3470 .Ql < ,
3471 .Ql >
3472 if the construct becomes more difficult, otherwise the current parser
3473 will fail; it is not smart enough to guess right.
3475 .Bd -literal -offset indent
3476 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
3477 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3478 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3479 "Hey, you", \e out\e there <diet@exam.ple>
3480 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3481 diet@exam.ple
3487 .It Ic alias , unalias
3488 (a, una) Aliases are a method of creating personal distribution lists
3489 that map a single alias name to none to multiple real receivers;
3490 these aliases become expanded after message composing is completed.
3491 The latter command removes the given list of aliases, the special name
3492 .Ql *
3493 will discard all existing aliases.
3494 The former command shows all currently defined aliases when used without
3495 arguments, and with one argument the expansion of the given alias.
3496 With more than one argument, creates or appends to the alias name given
3497 as the first argument the remaining arguments.
3498 Alias names are restricted to alphabetic characters, digits, the
3499 underscore, hyphen-minus, the number sign, colon, commercial at and
3500 period, the last character can also be the dollar sign:
3501 .Ql [[:alnum:]_#:@.-]+$? .
3504 .It Ic alternates
3505 (alt) Manage a list of alternate addresses or names of the active user,
3506 members of which will be removed from recipient lists when replying to
3507 messages (and the
3508 .Va metoo
3509 variable is not set).
3510 Without arguments the current set of alternates is displayed, otherwise
3511 the set of alternate names is replaced by the given arguments, and the
3512 internal variable
3513 .Va alternates
3514 is updated accordingly.
3515 As an extension, if one argument is given and that is the hyphen-minus
3516 .Ql -
3517 then the set of alternates is removed.
3521 .It Ic answered , unanswered
3522 Take a message lists and mark each message as having been answered,
3523 having not been answered, respectively.
3524 Messages will be marked answered when being
3525 .Ic reply Ns d
3526 to automatically if the
3527 .Va markanswered
3528 variable is set.
3529 See the section
3530 .Sx "Message states" .
3535 .It Ic bind , unbind
3536 \*(OP\*(NQ The bind command extends the MLE (see
3537 .Sx "On terminal control and line editor" )
3538 with freely configurable key bindings.
3539 The latter command removes from the given context the given key binding,
3540 both of which may be specified as a wildcard
3541 .Ql * ,
3542 so that, e.g.,
3543 .Ql unbind * *
3544 will remove all bindings of all contexts.
3545 With one argument the former command shows all key bindings for the
3546 given context, specifying an asterisk
3547 .Ql *
3548 will show the bindings of all contexts; a more verbose listing will be
3549 produced if either of
3550 .Va debug
3552 .Va verbose
3553 are set.
3554 With two or more arguments a binding is (re)established:
3555 the first argument is the context to which the binding shall apply,
3556 the second argument is a comma-separated list of the
3557 .Dq keys
3558 which form the binding, and any remaining arguments form the expansion.
3559 To indicate that a binding shall not be auto-committed, but that the
3560 expansion shall instead be furtherly editable by the user, a commercial at
3561 .Ql @
3562 (that will be removed) can be placed last in the expansion, from which
3563 leading and trailing whitespace will finally be removed.
3564 Reverse solidus cannot be used as the last character of expansion.
3567 Contexts define when a binding applies, i.e., a binding will not be seen
3568 unless the context for which it is defined for is currently active.
3569 This is not true for the shared binding
3570 .Ql base ,
3571 which is the foundation for all other bindings and as such always
3572 applies, its bindings, however, only apply secondarily.
3573 The available contexts are the shared
3574 .Ql base ,
3576 .Ql default
3577 context which is used in all not otherwise documented situations, and
3578 .Ql compose ,
3579 which applies to compose mode only.
3582 .Dq Keys
3583 which form the binding are specified as a comma-separated list of
3584 byte-sequences, where each list entry corresponds to one key(press).
3585 \*(OPally a list entry may, indicated by a leading colon character
3586 .Ql \&: ,
3587 also refer to the name of a terminal capability;
3588 several dozen names will be compiled into \*(UA and may be specified
3589 either by their
3590 .Xr terminfo 5 ,
3591 or, if existing, by their
3592 .Xr termcap 5
3593 name, regardless of the actually used terminal control library.
3594 It is however possible to use any capability, as long as the name is
3595 resolvable by the control library or defined in the internal variable
3596 .Va termcap .
3597 Input sequences are not case-normalized, so that an exact match is
3598 required to update or remove a binding.
3599 Examples:
3601 .Bd -literal -offset indent
3602 bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
3603 bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
3604 bind default $'\ecA',:khome,w 'echo An editable binding@'
3605 bind default a,b,c rm -rf / @  # Another editable binding
3606 bind default :kf1 File %
3607 bind compose :kf1 ~e
3611 Note that the entire comma-separated list is first parsed (over) as a
3612 shell-token with whitespace as the field separator, before being parsed
3613 and expanded for real with comma as the field separator, therefore
3614 whitespace needs to be properly quoted, see
3615 .Sx "Shell-style argument quoting" .
3616 Using Unicode reverse solidus escape sequences renders a binding
3617 defunctional if the locale does not support Unicode (see
3618 .Sx "Character sets" ) ,
3619 and using terminal capabilities does so if no terminal control support
3620 is (currently) available.
3623 The following terminal capability names are builtin and can be used in
3624 .Xr terminfo 5
3625 or (if available) the two-letter
3626 .Xr termcap 5
3627 notation regardless of the actually used library.
3628 See the respective manual for a list of capabilities.
3629 The program
3630 .Xr infocmp 1
3631 can be used to show all the capabilities of
3632 .Ev TERM
3633 or the given terminal type;
3634 using the
3635 .Fl \&\&x
3636 flag will also show supported (non-standard) extensions.
3639 .Bl -tag -compact -width kcuuf_or_kcuuf
3640 .It Cd kbs Ns \0or Cd kb
3641 Backspace.
3642 .It Cd kdch1 Ns \0or Cd kD
3643 Delete character.
3644 .It Cd kDC Ns \0or Cd *4
3645 \(em shifted variant.
3646 .It Cd kel Ns \0or Cd kE
3647 Clear to end of line.
3648 .It Cd kext Ns \0or Cd @9
3649 Exit.
3650 .It Cd kich1 Ns \0or Cd kI
3651 Insert character.
3652 .It Cd kIC Ns \0or Cd #3
3653 \(em shifted variant.
3654 .It Cd khome Ns \0or Cd kh
3655 Home.
3656 .It Cd kHOM Ns \0or Cd #2
3657 \(em shifted variant.
3658 .It Cd kend Ns \0or Cd @7
3659 End.
3660 .It Cd knp Ns \0or Cd kN
3661 Next page.
3662 .It Cd kpp Ns \0or Cd kP
3663 Previous page.
3664 .It Cd kcub1 Ns \0or Cd kl
3665 Left cursor (with more modifiers: see below).
3666 .It Cd kLFT Ns \0or Cd #4
3667 \(em shifted variant.
3668 .It Cd kcuf1 Ns \0or Cd kr
3669 Right cursor (ditto).
3670 .It Cd kRIT Ns \0or Cd %i
3671 \(em shifted variant.
3672 .It Cd kcud1 Ns \0or Cd kd
3673 Down cursor (ditto).
3674 .It Cd kDN
3675 \(em shifted variant (only terminfo).
3676 .It Cd kcuu1 Ns \0or Cd ku
3677 Up cursor (ditto).
3678 .It Cd kUP
3679 \(em shifted variant (only terminfo).
3680 .It Cd kf0 Ns \0or Cd k0
3681 Function key 0.
3682 Add one for each function key up to
3683 .Cd kf9
3685 .Cd k9 ,
3686 respectively.
3687 .It Cd kf10 Ns \0or Cd k;
3688 Function key 10.
3689 .It Cd kf11 Ns \0or Cd F1
3690 Function key 11.
3691 Add one for each function key up to
3692 .Cd kf19
3694 .Cd F9 ,
3695 respectively.
3699 Some terminals support key-modifier combination extensions, e.g.,
3700 .Ql Alt+Shift+xy .
3701 For example, the delete key,
3702 .Cd kdch1 :
3703 in its shifted variant, the name is mutated to
3704 .Cd  kDC ,
3705 then a number is appended for the states
3706 .Ql Alt
3707 .Pf ( Cd kDC3 ) ,
3708 .Ql Shift+Alt
3709 .Pf ( Cd kDC4 ) ,
3710 .Ql Control
3711 .Pf ( Cd kDC5 ) ,
3712 .Ql Shift+Control
3713 .Pf ( Cd kDC6 ) ,
3714 .Ql Alt+Control
3715 .Pf ( Cd kDC7 ) ,
3716 finally
3717 .Ql Shift+Alt+Control
3718 .Pf ( Cd kDC8 ) .
3719 The same for the left cursor key,
3720 .Cd kcub1 :
3721 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
3724 Key bindings can be removed with the command
3725 .Ic unbind .
3726 It is advisable to use an initial escape or other control character (e.g.,
3727 .Ql \ecA )
3728 for bindings which describe user key combinations (as opposed to purely
3729 terminal capability based ones), in order to avoid ambiguities whether
3730 input belongs to key sequences or not; it also reduces search time.
3731 Adjusting
3732 .Va bind-timeout
3733 may help shall keys and sequences be falsely recognized.
3737 .It Ic call
3738 \*(NQ Calls the given macro, which must have been created via
3739 .Ic define ,
3740 otherwise a
3741 .Va ^ERR Ns -NOENT
3742 error occurs.
3743 Parameters given to macros are implicitly local to the macro's scope, and
3744 may be accessed via special (positional) parameters, e.g.,
3745 .Va 1 ,
3746 .Va * ,
3747 .Va @ ,
3748 .Va # .
3749 The positional parameters may be removed by
3750 .Ic shift Ns
3751 ing them off the stack (exceeding the supported number of arguments
3752 results in a
3753 .Va ^ERR Ns -OVERFLOW ) ,
3754 and are otherwise controllable via
3755 .Ic vpospar .
3756 Macro execution can be terminated at any time by calling
3757 .Ic return .
3759 Calling macros recursively will at some time excess the stack size
3760 limit, causing a hard program abortion; if recursively calling a macro
3761 is the last command of the current macro, consider to use the command
3762 .Ic xcall ,
3763 which will first release all resources of the current macro before
3764 replacing the current macro with the called one.
3765 Numeric and string operations can be performed via
3766 .Ic vexpr ,
3768 .Ic eval
3769 may be helpful to recreate argument lists.
3770 .Bd -literal -offset indent
3771 define exmac {
3772   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
3773   return 1000 0
3775 call exmac Hello macro exmac!
3779 .It Ic call_if
3780 Identical to
3781 .Ic call
3782 if the given macro has been created via
3783 .Ic define ,
3784 but doesn't fail nor warn if the macro doesn't exist.
3787 .It Ic cd
3788 (ch) Change the working directory to
3789 .Ev HOME
3790 or the given argument.
3791 Synonym for
3792 .Ic chdir .
3795 .It Ic certsave
3796 \*(OP Only applicable to S/MIME signed messages.
3797 Takes a message list and a file name and saves the certificates
3798 contained within the message signatures to the named file in both
3799 human-readable and PEM format.
3800 The certificates can later be used to send encrypted messages to the
3801 respective message senders by setting
3802 .Va smime-encrypt-USER@HOST
3803 variables.
3807 .It Ic charsetalias , uncharsetalias
3808 \*(NQ Manage (character set conversion) character set alias mappings,
3809 as documented in the section
3810 .Sx "Character sets" .
3811 Character set aliases are expanded recursively, but no expansion is
3812 performed on values of the user-settable variables, e.g.,
3813 .Va charset-8bit .
3814 These are effectively no-operations if character set conversion
3815 is not available (i.e., no
3816 .Ql +iconv
3818 .Va features ) .
3819 Without arguments the list of all currently defined aliases is shown,
3820 with one argument the expansion of the given alias.
3821 Otherwise all given arguments are treated as pairs of character sets and
3822 their desired target alias name, creating new or changing already
3823 existing aliases, as necessary.
3825 The latter deletes all aliases given as arguments, the special argument
3826 .Ql *
3827 will remove all aliases.
3830 .It Ic chdir
3831 (ch) Change the working directory to
3832 .Ev HOME
3833 or the given argument.
3834 Synonym for
3835 .Ic cd .
3839 .It Ic collapse , uncollapse
3840 Only applicable to threaded mode.
3841 Takes a message list and makes all replies to these messages invisible
3842 in header summaries, except for
3843 .Ql new
3844 messages and the
3845 .Dq dot .
3846 Also when a message with collapsed replies is displayed,
3847 all of these are automatically uncollapsed.
3848 The latter command undoes collapsing.
3853 .It Ic colour , uncolour
3854 \*(OP\*(NQ Manage colour mappings of and for a
3855 .Sx "Coloured display" .
3856 The type of colour is given as the (case-insensitive) first argument,
3857 which must be one of
3858 .Ql 256
3859 for 256-colour terminals,
3860 .Ql 8 ,
3861 .Ql ansi
3863 .Ql iso
3864 for the standard 8-colour ANSI / ISO 6429 color palette and
3865 .Ql 1
3867 .Ql mono
3868 for monochrome terminals.
3869 Monochrome terminals cannot deal with colours, but only (some) font
3870 attributes.
3873 Without further arguments the list of all currently defined mappings
3874 for the given colour type is shown (as a special case giving
3875 .Ql all
3877 .Ql *
3878 will show the mappings of all types).
3879 Otherwise the second argument defines the mappable slot, and the third
3880 argument a (comma-separated list of) colour and font attribute
3881 specification(s), and the optional fourth argument can be used to
3882 specify a precondition: if conditioned mappings exist they are tested in
3883 (creation) order unless a (case-insensitive) match has been found, and
3884 the default mapping (if any has been established) will only be chosen as
3885 a last resort.
3886 The types of precondition available depend on the mappable slot (see
3887 .Sx "Coloured display"
3888 for some examples), the following of which exist:
3891 Mappings prefixed with
3892 .Ql mle-
3893 are used for the \*(OPal builtin Mailx-Line-Editor (MLE, see
3894 .Sx "On terminal control and line editor" )
3895 and do not support preconditions.
3897 .Bl -tag -compact -width view-partinfo
3898 .It Ar mle-position
3899 This mapping is used for the position indicator that is visible when
3900 a line cannot be fully displayed on the screen.
3901 .It Ar mle-prompt
3902 Used for the
3903 .Va prompt .
3907 Mappings prefixed with
3908 .Ql sum-
3909 are used in header summaries, and they all understand the preconditions
3910 .Ql dot
3911 (the current message) and
3912 .Ql older
3913 for elder messages (only honoured in conjunction with
3914 .Va datefield-markout-older ) .
3916 .Bl -tag -compact -width view-partinfo
3917 .It Ar sum-dotmark
3918 This mapping is used for the
3919 .Dq dotmark
3920 that can be created with the
3921 .Ql %>
3923 .Ql %<
3924 formats of the variable
3925 .Va headline .
3926 .It Ar sum-header
3927 For the complete header summary line except the
3928 .Dq dotmark
3929 and the thread structure.
3930 .It Ar sum-thread
3931 For the thread structure which can be created with the
3932 .Ql %i
3933 format of the variable
3934 .Va headline .
3938 Mappings prefixed with
3939 .Ql view-
3940 are used when displaying messages.
3942 .Bl -tag -compact -width view-partinfo
3943 .It Ar view-from_
3944 This mapping is used for so-called
3945 .Ql From_
3946 lines, which are MBOX file format specific header lines.
3947 .It Ar view-header
3948 For header lines.
3949 A comma-separated list of headers to which the mapping applies may be
3950 given as a precondition; if the \*(OPal regular expression support is
3951 available then if any of the
3952 .Dq magical
3953 (extended) regular expression characters is seen the precondition will
3954 be evaluated as (an extended) one.
3955 .It Ar view-msginfo
3956 For the introductional message info line.
3957 .It Ar view-partinfo
3958 For MIME part info lines.
3962 The following (case-insensitive) colour definitions and font attributes
3963 are understood, multiple of which can be specified in a comma-separated
3964 list:
3966 .Bl -tag -width ft=
3967 .It Ar ft=
3968 a font attribute:
3969 .Ql bold ,
3970 .Ql reverse
3972 .Ql underline .
3973 It is possible (and often applicable) to specify multiple font
3974 attributes for a single mapping.
3976 .It Ar fg=
3977 foreground colour attribute:
3978 .Ql black ,
3979 .Ql blue ,
3980 .Ql green ,
3981 .Ql red ,
3982 .Ql brown ,
3983 .Ql magenta ,
3984 .Ql cyan
3986 .Ql white .
3987 To specify a 256-color mode a decimal number colour specification in
3988 the range 0 to 255, inclusive, is supported, and interpreted as follows:
3990 .Bl -tag -compact -width "999 - 999"
3991 .It 0 - 7
3992 the standard ISO 6429 colors, as above.
3993 .It 8 - 15
3994 high intensity variants of the standard colors.
3995 .It 16 - 231
3996 216 colors in tuples of 6.
3997 .It 232 - 255
3998 grayscale from black to white in 24 steps.
4000 .Bd -literal -offset indent
4001 #!/bin/sh -
4002 fg() { printf "\e033[38;5;${1}m($1)"; }
4003 bg() { printf "\e033[48;5;${1}m($1)"; }
4005 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4006 printf "\e033[0m\en"
4008 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4009 printf "\e033[0m\en"
4012 .It Ar bg=
4013 background colour attribute (see
4014 .Cd fg=
4015 for possible values).
4019 The command
4020 .Ic \&uncolour
4021 will remove for the given colour type (the special type
4022 .Ql *
4023 selects all) the given mapping; if the optional precondition argument is
4024 given only the exact tuple of mapping and precondition is removed.
4025 The special name
4026 .Ql *
4027 will remove all mappings (no precondition allowed), thus
4028 .Ql uncolour * *
4029 will remove all established mappings.
4034 .It Ic commandalias , uncommandalias
4035 \*(NQ Define or list, and remove, respectively, command aliases.
4036 An (command)alias can be used everywhere a normal command can be used,
4037 but always takes precedence: any arguments that are given to the command
4038 alias are joined onto the alias expansion, and the resulting string
4039 forms the command line that is, in effect, executed.
4040 The latter command removes all given aliases, the special name
4041 .Ql *
4042 will remove all existing aliases.
4043 When used without arguments the former shows a list of all currently
4044 known aliases, with one argument only the expansion of the given one.
4046 With two or more arguments a command alias is defined or updated: the
4047 first argument is the name under which the remaining command line should
4048 be accessible, the content of which can be just about anything.
4049 An alias may itself expand to another alias, but to avoid expansion loops
4050 further expansion will be prevented if an alias refers to itself or if
4051 an expansion depth limit is reached.
4052 Explicit expansion prevention via reverse solidus
4053 .Cm \e ,
4054 one of the
4055 .Sx "Command modifiers" .
4056 .Bd -literal -offset indent
4057 ? commandalias xx
4058 \*(uA: `commandalias': no such alias: xx
4059 ? commandalias xx echo hello,
4060 ? commandalias xx
4061 commandalias xx 'echo hello,'
4062 ? xx
4063 hello,
4064 ? xx world
4065 hello, world
4069 .It Ic Copy
4070 (C) Copy messages to files whose names are derived from the author of
4071 the respective message and do not mark them as being saved;
4072 otherwise identical to
4073 .Ic Save .
4076 .It Ic copy
4077 (c) Copy messages to the named file and do not mark them as being saved;
4078 otherwise identical to
4079 .Ic save .
4082 .It Ic cwd
4083 Show the name of the current working directory, as reported by
4084 .Xr getcwd 3 .
4085 Supports
4086 .Cm vput
4087 (see
4088 .Sx "Command modifiers" ) .
4089 The return status is tracked via
4090 .Va \&! .
4093 .It Ic Decrypt
4094 \*(OP For unencrypted messages this command is identical to
4095 .Ic Copy ;
4096 Encrypted messages are first decrypted, if possible, and then copied.
4099 .It Ic decrypt
4100 \*(OP For unencrypted messages this command is identical to
4101 .Ic copy ;
4102 Encrypted messages are first decrypted, if possible, and then copied.
4106 .It Ic define , undefine
4107 Without arguments the current list of macros, including their content,
4108 is shown, otherwise a macro is defined, replacing an existing macro of
4109 the same name.
4110 A macro definition is a sequence of commands in the following form:
4111 .Bd -literal -offset indent
4112 define name {
4113   command1
4114   command2
4115   ...
4116   commandN
4120 A defined macro can be invoked explicitly by using the
4121 .Ic call
4123 .Ic ~
4124 commands, or implicitly if a macro hook is triggered, e.g., a
4125 .Va folder-hook .
4126 It is possible to localize adjustments, like creation, deletion and
4127 modification of
4128 .Sx "INTERNAL VARIABLES" ,
4129 by using the
4130 .Ic localopts
4131 command; the scope which is localized depends on how (i.e.,
4132 .Dq as what :
4133 normal macro, folder hook, hook,
4134 .Ic account
4135 switch) the macro is invoked.
4136 Execution of a macro body can be stopped from within by calling
4137 .Ic return .
4138 Inside a
4139 .Ic call Ns
4140 ed macro, given positional parameters can be
4141 .Ic shift Ns
4144 The latter command deletes the given macro, the special name
4145 .Ql *
4146 will discard all existing macros.
4147 Creation and deletion of (a) macro(s) can be performed from within
4148 a running macro.
4152 .It Ic delete , undelete
4153 (d, u) Marks the given message list as being or not being
4154 .Ql deleted ,
4155 respectively; if no argument has been specified then the usual search
4156 for a visible message is performed, as documented for
4157 .Sx "Message list arguments" ,
4158 showing only the next input prompt if the search fails.
4159 Deleted messages will neither be saved in the
4160 .Mx -sx
4161 .Sx "secondary mailbox"
4162 .Ev MBOX
4163 nor will they be available for most other commands.
4164 If the
4165 .Va autoprint
4166 variable is set, the new
4167 .Dq dot
4168 or the last message restored, respectively, is automatically
4169 .Ic type Ns
4170 d; also see
4171 .Ic dp ,
4172 .Ic dt .
4175 .It Ic discard
4176 (di) Identical to
4177 .Ic ignore .
4178 Superseded by the multiplexer
4179 .Ic headerpick .
4183 .It Ic dp , dt
4184 Delete the given messages and automatically
4185 .Ic type
4186 the new
4187 .Dq dot
4188 if one exists, regardless of the setting of
4189 .Va autoprint .
4192 .It Ic dotmove
4193 Move the
4194 .Dq dot
4195 up or down by one message when given
4196 .Ql +
4198 .Ql -
4199 argument, respectively.
4203 .It Ic draft , undraft
4204 Take message lists and mark each given message as being draft, or not
4205 being draft, respectively, as documented in the section
4206 .Sx "Message states" .
4209 .It Ic echo
4210 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4211 newline, whereas the otherwise identical
4212 .Ic echon
4213 does not.
4214 .Sx "Shell-style argument quoting"
4215 is used,
4216 .Sx "Filename transformations"
4217 are applied to the expanded arguments.
4220 .It Ic echoerr
4221 \*(NQ Identical to
4222 .Ic echo
4223 except that is echoes to standard error.
4224 Also see
4225 .Ic echoerrn .
4228 .It Ic echon
4229 \*(NQ Identical to
4230 .Ic echo ,
4231 but does not write a trailing newline.
4234 .It Ic echoerrn
4235 \*(NQ Identical to
4236 .Ic echoerr ,
4237 but does not write a trailing newline.
4240 .It Ic edit
4241 (e) Point the text editor (as defined in
4242 .Ev EDITOR )
4243 at each message from the given list in turn.
4244 Modified contents are discarded unless the
4245 .Va writebackedited
4246 variable is set.
4249 .It Ic elif
4250 Part of the
4251 .Ic if Ns / Ns Ic elif Ns / Ns Ic else Ns / Ns Ic endif
4252 conditional \(em if the condition of a preceding
4253 .Ic if
4254 was false, check the following condition and execute the following block
4255 if it evaluates true.
4258 .It Ic else
4259 (el) Part of the
4260 .Ic if Ns / Ns Ic elif Ns / Ns Ic else Ns / Ns Ic endif
4261 conditional \(em if none of the conditions of the preceding
4262 .Ic if
4264 .Ic elif
4265 commands was true, the
4266 .Ic else
4267 block is executed.
4270 .It Ic endif
4271 (en) Marks the end of an
4272 .Ic if Ns / Ns Ic elif Ns / Ns Ic else Ns / Ns Ic endif
4273 conditional execution block.
4277 .It Ic environ
4278 \*(NQ \*(UA has a strict notion about which variables are
4279 .Sx "INTERNAL VARIABLES"
4280 and which are managed in the program
4281 .Sx ENVIRONMENT .
4282 Since some of the latter are a vivid part of \*(UAs functioning,
4283 however, they are transparently integrated into the normal handling of
4284 internal variables via
4285 .Ic set
4287 .Ic unset .
4288 To integrate other environment variables of choice into this
4289 transparent handling, and also to export internal variables into the
4290 process environment where they normally are not, a
4291 .Ql link
4292 needs to become established with this command, as in, e.g.,
4295 .Dl environ link PERL5LIB from TZ
4298 Afterwards changing such variables with
4299 .Ic set
4300 will cause automatic updates of the program environment, and therefore
4301 be inherited by newly created child processes.
4302 Sufficient system support provided (it was in BSD as early as 1987, and
4303 is standardized since Y2K) removing such variables with
4304 .Ic unset
4305 will remove them also from the program environment, but in any way
4306 the knowledge they ever have been
4307 .Ql link Ns
4308 ed will be lost.
4309 Note this implies that
4310 .Ic localopts
4311 may cause loss of links.
4314 The command
4315 .Ql unlink
4316 will remove an existing link, but leaves the variables as such intact.
4317 Additionally the subcommands
4318 .Ql set
4320 .Ql unset
4321 are provided, which work exactly the same as the documented commands
4322 .Ic set
4324 .Ic unset ,
4325 but (additionally) link the variable(s) with the program environment and
4326 thus immediately export them to, or remove them from (if possible),
4327 respectively, the program environment.
4331 .It Ic errors
4332 \*(OP Since \*(UA uses the console as a user interface it can happen
4333 that messages scroll by too fast to become recognized.
4334 Optionally an error message ring queue is available which stores
4335 duplicates of any error message and notifies the user in interactive
4336 sessions whenever a new error has occurred.
4337 The queue is finite: if its maximum size is reached any new message
4338 replaces the eldest.
4339 The command
4340 .Ic errors
4341 can be used to manage this message queue: if given
4342 .Ar show
4343 or no argument the queue will be displayed and cleared,
4344 .Ar clear
4345 will only clear all messages from the queue.
4348 .It Ic eval
4349 \*(NQ Construct a command by concatenating the arguments, separated with
4350 a single space character, and then evaluate the result.
4351 This command passes through the exit status
4352 .Va \&?
4353 and error number
4354 .Va \&!
4355 of the evaluated command; also see
4356 .Ic call .
4357 .Bd -literal -offset indent
4358 define xverbose {
4359   # Like this, sh(1)ell-stylish from begin to end: works!
4360   # Result status ends up in $!, then
4361   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
4363 commandalias xv '\ecall xverbose'
4365 # E.g.:
4366 define xxx {
4367   echo "xxx arg <$1>"
4368   shift
4369   if [ $# > 0 ]
4370     \excall xxx "$@"
4371   endif
4373 define yyy {
4374   eval "$@ ' ball"
4376 call yyy '\ecall xxx' "b\e$'\et'u ' "
4377 call xxx arg <b      u>
4378 call xxx arg <  >
4379 call xxx arg <ball>
4383 .It Ic exit
4384 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4385 any saving of messages in the
4386 .Mx -sx
4387 .Sx "secondary mailbox"
4388 .Ev MBOX
4389 as well as a possibly tracked line editor history file.
4392 .It Ic File
4393 (Fi) Like
4394 .Ic file ,
4395 but open the mailbox read-only.
4399 .It Ic file
4400 (fi) The file command switches to a new mailbox.
4401 Without arguments it shows status information of the current mailbox.
4402 If an argument is given, it will write out changes (such as deletions)
4403 the user has made, open a new mailbox and update the internal variables
4404 .Va mailbox-resolved
4406 .Va mailbox-display .
4407 .Sx "Filename transformations"
4408 will be applied to the
4409 .Ar name
4410 argument, and
4411 .Ql protocol://
4412 prefixes are understood, e.g.,
4413 .Ql maildir:///tmp/mdirbox :
4414 if a protocol prefix is used the mailbox type is fixated and neither
4415 the auto-detection (read on) nor the
4416 .Va newfolders
4417 mechanisms apply.
4418 \*(OPally URLs can also be used to access network resources, see
4419 .Sx "On URL syntax and credential lookup" :
4422 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4423 .Dl \*(OU protocol://[user@]host[:port][/path]
4426 \*(OPally supported network protocols are
4427 .Ar pop3
4428 (POP3) and
4429 .Ar pop3s
4430 (POP3 with SSL/TLS encrypted transport),
4431 .Ar [/path]
4432 part is valid only for IMAP; there it defaults to
4433 .Ar INBOX .
4434 Network URLs require a special encoding as documented in the said section.
4437 If the resulting file protocol (MBOX database)
4438 .Ar name
4439 is located on a local filesystem then the list of all registered
4440 .Ic filetype Ns
4441 s is traversed in order to see whether a transparent intermediate
4442 conversion step is necessary to handle the given mailbox, in which case
4443 \*(UA will use the found hook to load and save data into and from
4444 a temporary file, respectively.
4445 Changing hooks will not affect already opened mailboxes.
4446 For example, the following creates hooks for the
4447 .Xr gzip 1
4448 compression tool and a combined compressed and encrypted format:
4450 .Bd -literal -offset indent
4451 filetype \e
4452   gzip 'gzip -dc' 'gzip -c' \e
4453   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4457 MBOX database files are generally locked during file operations in order
4458 to avoid inconsistencies due to concurrent modifications.
4459 \*(OPal Mailbox files which \*(UA treats as the system
4460 .Va inbox
4461 .Pf ( Ev MAIL ) ,
4463 .Mx -sx
4464 .Sx "primary system mailbox" Ns
4465 es in general will also be protected by so-called dotlock files, the
4466 traditional way of mail spool file locking: for any file
4467 .Ql a
4468 a lock file
4469 .Ql a.lock
4470 will be created for the duration of the synchronization \(em
4471 as necessary a privilege-separated dotlock child process will be used
4472 to accommodate for necessary privilege adjustments in order to create
4473 the dotlock file in the same directory
4474 and with the same user and group identities as the file of interest.
4477 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4478 files, but it will detect invalid message boundaries in this mode and
4479 complain (even more with
4480 .Va debug )
4481 if any is seen: in this case
4482 .Va mbox-rfc4155
4483 can be used to create a valid MBOX database from the invalid input.
4486 If no protocol has been fixated, and
4487 .Ar name
4488 refers to a directory with the subdirectories
4489 .Ql tmp ,
4490 .Ql new
4492 .Ql cur ,
4493 then it is treated as a folder in
4494 .Dq Maildir
4495 format.
4496 \*(ID Also, if no protocol has been fixated and no existing file has
4497 been found, the variable
4498 .Va newfolders
4499 controls the format of mailboxes yet to be created.
4504 .It Ic filetype , unfiletype
4505 \*(NQ Define or list, and remove, respectively, file handler hooks,
4506 which provide (shell) commands that enable \*(UA to load and save MBOX
4507 files from and to files with the registered file extensions;
4508 it will use an intermediate temporary file to store the plain data.
4509 The latter command removes the hooks for all given extensions,
4510 .Ql *
4511 will remove all existing handlers.
4513 When used without arguments the former shows a list of all currently
4514 defined file hooks, with one argument the expansion of the given alias.
4515 Otherwise three arguments are expected, the first specifying the file
4516 extension for which the hook is meant, and the second and third defining
4517 the load- and save commands, respectively, to deal with the file type,
4518 both of which must read from standard input and write to standard
4519 output.
4520 Changing hooks will not affect already opened mailboxes (\*(ID except below).
4521 \*(ID For now too much work is done, and files are oftened read in twice
4522 where once would be sufficient: this can cause problems if a filetype is
4523 changed while such a file is opened; this was already so with the
4524 builtin support of .gz etc. in Heirloom, and will vanish in v15.
4525 \*(ID For now all handler strings are passed to the
4526 .Ev SHELL for evaluation purposes; in the future a
4527 .Ql \&!
4528 prefix to load and save commands may mean to bypass this shell instance:
4529 placing a leading space will avoid any possible misinterpretations.
4530 .Bd -literal -offset indent
4531 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
4532   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
4533   zst 'zstd -dc' 'zstd -19 -zc' \e
4534   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4535 set record=+sent.zst.pgp
4540 .It Ic flag , unflag
4541 Take message lists and mark the messages as being flagged, or not being
4542 flagged, respectively, for urgent/special attention.
4543 See the section
4544 .Sx "Message states" .
4547 .It Ic folder
4548 (fold) The same as
4549 .Ic file .
4552 .It Ic folders
4553 With no arguments, list the names of the folders in the folder directory.
4554 With an existing folder as an argument,
4555 lists the names of folders below the named folder.
4558 .It Ic Followup
4559 (F) Similar to
4560 .Ic Respond ,
4561 but saves the message in a file named after the local part of the first
4562 recipient's address (instead of in
4563 .Va record Ns ).
4566 .It Ic followup
4567 (fo) Similar to
4568 .Ic respond ,
4569 but saves the message in a file named after the local part of the first
4570 recipient's address (instead of in
4571 .Va record Ns ).
4574 .It Ic followupall
4575 Similar to
4576 .Ic followup ,
4577 but responds to all recipients regardless of the
4578 .Va flipr
4579 variable.
4582 .It Ic followupsender
4583 Similar to
4584 .Ic Followup ,
4585 but responds to the sender only regardless of the
4586 .Va flipr
4587 variable.
4590 .It Ic Forward
4591 Alias for
4592 .Ic Fwd .
4595 .It Ic forward
4596 Alias for
4597 .Ic fwd .
4600 .It Ic from
4601 (f) Takes a list of message specifications and displays a summary of
4602 their message headers, exactly as via
4603 .Ic headers .
4604 An alias of this command is
4605 .Ic search .
4606 Also see
4607 .Sx "Specifying messages" .
4610 .It Ic Fwd
4611 Similar to
4612 .Ic fwd ,
4613 but saves the message in a file named after the local part of the
4614 recipient's address (instead of in
4615 .Va record Ns ).
4618 .It Ic fwd
4619 Takes a message and the address of a recipient
4620 and forwards the message to him.
4621 The text of the original message is included in the new one,
4622 with the value of the
4623 .Va fwdheading
4624 variable preceding it.
4625 To filter the included header fields to the desired subset use the
4626 .Ql foward
4627 slot of the white- and blacklisting command
4628 .Ic headerpick .
4629 Only the first part of a multipart message is included unless
4630 .Va forward-as-attachment ,
4631 and recipient addresses will be stripped from comments, names etc.
4632 unless the internal variable
4633 .Va fullnames
4634 is set .
4637 .It Ic fwdignore
4638 \*(OB Superseded by the multiplexer
4639 .Ic headerpick .
4642 .It Ic fwdretain
4643 \*(OB Superseded by the multiplexer
4644 .Ic headerpick .
4648 .It Ic ghost , unghost
4649 \*(OB Replaced by
4650 .Ic commandalias ,
4651 .Ic uncommandalias .
4655 .It Ic headerpick , unheaderpick
4656 \*(NQ Multiplexer command to manage white- and blacklisting
4657 selections of header fields for a variety of applications.
4658 Without arguments the set of contexts that have settings is displayed.
4659 When given arguments, the first argument is the context to which the
4660 command applies, one of (case-insensitively)
4661 .Ql type
4662 for display purposes (via, e.g.,
4663 .Ic type ) ,
4664 .Ql save
4665 for selecting which headers shall be stored persistently when
4666 .Ic save ,
4667 .Ic copy ,
4668 .Ic move
4669 or even
4670 .Ic decrypt Ns
4671 ing messages (note that MIME related etc. header fields should not be
4672 ignored in order to not destroy usability of the message in this case),
4673 .Ql forward
4674 for stripping down messages when
4675 .Ic forward Ns
4676 ing message (has no effect if
4677 .Va forward-as-attachment
4678 is set), and
4679 .Ql top
4680 for defining user-defined set of fields for the command
4681 .Ic top .
4684 The current settings of the given context are displayed if only the
4685 first argument is given.
4686 A second argument denotes the type of restriction that is to be chosen,
4687 it may be (a case-insensitive prefix of)
4688 .Ql retain
4690 .Ql ignore
4691 for white- and blacklisting purposes, respectively.
4692 Establishing a whitelist suppresses inspection of the corresponding
4693 blacklist.
4694 If no further argument is given the current settings of the given type
4695 will be displayed, otherwise the remaining arguments specify header
4696 fields, which \*(OPally may be given as regular expressions, to be be
4697 added to the given type.
4698 The special wildcard field (asterisk,
4699 .Ql * )
4700 will establish a (fast) shorthand setting which covers all fields.
4702 The latter command always takes three or more arguments and can be used
4703 to remove fields from the given type of list of the given context, the
4704 special argument
4705 .Ql *
4706 will remove all fields.
4710 .It Ic headers
4711 (h) Show the current group of headers, the size of which depends on
4712 the variable
4713 .Va screen
4714 and the style of which can be adjusted with the variable
4715 .Va headline .
4716 If a message-specification is given the group of headers containing the
4717 first message therein is shown and the message at the top of the screen
4718 becomes the new
4719 .Dq dot .
4722 .It Ic help
4723 (hel) A synonym for
4724 .Ic \&? .
4727 .It Ic history
4728 \*(OP Either
4729 .Ar show
4730 (this mode also supports a more
4731 .Va verbose
4732 output) or
4733 .Ar clear
4734 the list of history entries;
4735 a decimal
4736 .Ar NUMBER
4737 argument selects and evaluates the respective history entry,
4738 which will become the new history top; a negative number is used as an
4739 offset to the current command, e.g.,
4740 .Ql -1
4741 will select the last command, the history top.
4742 The default mode if no arguments are given is
4743 .Ar show .
4746 .It Ic hold
4747 (ho, also
4748 .Ic preserve )
4749 Takes a message list and marks each message therein to be saved in the
4750 user's system
4751 .Va inbox
4752 instead of in the
4753 .Mx -sx
4754 .Sx "secondary mailbox"
4755 .Ev MBOX .
4756 Does not override the
4757 .Ic delete
4758 command.
4759 \*(UA deviates from the POSIX standard with this command, because a
4760 .Ic next
4761 command issued after
4762 .Ic hold
4763 will display the following message, not the current one.
4767 .It Ic if
4768 (i) Part of the nestable
4769 .Ic if Ns / Ns Ic elif Ns / Ns Ic else Ns / Ns Ic endif
4770 conditional execution construct \(em if the given condition is true then
4771 the encapsulated block is executed.
4772 POSIX only supports the (case-insensitive) conditions
4773 .Ql r Ns
4774 eceive
4776 .Ql s Ns
4777 end, all remaining conditions are non-portable extensions; note that
4778 falsely specified conditions cause the execution of the entire
4779 conditional construct until the (matching) closing
4780 .Ic endif
4781 command to be suppressed.
4782 The syntax of the nestable
4783 .Ic if
4784 conditional execution construct requires that each condition and syntax
4785 element is surrounded by whitespace.
4787 .Bd -literal -offset indent
4788 if receive
4789   commands ...
4790 else
4791   commands ...
4792 endif
4796 The (case-insensitive) condition
4797 .Ql t Ns
4798 erminal will evaluate to true if the standard input is a terminal, i.e.,
4799 in interactive sessions.
4800 Another condition can be any boolean value (see the section
4801 .Sx "INTERNAL VARIABLES"
4802 for textual boolean representations) to mark an enwrapped block as
4803 .Dq never execute
4805 .Dq always execute .
4806 It is possible to check
4807 .Sx "INTERNAL VARIABLES"
4808 as well as
4809 .Sx ENVIRONMENT
4810 variables for existence or compare their expansion against a user given
4811 value or another variable by using the
4812 .Ql $
4813 .Pf ( Dq variable next )
4814 conditional trigger character;
4815 a variable on the right hand side may be signalled using the same
4816 mechanism.
4817 The variable names may be enclosed in a pair of matching braces.
4820 Integer operators treat the left and right hand side as integral numbers
4821 and compare them arithmetically.
4822 It is an error if any of the operands is not a valid integer, an empty
4823 operand is treated as if it were 0.
4824 Available operators are
4825 .Ql -lt
4826 (less than),
4827 .Ql -le
4828 (less than or equal to),
4829 .Ql -eq
4830 (equal),
4831 .Ql -ne
4832 (not equal),
4833 .Ql -ge
4834 (greater than or equal to), and
4835 .Ql -gt
4836 (greater than).
4839 String operators compare the left and right hand side 8-bit byte-wise,
4840 ignoring case according to the rules of the US-ASCII encoding
4841 (therefore, dependent on the active locale, possibly producing false
4842 results for strings in the locale encoding).
4843 An unset variable is treated as the empty string.
4844 Available operators are
4845 .Ql <
4846 (less than),
4847 .Ql <=
4848 (less than or equal to),
4849 .Ql ==
4850 (equal),
4851 .Ql !=
4852 (not equal),
4853 .Ql >=
4854 (greater than or equal to),
4855 .Ql >
4856 (greater than),
4857 .Ql =@
4858 (is substring of) and
4859 .Ql !@
4860 (is not substring of).
4863 When the \*(OPal regular expression support is available, the additional
4864 string operators
4865 .Ql =~
4867 .Ql !~
4868 can be used.
4869 They treat the right hand side as an extended regular expression that is
4870 matched case-insensitively and according to the active
4871 .Ev LC_CTYPE
4872 locale, meaning that strings in the locale encoding should be matched
4873 correctly.
4876 Conditions can be joined via AND-OR lists (where the AND operator is
4877 .Ql &&
4878 and the OR operator is
4879 .Ql || ) ,
4880 which have equal precedence and will be evaluated with left
4881 associativity, thus using the same syntax that is known for the
4882 .Xr sh 1 .
4883 It is also possible to form groups of conditions and lists by enclosing
4884 them in pairs of brackets
4885 .Ql [\ \&.\&.\&.\ ] ,
4886 which may be interlocked within each other, and also be joined via
4887 AND-OR lists.
4890 The results of individual conditions and entire groups may be modified
4891 via unary operators: the unary operator
4892 .Ql \&!
4893 will reverse the result.
4895 .Bd -literal -offset indent
4896 if $debug
4897   echo *debug* is set
4898 endif
4899 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" == UTF8 ]
4900   echo *ttycharset* is set to UTF-8, case-insensitively
4901 endif
4902 set t1=one t2=one
4903 if [ "${t1}" == "${t2}" ]
4904   echo These two variables are equal
4905 endif
4906 # This is a string test, -ge was added for v14.9.0
4907 if [ "$version-major" >= 15 ]
4908   echo Running a new version..
4909   if [ "$features" =@ +regex ]
4910     if [ "$TERM" =~ "^xterm\&.*" ]
4911       echo ..in an X terminal
4912     endif
4913   endif
4914   if [ [ true ] && [ [ "${debug}" != '' ] || \e
4915       [ "$verbose" != '' ] ] ]
4916     echo Noisy, noisy
4917   endif
4918   if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
4919     echo Left associativity, as is known from the shell
4920   endif
4921   if ! ! true && ! [ ! "$debug" && ! "$verbose" ]
4922     echo Unary operator support
4923   endif
4924 endif
4929 .It Ic ignore
4930 (ig) Identical to
4931 .Ic discard .
4932 Superseded by the multiplexer
4933 .Ic headerpick .
4936 .It Ic list
4937 Shows the names of all available commands, alphabetically sorted.
4938 If given any non-whitespace argument the list will be shown in the order
4939 in which command prefixes are searched.
4940 \*(OP In conjunction with a set variable
4941 .Va verbose
4942 additional information will be provided for each command: the argument
4943 type will be indicated, the documentation string will be shown,
4944 and the set of command flags will show up:
4946 .Bl -tag -compact -width ".It Ql BaNg"
4947 .It Ql "vput modifier"
4948 command supports the command modifier
4949 .Cm vput .
4950 .It Ql "errno in *!*"
4951 the error number is tracked in
4952 .Va \&! .
4953 .It Ql "needs box"
4954 commands needs an active mailbox, a
4955 .Ic file .
4956 .It Ql "ok: batch or interactive"
4957 command may only be used in interactive or
4958 .Fl #
4959 batch mode.
4960 .It Ql "ok: send mode"
4961 command can be used in send mode.
4962 .It Ql "not ok: compose mode"
4963 command is not available when in compose mode.
4964 .It Ql "not ok: during startup"
4965 command cannot be used during program startup, e.g., while loading
4966 .Sx "Resource files" .
4967 .It Ql "ok: in subprocess"
4968 command is allowed to be used when running in a subprocess instance,
4969 e.g., from within a macro that is called via
4970 .Va on-compose-splice .
4974 .It Ic localopts
4975 This command can be used to localize changes to variables, meaning that
4976 their state will be reverted to the former one once the covered scope
4977 is left.
4978 It can only be used inside of macro definition blocks introduced by
4979 .Ic account
4981 .Ic define ,
4982 and is interpreted as a boolean (string, see
4983 .Sx "INTERNAL VARIABLES" ) ;
4985 .Dq covered scope
4986 of an account is left once it is switched off again.
4987 .Bd -literal -offset indent
4988 define temporary_settings {
4989   set possibly_global_option1
4990   localopts on
4991   set local_option1
4992   set local_option2
4993   localopts off
4994   set possibly_global_option2
4998 .Sy Note
4999 that this setting
5000 .Dq stacks up :
5001 i.e., if
5002 .Ql macro1
5003 enables change localization and calls
5004 .Ql macro2 ,
5005 which explicitly resets localization, then any value changes within
5006 .Ql macro2
5007 will still be reverted by
5008 .Ql macro1 !
5009 \*(ID Once the outermost level, the one which enabled localization
5010 first, is left, but no earlier, all adjustments will be unrolled.
5011 \*(ID Likewise worth knowing, if in this example
5012 .Ql macro2
5013 changes to a different
5014 .Ic account
5015 which sets some variables that are yet covered by localizations, their
5016 scope will be extended, and in fact leaving the
5017 .Ic account
5018 will (thus) restore settings in (likely) global scope which actually
5019 were defined in a local, private context.
5022 .It Ic Lreply
5023 Reply to messages that come in via known
5024 .Pf ( Ic mlist )
5025 or subscribed
5026 .Pf ( Ic mlsubscribe )
5027 mailing lists, or pretend to do so (see
5028 .Sx "Mailing lists" ) :
5029 on top of the usual
5030 .Ic reply
5031 functionality this will actively resort and even remove message
5032 recipients in order to generate a message that is supposed to be sent to
5033 a mailing list.
5034 For example it will also implicitly generate a
5035 .Ql Mail-Followup-To:
5036 header if that seems useful, regardless of the setting of the variable
5037 .Va followup-to .
5040 .It Ic Mail
5041 Similar to
5042 .Ic mail ,
5043 but saves the message in a file named after the local part of the first
5044 recipient's address (instead of in
5045 .Va record Ns ).
5048 .It Ic mail
5049 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5050 or asks on standard input if none were given;
5051 then collects the remaining mail content and sends it out.
5054 .It Ic mbox
5055 (mb) The given message list is to be sent to the
5056 .Mx -sx
5057 .Sx "secondary mailbox"
5058 .Ev MBOX
5059 when \*(UA is quit; this is the default action unless the variable
5060 .Va hold
5061 is set.
5062 \*(ID This command can only be used in a
5063 .Mx -sx
5064 .Sx "primary system mailbox" .
5068 .It Ic mimetype , unmimetype
5069 Without any arguments the content of the MIME type cache will displayed.
5070 Otherwise each argument defines a complete MIME type specification of
5071 a type that shall be added (prepended) to the cache.
5072 In any event MIME type sources are loaded first as necessary \(en
5073 .Va mimetypes-load-control
5074 can be used to fine-tune which sources are actually loaded.
5075 Refer to the section on
5076 .Sx "The mime.types files"
5077 for more on MIME type specifications and this topic in general.
5079 The latter command deleted all specifications of the given MIME type, so
5080 .Ql unmimetype text/plain
5081 will remove all registered specifications for the MIME type
5082 .Ql text/plain .
5083 The special name
5084 .Ql *
5085 will discard all existing MIME types, just as will
5086 .Ql reset ,
5087 but which also reenables cache initialization via
5088 .Va mimetypes-load-control .
5092 .It Ic mlist , unmlist
5093 The latter command removes all given mailing-lists, the special name
5094 .Ql *
5095 can be used to remove all registered lists.
5096 The former will list all currently defined mailing lists (and their
5097 attributes, if any) when used without arguments; a more verbose listing
5098 will be produced if either of
5099 .Va debug
5101 .Va verbose
5102 are set.
5103 Otherwise all given arguments will be added and henceforth be recognized
5104 as mailing lists.
5105 If the \*(OPal regular expression support is available then mailing
5106 lists may also be specified as (extended) regular expressions (see
5107 .Xr re_format 7
5108 for more on those).
5112 .It Ic mlsubscribe , unmlsubscribe
5113 The latter command removes the subscription attribute from all given
5114 mailing-lists, the special name
5115 .Ql *
5116 can be used to do so for any registered list.
5117 The former will list all currently defined mailing lists which have
5118 a subscription attribute when used without arguments; a more verbose
5119 listing will be produced if either of
5120 .Va debug
5122 .Va verbose
5123 are set.
5124 Otherwise this attribute will be set for all given mailing lists,
5125 newly creating them as necessary (as via
5126 .Ic mlist ) .
5127 Also see
5128 .Va followup-to .
5131 .It Ic Move
5132 Similar to
5133 .Ic move ,
5134 but moves the messages to a file named after the local part of the
5135 sender address of the first message (instead of in
5136 .Va record Ns ).
5139 .It Ic move
5140 Acts like
5141 .Ic copy
5142 but marks the messages for deletion if they were transferred
5143 successfully.
5146 .It Ic More
5147 Like
5148 .Ic more ,
5149 but also displays header fields which would not pass the
5150 .Ic headerpick
5151 selection, and all MIME parts.
5152 Identical to
5153 .Ic Page .
5156 .It Ic more
5157 Invokes the
5158 .Ev PAGER
5159 on the given messages, even in non-interactive mode and as long as the
5160 standard output is a terminal.
5161 Identical to
5162 .Ic page .
5165 .It Ic netrc
5166 \*(OP When used without arguments or if
5167 .Ar show
5168 has been given the content of the
5169 .Pa .netrc
5170 cache is shown, loading it first as necessary.
5171 If the argument is
5172 .Ar load
5173 then the cache will only be initialized and
5174 .Ar clear
5175 will remove its contents.
5176 Note that \*(UA will try to load the file only once, use
5177 .Ql Ic \&\&netrc Ns \:\0\:clear
5178 to unlock further attempts.
5180 .Va netrc-lookup ,
5181 .Va netrc-pipe
5182 and the section
5183 .Sx "On URL syntax and credential lookup" ;
5184 the section
5185 .Sx "The .netrc file"
5186 documents the file format in detail.
5189 .It Ic newmail
5190 Checks for new mail in the current folder without committing any changes
5191 before.
5192 If new mail is present, a message is shown.
5193 If the
5194 .Va header
5195 variable is set,
5196 the headers of each new message are also shown.
5197 This command is not available for all mailbox types.
5200 .It Ic next
5201 (n) (like
5202 .Ql +
5204 .Dq ENTER )
5205 Goes to the next message in sequence and types it.
5206 With an argument list, types the next matching message.
5209 .It Ic New
5210 Same as
5211 .Ic Unread .
5214 .It Ic new
5215 Same as
5216 .Ic unread .
5219 .It Ic noop
5220 If the current folder is accessed via a network connection, a
5221 .Dq NOOP
5222 command is sent, otherwise no operation is performed.
5225 .It Ic Page
5226 Like
5227 .Ic page ,
5228 but also displays header fields which would not pass the
5229 .Ic headerpick
5230 selection, and all MIME parts.
5231 Identical to
5232 .Ic More .
5235 .It Ic page
5236 Invokes the
5237 .Ev PAGER
5238 on the given messages, even in non-interactive mode and as long as the
5239 standard output is a terminal.
5240 Identical to
5241 .Ic more .
5244 .It Ic Pipe
5245 Like
5246 .Ic pipe
5247 but also pipes header fields which would not pass the
5248 .Ic headerpick
5249 selection, and all parts of MIME
5250 .Ql multipart/alternative
5251 messages.
5254 .It Ic pipe
5255 (pi) Takes a message list and a shell command
5256 and pipes the messages through the command.
5257 Without an argument the current message is piped through the command
5258 given by the
5259 .Va cmd
5260 variable.
5261 If the
5262 .Va page
5263 variable is set,
5264 every message is followed by a formfeed character.
5267 .It Ic preserve
5268 (pre) A synonym for
5269 .Ic hold .
5272 .It Ic Print
5273 (P) Alias for
5274 .Ic Type .
5277 .It Ic print
5278 (p) Research
5280 equivalent of
5281 .Ic type .
5284 .It Ic quit
5285 (q) Terminates the session, saving all undeleted, unsaved messages in
5286 the current
5287 .Mx -sx
5288 .Sx "secondary mailbox"
5289 .Ev MBOX ,
5290 preserving all messages marked with
5291 .Ic hold
5293 .Ic preserve
5294 or never referenced in the system
5295 .Va inbox ,
5296 and removing all other messages from the
5297 .Mx -sx
5298 .Sx "primary system mailbox" .
5299 If new mail has arrived during the session,
5300 the message
5301 .Dq You have new mail
5302 will be shown.
5303 If given while editing a mailbox file with the command line option
5304 .Fl f ,
5305 then the edit file is rewritten.
5306 A return to the shell is effected,
5307 unless the rewrite of edit file fails,
5308 in which case the user can escape with the exit command.
5311 .It Ic read
5312 \*(NQ Read a line from standard input, and assign the data, which will
5313 be splitted as indicated by
5314 .Va ifs ,
5315 to the given variables.
5316 The variable names are checked by the same rules as documented for
5317 .Cm vput ,
5318 and the same error codes will be seen in
5319 .Va \&! ;
5320 the exit status
5321 .Va \&?
5322 indicates the number of bytes read, it will be
5323 .Ql -1
5324 with the error number
5325 .Va \&!
5326 set to
5327 .Va ^ERR Ns -BADF
5328 in case of I/O errors, or
5329 .Va ^ERR Ns -NONE
5330 upon End-Of-File.
5331 If there are more fields than variables, assigns successive fields to the
5332 last given variable.
5333 If there are less fields than variables, assigns the empty string to the
5334 remains.
5335 .Bd -literal -offset indent
5336 ? read a b c
5337    H  e  l  l  o
5338 ? echo "<$a> <$b> <$c>"
5339 <H> <e> <l  l  o>
5340 ? wysh set ifs=:; read a b c;unset ifs
5341 hey2.0,:"'you    ",:world!:mars.:
5342 ? echo $?/$^ERRNAME / <$a><$b><$c>
5343 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5347 .It Ic redirect
5348 Same as
5349 .Ic resend .
5352 .It Ic Redirect
5353 Same as
5354 .Ic Resend .
5357 .It Ic remove
5358 Removes the named files or directories.
5359 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
5360 type specific removal will be performed, deleting the complete mailbox.
5361 The user is asked for confirmation in interactive mode.
5364 .It Ic rename
5365 Takes the name of an existing folder
5366 and the name for the new folder
5367 and renames the first to the second one.
5368 Both folders must be of the same type.
5371 .It Ic Reply
5372 (R) Reply to originator.
5373 Does not reply to other recipients of the original message.
5374 .Va flipr
5375 will exchange this command with
5376 .Ic reply .
5377 Unless the internal variable
5378 .Va fullnames
5379 is set the recipient address will be stripped from comments, names etc.
5382 .It Ic reply
5383 (r) Take a message and group-responds to it by addressing the sender
5384 and all recipients.
5385 .Va followup-to ,
5386 .Va followup-to-honour ,
5387 .Va reply-to-honour
5388 as well as
5389 .Va recipients-in-cc
5390 influence response behaviour.
5391 The command
5392 .Ic Lreply
5393 offers special support for replying to mailing lists.
5394 Unless the internal variable
5395 .Va fullnames
5396 is set recipient addresses will be stripped from comments, names etc.
5398 .Va flipr
5399 is set the commands
5400 .Ic Reply
5402 .Ic reply
5403 are exchanged.
5406 .It Ic replyall
5407 Similar to
5408 .Ic reply ,
5409 but initiates a group-reply regardless of the value of
5410 .Va flipr .
5413 .It Ic replysender
5414 Similar to
5415 .Ic Reply ,
5416 but responds to the sender only regardless of the value of
5417 .Va flipr .
5420 .It Ic Resend
5421 Like
5422 .Ic resend ,
5423 but does not add any header lines.
5424 This is not a way to hide the sender's identity,
5425 but useful for sending a message again to the same recipients.
5428 .It Ic resend
5429 Takes a list of messages and a user name
5430 and sends each message to the named user.
5431 .Ql Resent-From:
5432 and related header fields are prepended to the new copy of the message.
5433 Saving in
5434 .Va record
5435 is only performed if
5436 .Va record-resent
5437 is set.
5440 .It Ic Respond
5441 Same as
5442 .Ic Reply .
5445 .It Ic respond
5446 Same as
5447 .Ic reply .
5450 .It Ic respondall
5451 Same as
5452 .Ic replyall .
5455 .It Ic respondsender
5456 Same as
5457 .Ic replysender .
5460 .It Ic retain
5461 (ret) Superseded by the multiplexer
5462 .Ic headerpick .
5465 .It Ic return
5466 Only available inside the scope of a
5467 .Ic define Ns
5468 d macro or an
5469 .Ic account ,
5470 this will stop evaluation of any further macro content, and return
5471 execution control to the caller.
5472 The two optional parameters must be specified as positive decimal
5473 numbers and default to the value 0:
5474 the first argument specifies the signed 32-bit return value (stored in
5475 .Va \&?
5476 and later extended to signed 64-bit),
5477 the second the signed 32-bit error number (stored in
5478 .Va \&! ) .
5479 As documented for
5480 .Va \&?
5481 a non-0 exit status may cause the program to exit.
5484 .It Ic Save
5485 (S) Similar to
5486 .Ic save,
5487 but saves the messages in a file named after the local part of the
5488 sender of the first message instead of (in
5489 .Va record
5490 and) taking a filename argument; the variable
5491 .Va outfolder
5492 is inspected to decide on the actual storage location.
5495 .It Ic save
5496 (s) Takes a message list and a filename and appends each message in turn
5497 to the end of the file.
5498 If no filename is given, the
5499 .Mx -sx
5500 .Sx "secondary mailbox"
5501 .Ev MBOX
5502 is used.
5503 The filename in quotes, followed by the generated character count
5504 is echoed on the user's terminal.
5505 If editing a
5506 .Mx -sx
5507 .Sx "primary system mailbox"
5508 the messages are marked for deletion.
5509 .Sx "Filename transformations"
5510 will be applied.
5513 .It Ic savediscard
5514 \*(OB Superseded by the multiplexer
5515 .Ic headerpick .
5518 .It Ic saveignore
5519 \*(OB Superseded by the multiplexer
5520 .Ic headerpick .
5523 .It Ic saveretain
5524 \*(OB Superseded by the multiplexer
5525 .Ic headerpick .
5528 .It Ic search
5529 Takes a message specification (list) and displays a header summary of
5530 all matching messages, as via
5531 .Ic headers .
5532 This command is an alias of
5533 .Ic from .
5534 Also see
5535 .Sx "Specifying messages" .
5538 .It Ic seen
5539 Takes a message list and marks all messages as having been read.
5544 .It Ic set , unset
5545 (se, \*(NQ uns) The latter commands will delete all given variables,
5546 the former, when used without arguments, will show all variables which
5547 are currently known to \*(UA; a more verbose listing will be produced if
5548 either of
5549 .Va debug
5551 .Va verbose
5552 are set.
5554 Otherwise the given variables (and arguments) are set or adjusted.
5555 Arguments are of the form
5556 .Ql name=value
5557 (no space before or after
5558 .Ql = ) ,
5559 or plain
5560 .Ql name
5561 if there is no value, i.e., a boolean variable.
5562 Quotation marks may be placed around any part of the assignment
5563 statement to quote blanks or tabs, e.g.,
5565 .Dl set indentprefix='->'
5567 If an argument begins with
5568 .Ql no ,
5569 as in
5570 .Ql set nosave ,
5571 the effect is the same as invoking the
5572 .Ic unset
5573 command with the remaining part of the variable
5574 .Pf ( Ql unset save ) .
5577 .Ql name
5578 that is known to map to an environment variable will automatically cause
5579 updates in the program environment (unsetting a variable in the
5580 environment requires corresponding system support) \(em use the command
5581 .Ic environ
5582 for further environmental control.
5583 Also see
5584 .Ic varedit ,
5585 .Ic varshow
5586 and the sections
5587 .Sx "INTERNAL VARIABLES"
5589 .Sx ENVIRONMENT .
5593 .It Ic shcodec
5594 Apply shell quoting rules to the given raw-data arguments.
5595 Supports
5596 .Cm vput
5597 (see
5598 .Sx "Command modifiers" ) ,
5599 The first argument specifies the operation:
5600 .Ar [+]e[ncode]
5602 .Ar d[ecode]
5603 cause shell quoting to be applied to the remains of the line, and
5604 expanded away thereof, respectively.
5605 If the former is prefixed with a plus-sign, the quoted result will not
5606 be roundtrip enabled, and thus can be decoded only in the very same
5607 environment that was used to perform the encode; also see
5608 .Cd mle-quote-rndtrip .
5609 If the coding operation fails the error number
5610 .Va \&!
5611 is set to
5612 .Va ^ERR Ns -CANCELED ,
5613 and the unmodified input is used as the result; the error number may
5614 change again due to output or result storage errors.
5617 .It Ic shell
5618 (sh) Invokes an interactive version of the shell.
5622 .It Ic shortcut , unshortcut
5623 Without arguments the list of all currently defined shortcuts is
5624 shown, with one argument the expansion of the given shortcut.
5625 Otherwise all given arguments are treated as pairs of shortcuts and
5626 their expansions, creating new or changing already existing shortcuts,
5627 as necessary.
5628 The latter command will remove all given shortcuts, the special name
5629 .Ql *
5630 will remove all registered shortcuts.
5633 .It Ic shift
5634 Shift the positional parameter stack (starting at
5635 .Va 1 )
5636 by the given number (which must be an unsigned, positive, decimal),
5637 or 1 if no argument has been given.
5638 It is an error if the value exceeds the number of positional parameters.
5639 If the given number is 0, no action is performed, successfully.
5640 The stack as such can be managed via
5641 .Ic vpospar .
5644 .It Ic show
5645 Like
5646 .Ic type ,
5647 but performs neither MIME decoding nor decryption, so that the raw
5648 message text is shown.
5651 .It Ic size
5652 (si) Shows the size in characters of each message of the given
5653 message-list.
5656 .It Ic sleep
5657 \*(NQ Sleep for the specified number of seconds (and optionally
5658 milliseconds), by default interruptably.
5659 If a third argument is given the sleep will be uninterruptible,
5660 otherwise the error number
5661 .Va \&!
5662 will be set to
5663 .Va ^ERR Ns -INTR
5664 if the sleep has been interrupted.
5665 The command will fail and the error number will be
5666 .Va ^ERR Ns -OVERFLOW
5667 if the given duration(s) overflow the time datatype, and
5668 .Va ^ERR Ns -INVAL
5669 if the given durations are no valid integers.
5674 .It Ic sort , unsort
5675 The latter command disables sorted or threaded mode, returns to normal
5676 message order and, if the
5677 .Va header
5678 variable is set,
5679 displays a header summary.
5680 The former command shows the current sorting criterion when used without
5681 an argument, but creates a sorted representation of the current folder
5682 otherwise, and changes the
5683 .Ic next
5684 command and the addressing modes such that they refer to messages in
5685 the sorted order.
5686 Message numbers are the same as in regular mode.
5687 If the
5688 .Va header
5689 variable is set,
5690 a header summary in the new order is also displayed.
5691 Automatic folder sorting can be enabled by setting the
5692 .Va autosort
5693 variable, as in, e.g.,
5694 .Ql set autosort=thread .
5695 Possible sorting criterions are:
5698 .Bl -tag -compact -width "subject"
5699 .It Ar date
5700 Sort the messages by their
5701 .Ql Date:
5702 field, that is by the time they were sent.
5703 .It Ar from
5704 Sort messages by the value of their
5705 .Ql From:
5706 field, that is by the address of the sender.
5707 If the
5708 .Va showname
5709 variable is set, the sender's real name (if any) is used.
5710 .It Ar size
5711 Sort the messages by their size.
5712 .It spam
5713 \*(OP Sort the message by their spam score, as has been classified by
5714 .Ic spamrate .
5715 .It Ar status
5716 Sort the messages by their message status.
5717 .It Ar subject
5718 Sort the messages by their subject.
5719 .It Ar thread
5720 Create a threaded display.
5721 .It Ar to
5722 Sort messages by the value of their
5723 .Ql To:
5724 field, that is by the address of the recipient.
5725 If the
5726 .Va showname
5727 variable is set, the recipient's real name (if any) is used.
5732 .It Ic source
5733 \*(NQ (so) The source command reads commands from the given file.
5734 .Sx "Filename transformations"
5735 will be applied.
5736 If the given expanded argument ends with a vertical bar
5737 .Ql |
5738 then the argument will instead be interpreted as a shell command and
5739 \*(UA will read the output generated by it.
5740 Interpretation of commands read is stopped when an error is encountered.
5741 \*(ID Note that
5742 .Ic \&\&source
5743 cannot be used from within macros that execute as
5744 .Va folder-hook Ns s
5746 .Ic account Ns s ,
5747 i.e., it can only be called from macros that were
5748 .Ic call Ns ed .
5751 .It Ic source_if
5752 \*(NQ The difference to
5753 .Ic source
5754 (beside not supporting pipe syntax aka shell command input) is that
5755 this command will not generate an error nor warn if the given file
5756 argument cannot be opened successfully.
5759 .It Ic spamclear
5760 \*(OP Takes a list of messages and clears their
5761 .Ql is-spam
5762 flag.
5765 .It Ic spamforget
5766 \*(OP Takes a list of messages and causes the
5767 .Va spam-interface
5768 to forget it has ever used them to train its Bayesian filter.
5769 Unless otherwise noted the
5770 .Ql is-spam
5771 flag of the message is inspected to chose whether a message shall be
5772 forgotten to be
5773 .Dq ham
5775 .Dq spam .
5778 .It Ic spamham
5779 \*(OP Takes a list of messages and informs the Bayesian filter of the
5780 .Va spam-interface
5781 that they are
5782 .Dq ham .
5783 This also clears the
5784 .Ql is-spam
5785 flag of the messages in question.
5788 .It Ic spamrate
5789 \*(OP Takes a list of messages and rates them using the configured
5790 .Va spam-interface ,
5791 without modifying the messages, but setting their
5792 .Ql is-spam
5793 flag as appropriate; because the spam rating headers are lost the rate
5794 will be forgotten once the mailbox is left.
5795 Refer to the manual section
5796 .Sx "Handling spam"
5797 for the complete picture of spam handling in \*(UA.
5800 .It Ic spamset
5801 \*(OP Takes a list of messages and sets their
5802 .Ql is-spam
5803 flag.
5806 .It Ic spamspam
5807 \*(OP Takes a list of messages and informs the Bayesian filter of the
5808 .Va spam-interface
5809 that they are
5810 .Dq spam .
5811 This also sets the
5812 .Ql is-spam
5813 flag of the messages in question.
5816 .It Ic thread
5817 \*(OB The same as
5818 .Ql sort thread
5819 (consider using a
5820 .Ql commandalias
5821 as necessary).
5824 .It Ic Top
5825 Like
5826 .Ic top
5827 but always uses the
5828 .Ic headerpick
5829 .Ql type
5830 slot for white- and blacklisting header fields.
5833 .It Ic top
5834 (to) Takes a message list and types out the first
5835 .Va toplines
5836 lines of each message on the users' terminal.
5837 Unless a special selection has been established for the
5838 .Ql top
5839 slot of the
5840 .Ic headerpick
5841 command, the only header fields that are displayed are
5842 .Ql From: ,
5843 .Ql To: ,
5844 .Ql CC: ,
5846 .Ql Subject: .
5847 .Ic Top
5848 will always use the
5849 .Ql type
5850 .Ic headerpick
5851 selection instead.
5852 It is possible to apply compression to what is displayed by setting
5853 .Va topsqueeze .
5854 Messages are decrypted and converted to the terminal character set
5855 if necessary.
5858 .It Ic touch
5859 (tou) Takes a message list and marks the messages for saving in the
5860 .Mx -sx
5861 .Sx "secondary mailbox"
5862 .Ev MBOX .
5863 \*(UA deviates from the POSIX standard with this command,
5864 as a following
5865 .Ic next
5866 command will display the following message instead of the current one.
5869 .It Ic Type
5870 (T) Like
5871 .Ic type
5872 but also displays header fields which would not pass the
5873 .Ic headerpick
5874 selection, and all parts of MIME
5875 .Ql multipart/alternative
5876 messages.
5879 .It Ic type
5880 (t) Takes a message list and types out each message on the users'
5881 terminal, honouring
5882 .Ic headerpick
5883 selections.
5884 For MIME multipart messages, all parts with a content type of
5885 .Ql text
5887 .Ql message
5888 are shown, the other are hidden except for their headers.
5889 Messages are decrypted and converted to the terminal character set
5890 if necessary.
5892 .It Ic unaccount
5894 .Ic account .
5896 .It Ic unalias
5897 (una) See
5898 .Ic alias .
5900 .It Ic unanswered
5902 .Ic answered .
5904 .It Ic unbind
5906 .Ic bind .
5908 .It Ic uncollapse
5910 .Ic collapse .
5912 .It Ic uncolour
5914 .Ic colour .
5916 .It Ic undefine
5918 .Ic define .
5920 .It Ic undelete
5922 .Ic delete .
5924 .It Ic undraft
5926 .Ic draft .
5928 .It Ic unflag
5930 .Ic flag .
5933 .It Ic unfwdignore
5934 \*(OB Superseded by the multiplexer
5935 .Ic headerpick .
5938 .It Ic unfwdretain
5939 \*(OB Superseded by the multiplexer
5940 .Ic headerpick .
5943 .It Ic unignore
5944 Superseded by the multiplexer
5945 .Ic headerpick .
5947 .It Ic unmimetype
5949 .Ic mimetype .
5951 .It Ic unmlist
5953 .Ic mlist .
5955 .It Ic unmlsubscribe
5957 .Ic mlsubscribe .
5960 .It Ic Unread
5961 Same as
5962 .Ic unread .
5965 .It Ic unread
5966 Takes a message list and marks each message as not having been read.
5969 .It Ic unretain
5970 Superseded by the multiplexer
5971 .Ic headerpick .
5974 .It Ic unsaveignore
5975 \*(OB Superseded by the multiplexer
5976 .Ic headerpick .
5979 .It Ic unsaveretain
5980 \*(OB Superseded by the multiplexer
5981 .Ic headerpick .
5983 .It Ic unset
5984 \*(NQ (uns) See
5985 .Ic set .
5987 .It Ic unshortcut
5989 .Ic shortcut .
5991 .It Ic unsort
5993 .Ic short .
5996 .It Ic unthread
5997 \*(OB
5998 Same as
5999 .Ic unsort .
6002 .It Ic urlcodec
6003 Perform URL percent codec operations on the raw-data argument, rather
6004 according to RFC 3986.
6005 Supports
6006 .Cm vput
6007 (see
6008 .Sx "Command modifiers" ) ,
6009 and manages the error number
6010 .Va \&! .
6011 This is a character set agnostic and thus locale dependent operation,
6012 and it may decode bytes which are invalid in the current
6013 .Va ttycharset .
6014 \*(ID This command does not about URLs beside that.
6016 The first argument specifies the operation:
6017 .Ar e[ncode]
6019 .Ar d[ecode]
6020 perform plain URL percent en- and decoding, respectively.
6021 .Ar p[ath]enc[ode]
6023 .Ar p[ath]dec[ode]
6024 perform a slightly modified operation which should be better for
6025 pathnames: it does not allow a tilde
6026 .Ql ~ ,
6027 and will neither accept hyphen-minus
6028 .Ql -
6029 nor dot
6030 .Ql .
6031 as an initial character.
6032 The remains of the line form the URL data which is to be converted.
6033 If the coding operation fails the error number
6034 .Va \&!
6035 is set to
6036 .Va ^ERR Ns -CANCELED ,
6037 and the unmodified input is used as the result; the error number may
6038 change again due to output or result storage errors.
6041 .It Ic varedit
6042 \*(NQ Edit the values of or create the given variable(s) in the
6043 .Ev EDITOR .
6044 Boolean variables cannot be edited, and variables can also not be
6045 .Ic unset
6046 with this command.
6049 .It Ic varshow
6050 \*(NQ This command produces the same output as the listing mode of
6051 .Ic set ,
6052 including
6053 .Va verbose Ns
6054 ity adjustments, but only for the given variables.
6057 .It Ic verify
6058 \*(OP Takes a message list and verifies each message.
6059 If a message is not a S/MIME signed message,
6060 verification will fail for it.
6061 The verification process checks if the message was signed using a valid
6062 certificate,
6063 if the message sender's email address matches one of those contained
6064 within the certificate,
6065 and if the message content has been altered.
6068 .It Ic version
6069 Shows the
6070 .Va version
6072 .Va features
6073 of \*(UA.
6077 .It Ic vexpr
6078 \*(NQ Evaluate arguments according to a given operator.
6079 This is a multiplexer command which can be used to perform signed 64-bit
6080 numeric calculations as well as string operations.
6081 It uses polish notation, i.e., the operator is the first argument and
6082 defines the number and type, and the meaning of the remaining arguments.
6083 An empty argument is replaced with a 0 if a number is expected.
6084 Supports
6085 .Cm vput
6086 (see
6087 .Sx "Command modifiers" ) .
6090 The result that is shown in case of errors is always
6091 .Ql -1
6092 for usage errors and numeric operations, and the empty string for string
6093 operations.
6094 String operations which fail to provide result data for
6095 .Dq soft
6096 errors, e.g., when a search operation failed, also set the
6097 .Va \&!
6098 error number to
6099 .Va ^ERR Ns -NODATA .
6100 Except when noted than numeric arguments are parsed as signed 64-bit
6101 numbers, and errors will be reported in the error number
6102 .Va \&!
6103 as the numeric error
6104 .Va ^ERR Ns -RANGE .
6107 Numeric operations work on one or two signed 64-bit integers.
6108 One integer is expected by assignment (equals sign
6109 .Ql = ) ,
6110 which does nothing but parsing the argument, thus detecting validity and
6111 possible overflow conditions, and unary not (tilde
6112 .Ql ~ ) ,
6113 which creates the bitwise complement.
6114 Two integers are used by addition (plus sign
6115 .Ql + ) ,
6116 subtraction (hyphen-minus
6117 .Ql - ) ,
6118 multiplication (asterisk
6119 .Ql * ) ,
6120 division (solidus
6121 .Ql / )
6122 and modulo (percent sign
6123 .Ql % ) ,
6124 as well as for the bitwise operators logical or (vertical bar
6125 .Ql | ,
6126 to be quoted) ,
6127 bitwise and (ampersand
6128 .Ql \&& ,
6129 to be quoted) ,
6130 bitwise xor (circumflex
6131 .Ql ^ ) ,
6132 the bitwise signed left- and right shifts
6133 .Pf ( Ql << ,
6134 .Ql >> ) ,
6135 as well as for the unsigned right shift
6136 .Ql >>> .
6139 All numeric operators can be suffixed with a commercial at
6140 .Ql @ ,
6141 e.g.,
6142 .Ql *@ :
6143 this will turn the operation into a saturated one, which means that
6144 overflow errors and division and modulo by zero are no longer reported
6145 via the exit status, but the result will linger at the minimum or
6146 maximum possible value, instead of overflowing (or trapping).
6147 This is true also for the argument parse step.
6148 For the bitwise shifts, the saturated maximum is 63.
6149 Any catched overflow will be reported via the error number
6150 .Va \&!
6152 .Va ^ERR Ns -OVERFLOW .
6155 String operations that take one argument are
6156 .Ql length ,
6157 which queries the length of the given argument,
6158 .Ql hash ,
6159 which calculates the Chris Torek hash of the given string, and
6160 .Ql file-expand ,
6161 which performs the usual
6162 .Sx "Filename transformations" ,
6163 on its argument, as well as
6164 .Ql random ,
6165 which generates a random string of the given length, or of
6166 .Dv \&\&PATH_MAX
6167 bytes (a constant from
6168 .Pa /usr/include )
6169 if the value 0 is given; the random string will be base64url encoded
6170 according to RFC 4648, and thus be usable as a file name.
6171 There is
6172 .Ql makeprint ,
6173 which (one-way) converts the argument to something safely printable on
6174 the terminal.
6177 String operations with two or more arguments are
6178 .Ql find ,
6179 which searches in the first for the second argument, and shows the
6180 resulting 0-based offset shall it have been found,
6181 .Ql ifind ,
6182 which is identical to
6183 .Ql find ,
6184 but works case-insensitively according to the rules of the ASCII
6185 character set.
6186 .Ql substring
6187 will show a substring of its first argument:
6188 the second argument is the 0-based starting offset, the optional third
6189 argument can be used to specify the length of the desired substring,
6190 by default the entire string is used;
6191 this operation tries to work around faulty arguments (set
6192 .Va verbose
6193 for error logs), but reports them via the error number
6194 .Va \&!
6196 .Va ^ERR Ns -OVERFLOW .
6199 \*(OP
6200 .Ql regex
6201 will try to match the first argument with the regular expression given
6202 in the second argument, as does
6203 .Ql iregex ,
6204 but which is case-insensitive.
6205 These operators match according to the active
6206 .Ev LC_CTYPE
6207 locale and thus should match correctly strings in the locale encoding.
6208 If the optional third argument has been given then instead of showing
6209 the match offset a replacement operation is performed:
6210 the third argument is treated as if specified via dollar-single-quote
6211 (see
6212 .Sx "Shell-style argument quoting" ) ,
6213 and any occurrence of a positional parameter, e.g.,
6214 .Va 1 ,
6215 is replaced by the corresponding match group of the regular expression.
6217 .Bd -literal -offset indent
6218 ? vexpr -@ +1 -9223372036854775808
6219 ? vput vexpr res ir bananarama (.*)NanA(.*) '\e${1}au\e$2'
6220 ? echo $0 $res
6225 .It Ic vpospar
6226 \*(NQ Manage the positional parameter stack (see
6227 .Va 1 , # , * , @
6228 as well as
6229 .Ic shift ) .
6230 If the first argument is
6231 .Ql clear ,
6232 then the positional parameter stack of the current context, or the
6233 global one, if there is none, is cleared.
6234 If it is
6235 .Ql set ,
6236 then the remaining arguments will be used to (re)create the stack,
6237 if the parameter stack size limit is excessed an
6238 .Va ^ERR Ns -OVERFLOW
6239 error will occur.
6242 If the first argument is
6243 .Ql quote ,
6244 a round-trip capable representation of the stack contents is created,
6245 with each quoted parameter separated from each other with the first
6246 character of
6247 .Va ifs ,
6248 and followed by the first character of
6249 .Va if-ws ,
6250 if that is not empyty and not identical to the first.
6251 If that results in no separation at all a
6252 .Cm space
6253 character is used.
6254 This mode supports
6255 .Cm vput
6256 (see
6257 .Sx "Command modifiers" ) .
6258 I.e., the subcommands
6259 .Ql set
6261 .Ql quote
6262 can be used (in conjunction with
6263 .Ic eval )
6264 to (re)create an argument stack from and to a single variable losslessly.
6266 .Bd -literal -offset indent
6267 ? vpospar set hey, "'you    ", world!
6268 ? echo $#: <${1}><${2}><${3}>
6269 ? vput vpospar x quote
6270 ? vpospar clear
6271 ? echo $#: <${1}><${2}><${3}>
6272 ? eval vpospar set ${x}
6273 ? echo $#: <${1}><${2}><${3}>
6278 .It Ic visual
6279 (v) Takes a message list and invokes the display editor on each message.
6280 Modified contents are discarded unless the
6281 .Va writebackedited
6282 variable is set.
6285 .It Ic write
6286 (w) For conventional messages the body without all headers is written.
6287 The original message is never marked for deletion in the originating
6288 mail folder.
6289 The output is decrypted and converted to its native format as necessary.
6290 If the output file exists, the text is appended.
6291 If a message is in MIME multipart format its first part is written to
6292 the specified file as for conventional messages, handling of the remains
6293 depends on the execution mode.
6294 No special handling of compressed files is performed.
6296 In interactive mode the user is consecutively asked for the filenames of
6297 the processed parts.
6298 For convience saving of each part may be skipped by giving an empty
6299 value, the same result as writing it to
6300 .Pa /dev/null .
6301 Shell piping the part content by specifying a leading vertical bar
6302 .Ql |
6303 character for the filename is supported.
6304 Other user input undergoes the usual
6305 .Sx "Filename transformations" ,
6306 and contents of the destination file are overwritten if the file
6307 previously existed.
6309 \*(ID In non-interactive mode any part which does not specify a filename
6310 is ignored, and suspicious parts of filenames of the remaining parts are
6311 URL percent encoded (as via
6312 .Ic urlencode )
6313 to prevent injection of malicious character sequences, resulting in
6314 a filename that will be written into the current directory.
6315 Existing files will not be overwritten, instead the part number or
6316 a dot are appended after a number sign
6317 .Ql #
6318 to the name until file creation succeeds (or fails due to other
6319 reasons).
6322 .It Ic xcall
6323 \*(NQ This command works only inside of a
6324 .Ic call Ns
6325 ed macro: the sole difference to
6326 .Ic call
6327 is that the new macro is executed in place of the current one, which
6328 will not regain control; all resources of the current macro will be
6329 released before control is given to the replacer.
6332 .It Ic xit
6333 (x) A synonym for
6334 .Ic exit .
6337 .It Ic z
6338 \*(NQ \*(UA presents message headers in
6339 .Va screen Ns
6340 fuls as described under the
6341 .Ic headers
6342 command.
6343 Without arguments this command scrolls to the next window of messages,
6344 likewise if the argument is
6345 .Ql + .
6346 An argument of
6347 .Ql -
6348 scrolls to the last,
6349 .Ql ^
6350 scrolls to the first, and
6351 .Ql $
6352 to the last
6353 .Va \&\&screen
6354 of messages.
6355 A number argument prefixed by
6356 .Ql +
6358 .Ql \-
6359 indicates that the window is calculated in relation to the current
6360 position, and a number without a prefix specifies an absolute position.
6363 .It Ic Z
6364 \*(NQ Similar to
6365 .Ic z ,
6366 but scrolls to the next or previous window that contains at least one
6367 .Ql new
6369 .Ic flag Ns
6370 ged message.
6372 .\" }}}
6373 .\" }}}
6376 .\" .Sh COMMAND ESCAPES {{{
6377 .Sh "COMMAND ESCAPES"
6379 Here is a summary of the command escapes available in compose mode,
6380 which are used to perform special functions when composing messages.
6381 Command escapes are only recognized at the beginning of lines.
6382 The actual escape character can be set via the internal variable
6383 .Va escape ,
6384 it defaults to the tilde
6385 .Ql ~ ,
6386 which is used in place of a better alternative in the following.
6387 To avoid the possible \*(OPal history addition, an otherwise ignored
6388 (single) whitespace character can be placed after the escape character.
6391 .Bl -tag -width ".It Ic BaNg"
6393 .It Ic ~~ Ar string
6394 Insert the string of text in the message prefaced by a single
6395 .Ql ~ .
6396 (If the escape character has been changed,
6397 that character must be doubled instead.)
6400 .It Ic ~! Ar command
6401 Execute the indicated shell
6402 .Ar command
6403 which follows, replacing unescaped exclamation marks with the previously
6404 executed command if the internal variable
6405 .Va bang
6406 is set, then return to the message.
6409 .It Ic ~.
6410 Same effect as typing the end-of-file character.
6413 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
6414 Execute the given \*(UA command.
6415 Not all commands, however, are allowed.
6418 .It Ic ~?
6419 Write a summary of command escapes.
6422 .It Ic ~< Ar filename
6423 Identical to
6424 .Ic ~r .
6427 .It Ic ~<! Ar command
6428 .Ar command
6429 is executed using the shell.
6430 Its standard output is inserted into the message.
6433 .It Ic ~@ Op Ar filename...
6434 Append or edit the list of attachments.
6435 A list of
6436 .Ar filename
6437 arguments is expected (see
6438 .Sx "Shell-style argument quoting" ;
6439 any token-separating commas are ignored), to be
6440 interpreted as documented for the command line option
6441 .Fl a ,
6442 with the message number exception as below.
6443 Without
6444 .Ar filename
6445 arguments the attachment list is edited, entry by entry;
6446 if a filename is left empty, that attachment is deleted from the list;
6447 once the end of the list is reached either new attachments may be
6448 entered or the session can be quit by committing an empty
6449 .Dq new
6450 attachment.
6451 For each mode, if a given file name solely consists of the number sign
6452 .Ql #
6453 followed by a valid message number of the currently active mailbox, then
6454 the given message is attached as a MIME
6455 .Ql message/rfc822
6456 part (note the number sign is the comment character and must be quoted).
6459 .It Ic ~A
6460 Inserts the string contained in the
6461 .Va Sign
6462 variable (same as
6463 .Ql Ic ~i Ns \0Sign ) .
6464 \*(OB (Use the
6465 .Cm wysh
6466 prefix when
6467 .Ic set Ns
6468 ting the variable(s) instead!) The escape sequences tabulator
6469 .Ql \et
6470 and newline
6471 .Ql \en
6472 are understood.
6475 .It Ic ~a
6476 Inserts the string contained in the
6477 .Va sign
6478 variable (same as
6479 .Ql Ic ~i Ns \0sign ) .
6480 \*(OB (Use the
6481 .Cm wysh
6482 prefix when
6483 .Ic set Ns
6484 ting the variable(s) instead!) The escape sequences tabulator
6485 .Ql \et
6486 and newline
6487 .Ql \en
6488 are understood.
6491 .It Ic ~b Ar name ...
6492 Add the given names to the list of blind carbon copy recipients.
6495 .It Ic ~c Ar name ...
6496 Add the given names to the list of carbon copy recipients.
6499 .It Ic ~d
6500 Read the file specified by the
6501 .Ev DEAD
6502 variable into the message.
6505 .It Ic ~e
6506 Invoke the text editor on the message collected so far.
6507 After the editing session is finished,
6508 the user may continue appending text to the message.
6511 .It Ic ~F Ar messages
6512 Read the named messages into the message being sent, including all
6513 message headers and MIME parts.
6514 If no messages are specified, read in the current message.
6517 .It Ic ~f Ar messages
6518 Read the named messages into the message being sent.
6519 If no messages are specified, read in the current message.
6520 Strips down the list of header fields according to the
6521 .Ql type
6522 white- and blacklist selection of
6523 .Ic headerpick .
6524 For MIME multipart messages,
6525 only the first displayable part is included.
6528 .It Ic ~H
6529 Edit the message header fields
6530 .Ql From: ,
6531 .Ql Reply-To:
6533 .Ql Sender:
6534 by typing each one in turn and allowing the user to edit the field.
6535 The default values for these fields originate from the
6536 .Va from , replyto
6538 .Va sender
6539 variables.
6542 .It Ic ~h
6543 Edit the message header fields
6544 .Ql To: ,
6545 .Ql Cc: ,
6546 .Ql Bcc:
6548 .Ql Subject:
6549 by typing each one in turn and allowing the user to edit the field.
6552 .It Ic ~i Ar variable
6553 Insert the value of the specified variable into the message,
6554 adding a newline character at the end.
6555 The message remains unaltered if the variable is unset or empty.
6556 \*(OB (Use the
6557 .Cm wysh
6558 prefix when
6559 .Ic set Ns
6560 ting the variable(s) instead!) The escape sequences tabulator
6561 .Ql \et
6562 and newline
6563 .Ql \en
6564 are understood.
6567 .It Ic ~M Ar messages
6568 Read the named messages into the message being sent,
6569 indented by
6570 .Va indentprefix .
6571 If no messages are specified, read the current message.
6574 .It Ic ~m Ar messages
6575 Read the named messages into the message being sent,
6576 indented by
6577 .Va indentprefix .
6578 If no messages are specified, read the current message.
6579 Strips down the list of header fields according to the
6580 .Ql type
6581 white- and blacklist selection of
6582 .Ic headerpick .
6583 For MIME multipart messages,
6584 only the first displayable part is included.
6587 .It Ic ~p
6588 Display the message collected so far,
6589 prefaced by the message header fields
6590 and followed by the attachment list, if any.
6593 .It Ic ~q
6594 Abort the message being sent,
6595 copying it to the file specified by the
6596 .Ev DEAD
6597 variable if
6598 .Va save
6599 is set.
6602 .It Ic ~R Ar filename
6603 Identical to
6604 .Ic ~r ,
6605 but indent each line that has been read by
6606 .Va indentprefix .
6609 .It Ic ~r Ar filename Op Ar HERE-delimiter
6610 Read the named file into the message.
6611 .Ar filename
6612 can also be a hyphen-minus
6613 .Ql - ,
6614 in which case standard input is used, e.g., for pasting purposes.
6615 Only in this latter mode
6616 .Ar HERE-delimiter
6617 may be given: if it is data will be read in until the given
6618 .Ar HERE-delimiter
6619 is seen on a line by itself, and encountering EOF is an error; the
6620 .Ar HERE-delimiter
6621 is a required argument in non-interactive mode;
6622 note that variables expansion is performed on the delimiter.
6625 .It Ic ~s Ar string
6626 Cause the named string to become the current subject field.
6627 Newline (NL) and carriage-return (CR) bytes are invalid and will be
6628 normalized to space (SP) characters.
6631 .It Ic ~t Ar name ...
6632 Add the given name(s) to the direct recipient list.
6635 .It Ic ~U Ar messages
6636 Read in the given / current message(s) excluding all headers, indented by
6637 .Va indentprefix .
6640 .It Ic ~u Ar messages
6641 Read in the given / current message(s), excluding all headers.
6644 .It Ic ~v
6645 Invoke an alternate editor (defined by the
6646 .Ev VISUAL
6647 environment variable) on the message collected so far.
6648 Usually, the alternate editor will be a screen editor.
6649 After the editor is quit,
6650 the user may resume appending text to the end of the message.
6653 .It Ic ~w Ar filename
6654 Write the message onto the named file.
6655 If the file exists,
6656 the message is appended to it.
6659 .It Ic ~x
6660 Same as
6661 .Ic ~q ,
6662 except that the message is not saved at all.
6665 .It Ic ~| Ar command
6666 Pipe the message through the specified filter command.
6667 If the command gives no output or terminates abnormally,
6668 retain the original text of the message.
6669 E.g., the command
6670 .Xr fmt 1
6671 is often used as a rejustifying filter.
6675 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
6676 Low-level command ment for scripted message access, i.e., for
6677 .Va on-compose-splice-shell
6679 .Va on-compose-splice .
6680 The used protocol is likely subject to changes, and therefore the
6681 mentioned hooks receive the used protocol version as an initial line.
6682 In general the first field of a response line represents a status code
6683 which specifies whether a command was successful or not, whether result
6684 data is to be expected, and if, the format of the result data.
6685 The status codes are:
6688 .Bl -tag -compact -width _210_
6689 .It Ql 210
6690 Status ok; the remains of the line are the result.
6691 .It Ql 211
6692 Status ok; the rest of the line is optionally used for more status.
6693 What follows are lines of result addresses, terminated by an empty line.
6694 The address lines consist of two fields, the first of which is the
6695 plain address, e.g.,
6696 .Ql bob@exam.ple ,
6697 separated by a single ASCII SP space from the second which contains the
6698 unstripped address, even if that is identical to the first field, e.g.,
6699 .Ql (Lovely) Bob <bob@exam.ple> .
6700 .It Ql 212
6701 Status ok; the rest of the line is optionally used for more status.
6702 What follows are lines of furtherly unspecified string content,
6703 terminated by an empty line.
6704 (All the input, including the empty line, must be consumed before
6705 further commands can be issued.)
6706 .It Ql 500
6707 Syntax error; invalid command.
6708 .It Ql 501
6709 Syntax error in parameters or arguments.
6710 .It Ql 505
6711 Error: an argument fails verification.
6712 For example an invalid address has been specified.
6713 .It Ql 506
6714 Error: an otherwise valid argument is rendered invalid due to context.
6715 For example, a second address is added to a header which may consist of
6716 a single address only.
6720 If a command indicates failure then the message will have remained
6721 unmodified.
6722 Most commands can fail with
6723 .Ql 500
6724 if required arguments are missing (false command usage).
6725 The following commands are supported, and, as usual, case-insensitive:
6728 .Bl -hang -width header
6729 .It Ar header
6730 This command allows listing, inspection, and editing of message headers.
6731 The second argument specifies the subcommand to apply, one of:
6734 .Bl -hang -compact -width remove
6735 .It Ar list
6736 Without a third argument a list of all yet existing headers is given via
6737 .Ql 210 ;
6738 this command is the default command of
6739 .Ar header
6740 if no second argument has been given.
6741 A third argument restricts output to the given header only, which may
6742 fail with
6743 .Ql 501
6744 if no such field is defined.
6746 .It Ar show
6747 Shows the content of the header given as the third argument.
6748 Dependent on the header type this may respond with
6749 .Ql 211
6751 .Ql 212 ;
6752 any failure results in
6753 .Ql 501 .
6755 .It Ar remove
6756 This will remove all instances of the header given as the third
6757 argument, reporting
6758 .Ql 210
6759 upon success or
6760 .Ql 501
6761 if no such header can be found.
6763 .It Ar insert
6764 Create a new or an additional instance of the header given in the third
6765 argument, with the header body content as given in the fourth argument
6766 (the remains of the line).
6767 It may return
6768 .Ql 501
6769 if the third argument specifies a free-form header field name that is
6770 invalid, or if body content extraction fails to succeed,
6771 .Ql 505
6772 if any extracted address does not pass syntax and/or security checks, and
6773 .Ql 506
6774 to indicate prevention of excessing a single-instance header \(em note that
6775 .Ql Subject:
6776 can be appended to (a space separator will be added automatically first).
6777 .Ql 210
6778 is returned upon success.
6782 .It Ar attachment
6783 This command allows listing, removal and addition of message attachments.
6784 The second argument specifies the subcommand to apply, one of:
6787 .Bl -hang -compact -width remove
6788 .It Ar list
6789 List all attachments via
6790 .Ql 212 ,
6791 or report
6792 .Ql 501
6793 if no attachments exist.
6794 This command is the default command of
6795 .Ar attachment
6796 if no second argument has been given.
6798 .It Ar remove
6799 This will remove the attachment given as the third argument, and report
6800 .Ql 210
6801 upon success or
6802 .Ql 501
6803 if no such attachment can be found.
6804 If there exists any path component in the given argument, then an exact
6805 match of the path which has been used to create the attachment is used
6806 directly, but if only the basename of that path matches then all
6807 attachments are traversed to find an exact match first, and the removal
6808 occurs afterwards; if multiple basenames match, a
6809 .Ql 506
6810 error occurs.
6811 Message attachments are treated as absolute pathnames.
6813 If no path component exists in the given argument, then all attachments
6814 will be searched for
6815 .Ql filename=
6816 parameter matches as well as for matches of the basename of the path
6817 which has been used when the attachment has been created; multiple
6818 matches result in a
6819 .Ql 506 .
6821 .It Ar remove-at
6822 This will interpret the third argument as a number and remove the
6823 attachment at that list position (counting from one!), reporting
6824 .Ql 210
6825 upon success or
6826 .Ql 505
6827 if the argument is not a number or
6828 .Ql 501
6829 if no such attachment exists.
6831 .It Ar insert
6832 Adds the attachment given as the third argument, specified exactly as
6833 documented for the command line option
6834 .Fl a ,
6835 and supporting the message number extension as documented for
6836 .Ic ~@ .
6837 This reports
6838 .Ql 210
6839 upon success, with the index of the new attachment following,
6840 .Ql 505
6841 if the given file cannot be opened,
6842 .Ql 506
6843 if an on-the-fly performed character set conversion fails, otherwise
6844 .Ql 501
6845 is reported; this is also reported if character set conversion is
6846 requested but not available.
6848 .It Ar attribute
6849 This uses the same search mechanism as described for
6850 .Ar remove
6851 and prints any known attributes of the first found attachment via
6852 .Ql 212
6853 upon success or
6854 .Ql 501
6855 if no such attachment can be found.
6856 The attributes are written as lines of keyword and value tuples, the
6857 keyword being separated from the rest of the line with an ASCII SP space
6858 character.
6860 .It Ar attribute-at
6861 This uses the same search mechanism as described for
6862 .Ar remove-at
6863 and is otherwise identical to
6864 .Ar attribute .
6866 .It Ar attribute-set
6867 This uses the same search mechanism as described for
6868 .Ar remove ,
6869 and will assign the attribute given as the fourth argument, which is
6870 expected to be a value tuple of keyword and other data, separated by
6871 a ASCII SP space or TAB tabulator character.
6872 If the value part is empty, then the given attribute is removed, or
6873 reset to a default value if existence of the attribute is crucial.
6874 It returns via
6875 .Ql 210
6876 upon success, with the index of the found attachment following,
6877 .Ql 505
6878 for message attachments or if the given keyword is invalid, and
6879 .Ql 501
6880 if no such attachment can be found.
6881 The following keywords may be used (case-insensitively):
6883 .Bl -hang -compact -width ".Ql filename"
6884 .It Ql filename
6885 Sets the filename of the MIME part, i.e., the name that is used for
6886 display and when (suggesting a name for) saving (purposes).
6887 .It Ql content-description
6888 Associate some descriptive information to the attachment's content, used
6889 in favour of the plain filename by some MUAs.
6890 .It Ql content-id
6891 May be used for uniquely identifying MIME entities in several contexts;
6892 this expects a special reference address format as defined in RFC 2045
6893 and generates a
6894 .Ql 505
6895 upon address content verification failure.
6896 .It Ql content-type
6897 Specifies the media type and subtype of the part; managed automatically.
6898 .It Ql content-disposition
6899 Automatically set to the string
6900 .Ql attachment .
6903 .It Ar attribute-set-at
6904 This uses the same search mechanism as described for
6905 .Ar remove-at
6906 and is otherwise identical to
6907 .Ar attribute-set .
6913 .\" }}}
6916 .\" .Sh INTERNAL VARIABLES {{{
6917 .Sh "INTERNAL VARIABLES"
6919 Internal \*(UA variables are controlled via the
6920 .Ic set
6922 .Ic unset
6923 commands; prefixing a variable name with the string
6924 .Ql no
6925 and calling
6926 .Ic set
6927 has the same effect as using
6928 .Ic unset :
6929 .Ql unset crt
6931 .Ql set nocrt
6932 do the same thing.
6933 Creation or editing of variables can be performed in the
6934 .Ev EDITOR
6935 with the command
6936 .Ic varedit .
6937 .Ic varshow
6938 will give more insight on the given variable(s), and
6939 .Ic set ,
6940 when called without arguments, will show a listing of all variables.
6941 Both commands support a more
6942 .Va verbose
6943 listing mode.
6944 Some well-known variables will also become inherited from the
6945 program
6946 .Sx ENVIRONMENT
6947 implicitly, others can be explicitly imported with the command
6948 .Ic environ
6949 and henceforth share said properties.
6952 Two different kind of internal variables exist.
6953 There are boolean variables, which can only be in one of the two states
6954 .Dq set
6956 .Dq unset ,
6957 and value variables with a(n optional) string value.
6958 For the latter proper quoting is necessary upon assignment time, the
6959 introduction of the section
6960 .Sx COMMANDS
6961 documents the supported quoting rules.
6963 .Bd -literal -offset indent
6964 wysh set one=val\e 1 two="val 2" \e
6965     three='val "3"' four=$'val \e'4\e''; \e
6966 varshow one two three four; \e
6967 unset one two three four
6971 Dependent upon the actual option the string values will be interpreted
6972 as numbers, colour names, normal text etc., but there also exists
6973 a special kind of string value, the
6974 .Dq boolean string ,
6975 which must either be a decimal integer (in which case
6976 .Ql 0
6977 is false and
6978 .Ql 1
6979 and any other value is true) or any of the (case-insensitive) strings
6980 .Ql off ,
6981 .Ql no ,
6982 .Ql n
6984 .Ql false
6985 for a false boolean and
6986 .Ql on ,
6987 .Ql yes ,
6988 .Ql y
6990 .Ql true
6991 for a true boolean; a special kind of boolean string is the
6992 .Dq quadoption ,
6993 which is a boolean string that can optionally be prefixed with the
6994 (case-insensitive) term
6995 .Ql ask- ,
6996 as in
6997 .Ql ask-yes ,
6998 which causes prompting of the user in interactive mode, with the given
6999 boolean as the default value.
7001 .\" .Ss "Initial settings" {{{
7002 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7003 .Ss "Initial settings"
7005 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7006 variable settings:
7007 .Pf no Va allnet ,
7008 .Pf no Va append ,
7009 .Va asksub ,
7010 .Pf no Va askbcc ,
7011 .Pf no Va autoprint ,
7012 .Pf no Va bang ,
7013 .Pf no Va cmd ,
7014 .Pf no Va crt ,
7015 .Pf no Va debug ,
7016 .Pf no Va dot ,
7017 .Va escape
7018 set to
7019 .Ql ~ ,
7020 .Pf no Va flipr ,
7021 .Pf no Va folder ,
7022 .Va header ,
7023 .Pf no Va hold ,
7024 .Pf no Va ignore ,
7025 .Pf no Va ignoreeof ,
7026 .Pf no Va keep ,
7027 .Pf no Va keepsave ,
7028 .Pf no Va metoo ,
7029 .Pf no Va outfolder ,
7030 .Pf no Va page ,
7031 .Va prompt
7032 set to
7033 .Ql ?\0 ,
7034 .Pf no Va quiet ,
7035 .Pf no Va record ,
7036 .Va save ,
7037 .Pf no Va sendwait ,
7038 .Pf no Va showto ,
7039 .Pf no Va Sign ,
7040 .Pf no Va sign ,
7041 .Va toplines
7042 set to
7043 .Ql 5 .
7046 Notes: \*(UA does not support the
7047 .Pf no Va onehop
7048 variable \(en use command line options or
7049 .Va mta-arguments
7050 to pass options through to a
7051 .Va mta .
7052 And the default global
7053 .Pa \*(UR
7054 file, which is loaded unless the
7055 .Fl \&:
7056 (with according argument) or
7057 .Fl n
7058 command line options have been used, or the
7059 .Ev MAILX_NO_SYSTEM_RC
7060 environment variable is set (see
7061 .Sx "Resource files" )
7062 bends those initial settings a bit, e.g., it sets the variables
7063 .Va hold ,
7064 .Va keepsave
7066 .Va keep ,
7067 to name a few, establishes a default
7068 .Ic headerpick
7069 selection etc., and should thus be taken into account.
7070 .\" }}}
7072 .\" .Ss "Variables" {{{
7073 .Ss "Variables"
7075 .Bl -tag -width ".It Va BaNg"
7078 .It Va \&?
7079 \*(RO The exit status of the last command, or the
7080 .Ic return
7081 value of the macro
7082 .Ic call Ns
7083 ed last.
7084 This status has a meaning in the state machine: in conjunction with
7085 .Va errexit
7086 any non-0 exit status will cause a program exit, and in
7087 .Ev POSIXLY_CORRECT
7088 mode any error while loading (any of the) resource files will have the
7089 same effect.
7090 .Cm ignerr ,
7091 one of the
7092 .Sx "Command modifiers" ,
7093 can be used to instruct the state machine to ignore errors.
7096 .It Va \&!
7097 \*(RO The current error number
7098 .Pf ( Xr errno 3 ) ,
7099 which is set after an error occurred; it is also available via
7100 .Va ^ERR ,
7101 and the error name and documentation string can be queried via
7102 .Va ^ERRNAME
7104 .Va ^ERRDOC .
7105 \*(ID This machinery is new and the error number is only really usable
7106 if a command explicitly states that it manages the variable
7107 .Va \&! ,
7108 for others errno will be used in case of errors, or
7109 .Va ^ERR Ns -INVAL
7110 if that is 0: it thus may or may not reflect the real error.
7111 The error number may be set with the command
7112 .Ic return .
7116 .It Va ^
7117 \*(RO This is a multiplexer variable which performs dynamic expansion of
7118 the requested state or condition, of which there are:
7121 .Bl -tag -compact -width ".It Va BaNg"
7125 .It Va ^ERR , ^ERRDOC , ^ERRNAME
7126 The number, documentation, and name of the current
7127 .Xr errno 3 ,
7128 respectively, which is usually set after an error occurred.
7129 \*(ID This machinery is new and is usually reliable only if a command
7130 explicitly states that it manages the variable
7131 .Va \&! ,
7132 which is effectively identical to
7133 .Va \&\&^ERR .
7134 Each of those variables can be suffixed with a hyphen minus followed by
7135 a name or number, in which case the expansion refers to the given error.
7136 Note this is a direct mapping of (a subset of) the system error values:
7137 .Bd -literal -offset indent
7138 define work {
7139   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
7140   vput vexpr i + "$1" 1
7141   if [ $i -lt 16 ]
7142     \excall work $i
7143   end
7145 call work 0
7151 .It Va *
7152 \*(RO Expands all positional parameters (see
7153 .Va 1 ) ,
7154 separated by a space character.
7155 \*(ID The special semantics of the equally named special parameter of the
7156 .Xr sh 1
7157 are not yet supported.
7160 .It Va @
7161 \*(RO Expands all positional parameters (see
7162 .Va 1 ) ,
7163 separated by a space character.
7164 If placed in double quotation marks, each positional parameter is
7165 properly quoted to expand to a single parameter again.
7168 .It Va #
7169 \*(RO Expands to the number of positional parameters in decimal.
7172 .It Va \&0
7173 \*(RO Inside the scope of a
7174 .Ic define Ns
7175 d and
7176 .Ic call Ns
7177 ed macro this expands to the name of the calling macro, or to the empty
7178 string if the macro is running from top-level.
7179 For the \*(OPal regular expression search and replace operator of
7180 .Ic vexpr
7181 this expands to the entire matching expression.
7182 It represents the program name in global context.
7185 .It Va 1
7186 \*(RO Access of the positional parameter stack.
7187 All further parameters can be accessed with this syntax, too, e.g.,
7188 .Ql 2 ,
7189 .Ql 3
7190 etc.; positional parameters can be shifted off the stack by calling
7191 .Ic shift .
7192 The parameter stack contains, e.g., the arguments of a
7193 .Ic call Ns
7195 .Ic define Ns
7196 d macro, the matching groups of the \*(OPal regular expression search
7197 and replace expression of
7198 .Ic vexpr ,
7199 and can be explicitly created or overwritten with the command
7200 .Ic vpospar .
7203 .It Va account
7204 \*(RO Is set to the active
7205 .Ic account .
7208 .It Va add-file-recipients
7209 \*(BO When file or pipe recipients have been specified,
7210 mention them in the corresponding address fields of the message instead
7211 of silently stripping them from their recipient list.
7212 By default such addressees are not mentioned.
7215 .It Va allnet
7216 \*(BO Causes only the local part to be evaluated
7217 when comparing addresses.
7220 .It Va alternates
7221 \*(RO Is set to the list of
7222 .Ic alternates .
7225 .It Va append
7226 \*(BO Causes messages saved in the
7227 .Mx -sx
7228 .Sx "secondary mailbox"
7229 .Ev MBOX
7230 to be appended to the end rather than prepended.
7231 This should always be set.
7234 .It Va ask
7235 \*(BO Causes \*(UA to prompt for the subject of each message sent.
7236 If the user responds with simply a newline,
7237 no subject field will be sent.
7240 .It Va askatend
7241 \*(BO Causes the prompts for
7242 .Ql Cc:
7244 .Ql Bcc:
7245 lists to appear after the message has been edited.
7248 .It Va askattach
7249 \*(BO If set, \*(UA asks for files to attach at the end of each message,
7250 shall the list be found empty at that time.
7251 An empty line finalizes the list.
7254 .It Va askcc
7255 \*(BO Causes the user to be prompted for carbon copy recipients
7256 (at the end of each message if
7257 .Va askatend
7259 .Va bsdcompat
7260 are set) shall the list be found empty (at that time).
7261 An empty line finalizes the list.
7264 .It Va askbcc
7265 \*(BO Causes the user to be prompted for blind carbon copy
7266 recipients (at the end of each message if
7267 .Va askatend
7269 .Va bsdcompat
7270 are set) shall the list be found empty (at that time).
7271 An empty line finalizes the list.
7274 .It Va asksign
7275 \*(BO\*(OP Causes the user to be prompted if the message is to be
7276 signed at the end of each message.
7278 .Va smime-sign
7279 variable is ignored when this variable is set.
7282 .It Va asksub
7283 \*(BO Alternative name for
7284 .Va ask .
7287 .It Va attrlist
7288 A sequence of characters to display in the
7289 .Ql attribute
7290 column of the
7291 .Va headline
7292 as shown in the display of
7293 .Ic headers ;
7294 each for one type of messages (see
7295 .Sx "Message states" ) ,
7296 with the default being
7297 .Ql NUROSPMFAT+\-$~
7299 .Ql NU\ \ *HMFAT+\-$~
7300 if the
7301 .Va bsdflags
7302 variable is set, in the following order:
7304 .Bl -tag -compact -width ".It Ql _"
7305 .It Ql N
7306 new.
7307 .It Ql U
7308 unread but old.
7309 .It Ql R
7310 new but read.
7311 .It Ql O
7312 read and old.
7313 .It Ql S
7314 saved.
7315 .It Ql P
7316 preserved.
7317 .It Ql M
7318 mboxed.
7319 .It Ql F
7320 flagged.
7321 .It Ql A
7322 answered.
7323 .It Ql T
7324 draft.
7325 .It Ql +
7326 start of a collapsed thread.
7327 .It Ql -
7328 an uncollapsed thread (TODO ignored for now).
7329 .It Ql $
7330 classified as spam.
7331 .It Ql ~
7332 classified as possible spam.
7337 .It Va autobcc
7338 Specifies a list of recipients to which a blind carbon copy of each
7339 outgoing message will be sent automatically.
7342 .It Va autocc
7343 Specifies a list of recipients to which a carbon copy of each outgoing
7344 message will be sent automatically.
7347 .It Va autocollapse
7348 \*(BO Causes threads to be collapsed automatically when threaded mode
7349 is entered (see the
7350 .Ic collapse
7351 command).
7354 .It Va autoprint
7355 \*(BO Enable automatic
7356 .Ic type Ns
7357 ing of a(n existing)
7358 .Dq successive
7359 message after
7360 .Ic delete
7362 .Ic undelete
7363 commands, e.g., the message that becomes the new
7364 .Dq dot
7365 is shown automatically, as via
7366 .Ic dp
7368 .Ic dt .
7371 .It Va autothread
7372 \*(BO\*(OB Causes threaded mode (see the
7373 .Ic thread
7374 command) to be entered automatically when a folder is opened.
7375 The same as
7376 .Ql autosort=thread .
7379 .It Va autosort
7380 Causes sorted mode (see the
7381 .Ic sort
7382 command) to be entered automatically with the value of this variable as
7383 sorting method when a folder is opened, e.g.,
7384 .Ql set autosort=thread .
7387 .It Va bang
7388 \*(BO Enables the substitution of all not (reverse-solidus) escaped
7389 exclamation mark
7390 .Ql \&!
7391 characters by the contents of the last executed command for the
7392 .Ic \&!
7393 shell escape command and
7394 .Ic ~! ,
7395 one of the compose mode
7396 .Sx "COMMAND ESCAPES" .
7397 If this variable is not set no reverse solidus stripping is performed.
7400 .It Va batch-exit-on-error
7401 \*(OB\*(BO Predecessor of
7402 .Va errexit .
7405 .It Va bind-timeout
7406 \*(OP Terminals generate multi-byte sequences for certain forms of
7407 input, for example for function and other special keys.
7408 Some terminals however do not write these multi-byte sequences as
7409 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
7410 This variable specifies the timeout in milliseconds that the MLE (see
7411 .Sx "On terminal control and line editor" )
7412 waits for more bytes to arrive unless it considers a sequence
7413 .Dq complete .
7414 The default is 200.
7417 .It Va bsdcompat
7418 \*(BO Sets some cosmetical features to traditional BSD style;
7419 has the same affect as setting
7420 .Va askatend
7421 and all other variables prefixed with
7422 .Ql bsd ;
7423 it also changes the behaviour of
7424 .Va emptystart
7425 (which does not exist in BSD).
7428 .It Va bsdflags
7429 \*(BO Changes the letters shown in the first column of a header
7430 summary to traditional BSD style.
7433 .It Va bsdheadline
7434 \*(BO Changes the display of columns in a header summary to traditional
7435 BSD style.
7438 .It Va bsdmsgs
7439 \*(BO Changes some informational messages to traditional BSD style.
7442 .It Va bsdorder
7443 \*(BO Causes the
7444 .Ql Subject:
7445 field to appear immediately after the
7446 .Ql To:
7447 field in message headers and with the
7448 .Ic ~h
7449 .Sx "COMMAND ESCAPES" .
7453 .It Va build-os , build-osenv
7454 \*(RO The operating system \*(UA has been build for, usually taken from
7455 .Xr uname 1
7457 .Ql uname -s
7459 .Ql uname -srm ,
7460 respectively, the former being lowercased.
7463 .It Va charset-7bit
7464 The value that should appear in the
7465 .Ql charset=
7466 parameter of
7467 .Ql Content-Type:
7468 MIME header fields when no character set conversion of the message data
7469 was performed.
7470 This defaults to US-ASCII, and the chosen character set should be
7471 US-ASCII compatible.
7474 .It Va charset-8bit
7475 \*(OP The default 8-bit character set that is used as an implicit last
7476 member of the variable
7477 .Va sendcharsets .
7478 This defaults to UTF-8 if character set conversion capabilities are
7479 available, and to ISO-8859-1 otherwise, in which case the only supported
7480 character set is
7481 .Va ttycharset
7482 and this variable is effectively ignored.
7483 Refer to the section
7484 .Sx "Character sets"
7485 for the complete picture of character set conversion in \*(UA.
7488 .It Va charset-unknown-8bit
7489 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
7490 .Dq upgrade
7491 the content of a mail message by using a character set with the name
7492 .Ql unknown-8bit .
7493 Because of the unclassified nature of this character set \*(UA will not
7494 be capable to convert this character set to any other character set.
7495 If this variable is set any message part which uses the character set
7496 .Ql unknown-8bit
7497 is assumed to really be in the character set given in the value,
7498 otherwise the (final) value of
7499 .Va charset-8bit
7500 is used for this purpose.
7502 This variable will also be taken into account if a MIME type (see
7503 .Sx "The mime.types files" )
7504 of a MIME message part that uses the
7505 .Ql binary
7506 character set is forcefully treated as text.
7509 .It Va cmd
7510 The default value for the
7511 .Ic pipe
7512 command.
7515 .It Va colour-disable
7516 \*(BO\*(OP Forcefully disable usage of colours.
7517 Also see the section
7518 .Sx "Coloured display" .
7521 .It Va colour-pager
7522 \*(BO\*(OP Whether colour shall be used for output that is paged through
7523 .Ev PAGER .
7524 Note that pagers may need special command line options, e.g.,
7525 .Xr less 1
7526 requires the option
7527 .Fl \&\&R
7529 .Xr lv 1
7530 the option
7531 .Fl \&\&c
7532 in order to support colours.
7533 Often doing manual adjustments is unnecessary since \*(UA may perform
7534 adjustments dependent on the value of the environment variable
7535 .Ev PAGER
7536 (see there for more).
7540 .It Va contact-mail , contact-web
7541 \*(RO Addresses for contact per email and web, respectively, e.g., for
7542 bug reports, suggestions, or help regarding \*(UA.
7543 The former can be used directly:
7544 .Ql ? eval mail $contact-mail .
7547 .It Va crt
7548 In a(n interactive) terminal session, then if this valued variable is
7549 set it will be used as a threshold to determine how many lines the given
7550 output has to span before it will be displayed via the configured
7551 .Ev PAGER ;
7552 Usage of the
7553 .Ev PAGER
7554 can be forced by setting this to the value
7555 .Ql 0 ,
7556 setting it without a value will deduce the current height of the
7557 terminal screen to compute the treshold (see
7558 .Ev LINES ,
7559 .Va screen
7561 .Xr stty 1 ) .
7562 \*(ID At the moment this uses the count of lines of the message in wire
7563 format, which, dependent on the
7564 .Va encoding
7565 of the message, is unrelated to the number of display lines.
7566 (The software is old and historically the relation was a given thing.)
7569 .It Va customhdr
7570 Define a set of custom headers to be injected into newly composed or
7571 forwarded messages; it is also possible to create custom headers in
7572 compose mode with
7573 .Ic ~^ ,
7574 which can be automated by setting one of the hooks
7575 .Va on-compose-splice-shell
7577 .Va on-compose-splice .
7578 The value is interpreted as a comma-separated list of custom headers to
7579 be injected, to include commas in the header bodies escape them with
7580 reverse solidus.
7581 \*(ID Overwriting of automatically managed headers is neither supported
7582 nor prevented.
7584 .Dl set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
7587 .It Va datefield
7588 Controls the appearance of the
7589 .Ql %d
7590 date and time format specification of the
7591 .Va headline
7592 variable, that is used, for example, when viewing the summary of
7593 .Ic headers .
7594 If unset, then the local receiving date is used and displayed
7595 unformatted, otherwise the message sending
7596 .Ql Date: .
7597 It is possible to assign a
7598 .Xr strftime 3
7599 format string and control formatting, but embedding newlines via the
7600 .Ql %n
7601 format is not supported, and will result in display errors.
7602 The default is
7603 .Ql %Y-%m-%d %H:%M ,
7604 and also see
7605 .Va datefield-markout-older .
7608 .It Va datefield-markout-older
7609 Only used in conjunction with
7610 .Va datefield .
7611 Can be used to create a visible distinction of messages dated more than
7612 a day in the future, or older than six months, a concept comparable to the
7613 .Fl \&\&l
7614 option of the POSIX utility
7615 .Xr ls 1 .
7616 If set to the empty string, then the plain month, day and year of the
7617 .Ql Date:
7618 will be displayed, but a
7619 .Xr strftime 3
7620 format string to control formatting can be assigned.
7621 The default is
7622 .Ql %Y-%m-%d .
7625 .It Va debug
7626 \*(BO Enables debug messages and obsoletion warnings, disables the
7627 actual delivery of messages and also implies
7628 .Pf no Va record
7629 as well as
7630 .Pf no Va save .
7633 .It Va disposition-notification-send
7634 \*(BO\*(OP Emit a
7635 .Ql Disposition-Notification-To:
7636 header (RFC 3798) with the message.
7637 This requires the
7638 .Va from
7639 variable to be set.
7640 .\" TODO .It Va disposition-notification-send-HOST
7641 .\"Overrides
7642 .\".Va disposition-notification-send
7643 .\" for SMTP accounts on a specific host.
7644 .\" TODO .It Va disposition-notification-send-USER@HOST
7645 .\"Overrides
7646 .\".Va disposition-notification-send
7647 .\"for a specific account.
7650 .It Va dot
7651 \*(BO When dot is set, a period
7652 .Ql \&.
7653 on a line by itself during message input in (interactive or batch
7654 .Fl # )
7655 compose mode will be treated as end-of-message (in addition to the
7656 normal end-of-file condition).
7657 This behaviour is implied in
7658 .Va posix
7659 mode with a set
7660 .Va ignoreeof .
7663 .It Va dotlock-ignore-error
7664 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
7665 .Mx -sx
7666 .Sx "primary system mailbox" Ns
7667 es (see, e.g., the notes on
7668 .Sx "Filename transformations" ,
7669 as well as the documentation of
7670 .Ic file )
7671 will be protected with so-called dotlock files\(emthe traditional mail
7672 spool file locking method\(emin addition to system file locking.
7673 Because \*(UA ships with a privilege-separated dotlock creation program
7674 that should always be able to create such a dotlock file there is no
7675 good reason to ignore dotlock file creation errors, and thus these are
7676 fatal unless this variable is set.
7679 .It Va editalong
7680 \*(BO If this variable is set then the editor is started automatically
7681 when a message is composed in interactive mode, as if the
7682 .Ic ~e
7683 .Sx "COMMAND ESCAPES"
7684 had been specified.
7686 .Va editheaders
7687 variable is implied for this automatically spawned editor session.
7690 .It Va editheaders
7691 \*(BO When a message is edited while being composed,
7692 its header is included in the editable text.
7694 .Ql To: ,
7695 .Ql Cc: ,
7696 .Ql Bcc: ,
7697 .Ql Subject: ,
7698 .Ql From: ,
7699 .Ql Reply-To:
7701 .Ql Sender:
7702 fields are accepted within the header, other fields are ignored.
7705 .It Va emptystart
7706 \*(BO When entering interactive mode \*(UA normally writes
7707 .Dq \&No mail for user
7708 and exits immediately if a mailbox is empty or does not exist.
7709 If this variable is set \*(UA starts even with an empty or nonexistent
7710 mailbox (the latter behaviour furtherly depends upon
7711 .Va bsdcompat ,
7712 though).
7715 .It Va encoding
7716 The MIME
7717 .Ql Content-Transfer-Encoding
7718 to use in outgoing text messages and message parts, where applicable.
7719 (7-bit clean text messages are sent as-is, without a transfer encoding.)
7720 Valid values are:
7722 .Bl -tag -compact -width "_%%_"
7723 .It Ql 8bit
7724 .Pf (Or\0 Ql 8b . )
7725 8-bit transport effectively causes the raw data be passed through
7726 unchanged, but may cause problems when transferring mail messages over
7727 channels that are not ESMTP (RFC 1869) compliant.
7728 Also, several input data constructs are not allowed by the
7729 specifications and may cause a different transfer-encoding to be used.
7730 .It Ql quoted-printable
7731 .Pf (Or\0 Ql qp . )
7732 Quoted-printable encoding is 7-bit clean and has the property that ASCII
7733 characters are passed through unchanged, so that an english message can
7734 be read as-is; it is also acceptible for other single-byte locales that
7735 share many characters with ASCII, like, e.g., ISO-8859-1.
7736 The encoding will cause a large overhead for messages in other character
7737 sets: e.g., it will require up to twelve (12) bytes to encode a single
7738 UTF-8 character of four (4) bytes.
7739 .It Ql base64
7740 .Pf (Or\0 Ql b64 . )
7741 The default encoding, it is 7-bit clean and will always be used for
7742 binary data.
7743 This encoding has a constant input:output ratio of 3:4, regardless of
7744 the character set of the input data it will encode three bytes of input
7745 to four bytes of output.
7746 This transfer-encoding is not human readable without performing
7747 a decoding step.
7751 .It Va errexit
7752 \*(BO Let each command with a non-0 exit status, including every
7753 .Ic call Ns
7754 ed macro which
7755 .Ic return Ns
7756 s a non-0 status, cause a program exit unless prefixed by
7757 .Cm ignerr
7758 (see
7759 .Sx "Command modifiers" ) ;
7760 please refer to the variable
7761 .Va \&?
7762 for more on this topic.
7765 .It Va escape
7766 The first character of this value defines the escape character for
7767 .Sx "COMMAND ESCAPES"
7768 in compose mode.
7769 The default value is the character tilde
7770 .Ql ~ .
7771 If set to the empty string, command escapes are disabled.
7772 Changes on this variable will not affect an active compose mode.
7775 .It Va expandaddr
7776 If not set then file and command pipeline targets are not allowed,
7777 and any such address will be filtered out, giving a warning message.
7778 If set without a value then all possible recipient address
7779 specifications will be accepted \(en see the section
7780 .Sx "On sending mail, and non-interactive mode"
7781 for more on this.
7782 To accept them, but only in interactive mode, or when tilde commands
7783 were enabled explicitly by using one of the command line options
7784 .Fl ~
7786 .Fl # ,
7787 set this to the (case-insensitive) value
7788 .Ql restrict
7789 (it actually acts like
7790 .Ql restrict,-all,+name,+addr ,
7791 so that care for ordering issues must be taken) .
7793 In fact the value is interpreted as a comma-separated list of values.
7794 If it contains
7795 .Ql fail
7796 then the existence of disallowed specifications is treated as a hard
7797 send error instead of only filtering them out.
7798 The remaining values specify whether a specific type of recipient
7799 address specification is allowed (optionally indicated by a plus sign
7800 .Ql +
7801 prefix) or disallowed (prefixed with a hyphen-minus
7802 .Ql - ) .
7803 The value
7804 .Ql all
7805 addresses all possible address specifications,
7806 .Ql file
7807 file targets,
7808 .Ql pipe
7809 command pipeline targets,
7810 .Ql name
7811 plain user names and (MTA) aliases (\*(OB
7812 .Ql noalias
7813 may be used as an alternative syntax to
7814 .Ql -name )
7816 .Ql addr
7817 network addresses.
7818 These kind of values are interpreted in the given order, so that
7819 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
7820 will cause hard errors for any non-network address recipient address
7821 unless \*(UA is in interactive mode or has been started with the
7822 .Fl ~
7824 .Fl #
7825 command line option; in the latter case(s) any address may be used, then.
7827 Historically invalid network addressees are silently stripped off.
7828 To change this and ensure that any encountered invalid email address
7829 instead causes a hard error, ensure the string
7830 .Ql failinvaddr
7831 is an entry in the above list.
7832 Setting this automatically enables network addressees
7833 (it actually acts like
7834 .Ql failinvaddr,+addr ,
7835 so that care for ordering issues must be taken) .
7838 .It Va expandargv
7839 Unless this variable is set additional
7840 .Va mta
7841 (Mail-Transfer-Agent)
7842 arguments from the command line, as can be given after a
7843 .Fl \&\&-
7844 separator, are ignored due to safety reasons.
7845 However, if set to the special (case-insensitive) value
7846 .Ql fail ,
7847 then the presence of additional MTA arguments is treated as a hard
7848 error that causes \*(UA to exit with failure status.
7849 A lesser strict variant is the otherwise identical
7850 .Ql restrict ,
7851 which does accept such arguments in interactive mode, or if tilde
7852 commands were enabled explicitly by using one of the command line options
7853 .Fl ~
7855 .Fl # .
7858 .It Va features
7859 \*(RO String giving a list of features \*(UA, preceded with a plus sign
7860 .Ql +
7861 if the feature is available, and a hyphen-minus
7862 .Ql -
7863 otherwise.
7864 The output of the command
7865 .Ic version
7866 will include this information.
7869 .It Va flipr
7870 \*(BO This setting reverses the meanings of a set of reply commands,
7871 turning the lowercase variants, which by default address all recipients
7872 included in the header of a message
7873 .Pf ( Ic reply , respond , followup )
7874 into the uppercase variants, which by default address the sender only
7875 .Pf ( Ic Reply , Respond , Followup )
7876 and vice versa.
7877 The commands
7878 .Ic replysender , respondsender , followupsender
7879 as well as
7880 .Ic replyall , respondall , followupall
7881 are not affected by the current setting of
7882 .Va flipr .
7885 .It Va folder
7886 The default path under which mailboxes are to be saved:
7887 file names that begin with the plus sign
7888 .Ql +
7889 will have the plus sign replaced with the value of this variable if set,
7890 otherwise the plus sign will remain unchanged when doing
7891 .Sx "Filename transformations" ;
7892 also see
7893 .Ic file
7894 for more on this topic.
7895 The value supports a subset of transformations itself, and if the
7896 non-empty value does not start with a solidus
7897 .Ql / ,
7898 then the value of
7899 .Ev HOME
7900 will be prefixed automatically.
7901 Once the actual value is evaluated first, the internal variable
7902 .Va folder-resolved
7903 will be updated for caching purposes.
7906 .It Va folder-hook
7907 This variable can be set to the name of a
7908 .Ic define Ns d
7909 macro which will be called whenever a
7910 .Ic file
7911 is opened.
7912 The macro will also be invoked when new mail arrives,
7913 but message lists for commands executed from the macro
7914 only include newly arrived messages then.
7915 .Ic localopts
7916 are activated by default in a folder hook, causing the covered settings
7917 to be reverted once the folder is left again.
7919 .Sy \*(ID:
7920 Macro behaviour, including option localization, will change in v15.
7921 One should be aware of that and possibly embed version checks in the
7922 used resource file(s).
7925 .It Va folder-hook-FOLDER
7926 Overrides
7927 .Va folder-hook
7928 for a folder named
7929 .Ql FOLDER .
7930 Unlike other folder specifications, the fully expanded name of a folder,
7931 without metacharacters, is used to avoid ambiguities.
7932 However, if the mailbox resides under
7933 .Va folder
7934 then the usual
7935 .Ql +
7936 specification is tried in addition, e.g., if
7937 .Va \&\&folder
7939 .Dq mail
7940 (and thus relative to the user's home directory) then
7941 .Pa /home/usr1/mail/sent
7942 will be tried as
7943 .Ql folder-hook-/home/usr1/mail/sent
7944 first, but then followed by
7945 .Ql folder-hook-+sent .
7948 .It Va folder-resolved
7949 \*(RO Set to the fully resolved path of
7950 .Va folder
7951 once that evaluation has occurred; rather internal.
7954 .It Va followup-to
7955 \*(BO Controls whether a
7956 .Ql Mail-Followup-To:
7957 header is generated when sending messages to known mailing lists.
7958 Also see
7959 .Va followup-to-honour
7960 and the commands
7961 .Ic mlist , mlsubscribe , reply
7963 .Ic Lreply .
7966 .It Va followup-to-honour
7967 Controls whether a
7968 .Ql Mail-Followup-To:
7969 header is honoured when group-replying to a message via
7970 .Ic reply
7972 .Ic Lreply .
7973 This is a quadoption; if set without a value it defaults to
7974 .Dq yes .
7975 Also see
7976 .Va followup-to
7977 and the commands
7978 .Ic mlist
7980 .Ic mlsubscribe .
7983 .It Va forward-as-attachment
7984 \*(BO Original messages are normally sent as inline text with the
7985 .Ic forward
7986 command,
7987 and only the first part of a multipart message is included.
7988 With this setting enabled messages are sent as unmodified MIME
7989 .Ql message/rfc822
7990 attachments with all of their parts included.
7993 .It Va from
7994 The address (or a list of addresses) to put into the
7995 .Ql From:
7996 field of the message header, quoting RFC 5322:
7997 the author(s) of the message, that is, the mailbox(es) of the person(s)
7998 or system(s) responsible for the writing of the message.
7999 When
8000 .Ic reply Ns
8001 ing to messages these addresses are handled as if they were in the
8002 .Ic alternates
8003 list.
8005 If the machine's hostname is not valid at the Internet (for example at
8006 a dialup machine) then either this variable or
8007 .Va hostname
8008 (\*(IN and with a defined SMTP protocol in
8009 .Va mta
8010 .Va smtp-hostname
8011 adds even more fine-tuning capabilities),
8012 have to be set.
8014 .Va \&\&from
8015 contains more than one address,
8016 setting the
8017 .Va sender
8018 variable is required (according to the standard RFC 5322).
8020 If a file-based MTA is used, then
8021 .Va from
8022 (or, if that contains multiple addresses,
8023 .Va sender )
8024 can nonetheless be enforced to appear as the envelope sender address at
8025 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8026 .Fl r
8027 command line option (with an empty argument; see there for the complete
8028 picture on this topic), or by setting the internal variable
8029 .Va r-option-implicit .
8032 .It Va fullnames
8033 \*(BO When replying to or forwarding a message \*(UA normally removes
8034 the comment and name parts of email addresses.
8035 If this variable is set such stripping is not performed,
8036 and comments, names etc. are retained.
8039 .It Va fwdheading
8040 The string to put before the text of a message with the
8041 .Ic forward
8042 command
8043 (unless the
8044 .Va forward-as-attachment
8045 variable is set).
8046 Defaults to
8047 .Dq -------- Original Message --------
8048 if unset; No heading is put if it is set to the empty string.
8051 .It Va header
8052 \*(BO Causes the header summary to be written at startup and after
8053 commands that affect the number of messages or the order of messages in
8054 the current
8055 .Ic folder .
8056 Unless in
8057 .Ev POSIXLY_CORRECT
8058 mode a header summary will also be displayed on folder changes.
8059 The command line option
8060 .Fl N
8061 can be used to set
8062 .Pf no Va header .
8066 .It Va headline
8067 A format string to use for the summary of
8068 .Ic headers ,
8069 similar to the ones used for
8070 .Xr printf 3
8071 formats.
8072 Format specifiers in the given string start with a percent sign
8073 .Ql %
8074 and may be followed by an optional decimal number indicating the field
8075 width \(em if that is negative, the field is to be left-aligned.
8076 Valid format specifiers are:
8079 .Bl -tag -compact -width "_%%_"
8080 .It Ql %%
8081 A plain percent sign.
8082 .It Ql %>
8083 .Dq Dotmark :
8084 a space character but for the current message
8085 .Pf ( Dq dot ) ,
8086 for which it expands to
8087 .Ql > .
8088 .It Ql %<
8089 .Dq Dotmark :
8090 a space character but for the current message
8091 .Pf ( Dq dot ) ,
8092 for which it expands to
8093 .Ql < .
8094 .It Ql %$
8095 \*(OP The spam score of the message, as has been classified via the
8096 command
8097 .Ic spamrate .
8098 Shows only a replacement character if there is no spam support.
8099 .It Ql %a
8100 Message attribute character (status flag); the actual content can be
8101 adjusted by setting
8102 .Va attrlist .
8103 .It Ql %d
8104 The date found in the
8105 .Ql From:
8106 header of the message when
8107 .Va datefield
8108 is set (the default), otherwise the date when the message was received.
8109 Formatting can be controlled by assigning a
8110 .Xr strftime 3
8111 format string to
8112 .Va datefield .
8113 .It Ql %e
8114 The indenting level in threaded mode.
8115 .It Ql %f
8116 The address of the message sender.
8117 .It Ql %i
8118 The message thread tree structure.
8119 (Note that this format does not support a field width.)
8120 .It Ql %l
8121 The number of lines of the message, if available.
8122 .It Ql %m
8123 Message number.
8124 .It Ql %o
8125 The number of octets (bytes) in the message, if available.
8126 .It Ql %s
8127 Message subject (if any).
8128 .It Ql %S
8129 Message subject (if any) in double quotes.
8130 .It Ql \&%T
8131 Message recipient flags: is the addressee of the message a known or
8132 subscribed mailing list \(en see
8133 .Ic mlist
8135 .Ic mlsubscribe .
8136 .It Ql %t
8137 The position in threaded/sorted order.
8140 The default is
8141 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
8143 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
8145 .Va bsdcompat
8146 is set.
8147 Also see
8148 .Va attrlist
8150 .Va headline-bidi .
8154 .It Va headline-bidi
8155 Bidirectional text requires special treatment when displaying headers,
8156 because numbers (in dates or for file sizes etc.) will not affect the
8157 current text direction, in effect resulting in ugly line layouts when
8158 arabic or other right-to-left text is to be displayed.
8159 On the other hand only a minority of terminals is capable to correctly
8160 handle direction changes, so that user interaction is necessary for
8161 acceptable results.
8162 Note that extended host system support is required nonetheless, e.g.,
8163 detection of the terminal character set is one precondition;
8164 and this feature only works in an Unicode (i.e., UTF-8) locale.
8166 In general setting this variable will cause \*(UA to encapsulate text
8167 fields that may occur when displaying
8168 .Va headline
8169 (and some other fields, like dynamic expansions in
8170 .Va prompt )
8171 with special Unicode control sequences;
8172 it is possible to fine-tune the terminal support level by assigning
8173 a value:
8174 no value (or any value other than
8175 .Ql 1 ,
8176 .Ql 2
8178 .Ql 3 )
8179 will make \*(UA assume that the terminal is capable to properly deal
8180 with Unicode version 6.3, in which case text is embedded in a pair of
8181 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
8182 characters.
8183 In addition no space on the line is reserved for these characters.
8185 Weaker support is chosen by using the value
8186 .Ql 1
8187 (Unicode 6.3, but reserve the room of two spaces for writing the control
8188 sequences onto the line).
8189 The values
8190 .Ql 2
8192 .Ql 3
8193 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
8194 again reserves room for two spaces in addition.
8197 .It Va history-file
8198 \*(OP If a line editor is available then this can be set to
8199 name the (expandable) path of the location of a permanent history file.
8200 Also see
8201 .Va history-size .
8204 .It Va history-gabby
8205 \*(BO\*(OP Add more entries to the history as is normally done.
8208 .It Va history-gabby-persist
8209 \*(BO\*(OP \*(UA's own MLE will not save the additional
8210 .Va history-gabby
8211 entries in persistent storage unless this variable is set.
8212 On the other hand it will not loose the knowledge of whether
8213 a persistent entry was gabby or not.
8214 Also see
8215 .Va history-file .
8218 .It Va history-size
8219 \*(OP Setting this variable imposes a limit on the number of concurrent
8220 history entries.
8221 If set to the value 0 then no further history entries will be added, and
8222 loading and incorporation of the
8223 .Va history-file
8224 upon program startup can also be suppressed by doing this.
8225 Runtime changes will not be reflected, but will affect the number of
8226 entries saved to permanent storage.
8229 .It Va hold
8230 \*(BO This setting controls whether messages are held in the system
8231 .Va inbox ,
8232 and it is set by default.
8235 .It Va hostname
8236 Use this string as hostname when expanding local addresses instead of
8237 the value obtained from
8238 .Xr uname 3
8240 .Xr getaddrinfo 3 .
8241 It is used, e.g., in
8242 .Ql Message-ID:
8244 .Ql From:
8245 fields, as well as when generating
8246 .Ql Content-ID:
8247 MIME part related unique ID fields.
8248 Setting it to the empty string will cause the normal hostname to be
8249 used, but nonetheless enables creation of said ID fields.
8250 \*(IN in conjunction with the builtin SMTP
8251 .Va mta
8252 .Va smtp-hostname
8253 also influences the results:
8254 one should produce some test messages with the desired combination of
8255 .Va \&\&hostname ,
8256 and/or
8257 .Va from ,
8258 .Va sender
8259 etc. first.
8262 .It Va idna-disable
8263 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
8264 names according to the rules of IDNA (internationalized domain names
8265 for applications).
8266 Since the IDNA code assumes that domain names are specified with the
8267 .Va ttycharset
8268 character set, an UTF-8 locale charset is required to represent all
8269 possible international domain names (before conversion, that is).
8272 .It Va ifs
8273 The input field separator that is used (\*(ID by some functions) to
8274 determine where to split input data.
8276 .Bl -tag -compact -width MMM
8277 .It 1.
8278 Unsetting is treated as assigning the default value,
8279 .Ql \& \et\en .
8280 .It 2.
8281 If set to the empty value, no field splitting will be performed.
8282 .It 3.
8283 If set to a non-empty value, all whitespace characters are extracted
8284 and assigned to the variable
8285 .Va ifs-ws .
8288 .Bl -tag -compact -width MMM
8289 .It a.
8290 .Va \&\&ifs-ws
8291 will be ignored at the beginning and end of input.
8292 Diverging from POSIX shells default whitespace is removed in addition,
8293 which is owed to the entirely different line content extraction rules.
8294 .It b.
8295 Each occurrence of a character of
8296 .Va \&\&ifs
8297 will cause field-splitting, any adjacent
8298 .Va \&\&ifs-ws
8299 characters will be skipped.
8303 .It Va ifs-ws
8304 \*(RO Automatically deduced from the whitespace characters in
8305 .Va ifs .
8308 .It Va ignore
8309 \*(BO Ignore interrupt signals from the terminal while entering
8310 messages; instead echo them as
8311 .Ql @
8312 characters and discard the current line.
8315 .It Va ignoreeof
8316 \*(BO Ignore end-of-file conditions
8317 .Pf ( Ql control-D )
8318 in compose mode on message input and in interactive command input.
8319 If set an interactive command input session can only be left by
8320 explicitly using one of the commands
8321 .Ic exit
8323 .Ic quit ,
8324 and message input in compose mode can only be terminated by entering
8325 a period
8326 .Ql \&.
8327 on a line by itself or by using the
8328 .Ic ~.
8329 .Sx "COMMAND ESCAPES" ;
8330 Setting this implies the behaviour that
8331 .Va dot
8332 describes in
8333 .Va posix
8334 mode.
8337 .It Va inbox
8338 If this is set to a non-empty string it will specify the users
8339 .Mx -sx
8340 .Sx "primary system mailbox" ,
8341 overriding
8342 .Ev MAIL
8343 and the system-dependent default, and (thus) be used to replace
8344 .Ql %
8345 when doing
8346 .Sx "Filename transformations" ;
8347 also see
8348 .Ic file
8349 for more on this topic.
8350 The value supports a subset of transformations itself.
8353 .It Va indentprefix
8354 String used by the
8355 .Ic ~m , ~M
8357 .Ic ~R
8358 .Sx "COMMAND ESCAPES"
8359 and by the
8360 .Va quote
8361 option for indenting messages,
8362 in place of the normal tabulator character
8363 .Ql ^I ,
8364 which is the default.
8365 Be sure to quote the value if it contains spaces or tabs.
8368 .It Va keep
8369 \*(BO If set, an empty
8370 .Mx -sx
8371 .Sx "primary system mailbox"
8372 file is not removed.
8373 Note that, in conjunction with
8374 .Ev POSIXLY_CORRECT
8375 any empty file will be removed unless this variable is set.
8376 This may improve the interoperability with other mail user agents
8377 when using a common folder directory, and prevents malicious users
8378 from creating fake mailboxes in a world-writable spool directory.
8379 \*(ID Only local regular (MBOX) files are covered, Maildir or other
8380 mailbox types will never be removed, even if empty.
8383 .It Va keep-content-length
8384 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
8385 be told to keep the
8386 .Ql Content-Length:
8388 .Ql Lines:
8389 header fields that some MUAs generate by setting this variable.
8390 Since \*(UA does neither use nor update these non-standardized header
8391 fields (which in itself shows one of their conceptual problems),
8392 stripping them should increase interoperability in between MUAs that
8393 work with with same mailbox files.
8394 Note that, if this is not set but
8395 .Va writebackedited ,
8396 as below, is, a possibly performed automatic stripping of these header
8397 fields already marks the message as being modified.
8400 .It Va keepsave
8401 \*(BO When a message is saved it is usually discarded from the
8402 originating folder when \*(UA is quit.
8403 This setting causes all saved message to be retained.
8406 .It Va line-editor-disable
8407 \*(BO Turn off any enhanced line editing capabilities (see
8408 .Sx "On terminal control and line editor"
8409 for more).
8412 .It Va line-editor-no-defaults
8413 \*(BO\*(OP Do not establish any default key binding.
8416 .It Va log-prefix
8417 Error log message prefix string
8418 .Pf ( Ql "\*(uA: " ) .
8421 .It Va mailbox-display
8422 \*(RO The name of the current mailbox
8423 .Pf ( Ic file ) ,
8424 possibly abbreviated for display purposes.
8427 .It Va mailbox-resolved
8428 \*(RO The fully resolved path of the current mailbox.
8431 .It Va mailx-extra-rc
8432 An additional startup file that is loaded as the last of the
8433 .Sx "Resource files" .
8434 Use this file for commands that are not understood by other POSIX
8435 .Xr mailx 1
8436 implementations, i.e., mostly anything which is not covered by
8437 .Sx "Initial settings" .
8440 .It Va markanswered
8441 \*(BO When a message is replied to and this variable is set,
8442 it is marked as having been
8443 .Ic answered .
8444 See the section
8445 .Sx "Message states" .
8448 .It Va mbox-rfc4155
8449 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
8450 POSIX rules for detecting message boundaries (so-called
8451 .Ql From_
8452 lines) due to compatibility reasons, instead of the stricter rules that
8453 have been standardized in RFC 4155.
8454 This behaviour can be switched to the stricter RFC 4155 rules by
8455 setting this variable.
8456 (This is never necessary for any message newly generated by \*(UA,
8457 it only applies to messages generated by buggy or malicious MUAs, or may
8458 occur in old MBOX databases: \*(UA itself will choose a proper
8459 .Va encoding
8460 to ensure that
8461 .Ql From_
8462 lines cannot be misinterpreted as message boundaries.)
8464 This may temporarily be handy when \*(UA complains about invalid
8465 .Ql From_
8466 lines when opening a MBOX: in this case setting this variable and
8467 re-opening the mailbox in question may correct the result.
8468 If so, copying the entire mailbox to some other file, as in
8469 .Ql copy * SOME-FILE ,
8470 will perform proper, all-compatible
8471 .Ql From_
8472 quoting for all detected messages, resulting in a valid MBOX mailbox.
8473 Finally the variable can be unset again:
8474 .Bd -literal -offset indent
8475 define mboxfix {
8476   localopts yes; wysh set mbox-rfc4155;\e
8477     wysh File "${1}"; eval copy * "${2}"
8479 call mboxfix /tmp/bad.mbox /tmp/good.mbox
8483 .It Va memdebug
8484 \*(BO Internal development variable.
8487 .It Va message-id-disable
8488 \*(BO By setting this variable the generation of
8489 .Ql Message-ID:
8490 can be completely suppressed, effectively leaving this task up to the
8491 .Va mta
8492 (Mail-Transfer-Agent) or the SMTP server.
8493 (According to RFC 5321 a SMTP server is not required to add this
8494 field by itself, so it should be ensured that it accepts messages without
8495 .Ql Message-ID . )
8496 This variable also affects automatic generation of
8497 .Va Content-ID:
8498 MIME header fields.
8501 .It Va message-inject-head
8502 A string to put at the beginning of each new message.
8503 The escape sequences tabulator
8504 .Ql \et
8505 and newline
8506 .Ql \en
8507 are understood.
8510 .It Va message-inject-tail
8511 A string to put at the end of each new message.
8512 The escape sequences tabulator
8513 .Ql \et
8514 and newline
8515 .Ql \en
8516 are understood.
8519 .It Va metoo
8520 \*(BO Usually, when an
8521 .Ic alias
8522 expansion contains the sender, the sender is removed from the expansion.
8523 Setting this option suppresses these removals.
8524 Note that a set
8525 .Va metoo
8526 also causes a
8527 .Ql -m
8528 option to be passed through to the
8529 .Va mta
8530 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
8531 this flag, no MTA is known which does not support it (for historical
8532 compatibility).
8535 .It Va mime-allow-text-controls
8536 \*(BO When sending messages, each part of the message is MIME-inspected
8537 in order to classify the
8538 .Ql Content-Type:
8540 .Ql Content-Transfer-Encoding:
8541 (see
8542 .Va encoding )
8543 that is required to send this part over mail transport, i.e.,
8544 a computation rather similar to what the
8545 .Xr file 1
8546 command produces when used with the
8547 .Ql --mime
8548 option.
8550 This classification however treats text files which are encoded in
8551 UTF-16 (seen for HTML files) and similar character sets as binary
8552 octet-streams, forcefully changing any
8553 .Ql text/plain
8555 .Ql text/html
8556 specification to
8557 .Ql application/octet-stream :
8558 If that actually happens a yet unset charset MIME parameter is set to
8559 .Ql binary ,
8560 effectively making it impossible for the receiving MUA to automatically
8561 interpret the contents of the part.
8563 If this variable is set, and the data was unambiguously identified as
8564 text data at first glance (by a
8565 .Ql .txt
8567 .Ql .html
8568 file extension), then the original
8569 .Ql Content-Type:
8570 will not be overwritten.
8573 .It Va mime-alternative-favour-rich
8574 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
8575 HTML) will be preferred in favour of included plain text versions when
8576 displaying messages, provided that a handler exists which produces
8577 output that can be (re)integrated into \*(UA's normal visual display.
8578 (E.g., at the time of this writing some newsletters ship their full
8579 content only in the rich HTML part, whereas the plain text part only
8580 contains topic subjects.)
8583 .It Va mime-counter-evidence
8584 Normally the
8585 .Ql Content-Type:
8586 field is used to decide how to handle MIME parts.
8587 Some MUAs however do not use
8588 .Xr mime.types 5
8589 or a similar mechanism to correctly classify content, but simply specify
8590 .Ql application/octet-stream ,
8591 even for plain text attachments like
8592 .Ql text/diff .
8593 If this variable is set then \*(UA will try to classify such MIME
8594 message parts on its own, if possible, for example via a possibly
8595 existing attachment filename.
8596 A non-empty value may also be given, in which case a number is expected,
8597 actually a carrier of bits.
8598 Creating the bit-carrying number is a simple addition:
8599 .Bd -literal -offset indent
8600 ? !echo Value should be set to $((2 + 4 + 8))
8601 Value should be set to 14
8604 .Bl -bullet -compact
8606 If bit two is set (2) then the detected
8607 .Dq real
8608 content-type will be carried along with the message and be used for
8609 deciding which
8610 .Va pipe-TYPE/SUBTYPE
8611 is responsible for the MIME part, shall that question arise;
8612 when displaying such a MIME part the part-info will indicate the
8613 overridden content-type by showing a plus sign
8614 .Ql + .
8616 If bit three is set (4) then the counter-evidence is always produced
8617 and a positive result will be used as the MIME type, even forcefully
8618 overriding the parts given MIME type.
8620 If bit four is set (8) then as a last resort the actual content of
8621 .Ql application/octet-stream
8622 parts will be inspected, so that data which looks like plain text can be
8623 treated as such.
8627 .It Va mimetypes-load-control
8628 Can be used to control which of the
8629 .Xr mime.types 5
8630 databases are loaded by \*(UA, as furtherly described in the section
8631 .Sx "The mime.types files" .
8632 If the letter
8633 .Ql u
8634 is part of the option value, then the user's personal
8635 .Pa ~/.mime.types
8636 file will be loaded (if it exists); likewise the letter
8637 .Ql s
8638 controls loading of the system wide
8639 .Pa /etc/mime.types ;
8640 directives found in the user file take precedence, letter matching is
8641 case-insensitive.
8642 If this variable is not set \*(UA will try to load both files.
8643 Incorporation of the \*(UA-builtin MIME types cannot be suppressed,
8644 but they will be matched last (the order can be listed via
8645 .Ic mimetype ) .
8647 More sources can be specified by using a different syntax: if the
8648 value string contains an equals sign
8649 .Ql =
8650 then it is instead parsed as a comma-separated list of the described
8651 letters plus
8652 .Ql f=FILENAME
8653 pairs; the given filenames will be expanded and loaded, and their
8654 content may use the extended syntax that is described in the section
8655 .Sx "The mime.types files" .
8656 Directives found in such files always take precedence (are prepended to
8657 the MIME type cache).
8661 .It Va mta
8662 To choose an alternate Mail-Transfer-Agent, set this option to either
8663 the full pathname of an executable (optionally prefixed with a
8664 .Ql file://
8665 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
8667 .Dl smtps?://[user[:password]@]server[:port]
8669 (\*(OU:
8670 .Ql [smtp://]server[:port] . )
8671 The default has been chosen at compie time.
8672 All supported data transfers are executed in child processes, which
8673 run asynchronously, and without supervision, unless either the
8674 .Va sendwait
8675 or the
8676 .Va verbose
8677 variable is set.
8678 If such a child receives a TERM signal, it will abort and
8679 .Va save
8680 the message to
8681 .Ev DEAD ,
8682 if so configured.
8685 For a file-based MTA it may be necessary to set
8686 .Va mta-argv0
8687 in in order to choose the right target of a modern
8688 .Xr mailwrapper 8
8689 environment.
8690 It will be passed command line arguments from several possible sources:
8691 from the variable
8692 .Va mta-arguments
8693 if set, from the command line if given and the variable
8694 .Va expandargv
8695 allows their use.
8696 Argument processing of the MTA will be terminated with a
8697 .Fl \&\&-
8698 separator.
8701 The otherwise occurring implicit usage of the following MTA command
8702 line arguments can be disabled by setting the boolean variable
8703 .Va mta-no-default-arguments
8704 (which will also disable passing
8705 .Fl \&\&-
8706 to the MTA):
8707 .Fl \&\&i
8708 (for not treating a line with only a dot
8709 .Ql \&.
8710 character as the end of input),
8711 .Fl \&\&m
8712 (shall the variable
8713 .Va metoo
8714 be set) and
8715 .Fl \&\&v
8716 (if the
8717 .Va verbose
8718 variable is set); in conjunction with the
8719 .Fl r
8720 command line option \*(UA will also (not) pass
8721 .Fl \&\&f
8722 as well as possibly
8723 .Fl \&\&F .
8726 \*(OP \*(UA can send mail over SMTP network connections to a single
8727 defined SMTP smarthost, the access URL of which has to be assigned to
8728 .Va mta .
8729 To use this mode it is helpful to read
8730 .Sx "On URL syntax and credential lookup" .
8731 It may be necessary to set the
8732 .Va smtp-hostname
8733 variable in order to use a specific combination of
8734 .Va from ,
8735 .Va hostname
8737 .Va mta
8738 with some mail providers.
8741 .Bl -bullet -compact
8743 The plain SMTP protocol (RFC 5321) that normally lives on the
8744 server port 25 and requires setting the
8745 .Va smtp-use-starttls
8746 variable to enter a SSL/TLS encrypted session state.
8747 Assign a value like \*(IN
8748 .Ql smtp://[user[:password]@]server[:port]
8749 (\*(OU
8750 .Ql smtp://server[:port] )
8751 to choose this protocol.
8753 The so-called SMTPS which is supposed to live on server port 465
8754 and is automatically SSL/TLS secured.
8755 Unfortunately it never became a standardized protocol and may thus not
8756 be supported by your hosts network service database
8757 \(en in fact the port number has already been reassigned to other
8758 protocols!
8760 SMTPS is nonetheless a commonly offered protocol and thus can be
8761 chosen by assigning a value like \*(IN
8762 .Ql smtps://[user[:password]@]server[:port]
8763 (\*(OU
8764 .Ql smtps://server[:port] ) ;
8765 due to the mentioned problems it is usually necessary to explicitly
8766 specify the port as
8767 .Ql :465 ,
8768 however.
8770 Finally there is the SUBMISSION protocol (RFC 6409), which usually
8771 lives on server port 587 and is practically identically to the SMTP
8772 protocol from \*(UA's point of view beside that; it requires setting the
8773 .Va smtp-use-starttls
8774 variable to enter a SSL/TLS secured session state.
8775 Assign a value like \*(IN
8776 .Ql submission://[user[:password]@]server[:port]
8777 (\*(OU
8778 .Ql submission://server[:port] ) .
8783 .It Va mta-arguments
8784 Arguments to pass through to a file-based
8785 .Va mta
8786 can be given via this variable, which is parsed according to
8787 .Sx "Shell-style argument quoting"
8788 into an array of arguments, and which will be joined onto MTA options
8789 from other sources, and then passed individually to the MTA:
8791 .Dl wysh set mta-arguments='-t -X \&"/tmp/my log\&"'
8794 .It Va mta-no-default-arguments
8795 \*(BO Unless this variable is set \*(UA will pass some well known
8796 standard command line options to a file-based
8797 .Va mta
8798 (Mail-Transfer-Agent), see there for more.
8801 .It Va mta-argv0
8802 Many systems use a so-called
8803 .Xr mailwrapper 8
8804 environment to ensure compatibility with
8805 .Xr sendmail 1 .
8806 This works by inspecting the name that was used to invoke the mail
8807 delivery system.
8808 If this variable is set then the mailwrapper (the program that is
8809 actually executed when calling the file-based
8810 .Va mta )
8811 will treat its contents as that name.
8812 The default is
8813 .Ql sendmail .
8815 .Mx Va netrc-lookup
8816 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
8817 \*(BO\*(IN\*(OP Used to control usage of the users
8818 .Pa .netrc
8819 file for lookup of account credentials, as documented in the section
8820 .Sx "On URL syntax and credential lookup"
8821 and for the command
8822 .Ic netrc ;
8823 the section
8824 .Sx "The .netrc file"
8825 documents the file format.
8826 Also see
8827 .Va netrc-pipe .
8830 .It Va netrc-pipe
8831 \*(IN\*(OP When
8832 .Pa .netrc
8833 is loaded (see
8834 .Ic netrc
8836 .Va netrc-lookup )
8837 then \*(UA will read the output of a shell pipe instead of the users
8838 .Pa .netrc
8839 file if this variable is set (to the desired shell command).
8840 This can be used to, e.g., store
8841 .Pa .netrc
8842 in encrypted form:
8844 .Dl set netrc-pipe='gpg -qd ~/.netrc.pgp'
8847 .It Va newfolders
8848 If this variable has the value
8849 .Ql maildir ,
8850 newly created local folders will be in Maildir instead of MBOX format.
8853 .It Va newmail
8854 Checks for new mail in the current folder each time the prompt is shown.
8855 A Maildir folder must be re-scanned to determine if new mail has arrived.
8856 If this variable is set to the special value
8857 .Ql nopoll
8858 then a Maildir folder will not be rescanned completely, but only
8859 timestamp changes are detected.
8863 .It Va on-compose-splice-shell , on-compose-splice
8864 These hooks run once the normal compose mode is finished, but before the
8865 .Va on-compose-leave
8866 macro hook is called, the
8867 .Va signature
8868 is injected etc.
8869 Both hooks will be executed in a subprocess, with their input and output
8870 connected to \*(UA such that they can act as if they would be an
8871 interactive user.
8872 The difference in between them is that the former is a
8873 .Ev SHELL
8874 command, whereas the latter is a normal \*(UA macro, but which is
8875 restricted to a small set of commands (the
8876 .Va verbose
8877 output of, e.g.,
8878 .Ic list
8879 will indicate said capability), just enough for the purpose of
8880 controlling the real \*(UA instance sufficiently.
8881 .Ic localopts
8882 are enabled for these hooks (in the parent process), causing any setting
8883 to be forgotten after the message has been sent.
8885 During execution of these hooks \*(UA will temporarily forget whether it
8886 has been started in interactive mode, (a restricted set of)
8887 .Sx "COMMAND ESCAPES"
8888 will always be available, and for guaranteed reproducibilities sake
8889 .Va escape
8891 .Va ifs
8892 will be set to their defaults.
8893 The compose mode command
8894 .Ic ~^
8895 has been especially designed for scriptability (via these hooks).
8896 The first line the hook will read on its standard input is the protocol
8897 version of said command escape, currently
8898 .Dq 0 0 1 :
8899 backward incompatible protocol changes are to be expected in the
8900 future, and it is advisable to make use of the protocol version.
8901 Care must be taken to avoid deadlocks because of unexpected control
8902 flow: if both involved processes wait for more input to happen at the
8903 same time, or one doesn't expect more input but the other is stuck
8904 waiting for consumption of its output.
8905 .Bd -literal -offset indent
8906 wysh set on-compose-splice-shell=$'\e
8907   read version;\e
8908   printf "hello $version!  Headers: ";\e
8909   echo \e'~^header list\e';\e
8910   read status result;\e
8911   echo "status=$status result=$result";\e
8912   '
8914 set on-compose-splice=ocsm
8915 define ocsm {
8916   read ver
8917   echo Splice protocol version is $ver
8918   echo '~^h l'; read hl; vput vexpr es substr "${hl}" 0 1
8919   if [ "$es" != 2 ]
8920     echoerr 'Cannot read header list'; echo '~x'
8921   endif
8922   if [ "$hl" !@ ' cc' ]
8923     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
8924       vput vexpr es substr "${es}" 0 1
8925     if [ "$es" != 2 ]
8926       echoerr 'Cannot insert Cc: header'; echo '~x'
8927     endif
8928   endif
8934 .It Va on-compose-enter , on-compose-leave
8935 Macro hooks which will be executed before compose mode is entered, and
8936 after composing has been finished (but before the
8937 .Va signature
8938 is injected, etc.), respectively.
8939 .Ic localopts
8940 are enabled for these hooks, causing any setting to be forgotten after
8941 the message has been sent.
8942 The following (read-only) variables will be set temporarily during
8943 execution of the macros:
8945 .Bl -tag -compact -width ".It Va compose_subject"
8946 .It Va compose-from
8947 .Va from .
8948 .It Va compose-sender
8949 .Va sender .
8950 .It Va compose-to , compose-cc , compose-bcc
8951 The list of receiver addresses as a space-separated list.
8952 .It Va compose-subject
8953 The subject.
8957 .It Va outfolder
8958 \*(BO Causes the filename given in the
8959 .Va record
8960 variable
8961 and the sender-based filenames for the
8962 .Ic Copy
8964 .Ic Save
8965 commands to be interpreted relative to the directory given in the
8966 .Va folder
8967 variable rather than to the current directory,
8968 unless it is set to an absolute pathname.
8971 .It Va page
8972 \*(BO If set, each message feed through the command given for
8973 .Ic pipe
8974 is followed by a formfeed character
8975 .Ql \ef .
8977 .Mx Va password
8978 .It Va password-USER@HOST , password-HOST , password
8979 \*(IN Variable chain that sets a password, which is used in case none has
8980 been given in the protocol and account-specific URL;
8981 as a last resort \*(UA will ask for a password on the user's terminal if
8982 the authentication method requires a password.
8983 Specifying passwords in a startup file is generally a security risk;
8984 the file should be readable by the invoking user only.
8986 .It Va password-USER@HOST
8987 \*(OU (see the chain above for \*(IN)
8988 Set the password for
8989 .Ql USER
8990 when connecting to
8991 .Ql HOST .
8992 If no such variable is defined for a host,
8993 the user will be asked for a password on standard input.
8994 Specifying passwords in a startup file is generally a security risk;
8995 the file should be readable by the invoking user only.
8998 .It Va piperaw
8999 \*(BO Send messages to the
9000 .Ic pipe
9001 command without performing MIME and character set conversions.
9005 .It Va pipe-TYPE/SUBTYPE
9006 When a MIME message part of type
9007 .Ql TYPE/SUBTYPE
9008 (case-insensitive) is displayed or quoted,
9009 its text is filtered through the value of this variable interpreted as
9010 a shell command.
9011 The special value
9012 .Ql @
9013 forces interpretation of the message part as plain text, e.g.,
9014 .Ql set pipe-application/xml=@
9015 will henceforth display XML
9016 .Dq as is .
9017 (The same could also be achieved by adding a MIME type marker with the
9018 .Ic mimetype
9019 command.
9020 And \*(OPally MIME type handlers may be defined via
9021 .Sx "The Mailcap files"
9022 \(em corresponding flag strings are shown in parenthesis below.)
9025 The special value
9026 .Ql @
9027 can in fact be used to adjust usage and behaviour of a following shell
9028 command specification by appending trigger characters to it, e.g., the
9029 following hypothetical command specification could be used:
9030 .Bd -literal -offset indent
9031 set pipe-X/Y='@*!++=@vim ${MAILX_FILENAME_TEMPORARY}'
9035 .Bl -tag -compact -width ".It Ql __"
9036 .It Ql *
9037 Simply by using the special
9038 .Ql @
9039 prefix the MIME type (shell command) handler will only be invoked to
9040 display or convert the MIME part if the message is addressed directly
9041 and alone by itself.
9042 Use this trigger to disable this and always invoke the handler
9043 .Pf ( Cd x-mailx-always ) .
9045 .It Ql #
9046 If set the handler will not be invoked when a message is to be quoted,
9047 but only when it will be displayed
9048 .Pf ( Cd x-mailx-noquote ) .
9050 .It Ql &
9051 The command will be run asynchronously, i.e., without blocking \*(UA,
9052 which may be a handy way to display a, e.g., PDF file while also
9053 continuing to read the mail message
9054 .Pf ( Cd x-mailx-async ) .
9055 Asynchronous execution implies
9056 .Ql # .
9058 .It Ql \&!
9059 The command must be run on an interactive terminal, \*(UA will
9060 temporarily release the terminal to it
9061 .Pf ( Cd needsterminal ) .
9062 This flag is mutual exclusive with
9063 .Ql & ,
9064 will only be used in interactive mode and implies
9065 .Ql # .
9067 .It Ql +
9068 Request creation of a zero-sized temporary file, the absolute pathname
9069 of which will be made accessible via the environment variable
9070 .Ev MAILX_FILENAME_TEMPORARY
9071 .Pf ( Cd x-mailx-tmpfile ) .
9072 If this trigger is given twice then the file will be unlinked
9073 automatically by \*(UA when the command loop is entered again at latest
9074 .Pf ( Cd x-mailx-tmpfile-unlink ) .
9075 (Do not use this for asynchronous handlers.)
9077 .It Ql =
9078 Normally the MIME part content is passed to the handler via standard
9079 input; if this flag is set then the data will instead be written into
9080 .Ev MAILX_FILENAME_TEMPORARY
9081 .Pf ( Cd x-mailx-tmpfile-fill ) ,
9082 the creation of which is implied; note however that in order to cause
9083 deletion of the temporary file you still have to use two plus signs
9084 .Ql ++
9085 explicitly!
9087 .It Ql @
9088 To avoid ambiguities with normal shell command content you can use
9089 another commercial at to forcefully terminate interpretation of
9090 remaining characters.
9091 (Any character not in this list will have the same effect.)
9095 Some information about the MIME part to be displayed is embedded into
9096 the environment of the shell command:
9099 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
9101 .It Ev MAILX_CONTENT
9102 The MIME content-type of the part, if known, the empty string otherwise.
9105 .It Ev MAILX_CONTENT_EVIDENCE
9107 .Va mime-counter-evidence
9108 includes the carry-around-bit (2), then this will be set to the detected
9109 MIME content-type; not only then identical to
9110 .Ev \&\&MAILX_CONTENT
9111 otherwise.
9114 .It Ev MAILX_FILENAME
9115 The filename, if any is set, the empty string otherwise.
9118 .It Ev MAILX_FILENAME_GENERATED
9119 A random string.
9122 .It Ev MAILX_FILENAME_TEMPORARY
9123 If temporary file creation has been requested through the command prefix
9124 this variable will be set and contain the absolute pathname of the
9125 temporary file.
9130 .It Va pipe-EXTENSION
9131 This is identical to
9132 .Va pipe-TYPE/SUBTYPE
9133 except that
9134 .Ql EXTENSION
9135 (normalized to lowercase using character mappings of the ASCII charset)
9136 names a file extension, e.g.,
9137 .Ql xhtml .
9138 Handlers registered using this method take precedence.
9140 .Mx Va pop3-auth
9141 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
9142 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
9143 The only possible value as of now is
9144 .Ql plain ,
9145 which is thus the default.
9148 .Mx Va pop3-bulk-load
9149 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
9150 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
9151 the messages, and only requests the message bodies on user request.
9152 For the POP3 protocol this means that the message headers will be
9153 downloaded twice.
9154 If this variable is set then \*(UA will download only complete messages
9155 from the given POP3 server(s) instead.
9157 .Mx Va pop3-keepalive
9158 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
9159 \*(OP POP3 servers close the connection after a period of inactivity;
9160 the standard requires this to be at least 10 minutes,
9161 but practical experience may vary.
9162 Setting this variable to a numeric value greater than
9163 .Ql 0
9164 causes a
9165 .Ql NOOP
9166 command to be sent each value seconds if no other operation is performed.
9168 .Mx Va pop3-no-apop
9169 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
9170 \*(BO\*(OP Unless this variable is set the
9171 .Ql APOP
9172 authentication method will be used when connecting to a POP3 server that
9173 advertises support.
9174 The advantage of
9175 .Ql APOP
9176 is that the password is not sent in clear text over the wire and that
9177 only a single packet is sent for the user/password tuple.
9178 Note that
9179 .Va pop3-no-apop-HOST
9180 requires \*(IN.
9182 .Mx Va pop3-use-starttls
9183 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
9184 \*(BO\*(OP Causes \*(UA to issue a
9185 .Ql STLS
9186 command to make an unencrypted POP3 session SSL/TLS encrypted.
9187 This functionality is not supported by all servers,
9188 and is not used if the session is already encrypted by the POP3S method.
9189 Note that
9190 .Va pop3-use-starttls-HOST
9191 requires \*(IN.
9195 .It Va posix
9196 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
9197 where that deviates from standardized behaviour.
9198 It will be set implicitly before the
9199 .Sx "Resource files"
9200 are loaded if the environment variable
9201 .Ev POSIXLY_CORRECT
9202 is set, and adjusting any of those two will be reflected by the other
9203 one implicitly.
9204 The following behaviour is covered and enforced by this mechanism:
9207 .Bl -bullet -compact
9209 In non-interactive mode, any error encountered while loading resource
9210 files during program startup will cause a program exit, whereas in
9211 interactive mode such errors will stop loading of the currently loaded
9212 (stack of) file(s, i.e., recursively).
9213 These exits can be circumvented on a per-command base by using
9214 .Cm ignerr ,
9215 one of the
9216 .Sx "Command modifiers" ,
9217 for each command which shall be allowed to fail.
9220 Setting
9221 .Va ignoreeof
9222 implies the behaviour described by
9223 .Va dot .
9226 The variable
9227 .Va keep
9228 is extended to cover any empty mailbox, not only empty
9229 .Mx -sx
9230 .Sx "primary system mailbox" Ns
9231 es: they will be removed when they are left in empty state otherwise.
9234 Upon changing the active
9235 .Ic file
9236 no summary of
9237 .Ic headers
9238 will be displayed even if
9239 .Va header
9240 is set.
9245 .It Va print-alternatives
9246 \*(BO When a MIME message part of type
9247 .Ql multipart/alternative
9248 is displayed and it contains a subpart of type
9249 .Ql text/plain ,
9250 other parts are normally discarded.
9251 Setting this variable causes all subparts to be displayed,
9252 just as if the surrounding part was of type
9253 .Ql multipart/mixed .
9256 .It Va prompt
9257 The string used as a prompt in interactive mode.
9258 Whenever the variable is evaluated the value is expanded as via
9259 dollar-single-quote expansion (see
9260 .Sx "Shell-style argument quoting" ) .
9261 This (post-assignment, i.e., second) expansion can be used to embed
9262 status information, for example
9263 .Va \&? ,
9264 .Va \&! ,
9265 .Va account
9267 .Va mailbox-display .
9269 In order to embed characters which should not be counted when
9270 calculating the visual width of the resulting string, enclose the
9271 characters of interest in a pair of reverse solidus escaped brackets:
9272 .Ql \e[\eE[0m\e] ;
9273 a slot for coloured prompts is also available with the \*(OPal command
9274 .Ic colour .
9275 Prompting may be prevented by setting this to the null string
9276 (a.k.a.\|
9277 .Ql set noprompt ) .
9280 .It Va prompt2
9281 This string is used for secondary prompts, but is otherwise identical to
9282 .Va prompt .
9283 The default is
9284 .Ql ..\0 .
9287 .It Va quiet
9288 \*(BO Suppresses the printing of the version when first invoked.
9291 .It Va quote
9292 If set, \*(UA starts a replying message with the original message
9293 prefixed by the value of the variable
9294 .Va indentprefix .
9295 Normally, a heading consisting of
9296 .Dq Fromheaderfield wrote:
9297 is put before the quotation.
9298 If the string
9299 .Ql noheading
9300 is assigned to the
9301 .Va \&\&quote
9302 variable, this heading is omitted.
9303 If the string
9304 .Ql headers
9305 is assigned, only the headers selected by the
9306 .Ql type
9307 .Ic headerpick
9308 selection are put above the message body,
9309 thus
9310 .Va \&\&quote
9311 acts like an automatic
9312 .Pf ` Ic ~m Ns '
9313 .Sx "COMMAND ESCAPES"
9314 command, then.
9315 If the string
9316 .Ql allheaders
9317 is assigned, all headers are put above the message body and all MIME
9318 parts are included, making
9319 .Va \&\&quote
9320 act like an automatic
9321 .Pf ` Ic ~M Ns '
9322 command; also see
9323 .Va quote-as-attachment .
9326 .It Va quote-as-attachment
9327 \*(BO Add the original message in its entirety as a
9328 .Ql message/rfc822
9329 MIME attachment when replying to a message.
9330 Note this works regardless of the setting of
9331 .Va quote .
9334 .It Va quote-fold
9335 \*(OP Can be set in addition to
9336 .Va indentprefix .
9337 Setting this turns on a more fancy quotation algorithm in that leading
9338 quotation characters are compressed and overlong lines are folded.
9339 .Va \&\&quote-fold
9340 can be set to either one or two (space separated) numeric values,
9341 which are interpreted as the maximum (goal) and the minimum line length,
9342 respectively, in a spirit rather equal to the
9343 .Xr fmt 1
9344 program, but line-, not paragraph-based.
9345 If not set explicitly the minimum will reflect the goal algorithmically.
9346 The goal cannot be smaller than the length of
9347 .Va indentprefix
9348 plus some additional pad.
9349 Necessary adjustments take place silently.
9352 .It Va r-option-implicit
9353 \*(BO Setting this option evaluates the contents of
9354 .Va from
9355 (or, if that contains multiple addresses,
9356 .Va sender )
9357 and passes the results onto the used (file-based) MTA as described for the
9358 .Fl r
9359 option (empty argument case).
9362 .It Va recipients-in-cc
9363 \*(BO When doing a
9364 .Ic reply ,
9365 the original
9366 .Ql From:
9368 .Ql To:
9369 are by default merged into the new
9370 .Ql To: .
9371 If this variable is set, only the original
9372 .Ql From:
9373 ends in the new
9374 .Ql To: ,
9375 the rest is merged into
9376 .Ql Cc: .
9379 .It Va record
9380 Unless this variable is defined, no copies of outgoing mail will be saved.
9381 If defined it gives the pathname, subject to the usual
9382 .Sx "Filename transformations" ,
9383 of a folder where all new, replied-to or forwarded messages are saved:
9384 when saving to this folder fails the message is not sent, but instead
9385 .Va save Ns
9386 d to
9387 .Ev DEAD .
9388 The standard defines that relative (fully expanded) paths are to be
9389 interpreted relative to the current directory
9390 .Pf ( Ic cwd ) ,
9391 to force interpretation relative to
9392 .Va folder
9393 .Va outfolder
9394 needs to be set in addition.
9397 .It Va record-files
9398 \*(BO If this variable is set the meaning of
9399 .Va record
9400 will be extended to cover messages which target only file and pipe
9401 recipients (see
9402 .Va expandaddr ) .
9403 These address types will not appear in recipient lists unless
9404 .Va add-file-recipients
9405 is also set.
9408 .It Va record-resent
9409 \*(BO If this variable is set the meaning of
9410 .Va record
9411 will be extended to also cover the
9412 .Ic resend
9414 .Ic Resend
9415 commands.
9418 .It Va reply-in-same-charset
9419 \*(BO If this variable is set \*(UA first tries to use the same
9420 character set of the original message for replies.
9421 If this fails, the mechanism described in
9422 .Sx "Character sets"
9423 is evaluated as usual.
9426 .It Va reply-strings
9427 Can be set to a comma-separated list of (case-insensitive according to
9428 ASCII rules) strings which shall be recognized in addition to the
9429 builtin strings as
9430 .Ql Subject:
9431 reply message indicators \(en builtin are
9432 .Ql Re: ,
9433 which is mandated by RFC 5322, as well as the german
9434 .Ql Aw: ,
9435 .Ql Antw: ,
9436 and the
9437 .Ql Wg:
9438 which often has been seen in the wild;
9439 I.e., the separating colon has to be specified explicitly.
9442 .It Va replyto
9443 A list of addresses to put into the
9444 .Ql Reply-To:
9445 field of the message header.
9446 Members of this list are handled as if they were in the
9447 .Ic alternates
9448 list.
9451 .It Va reply-to-honour
9452 Controls whether a
9453 .Ql Reply-To:
9454 header is honoured when replying to a message via
9455 .Ic reply
9457 .Ic Lreply .
9458 This is a quadoption; if set without a value it defaults to
9459 .Dq yes .
9462 .It Va rfc822-body-from_
9463 \*(BO This variable can be used to force displaying a so-called
9464 .Ql From_
9465 line for messages that are embedded into an envelope mail via the
9466 .Ql message/rfc822
9467 MIME mechanism, for more visual convenience.
9470 .It Va save
9471 \*(BO Enable saving of (partial) messages in
9472 .Ev DEAD
9473 upon interrupt or delivery error.
9476 .It Va screen
9477 The number of lines that represents a
9478 .Dq screenful
9479 of lines, used in
9480 .Ic headers
9481 summary display,
9482 .Ic from
9483 .Ic search Ns
9484 ing, message
9485 .Ic top Ns
9486 line display and scrolling via
9487 .Ic z .
9488 If this variable is not set \*(UA falls back to a calculation based upon
9489 the detected terminal window size and the baud rate: the faster the
9490 terminal, the more will be shown.
9491 Overall screen dimensions and pager usage is influenced by the
9492 environment variables
9493 .Ev COLUMNS
9495 .Ev LINES
9496 and the variable
9497 .Va crt .
9500 .It Va searchheaders
9501 \*(BO Expand message-list specifiers in the form
9502 .Ql /x:y
9503 to all messages containing the substring
9504 .Dq y
9505 in the header field
9506 .Ql x .
9507 The string search is case insensitive.
9510 .It Va sendcharsets
9511 \*(OP A comma-separated list of character set names that can be used in
9512 outgoing internet mail.
9513 The value of the variable
9514 .Va charset-8bit
9515 is automatically appended to this list of character sets.
9516 If no character set conversion capabilities are compiled into \*(UA then
9517 the only supported charset is
9518 .Va ttycharset .
9519 Also see
9520 .Va sendcharsets-else-ttycharset
9521 and refer to the section
9522 .Sx "Character sets"
9523 for the complete picture of character set conversion in \*(UA.
9526 .It Va sendcharsets-else-ttycharset
9527 \*(BO\*(OP If this variable is set, but
9528 .Va sendcharsets
9529 is not, then \*(UA acts as if
9530 .Va sendcharsets
9531 had been set to the value of the variable
9532 .Va ttycharset .
9533 In effect this combination passes through the message data in the
9534 character set of the current locale (given that
9535 .Va ttycharset
9536 has not been set manually), i.e., without converting it to the
9537 .Va charset-8bit
9538 fallback character set.
9539 Thus, mail message text will be in ISO-8859-1 encoding when send from
9540 within a ISO-8859-1 locale, and in UTF-8 encoding when send from within
9541 an UTF-8 locale.
9542 If no character set conversion capabilities are available in \*(UA then
9543 the only supported character set is
9544 .Va ttycharset .
9547 .It Va sender
9548 An address that is put into the
9549 .Ql Sender:
9550 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
9551 responsible for the actual transmission of the message.
9552 This field should normally not be used unless the
9553 .Va from
9554 field contains more than one address, on which case it is required.
9556 .Va \&\&sender
9557 address is handled as if it were in the
9558 .Ic alternates
9559 list; also see
9560 .Fl r ,
9561 .Va r-option-implicit .
9564 .It Va sendmail
9565 \*(OB Predecessor of
9566 .Va mta .
9569 .It Va sendmail-arguments
9570 \*(OB Predecessor of
9571 .Va mta-arguments .
9574 .It Va sendmail-no-default-arguments
9575 \*(OB\*(BO Predecessor of
9576 .Va mta-no-default-arguments .
9579 .It Va sendmail-progname
9580 \*(OB Predecessor of
9581 .Va mta-argv0 .
9584 .It Va sendwait
9585 \*(BO When sending a message wait until the
9586 .Va mta
9587 (including the builtin SMTP one) exits before accepting further commands.
9588 .Sy Only
9589 with this variable set errors reported by the MTA will be recognizable!
9590 If the MTA returns a non-zero exit status,
9591 the exit status of \*(UA will also be non-zero.
9594 .It Va showlast
9595 \*(BO This setting causes \*(UA to start at the last message
9596 instead of the first one when opening a mail folder.
9599 .It Va showname
9600 \*(BO Causes \*(UA to use the sender's real name instead of the plain
9601 address in the header field summary and in message specifications.
9604 .It Va showto
9605 \*(BO Causes the recipient of the message to be shown in the header
9606 summary if the message was sent by the user.
9609 .It Va Sign
9610 The string to expand
9611 .Ic ~A
9612 to (see
9613 .Sx "COMMAND ESCAPES" ) .
9616 .It Va sign
9617 The string to expand
9618 .Ic ~a
9619 to (see
9620 .Sx "COMMAND ESCAPES" ) .
9623 .It Va signature
9624 Must correspond to the name of a readable file if set.
9625 The file's content is then appended to each singlepart message
9626 and to the first part of each multipart message.
9627 Be warned that there is no possibility to edit the signature for an
9628 individual message.
9631 .It Va skipemptybody
9632 \*(BO If an outgoing message does not contain any text in its first or
9633 only message part, do not send it but discard it silently (see also the
9634 command line option
9635 .Fl E ) .
9639 .It Va smime-ca-dir , smime-ca-file
9640 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
9641 Enhanced Mail) format as a directory and a file, respectively, for the
9642 purpose of verification of S/MIME signed messages.
9643 It is possible to set both, the file will be loaded immediately, the
9644 directory will be searched whenever no match has yet been found.
9645 The set of CA certificates which are built into the SSL/TLS library can
9646 be explicitly turned off by setting
9647 .Va smime-ca-no-defaults ,
9648 and further fine-tuning is possible via
9649 .Va smime-ca-flags .
9652 .It Va smime-ca-flags
9653 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
9654 storage, and the certificate verification that is used.
9655 The actual values and their meanings are documented for
9656 .Va ssl-ca-flags .
9659 .It Va smime-ca-no-defaults
9660 \*(BO\*(OP Do not load the default CA locations that are built into the
9661 used to SSL/TLS library to verify S/MIME signed messages.
9663 .Mx Va smime-cipher
9664 .It Va smime-cipher-USER@HOST , smime-cipher
9665 \*(OP Specifies the cipher to use when generating S/MIME encrypted
9666 messages (for the specified account).
9667 RFC 5751 mandates a default of
9668 .Ql aes128
9669 (AES-128 CBC).
9670 Possible values are (case-insensitive and) in decreasing cipher strength:
9671 .Ql aes256
9672 (AES-256 CBC),
9673 .Ql aes192
9674 (AES-192 CBC),
9675 .Ql aes128
9676 (AES-128 CBC),
9677 .Ql des3
9678 (DES EDE3 CBC, 168 bits; default if
9679 .Ql aes128
9680 is not available) and
9681 .Ql des
9682 (DES CBC, 56 bits).
9684 The actually available cipher algorithms depend on the cryptographic
9685 library that \*(UA uses.
9686 \*(OP Support for more cipher algorithms may be available through
9687 dynamic loading via, e.g.,
9688 .Xr EVP_get_cipherbyname 3
9689 (OpenSSL) if \*(UA has been compiled to support this.
9692 .It Va smime-crl-dir
9693 \*(OP Specifies a directory that contains files with CRLs in PEM format
9694 to use when verifying S/MIME messages.
9697 .It Va smime-crl-file
9698 \*(OP Specifies a file that contains a CRL in PEM format to use when
9699 verifying S/MIME messages.
9702 .It Va smime-encrypt-USER@HOST
9703 \*(OP If this variable is set, messages send to the given receiver are
9704 encrypted before sending.
9705 The value of the variable must be set to the name of a file that
9706 contains a certificate in PEM format.
9708 If a message is sent to multiple recipients,
9709 each of them for whom a corresponding variable is set will receive an
9710 individually encrypted message;
9711 other recipients will continue to receive the message in plain text
9712 unless the
9713 .Va smime-force-encryption
9714 variable is set.
9715 It is recommended to sign encrypted messages, i.e., to also set the
9716 .Va smime-sign
9717 variable.
9720 .It Va smime-force-encryption
9721 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
9724 .It Va smime-sign
9725 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
9726 and include the user's certificate as a MIME attachment.
9727 Signing a message enables a recipient to verify that the sender used
9728 a valid certificate,
9729 that the email addresses in the certificate match those in the message
9730 header and that the message content has not been altered.
9731 It does not change the message text,
9732 and people will be able to read the message as usual.
9733 Also see
9734 .Va smime-sign-cert , smime-sign-include-certs
9736 .Va smime-sign-message-digest .
9738 .Mx Va smime-sign-cert
9739 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
9740 \*(OP Points to a file in PEM format.
9741 For the purpose of signing and decryption this file needs to contain the
9742 user's private key, followed by his certificate.
9744 For message signing
9745 .Ql USER@HOST
9746 is always derived from the value of
9747 .Va from
9748 (or, if that contains multiple addresses,
9749 .Va sender ) .
9750 For the purpose of encryption the recipient's public encryption key
9751 (certificate) is expected; the command
9752 .Ic certsave
9753 can be used to save certificates of signed messages (the section
9754 .Sx "Signed and encrypted messages with S/MIME"
9755 gives some details).
9756 This mode of operation is usually driven by the specialized form.
9758 When decrypting messages the account is derived from the recipient
9759 fields
9760 .Pf ( Ql To:
9762 .Ql Cc: )
9763 of the message, which are searched for addresses for which such
9764 a variable is set.
9765 \*(UA always uses the first address that matches,
9766 so if the same message is sent to more than one of the user's addresses
9767 using different encryption keys, decryption might fail.
9769 For signing and decryption purposes it is possible to use encrypted
9770 keys, and the pseudo-host(s)
9771 .Ql USER@HOST.smime-cert-key
9772 for the private key
9773 (and
9774 .Ql USER@HOST.smime-cert-cert
9775 for the certificate stored in the same file)
9776 will be used for performing any necessary password lookup,
9777 therefore the lookup can be automatized via the mechanisms described in
9778 .Sx "On URL syntax and credential lookup" .
9779 For example, the hypothetical address
9780 .Ql bob@exam.ple
9781 could be driven with a private key / certificate pair path defined in
9782 .Va \&\&smime-sign-cert-bob@exam.ple ,
9783 and needed passwords would then be looked up via the pseudo hosts
9784 .Ql bob@exam.ple.smime-cert-key
9785 (and
9786 .Ql bob@exam.ple.smime-cert-cert ) .
9787 To include intermediate certificates, use
9788 .Va smime-sign-include-certs .
9790 .Mx Va smime-sign-include-certs
9791 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
9792 \*(OP If used, this is supposed to a consist of a comma-separated list
9793 of files, each of which containing a single certificate in PEM format to
9794 be included in the S/MIME message in addition to the
9795 .Va smime-sign-cert
9796 certificate.
9797 This can be used to include intermediate certificates of the certificate
9798 authority, in order to allow the receiver's S/MIME implementation to
9799 perform a verification of the entire certificate chain, starting from
9800 a local root certificate, over the intermediate certificates, down to the
9801 .Va smime-sign-cert .
9802 Even though top level certificates may also be included in the chain,
9803 they won't be used for the verification on the receiver's side.
9805 For the purpose of the mechanisms involved here,
9806 .Ql USER@HOST
9807 refers to the content of the internal variable
9808 .Va from
9809 (or, if that contains multiple addresses,
9810 .Va sender ) .
9811 The pseudo-host
9812 .Ql USER@HOST.smime-include-certs
9813 will be used for performing password lookups for these certificates,
9814 shall they have been given one, therefore the lookup can be automatized
9815 via the mechanisms described in
9816 .Sx "On URL syntax and credential lookup" .
9818 .Mx Va smime-sign-message-digest
9819 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
9820 \*(OP Specifies the message digest to use when signing S/MIME messages.
9821 RFC 5751 mandates a default of
9822 .Ql sha1 .
9823 Possible values are (case-insensitive and) in decreasing cipher strength:
9824 .Ql sha512 ,
9825 .Ql sha384 ,
9826 .Ql sha256 ,
9827 .Ql sha224
9829 .Ql md5 .
9831 The actually available message digest algorithms depend on the
9832 cryptographic library that \*(UA uses.
9833 \*(OP Support for more message digest algorithms may be available
9834 through dynamic loading via, e.g.,
9835 .Xr EVP_get_digestbyname 3
9836 (OpenSSL) if \*(UA has been compiled to support this.
9837 Remember that for this
9838 .Ql USER@HOST
9839 refers to the variable
9840 .Va from
9841 (or, if that contains multiple addresses,
9842 .Va sender ) .
9845 .It Va smtp
9846 \*(OB\*(OP To use the builtin SMTP transport, specify a SMTP URL in
9847 .Va mta .
9848 \*(ID For compatibility reasons a set
9849 .Va smtp
9850 is used in preference of
9851 .Va mta .
9853 .Mx Va smtp-auth
9854 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
9855 \*(OP Variable chain that controls the SMTP
9856 .Va mta
9857 authentication method, possible values are
9858 .Ql none
9859 (\*(OU default),
9860 .Ql plain
9861 (\*(IN default),
9862 .Ql login
9863 as well as the \*(OPal methods
9864 .Ql cram-md5
9866 .Ql gssapi .
9868 .Ql none
9869 method does not need any user credentials,
9870 .Ql gssapi
9871 requires a user name and all other methods require a user name and
9872 a password.
9873 See \*(IN
9874 .Va mta ,
9875 .Va user
9877 .Va password
9878 (\*(OU
9879 .Va smtp-auth-password
9881 .Va smtp-auth-user ) .
9882 Note that
9883 .Va smtp-auth-HOST
9884 is \*(IN.
9885 \*(OU: Note for
9886 .Va smtp-auth-USER@HOST :
9887 may override dependent on sender address in the variable
9888 .Va from .
9890 .It Va smtp-auth-password
9891 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
9892 If the authentication method requires a password, but neither
9893 .Va smtp-auth-password
9894 nor a matching
9895 .Va smtp-auth-password-USER@HOST
9896 can be found,
9897 \*(UA will ask for a password on the user's terminal.
9899 .It Va smtp-auth-password-USER@HOST
9900 \*(OU Overrides
9901 .Va smtp-auth-password
9902 for specific values of sender addresses, dependent upon the variable
9903 .Va from .
9905 .It Va smtp-auth-user
9906 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
9907 If the authentication method requires a user name, but neither
9908 .Va smtp-auth-user
9909 nor a matching
9910 .Va smtp-auth-user-USER@HOST
9911 can be found,
9912 \*(UA will ask for a user name on the user's terminal.
9914 .It Va smtp-auth-user-USER@HOST
9915 \*(OU Overrides
9916 .Va smtp-auth-user
9917 for specific values of sender addresses, dependent upon the variable
9918 .Va from .
9921 .It Va smtp-hostname
9922 \*(OP\*(IN Normally \*(UA uses the variable
9923 .Va from
9924 to derive the necessary
9925 .Ql USER@HOST
9926 information in order to issue a
9927 .Ql MAIL FROM:<>
9928 SMTP
9929 .Va mta
9930 command.
9931 Setting
9932 .Va smtp-hostname
9933 can be used to use the
9934 .Ql USER
9935 from the SMTP account
9936 .Pf ( Va mta
9937 or the
9938 .Va user
9939 variable chain)
9940 and the
9941 .Ql HOST
9942 from the content of this variable (or, if that is the empty string,
9943 .Va hostname
9944 or the local hostname as a last resort).
9945 This often allows using an address that is itself valid but hosted by
9946 a provider other than which (in
9947 .Va from )
9948 is about to send the message.
9949 Setting this variable also influences generated
9950 .Ql Message-ID:
9952 .Ql Content-ID:
9953 header fields.
9955 .Mx Va smtp-use-starttls
9956 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
9957 \*(BO\*(OP Causes \*(UA to issue a
9958 .Ql STARTTLS
9959 command to make an SMTP
9960 .Va mta
9961 session SSL/TLS encrypted, i.e., to enable transport layer security.
9965 .It Va spam-interface
9966 \*(OP In order to use any of the spam-related commands (like, e.g.,
9967 .Ic spamrate )
9968 the desired spam interface must be defined by setting this variable.
9969 Please refer to the manual section
9970 .Sx "Handling spam"
9971 for the complete picture of spam handling in \*(UA.
9972 All or none of the following interfaces may be available:
9974 .Bl -tag -width ".It Ql _ilte_"
9975 .It Ql spamc
9976 Interaction with
9977 .Xr spamc 1
9978 from the
9979 .Xr spamassassin 1
9980 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
9981 suite.
9982 Different to the generic filter interface \*(UA will automatically add
9983 the correct arguments for a given command and has the necessary
9984 knowledge to parse the program's output.
9985 A default value for
9986 .Va spamc-command
9987 will have been compiled into the \*(UA binary if
9988 .Xr spamc 1
9989 has been found in
9990 .Ev PATH
9991 during compilation.
9992 Shall it be necessary to define a specific connection type (rather than
9993 using a configuration file for that), the variable
9994 .Va spamc-arguments
9995 can be used as in, e.g.,
9996 .Ql -d server.example.com -p 783 .
9997 It is also possible to specify a per-user configuration via
9998 .Va spamc-user .
9999 Note that this interface does not inspect the
10000 .Ql is-spam
10001 flag of a message for the command
10002 .Ic spamforget .
10004 .It Ql filter
10005 generic spam filter support via freely configurable hooks.
10006 This interface is meant for programs like
10007 .Xr bogofilter 1
10008 and requires according behaviour in respect to the hooks' exit
10009 status for at least the command
10010 .Ic spamrate
10011 .Pf ( Ql 0
10012 meaning a message is spam,
10013 .Ql 1
10014 for non-spam,
10015 .Ql 2
10016 for unsure and any other return value indicating a hard error);
10017 since the hooks can include shell code snippets diverting behaviour
10018 can be intercepted as necessary.
10019 The hooks are
10020 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
10021   spamfilter-rate
10023 .Va spamfilter-spam ;
10024 the manual section
10025 .Sx "Handling spam"
10026 contains examples for some programs.
10027 The process environment of the hooks will have the variable
10028 .Ev MAILX_FILENAME_GENERATED
10029 set.
10030 Note that spam score support for
10031 .Ic spamrate
10032 is not supported unless the \*(OPtional regular expression support is
10033 available and the
10034 .Va spamfilter-rate-scanscore
10035 variable is set.
10040 .It Va spam-maxsize
10041 \*(OP Messages that exceed this size will not be passed through to the
10042 configured
10043 .Va spam-interface .
10044 If unset or 0, the default of 420000 bytes is used.
10047 .It Va spamc-command
10048 \*(OP The path to the
10049 .Xr spamc 1
10050 program for the
10051 .Ql spamc
10052 .Va spam-interface .
10053 Note that the path is not expanded, but used
10054 .Dq as is .
10055 A fallback path will have been compiled into the \*(UA binary if the
10056 executable had been found during compilation.
10059 .It Va spamc-arguments
10060 \*(OP Even though \*(UA deals with most arguments for the
10061 .Ql spamc
10062 .Va spam-interface
10063 automatically, it may at least sometimes be desirable to specify
10064 connection-related ones via this variable, e.g.,
10065 .Ql -d server.example.com -p 783 .
10068 .It Va spamc-user
10069 \*(OP Specify a username for per-user configuration files for the
10070 .Ql spamc
10071 .Va spam-interface .
10072 If this is set to the empty string then \*(UA will use the name of the
10073 current
10074 .Va user .
10081 .It Va spamfilter-ham , spamfilter-noham , \
10082   spamfilter-nospam , spamfilter-rate , spamfilter-spam
10083 \*(OP Command and argument hooks for the
10084 .Ql filter
10085 .Va spam-interface .
10086 The manual section
10087 .Sx "Handling spam"
10088 contains examples for some programs.
10091 .It Va spamfilter-rate-scanscore
10092 \*(OP Because of the generic nature of the
10093 .Ql filter
10094 .Va spam-interface
10095 spam scores are not supported for it by default, but if the \*(OPnal
10096 regular expression support is available then setting this variable can
10097 be used to overcome this restriction.
10098 It is interpreted as follows: first a number (digits) is parsed that
10099 must be followed by a semicolon
10100 .Ql \&;
10101 and an extended regular expression.
10102 Then the latter is used to parse the first output line of the
10103 .Va spamfilter-rate
10104 hook, and, in case the evaluation is successful, the group that has been
10105 specified via the number is interpreted as a floating point scan score.
10109 .It Va ssl-ca-dir , ssl-ca-file
10110 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10111 Enhanced Mail) format as a directory and a file, respectively, for the
10112 purpose of verification of SSL/TLS server certificates.
10113 It is possible to set both, the file will be loaded immediately, the
10114 directory will be searched whenever no match has yet been found.
10115 The set of CA certificates which are built into the SSL/TLS library can
10116 be explicitly turned off by setting
10117 .Va ssl-ca-no-defaults ,
10118 and further fine-tuning is possible via
10119 .Va ssl-ca-flags ;
10120 also see
10121 .Xr SSL_CTX_load_verify_locations 3
10122 for more information.
10126 .It Va ssl-ca-flags
10127 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10128 storage, and the certificate verification that is used (also see
10129 .Va ssl-verify ) .
10130 The value is expected to consist of a comma-separated list of
10131 configuration directives, with any intervening whitespace being ignored.
10132 The directives directly map to flags that can be passed to
10133 .Xr X509_STORE_set_flags 3 ,
10134 which are usually defined in a file
10135 .Pa openssl/x509_vfy.h ,
10136 and the availability of which depends on the used SSL/TLS library
10137 version: a directive without mapping is ignored (error log subject to
10138 .Va debug ) .
10139 Directives currently understood (case-insensitively) include:
10142 .Bl -tag -compact -width ".It Cd BaNg"
10143 .It Cd no-alt-chains
10144 If the initial chain is not trusted, do not attempt to build an
10145 alternative chain.
10146 Setting this flag will make OpenSSL certificate verification match that
10147 of older OpenSSL versions, before automatic building and checking of
10148 alternative chains has been implemented; also see
10149 .Cd trusted-first .
10150 .It Cd no-check-time
10151 Do not check certificate/CRL validity against current time.
10152 .It Cd partial-chain
10153 By default partial, incomplete chains which cannot be verified up to the
10154 chain top, a self-signed root certificate, will not verify.
10155 With this flag set, a chain succeeds to verify if at least one signing
10156 certificate of the chain is in any of the configured trusted stores of
10157 CA certificates.
10158 The OpenSSL manual page
10159 .Xr SSL_CTX_load_verify_locations 3
10160 gives some advise how to manage your own trusted store of CA certificates.
10161 .It Cd strict
10162 Disable workarounds for broken certificates.
10163 .It Cd trusted-first
10164 Try building a chain using issuers in the trusted store first to avoid
10165 problems with server-sent legacy intermediate certificates.
10166 Newer versions of OpenSSL support alternative chain checking and enable
10167 it by default, resulting in the same behaviour; also see
10168 .Cd no-alt-chains .
10173 .It Va ssl-ca-no-defaults
10174 \*(BO\*(OP Do not load the default CA locations that are built into the
10175 used to SSL/TLS library to verify SSL/TLS server certificates.
10177 .Mx Va ssl-cert
10178 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
10179 \*(OP Variable chain that sets the file name for a SSL/TLS client
10180 certificate required by some servers.
10181 This is a direct interface to the
10182 .Ql Certificate
10183 slot of the
10184 .Xr SSL_CONF_cmd 3
10185 function of the OpenSSL library, if available.
10187 .Mx Va ssl-cipher-list
10188 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
10189 \*(OP Specifies a list of ciphers for SSL/TLS connections.
10190 This is a direct interface to the
10191 .Ql CipherString
10192 slot of the
10193 .Xr SSL_CONF_cmd 3
10194 function of the OpenSSL library, if available; see
10195 .Xr ciphers 1
10197 .Xr SSL_CTX_set_cipher_list 3
10198 for more information.
10199 By default \*(UA does not set a list of ciphers, in effect using a
10200 .Va ssl-protocol
10201 specific cipher (protocol standards ship with a list of acceptable
10202 ciphers), possibly cramped to what the actually used SSL/TLS library
10203 supports \(en the manual section
10204 .Sx "An example configuration"
10205 also contains a SSL/TLS use case.
10208 .It Va ssl-config-file
10209 \*(OP If this variable is set \*(UA will call
10210 .Xr CONF_modules_load_file 3
10211 to allow OpenSSL to be configured according to the host system wide
10212 security settings.
10213 If a non-empty value is given then this will be used to specify the
10214 configuration file to be used instead of the global OpenSSL default;
10215 note that in this case it is an error if the file cannot be loaded.
10216 The application name will always be passed as
10217 .Dq \*(uA .
10219 .Mx Va ssl-curves
10220 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
10221 \*(OP Specifies a list of supported curves for SSL/TLS connections.
10222 This is a direct interface to the
10223 .Ql Curves
10224 slot of the
10225 .Xr SSL_CONF_cmd 3
10226 function of the OpenSSL library, if available; see
10227 .Xr SSL_CTX_set1_curves_list 3
10228 for more information.
10229 By default \*(UA does not set a list of curves.
10233 .It Va ssl-crl-dir , ssl-crl-file
10234 \*(OP Specify a directory / a file, respectively that contains a CRL in
10235 PEM format to use when verifying SSL/TLS server certificates.
10237 .Mx Va ssl-key
10238 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
10239 \*(OP Variable chain that sets the file name for the private key of
10240 a SSL/TLS client certificate.
10241 If unset, the name of the certificate file is used.
10242 The file is expected to be in PEM format.
10243 This is a direct interface to the
10244 .Ql PrivateKey
10245 slot of the
10246 .Xr SSL_CONF_cmd 3
10247 function of the OpenSSL library, if available.
10249 .Mx Va ssl-method
10250 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
10251 \*(OB\*(OP Please use the newer and more flexible
10252 .Va ssl-protocol
10253 instead: if both values are set,
10254 .Va ssl-protocol
10255 will take precedence!
10256 Can be set to the following values, the actually used
10257 .Va ssl-protocol
10258 specification to which it is mapped is shown in parenthesis:
10259 .Ql tls1.2
10260 .Pf ( Ql -ALL, TLSv1.2 ) ,
10261 .Ql tls1.1
10262 .Pf ( Ql -ALL, TLSv1.1 ) ,
10263 .Ql tls1
10264 .Pf ( Ql -ALL, TLSv1 )
10266 .Ql ssl3
10267 .Pf ( Ql -ALL, SSLv3 ) ;
10268 the special value
10269 .Ql auto
10270 is mapped to
10271 .Ql ALL, -SSLv2
10272 and thus includes the SSLv3 protocol.
10273 Note that SSLv2 is no longer supported at all.
10275 .Mx Va ssl-protocol
10276 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
10277 \*(OP Specify the used SSL/TLS protocol.
10278 This is a direct interface to the
10279 .Ql Protocol
10280 slot of the
10281 .Xr SSL_CONF_cmd 3
10282 function of the OpenSSL library, if available;
10283 otherwise an \*(UA internal parser is used which understands the
10284 following subset of (case-insensitive) command strings:
10285 .Ql SSLv3 ,
10286 .Ql TLSv1 ,
10287 .Ql TLSv1.1
10289 .Ql TLSv1.2 ,
10290 as well as the special value
10291 .Ql ALL .
10292 Multiple specifications may be given via a comma-separated list which
10293 ignores any whitespace.
10294 An optional
10295 .Ql +
10296 plus sign prefix will enable a protocol, a
10297 .Ql -
10298 hyphen-minus prefix will disable it, so that
10299 .Ql -ALL, TLSv1.2
10300 will enable only the TLSv1.2 protocol.
10302 It depends upon the used TLS/SSL library which protocols are actually
10303 supported and which protocols are used if
10304 .Va ssl-protocol
10305 is not set, but note that SSLv2 is no longer supported at all and
10306 actively disabled.
10307 Especially for older protocols explicitly securing
10308 .Va ssl-cipher-list
10309 may be worthwile, see
10310 .Sx "An example configuration" .
10313 .It Va ssl-rand-egd
10314 \*(OP Gives the pathname to an entropy daemon socket, see
10315 .Xr RAND_egd 3 .
10316 Not all SSL/TLS libraries support this.
10319 .It Va ssl-rand-file
10320 \*(OP Gives the filename to a file with random entropy data, see
10321 .Xr RAND_load_file 3 .
10322 If this variable is not set, or set to the empty string, or if the
10323 .Sx "Filename transformations"
10324 fail, then
10325 .Xr RAND_file_name 3
10326 will be used to create the filename if, and only if,
10327 .Xr RAND_status 3
10328 documents that the SSL PRNG is not yet sufficiently seeded.
10329 If \*(UA successfully seeded the SSL PRNG then it will update the file
10330 .Pf ( Xr RAND_write_file 3 ) .
10331 This variable is only used if
10332 .Va ssl-rand-egd
10333 is not set (or not supported by the SSL/TLS library).
10335 .Mx Va ssl-verify
10336 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
10337 \*(OP Variable chain that sets the action to be performed if an error
10338 occurs during SSL/TLS server certificate validation against the
10339 specified or default trust stores
10340 .Va ssl-ca-dir ,
10341 .Va ssl-ca-file ,
10342 or the SSL/TLS library builtin defaults (unless usage disallowed via
10343 .Va ssl-ca-no-defaults ) ,
10344 and as fine-tuned via
10345 .Va ssl-ca-flags .
10346 Valid (case-insensitive) values are
10347 .Ql strict
10348 (fail and close connection immediately),
10349 .Ql ask
10350 (ask whether to continue on standard input),
10351 .Ql warn
10352 (show a warning and continue),
10353 .Ql ignore
10354 (do not perform validation).
10355 The default is
10356 .Ql ask .
10359 .It Va stealthmua
10360 If only set without an assigned value, then this setting inhibits the
10361 generation of the
10362 .Ql Message-ID: ,
10363 .Ql Content-ID:
10365 .Ql User-Agent:
10366 header fields that include obvious references to \*(UA.
10367 There are two pitfalls associated with this:
10368 First, the message id of outgoing messages is not known anymore.
10369 Second, an expert may still use the remaining information in the header
10370 to track down the originating mail user agent.
10371 If set to the value
10372 .Ql noagent ,
10373 then the mentioned
10374 .Ql Message-ID:
10376 .Ql Content-ID:
10377 suppression does not occur.
10381 .It Va termcap
10382 (\*(OP) This specifies a comma-separated list of
10383 .Lb libterminfo
10384 and/or
10385 .Lb libtermcap
10386 capabilities (see
10387 .Sx "On terminal control and line editor" ,
10388 escape commas with reverse solidus) to be used to overwrite or define
10389 entries.
10390 Note that this variable will only be queried once at program startup and
10391 can thus only be specified in resource files or on the command line.
10394 String capabilities form
10395 .Ql cap=value
10396 pairs and are expected unless noted otherwise.
10397 Numerics have to be notated as
10398 .Ql cap#number
10399 where the number is expected in normal decimal notation.
10400 Finally, booleans do not have any value but indicate a true or false
10401 state simply by being defined or not; this indeed means that \*(UA
10402 does not support undefining an existing boolean.
10403 String capability values will undergo some expansions before use:
10404 for one notations like
10405 .Ql ^LETTER
10406 stand for
10407 .Ql control-LETTER ,
10408 and for clarification purposes
10409 .Ql \eE
10410 can be used to specify
10411 .Ql escape
10412 (the control notation
10413 .Ql ^[
10414 could lead to misreadings when a left bracket follows, which it does for
10415 the standard CSI sequence);
10416 finally three letter octal sequences, as in
10417 .Ql \e061 ,
10418 are supported.
10419 To specify that a terminal supports 256-colours, and to define sequences
10420 that home the cursor and produce an audible bell, one might write:
10422 .Bd -literal -offset indent
10423 set termcap='Co#256,home=\eE[H,bel=^G'
10427 The following terminal capabilities are or may be meaningful for the
10428 operation of the builtin line editor or \*(UA in general:
10431 .Bl -tag -compact -width yay
10432 .\" HAVE_COLOUR
10433 .It Cd colors Ns \0or Cd Co
10434 .Cd max_colors :
10435 numeric capability specifying the maximum number of colours.
10436 Note that \*(UA does not actually care about the terminal beside that,
10437 but always emits ANSI / ISO 6429 escape sequences.
10439 .\" HAVE_TERMCAP
10440 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
10441 .Cd exit_ca_mode
10443 .Cd enter_ca_mode ,
10444 respectively: exit and enter the alternative screen
10445 .Dq ca-mode ,
10446 effectively turning \*(UA into a fullscreen application.
10447 To disable that, set (at least) one to the empty string.
10449 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
10450 .Cd keypad_xmit
10452 .Cd keypad_local ,
10453 respectively: enable and disable the keypad.
10454 This is always enabled if available, because it seems even keyboards
10455 without keypads generate other key codes for, e.g., cursor keys in that
10456 case, and only if enabled we see the codes that we are interested in.
10458 .It Cd ed Ns \0or Cd cd
10459 .Cd clr_eos :
10460 clear the screen.
10462 .It Cd clear Ns \0or Cd cl
10463 .Cd clear_screen :
10464 clear the screen and home cursor.
10465 (Will be simulated via
10466 .Cd ho
10467 plus
10468 .Cd cd . )
10470 .It Cd home Ns \0or Cd ho
10471 .Cd cursor_home :
10472 home cursor.
10474 .\" HAVE_MLE
10475 .It Cd el Ns \0or Cd ce
10476 .Cd clr_eol :
10477 clear to the end of line.
10478 (Will be simulated via
10479 .Cd ch
10480 plus repetitions of space characters.)
10482 .It Cd hpa Ns \0or Cd ch
10483 .Cd column_address :
10484 move the cursor (to the given column parameter) in the current row.
10485 (Will be simulated via
10486 .Cd cr
10487 plus
10488 .Cd nd . )
10490 .It Cd cr
10491 .Cd carriage_return :
10492 move to the first column in the current row.
10493 The default builtin fallback is
10494 .Ql \er .
10496 .It Cd cub1 Ns \0or Cd le
10497 .Cd cursor_left :
10498 move the cursor left one space (non-destructively).
10499 The default builtin fallback is
10500 .Ql \eb .
10502 .It Cd cuf1 Ns \0or Cd nd
10503 .Cd cursor_right :
10504 move the cursor right one space (non-destructively).
10505 The default builtin fallback is
10506 .Ql \eE[C ,
10507 which is used by most terminals.
10508 Less often occur
10509 .Ql \eEC
10511 .Ql \eEOC .
10515 Many more capabilities which describe key-sequences are documented for
10516 .Ic bind .
10519 .It Va termcap-disable
10520 \*(OP Disable any interaction with a terminal control library.
10521 If set only some generic fallback builtins and possibly the content of
10522 .Va termcap
10523 describe the terminal to \*(UA.
10524 .Sy Note
10525 that this variable will only be queried once at program startup and can
10526 thus only be specified in resource files or on the command line.
10529 .It Va toplines
10530 If defined, gives the number of lines of a message to be displayed
10531 with the command
10532 .Ic top ;
10533 if unset, the first five lines are printed, if set to 0 the variable
10534 .Va screen
10535 is inspected.
10536 If the value is negative then its absolute value will be used for
10537 unsigned right shifting (see
10538 .Ic vexpr )
10540 .Va screen
10541 height.
10544 .It Va topsqueeze
10545 \*(BO If set then the
10546 .Ic top
10547 command series will strip adjacent empty lines and quotations.
10550 .It Va ttycharset
10551 The character set of the terminal \*(UA operates on,
10552 and the one and only supported character set that \*(UA can use if no
10553 character set conversion capabilities have been compiled into it,
10554 in which case it defaults to ISO-8859-1 unless it can deduce a value
10555 from the
10556 .Ev LC_CTYPE
10557 locale environment.
10558 It defaults to UTF-8 if conversion is available.
10559 Refer to the section
10560 .Sx "Character sets"
10561 for the complete picture about character sets.
10564 .It Va typescript-mode
10565 \*(BO A special multiplex variable that disables all variables and
10566 settings which result in behaviour that interferes with running \*(UA in
10567 .Xr script 1 ,
10568 e.g., it sets
10569 .Va colour-disable ,
10570 .Va line-editor-disable
10571 and (before startup completed only)
10572 .Va termcap-disable .
10573 Unsetting it does not restore the former state of the covered settings.
10576 .It Va umask
10577 For a safety-by-default policy \*(UA sets its process
10578 .Xr umask 2
10580 .Ql 0077 ,
10581 but this variable can be used to override that:
10582 set it to an empty value to do not change the (current) setting,
10583 otherwise the process file mode creation mask is updated to the new value.
10584 Child processes inherit the process file mode creation mask.
10586 .Mx Va user
10587 .It Va user-HOST , user
10588 \*(IN Variable chain that sets a global fallback user name, which is
10589 used in case none has been given in the protocol and account-specific
10590 URL.
10591 This variable defaults to the name of the user who runs \*(UA.
10594 .It Va v15-compat
10595 \*(BO Setting this enables upward compatibility with \*(UA
10596 version 15.0 in respect to which configuration options are available and
10597 how they are handled.
10598 This manual uses \*(IN and \*(OU to refer to the new and the old way of
10599 doing things, respectively.
10602 .It Va verbose
10603 \*(BO This setting, also controllable via the command line option
10604 .Fl v ,
10605 causes \*(UA to be more verbose, e.g., it will display obsoletion
10606 warnings and SSL/TLS certificate chains.
10607 Even though marked \*(BO this option may be set twice in order to
10608 increase the level of verbosity even more, in which case even details of
10609 the actual message delivery and protocol conversations are shown.
10610 A single
10611 .Pf no Va verbose
10612 is sufficient to disable verbosity as such.
10619 .It Va version , version-date , version-major , version-minor , version-update
10620 \*(RO \*(UA version information: the first variable contains a string
10621 containing the complete version identification, the latter three contain
10622 only digits: the major, minor and update version numbers.
10623 The date is in ISO 8601 notation.
10624 The output of the command
10625 .Ic version
10626 will include this information.
10629 .It Va writebackedited
10630 If this variable is set messages modified using the
10631 .Ic edit
10633 .Ic visual
10634 commands are written back to the current folder when it is quit;
10635 it is only honoured for writable folders in MBOX format, though.
10636 Note that the editor will be pointed to the raw message content in that
10637 case, i.e., neither MIME decoding nor decryption will have been
10638 performed, and proper RFC 4155
10639 .Ql From_
10640 quoting of newly added or edited content is also left as an excercise to
10641 the user.
10643 .\" }}} (Variables)
10644 .\" }}} (INTERNAL VARIABLES)
10647 .\" .Sh ENVIRONMENT {{{
10648 .Sh ENVIRONMENT
10650 The term
10651 .Dq environment variable
10652 should be considered an indication that these variables are either
10653 standardized as vivid parts of process environments, or that they are
10654 commonly found in there.
10655 The process environment is inherited from the
10656 .Xr sh 1
10657 once \*(UA is started, and unless otherwise explicitly noted handling of
10658 the following variables transparently integrates into that of the
10659 .Sx "INTERNAL VARIABLES"
10660 from \*(UA's point of view.
10661 This means that, e.g., they can be managed via
10662 .Ic set
10664 .Ic unset ,
10665 causing automatic program environment updates (to be inherited by
10666 newly created child processes).
10669 In order to transparently integrate other environment variables equally
10670 they need to be imported (linked) with the command
10671 .Ic environ .
10672 This command can also be used to set and unset non-integrated
10673 environment variables from scratch, sufficient system support provided.
10674 The following example, applicable to a POSIX shell, sets the
10675 .Ev COLUMNS
10676 environment variable for \*(UA only, and beforehand exports the
10677 .Ev EDITOR
10678 in order to affect any further processing in the running shell:
10680 .Bd -literal -offset indent
10681 $ EDITOR="vim -u ${HOME}/.vimrc"
10682 $ export EDITOR
10683 $ COLUMNS=80 \*(uA -R
10686 .Bl -tag -width ".It Ev BaNg"
10688 .It Ev COLUMNS
10689 The user's preferred width in column positions for the terminal screen
10690 or window.
10691 Queried and used once on program startup, actively managed for child
10692 processes and the MLE (see
10693 .Sx "On terminal control and line editor" )
10694 in interactive mode thereafter.
10695 Ignored in non-interactive mode, which always uses 80 columns.
10698 .It Ev DEAD
10699 The name of the (mailbox)
10700 .Ic file
10701 to use for saving aborted messages if
10702 .Va save
10703 is set; this defaults to
10704 .Pa dead.letter
10705 in the user's
10706 .Ev HOME
10707 directory.
10708 If the variable
10709 .Va debug
10710 is set no output will be generated, otherwise the contents of the file
10711 will be replaced.
10714 .It Ev EDITOR
10715 Pathname of the text editor to use in the
10716 .Ic edit
10717 command and
10718 .Ic ~e
10719 .Sx "COMMAND ESCAPES" .
10720 A default editor is used if this value is not defined.
10723 .It Ev HOME
10724 The user's home directory.
10725 This variable is only used when it resides in the process environment.
10732 .It Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
10734 .Xr locale 7
10736 .Sx "Character sets" .
10739 .It Ev LINES
10740 The user's preferred number of lines on a page or the vertical screen
10741 or window size in lines.
10742 Queried and used once on program startup, actively managed for child
10743 processes in interactive mode thereafter.
10744 Ignored in non-interactive mode, which always uses 24 lines.
10747 .It Ev LISTER
10748 Pathname of the directory lister to use in the
10749 .Ic folders
10750 command when operating on local mailboxes.
10751 Default is
10752 .Xr ls 1
10753 (path search through
10754 .Ev SHELL ) .
10757 .It Ev LOGNAME
10758 Upon startup \*(UA will actively ensure that this variable refers to the
10759 name of the user who runs \*(UA, in order to be able to pass a verified
10760 name to any newly created child process.
10763 .It Ev MAIL
10764 Is used as the users
10765 .Mx -sx
10766 .Sx "primary system mailbox"
10767 unless
10768 .Va inbox
10769 is set.
10770 This is assumed to be an absolute pathname.
10773 .It Ev MAILCAPS
10774 \*(OP Overrides the default path search for
10775 .Sx "The Mailcap files" ,
10776 which is defined in the standard RFC 1524 as
10777 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
10778 .\" TODO we should have a mailcaps-default virtual RDONLY option!
10779 (\*(UA makes it a configuration option, however.)
10780 Note this is not a search path, but a path search.
10783 .It Ev MAILRC
10784 Is used as a startup file instead of
10785 .Pa \*(ur
10786 if set.
10787 When \*(UA scripts are invoked on behalf of other users,
10788 either this variable should be set to
10789 .Pa /dev/null
10790 or the
10791 .Fl \&:
10792 command line option should be used in order to avoid side-effects from
10793 reading their configuration files.
10794 This variable is only used when it resides in the process environment.
10797 .It Ev MAILX_NO_SYSTEM_RC
10798 If this variable is set then reading of
10799 .Pa \*(UR
10800 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
10801 had been started up with the option
10802 .Fl \&:
10803 (and according argument) or
10804 .Fl n .
10805 This variable is only used when it resides in the process environment.
10808 .It Ev MBOX
10809 The name of the users
10810 .Mx -sx
10811 .Sx "secondary mailbox"
10812 file.
10813 A logical subset of the special
10814 .Sx "Filename transformations"
10815 (also see
10816 .Ic file )
10817 are supported.
10818 The fallback default is
10819 .Pa mbox
10820 in the user's
10821 .Ev HOME
10822 directory.
10823 Traditionally this MBOX is used as the file to save messages from the
10824 .Mx -sx
10825 .Sx "primary system mailbox"
10826 that have been read.
10827 Also see
10828 .Sx "Message states" .
10831 .It Ev NETRC
10832 \*(IN\*(OP This variable overrides the default location of the user's
10833 .Pa ~/.netrc
10834 file.
10837 .It Ev PAGER
10838 Pathname of the program to use for backing the command
10839 .Ic more ,
10840 and when the
10841 .Va crt
10842 variable enforces usage of a pager for output.
10843 The default paginator is
10844 .Xr more 1
10845 (path search through
10846 .Ev SHELL ) .
10848 \*(UA inspects the contents of this variable: if its contains the string
10849 .Dq less
10850 then a non-existing environment variable
10851 .Va LESS
10852 will be set to
10853 .Ql FRXi ,
10854 .Ql FRi
10856 .Ql Ri ,
10857 dependent on whether terminal control support is available and whether
10858 that supports full (alternative) screen mode or not (also see
10859 .Sx "On terminal control and line editor" ) .
10860 Likewise for
10861 .Dq lv
10862 .Va LV
10863 will optionally be set to
10864 .Dq -c .
10865 Alse see
10866 .Va colour-pager .
10869 .It Ev PATH
10870 A colon-separated list of directories that is searched by the shell when
10871 looking for commands, e.g.,
10872 .Ql /bin:/usr/bin:/usr/local/bin .
10875 .It Ev POSIXLY_CORRECT
10876 This variable is automatically looked for upon startup, see
10877 .Va posix
10878 for more.
10881 .It Ev SHELL
10882 The shell to use for the commands
10883 .Ic \&! ,
10884 .Ic shell ,
10886 .Ic ~!
10887 .Sx "COMMAND ESCAPES"
10888 and when starting subprocesses.
10889 A default shell is used if this environment variable is not defined.
10892 .It Ev SOURCE_DATE_EPOCH
10893 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
10894 used in place of the current time.
10895 This variable is looked up upon program startup, and its existence will
10896 switch \*(UA to a completely reproducible mode which causes
10897 deterministic random numbers, a special fixed (non-existent?)
10898 .Ev LOGNAME
10899 and more to be used and set.
10900 It is to be used during development or by software packagers.
10901 \*(ID Currently an invalid setting is only ignored, rather than causing
10902 a program abortion.
10904 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
10907 .It Ev TERM
10908 \*(OP The terminal type for which output is to be prepared.
10909 For extended colour and font control please refer to
10910 .Sx "Coloured display" ,
10911 and for terminal management in general to
10912 .Sx "On terminal control and line editor" .
10915 .It Ev TMPDIR
10916 Used as directory for temporary files instead of
10917 .Pa /tmp ,
10918 if set.
10919 This variable is only used when it resides in the process environment,
10920 but \*(UA will ensure at startup that this environment variable is
10921 updated to contain a usable temporary directory.
10924 .It Ev USER
10925 Identical to
10926 .Ev LOGNAME
10927 (see there), but this variable is not standardized, should therefore not
10928 be used, and is only corrected if already set.
10931 .It Ev VISUAL
10932 Pathname of the text editor to use in the
10933 .Ic visual
10934 command and
10935 .Ic ~v
10936 .Sx "COMMAND ESCAPES" .
10938 .\" }}}
10941 .\" .Sh FILES {{{
10942 .Sh FILES
10944 .Bl -tag -width ".It Pa BaNg"
10945 .It Pa \*(ur
10946 File giving initial commands.
10948 .It Pa \*(UR
10949 System wide initialization file.
10952 .It Pa ~/.mailcap
10953 \*(OP Personal MIME type handler definition file, see
10954 .Sx "The Mailcap files" .
10955 This location is part of the RFC 1524 standard search path, which is
10956 a configuration option and can be overridden via
10957 .Ev MAILCAPS .
10960 .It Pa /etc/mailcap
10961 \*(OP System wide MIME type handler definition file, see
10962 .Sx "The Mailcap files" .
10963 This location is part of the RFC 1524 standard search path, which is
10964 a configuration option and can be overridden via
10967 .It Pa ~/.mime.types
10968 Personal MIME types, see
10969 .Sx "The mime.types files" .
10970 The actually used path is a configuration option.
10973 .It Pa /etc/mime.types
10974 System wide MIME types, see
10975 .Sx "The mime.types files" .
10976 The actually used path is a configuration option.
10979 .It Pa ~/.netrc
10980 \*(IN\*(OP The default location of the users
10981 .Pa .netrc
10982 file \(en the section
10983 .Sx "The .netrc file"
10984 documents the file format.
10985 The actually used path is a configuration option and can be overridden via
10986 .Ev NETRC .
10989 .\" .Ss "The mime.types files" {{{
10990 .Ss "The mime.types files"
10992 When sending messages \*(UA tries to determine the content type of all
10993 attachments.
10994 When displaying message content or attachments \*(UA uses the content
10995 type to decide whether it can directly display data or whether it needs
10996 to deal with content handlers.
10997 It learns about M(ultipurpose) I(nternet) M(ail) E(xtensions) types and
10998 how to treat them by reading
10999 .Pa mime.types
11000 files, the loading of which can be controlled by setting the variable
11001 .Va mimetypes-load-control .
11002 (The command
11003 .Ic mimetype
11004 can also be used to deal with MIME types.)
11005 .Pa mime.types
11006 files have the following syntax:
11009 .Dl type/subtype extension [extension ...]
11012 where
11013 .Ql type/subtype
11014 are strings describing the file contents, and one or multiple
11015 .Ql extension Ns
11016 s, separated by whitespace, name the part of a filename starting after
11017 the last dot (of interest).
11018 Comments may be introduced anywhere on a line with a number sign
11019 .Ql # ,
11020 causing the remaining line to be discarded.
11022 \*(UA also supports an extended, non-portable syntax in specially
11023 crafted files, which can be loaded via the alternative value syntax of
11024 .Va mimetypes-load-control
11025 and prepends an optional
11026 .Ql type-marker :
11029 .Dl [type-marker ]type/subtype extension [extension ...]
11032 The following type markers are supported:
11035 .Bl -tag -compact -width ".It Ar _n_u"
11036 .It Ar @
11037 Treat message parts with this content as plain text.
11038 .It Ar @t@
11039 The same as plain
11040 .Ar @ .
11041 .It Ar @h@
11042 Treat message parts with this content as HTML tagsoup.
11043 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
11044 the content as plain text instead.
11045 .It Ar @H@
11046 Likewise
11047 .Ar @h@
11048 but instead of falling back to plain text require an explicit content
11049 handler to be defined.
11053 Further reading:
11054 for sending messages:
11055 .Ic mimetype ,
11056 .Va mime-allow-text-controls ,
11057 .Va mimetypes-load-control .
11058 For reading etc. messages:
11059 .Sx "HTML mail and MIME attachments" ,
11060 .Sx "The Mailcap files" ,
11061 .Ic mimetype ,
11062 .Va mime-counter-evidence ,
11063 .Va mimetypes-load-control ,
11064 .Va pipe-TYPE/SUBTYPE ,
11065 .Va pipe-EXTENSION .
11066 .\" }}}
11068 .\" .Ss "The Mailcap files" {{{
11069 .Ss "The Mailcap files"
11071 .\" TODO MAILCAP DISABLED
11072 .Sy This feature is not available in v14.9.0, sorry!
11073 RFC 1524 defines a
11074 .Dq User Agent Configuration Mechanism
11075 which \*(UA \*(OPally supports.
11076 It defines a file format to be used to inform mail user agent programs
11077 about the locally-installed facilities for handling various data
11078 formats, i.e., about commands and how they can be used to display, edit
11079 etc. MIME part contents, as well as a default path search that includes
11080 multiple possible locations of
11081 .Dq mailcap
11082 files and the
11083 .Ev MAILCAPS
11084 environment variable that can be used to overwrite that (repeating here
11085 that it is not a search path, but instead a path search specification).
11086 Any existing files will be loaded in sequence, appending any content to
11087 the list of MIME type handler directives.
11090 .Dq Mailcap
11091 files consist of a set of newline separated entries.
11092 Comment lines start with a number sign
11093 .Ql #
11094 (in the first column!) and are ignored.
11095 Empty lines are also ignored.
11096 All other lines form individual entries that must adhere to the syntax
11097 described below.
11098 To extend a single entry (not comment) its line can be continued on
11099 follow lines if newline characters are
11100 .Dq escaped
11101 by preceding them with the reverse solidus character
11102 .Ql \e .
11103 The standard does not specify how leading whitespace of follow lines
11104 is to be treated, therefore \*(UA retains it.
11107 .Dq Mailcap
11108 entries consist of a number of semicolon
11109 .Ql \&;
11110 separated fields, and the reverse solidus
11111 .Ql \e
11112 character can be used to escape any following character including
11113 semicolon and itself.
11114 The first two fields are mandatory and must occur in the specified
11115 order, the remaining fields are optional and may appear in any order.
11116 Leading and trailing whitespace of content is ignored (removed).
11119 The first field defines the MIME
11120 .Ql TYPE/SUBTYPE
11121 the entry is about to handle (case-insensitively, and no reverse solidus
11122 escaping is possible in this field).
11123 If the subtype is specified as an asterisk
11124 .Ql *
11125 the entry is meant to match all subtypes of the named type, e.g.,
11126 .Ql audio/*
11127 would match any audio type.
11128 The second field defines the shell command which shall be used to
11129 .Dq display
11130 MIME parts of the given type; it is implicitly called the
11131 .Cd view
11132 command.
11135 For data
11136 .Dq consuming
11137 shell commands message (MIME part) data is passed via standard input
11138 unless the given shell command includes one or more instances of the
11139 (unquoted) string
11140 .Ql %s ,
11141 in which case these instances will be replaced with a temporary filename
11142 and the data will have been stored in the file that is being pointed to.
11143 Likewise, for data
11144 .Dq producing
11145 shell commands data is assumed to be generated on standard output unless
11146 the given command includes (one ore multiple)
11147 .Ql %s .
11148 In any case any given
11149 .Ql %s
11150 format is replaced with a(n already) properly quoted filename.
11151 Note that when a command makes use of a temporary file via
11152 .Ql %s
11153 then \*(UA will remove it again, as if the
11154 .Cd x-mailx-tmpfile ,
11155 .Cd x-mailx-tmpfile-fill
11157 .Cd x-mailx-tmpfile-unlink
11158 flags had been set; see below for more.
11161 The optional fields either define a shell command or an attribute (flag)
11162 value, the latter being a single word and the former being a keyword
11163 naming the field followed by an equals sign
11164 .Ql =
11165 succeeded by a shell command, and as usual for any
11166 .Dq Mailcap
11167 content any whitespace surrounding the equals sign will be removed, too.
11168 Optional fields include the following:
11171 .Bl -tag -width ".It Cd BaNg"
11172 .It Cd compose
11173 A program that can be used to compose a new body or body part in the
11174 given format.
11175 (Currently unused.)
11177 .It Cd composetyped
11178 Similar to the
11179 .Cd compose
11180 field, but is to be used when the composing program needs to specify the
11181 .Ql Content-type:
11182 header field to be applied to the composed data.
11183 (Currently unused.)
11185 .It Cd edit
11186 A program that can be used to edit a body or body part in the given
11187 format.
11188 (Currently unused.)
11190 .It Cd print
11191 A program that can be used to print a message or body part in the given
11192 format.
11193 (Currently unused.)
11195 .It Cd test
11196 Specifies a program to be run to test some condition, e.g., the machine
11197 architecture, or the window system in use, to determine whether or not
11198 this mailcap entry applies.
11199 If the test fails, a subsequent mailcap entry should be sought; also see
11200 .Cd x-mailx-test-once .
11202 .It Cd needsterminal
11203 This flag field indicates that the given shell command must be run on
11204 an interactive terminal.
11205 \*(UA will temporarily release the terminal to the given command in
11206 interactive mode, in non-interactive mode this entry will be entirely
11207 ignored; this flag implies
11208 .Cd x-mailx-noquote .
11210 .It Cd copiousoutput
11211 A flag field which indicates that the output of the
11212 .Cd view
11213 command will be an extended stream of textual output that can be
11214 (re)integrated into \*(UA's normal visual display.
11215 It is mutually exclusive with
11216 .Cd needsterminal
11217 and implies
11218 .Cd x-mailx-always .
11220 .It Cd textualnewlines
11221 A flag field which indicates that this type of data is line-oriented and
11222 that, if encoded in
11223 .Ql base64 ,
11224 all newlines should be converted to canonical form (CRLF) before
11225 encoding, and will be in that form after decoding.
11226 (Currently unused.)
11228 .It Cd nametemplate
11229 This field gives a file name format, in which
11230 .Ql %s
11231 will be replaced by a random string, the joined combination of which
11232 will be used as the filename denoted by
11233 .Ev MAILX_FILENAME_TEMPORARY .
11234 One could specify that a GIF file being passed to an image viewer should
11235 have a name ending in
11236 .Ql .gif
11237 by using
11238 .Ql nametemplate=%s.gif .
11239 Note that \*(UA ignores the name template unless that solely specifies
11240 a filename suffix that consists of (ASCII) alphabetic and numeric
11241 characters, the underscore and dot only.
11243 .It Cd x11-bitmap
11244 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
11245 icon to be used to visually denote the presence of this kind of data.
11246 This field is not used by \*(UA.
11248 .It Cd description
11249 A textual description that describes this type of data.
11251 .It Cd x-mailx-always
11252 Extension flag field that denotes that the given
11253 .Cd view
11254 command shall be executed even if multiple messages will be displayed
11255 at once.
11256 Normally messages which require external viewers that produce output
11257 which does not integrate into \*(UA's visual display (i.e., do not have
11258 .Cd copiousoutput
11259 set) have to be addressed directly and individually.
11260 (To avoid cases where, e.g., a thousand PDF viewer instances are spawned
11261 in sequence.)
11263 .It Cd x-mailx-even-if-not-interactive
11264 An extension flag test field \(em by default handlers without
11265 .Cd copiousoutput
11266 are entirely ignored in non-interactive mode, but if this flag is set
11267 then their use will be considered.
11268 It is an error if this flag is set for commands that use the flag
11269 .Cd needsterminal .
11271 .It Cd x-mailx-noquote
11272 An extension flag field that indicates that even a
11273 .Cd copiousoutput
11274 .Cd view
11275 command shall not be used to generate message quotes
11276 (as it would be by default).
11278 .It Cd x-mailx-async
11279 Extension flag field that denotes that the given
11280 .Cd view
11281 command shall be executed asynchronously, without blocking \*(UA.
11282 Cannot be used in conjunction with
11283 .Cd needsterminal .
11285 .It Cd x-mailx-test-once
11286 Extension flag which denotes whether the given
11287 .Cd test
11288 command shall be evaluated once only and the (boolean) result be cached.
11289 This is handy if some global unchanging condition is to be queried, like
11290 .Dq running under the X Window System .
11292 .It Cd x-mailx-tmpfile
11293 Extension flag field that requests creation of a zero-sized temporary
11294 file, the name of which is to be placed in the environment variable
11295 .Ev MAILX_FILENAME_TEMPORARY .
11296 It is an error to use this flag with commands that include a
11297 .Ql %s
11298 format.
11300 .It Cd x-mailx-tmpfile-fill
11301 Normally the MIME part content is passed to the handler via standard
11302 input; if this flag is set then the data will instead be written into
11303 the implied
11304 .Cd x-mailx-tmpfile .
11305 In order to cause deletion of the temporary file you will have to set
11306 .Cd x-mailx-tmpfile-unlink
11307 explicitly!
11308 It is an error to use this flag with commands that include a
11309 .Ql %s
11310 format.
11312 .It Cd x-mailx-tmpfile-unlink
11313 Extension flag field that requests that the temporary file shall be
11314 deleted automatically when the command loop is entered again at latest.
11315 (Do not use this for asynchronous handlers.)
11316 It is an error to use this flag with commands that include a
11317 .Ql %s
11318 format, or without also setting
11319 .Cd x-mailx-tmpfile
11321 .Cd x-mailx-tmpfile-fill .
11323 .It Cd x-mailx-tmpfile-keep
11324 Using the string
11325 .Ql %s
11326 implies the three tmpfile related flags above, but if you want, e.g.,
11327 .Cd x-mailx-async
11328 and deal with the temporary file yourself, you can add in this flag to
11329 forcefully ignore
11330 .Cd x-mailx-tmpfile-unlink .
11335 The standard includes the possibility to define any number of additional
11336 entry fields, prefixed by
11337 .Ql x- .
11338 Flag fields apply to the entire
11339 .Dq Mailcap
11340 entry \(em in some unusual cases, this may not be desirable, but
11341 differentiation can be accomplished via separate entries, taking
11342 advantage of the fact that subsequent entries are searched if an earlier
11343 one does not provide enough information.
11344 E.g., if a
11345 .Cd view
11346 command needs to specify the
11347 .Cd needsterminal
11348 flag, but the
11349 .Cd compose
11350 command shall not, the following will help out the latter (with enabled
11351 .Va debug
11352 or an increased
11353 .Va verbose
11354 level \*(UA will show information about handler evaluation):
11356 .Bd -literal -offset indent
11357 application/postscript; ps-to-terminal %s; needsterminal
11358 application/postscript; ps-to-terminal %s; compose=idraw %s
11362 In fields any occurrence of the format string
11363 .Ql %t
11364 will be replaced by the
11365 .Ql TYPE/SUBTYPE
11366 specification.
11367 Named parameters from the
11368 .Ql Content-type:
11369 field may be placed in the command execution line using
11370 .Ql %{
11371 followed by the parameter name and a closing
11372 .Ql }
11373 character.
11374 The entire parameter should appear as a single command line argument,
11375 regardless of embedded spaces; thus:
11377 .Bd -literal -offset indent
11378 # Message
11379 Content-type:  multipart/mixed; boundary=42
11381 # Mailcap file
11382 multipart/*; /usr/local/bin/showmulti \e
11383   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
11385 # Executed shell command
11386 /usr/local/bin/showmulti multipart/mixed 42
11390 .\" TODO v15: Mailcap: %n,%F
11391 Note that \*(UA does not support handlers for multipart MIME parts as
11392 shown in this example (as of today).
11393 \*(UA does not support the additional formats
11394 .Ql %n
11396 .Ql %F .
11397 An example file, also showing how to properly deal with the expansion of
11398 .Ql %s ,
11399 which includes any quotes that are necessary to make it a valid shell
11400 argument by itself and thus will cause undesired behaviour when placed
11401 in additional user-provided quotes:
11403 .Bd -literal -offset indent
11404 # Comment line
11405 text/richtext; richtext %s; copiousoutput
11407 text/x-perl; perl -cWT %s
11409 application/pdf; \e
11410   infile=%s\e; \e
11411     trap "rm -f ${infile}" EXIT\e; \e
11412     trap "exit 75" INT QUIT TERM\e; \e
11413     mupdf %s; \e
11414   x-mailx-async; x-mailx-tmpfile-keep
11416 application/*; echo "This is \e"%t\e" but \e
11417     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
11418   copiousoutput; x-mailx-noquote
11422 Further reading:
11423 .Sx "HTML mail and MIME attachments" ,
11424 .Sx "The mime.types files" ,
11425 .Ic mimetype ,
11426 .Ev MAILCAPS ,
11427 .Va mime-counter-evidence ,
11428 .Va pipe-TYPE/SUBTYPE ,
11429 .Va pipe-EXTENSION .
11430 .\" }}}
11432 .\" .Ss "The .netrc file" {{{
11433 .Ss "The .netrc file"
11436 .Pa .netrc
11437 file contains user credentials for machine accounts.
11438 The default location in the user's
11439 .Ev HOME
11440 directory may be overridden by the
11441 .Ev NETRC
11442 environment variable.
11443 The file consists of space, tabulator or newline separated tokens.
11444 \*(UA implements a parser that supports a superset of the original BSD
11445 syntax, but users should nonetheless be aware of portability glitches
11446 of that file format, shall their
11447 .Pa .netrc
11448 be usable across multiple programs and platforms:
11451 .Bl -bullet -compact
11453 BSD does not support single, but only double quotation marks, e.g.,
11454 .Ql password="pass with spaces" .
11456 BSD (only?) supports escaping of single characters via a reverse solidus
11457 (e.g., a space can be escaped via
11458 .Ql \e\0 ) ,
11459 in- as well as outside of a quoted string.
11461 BSD does not require a final quotation mark of the last user input token.
11463 The original BSD (Berknet) parser also supported a format which allowed
11464 tokens to be separated with commas \(en whereas at least Hewlett-Packard
11465 still seems to support this syntax, \*(UA does not!
11467 As a non-portable extension some widely-used programs support
11468 shell-style comments: if an input line starts, after any amount of
11469 whitespace, with a number sign
11470 .Ql # ,
11471 then the rest of the line is ignored.
11473 Whereas other programs may require that the
11474 .Pa .netrc
11475 file is accessible by only the user if it contains a
11476 .Cd password
11477 token for any other
11478 .Cd login
11479 than
11480 .Dq anonymous ,
11481 \*(UA will always require these strict permissions.
11485 Of the following list of supported tokens \*(UA only uses (and caches)
11486 .Cd machine ,
11487 .Cd login
11489 .Cd password .
11490 At runtime the command
11491 .Ic netrc
11492 can be used to control \*(UA's
11493 .Pa .netrc
11494 cache.
11496 .Bl -tag -width ".It Cd BaNg"
11497 .It Cd machine Ar name
11498 The hostname of the entries' machine, lowercase-normalized by \*(UA
11499 before use.
11500 Any further file content, until either end-of-file or the occurrence
11501 of another
11502 .Cd machine
11503 or a
11504 .Cd default
11505 first-class token is bound (only related) to the machine
11506 .Ar name .
11508 As an extension that should not be the cause of any worries
11509 \*(UA supports a single wildcard prefix for
11510 .Ar name :
11511 .Bd -literal -offset indent
11512 machine *.example.com login USER password PASS
11513 machine pop3.example.com login USER password PASS
11514 machine smtp.example.com login USER password PASS
11517 which would match
11518 .Ql xy.example.com
11519 as well as
11520 .Ql pop3.example.com ,
11521 but neither
11522 .Ql example.com
11524 .Ql local.smtp.example.com .
11525 Note that in the example neither
11526 .Ql pop3.example.com
11528 .Ql smtp.example.com
11529 will be matched by the wildcard, since the exact matches take
11530 precedence (it is however faster to specify it the other way around).
11532 .It Cd default
11533 This is the same as
11534 .Cd machine
11535 except that it is a fallback entry that is used shall none of the
11536 specified machines match; only one default token may be specified,
11537 and it must be the last first-class token.
11539 .It Cd login Ar name
11540 The user name on the remote machine.
11542 .It Cd password Ar string
11543 The user's password on the remote machine.
11545 .It Cd account Ar string
11546 Supply an additional account password.
11547 This is merely for FTP purposes.
11549 .It Cd macdef Ar name
11550 Define a macro.
11551 A macro is defined with the specified
11552 .Ar name ;
11553 it is formed from all lines beginning with the next line and continuing
11554 until a blank line is (consecutive newline characters are) encountered.
11555 (Note that
11556 .Cd macdef
11557 entries cannot be utilized by multiple machines, too, but must be
11558 defined following the
11559 .Ic machine
11560 they are intended to be used with.)
11561 If a macro named
11562 .Ar init
11563 exists, it is automatically run as the last step of the login process.
11564 This is merely for FTP purposes.
11566 .\" }}}
11568 .\" }}}
11571 .\" .Sh EXAMPLES {{{
11572 .Sh EXAMPLES
11574 .\" .Ss "An example configuration" {{{
11575 .Ss "An example configuration"
11577 .Bd -literal -offset indent
11578 # This example assumes v15.0 compatibility mode
11579 set v15-compat
11581 # Request strict transport security checks!
11582 set ssl-verify=strict
11584 # Where are the up-to-date SSL certificates?
11585 # (Since we manage up-to-date ones explicitly, do not use any,
11586 # possibly outdated, default certificates shipped with OpenSSL)
11587 #set ssl-ca-dir=/etc/ssl/certs
11588 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
11589 set ssl-ca-no-defaults
11590 #set ssl-ca-flags=partial-chain
11591 wysh set smime-ca-file="${ssl-ca-file}" \e
11592   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
11594 # Do not use protocols older than TLS v1.2.
11595 # Change this only when the remote server does not support it:
11596 # maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
11597 # such explicit exceptions, then, e.g.
11598 #   set ssl-protocol-exam.ple='-ALL,+TLSv1.1'
11599 set ssl-protocol='-ALL,+TLSv1.2'
11601 # Explicitly define the list of ciphers, which may improve security,
11602 # especially with protocols older than TLS v1.2.  See ciphers(1).
11603 # Including "@STRENGTH" will sort the final list by algorithm strength.
11604 # In reality it is possibly best to only use ssl-cipher-list-HOST
11605 # (or -USER@HOST), as necessary, again..
11606 set ssl-cipher-list=TLSv1.2:!aNULL:!eNULL:@STRENGTH
11607 # - TLSv1.2:!aNULL:!eNULL:\e
11608 #     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
11609 #     DHE-RSA-AES256-SHA:@STRENGTH
11610 # -ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH
11611 # Especially with TLSv1.3 curves selection may be desired:
11612 #set ssl-curves=P-521:P-384:P-256
11614 # Essential setting: select allowed character sets
11615 set sendcharsets=utf-8,iso-8859-1
11617 # A very kind option: when replying to a message, first try to
11618 # use the same encoding that the original poster used herself!
11619 set reply-in-same-charset
11621 # When replying, do not merge From: and To: of the original message
11622 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
11623 set recipients-in-cc
11625 # When sending messages, wait until the Mail-Transfer-Agent finishs.
11626 # Only like this you will be able to see errors reported through the
11627 # exit status of the MTA (including the builtin SMTP one)!
11628 set sendwait
11630 # Only use builtin MIME types, no mime.types(5) files
11631 set mimetypes-load-control
11633 # Default directory where we act in (relative to $HOME)
11634 set folder=mail
11635 # A leading "+" (often) means: under *folder*
11636 # *record* is used to save copies of sent messages
11637 set MBOX=+mbox.mbox DEAD=+dead.txt \e
11638   record=+sent.mbox record-files record-resent
11640 # Make "file mymbox" and "file myrec" go to..
11641 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
11643 # Not really optional, e.g., for S/MIME
11644 set from='Your Name <address@exam.ple>'
11646 # It may be necessary to set hostname and/or smtp-hostname
11647 # if the "SERVER" of mta and "domain" of from do not match.
11648 # The `urlencode' command can be used to encode USER and PASS
11649 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
11650   smtp-auth=login/plain... \e
11651   smtp-use-starttls
11653 # Never refuse to start into interactive mode, and more
11654 set emptystart \e
11655   colour-pager crt= \e
11656   followup-to followup-to-honour=ask-yes \e
11657   history-file=+.\*(uAhist history-size=-1 history-gabby \e
11658   mime-counter-evidence=0xE \e
11659   prompt='?\e?!\e![\e${account}#\e${mailbox-display}]? ' \e
11660   reply-to-honour=ask-yes \e
11661   umask=
11663 # Only include the selected header fields when typing messages
11664 headerpick type retain from_ date from to cc subject \e
11665   message-id mail-followup-to reply-to
11666 # ...when forwarding messages
11667 headerpick forward retain subject date from to cc
11668 # ...when saving message, etc.
11669 #headerpick save ignore ^Original-.*$ ^X-.*$
11671 # Some mailing lists
11672 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
11673 mlsubscribe '^xfans@xfans\e.xyz$'
11675 # Handle a few file extensions (to store MBOX databases)
11676 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
11677   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
11678   zst 'zstd -dc' 'zstd -19 -zc' \e
11679   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
11681 # A real life example of a very huge free mail provider
11682 # Instead of directly placing content inside `account',
11683 # we `define' a macro: like that we can switch "accounts"
11684 # from within *on-compose-splice*, for example!
11685 define XooglX {
11686   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
11687   set from='Your Name <address@examp.ple>'
11688   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
11690 account XooglX {
11691   \ecall XooglX
11694 # Here is a pretty large one which does not allow sending mails
11695 # if there is a domain name mismatch on the SMTP protocol level,
11696 # which would bite us if the value of from does not match, e.g.,
11697 # for people who have a sXXXXeforge project and want to speak
11698 # with the mailing list under their project account (in from),
11699 # still sending the message through their normal mail provider
11700 define XandeX {
11701   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
11702   set from='Your Name <address@exam.ple>'
11703   set mta=smtps://USER:PASS@smtp.yaXXex.ru:465 \e
11704     hostname=yaXXex.com smtp-hostname=
11706 account XandeX {
11707   \ecall Xandex
11710 # Create some new commands so that, e.g., `ls /tmp' will..
11711 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
11712 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
11714 # We do not support gpg(1) directly yet.  But simple --clearsign'd
11715 # message parts can be dealt with as follows:
11716 define V {
11717   localopts yes
11718   wysh set pipe-text/plain=$'@*#++=@\e
11719     < "${MAILX_FILENAME_TEMPORARY}" awk \e
11720         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
11721       BEGIN{done=0}\e
11722       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
11723         if(done++ != 0)\e
11724           next;\e
11725         print "--- GPG --verify ---";\e
11726         system("gpg --verify " TMPFILE " 2>&1");\e
11727         print "--- GPG --verify ---";\e
11728         print "";\e
11729         next;\e
11730       }\e
11731       /^-----BEGIN PGP SIGNATURE-----/,\e
11732           /^-----END PGP SIGNATURE-----/{\e
11733         next;\e
11734       }\e
11735       {print}\e
11736     \e''
11737     print
11739 commandalias V '\e'call V
11743 When storing passwords in
11744 .Pa \*(ur
11745 appropriate permissions should be set on this file with
11746 .Ql $ chmod 0600 \*(ur .
11747 If the \*(OPal
11748 .Va netrc-lookup
11749 is available user credentials can be stored in the central
11750 .Pa .netrc
11751 file instead; e.g., here is a different version of the example account
11752 that sets up SMTP and POP3:
11754 .Bd -literal -offset indent
11755 define XandeX {
11756   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
11757   set from='Your Name <address@exam.ple>'
11758   set netrc-lookup
11759   # Load an encrypted ~/.netrc by uncommenting the next line
11760   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
11762   set mta=smtps://smtp.yXXXXx.ru:465 \e
11763       smtp-hostname= hostname=yXXXXx.com
11764   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
11765   commandalias xp fi pop3s://pop.yXXXXx.ru
11767 account XandeX {
11768   \ecall XandeX
11773 and, in the
11774 .Pa .netrc
11775 file:
11777 .Bd -literal -offset indent
11778 machine *.yXXXXx.ru login USER password PASS
11782 This configuration should now work just fine:
11785 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
11786 .\" }}}
11788 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
11789 .Ss "Signed and encrypted messages with S/MIME"
11791 \*(OP S/MIME provides two central mechanisms:
11792 message signing and message encryption.
11793 A signed message contains some data in addition to the regular text.
11794 The data can be used to verify that the message was sent using a valid
11795 certificate, that the sender's address in the message header matches
11796 that in the certificate, and that the message text has not been altered.
11797 Signing a message does not change its regular text;
11798 it can be read regardless of whether the recipient's software is able to
11799 handle S/MIME.
11802 It is thus usually possible to sign all outgoing messages if so desired.
11803 Encryption, in contrast, makes the message text invisible for all people
11804 except those who have access to the secret decryption key.
11805 To encrypt a message, the specific recipient's public encryption key
11806 must be known.
11807 It is therefore not possible to send encrypted mail to people unless their
11808 key has been retrieved from either previous communication or public key
11809 directories.
11810 A message should always be signed before it is encrypted.
11811 Otherwise, it is still possible that the encrypted message text is
11812 altered.
11815 A central concept to S/MIME is that of the certification authority (CA).
11816 A CA is a trusted institution that issues certificates.
11817 For each of these certificates it can be verified that it really
11818 originates from the CA, provided that the CA's own certificate is
11819 previously known.
11820 A set of CA certificates is usually delivered with OpenSSL and installed
11821 on your system.
11822 If you trust the source of your OpenSSL software installation,
11823 this offers reasonable security for S/MIME on the Internet.
11824 Otherwise set
11825 .Va smime-ca-no-defaults
11826 to avoid using the default certificate and point
11827 .Va smime-ca-file
11828 and/or
11829 .Va smime-ca-dir
11830 to a trusted pool of certificates.
11831 In general, a certificate cannot be more secure than the method its CA
11832 certificate has been retrieved with.
11835 The first thing you need for participating in S/MIME message exchange is
11836 your personal certificate, including a private key.
11837 The certificate contains public information, in particular your name and
11838 your email address(es), and the public key that is used by others to
11839 encrypt messages for you,
11840 and to verify signed messages they supposedly received from you.
11841 The certificate is included in each signed message you send.
11842 The private key must be kept secret.
11843 It is used to decrypt messages that were previously encrypted with your
11844 public key, and to sign messages.
11847 For personal use it is recommended that you get a S/MIME certificate
11848 from one of the major CAs on the Internet using your WWW browser.
11849 Many CAs offer such certificates for free.
11850 There is also
11851 .Lk https://www.CAcert.org
11852 which issues client and server certificates to members of their
11853 community for free; their root certificate
11854 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
11855 is often not in the default set of trusted CA root certificates, though,
11856 which means you will have to download their root certificate separately
11857 and ensure it is part of our S/MIME certificate validation chain by
11858 including it in
11859 .Va smime-ca-dir
11860 or as a vivid member of the
11861 .Va smime-ca-file .
11862 But let us take a step-by-step tour on how to setup S/MIME with
11863 a certificate from CAcert.org despite this situation!
11866 First of all you will have to become a member of the CAcert.org
11867 community, simply by registrating yourself via the web interface.
11868 Once you are, create and verify all email addresses you want to be able
11869 to create signed and encrypted messages for/with using the corresponding
11870 entries of the web interface.
11871 Now ready to create S/MIME certificates, so let us create a new
11872 .Dq client certificate ,
11873 ensure to include all email addresses that should be covered by the
11874 certificate in the following web form, and also to use your name as the
11875 .Dq common name .
11878 Create a private key and a certificate request on your local computer
11879 (please see the manual pages of the used commands for more in-depth
11880 knowledge on what the used arguments etc. do):
11883 .Dl openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
11886 Afterwards copy-and-paste the content of
11887 .Dq creq.pem
11888 into the certificate-request (CSR) field of the web form on the
11889 CAcert.org website (you may need to unfold some
11890 .Dq advanced options
11891 to see the corresponding text field).
11892 This last step will ensure that your private key (which never left your
11893 box) and the certificate belong together (through the public key that
11894 will find its way into the certificate via the certificate-request).
11895 You are now ready and can create your CAcert certified certificate.
11896 Download and store or copy-and-paste it as
11897 .Dq pub.crt .
11900 Yay.
11901 In order to use your new S/MIME setup a combined private key/public key
11902 (certificate) file has to be created:
11905 .Dl cat key.pem pub.crt > ME@HERE.com.paired
11908 This is the file \*(UA will work with.
11909 If you have created your private key with a passphrase then \*(UA will
11910 ask you for it whenever a message is signed or decrypted.
11911 Set the following variables to henceforth use S/MIME (setting
11912 .Va smime-ca-file
11913 is of interest for verification only):
11915 .Bd -literal -offset indent
11916 set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
11917   smime-sign-cert=ME@HERE.com.paired \e
11918   smime-sign-message-digest=SHA256 \e
11919   smime-sign
11923 From each signed message you send, the recipient can fetch your
11924 certificate and use it to send encrypted mail back to you.
11925 Accordingly if somebody sends you a signed message, you can do the same,
11926 and use the
11927 .Ic verify
11928 command to check the validity of the certificate.
11931 Variables of interest for S/MIME signing:
11932 .Va smime-ca-dir ,
11933 .Va smime-ca-file ,
11934 .Va smime-ca-flags ,
11935 .Va smime-ca-no-defaults ,
11936 .Va smime-crl-dir ,
11937 .Va smime-crl-file ,
11938 .Va smime-sign ,
11939 .Va smime-sign-cert ,
11940 .Va smime-sign-include-certs
11942 .Va smime-sign-message-digest .
11945 After it has been verified save the certificate via
11946 .Ic certsave
11947 and tell \*(UA that it should use it for encryption for further
11948 communication with that somebody:
11950 .Bd -literal -offset indent
11951 certsave FILENAME
11952 set smime-encrypt-USER@HOST=FILENAME \e
11953     smime-cipher-USER@HOST=AES256
11957 Additional variables of interest for S/MIME en- and decryption:
11958 .Va smime-cipher
11960 .Va smime-encrypt-USER@HOST .
11963 You should carefully consider if you prefer to store encrypted messages
11964 in decrypted form.
11965 If you do, anybody who has access to your mail folders can read them,
11966 but if you do not, you might be unable to read them yourself later if
11967 you happen to lose your private key.
11969 .Ic decrypt
11970 command saves messages in decrypted form, while the
11971 .Ic save , copy ,
11973 .Ic move
11974 commands leave them encrypted.
11977 Note that neither S/MIME signing nor encryption applies to message
11978 subjects or other header fields yet.
11979 Thus they may not contain sensitive information for encrypted messages,
11980 and cannot be trusted even if the message content has been verified.
11981 When sending signed messages,
11982 it is recommended to repeat any important header information in the
11983 message text.
11984 .\" }}}
11986 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
11987 .Ss "Using CRLs with S/MIME or SSL/TLS"
11989 \*(OP Certification authorities (CAs) issue certificate revocation
11990 lists (CRLs) on a regular basis.
11991 These lists contain the serial numbers of certificates that have been
11992 declared invalid after they have been issued.
11993 Such usually happens because the private key for the certificate has
11994 been compromised,
11995 because the owner of the certificate has left the organization that is
11996 mentioned in the certificate, etc.
11997 To seriously use S/MIME or SSL/TLS verification,
11998 an up-to-date CRL is required for each trusted CA.
11999 There is otherwise no method to distinguish between valid and
12000 invalidated certificates.
12001 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
12002 the Internet, so they have to be retrieved by some external mechanism.
12005 \*(UA accepts CRLs in PEM format only;
12006 CRLs in DER format must be converted, like, e.\|g.:
12009 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
12012 To tell \*(UA about the CRLs, a directory that contains all CRL files
12013 (and no other files) must be created.
12015 .Va smime-crl-dir
12017 .Va ssl-crl-dir
12018 variables, respectively, must then be set to point to that directory.
12019 After that, \*(UA requires a CRL to be present for each CA that is used
12020 to verify a certificate.
12021 .\" }}}
12023 .\" .Ss "Handling spam" {{{
12024 .Ss "Handling spam"
12026 \*(OP \*(UA can make use of several spam interfaces for the purpose of
12027 identification of, and, in general, dealing with spam messages.
12028 A precondition of most commands in order to function is that the
12029 .Va spam-interface
12030 variable is set to one of the supported interfaces.
12031 Once messages have been identified as spam their (volatile)
12032 .Ql is-spam
12033 state can be prompted: the
12034 .Ql Ar :s
12036 .Ql Ar :S
12037 message specifications will address respective messages and their
12038 .Va attrlist
12039 entries will be used when displaying the
12040 .Va headline
12041 in the header display.
12043 .Bl -bullet
12045 .Ic spamrate
12046 rates the given messages and sets their
12047 .Ql is-spam
12048 flag accordingly.
12049 If the spam interface offers spam scores those can also be displayed in
12050 the header display by including the
12051 .Ql %$
12052 format in the
12053 .Va headline
12054 variable.
12056 .Ic spamham ,
12057 .Ic spamspam
12059 .Ic spamforget
12060 will interact with the Bayesian filter of the chosen interface and learn
12061 the given messages as
12062 .Dq ham
12064 .Dq spam ,
12065 respectively; the last command can be used to cause
12066 .Dq unlearning
12067 of messages; it adheres to their current
12068 .Ql is-spam
12069 state and thus reverts previous teachings.
12071 .Ic spamclear
12073 .Ic spamset
12074 will simply set and clear, respectively, the mentioned volatile
12075 .Ql is-spam
12076 message flag, without any interface interaction.
12081 .Xr spamassassin 1
12082 based
12083 .Va spam-interface
12084 .Ql spamc
12085 requires a running instance of the
12086 .Xr spamd 1
12087 server in order to function, started with the option
12088 .Fl -allow-tell
12089 shall Bayesian filter learning be possible.
12091 .Bd -literal -offset indent
12092 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
12093 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
12094     --daemonize [--local] [--allow-tell]
12098 Thereafter \*(UA can make use of these interfaces:
12100 .Bd -literal -offset indent
12101 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
12102     -Sspamc-command=/usr/local/bin/spamc \e
12103     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
12105 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
12106     -Sspamc-command=/usr/local/bin/spamc \e
12107     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
12111 Using the generic filter approach allows usage of programs like
12112 .Xr bogofilter 1 .
12113 Here is an example, requiring it to be accessible via
12114 .Ev PATH :
12116 .Bd -literal -offset indent
12117 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
12118     -Sspamfilter-ham="bogofilter -n" \e
12119     -Sspamfilter-noham="bogofilter -N" \e
12120     -Sspamfilter-nospam="bogofilter -S" \e
12121     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
12122     -Sspamfilter-spam="bogofilter -s" \e
12123     -Sspamfilter-rate-scanscore="1;^(.+)$"
12127 Because messages must exist on local storage in order to be scored (or
12128 used for Bayesian filter training), it is possibly a good idea to
12129 perform the local spam check last:
12131 .Bd -literal -offset indent
12132 define spamdelhook {
12133   # Server side DCC
12134   spamset (header x-dcc-brand-metrics "bulk")
12135   # Server-side spamassassin(1)
12136   spamset (header x-spam-flag "YES")
12137   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
12138   move :S +maybe-spam
12139   spamrate :u
12140   del :s
12141   move :S +maybe-spam
12143 set folder-hook-FOLDER=spamdelhook
12147 See also the documentation for the variables
12148 .Va spam-interface , spam-maxsize ,
12149 .Va spamc-command , spamc-arguments , spamc-user ,
12150 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
12151   spamfilter-rate
12153 .Va spamfilter-rate-scanscore .
12154 .\" }}}
12155 .\" }}} (Examples)
12158 .\" .Sh "FAQ" {{{
12159 .Sh "FAQ"
12161 In general it is a good idea to turn on
12162 .Va debug
12163 .Pf ( Fl d )
12164 and / or
12165 .Va verbose
12166 .Pf ( Fl v ,
12167 twice) if something does not work well.
12168 Very often a diagnostic message can be produced that leads to the
12169 problems' solution.
12171 .\" .Ss "\*(UA shortly hangs on startup" {{{
12172 .Ss "\*(UA shortly hangs on startup"
12174 This can have two reasons, one is the necessity to wait for a file lock
12175 and cannot be helped, the other being that \*(UA calls the function
12176 .Xr uname 2
12177 in order to query the nodename of the box (sometimes the real one is
12178 needed instead of the one represented by the internal variable
12179 .Va hostname ) .
12180 One may have varying success by ensuring that the real hostname and
12181 .Ql localhost
12182 have entries in
12183 .Pa /etc/hosts ,
12184 or, more generally, that the name service is properly setup \(en
12185 and does
12186 .Xr hostname 1
12187 return the expected value?
12188 Does this local hostname has a domain suffix?
12189 RFC 6762 standardized the link-local top-level domain
12190 .Ql .local ,
12191 try again after adding an (additional) entry with this extension.
12192 .\" }}}
12194 .\" .Ss "\*(UA exits quick, and output is cleared away" {{{
12195 .Ss "\*(UA exits quick, and output is cleared away"
12197 When this happens even with
12198 .Va emptystart
12199 set, then this most likely indicates a problem with the creation of
12200 so-called dotlock files: setting
12201 .Va dotlock-ignore-error
12202 should overcome this situation.
12203 This only avoids symptoms, it does not address the problem, though.
12204 Since the output is cleared away \*(UA has support for
12205 .Sx "On terminal control and line editor" ,
12206 and switches to the
12207 .Dq ca-mode ,
12208 which causes the output clearance: by doing
12209 .Ql set termcap='smcup='
12210 this mode can be suppressed, and by setting
12211 .Va verbose
12212 (twice) the actual problem should be reported.
12213 .\" }}}
12215 .\" .Ss "I cannot login to Google mail aka GMail" {{{
12216 .Ss "I cannot login to Google mail aka GMail"
12218 Since 2014 some free service providers classify programs as
12219 .Dq less secure
12220 unless they use a special authentification method (OAuth 2.0) which
12221 was not standardized for non-HTTP protocol authentication token query
12222 until August 2015 (RFC 7628).
12225 Different to Kerberos / GSSAPI, which is developed since the mid of the
12226 1980s, where a user can easily create a local authentication ticket for
12227 her- and himself with the locally installed
12228 .Xr kinit 1
12229 program, that protocol has no such local part but instead requires
12230 a world-wide-web query to create or fetch a token; since there is no
12231 local cache this query would have to be performed whenever \*(UA is
12232 invoked (in interactive sessions situation may differ).
12235 \*(UA does not support OAuth.
12236 Because of this it is necessary to declare \*(UA a
12237 .Dq less secure app
12238 (on the providers account web page) in order to read and send mail.
12239 However, it also seems possible to take the following steps instead:
12242 .Bl -enum -compact
12244 give the provider the number of a mobile phone,
12246 enable
12247 .Dq 2-Step Verification ,
12249 create an application specific password (16 characters), and
12251 use that special password instead of the real Google account password in
12252 \*(UA (for more on that see the section
12253 .Sx "On URL syntax and credential lookup" ) .
12255 .\" }}}
12257 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
12258 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
12260 It can happen that the terminal library (see
12261 .Sx "On terminal control and line editor",
12262 .Ic bind ,
12263 .Va termcap )
12264 reports different codes than the terminal really sends, in which case
12265 \*(UA will tell that a key binding is functional, but will not be able to
12266 recognize it because the received data does not match anything expected.
12268 .Va verbose
12269 listing of
12270 .Ic bind Ns
12271 ings will show the byte sequences that are expected.
12274 To overcome the situation, use, e.g., the program
12275 .Xr cat 1 ,
12276 in conjunction with the command line option
12277 .Fl \&\&v ,
12278 if available, to see the byte sequences which are actually produced
12279 by keypresses, and use the variable
12280 .Va termcap
12281 to make \*(UA aware of them.
12282 E.g., the terminal this is typed on produces some false sequences, here
12283 an example showing the shifted home key:
12285 .Bd -literal -offset indent
12286 ? set verbose
12287 ? bind*
12288 # 1B 5B=[ 31=1 3B=; 32=2 48=H
12289   bind base :kHOM z0
12290 ? x
12291 $ cat -v
12292 ^[[H
12293 ? \*(uA -v -Stermcap='kHOM=\eE[H'
12294 ? bind*
12295 # 1B 5B=[ 48=H
12296   bind base :kHOM z0
12298 .\" }}}
12299 .\" }}}
12302 .\" .Sh "SEE ALSO" {{{
12303 .Sh "SEE ALSO"
12305 .Xr bogofilter 1 ,
12306 .Xr gpg 1 ,
12307 .Xr more 1 ,
12308 .Xr newaliases 1 ,
12309 .Xr openssl 1 ,
12310 .Xr sendmail 1 ,
12311 .Xr sh 1 ,
12312 .Xr spamassassin 1 ,
12313 .Xr iconv 3 ,
12314 .Xr setlocale 3 ,
12315 .Xr aliases 5 ,
12316 .Xr termcap 5 ,
12317 .Xr terminfo 5 ,
12318 .Xr locale 7 ,
12319 .Xr mailaddr 7 ,
12320 .Xr re_format 7 ,
12321 .Xr mailwrapper 8 ,
12322 .Xr sendmail 8
12323 .\" }}}
12326 .\" .Sh HISTORY {{{
12327 .Sh HISTORY
12329 M. Douglas McIlroy writes in his article
12330 .Dq A Research UNIX Reader: Annotated Excerpts \
12331 from the Programmer's Manual, 1971-1986
12333 .Xr mail 1
12334 command already appeared in First Edition
12336 in 1971:
12338 .Bd -ragged -offset indent
12339 Electronic mail was there from the start.
12340 Never satisfied with its exact behavior, everybody touched it at one
12341 time or another: to assure the safety of simultaneous access, to improve
12342 privacy, to survive crashes, to exploit uucp, to screen out foreign
12343 freeloaders, or whatever.
12344 Not until v7 did the interface change (Thompson).
12345 Later, as mail became global in its reach, Dave Presotto took charge and
12346 brought order to communications with a grab-bag of external networks
12347 (v8).
12352 Mail was written in 1978 by Kurt Shoens and developed as part of the
12355 distribution until 1995.
12356 Mail has then seen further development in open source
12358 variants, noticeably by Christos Zoulas in
12359 .Pf Net Bx .
12360 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
12361 Ritter in the years 2000 until 2008.
12362 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
12363 This man page is derived from
12364 .Dq The Mail Reference Manual
12365 that was originally written by Kurt Shoens.
12366 .\" }}}
12369 .Sh AUTHORS
12371 .An "Kurt Shoens" ,
12372 .An "Edward Wang" ,
12373 .An "Keith Bostic" ,
12374 .An "Christos Zoulas" ,
12375 .An "Gunnar Ritter" ,
12376 .An "Steffen Nurpmeso" .
12379 The variables
12380 .Va contact-mail
12382 .Va contact-web
12383 provide contact addresses:
12385 .\" v15-compat: drop eval as `mail' will expand variable?
12386 .Dl ? echo $contact-web; eval mail $contact-mail
12389 .\" .Sh CAVEATS {{{
12390 .Sh CAVEATS
12392 \*(ID Interrupting an operation via
12393 .Dv \&\&SIGINT
12395 .Ql control-C
12396 from anywhere else but a command prompt is very problematic and likely
12397 to leave the program in an undefined state: many library functions
12398 cannot deal with the
12399 .Fn siglongjmp 3
12400 that this software (still) performs; even though efforts have been taken
12401 to address this, no sooner but in v15 it will have been worked out:
12402 interruptions have not been disabled in order to allow forceful breakage
12403 of hanging network connections, for example (all this is unrelated to
12404 .Va ignore ) .
12407 The SMTP and POP3 protocol support of \*(UA is very basic.
12408 Also, if it fails to contact its upstream SMTP server, it will not make
12409 further attempts to transfer the message at a later time (setting
12410 .Va save
12412 .Va sendwait
12413 may be useful).
12414 If this is a concern, it might be better to set up a local SMTP server
12415 that is capable of message queuing.
12416 .\" }}}
12419 .Sh BUGS
12421 After deleting some message of a POP3 mailbox the header summary falsely
12422 claims that there are no messages to display, one needs to perform
12423 a scroll or dot movement to restore proper state.
12425 In threaded display a power user may encounter crashes very
12426 occasionally (this is may and very).
12428 The file
12429 .Pa TODO
12430 in the source repository lists future directions.
12431 .\" s-ts-mode