mx_tty_create_prompt()++: never prepend ERROR# to *prompt* (Stephen Isard)
[s-mailx.git] / nail.1
blobbe4c68cd341ad52f31bf417956ca4624180b6048
1 .\"@ nail.1 - S-nail(1) reference manual.
2 .\"
3 .\" Copyright (c) 2012 - 2020 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
4 .\" SPDX-License-Identifier: ISC
5 .\"
6 .\" Permission to use, copy, modify, and/or distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
9 .\"
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .\"
18 .\"--MKREL-START--
19 .\"@ S-nail v14.9.22 / 2021-02-24
20 .Dd February 24, 2021
21 .ds VV \\%v14.9.22
22 .\"--MKREL-END--
23 .\"--MKMAN-START--
24 .ds UU \\%S-NAIL
25 .ds UA \\%S-nail
26 .ds uA \\%s-nail
27 .ds UR \\%s-nail.rc
28 .ds ur \\%~/.mailrc
29 .ds VD \\%~/dead.letter
30 .ds VM \\%~/mbox
31 .ds VN \\%~/.netrc
32 .ds VT \\%/tmp
33 .ds vS /etc/mime.types
34 .ds vU ~/.mime.types
35 .\"--MKMAN-END--
36 .\" --BEGINSTRIP--
37 .\"
38 .ds BO (Boolean)
39 .ds CM (Compose mode)
40 .ds ID [v15 behaviour may differ]
41 .ds IN [v15-compat]
42 .ds NQ [Only new quoting rules]
43 .ds OB [Obsolete]
44 .ds OP [Option]
45 .ds OU [no v15-compat]
46 .ds RO (Read-only)
47 .ds SM (Send mode)
48 .\"
49 .if !d str-Lb-libterminfo \
50   .ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo)
52 .Dt "\*(UU" 1
53 .Os
54 .Mx -enable
57 .Sh NAME
58 .Nm \*(UA \%[\*(VV]
59 .Nd send and receive Internet mail
62 .\" .Sh SYNOPSIS {{{
63 .Sh SYNOPSIS
65 .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
66 .Nm \*(uA
67 .Bk -words
68 .Op Fl DdEFinv~#
69 .Op Fl \&: Ar spec
70 .Op Fl A Ar account
71 .Op : Ns Fl a Ar attachment Ns \&:
72 .Op : Ns Fl b Ar bcc-addr Ns \&:
73 .Op : Ns Fl C Ar """field:\0body""" Ns \&:
74 .Op : Ns Fl c Ar cc-addr Ns \&:
75 .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
76 .Op Fl r Ar from-addr
77 .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
78 .Op Fl s Ar subject
79 .Op : Ns Fl T Ar """field:\0addr""" Ns \&:
80 .Op : Ns Fl X Ar cmd Ns \&:
81 .Op : Ns Fl Y Ar cmd Ns \&:
82 .Op Fl \&.
83 .Pf : Ar to-addr Ns \&:
84 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
85 .Ek
86 .Pp
87 .Nm \*(uA
88 .Bk -words
89 .Op Fl DdEeHiNnRv~#
90 .Op Fl \&: Ar spec
91 .Op Fl A Ar account
92 .Op : Ns Fl C Ar """field:\0body""" Ns \&:
93 .Op Fl L Ar spec
94 .Op Fl r Ar from-addr
95 .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
96 .Op Fl u Ar user
97 .Op : Ns Fl X Ar cmd Ns \&:
98 .Op : Ns Fl Y Ar cmd Ns \&:
99 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
101 .Nm \*(uA
102 .Bk -words
103 .Op Fl DdEeHiNnRv~#
104 .Op Fl \&: Ar spec
105 .Op Fl A Ar account
106 .Op : Ns Fl C Ar """field:\0body""" Ns \&:
107 .Fl f
108 .Op Fl L Ar spec
109 .Op Fl r Ar from-addr
110 .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
111 .Op : Ns Fl X Ar cmd Ns \&:
112 .Op : Ns Fl Y Ar cmd Ns \&:
113 .Op Ar file
114 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
117 .Nm \*(uA
118 .Fl h | Fl Fl help
119 .Nm \*(uA
120 .Fl V | Fl Fl version
122 .\" }}}
125 .Mx -toc -tree html pdf ps xhtml
128 .\" .Sh DESCRIPTION {{{
129 .Sh DESCRIPTION
131 .Bd -filled -compact -offset indent
132 .Sy Note:
133 S-nail (\*(UA) will see major changes in v15.0 (circa 2022).
134 Some backward incompatibilities cannot be avoided.
135 .Sx COMMANDS
136 change to
137 .Sx "Shell-style argument quoting" ,
138 and shell metacharacters will become (more) meaningful.
139 Some commands accept new syntax today via
140 .Cm wysh
141 .Pf ( Sx "Command modifiers" ) .
142 Behaviour is flagged \*(IN and \*(OU,
143 .Ic set Ns
144 ting
145 .Va v15-compat
146 .Pf ( Sx "INTERNAL VARIABLES" )
147 will choose new behaviour when applicable;
148 giving it a value makes
149 .Cm wysh
150 an implied default.
151 \*(OB flags what will vanish.
153 .Sy Warning!
154 .Va v15-compat
155 (with value) will be a default in v14.10.0!
159 \*(UA provides a simple and friendly environment for sending and
160 receiving mail.
161 It is intended to provide the functionality of the POSIX
162 .Xr mailx 1
163 command, but is MIME capable and optionally offers extensions for
164 line editing, S/MIME, SMTP and POP3, among others.
165 \*(UA divides incoming mail into its constituent messages and allows
166 the user to deal with them in any order.
167 It offers many
168 .Sx COMMANDS
170 .Sx "INTERNAL VARIABLES"
171 for manipulating messages and sending mail.
172 It provides the user simple editing capabilities to ease the composition
173 of outgoing messages, and increasingly powerful and reliable
174 non-interactive scripting capabilities.
176 .\" .Ss "Options" {{{
177 .Ss "Options"
179 .Bl -tag -width ".It Fl BaNg"
181 .It Fl \&: Ar spec , Fl Fl resource-files Ns =..
182 Controls loading of (as via
183 .Ic source )
184 .Sx "Resource files" :
185 .Ar spec
186 is parsed case-insensitively, the letter
187 .Ql s
188 corresponds to the system wide
189 .Pa \*(UR ,
190 .Ql u
191 the user's personal file
192 .Pa \*(ur .
193 The (original) system wide resource is also compiled-in, accessible via
194 .Ql x .
195 The letters
196 .Ql -
198 .Ql /
199 disable usage of resource files.
200 Order matters, default is
201 .Ql su .
202 This option overrides
203 .Fl n .
206 .It Fl A Ar name , Fl Fl account Ns =..
207 Activate user
208 .Ic account
209 .Ar name
210 after program startup is complete (resource files loaded, only
211 .Fl X
212 commands are to be executed), and switch to its
213 .Mx -sx
214 .Sx "primary system mailbox"
215 (most likely the
216 .Va inbox ) .
217 If activation fails the program
218 .Pf e Ic xit Ns
219 s if used non-interactively, or if any of
220 .Va errexit
222 .Va posix
223 are set.
226 .It Fl a Ar file Ns Oo Ar =input-charset Ns Oo Ar #output-charset Oc Oc , \
227   Fl Fl attach Ns =..
228 \*(SM Attach
229 .Ar file .
230 For \*(CM opportunities refer to
231 .Ic ~@
233 .Ic ~^ .
234 .Ar file
235 is subject to tilde expansion (see
236 .Sx "Filename transformations"
238 .Ic folder ) ;
239 if it is not accessible but contains a
240 .Ql =
241 character, anything before the last
242 .Ql =
243 will be used as the filename, anything thereafter as a character set
244 specification, as shown.
246 If only an input character set
247 .Mx -ix "character set specification"
248 is specified, the input side is fixed, and no character set conversion
249 will be applied; an empty or the special string hyphen-minus
250 .Ql -
251 is taken for
252 .Va ttycharset
253 (the default).
254 If an output character set has also been specified the desired
255 conversion is performed immediately, not considering file type and
256 content, except for an empty string or hyphen-minus
257 .Ql - ,
258 which select the default conversion algorithm (see
259 .Sx "Character sets" ) :
260 no immediate conversion is performed,
261 .Ar file
262 and its contents will be MIME-classified
263 .Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files")
264 first \(em only the latter mode is available unless
265 .Va features
266 includes
267 .Ql ,+iconv, .
269 .It Fl B
270 (\*(OB: \*(UA will always use line-buffered output, to gain
271 line-buffered input even in batch mode enable batch mode via
272 .Fl # . )
275 .It Fl b Ar addr , Fl Fl bcc Ns =..
276 \*(SM Send a blind carbon copy to recipient
277 .Ar addr .
278 The option may be used multiple times.
279 Also see the section
280 .Sx "On sending mail, and non-interactive mode" .
283 .It Fl C Ar """field: body""" , Fl Fl custom-header Ns =..
284 Create a custom header which persists for an entire session.
285 A custom header consists of the field name followed by a colon
286 .Ql \&:
287 and the field content body, for example
288 .Ql -C """Blah: Neminem laede; imo omnes, quantum potes, juva""" .
289 Standard header field names cannot be overwritten by custom headers.
290 Runtime adjustable custom headers are available via the variable
291 .Va customhdr ,
292 and in \*(CM
293 .Ic ~^ ,
294 one of the
295 .Sx "COMMAND ESCAPES" ,
296 as well as
297 .Ic digmsg
298 are the most flexible and powerful options to manage message headers.
299 This option may be used multiple times.
302 .It Fl c Ar addr , Fl Fl cc Ns =..
303 \*(SM Just like
304 .Fl b ,
305 except it places the argument in the list of carbon copies.
308 .It Fl D , Fl Fl disconnected
309 \*(OP Startup with
310 .Va disconnected
311 .Ic set .
314 .It Fl d , Fl Fl debug
315 Enter a debug-only sandbox mode by setting the internal variable
316 .Va debug ;
317 the same can be achieved via
318 .Ql Fl S Va \&\&debug
320 .Ql Ic set Va \&\&debug .
321 Also see
322 .Fl v .
325 .It Fl E , Fl Fl discard-empty-messages
326 \*(SM
327 .Ic set
328 .Va skipemptybody
329 and thus discard messages with an empty message part body, successfully.
332 .It Fl e , Fl Fl check-and-exit
333 Just check if mail is present (in the system
334 .Va inbox
335 or the one specified via
336 .Fl f ) :
337 if yes, return an exit status of zero, a non-zero value otherwise.
338 To restrict the set of mails to consider in this evaluation a message
339 specification can be added with the option
340 .Fl L .
341 Quickrun: does not open an interactive session.
344 .It Fl F
345 \*(SM Save the message to send in a file named after the local part of
346 the first recipient's address (instead of in
347 .Va record Ns ).
350 .It Fl f , Fl Fl file
351 Read in the contents of the user's
352 .Mx -sx
353 .Sx "secondary mailbox"
354 .Ev MBOX
355 (or the specified file) for processing;
356 when \*(UA is quit, it writes undeleted messages back to this file
357 (but be aware of the
358 .Va hold
359 option).
360 The optional
361 .Ar file
362 argument will undergo some special
363 .Sx "Filename transformations"
364 (as via
365 .Ic folder ) .
366 Note that
367 .Ar file
368 is not an argument to the flag
369 .Fl \&\&f ,
370 but is instead taken from the command line after option processing has
371 been completed.
372 In order to use a
373 .Ar file
374 that starts with a hyphen-minus, prefix with a relative path, as in
375 .Ql ./-hyphenbox.mbox .
378 .It Fl H , Fl Fl header-summary
379 Display a summary of
380 .Ic headers
381 for the given
382 .Ic folder
383 (depending on
384 .Fl u ,
385 .Va inbox
387 .Ev MAIL ,
388 or as specified via
389 .Fl f ) ,
390 then exit.
391 A configurable summary view is available via the option
392 .Fl L .
393 This mode does not honour
394 .Va showlast .
395 Quickrun: does not open an interactive session.
398 .It Fl h , Fl Fl help
399 Show a brief usage summary; use
400 .Fl Fl long-help
401 for a list long options.
404 .It Fl i
405 .Ic set
406 .Va ignore
407 to ignore tty interrupt signals.
410 .It Fl L Ar spec , Fl Fl search Ns =..
411 Display a summary of
412 .Ic headers
413 of all messages that match the given
414 .Ar spec
415 in the
416 .Ic folder
417 found by the same algorithm used by
418 .Fl H ,
419 then exit.
420 See the section
421 .Sx "Specifying messages"
422 for the format of
423 .Ar spec .
424 This mode does not honour
425 .Va showlast .
427 If the
428 .Fl e
429 option has been given in addition no header summary is produced,
430 but \*(UA will instead indicate via its exit status whether
431 .Ar spec
432 matched any messages
433 .Pf ( Ql 0 )
434 or not
435 .Pf ( Ql 1 ) ;
436 note that any verbose output is suppressed in this mode and must instead
437 be enabled explicitly (see
438 .Fl v ) .
439 Quickrun: does not open an interactive session.
442 .It Fl M Ar type
443 \*(SM Will flag standard input with the MIME
444 .Ql Content-Type:
445 set to the given known
446 .Ar type
447 .Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files" )
448 and use it as the main message body.
449 \*(ID Using this option will bypass processing of
450 .Va message-inject-head
452 .Va message-inject-tail .
453 Also see
454 .Fl q , m , t .
457 .It Fl m Ar file
458 \*(SM MIME classify the specified
459 .Ar file
460 and use it as the main message body.
461 \*(ID Using this option will bypass processing of
462 .Va message-inject-head
464 .Va message-inject-tail .
465 Also see
466 .Fl q , M , t .
469 .It Fl N , Fl Fl no-header-summary
470 inhibit the initial display of message headers when reading mail or
471 editing a mailbox
472 .Ic folder
473 by calling
474 .Ic unset
475 for the internal variable
476 .Va header .
479 .It Fl n
480 Standard flag that inhibits reading the system wide
481 .Pa \*(UR
482 upon startup.
483 The option
484 .Fl \&:
485 allows more control over the startup sequence; also see
486 .Sx "Resource files" .
489 .It Fl q Ar file , Fl Fl quote-file Ns =..
490 \*(SM Initialize the message body with the contents of
491 .Ar file ,
492 which may be standard input
493 .Ql -
494 only in non-interactive context.
495 Also see
496 .Fl M , m , t .
499 .It Fl R , Fl Fl read-only
500 Any mailbox
501 .Ic folder
502 aka\&
503 .Ic folder
504 opened will be in read-only mode.
508 .It Fl r Ar from-addr , Fl Fl from-address Ns =..
509 The RFC 5321 reverse-path used for relaying and delegating messages to
510 its destination(s), for example to report delivery errors, is normally
511 derived from the address which appears in the
512 .Va from
513 header (or, if that contains multiple addresses, in
514 .Va sender ) .
515 A file-based aka local executable
516 .Va mta
517 (Mail-Transfer-Agent), however, instead uses the local identity of the
518 initiating user.
521 When this command line option is used the given single addressee
522 .Ar from-addr
523 will be assigned to the internal variable
524 .Va from ,
525 but in addition the command line option
526 .Fl \&\&f Ar from-addr
527 will be passed to a file-based
528 .Va mta
529 whenever a message is sent.
530 Shall
531 .Ar from-addr
532 include a user name the address components will be separated and
533 the name part will be passed to a file-based
534 .Va mta
535 individually via
536 .Fl \&\&F Ar name .
537 Even though not a recipient the
538 .Ql shquote
539 .Va expandaddr
540 flag is supported.
543 If an empty string is passed as
544 .Ar from-addr
545 then the content of the variable
546 .Va from
547 (or, if that contains multiple addresses,
548 .Va sender )
549 will be evaluated and used for this purpose whenever the file-based
550 .Va mta
551 is contacted.
552 By default, without
553 .Fl \&\&r
554 that is, neither
555 .Fl \&\&f
557 .Fl \&\&F
558 command line options are used when contacting a file-based MTA, unless
559 this automatic deduction is enforced by
560 .Ic set Ns
561 ting the internal variable
562 .Va r-option-implicit .
565 Remarks: many default installations and sites disallow overriding the
566 local user identity like this unless either the MTA has been configured
567 accordingly or the user is member of a group with special privileges.
568 Passing an invalid address will cause an error.
572 .It Fl S Ar var Ns Oo = Ns value Oc , Fl Fl set Ns =..
573 .Ic set
574 (or, with a prefix string
575 .Ql no ,
576 as documented in
577 .Sx "INTERNAL VARIABLES" ,
578 .Ic unset )
579 .Ar var Ns
580 iable and optionally assign
581 .Ar value ,
582 if supported; \*(ID the entire expression is evaluated as if specified
583 within dollar-single-quotes (see
584 .Sx "Shell-style argument quoting" )
585 if the internal variable
586 .Va v15-compat
587 is set.
588 If the operation fails the program will exit if any of
589 .Va errexit
591 .Va posix
592 are set.
593 Settings established via
594 .Fl \&\&S
595 cannot be changed from within
596 .Sx "Resource files"
597 or an account switch initiated by
598 .Fl A .
599 They will become mutable again before commands registered via
600 .Fl X
601 are executed.
604 .It Fl s Ar subject , Fl Fl subject Ns =..
605 \*(SM Specify the subject of the message to be sent.
606 Newline (NL) and carriage-return (CR) bytes are invalid and will be
607 normalized to space (SP) characters.
610 .It Fl T Ar """field: addr""" , Fl Fl target Ns =..
611 \*(SM Add
612 .Ar addr
613 to the list of receivers targeted by
614 .Ar field ,
615 for now supported are only
616 .Ql bcc ,
617 .Ql cc ,
618 .Ql fcc ,
620 .Ql to .
621 Field and body (address) are separated by a colon
622 .Ql \&:
623 and optionally blank (space, tabulator) characters.
625 .Ql shquote
626 .Va expandaddr
627 flag is supported.
628 .Ar addr
629 is parsed like a message header address line, as if it would be part of
630 a template message fed in via
631 .Fl t ,
632 and the same modifier suffix is supported.
633 This option may be used multiple times.
636 .It Fl t , Fl Fl template
637 \*(SM The text message given (on standard input) is expected to contain,
638 separated from the message body by an empty line, one or multiple
639 plain text message headers.
640 \*(ID Readily prepared MIME mail messages cannot be passed.
641 Headers can span multiple consecutive lines if follow lines start with
642 any amount of whitespace.
643 A line starting with the number sign
644 .Ql #
645 in the first column is ignored.
646 Message recipients can be given via the message headers
647 .Ql To: ,
648 .Ql Cc: ,
649 .Ql Bcc:
650 (the
651 .Ql ?single
652 modifier enforces treatment as a single addressee, for example
653 .Ql To?single: exa, <m@ple> )
655 .Ql Fcc: ,
656 they will be added to any recipients specified on the command line,
657 and are likewise subject to
658 .Va expandaddr
659 validity checks.
660 If a message subject is specified via
661 .Ql Subject:
662 then it will be used in favour of one given on the command line.
664 More optional headers are
665 .Ql Reply-To:
666 (possibly overriding
667 .Va reply-to ) ,
668 .Ql Sender:
669 .Pf ( Va sender ) ,
670 .Ql From:
671 .Pf ( Va from
672 and / or option
673 .Fl r ) .
674 .Ql Message-ID: ,
675 .Ql In-Reply-To: ,
676 .Ql References:
678 .Ql Mail-Followup-To: ,
679 by default created automatically dependent on message context, will
680 be used if specified (a special address massage will however still occur
681 for the latter).
682 Any other custom header field (also see
683 .Fl C ,
684 .Va customhdr
686 .Ic ~^ )
687 is passed through entirely
688 unchanged, and in conjunction with the options
689 .Fl ~
691 .Fl #
692 it is possible to embed
693 .Sx "COMMAND ESCAPES" .
694 Also see
695 .Fl M , m , q .
698 .It Fl u Ar user , Fl Fl inbox-of Ns =..
699 Initially read the
700 .Mx -sx
701 .Sx "primary system mailbox"
703 .Ar user ,
704 appropriate privileges presumed; effectively identical to
705 .Ql Fl \&\&f Ns \0%user .
708 .It Fl V , Fl Fl version
709 Show \*(UAs
710 .Va version
711 and exit.
712 The command
713 .Ic version
714 will also show the list of
715 .Va features :
716 .Ql $ \*(uA -:/ -Xversion -Xx .
719 .It Fl v , Fl Fl verbose
720 .Ic set Ns
721 s the internal variable
722 .Va verbose
723 to enable logging of informational context messages.
724 (Increases level of verbosity when used multiple times.)
725 Also see
726 .Fl d .
729 .It Fl X Ar cmd , Fl Fl startup-cmd Ns =..
730 Add the given (or multiple for a multiline argument)
731 .Ar cmd
732 to a list of commands to be executed before normal operation starts.
733 The commands will be evaluated as a unit, just as via
734 .Ic source .
735 Correlates with
736 .Fl #
738 .Va errexit .
741 .It Fl Y Ar cmd , Fl Fl cmd Ns =..
742 Add the given (or multiple for a multiline argument)
743 .Ar cmd
744 to a list of commands to be executed after normal operation has started.
745 The commands will be evaluated successively in the given order, and as
746 if given on the program's standard input \(em before interactive
747 prompting begins in interactive mode, after standard input has been
748 consumed otherwise.
751 .It Fl ~ , Fl Fl enable-cmd-escapes
752 Enable
753 .Sx "COMMAND ESCAPES"
754 in \*(CM even in non-interactive use cases.
755 This can for example be used to automatically format the composed
756 message text before sending the message:
757 .Bd -literal -offset indent
758 $ ( echo 'line    one. Word.     Word2.';\e
759     echo '~| /usr/bin/fmt -tuw66' ) |\e
760   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
764 .It Fl # , Fl Fl batch-mode
765 Enables batch mode: standard input is made line buffered, the complete
766 set of (interactive) commands is available, processing of
767 .Sx "COMMAND ESCAPES"
768 is enabled in
769 .Sx "Compose mode" ,
770 and diverse
771 .Sx "INTERNAL VARIABLES"
772 are adjusted for batch necessities, exactly as if done via
773 .Fl S :
774 .Va emptystart ,
775 .Pf no Va errexit ,
776 .Pf no Va header ,
777 .Pf no Va posix ,
778 .Va quiet ,
779 .Va sendwait ,
780 .Va typescript-mode
781 as well as
782 .Ev MAIL ,
783 .Ev MBOX
785 .Va inbox
786 (the latter three to
787 .Pa /dev/null ) .
788 Also, the values of
789 .Ev COLUMNS
791 .Ev LINES
792 are looked up, and acted upon.
793 The following prepares an email message in a batched dry run:
794 .Bd -literal -offset indent
795 $ for name in bob alice@exam.ple lisa@exam.ple; do
796     printf 'mail %s\en~s ubject\enText\en~.\en' "${name}"
797   done |
798   LC_ALL=C \*(uA -#:x -Smta=test \e
799     -X'alias bob bob@exam.ple'
803 .It Fl \&. , Fl Fl end-options
804 This flag forces termination of option processing in order to prevent
805 .Dq option injection
806 (attacks).
807 It also forcefully puts \*(UA into send mode, see
808 .Sx "On sending mail, and non-interactive mode" .
812 If the setting of
813 .Va expandargv
814 allows their recognition all
815 .Ar mta-option
816 arguments given at the end of the command line after a
817 .Ql --
818 separator will be passed through to a file-based
819 .Va mta
820 (Mail-Transfer-Agent) and persist for the entire session.
821 .Va expandargv
822 constraints do not apply to the content of
823 .Va mta-arguments .
824 Command line receiver address handling supports the
825 .Ql shquote
826 constraint of
827 .Va expandaddr ,
828 for more please see
829 .Sx "On sending mail, and non-interactive mode" .
831 .Bd -literal -offset indent
832 $ \*(uA -#:/ -X 'addrcodec enc Hey, ho <silver@go>' -Xx
834 .\" }}}
836 .\" .Ss "A starter" {{{ review
837 .Ss "A starter"
839 \*(UA is a direct descendant of
841 Mail, itself a successor to the Research
843 mail which
844 .Dq was there from the start
845 according to
846 .Sx HISTORY .
847 It thus represents the user side of the
849 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
850 traditionally taken by
851 .Xr sendmail 8
852 (and most MTAs provide a binary of this name for compatibility reasons).
853 If the \*(OPal SMTP
854 .Va mta
855 is included in the
856 .Va features
857 of \*(UA then the system side is not a mandatory precondition for mail
858 delivery.
861 \*(UA strives for compliance with the POSIX
862 .Xr mailx 1
863 standard, but
864 .Va posix ,
865 one of the
866 .Sx "INTERNAL VARIABLES" ,
867 or its
868 .Sx ENVIRONMENT Ns
869 al equivalent
870 .Ev POSIXLY_CORRECT ,
871 needs to be set to adjust behaviour to be almost on par.
872 Almost, because there is one important difference: POSIX
873 .Sx "Shell-style argument quoting"
874 is (\*(ID increasingly) used instead of the
875 .Sx "Old-style argument quoting"
876 that the standard documents, which is believed to be a feature.
877 The builtin as well as the (default) global
878 .Pa \*(UR
879 .Sx "Resource files"
880 already bend the standard imposed settings a bit.
883 For example,
884 .Va hold
886 .Va keepsave
888 .Ic set
889 in order to suppress the automatic moving of messages to the
890 .Mx -sx
891 .Sx "secondary mailbox"
892 .Ev MBOX
893 that would otherwise occur (see
894 .Sx "Message states" ) ,
896 .Va keep
897 to not remove empty system MBOX mailbox files (or all empty such files in
898 .Va posix
899 mode) to avoid mangling of file permissions when files eventually get
900 recreated.
903 To enter interactive mode even if the initial mailbox is empty
904 .Va emptystart
905 is set,
906 .Va editheaders
907 to allow editing of headers as well as
908 .Va fullnames
909 to not strip down addresses in
910 .Sx "Compose mode" ,
912 .Va quote
913 to include the message that is being responded to when
914 .Ic reply Ns
915 ing, which is indented by an
916 .Va indentprefix
917 that also deviates from standard imposed settings.
918 .Va mime-counter-evidence
919 is fully enabled, too.
920 It sets
921 .Va followup-to-honour
923 .Va reply-to-honour
924 to comply with reply address desires.
927 Credentials and other settings are easily addressable by grouping them via
928 .Ic account .
929 The file mode creation mask can be managed with
930 .Va umask .
931 Files and shell pipe output can be
932 .Ic source Ns
933 d for
934 .Ic eval Ns
935 uation, also during startup from within the
936 .Sx "Resource files" .
937 Informational context can be available by
938 .Ic set Ns
939 ting
940 .Va verbose
942 .Va debug
943 (as via
944 .Fl v , d ) .
945 .\" }}}
947 .\" .Ss "On sending mail, and non-interactive mode" {{{
948 .Ss "On sending mail, and non-interactive mode"
950 To send a message to one or more people, using a local or built-in
951 .Va mta
952 (Mail-Transfer-Agent) transport to actually deliver the generated mail
953 message, \*(UA can be invoked with arguments which are the names of
954 people to whom the mail will be sent, and the command line options
955 .Fl b
957 .Fl c
958 can be used to add (blind) carbon copy receivers:
960 .Bd -literal -offset indent
961 # Via test MTA
962 $ echo Hello, world | \*(uA -:/ -Smta=test -s test $LOGNAME
964 # Via sendmail(1) MTA
965 $ </dev/null \*(uA -:x -s test $LOGNAME
967 # Debug dry-run mode:
968 $ </dev/null LC_ALL=C \*(uA -d -:/ \e
969    -Sttycharset=utf8 -Sfullnames \e
970    -b bcc@exam.ple -c cc@exam.ple -. \e
971    '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
973 # With SMTP (no real sending due to -d debug dry-run)
974 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Sttycharset=utf8 \e
975     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
976     -S from=scriptreply@exam.ple \e
977     -a /etc/mail.rc --end-options \e
978     eric@exam.ple < /tmp/letter.txt
982 Email addresses and plain user names are subject to
983 .Ic alternates
984 filtering, names only are first expanded through
985 .Ic alias
987 .Va mta-aliases .
988 An address in angle brackets consisting only of a valid local user
989 .Ql <name>
990 will be converted to a fully qualified address if either
991 .Va hostname
992 is not set, or set to a non-empty value; if set to the empty value the
993 conversion is left up to the
994 .Va mta .
995 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
996 .\" grep the latter for the complete picture
997 By setting
998 .Va expandaddr
999 fine-grained control of recipient address types other than user names
1000 and network addresses is possible.
1001 Recipients are classified as follows:
1002 any name that starts with a vertical bar
1003 .Ql |
1004 character specifies a command pipe \(en the command string following the
1005 .Ql |
1006 is executed and the message is sent to its standard input;
1007 likewise, any name that consists only of hyphen-minus
1008 .Ql -
1009 or starts with the character solidus
1010 .Ql /
1011 or the character sequence dot solidus
1012 .Ql ./
1013 is treated as a file, regardless of the remaining content.
1014 Any other name which contains a commercial at
1015 .Ql @
1016 character is a network address;
1017 Any other name which starts with a plus sign
1018 .Ql +
1019 character is a mailbox name;
1020 Any other name which contains a solidus
1021 .Ql /
1022 character but no exclamation mark
1023 .Ql \&!
1024 or percent sign
1025 .Ql %
1026 character before is also a mailbox name;
1027 What remains is treated as a network address.
1028 This classification can be avoided by using a
1029 .Ql Fcc:
1030 header, see
1031 .Sx "Compose mode" .
1033 .Bd -literal -offset indent
1034 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1035 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1036 $ echo safe | LC_ALL=C \e
1037     \*(uA -:/ -Smta=test -Sv15-compat -Sttycharset=utf8 \e
1038       --set mime-force-sendout --set fullnames \e
1039       -S expandaddr=fail,-all,+addr,failinvaddr -s test \e
1040       --end-options 'Imagine John <cold@turk.ey>'
1044 Before messages are sent they undergo editing in
1045 .Sx "Compose mode" .
1046 But many settings are static and can be set more generally.
1047 The envelope sender address for example is defined by
1048 .Va from ,
1049 explicitly defining an originating
1050 .Va hostname
1051 may be desirable, especially with the built-in SMTP Mail-Transfer-Agent
1052 .Va mta .
1053 .Sx "Character sets"
1054 for outgoing message and MIME part content are configurable via
1055 .Va sendcharsets ,
1056 whereas input data is assumed to be in
1057 .Va ttycharset .
1058 Message data will be passed over the wire in a
1059 .Va mime-encoding ,
1060 and MIME parts aka attachments need a
1061 .Ic mimetype ,
1062 usually taken out of
1063 .Sx "The mime.types files" .
1064 Saving copies of sent messages in a
1065 .Va record
1066 mailbox may be desirable \(en as for most mailbox
1067 .Ic folder
1068 targets
1069 .Sx "Filename transformations"
1070 will be performed.
1073 For the purpose of arranging a complete environment of settings that can
1074 be switched to with a single command or command line option there are
1075 .Ic account Ns s .
1076 Alternatively a flat configuration could be possible, making use
1077 of so-called variable chains which automatically pick
1078 .Ql USER@HOST
1080 .Ql HOST
1081 context-dependent variants some variables support: for example addressing
1082 .Ql Ic Folder Ns \& pop3://yaa@exam.ple
1083 would find
1084 .Va \&\&pop3-no-apop-yaa@exam.ple ,
1085 .Va \&\&pop3-no-apop-exam.ple
1087 .Va pop3-no-apop
1088 in order.
1089 For more please see
1090 .Sx "On URL syntax and credential lookup"
1092 .Sx "INTERNAL VARIABLES" .
1095 To avoid environmental noise scripts should create a script-local
1096 environment, ideally with the command line options
1097 .Fl \&:
1098 to disable configuration files in conjunction with repetitions of
1099 .Fl S
1100 to specify variables:
1102 .Bd -literal -offset indent
1103 $ env LC_ALL=C \*(uA -:/ \e
1104     -Sv15-compat \e
1105     -Sttycharset=utf-8 -Smime-force-sendout \e
1106     -Sexpandaddr=fail,-all,failinvaddr \e
1107     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1108     -S from=scriptreply@exam.ple \e
1109     -s 'Subject to go' -a attachment_file \e
1110     -Sfullnames -. \e
1111     'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1112     < content_file
1116 As shown, scripts producing messages can
1117 .Dq fake
1118 a locale environment, the above specifies the all-compatible 7-bit clean
1119 .Ev LC_ALL
1120 .Dq C ,
1121 but will nonetheless take and send UTF-8 in the message text by using
1122 .Va ttycharset .
1123 If character set conversion is compiled in
1124 .Pf ( Va features
1125 includes the term
1126 .Ql ,+iconv, )
1127 invalid (according to
1128 .Va ttycharset )
1129 character input data would normally cause errors; setting
1130 .Va mime-force-sendout
1131 will instead, as a last resort, classify the input as binary data, and
1132 therefore allow message creation to be successful.
1133 (Such content can then be inspected either by installing a
1134 .Va pipe-TYPE/SUBTYPE
1135 handler for
1136 .Ql application/octet-stream ,
1137 or possibly automatically through
1138 .Va mime-counter-evidence ) .
1141 In interactive mode, introduced soon, messages can be sent by calling the
1142 .Ic mail
1143 command with a list of recipient addresses:
1145 .Bd -literal -offset indent
1146 $ \*(uA -:/ -Squiet -Semptystart -Sfullnames -Smta=test
1147 "/var/spool/mail/user": 0 messages
1148 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1149 \&...
1150 ? # Will do the right thing (tm)
1151 ? m rec1@exam.ple rec2@exam.ple
1153 .\" }}}
1155 .\" .Ss "Compose mode" {{{
1156 .Ss "Compose mode"
1158 If standard input is a terminal rather than the message to be sent,
1159 the user is expected to type in the message contents.
1160 In compose mode lines beginning with the character
1161 .Ql ~
1162 (in fact the value of
1163 .Va escape )
1164 are special \(en these are so-called
1165 .Sx "COMMAND ESCAPES"
1166 which can be used to read in files, process shell commands, add and edit
1167 attachments and more.
1168 For example
1169 .Ic ~v
1171 .Ic ~e
1172 will start the
1173 .Ev VISUAL
1174 text
1175 .Ev EDITOR ,
1176 respectively, to revise the message in its current state,
1177 .Ic ~h
1178 allows editing of the most important message headers, with the potent
1179 .Ic ~^
1180 custom headers can be created, for example (more specifically than with
1181 .Fl C
1183 .Va customhdr ) .
1184 \*(OPally
1185 .Ic ~?
1186 gives an overview of most other available command escapes.
1189 To create file-carbon-copies the special recipient header
1190 .Ql Fcc:
1191 may be used as often as desired, for example via
1192 .Ic ~^ .
1193 Its entire value (or body in standard terms) is interpreted as a
1194 .Ic folder
1195 target, after having been subject to
1196 .Sx "Filename transformations" :
1197 this is the only way to create a file-carbon-copy without introducing an
1198 ambiguity regarding the interpretation of the address, file names with
1199 leading vertical bars or commercial ats can be used.
1200 Like all other recipients
1201 .Ql Fcc:
1202 is subject to the checks of
1203 .Va expandaddr .
1204 Any local file and pipe command addressee honours the setting of
1205 .Va mbox-fcc-and-pcc .
1208 Once finished with editing the command escape
1209 .Ic ~.
1210 (see there) will call hooks, insert automatic injections and receivers,
1211 leave compose mode and send the message once it is completed.
1212 Aborting letter composition is possible with either of
1213 .Ic ~x
1215 .Ic ~q ,
1216 the latter of which will save the message in the file denoted by
1217 .Ev DEAD
1218 unless
1219 .Pf no Va save
1220 is set.
1221 And unless
1222 .Va ignoreeof
1223 is set the effect of
1224 .Ic ~.
1225 can also be achieved by typing end-of-transmission (EOT) via
1226 .Ql control-D
1227 .Pf ( Ql ^D )
1228 at the beginning of an empty line, and
1229 .Ic ~q
1230 is always reachable by typing end-of-text (ETX) twice via
1231 .Ql control-C
1232 .Pf ( Ql ^C ) .
1235 The compose mode hooks
1236 .Va on-compose-enter , on-compose-splice , on-compose-leave
1238 .Va on-compose-cleanup
1239 may be set to
1240 .Ic define Ns
1241 d macros and provide reliable and increasingly powerful mechanisms to
1242 perform automated message adjustments dependent on message context,
1243 for example addition of message signatures
1244 .Pf ( Va message-inject-head , message-inject-tail )
1245 or creation of additional receiver lists (also by setting
1246 .Va autocc , autobcc ) .
1247 To achieve that the command
1248 .Ic digmsg
1249 may be used in order to query and adjust status of message(s).
1250 The splice hook can also make use of
1251 .Sx "COMMAND ESCAPES" .
1252 (\*(ID The compose mode hooks work for
1253 .Ic forward , mail , reply
1254 and variants;
1255 .Ic resend
1257 .Ic Resend
1258 only provide the hooks
1259 .Va on-resend-enter
1261 .Va on-resend-cleanup ,
1262 which are pretty restricted due to the nature of the operation.)
1263 .\" }}}
1265 .\" .Ss "On reading mail, and more on interactive mode" {{{
1266 .Ss "On reading mail, and more on interactive mode"
1268 When invoked without addressees \*(UA enters interactive mode in which
1269 mails may be read.
1270 When used like that the user's system
1271 .Va inbox
1272 (for more on mailbox types please see the command
1273 .Ic folder )
1274 is read in and a one line header of each message therein is displayed if
1275 the variable
1276 .Va header
1277 is set.
1278 The visual style of this summary of
1279 .Ic headers
1280 can be adjusted through the variable
1281 .Va headline
1282 and the possible sorting criterion via
1283 .Va autosort .
1284 Scrolling through
1285 .Va screen Ns
1286 fuls of
1287 .Ic headers
1288 can be performed with the command
1289 .Ic z .
1290 If the initially opened mailbox is empty \*(UA will instead exit
1291 immediately (after displaying a message) unless the variable
1292 .Va emptystart
1293 is set.
1296 At the
1297 .Va prompt
1298 the command
1299 .Ic list
1300 will give a listing of all available commands and
1301 .Ic help
1302 will \*(OPally give a summary of some common ones.
1303 If the \*(OPal documentation strings are available (see
1304 .Va features )
1305 one can type
1306 .Ql help X
1307 .Pf "(or " Ql \&?X )
1308 and see the actual expansion of
1309 .Ql X
1310 and what its purpose is, i.e., commands can be abbreviated
1311 (note that POSIX defines some abbreviations, so that the alphabetical
1312 order of commands does not necessarily relate to the abbreviations; it is
1313 however possible to define overwrites with
1314 .Ic commandalias ) .
1315 These commands can also produce a more
1316 .Va verbose
1317 output.
1320 Messages are given numbers (starting at 1) which uniquely identify
1321 messages; the current message \(en the
1322 .Dq dot
1323 \(en will either be the first new message, or the first unread message,
1324 or the first message of the mailbox; the internal variable
1325 .Va showlast
1326 will instead cause usage of the last message for this purpose.
1327 The command
1328 .Ic headers
1329 will display a
1330 .Va screen Ns
1331 ful of header summaries containing the
1332 .Dq dot ,
1333 whereas
1334 .Ic from
1335 will display only the summaries of the given messages, defaulting to the
1336 .Dq dot .
1339 Message content can be displayed with the command
1340 .Ic type
1341 .Pf ( Ql t ,
1342 alias
1343 .Ic print ) .
1344 Here the variable
1345 .Va crt
1346 controls whether and when \*(UA will use the configured
1347 .Ev PAGER
1348 for display instead of directly writing to the user terminal
1349 .Va screen ,
1350 the sole difference to the command
1351 .Ic more ,
1352 which will always use the
1353 .Ev PAGER .
1354 The command
1355 .Ic top
1356 will instead only show the first
1357 .Va toplines
1358 of a message (maybe even compressed if
1359 .Va topsqueeze
1360 is set).
1361 Message display experience may improve by setting and adjusting
1362 .Va mime-counter-evidence ,
1363 and also see
1364 .Sx "HTML mail and MIME attachments" .
1367 By default the current message
1368 .Pf ( Dq dot )
1369 is displayed, but like with many other commands it is possible to give
1370 a fancy message specification (see
1371 .Sx "Specifying messages" ) ,
1372 for example
1373 .Ql t:u
1374 will display all unread messages,
1375 .Ql t.
1376 will display the
1377 .Dq dot ,
1378 .Ql t 1 5
1379 will type the messages 1 and 5,
1380 .Ql t 1-5
1381 will type the messages 1 through 5, and
1382 .Ql t-
1384 .Ql t+
1385 will display the previous and the next message, respectively.
1386 The command
1387 .Ic search
1388 (a more substantial alias for
1389 .Ic from )
1390 will display a header summary of the given message specification list
1391 instead of their content; the following will search for subjects:
1394 .Dl ? from "'@Some subject to search for'"
1397 In the default setup all header fields of a message will be
1398 .Ic type Ns
1399 d, but fields can be white- or blacklisted for a variety of
1400 applications by using the command
1401 .Ic headerpick ,
1402 e.g., to restrict their display to a very restricted set for
1403 .Ic type :
1404 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1405 In order to display all header fields of a message regardless of
1406 currently active ignore or retain lists, use the commands
1407 .Ic Type
1409 .Ic Top ;
1410 .Ic Show
1411 will show the raw message content.
1412 Note that historically the global
1413 .Pa \*(UR
1414 not only adjusts the list of displayed headers, but also sets
1415 .Va crt .
1416 (\*(ID A yet somewhat restricted) Reliable scriptable message
1417 inspection is available via
1418 .Ic digmsg .
1421 Dependent upon the configuration a line editor (see the section
1422 .Sx "On terminal control and line editor" )
1423 aims at making the user experience with the many
1424 .Sx COMMANDS
1425 a bit nicer.
1426 When reading the system
1427 .Va inbox ,
1428 or when
1429 .Fl f
1431 .Ic folder )
1432 specified a mailbox explicitly prefixed with the special
1433 .Ql %:
1434 modifier (to propagate it to a
1435 .Mx -sx
1436 .Sx "primary system mailbox" ) ,
1437 then messages which have been read
1438 .Pf (see\0 Sx "Message states" )
1439 will be automatically moved to a
1440 .Mx -sx
1441 .Sx "secondary mailbox" ,
1442 the user's
1443 .Ev MBOX
1444 file, when the mailbox is left, either by changing the active mailbox or
1445 by quitting \*(UA \(en this automatic moving from a system- or primary-
1446 to the secondary mailbox is not performed when the variable
1447 .Va hold
1448 is set.
1449 Messages can also be explicitly
1450 .Ic move Ns
1451 d to other mailboxes, whereas
1452 .Ic copy
1453 keeps the original message.
1454 .Ic write
1455 can be used to write out data content of specific parts of messages.
1458 After examining a message the user can
1459 .Ic reply Ql r
1460 to the sender and all recipients (which will also be placed in
1461 .Ql To:
1462 unless
1463 .Va recipients-in-cc
1464 is set), or
1465 .Ic Reply Ql R
1466 exclusively to the sender(s).
1467 To comply with with the receivers desired reply address the
1468 .Mx -sx
1469 .Sx quadoption Ns
1471 .Va followup-to-honour
1473 .Va reply-to-honour
1474 should usually be set.
1475 The commands
1476 .Ic Lreply
1478 .Ic Lfollowup
1479 know how to apply a special addressee massage, see
1480 .Sx "Mailing lists" .
1481 Dependent on the presence and value of
1482 .Va quote
1483 the message being replied to will be included in a quoted form.
1484 .Ic forward Ns
1485 ing a message will allow editing the new message: the original message
1486 will be contained in the message body, adjusted according to
1487 .Ic headerpick .
1488 It is possible to
1489 .Ic resend
1491 .Ic Resend
1492 messages: the former will add a series of
1493 .Ql Resent-
1494 headers, whereas the latter will not; different to newly created
1495 messages editing is not possible and no copy will be saved even with
1496 .Va record
1497 unless the additional variable
1498 .Va record-resent
1499 is set.
1500 When sending, replying or forwarding messages comments and full names
1501 will be stripped from recipient addresses unless the internal variable
1502 .Va fullnames
1503 is set.
1506 Of course messages can be
1507 .Ic delete Ql d ,
1508 and they can spring into existence again via
1509 .Ic undelete ,
1510 or when the \*(UA session is ended via the
1511 .Ic exit
1513 .Ic xit
1514 commands to perform a quick program termation.
1515 To end a mail processing session regularly and perform a full program
1516 exit one may issue the command
1517 .Ic quit .
1518 It will, among others, move read messages to the
1519 .Mx -sx
1520 .Sx "secondary mailbox"
1521 .Ev MBOX
1522 as necessary, discard deleted messages in the current mailbox,
1523 and update the \*(OPal (see
1524 .Va features )
1525 line editor
1526 .Va history-file .
1527 By the way, whenever the main event loop is about to look out for the
1528 next input line it will trigger the hook
1529 .Va on-main-loop-tick .
1530 .\" }}}
1532 .\" .Ss "HTML mail and MIME attachments" {{{ review
1533 .Ss "HTML mail and MIME attachments"
1535 HTML-only messages become more and more common, and many messages come
1536 bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions)
1537 parts and attachments.
1538 To get a notion of MIME types \*(UA has a default set of types built-in,
1539 onto which the content of
1540 .Sx "The mime.types files"
1541 will be added (as configured and allowed by
1542 .Va mimetypes-load-control ) .
1543 Types can also become registered with the command
1544 .Ic mimetype .
1545 To improve interaction with the faulty MIME part declarations of real life
1546 .Va mime-counter-evidence
1547 will allow verification of the given assertion, and the possible
1548 provision of an alternative, better MIME type.
1551 Whereas a simple HTML-to-text filter for displaying HTML messages is
1552 \*(OPally supported (indicated by
1553 .Ql ,+filter-html-tagsoup,
1555 .Va features ) ,
1556 MIME types other than plain text cannot be handled directly.
1557 Instead programs need to become registered to deal with specific MIME
1558 types or file extensions, either to prepare (re-)integrable plain text
1559 versions of their input (a mode which is called
1560 .Cd copiousoutput ) ,
1561 or to display the content externally, for example in a graphical window:
1562 the latter type is only considered by and for the command
1563 .Ic mimeview .
1566 To install a handler program for a MIME type an according
1567 .Va pipe-TYPE/SUBTYPE
1568 variable needs to be set; to define a handler for a file extension
1569 .Va pipe-EXTENSION
1570 can be used \(en these handlers take precedence.
1571 \*(OPally mail user agent configuration is supported (see
1572 .Sx "The Mailcap files" ) ,
1573 and will be queried for display or quote handlers after the former ones.
1574 Type-markers registered via
1575 .Ic mimetype
1576 are the last possible source for information how to handle a MIME type.
1579 For example, to display HTML messages integrated via the text browsers
1580 .Xr lynx 1
1582 .Xr elinks 1 ,
1583 register a MathML MIME type and enable its plain text display, and to
1584 open PDF attachments in an external PDF viewer, asynchronously and with
1585 some other magic attached:
1587 .Bd -literal -offset indent
1588 ? if "$features" !% ,+filter-html-tagsoup,
1589 ?   #set pipe-text/html='?* elinks -force-html -dump 1'
1590 ?   set pipe-text/html='?* lynx -stdin -dump -force_html'
1591 ?   # Display HTML as plain text instead
1592 ?   #set pipe-text/html=?t
1593 ? endif
1594 ? mimetype ?t application/mathml+xml mathml
1595 ? wysh set pipe-application/pdf='?&=? \e
1596     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1597     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1598     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1600 .\" }}}
1602 .\" .Ss "Mailing lists" {{{
1603 .Ss "Mailing lists"
1605 Known or subscribed-to mailing lists may be flagged in the summary of
1606 .Ic headers
1607 .Pf ( Va headline
1608 format character
1609 .Ql %L ) ,
1610 and will gain special treatment when sending mails: the variable
1611 .Va followup-to-honour
1612 will ensure that a
1613 .Ql Mail-\:Followup-\:To:
1614 header is honoured when a message is being replied to
1615 .Pf ( Ic reply ,
1616 .Ic followup ,
1617 .Ic Lreply ,
1618 .Ic Lfollowup ) ,
1620 .Va followup-to
1621 controls creation of this header when creating
1622 .Ic mail Ns
1623 s, if the necessary user setup
1624 .Pf ( from , sender ) ;
1625 is available; then, it may also be created automatically, for example
1626 when list-replying via
1627 .Ic Lreply
1629 .Ic Lfollowup ,
1630 when
1631 .Ic followup
1633 .Ic reply
1634 is used and the messages
1635 .Ql Mail-Followup-To:
1636 is honoured etc.
1639 The commands
1640 .Ic mlist
1642 .Ic mlsubscribe
1643 manage \*(UAs notion of which addresses are mailing lists.
1644 With the \*(OPal regular expression support any address
1645 .Mx -ix "magic regular expression characters"
1646 which contains any of the magic regular expression characters
1647 .Ql ( ^[*+?|$ ;
1649 .Xr re_format 7
1651 .Xr regex 7 ,
1652 dependent on the host system)
1653 will be compiled and used as one, possibly matching many addresses.
1654 It is not possible to escape the
1655 .Dq magic :
1656 in order to match special characters as-is, bracket expressions must be
1657 used, for example
1658 .Ql Ic search Li @subject@'[[]open bracket' .
1660 .Bd -literal -offset indent
1661 ? set followup-to followup-to-honour=ask-yes \e
1662     reply-to-honour=ask-yes
1663 ? mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1664 ? mlsubscribe a4@b4.c4 exact@lists.c3
1668 Known and subscribed lists differ in that for the latter the
1669 .Va user Ns
1670 s address is not part of a generated
1671 .Ql Mail-Followup-To: .
1672 There are exceptions, for example if multiple lists are addressed and
1673 not all have the subscription attribute.
1674 When replying to a message its list address
1675 .Pf ( Ql List-Post:
1676 header) is automatically and temporarily treated like a known
1677 .Ic mlist ;
1678 dependent on the variable
1679 .Va reply-to-honour
1680 an existing
1681 .Ql Reply-To:
1682 is used instead (if it is a single address on the same domain as
1683 .Ql List-Post: )
1684 in order to accept a list administrator's wish that is supposed to have
1685 been manifested like that.
1688 For convenience and compatibility with mail programs that do not honour
1689 the non-standard M-F-T, an automatic user entry in the carbon-copy
1690 .Ql Cc:
1691 address list of generated message can be created by setting
1692 .Va followup-to-add-cc .
1693 This entry will be added whenever the user will be placed in the
1694 .Ql Mail-Followup-To:
1695 list, and is not a regular addressee already.
1696 .Va reply-to-swap-in
1697 tries to deal with the address rewriting that many mailing-lists nowadays
1698 perform to work around DKIM / DMARC etc. standard imposed problems.
1699 .\" }}}
1701 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1702 .Ss "Signed and encrypted messages with S/MIME"
1704 \*(OP S/MIME provides two central mechanisms:
1705 message signing and message encryption.
1706 A signed message contains some data in addition to the regular text.
1707 The data can be used to verify that the message has been sent using
1708 a valid certificate, that the sender address matches that in the
1709 certificate, and that the message text has not been altered.
1710 Signing a message does not change its regular text;
1711 it can be read regardless of whether the recipients software is able to
1712 handle S/MIME.
1713 It is thus usually possible to sign all outgoing messages if so desired.
1716 Encryption, in contrast, makes the message text invisible for all people
1717 except those who have access to the secret decryption key.
1718 To encrypt a message, the specific recipients public encryption key
1719 must be known.
1720 It is therefore not possible to send encrypted mail to people unless their
1721 key has been retrieved from either previous communication or public key
1722 directories.
1723 Because signing is performed with private keys, and encryption with
1724 public keys, messages should always be signed before being encrypted.
1727 A central concept to S/MIME is that of the certification authority (CA).
1728 A CA is a trusted institution that issues certificates.
1729 For each of these certificates it can be verified that it really
1730 originates from the CA, provided that the CA's own certificate is
1731 previously known.
1732 A set of CA certificates is usually delivered and installed together
1733 with the cryptographical library that is used on the local system.
1734 Therefore reasonable security for S/MIME on the Internet is provided if
1735 the source that provides that library installation is trusted.
1736 It is also possible to use a specific pool of trusted certificates.
1737 If this is desired,
1738 .Va smime-ca-no-defaults
1739 should be set to avoid using the default certificate pool, and
1740 .Va smime-ca-file
1741 and/or
1742 .Va smime-ca-dir
1743 should be pointed to a trusted pool of certificates.
1744 A certificate cannot be more secure than the method its CA certificate
1745 has been retrieved with.
1748 This trusted pool of certificates is used by the command
1749 .Ic verify
1750 to ensure that the given S/MIME messages can be trusted.
1751 If so, verified sender certificates that were embedded in signed
1752 messages can be saved locally with the command
1753 .Ic certsave ,
1754 and used by \*(UA to encrypt further communication with these senders:
1756 .Bd -literal -offset indent
1757 ? certsave FILENAME
1758 ? set smime-encrypt-USER@HOST=FILENAME \e
1759     smime-cipher-USER@HOST=AES256
1763 To sign outgoing messages, in order to allow receivers to verify the
1764 origin of these messages, a personal S/MIME certificate is required.
1765 \*(UA supports password-protected personal certificates (and keys), see
1766 .Va smime-sign-cert .
1767 The section
1768 .Sx "On URL syntax and credential lookup"
1769 gives an overview of the possible sources of user credentials, and
1770 .Sx "S/MIME step by step"
1771 shows examplarily how a private S/MIME certificate can be obtained.
1772 In general, if such a private key plus certificate
1773 .Dq pair
1774 is available, all that needs to be done is to set some variables:
1776 .Bd -literal -offset indent
1777 ? set smime-sign-cert=ME@exam.ple.paired \e
1778     smime-sign-digest=SHA512 \e
1779     smime-sign from=myname@my.host
1783 Variables of interest for S/MIME in general are
1784 .Va smime-ca-dir ,
1785 .Va smime-ca-file ,
1786 .Va smime-ca-flags ,
1787 .Va smime-ca-no-defaults ,
1788 .Va smime-crl-dir ,
1789 .Va smime-crl-file .
1790 For S/MIME signing of interest are
1791 .Va smime-sign ,
1792 .Va smime-sign-cert ,
1793 .Va smime-sign-include-certs
1795 .Va smime-sign-digest .
1796 Additional variables of interest for S/MIME en- and decryption:
1797 .Va smime-cipher
1799 .Va smime-encrypt-USER@HOST .
1800 Variables of secondary interest may be
1801 .Va content-description-smime-message
1803 .Va content-description-smime-signature .
1804 S/MIME is available if
1805 .Ql ,+smime,
1806 is included in
1807 .Va features .
1810 \*(ID Note that neither S/MIME signing nor encryption applies to
1811 message subjects or other header fields yet.
1812 Thus they may not contain sensitive information for encrypted messages,
1813 and cannot be trusted even if the message content has been verified.
1814 When sending signed messages,
1815 it is recommended to repeat any important header information in the
1816 message text.
1817 .\" }}}
1819 .\" .Ss "On URL syntax and credential lookup" {{{ review
1820 .Ss "On URL syntax and credential lookup"
1822 For accessing protocol-specific resources Uniform Resource Locators
1823 (URL, RFC 3986) have become omnipresent.
1824 Here they are expected in a
1825 .Dq normalized
1826 variant, not used in data exchange, but only meant as a compact,
1827 easy-to-use way of defining and representing information in a well-known
1828 notation; as such they do not conform to any real standard.
1829 Optional parts are placed in brackets
1830 .Ql [] ,
1831 optional either because there also exist other ways to define the
1832 information, or because the part is protocol specific.
1833 .Ql /path
1834 for example is used by the \*(OPal Maildir
1835 .Ic folder
1836 type and the IMAP protocol, but not by POP3.
1838 .Ql USER
1840 .Ql PASSWORD
1841 are included in an URL server specification, URL percent encoded
1842 (RFC 3986) forms are needed, generable with
1843 .Ic urlcodec .
1846 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1849 Often
1850 .Sx "INTERNAL VARIABLES"
1851 exist in multiple versions, called
1852 .Dq variable chains
1853 in this document: the plain
1854 .Ql variable
1855 as well as
1856 .Ql variable-HOST
1858 .Ql variable-USER@HOST .
1859 If a port was specified
1860 .Ql HOST
1861 really means
1862 .Ql server:port ,
1864 .Ql server .
1865 And this
1866 .Ql USER
1867 is never in URL percent encoded form.
1868 For example, whether the hypothetical
1869 .Ql smtp://\:wings\:%3A\:of\:@a.dove
1870 including user and password was used, or whether it was
1871 .Ql smtp://a.dove
1872 and it came from a different source, to lookup the chain
1873 .Va tls-config-pairs
1874 first
1875 .Ql tls-\:config-\:pairs-\:wings:of@a.dove
1876 is looked up, then
1877 .Ql tls-\:config-pairs\-\:a.dove ,
1878 before finally looking up the plain variable.
1881 The logic to collect (an
1882 .Ic account Ns
1883 s) credential information is as follows:
1885 .Bl -bullet
1887 A user is always required.
1888 If no
1889 .Ql USER
1890 has been given in the URL the variables
1891 .Va user-HOST
1893 .Va user
1894 are looked up.
1895 Afterwards, when enforced by the \*(OPal variables
1896 .Va netrc-lookup-HOST
1898 .Va netrc-lookup ,
1899 .Sx "The .netrc file"
1900 of the user will be searched for a
1901 .Ql HOST
1902 specific entry which provides a
1903 .Ql login
1904 name: only unambiguous entries are used (one possible matching entry for
1905 .Ql HOST ) .
1907 If there is still no
1908 .Ql USER
1909 then the verified
1910 .Ev LOGNAME ,
1911 known to be a valid user on the current host, is used.
1914 Authentication: unless otherwise noted the chain
1915 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1916 is checked, falling back to a protocol-specific default as necessary.
1919 If no
1920 .Ql PASSWORD
1921 has been given in the URL, then if the
1922 .Ql USER
1923 has been found through the \*(OPal
1924 .Va netrc-lookup ,
1925 that may have also provided the password.
1926 Otherwise the chain
1927 .Va password-USER@HOST , password-HOST , password
1928 is looked up.
1930 Thereafter the (now complete) \*(OPal chain
1931 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1932 is checked, if set the
1933 .Ic netrc
1934 cache is searched for a password only (multiple user accounts for
1935 a single machine may exist as well as a fallback entry without user
1936 but with a password).
1938 If at that point there is still no password available, but the
1939 (protocols') chosen authentication type requires a password, then in
1940 interactive mode the user will be prompted on the terminal.
1944 .Sy Note:
1945 S/MIME verification works relative to the values found in the
1946 .Ql From:
1948 .Ql Sender: )
1949 header field(s), which means the values of
1950 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1952 .Va smime-sign-digest
1953 will not be looked up using the
1954 .Ql USER
1956 .Ql HOST
1957 chains from above, but instead use the corresponding values from the
1958 message that is being worked on.
1959 If no address matches we assume and use the setting of
1960 .Va from .
1961 In unusual cases multiple and different
1962 .Ql USER
1964 .Ql HOST
1965 combinations may therefore be involved \(en on the other hand those
1966 unusual cases become possible.
1967 The usual case is as short as:
1969 .Bd -literal -offset indent
1970 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1971     smime-sign smime-sign-cert=+smime.pair \e
1972     from=myname@my.host
1976 The section
1977 .Sx EXAMPLES
1978 contains complete example configurations.
1979 .\" }}}
1981 .\" .Ss "Encrypted network communication" {{{ review
1982 .Ss "Encrypted network communication"
1984 \*(OP SSL (Secure Sockets Layer) aka its successor TLS (Transport Layer
1985 Security) are protocols which aid in securing communication by providing
1986 a safely initiated and encrypted network connection.
1987 A central concept of TLS are certificates: as part of each network
1988 connection setup a (set of) certificates will be exchanged through which
1989 the identity of the network peer can be cryptographically verified;
1990 if possible the TLS/SNI (ServerNameIndication) extension will be enabled
1991 to allow servers fine-grained control over the certificates being used.
1992 A locally installed pool of trusted certificates will then be inspected,
1993 and verification will succeed if it contains a(n in)direct signer of the
1994 presented certificate(s).
1997 The local pool of trusted so-called CA (Certification Authority)
1998 certificates is usually delivered with and used along the TLS library.
1999 A custom pool of trusted certificates can be selected by pointing
2000 .Va tls-ca-file
2001 and/or (with special preparation)
2002 .Va tls-ca-dir
2003 to the desired location; setting
2004 .Va tls-ca-no-defaults
2005 in addition will avoid additional inspection of the default pool.
2006 A certificate cannot be more secure than the method its CA certificate
2007 has been retrieved with.
2008 For inspection or other purposes, the certificate of a server (as seen
2009 when connecting to it) can be fetched with the command
2010 .Ic tls
2011 (port can usually be the protocol name, too, and
2012 .Va tls-verify
2013 is taken into account here):
2015 .Bd -literal -offset indent
2016 $ \*(uA -vX 'tls certchain SERVER-URL[:PORT]; x'
2020 A local pool of CA certificates is not strictly necessary, however,
2021 server certificates can also be verified via their fingerprint.
2022 For this a message digest will be calculated and compared against the
2023 variable chain
2024 .Va tls-fingerprint ,
2025 and verification will succeed if the fingerprint matches.
2026 The message digest (algorithm) can be configured via the variable chain
2027 .Va tls-fingerprint-digest ;
2028 .Ic tls
2029 can again be used:
2031 .Bd -literal -offset indent
2032 $ \*(uA -X 'wysh set verbose; tls fingerprint SERVER-URL[:PORT]; x'
2036 It depends on the used protocol whether encrypted communication is
2037 possible, and which configuration steps have to be taken to enable it.
2038 Some protocols, like POP3S, are implicitly encrypted, others, like
2039 POP3, can upgrade a plain text connection if so requested.
2040 For example, to use the
2041 .Ql STLS
2042 that POP3 offers (a member of) the variable (chain)
2043 .Va pop3-use-starttls
2044 needs to be set, with convenience via
2045 .Ic shortcut :
2047 .Bd -literal -offset indent
2048 shortcut encpop1 pop3s://pop1.exam.ple
2050 shortcut encpop2 pop3://pop2.exam.ple
2051 set pop3-use-starttls-pop2.exam.ple
2053 set mta=smtps://smtp.exam.ple:465
2054 set mta=smtp://smtp.exam.ple smtp-use-starttls
2058 Normally that is all there is to do, given that TLS libraries try to
2059 provide safe defaults, plenty of knobs however exist to adjust settings.
2060 For example certificate verification settings can be fine-tuned via
2061 .Va tls-ca-flags ,
2062 and the TLS configuration basics are accessible via
2063 .Va tls-config-pairs ,
2064 for example to control protocol versions or cipher lists.
2065 In the past hints on how to restrict the set of protocols to highly
2066 secure ones were indicated, but as of the time of this writing the list
2067 of protocols or ciphers may need to become relaxed in order to be able
2068 to connect to some servers; the following example allows connecting to a
2069 .Dq Lion
2070 that uses OpenSSL 0.9.8za from June 2014 (refer to
2071 .Sx "INTERNAL VARIABLES"
2072 for more on variable chains):
2074 .Bd -literal -offset indent
2075 wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e
2076     CipherString=TLSv1.2:!aNULL:!eNULL:\e
2077       ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
2078       DHE-RSA-AES256-SHA:@STRENGTH'
2082 The OpenSSL program
2083 .Xr ciphers 1
2084 should be referred to when creating a custom cipher list.
2085 Variables of interest for TLS in general are
2086 .Va tls-ca-dir ,
2087 .Va tls-ca-file ,
2088 .Va tls-ca-flags ,
2089 .Va tls-ca-no-defaults ,
2090 .Va tls-config-file ,
2091 .Va tls-config-module ,
2092 .Va tls-config-pairs ,
2093 .Va tls-crl-dir ,
2094 .Va tls-crl-file ,
2095 .Va tls-rand-file
2096 as well as
2097 .Va tls-verify .
2098 Also see
2099 .Va tls-features .
2100 TLS is available if
2101 .Ql +tls
2102 is included in
2103 .Va features .
2104 .\" }}}
2106 .\" .Ss "Character sets" review {{{
2107 .Ss "Character sets"
2109 \*(OP The user's locale environment is detected by looking at the
2110 .Ev LC_ALL
2111 environment variable.
2112 The internal variable
2113 .Va ttycharset
2114 will be set to the detected terminal character set accordingly,
2115 and will thus show up in the output of commands like
2116 .Ic set
2118 .Ic varshow .
2119 This character set will be targeted when trying to display data,
2120 and user input data is expected to be in this character set, too.
2123 When creating messages their character input data is classified.
2124 7-bit clean text data and attachments will be classified as
2125 .Va charset-7bit .
2126 8-bit data will \*(OPally be converted into members of
2127 .Va sendcharsets
2128 until a character set conversion succeeds.
2129 .Va charset-8bit
2130 is the implied default last member of this list.
2131 If no 8-bit character set is capable to represent input data,
2132 no message will be sent, and its text will optionally be
2133 .Va save Ns d
2135 .Ev DEAD .
2136 If that is not acceptable, for example in script environments,
2137 .Va mime-force-sendout
2138 can be set to force sending of non-convertible data as
2139 .Ql application/octet-stream
2140 classified binary content instead: like this receivers still have the
2141 option to inspect message content (for example via
2142 .Va mime-counter-evidence ) .
2143 If the \*(OPal character set conversion is not available
2144 .Pf ( Va features
2145 misses
2146 .Ql ,+iconv, ) ,
2147 .Va ttycharset
2148 is the only supported character set for non 7-bit clean data, and
2149 it is simply assumed it can be used to exchange 8-bit messages.
2152 .Va ttycharset
2153 may also be given an explicit value to send mail in a completely
2154 .Dq faked
2155 locale environment, which can be used to generate and send for
2156 example 8-bit UTF-8 input data in a pure 7-bit US-ASCII
2157 .Ql LC_ALL=C
2158 environment (an example of this can be found in the section
2159 .Sx "On sending mail, and non-interactive mode" ) .
2160 Due to lack of programming interfaces reading mail will not really work
2161 as expected in a faked environment: whereas
2162 .Va ttycharset
2163 might be addressable, any output will be made safely printable, as via
2164 .Ic vexpr
2165 .Cm makeprint ,
2166 according to the actual locale environment, which is not affected by
2167 .Va ttycharset.
2170 Classifying 7-bit clean data as
2171 .Va charset-7bit
2172 is a problem if the input character set
2173 .Pf ( Va ttycharset )
2174 is a multibyte character set that is itself 7-bit clean.
2175 For example, the Japanese character set ISO-2022-JP is, but is capable
2176 to encode the rich set of Japanese Kanji, Hiragana and Katakana
2177 characters: in order to notify receivers of this character set the mail
2178 message must be MIME encoded so that the character set ISO-2022-JP can
2179 be advertised, otherwise an invalid email message would result!
2180 To achieve this, the variable
2181 .Va charset-7bit
2182 can be set to ISO-2022-JP.
2183 (Today a better approach regarding email is the usage of UTF-8, which
2184 uses 8-bit bytes for non-US-ASCII data.)
2187 When replying to a message and the variable
2188 .Va reply-in-same-charset
2189 is set, the character set of the message being replied to is tried first
2190 as a target character set (still being a subject of
2191 .Ic charsetalias
2192 filtering, however).
2193 Another opportunity is
2194 .Va sendcharsets-else-ttycharset
2195 to reflect the user's locale environment automatically, it will treat
2196 .Va ttycharset
2197 as an implied member of (an unset)
2198 .Va sendcharsets .
2201 \*(OP When reading messages, their text data is converted into
2202 .Va ttycharset
2203 as necessary in order to display them on the user's terminal.
2204 Unprintable characters and invalid byte sequences are detected
2205 and replaced by substitution characters.
2206 Character set mappings for source character sets can be established with
2207 .Ic charsetalias ,
2208 which may be handy to work around faulty or incomplete character set
2209 catalogues (one could for example add a missing LATIN1 to ISO-8859-1
2210 mapping), or to enforce treatment of one character set as another one
2211 .Pf ( Dq interpret LATIN1 as CP1252 ) .
2212 Also see
2213 .Va charset-unknown-8bit
2214 to deal with another hairy aspect of message interpretation.
2217 In general, if a message saying
2218 .Dq cannot convert from a to b
2219 appears, either some characters are not appropriate for the currently
2220 selected (terminal) character set,
2221 or the needed conversion is not supported by the system.
2222 In the first case, it is necessary to set an appropriate
2223 .Ev LC_CTYPE
2224 locale and/or the variable
2225 .Va ttycharset .
2226 The best results are usually achieved when running in a UTF-8
2227 locale on a UTF-8 capable terminal, in which case the full Unicode
2228 spectrum of characters is available.
2229 In this setup characters from various countries can be displayed,
2230 while it is still possible to use more simple character sets for sending
2231 to retain maximum compatibility with older mail clients.
2234 On the other hand the POSIX standard defines a locale-independent 7-bit
2235 .Dq portable character set
2236 that should be used when overall portability is an issue, the even more
2237 restricted subset named
2238 .Dq portable filename character set
2239 consists of A-Z, a-z, 0-9, period
2240 .Ql \&. ,
2241 underscore
2242 .Ql _
2243 and hyphen-minus
2244 .Ql - .
2245 .\" }}}
2247 .\" .Ss "Message states" {{{
2248 .Ss "Message states"
2250 \*(UA differentiates in between several message states; the current
2251 state will be reflected in the summary of
2252 .Ic headers
2253 if the
2254 .Va attrlist
2255 of the configured
2256 .Va headline
2257 allows, and
2258 .Sx "Specifying messages"
2259 dependent on their state is possible.
2260 When operating on the system
2261 .Va inbox ,
2262 or in any other
2263 .Mx -sx
2264 .Sx "primary system mailbox" ,
2265 special actions, like the automatic moving of messages to the
2266 .Mx -sx
2267 .Sx "secondary mailbox"
2268 .Ev MBOX ,
2269 may be applied when the mailbox is left (also implicitly by program
2270 termination, unless the command
2271 .Ic exit
2272 was used) \(en however, because this may be irritating to users which
2273 are used to
2274 .Dq more modern
2275 mail-user-agents, the provided global
2276 .Pa \*(UR
2277 template sets the internal
2278 .Va hold
2280 .Va keepsave
2281 variables in order to suppress this behaviour.
2283 .Bl -hang -width ".It Ql new"
2284 .It Ql new
2285 Message has neither been viewed nor moved to any other state.
2286 Such messages are retained even in the
2287 .Mx -sx
2288 .Sx "primary system mailbox" .
2290 .It Ql unread
2291 Message has neither been viewed nor moved to any other state, but the
2292 message was present already when the mailbox has been opened last:
2293 Such messages are retained even in the
2294 .Mx -sx
2295 .Sx "primary system mailbox" .
2297 .It Ql read
2298 The message has been processed by one of the following commands:
2299 .Ic ~f ,
2300 .Ic ~m ,
2301 .Ic ~F ,
2302 .Ic ~M ,
2303 .Ic copy ,
2304 .Ic mbox ,
2305 .Ic next ,
2306 .Ic pipe  ,
2307 .Ic Print ,
2308 .Ic print ,
2309 .Ic top ,
2310 .Ic Type ,
2311 .Ic type ,
2312 .Ic undelete .
2313 The commands
2314 .Ic dp
2316 .Ic dt
2317 will always try to automatically
2318 .Dq step
2320 .Ic type
2322 .Dq next
2323 logical message, and may thus mark multiple messages as read, the
2324 .Ic delete
2325 command will do so if the internal variable
2326 .Va autoprint
2327 is set.
2329 Except when the
2330 .Ic exit
2331 command is used, messages that are in a
2332 .Mx -sx
2333 .Sx "primary system mailbox"
2334 and are in
2335 .Ql read
2336 state when the mailbox is left will be saved in the
2337 .Mx -sx
2338 .Sx "secondary mailbox"
2339 .Ev MBOX
2340 unless the internal variable
2341 .Va hold
2342 it set.
2344 .It Ql deleted
2345 The message has been processed by one of the following commands:
2346 .Ic delete ,
2347 .Ic dp ,
2348 .Ic dt .
2349 Only
2350 .Ic undelete
2351 can be used to access such messages.
2353 .It Ql preserved
2354 The message has been processed by a
2355 .Ic preserve
2356 command and it will be retained in its current location.
2358 .It Ql saved
2359 The message has been processed by one of the following commands:
2360 .Ic save
2362 .Ic write .
2363 Unless when the
2364 .Ic exit
2365 command is used, messages that are in a
2366 .Mx -sx
2367 .Sx "primary system mailbox"
2368 and are in
2369 .Ql saved
2370 state when the mailbox is left will be deleted; they will be saved in the
2371 .Mx -sx
2372 .Sx "secondary mailbox"
2373 .Ev MBOX
2374 when the internal variable
2375 .Va keepsave
2376 is set.
2380 In addition to these message states, flags which otherwise have no
2381 technical meaning in the mail system except allowing special ways of
2382 addressing them when
2383 .Sx "Specifying messages"
2384 can be set on messages.
2385 These flags are saved with messages and are thus persistent, and are
2386 portable between a set of widely used MUAs.
2388 .Bl -hang -width ".It Ic answered"
2389 .It Ic answered
2390 Mark messages as having been answered.
2391 .It Ic draft
2392 Mark messages as being a draft.
2393 .It Ic flag
2394 Mark messages which need special attention.
2396 .\" }}}
2398 .\" .Ss "Specifying messages" {{{
2399 .Ss "Specifying messages"
2401 \*(NQ
2402 .Ic COMMANDS
2403 which take
2404 .Sx "Message list arguments" ,
2405 such as
2406 .Ic search ,
2407 .Ic type ,
2408 .Ic copy ,
2410 .Ic delete ,
2411 can perform actions on a number of messages at once.
2412 Specifying invalid messages, or using illegal syntax, will cause errors
2413 to be reported through the
2414 .Sx "INTERNAL VARIABLES"
2415 .Va \&! ,
2416 .Va ^ERR
2417 and companions, as well as the command exit status
2418 .Va \&? .
2421 For example,
2422 .Ql delete 1 2
2423 deletes the messages 1 and 2,
2424 whereas
2425 .Ql delete 1-5
2426 will delete the messages 1 through 5.
2427 In sorted or threaded mode (see the
2428 .Ic sort
2429 command),
2430 .Ql delete 1-5
2431 will delete the messages that are located between (and including)
2432 messages 1 through 5 in the sorted/threaded order, as shown in the
2433 .Ic headers
2434 summary.
2437 Errors can for example be
2438 .Va ^ERR Ns -BADMSG
2439 when requesting an invalid message,
2440 .Va ^ERR Ns -NOMSG
2441 if no applicable message can be found,
2442 .Va ^ERR Ns -CANCELED
2443 for missing informational data (mostly thread-related).
2444 .Va ^ERR Ns -INVAL
2445 for invalid syntax as well as
2446 .Va ^ERR Ns -IO
2447 for input/output errors can happen.
2448 The following special message names exist:
2451 .Bl -tag -width ".It Ar BaNg"
2452 .It Ar \&.
2453 The current message, the so-called
2454 .Dq dot .
2456 .It Ar \&;
2457 The message that was previously the current message; needs to be quoted.
2459 .It Ar \&,
2460 The parent message of the current message,
2461 that is the message with the Message-ID given in the
2462 .Ql In-Reply-To:
2463 field or the last entry of the
2464 .Ql References:
2465 field of the current message.
2467 .It Ar -
2468 The previous undeleted message, or the previous deleted message for the
2469 .Ic undelete
2470 command; In
2471 .Ic sort Ns
2472 ed or
2473 .Ql thread Ns
2474 ed mode, the previous such message in the according order.
2476 .It Ar +
2477 The next undeleted message, or the next deleted message for the
2478 .Ic undelete
2479 command; In
2480 .Ic sort Ns
2481 ed or
2482 .Ql thread Ns
2483 ed mode, the next such message in the according order.
2485 .It Ar ^
2486 The first undeleted message,
2487 or the first deleted message for the
2488 .Ic undelete
2489 command; In
2490 .Ic sort Ns
2491 ed or
2492 .Ql thread Ns
2493 ed mode, the first such message in the according order.
2495 .It Ar $
2496 The last message; In
2497 .Ic sort Ns
2498 ed or
2499 .Ql thread Ns
2500 ed mode, the last such message in the according order.
2501 Needs to be quoted.
2503 .It Ar & Ns Ar x
2505 .Ql thread Ns
2507 .Ic sort
2508 mode, selects the message addressed with
2509 .Ar x ,
2510 where
2511 .Ar x
2512 is any other message specification,
2513 and all messages from the thread that begins at it.
2514 Otherwise it is identical to
2515 .Ar x .
2517 .Ar x
2518 is omitted,
2519 the thread beginning with the current message is selected.
2521 .It Ar *
2522 All messages.
2524 .It Ar `
2525 All messages that were included in the
2526 .Sx "Message list arguments"
2527 of the previous command; needs to be quoted.
2528 (A convenient way to read all new messages is to select them via
2529 .Ql from :n ,
2530 as below, and then to read them in order with the default command \(em
2531 .Ic next
2532 \(em simply by successively typing
2533 .Ql ` ;
2534 for this to work
2535 .Va showlast
2536 must be set.)
2538 .It Ar x-y
2539 An inclusive range of message numbers.
2540 Selectors that may also be used as endpoints include any of
2541 .Ar .;-+^$ .
2543 .It Ar address
2544 A case-insensitive
2545 .Dq any substring matches
2546 search against the
2547 .Ql From:
2548 header, which will match addresses (too) even if
2549 .Va showname
2550 is set (and POSIX says
2551 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2552 However, if the
2553 .Va allnet
2554 variable is set, only the local part of the address is evaluated
2555 for the comparison, not ignoring case, and the setting of
2556 .Va showname
2557 is completely ignored.
2558 For finer control and match boundaries use the
2559 .Ql @
2560 search expression.
2562 .It Ar / Ns Ar string
2563 All messages that contain
2564 .Ar string
2565 in the subject field (case ignored according to locale).
2566 See also the
2567 .Va searchheaders
2568 variable.
2570 .Ar string
2571 is empty,
2572 the string from the previous specification of that type is used again.
2575 .It Xo Op Ar @ Ns Ar name-list Ns
2576 .Ar @ Ns Ar expr
2578 All messages that contain the given case-insensitive search
2579 .Ar expr Ns
2580 ession;  If the \*(OPal regular expression support is available
2581 .Ar expr
2582 will be interpreted as (an extended) one if any of the
2583 .Mx -sx
2584 .Sx "magic regular expression characters"
2585 is seen.
2586 If the optional
2587 .Ar @ Ns Ar name-list
2588 part is missing the search is restricted to the subject field body,
2589 but otherwise
2590 .Ar name-list
2591 specifies a comma-separated list of header fields to search, for example
2594 .Dl '@to,from,cc@Someone i ought to know'
2597 In order to search for a string that includes a
2598 .Ql @
2599 (commercial at) character the
2600 .Ar name-list
2601 is effectively non-optional, but may be given as the empty string.
2602 Also, specifying an empty search
2603 .Ar expr Ns
2604 ession will effectively test for existence of the given header fields.
2605 Some special header fields may be abbreviated:
2606 .Ql f ,
2607 .Ql t ,
2608 .Ql c ,
2609 .Ql b
2611 .Ql s
2612 will match
2613 .Ql From ,
2614 .Ql To ,
2615 .Ql Cc ,
2616 .Ql Bcc
2618 .Ql Subject ,
2619 respectively and case-insensitively.
2620 \*(OPally, and just like
2621 .Ar expr ,
2622 .Ar name-list
2623 will be interpreted as (an extended) regular expression if any of the
2624 .Mx -sx
2625 .Sx "magic regular expression characters"
2626 is seen.
2629 The special names
2630 .Ql header
2632 .Ql <
2633 can be used to search in (all of) the header(s) of the message, and the
2634 special names
2635 .Ql body
2637 .Ql >
2639 .Ql text
2641 .Ql =
2642 will perform full text searches \(en whereas the former searches only
2643 the body, the latter also searches the message header (\*(ID this mode
2644 yet brute force searches over the entire decoded content of messages,
2645 including administrativa strings).
2648 This specification performs full text comparison, but even with
2649 regular expression support it is almost impossible to write a search
2650 expression that safely matches only a specific address domain.
2651 To request that the body content of the header is treated as a list of
2652 addresses, and to strip those down to the plain email address which the
2653 search expression is to be matched against, prefix the effective
2654 .Ar name-list
2655 with a tilde
2656 .Ql ~ :
2659 .Dl '@~f,c@@a\e.safe\e.domain\e.match$'
2662 .It Ar :c
2663 All messages of state or with matching condition
2664 .Ql c ,
2665 where
2666 .Ql c
2667 is one or multiple of the following colon modifiers:
2669 .Bl -tag -compact -width ".It Ar :M"
2670 .It Ar a
2671 .Ic answered
2672 messages (cf. the variable
2673 .Va markanswered ) .
2674 .It Ar d
2675 .Ql deleted
2676 messages (for the
2677 .Ic undelete
2679 .Ic from
2680 commands only).
2681 .It Ar f
2682 .Ic flag Ns
2683 ged messages.
2684 .It Ar L
2685 Messages with receivers that match
2686 .Ic mlsubscribe Ns
2687 d addresses.
2688 .It Ar l
2689 Messages with receivers that match
2690 .Ic mlist Ns
2691 ed addresses.
2692 .It Ar n
2693 .Ql new
2694 messages.
2695 .It Ar o
2696 Old messages (any not in state
2697 .Ql read
2699 .Ql new ) .
2700 .It Ar r
2701 .Ql read
2702 messages.
2703 .It Ar S
2704 \*(OP Messages with unsure spam classification (see
2705 .Sx "Handling spam" ) .
2706 .It Ar s
2707 \*(OP Messages classified as spam.
2708 .It Ar t
2709 Messages marked as
2710 .Ic draft .
2711 .It Ar u
2712 .Ql unread
2713 messages.
2719 \*(OP IMAP-style SEARCH expressions may also be used.
2720 These consist of keywords and criterions, and because
2721 .Sx "Message list arguments"
2722 are split into tokens according to
2723 .Sx "Shell-style argument quoting"
2724 it is necessary to quote the entire IMAP search expression in order to
2725 ensure that it remains a single token.
2726 This addressing mode is available with all types of mailbox
2727 .Ic folder Ns
2728 s; \*(UA will perform the search locally as necessary.
2729 Strings must be enclosed by double quotation marks
2730 .Ql \&"
2731 in their entirety if they contain whitespace or parentheses;
2732 within the quotes, only reverse solidus
2733 .Ql \e
2734 is recognized as an escape character.
2735 All string searches are case-insensitive.
2736 When the description indicates that the
2737 .Dq envelope
2738 representation of an address field is used,
2739 this means that the search string is checked against both a list
2740 constructed as
2742 .Bd -literal -offset indent
2743 \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)'
2747 for each address,
2748 and the addresses without real names from the respective header field.
2749 These search expressions can be nested using parentheses, see below for
2750 examples.
2753 .Bl -tag -compact -width ".It Ar _n_u"
2754 .It Ar ( criterion )
2755 All messages that satisfy the given
2756 .Ar criterion .
2757 .It Ar ( criterion1 criterion2 ... criterionN )
2758 All messages that satisfy all of the given criteria.
2760 .It Ar ( or criterion1 criterion2 )
2761 All messages that satisfy either
2762 .Ar criterion1
2764 .Ar criterion2 ,
2765 or both.
2766 To connect more than two criteria using
2767 .Ql or
2768 specifications have to be nested using additional parentheses,
2769 as with
2770 .Ql (or a (or b c)) ,
2771 since
2772 .Ql (or a b c)
2773 really means
2774 .Ql ((a or b) and c) .
2775 For a simple
2776 .Ql or
2777 operation of independent criteria on the lowest nesting level,
2778 it is possible to achieve similar effects by using three separate
2779 criteria, as with
2780 .Ql (a) (b) (c) .
2782 .It Ar ( not criterion )
2783 All messages that do not satisfy
2784 .Ar criterion .
2785 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2786 All messages that contain
2787 .Ar string
2788 in the envelope representation of the
2789 .Ql Bcc:
2790 field.
2791 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2792 All messages that contain
2793 .Ar string
2794 in the envelope representation of the
2795 .Ql Cc:
2796 field.
2797 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2798 All messages that contain
2799 .Ar string
2800 in the envelope representation of the
2801 .Ql From:
2802 field.
2803 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2804 All messages that contain
2805 .Ar string
2806 in the
2807 .Ql Subject:
2808 field.
2809 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2810 All messages that contain
2811 .Ar string
2812 in the envelope representation of the
2813 .Ql To:
2814 field.
2815 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2816 All messages that contain
2817 .Ar string
2818 in the specified
2819 .Ql Name:
2820 field.
2821 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2822 All messages that contain
2823 .Ar string
2824 in their body.
2825 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2826 All messages that contain
2827 .Ar string
2828 in their header or body.
2829 .It Ar ( larger size )
2830 All messages that are larger than
2831 .Ar size
2832 (in bytes).
2833 .It Ar ( smaller size )
2834 All messages that are smaller than
2835 .Ar size
2836 (in bytes).
2838 .It Ar ( before date )
2839 All messages that were received before
2840 .Ar date ,
2841 which must be in the form
2842 .Ql d[d]-mon-yyyy ,
2843 where
2844 .Ql d
2845 denotes the day of the month as one or two digits,
2846 .Ql mon
2847 is the name of the month \(en one of
2848 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2850 .Ql yyyy
2851 is the year as four digits, for example
2852 .Ql 28-Dec-2012 .
2854 .It Ar ( on date )
2855 All messages that were received on the specified date.
2856 .It Ar ( since date )
2857 All messages that were received since the specified date.
2858 .It Ar ( sentbefore date )
2859 All messages that were sent on the specified date.
2860 .It Ar ( senton date )
2861 All messages that were sent on the specified date.
2862 .It Ar ( sentsince date )
2863 All messages that were sent since the specified date.
2864 .It Ar ()
2865 The same criterion as for the previous search.
2866 This specification cannot be used as part of another criterion.
2867 If the previous command line contained more than one independent
2868 criterion then the last of those criteria is used.
2870 .\" }}}
2872 .\" .Ss "On terminal control and line editor" {{{ review
2873 .Ss "On terminal control and line editor"
2875 \*(OP Terminal control through one of the standard
2877 libraries,
2878 .Lb libtermcap
2880 .Lb libterminfo ,
2881 may be available.
2882 For the
2883 .Ev TERM Ns
2884 inal defined in the environment interactive usage aspects, for example
2885 .Sx "Coloured display" ,
2886 and insight of cursor and function keys for the Mailx-Line-Editor
2887 (MLE), will be enhanced or enabled.
2888 Library interaction can be disabled on a per-invocation basis via
2889 .Va termcap-disable ,
2890 whereas the internal variable
2891 .Va termcap
2892 is always used as a preferred source of terminal capabilities.
2893 (For a usage example see the
2894 .Sx FAQ
2895 entry
2896 .Sx "Not \(dqdefunctional\(dq, but the editor key does not work" . )
2899 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2900 environments which comply to the ISO C standard
2901 .St -isoC-amd1 ,
2902 and will support wide glyphs if possible (the necessary functionality
2903 had been removed from ISO C, but was included in
2904 .St -xpg4 ) .
2905 Usage of a line editor in interactive mode can be prevented by setting
2906 .Va line-editor-disable .
2907 Especially if the \*(OPal terminal control support is missing setting
2908 entries in
2909 .Va termcap
2910 will help shall the MLE misbehave, see there for more.
2911 The MLE can support a little bit of
2912 .Ic colour .
2915 \*(OP If the
2916 .Ic history
2917 feature is available then input from line editor prompts will be saved
2918 in a history list that can be searched in and be expanded from.
2919 Such saving can be prevented by prefixing input with any amount of
2920 whitespace.
2921 Aspects of history, like allowed content and maximum size, as well as
2922 whether history shall be saved persistently, can be configured with the
2923 internal variables
2924 .Va history-file ,
2925 .Va history-gabby ,
2926 .Va history-gabby-persist
2928 .Va history-size .
2929 There also exists the macro hook
2930 .Va on-history-addition
2931 which can be used to apply finer control on what enters history.
2934 The MLE supports a set of editing and control commands.
2935 By default (as) many (as possible) of these will be assigned to a set of
2936 single-letter control codes, which should work on any terminal (and can
2937 be generated by holding the
2938 .Dq control
2939 key while pressing the key of desire, for example
2940 .Ql control-D ) .
2941 If the \*(OPal
2942 .Ic bind
2943 command is available then the MLE commands can also be accessed freely
2944 by assigning the command name, which is shown in parenthesis in the list
2945 below, to any desired key-sequence, and the MLE will instead and also use
2946 .Ic bind
2947 to establish its built-in key bindings
2948 (more of them if the \*(OPal terminal control is available),
2949 an action which can then be suppressed completely by setting
2950 .Va line-editor-no-defaults .
2951 .Sx "Shell-style argument quoting"
2952 notation is used in the following:
2956 .Bl -tag -compact -width ".It Ql \eBa"
2957 .It Ql \ecA
2958 Go to the start of the line
2960 .Pf ( Cd mle-go-home ) .
2962 .It Ql \ecB
2963 Move the cursor backward one character
2965 .Pf ( Cd mle-go-bwd ) .
2967 .It Ql \ecC
2968 .Xr raise 3
2969 .Ql SIGINT
2971 .Pf ( Cd mle-raise-int ) .
2973 .It Ql \ecD
2974 Forward delete the character under the cursor;
2975 quits \*(UA if used on the empty line unless the internal variable
2976 .Va ignoreeof
2977 is set
2979 .Pf ( Cd mle-del-fwd ) .
2981 .It Ql \ecE
2982 Go to the end of the line
2984 .Pf ( Cd mle-go-end ) .
2986 .It Ql \ecF
2987 Move the cursor forward one character
2989 .Pf ( Cd mle-go-fwd ) .
2991 .It Ql \ecG
2992 Cancel current operation, full reset.
2993 If there is an active history search or tabulator expansion then this
2994 command will first reset that, reverting to the former line content;
2995 thus a second reset is needed for a full reset in this case
2997 .Pf ( Cd mle-reset ) .
2999 .It Ql \ecH
3000 Backspace: backward delete one character
3002 .Pf ( Cd mle-del-bwd ) .
3004 .It Ql \ecI
3005 \*(NQ
3006 Horizontal tabulator:
3007 try to expand the word before the cursor, supporting the usual
3008 .Sx "Filename transformations"
3010 .Pf ( Cd mle-complete ;
3011 this is affected by
3012 .Cd mle-quote-rndtrip
3014 .Va line-editor-cpl-word-breaks ) .
3016 .It Ql \ecJ
3017 Newline:
3018 commit the current line
3020 .Pf ( Cd mle-commit ) .
3022 .It Ql \ecK
3023 Cut all characters from the cursor to the end of the line
3025 .Pf ( Cd mle-snarf-end ) .
3027 .It Ql \ecL
3028 Repaint the line
3030 .Pf ( Cd mle-repaint ) .
3032 .It Ql \ecN
3033 \*(OP Go to the next history entry
3035 .Pf ( Cd mle-hist-fwd ) .
3037 .It Ql \ecO
3038 (\*(OPally context-dependent) Invokes the command
3039 .Ic dt .
3041 .It Ql \ecP
3042 \*(OP Go to the previous history entry
3044 .Pf ( Cd mle-hist-bwd ) .
3046 .It Ql \ecQ
3047 Toggle roundtrip mode shell quotes, where produced,
3048 on and off
3050 .Pf ( Cd mle-quote-rndtrip ) .
3051 This setting is temporary, and will be forgotten once the command line
3052 is committed; also see
3053 .Ic shcodec .
3055 .It Ql \ecR
3056 \*(OP Complete the current line from (the remaining) older history entries
3058 .Pf ( Cd mle-hist-srch-bwd ) .
3060 .It Ql \ecS
3061 \*(OP Complete the current line from (the remaining) newer history entries
3063 .Pf ( Cd mle-hist-srch-fwd ) .
3065 .It Ql \ecT
3066 Paste the snarf buffer
3068 .Pf ( Cd mle-paste ) .
3070 .It Ql \ecU
3071 The same as
3072 .Ql \ecA
3073 followed by
3074 .Ql \ecK
3076 .Pf ( Cd mle-snarf-line ) .
3078 .It Ql \ecV
3079 Prompts for a Unicode character (hexadecimal number without prefix, see
3080 .Ic vexpr )
3081 to be inserted
3083 .Pf ( Cd mle-prompt-char ) .
3084 Note this command needs to be assigned to a single-letter control code
3085 in order to become recognized and executed during input of
3086 a key-sequence (only three single-letter control codes can be used for
3087 that shortcut purpose); this control code is then special-treated and
3088 thus cannot be part of any other sequence (because it will trigger the
3089 .Cd \&\&mle-prompt-char
3090 function immediately).
3092 .It Ql \ecW
3093 Cut the characters from the one preceding the cursor to the preceding
3094 word boundary
3096 .Pf ( Cd mle-snarf-word-bwd ) .
3098 .It Ql \ecX
3099 Move the cursor forward one word boundary
3101 .Pf ( Cd mle-go-word-fwd ) .
3103 .It Ql \ecY
3104 Move the cursor backward one word boundary
3106 .Pf ( Cd mle-go-word-bwd ) .
3108 .It Ql \ecZ
3109 .Xr raise 3
3110 .Ql SIGTSTP
3112 .Pf ( Cd mle-raise-tstp ) .
3114 .It Ql \ec[
3115 Escape: reset a possibly used multibyte character input state machine
3116 and \*(OPally a lingering, incomplete key binding
3118 .Pf ( Cd mle-cancel ) .
3119 This command needs to be assigned to a single-letter control code in
3120 order to become recognized and executed during input of a key-sequence
3121 (only three single-letter control codes can be used for that shortcut
3122 purpose).
3123 This control code may also be part of a multi-byte sequence, but if
3124 a sequence is active and the very control code is currently also an
3125 expected input, then the active sequence takes precedence and will
3126 consume the control code.
3128 .It Ql \ec\e
3129 (\*(OPally context-dependent) Invokes the command
3130 .Ql Ic z Ns + .
3132 .It Ql \ec]
3133 (\*(OPally context-dependent) Invokes the command
3134 .Ql Ic z Ns $ .
3136 .It Ql \ec^
3137 (\*(OPally context-dependent) Invokes the command
3138 .Ql Ic z Ns 0 .
3140 .It Ql \ec_
3141 Cut the characters from the one after the cursor to the succeeding word
3142 boundary
3144 .Pf ( Cd mle-snarf-word-fwd ) .
3146 .It Ql \ec?
3147 Backspace:
3148 .Cd mle-del-bwd .
3150 .It \(en
3152 .Cd mle-bell :
3153 ring the audible bell.
3155 .It \(en
3156 \*(OP
3158 .Cd mle-clear-screen :
3159 move the cursor home and clear the screen.
3161 .It \(en
3163 .Cd mle-fullreset :
3164 different to
3165 .Cd mle-reset
3166 this will immediately reset a possibly active search etc.
3168 .It \(en
3170 .Cd mle-go-screen-bwd :
3171 move the cursor backward one screen width.
3173 .It \(en
3175 .Cd mle-go-screen-fwd :
3176 move the cursor forward one screen width.
3178 .It \(en
3180 .Cd mle-raise-quit:
3181 .Xr raise 3
3182 .Ql SIGQUIT .
3184 .\" }}}
3186 .\" .Ss "Coloured display" {{{ review
3187 .Ss "Coloured display"
3189 \*(OP Colours and font attributes through ANSI a.k.a. ISO 6429 SGR
3190 (select graphic rendition) escape sequences are optionally supported.
3191 Usage of colours and font attributes solely depends upon the
3192 capability of the detected terminal type
3193 .Pf ( Ev TERM ) ,
3194 and as fine-tuned through
3195 .Va termcap .
3196 Colours and font attributes can be managed with the multiplexer command
3197 .Ic colour ,
3199 .Ic uncolour
3200 removes the given mappings.
3201 Setting
3202 .Va colour-disable
3203 suppresses usage of colour and font attribute sequences, while leaving
3204 established mappings unchanged.
3207 Whether actually applicable colour and font attribute sequences should
3208 also be generated when output is going to be paged through the external
3209 .Ev PAGER
3210 (also see
3211 .Va crt Ns
3212 ) depends upon the setting of
3213 .Va colour-pager ,
3214 because pagers usually need to be configured in order to support ISO
3215 escape sequences.
3216 Knowledge of some widely used pagers is however built-in, and in a clean
3217 environment it is often enough to simply set
3218 .Va colour-pager ;
3219 please refer to that variable for more on this topic.
3222 It might make sense to conditionalize colour setup on interactive mode via
3223 .Ic if
3224 .Pf ( Ql terminal
3225 indeed means
3226 .Dq interactive ) :
3228 .Bd -literal -offset indent
3229 if terminal && "$features" =% ,+colour,
3230   colour iso view-msginfo ft=bold,fg=green
3231   colour iso view-header ft=bold,fg=red (from|subject) # regex
3232   colour iso view-header fg=red
3234   uncolour iso view-header from,subject
3235   colour iso view-header ft=bold,fg=magenta,bg=cyan
3236   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
3237   colour mono view-header ft=bold
3238   colour mono view-header ft=bold,ft=reverse subject,from
3239 endif
3241 .\" }}}
3243 .\" .Ss "Handling spam" {{{
3244 .Ss "Handling spam"
3246 \*(OP \*(UA can make use of several spam interfaces for the purpose of
3247 identification of, and, in general, dealing with spam messages.
3248 A precondition of most commands in order to function is that the
3249 .Va spam-interface
3250 variable is set to one of the supported interfaces.
3251 .Sx "Specifying messages"
3252 that have been identified as spam is possible via their (volatile)
3253 .Ql is-spam
3254 state by using the
3255 .Ql Ar :s
3257 .Ql Ar :S
3258 specifications, and their
3259 .Va attrlist
3260 entries will be used when displaying the
3261 .Va headline
3262 in the summary of
3263 .Ic headers .
3265 .Bl -bullet
3267 .Ic spamrate
3268 rates the given messages and sets their
3269 .Ql is-spam
3270 flag accordingly.
3271 If the spam interface offers spam scores these can be shown in
3272 .Va headline
3273 by using the format
3274 .Ql %$ .
3276 .Ic spamham ,
3277 .Ic spamspam
3279 .Ic spamforget
3280 will interact with the Bayesian filter of the chosen interface and learn
3281 the given messages as
3282 .Dq ham
3284 .Dq spam ,
3285 respectively; the last command can be used to cause
3286 .Dq unlearning
3287 of messages; it adheres to their current
3288 .Ql is-spam
3289 state and thus reverts previous teachings.
3291 .Ic spamclear
3293 .Ic spamset
3294 will simply set and clear, respectively, the mentioned volatile
3295 .Ql is-spam
3296 message flag, without any interface interaction.
3301 .Xr spamassassin 1
3302 based
3303 .Va spam-interface
3304 .Ql spamc
3305 requires a running instance of the
3306 .Xr spamd 1
3307 server in order to function, started with the option
3308 .Fl -allow-tell
3309 shall Bayesian filter learning be possible.
3311 .Bd -literal -offset indent
3312 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3313 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3314     --daemonize [--local] [--allow-tell]
3318 Thereafter \*(UA can make use of these interfaces:
3320 .Bd -literal -offset indent
3321 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3322     -Sspamc-command=/usr/local/bin/spamc \e
3323     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3325 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3326     -Sspamc-command=/usr/local/bin/spamc \e
3327     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3331 Using the generic filter approach allows usage of programs like
3332 .Xr bogofilter 1 .
3333 Here is an example, requiring it to be accessible via
3334 .Ev PATH :
3336 .Bd -literal -offset indent
3337 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3338     -Sspamfilter-ham="bogofilter -n" \e
3339     -Sspamfilter-noham="bogofilter -N" \e
3340     -Sspamfilter-nospam="bogofilter -S" \e
3341     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3342     -Sspamfilter-spam="bogofilter -s" \e
3343     -Sspamfilter-rate-scanscore="1;^(.+)$"
3347 Because messages must exist on local storage in order to be scored (or
3348 used for Bayesian filter training), it is possibly a good idea to
3349 perform the local spam check last.
3350 Spam can be checked automatically when opening specific folders by
3351 setting a specialized form of the internal variable
3352 .Va folder-hook .
3354 .Bd -literal -offset indent
3355 define spamdelhook {
3356   # Server side DCC
3357   spamset (header x-dcc-brand-metrics "bulk")
3358   # Server-side spamassassin(1)
3359   spamset (header x-spam-flag "YES")
3360   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3361   move :S +maybe-spam
3362   spamrate :u
3363   del :s
3364   move :S +maybe-spam
3366 set folder-hook-SOMEFOLDER=spamdelhook
3370 See also the documentation for the variables
3371 .Va spam-interface , spam-maxsize ,
3372 .Va spamc-command , spamc-arguments , spamc-user ,
3373 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3374   spamfilter-rate
3376 .Va spamfilter-rate-scanscore .
3377 .\" }}}
3379 .\" }}} (DESCRIPTION)
3382 .\" .Sh COMMANDS {{{
3383 .Sh COMMANDS
3385 \*(UA reads input in lines.
3386 An unquoted reverse solidus
3387 .Ql \e
3388 at the end of a command line
3389 .Dq escapes
3390 the newline character: it is discarded and the next line of input is
3391 used as a follow-up line, with all leading whitespace removed;
3392 once an entire line is completed, the whitespace characters
3393 .Cm space , tabulator , newline
3394 as well as those defined by the variable
3395 .Va ifs
3396 are removed from the beginning and end.
3397 Placing any whitespace characters at the beginning of a line will
3398 prevent a possible addition of the command line to the \*(OPal
3399 .Ic history .
3402 The beginning of such input lines is then scanned for the name of
3403 a known command: command names may be abbreviated, in which case the
3404 first command that matches the given prefix will be used.
3405 .Sx "Command modifiers"
3406 may prefix a command in order to modify its behaviour.
3407 A name may also be a
3408 .Ic commandalias ,
3409 which will become expanded until no more expansion is possible.
3410 Once the command that shall be executed is known, the remains of the
3411 input line will be interpreted according to command-specific rules,
3412 documented in the following.
3415 This behaviour is different to the
3416 .Xr sh 1 Ns
3417 ell, which is a programming language with syntactic elements of clearly
3418 defined semantics, and therefore capable to sequentially expand and
3419 evaluate individual elements of a line.
3420 .Ql \&? set one=value two=$one
3421 for example will never possibly assign value to one, because the
3422 variable assignment is performed no sooner but by the command
3423 .Pf ( Ic set ) ,
3424 long after the expansion happened.
3427 A list of all commands in lookup order is dumped by the command
3428 .Ic list .
3429 \*(OPally the command
3430 .Ic help
3432 .Ic \&? ) ,
3433 when given an argument, will show a documentation string for the
3434 command matching the expanded argument, as in
3435 .Ql \&?t ,
3436 which should be a shorthand of
3437 .Ql \&?type ;
3438 with these documentation strings both commands support a more
3439 .Va verbose
3440 listing mode which includes the argument type of the command and other
3441 information which applies; a handy suggestion might thus be:
3443 .Bd -literal -offset indent
3444 ? define __xv {
3445   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3446   localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}
3448 ? commandalias xv '\ecall __xv'
3449 ? xv help set
3452 .\" .Ss "Command modifiers" {{{
3453 .Ss "Command modifiers"
3455 Commands may be prefixed by none to multiple command modifiers.
3456 Some command modifiers can be used with a restricted set of commands
3457 only, the
3458 .Va verbose
3459 version of
3460 .Ic list
3461 will (\*(OPally) show which modifiers apply.
3463 .Bl -bullet
3465 The modifier reverse solidus
3467 .Cm \e ,
3468 to be placed first, prevents
3469 .Ic commandalias
3470 expansions on the remains of the line, for example
3471 .Ql \eecho
3472 will always evaluate the command
3473 .Ic echo ,
3474 even if an (command)alias of the same name exists.
3475 .Ic commandalias
3476 content may itself contain further command modifiers, including
3477 an initial reverse solidus to prevent further expansions.
3480 The modifier
3482 .Cm ignerr
3483 indicates that any error generated by the following command should be
3484 ignored by the state machine and not cause a program exit with enabled
3485 .Va errexit
3486 or for the standardized exit cases in
3487 .Va posix
3488 mode.
3489 .Va \&? ,
3490 one of the
3491 .Sx "INTERNAL VARIABLES" ,
3492 will be set to the real exit status of the command regardless.
3496 .Cm local
3497 will alter the called command to apply changes only temporarily,
3498 local to block-scope, and can thus only be used inside of a
3499 .Ic define Ns
3500 d macro or an
3501 .Ic account
3502 definition.
3503 Specifying it implies the modifier
3504 .Cm wysh .
3505 Local variables will not be inherited by macros deeper in the
3506 .Ic call
3507 chain, and all local settings will be garbage collected once the local
3508 scope is left.
3509 To record and unroll changes in the global scope use the command
3510 .Ic localopts .
3514 .Cm scope
3515 does yet not implement any functionality.
3519 .Cm u
3520 does yet not implement any functionality.
3523 Some commands support the
3525 .Cm vput
3526 modifier: if used, they expect the name of a variable, which can itself
3527 be a variable, i.e., shell expansion is applied, as their first
3528 argument, and will place their computation result in it instead of the
3529 default location (it is usually written to standard output).
3531 The given name will be tested for being a valid
3532 .Xr sh 1
3533 variable name, and may therefore only consist of upper- and lowercase
3534 characters, digits, and the underscore; the hyphen-minus may be used as
3535 a non-portable extension; digits may not be used as first, hyphen-minus
3536 may not be used as last characters.
3537 In addition the name may either not be one of the known
3538 .Sx "INTERNAL VARIABLES" ,
3539 or must otherwise refer to a writable (non-boolean) value variable.
3540 The actual put operation may fail nonetheless, for example if the
3541 variable expects a number argument only a number will be accepted.
3542 Any error during these operations causes the command as such to fail,
3543 and the error number
3544 .Va \&!
3545 will be set to
3546 .Va ^ERR Ns -NOTSUP ,
3547 the exit status
3548 .Va \&?
3549 should be set to
3550 .Ql -1 ,
3551 but some commands deviate from the latter, which is documented.
3554 Last, but not least, the modifier
3556 .Cm wysh
3557 can be used for some old and established commands to choose the new
3558 .Sx "Shell-style argument quoting"
3559 rules over the traditional
3560 .Sx "Old-style argument quoting" .
3561 This modifier is implied if
3562 .Va v15-compat
3563 is set to a non-empty value.
3565 .\" }}}
3567 .\" .Ss "Old-style argument quoting" v15-compat: rename Obsolete.. {{{
3568 .Ss "Old-style argument quoting"
3570 \*(ID This section documents the traditional and POSIX standardized
3571 style of quoting non-message list arguments to commands which expect
3572 this type of arguments: whereas still used by the majority of such
3573 commands, the new
3574 .Sx "Shell-style argument quoting"
3575 may be available even for those via
3576 .Cm wysh ,
3577 one of the
3578 .Sx "Command modifiers" .
3579 Nonetheless care must be taken, because only new commands have been
3580 designed with all the capabilities of the new quoting rules in mind,
3581 which can, for example generate control characters.
3584 .Bl -bullet -offset indent
3586 An argument can be enclosed between paired double-quotes
3587 .Ql """argument"""
3589 single-quotes
3590 .Ql 'argument' ;
3591 any whitespace, shell word expansion, or reverse solidus characters
3592 (except as described next) within the quotes are treated literally as
3593 part of the argument.
3594 A double-quote will be treated literally within single-quotes and vice
3595 versa.
3596 Inside such a quoted string the actually used quote character can be
3597 used nonetheless by escaping it with a reverse solidus
3598 .Ql \e ,
3599 as in
3600 .Ql """y\e""ou""" .
3603 An argument that is not enclosed in quotes, as above, can usually still
3604 contain space characters if those spaces are reverse solidus escaped, as in
3605 .Ql you\e are .
3608 A reverse solidus outside of the enclosing quotes is discarded
3609 and the following character is treated literally as part of the argument.
3611 .\" }}}
3613 .\" .Ss "Shell-style argument quoting" {{{
3614 .Ss "Shell-style argument quoting"
3616 .Xr sh 1 Ns
3617 ell-style, and therefore POSIX standardized, argument parsing and
3618 quoting rules are used by most commands.
3619 \*(ID Most new commands only support these new rules and are flagged
3620 \*(NQ, some elder ones can use them with the command modifier
3621 .Cm wysh ;
3622 in the future only this type of argument quoting will remain.
3625 A command line is parsed from left to right and an input token is
3626 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3627 Metacharacters are vertical bar
3628 .Cm \&| ,
3629 ampersand
3630 .Cm & ,
3631 semicolon
3632 .Cm \&; ,
3633 as well as all characters from the variable
3634 .Va ifs ,
3635 and / or
3636 .Cm space , tabulator , newline .
3637 The additional metacharacters left and right parenthesis
3638 .Cm \&( , \&)
3639 and less-than and greater-than signs
3640 .Cm < , >
3641 that the
3642 .Xr sh 1
3643 supports are not used, and are treated as ordinary characters: for one
3644 these characters are a vivid part of email addresses, and it seems
3645 highly unlikely that their function will become meaningful to \*(UA.
3647 .Bd -filled -offset indent
3648 .Sy Compatibility note:
3649 \*(ID Please note that even many new-style commands do not yet honour
3650 .Va ifs
3651 to parse their arguments: whereas the
3652 .Xr sh 1 Ns
3653 ell is a language with syntactic elements of clearly defined semantics,
3654 \*(UA parses entire input lines and decides on a per-command base what
3655 to do with the rest of the line.
3656 This also means that whenever an unknown command is seen all that \*(UA
3657 can do is cancellation of the processing of the remains of the line.
3659 It also often depends on an actual subcommand of a multiplexer command
3660 how the rest of the line should be treated, and until v15 we are not
3661 capable to perform this deep inspection of arguments.
3662 Nonetheless, at least the following commands which work with positional
3663 parameters fully support
3664 .Va ifs
3665 for an almost shell-compatible field splitting:
3666 .Ic call , call_if , read , vpospar , xcall .
3670 Any unquoted number sign
3671 .Ql #
3672 at the beginning of a new token starts a comment that extends to the end
3673 of the line, and therefore ends argument processing.
3674 An unquoted dollar sign
3675 .Ql $
3676 will cause variable expansion of the given name, which must be a valid
3677 .Xr sh 1 Ns
3678 ell-style variable name (see
3679 .Cm vput ) :
3680 .Sx "INTERNAL VARIABLES"
3681 as well as
3682 .Sx ENVIRONMENT
3683 (shell) variables can be accessed through this mechanism, brace
3684 enclosing the name is supported (i.e., to subdivide a token).
3687 Whereas the metacharacters
3688 .Cm space , tabulator , newline
3689 only complete an input token, vertical bar
3690 .Cm \&| ,
3691 ampersand
3692 .Cm &
3693 and semicolon
3694 .Cm \&;
3695 also act as control operators and perform control functions.
3696 For now supported is semicolon
3697 .Cm \&; ,
3698 which terminates a single command, therefore sequencing the command line
3699 and making the remainder of the line a subject to reevaluation.
3700 With sequencing, multiple command argument types and quoting rules may
3701 therefore apply to a single line, which can become problematic before
3702 v15: e.g., the first of the following will cause surprising results.
3705 .Dl ? echo one; set verbose; echo verbose=$verbose.
3706 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3709 Quoting is a mechanism that will remove the special meaning of
3710 metacharacters and reserved words, and will prevent expansion.
3711 There are four quoting mechanisms: the escape character, single-quotes,
3712 double-quotes and dollar-single-quotes:
3715 .Bl -bullet -offset indent
3717 The literal value of any character can be preserved by preceding it
3718 with the escape character reverse solidus
3719 .Ql \e .
3722 Arguments which are enclosed in
3723 .Ql 'single-\:quotes'
3724 retain their literal value.
3725 A single-quote cannot occur within single-quotes.
3728 The literal value of all characters enclosed in
3729 .Ql \(dqdouble-\:quotes\(dq
3730 is retained, with the exception of dollar sign
3731 .Ql $ ,
3732 which will cause variable expansion, as above, backquote (grave accent)
3733 .Ql ` ,
3734 (which not yet means anything special), reverse solidus
3735 .Ql \e ,
3736 which will escape any of the characters dollar sign
3737 .Ql $
3738 (to prevent variable expansion), backquote (grave accent)
3739 .Ql ` ,
3740 double-quote
3741 .Ql \(dq
3742 (to prevent ending the quote) and reverse solidus
3743 .Ql \e
3744 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3745 but has no special meaning otherwise.
3748 Arguments enclosed in
3749 .Ql $'dollar-\:single-\:quotes'
3750 extend normal single quotes in that reverse solidus escape sequences are
3751 expanded as follows:
3753 .Bl -tag -compact -width ".Ql \eNNN"
3754 .It Ql \ea
3755 bell control character (ASCII and ISO-10646 BEL).
3756 .It Ql \eb
3757 backspace control character (ASCII and ISO-10646 BS).
3758 .It Ql \eE
3759 escape control character (ASCII and ISO-10646 ESC).
3760 .It Ql \ee
3761 the same.
3762 .It Ql \ef
3763 form feed control character (ASCII and ISO-10646 FF).
3764 .It Ql \en
3765 line feed control character (ASCII and ISO-10646 LF).
3766 .It Ql \er
3767 carriage return control character (ASCII and ISO-10646 CR).
3768 .It Ql \et
3769 horizontal tabulator control character (ASCII and ISO-10646 HT).
3770 .It Ql \ev
3771 vertical tabulator control character (ASCII and ISO-10646 VT).
3772 .It Ql \e\e
3773 emits a reverse solidus character.
3774 .It Ql \e'
3775 single quote.
3776 .It Ql \e"
3777 double quote (escaping is optional).
3778 .It Ql \eNNN
3779 eight-bit byte with the octal value
3780 .Ql NNN
3781 (one to three octal digits), optionally prefixed by an additional
3782 .Ql 0 .
3783 A 0 byte will suppress further output for the quoted argument.
3784 .It Ql \exHH
3785 eight-bit byte with the hexadecimal value
3786 .Ql HH
3787 (one or two hexadecimal characters, no prefix, see
3788 .Ic vexpr ) .
3789 A 0 byte will suppress further output for the quoted argument.
3790 .It Ql \eUHHHHHHHH
3791 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3792 .Ql HHHHHHHH
3793 (one to eight hexadecimal characters) \(em note that Unicode defines the
3794 maximum codepoint ever to be supported as
3795 .Ql 0x10FFFF
3796 (in planes of
3797 .Ql 0xFFFF
3798 characters each).
3799 This escape is only supported in locales that support Unicode (see
3800 .Sx "Character sets" ) ,
3801 in other cases the sequence will remain unexpanded unless the given code
3802 point is ASCII compatible or (if the \*(OPal character set conversion is
3803 available) can be represented in the current locale.
3804 The character NUL will suppress further output for the quoted argument.
3805 .It Ql \euHHHH
3806 Identical to
3807 .Ql \eUHHHHHHHH
3808 except it takes only one to four hexadecimal characters.
3809 .It Ql \ecX
3810 Emits the non-printable (ASCII and compatible) C0 control codes
3811 0 (NUL) to 31 (US), and 127 (DEL).
3812 Printable representations of ASCII control codes can be created by
3813 mapping them to a different, visible part of the ASCII character set.
3814 Adding the number 64 achieves this for the codes 0 to 31, here 7 (BEL):
3815 .Ql 7 + 64 = 71 = G .
3816 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3817 .Ic vexpr ) ,
3818 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3819 .Ql \&?\0vexpr\0^\0127\064 .
3821 Whereas historically circumflex notation has often been used for
3822 visualization purposes of control codes, as in
3823 .Ql ^G ,
3824 the reverse solidus notation has been standardized:
3825 .Ql \ecG .
3826 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3827 as shown above
3828 .Pf ( Ql \ea ,
3829 .Ql \en ,
3830 .Ql \et
3831 etc) :
3832 whenever such an alias exists it will be used for display purposes.
3833 The control code NUL
3834 .Pf ( Ql \ec@ ,
3835 a non-standard extension) will suppress further output for the remains
3836 of the token (which may extend beyond the current quote), or, depending
3837 on the context, the remains of all arguments for the current command.
3838 .It Ql \e$NAME
3839 Non-standard extension: expand the given variable name, as above.
3840 Brace enclosing the name is supported.
3841 .It Ql \e`{command}
3842 Not yet supported, just to raise awareness: Non-standard extension.
3847 Caveats:
3849 .Bd -literal -offset indent
3850 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3851 ? echo Quotes ${HOME} and tokens differ! # comment
3852 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3854 .\" }}}
3856 .\" .Ss "Message list arguments" {{{
3857 .Ss "Message list arguments"
3859 Many commands operate on message list specifications, as documented in
3860 .Sx "Specifying messages" .
3861 The argument input is first split into individual tokens via
3862 .Sx "Shell-style argument quoting" ,
3863 which are then interpreted as the mentioned specifications.
3864 If no explicit message list has been specified, many commands will
3865 search for and use the next message forward that satisfies the commands'
3866 requirements, and if there are no messages forward of the current
3867 message, the search proceeds backwards;
3868 if there are no good messages at all to be found, an error message is
3869 shown and the command is aborted.
3871 .Va verbose
3872 output of the command
3873 .Ic list
3874 will indicate whether a command searches for a default message, or not.
3875 .\" }}}
3877 .\" .Ss "Raw data arguments for codec commands" {{{
3878 .Ss "Raw data arguments for codec commands"
3880 A special set of commands, which all have the string
3881 .Dq codec
3882 in their name, like
3883 .Ic addrcodec ,
3884 .Ic shcodec ,
3885 .Ic urlcodec ,
3886 take raw string data as input, which means that the content of the
3887 command input line is passed completely unexpanded and otherwise
3888 unchanged: like this the effect of the actual codec is visible without
3889 any noise of possible shell quoting rules etc., i.e., the user can input
3890 one-to-one the desired or questionable data.
3891 To gain a level of expansion, the entire command line can be
3892 .Ic eval Ns
3893 uated first, for example
3895 .Bd -literal -offset indent
3896 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3897 ? echo $res
3898 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3899 ? shcodec d $res
3900 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3901 ? eval shcodec d $res
3902 /usr/Sch\[:o]nes Wetter/heute.txt
3904 .\" }}}
3906 .\" .Ss "Filename transformations" {{{
3907 .Ss "Filename transformations"
3909 Filenames, where expected, and unless documented otherwise, are
3910 subsequently subject to the following filename transformations, in
3911 sequence:
3913 .Bl -bullet -offset indent
3915 If the given name is a registered
3916 .Ic shortcut ,
3917 it will be replaced with the expanded shortcut.
3918 This step is mostly taken for
3919 .Ic folder Ns
3920 s only.
3923 The filename is matched against the following patterns or strings.
3924 But for plus
3925 .Ar +file
3926 .Va folder
3927 expansion this step is mostly taken for
3928 .Ic folder Ns
3929 s only.
3933 .Bl -hang -compact -width ".Ar %user"
3934 .It Ar #
3935 (Number sign) is expanded to the previous file.
3937 .It Ar %
3938 (Percent sign) is replaced by the invoking
3939 .Mx -ix "primary system mailbox"
3940 user's primary system mailbox, which either is the (itself expandable)
3941 .Va inbox
3942 if that is set, the standardized absolute pathname indicated by
3943 .Ev MAIL
3944 if that is set, or a built-in compile-time default otherwise.
3945 When opening a
3946 .Ic folder
3947 the used name is actively checked for being a primary mailbox, first
3948 against
3949 .Va \&\&inbox ,
3950 then against
3951 .Ev MAIL .
3953 .It Ar %user
3954 Expands to the primary system mailbox of
3955 .Ar user
3956 (and never the value of
3957 .Va inbox ,
3958 regardless of its actual setting).
3960 .It Ar &
3961 (Ampersand) is replaced with the invoking user's
3962 .Mx -ix "secondary mailbox"
3963 secondary mailbox, the
3964 .Ev MBOX .
3966 .It Ar +file
3967 Refers to a
3968 .Ar file
3969 in the
3970 .Va folder
3971 directory (if that variable is set).
3973 .It Ar %:filespec
3974 Expands to the same value as
3975 .Ar filespec ,
3976 but has special meaning when used with, for example, the command
3977 .Ic folder :
3978 the file will be treated as a primary system mailbox by, among others, the
3979 .Ic mbox
3981 .Ic save
3982 commands, meaning that messages that have been read in the current
3983 session will be moved to the
3984 .Ev MBOX
3985 mailbox instead of simply being flagged as read.
3990 Meta expansions may be applied to the resulting filename, as allowed by
3991 the operation and applicable to the resulting access protocol (also see
3992 .Sx "On URL syntax and credential lookup" ) .
3993 For the file-protocol, a leading tilde
3994 .Ql ~
3995 character will be replaced by the expansion of
3996 .Ev HOME ,
3997 except when followed by a valid user name, in which case the home
3998 directory of the given user is used instead.
4000 A shell expansion as if specified in double-quotes (see
4001 .Sx "Shell-style argument quoting" )
4002 may be applied, so that any occurrence of
4003 .Ql $VARIABLE
4005 .Ql ${VARIABLE} )
4006 will be replaced by the expansion of the variable, if possible;
4007 .Sx "INTERNAL VARIABLES"
4008 as well as
4009 .Sx ENVIRONMENT
4010 (shell) variables can be accessed through this mechanism.
4012 Shell pathname wildcard pattern expansions
4013 .Pf ( Xr glob 7 )
4014 may be applied as documented.
4015 If the fully expanded filename results in multiple pathnames and the
4016 command is expecting only one file, an error results.
4018 In interactive context, in order to allow simple value acceptance (via
4019 .Dq ENTER ) ,
4020 arguments will usually be displayed in a properly quoted form, so a file
4021 .Ql diet\e is \ecurd.txt
4022 may be displayed as
4023 .Ql 'diet\e is \ecurd.txt' .
4025 .\" }}}
4027 .\" .Ss "Commands" {{{
4028 .Ss "Commands"
4030 The following commands are available:
4032 .Bl -tag -width ".It Ic BaNg"
4036 .It Ic \&!
4037 Executes the
4038 .Ev SHELL
4039 command which follows, replacing unescaped exclamation marks with the
4040 previously executed command if the internal variable
4041 .Va bang
4042 is set.
4043 This command supports
4044 .Cm vput
4045 as documented in
4046 .Sx "Command modifiers" ,
4047 and manages the error number
4048 .Va \&! .
4049 A 0 or positive exit status
4050 .Va \&?
4051 reflects the exit status of the command, negative ones that
4052 an error happened before the command was executed, or that the program
4053 did not exit cleanly, but maybe due to a signal: the error number is
4054 .Va ^ERR Ns -CHILD ,
4055 then.
4058 In conjunction with the
4059 .Cm vput
4060 modifier the following special cases exist:
4061 a negative exit status occurs if the collected data could not be stored
4062 in the given variable, which is a
4063 .Va ^ERR Ns -NOTSUP
4064 error that should otherwise not occur.
4065 .Va ^ERR Ns -CANCELED
4066 indicates that no temporary file could be created to collect the command
4067 output at first glance.
4068 In case of catchable out-of-memory situations
4069 .Va ^ERR Ns -NOMEM
4070 will occur and \*(UA will try to store the empty string, just like with
4071 all other detected error conditions.
4075 .It Ic #
4076 The comment-command causes the entire line to be ignored.
4077 .Sy Note:
4078 this really is a normal command which' purpose is to discard its
4079 arguments, not a
4080 .Dq comment-start
4081 indicating special character, which means that for example trailing
4082 comments on a line are not possible (except for commands which use
4083 .Sx "Shell-style argument quoting" ) .
4086 .It Ic +
4087 Goes to the next message in sequence and types it
4088 (like
4089 .Dq ENTER ) .
4092 .It Ic -
4093 Display the preceding message, or the n'th previous message if given
4094 a numeric argument n.
4097 .It Ic =
4098 Shows the message number of the current message (the
4099 .Dq dot )
4100 when used without arguments, that of the given list otherwise.
4101 Output numbers will be separated from each other with the first
4102 character of
4103 .Va ifs ,
4104 and followed by the first character of
4105 .Va if-ws ,
4106 if that is not empty and not identical to the first.
4107 If that results in no separation at all a
4108 .Cm space
4109 character is used.
4110 This command supports
4111 .Cm vput
4112 (see
4113 .Sx "Command modifiers" ) ,
4114 and manages the error number
4115 .Va \&! .
4118 .It Ic \&?
4119 \*(OP Show a brief summary of commands.
4120 \*(OP Given an argument a synopsis for the command in question is
4121 shown instead; commands can be abbreviated in general and this command
4122 can be used to see the full expansion of an abbreviation including the
4123 synopsis, try, for example
4124 .Ql \&?h ,
4125 .Ql \&?hel
4127 .Ql \&?help
4128 and see how the output changes.
4129 To avoid that aliases are resolved the modifier
4130 .Cm \e
4131 can be prepended to the argument, but note it must be quoted.
4132 This mode also supports a more
4133 .Va verbose
4134 output, which will provide the information documented for
4135 .Ic list .
4138 .It Ic \&|
4139 A synonym for the
4140 .Ic pipe
4141 command.
4145 .It Ic account , unaccount
4146 (ac, una) Creates, selects or lists (an) account(s).
4147 Accounts are special incarnations of
4148 .Ic define Ns d
4149 macros and group commands and variable settings which together usually
4150 arrange the environment for the purpose of creating an email account.
4151 Different to normal macros settings which are covered by
4152 .Ic localopts
4153 \(en here by default enabled! \(en will not be reverted before the
4154 .Ic account
4155 is changed again.
4156 The special account
4157 .Ql null
4158 (case-insensitive) always exists, and all but it can be deleted by the
4159 latter command, and in one operation with the special name
4160 .Ql * .
4161 Also for all but it a possibly set
4162 .Va on-account-cleanup
4163 hook is called once they are left, also for program exit.
4165 Without arguments a listing of all defined accounts is shown.
4166 With one argument the given account is activated: the system
4167 .Va inbox
4168 of that account will be activated (as via
4169 .Ic folder ) ,
4170 a possibly installed
4171 .Va folder-hook
4172 will be run, and the internal variable
4173 .Va account
4174 will be updated.
4175 The two argument form behaves identical to defining a macro as via
4176 .Ic define .
4177 Important settings for accounts include
4178 .Va folder , from , hostname , inbox , mta , password
4180 .Va user
4181 .Pf ( Sx "On URL syntax and credential lookup" ) ,
4182 as well as things like
4183 .Va tls-config-pairs
4184 .Pf ( Sx "Encrypted network communication" ) ,
4185 and protocol specifics like
4186 .Va imap-auth , pop3-auth , smtp-auth .
4187 .Bd -literal -offset indent
4188 account myisp {
4189   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
4190   set from='(My Name) myname@myisp.example'
4191   set mta=smtp://mylogin@smtp.myisp.example
4197 .It Ic addrcodec
4198 Perform email address codec transformations on raw-data argument, rather
4199 according to email standards (RFC 5322; \*(ID will furtherly improve).
4200 Supports
4201 .Cm vput
4202 (see
4203 .Sx "Command modifiers" ) ,
4204 and manages the error number
4205 .Va \&! .
4206 The first argument must be either
4207 .Ar [+[+[+]]]e[ncode] ,
4208 .Ar d[ecode] ,
4209 .Ar s[kin]
4211 .Ar skinl[ist]
4212 and specifies the operation to perform on the rest of the line.
4215 Decoding will show how a standard-compliant MUA will display the given
4216 argument, which should be an email address.
4217 Please be aware that most MUAs have difficulties with the address
4218 standards, and vary wildly when (comments) in parenthesis,
4219 .Dq double-quoted
4220 strings, or quoted-pairs, as below, become involved.
4221 \*(ID \*(UA currently does not perform decoding when displaying addresses.
4224 Skinning is identical to decoding but only outputs the plain address,
4225 without any string, comment etc. components.
4226 Another difference is that it may fail with the error number
4227 .Va \&!
4228 set to
4229 .Va ^ERR Ns -INVAL
4230 if decoding fails to find a(n) (valid) email address, in which case the
4231 unmodified input will be output again.
4234 .Ar skinlist
4235 first performs a skin operation, and thereafter checks a valid
4236 address for whether it is a registered mailing list (see
4237 .Ic mlist
4239 .Ic mlsubscribe ) ,
4240 eventually reporting that state in the error number
4241 .Va \&!
4243 .Va ^ERR Ns -EXIST .
4244 (This state could later become overwritten by an I/O error, though.)
4247 Encoding supports four different modes, lesser automated versions can be
4248 chosen by prefixing one, two or three plus signs: the standard imposes
4249 a special meaning on some characters, which thus have to be transformed
4250 to so-called quoted-pairs by pairing them with a reverse solidus
4251 .Ql \e
4252 in order to remove the special meaning; this might change interpretation
4253 of the entire argument from what has been desired, however!
4254 Specify one plus sign to remark that parenthesis shall be left alone,
4255 two for not turning double quotation marks into quoted-pairs, and three
4256 for also leaving any user-specified reverse solidus alone.
4257 The result will always be valid, if a successful exit status is reported
4258 (\*(ID the current parser fails this assertion for some constructs).
4259 \*(ID Addresses need to be specified in between angle brackets
4260 .Ql < ,
4261 .Ql >
4262 if the construct becomes more difficult, otherwise the current parser
4263 will fail; it is not smart enough to guess right.
4265 .Bd -literal -offset indent
4266 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
4267 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4268 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4269 "Hey, you", \e out\e there <diet@exam.ple>
4270 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4271 diet@exam.ple
4277 .It Ic alias , unalias
4278 \*(NQ(a, una) Define or list, and remove, respectively, address aliases,
4279 which are a method of creating personal distribution lists that map
4280 a single name to none to multiple receivers, to be expanded after
4281 .Sx "Compose mode"
4282 is left; the expansion correlates with
4283 .Va metoo .
4284 The latter command removes all given aliases, the special name asterisk
4285 .Ql *
4286 will remove all existing aliases.
4287 When used without arguments the former shows a list of all currently
4288 known aliases, with one argument only the target(s) of the given one.
4289 When given two arguments, hyphen-minus
4290 .Ql -
4291 being the first, the target(s) of the second is/are expanded recursively.
4294 In all other cases the given alias is newly defined, or will be appended
4295 to: arguments must either be themselves valid alias names, or any
4296 other address type (see
4297 .Sx "On sending mail, and non-interactive mode" ) .
4298 Recursive expansion of aliases can be prevented by prefixing the desired
4299 argument with the modifier reverse solidus
4300 .Cm \&\&\e .
4301 A valid alias name conforms to
4302 .Va mta-aliases
4303 syntax, but follow-up characters can also be the number sign
4304 .Ql # ,
4305 colon
4306 .Ql \&: ,
4307 commercial at
4308 .Ql @,
4309 exclamation mark
4310 .Ql \&! ,
4311 period
4312 .Ql \&.
4313 as well as
4314 .Dq any character that has the high bit set .
4315 The dollar sign
4316 .Ql $
4317 may be the last character.
4318 The number sign
4319 .Ql #
4320 may need
4321 .Sx "Shell-style argument quoting" .
4324 .\" ALIASCOLON next sentence
4325 \*(ID Unfortunately the colon is currently not supported, as it
4326 interferes with normal address parsing rules.
4327 .\" ALIASCOLON next sentence
4328 \*(ID Such high bit characters will likely cause warnings at the moment
4329 for the same reasons why colon is unsupported; also, in the future
4330 locale dependent character set validity checks will be performed.
4332 .Bd -literal -offset indent
4333 ? alias cohorts  bill jkf mark kridle@ucbcory ~/cohorts.mbox
4334 ? alias mark  mark@exam.ple
4335 ? set mta-aliases=/etc/aliases
4341 .It Ic alternates , unalternates
4342 \*(NQ (alt) Manage a list of alternate addresses or names of the active
4343 user, members of which will be removed from recipient lists (except one).
4344 There is a set of implicit alternates which is formed of the values of
4345 .Ev LOGNAME ,
4346 .Va from ,
4347 .Va sender
4349 .Va reply-to .
4350 .Va from
4351 will not be used if
4352 .Va sender
4353 is set.
4354 The latter command removes the given list of alternates, the special name
4355 .Ql *
4356 will discard all existing alternate names.
4358 The former command manages the error number
4359 .Va \&! .
4360 It shows the current set of alternates when used without arguments; in
4361 this mode only it also supports
4362 .Cm vput
4363 (see
4364 .Sx "Command modifiers" ) .
4365 Otherwise the given arguments (after being checked for validity) are
4366 appended to the list of alternate names; in
4367 .Va posix
4368 mode they replace that list instead.
4372 .It Ic answered , unanswered
4373 Take a message lists and mark each message as (not) having been answered.
4374 Messages will be marked answered when being
4375 .Ic reply Ns d
4376 to automatically if the
4377 .Va markanswered
4378 variable is set.
4379 See the section
4380 .Sx "Message states" .
4385 .It Ic bind , unbind
4386 \*(OP\*(NQ The bind command extends the MLE (see
4387 .Sx "On terminal control and line editor" )
4388 with freely configurable key bindings.
4389 The latter command removes from the given context the given key binding,
4390 both of which may be specified as a wildcard
4391 .Ql * ,
4392 so that
4393 .Ql unbind * *
4394 will remove all bindings of all contexts.
4395 Due to initialization order unbinding will not work for built-in key
4396 bindings upon program startup, however: please use
4397 .Va line-editor-no-defaults
4398 for this purpose instead.
4401 With zero arguments, or with a context name the former command shows
4402 all key bindings (of the given context; an asterisk
4403 .Ql *
4404 will iterate over all contexts); a more verbose listing will be
4405 produced if either of
4406 .Va debug
4408 .Va verbose
4409 are set.
4410 With two or more arguments a specific binding is shown, or
4411 (re)established: the first argument is the context to which the binding
4412 shall apply, the second argument is a comma-separated list of the
4413 .Dq keys
4414 which form the binding.
4415 Further arguments will be joined to form the expansion, and cause the
4416 binding to be created or updated.
4417 To indicate that a binding shall not be auto-committed, but that the
4418 expansion shall instead be furtherly editable by the user, a commercial at
4419 .Ql @
4420 (that will be removed) can be placed last in the expansion, from which
4421 leading and trailing whitespace will finally be removed.
4422 Reverse solidus cannot be used as the last character of expansion.
4423 An empty expansion will be rejected.
4426 Contexts define when a binding applies, i.e., a binding will not be seen
4427 unless the context for which it is defined for is currently active.
4428 This is not true for the shared binding
4429 .Ql base ,
4430 which is the foundation for all other bindings and as such always
4431 applies, its bindings, however, only apply secondarily.
4432 The available contexts are the shared
4433 .Ql base ,
4435 .Ql default
4436 context which is used in all not otherwise documented situations, and
4437 .Ql compose ,
4438 which applies only to
4439 .Sx "Compose mode" .
4442 Bindings are specified as a comma-separated list of byte-sequences,
4443 where each list entry corresponds to one
4444 .Dq key
4445 (press).
4446 Byte sequence boundaries will be forcefully terminated after
4447 .Va bind-inter-byte-timeout
4448 milliseconds, whereas key sequences can be timed out via
4449 .Va bind-inter-key-timeout .
4450 A list entry may, indicated by a leading colon character
4451 .Ql \&: ,
4452 also refer to the name of a terminal capability; several dozen names
4453 are compiled in and may be specified either by their
4454 .Xr terminfo 5 ,
4455 or, if existing, by their
4456 .Xr termcap 5
4457 name, regardless of the actually used \*(OPal terminal control library.
4458 But any capability may be used, as long as the name is resolvable by the
4459 \*(OPal control library, or was defined via the internal variable
4460 .Va termcap .
4461 Input sequences are not case-normalized, an exact match is required to
4462 update or remove a binding.
4463 It is advisable to use an initial escape or other control character (like
4464 .Ql \ecA )
4465 for user (as opposed to purely terminal capability based) bindings in
4466 order to avoid ambiguities; it also reduces search time.
4467 Examples:
4469 .Bd -literal -offset indent
4470 ? bind base a,b echo one
4471 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4472 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete
4473 ? bind default $'\ecA',:khome,w 'echo Editable binding@'
4474 ? bind default a,b,c rm -irf / @  # Also editable
4475 ? bind default :kf1 File %
4476 ? bind compose :kf1 ~v
4480 Note that the entire comma-separated list is first parsed (over) as a
4481 shell-token with whitespace as the field separator, then parsed and
4482 expanded for real with comma as the field separator, therefore
4483 whitespace needs to be properly quoted, see
4484 .Sx "Shell-style argument quoting" .
4485 Using Unicode reverse solidus escape sequences renders a binding
4486 defunctional if the locale does not support Unicode (see
4487 .Sx "Character sets" ) ,
4488 and using terminal capabilities does so if no (corresponding) terminal
4489 control support is (currently) available.
4490 Adding, deleting or modifying a key binding invalidates the internal
4491 prebuilt lookup tree, it will be recreated as necessary: this process
4492 will be visualized in most
4493 .Va verbose
4494 as well as in
4495 .Va debug
4496 mode.
4499 The following terminal capability names are built-in and can be used in
4500 .Xr terminfo 5
4501 or (if available) the two-letter
4502 .Xr termcap 5
4503 notation.
4504 See the respective manual for a list of capabilities.
4505 The program
4506 .Xr infocmp 1
4507 can be used to show all the capabilities of
4508 .Ev TERM
4509 or the given terminal type;
4510 using the
4511 .Fl \&\&x
4512 flag will also show supported (non-standard) extensions.
4515 .Bl -tag -compact -width kcuuf_or_kcuuf
4516 .It Cd kbs Ns \0or Cd kb
4517 Backspace.
4518 .It Cd kdch1 Ns \0or Cd kD
4519 Delete character.
4520 .It Cd kDC Ns \0or Cd *4
4521 \(em shifted variant.
4522 .It Cd kel Ns \0or Cd kE
4523 Clear to end of line.
4524 .It Cd kext Ns \0or Cd @9
4525 Exit.
4526 .It Cd kich1 Ns \0or Cd kI
4527 Insert character.
4528 .It Cd kIC Ns \0or Cd #3
4529 \(em shifted variant.
4530 .It Cd khome Ns \0or Cd kh
4531 Home.
4532 .It Cd kHOM Ns \0or Cd #2
4533 \(em shifted variant.
4534 .It Cd kend Ns \0or Cd @7
4535 End.
4536 .It Cd knp Ns \0or Cd kN
4537 Next page.
4538 .It Cd kpp Ns \0or Cd kP
4539 Previous page.
4540 .It Cd kcub1 Ns \0or Cd kl
4541 Left cursor (with more modifiers: see below).
4542 .It Cd kLFT Ns \0or Cd #4
4543 \(em shifted variant.
4544 .It Cd kcuf1 Ns \0or Cd kr
4545 Right cursor (ditto).
4546 .It Cd kRIT Ns \0or Cd %i
4547 \(em shifted variant.
4548 .It Cd kcud1 Ns \0or Cd kd
4549 Down cursor (ditto).
4550 .It Cd kDN
4551 \(em shifted variant (only terminfo).
4552 .It Cd kcuu1 Ns \0or Cd ku
4553 Up cursor (ditto).
4554 .It Cd kUP
4555 \(em shifted variant (only terminfo).
4556 .It Cd kf0 Ns \0or Cd k0
4557 Function key 0.
4558 Add one for each function key up to
4559 .Cd kf9
4561 .Cd k9 ,
4562 respectively.
4563 .It Cd kf10 Ns \0or Cd k;
4564 Function key 10.
4565 .It Cd kf11 Ns \0or Cd F1
4566 Function key 11.
4567 Add one for each function key up to
4568 .Cd kf19
4570 .Cd F9 ,
4571 respectively.
4575 Some terminals support key-modifier combination extensions, e.g.,
4576 .Ql Alt+Shift+xy .
4577 For example, the delete key,
4578 .Cd kdch1 :
4579 in its shifted variant, the name is mutated to
4580 .Cd  kDC ,
4581 then a number is appended for the states
4582 .Ql Alt
4583 .Pf ( Cd kDC3 ) ,
4584 .Ql Shift+Alt
4585 .Pf ( Cd kDC4 ) ,
4586 .Ql Control
4587 .Pf ( Cd kDC5 ) ,
4588 .Ql Shift+Control
4589 .Pf ( Cd kDC6 ) ,
4590 .Ql Alt+Control
4591 .Pf ( Cd kDC7 ) ,
4592 finally
4593 .Ql Shift+Alt+Control
4594 .Pf ( Cd kDC8 ) .
4595 The same for the left cursor key,
4596 .Cd kcub1 :
4597 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4601 .It Ic call
4602 \*(NQ Calls the given macro, which must have been created via
4603 .Ic define
4604 (see there for more), otherwise an
4605 .Va ^ERR Ns -NOENT
4606 error occurs.
4607 Calling macros recursively will at some time excess the stack size
4608 limit, causing a hard program abortion; if recursively calling a macro
4609 is the last command of the current macro, consider to use the command
4610 .Ic xcall ,
4611 which will first release all resources of the current macro before
4612 replacing the current macro with the called one.
4616 .It Ic call_if
4617 Identical to
4618 .Ic call
4619 if the given macro has been created via
4620 .Ic define ,
4621 but does not fail nor warn if the macro does not exist.
4624 .It Ic cd
4625 Synonym for
4626 .Ic chdir .
4629 .It Ic certsave
4630 \*(OP Only applicable to S/MIME signed messages.
4631 Takes an optional message list and a filename and saves the certificates
4632 contained within the message signatures to the named file in both
4633 human-readable and PEM format.
4634 The certificates can later be used to send encrypted messages to the
4635 respective message senders by setting
4636 .Va smime-encrypt-USER@HOST
4637 variables.
4641 .It Ic charsetalias , uncharsetalias
4642 \*(NQ Manage alias mappings for (conversion of)
4643 .Sx "Character sets" .
4644 Alias processing is not performed for
4645 .Sx "INTERNAL VARIABLES" ,
4646 for example
4647 .Va charset-8bit ,
4648 and mappings are ineffective if character set conversion is not available
4649 .Pf ( Va features
4650 does not announce
4651 .Ql ,+iconv, ) .
4652 Expansion happens recursively for cases where aliases point to other
4653 aliases (built-in loop limit: 8).
4655 The latter command deletes all aliases given as arguments,
4656 or all at once when given the asterisk
4657 .Ql * .
4658 The former shows the list of all currently defined aliases if used
4659 without arguments, or the target of the given single argument;
4660 when given two arguments, hyphen-minus
4661 .Ql -
4662 being the first, the second is instead expanded recursively.
4663 In all other cases the given arguments are treated as pairs of character
4664 sets and their desired target alias name, creating new or updating
4665 already existing aliases.
4668 .It Ic chdir
4669 \*(NQ(ch) Change the working directory to
4670 .Ev HOME
4671 or the given argument.
4672 Synonym for
4673 .Ic cd .
4677 .It Ic collapse , uncollapse
4678 Only applicable to
4679 .Ql thread Ns
4681 .Ic sort
4682 mode.
4683 Takes a message list and makes all replies to these messages invisible
4684 in header summaries, except for
4685 .Ql new
4686 messages and the
4687 .Dq dot .
4688 Also when a message with collapsed replies is displayed,
4689 all of these are automatically uncollapsed.
4690 The latter command undoes collapsing.
4693 .\" FIXME review until this point
4696 .It Ic colour , uncolour
4697 \*(OP\*(NQ Manage colour mappings of and for a
4698 .Sx "Coloured display" .
4699 Without arguments the former shows all currently defined mappings.
4700 Otherwise a colour type is expected (case-insensitively),
4701 it must be one of
4702 .Ql 256
4703 for 256-colour terminals,
4704 .Ql 8 ,
4705 .Ql ansi
4707 .Ql iso
4708 for the standard 8-colour ANSI / ISO 6429 colour palette, and
4709 .Ql 1
4711 .Ql mono
4712 for monochrome terminals, which only support (some) font attributes.
4713 Without further arguments the list of all currently defined mappings
4714 of the given type is shown (here the special
4715 .Ql all
4717 .Ql *
4718 also show all currently defined mappings).
4721 Otherwise the second argument defines the mappable slot, the third
4722 argument a (comma-separated list of) colour and font attribute
4723 specification(s), and the optionally supported fourth argument can be
4724 used to specify a precondition: if conditioned mappings exist they are
4725 tested in (creation) order unless a (case-insensitive) match has been
4726 found, and the default mapping (if any has been established) will only
4727 be chosen as a last resort.
4728 The types of available preconditions depend on the mappable slot,
4729 the following of which exist:
4732 Mappings prefixed with
4733 .Ql mle-
4734 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4735 .Sx "On terminal control and line editor" )
4736 and do not support preconditions.
4738 .Bl -tag -compact -width view-partinfo
4739 .It Ar mle-position
4740 This mapping is used for the position indicator that is visible when
4741 a line cannot be fully displayed on the screen.
4742 .It Ar mle-prompt
4743 Used for the
4744 .Va prompt .
4745 .It Ar mle-error
4746 Used for the occasionally appearing error indicator that is joined onto
4747 .Va prompt .
4748 \*(ID Also used for error messages written on standard error .
4752 Mappings prefixed with
4753 .Ql sum-
4754 are used in header summaries, and they all understand the preconditions
4755 .Ql dot
4756 (the current message) and
4757 .Ql older
4758 for elder messages (only honoured in conjunction with
4759 .Va datefield-markout-older ) .
4761 .Bl -tag -compact -width view-partinfo
4762 .It Ar sum-dotmark
4763 This mapping is used for the
4764 .Dq dotmark
4765 that can be created with the
4766 .Ql %>
4768 .Ql %<
4769 formats of the variable
4770 .Va headline .
4771 .It Ar sum-header
4772 For the complete header summary line except the
4773 .Dq dotmark
4774 and the thread structure.
4775 .It Ar sum-thread
4776 For the thread structure which can be created with the
4777 .Ql %i
4778 format of the variable
4779 .Va headline .
4783 Mappings prefixed with
4784 .Ql view-
4785 are used when displaying messages.
4787 .Bl -tag -compact -width view-partinfo
4788 .It Ar view-from_
4789 This mapping is used for so-called
4790 .Ql From_
4791 lines, which are MBOX file format specific header lines (also see
4792 .Va mbox-rfc4155 ) .
4793 .It Ar view-header
4794 For header lines.
4795 A comma-separated list of headers to which the mapping applies may be
4796 given as a precondition; if the \*(OPal regular expression support is
4797 available then if any of the
4798 .Mx -sx
4799 .Sx "magic regular expression characters"
4800 is seen the precondition will be evaluated as (an extended) one.
4801 .It Ar view-msginfo
4802 For the introductional message info line.
4803 .It Ar view-partinfo
4804 For MIME part info lines.
4808 The following (case-insensitive) colour definitions and font attributes
4809 are understood, multiple of which can be specified in a comma-separated
4810 list:
4812 .Bl -tag -width ft=
4813 .It Ar ft=
4814 a font attribute:
4815 .Ql bold ,
4816 .Ql reverse
4818 .Ql underline .
4819 It is possible (and often applicable) to specify multiple font
4820 attributes for a single mapping.
4822 .It Ar fg=
4823 foreground colour attribute, in order (numbers 0 - 7)
4824 .Ql black ,
4825 .Ql red ,
4826 .Ql green ,
4827 .Ql brown ,
4828 .Ql blue ,
4829 .Ql magenta ,
4830 .Ql cyan
4832 .Ql white .
4833 To specify a 256-colour mode a decimal number colour specification in
4834 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4836 .Bl -tag -compact -width "999 - 999"
4837 .It 0 - 7
4838 the standard ISO 6429 colours, as above.
4839 .It 8 - 15
4840 high intensity variants of the standard colours.
4841 .It 16 - 231
4842 216 colours in tuples of 6.
4843 .It 232 - 255
4844 grayscale from black to white in 24 steps.
4846 .Bd -literal -offset indent
4847 #!/bin/sh -
4848 fg() { printf "\e033[38;5;${1}m($1)"; }
4849 bg() { printf "\e033[48;5;${1}m($1)"; }
4851 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4852 printf "\e033[0m\en"
4854 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4855 printf "\e033[0m\en"
4858 .It Ar bg=
4859 background colour attribute (see
4860 .Cd fg=
4861 for possible values).
4865 The command
4866 .Ic \&uncolour
4867 will remove for the given colour type (the special type
4868 .Ql *
4869 selects all) the given mapping; if the optional precondition argument is
4870 given only the exact tuple of mapping and precondition is removed.
4871 The special name
4872 .Ql *
4873 will remove all mappings (no precondition allowed), thus
4874 .Ql uncolour * *
4875 will remove all established mappings.
4880 .It Ic commandalias , uncommandalias
4881 \*(NQ Define or list, and remove, respectively, command aliases.
4882 An (command)alias can be used everywhere a normal command can be used,
4883 but always takes precedence: any arguments that are given to the command
4884 alias are joined onto the alias expansion, and the resulting string
4885 forms the command line that is, in effect, executed.
4886 The latter command removes all given aliases, the special name asterisk
4887 .Ql *
4888 will remove all existing aliases.
4889 When used without arguments the former shows a list of all currently
4890 known aliases, with one argument only the expansion of the given one.
4892 With two or more arguments a command alias is defined or updated: the
4893 first argument is the name under which the remaining command line should
4894 be accessible, the content of which can be just about anything.
4895 An alias may itself expand to another alias, but to avoid expansion loops
4896 further expansion will be prevented if an alias refers to itself or if
4897 an expansion depth limit is reached.
4898 Explicit expansion prevention is available via reverse solidus
4899 .Cm \e ,
4900 one of the
4901 .Sx "Command modifiers" .
4902 .Bd -literal -offset indent
4903 ? commandalias xx
4904 \*(uA: `commandalias': no such alias: xx
4905 ? commandalias xx echo hello,
4906 ? commandalias xx
4907 commandalias xx 'echo hello,'
4908 ? xx
4909 hello,
4910 ? xx world
4911 hello, world
4915 .It Ic Copy
4916 (C) Similar to
4917 .Ic copy ,
4918 but copy the messages to a file named after the local part of the
4919 sender of the first message instead of taking a filename argument;
4920 .Va outfolder
4921 is inspected to decide on the actual storage location.
4924 .It Ic copy
4925 (c) Copy messages to the named file and do not mark them as being saved;
4926 otherwise identical to
4927 .Ic save .
4931 .It Ic csop
4932 \*(NQ A multiplexer command which provides C-style string operations on
4933 8-bit bytes without a notion of locale settings and character sets,
4934 effectively assuming ASCII data.
4935 For numeric and other operations refer to
4936 .Ic vexpr .
4937 .Cm vput ,
4938 one of the
4939 .Sx "Command modifiers" ,
4940 is supported.
4941 The error result is
4942 .Ql -1
4943 for usage errors and numeric results, the empty string otherwise;
4944 missing data errors, as for unsuccessful searches, result in the
4945 .Va \&!
4946 error number being set to
4947 .Va ^ERR Ns -NODATA .
4948 Where the question mark
4949 .Ql \&?
4950 modifier suffix is supported, a case-insensitive (ASCII mapping)
4951 operation mode is supported; the keyword
4952 .Ql case
4953 is optional so that
4954 .Ql find?
4956 .Ql find?case
4957 are identical.
4959 .Bl -hang -width ".It Cm length"
4960 .It Cm length
4961 Queries the length of the given argument.
4963 .It Cm hash , Cm hash32
4964 Calculates a hash value of the given argument.
4965 The latter will return a 32-bit result regardless of host environment.
4966 .Ql \&?
4967 modifier suffix is supported.
4968 These use Chris Torek's hash algorithm, the resulting hash value is
4969 bit mixed as shown by Bret Mulvey.
4971 .It Cm find
4972 Search for the second in the first argument.
4973 Shows the resulting 0-based offset shall it have been found.
4974 .Ql \&?
4975 modifier suffix is supported.
4977 .It Cm substring
4978 Creates a substring of its first argument.
4979 The optional second argument is the 0-based starting offset,
4980 a negative one counts from the end;
4981 the optional third argument specifies the length of the desired result,
4982 a negative length leaves off the given number of bytes at the end of the
4983 original string; by default the entire string is used.
4984 This operation tries to work around faulty arguments (set
4985 .Va verbose
4986 for error logs), but reports them via the error number
4987 .Va \&!
4989 .Va ^ERR Ns -OVERFLOW .
4991 .It Cm trim
4992 Trim away whitespace characters from both ends of the argument.
4994 .It Cm trim-front
4995 Trim away whitespace characters from the begin of the argument.
4997 .It Cm trim-end
4998 Trim away whitespace characters from the end of the argument.
5003 .It Ic cwd
5004 Show the name of the current working directory, as reported by
5005 .Xr getcwd 3 .
5006 Supports
5007 .Cm vput
5008 (see
5009 .Sx "Command modifiers" ) .
5010 The return status is tracked via
5011 .Va \&? .
5014 .It Ic Decrypt
5015 \*(OP For unencrypted messages this command is identical to
5016 .Ic Copy ;
5017 Encrypted messages are first decrypted, if possible, and then copied.
5020 .It Ic decrypt
5021 \*(OP For unencrypted messages this command is identical to
5022 .Ic copy ;
5023 Encrypted messages are first decrypted, if possible, and then copied.
5028 .It Ic define , undefine
5029 The latter command deletes the given macro, the special name
5030 .Ql *
5031 will discard all existing macros.
5032 Deletion of (a) macro(s) can be performed from within running (a)
5033 macro(s), including self-deletion.
5034 Without arguments the former command prints the current list of macros,
5035 including their content, otherwise it defines a macro, replacing an
5036 existing one of the same name as applicable.
5039 A defined macro can be invoked explicitly by using the
5040 .Ic call ,
5041 .Ic call_if
5043 .Ic xcall
5044 commands, or implicitly if a macro hook is triggered, for example a
5045 .Va folder-hook .
5046 Execution of a macro body can be stopped from within by calling
5047 .Ic return .
5050 Temporary macro block-scope variables can be created or deleted with the
5051 .Cm local
5052 command modifier in conjunction with the commands
5053 .Ic set
5055 .Ic unset ,
5056 respectively.
5057 To enforce unrolling of changes made to (global)
5058 .Sx "INTERNAL VARIABLES"
5059 the command
5060 .Ic localopts
5061 can be used instead; its covered scope depends on how (i.e.,
5062 .Dq as what :
5063 normal macro, folder hook, hook,
5064 .Ic account
5065 switch) the macro is invoked.
5068 Inside a
5069 .Ic call Ns
5070 ed macro, the given positional parameters are implicitly local
5071 to the macro's scope, and may be accessed via the variables
5072 .Va * ,
5073 .Va @ ,
5074 .Va #
5076 .Va 1
5077 and any other positive unsigned decimal number less than or equal to
5078 .Va # .
5079 Positional parameters can be
5080 .Ic shift Ns
5081 ed, or become completely replaced, removed etc. via
5082 .Ic vpospar .
5083 A helpful command for numeric computation and string evaluations is
5084 .Ic vexpr ,
5085 .Ic csop
5086 offers C-style byte string operations.
5088 .Bd -literal -offset indent
5089 define name {
5090   command1
5091   command2
5092   ...
5093   commandN
5096 define exmac {
5097   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
5098   return 1000 0
5100 call exmac Hello macro exmac!
5101 echo ${?}/${!}/${^ERRNAME}
5107 .It Ic delete , undelete
5108 (d, u) Marks the given message list as being or not being
5109 .Ql deleted ,
5110 respectively; if no argument has been specified then the usual search
5111 for a visible message is performed, as documented for
5112 .Sx "Message list arguments" ,
5113 showing only the next input prompt if the search fails.
5114 Deleted messages will neither be saved in the
5115 .Mx -sx
5116 .Sx "secondary mailbox"
5117 .Ev MBOX
5118 nor will they be available for most other commands.
5119 If the
5120 .Va autoprint
5121 variable is set, the new
5122 .Dq dot
5123 or the last message restored, respectively, is automatically
5124 .Ic type Ns
5125 d; also see
5126 .Ic dp ,
5127 .Ic dt .
5131 .It Ic digmsg
5132 \*(NQ Digging (information out of) messages is possible through
5133 .Ic \&\&digmsg
5134 objects, which can be
5135 .Cm create Ns
5136 d for the given message number; in
5137 .Sx "Compose mode"
5138 the hyphen-minus
5139 .Ql -
5140 will instead open the message that is being composed.
5141 If a hyphen-minus is given as the optional third argument then output
5142 will be generated on the standard output channel instead of being
5143 subject to consumption by the
5144 .Ic readall
5146 .Ic read
5148 .Ic readsh )
5149 command(s).
5150 Note: output must be consumed before normal processing can continue; for
5151 .Ic \&\&digmsg
5152 objects this means each command output has to be read until the end of
5153 file (EOF) state occurs.
5156 The objects may be
5157 .Cm remove Ns
5158 d again by giving the same identifier used for creation;
5159 this step could be omitted: objects will be automatically closed
5160 when the active
5161 .Ic folder
5162 (mailbox) or the compose mode is left, respectively.
5163 In all other use cases the second argument is an object identifier,
5164 and the third and all following arguments are interpreted as via
5165 .Ic ~^
5166 (see
5167 .Sx "COMMAND ESCAPES" ) :
5169 .Bd -literal -offset indent
5170 ? vput = msgno; digmsg create $msgno
5171 ? digmsg $msgno header list;   readall x;   echon $x
5172 210 Subject From To Message-ID References In-Reply-To
5173 ? digmsg $msgno header show Subject;readall x;echon $x
5174 212 Subject
5175 \(aqHello, world'
5177 ? digmsg remove $msgno
5182 .It Ic discard
5183 (di) Identical to
5184 .Ic ignore .
5185 Superseded by the multiplexer
5186 .Ic headerpick .
5190 .It Ic dp , dt
5191 Delete the given messages and automatically
5192 .Ic type
5193 the new
5194 .Dq dot
5195 if one exists, regardless of the setting of
5196 .Va autoprint .
5199 .It Ic dotmove
5200 Move the
5201 .Dq dot
5202 up or down by one message when given
5203 .Ql +
5205 .Ql -
5206 argument, respectively.
5210 .It Ic draft , undraft
5211 Take message lists and mark each given message as being draft, or not
5212 being draft, respectively, as documented in the section
5213 .Sx "Message states" .
5216 .It Ic echo
5217 \*(NQ(ec) Print the given strings, equivalent to the shell utility
5218 .Xr echo 1 ,
5219 that is,
5220 .Sx "Shell-style argument quoting"
5221 expansion is performed and, different to the otherwise identical
5222 .Ic echon ,
5223 a trailing newline is echoed.
5224 .Cm vput
5225 as documented in
5226 .Sx "Command modifiers"
5227 is supported, and the error number
5228 .Va \&!
5229 is managed: if data is stored in a variable then the return value
5230 reflects the length of the result string in case of success and is
5231 .Ql -1
5232 on error.
5234 .Sy Remarks:
5235 this command traditionally (in BSD Mail) also performed
5236 .Sx "Filename transformations" ,
5237 which is standard incompatible and hard to handle because quoting
5238 transformation patterns is not possible; the subcommand
5239 .Cm file-expand
5241 .Ic vexpr
5242 can be used to expand filenames.
5245 .It Ic echoerr
5246 \*(NQ Identical to
5247 .Ic echo ,
5248 but the message is written to standard error, and prefixed by
5249 .Va log-prefix .
5250 Also see
5251 .Ic echoerrn .
5252 In interactive sessions the \*(OPal message ring queue for
5253 .Ic errors
5254 will be used instead, if available and
5255 .Cm vput
5256 was not used.
5259 .It Ic echon
5260 \*(NQ Identical to
5261 .Ic echo ,
5262 but does not write or store a trailing newline.
5265 .It Ic echoerrn
5266 \*(NQ Identical to
5267 .Ic echoerr ,
5268 but does not write or store a trailing newline.
5271 .It Ic edit
5272 (e) Point the text
5273 .Ev EDITOR
5274 at each message from the given list in turn.
5275 Modified contents are discarded unless the
5276 .Va writebackedited
5277 variable is set, and are not used unless the mailbox can be written to
5278 and the editor returns a successful exit status.
5279 .Ic visual
5280 can be used instead for a more display oriented editor.
5283 .It Ic elif
5284 Part of the
5285 .Ic if
5286 (see there for more),
5287 .Ic elif , else , endif
5288 conditional \(em if the condition of a preceding
5289 .Ic if
5290 was false, check the following condition and execute the following block
5291 if it evaluates true.
5294 .It Ic else
5295 (el) Part of the
5296 .Ic if
5297 (see there for more),
5298 .Ic elif , else , endif
5299 conditional \(em if none of the conditions of the preceding
5300 .Ic if
5302 .Ic elif
5303 commands was true, the
5304 .Ic else
5305 block is executed.
5308 .It Ic endif
5309 (en) Marks the end of an
5310 .Ic if
5311 (see there for more),
5312 .Ic elif , else , endif
5313 conditional execution block.
5317 .It Ic environ
5318 \*(NQ There is a strict separation in between
5319 .Sx "INTERNAL VARIABLES"
5320 and the program
5321 .Sx ENVIRONMENT ,
5322 which is inherited by child processes.
5323 Some variables of the latter are however vivid for program operation,
5324 their purpose is known, therefore they have been integrated
5325 transparently into handling of the former, as accessible via
5326 .Ic set
5328 .Ic unset .
5329 To integrate any other environment variable, and/or to export internal
5330 variables into the process environment where they normally are not, a
5331 .Cm link
5332 needs to become established with this command, for example
5335 .Dl environ link PERL5LIB TZ
5338 Afterwards changing such variables with
5339 .Ic set
5340 will cause automatic updates of the environment, too.
5341 Sufficient system support provided (it was in BSD as early as 1987, and
5342 is standardized since Y2K) removing such variables with
5343 .Ic unset
5344 will remove them also from the environment, but in any way the knowledge
5345 they ever have been
5346 .Cm link Ns
5347 ed will be lost.
5348 This implies that
5349 .Ic localopts
5350 may cause loss of such links.
5353 The subcommand
5354 .Cm unlink
5355 removes an existing link without otherwise touching variables, the
5356 .Cm set
5358 .Cm unset
5359 subcommands are identical to
5360 .Ic set
5362 .Ic unset ,
5363 but additionally update the program environment accordingly; removing
5364 a variable breaks any freely established
5365 .Cm link .
5369 .It Ic errors
5370 \*(OP As console user interfaces at times scroll error messages by too
5371 fast and/or out of scope, data can additionally be sent to an error queue
5372 manageable by this command:
5373 .Ar show
5374 or no argument will display and clear the queue,
5375 .Ar clear
5376 will only clear it.
5377 As the queue becomes filled with
5378 .Va errors-limit
5379 entries the eldest entries are being dropped.
5380 There are also the variables
5381 .Va ^ERRQUEUE-COUNT
5383 .Va ^ERRQUEUE-EXISTS .
5386 .It Ic eval
5387 \*(NQ Construct a command by concatenating the arguments, separated with
5388 a single space character, and then evaluate the result.
5389 This command passes through the exit status
5390 .Va \&?
5391 and error number
5392 .Va \&!
5393 of the evaluated command; also see
5394 .Ic call .
5395 .Bd -literal -offset indent
5396 define xxx {
5397   echo "xxx arg <$1>"
5398   shift
5399   if $# -gt 0
5400     \excall xxx "$@"
5401   endif
5403 define yyy {
5404   eval "$@ ' ball"
5406 call yyy '\ecall xxx' "b\e$'\et'u ' "
5407 call xxx arg <b      u>
5408 call xxx arg <  >
5409 call xxx arg <ball>
5413 .It Ic exit
5414 (ex or x) Exit from \*(UA without changing the active mailbox and skip
5415 any saving of messages in the
5416 .Mx -sx
5417 .Sx "secondary mailbox"
5418 .Ev MBOX ,
5419 as well as a possibly tracked line editor
5420 .Va history-file .
5421 A possibly set
5422 .Va on-account-cleanup
5423 will be invoked, however.
5424 The optional status number argument will be passed through to
5425 .Xr exit 3 .
5426 \*(ID For now it can happen that the given status will be overwritten,
5427 later this will only occur if a later error needs to be reported onto an
5428 otherwise success indicating status.
5431 .It Ic File
5432 (Fi) Like
5433 .Ic folder ,
5434 but open the mailbox read-only.
5437 .It Ic file
5438 (fi) See
5439 .Ic folder .
5443 .It Ic filetype , unfiletype
5444 \*(NQ Define, list, and remove, respectively, file handler hooks,
5445 which provide (shell) commands that enable \*(UA to load and save MBOX
5446 files from and to files with the registered file extensions, as shown
5447 and described for
5448 .Ic folder .
5449 The extensions are used case-insensitively, yet the auto-completion
5450 feature of for example
5451 .Ic folder
5452 will only work case-sensitively.
5453 An intermediate temporary file will be used to store the expanded data.
5454 The latter command will remove hooks for all given extensions, asterisk
5455 .Ql *
5456 will remove all existing handlers.
5458 When used without arguments the former shows a list of all currently
5459 defined file hooks, with one argument the expansion of the given alias.
5460 Otherwise three arguments are expected, the first specifying the file
5461 extension for which the hook is meant, and the second and third defining
5462 the load- and save commands to deal with the file type, respectively,
5463 both of which must read from standard input and write to standard
5464 output.
5465 Changing hooks will not affect already opened mailboxes (\*(ID except below).
5466 \*(ID For now too much work is done, and files are oftened read in twice
5467 where once would be sufficient: this can cause problems if a filetype is
5468 changed while such a file is opened; this was already so with the
5469 built-in support of .gz etc. in Heirloom, and will vanish in v15.
5470 \*(ID For now all handler strings are passed to the
5471 .Ev SHELL for evaluation purposes; in the future a
5472 .Ql \&!
5473 prefix to load and save commands may mean to bypass this shell instance:
5474 placing a leading space will avoid any possible misinterpretations.
5475 .Bd -literal -offset indent
5476 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
5477     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
5478     zst 'zstd -dc' 'zstd -19 -zc' \e
5479     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5480 ? set record=+sent.zst.pgp
5485 .It Ic flag , unflag
5486 Take message lists and mark the messages as being flagged, or not being
5487 flagged, respectively, for urgent/special attention.
5488 See the section
5489 .Sx "Message states" .
5492 .It Ic Folder
5493 (Fold) Like
5494 .Ic folder ,
5495 but open the mailbox read-only.
5499 .It Ic folder
5500 (fold) Open a new, or show status information of the current mailbox.
5501 If an argument is given, changes (such as deletions) will be written
5502 out, a new mailbox will be opened, the internal variables
5503 .Va mailbox-resolved
5505 .Va mailbox-display
5506 will be updated, a set according
5507 .Va folder-hook
5508 is executed, and optionally a summary of
5509 .Ic headers
5510 is displayed if the variable
5511 .Va header
5512 is set.
5515 .Sx "Filename transformations"
5516 will be applied to the
5517 .Ar name
5518 argument, and
5519 .Ql protocol://
5520 prefixes are, i.e., URL (see
5521 .Sx "On URL syntax and credential lookup" )
5522 syntax is understood, as in
5523 .Ql mbox:///tmp/somefolder .
5524 If a protocol prefix is used the mailbox type is fixated, otherwise
5525 opening none-existing
5526 .Ic folders
5527 uses the protocol defined in
5528 .Va newfolders .
5531 For the protocols
5532 .Ar mbox
5534 .Ar file
5535 (MBOX database), as well as
5536 .Ar eml
5537 (electronic mail message \*(ID read-only) the list of all registered
5538 .Ic filetype Ns
5539 s is traversed to check whether hooks shall be used to load (and save)
5540 data from (and to) the given
5541 .Ar name .
5542 Changing hooks will not affect already opened mailboxes.
5543 For example, the following creates hooks for the
5544 .Xr gzip 1
5545 compression tool and a combined compressed and encrypted format:
5547 .Bd -literal -offset indent
5548 ? filetype \e
5549     gzip 'gzip -dc' 'gzip -c' \e
5550     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5554 For historic reasons
5555 .Ic filetype Ns
5556 s provide limited (case-sensitive) auto-completion capabilities.
5557 For example
5558 .Ql mbox.gz
5559 will be found for
5560 .Ql \&? file mbox ,
5561 provided that corresponding handlers are installed.
5562 It will neither find
5563 .Ql mbox.GZ
5565 .Ql mbox.Gz
5566 however, but an explicit
5567 .Ql \&? file mbox.GZ
5568 will find and use the handler for
5569 .Ql gz .
5570 \*(ID The latter mode can only be used for MBOX files.
5573 EML files consist of only one mail message,
5574 \*(ID and can only be opened read-only.
5575 When reading MBOX files tolerant POSIX rules are used by default.
5576 Invalid message boundaries that can be found quite often in historic
5577 MBOX files will be complained about (even more with
5578 .Va debug ) :
5579 in this case the method described for
5580 .Va mbox-rfc4155
5581 can be used to create a valid MBOX database from the invalid input.
5584 MBOX databases and EML files will always be protected via file-region locks
5585 .Pf ( Xr fcntl 2 )
5586 during file operations to protect against concurrent modifications.
5587 .Mx -ix "dotlock files"
5588 \*(OP An MBOX
5589 .Va inbox
5590 .Pf ( Ev MAIL )
5592 .Mx -sx
5593 .Sx "primary system mailbox"
5594 will also be protected by so-called dotlock files,
5595 the traditional way of mail spool file locking: for any file
5596 .Ql x
5597 a lock file
5598 .Ql x.lock
5599 will be created during the synchronization, in the same directory and
5600 with the same user and group identities as the file of interest \(em
5601 as necessary created by an external privileged dotlock helper.
5602 .Va dotlock-disable
5603 disables dotlock files.
5604 Also see
5605 .Sx FAQ :
5606 .Sx "Howto handle stale dotlock files" .
5609 \*(OP If no protocol has been fixated, and
5610 .Ar name
5611 refers to a directory with the subdirectories
5612 .Ql tmp ,
5613 .Ql new
5615 .Ql cur ,
5616 then it is treated as a folder in
5617 .Dq Maildir
5618 format.
5619 The maildir format stores each message in its own file, and has been
5620 designed so that file locking is not necessary when reading or writing
5621 files.
5624 \*(OPally URLs can be used to access network resources, securely via
5625 .Sx "Encrypted network communication" ,
5626 if so supported.
5627 Network communication socket timeouts are configurable via
5628 .Va socket-connect-timeout .
5629 All network traffic may be proxied over a SOCKS server via
5630 .Va socks-proxy .
5633 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
5634 .Dl \*(OU protocol://[user@]host[:port][/path]
5637 \*(OPally supported network protocols are
5638 .Ar pop3
5639 (POP3) and
5640 .Ar pop3s
5641 (POP3 with TLS encrypted transport),
5642 .Ar imap
5644 .Ar imaps .
5646 .Ar [/path]
5647 part is valid only for IMAP; there it defaults to
5648 .Ar INBOX .
5649 Network URLs require a special encoding as documented in the section
5650 .Sx "On URL syntax and credential lookup" .
5654 .It Ic folders
5655 Lists the names of all folders below the given argument or
5656 .Va folder .
5657 For file-based protocols
5658 .Ev LISTER
5659 will be used for display purposes.
5663 .It Ic Followup , followup
5664 \*(CM(F,fo) Similar to
5665 .Ic Reply ,
5667 .Ic reply ,
5668 respectively, but save the message in a file named after the local part
5669 of the (first) recipient's address, possibly overwriting
5670 .Va record ,
5671 and honouring
5672 .Va outfolder .
5673 Also see
5674 .Ic Copy
5676 .Ic Save .
5679 .It Ic Forward
5680 \*(CM Similar to
5681 .Ic forward ,
5682 but saves the message in a file named after the local part of the
5683 recipient's address (instead of in
5684 .Va record Ns ).
5687 .It Ic forward
5688 \*(CM Take a message list and the address of a recipient, subject to
5689 .Va fullnames ,
5690 to whom the messages are sent.
5691 The text of the original message is included in the new one,
5692 enclosed by the values of
5693 .Va forward-inject-head
5695 .Va forward-inject-tail .
5696 .Va content-description-forwarded-message
5697 is inspected.
5698 The list of included headers can be filtered with the
5699 .Ql forward
5700 slot of the white- and blacklisting command
5701 .Ic headerpick .
5702 Only the first part of a multipart message is included but for
5703 .Va forward-as-attachment .
5705 This may generate the errors
5706 .Va ^ERR Ns -DESTADDRREQ
5707 if no receiver has been specified, or was rejected by
5708 .Va expandaddr
5709 policy,
5710 .Va ^ERR Ns -IO
5711 if an I/O error occurs,
5712 .Va ^ERR Ns -NOTSUP
5713 if a necessary character set conversion fails, and
5714 .Va ^ERR Ns -INVAL
5715 for other errors.
5716 It can also fail with errors of
5717 .Sx "Specifying messages" .
5718 Any error stops processing of further messages.
5721 .It Ic from
5722 (f) Takes a list of message specifications and displays a summary of
5723 their message headers, exactly as via
5724 .Ic headers ,
5725 making the first message of the result the new
5726 .Dq dot
5727 (the last message if
5728 .Va showlast
5729 is set).
5730 An alias of this command is
5731 .Ic search .
5732 Also see
5733 .Sx "Specifying messages" .
5735 .It Ic Fwd
5736 \*(OB Alias for
5737 .Ic Forward .
5739 .It Ic fwd
5740 \*(OB Alias for
5741 .Ic forward .
5743 .It Ic fwdignore
5744 \*(OB Superseded by the multiplexer
5745 .Ic headerpick .
5747 .It Ic fwdretain
5748 \*(OB Superseded by the multiplexer
5749 .Ic headerpick .
5751 .It Ic ghost , unghost
5752 \*(OB Replaced by
5753 .Ic commandalias ,
5754 .Ic uncommandalias .
5758 .It Ic headerpick , unheaderpick
5759 \*(NQ Multiplexer command to manage white- and blacklisting
5760 selections of header fields for a variety of applications.
5761 Without arguments the set of contexts that have settings is displayed.
5762 When given arguments, the first argument is the context to which the
5763 command applies, one of (case-insensitive)
5764 .Ql type
5765 for display purposes (for example
5766 .Ic type ) ,
5767 .Ql save
5768 for selecting which headers shall be stored persistently when
5769 .Ic save ,
5770 .Ic copy ,
5771 .Ic move
5772 or even
5773 .Ic decrypt Ns
5774 ing messages (note that MIME related etc. header fields should not be
5775 ignored in order to not destroy usability of the message in this case),
5776 .Ql forward
5777 for stripping down messages when
5778 .Ic forward Ns
5779 ing message (has no effect if
5780 .Va forward-as-attachment
5781 is set), and
5782 .Ql top
5783 for defining user-defined set of fields for the command
5784 .Ic top .
5786 The current settings of the given context are displayed if it is the
5787 only argument.
5788 A second argument denotes the type of restriction that is to be chosen,
5789 it may be (a case-insensitive prefix of)
5790 .Ql retain
5792 .Ql ignore
5793 for white- and blacklisting purposes, respectively.
5794 Establishing a whitelist suppresses inspection of the corresponding
5795 blacklist.
5797 If no further argument is given the current settings of the given type
5798 will be displayed, otherwise the remaining arguments specify header
5799 fields, which \*(OPally may be given as regular expressions, to be added
5800 to the given type.
5801 The special wildcard field (asterisk,
5802 .Ql * )
5803 will establish a (fast) shorthand setting which covers all fields.
5805 The latter command always takes three or more arguments and can be used
5806 to remove selections, i.e., from the given context, the given type of
5807 list, all the given headers will be removed, the special argument
5808 .Ql *
5809 will remove all headers.
5812 .It Ic headers
5813 (h) Show the current group of headers, the size of which depends on
5814 the variable
5815 .Va screen
5816 in interactive mode, and the format of which can be defined with
5817 .Va headline .
5818 If a message-specification is given the group of headers containing the
5819 first message therein is shown and the message at the top of the screen
5820 becomes the new
5821 .Dq dot ;
5822 the last message is targeted if
5823 .Va showlast
5824 is set.
5827 .It Ic help
5828 (hel) A synonym for
5829 .Ic \&? .
5832 .It Ic history
5833 \*(OP Without arguments or when given
5834 .Cm show
5835 all history entries are shown (this mode also supports a more
5836 .Va verbose
5837 output).
5838 .Cm load
5839 will replace the list of entries with the content of
5840 .Va history-file ,
5842 .Cm save
5843 will dump all entries to said file, replacing former content, and
5844 .Cm clear
5845 will delete all entries.
5846 The argument can also be a signed decimal
5847 .Ar NUMBER ,
5848 which will select and evaluate the respective history entry, and move it
5849 to the top of the history; a negative number is used as an offset to the
5850 current command so that
5851 .Ql -1
5852 will select the last command, the history top, whereas
5853 .Cm delete
5854 will delete all given entries
5855 .Pf ( Ar :NUMBER: ) .
5856 Also see
5857 .Sx "On terminal control and line editor" .
5860 .It Ic hold
5861 (ho, also
5862 .Ic preserve )
5863 Takes a message list and marks each message therein to be saved in the
5864 user's system
5865 .Va inbox
5866 instead of in the
5867 .Mx -sx
5868 .Sx "secondary mailbox"
5869 .Ev MBOX .
5870 Does not override the
5871 .Ic delete
5872 command.
5873 \*(UA deviates from the POSIX standard with this command, because a
5874 .Ic next
5875 command issued after
5876 .Ic hold
5877 will display the following message, not the current one.
5881 .It Ic if
5882 (i) Part of the
5883 .Ic \&\&if , Ic elif , else , endif
5884 conditional execution construct \(em if the given condition is true then
5885 the encapsulated block is executed.
5886 The POSIX standard only supports the (case-insensitive) conditions
5887 .Ql r Ns
5888 eceive
5890 .Ql s Ns
5891 end, the remaining are non-portable extensions.
5892 \*(ID In conjunction with the
5893 .Cm wysh
5894 command prefix(es)
5895 .Sx "Shell-style argument quoting"
5896 and more test operators are available.
5898 .Bd -literal -offset indent
5899 if receive
5900   commands ...
5901 else
5902   commands ...
5903 endif
5907 Further (case-insensitive) one-argument conditions are
5908 .Ql t Ns
5909 erminal which evaluates to true in interactive terminal sessions
5910 (running with standard input or standard output attached to a terminal,
5911 and none of the
5912 .Dq quickrun
5913 command line options
5914 .Fl e ,
5915 .Fl H
5917 .Fl L
5918 have been used), as well as any boolean value (see
5919 .Sx "INTERNAL VARIABLES"
5920 for textual boolean representations) to mark an enwrapped block as
5921 .Dq never execute
5923 .Dq always execute .
5924 (Remarks: condition syntax errors skip all branches until
5925 .Ic endif . )
5928 \*(OU and without
5929 .Cm wysh :
5930 It is possible to check
5931 .Sx "INTERNAL VARIABLES"
5932 as well as
5933 .Sx ENVIRONMENT
5934 variables for existence or compare their expansion against a user given
5935 value or another variable by using the
5936 .Ql $
5937 .Pf ( Dq variable next )
5938 conditional trigger character;
5939 a variable on the right hand side may be signalled using the same
5940 mechanism.
5941 Variable names may be enclosed in a pair of matching braces.
5942 When this mode has been triggered, several operators are available
5943 (\*(IN and
5944 .Cm wysh :
5945 they are always available, and there is no trigger: variables will have
5946 been expanded by the shell-compatible parser before the
5947 .Ic if
5948 etc. command sees them).
5951 \*(IN Two argument conditions.
5952 Variables can be tested for existence and expansion:
5953 .Ql -N
5954 will test whether the given variable exists, so that
5955 .Ql -N editalong
5956 will evaluate to true when
5957 .Va editalong
5958 is set, whereas
5959 .Ql -Z editalong
5960 will if it is not.
5961 .Ql -n """$editalong"""
5962 will be true if the variable is set and expands to a non-empty string,
5963 .Ql -z $'\e$editalong'
5964 only if the expansion is empty, whether the variable exists or not.
5965 The remaining conditions take three arguments.
5968 Integer operators treat the arguments on the left and right hand side of
5969 the operator as integral numbers and compare them arithmetically.
5970 It is an error if any of the operands is not a valid integer, an empty
5971 argument (which implies it had been quoted) is treated as if it were 0.
5972 Via the question mark
5973 .Ql \&?
5974 modifier suffix a saturated operation mode is available where numbers
5975 will linger at the minimum or maximum possible value, instead of
5976 overflowing (or trapping), the keyword
5977 .Ql saturated
5978 is optional,
5979 .Ql ==? ,
5980 .Ql ==?satu
5982 .Ql ==?saturated
5983 are therefore identical.
5984 Available operators are
5985 .Ql -lt
5986 (less than),
5987 .Ql -le
5988 (less than or equal to),
5989 .Ql -eq
5990 (equal),
5991 .Ql -ne
5992 (not equal),
5993 .Ql -ge
5994 (greater than or equal to), and
5995 .Ql -gt
5996 (greater than).
5999 String and regular expression data operators compare the left and right
6000 hand side according to their textual content.
6001 Unset variables are treated as the empty string.
6002 Via the question mark
6003 .Ql \&?
6004 modifier suffix a case-insensitive operation mode is available, the keyword
6005 .Ql case
6006 is optional,
6007 .Ql ==?
6009 .Ql ==?case
6010 are identical.
6013 Available string operators are
6014 .Ql <
6015 (less than),
6016 .Ql <=
6017 (less than or equal to),
6018 .Ql ==
6019 (equal),
6020 .Ql !=
6021 (not equal),
6022 .Ql >=
6023 (greater than or equal to),
6024 .Ql >
6025 (greater than),
6026 .Ql =%
6027 (is substring of) and
6028 .Ql !%
6029 (is not substring of).
6030 By default these operators work on bytes and (therefore) do not take
6031 into account character set specifics.
6032 If the case-insensitivity modifier has been used, case is ignored
6033 according to the rules of the US-ASCII encoding, i.e., bytes are
6034 still compared.
6037 When the \*(OPal regular expression support is available, the additional
6038 string operators
6039 .Ql =~
6041 .Ql !~
6042 can be used.
6043 They treat the right hand side as an extended regular expression that is
6044 matched according to the active locale (see
6045 .Sx "Character sets" ) ,
6046 i.e., character sets should be honoured correctly.
6049 Conditions can be joined via AND-OR lists (where the AND operator is
6050 .Ql &&
6051 and the OR operator is
6052 .Ql || ) ,
6053 which have equal precedence and will be evaluated with left
6054 associativity, thus using the same syntax that is known for the
6055 .Xr sh 1 .
6056 It is also possible to form groups of conditions and lists by enclosing
6057 them in pairs of brackets
6058 .Ql [\ \&.\&.\&.\ ] ,
6059 which may be interlocked within each other, and also be joined via
6060 AND-OR lists.
6063 The results of individual conditions and entire groups may be modified
6064 via unary operators: the unary operator
6065 .Ql \&!
6066 will reverse the result.
6068 .Bd -literal -offset indent
6069 wysh set v15-compat=yes # with value: automatic "wysh"!
6070 if -N debug;echo *debug* set;else;echo not;endif
6071 if "$ttycharset" == UTF-8 || "$ttycharset" ==?cas UTF8
6072   echo ttycharset is UTF-8, the former case-sensitive!
6073 endif
6074 set t1=one t2=one
6075 if [ "${t1}" == "${t2}" ]
6076   echo These two variables are equal
6077 endif
6078 if "$features" =% ,+regex, && "$TERM" =~?case ^xterm\&.*
6079   echo ..in an X terminal
6080 endif
6081 if [ [ true ] && [ [ "${debug}" != '' ] || \e
6082     [ "$verbose" != '' ] ] ]
6083   echo Noisy, noisy
6084 endif
6085 if true && [ -n "$debug" || -n "${verbose}" ]
6086   echo Left associativity, as is known from the shell
6087 endif
6092 .It Ic ignore
6093 (ig) Identical to
6094 .Ic discard .
6095 Superseded by the multiplexer
6096 .Ic headerpick .
6099 .It Ic list
6100 Shows the names of all available commands, in command lookup order.
6101 \*(OP In conjunction with a set variable
6102 .Va verbose
6103 additional information will be provided for each command: the argument
6104 type will be indicated, the documentation string will be shown,
6105 and the set of command flags will show up:
6107 .Bl -tag -compact -width ".It Ql NEEDS_BOX"
6108 .It Ql "`local'"
6109 command supports the command modifier
6110 .Cm local .
6111 .It Ql "`vput'"
6112 command supports the command modifier
6113 .Cm vput .
6114 .It Ql "*!*"
6115 the error number is tracked in
6116 .Va \&! .
6117 .It Ql needs-box
6118 whether the command needs an active mailbox, a
6119 .Ic folder .
6120 .It Ql ok:
6121 indicators whether command is \&.\h'.3m'.\h'.3m'.
6122 .Bl -tag -compact -width ".It Ql SUBPROCESS"
6123 .It Ql batch/interactive
6124 usable in interactive or batch mode
6125 .Pf ( Fl # ) .
6126 .It Ql send-mode
6127 usable in send mode.
6128 .It Ql subprocess
6129 allowed to be used when running in a subprocess instance,
6130 for example from within a macro that is called via
6131 .Va on-compose-splice .
6133 .It Ql not ok:
6134 indicators whether command is not \&.\h'.3m'.\h'.3m'.
6135 .Bl -tag -compact -width ".It Ql COMPOSE_MODE"
6136 .It Ql compose mode
6137 available in
6138 .Sx "Compose mode".
6139 .It Ql startup
6140 available during program startup, like in
6141 .Sx "Resource files" .
6143 .It Ql "gabby"
6144 The command produces
6145 .Va history-gabby
6146 .Ic history
6147 entries.
6152 .It Ic localopts
6153 Enforce change localization of
6154 .Ic environ
6155 (linked)
6156 .Sx ENVIRONMENT
6157 as well as (global)
6158 .Sx "INTERNAL VARIABLES" ,
6159 meaning that their state will be reverted to the former one once the
6160 .Dq covered scope
6161 is left.
6162 Just like the command modifier
6163 .Cm local ,
6164 which provides block-scope localization for some commands (instead),
6165 it can only be used inside of macro definition blocks introduced by
6166 .Ic account
6168 .Ic define .
6169 The covered scope of an
6170 .Ic account
6171 is left once a different account is activated, and some macros, notably
6172 .Va folder-hook Ns s ,
6173 use their own specific notion of covered scope, here it will be extended
6174 until the folder is left again.
6177 This setting stacks up: i.e., if
6178 .Ql macro1
6179 enables change localization and calls
6180 .Ql macro2 ,
6181 which explicitly resets localization, then any value changes within
6182 .Ql macro2
6183 will still be reverted when the scope of
6184 .Ql macro1
6185 is left.
6186 (Caveats: if in this example
6187 .Ql macro2
6188 changes to a different
6189 .Ic account
6190 which sets some variables that are already covered by localizations,
6191 their scope will be extended, and in fact leaving the
6192 .Ic account
6193 will (thus) restore settings in (likely) global scope which actually
6194 were defined in a local, macro private context!)
6197 This command takes one or two arguments, the optional first one
6198 specifies an attribute that may be one of
6199 .Cm \&\&scope ,
6200 which refers to the current scope and is thus the default,
6201 .Cm call ,
6202 which causes any macro that is being
6203 .Ic call Ns
6204 ed to be started with localization enabled by default, as well as
6205 .Cm call-fixate ,
6206 which (if enabled) disallows any called macro to turn off localization:
6207 like this it can be ensured that once the current scope regains control,
6208 any changes made in deeper levels have been reverted.
6209 The latter two are mutually exclusive, and neither affects
6210 .Ic xcall .
6211 The (second) argument is interpreted as a boolean (string, see
6212 .Sx "INTERNAL VARIABLES" )
6213 and states whether the given attribute shall be turned on or off.
6215 .Bd -literal -offset indent
6216 define temporary_settings {
6217   set possibly_global_option1
6218   localopts on
6219   set localized_option1
6220   set localized_option2
6221   localopts scope off
6222   set possibly_global_option2
6229 .It Ic Lfollowup , Lreply
6230 \*(CM Reply to messages that come in via known
6231 .Pf ( Ic mlist )
6232 or subscribed
6233 .Pf ( Ic mlsubscribe )
6234 mailing lists, or pretend to do so (see
6235 .Sx "Mailing lists" ) :
6236 on top of the usual
6237 .Ic followup
6239 .Ic reply ,
6240 respectively, functionality this will actively resort and even remove
6241 message recipients in order to generate a message that is supposed to be
6242 sent to a mailing list.
6243 For example it will also implicitly generate a
6244 .Ql Mail-Followup-To:
6245 header if that seems useful, regardless of the setting of the variable
6246 .Va followup-to .
6247 For more documentation please refer to
6248 .Sx "On sending mail, and non-interactive mode" .
6250 This may generate the errors
6251 .Va ^ERR Ns -DESTADDRREQ
6252 if no receiver has been specified,
6253 .Va ^ERR Ns -PERM
6254 if some addressees where rejected by
6255 .Va expandaddr ,
6256 .Va ^ERR Ns -IO
6257 if an I/O error occurs,
6258 .Va ^ERR Ns -NOTSUP
6259 if a necessary character set conversion fails, and
6260 .Va ^ERR Ns -INVAL
6261 for other errors.
6262 It can also fail with errors of
6263 .Sx "Specifying messages" .
6264 Occurrence of some of the errors depend on the value of
6265 .Va expandaddr .
6266 Any error stops processing of further messages.
6269 .It Ic Mail
6270 \*(CM Similar to
6271 .Ic mail ,
6272 but saves the message in a file named after the local part of the first
6273 recipient's address (instead of in
6274 .Va record Ns ).
6277 .It Ic mail
6278 \*(CM(m) Takes a (list of) recipient address(es) as (an) argument(s),
6279 or asks on standard input if none were given;
6280 then collects the remaining mail content and sends it out.
6281 Unless the internal variable
6282 .Va fullnames
6283 is set recipient addresses will be stripped from comments, names etc.
6284 For more documentation please refer to
6285 .Sx "On sending mail, and non-interactive mode" .
6287 This may generate the errors
6288 .Va ^ERR Ns -DESTADDRREQ
6289 if no receiver has been specified,
6290 .Va ^ERR Ns -PERM
6291 if some addressees where rejected by
6292 .Va expandaddr ,
6293 .Va ^ERR Ns -NOTSUP
6294 if multiple messages have been specified,
6295 .Va ^ERR Ns -IO
6296 if an I/O error occurs,
6297 .Va ^ERR Ns -NOTSUP
6298 if a necessary character set conversion fails, and
6299 .Va ^ERR Ns -INVAL
6300 for other errors.
6301 It can also fail with errors of
6302 .Sx "Specifying messages" .
6303 Occurrence of some of the errors depend on the value of
6304 .Va expandaddr .
6307 .It Ic mailcap
6308 \*(OP When used without arguments or if
6309 .Ar show
6310 has been given the content of
6311 .Sx "The Mailcap files"
6312 cache is shown, (re-)initializing it first (as necessary.
6313 If the argument is
6314 .Ar load
6315 then the cache will only be (re-)initialized, and
6316 .Ar clear
6317 will remove its contents.
6318 Note that \*(UA will try to load the files only once, use
6319 .Ql Ic \&\&mailcap Ns \:\0\:clear
6320 to unlock further attempts.
6321 Loading and parsing can be made more
6322 .Va verbose .
6325 .It Ic mbox
6326 (mb) The given message list is to be sent to the
6327 .Mx -sx
6328 .Sx "secondary mailbox"
6329 .Ev MBOX
6330 when \*(UA is quit; this is the default action unless the variable
6331 .Va hold
6332 is set.
6333 \*(ID This command can only be used in a
6334 .Mx -sx
6335 .Sx "primary system mailbox" .
6339 .It Ic mimetype , unmimetype
6340 \*(NQ Without arguments the content of the MIME type cache will displayed;
6341 a more verbose listing will be produced if either of
6342 .Va debug
6344 .Va verbose
6345 are set.
6346 When given arguments they will be joined, interpreted as shown in
6347 .Sx "The mime.types files"
6348 (also see
6349 .Sx "HTML mail and MIME attachments" ) ,
6350 and the resulting entry will be added (prepended) to the cache.
6351 In any event MIME type sources are loaded first as necessary \(en
6352 .Va mimetypes-load-control
6353 can be used to fine-tune which sources are actually loaded.
6355 The latter command deletes all specifications of the given MIME type, thus
6356 .Ql \&? unmimetype text/plain
6357 will remove all registered specifications for the MIME type
6358 .Ql text/plain .
6359 The special name
6360 .Ql *
6361 will discard all existing MIME types, just as will
6362 .Ql reset ,
6363 but which also reenables cache initialization via
6364 .Va mimetypes-load-control .
6367 .It Ic mimeview
6368 \*(ID Only available in interactive mode, this command allows execution
6369 of external MIME type handlers which do not integrate into the normal
6370 .Ic type
6371 output (see
6372 .Sx "HTML mail and MIME attachments" ) .
6373 (\*(ID No syntax to directly address parts, this restriction may vanish.)
6374 The user will be asked for each non-text part of the given message in
6375 turn whether the registered handler shall be used to display the part.
6379 .It Ic mlist , unmlist
6380 \*(NQ Manage the list of known
6381 .Sx "Mailing lists" ;
6382 subscriptions are controlled via
6383 .Ic mlsubscribe .
6384 The latter command deletes all given arguments,
6385 or all at once when given the asterisk
6386 .Ql * .
6387 The former shows the list of all currently known lists if used
6388 without arguments, otherwise the given arguments will become known.
6389 \*(OP In the latter case, arguments which contain any of the
6390 .Mx -sx
6391 .Sx "magic regular expression characters"
6392 will be interpreted as one, possibly matching many addresses;
6393 these will be sequentially matched via linked lists instead of being
6394 looked up in a dictionary.
6398 .It Ic mlsubscribe , unmlsubscribe
6399 Building upon the command pair
6400 .Ic mlist , unmlist ,
6401 but only managing the subscription attribute of mailing lists.
6402 (The former will also create not yet existing mailing lists.)
6405 .It Ic Move
6406 Similar to
6407 .Ic move ,
6408 but move the messages to a file named after the local part of the
6409 sender of the first message instead of taking a filename argument;
6410 .Va outfolder
6411 is inspected to decide on the actual storage location.
6414 .It Ic move
6415 Acts like
6416 .Ic copy
6417 but marks the messages for deletion if they were transferred
6418 successfully.
6421 .It Ic More
6422 Like
6423 .Ic more ,
6424 but also displays header fields which would not pass the
6425 .Ic headerpick
6426 selection, and all MIME parts.
6427 Identical to
6428 .Ic Page .
6431 .It Ic more
6432 Invokes the
6433 .Ev PAGER
6434 on the given messages, even in non-interactive mode and as long as the
6435 standard output is a terminal.
6436 Identical to
6437 .Ic page .
6440 .It Ic mtaaliases
6441 \*(OP When used without arguments or if
6442 .Ar show
6443 has been given the content of the
6444 .Va mta-aliases
6445 cache is shown, (re-)initializing it first (as necessary).
6446 If the argument is
6447 .Ar load
6448 then the cache will only be (re-)initialized, and
6449 .Ar clear
6450 will remove its contents.
6453 .It Ic netrc
6454 \*(OP When used without arguments, or when the argument was
6455 .Ar show
6456 the content of the
6457 .Pa \*(VN
6458 cache is shown, initializing it as necessary.
6459 If the argument is
6460 .Ar load
6461 then the cache will be (re)loaded, whereas
6462 .Ar clear
6463 removes it.
6464 Loading and parsing can be made more
6465 .Va verbose .
6466 .Ar lookup
6467 will query the cache for the URL given as the second argument
6468 .Pf ( Ql [USER@]HOST ) .
6470 .Va netrc-lookup ,
6471 .Va netrc-pipe
6472 and the section
6473 .Sx "On URL syntax and credential lookup" ;
6474 the section
6475 .Sx "The .netrc file"
6476 documents the file format in detail.
6479 .It Ic newmail
6480 Checks for new mail in the current folder without committing any changes
6481 before.
6482 If new mail is present, a message is shown.
6483 If the
6484 .Va header
6485 variable is set,
6486 the headers of each new message are also shown.
6487 This command is not available for all mailbox types.
6490 .It Ic next
6491 (n) (like
6492 .Ql +
6494 .Dq ENTER )
6495 Goes to the next message in sequence and types it.
6496 With an argument list, types the next matching message.
6499 .It Ic New
6500 Same as
6501 .Ic Unread .
6504 .It Ic new
6505 Same as
6506 .Ic unread .
6509 .It Ic noop
6510 If the current folder is accessed via a network connection, a
6511 .Dq NOOP
6512 command is sent, otherwise no operation is performed.
6515 .It Ic Page
6516 Like
6517 .Ic page ,
6518 but also displays header fields which would not pass the
6519 .Ic headerpick
6520 selection, and all MIME parts.
6521 Identical to
6522 .Ic More .
6525 .It Ic page
6526 Invokes the
6527 .Ev PAGER
6528 on the given messages, even in non-interactive mode and as long as the
6529 standard output is a terminal.
6530 Identical to
6531 .Ic more .
6534 .It Ic Pipe
6535 Like
6536 .Ic pipe
6537 but also pipes header fields which would not pass the
6538 .Ic headerpick
6539 selection, and all parts of MIME
6540 .Ql multipart/alternative
6541 messages.
6544 .It Ic pipe
6545 (pi) Takes an optional message list and shell command (that defaults to
6546 .Va cmd ) ,
6547 and pipes the messages through the command.
6548 If the
6549 .Va page
6550 variable is set,
6551 every message is followed by a formfeed character.
6554 .It Ic preserve
6555 (pre) A synonym for
6556 .Ic hold .
6559 .It Ic Print
6560 (P) Alias for
6561 .Ic Type .
6564 .It Ic print
6565 (p) Research
6567 equivalent of
6568 .Ic type .
6571 .It Ic quit
6572 (q) Terminates the session, saving all undeleted, unsaved messages in
6573 the current
6574 .Mx -sx
6575 .Sx "secondary mailbox"
6576 .Ev MBOX ,
6577 preserving all messages marked with
6578 .Ic hold
6580 .Ic preserve
6581 or never referenced in the system
6582 .Va inbox ,
6583 and removing all other messages from the
6584 .Mx -sx
6585 .Sx "primary system mailbox" .
6586 If new mail has arrived during the session,
6587 the message
6588 .Dq You have new mail
6589 will be shown.
6590 If given while editing a mailbox file with the command line option
6591 .Fl f ,
6592 then the edit file is rewritten.
6593 A return to the shell is effected,
6594 unless the rewrite of edit file fails,
6595 in which case the user can escape with the exit command.
6596 The optional status number argument will be passed through to
6597 .Xr exit 3 .
6598 \*(ID For now it can happen that the given status will be overwritten,
6599 later this will only occur if a later error needs to be reported onto an
6600 otherwise success indicating status.
6603 .It Ic read
6604 \*(NQ Read a line from standard input, or the channel set active via
6605 .Ic readctl ,
6606 and assign the data, which will be split as indicated by
6607 .Va ifs ,
6608 to the given variables.
6609 The variable names are checked by the same rules as documented for
6610 .Cm vput ,
6611 and the same error codes will be seen in
6612 .Va \&! ;
6613 the exit status
6614 .Va \&?
6615 indicates the number of bytes read, it will be
6616 .Ql -1
6617 with the error number
6618 .Va \&!
6619 set to
6620 .Va ^ERR Ns -BADF
6621 in case of I/O errors, or
6622 .Va ^ERR Ns -NONE
6623 upon End-Of-File.
6624 If there are more fields than variables, assigns successive fields to the
6625 last given variable.
6626 If there are less fields than variables, assigns the empty string to the
6627 remains.
6628 .Bd -literal -offset indent
6629 ? read a b c
6630    H  e  l  l  o
6631 ? echo "<$a> <$b> <$c>"
6632 <H> <e> <l  l  o>
6633 ? wysh set ifs=:; read a b c;unset ifs
6634 hey2.0,:"'you    ",:world!:mars.:
6635 ? echo $?/$^ERRNAME / <$a><$b><$c>
6636 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
6640 .It Ic readsh
6641 \*(NQ Like
6642 .Ic read ,
6643 but splits on shell token boundaries (see
6644 .Sx "Shell-style argument quoting" )
6645 rather than at
6646 .Va ifs .
6647 \*(ID Could become a
6648 .Ic commandalias ,
6649 maybe
6650 .Ql read --tokenize -- .
6653 .It Ic readall
6654 \*(NQ Read anything from standard input, or the channel set active via
6655 .Ic readctl ,
6656 and assign the data to the given variable.
6657 The variable name is checked by the same rules as documented for
6658 .Cm vput ,
6659 and the same error codes will be seen in
6660 .Va \&! ;
6661 the exit status
6662 .Va \&?
6663 indicates the number of bytes read, it will be
6664 .Ql -1
6665 with the error number
6666 .Va \&!
6667 set to
6668 .Va ^ERR Ns -BADF
6669 in case of I/O errors, or
6670 .Va ^ERR Ns -NONE
6671 upon End-Of-File.
6672 \*(ID The input data length is restricted to 31-bits.
6675 .It Ic readctl
6676 \*(NQ Manages input channels for
6677 .Ic read ,
6678 .Ic readsh
6680 .Ic readall ,
6681 to be used to avoid complicated or impracticable code, like calling
6682 .Ic \&\&read
6683 from within a macro in non-interactive mode.
6684 Without arguments, or when the first argument is
6685 .Cm show ,
6686 a listing of all known channels is printed.
6687 Channels can otherwise be
6688 .Cm create Ns
6689 d, and existing channels can be
6690 .Cm set
6691 active and
6692 .Cm remove Ns
6693 d by giving the string used for creation.
6695 The channel name is expected to be a file descriptor number, or,
6696 if parsing the numeric fails, an input file name that undergoes
6697 .Sx "Filename transformations" .
6698 For example (this example requires a modern shell):
6699 .Bd -literal -offset indent
6700 $ printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
6701   \*(uA -R#
6702 hey, you
6703 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
6704   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
6705 hey, you
6709 .It Ic remove
6710 \*(NQ Removes the named files or directories.
6711 If a name refers to a mailbox, say a Maildir mailbox, then a mailbox
6712 type specific removal will be performed, deleting the complete mailbox.
6713 In interactive mode the user is asked for confirmation.
6716 .It Ic rename
6717 \*(NQ Takes the name of an existing folder
6718 and the name for the new folder
6719 and renames the first to the second one.
6720 .Sx "Filename transformations"
6721 including shell pathname wildcard pattern expansions
6722 .Pf ( Xr glob 7 )
6723 are performed on both arguments.
6724 Both folders must be of the same type.
6728 .It Ic Reply , Respond
6729 \*(CM(R) Identical to
6730 .Ic reply
6731 except that it replies to only the sender of each message of the given
6732 list, by using the first message as the template to quote, for the
6733 .Ql Subject:
6734 etc.; setting
6735 .Va flipr
6736 will exchange this command with
6737 .Ic reply .
6741 .It Ic reply , respond
6742 \*(CM(r) Take a message (list) and group-respond (to each in turn)
6743 by addressing the sender and all recipients, subject to
6744 .Va fullnames
6746 .Ic alternates
6747 processing.
6748 .Va followup-to ,
6749 .Va followup-to-honour ,
6750 .Va reply-to-honour
6751 as well as
6752 .Va recipients-in-cc
6753 influence response behaviour.
6754 .Va quote
6755 as well as
6756 .Va quote-as-attachment
6757 configure whether responded-to message shall be quoted etc.,
6758 .Va content-description-quote-attachment
6759 may be used.
6760 Setting
6761 .Va flipr
6762 will exchange this command with
6763 .Ic Reply .
6764 The command
6765 .Ic Lreply
6766 offers special support for replying to mailing lists.
6767 For more documentation please refer to
6768 .Sx "On sending mail, and non-interactive mode" .
6770 This may generate the errors
6771 .Va ^ERR Ns -DESTADDRREQ
6772 if no receiver has been specified, or was rejected by
6773 .Va expandaddr
6774 policy,
6775 .Va ^ERR Ns -IO
6776 if an I/O error occurs,
6777 .Va ^ERR Ns -NOTSUP
6778 if a necessary character set conversion fails, and
6779 .Va ^ERR Ns -INVAL
6780 for other errors.
6781 It can also fail with errors of
6782 .Sx "Specifying messages" .
6783 Any error stops processing of further messages.
6786 .It Ic Resend
6787 Like
6788 .Ic resend ,
6789 but does not add any header lines.
6790 This is not a way to hide the sender's identity,
6791 but useful for sending a message again to the same recipients.
6794 .It Ic resend
6795 Takes a list of messages and a name,
6796 and sends each message to the given addressee, which is subject to
6797 .Va fullnames .
6798 .Ql Resent-From:
6799 and related header fields are prepended to the new copy of the message.
6800 Saving in
6801 .Va record
6802 is only performed if
6803 .Va record-resent
6804 is set.
6805 \*(ID\*(CM is not entered, the only supported hooks are
6806 .Va on-resend-enter
6808 .Va on-resend-cleanup .
6810 This may generate the errors
6811 .Va ^ERR Ns -DESTADDRREQ
6812 if no receiver has been specified, or was rejected by
6813 .Va expandaddr
6814 policy,
6815 .Va ^ERR Ns -IO
6816 if an I/O error occurs,
6817 .Va ^ERR Ns -NOTSUP
6818 if a necessary character set conversion fails, and
6819 .Va ^ERR Ns -INVAL
6820 for other errors.
6821 It can also fail with errors of
6822 .Sx "Specifying messages" .
6823 Any error stops processing of further messages.
6826 .It Ic retain
6827 (ret) Superseded by the multiplexer
6828 .Ic headerpick .
6831 .It Ic return
6832 Only available inside of a
6833 .Ic define Ns
6834 d macro or an
6835 .Ic account ,
6836 this command returns control of execution to the outer scope.
6837 The two optional parameters are positive decimal numbers and default to 0:
6838 the first specifies the 32-bit return value (stored in
6839 .Va \&?
6840 \*(ID and later extended to 64-bit),
6841 the second the 32-bit error number (stored in
6842 .Va \&! ) .
6843 As documented for
6844 .Va \&?
6845 a non-0 exit status may cause the program to exit.
6848 .It Ic Save
6849 (S) Similar to
6850 .Ic save,
6851 but saves the messages in a file named after the local part of the
6852 sender of the first message instead of taking a filename argument;
6853 .Va outfolder
6854 is inspected to decide on the actual storage location.
6857 .It Ic save
6858 (s) Takes a message list and a filename and appends each message in turn
6859 to the end of the file.
6860 .Sx "Filename transformations"
6861 including shell pathname wildcard pattern expansions
6862 .Pf ( Xr glob 7 )
6863 is performed on the filename.
6864 If no filename is given, the
6865 .Mx -sx
6866 .Sx "secondary mailbox"
6867 .Ev MBOX
6868 is used.
6869 The filename in quotes, followed by the generated character count
6870 is echoed on the user's terminal.
6871 If editing a
6872 .Mx -sx
6873 .Sx "primary system mailbox"
6874 the messages are marked for deletion.
6875 To filter the saved header fields to the desired subset use the
6876 .Ql save
6877 slot of the white- and blacklisting command
6878 .Ic headerpick .
6879 Also see
6880 .Ic Copy .
6882 .It Ic savediscard
6883 \*(OB Superseded by the multiplexer
6884 .Ic headerpick .
6886 .It Ic saveignore
6887 \*(OB Superseded by the multiplexer
6888 .Ic headerpick .
6890 .It Ic saveretain
6891 \*(OB Superseded by the multiplexer
6892 .Ic headerpick .
6895 .It Ic search
6896 Takes a message specification (list) and displays a header summary of
6897 all matching messages, as via
6898 .Ic headers .
6899 This command is an alias of
6900 .Ic from .
6901 Also see
6902 .Sx "Specifying messages" .
6905 .It Ic seen
6906 Takes a message list and marks all messages as having been read.
6911 .It Ic set , unset
6912 (se, \*(NQ uns) The latter command will delete all given global
6913 variables, or only block-scope local ones if the
6914 .Cm local
6915 command modifier has been used.
6916 The former, when used without arguments, will show all
6917 currently known variables, being more verbose if either of
6918 .Va debug
6920 .Va verbose
6921 is set.
6922 Remarks: this list mode will not automatically link-in (known)
6923 .Sx ENVIRONMENT
6924 variables, this only happens for explicit addressing, examples are
6925 .Ic varshow ,
6926 using a variable in an
6927 .Ic if
6928 condition or a string passed to
6929 .Ic echo ,
6930 explicit
6931 .Ic \&\&set Ns
6932 ting, as well as some program-internal use cases (look-ups).
6935 Otherwise the given variables (and arguments) are set or adjusted.
6936 Arguments are of the form
6937 .Ql name=value
6938 (no space before or after
6939 .Ql = ) ,
6940 or plain
6941 .Ql name
6942 if there is no value, i.e., a boolean variable.
6943 If a name begins with
6944 .Ql no ,
6945 as in
6946 .Ql set nosave ,
6947 the effect is the same as invoking the
6948 .Ic \&\&unset
6949 command with the remaining part of the variable
6950 .Pf ( Ql unset save ) .
6951 \*(ID In conjunction with the
6952 .Cm wysh
6953 .Pf (or\0 Cm local )
6954 command prefix(es)
6955 .Sx "Shell-style argument quoting"
6956 can be used to quote arguments as necessary.
6957 \*(ID Otherwise quotation marks may be placed around any part of the
6958 assignment statement to quote blanks or tabs.
6961 When operating in global scope any
6962 .Ql name
6963 that is known to map to an environment variable will automatically cause
6964 updates in the program environment (unsetting a variable in the
6965 environment requires corresponding system support) \(em use the command
6966 .Ic environ
6967 for further environmental control.
6968 If the command modifier
6969 .Cm local
6970 has been used to enforce local scoping then the given user variables
6971 will be garbage collected when the local scope is left;
6973 .Sx "INTERNAL VARIABLES" ,
6974 however,
6975 .Cm local
6976 behaves the same as if
6977 .Ic localopts
6978 would have been set (temporarily), which means that changes are
6979 inherited by deeper scopes.
6980 Also see
6981 .Ic varshow
6982 and the sections
6983 .Sx "INTERNAL VARIABLES"
6985 .Sx ENVIRONMENT .
6987 .Bd -literal -offset indent
6988 ? wysh set indentprefix=' -> '
6989 ? wysh set atab=$'\t' aspace=' ' zero=0
6994 .It Ic shcodec
6995 Apply shell quoting rules to the given raw-data arguments.
6996 Supports
6997 .Cm vput
6998 (see
6999 .Sx "Command modifiers" ) .
7000 The first argument specifies the operation:
7001 .Ar [+]e[ncode]
7003 .Ar d[ecode]
7004 cause shell quoting to be applied to the remains of the line, and
7005 expanded away thereof, respectively.
7006 If the former is prefixed with a plus-sign, the quoted result will not
7007 be roundtrip enabled, and thus can be decoded only in the very same
7008 environment that was used to perform the encode; also see
7009 .Cd mle-quote-rndtrip .
7010 If the coding operation fails the error number
7011 .Va \&!
7012 is set to
7013 .Va ^ERR Ns -CANCELED ,
7014 and the unmodified input is used as the result; the error number may
7015 change again due to output or result storage errors.
7018 .It Ic shell
7019 \*(NQ (sh) Invokes an interactive version of the shell,
7020 and returns its exit status.
7024 .It Ic shortcut , unshortcut
7025 \*(NQ Manage the file- or pathname shortcuts as documented for
7026 .Ic folder .
7027 The latter command deletes all shortcuts given as arguments,
7028 or all at once when given the asterisk
7029 .Ql * .
7030 The former shows the list of all currently defined shortcuts if used
7031 without arguments, the target of the given with a single argument.
7032 Otherwise arguments are treated as pairs of shortcuts and their desired
7033 expansion, creating new or updating already existing ones.
7036 .It Ic shift
7037 \*(NQ Shift the positional parameter stack (starting at
7038 .Va 1 )
7039 by the given number (which must be a positive decimal),
7040 or 1 if no argument has been given.
7041 It is an error if the value exceeds the number of positional parameters.
7042 If the given number is 0, no action is performed, successfully.
7043 The stack as such can be managed via
7044 .Ic vpospar .
7045 Note this command will fail in
7046 .Ic account
7047 and hook macros unless the positional parameter stack has been
7048 explicitly created in the current context via
7049 .Ic vpospar .
7052 .It Ic show
7053 Like
7054 .Ic type ,
7055 but performs neither MIME decoding nor decryption, so that the raw
7056 message text is shown.
7059 .It Ic size
7060 (si) Shows the size in characters of each message of the given
7061 message list.
7064 .It Ic sleep
7065 \*(NQ Sleep for the specified number of seconds (and optionally
7066 milliseconds), by default interruptible.
7067 If a third argument is given the sleep will be uninterruptible,
7068 otherwise the error number
7069 .Va \&!
7070 will be set to
7071 .Va ^ERR Ns -INTR
7072 if the sleep has been interrupted.
7073 The command will fail and the error number will be
7074 .Va ^ERR Ns -OVERFLOW
7075 if the given duration(s) overflow the time datatype, and
7076 .Va ^ERR Ns -INVAL
7077 if the given durations are no valid integers.
7082 .It Ic sort , unsort
7083 The latter command disables sorted or threaded mode, returns to normal
7084 message order and, if the
7085 .Va header
7086 variable is set,
7087 displays a header summary.
7088 The former command shows the current sorting criterion when used without
7089 an argument, but creates a sorted representation of the current folder
7090 otherwise, and changes the
7091 .Ic next
7092 command and the addressing modes such that they refer to messages in
7093 the sorted order.
7094 Message numbers are the same as in regular mode.
7095 If the
7096 .Va header
7097 variable is set,
7098 a header summary in the new order is also displayed.
7099 Automatic folder sorting can be enabled by setting the
7100 .Va autosort
7101 variable, as in
7102 .Ql set autosort=thread .
7103 Possible sorting criterions are:
7106 .Bl -tag -compact -width "subject"
7107 .It Ar date
7108 Sort the messages by their
7109 .Ql Date:
7110 field, that is by the time they were sent.
7111 .It Ar from
7112 Sort messages by the value of their
7113 .Ql From:
7114 field, that is by the address of the sender.
7115 If the
7116 .Va showname
7117 variable is set, the sender's real name (if any) is used.
7118 .It Ar size
7119 Sort the messages by their size.
7120 .It spam
7121 \*(OP Sort the message by their spam score, as has been classified by
7122 .Ic spamrate .
7123 .It Ar status
7124 Sort the messages by their message status.
7125 .It Ar subject
7126 Sort the messages by their subject.
7127 .It Ar thread
7128 Create a threaded display.
7129 .It Ar to
7130 Sort messages by the value of their
7131 .Ql To:
7132 field, that is by the address of the recipient.
7133 If the
7134 .Va showname
7135 variable is set, the recipient's real name (if any) is used.
7140 .It Ic source
7141 \*(NQ (so) The source command reads commands from the given file.
7142 .Sx "Filename transformations"
7143 will be applied.
7144 If the given expanded argument ends with a vertical bar
7145 .Ql |
7146 then the argument will instead be interpreted as a shell command and
7147 \*(UA will read the output generated by it.
7148 Dependent on the settings of
7149 .Va posix
7151 .Va errexit ,
7152 and also dependent on whether the command modifier
7153 .Cm ignerr
7154 had been used, encountering errors will stop sourcing of the given input.
7155 \*(ID Note that
7156 .Ic \&\&source
7157 cannot be used from within macros that execute as
7158 .Va folder-hook Ns s
7160 .Ic account Ns s ,
7161 i.e., it can only be called from macros that were
7162 .Ic call Ns ed .
7165 .It Ic source_if
7166 \*(NQ The difference to
7167 .Ic source
7168 (beside not supporting pipe syntax aka shell command input) is that
7169 this command will not generate an error nor warn if the given file
7170 argument cannot be opened successfully.
7173 .It Ic spamclear
7174 \*(OP Takes a list of messages and clears their
7175 .Ql is-spam
7176 flag.
7179 .It Ic spamforget
7180 \*(OP Takes a list of messages and causes the
7181 .Va spam-interface
7182 to forget it has ever used them to train its Bayesian filter.
7183 Unless otherwise noted the
7184 .Ql is-spam
7185 flag of the message is inspected to chose whether a message shall be
7186 forgotten to be
7187 .Dq ham
7189 .Dq spam .
7192 .It Ic spamham
7193 \*(OP Takes a list of messages and informs the Bayesian filter of the
7194 .Va spam-interface
7195 that they are
7196 .Dq ham .
7197 This also clears the
7198 .Ql is-spam
7199 flag of the messages in question.
7202 .It Ic spamrate
7203 \*(OP Takes a list of messages and rates them using the configured
7204 .Va spam-interface ,
7205 without modifying the messages, but setting their
7206 .Ql is-spam
7207 flag as appropriate; because the spam rating headers are lost the rate
7208 will be forgotten once the mailbox is left.
7209 Refer to the manual section
7210 .Sx "Handling spam"
7211 for the complete picture of spam handling in \*(UA.
7214 .It Ic spamset
7215 \*(OP Takes a list of messages and sets their
7216 .Ql is-spam
7217 flag.
7220 .It Ic spamspam
7221 \*(OP Takes a list of messages and informs the Bayesian filter of the
7222 .Va spam-interface
7223 that they are
7224 .Dq spam .
7225 This also sets the
7226 .Ql is-spam
7227 flag of the messages in question.
7229 .It Ic thread
7230 \*(OB The same as
7231 .Ql sort thread
7232 (consider using a
7233 .Ql commandalias
7234 as necessary).
7238 .It Ic tls
7239 \*(NQ TLS information and management command multiplexer to aid in
7240 .Sx "Encrypted network communication" ,
7241 mostly available only if the term
7242 .Ql ,+sockets,
7243 is included in
7244 .Va features .
7245 Commands support
7246 .Cm vput
7247 if so documented (see
7248 .Sx "Command modifiers" ) .
7249 The result that is shown in case of errors is always the empty string,
7250 errors can be identified via the error number
7251 .Va \&! .
7252 For example, string length overflows are caught and set
7253 .Va \&!
7255 .Va ^ERR Ns -OVERFLOW .
7256 The TLS configuration is honoured, especially
7257 .Va tls-verify .
7259 .Bd -literal -offset indent
7260 ? vput tls result fingerprint pop3s://ex.am.ple
7261 ? echo $?/$!/$^ERRNAME: $result
7264 .Bl -hang -width ".It Cm random"
7265 .It Cm certchain
7266 Show the complete verified peer certificate chain.
7267 Includes informational fields in conjunction with
7268 .Va verbose .
7269 .It Cm certificate
7270 Show only the peer certificate, without any signers.
7271 Includes informational fields in conjunction with
7272 .Va verbose .
7273 .It Cm fingerprint
7274 Show the
7275 .Va tls-fingerprint-digest Ns
7276 ed fingerprint of the certificate of the given HOST
7277 .Pf ( Ql server:port ,
7278 where the port defaults to the HTTPS port, 443).
7279 .Va tls-fingerprint
7280 is actively ignored for the runtime of this command.
7285 .It Ic Top
7286 Like
7287 .Ic top
7288 but always uses the
7289 .Ic headerpick
7290 .Ql type
7291 slot for white- and blacklisting header fields.
7294 .It Ic top
7295 (to) Takes a message list and types out the first
7296 .Va toplines
7297 lines of each message on the user's terminal.
7298 Unless a special selection has been established for the
7299 .Ql top
7300 slot of the
7301 .Ic headerpick
7302 command, the only header fields that are displayed are
7303 .Ql From: ,
7304 .Ql To: ,
7305 .Ql Cc: ,
7307 .Ql Subject: .
7308 .Ic Top
7309 will always use the
7310 .Ql type
7311 .Ic headerpick
7312 selection instead.
7313 It is possible to apply compression to what is displayed by setting
7314 .Va topsqueeze .
7315 Messages are decrypted and converted to the terminal character set
7316 if necessary.
7319 .It Ic touch
7320 (tou) Takes a message list and marks the messages for saving in the
7321 .Mx -sx
7322 .Sx "secondary mailbox"
7323 .Ev MBOX .
7324 \*(UA deviates from the POSIX standard with this command,
7325 as a following
7326 .Ic next
7327 command will display the following message instead of the current one.
7330 .It Ic Type
7331 (T) Like
7332 .Ic type
7333 but also displays header fields which would not pass the
7334 .Ic headerpick
7335 selection, and all visualizable parts of MIME
7336 .Ql multipart/alternative
7337 messages.
7340 .It Ic type
7341 (t) Takes a message list and types out each message on the user's terminal.
7342 The display of message headers is selectable via
7343 .Ic headerpick .
7344 For MIME multipart messages, all parts with a content type of
7345 .Ql text ,
7346 all parts which have a registered MIME type handler (see
7347 .Sx "HTML mail and MIME attachments" )
7348 which produces plain text output, and all
7349 .Ql message
7350 parts are shown, others are hidden except for their headers.
7351 Messages are decrypted and converted to the terminal character set
7352 if necessary.
7353 The command
7354 .Ic mimeview
7355 can be used to display parts which are not displayable as plain text.
7357 .It Ic unaccount
7359 .Ic account .
7361 .It Ic unalias
7362 (una) See
7363 .Ic alias .
7365 .It Ic unanswered
7367 .Ic answered .
7369 .It Ic unbind
7371 .Ic bind .
7373 .It Ic uncollapse
7375 .Ic collapse .
7377 .It Ic uncolour
7379 .Ic colour .
7381 .It Ic undefine
7383 .Ic define .
7385 .It Ic undelete
7387 .Ic delete .
7389 .It Ic undraft
7391 .Ic draft .
7393 .It Ic unflag
7395 .Ic flag .
7397 .It Ic unfwdignore
7398 \*(OB Superseded by the multiplexer
7399 .Ic headerpick .
7401 .It Ic unfwdretain
7402 \*(OB Superseded by the multiplexer
7403 .Ic headerpick .
7406 .It Ic unignore
7407 Superseded by the multiplexer
7408 .Ic headerpick .
7410 .It Ic unmimetype
7412 .Ic mimetype .
7414 .It Ic unmlist
7416 .Ic mlist .
7418 .It Ic unmlsubscribe
7420 .Ic mlsubscribe .
7423 .It Ic Unread
7424 Same as
7425 .Ic unread .
7428 .It Ic unread
7429 Takes a message list and marks each message as not having been read.
7432 .It Ic unretain
7433 Superseded by the multiplexer
7434 .Ic headerpick .
7436 .It Ic unsaveignore
7437 \*(OB Superseded by the multiplexer
7438 .Ic headerpick .
7440 .It Ic unsaveretain
7441 \*(OB Superseded by the multiplexer
7442 .Ic headerpick .
7444 .It Ic unset
7445 \*(NQ (uns) See
7446 .Ic set .
7448 .It Ic unshortcut
7450 .Ic shortcut .
7452 .It Ic unsort
7454 .Ic short .
7456 .It Ic unthread
7457 \*(OB
7458 Same as
7459 .Ic unsort .
7462 .It Ic urlcodec
7463 Perform URL percent codec operations on the raw-data argument, rather
7464 according to RFC 3986.
7465 The first argument specifies the operation:
7466 .Ar e[ncode]
7468 .Ar d[ecode]
7469 perform plain URL percent en- and decoding, respectively.
7470 .Ar p[ath]enc[ode]
7472 .Ar p[ath]dec[ode]
7473 perform a slightly modified operation which should be better for
7474 pathnames: it does not allow a tilde
7475 .Ql ~ ,
7476 and will neither accept hyphen-minus
7477 .Ql -
7478 nor dot
7479 .Ql .
7480 as an initial character.
7481 The remains of the line form the URL data which is to be converted.
7482 This is a character set agnostic operation,
7483 and it may thus decode bytes which are invalid in the current
7484 .Va ttycharset .
7486 Supports
7487 .Cm vput
7488 (see
7489 .Sx "Command modifiers" ) ,
7490 and manages the error number
7491 .Va \&! .
7492 If the coding operation fails the error number
7493 .Va \&!
7494 is set to
7495 .Va ^ERR Ns -CANCELED ,
7496 and the unmodified input is used as the result; the error number may
7497 change again due to output or result storage errors.
7498 \*(ID This command does not know about URLs beside what is documented.
7499 .Pf ( Ic vexpr
7500 offers a
7501 .Cm makeprint
7502 subcommand, shall the URL be displayed.)
7505 .It Ic varshow
7506 \*(NQ This command produces the same output as the listing mode of
7507 .Ic set ,
7508 including
7509 .Va verbose Ns
7510 ity adjustments, but only for the given variables.
7513 .It Ic verify
7514 \*(OP Takes a message list and verifies each message.
7515 If a message is not a S/MIME signed message,
7516 verification will fail for it.
7517 The verification process checks if the message was signed using a valid
7518 certificate,
7519 if the message sender's email address matches one of those contained
7520 within the certificate,
7521 and if the message content has been altered.
7524 .It Ic version
7525 Shows the
7526 .Va version
7528 .Va features
7529 of \*(UA, optionally in a more
7530 .Va verbose
7531 form which also includes the build and running system environment.
7532 This command supports
7533 .Cm vput
7534 (see
7535 .Sx "Command modifiers" ) .
7539 .It Ic vexpr
7540 \*(NQ A multiplexer command which offers signed 64-bit numeric
7541 calculations, as well as other, mostly string-based operations.
7542 C-style byte string operations are available via
7543 .Ic csop .
7544 The first argument defines the number, type, and meaning of the
7545 remaining arguments.
7546 An empty number argument is treated as 0.
7547 Supports
7548 .Cm vput
7549 (see
7550 .Sx "Command modifiers" ) .
7551 The result shown in case of errors is
7552 .Ql -1
7553 for usage errors and numeric operations, the empty string otherwise;
7554 .Dq soft
7555 errors, like when a search operation failed, will also set the
7556 .Va \&!
7557 error number to
7558 .Va ^ERR Ns -NODATA .
7559 Except when otherwise noted numeric arguments are parsed as signed 64-bit
7560 numbers, and errors will be reported in the error number
7561 .Va \&!
7562 as the numeric error
7563 .Va ^ERR Ns -RANGE .
7566 Numeric operations work on one or two signed 64-bit integers.
7567 Numbers prefixed with
7568 .Ql 0x
7570 .Ql 0X
7571 are interpreted as hexadecimal (base 16) numbers, whereas
7572 .Ql 0
7573 indicates octal (base 8), and
7574 .Ql 0b
7575 as well as
7576 .Ql 0B
7577 denote binary (base 2) numbers.
7578 It is possible to use any base in between 2 and 36, inclusive, with the
7579 .Ql BASE#number
7580 notation, where the base is given as an unsigned decimal number, so
7581 .Ql 16#AFFE
7582 is a different way of specifying a hexadecimal number.
7583 Unsigned interpretation of a number can be enforced by prefixing an
7584 .Ql u
7585 (case-insensitively), as in
7586 .Ql u-110 ;
7587 this is not necessary for power-of-two bases (2, 4, 8, 16 and 32),
7588 which will be interpreted as unsigned by default, but it still makes
7589 a difference regarding overflow detection and overflow constant.
7590 It is possible to enforce signed interpretation by (instead) prefixing a
7591 .Ql s
7592 (case-insensitively).
7593 The number sign notation uses a permissive parse mode and as such
7594 supports complicated conditions out of the box:
7595 .Bd -literal -offset indent
7596 ? wysh set ifs=:;read i;unset ifs;echo $i;vexpr pb 2 10#$i
7597    -009
7598 <   -009>
7599 0b1001
7603 One integer is expected by assignment (equals sign
7604 .Ql = ) ,
7605 which does nothing but parsing the argument, thus detecting validity and
7606 possible overflow conditions, unary not (tilde
7607 .Ql ~ ) ,
7608 which creates the bitwise complement, and unary plus and minus.
7609 Two integers are used by addition (plus sign
7610 .Ql + ) ,
7611 subtraction (hyphen-minus
7612 .Ql - ) ,
7613 multiplication (asterisk
7614 .Ql * ) ,
7615 division (solidus
7616 .Ql / )
7617 and modulo (percent sign
7618 .Ql % ) ,
7619 as well as for the bitwise operators logical or (vertical bar
7620 .Ql | ,
7621 to be quoted) ,
7622 bitwise and (ampersand
7623 .Ql \&& ,
7624 to be quoted) ,
7625 bitwise xor (circumflex
7626 .Ql ^ ) ,
7627 the bitwise signed left- and right shifts
7628 .Pf ( Ql << ,
7629 .Ql >> ) ,
7630 as well as for the unsigned right shift
7631 .Ql >>> .
7634 Another numeric operation is
7635 .Cm pbase ,
7636 which takes a number base in between 2 and 36, inclusive, and will act
7637 on the second number given just the same as what equals sign
7638 .Ql =
7639 does, but the number result will be formatted in the base given, as
7640 a signed 64-bit number unless unsigned interpretation of the input
7641 number had been forced (with an u prefix).
7644 Numeric operations support a saturated mode via the question mark
7645 .Ql \&?
7646 modifier suffix; the keyword
7647 .Ql saturated
7648 is optional,
7649 .Ql +? ,
7650 .Ql +?satu ,
7652 .Ql +?saturated
7653 are therefore identical.
7654 In saturated mode overflow errors and division and modulo by zero are no
7655 longer reported via the exit status, but the result will linger at the
7656 minimum or maximum possible value, instead of overflowing (or trapping).
7657 This is true also for the argument parse step.
7658 For the bitwise shifts, the saturated maximum is 63.
7659 Any caught overflow will be reported via the error number
7660 .Va \&!
7662 .Va ^ERR Ns -OVERFLOW .
7664 .Bd -literal -offset indent
7665 ? vput vexpr res -? +1 -9223372036854775808
7666 ? echo $?/$!/$^ERRNAME:$res
7667 0/75/OVERFLOW:-9223372036854775808
7671 Character set agnostic string functions have no notion of locale
7672 settings and character sets.
7674 .Bl -hang -width ".It Cm random"
7675 .It Cm date-utc
7676 Outputs the current date and time in UTC (Coordinated Universal Time)
7677 with values named such that
7678 .Ql vput vexpr x date-utc; eval wysh set $x
7679 creates accessible variables.
7680 .It Cm date-stamp-utc
7681 Outputs a RFC 3339 internet date/time format of UTC.
7682 .It Cm epoch
7683 The seconds and nanoseconds since the Unix epoch (1970-01-01T00:00:00)
7684 named
7685 .Ql epoch_sec
7687 .Ql epoch_nsec
7688 such that
7689 .Ql vput vexpr x epoch; eval wysh set $x
7690 creates accessible variables.
7691 .It Cm file-expand
7692 Performs the usual
7693 .Sx "Filename transformations"
7694 on its argument.
7695 .It Cm file-stat , file-lstat
7696 Perform the usual
7697 .Sx "Filename transformations"
7698 on the argument, then call
7699 .Xr stat 2
7701 .Xr lstat 2 ,
7702 respectively, and output values such that
7703 .Ql vput vexpr x file-stat FILE; eval wysh set $x
7704 creates accessible variables.
7705 The variable
7706 .Ql st_type
7707 uses solidus
7708 .Ql /
7709 to denote directories, commercial at
7710 .Ql @
7711 for links, number sign
7712 .Ql #
7713 for block devices, percent sign
7714 .Ql %
7715 for for character devices, vertical bar
7716 .Ql |
7717 for FIFOs, equal sign
7718 .Ql =
7719 for sockets, and the period
7720 .Ql \&.
7721 for the rest.
7722 .It Cm random
7723 Generates a random string of the given length, or of
7724 .Dv \&\&PATH_MAX
7725 bytes (a constant from
7726 .Pa /usr/include )
7727 if the value 0 is given; the random string will be base64url encoded
7728 according to RFC 4648, and thus be usable as a (portable) filename.
7732 String operations work, sufficient support provided, according to the
7733 active user's locale encoding and character set (see
7734 .Sx "Character sets" ) .
7735 Where the question mark
7736 .Ql \&?
7737 modifier suffix is supported, a case-insensitive operation mode is
7738 available; the keyword
7739 .Ql case
7740 is optional,
7741 .Ql regex?
7743 .Ql regex?case
7744 are therefore identical.
7746 .Bl -hang -width ".It Cm regex"
7747 .It Cm makeprint
7748 (One-way) Converts the argument to something safely printable on the
7749 terminal.
7751 .It Cm regex
7752 \*(OP A string operation that will try to match the first argument with
7753 the regular expression given as the second argument.
7754 .Ql \&?
7755 modifier suffix is supported.
7756 If the optional third argument has been given then instead of showing
7757 the match offset a replacement operation is performed: the third
7758 argument is treated as if specified within dollar-single-quote (see
7759 .Sx "Shell-style argument quoting" ) ,
7760 and any occurrence of a positional parameter, for example
7761 .Va \&0 , 1
7762 etc. is replaced with the according match group of the regular expression:
7763 .Bd -literal -offset indent
7764 ? vput vexpr res regex bananarama \e
7765     (.*)NanA(.*) '\e${1}au\e$2'
7766 ? echo $?/$!/$^ERRNAME:$res:
7767 1/61/NODATA::
7768 ? vput vexpr res regex?case bananarama \e
7769     (.*)NanA(.*) '\e${1}uauf\e$2'
7770 ? echo $?/$!/$^ERRNAME:$res:
7771 0/0/NONE:bauauframa:
7777 .It Ic vpospar
7778 \*(NQ Manage the positional parameter stack (see
7779 .Va 1 , # , * , @
7780 as well as
7781 .Ic shift ) .
7782 If the first argument is
7783 .Ql clear ,
7784 then the positional parameter stack of the current context, or the
7785 global one, if there is none, is cleared.
7786 If it is
7787 .Ql set ,
7788 then the remaining arguments will be used to (re)create the stack,
7789 if the parameter stack size limit is excessed an
7790 .Va ^ERR Ns -OVERFLOW
7791 error will occur.
7794 If the first argument is
7795 .Ql quote ,
7796 a round-trip capable representation of the stack contents is created,
7797 with each quoted parameter separated from each other with the first
7798 character of
7799 .Va ifs ,
7800 and followed by the first character of
7801 .Va if-ws ,
7802 if that is not empty and not identical to the first.
7803 If that results in no separation at all a
7804 .Cm space
7805 character is used.
7806 This mode supports
7807 .Cm vput
7808 (see
7809 .Sx "Command modifiers" ) .
7810 I.e., the subcommands
7811 .Ql set
7813 .Ql quote
7814 can be used (in conjunction with
7815 .Ic eval )
7816 to (re)create an argument stack from and to a single variable losslessly.
7818 .Bd -literal -offset indent
7819 ? vpospar set hey, "'you    ", world!
7820 ? echo $#: <${1}><${2}><${3}>
7821 ? vput vpospar x quote
7822 ? vpospar clear
7823 ? echo $#: <${1}><${2}><${3}>
7824 ? eval vpospar set ${x}
7825 ? echo $#: <${1}><${2}><${3}>
7830 .It Ic visual
7831 (v) Takes a message list and invokes the
7832 .Ev VISUAL
7833 display editor on each message.
7834 Modified contents are discarded unless the
7835 .Va writebackedited
7836 variable is set, and are not used unless the mailbox can be written to
7837 and the editor returns a successful exit status.
7838 .Ic edit
7839 can be used instead for a less display oriented editor.
7842 .It Ic write
7843 (w) For conventional messages the body without all headers is written.
7844 The original message is never marked for deletion in the originating
7845 mail folder.
7846 The output is decrypted and converted to its native format as necessary.
7847 If the output file exists, the text is appended.
7848 If a message is in MIME multipart format its first part is written to
7849 the specified file as for conventional messages, handling of the remains
7850 depends on the execution mode.
7851 No special handling of compressed files is performed.
7853 In interactive mode the user is consecutively asked for the filenames of
7854 the processed parts.
7855 For convenience saving of each part may be skipped by giving an empty
7856 value, the same result as writing it to
7857 .Pa /dev/null .
7858 Shell piping the part content by specifying a leading vertical bar
7859 .Ql |
7860 character for the filename is supported.
7861 Other user input undergoes the usual
7862 .Sx "Filename transformations" ,
7863 including shell pathname wildcard pattern expansions
7864 .Pf ( Xr glob 7 )
7865 and shell variable expansion for the message as such, not the individual
7866 parts, and contents of the destination file are overwritten if the file
7867 previously existed.
7868 Character set conversion to
7869 .Va ttycharset
7870 is performed when saving text data.
7872 \*(ID In non-interactive mode any part which does not specify a filename
7873 is ignored, and suspicious parts of filenames of the remaining parts are
7874 URL percent encoded (as via
7875 .Ic urlcodec )
7876 to prevent injection of malicious character sequences, resulting in
7877 a filename that will be written into the current directory.
7878 Existing files will not be overwritten, instead the part number or
7879 a dot are appended after a number sign
7880 .Ql #
7881 to the name until file creation succeeds (or fails due to other
7882 reasons).
7885 .It Ic xcall
7886 \*(NQ The sole difference to
7887 .Ic call
7888 is that the new macro is executed in place of the current one, which
7889 will not regain control: all resources of the current macro will be
7890 released first.
7891 This implies that any setting covered by
7892 .Ic localopts
7893 will be forgotten and covered variables will become cleaned up.
7894 If this command is not used from within a
7895 .Ic call Ns
7896 ed macro it will silently be (a more expensive variant of)
7897 .Ic call .
7900 .It Ic xit
7901 (x) A synonym for
7902 .Ic exit .
7905 .It Ic z
7906 \*(NQ \*(UA presents message headers in
7907 .Va screen Ns
7908 fuls as described under the
7909 .Ic headers
7910 command.
7911 Without arguments this command scrolls to the next window of messages,
7912 likewise if the argument is
7913 .Ql + .
7914 An argument of
7915 .Ql -
7916 scrolls to the last,
7917 .Ql ^
7918 scrolls to the first, and
7919 .Ql $
7920 to the last
7921 .Va \&\&screen
7922 of messages.
7923 A number argument prefixed by
7924 .Ql +
7926 .Ql \-
7927 indicates that the window is calculated in relation to the current
7928 position, and a number without a prefix specifies an absolute position.
7931 .It Ic Z
7932 \*(NQ Similar to
7933 .Ic z ,
7934 but scrolls to the next or previous window that contains at least one
7935 .Ql new
7937 .Ic flag Ns
7938 ged message.
7940 .\" }}}
7942 .\" }}}
7945 .\" .Sh COMMAND ESCAPES {{{
7946 .Sh "COMMAND ESCAPES"
7948 Command escapes are available in
7949 .Sx "Compose mode"
7950 during interactive usage, when explicitly requested via
7951 .Fl ~ ,
7952 and in batch mode
7953 .Pf ( Fl # ) .
7954 They perform special functions, like editing headers of the message
7955 being composed, calling normal
7956 .Sx COMMANDS ,
7957 yielding a shell, etc.
7958 Command escapes are only recognized at the beginning of lines, and
7959 consist of an escape followed by a command character.
7960 The default
7961 .Va escape
7962 character is the tilde
7963 .Ql ~ .
7966 Unless otherwise documented command escapes ensure proper updates of
7967 the error number
7968 .Va \&!
7969 and the exit status
7970 .Va \&? .
7971 The variable
7972 .Va errexit
7973 controls whether a failed operation errors out message compose mode and
7974 causes program exit.
7975 Escapes may be prefixed by none to multiple single character command
7976 modifiers, interspersed whitespace is ignored:
7978 .Bl -bullet
7980 An effect equivalent to the command modifier
7981 .Cm ignerr
7982 can be achieved with hyphen-minus
7983 .Ql - ,
7984 overriding
7985 .Va errexit .
7987 The modifier dollar
7988 .Ql $
7989 .Ic eval Ns
7990 uates the remains of the line; also see
7991 .Sx "Shell-style argument quoting" .
7992 \*(ID For now the entire input line is evaluated as a whole; to avoid
7993 that control operators like semicolon
7994 .Cm \&;
7995 are interpreted unintentionally, they must be quoted.
7999 Addition of the command line to the \*(OPal history can be prevented by
8000 placing whitespace directly after
8001 .Va escape .
8002 The \*(OPal key
8003 .Ic bind Ns
8004 ings support a compose mode specific context.
8005 The following command escapes are supported:
8008 .Bl -tag -width ".It Ic BaNg"
8010 .It Ic ~~ Ar string
8011 Insert the string of text in the message prefaced by a single
8012 .Ql ~ .
8013 (If the escape character has been changed,
8014 that character must be doubled instead.)
8017 .It Ic ~! Ar command
8018 Execute the indicated shell
8019 .Ar command
8020 which follows, replacing unescaped exclamation marks with the previously
8021 executed command if the internal variable
8022 .Va bang
8023 is set, then return to the message.
8026 .It Ic ~.
8027 End compose mode and send the message.
8028 The hooks
8029 .Va on-compose-splice-shell
8031 .Va on-compose-splice ,
8032 in order, will be called when set, after which, in interactive mode
8033 .Va askatend
8034 (leading to
8035 .Va askcc , askbcc )
8037 .Va askattach
8038 will be checked as well as
8039 .Va asksend ,
8040 after which a set
8041 .Va on-compose-leave
8042 hook will be called,
8043 .Va autocc
8045 .Va autobcc
8046 will be joined in if set,
8047 finally a given
8048 .Va message-inject-tail
8049 will be incorporated, after which the compose mode is left.
8052 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
8053 Can be used to execute
8054 .Sx COMMANDS
8055 (which are allowed in compose mode).
8058 .It Ic ~< Ar filename
8059 Identical to
8060 .Ic ~r .
8063 .It Ic ~<! Ar command
8064 .Ar command
8065 is executed using the shell.
8066 Its standard output is inserted into the message.
8069 .It Ic ~?
8070 \*(OP Write a summary of command escapes.
8073 .It Ic ~@ Op Ar filename...
8074 Append or edit the list of attachments.
8075 Does not manage the error number
8076 .Va \&!
8077 and the exit status
8078 .Va \&?
8079 (please use
8080 .Ic ~^
8081 if error handling is necessary).
8082 The append mode expects a list of
8083 .Ar filename
8084 arguments as shell tokens (see
8085 .Sx "Shell-style argument quoting" ;
8086 token-separating commas are ignored, too), to be
8087 interpreted as documented for the command line option
8088 .Fl a ,
8089 with the message number exception as below.
8091 Without
8092 .Ar filename
8093 arguments the attachment list is edited, entry by entry;
8094 if a filename is left empty, that attachment is deleted from the list;
8095 once the end of the list is reached either new attachments may be
8096 entered or the session can be quit by committing an empty
8097 .Dq new
8098 attachment.
8099 In non-interactive mode or in batch mode
8100 .Pf ( Fl # )
8101 the list of attachments is effectively not edited but instead recreated;
8102 again, an empty input ends list creation.
8104 For all modes, if a given filename solely consists of the number sign
8105 .Ql #
8106 followed by either a valid message number of the currently active
8107 mailbox, or by a period
8108 .Ql \&. ,
8109 referring to the current message of the active mailbox, the so-called
8110 .Dq dot ,
8111 then the given message is attached as a
8112 .Ql message/rfc822
8113 MIME message part.
8114 The number sign must be quoted to avoid misinterpretation as a shell
8115 comment character.
8118 .It Ic ~| Ar command
8119 Pipe the message text through the specified filter command.
8120 If the command gives no output or terminates abnormally,
8121 retain the original text of the message.
8122 The command
8123 .Xr fmt 1
8124 is often used as a rejustifying filter.
8126 If the first character of the command is a vertical bar, then the entire
8127 message including header fields is subject to the filter command, so
8128 .Ql ~|| echo Fcc: /tmp/test; cat
8129 will prepend a file-carbon-copy message header.
8130 Also see
8131 .Ic ~e , ~v .
8135 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
8136 Inspect and modify the message using the semantics of
8137 .Ic digmsg ,
8138 therefore arguments are evaluated according to
8139 .Sx "Shell-style argument quoting" .
8140 Error number
8141 .Va \&!
8142 and exit status
8143 .Va \&?
8144 are not managed: errors are handled via the protocol,
8145 and hard errors like I/O failures cannot be handled.
8148 The protocol consists of command lines followed by (a) response line(s).
8149 The first field of the response line represents a status code
8150 which specifies whether a command was successful or not, whether result
8151 data is to be expected, and if, the format of the result data.
8152 Response data will be shell quoted as necessary for consumption by
8153 .Ic readsh ,
8155 .Ic eval
8157 .Ic vpospar ,
8158 to name a few.
8159 Error status code lines may optionally contain additional context:
8163 .Bl -tag -compact -width ".It Ql 210"
8164 .It Ql 210
8165 Status ok; the remains of the line are the result.
8167 .It Ql 211
8168 Status ok; the rest of the line is optionally used for more status.
8169 What follows are lines of result addresses, terminated by an empty line.
8170 All the input, including the empty line, must be consumed before further
8171 commands can be issued.
8172 Address lines consist of two token, first the plain network address, e.g.,
8173 .Ql bob@exam.ple ,
8174 followed by the (quoted) full address as known:
8175 .Ql '(Lovely) Bob <bob@exam.ple>' .
8176 Non-network addresses use the first field to indicate the type (hyphen-minus
8177 .Ql -
8178 for files, vertical bar
8179 .Ql |
8180 for pipes, and number sign
8181 .Ql #
8182 for names which will undergo
8183 .Ic alias
8184 processing) instead, the actual value will be in the second field.
8186 .It Ql 212
8187 Status ok; the rest of the line is optionally used for more status.
8188 What follows are lines of furtherly unspecified (quoted) string content,
8189 terminated by an empty line.
8190 All the input, including the empty line, must be consumed before further
8191 commands can be issued.
8193 .It Ql 500
8194 Syntax error; invalid command.
8196 .It Ql 501
8197 Syntax error or otherwise invalid parameters or arguments.
8199 .It Ql 505
8200 Error: an argument fails verification.
8201 For example an invalid address has been specified (also see
8202 .Va expandaddr ) ,
8203 or an attempt was made to modify anything in \*(UA's own namespace,
8204 or a modifying subcommand has been used on a read-only message.
8206 .It Ql 506
8207 Error: an otherwise valid argument is rendered invalid due to context.
8208 For example, a second address is added to a header which may consist of
8209 a single address only.
8214 If a command indicates failure then the message will have remained
8215 unmodified.
8216 Most commands can fail with
8217 .Ql 500
8218 if required arguments are missing, or excessive arguments have been
8219 given (false command usage).
8220 (\*(ID The latter does not yet occur regularly, because as stated in
8221 .Sx "Shell-style argument quoting"
8222 our argument parser is not yet smart enough to work on subcommand base;
8223 for example one might get excess argument error for a three argument
8224 subcommand that receives four arguments, but not for a four argument
8225 subcommand which receives six arguments: here excess will be joined.)
8226 The following (case-insensitive) commands are supported:
8229 .Bl -hang -width ".It Cm version"
8230 .It Cm attachment
8231 This command allows listing, removal and addition of message attachments.
8232 The second argument specifies the subcommand to apply, one of:
8234 .Bl -hang -width ".It Cm remove"
8235 .It Cm attribute
8236 This uses the same search mechanism as described for
8237 .Cm remove
8238 and prints any known attributes of the first found attachment via
8239 .Ql 212
8240 upon success or
8241 .Ql 501
8242 if no such attachment can be found.
8243 The attributes are written as lines with a keyword and a value token.
8245 .It Cm attribute-at
8246 This uses the same search mechanism as described for
8247 .Cm remove-at
8248 and is otherwise identical to
8249 .Cm attribute .
8251 .It Cm attribute-set
8252 This uses the same search mechanism as described for
8253 .Cm remove ,
8254 and will set the attribute given as the fourth to the value given as
8255 the fifth token argument.
8256 If the value is an empty token, then the given attribute is removed,
8257 or reset to a default value if existence of the attribute is crucial.
8259 It returns via
8260 .Ql 210
8261 upon success, with the index of the found attachment following,
8262 .Ql 505
8263 for message attachments or if the given keyword is invalid, and
8264 .Ql 501
8265 if no such attachment can be found.
8266 The following keywords may be used (case-insensitively):
8268 .Bl -hang -compact -width ".It Ql filename"
8269 .It Ql filename
8270 Sets the filename of the MIME part, i.e., the name that is used for
8271 display and when (suggesting a name for) saving (purposes).
8272 .It Ql content-description
8273 Associate some descriptive information to the attachment's content, used
8274 in favour of the plain filename by some MUAs.
8275 .It Ql content-id
8276 May be used for uniquely identifying MIME entities in several contexts;
8277 this expects a special reference address format as defined in RFC 2045
8278 and generates a
8279 .Ql 505
8280 upon address content verification failure.
8281 .It Ql content-type
8282 Defines the media type/subtype of the part, which is managed
8283 automatically, but can be overwritten.
8284 .It Ql content-disposition
8285 Automatically set to the string
8286 .Ql attachment .
8289 .It Cm attribute-set-at
8290 This uses the same search mechanism as described for
8291 .Cm remove-at
8292 and is otherwise identical to
8293 .Cm attribute-set .
8295 .It Cm insert
8296 Adds the attachment given as the third argument, specified exactly as
8297 documented for the command line option
8298 .Fl a ,
8299 and supporting the message number extension as documented for
8300 .Ic ~@ .
8301 This reports
8302 .Ql 210
8303 upon success, with the index of the new attachment following,
8304 .Ql 505
8305 if the given file cannot be opened,
8306 .Ql 506
8307 if an on-the-fly performed character set conversion fails, otherwise
8308 .Ql 501
8309 is reported; this is also reported if character set conversion is
8310 requested but not available.
8312 .It Cm list
8313 List all attachments via
8314 .Ql 212 ,
8315 or report
8316 .Ql 501
8317 if no attachments exist.
8318 This command is the default command of
8319 .Cm attachment
8320 if no second argument has been given.
8322 .It Cm remove
8323 This will remove the attachment given as the third argument, and report
8324 .Ql 210
8325 upon success or
8326 .Ql 501
8327 if no such attachment can be found.
8328 If there exists any path component in the given argument, then an exact
8329 match of the path which has been used to create the attachment is used
8330 directly, but if only the basename of that path matches then all
8331 attachments are traversed to find an exact match first, and the removal
8332 occurs afterwards; if multiple basenames match, a
8333 .Ql 506
8334 error occurs.
8335 Message attachments are treated as absolute pathnames.
8337 If no path component exists in the given argument, then all attachments
8338 will be searched for
8339 .Ql filename=
8340 parameter matches as well as for matches of the basename of the path
8341 which has been used when the attachment has been created; multiple
8342 matches result in a
8343 .Ql 506 .
8345 .It Cm remove-at
8346 This will interpret the third argument as a number and remove the
8347 attachment at that list position (counting from one!), reporting
8348 .Ql 210
8349 upon success or
8350 .Ql 505
8351 if the argument is not a number or
8352 .Ql 501
8353 if no such attachment exists.
8357 .It Cm header
8358 This command allows listing, inspection, and editing of message headers.
8359 Header name case is not normalized, so that case-insensitive comparison
8360 should be used when matching names.
8361 The second argument specifies the subcommand to apply, one of:
8364 .Bl -hang -width ".It Cm remove"
8365 .It Cm insert
8366 Create a new or an additional instance of the header given in the third
8367 argument, with the header body content as given in the fourth token.
8368 It may return
8369 .Ql 501
8370 if the third argument specifies a free-form header field name that is
8371 invalid, or if body content extraction fails to succeed,
8372 .Ql 505
8373 if any extracted address does not pass syntax and/or security checks or
8374 on \*(UA namespace violations, and
8375 .Ql 506
8376 to indicate prevention of excessing a single-instance header \(em note that
8377 .Ql Subject:
8378 can be appended to (a space separator will be added automatically first).
8379 .Ql To: ,
8380 .Ql Cc:
8382 .Ql Bcc:
8383 support the
8384 .Ql ?single
8385 modifier to enforce treatment as a single addressee, for example
8386 .Ql header insert To?single: 'exa, <m@ple>' ;
8387 the word
8388 .Ql single
8389 is optional.
8391 .Ql 210
8392 is returned upon success, followed by the name of the header and the list
8393 position of the newly inserted instance.
8394 The list position is always 1 for single-instance header fields.
8395 All free-form header fields are managed in a single list; also see
8396 .Va customhdr .
8398 .It Cm list
8399 Without a third argument a list of all yet existing headers is given via
8400 .Ql 210 ;
8401 this command is the default command of
8402 .Cm header
8403 if no second argument has been given.
8404 A third argument restricts output to the given header only, which may
8405 fail with
8406 .Ql 501
8407 if no such field is defined.
8409 .It Cm remove
8410 This will remove all instances of the header given as the third
8411 argument, reporting
8412 .Ql 210
8413 upon success,
8414 .Ql 501
8415 if no such header can be found, and
8416 .Ql 505
8417 on \*(UA namespace violations.
8419 .It Cm remove-at
8420 This will remove from the header given as the third argument the
8421 instance at the list position (counting from one!) given with the fourth
8422 argument, reporting
8423 .Ql 210
8424 upon success or
8425 .Ql 505
8426 if the list position argument is not a number or on \*(UA namespace
8427 violations, and
8428 .Ql 501
8429 if no such header instance exists.
8431 .It Cm show
8432 Shows the content of the header given as the third argument.
8433 Dependent on the header type this may respond with
8434 .Ql 211
8436 .Ql 212 ;
8437 any failure results in
8438 .Ql 501 .
8443 In compose-mode read-only access to optional pseudo headers in the \*(UA
8444 private namespace is available:
8448 .Bl -tag -compact -width ".It Va BaNg"
8449 .It Ql Mailx-Command:
8450 The name of the command that generates the message, one of
8451 .Ql forward ,
8452 .Ql Lreply ,
8453 .Ql mail ,
8454 .Ql Reply ,
8455 .Ql reply ,
8456 .Ql resend .
8457 This pseudo header always exists (in compose-mode).
8459 .It Ql Mailx-Raw-To:
8460 .It Ql Mailx-Raw-Cc:
8461 .It Ql Mailx-Raw-Bcc:
8462 Represent the frozen initial state of these headers before any
8463 transformation
8464 .Pf ( Ic alias ,
8465 .Ic alternates ,
8466 .Va recipients-in-cc
8467 etc.) took place.
8469 .It Ql Mailx-Orig-Sender:
8470 .It Ql Mailx-Orig-From:
8471 .It Ql Mailx-Orig-To:
8472 .It Ql Mailx-Orig-Cc:
8473 .It Ql Mailx-Orig-Bcc:
8474 The values of said headers of the original message which has been
8475 addressed by any of
8476 .Ic reply , forward , resend .
8477 The sender field is special as it is filled in with the sole sender
8478 according to RFC 5322 rules, it may thus be equal to the from field.
8482 .It Cm help , \&?
8483 Show an abstract of the above commands via
8484 .Ql 211 .
8486 .It Cm version
8487 This command will print the protocol version via
8488 .Ql 210 .
8493 .It Ic ~A
8494 The same as
8495 .Ql Ic ~i Ns \| Va Sign .
8498 .It Ic ~a
8499 The same as
8500 .Ql Ic ~i Ns \| Va sign .
8503 .It Ic ~b Ar name ...
8504 Add the given names to the list of blind carbon copy recipients.
8507 .It Ic ~c Ar name ...
8508 Add the given names to the list of carbon copy recipients.
8511 .It Ic ~d
8512 Read the file specified by the
8513 .Ev DEAD
8514 variable into the message.
8517 .It Ic ~e
8518 Invoke the text
8519 .Ev EDITOR
8520 on the message collected so far, then return to compose mode.
8521 .Ic ~v
8522 can be used for a more display oriented editor, and
8523 .Ic ~| Ns |
8524 offers a pipe-based editing approach.
8527 .It Ic ~F Ar messages
8528 Read the named messages into the message being sent, including all
8529 message headers and MIME parts, and honouring
8530 .Va forward-add-cc
8531 as well as
8532 .Va forward-inject-head
8534 .Va forward-inject-tail .
8535 If no messages are specified, read in the current message, the
8536 .Dq dot .
8539 .It Ic ~f Ar messages
8540 Read the named messages into the message being sent.
8541 If no messages are specified, read in the current message, the
8542 .Dq dot .
8543 Strips down the list of header fields according to the
8544 .Ql forward
8545 (with
8546 .Va posix :
8547 .Ql type )
8548 white- and blacklist selection of
8549 .Ic headerpick ,
8550 and honours
8551 .Va forward-add-cc
8552 as well as
8553 .Va forward-inject-head
8555 .Va forward-inject-tail .
8556 For MIME multipart messages,
8557 only the first displayable part is included.
8560 .It Ic ~H
8561 In interactive mode, edit the message header fields
8562 .Ql From: ,
8563 .Ql Reply-To:
8565 .Ql Sender:
8566 by typing each one in turn and allowing the user to edit the field.
8567 The default values for these fields originate from the
8568 .Va from , reply-to
8570 .Va sender
8571 variables.
8572 In non-interactive mode this sets
8573 .Va ^ERR Ns -NOTTY .
8576 .It Ic ~h
8577 In interactive mode, edit the message header fields
8578 .Ql To: ,
8579 .Ql Cc: ,
8580 .Ql Bcc:
8582 .Ql Subject:
8583 by typing each one in turn and allowing the user to edit the field.
8584 In non-interactive mode this sets
8585 .Va ^ERR Ns -NOTTY .
8588 .It Ic ~I Ar variable
8589 Insert the value of the specified variable into the message.
8590 The message remains unaltered if the variable is unset or empty.
8591 Any embedded character sequences
8592 .Ql \et
8593 horizontal tabulator and
8594 .Ql \en
8595 line feed are expanded in
8596 .Va posix
8597 mode; otherwise the expansion should occur at
8598 .Ic set
8599 time (\*(ID by using the command modifier
8600 .Va wysh ) .
8603 .It Ic ~i Ar variable
8604 Like
8605 .Ic ~I ,
8606 but appends a newline character.
8609 .It Ic ~M Ar messages
8610 Read the named messages into the message being sent,
8611 indented by
8612 .Va indentprefix .
8613 If no messages are specified, read the current message, the
8614 .Dq dot .
8615 Honours
8616 .Va forward-add-cc
8617 as well as
8618 .Va forward-inject-head
8620 .Va forward-inject-tail .
8623 .It Ic ~m Ar messages
8624 Read the named messages into the message being sent,
8625 indented by
8626 .Va indentprefix .
8627 If no messages are specified, read the current message, the
8628 .Dq dot .
8629 Strips down the list of header fields according to the
8630 .Ql type
8631 white- and blacklist selection of
8632 .Ic headerpick .
8633 Honours
8634 .Va forward-add-cc
8635 as well as
8636 .Va forward-inject-head
8638 .Va forward-inject-tail .
8639 For MIME multipart messages,
8640 only the first displayable part is included.
8643 .It Ic ~p
8644 Display the message collected so far,
8645 prefaced by the message header fields
8646 and followed by the attachment list, if any.
8649 .It Ic ~Q
8650 Read in the given / current message(s) using the algorithm of
8651 .Va quote
8652 (except that is implicitly assumed, even if not set), honouring
8653 .Va quote-add-cc .
8656 .It Ic ~q
8657 Abort the message being sent,
8658 copying it to the file specified by the
8659 .Ev DEAD
8660 variable if
8661 .Va save
8662 is set.
8665 .It Ic ~R Ar filename
8666 Identical to
8667 .Ic ~r ,
8668 but indent each line that has been read by
8669 .Va indentprefix .
8672 .It Ic ~r Ar filename Op Ar HERE-delimiter
8673 Read the named file, object to
8674 .Sx "Filename transformations"
8675 excluding shell globs and variable expansions, into the message; if
8676 .Ar filename
8677 is the hyphen-minus
8678 .Ql -
8679 then standard input is used (for pasting, for example).
8680 Only in this latter mode
8681 .Ar HERE-delimiter
8682 may be given: if it is data will be read in until the given
8683 .Ar HERE-delimiter
8684 is seen on a line by itself, and encountering EOF is an error; the
8685 .Ar HERE-delimiter
8686 is a required argument in non-interactive mode; if it is single-quote
8687 quoted then the pasted content will not be expanded, \*(ID otherwise
8688 a future version of \*(UA may perform shell-style expansion on the content.
8691 .It Ic ~s Ar string
8692 Cause the named string to become the current subject field.
8693 Newline (NL) and carriage-return (CR) bytes are invalid and will be
8694 normalized to space (SP) characters.
8697 .It Ic ~t Ar name ...
8698 Add the given name(s) to the direct recipient list.
8701 .It Ic ~U Ar messages
8702 Read in the given / current message(s) excluding all headers, indented by
8703 .Va indentprefix .
8704 Honours
8705 .Va forward-add-cc
8706 as well as
8707 .Va forward-inject-head
8709 .Va forward-inject-tail .
8712 .It Ic ~u Ar messages
8713 Read in the given / current message(s), excluding all headers.
8714 Honours
8715 .Va forward-add-cc
8716 as well as
8717 .Va forward-inject-head
8719 .Va forward-inject-tail .
8722 .It Ic ~v
8723 Invoke the
8724 .Ev VISUAL
8725 editor on the message collected so far, then return to compose mode.
8726 .Ic ~e
8727 can be used for a less display oriented editor, and
8728 .Ic ~| Ns |
8729 offers a pipe-based editing approach.
8732 .It Ic ~w Ar filename
8733 Write the message onto the named file, which is object to the usual
8734 .Sx "Filename transformations" .
8735 If the file exists,
8736 the message is appended to it.
8739 .It Ic ~x
8740 Same as
8741 .Ic ~q ,
8742 except that the message is not saved at all.
8745 .\" }}}
8748 .\" .Sh INTERNAL VARIABLES {{{
8749 .Sh "INTERNAL VARIABLES"
8751 Internal \*(UA variables are controlled via the
8752 .Ic set
8754 .Ic unset
8755 commands; prefixing a variable name with the string
8756 .Ql no
8757 and calling
8758 .Ic set
8759 has the same effect as using
8760 .Ic unset :
8761 .Ql unset crt
8763 .Ql set nocrt
8764 do the same thing.
8765 .Ic varshow
8766 will give more insight on the given variable(s), and
8767 .Ic set ,
8768 when called without arguments, will show a listing of all variables.
8769 Both commands support a more
8770 .Va verbose
8771 listing mode.
8772 Some well-known variables will also become inherited from the
8773 program
8774 .Sx ENVIRONMENT
8775 implicitly, others can be imported explicitly with the command
8776 .Ic environ
8777 and henceforth share said properties.
8780 Two different kinds of internal variables exist, and both of which can
8781 also form chains.
8782 There are boolean variables, which can only be in one of the two states
8783 .Dq set
8785 .Dq unset ,
8786 and value variables with a(n optional) string value.
8787 For the latter proper quoting is necessary upon assignment time, the
8788 introduction of the section
8789 .Sx COMMANDS
8790 documents the supported quoting rules.
8792 .Bd -literal -offset indent
8793 ? wysh set one=val\e 1 two="val 2" \e
8794     three='val "3"' four=$'val \e'4\e''; \e
8795     varshow one two three four; \e
8796     unset one two three four
8800 Dependent upon the actual option string values may become interpreted as
8801 colour names, command specifications, normal text, etc.
8802 They may be treated as numbers, in which case decimal values are
8803 expected if so documented, but otherwise any numeric format and
8804 base that is valid and understood by the
8805 .Ic vexpr
8806 command may be used, too.
8809 There also exists a special kind of string value, the
8810 .Dq boolean string ,
8811 which must either be a decimal integer (in which case
8812 .Ql 0
8813 is false and
8814 .Ql 1
8815 and any other value is true) or any of the (case-insensitive) strings
8816 .Ql off ,
8817 .Ql no ,
8818 .Ql n
8820 .Ql false
8821 for a false boolean and
8822 .Ql on ,
8823 .Ql yes ,
8824 .Ql y
8826 .Ql true
8827 for a true boolean;
8828 .Mx -ix quadoption
8829 a special kind of boolean string is the
8830 .Dq quadoption :
8831 it can optionally be prefixed with the (case-insensitive) term
8832 .Ql ask- ,
8833 as in
8834 .Ql ask-yes ;
8835 in interactive mode the user will be prompted, otherwise the actual
8836 boolean is used.
8839 Variable chains extend a plain
8840 .Ql variable
8841 with
8842 .Ql variable-HOST
8844 .Ql variable-USER@HOST
8845 variants.
8846 Here
8847 .Ql HOST
8848 will be converted to all lowercase when looked up (but not when the
8849 variable is set or unset!), \*(OPally IDNA converted, and indeed means
8850 .Ql server:port
8851 if a
8852 .Ql port
8853 had been specified in the contextual Uniform Resource Locator URL, see
8854 .Sx "On URL syntax and credential lookup" .
8855 Even though this mechanism is based on URLs no URL percent encoding may
8856 be applied to neither of
8857 .Ql USER
8859 .Ql HOST ,
8860 variable chains need to be specified using raw data;
8861 the mentioned section contains examples.
8862 Variables which support chains are explicitly documented as such, and
8863 \*(UA treats the base name of any such variable special, meaning that
8864 users should not create custom names like
8865 .Ql variable-xyz
8866 in order to avoid false classifications and treatment of such variables.
8868 .\" .Ss "Initial settings" {{{
8869 .\" (Keep in SYNC: mx/nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
8870 .Ss "Initial settings"
8872 The standard POSIX 2008/Cor 2-2016 mandates the following initial
8873 variable settings:
8874 .Pf no Va allnet ,
8875 .Pf no Va append ,
8876 .Va asksub ,
8877 .Pf no Va askbcc ,
8878 .Pf no Va autoprint ,
8879 .Pf no Va bang ,
8880 .Pf no Va cmd ,
8881 .Pf no Va crt ,
8882 .Pf no Va debug ,
8883 .Pf no Va dot ,
8884 .Va escape
8885 set to
8886 .Ql ~ ,
8887 .Pf no Va flipr ,
8888 .Pf no Va folder ,
8889 .Va header ,
8890 .Pf no Va hold ,
8891 .Pf no Va ignore ,
8892 .Pf no Va ignoreeof ,
8893 .Pf no Va keep ,
8894 .Pf no Va keepsave ,
8895 .Pf no Va metoo ,
8896 .Pf no Va outfolder ,
8897 .Pf no Va page ,
8898 .Va prompt
8899 set to
8900 .Ql \&?\0 ,
8901 .Pf no Va quiet ,
8902 .Pf no Va record ,
8903 .Va save ,
8904 .Pf no Va sendwait ,
8905 .Pf no Va showto ,
8906 .Pf no Va Sign ,
8907 .Pf no Va sign ,
8908 .Va toplines
8909 set to
8910 .Ql 5 .
8913 However, \*(UA has built-in some initial (and some default) settings
8914 which (may) diverge, others may become adjusted by one of the
8915 .Sx "Resource files" .
8916 Displaying the former is accomplished via
8917 .Ic set :
8918 .Ql $ \*(uA -:/ -v -Xset -Xx .
8919 In general this implementation sets (and has extended the meaning of)
8920 .Va sendwait ,
8921 and does not support the
8922 .Pf no Va onehop
8923 variable \(en use command line options or
8924 .Va mta-arguments
8925 to pass options through to a
8926 .Va mta .
8927 The default global resource file sets, among others, the variables
8928 .Va hold ,
8929 .Va keep
8931 .Va keepsave ,
8932 establishes a default
8933 .Ic headerpick
8934 selection etc., and should thus be taken into account.
8935 .\" }}}
8937 .\" .Ss "Variables" {{{
8938 .Ss "Variables"
8940 .Bl -tag -width ".It Va BaNg"
8943 .It Va \&?
8944 \*(RO The exit status of the last command, or the
8945 .Ic return
8946 value of the macro
8947 .Ic call Ns
8948 ed last.
8949 This status has a meaning in the state machine: in conjunction with
8950 .Va errexit
8951 any non-0 exit status will cause a program exit, and in
8952 .Va posix
8953 mode any error while loading (any of the) resource files will have the
8954 same effect.
8955 .Cm ignerr ,
8956 one of the
8957 .Sx "Command modifiers" ,
8958 can be used to instruct the state machine to ignore errors.
8961 .It Va \&!
8962 \*(RO The current error number
8963 .Pf ( Xr errno 3 ) ,
8964 which is set after an error occurred; it is also available via
8965 .Va ^ERR ,
8966 and the error name and documentation string can be queried via
8967 .Va ^ERRNAME
8969 .Va ^ERRDOC .
8970 \*(ID This machinery is new and the error number is only really usable
8971 if a command explicitly states that it manages the variable
8972 .Va \&! ,
8973 for others errno will be used in case of errors, or
8974 .Va ^ERR Ns -INVAL
8975 if that is 0: it thus may or may not reflect the real error.
8976 The error number may be set with the command
8977 .Ic return .
8981 .It Va ^
8982 \*(RO This is a multiplexer variable which performs dynamic expansion of
8983 the requested state or condition, of which there are:
8985 .Bl -tag -width ".It Va BaNg"
8989 .It Va ^ERR , ^ERRDOC , ^ERRNAME
8990 The number, documentation, and name of the current
8991 .Xr errno 3 ,
8992 respectively, which is usually set after an error occurred.
8993 The documentation is an \*(OP, the name is used if not available.
8994 \*(ID This machinery is new and is usually reliable only if a command
8995 explicitly states that it manages the variable
8996 .Va \&! ,
8997 which is effectively identical to
8998 .Va \&\&^ERR .
8999 Each of those variables can be suffixed with a hyphen minus followed by
9000 a name or number, in which case the expansion refers to the given error.
9001 Note this is a direct mapping of (a subset of) the system error values:
9002 .Bd -literal -offset indent
9003 define work {
9004   eval echo \e$1: \e$^ERR-$1:\e
9005     \e$^ERRNAME-$1: \e$^ERRDOC-$1
9006   vput vexpr i + "$1" 1
9007   if [ $i -lt 16 ]
9008     \excall work $i
9009   end
9011 call work 0
9016 .It Va ^ERRQUEUE-COUNT , ^ERRQUEUE-EXISTS
9017 The number of messages present in the \*(OPal log queue of
9018 .Ic errors ,
9019 and a boolean which indicates whether the queue is not empty,
9020 respectively; both are always 0 unless
9021 .Va features
9022 includes
9023 .Ql ,+errors, .
9028 .It Va *
9029 \*(RO Expands all positional parameters (see
9030 .Va 1 ) ,
9031 separated by the first character of the value of
9032 .Va ifs .
9033 \*(ID The special semantics of the equally named special parameter of the
9034 .Xr sh 1
9035 are not yet supported.
9038 .It Va @
9039 \*(RO Expands all positional parameters (see
9040 .Va 1 ) ,
9041 separated by a space character.
9042 If placed in double quotation marks, each positional parameter is
9043 properly quoted to expand to a single parameter again.
9046 .It Va #
9047 \*(RO Expands to the number of positional parameters, i.e., the size of
9048 the positional parameter stack in decimal.
9051 .It Va \&0
9052 \*(RO Inside the scope of a
9053 .Ic define Ns
9054 d and
9055 .Ic call Ns
9056 ed macro this expands to the name of the calling macro, or to the empty
9057 string if the macro is running from top-level.
9058 For the \*(OPal regular expression search and replace operator of
9059 .Ic vexpr
9060 this expands to the entire matching expression.
9061 It represents the program name in global context.
9064 .It Va 1
9065 \*(RO Access of the positional parameter stack.
9066 All further parameters can be accessed with this syntax, too,
9067 .Ql 2 ,
9068 .Ql 3
9069 etc.; positional parameters can be shifted off the stack by calling
9070 .Ic shift .
9071 The parameter stack contains, for example, the arguments of a
9072 .Ic call Ns
9074 .Ic define Ns
9075 d macro, the matching groups of the \*(OPal regular expression search
9076 and replace expression of
9077 .Ic vexpr ,
9078 and can be explicitly created or overwritten with the command
9079 .Ic vpospar .
9082 .It Va account
9083 \*(RO Is set to the active
9084 .Ic account .
9087 .It Va add-file-recipients
9088 \*(BO When file or pipe recipients have been specified,
9089 mention them in the corresponding address fields of the message instead
9090 of silently stripping them from their recipient list.
9091 By default such addressees are not mentioned.
9094 .It Va allnet
9095 \*(BO Causes only the local part to be evaluated
9096 when comparing addresses.
9099 .It Va append
9100 \*(BO Causes messages saved in the
9101 .Mx -sx
9102 .Sx "secondary mailbox"
9103 .Ev MBOX
9104 to be appended to the end rather than prepended.
9105 This should always be set.
9108 .It Va askatend
9109 \*(BO Causes the prompts for
9110 .Ql Cc:
9112 .Ql Bcc:
9113 lists to appear after the message has been edited.
9116 .It Va askattach
9117 \*(BO If set, \*(UA asks an interactive user for files to attach at the
9118 end of each message; An empty line finalizes the list.
9121 .It Va askcc
9122 \*(BO Causes the interactive user to be prompted for carbon copy
9123 recipients (at the end of each message if
9124 .Va askatend
9126 .Va bsdcompat
9127 are set).
9130 .It Va askbcc
9131 \*(BO Causes the interactive user to be prompted for blind carbon copy
9132 recipients (at the end of each message if
9133 .Va askatend
9135 .Va bsdcompat
9136 are set).
9139 .It Va asksend
9140 \*(BO Causes the interactive user to be prompted for confirmation to
9141 send the message or reenter compose mode after having been shown
9142 a preliminary envelope summary.
9145 .It Va asksign
9146 \*(BO\*(OP Causes the interactive user to be prompted if the message is
9147 to be signed at the end of each message.
9149 .Va smime-sign
9150 variable is ignored when this variable is set.
9153 .It Va asksub
9154 .\" The alternative *ask* is not documented on purpose
9155 \*(BO Causes \*(UA to prompt the interactive user for the subject upon
9156 entering compose mode unless a subject already exists.
9159 .It Va attrlist
9160 A sequence of characters to display in the
9161 .Ql attribute
9162 column of the
9163 .Va headline
9164 as shown in the display of
9165 .Ic headers ;
9166 each for one type of messages (see
9167 .Sx "Message states" ) ,
9168 with the default being
9169 .Ql NUROSPMFAT+\-$~
9171 .Ql NU\ \ *HMFAT+\-$~
9172 if the
9173 .Va bsdflags
9174 variable is set, in the following order:
9176 .Bl -tag -compact -width ".It Ql _"
9177 .It Ql N
9178 new.
9179 .It Ql U
9180 unread but old.
9181 .It Ql R
9182 new but read.
9183 .It Ql O
9184 read and old.
9185 .It Ql S
9186 saved.
9187 .It Ql P
9188 preserved.
9189 .It Ql M
9190 mboxed.
9191 .It Ql F
9192 flagged.
9193 .It Ql A
9194 answered.
9195 .It Ql T
9196 draft.
9197 .It Ql +
9198 \*(ID start of a (collapsed) thread in threaded mode (see
9199 .Va autosort ,
9200 .Ic thread ) ;
9201 .It Ql -
9202 \*(ID an uncollapsed thread in threaded mode; only used in conjunction with
9203 .Fl L .
9204 .It Ql $
9205 classified as spam.
9206 .It Ql ~
9207 classified as possible spam.
9212 .It Va autobcc
9213 Specifies a list of recipients to which a blind carbon copy of each
9214 outgoing message will be sent automatically.
9217 .It Va autocc
9218 Specifies a list of recipients to which a carbon copy of each outgoing
9219 message will be sent automatically.
9222 .It Va autocollapse
9223 \*(BO Causes threads to be collapsed automatically when .Ql thread Ns
9225 .Ic sort
9226 mode is entered (see the
9227 .Ic collapse
9228 command).
9231 .It Va autoprint
9232 \*(BO Enable automatic
9233 .Ic type Ns
9234 ing of a(n existing)
9235 .Dq successive
9236 message after
9237 .Ic delete
9239 .Ic undelete
9240 commands: the message that becomes the new
9241 .Dq dot
9242 is shown automatically, as via
9243 .Ic dp
9245 .Ic dt .
9248 .It Va autosort
9249 Causes sorted mode (see the
9250 .Ic sort
9251 command) to be entered automatically with the value of this variable as
9252 sorting method when a folder is opened, for example
9253 .Ql set autosort=thread .
9256 .It Va bang
9257 \*(BO Enables the substitution of all not (reverse-solidus) escaped
9258 exclamation mark
9259 .Ql \&!
9260 characters by the contents of the last executed command for the
9261 .Ic \&!
9262 shell escape command and
9263 .Ic ~! ,
9264 one of the compose mode
9265 .Sx "COMMAND ESCAPES" .
9266 If this variable is not set no reverse solidus stripping is performed.
9269 .It Va bind-timeout
9270 \*(OB Predecessor of
9271 .Va bind-inter-byte-timeout .
9272 \*(ID Setting this automatically sets the successor.
9275 .It Va bind-inter-byte-timeout
9276 \*(OP Terminals may generate multi-byte sequences for special function
9277 keys, for example, but these sequences may not become read as a unit.
9278 And multi-byte sequences can be defined freely via
9279 .Ic bind .
9280 This variable specifies the timeout in milliseconds that the MLE (see
9281 .Sx "On terminal control and line editor" )
9282 waits for more bytes to arrive unless it considers a sequence
9283 .Dq complete .
9284 The default is 200, the maximum is about 10 seconds.
9285 In the following example the comments state which sequences are
9286 affected by this timeout:
9287 .Bd -literal -offset indent
9288 ? bind base abc echo 0 # abc
9289 ? bind base ab,c echo 1 # ab
9290 ? bind base abc,d echo 2 # abc
9291 ? bind base ac,d echo 3 # ac
9292 ? bind base a,b,c echo 4
9293 ? bind base a,b,c,d echo 5
9294 ? bind base a,b,cc,dd echo 6 # cc and dd
9298 .It Va bind-inter-key-timeout
9299 \*(OP Multi-key
9300 .Ic bind
9301 sequences do not time out by default.
9302 If this variable is set, then the current key sequence is forcefully
9303 terminated once the timeout (in milliseconds) triggers.
9304 The value should be (maybe significantly) larger than
9305 .Va bind-inter-byte-timeout ,
9306 but may not excess the maximum, too.
9309 .It Va bsdcompat
9310 \*(BO Sets some cosmetical features to traditional BSD style;
9311 has the same affect as setting
9312 .Va askatend
9313 and all other variables prefixed with
9314 .Ql bsd ;
9315 it also changes the behaviour of
9316 .Va emptystart
9317 (which does not exist in BSD).
9320 .It Va bsdflags
9321 \*(BO Changes the letters shown in the first column of a header
9322 summary to traditional BSD style.
9325 .It Va bsdheadline
9326 \*(BO Changes the display of columns in a header summary to traditional
9327 BSD style.
9330 .It Va bsdmsgs
9331 \*(BO Changes some informational messages to traditional BSD style.
9334 .It Va bsdorder
9335 \*(BO Causes the
9336 .Ql Subject:
9337 field to appear immediately after the
9338 .Ql To:
9339 field in message headers and with the
9340 .Ic ~h
9341 .Sx "COMMAND ESCAPES" .
9347 .It Va build-cc , build-ld , build-os , build-rest
9348 \*(RO The build environment, including the compiler, the linker, the
9349 operating system \*(UA has been build for, usually taken from
9350 .Xr uname 1
9352 .Ql uname -s ,
9353 and then lowercased, as well as all the possibly interesting rest of the
9354 configuration and build environment.
9355 This information is also available in the
9356 .Va verbose
9357 output of the command
9358 .Ic version .
9361 .It Va charset-7bit
9362 The value that should appear in the
9363 .Ql charset=
9364 parameter of
9365 .Ql Content-Type:
9366 MIME header fields when no character set conversion of the message data
9367 was performed.
9368 This defaults to US-ASCII, and the chosen character set should be
9369 US-ASCII compatible.
9372 .It Va charset-8bit
9373 \*(OP The default 8-bit character set that is used as an implicit last
9374 member of the variable
9375 .Va sendcharsets .
9376 This defaults to UTF-8 if character set conversion capabilities are
9377 available, and to ISO-8859-1 otherwise (unless the operating system
9378 environment is known to always and exclusively support UTF-8 locales),
9379 in which case the only supported character set is
9380 .Va ttycharset
9381 and this variable is effectively ignored.
9384 .It Va charset-unknown-8bit
9385 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
9386 .Dq upgrade
9387 the content of a mail message by using a character set with the name
9388 .Ql unknown-8bit .
9389 Because of the unclassified nature of this character set \*(UA will not
9390 be capable to convert this character set to any other character set.
9391 If this variable is set any message part which uses the character set
9392 .Ql unknown-8bit
9393 is assumed to really be in the character set given in the value,
9394 otherwise the (final) value of
9395 .Va charset-8bit
9396 is used for this purpose.
9398 This variable will also be taken into account if a MIME type (see
9399 .Sx "The mime.types files" )
9400 of a MIME message part that uses the
9401 .Ql binary
9402 character set is forcefully treated as text.
9405 .It Va cmd
9406 The default value for the
9407 .Ic pipe
9408 command.
9411 .It Va colour-disable
9412 \*(BO\*(OP Forcefully disable usage of colours.
9413 Also see the section
9414 .Sx "Coloured display" .
9417 .It Va colour-pager
9418 \*(BO\*(OP Whether colour shall be used for output that is paged through
9419 .Ev PAGER .
9420 Note that pagers may need special command line options, for example
9421 .Xr less 1
9422 requires the option
9423 .Fl \&\&R
9425 .Xr lv 1
9426 the option
9427 .Fl \&\&c
9428 in order to support colours.
9429 Often doing manual adjustments is unnecessary since \*(UA may perform
9430 adjustments dependent on the value of the environment variable
9431 .Ev PAGER
9432 (see there for more).
9436 .It Va contact-mail , contact-web
9437 \*(RO Addresses for contact per email and web, respectively, for
9438 bug reports, suggestions, or anything else regarding \*(UA.
9439 The former can be used directly:
9440 .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
9446 .It Va content-description-forwarded-message , \
9447     content-description-quote-attachment , \
9448     content-description-smime-message , \
9449     content-description-smime-signature
9450 \*(OP(partially) Strings which will be placed in according
9451 .Ql Content-Description:
9452 headers if non-empty.
9453 They all have default values, for example
9454 .Ql Forwarded message .
9457 .It Va crt
9458 In a(n interactive) terminal session, then if this valued variable is
9459 set it will be used as a threshold to determine how many lines the given
9460 output has to span before it will be displayed via the configured
9461 .Ev PAGER ;
9462 Usage of the
9463 .Ev PAGER
9464 can be forced by setting this to the value
9465 .Ql 0 ,
9466 setting it without a value will deduce the current height of the
9467 terminal screen to compute the threshold (see
9468 .Ev LINES ,
9469 .Va screen
9471 .Xr stty 1 ) .
9472 \*(ID At the moment this uses the count of lines of the message in wire
9473 format, which, dependent on the
9474 .Va mime-encoding
9475 of the message, is unrelated to the number of display lines.
9476 (The software is old and historically the relation was a given thing.)
9479 .It Va customhdr
9480 Define a set of custom headers to be injected into newly composed or
9481 forwarded messages.
9482 A custom header consists of the field name followed by a colon
9483 .Ql \&:
9484 and the field content body.
9485 Standard header field names cannot be overwritten by a custom header,
9486 with the exception of
9487 .Ql Comments:
9489 .Ql Keywords: .
9490 Different to the command line option
9491 .Fl C
9492 the variable value is interpreted as a comma-separated list of custom
9493 headers: to include commas in header bodies they need to become escaped
9494 with reverse solidus
9495 .Ql \e .
9496 Headers can be managed more freely in
9497 .Sx "Compose mode"
9499 .Ic ~^ .
9501 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
9504 .It Va datefield
9505 Controls the appearance of the
9506 .Ql %d
9507 date and time format specification of the
9508 .Va headline
9509 variable, that is used, for example, when viewing the summary of
9510 .Ic headers .
9511 If unset, then the local receiving date is used and displayed
9512 unformatted, otherwise the message sending
9513 .Ql Date: .
9514 It is possible to assign a
9515 .Xr strftime 3
9516 format string and control formatting, but embedding newlines via the
9517 .Ql %n
9518 format is not supported, and will result in display errors.
9519 The default is
9520 .Ql %Y-%m-%d %H:%M ,
9521 and also see
9522 .Va datefield-markout-older .
9525 .It Va datefield-markout-older
9526 Only used in conjunction with
9527 .Va datefield .
9528 Can be used to create a visible distinction of messages dated more than
9529 a day in the future, or older than six months, a concept comparable to the
9530 .Fl \&\&l
9531 option of the POSIX utility
9532 .Xr ls 1 .
9533 If set to the empty string, then the plain month, day and year of the
9534 .Ql Date:
9535 will be displayed, but a
9536 .Xr strftime 3
9537 format string to control formatting can be assigned.
9538 The default is
9539 .Ql %Y-%m-%d .
9542 .It Va debug
9543 \*(BO (Almost) Enter a debug-only sandbox mode which generates many
9544 log messages, disables the actual delivery of messages, and also implies
9545 .Pf no Va record
9546 as well as
9547 .Pf no Va save .
9548 Also see
9549 .Va verbose .
9552 .It Va disposition-notification-send
9553 \*(BO\*(OP Emit a
9554 .Ql Disposition-Notification-To:
9555 header (RFC 3798) with the message.
9556 This requires the
9557 .Va from
9558 variable to be set.
9559 .\" TODO .It Va disposition-notification-send-HOST
9560 .\"Overrides
9561 .\".Va disposition-notification-send
9562 .\" for SMTP accounts on a specific host.
9563 .\" TODO .It Va disposition-notification-send-USER@HOST
9564 .\"Overrides
9565 .\".Va disposition-notification-send
9566 .\"for a specific account.
9569 .It Va dot
9570 \*(BO When dot is set, a period
9571 .Ql \&.
9572 on a line by itself during message input in (interactive or batch
9573 .Fl # )
9574 .Sx "Compose mode"
9575 will be treated as end-of-message (in addition to the
9576 normal end-of-file condition).
9577 This behaviour is implied in
9578 .Va posix
9579 mode with a set
9580 .Va ignoreeof .
9583 .It Va dotlock-disable
9584 \*(BO\*(OP Disable creation of
9585 .Mx -sx
9586 .Sx "dotlock files"
9587 for MBOX databases.
9589 .It Va dotlock-ignore-error
9590 \*(OB\*(BO\*(OP Ignore failures when creating
9591 .Mx -sx
9592 .Sx "dotlock files" .
9593 Please use
9594 .Va dotlock-disable
9595 instead.
9598 .It Va editalong
9599 If this variable is set then the editor is started automatically when
9600 a message is composed in interactive mode.
9601 If the value starts with the letter
9602 .Ql v
9603 then this acts as if
9604 .Ic ~v ,
9605 otherwise as if
9606 .Ic ~e
9607 .Pf (see\0 Sx "COMMAND ESCAPES" )
9608 had been specified.
9610 .Va editheaders
9611 variable is implied for this automatically spawned editor session.
9614 .It Va editheaders
9615 \*(BO When a message is edited while being composed,
9616 its header is included in the editable text.
9619 .It Va emptystart
9620 \*(BO When entering interactive mode \*(UA normally writes
9621 .Dq \&No mail for user
9622 and exits immediately if a mailbox is empty or does not exist.
9623 If this variable is set \*(UA starts even with an empty or non-existent
9624 mailbox (the latter behaviour furtherly depends upon
9625 .Va bsdcompat ,
9626 though).
9629 .It Va errexit
9630 \*(BO Let each command with a non-0 exit status, including every
9631 .Ic call Ns
9632 ed macro which
9633 .Ic return Ns
9634 s a non-0 status, cause a program exit unless prefixed by
9635 .Cm ignerr
9636 (see
9637 .Sx "Command modifiers" ) .
9638 This also affects
9639 .Sx "COMMAND ESCAPES" ,
9640 but which use a different modifier for ignoring the error.
9641 Please refer to the variable
9642 .Va \&?
9643 for more on this topic.
9646 .It Va errors-limit
9647 \*(OP Maximum number of entries in the
9648 .Ic errors
9649 queue.
9652 .It Va escape
9653 The first character of this value defines the escape character for
9654 .Sx "COMMAND ESCAPES"
9656 .Sx "Compose mode" .
9657 The default value is the character tilde
9658 .Ql ~ .
9659 If set to the empty string, command escapes are disabled.
9663 .It Va expandaddr
9664 If unset only user name and email address recipients are allowed
9665 .Sx "On sending mail, and non-interactive mode" .
9666 If set without value all possible recipient types will be accepted.
9667 A value is parsed as a comma-separated list of case-insensitive strings,
9668 and if that contains
9669 .Ql restrict
9670 behaviour equals the former except when in interactive mode or if
9671 .Sx "COMMAND ESCAPES"
9672 were enabled via
9673 .Fl ~
9675 .Fl # ,
9676 in which case it equals the latter, allowing all address types.
9677 .Ql restrict
9678 really acts like
9679 .Ql restrict,\:-all,\:+name,\:+addr ,
9680 so care for ordering issues must be taken.
9683 Recipient types can be added and removed with a plus sign
9684 .Ql +
9685 or hyphen-minus
9686 .Ql -
9687 prefix, respectively.
9688 By default invalid or disallowed types are filtered out and
9689 cause a warning, hard send errors need to be enforced by including
9690 .Ql fail .
9691 The value
9692 .Ql all
9693 covers all types,
9694 .Ql fcc
9695 whitelists
9696 .Ql Fcc:
9697 header targets regardless of other settings,
9698 .Ql file
9699 file targets (it includes
9700 .Ql fcc ) ,
9701 .Ql pipe
9702 command pipeline targets,
9703 .Ql name
9704 user names still unexpanded after
9705 .Ic alias
9707 .Va mta-aliases
9708 processing and thus left for expansion by the
9709 .Va mta
9710 (invalid for the built-in SMTP one), and
9711 .Ql addr
9712 network addresses.
9713 Targets are interpreted in the given order, so that
9714 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
9715 will cause hard errors for any non-network address recipient address
9716 unless running interactively or having been started with the option
9717 .Fl ~
9719 .Fl # ;
9720 in the latter case(s) any type may be used.
9723 User name receivers addressing valid local users can be expanded to
9724 fully qualified network addresses (also see
9725 .Va hostname )
9726 by including
9727 .Ql nametoaddr
9728 in the list.
9729 Historically invalid recipients were stripped off without causing
9730 errors, this can be changed by making
9731 .Ql failinvaddr
9732 an entry of the list (it really acts like
9733 .Ql failinvaddr,\:+addr ) .
9734 Likewise,
9735 .Ql domaincheck
9736 .Pf (really\0\: Ql domaincheck,\:+addr )
9737 compares address domain names against a whitelist and strips off
9738 .Pf ( Ql fail
9739 for hard errors) addressees which fail this test; the domain name
9740 .Ql localhost
9741 and the non-empty value of
9742 .Va hostname
9743 (the real hostname otherwise) are always whitelisted,
9744 .Va expandaddr-domaincheck
9745 can be set to extend this list.
9746 Finally some address providers (for example
9747 .Fl b , c
9748 and all other command line recipients) will be evaluated as
9749 if specified within dollar-single-quotes (see
9750 .Sx "Shell-style argument quoting" )
9751 if the value list contains the string
9752 .Ql shquote .
9756 .It Va expandaddr-domaincheck
9757 Can be set to a comma-separated list of domain names which should be
9758 whitelisted for the evaluation of the
9759 .Ql domaincheck
9760 mode of
9761 .Va expandaddr .
9762 IDNA encoding is not automatically performed,
9763 .Ic addrcodec
9764 can be used to prepare the domain (of an address).
9767 .It Va expandargv
9768 Unless this variable is set additional
9769 .Va mta
9770 (Mail-Transfer-Agent)
9771 arguments from the command line, as can be given after a
9772 .Fl \&\&-
9773 separator, results in a program termination with failure status.
9774 The same can be accomplished by using the special (case-insensitive) value
9775 .Ql fail .
9776 A lesser strict variant is the otherwise identical
9777 .Ql restrict ,
9778 which does accept such arguments in interactive mode, or if tilde
9779 commands were enabled explicitly by using one of the command line options
9780 .Fl ~
9782 .Fl # .
9783 The empty value will allow unconditional usage.
9786 .It Va features
9787 \*(RO String giving a list of optional features.
9788 Features are preceded with a plus sign
9789 .Ql +
9790 if they are available, with a hyphen-minus
9791 .Ql -
9792 otherwise.
9793 To ease substring matching the string starts and ends with a comma.
9794 The output of the command
9795 .Ic version
9796 includes this information in a more pleasant output.
9799 .It Va flipr
9800 \*(BO This setting reverses the meanings of a set of reply commands,
9801 turning the lowercase variants, which by default address all recipients
9802 included in the header of a message
9803 .Pf ( Ic reply , respond , followup )
9804 into the uppercase variants, which by default address the sender only
9805 .Pf ( Ic Reply , Respond , Followup )
9806 and vice versa.
9809 .It Va folder
9810 The default path under which mailboxes are to be saved:
9811 filenames that begin with the plus sign
9812 .Ql +
9813 will have the plus sign replaced with the value of this variable if set,
9814 otherwise the plus sign will remain unchanged when doing
9815 .Sx "Filename transformations" ;
9816 also see
9817 .Ic folder
9818 for more on this topic, and know about standard imposed implications of
9819 .Va outfolder .
9820 The value supports a subset of transformations itself, and if the
9821 non-empty value does not start with a solidus
9822 .Ql / ,
9823 then the value of
9824 .Ev HOME
9825 will be prefixed automatically.
9826 Once the actual value is evaluated first, the internal variable
9827 .Va folder-resolved
9828 will be updated for caching purposes.
9830 .Mx Va folder-hook
9831 .It Va folder-hook-FOLDER , Va folder-hook
9832 Names a
9833 .Ic define Ns d
9834 macro which will be called whenever a
9835 .Ic folder
9836 is opened.
9837 The macro will also be invoked when new mail arrives,
9838 but message lists for commands executed from the macro
9839 only include newly arrived messages then.
9840 .Ic localopts
9841 are activated by default in a folder hook, causing the covered settings
9842 to be reverted once the folder is left again.
9844 The specialized form will override the generic one if
9845 .Ql FOLDER
9846 matches the file that is opened.
9847 Unlike other folder specifications, the fully expanded name of a folder,
9848 without metacharacters, is used to avoid ambiguities.
9849 However, if the mailbox resides under
9850 .Va folder
9851 then the usual
9852 .Ql +
9853 specification is tried in addition, so that if
9854 .Va \&\&folder
9856 .Dq mail
9857 (and thus relative to the user's home directory) then
9858 .Pa /home/usr1/mail/sent
9859 will be tried as
9860 .Ql folder-hook-/home/usr1/mail/sent
9861 first, but then followed by
9862 .Ql folder-hook-+sent .
9865 .It Va folder-resolved
9866 \*(RO Set to the fully resolved path of
9867 .Va folder
9868 once that evaluation has occurred; rather internal.
9871 .It Va followup-to
9872 \*(BO Controls whether a
9873 .Ql Mail-Followup-To:
9874 header is generated when sending messages to known mailing lists.
9875 The user as determined via
9876 .Va from
9877 (or, if that contains multiple addresses,
9878 .Va sender )
9879 will be placed in there if any list addressee is not a subscribed list.
9880 Also see
9881 .Va followup-to-honour
9882 and the commands
9883 .Ic mlist , mlsubscribe , reply
9885 .Ic Lreply .
9888 .It Va followup-to-add-cc
9889 \*(BO Controls whether the user will be added to the messages'
9890 .Ql Cc:
9891 list in addition to placing an entry in
9892 .Ql Mail-Followup-To:
9893 (see
9894 .Va followup-to ) .
9897 .It Va followup-to-honour
9898 Controls whether a
9899 .Ql Mail-Followup-To:
9900 header is honoured when group-replying to a message via
9901 .Ic reply
9903 .Ic Lreply .
9904 This is a
9905 .Mx -sx
9906 .Sx quadoption ;
9907 if set without a value it defaults to
9908 .Dq yes ,
9909 and see
9910 .Va followup-to .
9913 .It Va forward-add-cc
9914 \*(BO Whether senders of messages forwarded via
9915 .Ic ~F , ~f , ~m , ~U
9917 .Ic ~u
9918 shall be made members of the carbon copies
9919 .Ql Cc:
9920 list.
9923 .It Va forward-as-attachment
9924 \*(BO Original messages are normally sent as inline text with the
9925 .Ic forward
9926 command,
9927 and only the first part of a multipart message is included.
9928 With this setting enabled messages are sent as unmodified MIME
9929 .Ql message/rfc822
9930 attachments with all of their parts included.
9934 .It Va forward-inject-head , forward-inject-tail
9935 The strings to put before and after the text of a message with the
9936 .Ic forward
9937 command, respectively.
9938 The former defaults to
9939 .Ql -------- Original Message --------\en .
9940 Special format directives in these strings will be expanded if possible,
9941 and if so configured the output will be folded according to
9942 .Va quote-fold ;
9943 for more please refer to
9944 .Va quote-inject-head .
9945 Injections will not be performed by
9946 .Ic forward
9947 if the variable
9948 .Va forward-as-attachment
9949 is set \(em the
9950 .Sx "COMMAND ESCAPES"
9951 .Ic ~F , ~f , ~M , ~m , ~U , ~u
9952 always inject.
9956 .It Va from
9957 The address (or a list of addresses) to put into the
9958 .Ql From:
9959 field of the message header, quoting RFC 5322:
9960 the author(s) of the message, that is, the mailbox(es) of the person(s)
9961 or system(s) responsible for the writing of the message.
9962 According to that RFC setting the
9963 .Va sender
9964 variable is required if
9965 .Va \&\&from
9966 contains more than one address.
9967 \*(ID Please expect automatic management of the
9968 .Va from
9970 .Va sender
9971 relationship.
9972 Dependent on the context these addresses are handled as if they were in
9973 the list of
9974 .Ic alternates .
9977 If a file-based MTA is used, then
9978 .Va \&\&from
9979 (or, if that contains multiple addresses,
9980 .Va sender )
9981 can nonetheless be used as the envelope sender address at the MTA
9982 protocol level (the RFC 5321 reverse-path), either via the
9983 .Fl r
9984 command line option (without argument; see there for more), or by setting
9985 .Va r-option-implicit .
9988 If the machine's hostname is not valid at the Internet (for example at
9989 a dialup machine), then either this variable or
9990 .Va hostname
9991 (\*(IN a SMTP-based
9992 .Va mta
9993 adds even more fine-tuning capabilities with
9994 .Va smtp-hostname )
9995 have to be set: if so the message and MIME part related unique ID fields
9996 .Ql Message-ID:
9998 .Ql Content-ID:
9999 will be created (except when disallowed by
10000 .Va message-id-disable
10002 .Va stealthmua ) .
10006 .It Va fullnames
10007 \*(BO Due to historical reasons comments and name parts of email
10008 addresses are removed by default when sending mail, replying to or
10009 forwarding a message.
10010 If this variable is set such stripping is not performed.
10012 .It Va fwdheading
10013 \*(OB Predecessor of
10014 .Va forward-inject-head .
10017 .It Va header
10018 \*(BO Causes the header summary to be written at startup and after
10019 commands that affect the number of messages or the order of messages in
10020 the current
10021 .Ic folder .
10022 Unless in
10023 .Va posix
10024 mode a header summary will also be displayed on folder changes.
10025 The command line option
10026 .Fl N
10027 can be used to set
10028 .Pf no Va header .
10032 .It Va headline
10033 A format string to use for the summary of
10034 .Ic headers .
10035 Format specifiers in the given string start with a percent sign
10036 .Ql %
10037 and may be followed by an optional decimal number indicating the field
10038 width \(em if that is negative, the field is to be left-aligned.
10039 Names and addresses are subject to modifications according to
10040 .Va showname
10042 .Va showto .
10043 Valid format specifiers are:
10046 .Bl -tag -compact -width ".It Ql _%%_"
10047 .It Ql %%
10048 A plain percent sign.
10049 .It Ql %>
10050 .Dq Dotmark :
10051 a space character but for the current message
10052 .Pf ( Dq dot ) ,
10053 for which it expands to
10054 .Ql >
10055 (dependent on
10056 .Va headline-plain ) .
10057 .It Ql %<
10058 .Dq Dotmark :
10059 a space character but for the current message
10060 .Pf ( Dq dot ) ,
10061 for which it expands to
10062 .Ql <
10063 (dependent on
10064 .Va headline-plain ) .
10065 .It Ql %$
10066 \*(OP The spam score of the message, as has been classified via the
10067 command
10068 .Ic spamrate .
10069 Shows only a replacement character if there is no spam support.
10070 .It Ql %a
10071 Message attribute character (status flag); the actual content can be
10072 adjusted by setting
10073 .Va attrlist .
10074 .It Ql %d
10075 The date found in the
10076 .Ql Date:
10077 header of the message when
10078 .Va datefield
10079 is set (the default), otherwise the date when the message was received.
10080 Formatting can be controlled by assigning a
10081 .Xr strftime 3
10082 format string to
10083 .Va datefield
10084 (and
10085 .Va datefield-markout-older ) .
10086 .It Ql %e
10087 The indenting level in
10088 .Ql thread Ns
10090 .Ic sort
10091 mode.
10092 .It Ql %f
10093 The address of the message sender.
10094 .It Ql %i
10095 The message thread tree structure.
10096 (Note that this format does not support a field width, and honours
10097 .Va headline-plain . )
10098 .It Ql %L
10099 Mailing list status: is the addressee of the message a known
10100 .Ql l
10101 .Pf ( Ic mlist )
10103 .Ql L
10104 .Ic mlsubscribe Ns
10105 d mailing list?
10106 The letter
10107 .Ql P
10108 announces the presence of a RFC 2369
10109 .Ql List-Post:
10110 header, which makes a message a valuable target of
10111 .Ic Lreply .
10112 .It Ql %l
10113 The number of lines of the message, if available.
10114 .It Ql %m
10115 Message number.
10116 .It Ql %o
10117 The number of octets (bytes) in the message, if available.
10118 .It Ql %S
10119 Message subject (if any) in double quotes.
10120 .It Ql %s
10121 Message subject (if any).
10122 .It Ql %t
10123 The position in threaded/sorted order.
10124 .It Ql \&%U
10125 The value 0 except in an IMAP mailbox,
10126 where it expands to the UID of the message.
10129 The default is
10130 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
10132 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
10134 .Va bsdcompat
10135 is set.
10136 Also see
10137 .Va attrlist ,
10138 .Va headline-plain
10140 .Va headline-bidi .
10144 .It Va headline-bidi
10145 Bidirectional text requires special treatment when displaying headers,
10146 because numbers (in dates or for file sizes etc.) will not affect the
10147 current text direction, in effect resulting in ugly line layouts when
10148 arabic or other right-to-left text is to be displayed.
10149 On the other hand only a minority of terminals is capable to correctly
10150 handle direction changes, so that user interaction is necessary for
10151 acceptable results.
10152 Note that extended host system support is required nonetheless, e.g.,
10153 detection of the terminal character set is one precondition;
10154 and this feature only works in an Unicode (i.e., UTF-8) locale.
10156 In general setting this variable will cause \*(UA to encapsulate text
10157 fields that may occur when displaying
10158 .Va headline
10159 (and some other fields, like dynamic expansions in
10160 .Va prompt )
10161 with special Unicode control sequences;
10162 it is possible to fine-tune the terminal support level by assigning
10163 a value:
10164 no value (or any value other than
10165 .Ql 1 ,
10166 .Ql 2
10168 .Ql 3 )
10169 will make \*(UA assume that the terminal is capable to properly deal
10170 with Unicode version 6.3, in which case text is embedded in a pair of
10171 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
10172 characters.
10173 In addition no space on the line is reserved for these characters.
10175 Weaker support is chosen by using the value
10176 .Ql 1
10177 (Unicode 6.3, but reserve the room of two spaces for writing the control
10178 sequences onto the line).
10179 The values
10180 .Ql 2
10182 .Ql 3
10183 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
10184 again reserves room for two spaces in addition.
10187 .It Va headline-plain
10188 \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are
10189 used by default for certain entries of
10190 .Va headline .
10191 If this variable is set only basic US-ASCII symbols will be used.
10194 .It Va history-file
10195 \*(OP The (expandable) location of a permanent
10196 .Ic history
10197 file for the MLE line editor
10198 .Pf ( Sx "On terminal control and line editor" ) .
10199 Also see
10200 .Va history-size .
10203 .It Va history-gabby
10204 \*(OP Add more entries to the MLE
10205 .Ic history
10206 as is normally done.
10207 A comma-separated list of case-insensitive strings can be used to
10208 fine-tune which gabby entries shall be allowed.
10209 If it contains
10210 .Ql errors ,
10211 erroneous commands will also be added.
10212 .Ql all
10213 adds all optional entries, and is the fallback chattiness identifier of
10214 .Va on-history-addition .
10217 .It Va history-gabby-persist
10218 \*(BO\*(OP The
10219 .Va history-gabby
10220 entries will not be saved in persistent storage unless this variable is set.
10221 The knowledge of whether a persistent entry was gabby is not lost.
10222 Also see
10223 .Va history-file .
10226 .It Va history-size
10227 \*(OP Setting this variable imposes a limit on the number of concurrent
10228 .Ic history
10229 entries.
10230 If set to the value 0 then no further history entries will be added,
10231 and loading and incorporation of the
10232 .Va history-file
10233 upon program startup can also be suppressed by doing this.
10234 Runtime changes will not be reflected before the
10235 .Ic history
10236 is saved or loaded (again).
10239 .It Va hold
10240 \*(BO This setting controls whether messages are held in the system
10241 .Va inbox ,
10242 and it is set by default.
10245 .It Va hostname
10246 Used instead of the value obtained from
10247 .Xr uname 3
10249 .Xr getaddrinfo 3
10250 as the hostname when expanding local addresses, for example in
10251 .Ql From:
10252 (also see
10253 .Sx "On sending mail, and non-interactive mode" ,
10254 for expansion of addresses that have a valid user-, but no domain
10255 name in angle brackets).
10256 If either of
10257 .Va from
10258 or this variable is set the message and MIME part related unique ID fields
10259 .Ql Message-ID:
10261 .Ql Content-ID:
10262 will be created (except when disallowed by
10263 .Va message-id-disable
10265 .Va stealthmua ) .
10266 If the \*(OPal IDNA support is available (see
10267 .Va idna-disable )
10268 variable assignment is aborted when a necessary conversion fails.
10270 Setting it to the empty string will cause the normal hostname to be
10271 used, but nonetheless enables creation of said ID fields.
10272 \*(IN in conjunction with the built-in SMTP
10273 .Va mta
10274 .Va smtp-hostname
10275 also influences the results:
10276 one should produce some test messages with the desired combination of
10277 .Va \&\&hostname ,
10278 and/or
10279 .Va from ,
10280 .Va sender
10281 etc. first.
10284 .It Va idna-disable
10285 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
10286 names according to the rules of IDNA (internationalized domain names
10287 for applications).
10288 Since the IDNA code assumes that domain names are specified with the
10289 .Va ttycharset
10290 character set, an UTF-8 locale charset is required to represent all
10291 possible international domain names (before conversion, that is).
10294 .It Va ifs
10295 The input field separator that is used (\*(ID by some functions) to
10296 determine where to split input data.
10298 .Bl -tag -compact -width ".It MMM"
10299 .It 1.
10300 Unsetting is treated as assigning the default value,
10301 .Ql \& \et\en .
10302 .It 2.
10303 If set to the empty value, no field splitting will be performed.
10304 .It 3.
10305 If set to a non-empty value, all whitespace characters are extracted
10306 and assigned to the variable
10307 .Va ifs-ws .
10310 .Bl -tag -compact -width ".It MMM"
10311 .It a.
10312 .Va \&\&ifs-ws
10313 will be ignored at the beginning and end of input.
10314 Diverging from POSIX shells default whitespace is removed in addition,
10315 which is owed to the entirely different line content extraction rules.
10316 .It b.
10317 Each occurrence of a character of
10318 .Va \&\&ifs
10319 will cause field-splitting, any adjacent
10320 .Va \&\&ifs-ws
10321 characters will be skipped.
10325 .It Va ifs-ws
10326 \*(RO Automatically deduced from the whitespace characters in
10327 .Va ifs .
10330 .It Va ignore
10331 \*(BO Ignore interrupt signals from the terminal while entering
10332 messages; instead echo them as
10333 .Ql @
10334 characters and discard the current line.
10337 .It Va ignoreeof
10338 \*(BO Ignore end-of-file conditions
10339 .Pf ( Ql control-D )
10341 .Sx "Compose mode"
10342 on message input and in interactive command input.
10343 If set an interactive command input session can only be left by
10344 explicitly using one of the commands
10345 .Ic exit
10347 .Ic quit ,
10348 and message input in compose mode can only be terminated by entering
10349 a period
10350 .Ql \&.
10351 on a line by itself or by using the
10352 .Ic ~.
10353 .Sx "COMMAND ESCAPES" ;
10354 Setting this implies the behaviour that
10355 .Va dot
10356 describes in
10357 .Va posix
10358 mode.
10361 .It Va inbox
10362 If this is set to a non-empty string it will specify the user's
10363 .Mx -sx
10364 .Sx "primary system mailbox" ,
10365 overriding
10366 .Ev MAIL
10367 and the system-dependent default, and (thus) be used to replace
10368 .Ql %
10369 when doing
10370 .Sx "Filename transformations" ;
10371 also see
10372 .Ic folder
10373 for more on this topic.
10374 The value supports a subset of transformations itself.
10376 .It Va indentprefix
10377 String used by the
10378 .Ic ~m , ~M
10380 .Ic ~R
10381 .Sx "COMMAND ESCAPES"
10382 and by the
10383 .Va quote
10384 option for indenting messages,
10385 in place of the POSIX mandated default tabulator character
10386 .Ql \et .
10387 Also see
10388 .Va quote-chars .
10391 .It Va keep
10392 \*(BO If set, an empty
10393 .Mx -sx
10394 .Sx "primary system mailbox"
10395 file is not removed.
10396 Note that, in conjunction with
10397 .Va posix
10398 mode any empty file will be removed unless this variable is set.
10399 This may improve the interoperability with other mail user agents
10400 when using a common folder directory, and prevents malicious users
10401 from creating fake mailboxes in a world-writable spool directory.
10402 \*(ID Only local regular (MBOX) files are covered, Maildir and other
10403 mailbox types will never be removed, even if empty.
10406 .It Va keep-content-length
10407 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
10408 be told to keep the
10409 .Ql Content-Length:
10411 .Ql Lines:
10412 header fields that some MUAs generate by setting this variable.
10413 Since \*(UA does neither use nor update these non-standardized header
10414 fields (which in itself shows one of their conceptual problems),
10415 stripping them should increase interoperability in between MUAs that
10416 work with with same mailbox files.
10417 Note that, if this is not set but
10418 .Va writebackedited ,
10419 as below, is, a possibly performed automatic stripping of these header
10420 fields already marks the message as being modified.
10421 \*(ID At some future time \*(UA will be capable to rewrite and apply an
10422 .Va mime-encoding
10423 to modified messages, and then those fields will be stripped silently.
10426 .It Va keepsave
10427 \*(BO When a message is saved it is usually discarded from the
10428 originating folder when \*(UA is quit.
10429 This setting causes all saved message to be retained.
10432 .It Va line-editor-cpl-word-breaks
10433 \*(OP List of bytes which are used by the
10434 .Cd mle-complete
10435 tabulator completion to decide where word boundaries exist, by default
10436 .Ql """'@=;|:
10437 \*(ID This mechanism is yet restricted.
10440 .It Va line-editor-disable
10441 \*(BO Turn off any line editing capabilities (from \*(UAs POW, see
10442 .Sx "On terminal control and line editor"
10443 for more).
10446 .It Va line-editor-no-defaults
10447 \*(BO\*(OP Do not establish any default key binding.
10450 .It Va log-prefix
10451 Error log message prefix string
10452 .Pf ( Ql "\*(uA: " ) .
10455 .It Va mailbox-display
10456 \*(RO The name of the current mailbox
10457 .Pf ( Ic folder ) ,
10458 possibly abbreviated for display purposes.
10461 .It Va mailbox-resolved
10462 \*(RO The fully resolved path of the current mailbox.
10465 .It Va mailcap-disable
10466 \*(BO\*(OP Turn off consideration of MIME type handlers from,
10467 and implicit loading of
10468 .Sx "The Mailcap files" .
10471 .It Va mailx-extra-rc
10472 An additional startup file that is loaded as the last of the
10473 .Sx "Resource files" .
10474 Use this file for commands that are not understood by other POSIX
10475 .Xr mailx 1
10476 implementations, i.e., mostly anything which is not covered by
10477 .Sx "Initial settings" .
10480 .It Va markanswered
10481 \*(BO When a message is replied to and this variable is set,
10482 it is marked as having been
10483 .Ic answered .
10484 See the section
10485 .Sx "Message states" .
10488 .It Va mbox-fcc-and-pcc
10489 \*(BO By default all file and pipe message receivers (see
10490 .Va expandaddr )
10491 will be fed valid MBOX database entry message data (see
10492 .Ic folder ,
10493 .Va mbox-rfc4155 ) ,
10494 and existing file targets will become extended in compliance to RFC 4155.
10495 If this variable is unset then a plain standalone RFC 5322 message will
10496 be written, and existing file targets will be overwritten.
10499 .It Va mbox-rfc4155
10500 \*(BO When opening MBOX mailbox databases, and in order to achieve
10501 compatibility with old software, the very tolerant POSIX standard rules
10502 for detecting message boundaries (so-called
10503 .Ql From_
10504 lines) are used instead of the stricter rules from the standard RFC 4155.
10505 This behaviour can be switched by setting this variable.
10507 This may temporarily be handy when \*(UA complains about invalid
10508 .Ql From_
10509 lines when opening a MBOX: in this case setting this variable and
10510 re-opening the mailbox in question may correct the result.
10511 If so, copying the entire mailbox to some other file, as in
10512 .Ql copy * SOME-FILE ,
10513 will perform proper, all-compatible
10514 .Ql From_
10515 quoting for all detected messages, resulting in a valid MBOX mailbox.
10516 (\*(ID The better and non-destructive approach is to re-encode invalid
10517 messages, as if it would be created anew, instead of mangling the
10518 .Ql From_
10519 lines; this requires the structural code changes of the v15 rewrite.)
10520 Finally the variable can be unset again:
10521 .Bd -literal -offset indent
10522 define mboxfix {
10523   localopts yes; wysh set mbox-rfc4155;\e
10524     wysh File "${1}"; copy * "${2}"
10526 call mboxfix /tmp/bad.mbox /tmp/good.mbox
10530 .It Va memdebug
10531 \*(BO Internal development variable.
10532 (Keeps memory debug enabled even if
10533 .Va debug
10534 is not set.)
10537 .It Va message-id-disable
10538 \*(BO By setting this variable the generation of
10539 .Ql Message-ID:
10541 .Ql Content-ID:
10542 message and MIME part headers can be completely suppressed, effectively
10543 leaving this task up to the
10544 .Va mta
10545 (Mail-Transfer-Agent) or the SMTP server.
10546 Note that according to RFC 5321 a SMTP server is not required to add this
10547 field by itself, so it should be ensured that it accepts messages without
10548 .Ql Message-ID .
10551 .It Va message-inject-head
10552 A string to put at the beginning of each new message, followed by a newline.
10553 \*(OB The escape sequences tabulator
10554 .Ql \et
10555 and newline
10556 .Ql \en
10557 are understood (use the
10558 .Cm wysh
10559 prefix when
10560 .Ic set Ns
10561 ting the variable(s) instead).
10564 .It Va message-inject-tail
10565 A string to put at the end of each new message, followed by a newline.
10566 \*(OB The escape sequences tabulator
10567 .Ql \et
10568 and newline
10569 .Ql \en
10570 are understood (use the
10571 .Cm wysh
10572 prefix when
10573 .Ic set Ns
10574 ting the variable(s) instead).
10575 Also see
10576 .Va on-compose-leave .
10579 .It Va metoo
10580 \*(BO Usually, when an
10581 .Ic alias
10582 expansion contains the sender, the sender is removed from the expansion.
10583 Setting this option suppresses these removals.
10584 Note that a set
10585 .Va metoo
10586 also causes a
10587 .Ql -m
10588 option to be passed through to the
10589 .Va mta
10590 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
10591 this flag, no MTA is known which does not support it (for historical
10592 compatibility).
10595 .It Va mime-allow-text-controls
10596 \*(BO When sending messages, each part of the message is MIME-inspected
10597 in order to classify the
10598 .Ql Content-Type:
10600 .Ql Content-Transfer-Encoding:
10601 (see
10602 .Va mime-encoding )
10603 that is required to send this part over mail transport, i.e.,
10604 a computation rather similar to what the
10605 .Xr file 1
10606 command produces when used with the
10607 .Ql --mime
10608 option.
10610 This classification however treats text files which are encoded in
10611 UTF-16 (seen for HTML files) and similar character sets as binary
10612 octet-streams, forcefully changing any
10613 .Ql text/plain
10615 .Ql text/html
10616 specification to
10617 .Ql application/octet-stream :
10618 If that actually happens a yet unset charset MIME parameter is set to
10619 .Ql binary ,
10620 effectively making it impossible for the receiving MUA to automatically
10621 interpret the contents of the part.
10623 If this variable is set, and the data was unambiguously identified as
10624 text data at first glance (by a
10625 .Ql .txt
10627 .Ql .html
10628 file extension), then the original
10629 .Ql Content-Type:
10630 will not be overwritten.
10633 .It Va mime-alternative-favour-rich
10634 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
10635 HTML) will be preferred in favour of included plain text versions when
10636 displaying messages, provided that a handler exists which produces
10637 output that can be (re)integrated into \*(UA's normal visual display.
10640 .It Va mime-counter-evidence
10641 Normally the
10642 .Ql Content-Type:
10643 field is used to decide how to handle MIME parts.
10644 Some MUAs, however, do not use
10645 .Sx "The mime.types files"
10646 (also see
10647 .Sx "HTML mail and MIME attachments" )
10648 or a similar mechanism to correctly classify content, but specify an
10649 unspecific MIME type
10650 .Pf ( Ql application/octet-stream )
10651 even for plain text attachments.
10652 If this variable is set then \*(UA will try to re-classify such MIME
10653 message parts, if possible, for example via a possibly existing
10654 attachment filename.
10655 A non-empty value may also be given, in which case a number is expected,
10656 actually a carrier of bits, best specified as a binary value, like
10657 .Ql 0b1111 .
10659 .Bl -bullet -compact
10661 If bit two is set (counting from 1, decimal 2) then the detected
10662 .Ic mimetype
10663 will be carried along with the message and be used for deciding which
10664 MIME handler is to be used, for example;
10665 when displaying such a MIME part the part-info will indicate the
10666 overridden content-type by showing a plus sign
10667 .Ql + .
10669 If bit three is set (decimal 4) then the counter-evidence is always
10670 produced and a positive result will be used as the MIME type, even
10671 forcefully overriding the parts given MIME type.
10673 If bit four is set (decimal 8) as a last resort the actual content of
10674 .Ql application/octet-stream
10675 parts will be inspected, so that data which looks like plain text can be
10676 treated as such.
10677 This mode is even more relaxed when data is to be displayed to the user
10678 or used as a message quote (data consumers which mangle data for display
10679 purposes, which includes masking of control characters, for example).
10684 .It Va mime-encoding
10685 The MIME
10686 .Ql Content-Transfer-Encoding
10687 to use in outgoing text messages and message parts, where applicable
10688 (7-bit clean text messages are without an encoding if possible):
10691 .Bl -tag -compact -width ".It Ql _%%_"
10692 .It Ql 8bit
10693 .Pf (Or\0 Ql 8b . )
10694 8-bit transport effectively causes the raw data be passed through
10695 unchanged, but may cause problems when transferring mail messages over
10696 channels that are not ESMTP (RFC 1869) compliant.
10697 Also, several input data constructs are not allowed by the
10698 specifications and may cause a different transfer-encoding to be used.
10699 By established rules and popular demand occurrences of
10700 .Ql ^From_
10701 (see
10702 .Va mbox-rfc4155 )
10703 will be MBOXO quoted (prefixed with greater-than sign
10704 .Ql > )
10705 instead of causing a non-destructive encoding like
10706 .Ql quoted-printable
10707 to be chosen, unless context (like message signing) requires otherwise.
10709 .It Ql quoted-printable
10710 .Pf (Or\0 Ql qp . )
10711 Quoted-printable encoding is 7-bit clean and has the property that ASCII
10712 characters are passed through unchanged, so that an english message can
10713 be read as-is; it is also acceptable for other single-byte locales that
10714 share many characters with ASCII, for example ISO-8859-1.
10715 The encoding will cause a large overhead for messages in other character
10716 sets: for example it will require up to twelve (12) bytes to encode
10717 a single UTF-8 character of four (4) bytes.
10718 It is the default encoding.
10720 .It Ql base64
10721 .Pf (Or\0 Ql b64 . )
10722 This encoding is 7-bit clean and will always be used for binary data.
10723 This encoding has a constant input:output ratio of 3:4, regardless of
10724 the character set of the input data it will encode three bytes of input
10725 to four bytes of output.
10726 This transfer-encoding is not human readable without performing
10727 a decoding step.
10732 .It Va mime-force-sendout
10733 \*(BO\*(OP Whenever it is not acceptable to fail sending out messages
10734 because of non-convertible character content this variable may be set.
10735 It will, as a last resort, classify the part content as
10736 .Ql application/octet-stream .
10737 Please refer to the section
10738 .Sx "Character sets"
10739 for the complete picture of character set conversion, and
10740 .Sx "HTML mail and MIME attachments"
10741 for how to internally or externally handle part content.
10744 .It Va mimetypes-load-control
10745 Can be used to control which of
10746 .Sx "The mime.types files"
10747 are loaded: if the letter
10748 .Ql u
10749 is part of the option value, then the user's personal
10750 .Pa \*(vU
10751 file will be loaded (if it exists); likewise the letter
10752 .Ql s
10753 controls loading of the system wide
10754 .Pa \*(vS ;
10755 directives found in the user file take precedence, letter matching is
10756 case-insensitive.
10757 If this variable is not set \*(UA will try to load both files.
10758 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
10759 but they will be matched last (the order can be listed via
10760 .Ic mimetype ) .
10762 More sources can be specified by using a different syntax: if the
10763 value string contains an equals sign
10764 .Ql =
10765 then it is instead parsed as a comma-separated list of the described
10766 letters plus
10767 .Ql f=FILENAME
10768 pairs; the given filenames will be expanded and loaded, and their
10769 content may use the extended syntax that is described in the section
10770 .Sx "The mime.types files" .
10771 Directives found in such files always take precedence (are prepended to
10772 the MIME type cache).
10776 .It Va mta
10777 Select an alternate Mail-Transfer-Agent by either specifying the full
10778 pathname of an executable (a
10779 .Ql file://
10780 prefix may be given), or \*(OPally a SMTP aka SUBMISSION protocol URL \*(IN:
10782 .Dl submissions://[user[:password]@]server[:port]
10784 (\*(OU:
10785 .Ql [smtp://]server[:port] . )
10786 The default has been chosen at compile time.
10787 MTA data transfers are always performed in asynchronous child processes,
10788 and without supervision unless either the
10789 .Va sendwait
10790 or the
10791 .Va verbose
10792 variable is set.
10793 Also see
10794 .Va mta-bcc-ok .
10795 \*(OPally expansion of
10796 .Xr aliases 5
10797 can be performed by setting
10798 .Va mta-aliases .
10801 For testing purposes there is the
10802 .Ql test
10803 pseudo-MTA, which dumps to standard output or optionally to a file,
10804 and honours
10805 .Va mbox-fcc-and-pcc :
10807 .Bd -literal -offset indent
10808 $ echo text | \*(uA -:/ -Smta=test -s ubject ex@am.ple
10809 $ </dev/null \*(uA -:/ -Smta=test://./xy ex@am.ple
10813 For a file-based MTA it may be necessary to set
10814 .Va mta-argv0
10815 in in order to choose the right target of a modern
10816 .Xr mailwrapper 8
10817 environment.
10818 It will be passed command line arguments from several possible sources:
10819 from the variable
10820 .Va mta-arguments
10821 if set, from the command line if given and the variable
10822 .Va expandargv
10823 allows their use.
10824 Argument processing of the MTA will be terminated with a
10825 .Fl \&\&-
10826 separator.
10829 The otherwise occurring implicit usage of the following MTA command
10830 line arguments can be disabled by setting the boolean variable
10831 .Va mta-no-default-arguments
10832 (which will also disable passing
10833 .Fl \&\&-
10834 to the MTA):
10835 .Fl \&\&i
10836 (for not treating a line with only a dot
10837 .Ql \&.
10838 character as the end of input),
10839 .Fl \&\&m
10840 (shall the variable
10841 .Va metoo
10842 be set) and
10843 .Fl \&\&v
10844 (if the
10845 .Va verbose
10846 variable is set); in conjunction with the
10847 .Fl r
10848 command line option or
10849 .Va r-option-implicit
10850 .Fl \&\&f
10851 as well as possibly
10852 .Fl \&\&F
10853 will (not) be passed.
10856 \*(OPally \*(UA can send mail over SMTP aka SUBMISSION network
10857 connections to a single defined smart host by setting this variable to
10858 a SMTP or SUBMISSION URL (see
10859 .Sx "On URL syntax and credential lookup" ) .
10860 An authentication scheme can be specified via the variable chain
10861 .Va smtp-auth .
10862 Encrypted network connections are \*(OPally available, the section
10863 .Sx "Encrypted network communication"
10864 should give an overview and provide links to more information on this.
10865 Note that with some mail providers it may be necessary to set the
10866 .Va smtp-hostname
10867 variable in order to use a specific combination of
10868 .Va from ,
10869 .Va hostname
10871 .Va mta .
10872 Network communication socket timeouts are configurable via
10873 .Va socket-connect-timeout .
10874 All generated network traffic may be proxied over a SOCKS
10875 .Va socks-proxy ,
10876 it can be logged by setting
10877 .Va verbose
10878 twice.
10879 The following SMTP variants may be used:
10881 .Bl -bullet
10883 The plain SMTP protocol (RFC 5321) that normally lives on the
10884 server port 25 and requires setting the
10885 .Va smtp-use-starttls
10886 variable to enter a TLS encrypted session state.
10887 Assign a value like \*(IN
10888 .Ql smtp://[user[:password]@]server[:port]
10889 (\*(OU
10890 .Ql smtp://server[:port] )
10891 to choose this protocol.
10893 The so-called SMTPS which is supposed to live on server port 465
10894 and is automatically TLS secured.
10895 Unfortunately it never became a standardized protocol and may thus not
10896 be supported by your hosts network service database
10897 \(en in fact the port number has already been reassigned to other
10898 protocols!
10900 SMTPS is nonetheless a commonly offered protocol and thus can be
10901 chosen by assigning a value like \*(IN
10902 .Ql smtps://[user[:password]@]server[:port]
10903 (\*(OU
10904 .Ql smtps://server[:port] ) ;
10905 due to the mentioned problems it is usually necessary to explicitly
10906 specify the port as
10907 .Ql :465 ,
10908 however.
10910 The SUBMISSION protocol (RFC 6409) lives on server port 587 and
10911 is identically to the SMTP protocol from \*(UA's point of view;
10912 it requires setting
10913 .Va smtp-use-starttls
10914 to enter a TLS secured session state; e.g., \*(IN
10915 .Ql submission://[user[:password]@]server[:port] .
10917 The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is
10918 TLS secured by default.
10919 It can be chosen by assigning a value like \*(IN
10920 .Ql submissions://[user[:password]@]server[:port] .
10921 Due to the problems mentioned for SMTPS above and the fact that
10922 SUBMISSIONS is new and a successor that lives on the same port as the
10923 historical engineering mismanagement named SMTPS, it is usually
10924 necessary to explicitly specify the port as
10925 .Ql :465 .
10930 .It Va mta-aliases
10931 \*(OP If set to a path pointing to a text file in valid MTA (Postfix)
10932 .Xr aliases 5
10933 format, the file is loaded and cached (manageable with
10934 .Ic mtaaliases ) ,
10935 and henceforth plain
10936 .Ql name
10937 (see
10938 .Va expandaddr )
10939 message receiver names are recursively expanded as a last expansion
10940 step, after the distribution lists which can be created with
10941 .Ic alias .
10942 Constraints on
10943 .Xr \&\&aliases 5
10944 content support: only local addresses (names) which are valid usernames
10945 .Pf ( Ql [a-z_][a-z0-9_-]*[$]? )
10946 are treated as expandable aliases, and \*(ID
10947 .Ql :include:/file/name
10948 directives are not supported.
10949 By including
10950 .Ql -name
10952 .Va expandaddr
10953 it can be asserted that only expanded names (mail addresses) are passed
10954 through to the MTA.
10957 .It Va mta-arguments
10958 Arguments to pass through to a file-based
10959 .Va mta
10960 (Mail-Transfer-Agent), parsed according to
10961 .Sx "Shell-style argument quoting"
10962 into an array of arguments which will be joined onto MTA options
10963 from other sources, for example
10964 .Ql \&? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
10967 .It Va mta-no-default-arguments
10968 \*(BO Avoids passing standard command line options to a file-based
10969 .Va mta
10970 (please see there).
10973 .It Va mta-no-receiver-arguments
10974 \*(BO By default all receiver addresses will be passed as command line
10975 options to a file-based
10976 .Va mta .
10977 Setting this variable disables this behaviour to aid those MTAs which
10978 employ special treatment of such arguments.
10979 Doing so can make it necessary to pass a
10980 .Fl \&\&t
10982 .Va mta-arguments ,
10983 to testify the MTA that it should use the passed message as a template.
10986 .It Va mta-argv0
10987 Many systems use a so-called
10988 .Xr mailwrapper 8
10989 environment to ensure compatibility with
10990 .Xr sendmail 1 .
10991 This works by inspecting the name that was used to invoke the mail
10992 delivery system.
10993 If this variable is set then the mailwrapper (the program that is
10994 actually executed when calling the file-based
10995 .Va mta )
10996 will treat its contents as that name.
10999 .It Va mta-bcc-ok
11000 \*(BO In violation of RFC 5322 some MTAs do not remove
11001 .Ql Bcc:
11002 header lines from transported messages after having noted the respective
11003 receivers for addressing purposes.
11004 (The MTAs Exim and Courier for example require the command line option
11005 .Fl \&\&t
11006 to enforce removal.)
11007 Unless this is set corresponding receivers are addressed by
11008 protocol-specific means or MTA command line options only, the header
11009 itself is stripped before being sent over the wire.
11011 .Mx Va netrc-lookup
11012 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
11013 \*(BO\*(IN\*(OP Used to control usage of the user's
11014 .Pa \*(VN
11015 file for lookup of account credentials, as documented in the section
11016 .Sx "On URL syntax and credential lookup"
11017 and for the command
11018 .Ic netrc ;
11019 the section
11020 .Sx "The .netrc file"
11021 documents the file format.
11022 Also see
11023 .Va netrc-pipe .
11026 .It Va netrc-pipe
11027 \*(IN\*(OP When
11028 .Pa \*(VN
11029 is loaded (see
11030 .Ic netrc
11032 .Va netrc-lookup )
11033 then \*(UA will read the output of a shell pipe instead of the user's
11034 .Pa \*(VN
11035 file if this variable is set (to the desired shell command).
11036 This can be used to, for example, store
11037 .Pa \*(VN
11038 in encrypted form:
11039 .Ql \&? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
11042 .It Va newfolders
11043 \*(OP If this variable has the value
11044 .Ql maildir ,
11045 newly created local folders will be in Maildir instead of MBOX format.
11048 .It Va newmail
11049 Checks for new mail in the current folder each time the prompt is shown.
11050 A Maildir folder must be re-scanned to determine if new mail has arrived.
11051 If this variable is set to the special value
11052 .Ql nopoll
11053 then a Maildir folder will not be rescanned completely, but only
11054 timestamp changes are detected.
11055 Maildir folders are \*(OPal.
11058 .It Va outfolder
11059 \*(BO Causes a non-absolute filename specified in
11060 .Va record ,
11061 as well as the sender-based filenames of the
11062 .Ic Copy ,
11063 .Ic Save ,
11064 .Ic Followup
11066 .Ic followup
11067 commands to be interpreted relative to the
11068 .Va folder
11069 directory rather than relative to the current directory.
11071 .Mx Va on-account-cleanup
11072 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
11073 Macro hook which will be called once an
11074 .Ic account
11075 is left, as the very last step before unrolling per-account
11076 .Ic localopts .
11077 This hook is run even in case of fatal errors, including those generated
11078 by switching to the account as such, and it is advisable to perform only
11079 absolutely necessary actions, like cleaning up
11080 .Ic alternates ,
11081 for example.
11082 The specialized form is used in favour of the generic one if found.
11085 .It Va on-compose-cleanup
11086 Macro hook which will be called after the message has been sent (or not,
11087 in case of failures), as the very last step before unrolling compose mode
11088 .Ic localopts .
11089 This hook is run even in case of fatal errors, and it is advisable to
11090 perform only absolutely necessary actions, like cleaning up
11091 .Ic alternates ,
11092 for example.
11094 For compose mode hooks that may affect the message content please see
11095 .Va on-compose-enter , on-compose-leave , on-compose-splice .
11096 \*(ID This hook exists because
11097 .Ic alias , alternates , commandalias , shortcut ,
11098 to name a few, are neither covered by
11099 .Ic localopts
11100 nor by
11101 .Cm local :
11102 changes applied in compose mode will continue to be in effect thereafter.
11107 .It Va on-compose-enter , on-compose-leave
11108 Macro hooks which will be called once compose mode is entered,
11109 and after composing has been finished, respectively;
11110 the exact order of the steps taken is documented for
11111 .Ic ~. ,
11112 one of the
11113 .Sx "COMMAND ESCAPES" .
11114 Context about the message being worked on can be queried via
11115 .Ic digmsg .
11116 .Ic localopts
11117 are enabled for these hooks, and changes on variables will be forgotten
11118 after the message has been sent.
11119 .Va on-compose-cleanup
11120 can be used to perform other necessary cleanup steps.
11123 Here is an example that injects a signature via
11124 .Va message-inject-tail ;
11125 instead using
11126 .Va on-compose-splice
11127 to simply inject the file of desire via
11128 .Ic ~<
11130 .Ic ~<!
11131 may be a better approach.
11133 .Bd -literal -offset indent
11134 define t_ocl {
11135   vput ! i cat ~/.mysig
11136   if $? -eq 0
11137      vput csop message-inject-tail trim-end $i
11138   end
11140   # Alternatively
11141   readctl create ~/.mysig
11142   if $? -eq 0
11143     readall i
11144     if $? -eq 0
11145       vput csop message-inject-tail trim-end $i
11146     end
11147     readctl remove ~/.mysig
11148   end
11150 set on-compose-leave=t_ocl
11156 .It Va on-compose-splice , on-compose-splice-shell
11157 These hooks run once the normal compose mode is finished, but before the
11158 .Va on-compose-leave
11159 macro hook is called etc.
11160 Both hooks will be executed in a subprocess, with their input and output
11161 connected to \*(UA such that they can act as if they would be an
11162 interactive user.
11163 The difference in between them is that the latter is a
11164 .Ev SHELL
11165 command, whereas the former is a normal
11166 .Ic define Ns
11167 d macro, but which is restricted to a small set of commands (the
11168 .Va verbose
11169 output of for example
11170 .Ic list
11171 will indicate said capability).
11172 .Ic localopts
11173 are enabled for these hooks (in the parent process), causing any setting
11174 to be forgotten after the message has been sent;
11175 .Va on-compose-cleanup
11176 can be used to perform other cleanup as necessary.
11179 During execution of these hooks \*(UA will temporarily forget whether it
11180 has been started in interactive mode, (a restricted set of)
11181 .Sx "COMMAND ESCAPES"
11182 will always be available, and for guaranteed reproducibilities sake
11183 .Va escape
11185 .Va ifs
11186 will be set to their defaults.
11187 The compose mode command
11188 .Ic ~^
11189 has been especially designed for scriptability (via these hooks).
11190 The first line the hook will read on its standard input is the protocol
11191 version of said command escape, currently
11192 .Dq 0 0 2 :
11193 backward incompatible protocol changes have to be expected.
11196 Care must be taken to avoid deadlocks and other false control flow:
11197 if both involved processes wait for more input to happen at the
11198 same time, or one does not expect more input but the other is stuck
11199 waiting for consumption of its output, etc.
11200 There is no automatic synchronization of the hook: it will not be
11201 stopped automatically just because it, e.g., emits
11202 .Ql ~x .
11203 The hooks will however receive a termination signal if the parent enters
11204 an error condition.
11205 \*(ID Protection against and interaction with signals is not yet given;
11206 it is likely that in the future these scripts will be placed in an
11207 isolated session, which is signalled in its entirety as necessary.
11209 .Bd -literal -offset indent
11210 define ocs_signature {
11211   read version
11212   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
11214 set on-compose-splice=ocs_signature
11216 wysh set on-compose-splice-shell=$'\e
11217   read version;\e
11218   printf "hello $version!  Headers: ";\e
11219   echo \e'~^header list\e';\e
11220   read status result;\e
11221   echo "status=$status result=$result";\e
11222   '
11224 define ocsm {
11225   read version
11226   echo Splice protocol version is $version
11227   echo '~^h l'; read hl; vput csop es subs "${hl}" 0 1
11228   if "$es" != 2
11229     echoerr 'Cannot read header list'; echo '~x'; xit
11230   endif
11231   if "$hl" !%?case ' cc'
11232     echo '~^h i cc "Diet is your <mirr.or>"'; read es;\e
11233       vput csop es substring "${es}" 0 1
11234     if "$es" != 2
11235       echoerr 'Cannot insert Cc: header'; echo '~x'
11236       # (no xit, macro finishes anyway)
11237     endif
11238   endif
11240 set on-compose-splice=ocsm
11245 .It Va on-history-addition
11246 This hook will be called if an entry is about to be added to the
11247 .Ic history
11248 of the MLE, as documented in
11249 .Sx "On terminal control and line editor" .
11250 It will be called with three arguments: the first is the name of the
11251 input context (see
11252 .Ic bind ) ,
11253 the second is either an empty string or the matching
11254 .Va history-gabby
11255 type, and the third being the complete command line to be added.
11256 The entry will not be added to history if the hook uses a non-0
11257 .Ic return .
11258 \*(ID A future version will give the expanded command name as the third
11259 argument, followed by the tokenized command line as parsed in the
11260 remaining arguments, the first of which is the original unexpanded
11261 command name; i.e., one may do
11262 .Ql Ic shift Ns \| 4
11263 and will then be able to access the positional parameters as usual via
11264 .Va * , # , 1
11265 etc.
11268 .It Va on-main-loop-tick
11269 This hook will be called whenever the program's main event loop is
11270 about to read the next input line.
11271 Note variable and other changes it performs are not scoped as via
11272 .Ic localopts !
11275 .It Va on-program-exit
11276 This hook will be called when the program exits, whether via
11277 .Ic exit
11279 .Ic quit ,
11280 or because the send mode is done.
11281 .Sy Note:
11282 this runs late and so terminal settings etc. are already teared down.
11285 .It Va on-resend-cleanup
11286 \*(ID Identical to
11287 .Va on-compose-cleanup ,
11288 but is only triggered by
11289 .Ic resend .
11292 .It Va on-resend-enter
11293 \*(ID Identical to
11294 .Va on-compose-enter ,
11295 but is only triggered by
11296 .Ic resend ;
11297 currently there is no
11298 .Ic digmsg
11299 support, for example.
11302 .It Va page
11303 \*(BO If set, each message feed through the command given for
11304 .Ic pipe
11305 is followed by a formfeed character
11306 .Ql \ef .
11308 .Mx Va password
11309 .It Va password-USER@HOST , password-HOST , password
11310 \*(IN Variable chain that sets a password, which is used in case none has
11311 been given in the protocol and account-specific URL;
11312 as a last resort \*(UA will ask for a password on the user's terminal if
11313 the authentication method requires a password.
11314 Specifying passwords in a startup file is generally a security risk;
11315 the file should be readable by the invoking user only.
11317 .It Va password-USER@HOST
11318 \*(OU (see the chain above for \*(IN)
11319 Set the password for
11320 .Ql USER
11321 when connecting to
11322 .Ql HOST .
11323 If no such variable is defined for a host,
11324 the user will be asked for a password on standard input.
11325 Specifying passwords in a startup file is generally a security risk;
11326 the file should be readable by the invoking user only.
11329 .It Va piperaw
11330 \*(BO Send messages to the
11331 .Ic pipe
11332 command without performing MIME and character set conversions.
11336 .It Va pipe-TYPE/SUBTYPE
11337 When a MIME message part of type
11338 .Ql TYPE/SUBTYPE
11339 (case-insensitive) is displayed or quoted,
11340 its text is filtered through the value of this variable interpreted as
11341 a shell command.
11342 Note that only parts which can be displayed inline as plain text (see
11343 .Cd copiousoutput )
11344 are displayed unless otherwise noted, other MIME parts will only be
11345 considered by and for the command
11346 .Ic mimeview .
11349 The special value question mark
11350 .Ql \&?
11351 forces interpretation of the message part as plain text, for example
11352 .Ql set pipe-application/xml=?
11353 will henceforth display XML
11354 .Dq as is .
11355 (The same could also be achieved by adding a MIME type marker with the
11356 .Ic mimetype
11357 command.
11358 And \*(OPally MIME type handlers may be defined via
11359 .Sx "The Mailcap files"
11360 \(em these directives,
11361 .Cd copiousoutput
11362 has already been used, should be referred to for further documentation.
11365 The question mark
11366 .Ql \&?
11367 can in fact be used as a trigger character to adjust usage and behaviour
11368 of a following shell command specification more thoroughly by appending
11369 more special characters which refer to further mailcap directives, for
11370 example the following hypothetical command specification could be used:
11372 .Bd -literal -offset indent
11373 ? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}'
11377 .Bl -tag -compact -width ".It Ql __"
11378 .It Ql *
11379 The command produces plain text to be integrated in \*(UAs output:
11380 .Cd copiousoutput .
11382 .It Ql #
11383 If set the handler will not be invoked when a message is to be quoted,
11384 but only when it will be displayed:
11385 .Cd x-mailx-noquote .
11387 .It Ql &
11388 Run the command asynchronously, i.e., without blocking \*(UA:
11389 .Cd x-mailx-async .
11390 The standard output of the command will go to
11391 .Pa /dev/null .
11393 .It Ql \&!
11394 The command must be run on an interactive terminal, \*(UA will
11395 temporarily release the terminal to it:
11396 .Cd needsterminal .
11398 .It Ql +
11399 Request creation of a zero-sized temporary file, the absolute pathname
11400 of which will be made accessible via the environment variable
11401 .Ev MAILX_FILENAME_TEMPORARY :
11402 .Cd x-mailx-tmpfile .
11403 If given twice then the file will be unlinked automatically by \*(UA
11404 when the command loop is entered again at latest:
11405 .Cd x-mailx-tmpfile-unlink ;
11406 it is an error to use automatic deletion in conjunction with
11407 .Cd x-mailx-async .
11409 .It Ql =
11410 Normally the MIME part content is passed to the handler via standard
11411 input; if this flag is set then the data will instead be written into
11412 .Ev MAILX_FILENAME_TEMPORARY
11413 .Pf ( Cd x-mailx-tmpfile-fill ) ,
11414 the creation of which is implied; in order to cause automatic deletion
11415 of the temporary file two plus signs
11416 .Ql ++
11417 still have to be used.
11419 .It Ql \&?
11420 To avoid ambiguities with normal shell command content another
11421 question mark can be used to forcefully terminate interpretation of
11422 remaining characters.
11423 (Any character not in this list will have the same effect.)
11427 Some information about the MIME part to be displayed is embedded into
11428 the environment of the shell command:
11431 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
11433 .It Ev MAILX_CONTENT
11434 The MIME content-type of the part, if known, the empty string otherwise.
11437 .It Ev MAILX_CONTENT_EVIDENCE
11439 .Va mime-counter-evidence
11440 includes the carry-around-bit (2), then this will be set to the detected
11441 MIME content-type; not only then identical to
11442 .Ev \&\&MAILX_CONTENT
11443 otherwise.
11446 .It Ev MAILX_EXTERNAL_BODY_URL
11447 MIME parts of type
11448 .Ql message/external-body access-type=url
11449 will store the access URL in this variable, it is empty otherwise.
11450 URL targets should not be activated automatically, without supervision.
11453 .It Ev MAILX_FILENAME
11454 The filename, if any is set, the empty string otherwise.
11457 .It Ev MAILX_FILENAME_GENERATED
11458 A random string.
11461 .It Ev MAILX_FILENAME_TEMPORARY
11462 If temporary file creation has been requested through the command prefix
11463 this variable will be set and contain the absolute pathname of the
11464 temporary file.
11469 .It Va pipe-EXTENSION
11470 This is identical to
11471 .Va pipe-TYPE/SUBTYPE
11472 except that
11473 .Ql EXTENSION
11474 (normalized to lowercase using character mappings of the ASCII charset)
11475 names a file extension, for example
11476 .Ql xhtml .
11477 Handlers registered using this method take precedence.
11479 .Mx Va pop3-auth
11480 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
11481 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
11482 Supported are the default
11483 .Ql plain ,
11484 \*(IN
11485 .Ql oauthbearer
11486 (see
11487 .Sx FAQ
11488 entry
11489 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) ,
11490 as well as \*(IN
11491 .Ql external
11493 .Ql externanon
11494 for TLS secured connections which pass a client certificate via
11495 .Va tls-config-pairs .
11496 There may be the \*(OPal method \*(IN
11497 .Ql gssapi .
11498 .Ql externanon
11499 does not need any user credentials,
11500 .Ql external
11502 .Ql gssapi
11503 need a
11504 .Va user ,
11505 the remains also require a
11506 .Va password .
11507 .Ql externanon
11508 solely builds upon the credentials passed via a client certificate,
11509 and is usually the way to go since tested servers do not actually follow
11510 RFC 4422, and fail if additional credentials are actually passed.
11511 Unless
11512 .Va pop3-no-apop
11513 is set the
11514 .Ql plain
11515 method will \*(OPally be replaced with APOP if possible (see there).
11517 .Mx Va pop3-bulk-load
11518 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
11519 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
11520 the messages, and only requests the message bodies on user request.
11521 For the POP3 protocol this means that the message headers will be
11522 downloaded twice.
11523 If this variable is set then \*(UA will download only complete messages
11524 from the given POP3 server(s) instead.
11526 .Mx Va pop3-keepalive
11527 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
11528 \*(OP POP3 servers close the connection after a period of inactivity;
11529 the standard requires this to be at least 10 minutes,
11530 but practical experience may vary.
11531 Setting this variable to a numeric value greater than
11532 .Ql 0
11533 causes a
11534 .Ql NOOP
11535 command to be sent each value seconds if no other operation is performed.
11537 .Mx Va pop3-no-apop
11538 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
11539 \*(BO\*(OP Unless this variable is set the MD5 based
11540 .Ql APOP
11541 authentication method will be used instead of a chosen
11542 .Ql plain
11543 .Va pop3-auth
11544 when connecting to a POP3 server that advertises support.
11545 The advantage of
11546 .Ql APOP
11547 is that only a single packet is sent for the user/password tuple.
11548 (Originally also that the password is not sent in clear text over the
11549 wire, but for one MD5 does not any longer offer sufficient security,
11550 and then today transport is almost ever TLS secured.)
11551 Note that
11552 .Va pop3-no-apop-HOST
11553 requires \*(IN.
11555 .Mx Va pop3-use-starttls
11556 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
11557 \*(BO\*(OP Causes \*(UA to issue a
11558 .Ql STLS
11559 command to make an unencrypted POP3 session TLS encrypted.
11560 This functionality is not supported by all servers,
11561 and is not used if the session is already encrypted by the POP3S method.
11562 Note that
11563 .Va pop3-use-starttls-HOST
11564 requires \*(IN.
11568 .It Va posix
11569 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
11570 where that deviates from standardized behaviour.
11571 It is automatically squared with the environment variable
11572 .Ev POSIXLY_CORRECT ,
11573 changing the one will adjust the other.
11574 The following behaviour is covered and enforced by this mechanism:
11577 .Bl -bullet -compact
11579 In non-interactive mode, any error encountered while loading resource
11580 files during program startup will cause a program exit, whereas in
11581 interactive mode such errors will stop loading of the currently loaded
11582 (stack of) file(s, i.e., recursively).
11583 These exits can be circumvented on a per-command base by using
11584 .Cm ignerr ,
11585 one of the
11586 .Sx "Command modifiers" ,
11587 for each command which shall be allowed to fail.
11590 .Ic alternates
11591 will replace the list of alternate addresses instead of appending to it.
11592 In addition alternates will only be honoured for any sort of message
11593 .Ic reply ,
11594 and for aliases.
11597 The variable inserting
11598 .Sx "COMMAND ESCAPES"
11599 .Ic ~A ,
11600 .Ic ~a ,
11601 .Ic ~I
11603 .Ic ~i
11604 will expand embedded character sequences
11605 .Ql \et
11606 horizontal tabulator and
11607 .Ql \en
11608 line feed.
11609 \*(ID For compatibility reasons this step will always be performed.
11612 Reading in messages via
11613 .Ic ~f
11614 .Pf ( Sx "COMMAND ESCAPES" )
11615 will use the
11616 .Ql type
11617 not the
11618 .Ql forward
11619 .Ic headerpick
11620 selection.
11623 Upon changing the active
11624 .Ic folder
11625 no summary of
11626 .Ic headers
11627 will be displayed even if
11628 .Va header
11629 is set.
11632 Setting
11633 .Va ignoreeof
11634 implies the behaviour described by
11635 .Va dot .
11638 The variable
11639 .Va keep
11640 is extended to cover any empty mailbox, not only empty
11641 .Mx -sx
11642 .Sx "primary system mailbox" Ns
11643 es: they will be removed when they are left in empty state otherwise.
11646 Each command has an exit
11647 .Va \&?
11648 and error
11649 .Va \&!
11650 status that overwrites that of the last command.
11651 In POSIX mode the program exit status will signal failure regardless
11652 unless all messages were successfully sent out to the
11653 .Va mta ;
11654 also see
11655 .Va sendwait .
11660 .It Va print-alternatives
11661 \*(BO When a MIME message part of type
11662 .Ql multipart/alternative
11663 is displayed and it contains a subpart of type
11664 .Ql text/plain ,
11665 other parts are normally discarded.
11666 Setting this variable causes all subparts to be displayed,
11667 just as if the surrounding part was of type
11668 .Ql multipart/mixed .
11671 .It Va prompt
11672 The string used as a prompt in interactive mode.
11673 Whenever the variable is evaluated the value is treated as if specified
11674 within dollar-single-quotes (see
11675 .Sx "Shell-style argument quoting" ) .
11676 This (post-assignment, i.e., second) expansion can be used to embed
11677 status information, for example
11678 .Va \&? ,
11679 .Va \&! ,
11680 .Va account
11682 .Va mailbox-display .
11684 In order to embed characters which should not be counted when
11685 calculating the visual width of the resulting string, enclose the
11686 characters of interest in a pair of reverse solidus escaped brackets:
11687 .Ql \e[\eE[0m\e] ;
11688 a slot for coloured prompts is also available with the \*(OPal command
11689 .Ic colour .
11690 Prompting may be prevented by setting this to the null string
11691 (aka\|
11692 .Ql set noprompt ) .
11695 .It Va prompt2
11696 This string is used for secondary prompts, but is otherwise identical to
11697 .Va prompt .
11698 The default is
11699 .Ql ..\0 .
11702 .It Va quiet
11703 \*(BO Suppresses the printing of the version when first invoked.
11706 .It Va quote
11707 If set messages processed by variants of
11708 .Ic followup
11710 .Ic reply
11711 will start with the original message, lines of which prefixed by
11712 .Va indentprefix ,
11713 taking into account
11714 .Va quote-chars
11716 .Va quote-fold .
11717 No headers will be quoted when set without value or for
11718 .Ql noheading ,
11720 .Ql headers
11722 .Ql type
11723 .Ic headerpick
11724 selection will be included in the quote,
11725 .Ql allbodies
11726 embeds the (body) contents of all MIME parts, and
11727 .Ql allheaders
11728 also includes all headers.
11729 The quoted message will be enclosed by the expansions of
11730 .Va quote-inject-head
11732 .Va quote-inject-tail .
11733 Also see
11734 .Va quote-add-cc ,
11735 .Va quote-as-attachment
11737 .Ic ~Q ,
11738 one of the
11739 .Sx "COMMAND ESCAPES" .
11742 .It Va quote-add-cc
11743 \*(BO Whether senders of messages quoted via
11744 .Ic ~Q
11745 shall be made members of the carbon copies
11746 .Ql Cc:
11747 list.
11750 .It Va quote-as-attachment
11751 \*(BO Add the original message in its entirety as a
11752 .Ql message/rfc822
11753 MIME attachment when replying to a message.
11754 Note this works regardless of the setting of
11755 .Va quote .
11758 .It Va quote-chars
11759 Can be set to a string consisting of non-whitespace ASCII characters
11760 which shall be treated as quotation leaders, the default being
11761 .Ql >|}: .
11764 .It Va quote-fold
11765 \*(OP Can be set in addition to
11766 .Va indentprefix ,
11767 and creates a more fancy quotation in that leading quotation characters
11768 .Pf ( Va quote-chars )
11769 are compressed and overlong lines are folded.
11770 .Va \&\&quote-fold
11771 can be set to either one, two or three (space separated) numeric values,
11772 which are interpreted as the maximum (goal) and the minimum line length,
11773 respectively, in a spirit rather equal to the
11774 .Xr fmt 1
11775 program, but line- instead of paragraph-based.
11776 The third value is used as the maximum line length instead of the first
11777 if no better break point can be found; it is ignored unless it is larger
11778 than the minimum and smaller than the maximum.
11779 If not set explicitly the minimum will reflect the goal algorithmically.
11780 The goal cannot be smaller than the length of
11781 .Va indentprefix
11782 plus some additional pad; necessary adjustments take place silently.
11787 .It Va quote-inject-head , quote-inject-tail
11788 The strings to put before and after the text of a
11789 .Va quote Ns
11790 d message, if non-empty, and respectively.
11791 The former defaults to
11792 .Ql %f wrote:\en\en .
11793 Special format directives will be expanded if possible, and if so
11794 configured the output will be folded according to
11795 .Va quote-fold .
11796 Format specifiers in the given strings start with a percent sign
11797 .Ql %
11798 and expand values of the original message, unless noted otherwise.
11799 Note that names and addresses are not subject to the setting of
11800 .Va showto .
11801 Valid format specifiers are:
11804 .Bl -tag -compact -width ".It Ql _%%_"
11805 .It Ql %%
11806 A plain percent sign.
11807 .It Ql %a
11808 The address(es) of the sender(s).
11809 .It Ql %d
11810 The date found in the
11811 .Ql Date:
11812 header of the message when
11813 .Va datefield
11814 is set (the default), otherwise the date when the message was received.
11815 Formatting can be controlled by assigning a
11816 .Xr strftime 3
11817 format string to
11818 .Va datefield
11819 (and
11820 .Va datefield-markout-older ) .
11821 .It Ql %f
11822 The full name(s) (name and address, as given) of the sender(s).
11823 .It Ql %i
11825 .Ql Message-ID: .
11826 .It Ql %n
11827 The real name(s) of the sender(s) if there is one and
11828 .Va showname
11829 allows usage, the address(es) otherwise.
11830 .It Ql %r
11831 The senders real name(s) if there is one, the address(es) otherwise.
11836 .It Va r-option-implicit
11837 \*(BO Setting this option evaluates the contents of
11838 .Va from
11839 (or, if that contains multiple addresses,
11840 .Va sender )
11841 and passes the results onto the used (file-based) MTA as described for the
11842 .Fl r
11843 option (empty argument case).
11846 .It Va recipients-in-cc
11847 \*(BO When doing a
11848 .Ic reply ,
11849 the original
11850 .Ql From:
11852 .Ql To:
11853 as well as addressees which possibly came in via
11854 .Ql Reply-To:
11856 .Ql Mail-Followup-To:
11857 are by default merged into the new
11858 .Ql To: .
11859 If this variable is set a sensitive algorithm tries to place in
11860 .Ql To:
11861 only the sender of the message being replied to, others are placed in
11862 .Ql Cc: .
11865 .It Va record
11866 Unless this variable is defined, no copies of outgoing mail will be saved.
11867 If defined it gives the pathname, subject to the usual
11868 .Sx "Filename transformations" ,
11869 of a folder where all new, replied-to or forwarded messages are saved:
11870 when saving to this folder fails the message is not sent, but instead
11871 .Va save Ns
11872 d to
11873 .Ev DEAD .
11874 The standard defines that relative (fully expanded) paths are to be
11875 interpreted relative to the current directory
11876 .Pf ( Ic cwd ) ,
11877 to force interpretation relative to
11878 .Va folder
11879 .Va outfolder
11880 needs to be set in addition.
11883 .It Va record-files
11884 \*(BO If this variable is set the meaning of
11885 .Va record
11886 will be extended to cover messages which target only file and pipe
11887 recipients (see
11888 .Va expandaddr ) .
11889 These address types will not appear in recipient lists unless
11890 .Va add-file-recipients
11891 is also set.
11894 .It Va record-resent
11895 \*(BO If this variable is set the meaning of
11896 .Va record
11897 will be extended to also cover the
11898 .Ic resend
11900 .Ic Resend
11901 commands.
11904 .It Va reply-in-same-charset
11905 \*(BO If this variable is set \*(UA first tries to use the same
11906 character set of the original message for replies.
11907 If this fails, the mechanism described in
11908 .Sx "Character sets"
11909 is evaluated as usual.
11912 .It Va reply-strings
11913 Can be set to a comma-separated list of (case-insensitive according to
11914 ASCII rules) strings which shall be recognized in addition to the
11915 built-in strings as
11916 .Ql Subject:
11917 reply message indicators \(en built-in are
11918 .Ql Re: ,
11919 which is mandated by RFC 5322, as well as the german
11920 .Ql Aw: ,
11921 .Ql Antw: ,
11922 and the
11923 .Ql Wg:
11924 which often has been seen in the wild;
11925 I.e., the separating colon has to be specified explicitly.
11928 .It Va reply-to
11929 A list of addresses to put into the
11930 .Ql Reply-To:
11931 field of the message header.
11932 Members of this list are handled as if they were in the
11933 .Ic alternates
11934 list.
11936 .It Va replyto
11937 \*(OB Variant of
11938 .Va reply-to .
11941 .It Va reply-to-honour
11942 Controls whether a
11943 .Ql Reply-To:
11944 header is honoured when replying to a message via
11945 .Ic reply
11947 .Ic Lreply .
11948 This is a
11949 .Mx -sx
11950 .Sx quadoption ;
11951 if set without a value it defaults to
11952 .Dq yes .
11955 .It Va reply-to-swap-in
11956 Standards like DKIM and (in conjunction with) DMARC caused many
11957 .Sx "Mailing lists"
11958 to use sender address rewriting in the style of
11959 .Ql Name via List <list@address> ,
11960 where the original sender address often being placed in
11961 .Ql Reply-To: .
11962 If this is set and a
11963 .Ql Reply-To:
11964 exists, and consists of only one addressee (!), then that is used in
11965 place of the pretended sender.
11966 This works independently from
11967 .Va reply-to-honour .
11968 The optional value, a comma-separated list of strings, offers more
11969 fine-grained control on when swapping shall be used; for now supported is
11970 .Va mlist ,
11971 here swapping occurs if the sender is a mailing-list as defined by
11972 .Ic mlist .
11975 .It Va rfc822-body-from_
11976 \*(BO This variable can be used to force displaying a so-called
11977 .Ql From_
11978 line for messages that are embedded into an envelope mail via the
11979 .Ql message/rfc822
11980 MIME mechanism, for more visual convenience, also see
11981 .Va mbox-rfc4155 .
11984 .It Va save
11985 \*(BO Enable saving of (partial) messages in
11986 .Ev DEAD
11987 upon interrupt or delivery error.
11990 .It Va screen
11991 The number of lines that represents a
11992 .Dq screenful
11993 of lines, used in
11994 .Ic headers
11995 summary display,
11996 .Ic from
11997 .Ic search Ns
11998 ing, message
11999 .Ic top Ns
12000 line display and scrolling via
12001 .Ic z .
12002 If this variable is not set \*(UA falls back to a calculation based upon
12003 the detected terminal window size and the baud rate: the faster the
12004 terminal, the more will be shown.
12005 Overall screen dimensions and pager usage is influenced by the
12006 environment variables
12007 .Ev COLUMNS
12009 .Ev LINES
12010 and the variable
12011 .Va crt .
12014 .It Va searchheaders
12015 \*(BO Expand message list specifiers in the form
12016 .Ql /x:y
12017 to all messages containing the substring
12018 .Dq y
12019 in the header field
12020 .Ql x .
12021 The string search is case insensitive.
12024 .It Va sendcharsets
12025 \*(OP A comma-separated list of character set names that can be used in
12026 outgoing internet mail.
12027 The value of the variable
12028 .Va charset-8bit
12029 is automatically appended to this list of character sets.
12030 If no character set conversion capabilities are compiled into \*(UA then
12031 the only supported charset is
12032 .Va ttycharset .
12033 Also see
12034 .Va sendcharsets-else-ttycharset
12035 and refer to the section
12036 .Sx "Character sets"
12037 for the complete picture of character set conversion in \*(UA.
12040 .It Va sendcharsets-else-ttycharset
12041 \*(BO\*(OP If this variable is set, but
12042 .Va sendcharsets
12043 is not, then \*(UA acts as if
12044 .Va sendcharsets
12045 had been set to the value of the variable
12046 .Va ttycharset .
12047 In effect this combination passes through the message data in the
12048 character set of the current locale encoding:
12049 therefore mail message text will be (assumed to be) in ISO-8859-1
12050 encoding when send from within a ISO-8859-1 locale, and in UTF-8
12051 encoding when send from within an UTF-8 locale.
12053 The 8-bit fallback
12054 .Va charset-8bit
12055 never comes into play as
12056 .Va ttycharset
12057 is implicitly assumed to be 8-bit and capable to represent all files the
12058 user may specify (as is the case when no character set conversion
12059 support is available in \*(UA and the only supported character set is
12060 .Va ttycharset ,
12062 .Sx "Character sets" ) .
12063 This might be a problem for scripts which use the suggested
12064 .Ql LC_ALL=C
12065 setting, since in this case the character set is US-ASCII by definition,
12066 so that it is better to also override
12067 .Va ttycharset ,
12068 then; and/or do something like the following in the resource file:
12069 .Bd -literal -offset indent
12070 # Avoid ASCII "propagates to 8-bit" when scripting
12071 \eif ! t && "$LC_ALL" != C && "$LC_CTYPE" != C
12072   \eset sendcharsets-else-ttycharset
12073 \eend
12077 .It Va sender
12078 An address that is put into the
12079 .Ql Sender:
12080 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
12081 responsible for the actual transmission of the message.
12082 This field should normally not be used unless the
12083 .Va from
12084 field contains more than one address, on which case it is required.
12085 \*(ID Please expect automatic management of the
12086 .Va from
12088 .Va sender
12089 relationship.
12090 Dependent on the context this address is handled as if it were in
12091 the list of
12092 .Ic alternates .
12093 Also see
12094 .Fl r ,
12095 .Va r-option-implicit .
12097 .It Va sendmail
12098 \*(OB Predecessor of
12099 .Va mta .
12101 .It Va sendmail-arguments
12102 \*(OB Predecessor of
12103 .Va mta-arguments .
12105 .It Va sendmail-no-default-arguments
12106 \*(OB\*(BO Predecessor of
12107 .Va mta-no-default-arguments .
12109 .It Va sendmail-progname
12110 \*(OB Predecessor of
12111 .Va mta-argv0 .
12114 .It Va sendwait
12115 Sending messages to the chosen
12116 .Va mta
12117 or to command-pipe receivers (see
12118 .Sx "On sending mail, and non-interactive mode" )
12119 will be performed asynchronously.
12120 This means that only startup errors of the respective program will be
12121 recognizable, but no delivery errors.
12122 Also, no guarantees can be made as to when the respective program will
12123 actually run, as well as to when they will have produced output.
12125 If this variable is set then child program exit is waited for, and its
12126 exit status code is used to decide about success.
12127 Remarks: in conflict with the POSIX standard this variable is built-in
12128 to be initially set.
12129 Another difference is that it can have a value, which is interpreted as
12130 a comma-separated list of case-insensitive strings naming specific
12131 subsystems for which synchronousness shall be ensured (only).
12132 Possible values are
12133 .Ql mta
12135 .Va mta
12136 delivery, and
12137 .Ql pcc
12138 for command-pipe receivers.
12141 .It Va showlast
12142 \*(BO This setting causes \*(UA to start at the last message
12143 instead of the first one when opening a mail folder, as well as with
12144 .Ic from
12146 .Ic headers .
12149 .It Va showname
12150 \*(BO Causes \*(UA to use the sender's real name instead of the plain
12151 address in the header field summary and in message specifications.
12154 .It Va showto
12155 \*(BO Causes the recipient of the message to be shown in the header
12156 summary if the message was sent by the user.
12159 .It Va Sign
12160 The value backing
12161 .Ic ~A ,
12162 one of the
12163 .Sx "COMMAND ESCAPES" .
12164 Also see
12165 .Va message-inject-tail ,
12166 .Va on-compose-leave
12168 .Va on-compose-splice .
12171 .It Va sign
12172 The value backing
12173 .Ic ~a ,
12174 one of the
12175 .Sx "COMMAND ESCAPES" .
12176 Also see
12177 .Va message-inject-tail ,
12178 .Va on-compose-leave
12180 .Va on-compose-splice .
12183 .It Va signature
12184 \*(OB Please use
12185 .Va on-compose-splice
12187 .Va on-compose-splice-shell
12189 .Va on-compose-leave
12190 and (if necessary)
12191 .Va message-inject-tail
12192 instead!
12195 .It Va skipemptybody
12196 \*(BO If an outgoing message has an empty first or only message part, do
12197 not send, but discard it, successfully (also see the command line option
12198 .Fl E ) .
12202 .It Va smime-ca-dir , smime-ca-file
12203 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
12204 Enhanced Mail) for the purpose of verification of S/MIME signed messages.
12205 .Va tls-ca-dir
12206 documents the necessary preparation steps to use the former.
12207 The set of CA certificates which are built into the TLS library can
12208 be explicitly turned off by setting
12209 .Va smime-ca-no-defaults ,
12210 and further fine-tuning is possible via
12211 .Va smime-ca-flags .
12214 .It Va smime-ca-flags
12215 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
12216 storage, and the certificate verification that is used.
12217 The actual values and their meanings are documented for
12218 .Va tls-ca-flags .
12221 .It Va smime-ca-no-defaults
12222 \*(BO\*(OP Do not load the default CA locations that are built into the
12223 used to TLS library to verify S/MIME signed messages.
12225 .Mx Va smime-cipher
12226 .It Va smime-cipher-USER@HOST , smime-cipher
12227 \*(OP Specifies the cipher to use when generating S/MIME encrypted
12228 messages (for the specified account).
12229 RFC 5751 mandates a default of
12230 .Ql aes128
12231 (AES-128 CBC).
12232 Possible values are (case-insensitive and) in decreasing cipher strength:
12233 .Ql aes256
12234 (AES-256 CBC),
12235 .Ql aes192
12236 (AES-192 CBC),
12237 .Ql aes128
12238 (AES-128 CBC),
12239 .Ql des3
12240 (DES EDE3 CBC, 168 bits; default if
12241 .Ql aes128
12242 is not available) and
12243 .Ql des
12244 (DES CBC, 56 bits).
12246 The actually available cipher algorithms depend on the cryptographic
12247 library that \*(UA uses.
12248 \*(OP Support for more cipher algorithms may be available through
12249 dynamic loading via
12250 .Xr EVP_get_cipherbyname 3
12251 (OpenSSL) if \*(UA has been compiled to support this.
12254 .It Va smime-crl-dir
12255 \*(OP Specifies a directory that contains files with CRLs in PEM format
12256 to use when verifying S/MIME messages.
12259 .It Va smime-crl-file
12260 \*(OP Specifies a file that contains a CRL in PEM format to use when
12261 verifying S/MIME messages.
12264 .It Va smime-encrypt-USER@HOST
12265 \*(OP If this variable is set, messages send to the given receiver are
12266 encrypted before sending.
12267 The value of the variable must be set to the name of a file that
12268 contains a certificate in PEM format.
12270 If a message is sent to multiple recipients,
12271 each of them for whom a corresponding variable is set will receive an
12272 individually encrypted message;
12273 other recipients will continue to receive the message in plain text
12274 unless the
12275 .Va smime-force-encryption
12276 variable is set.
12277 It is recommended to sign encrypted messages, i.e., to also set the
12278 .Va smime-sign
12279 variable.
12280 .Va content-description-smime-message
12281 will be inspected for messages which become encrypted.
12284 .It Va smime-force-encryption
12285 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
12288 .It Va smime-sign
12289 \*(BO\*(OP S/MIME sign outgoing messages with the user's
12290 .Pf ( Va from )
12291 private key and include the users certificate as a MIME attachment.
12292 Signing a message enables a recipient to verify that the sender used
12293 a valid certificate,
12294 that the email addresses in the certificate match those in the message
12295 header and that the message content has not been altered.
12296 It does not change the message text,
12297 and people will be able to read the message as usual.
12298 .Va content-description-smime-signature
12299 will be inspected.
12300 Also see
12301 .Va smime-sign-cert , smime-sign-include-certs
12303 .Va smime-sign-digest .
12305 .Mx Va smime-sign-cert
12306 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
12307 \*(OP Points to a file in PEM format.
12308 For the purpose of signing and decryption this file needs to contain the
12309 user's private key, followed by his certificate.
12311 For message signing
12312 .Ql USER@HOST
12313 is always derived from the value of
12314 .Va from
12315 (or, if that contains multiple addresses,
12316 .Va sender ) .
12317 For the purpose of encryption the recipients public encryption key
12318 (certificate) is expected; the command
12319 .Ic certsave
12320 can be used to save certificates of signed messages (the section
12321 .Sx "Signed and encrypted messages with S/MIME"
12322 gives some details).
12323 This mode of operation is usually driven by the specialized form.
12325 When decrypting messages the account is derived from the recipient
12326 fields
12327 .Pf ( Ql To:
12329 .Ql Cc: )
12330 of the message, which are searched for addresses for which such
12331 a variable is set.
12332 \*(UA always uses the first address that matches,
12333 so if the same message is sent to more than one of the user addresses
12334 using different encryption keys, decryption might fail.
12336 Password-encrypted keys may be used for signing and decryption.
12337 Automated password lookup is possible via the
12338 .Dq pseudo-hosts
12339 .Ql USER@HOST.smime-cert-key
12340 for the private key, and
12341 .Ql USER@HOST.smime-cert-cert
12342 for the certificate stored in the same file.
12343 For example, the hypothetical address
12344 .Ql bob@exam.ple
12345 could be driven with a private key / certificate pair path defined in
12346 .Va \&\&smime-sign-cert-bob@exam.ple ,
12347 and the needed passwords would then be looked up as
12348 .Ql bob@exam.ple.smime-cert-key
12350 .Ql bob@exam.ple.smime-cert-cert .
12351 When decrypting the value of
12352 .Va from
12353 will be tried as a fallback to provide the necessary
12354 .Ql USER@HOST .
12355 To include intermediate certificates, use
12356 .Va smime-sign-include-certs .
12357 The possible password sources are documented in
12358 .Sx "On URL syntax and credential lookup" .
12360 .Mx Va smime-sign-digest
12361 .It Va smime-sign-digest-USER@HOST , smime-sign-digest
12362 \*(OP Specifies the message digest to use when signing S/MIME messages.
12363 Please remember that for this use case
12364 .Ql USER@HOST
12365 refers to the variable
12366 .Va from
12367 (or, if that contains multiple addresses,
12368 .Va sender ) .
12369 The available algorithms depend on the used cryptographic library, but
12370 at least one usable built-in algorithm is ensured as a default.
12371 If possible the standard RFC 5751 will be violated by using
12372 .Ql SHA512
12373 instead of the mandated
12374 .Ql SHA1
12375 due to security concerns.
12376 This variable is ignored for very old (released before 2010)
12377 cryptographic libraries which do not offer the necessary interface:
12378 it will be logged if that happened.
12380 \*(UA will try to add built-in support for the following message
12381 digests, names are case-insensitive:
12382 .Ql BLAKE2b512 ,
12383 .Ql BLAKE2s256 ,
12384 .Ql SHA3-512 ,
12385 .Ql SHA3-384 ,
12386 .Ql SHA3-256 ,
12387 .Ql SHA3-224 ,
12388 as well as the widely available
12389 .Ql SHA512 ,
12390 .Ql SHA384 ,
12391 .Ql SHA256 ,
12392 .Ql SHA224 ,
12393 and the proposed insecure
12394 .Ql SHA1 ,
12395 finally
12396 .Ql MD5 .
12397 More digests may \*(OPally be available through dynamic loading via the
12398 OpenSSL function
12399 .Xr EVP_get_digestbyname 3 .
12401 .Mx Va smime-sign-include-certs
12402 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
12403 \*(OP If used, this is supposed to a consist of a comma-separated list
12404 of files, each of which containing a single certificate in PEM format to
12405 be included in the S/MIME message in addition to the
12406 .Va smime-sign-cert
12407 certificate.
12408 This can be used to include intermediate certificates of the certificate
12409 authority, in order to allow the receiver's S/MIME implementation to
12410 perform a verification of the entire certificate chain, starting from
12411 a local root certificate, over the intermediate certificates, down to the
12412 .Va smime-sign-cert .
12413 Even though top level certificates may also be included in the chain,
12414 they will not be used for the verification on the receiver's side.
12416 For the purpose of the mechanisms involved here,
12417 .Ql USER@HOST
12418 refers to the content of the internal variable
12419 .Va from
12420 (or, if that contains multiple addresses,
12421 .Va sender ) .
12422 The pseudo-host
12423 .Ql USER@HOST.smime-include-certs
12424 will be used for performing password lookups for these certificates,
12425 shall they have been given one, therefore the lookup can be automated
12426 via the mechanisms described in
12427 .Sx "On URL syntax and credential lookup" .
12429 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
12430 \*(OB\*(OP Predecessor(s) of
12431 .Va smime-sign-digest .
12433 .It Va smtp
12434 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
12435 .Va mta .
12436 \*(ID For compatibility reasons a set
12437 .Va smtp
12438 is used in preference of
12439 .Va mta .
12441 .Mx Va smtp-auth
12442 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
12443 \*(OP Variable chain that controls the SMTP
12444 .Va mta
12445 authentication method, possible values are
12446 .Ql none
12447 (\*(OU default),
12448 .Ql plain
12449 (\*(IN default),
12450 .Ql login ,
12451 \*(IN
12452 .Ql oauthbearer
12453 (see
12454 .Sx FAQ
12455 entry
12456 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" )
12457 as well as \*(IN
12458 .Ql external
12460 .Ql externanon
12461 for TLS secured connections which pass a client certificate via
12462 .Va tls-config-pairs .
12463 There may be the \*(OPal methods
12464 .Ql cram-md5
12466 .Ql gssapi .
12467 .Ql none
12469 .Ql externanon
12470 do not need any user credentials,
12471 .Ql external
12473 .Ql gssapi
12474 require a user name, and all other methods require a
12475 .Va user
12476 name and a
12477 .Va password .
12478 .Ql externanon
12479 solely builds upon the credentials passed via a client certificate,
12480 and is usually the way to go since tested servers do not actually follow
12481 RFC 4422 aka RFC 4954, and fail if additional credentials are passed.
12482 Also see
12483 .Va mta .
12484 Note that
12485 .Va smtp-auth-HOST
12486 is \*(IN.
12487 (\*(OU Requires
12488 .Va smtp-auth-password
12490 .Va smtp-auth-user .
12491 Note for
12492 .Va smtp-auth-USER@HOST :
12493 may override dependent on sender address in the variable
12494 .Va from . )
12496 .It Va smtp-auth-password
12497 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
12498 If the authentication method requires a password, but neither
12499 .Va smtp-auth-password
12500 nor a matching
12501 .Va smtp-auth-password-USER@HOST
12502 can be found,
12503 \*(UA will ask for a password on the user's terminal.
12505 .It Va smtp-auth-password-USER@HOST
12506 \*(OU Overrides
12507 .Va smtp-auth-password
12508 for specific values of sender addresses, dependent upon the variable
12509 .Va from .
12511 .It Va smtp-auth-user
12512 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
12513 If the authentication method requires a user name, but neither
12514 .Va smtp-auth-user
12515 nor a matching
12516 .Va smtp-auth-user-USER@HOST
12517 can be found,
12518 \*(UA will ask for a user name on the user's terminal.
12520 .It Va smtp-auth-user-USER@HOST
12521 \*(OU Overrides
12522 .Va smtp-auth-user
12523 for specific values of sender addresses, dependent upon the variable
12524 .Va from .
12527 .It Va smtp-hostname
12528 \*(OP\*(IN Normally \*(UA uses the variable
12529 .Va from
12530 to derive the necessary
12531 .Ql USER@HOST
12532 information in order to issue a
12533 .Ql MAIL FROM:<>
12534 SMTP
12535 .Va mta
12536 command.
12537 Setting
12538 .Va smtp-hostname
12539 can be used to use the
12540 .Ql USER
12541 from the SMTP account
12542 .Pf ( Va mta
12543 or the
12544 .Va user
12545 variable chain)
12546 and the given
12547 .Ql HOST
12548 .Pf ( Va hostname
12549 if the empty string is given, or the local hostname as a last resort).
12550 This often allows using an address that is itself valid but hosted by
12551 a provider other than from which (in
12552 .Va from )
12553 the message is sent.
12554 Setting this variable also influences generated
12555 .Ql Message-ID:
12557 .Ql Content-ID:
12558 header fields.
12559 If the \*(OPal IDNA support is available (see
12560 .Va idna-disable )
12561 variable assignment is aborted when a necessary conversion fails.
12563 .Mx Va smtp-use-starttls
12564 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
12565 \*(BO\*(OP Causes \*(UA to issue a
12566 .Ql STARTTLS
12567 command to make an SMTP
12568 .Va mta
12569 session TLS encrypted, i.e., to enable transport layer security.
12572 .It Va socket-connect-timeout
12573 \*(OP A positive number that defines the timeout to wait for
12574 establishing a socket connection before forcing
12575 .Va ^ERR Ns -TIMEDOUT .
12577 .Mx Va socks-proxy
12578 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
12579 \*(OP If set to the URL of a SOCKS5 server then all network activities
12580 are proxied through it, except for the single DNS name lookup necessary
12581 to resolve the proxy URL (unnecessary when given an already resolved IP
12582 address).
12583 It is automatically squared with the environment variable
12584 .Ev SOCKS5_PROXY ,
12585 changing the one will adjust the other.
12586 This example creates a local SOCKS5 proxy on port 10000 that forwards to
12587 the machine
12588 .Ql HOST
12589 (with identity
12590 .Ql USER ) ,
12591 and from which actual network traffic happens:
12592 .Bd -literal -offset indent
12593 $ ssh -D 10000 USER@HOST
12594 $ \*(uA -Ssocks-proxy=[socks5://]localhost:10000
12595 # or =localhost:10000; no local DNS: =127.0.0.1:10000
12599 .It Va spam-interface
12600 \*(OP In order to use any of the spam-related commands (like
12601 .Ic spamrate )
12602 the desired spam interface must be defined by setting this variable.
12603 Please refer to the manual section
12604 .Sx "Handling spam"
12605 for the complete picture of spam handling in \*(UA.
12606 All or none of the following interfaces may be available:
12608 .Bl -tag -width ".It Ql _ilte_"
12609 .It Ql spamc
12610 Interaction with
12611 .Xr spamc 1
12612 from the
12613 .Xr spamassassin 1
12614 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
12615 suite.
12616 Different to the generic filter interface \*(UA will automatically add
12617 the correct arguments for a given command and has the necessary
12618 knowledge to parse the program's output.
12619 A default value for
12620 .Va spamc-command
12621 will have been compiled into the \*(UA binary if
12622 .Xr spamc 1
12623 has been found in
12624 .Ev PATH
12625 during compilation.
12626 Shall it be necessary to define a specific connection type (rather than
12627 using a configuration file for that), the variable
12628 .Va spamc-arguments
12629 can be used as in for example
12630 .Ql -d server.example.com -p 783 .
12631 It is also possible to specify a per-user configuration via
12632 .Va spamc-user .
12633 Note that this interface does not inspect the
12634 .Ql is-spam
12635 flag of a message for the command
12636 .Ic spamforget .
12638 .It Ql filter
12639 generic spam filter support via freely configurable hooks.
12640 This interface is meant for programs like
12641 .Xr bogofilter 1
12642 and requires according behaviour in respect to the hooks' exit
12643 status for at least the command
12644 .Ic spamrate
12645 .Pf ( Ql 0
12646 meaning a message is spam,
12647 .Ql 1
12648 for non-spam,
12649 .Ql 2
12650 for unsure and any other return value indicating a hard error);
12651 since the hooks can include shell code snippets diverting behaviour
12652 can be intercepted as necessary.
12653 The hooks are
12654 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
12655   spamfilter-rate
12657 .Va spamfilter-spam ;
12658 the manual section
12659 .Sx "Handling spam"
12660 contains examples for some programs.
12661 The process environment of the hooks will have the variable
12662 .Ev MAILX_FILENAME_GENERATED
12663 set.
12664 Note that spam score support for
12665 .Ic spamrate
12666 is not supported unless the \*(OPtional regular expression support is
12667 available and the
12668 .Va spamfilter-rate-scanscore
12669 variable is set.
12674 .It Va spam-maxsize
12675 \*(OP Messages that exceed this size will not be passed through to the
12676 configured
12677 .Va spam-interface .
12678 If unset or 0, the default of 420000 bytes is used.
12681 .It Va spamc-command
12682 \*(OP The path to the
12683 .Xr spamc 1
12684 program for the
12685 .Ql spamc
12686 .Va spam-interface .
12687 Note that the path is not expanded, but used
12688 .Dq as is .
12689 A fallback path will have been compiled into the \*(UA binary if the
12690 executable had been found during compilation.
12693 .It Va spamc-arguments
12694 \*(OP Even though \*(UA deals with most arguments for the
12695 .Ql spamc
12696 .Va spam-interface
12697 automatically, it may at least sometimes be desirable to specify
12698 connection-related ones via this variable, for example
12699 .Ql -d server.example.com -p 783 .
12702 .It Va spamc-user
12703 \*(OP Specify a username for per-user configuration files for the
12704 .Ql spamc
12705 .Va spam-interface .
12706 If this is set to the empty string then \*(UA will use the name of the
12707 current
12708 .Va user .
12715 .It Va spamfilter-ham , spamfilter-noham , \
12716   spamfilter-nospam , spamfilter-rate , spamfilter-spam
12717 \*(OP Command and argument hooks for the
12718 .Ql filter
12719 .Va spam-interface .
12720 The manual section
12721 .Sx "Handling spam"
12722 contains examples for some programs.
12725 .It Va spamfilter-rate-scanscore
12726 \*(OP Because of the generic nature of the
12727 .Ql filter
12728 .Va spam-interface
12729 spam scores are not supported for it by default, but if the \*(OPnal
12730 regular expression support is available then setting this variable can
12731 be used to overcome this restriction.
12732 It is interpreted as follows: first a number (digits) is parsed that
12733 must be followed by a semicolon
12734 .Ql \&;
12735 and an extended regular expression.
12736 Then the latter is used to parse the first output line of the
12737 .Va spamfilter-rate
12738 hook, and, in case the evaluation is successful, the group that has been
12739 specified via the number is interpreted as a floating point scan score.
12741 .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\
12742   ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file
12743 \*(OB\*(OP Predecessors of
12744 .Va tls-ca-file ,
12745 .Va tls-ca-dir .
12747 .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags
12748 \*(OB\*(OP Predecessor of
12749 .Va tls-ca-flags .
12751 .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\
12752   ssl-ca-no-defaults
12753 \*(OB\*(BO\*(OP Predecessor of
12754 .Va tls-ca-no-defaults .
12756 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
12757 \*(OB\*(OP Please use the
12758 .Cd Certificate
12759 slot of
12760 .Va tls-config-pairs .
12762 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
12763 \*(OB\*(OP Please use the
12764 .Cd CipherString
12765 slot of
12766 .Va tls-config-pairs .
12768 .It Va ssl-config-file
12769 \*(OB\*(OP Predecessor of
12770 .Va tls-config-file .
12772 .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\
12773   ssl-config-module
12774 \*(OB\*(OP Predecessor of
12775 .Va tls-config-module .
12777 .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs
12778 \*(OB\*(OP Predecessor of
12779 .Va tls-config-pairs .
12781 .It Va ssl-crl-dir , ssl-crl-file
12782 \*(OB\*(OP Predecessors of
12783 .Va tls-crl-dir ,
12784 .Va tls-crl-file .
12786 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
12787 \*(OB\*(OP Please use the
12788 .Cd Curves
12789 slot of
12790 .Va tls-config-pairs .
12792 .It Va ssl-features
12793 \*(OB\*(OP\*(RO Predecessor of
12794 .Va tls-features .
12796 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
12797 \*(OB\*(OP Please use the
12798 .Cd PrivateKey
12799 slot of
12800 .Va tls-config-pairs .
12802 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
12803 \*(OB\*(OP Please use the
12804 .Cd Protocol
12805 slot of
12806 .Va tls-config-pairs .
12808 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
12809 \*(OB\*(OP Please use the
12810 .Cd Protocol
12811 slot of
12812 .Va tls-config-pairs .
12814 .It Va ssl-rand-file
12815 \*(OB\*(OP Predecessor of
12816 .Va tls-rand-file .
12818 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
12819 \*(OB\*(OP Predecessor of
12820 .Va tls-verify .
12823 .It Va stealthmua
12824 If only set without an assigned value, then this setting inhibits the
12825 generation of the
12826 .Ql Message-ID: ,
12827 .Ql Content-ID:
12829 .Ql User-Agent:
12830 header fields that include obvious references to \*(UA.
12831 There are two pitfalls associated with this:
12832 First, the message id of outgoing messages is not known anymore.
12833 Second, an expert may still use the remaining information in the header
12834 to track down the originating mail user agent.
12835 If set to the value
12836 .Ql noagent ,
12837 then the mentioned
12838 .Ql Message-ID:
12840 .Ql Content-ID:
12841 suppression does not occur.
12844 .It Va system-mailrc
12845 \*(RO The compiled in path of the system wide initialization file
12846 one of the
12847 .Sx "Resource files" :
12848 .Pa \*(UR .
12852 .It Va termcap
12853 (\*(OP) This specifies a comma-separated list of
12854 .Lb libterminfo
12855 and/or
12856 .Lb libtermcap
12857 capabilities (see
12858 .Sx "On terminal control and line editor" ,
12859 escape commas with reverse solidus
12860 .Ql \e )
12861 to be used to overwrite or define entries.
12862 .Sy Note
12863 this variable will only be queried once at program startup and can
12864 thus only be specified in resource files or on the command line.
12865 It will always be inspected, regardless of whether
12866 .Va features
12867 denotes termcap/terminfo library support via
12868 .Ql ,+termcap, .
12871 String capabilities form
12872 .Ql cap=value
12873 pairs and are expected unless noted otherwise.
12874 Numerics have to be notated as
12875 .Ql cap#number
12876 where the number is expected in normal decimal notation.
12877 Finally, booleans do not have any value but indicate a true or false
12878 state simply by being defined or not; this indeed means that \*(UA
12879 does not support undefining an existing boolean.
12880 String capability values will undergo some expansions before use:
12881 for one notations like
12882 .Ql ^LETTER
12883 stand for
12884 .Ql control-LETTER ,
12885 and for clarification purposes
12886 .Ql \eE
12887 can be used to specify
12888 .Ql escape
12889 (the control notation
12890 .Ql ^[
12891 could lead to misreadings when a left bracket follows, which it does for
12892 the standard CSI sequence);
12893 finally three letter octal sequences, as in
12894 .Ql \e061 ,
12895 are supported.
12896 To specify that a terminal supports 256-colours, and to define sequences
12897 that home the cursor and produce an audible bell, one might write:
12899 .Bd -literal -offset indent
12900 ? set termcap='Co#256,home=\eE[H,bel=^G'
12904 The following terminal capabilities are or may be meaningful for the
12905 operation of the built-in line editor or \*(UA in general:
12908 .Bl -tag -compact -width ".It Cd yay"
12909 .It Cd am
12910 .Cd auto_right_margin :
12911 boolean which indicates if the right margin needs special treatment; the
12912 .Cd xenl
12913 capability is related, for more see
12914 .Ev COLUMNS .
12915 This capability is only used when backed by library support.
12917 .It Cd clear Ns \0or Cd cl
12918 .Cd clear_screen :
12919 clear the screen and home cursor.
12920 (Will be simulated via
12921 .Cd ho
12922 plus
12923 .Cd cd . )
12925 .\" mx_HAVE_COLOUR
12926 .It Cd colors Ns \0or Cd Co
12927 .Cd max_colors :
12928 numeric capability specifying the maximum number of colours.
12929 Note that \*(UA does not actually care about the terminal beside that,
12930 but always emits ANSI / ISO 6429 escape sequences; also see
12931 .Ic colour .
12933 .It Cd cr
12934 .Cd carriage_return :
12935 move to the first column in the current row.
12936 The default built-in fallback is
12937 .Ql \er .
12939 .It Cd cub1 Ns \0or Cd le
12940 .Cd cursor_left :
12941 move the cursor left one space (non-destructively).
12942 The default built-in fallback is
12943 .Ql \eb .
12945 .It Cd cuf1 Ns \0or Cd nd
12946 .Cd cursor_right :
12947 move the cursor right one space (non-destructively).
12948 The default built-in fallback is
12949 .Ql \eE[C ,
12950 which is used by most terminals.
12951 Less often occur
12952 .Ql \eEC
12954 .Ql \eEOC .
12956 .It Cd ed Ns \0or Cd cd
12957 .Cd clr_eos :
12958 clear the screen.
12960 .\" mx_HAVE_MLE
12961 .It Cd el Ns \0or Cd ce
12962 .Cd clr_eol :
12963 clear to the end of line.
12964 (Will be simulated via
12965 .Cd ch
12966 plus repetitions of space characters.)
12968 .It Cd home Ns \0or Cd ho
12969 .Cd cursor_home :
12970 home cursor.
12972 .It Cd hpa Ns \0or Cd ch
12973 .Cd column_address :
12974 move the cursor (to the given column parameter) in the current row.
12975 (Will be simulated via
12976 .Cd cr
12977 plus
12978 .Cd nd . )
12980 .\" mx_HAVE_TERMCAP
12981 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
12982 .Cd exit_ca_mode
12984 .Cd enter_ca_mode ,
12985 respectively: exit and enter the alternative screen ca-mode,
12986 effectively turning \*(UA into a fullscreen application.
12987 This must be enabled explicitly by setting
12988 .Va termcap-ca-mode .
12990 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
12991 .Cd keypad_xmit
12993 .Cd keypad_local ,
12994 respectively: enable and disable the keypad.
12995 This is always enabled if available, because it seems even keyboards
12996 without keypads generate other key codes for, e.g., cursor keys in that
12997 case, and only if enabled we see the codes that we are interested in.
12999 .It Cd xenl Ns \0or Cd xn
13000 .Cd eat_newline_glitch :
13001 boolean which indicates whether a newline written in the last column of an
13002 .Cd auto_right_margin
13003 indicating terminal is ignored.
13004 With it the full terminal width is available even on autowrap terminals.
13005 This will be inspected even without
13006 .Ql ,+termcap,
13007 .Va features .
13011 Many more capabilities which describe key-sequences are documented for
13012 .Ic bind .
13016 .It Va termcap-ca-mode
13017 \*(OP Allow usage of the
13018 .Cd exit_ca_mode
13020 .Cd enter_ca_mode
13021 .Va termcap Ns
13022 abilities in order to enter an alternative exclusive screen, the
13023 so-called ca-mode; this usually requires special configuration of the
13024 .Ev PAGER ,
13025 also dependent on the value of
13026 .Va crt .
13027 .Sy Note
13028 this variable will only be queried once at program startup and can
13029 thus only be specified in resource files or on the command line.
13032 .It Va termcap-disable
13033 \*(OP Disable any interaction with a terminal control library.
13034 If set only some generic fallback built-ins and possibly the content of
13035 .Va termcap
13036 describe the terminal to \*(UA.
13037 .Sy Note
13038 this variable will only be queried once at program startup and can
13039 thus only be specified in resource files or on the command line.
13041 .Mx Va tls-ca-file
13042 .Mx Va tls-ca-dir
13043 .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\
13044   tls-ca-file-USER@HOST , tls-ca-file-HOST , tls-ca-file
13045 \*(OP Directory and file, respectively, for pools of trusted CA
13046 certificates in PEM (Privacy Enhanced Mail) format, for the purpose of
13047 verification of TLS server certificates.
13048 Concurrent use is possible, the file is loaded once needed first, the
13049 directory lookup is performed anew as a last resort whenever necessary.
13050 The CA certificate pool built into the TLS library can be disabled via
13051 .Va tls-ca-no-defaults ,
13052 further fine-tuning is possible via
13053 .Va tls-ca-flags .
13054 The directory search requires special filename conventions, please see
13055 .Xr SSL_CTX_load_verify_locations 3
13057 .Xr verify 1
13059 .Xr c_rehash 1 ) .
13062 .Mx Va tls-ca-flags
13063 .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags
13064 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
13065 storage, and the certificate verification that is used (also see
13066 .Va tls-verify ) .
13067 The value is expected to consist of a comma-separated list of
13068 configuration directives, with any intervening whitespace being ignored.
13069 The directives directly map to flags that can be passed to
13070 .Xr X509_STORE_set_flags 3 ,
13071 which are usually defined in a file
13072 .Pa openssl/x509_vfy.h ,
13073 and the availability of which depends on the used TLS library
13074 version: a directive without mapping is ignored (error log subject to
13075 .Va debug ) .
13076 Directives currently understood (case-insensitively) include:
13079 .Bl -tag -compact -width ".It Cd BaNg"
13080 .It Cd no-alt-chains
13081 If the initial chain is not trusted, do not attempt to build an
13082 alternative chain.
13083 Setting this flag will make OpenSSL certificate verification match that
13084 of older OpenSSL versions, before automatic building and checking of
13085 alternative chains has been implemented; also see
13086 .Cd trusted-first .
13087 .It Cd no-check-time
13088 Do not check certificate/CRL validity against current time.
13089 .It Cd partial-chain
13090 By default partial, incomplete chains which cannot be verified up to the
13091 chain top, a self-signed root certificate, will not verify.
13092 With this flag set, a chain succeeds to verify if at least one signing
13093 certificate of the chain is in any of the configured trusted stores of
13094 CA certificates.
13095 The OpenSSL manual page
13096 .Xr SSL_CTX_load_verify_locations 3
13097 gives some advise how to manage your own trusted store of CA certificates.
13098 .It Cd strict
13099 Disable workarounds for broken certificates.
13100 .It Cd trusted-first
13101 Try building a chain using issuers in the trusted store first to avoid
13102 problems with server-sent legacy intermediate certificates.
13103 Newer versions of OpenSSL support alternative chain checking and enable
13104 it by default, resulting in the same behaviour; also see
13105 .Cd no-alt-chains .
13109 .Mx Va tls-ca-no-defaults
13110 .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\
13111   tls-ca-no-defaults
13112 \*(BO\*(OP Do not load the default CA locations that are built into the
13113 used to TLS library to verify TLS server certificates.
13116 .It Va tls-config-file
13117 \*(OP If this variable is set
13118 .Xr CONF_modules_load_file 3
13119 (if announced via
13120 .Ql ,+modules-load-file,
13122 .Va tls-features )
13123 is used to allow resource file based configuration of the TLS library.
13124 This happens once the library is used first, which may also be early
13125 during startup (logged with
13126 .Va verbose ) !
13127 If a non-empty value is given then the given file, after performing
13128 .Sx "Filename transformations" ,
13129 will be used instead of the TLS libraries global default, and it is an
13130 error if the file cannot be loaded.
13131 The application name will always be passed as
13132 .Ql \*(uA .
13133 Some TLS libraries support application-specific configuration via
13134 resource files loaded like this, please see
13135 .Va tls-config-module .
13137 .Mx Va tls-config-module
13138 .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\
13139   tls-config-module
13140 \*(OP If file based application-specific configuration via
13141 .Va tls-config-file
13142 is available, announced as
13143 .Ql ,+ctx-config,
13145 .Va tls-features ,
13146 indicating availability of
13147 .Xr SSL_CTX_config 3 ,
13148 then, it becomes possible to use a central TLS configuration file
13149 for all programs, including \*(uA, for example
13150 .Bd -literal -offset indent
13151 # Register a configuration section for \*(uA
13152 \*(uA = mailx_master
13153 # The top configuration section creates a relation
13154 # in between dynamic SSL configuration and an actual
13155 # program specific configuration section
13156 [mailx_master]
13157 ssl_conf = mailx_tls_config
13158 # And that program specific configuration section now
13159 # can map diverse tls-config-module names to sections,
13160 # as in: tls-config-module=account_xy
13161 [mailx_tls_config]
13162 account_xy = mailx_account_xy
13163 account_yz = mailx_account_yz
13164 [mailx_account_xy]
13165 MinProtocol = TLSv1.2
13166 Curves=P-521
13167 [mailx_account_yz]
13168 CipherString = TLSv1.2:!aNULL:!eNULL:
13169 MinProtocol = TLSv1.1
13170 Options = Bugs
13174 .Mx Va tls-config-pairs
13175 .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs
13176 \*(OP The value of this variable chain will be interpreted as
13177 a comma-separated list of directive/value pairs.
13178 Directives and values need to be separated by equals signs
13179 .Ql = ,
13180 any whitespace surrounding pair members is removed.
13181 Keys are (usually) case-insensitive.
13182 Different to when placing these pairs in a
13183 .Va tls-config-module
13184 section of a
13185 .Va tls-config-file ,
13186 commas
13187 .Ql \&,
13188 need to be escaped with a reverse solidus
13189 .Ql \e
13190 when included in pairs; also different: if the equals sign
13191 .Ql =
13192 is preceded with an asterisk
13193 .Ql *
13194 .Sx "Filename transformations"
13195 will be performed on the value; it is an error if these fail.
13196 Unless proper support is announced by
13197 .Va tls-features
13198 .Pf ( Ql ,+conf-ctx, )
13199 only the keys below are supported, otherwise the pairs will be used
13200 directly as arguments to the function
13201 .Xr SSL_CONF_cmd 3 .
13204 .Bl -tag -compact -width ".It Cd C_rtificate_"
13205 .It Cd Certificate
13206 Filename of a TLS client certificate (chain) required by some servers.
13207 Fallback support via
13208 .Xr SSL_CTX_use_certificate_chain_file 3 .
13209 .Sx "Filename transformations"
13210 are performed.
13211 .Cd PrivateKey
13212 will be set to the same value if not initialized explicitly.
13213 Some services support so-called
13214 .Ql external
13215 authentication if a TLS client certificate was successfully presented
13216 during connection establishment
13217 .Pf ( Dq connecting is authenticating ) .
13219 .It Cd CipherString
13220 A list of ciphers for TLS connections, see
13221 .Xr ciphers 1 .
13222 By default no list of ciphers is set, resulting in a
13223 .Cd Protocol Ns - Ns
13224 specific list of ciphers (the protocol standards define lists of
13225 acceptable ciphers; possibly cramped by the used TLS library).
13226 Fallback support via
13227 .Xr SSL_CTX_set_cipher_list 3 .
13229 .It Cd Ciphersuites
13230 A list of ciphers used for TLSv1.3 connections, see
13231 .Xr ciphers 1 .
13232 These will be joined onto the list of ciphers from
13233 .Cd CipherString .
13234 Available if
13235 .Va tls-features
13236 announces
13237 .Ql ,+ctx-set-ciphersuites, ,
13238 as necessary via
13239 .Xr SSL_CTX_set_ciphersuites 3 .
13241 .It Cd Curves
13242 A list of supported elliptic curves, if applicable.
13243 By default no curves are set.
13244 Fallback support via
13245 .Xr SSL_CTX_set1_curves_list 3 ,
13246 if available.
13248 .It Cd MaxProtocol , MinProtocol
13249 The maximum and minimum supported TLS versions, respectively.
13250 Available if
13251 .Va tls-features
13252 announces
13253 .Ql ,+ctx-set-maxmin-proto, ,
13254 as necessary via
13255 .Xr SSL_CTX_set_max_proto_version 3
13257 .Xr SSL_CTX_set_min_proto_version 3 ;
13258 these fallbacks use an internal parser which understands the strings
13259 .Ql SSLv3 ,
13260 .Ql TLSv1 ,
13261 .Ql TLSv1.1 ,
13262 .Ql TLSv1.2 ,
13263 .Ql TLSv1.3 ,
13264 and the special value
13265 .Ql None ,
13266 which disables the given limit.
13268 .It Cd Options
13269 Various flags to set.
13270 Fallback via
13271 .Xr SSL_CTX_set_options 3 ,
13272 in which case any other value but (exactly)
13273 .Ql Bugs
13274 results in an error.
13276 .It Cd PrivateKey
13277 Filename of the private key in PEM format of a TLS client certificate.
13278 If unset, the value of
13279 .Cd Certificate
13280 is used.
13281 .Sx "Filename transformations"
13282 are performed.
13283 Fallback via
13284 .Xr SSL_CTX_use_PrivateKey_file 3 .
13286 .It Cd Protocol
13287 The used TLS protocol.
13289 .Va tls-features
13290 announces
13291 .Ql ,+conf-ctx,
13293 .Ql ctx-set-maxmin-proto
13294 then using
13295 .Cd MaxProtocol
13297 .Cd MinProtocol
13298 is preferable.
13299 Fallback is
13300 .Xr SSL_CTX_set_options 3 ,
13301 driven via an internal parser which understands the strings
13302 .Ql SSLv3 ,
13303 .Ql TLSv1 ,
13304 .Ql TLSv1.1 ,
13305 .Ql TLSv1.2 ,
13306 .Ql TLSv1.3 ,
13307 and the special value
13308 .Ql ALL .
13309 Multiple protocols may be given as a comma-separated list, any
13310 whitespace is ignored, an optional plus sign
13311 .Ql +
13312 prefix enables, a hyphen-minus
13313 .Ql -
13314 prefix disables a protocol, so that
13315 .Ql -ALL, TLSv1.2
13316 enables only the TLSv1.2 protocol.
13322 .It Va tls-crl-dir , tls-crl-file
13323 \*(OP Specify a directory / a file, respectively, that contains a CRL in
13324 PEM format to use when verifying TLS server certificates.
13327 .It Va tls-features
13328 \*(OP\*(RO This expands to a comma-separated list of the TLS library
13329 identity and optional features.
13330 To ease substring matching the string starts and ends with a comma.
13331 Currently supported identities are
13332 .Ql libressl
13333 (LibreSSL) ,
13334 .Ql libssl-0x30000
13335 (OpenSSL v3.0.0 series),
13336 .Ql libssl-0x10100
13337 (OpenSSL v1.1.x series)
13339 .Ql libssl-0x10000
13340 (elder OpenSSL series, other clones).
13341 Optional features are preceded with a plus sign
13342 .Ql +
13343 when available, and with a hyphen-minus
13344 .Ql -
13345 otherwise.
13347 Currently known features are
13348 .Ql conf-ctx
13349 .Pf ( Va tls-config-pairs ) ,
13350 .Ql ctx-config
13351 .Pf ( Va tls-config-module ) ,
13352 .Ql ctx-set-ciphersuites
13353 .Pf ( Cd Ciphersuites
13354 slot of
13355 .Va tls-config-pairs ) ,
13356 .Ql ctx-set-maxmin-proto
13357 .Pf ( Va tls-config-pairs ) ,
13358 .Ql modules-load-file
13359 .Pf ( Va tls-config-file ) ,
13361 .Ql tls-rand-file
13362 .Pf ( Va tls-rand-file ) .
13364 .Mx Va tls-fingerprint
13365 .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint
13366 \*(OP It is possible to replace the verification of the connection
13367 peer certificate against the entire local pool of CAs (for more see
13368 .Sx "Encrypted network communication" )
13369 with the comparison against a precalculated certificate message digest,
13370 the so-called fingerprint, to be specified as the used
13371 .Va tls-fingerprint-digest .
13372 This fingerprint can for example be calculated with
13373 .Ql Ic tls Ns \:\0\:fingerprint HOST .
13375 .Mx Va tls-fingerprint-digest
13376 .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \
13377   tls-fingerprint-digest
13378 \*(OP The message digest to be used when creating TLS certificate
13379 fingerprints, the defaults, if available, in test order, being
13380 .Ql BLAKE2s256 ,
13381 .Ql SHA256 .
13382 For the complete list of digest algorithms refer to
13383 .Va smime-sign-digest .
13386 .It Va tls-rand-file
13387 \*(OP If
13388 .Va tls-features
13389 announces
13390 .Ql ,+tls-rand-file,
13391 then this will be queried to find a file with random entropy data which
13392 can be used to seed the P(seudo)R(andom)N(umber)G(enerator), see
13393 .Xr RAND_load_file 3 .
13394 The default filename
13395 .Pf ( Xr RAND_file_name 3 ,
13396 normally
13397 .Pa ~/.rnd )
13398 will be used if this variable is not set or empty, or if the
13399 .Sx "Filename transformations"
13400 fail.
13401 Shall seeding the PRNG have been successful,
13402 .Xr RAND_write_file 3
13403 will be called to update the entropy.
13404 Remarks: libraries which do not announce this feature seed the PRNG by
13405 other means.
13407 .Mx Va tls-verify
13408 .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify
13409 \*(OP Variable chain that sets the action to be performed if an error
13410 occurs during TLS server certificate validation against the
13411 specified or default trust stores
13412 .Va tls-ca-dir ,
13413 .Va tls-ca-file ,
13414 or the TLS library built-in defaults (unless usage disallowed via
13415 .Va tls-ca-no-defaults ) ,
13416 and as fine-tuned via
13417 .Va tls-ca-flags .
13418 Valid (case-insensitive) values are
13419 .Ql strict
13420 (fail and close connection immediately),
13421 .Ql ask
13422 (ask whether to continue on standard input),
13423 .Ql warn
13424 (show a warning and continue),
13425 .Ql ignore
13426 (do not perform validation).
13427 The default is
13428 .Ql ask .
13430 .It Va toplines
13431 If defined, gives the number of lines of a message to be displayed
13432 with the command
13433 .Ic top ;
13434 if unset, the first five lines are printed, if set to 0 the variable
13435 .Va screen
13436 is inspected.
13437 If the value is negative then its absolute value will be used for
13438 unsigned right shifting (see
13439 .Ic vexpr )
13441 .Va screen
13442 height.
13445 .It Va topsqueeze
13446 \*(BO If set then the
13447 .Ic top
13448 command series will strip adjacent empty lines and quotations.
13451 .It Va ttycharset
13452 The character set of the terminal \*(UA operates on,
13453 and the one and only supported character set that \*(UA can use if no
13454 character set conversion capabilities have been compiled into it,
13455 in which case it defaults to ISO-8859-1.
13456 Otherwise it defaults to UTF-8.
13457 Sufficient locale support provided the default will be preferably
13458 deduced from the locale environment if that is set (for example
13459 .Ev LC_CTYPE ,
13460 see there for more); runtime locale changes will be reflected by
13461 .Va \&\&ttycharset
13462 except during the program startup phase and if
13463 .Fl S
13464 had been used to freeze the given value.
13465 Refer to the section
13466 .Sx "Character sets"
13467 for the complete picture about character sets.
13470 .It Va typescript-mode
13471 \*(BO A special multiplex variable that disables all variables and
13472 settings which result in behaviour that interferes with running \*(UA in
13473 .Xr script 1 ;
13474 it sets
13475 .Va colour-disable ,
13476 .Va line-editor-disable
13477 and (before startup completed only)
13478 .Va termcap-disable .
13479 Unsetting it does not restore the former state of the covered settings.
13482 .It Va umask
13483 For a safe-by-default policy the process file mode creation mask
13484 .Xr umask 2
13485 will be set to
13486 .Ql 0077
13487 on program startup after the resource files have been loaded,
13488 and unless this variable is set.
13489 By assigning this an empty value the active setting will not be changed,
13490 otherwise the given value will be made the new file mode creation mask.
13491 Child processes inherit the file mode creation mask of their parent.
13493 .Mx Va user
13494 .It Va user-HOST , user
13495 \*(IN Variable chain that sets a global fallback user name, used in case
13496 none has been given in the protocol and account-specific URL.
13497 This variable defaults to the name of the user who runs \*(UA.
13500 .It Va v15-compat
13501 Enable upward compatibility with \*(UA version 15.0 in respect to which
13502 configuration options are available and how they are handled.
13503 If set to a non-empty value the command modifier
13504 .Cm wysh
13505 is implied and thus enforces
13506 .Sx "Shell-style argument quoting"
13507 over
13508 .Sx "Old-style argument quoting"
13509 for all commands which support both.
13510 This manual uses \*(IN and \*(OU to refer to the new and the old way of
13511 doing things, respectively.
13514 .It Va verbose
13515 Verbose mode enables logging of informational context messages.
13516 Historically a \*(BO variable, this can either be set multiple times
13517 (what the command line option
13518 .Fl v
13519 uses), or be assigned a numeric value in order to increase verbosity.
13520 Assigning the value 0 disables verbosity and thus (almost) equals
13521 .Ic unset .
13522 The maximum number is 3.
13523 Also see
13524 .Va debug .
13532 .It Va version , version-date , \
13533   version-hexnum , version-major , version-minor , version-update
13534 \*(RO \*(UA version information: the first variable is a string with
13535 the complete version identification, the second the release date in ISO
13536 8601 notation without time.
13537 The third is a 32-bit hexadecimal number with the upper 8 bits storing
13538 the major, followed by the minor and update version numbers which occupy
13539 12 bits each.
13540 The latter three variables contain only decimal digits: the major, minor
13541 and update version numbers.
13542 The output of the command
13543 .Ic version
13544 will include this information.
13547 .It Va writebackedited
13548 If this variable is set messages modified using the
13549 .Ic edit
13551 .Ic visual
13552 commands are written back to the current folder when it is quit;
13553 it is only honoured for writable folders in MBOX format, though.
13554 Note that the editor will be pointed to the raw message content in that
13555 case, i.e., neither MIME decoding nor decryption will have been
13556 performed, and proper
13557 .Va mbox-rfc4155
13558 .Ql From_
13559 quoting of newly added or edited content is also left as an exercise
13560 to the user.
13562 .\" }}} (Variables)
13564 .\" }}} (INTERNAL VARIABLES)
13567 .\" .Sh ENVIRONMENT {{{
13568 .Sh ENVIRONMENT
13570 The term
13571 .Dq environment variable
13572 should be considered an indication that these variables are either
13573 standardized as vivid parts of process environments, or that they are
13574 commonly found in there.
13575 The process environment is inherited from the
13576 .Xr sh 1
13577 once \*(UA is started, and unless otherwise explicitly noted handling of
13578 the following variables transparently integrates into that of the
13579 .Sx "INTERNAL VARIABLES"
13580 from \*(UA's point of view.
13581 This means they can be managed via
13582 .Ic set
13584 .Ic unset ,
13585 causing automatic program environment updates (to be inherited by
13586 newly created child processes).
13589 In order to integrate other environment variables equally they need to
13590 be imported (linked) with the command
13591 .Ic environ .
13592 This command can also be used to set and unset non-integrated
13593 environment variables from scratch, sufficient system support provided.
13594 The following example, applicable to a POSIX shell, sets the
13595 .Ev COLUMNS
13596 environment variable for \*(UA only, and beforehand exports the
13597 .Ev EDITOR
13598 in order to affect any further processing in the running shell:
13600 .Bd -literal -offset indent
13601 $ EDITOR="vim -u ${HOME}/.vimrc"
13602 $ export EDITOR
13603 $ COLUMNS=80 \*(uA -R
13606 .Bl -tag -width ".It Ev BaNg"
13608 .It Ev COLUMNS
13609 The user's preferred width in column positions for the terminal screen.
13610 Queried and used once on program startup in interactive or batch
13611 .Pf ( Fl \&# )
13612 mode, actively managed for child processes and the MLE (see
13613 .Sx "On terminal control and line editor" )
13614 in interactive mode thereafter.
13615 Non-interactive mode always uses, and the fallback default is
13616 a compile-time constant, by default 80 columns.
13617 If in batch mode
13618 .Ev \&\&COLUMNS
13620 .Ev LINES
13621 are both set but not both are usable (empty, not a number, or 0) at
13622 program startup, then the real terminal screen size will be (tried to
13623 be) determined once.
13624 (Normally the
13625 .Xr sh 1
13626 manages these variables, and unsets them for pipe specifications etc.)
13629 .It Ev DEAD
13630 The name of the (mailbox)
13631 .Ic folder
13632 to use for saving aborted messages if
13633 .Va save
13634 is set; this defaults to
13635 .Pa \*(VD .
13636 If the variable
13637 .Va debug
13638 is set no output will be generated, otherwise the contents of the file
13639 will be replaced.
13640 Except shell globs
13641 .Sx "Filename transformations"
13642 (also see
13643 .Ic folder )
13644 will be performed.
13647 .It Ev EDITOR
13648 Pathname of the text editor to use for the
13649 .Ic edit
13650 command and
13651 .Ic ~e
13652 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
13653 .Ev VISUAL
13654 is used for a more display oriented editor.
13657 .It Ev HOME
13658 The user's home directory.
13659 This variable is only used when it resides in the process environment.
13660 The calling user's home directory will be used instead if this directory
13661 does not exist, is not accessible or cannot be read;
13662 it will always be used for the root user.
13663 (No test for being writable is performed to allow usage by
13664 non-privileged users within read-only jails, but dependent on settings
13665 this directory is a default write target for, for example,
13666 .Ev DEAD ,
13667 .Ev MBOX
13668 and more.)
13673 .It Ev LC_ALL , LC_CTYPE , LANG
13674 \*(OP The (names in lookup order of the)
13675 .Xr locale 7
13676 (and / or see
13677 .Xr setlocale 3 )
13678 which indicates the used
13679 .Sx "Character sets" .
13680 Runtime changes trigger automatic updates of the entire locale system,
13681 which includes updating
13682 .Va ttycharset
13683 (except during startup if the variable has been frozen via
13684 .Fl S ) .
13687 .It Ev LINES
13688 The user's preferred number of lines for the terminal screen.
13689 The behaviour is as described for
13690 .Ev COLUMNS ,
13691 yet the compile-time constant used in non-interactive mode and as
13692 a fallback defaults to 24 (lines).
13695 .It Ev LISTER
13696 Pathname of the directory lister to use in the
13697 .Ic folders
13698 command when operating on local mailboxes.
13699 Default is
13700 .Xr ls 1
13701 (path search through
13702 .Ev SHELL ) .
13705 .It Ev LOGNAME
13706 Upon startup \*(UA will actively ensure that this variable refers to the
13707 name of the user who runs \*(UA, in order to be able to pass a verified
13708 name to any newly created child process.
13711 .It Ev MAIL
13712 Is used as the user's
13713 .Mx -sx
13714 .Sx "primary system mailbox"
13715 unless
13716 .Va inbox
13717 is set.
13718 If the environmental fallback is also not set, a built-in compile-time
13719 default is used.
13720 This is assumed to be an absolute pathname.
13723 .It Ev MAILCAPS
13724 \*(OP Override the default path search of
13725 .Sx "The Mailcap files" :
13726 any existing file therein will be loaded in sequence, appending any
13727 content to the list of MIME type handler directives.
13728 The RFC 1524 standard imposed default value is assigned otherwise:
13729 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
13730 (The default value is a compile-time \*(OP.)
13733 .It Ev MAILRC
13734 Is used as a startup file instead of
13735 .Pa \*(ur
13736 if set.
13737 In order to avoid side-effects from configuration files scripts should
13738 either set this variable to
13739 .Pa /dev/null
13740 or the
13741 .Fl \&:
13742 command line option should be used.
13745 .It Ev MAILX_NO_SYSTEM_RC
13746 If this variable is set then reading of
13747 .Pa \*(UR
13748 (aka\&
13749 .Va system-mailrc )
13750 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
13751 had been started up with the option
13752 .Fl \&:
13753 (and according argument) or
13754 .Fl n .
13755 This variable is only used when it resides in the process environment.
13758 .It Ev MBOX
13759 The name of the user's
13760 .Mx -sx
13761 .Sx "secondary mailbox"
13762 file.
13763 A logical subset of the special
13764 .Sx "Filename transformations"
13765 (also see
13766 .Ic folder )
13767 are supported.
13768 The default is
13769 .Pa \*(VM .
13770 Traditionally this MBOX is used as the file to save messages from the
13771 .Mx -sx
13772 .Sx "primary system mailbox"
13773 that have been read.
13774 Also see
13775 .Sx "Message states" .
13778 .It Ev NETRC
13779 \*(IN\*(OP This variable overrides the default location of the user's
13780 .Pa \*(VN
13781 file.
13784 .It Ev PAGER
13785 Pathname of the program to use for backing the command
13786 .Ic more ,
13787 and when the
13788 .Va crt
13789 variable enforces usage of a pager for output.
13790 The default paginator is
13791 .Xr more 1
13792 (path search through
13793 .Ev SHELL ) .
13795 \*(UA inspects the contents of this variable: if its contains the string
13796 .Dq less
13797 then a non-existing environment variable
13798 .Ev LESS
13799 will be set to (the portable)
13800 .Ql RI ,
13801 likewise for
13802 .Dq lv
13803 .Ev LV
13804 will optionally be set to
13805 .Ql -c .
13806 Also see
13807 .Va colour-pager .
13810 .It Ev PATH
13811 A colon-separated list of directories that is searched by the shell when
13812 looking for commands, for example
13813 .Ql /bin:/usr/bin:/usr/local/bin .
13816 .It Ev POSIXLY_CORRECT
13817 This environment entry is automatically squared with
13818 .Va posix .
13821 .It Ev SHELL
13822 The shell to use for the commands
13823 .Ic \&! ,
13824 .Ic shell ,
13826 .Ic ~!
13827 .Sx "COMMAND ESCAPES"
13828 and when starting subprocesses.
13829 A default shell is used if this environment variable is not defined.
13832 .It Ev SOCKS5_PROXY
13833 This environment entry is automatically squared with
13834 .Va socks-proxy .
13837 .It Ev SOURCE_DATE_EPOCH
13838 Specifies a time in seconds since the Unix epoch (1970-01-01) to be
13839 used in place of the current time.
13840 This variable is looked up upon program startup, and its existence will
13841 switch \*(UA to a reproducible mode
13842 .Pf ( Lk https://reproducible-builds.org )
13843 which uses deterministic random numbers, a special fixated pseudo
13844 .Ev LOGNAME
13845 and more.
13846 This operation mode is used for development and by software packagers.
13847 \*(ID Currently an invalid setting is only ignored, rather than causing
13848 a program abortion.
13850 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
13853 .It Ev TERM
13854 \*(OP The terminal type for which output is to be prepared.
13855 For extended colour and font control please refer to
13856 .Sx "Coloured display" ,
13857 and for terminal management in general to
13858 .Sx "On terminal control and line editor" .
13861 .It Ev TMPDIR
13862 Except for the root user this variable defines the directory for
13863 temporary files to be used instead of
13864 .Pa \*(VT
13865 (or the given compile-time constant) if set, existent, accessible as
13866 well as read- and writable.
13867 This variable is only used when it resides in the process environment,
13868 but \*(UA will ensure at startup that this environment variable is
13869 updated to contain a usable temporary directory.
13872 .It Ev USER
13873 Identical to
13874 .Ev LOGNAME
13875 (see there), but this variable is not standardized, should therefore not
13876 be used, and is only corrected if already set.
13879 .It Ev VISUAL
13880 Pathname of the text editor to use for the
13881 .Ic visual
13882 command and
13883 .Ic ~v
13884 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
13885 .Ev EDITOR
13886 is used for a less display oriented editor.
13889 .\" }}}
13892 .\" .Sh FILES {{{
13893 .Sh FILES
13895 .\" file list {{{
13896 .Bl -tag -width ".It Pa BaNg"
13899 .It Pa ~/.mailcap , /etc/mailcap
13900 \*(OP Personal and system-wide MIME type handler definition files, see
13901 .Sx "The Mailcap files" .
13902 (The shown names are part of the RFC 1524 standard search path
13903 .Ev MAILCAPS . )
13905 .It Pa \*(ur , \*(UR
13906 User-specific and system-wide files giving initial commands, the
13907 .Sx "Resource files" .
13908 (The used filenames come from
13909 .Va MAILRC
13911 .Va system-mailrc ,
13912 respectively.)
13915 .It Pa \*(VM
13916 The default value for
13917 .Ev MBOX .
13921 .It Pa \*(vU , \*(vS
13922 Personal and system-wide MIME types, see
13923 .Sx "The mime.types files" .
13926 .It Pa \*(VN
13927 \*(IN\*(OP The default location of the user's
13928 .Pa .netrc
13929 file \(en the section
13930 .Sx "The .netrc file"
13931 documents the file format.
13932 The used path can be set via
13933 .Ev NETRC .
13936 .It Pa /dev/null
13937 The data sink
13938 .Xr null 4 .
13941 .It Pa ~/.rnd
13942 \*(OP Possible location for persistent random entropy seed storage, see
13943 .Va tls-rand-file .
13945 .\" }}}
13947 .\" .Ss "Resource files" {{{
13948 .Ss "Resource files"
13950 Upon startup \*(UA reads in several resource files, in order:
13952 .Bl -tag -width ".It Pa BaNg"
13954 .It Pa \*(UR
13955 System wide initialization file
13956 .Pf ( Va system-mailrc ) .
13957 Reading of this file can be suppressed, either by using the
13958 .Fl \&:
13959 (and according argument) or
13960 .Fl n
13961 command line options, or by setting the
13962 .Sx ENVIRONMENT
13963 variable
13964 .Ev MAILX_NO_SYSTEM_RC .
13967 .It Pa \*(ur
13968 File giving initial commands.
13969 A different file can be chosen by setting the
13970 .Sx ENVIRONMENT
13971 variable
13972 .Ev MAILRC .
13973 Reading of this file can be suppressed with the
13974 .Fl \&:
13975 command line option.
13977 .It Va mailx-extra-rc
13978 Defines a startup file to be read after all other resource files.
13979 It can be used to specify settings that are not understood by other
13980 .Xr mailx 1
13981 implementations, for example.
13985 The content of these files is interpreted as follows:
13988 .Bl -bullet -compact
13990 The whitespace characters space, tabulator and newline,
13991 as well as those defined by the variable
13992 .Va ifs ,
13993 are removed from the beginning and end of input lines.
13995 Empty lines are ignored.
13997 Any other line is interpreted as a command.
13998 It may be spread over multiple input lines if the newline character is
13999 .Dq escaped
14000 by placing a reverse solidus character
14001 .Ql \e
14002 as the last character of the line; whereas any leading whitespace of
14003 follow lines is ignored, trailing whitespace before a escaped newline
14004 remains in the input.
14006 If the line (content) starts with the number sign
14007 .Ql #
14008 then it is a comment-command and also ignored.
14009 (The comment-command is a real command, which does nothing, and
14010 therefore the usual follow lines mechanism applies!)
14014 Errors while loading these files are subject to the settings of
14015 .Va errexit
14017 .Va posix .
14018 More files with syntactically equal content can be
14019 .Ic source Ns ed .
14020 The following, saved in a file, would be an examplary content:
14022 .Bd -literal -offset indent
14023  # This line is a comment command.  And y\e
14024     es, it is really continued here.
14025 set debug \e
14026     verbose
14027     set editheaders
14029 .\" }}}
14031 .\" .Ss "The mime.types files" {{{
14032 .Ss "The mime.types files"
14034 As stated in
14035 .Sx "HTML mail and MIME attachments"
14036 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
14037 media types in order to classify message and attachment content.
14038 One source for them are
14039 .Pa mime.types
14040 files, the loading of which can be controlled by setting the variable
14041 .Va mimetypes-load-control .
14042 Another is the command
14043 .Ic mimetype ,
14044 which also offers access to \*(UAs MIME type cache.
14045 .Pa mime.types
14046 files have the following syntax:
14048 .Bd -literal -offset indent
14049 type/subtype extension [extension ...]
14050 # For example text/html html htm
14054 where
14055 .Ql type/subtype
14056 define the MIME media type, as standardized in RFC 2046:
14057 .Ql type
14058 is used to declare the general type of data, while the
14059 .Ql subtype
14060 specifies a specific format for that type of data.
14061 One or multiple filename
14062 .Ql extension Ns
14063 s, separated by whitespace, can be bound to the media type format.
14064 Comments may be introduced anywhere on a line with a number sign
14065 .Ql # ,
14066 causing the remaining line to be discarded.
14068 \*(UA also supports an extended, non-portable syntax in especially
14069 crafted files, which can be loaded via the alternative value syntax of
14070 .Va mimetypes-load-control ,
14071 and prepends an optional
14072 .Ql type-marker :
14075 .Dl [type-marker ]type/subtype extension [extension ...]
14078 The following type markers are supported:
14081 .Bl -tag -compact -width ".It Ar _n_u"
14082 .It Ar \&?
14083 Treat message parts with this content as plain text.
14084 .It Ar ?t
14085 The same as plain
14086 .Ar \&? .
14087 .It Ar ?h
14088 Treat message parts with this content as HTML tagsoup.
14089 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
14090 the content as plain text instead.
14091 .It Ar ?H
14092 Likewise
14093 .Ar ?h ,
14094 but instead of falling back to plain text require an explicit content
14095 handler to be defined.
14096 .It Ar ?q
14097 If no handler can be found a text message is displayed which says so.
14098 This can be annoying, for example signatures serve a contextual purpose,
14099 their content is of no use by itself.
14100 This marker will avoid displaying the text message.
14104 Further reading:
14105 for sending messages:
14106 .Ic mimetype ,
14107 .Va mime-allow-text-controls ,
14108 .Va mimetypes-load-control .
14109 For reading etc. messages:
14110 .Sx "HTML mail and MIME attachments" ,
14111 .Sx "The Mailcap files" ,
14112 .Ic mimetype ,
14113 .Va mime-counter-evidence ,
14114 .Va mimetypes-load-control ,
14115 .Va pipe-TYPE/SUBTYPE ,
14116 .Va pipe-EXTENSION .
14117 .\" }}}
14119 .\" .Ss "The Mailcap files" {{{ review
14120 .Ss "The Mailcap files"
14122 \*(OP RFC 1524 defines a
14123 .Dq User Agent Configuration Mechanism
14124 to be used to inform mail user agent programs about the locally
14125 installed facilities for handling various data formats, i.e., about
14126 commands and how they can be used to display, edit et cetera MIME part
14127 contents, as well as a default path search that includes multiple
14128 possible locations of resource files, and the
14129 .Ev MAILCAPS
14130 environment variable to overwrite that.
14131 Handlers found from doing the path search will be cached, the command
14132 .Ic mailcap
14133 operates on that cache, and the variable
14134 .Va mailcap-disable
14135 will suppress automatic loading, and usage of any mailcap handlers.
14136 .Sx "HTML mail and MIME attachments"
14137 gives a general overview of how MIME types are handled.
14140 .Dq Mailcap
14141 files consist of a set of newline separated entries.
14142 Comment lines start with a number sign
14143 .Ql #
14144 (in the first column!) and are ignored.
14145 Empty lines are ignored.
14146 All other lines are interpreted as mailcap entries.
14147 An entry definition may be split over multiple lines by placing the
14148 reverse solidus character
14149 .Ql \e
14150 last in all but the final line.
14151 The standard does not specify how leading whitespace of successive lines
14152 is to be treated, therefore they are retained.
14155 .Dq Mailcap
14156 entries consist of a number of semicolon
14157 .Ql \&;
14158 separated fields.
14159 The first two fields are mandatory and must occur in the specified
14160 order, the remaining fields are optional and may appear in any order.
14161 Leading and trailing whitespace of field content is ignored (removed).
14162 The reverse solidus
14163 .Ql \e
14164 character can be used to escape any following character including
14165 semicolon and itself in the content of the second field, and in value
14166 parts of any optional key/value field.
14169 The first field defines the MIME
14170 .Ql TYPE/SUBTYPE
14171 the entry is about to handle (case-insensitively).
14172 If the subtype is specified as an asterisk
14173 .Ql *
14174 the entry is meant to match all subtypes of the named type, e.g.,
14175 .Ql audio/*
14176 would match any audio type.
14177 The second field is the
14178 .Cd view
14179 shell command used to display MIME parts of the given type.
14182 Data consuming shell commands will be fed message (MIME part) data on
14183 standard input unless one or more instances of the (unquoted) string
14184 .Ql %s
14185 are used: these formats will be replaced with a temporary file(name)
14186 that has been prefilled with the parts data.
14187 Data producing shell commands are expected to generata data on their
14188 standard output unless that format is used.
14189 In all cases any given
14190 .Ql %s
14191 format is replaced with a properly shell quoted filename.
14192 When a command requests a temporary file via
14193 .Ql %s
14194 then that will be removed again, as if the
14195 .Cd x-mailx-tmpfile
14197 .Cd x-mailx-tmpfile-fill
14198 flags had been set; unless the command requests
14199 .Cd x-mailx-async
14201 .Cd x-mailx-tmpfile-unlink
14202 flag is also implied; see below for more.
14205 Optional fields define single-word flags (case-insensitive), or key
14206 / value pairs consisting of a case-insensitive keyword, an equals sign
14207 .Ql = ,
14208 and a shell command; whitespace surrounding the equals sign is removed.
14209 Optional fields include the following:
14212 .Bl -tag -width ".It Cd BaNg"
14213 .It Cd compose
14214 A program that can be used to compose a new body or body part in the
14215 given format.
14216 (Currently unused.)
14218 .It Cd composetyped
14219 Similar to the
14220 .Cd compose
14221 field, but is to be used when the composing program needs to specify the
14222 .Ql Content-type:
14223 header field to be applied to the composed data.
14224 (Currently unused.)
14227 .It Cd copiousoutput
14228 A flag field which indicates that the output of the
14229 .Cd view
14230 command is integrable into \*(UAs normal visual display.
14231 It is mutually exclusive with
14232 .Cd needsterminal .
14234 .It Cd description
14235 A textual description that describes this type of data.
14236 The text may optionally be enclosed within double quotation marks
14237 .Ql \&" .
14239 .It Cd edit
14240 A program that can be used to edit a body or body part in the given
14241 format.
14242 (Currently unused.)
14244 .It Cd nametemplate
14245 This field specifies a filename format for the
14246 .Ql %s
14247 format used in the shell command fields, in which
14248 .Ql %s
14249 will be replaced by a random string.
14250 (The filename is also stored in and passed to subprocesses via
14251 .Ev MAILX_FILENAME_TEMPORARY . )
14252 The standard says this is
14253 .Dq only expected to be relevant in environments \
14254   where filename extensions are meaningful ,
14255 and so this field is ignored unless the
14256 .Ql %s
14257 is a prefix, optionally followed by (ASCII) alphabetic and numeric
14258 characters, the underscore and the period.
14259 For example, to specify that a JPG file is to be passed to an image
14260 viewer with a name ending in
14261 .Ql .jpg ,
14262 .Ql nametemplate=%s.jpg
14263 can be used.
14266 .It Cd needsterminal
14267 This flag field indicates that the given shell command must be run on
14268 an interactive terminal.
14269 \*(UA will temporarily release the terminal to the given command in
14270 interactive mode, in non-interactive mode this entry will be entirely
14271 ignored; this flag implies
14272 .Cd x-mailx-noquote .
14274 .It Cd print
14275 A program that can be used to print a message or body part in the given
14276 format.
14277 (Currently unused.)
14279 .It Cd test
14280 Specifies a program to be run to test some condition, for example, the
14281 machine architecture, or the window system in use, to determine whether
14282 or not this mailcap entry applies.
14283 If the test fails, a subsequent mailcap entry should be sought; also see
14284 .Cd x-mailx-test-once .
14285 Standard I/O of the test program is redirected from and to
14286 .Pa /dev/null ,
14287 and the format
14288 .Ql %s
14289 is not supported (the data does not yet exist).
14291 .It Cd textualnewlines
14292 A flag field which indicates that this type of data is line-oriented and
14293 that, if encoded in
14294 .Ql base64 ,
14295 all newlines should be converted to canonical form (CRLF) before
14296 encoding, and will be in that form after decoding.
14297 (Currently unused.)
14299 .It Cd x11-bitmap
14300 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
14301 icon to be used to visually denote the presence of this kind of data.
14302 This field is not used by \*(UA.
14305 .It Cd x-mailx-async
14306 Extension flag field that denotes that the given
14307 .Cd view
14308 command shall be executed asynchronously, without blocking \*(UA.
14309 Cannot be used in conjunction with
14310 .Cd needsterminal ;
14311 the standard output of the command will go to
14312 .Pa /dev/null .
14315 .It Cd x-mailx-noquote
14316 An extension flag field that indicates that even a
14317 .Cd copiousoutput
14318 .Cd view
14319 command shall not be used when
14320 .Va quote Ns
14321 ing messages, as it would by default.
14324 .It Cd x-mailx-test-once
14325 Extension flag which denotes whether the given
14326 .Cd test
14327 command shall be evaluated once only with its exit status being cached.
14328 This is handy if some global unchanging condition is to be queried, like
14329 .Dq running under the X Window System .
14332 .It Cd x-mailx-tmpfile
14333 Extension flag field that requests creation of a zero-sized temporary
14334 file, the name of which is to be placed in the environment variable
14335 .Ev MAILX_FILENAME_TEMPORARY .
14336 It is an error to use this flag with commands that include a
14337 .Ql %s
14338 format (because that is implemented by means of this temporary file).
14341 .It Cd x-mailx-tmpfile-fill
14342 Normally the MIME part content is passed to the handler via standard
14343 input; if this flag is set then the data will instead be written into
14344 the implied
14345 .Cd x-mailx-tmpfile .
14346 In order to cause deletion of the temporary file you will have to set
14347 .Cd x-mailx-tmpfile-unlink
14348 explicitly!
14349 It is an error to use this flag with commands that include a
14350 .Ql %s
14351 format.
14354 .It Cd x-mailx-tmpfile-unlink
14355 Extension flag field that requests that the temporary file shall be
14356 deleted automatically when the command loop is entered again at latest.
14357 It is an error to use this flag with commands that include a
14358 .Ql %s
14359 format, or in conjunction with
14360 .Cd x-mailx-async .
14361 .Cd x-mailx-tmpfile
14362 is implied.
14365 .It Cd x-mailx-last-resort
14366 An extension flag that indicates that this handler shall only be used
14367 as a last resort, when no other source (see
14368 .Sx "HTML mail and MIME attachments" )
14369 provides a MIME handler.
14372 .It Cd x-mailx-ignore
14373 An extension that enforces that this handler is not used at all.
14378 The standard includes the possibility to define any number of additional
14379 fields, prefixed by
14380 .Ql x- .
14381 Flag fields apply to the entire
14382 .Dq Mailcap
14383 entry \(em in some unusual cases, this may not be desirable, but
14384 differentiation can be accomplished via separate entries, taking
14385 advantage of the fact that subsequent entries are searched if an earlier
14386 one does not provide enough information.
14387 For example, if a
14388 .Cd view
14389 command needs to specify the
14390 .Cd needsterminal
14391 flag, but the
14392 .Cd compose
14393 command shall not, the following will help out the latter:
14395 .Bd -literal -offset indent
14396 application/postscript; ps-to-terminal %s; needsterminal
14397 application/postscript; ps-to-terminal %s; compose=idraw %s
14401 In value parts of command fields any occurrence of the format string
14402 .Ql %t
14403 will be replaced by the
14404 .Ql TYPE/SUBTYPE
14405 specification.
14406 Any named parameter from a messages'
14407 .Ql Content-type:
14408 field may be embedded into the command line using the format
14409 .Ql %{
14410 followed by the parameter name and a closing brace
14411 .Ql }
14412 character.
14413 The entire parameter should appear as a single command line argument,
14414 regardless of embedded spaces, shell quoting will be performed by the
14415 RFC 1524 processor, thus:
14417 .Bd -literal -offset indent
14418 # Message
14419 Content-type:  multipart/mixed; boundary=42
14421 # Mailcap file
14422 multipart/*; /usr/local/bin/showmulti \e
14423   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
14425 # Executed shell command
14426 /usr/local/bin/showmulti multipart/mixed 42
14430 Note that \*(UA does not support handlers for multipart MIME parts as
14431 shown in this example (as of today).
14432 It does not support the additional formats
14433 .Ql %n
14435 .Ql %F .
14436 An example file, also showing how to properly deal with the expansion of
14437 .Ql %s ,
14438 which includes any quotes that are necessary to make it a valid shell
14439 argument by itself and thus will cause undesired behaviour when placed
14440 in additional user-provided quotes:
14442 .Bd -literal -offset indent
14443 # Comment line
14444 text/richtext; richtext %s; copiousoutput
14446 text/x-perl; perl -cWT %s; nametemplate = %s.pl
14448 # Exit EX_TEMPFAIL=75 on signal
14449 application/pdf; \e
14450   infile=%s\e; \e
14451     trap "rm -f ${infile}" EXIT\e; \e
14452     trap "exit 75" INT QUIT TERM\e; \e
14453     mupdf "${infile}"; \e
14454   test = [ -n "${DISPLAY}" ]; \e
14455   nametemplate = %s.pdf; x-mailx-async
14456 application/pdf; pdftotext -layout - -; copiousoutput
14458 application/*; echo "This is \e\e"%t\e\e" but \e
14459     is 50 \e% Greek to me" \e; < %s head -c 512 | cat -vet; \e
14460   copiousoutput; x-mailx-noquote; x-mailx-last-resort
14464 Further reading:
14465 .Sx "HTML mail and MIME attachments" ,
14466 .Sx "The mime.types files" ,
14467 .Ic mimetype ,
14468 .Ev MAILCAPS ,
14469 .Va mime-counter-evidence ,
14470 .Va pipe-TYPE/SUBTYPE ,
14471 .Va pipe-EXTENSION .
14472 .\" }}}
14474 .\" .Ss "The .netrc file" {{{ review
14475 .Ss "The .netrc file"
14477 User credentials for machine accounts (see
14478 .Sx "On URL syntax and credential lookup" )
14479 can be placed in the
14480 .Pa .netrc
14481 file, which will be loaded and cached when requested by
14482 .Va netrc-lookup .
14483 The default location
14484 .Pa \*(VN
14485 may be overridden by the
14486 .Ev NETRC
14487 environment variable.
14488 As long as syntax constraints are honoured the file source may be
14489 replaced with the output of the shell command set in
14490 .Va netrc-pipe ,
14491 to load an encrypted file, for example.
14492 The cache can be managed with the command
14493 .Ic netrc .
14496 The file consists of space, tabulator or newline separated tokens.
14497 This parser implements a superset of the original BSD syntax, but users
14498 should nonetheless be aware of portability glitches, shall their
14499 .Pa .netrc
14500 be usable across multiple programs and platforms:
14503 .Bl -bullet -compact
14505 BSD only supports double quotation marks, for example
14506 .Ql password """pass with spaces""" .
14508 BSD (only?) supports escaping of single characters via a reverse solidus
14509 (a space could be escaped via
14510 .Ql \e\0 ) ,
14511 in- as well as outside of a quoted string.
14512 This method is assumed to be present, and will actively be used to quote
14513 double quotation marks
14514 .Ql \&"
14515 and reverse solidus
14516 .Ql \e
14517 characters inside the
14518 .Cd login
14520 .Cd password
14521 tokens, for example for display purposes.
14523 BSD does not require a final quotation mark of the last user input token.
14525 The original BSD (Berknet) parser also supported a format which allowed
14526 tokens to be separated with commas \(en whereas at least Hewlett-Packard
14527 still seems to support this syntax, this parser does not!
14529 As a non-portable extension some widely-used programs support
14530 shell-style comments: if an input line starts, after any amount of
14531 whitespace, with a number sign
14532 .Ql # ,
14533 then the rest of the line is ignored.
14535 Whereas other programs may require that the
14536 .Pa .netrc
14537 file is accessible by only the user if it contains a
14538 .Cd password
14539 token for any other
14540 .Cd login
14541 than
14542 .Dq anonymous ,
14543 this parser will always require these strict permissions.
14547 Of the following list of supported tokens this parser uses (and caches)
14548 .Cd machine ,
14549 .Cd login
14551 .Cd password .
14552 An existing
14553 .Cd default
14554 entry will not be used.
14556 .Bl -tag -width ".It Cd BaNg"
14557 .It Cd machine Ar name
14558 The hostname of the entries' machine, lowercase-normalized before use.
14559 Any further file content, until either end-of-file or the occurrence
14560 of another
14561 .Cd machine
14562 or a
14563 .Cd default
14564 first-class token is bound (only related) to the machine
14565 .Ar name .
14567 As an extension that should not be the cause of any worries this parser
14568 supports a single wildcard prefix for
14569 .Ar name :
14570 .Bd -literal -offset indent
14571 machine *.example.com login USER password PASS
14572 machine pop3.example.com login USER password PASS
14573 machine smtp.example.com login USER password PASS
14576 which would match
14577 .Ql xy.example.com
14578 as well as
14579 .Ql pop3.example.com ,
14580 but neither
14581 .Ql example.com
14583 .Ql local.smtp.example.com .
14584 In the example neither
14585 .Ql pop3.example.com
14587 .Ql smtp.example.com
14588 will be matched by the wildcard, since the exact matches take
14589 precedence (it is however faster to specify it the other way around).
14591 .It Cd default
14592 This is the same as
14593 .Cd machine
14594 except that it is a fallback entry that is used shall none of the
14595 specified machines match; only one default token may be specified,
14596 and it must be the last first-class token.
14598 .It Cd login Ar name
14599 The user name on the remote machine.
14601 .It Cd password Ar string
14602 The user's password on the remote machine.
14604 .It Cd account Ar string
14605 Supply an additional account password.
14606 This is merely for FTP purposes.
14608 .It Cd macdef Ar name
14609 Define a macro.
14610 A macro is defined with the specified
14611 .Ar name ;
14612 it is formed from all lines beginning with the next line and continuing
14613 until a blank line is (consecutive newline characters are) encountered.
14614 (Note that
14615 .Cd macdef
14616 entries cannot be utilized by multiple machines, too, but must be
14617 defined following the
14618 .Ic machine
14619 they are intended to be used with.)
14620 If a macro named
14621 .Ar init
14622 exists, it is automatically run as the last step of the login process.
14623 This is merely for FTP purposes.
14625 .\" }}}
14627 .\" }}}
14630 .\" .Sh EXAMPLES {{{
14631 .Sh EXAMPLES
14633 .\" .Ss "An example configuration" {{{
14634 .Ss "An example configuration"
14636 .Bd -literal -offset indent
14637 # This example assumes v15.0 compatibility mode
14638 set v15-compat
14640 # Request strict TLL transport layer security checks
14641 set tls-verify=strict
14643 # Where are the up-to-date TLS certificates?
14644 # (Since we manage up-to-date ones explicitly, do not use any,
14645 # possibly outdated, default certificates shipped with OpenSSL)
14646 #set tls-ca-dir=/etc/ssl/certs
14647 set tls-ca-file=/etc/ssl/certs/ca-certificates.crt
14648 set tls-ca-no-defaults
14649 #set tls-ca-flags=partial-chain
14650 wysh set smime-ca-file="${tls-ca-file}" \e
14651   smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}"
14653 # This could be outsourced to a central configuration file via
14654 # tls-config-file plus tls-config-module if the used library allows.
14655 # CipherString: explicitly define the list of ciphers, which may
14656 #   improve security, especially with protocols older than TLS v1.2.
14657 #   See ciphers(1).  Possibly best to only use tls-config-pairs-HOST
14658 #   (or -USER@HOST), as necessary, again..
14659 #   Note that TLSv1.3 uses Ciphersuites= instead, which will join
14660 #   with CipherString (if protocols older than v1.3 are allowed)
14661 # Curves: especially with TLSv1.3 curves selection may be desired.
14662 # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.
14663 #   Change this only when the remote server does not support it:
14664 #   maybe use chain support via tls-config-pairs-HOST / -USER@HOST
14665 #   to define such explicit exceptions, then, e.g.,
14666 #     MinProtocol=TLSv1.1
14667 if "$tls-features" =% ,+ctx-set-maxmin-proto,
14668   wysh set tls-config-pairs='\e
14669       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
14670       Curves=P-521:P-384:P-256,\e
14671       MinProtocol=TLSv1.1'
14672 else
14673   wysh set tls-config-pairs='\e
14674       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
14675       Curves=P-521:P-384:P-256,\e
14676       Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2\e, +TLSv1.3'
14677 endif
14679 # Essential setting: select allowed character sets
14680 set sendcharsets=utf-8,iso-8859-1
14682 # A very kind option: when replying to a message, first try to
14683 # use the same encoding that the original poster used herself!
14684 set reply-in-same-charset
14686 # When replying, do not merge From: and To: of the original message
14687 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
14688 set recipients-in-cc
14690 # When sending messages, wait until the Mail-Transfer-Agent finishs.
14691 # Only like this you will be able to see errors reported through the
14692 # exit status of the MTA (including the built-in SMTP one)!
14693 set sendwait
14695 # Only use built-in MIME types, no mime.types(5) files
14696 set mimetypes-load-control
14698 # Default directory where we act in (relative to $HOME)
14699 set folder=mail
14700 # A leading "+" (often) means: under *folder*
14701 # *record* is used to save copies of sent messages
14702 set MBOX=+mbox.mbox DEAD=+dead.txt \e
14703   record=+sent.mbox record-files record-resent
14705 # Make "file mymbox" and "file myrec" go to..
14706 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
14708 # Not really optional, e.g., for S/MIME
14709 set from='Your Name <address@exam.ple>'
14711 # It may be necessary to set hostname and/or smtp-hostname
14712 # if the "SERVER" of mta and "domain" of from do not match.
14713 # The `urlencode' command can be used to encode USER and PASS
14714 set mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \e
14715   smtp-auth=login/plain... \e
14716   smtp-use-starttls
14718 # Never refuse to start into interactive mode, and more
14719 set emptystart \e
14720   colour-pager crt= \e
14721   followup-to followup-to-honour=ask-yes fullnames \e
14722   history-file=+.\*(uAhist history-size=-1 history-gabby \e
14723   mime-counter-evidence=0b1111 \e
14724   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
14725   reply-to-honour=ask-yes \e
14726   umask=
14728 # Only include the selected header fields when typing messages
14729 headerpick type retain from_ date from to cc subject \e
14730   message-id mail-followup-to reply-to
14731 # ...when forwarding messages
14732 headerpick forward retain subject date from to cc
14733 # ...when saving message, etc.
14734 #headerpick save ignore ^Original-.*$ ^X-.*$
14736 # Some mailing lists
14737 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
14738 mlsubscribe '^xfans@xfans\e.xyz$'
14740 # Handle a few file extensions (to store MBOX databases)
14741 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
14742   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
14743   zst 'zstd -dc' 'zstd -19 -zc' \e
14744   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
14746 # A real life example of a very huge free mail provider
14747 # Instead of directly placing content inside `account',
14748 # we `define' a macro: like that we can switch "accounts"
14749 # from within *on-compose-splice*, for example!
14750 define XooglX {
14751   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
14752   set from='Your Name <address@examp.ple>'
14754   set pop3-no-apop-pop.gmXil.com
14755   shortcut pop %:pop3s://pop.gmXil.com
14756   shortcut imap %:imaps://imap.gmXil.com
14757   # Or, entirely IMAP based setup
14758   #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e
14759   #   imap-cache=~/spool/cache
14761   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
14762   # Alternatively:
14763   set mta=smtps://USER:PASS@smtp.gmail.com:465
14765 account XooglX {
14766   \ecall XooglX
14769 # Here is a pretty large one which does not allow sending mails
14770 # if there is a domain name mismatch on the SMTP protocol level,
14771 # which would bite us if the value of from does not match, e.g.,
14772 # for people who have a sXXXXeforge project and want to speak
14773 # with the mailing list under their project account (in from),
14774 # still sending the message through their normal mail provider
14775 define XandeX {
14776   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
14777   set from='Your Name <address@exam.ple>'
14779   shortcut pop %:pop3s://pop.yaXXex.com
14780   shortcut imap %:imaps://imap.yaXXex.com
14782   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
14783     hostname=yaXXex.com smtp-hostname=
14785 account XandeX {
14786   \ecall Xandex
14789 # Create some new commands so that, e.g., `ls /tmp' will..
14790 commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS'
14791 commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS'
14793 set pipe-message/external-body='?* echo $MAILX_EXTERNAL_BODY_URL'
14795 # We do not support gpg(1) directly yet.  But simple --clearsign'd
14796 # message parts can be dealt with as follows:
14797 define V {
14798   localopts yes
14799   wysh set pipe-text/plain=$'?*#++=?\e
14800     < "${MAILX_FILENAME_TEMPORARY}" awk \e
14801         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
14802       BEGIN{done=0}\e
14803       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
14804         if(done++ != 0)\e
14805           next;\e
14806         print "--- GPG --verify ---";\e
14807         system("gpg --verify " TMPFILE " 2>&1");\e
14808         print "--- GPG --verify ---";\e
14809         print "";\e
14810         next;\e
14811       }\e
14812       /^-----BEGIN PGP SIGNATURE-----/,\e
14813           /^-----END PGP SIGNATURE-----/{\e
14814         next;\e
14815       }\e
14816       {print}\e
14817     \e''
14818     print
14820 commandalias V '\e'call V
14824 When storing passwords in
14825 .Pa \*(ur
14826 appropriate permissions should be set on this file with
14827 .Ql $ chmod 0600 \*(ur .
14828 If the \*(OPal
14829 .Va netrc-lookup
14830 is available user credentials can be stored in the central
14831 .Pa \*(VN
14832 file instead; e.g., here is a different version of the example account
14833 that sets up SMTP and POP3:
14835 .Bd -literal -offset indent
14836 define XandeX {
14837   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
14838   set from='Your Name <address@exam.ple>'
14839   set netrc-lookup
14840   # Load an encrypted ~/.netrc by uncommenting the next line
14841   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
14843   set mta=smtps://smtp.yXXXXx.ru:465 \e
14844       smtp-hostname= hostname=yXXXXx.com
14845   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
14846   commandalias xp fi pop3s://pop.yXXXXx.ru
14848 account XandeX {
14849   \ecall XandeX
14854 and, in the
14855 .Pa \*(VN
14856 file:
14858 .Bd -literal -offset indent
14859 machine *.yXXXXx.ru login USER password PASS
14863 This configuration should now work just fine:
14866 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
14867 .\" }}}
14869 .\" .Ss "S/MIME step by step" {{{
14870 .Ss "S/MIME step by step"
14872 \*(OP The first thing that is needed for
14873 .Sx "Signed and encrypted messages with S/MIME"
14874 is a personal certificate, and a private key.
14875 The certificate contains public information, in particular a name and
14876 email address(es), and the public key that can be used by others to
14877 encrypt messages for the certificate holder (the owner of the private
14878 key), and to
14879 .Ic verify
14880 signed messages generated with that certificate('s private key).
14881 Whereas the certificate is included in each signed message, the private
14882 key must be kept secret.
14883 It is used to decrypt messages that were previously encrypted with the
14884 public key, and to sign messages.
14887 For personal use it is recommended to get a S/MIME certificate from
14888 one of the major CAs on the Internet.
14889 Many CAs offer such certificates for free.
14890 Usually offered is a combined certificate and private key in PKCS#12
14891 format which \*(UA does not accept directly.
14892 To convert it to PEM format, the following shell command can be used;
14893 please read on for how to use these PEM files.
14895 .Bd -literal -offset indent
14896 $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes
14897 $ # Alternatively
14898 $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys
14899 $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes
14903 There is also
14904 .Lk https://www.CAcert.org
14905 which issues client and server certificates to members of their
14906 community for free; their root certificate
14907 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
14908 is often not in the default set of trusted CA root certificates, though,
14909 which means their root certificate has to be downloaded separately,
14910 and needs to be part of the S/MIME certificate validation chain by
14911 including it in
14912 .Va smime-ca-dir
14913 or as a vivid member of the
14914 .Va smime-ca-file .
14915 But let us take a step-by-step tour on how to setup S/MIME with
14916 a certificate from CAcert.org despite this situation!
14919 First of all you will have to become a member of the CAcert.org
14920 community, simply by registrating yourself via the web interface.
14921 Once you are, create and verify all email addresses you want to be able
14922 to create signed and encrypted messages for/with using the corresponding
14923 entries of the web interface.
14924 Now ready to create S/MIME certificates, so let us create a new
14925 .Dq client certificate ,
14926 ensure to include all email addresses that should be covered by the
14927 certificate in the following web form, and also to use your name as the
14928 .Dq common name .
14931 Create a private key and a certificate request on your local computer
14932 (please see the manual pages of the used commands for more in-depth
14933 knowledge on what the used arguments etc. do):
14936 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
14939 Afterwards copy-and-paste the content of
14940 .Dq creq.pem
14941 into the certificate-request (CSR) field of the web form on the
14942 CAcert.org website (you may need to unfold some
14943 .Dq advanced options
14944 to see the corresponding text field).
14945 This last step will ensure that your private key (which never left your
14946 box) and the certificate belong together (through the public key that
14947 will find its way into the certificate via the certificate-request).
14948 You are now ready and can create your CAcert certified certificate.
14949 Download and store or copy-and-paste it as
14950 .Dq pub.crt .
14953 Yay.
14954 In order to use your new S/MIME setup a combined private key/public key
14955 (certificate) file has to be created:
14958 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
14961 This is the file \*(UA will work with.
14962 If you have created your private key with a passphrase then \*(UA will
14963 ask you for it whenever a message is signed or decrypted, unless this
14964 operation has been automated as described in
14965 .Sx "Signed and encrypted messages with S/MIME" .
14966 Set the following variables to henceforth use S/MIME (setting
14967 .Va smime-ca-file
14968 is of interest for verification only):
14970 .Bd -literal -offset indent
14971 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
14972     smime-sign-cert=ME@HERE.com.paired \e
14973     smime-sign-digest=SHA512 \e
14974     smime-sign from=myname@my.host
14977 .\" }}}
14979 .\" .Ss "Using CRLs with S/MIME or TLS" {{{
14980 .Ss "Using CRLs with S/MIME or TLS"
14982 \*(OP Certification authorities (CAs) issue certificate revocation
14983 lists (CRLs) on a regular basis.
14984 These lists contain the serial numbers of certificates that have been
14985 declared invalid after they have been issued.
14986 Such usually happens because the private key for the certificate has
14987 been compromised,
14988 because the owner of the certificate has left the organization that is
14989 mentioned in the certificate, etc.
14990 To seriously use S/MIME or TLS verification,
14991 an up-to-date CRL is required for each trusted CA.
14992 There is otherwise no method to distinguish between valid and
14993 invalidated certificates.
14994 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
14995 the Internet, so they have to be retrieved by some external mechanism.
14998 \*(UA accepts CRLs in PEM format only;
14999 CRLs in DER format must be converted, like, e.\|g.:
15002 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
15005 To tell \*(UA about the CRLs, a directory that contains all CRL files
15006 (and no other files) must be created.
15008 .Va smime-crl-dir
15010 .Va tls-crl-dir
15011 variables, respectively, must then be set to point to that directory.
15012 After that, \*(UA requires a CRL to be present for each CA that is used
15013 to verify a certificate.
15014 .\" }}}
15016 .\" }}} (Examples)
15019 .\" .Sh "FAQ" {{{
15020 .Sh "FAQ"
15022 In general it is a good idea to turn on
15023 .Va debug
15024 .Pf ( Fl d )
15025 and / or
15026 .Va verbose
15027 .Pf ( Fl v ,
15028 twice) if something does not work well.
15029 Very often a diagnostic message can be produced that leads to the
15030 problems' solution.
15032 .\" .Ss "\*(UA shortly hangs on startup" {{{
15033 .Ss "\*(UA shortly hangs on startup"
15035 This can have two reasons, one is the necessity to wait for a file lock
15036 and cannot be helped, the other being that \*(UA calls the function
15037 .Xr uname 2
15038 in order to query the nodename of the box (sometimes the real one is
15039 needed instead of the one represented by the internal variable
15040 .Va hostname ) .
15041 One may have varying success by ensuring that the real hostname and
15042 .Ql localhost
15043 have entries in
15044 .Pa /etc/hosts ,
15045 or, more generally, that the name service is properly setup \(en
15046 and does
15047 .Xr hostname 1
15048 return the expected value?
15049 Does this local hostname have a domain suffix?
15050 RFC 6762 standardized the link-local top-level domain
15051 .Ql .local ,
15052 try again after adding an (additional) entry with this extension.
15053 .\" }}}
15055 .\" .Ss "I cannot login to Google mail (via OAuth)" {{{
15056 .Ss "I cannot login to Google mail \&(via OAuth\&)"
15058 Since 2014 some free service providers classify programs as
15059 .Dq less secure
15060 unless they use a special authentication method (OAuth 2.0) which
15061 was not standardized for non-HTTP protocol authentication token query
15062 until August 2015 (RFC 7628).
15065 Different to Kerberos / GSSAPI, which is developed since the mid of the
15066 1980s, where a user can easily create a local authentication ticket for
15067 her- and himself with the locally installed
15068 .Xr kinit 1
15069 program, that protocol has no such local part but instead requires
15070 a world-wide-web query to create or fetch a token; since there is no
15071 local cache this query would have to be performed whenever \*(UA is
15072 invoked (in interactive sessions situation may differ).
15075 \*(UA does not directly support OAuth.
15076 It, however, supports XOAUTH2 / OAUTHBEARER, see
15077 .Sx "But, how about XOAUTH2 / OAUTHBEARER?"
15078 If that is not used it is necessary to declare \*(UA a
15079 .Dq less secure app
15080 (on the providers account web page) in order to read and send mail.
15081 However, it also seems possible to take the following steps instead:
15084 .Bl -enum -compact
15086 give the provider the number of a mobile phone,
15088 enable
15089 .Dq 2-Step Verification ,
15091 create an application specific password (16 characters), and
15093 use that special password instead of the real Google account password in
15094 \*(UA (for more on that see the section
15095 .Sx "On URL syntax and credential lookup" ) .
15097 .\" }}}
15099 .\" .Ss "But, how about XOAUTH2 / OAUTHBEARER?" {{{
15100 .Ss "But, how about XOAUTH2 / OAUTHBEARER?"
15102 Following up
15103 .Sx "I cannot login to Google mail \&(via OAuth\&)"
15104 one OAuth-based authentication method is available:
15105 the OAuth 2.0 bearer token usage as standardized in RFC 6750 (according
15106 SASL mechanism in RFC 7628), also known as XOAUTH2 and OAUTHBEARER,
15107 allows fetching a temporary access token via the web that can locally be
15108 used as a
15109 .Va password .
15110 The protocol is simple and extendable, token updates or even password
15111 changes via a simple TLS secured server login would be possible in
15112 theory, but today a web browser and an external support tool are
15113 prerequisites for using this authentication method.
15114 The token times out and must be periodically refreshed via the web.
15117 Some hurdles must be taken before being able to use this method.
15118 Using GMail as an example, an application (that is a name) must be
15119 registered, for which credentials, a
15120 .Dq client ID
15121 and a
15122 .Dq client secret ,
15123 need to be created and saved locally (in a secure way).
15124 These initial configuration steps can be performed at
15125 .Lk https://console.developers.google.com/apis/credentials .
15126 Thereafter a refresh token can be requested;
15127 a python program to do this for GMail accounts is
15128 .Lk https://github.com/google/\:gmail-oauth2-tools/\:raw/\:\
15129 master/\:python/\:oauth2.py :
15131 .Bd -literal -offset indent
15132 $ python oauth2.py --user=EMAIL \e
15133   --client-id=THE-ID --client-secret=THE-SECRET \e
15134   --generate_oauth2_token
15135 To authorize token, visit this url and follow the directions:
15136   https://accounts.google.com/o/oauth2/auth?client_id=...
15137   Enter verification code: ...
15138   Refresh Token: ...
15139   Access Token: ...
15140   Access Token Expiration Seconds: 3600
15141 $ # Of which the last three are actual token responses.
15142 $ # Thereafter access tokens can regularly be refreshed
15143 $ # via the created refresh token (read on)
15147 The generated refresh token must also be saved locally (securely).
15148 The procedure as a whole can be read at
15149 .Lk https://github.com/google/\:gmail-oauth2-tools/\:wiki/\:\
15150 OAuth2DotPyRunThrough .
15151 Since periodic timers are not yet supported, keeping an access token
15152 up-to-date (from within \*(UA) can only be performed via the hook
15153 .Va on-main-loop-tick ,
15154 or (for sending only)
15155 .Va on-compose-enter
15156 (for more on authentication please see the section
15157 .Sx "On URL syntax and credential lookup" ) :
15159 .Bd -literal -offset indent
15160 set on-main-loop-tick=o-m-l-t on-compose-enter=o-c-e
15161 define o-m-l-t {
15162   xcall update_access_token
15164 define o-c-e {
15165   xcall update_access_token
15168 set access_token_=0
15169 define update_access_token {
15170   local set i epoch_sec epoch_nsec
15171   vput vexpr i epoch
15172   eval set $i # set epoch_sec/_nsec of vexpr epoch
15173   vput vexpr i + $access_token_ 2100
15174   if $epoch_sec -ge $i
15175     vput ! password python oauth2.py --user=EMAIL \e
15176         --client-id=THE-ID --client-secret=THE-SECRET \e
15177         --refresh-token=THE-REFRESH-TOKEN |\e
15178       sed '1b PASS;d; :PASS s/^.\e{1,\e}:\e(.\e{1,\e}\e)$/\e1/'
15179     vput csop password trim "$password"
15180     if -n "$verbose"
15181       echo password is <$password>
15182     endif
15183     set access_token_=$epoch_sec
15184   endif
15187 .\" }}}
15189 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{ review
15190 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
15192 Two thinkable situations: the first is a shadowed sequence; setting
15193 .Va debug ,
15194 or the most possible
15195 .Va verbose
15196 mode, causes a printout of the
15197 .Ic bind
15198 tree after that is built; being a cache, this happens only upon startup
15199 or after modifying bindings.
15202 Or second, terminal libraries (see
15203 .Sx "On terminal control and line editor",
15204 .Ic bind ,
15205 .Va termcap )
15206 may report different codes than the terminal really sends, rendering
15207 bindings dysfunctional because expected and received data do not match; the
15208 .Va verbose
15209 listing of
15210 .Ic bind Ns
15211 ings will show the byte sequences that are expected.
15212 (One common source of problems is that the \(em possibly even
15213 non-existing \(em keypad is not turned on, and the resulting layout
15214 reports the keypad control codes for the normal keyboard keys.)
15217 To overcome the situation use for example the program
15218 .Xr cat 1
15219 with its option
15220 .Fl \&\&v ,
15221 if available, to see the byte sequences which are actually produced
15222 by keypresses, and use the variable
15223 .Va termcap
15224 to make \*(UA aware of them.
15225 The terminal this is typed on produces some unexpected sequences,
15226 here for an example the shifted home key:
15228 .Bd -literal -offset indent
15229 ? set verbose
15230 ? bind*
15231 # 1B 5B=[ 31=1 3B=; 32=2 48=H
15232   bind base :kHOM z0
15233 ? x
15234 $ cat -v
15235 ^[[H
15236 $ \*(uA -v -Stermcap='kHOM=\eE[H'
15237 ? bind*
15238 # 1B 5B=[ 48=H
15239   bind base :kHOM z0
15241 .\" }}}
15243 .\" .Ss "Can \*(UA git-send-email?" {{{
15244 .Ss "Can \*(UA git-send-email?"
15246 Yes.
15247 Put (at least parts of) the following in your
15248 .Pa ~/.gitconfig :
15250 .Bd -literal -offset indent
15251 [sendemail]
15252 smtpserver = /usr/bin/\*(uA
15253 smtpserveroption = -t
15254 #smtpserveroption = -Sexpandaddr
15255 smtpserveroption = -Athe-account-you-need
15257 suppresscc = all
15258 suppressfrom = false
15259 assume8bitEncoding = UTF-8
15260 #to = /tmp/OUT
15261 confirm = always
15262 chainreplyto = true
15263 multiedit = false
15264 thread = true
15265 quiet = true
15266 annotate = true
15270 Patches can also be send directly, for example:
15272 .Bd -literal -offset indent
15273 $ git format-patch -M --stdout HEAD^ |
15274   \*(uA -A the-account-you-need -t RECEIVER
15276 .\" }}}
15278 .\" .Ss "Howto handle stale dotlock files" {{{
15279 .Ss "Howto handle stale dotlock files"
15281 .Ic folder
15282 sometimes fails to open MBOX mail databases because creation of
15283 .Mx -sx
15284 .Sx "dotlock files"
15285 is impossible due to existing but unowned lock files.
15286 \*(UA does not offer an option to deal with those files, because it is
15287 considered a site policy what counts as unowned, and what not.
15288 The site policy is usually defined by administrator(s), and expressed in
15289 the configuration of a locally installed MTA (for example Postfix
15290 .Ql stale_lock_time=500s ) .
15291 Therefore the suggestion:
15293 .Bd -literal -offset indent
15294 $ </dev/null \*(uA -s 'MTA: be no frog, handle lock' $LOGNAME
15298 By sending a mail to yourself the local MTA can use its normal queue
15299 mechanism to try the delivery multiple times, finally decide a lock file
15300 has become stale, and remove it.
15301 .\" }}}
15303 .\" }}}
15306 .\" .Sh "IMAP CLIENT" {{{
15307 .Sh "IMAP CLIENT"
15309 \*(OPally there is IMAP client support available.
15310 This part of the program is obsolete and will vanish in v15 with the
15311 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
15312 and makes excessive use of signal based long code jumps.
15313 Support can hopefully be readded later based on a new-style I/O, with
15314 SysV signal handling.
15315 In fact the IMAP support had already been removed from the codebase, but
15316 was reinstantiated on user demand: in effect the IMAP code is at the
15317 level of \*(UA v14.8.16 (with
15318 .Ic imapcodec
15319 being the sole exception), and should be treated with some care.
15322 IMAP uses the
15323 .Ql imap://
15325 .Ql imaps://
15326 protocol prefixes, and an IMAP-based
15327 .Va folder
15328 may be used.
15329 IMAP URLs (paths) undergo inspections and possible transformations
15330 before use (and the command
15331 .Ic imapcodec
15332 can be used to manually apply them to any given argument).
15333 Hierarchy delimiters are normalized, a step which is configurable via the
15334 .Va imap-delim
15335 variable chain, but defaults to the first seen delimiter otherwise.
15336 \*(UA supports internationalised IMAP names, and en- and decodes the
15337 names from and to the
15338 .Va ttycharset
15339 as necessary and possible.
15340 If a mailbox name is expanded (see
15341 .Sx "Filename transformations" )
15342 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
15343 mailboxes below the
15344 .Va folder
15345 target box, while folder names prefixed by `@' refer to folders below
15346 the hierarchy base, so the following will list all folders below the
15347 current one when in an IMAP mailbox:
15348 .Ql folders @ .
15351 Note: some IMAP servers do not accept the creation of mailboxes in
15352 the hierarchy base, but require that they are created as subfolders of
15353 `INBOX' \(en with such servers a folder name of the form
15355 .Dl imaps://mylogin@imap.myisp.example/INBOX.
15357 should be used (the last character is the server's hierarchy
15358 delimiter).
15359 The following IMAP-specific commands exist:
15362 .Bl -tag -width ".It Ic BaNg"
15364 .It Ic cache
15365 Only applicable to cached IMAP mailboxes;
15366 takes a message list and reads the specified messages into the IMAP
15367 cache.
15370 .It Ic connect
15371 If operating in disconnected mode on an IMAP mailbox,
15372 switch to online mode and connect to the mail server while retaining
15373 the mailbox status.
15374 See the description of the
15375 .Va disconnected
15376 variable for more information.
15379 .It Ic disconnect
15380 If operating in online mode on an IMAP mailbox,
15381 switch to disconnected mode while retaining the mailbox status.
15382 See the description of the
15383 .Va disconnected
15384 variable for more.
15385 A list of messages may optionally be given as argument;
15386 the respective messages are then read into the cache before the
15387 connection is closed, thus
15388 .Ql disco *
15389 makes the entire mailbox available for disconnected use.
15392 .It Ic imap
15393 Sends command strings directly to the current IMAP server.
15394 \*(UA operates always in IMAP `selected state' on the current mailbox;
15395 commands that change this will produce undesirable results and should be
15396 avoided.
15397 Useful IMAP commands are:
15398 .Bl -tag -offset indent -width ".Ic getquotearoot"
15399 .It create
15400 Takes the name of an IMAP mailbox as an argument and creates it.
15401 .It getquotaroot
15402 (RFC 2087) Takes the name of an IMAP mailbox as an argument
15403 and prints the quotas that apply to the mailbox.
15404 Not all IMAP servers support this command.
15405 .It namespace
15406 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
15407 the Other User's Namespaces and the Shared Namespaces.
15408 Each namespace type is printed in parentheses;
15409 if there are multiple namespaces of the same type,
15410 inner parentheses separate them.
15411 For each namespace a prefix and a hierarchy separator is listed.
15412 Not all IMAP servers support this command.
15416 .It Ic imapcodec
15417 Perform IMAP path transformations.
15418 Supports
15419 .Cm vput
15420 (see
15421 .Sx "Command modifiers" ) ,
15422 and manages the error number
15423 .Va \&! .
15424 The first argument specifies the operation:
15425 .Ar e[ncode]
15426 normalizes hierarchy delimiters (see
15427 .Va imap-delim )
15428 and converts the strings from the locale
15429 .Va ttycharset
15430 to the internationalized variant used by IMAP,
15431 .Ar d[ecode]
15432 performs the reverse operation.
15433 Encoding will honour the (global) value of
15434 .Va imap-delim .
15439 The following IMAP-specific internal variables exist:
15442 .Bl -tag -width ".It Va BaNg"
15444 .It Va disconnected
15445 \*(BO When an IMAP mailbox is selected and this variable is set,
15446 no connection to the server is initiated.
15447 Instead, data is obtained from the local cache (see
15448 .Va imap-cache Ns
15450 Mailboxes that are not present in the cache
15451 and messages that have not yet entirely been fetched from the server
15452 are not available;
15453 to fetch all messages in a mailbox at once,
15454 the command
15455 .No ` Ns Li copy * /dev/null Ns '
15456 can be used while still in connected mode.
15457 Changes that are made to IMAP mailboxes in disconnected mode are queued
15458 and committed later when a connection to that server is made.
15459 This procedure is not completely reliable since it cannot be guaranteed
15460 that the IMAP unique identifiers (UIDs) on the server still match the
15461 ones in the cache at that time.
15462 Data is saved to
15463 .Ev DEAD
15464 when this problem occurs.
15466 .It Va disconnected-USER@HOST
15467 The specified account is handled as described for the
15468 .Va disconnected
15469 variable above,
15470 but other accounts are not affected.
15472 .Mx Va imap-auth
15473 .It Va imap-auth-USER@HOST , imap-auth
15474 Sets the IMAP authentication method.
15475 Supported are the default
15476 .Ql login ,
15477 \*(IN
15478 .Ql oauthbearer
15479 (see
15480 .Sx FAQ
15481 entry
15482 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) ,
15483 \*(IN
15484 .Ql external
15486 .Ql externanon
15487 (for TLS secured connections which pass a client certificate via
15488 .Va tls-config-pairs ) ,
15489 as well as the \*(OPal
15490 .Ql cram-md5
15492 .Ql gssapi .
15493 All methods need a
15494 .Va user
15495 and a
15496 .Va password
15497 except
15498 .Ql gssapi
15500 .Ql external ,
15501 which only need the former.
15502 .Ql externanon
15503 solely builds upon the credentials passed via a client certificate,
15504 and is usually the way to go since tested servers do not actually follow
15505 RFC 4422, and fail if additional credentials are actually passed.
15508 .It Va imap-cache
15509 Enables caching of IMAP mailboxes.
15510 The value of this variable must point to a directory that is either
15511 existent or can be created by \*(UA.
15512 All contents of the cache can be deleted by \*(UA at any time;
15513 it is not safe to make assumptions about them.
15515 .Mx Va imap-delim
15516 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
15517 The hierarchy separator used by the IMAP server.
15518 Whenever an IMAP path is specified it will undergo normalization.
15519 One of the normalization steps is the squeezing and adjustment of
15520 hierarchy separators.
15521 If this variable is set, any occurrence of any character of the given
15522 value that exists in the path will be replaced by the first member of
15523 the value; an empty value will cause the default to be used, it is
15524 .Ql /. .
15525 If not set, we will reuse the first hierarchy separator character that
15526 is discovered in a user-given mailbox name.
15528 .Mx Va imap-keepalive
15529 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
15530 IMAP servers may close the connection after a period of
15531 inactivity; the standard requires this to be at least 30 minutes,
15532 but practical experience may vary.
15533 Setting this variable to a numeric `value' greater than 0 causes
15534 a `NOOP' command to be sent each `value' seconds if no other operation
15535 is performed.
15538 .It Va imap-list-depth
15539 When retrieving the list of folders on an IMAP server, the
15540 .Ic folders
15541 command stops after it has reached a certain depth to avoid possible
15542 infinite loops.
15543 The value of this variable sets the maximum depth allowed.
15544 The default is 2.
15545 If the folder separator on the current IMAP server is a slash `/',
15546 this variable has no effect and the
15547 .Ic folders
15548 command does not descend to subfolders.
15550 .Mx Va imap-use-starttls
15551 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
15552 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
15553 IMAP session TLS encrypted.
15554 This functionality is not supported by all servers,
15555 and is not used if the session is already encrypted by the IMAPS method.
15558 .\" }}}
15561 .\" .Sh "SEE ALSO" {{{
15562 .Sh "SEE ALSO"
15564 .Xr bogofilter 1 ,
15565 .Xr gpg 1 ,
15566 .Xr more 1 ,
15567 .Xr newaliases 1 ,
15568 .Xr openssl 1 ,
15569 .Xr sendmail 1 ,
15570 .Xr sh 1 ,
15571 .Xr spamassassin 1 ,
15572 .Xr iconv 3 ,
15573 .Xr setlocale 3 ,
15574 .Xr aliases 5 ,
15575 .Xr termcap 5 ,
15576 .Xr terminfo 5 ,
15577 .Xr locale 7 ,
15578 .Xr mailaddr 7 ,
15579 .Xr re_format 7
15580 .Pf (or\0 Xr regex 7 ) ,
15581 .Xr mailwrapper 8 ,
15582 .Xr sendmail 8
15584 .\" }}}
15587 .\" .Sh HISTORY {{{
15588 .Sh HISTORY
15590 M. Douglas McIlroy writes in his article
15591 .Dq A Research UNIX Reader: Annotated Excerpts \
15592 from the Programmer's Manual, 1971-1986
15593 that a
15594 .Xr mail 1
15595 command already appeared in First Edition
15597 in 1971:
15599 .Bd -ragged -offset indent
15600 Electronic mail was there from the start.
15601 Never satisfied with its exact behavior, everybody touched it at one
15602 time or another: to assure the safety of simultaneous access, to improve
15603 privacy, to survive crashes, to exploit uucp, to screen out foreign
15604 freeloaders, or whatever.
15605 Not until v7 did the interface change (Thompson).
15606 Later, as mail became global in its reach, Dave Presotto took charge and
15607 brought order to communications with a grab-bag of external networks
15608 (v8).
15613 Mail, in large parts compatible with
15615 mail, was written in 1978 by Kurt Shoens and developed as part of the
15618 distribution until 1995.
15619 This manual page is derived from
15620 .Dq The Mail Reference Manual
15621 that Kurt Shoens wrote for Mail 1.3, included in 3BSD in 1980.
15622 The common
15626 denominator became standardized as
15627 .Xr mailx 1
15628 in the X/Open Portability Guide Issue 2 (January 1987).
15629 After the rise of Open Source
15631 variants
15632 Mail saw continuous development in the individual code forks,
15633 noticeably by Christos Zoulas in
15634 .Pf Net Bx .
15635 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
15636 Ritter in the years 2000 until 2008.
15637 Since 2012 S-nail is maintained by Steffen Nurpmeso.
15640 Electronic mail exchange in general is a concept even older.
15641 The earliest well documented electronic mail system was part of the
15642 Compatible Time Sharing System (CTSS) at MIT, its MAIL command had been
15643 proposed in a staff planning memo at the end of 1964 and was implemented
15644 in mid-1965 when Tom Van Vleck and Noel Morris wrote the necessary code.
15645 Similar communication programs were built for other timesharing systems.
15646 One of the most ambitious and influential was Murray Turoff's EMISARI.
15647 Created in 1971 for the United States Office of Emergency Preparedness,
15648 EMISARI combined private electronic messages with a chat system, public
15649 postings, voting, and a user directory.
15652 During the 1960s it was common to connect a large number of terminals to
15653 a single, central computer.
15654 Connecting two computers together was relatively unusual.
15655 This began to change with the development of the ARPANET, the ancestor
15656 of today's Internet.
15657 In 1971 Ray Tomlinson adapted the SNDMSG program, originally developed
15658 for the University of California at Berkeley timesharing system, to give
15659 it the ability to transmit a message across the network into the mailbox
15660 of a user on a different computer.
15661 For the first time it was necessary to specify the recipient's computer
15662 as well as an account name.
15663 Tomlinson decided that the underused commercial at
15664 .Ql @
15665 would work to separate the two.
15668 Sending a message across the network was originally treated as a special
15669 instance of transmitting a file, and so a MAIL command was included in
15670 RFC 385 on file transfer in 1972.
15671 Because it was not always clear when or where a message had come from,
15672 RFC 561 in 1973 aimed to formalize electronic mail headers, including
15673 .Dq from ,
15674 .Dq date ,
15676 .Dq subject .
15677 In 1975 RFC 680 described fields to help with the transmission of
15678 messages to multiple users, including
15679 .Dq to ,
15680 .Dq cc ,
15682 .Dq bcc .
15683 In 1977 these features and others went from best practices to a binding
15684 standard in RFC 733.
15685 Queen Elizabeth II of England became the first head of state to send
15686 electronic mail on March 26 1976 while ceremonially opening a building
15687 in the British Royal Signals and Radar Establishment (RSRE) in Malvern.
15688 .\" }}}
15691 .Sh AUTHORS
15693 .An -nosplit
15694 .An "Kurt Shoens" ,
15695 .An "Edward Wang" ,
15696 .An "Keith Bostic" ,
15697 .An "Christos Zoulas" ,
15698 .An "Gunnar Ritter" .
15699 \*(UA is developed by
15700 .An "Steffen Nurpmeso" Aq s-mailx@lists.sdaoden.eu .
15703 .\" .Sh CAVEATS {{{
15704 .Sh CAVEATS
15706 \*(ID Interrupting an operation via
15707 .Dv \&\&SIGINT
15709 .Ql control-C
15710 from anywhere else but a command prompt is very problematic and likely
15711 to leave the program in an undefined state: many library functions
15712 cannot deal with the
15713 .Fn siglongjmp 3
15714 that this software (still) performs; even though efforts have been taken
15715 to address this, no sooner but in v15 it will have been worked out:
15716 interruptions have not been disabled in order to allow forceful breakage
15717 of hanging network connections, for example (all this is unrelated to
15718 .Va ignore ) .
15721 The SMTP and POP3 protocol support of \*(UA is very basic.
15722 Also, if it fails to contact its upstream SMTP server, it will not make
15723 further attempts to transfer the message at a later time (setting
15724 .Va save
15726 .Va sendwait
15727 may be useful).
15728 If this is a concern, it might be better to set up a local SMTP server
15729 that is capable of message queuing.
15731 .\" }}}
15734 .Sh BUGS
15736 When a network-based mailbox is open, directly changing to another
15737 network-based mailbox of a different protocol (i.e., from POP3 to IMAP
15738 or vice versa) will cause a
15739 .Dq deadlock .
15742 After deleting some message of a POP3 mailbox the header summary falsely
15743 claims that there are no messages to display, one needs to perform
15744 a scroll or dot movement to restore proper state.
15748 .Ql thread Ns
15750 .Ic sort
15751 mode a power user may encounter crashes very occasionally (this is may
15752 and very).
15755 Please report bugs to the
15756 .Va contact-mail
15757 address, for example from within \*(uA:
15758 .\" v15-compat: drop eval as `mail' will expand variable?
15759 .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
15760 Including the
15761 .Va verbose
15762 output of the command
15763 .Ic version
15764 may be helpful:
15766 .Bd -literal -offset indent
15767 ? wysh set escape=! verbose; vput version xy; unset verbose;\e
15768   eval mail $contact-mail
15769 Bug subject
15770 !I xy
15775 Information on the web at
15776 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ; x' .
15778 .\" s-ts-mode