Bump S-nail v14.9.24 ("Black ships ate the sky"), 2022-03-26
[s-mailx.git] / nail.1
blob636470a877cb29804047489a15924f495c9f5f7f
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.24 / 2022-03-26
20 .Dd March 26, 2022
21 .ds VV \\%v14.9.24
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 there is a built-in default set,
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 and listed 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.
1549 Note plain text parts will always be preferred in
1550 .Ql multipart/alternative
1551 MIME messages unless
1552 .Va mime-alternative-favour-rich
1553 is set.
1556 Whereas a simple HTML-to-text filter for displaying HTML messages is
1557 \*(OPally supported (indicated by
1558 .Ql ,+filter-html-tagsoup,
1560 .Va features ) ,
1561 MIME types other than plain text cannot be handled directly.
1562 To deal with specific non-text MIME types or file extensions programs
1563 need to be registered which either prepare (re-)integrable plain text
1564 versions of their input (a mode which is called
1565 .Cd copiousoutput ) ,
1566 or display the content externally, for example in a graphical window:
1567 the latter type is only considered by and for the command
1568 .Ic mimeview .
1571 To install a handler program for a MIME type an according
1572 .Va pipe-TYPE/SUBTYPE
1573 variable needs to be set; to define a handler for a file extension
1574 .Va pipe-EXTENSION
1575 can be used \(en these handlers take precedence.
1576 \*(OPally mail user agent configuration is supported (see
1577 .Sx "The Mailcap files" ) ,
1578 and will be queried for display or quote handlers after the former ones.
1579 Type-markers registered via
1580 .Ic mimetype
1581 are the last possible source for information how to handle a MIME type.
1584 For example, to display HTML messages integrated via the text browsers
1585 .Xr lynx 1
1587 .Xr elinks 1 ,
1588 register a MathML MIME type and enable its plain text display, and to
1589 open PDF attachments in an external PDF viewer, asynchronously and with
1590 some other magic attached:
1592 .Bd -literal -offset indent
1593 ? if "$features" !% ,+filter-html-tagsoup,
1594 ?   #set pipe-text/html='?* elinks -force-html -dump 1'
1595 ?   set pipe-text/html='?* lynx -stdin -dump -force_html'
1596 ?   # Display HTML as plain text instead
1597 ?   #set pipe-text/html=?t
1598 ? endif
1600 ? mimetype ?t application/mathml+xml mathml
1602 ? wysh set pipe-application/pdf='?&=? \e
1603     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1604     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1605     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1607 ? define showhtml {
1608 ?   \elocalopts yes
1609 ?   \eset mime-alternative-favour-rich pipe-text/html=?h?
1610 ?   \etype "$@"
1611 ? }
1612 ? \ecommandalias html \e\ecall showhtml
1614 .\" }}}
1616 .\" .Ss "Mailing lists" {{{
1617 .Ss "Mailing lists"
1619 Known or subscribed-to mailing lists may be flagged in the summary of
1620 .Ic headers
1621 .Pf ( Va headline
1622 format character
1623 .Ql %L ) ,
1624 and will gain special treatment when sending mails: the variable
1625 .Va followup-to-honour
1626 will ensure that a
1627 .Ql Mail-\:Followup-\:To:
1628 header is honoured when a message is being replied to
1629 .Pf ( Ic reply ,
1630 .Ic followup ,
1631 .Ic Lreply ,
1632 .Ic Lfollowup ) ,
1634 .Va followup-to
1635 controls creation of this header when creating
1636 .Ic mail Ns
1637 s, if the necessary user setup
1638 .Pf ( from , sender ) ;
1639 is available; then, it may also be created automatically, for example
1640 when list-replying via
1641 .Ic Lreply
1643 .Ic Lfollowup ,
1644 when
1645 .Ic followup
1647 .Ic reply
1648 is used and the messages
1649 .Ql Mail-Followup-To:
1650 is honoured etc.
1653 The commands
1654 .Ic mlist
1656 .Ic mlsubscribe
1657 manage \*(UAs notion of which addresses are mailing lists.
1658 With the \*(OPal regular expression support any address
1659 .Mx -ix "magic regular expression characters"
1660 which contains any of the magic regular expression characters
1661 .Ql ( ^[*+?|$ ;
1663 .Xr re_format 7
1665 .Xr regex 7 ,
1666 dependent on the host system)
1667 will be compiled and used as one, possibly matching many addresses.
1668 It is not possible to escape the
1669 .Dq magic :
1670 in order to match special characters as-is, bracket expressions must be
1671 used, for example
1672 .Ql Ic search Li @subject@'[[]open bracket' .
1674 .Bd -literal -offset indent
1675 ? set followup-to followup-to-honour=ask-yes \e
1676     reply-to-honour=ask-yes
1677 ? mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1678 ? mlsubscribe a4@b4.c4 exact@lists.c3
1682 Known and subscribed lists differ in that for the latter the
1683 .Va user Ns
1684 s address is not part of a generated
1685 .Ql Mail-Followup-To: .
1686 There are exceptions, for example if multiple lists are addressed and
1687 not all have the subscription attribute.
1688 When replying to a message its list address
1689 .Pf ( Ql List-Post:
1690 header) is automatically and temporarily treated like a known
1691 .Ic mlist ;
1692 dependent on the variable
1693 .Va reply-to-honour
1694 an existing
1695 .Ql Reply-To:
1696 is used instead (if it is a single address on the same domain as
1697 .Ql List-Post: )
1698 in order to accept a list administrator's wish that is supposed to have
1699 been manifested like that.
1702 For convenience and compatibility with mail programs that do not honour
1703 the non-standard M-F-T, an automatic user entry in the carbon-copy
1704 .Ql Cc:
1705 address list of generated message can be created by setting
1706 .Va followup-to-add-cc .
1707 This entry will be added whenever the user will be placed in the
1708 .Ql Mail-Followup-To:
1709 list, and is not a regular addressee already.
1710 .Va reply-to-swap-in
1711 tries to deal with the address rewriting that many mailing-lists nowadays
1712 perform to work around DKIM / DMARC etc. standard imposed problems.
1713 .\" }}}
1715 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1716 .Ss "Signed and encrypted messages with S/MIME"
1718 \*(OP S/MIME provides two central mechanisms:
1719 message signing and message encryption.
1720 A signed message contains some data in addition to the regular text.
1721 The data can be used to verify that the message has been sent using
1722 a valid certificate, that the sender address matches that in the
1723 certificate, and that the message text has not been altered.
1724 Signing a message does not change its regular text;
1725 it can be read regardless of whether the recipients software is able to
1726 handle S/MIME.
1727 It is thus usually possible to sign all outgoing messages if so desired.
1730 Encryption, in contrast, makes the message text invisible for all people
1731 except those who have access to the secret decryption key.
1732 To encrypt a message, the specific recipients public encryption key
1733 must be known.
1734 It is therefore not possible to send encrypted mail to people unless their
1735 key has been retrieved from either previous communication or public key
1736 directories.
1737 Because signing is performed with private keys, and encryption with
1738 public keys, messages should always be signed before being encrypted.
1741 A central concept to S/MIME is that of the certification authority (CA).
1742 A CA is a trusted institution that issues certificates.
1743 For each of these certificates it can be verified that it really
1744 originates from the CA, provided that the CA's own certificate is
1745 previously known.
1746 A set of CA certificates is usually delivered and installed together
1747 with the cryptographical library that is used on the local system.
1748 Therefore reasonable security for S/MIME on the Internet is provided if
1749 the source that provides that library installation is trusted.
1750 It is also possible to use a specific pool of trusted certificates.
1751 If this is desired,
1752 .Va smime-ca-no-defaults
1753 should be set to avoid using the default certificate pool, and
1754 .Va smime-ca-file
1755 and/or
1756 .Va smime-ca-dir
1757 should be pointed to a trusted pool of certificates.
1758 A certificate cannot be more secure than the method its CA certificate
1759 has been retrieved with.
1762 This trusted pool of certificates is used by the command
1763 .Ic verify
1764 to ensure that the given S/MIME messages can be trusted.
1765 If so, verified sender certificates that were embedded in signed
1766 messages can be saved locally with the command
1767 .Ic certsave ,
1768 and used by \*(UA to encrypt further communication with these senders:
1770 .Bd -literal -offset indent
1771 ? certsave FILENAME
1772 ? set smime-encrypt-USER@HOST=FILENAME \e
1773     smime-cipher-USER@HOST=AES256
1777 To sign outgoing messages, in order to allow receivers to verify the
1778 origin of these messages, a personal S/MIME certificate is required.
1779 \*(UA supports password-protected personal certificates (and keys), see
1780 .Va smime-sign-cert .
1781 The section
1782 .Sx "On URL syntax and credential lookup"
1783 gives an overview of the possible sources of user credentials, and
1784 .Sx "S/MIME step by step"
1785 shows examplarily how a private S/MIME certificate can be obtained.
1786 In general, if such a private key plus certificate
1787 .Dq pair
1788 is available, all that needs to be done is to set some variables:
1790 .Bd -literal -offset indent
1791 ? set smime-sign-cert=ME@exam.ple.paired \e
1792     smime-sign-digest=SHA512 \e
1793     smime-sign from=myname@my.host
1797 Variables of interest for S/MIME in general are
1798 .Va smime-ca-dir ,
1799 .Va smime-ca-file ,
1800 .Va smime-ca-flags ,
1801 .Va smime-ca-no-defaults ,
1802 .Va smime-crl-dir ,
1803 .Va smime-crl-file .
1804 For S/MIME signing of interest are
1805 .Va smime-sign ,
1806 .Va smime-sign-cert ,
1807 .Va smime-sign-include-certs
1809 .Va smime-sign-digest .
1810 Additional variables of interest for S/MIME en- and decryption:
1811 .Va smime-cipher
1813 .Va smime-encrypt-USER@HOST .
1814 Variables of secondary interest may be
1815 .Va content-description-smime-message
1817 .Va content-description-smime-signature .
1818 S/MIME is available if
1819 .Ql ,+smime,
1820 is included in
1821 .Va features .
1824 \*(ID Note that neither S/MIME signing nor encryption applies to
1825 message subjects or other header fields yet.
1826 Thus they may not contain sensitive information for encrypted messages,
1827 and cannot be trusted even if the message content has been verified.
1828 When sending signed messages,
1829 it is recommended to repeat any important header information in the
1830 message text.
1831 .\" }}}
1833 .\" .Ss "On URL syntax and credential lookup" {{{ review
1834 .Ss "On URL syntax and credential lookup"
1836 For accessing protocol-specific resources Uniform Resource Locators
1837 (URL, RFC 3986) have become omnipresent.
1838 Here they are expected in a
1839 .Dq normalized
1840 variant, not used in data exchange, but only meant as a compact,
1841 easy-to-use way of defining and representing information in a well-known
1842 notation; as such they do not conform to any real standard.
1843 Optional parts are placed in brackets
1844 .Ql [] ,
1845 optional either because there also exist other ways to define the
1846 information, or because the part is protocol specific.
1847 .Ql /path
1848 for example is used by the \*(OPal Maildir
1849 .Ic folder
1850 type and the IMAP protocol, but not by POP3.
1852 .Ql USER
1854 .Ql PASSWORD
1855 are included in an URL server specification, URL percent encoded
1856 (RFC 3986) forms are needed, generable with
1857 .Ic urlcodec .
1860 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1863 Often
1864 .Sx "INTERNAL VARIABLES"
1865 exist in multiple versions, called
1866 .Dq variable chains
1867 in this document: the plain
1868 .Ql variable
1869 as well as
1870 .Ql variable-HOST
1872 .Ql variable-USER@HOST .
1873 If a port was specified
1874 .Ql HOST
1875 really means
1876 .Ql server:port ,
1878 .Ql server .
1879 And this
1880 .Ql USER
1881 is never in URL percent encoded form.
1882 For example, whether the hypothetical
1883 .Ql smtp://\:wings\:%3A\:of\:@a.dove
1884 including user and password was used, or whether it was
1885 .Ql smtp://a.dove
1886 and it came from a different source, to lookup the chain
1887 .Va tls-config-pairs
1888 first
1889 .Ql tls-\:config-\:pairs-\:wings:of@a.dove
1890 is looked up, then
1891 .Ql tls-\:config-pairs\-\:a.dove ,
1892 before finally looking up the plain variable.
1895 The logic to collect (an
1896 .Ic account Ns
1897 s) credential information is as follows:
1899 .Bl -bullet
1901 A user is always required.
1902 If no
1903 .Ql USER
1904 has been given in the URL the variables
1905 .Va user-HOST
1907 .Va user
1908 are looked up.
1909 Afterwards, when enforced by the \*(OPal variables
1910 .Va netrc-lookup-HOST
1912 .Va netrc-lookup ,
1913 .Sx "The .netrc file"
1914 of the user will be searched for a
1915 .Ql HOST
1916 specific entry which provides a
1917 .Ql login
1918 name: only unambiguous entries are used (one possible matching entry for
1919 .Ql HOST ) .
1921 If there is still no
1922 .Ql USER
1923 then the verified
1924 .Ev LOGNAME ,
1925 known to be a valid user on the current host, is used.
1928 Authentication: unless otherwise noted the chain
1929 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1930 is checked, falling back to a protocol-specific default as necessary.
1933 If no
1934 .Ql PASSWORD
1935 has been given in the URL, then if the
1936 .Ql USER
1937 has been found through the \*(OPal
1938 .Va netrc-lookup ,
1939 that may have also provided the password.
1940 Otherwise the chain
1941 .Va password-USER@HOST , password-HOST , password
1942 is looked up.
1944 Thereafter the (now complete) \*(OPal chain
1945 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1946 is checked, if set the
1947 .Ic netrc
1948 cache is searched for a password only (multiple user accounts for
1949 a single machine may exist as well as a fallback entry without user
1950 but with a password).
1952 If at that point there is still no password available, but the
1953 (protocols') chosen authentication type requires a password, then in
1954 interactive mode the user will be prompted on the terminal.
1958 .Sy Note:
1959 S/MIME verification works relative to the values found in the
1960 .Ql From:
1962 .Ql Sender: )
1963 header field(s), which means the values of
1964 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1966 .Va smime-sign-digest
1967 will not be looked up using the
1968 .Ql USER
1970 .Ql HOST
1971 chains from above, but instead use the corresponding values from the
1972 message that is being worked on.
1973 If no address matches we assume and use the setting of
1974 .Va from .
1975 In unusual cases multiple and different
1976 .Ql USER
1978 .Ql HOST
1979 combinations may therefore be involved \(en on the other hand those
1980 unusual cases become possible.
1981 The usual case is as short as:
1983 .Bd -literal -offset indent
1984 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1985     smime-sign smime-sign-cert=+smime.pair \e
1986     from=myname@my.host
1990 The section
1991 .Sx EXAMPLES
1992 contains complete example configurations.
1993 .\" }}}
1995 .\" .Ss "Encrypted network communication" {{{ review
1996 .Ss "Encrypted network communication"
1998 \*(OP SSL (Secure Sockets Layer) aka its successor TLS (Transport Layer
1999 Security) are protocols which aid in securing communication by providing
2000 a safely initiated and encrypted network connection.
2001 A central concept of TLS are certificates: as part of each network
2002 connection setup a (set of) certificates will be exchanged through which
2003 the identity of the network peer can be cryptographically verified;
2004 if possible the TLS/SNI (ServerNameIndication) extension will be enabled
2005 to allow servers fine-grained control over the certificates being used.
2006 A locally installed pool of trusted certificates will then be inspected,
2007 and verification will succeed if it contains a(n in)direct signer of the
2008 presented certificate(s).
2011 The local pool of trusted so-called CA (Certification Authority)
2012 certificates is usually delivered with and used along the TLS library.
2013 A custom pool of trusted certificates can be selected by pointing
2014 .Va tls-ca-file
2015 and/or (with special preparation)
2016 .Va tls-ca-dir
2017 to the desired location; setting
2018 .Va tls-ca-no-defaults
2019 in addition will avoid additional inspection of the default pool.
2020 A certificate cannot be more secure than the method its CA certificate
2021 has been retrieved with.
2022 For inspection or other purposes, the certificate of a server (as seen
2023 when connecting to it) can be fetched with the command
2024 .Ic tls
2025 (port can usually be the protocol name, too, and
2026 .Va tls-verify
2027 is taken into account here):
2029 .Bd -literal -offset indent
2030 $ \*(uA -vX 'tls certchain SERVER-URL[:PORT]; x'
2034 A local pool of CA certificates is not strictly necessary, however,
2035 server certificates can also be verified via their fingerprint.
2036 For this a message digest will be calculated and compared against the
2037 variable chain
2038 .Va tls-fingerprint ,
2039 and verification will succeed if the fingerprint matches.
2040 The message digest (algorithm) can be configured via the variable chain
2041 .Va tls-fingerprint-digest ;
2042 .Ic tls
2043 can again be used:
2045 .Bd -literal -offset indent
2046 $ \*(uA -X 'wysh set verbose; tls fingerprint SERVER-URL[:PORT]; x'
2050 It depends on the used protocol whether encrypted communication is
2051 possible, and which configuration steps have to be taken to enable it.
2052 Some protocols, like POP3S, are implicitly encrypted, others, like
2053 POP3, can upgrade a plain text connection if so requested.
2054 For example, to use the
2055 .Ql STLS
2056 that POP3 offers (a member of) the variable (chain)
2057 .Va pop3-use-starttls
2058 needs to be set, with convenience via
2059 .Ic shortcut :
2061 .Bd -literal -offset indent
2062 shortcut encpop1 pop3s://pop1.exam.ple
2064 shortcut encpop2 pop3://pop2.exam.ple
2065 set pop3-use-starttls-pop2.exam.ple
2067 set mta=smtps://smtp.exam.ple:465
2068 set mta=smtp://smtp.exam.ple smtp-use-starttls
2072 Normally that is all there is to do, given that TLS libraries try to
2073 provide safe defaults, plenty of knobs however exist to adjust settings.
2074 For example certificate verification settings can be fine-tuned via
2075 .Va tls-ca-flags ,
2076 and the TLS configuration basics are accessible via
2077 .Va tls-config-pairs ,
2078 for example to control protocol versions or cipher lists.
2079 In the past hints on how to restrict the set of protocols to highly
2080 secure ones were indicated, but as of the time of this writing the list
2081 of protocols or ciphers may need to become relaxed in order to be able
2082 to connect to some servers; the following example allows connecting to a
2083 .Dq Lion
2084 that uses OpenSSL 0.9.8za from June 2014 (refer to
2085 .Sx "INTERNAL VARIABLES"
2086 for more on variable chains):
2088 .Bd -literal -offset indent
2089 wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e
2090     CipherString=TLSv1.2:!aNULL:!eNULL:\e
2091       ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
2092       DHE-RSA-AES256-SHA:@STRENGTH'
2096 The OpenSSL program
2097 .Xr ciphers 1
2098 should be referred to when creating a custom cipher list.
2099 Variables of interest for TLS in general are
2100 .Va tls-ca-dir ,
2101 .Va tls-ca-file ,
2102 .Va tls-ca-flags ,
2103 .Va tls-ca-no-defaults ,
2104 .Va tls-config-file ,
2105 .Va tls-config-module ,
2106 .Va tls-config-pairs ,
2107 .Va tls-crl-dir ,
2108 .Va tls-crl-file ,
2109 .Va tls-rand-file
2110 as well as
2111 .Va tls-verify .
2112 Also see
2113 .Va tls-features .
2114 TLS is available if
2115 .Ql +tls
2116 is included in
2117 .Va features .
2118 .\" }}}
2120 .\" .Ss "Character sets" review {{{
2121 .Ss "Character sets"
2123 \*(OP The user's locale environment is detected by looking at the
2124 .Ev LC_ALL
2125 environment variable.
2126 The internal variable
2127 .Va ttycharset
2128 will be set to the detected terminal character set accordingly,
2129 and will thus show up in the output of commands like
2130 .Ic set
2132 .Ic varshow .
2133 This character set will be targeted when trying to display data,
2134 and user input data is expected to be in this character set, too.
2137 When creating messages their character input data is classified.
2138 7-bit clean text data and attachments will be classified as
2139 .Va charset-7bit .
2140 8-bit data will \*(OPally be converted into members of
2141 .Va sendcharsets
2142 until a character set conversion succeeds.
2143 .Va charset-8bit
2144 is the implied default last member of this list.
2145 If no 8-bit character set is capable to represent input data,
2146 no message will be sent, and its text will optionally be
2147 .Va save Ns d
2149 .Ev DEAD .
2150 If that is not acceptable, for example in script environments,
2151 .Va mime-force-sendout
2152 can be set to force sending of non-convertible data as
2153 .Ql application/octet-stream
2154 classified binary content instead: like this receivers still have the
2155 option to inspect message content (for example via
2156 .Va mime-counter-evidence ) .
2157 If the \*(OPal character set conversion is not available
2158 .Pf ( Va features
2159 misses
2160 .Ql ,+iconv, ) ,
2161 .Va ttycharset
2162 is the only supported character set for non 7-bit clean data, and
2163 it is simply assumed it can be used to exchange 8-bit messages.
2166 .Va ttycharset
2167 may also be given an explicit value to send mail in a completely
2168 .Dq faked
2169 locale environment, which can be used to generate and send for
2170 example 8-bit UTF-8 input data in a pure 7-bit US-ASCII
2171 .Ql LC_ALL=C
2172 environment (an example of this can be found in the section
2173 .Sx "On sending mail, and non-interactive mode" ) .
2174 Due to lack of programming interfaces reading mail will not really work
2175 as expected in a faked environment: whereas
2176 .Va ttycharset
2177 might be addressable, any output will be made safely printable, as via
2178 .Ic vexpr
2179 .Cm makeprint ,
2180 according to the actual locale environment, which is not affected by
2181 .Va ttycharset.
2184 Classifying 7-bit clean data as
2185 .Va charset-7bit
2186 is a problem if the input character set
2187 .Pf ( Va ttycharset )
2188 is a multibyte character set that is itself 7-bit clean.
2189 For example, the Japanese character set ISO-2022-JP is, but is capable
2190 to encode the rich set of Japanese Kanji, Hiragana and Katakana
2191 characters: in order to notify receivers of this character set the mail
2192 message must be MIME encoded so that the character set ISO-2022-JP can
2193 be advertised, otherwise an invalid email message would result!
2194 To achieve this, the variable
2195 .Va charset-7bit
2196 can be set to ISO-2022-JP.
2197 (Today a better approach regarding email is the usage of UTF-8, which
2198 uses 8-bit bytes for non-US-ASCII data.)
2201 When replying to a message and the variable
2202 .Va reply-in-same-charset
2203 is set, the character set of the message being replied to is tried first
2204 as a target character set (still being a subject of
2205 .Ic charsetalias
2206 filtering, however).
2207 Another opportunity is
2208 .Va sendcharsets-else-ttycharset
2209 to reflect the user's locale environment automatically, it will treat
2210 .Va ttycharset
2211 as an implied member of (an unset)
2212 .Va sendcharsets .
2215 \*(OP When reading messages, their text data is converted into
2216 .Va ttycharset
2217 as necessary in order to display them on the user's terminal.
2218 Unprintable characters and invalid byte sequences are detected
2219 and replaced by substitution characters.
2220 Character set mappings for source character sets can be established with
2221 .Ic charsetalias ,
2222 which may be handy to work around faulty or incomplete character set
2223 catalogues (one could for example add a missing LATIN1 to ISO-8859-1
2224 mapping), or to enforce treatment of one character set as another one
2225 .Pf ( Dq interpret LATIN1 as CP1252 ) .
2226 Also see
2227 .Va charset-unknown-8bit
2228 to deal with another hairy aspect of message interpretation.
2231 In general, if a message saying
2232 .Dq cannot convert from a to b
2233 appears, either some characters are not appropriate for the currently
2234 selected (terminal) character set,
2235 or the needed conversion is not supported by the system.
2236 In the first case, it is necessary to set an appropriate
2237 .Ev LC_CTYPE
2238 locale and/or the variable
2239 .Va ttycharset .
2240 The best results are usually achieved when running in a UTF-8
2241 locale on a UTF-8 capable terminal, in which case the full Unicode
2242 spectrum of characters is available.
2243 In this setup characters from various countries can be displayed,
2244 while it is still possible to use more simple character sets for sending
2245 to retain maximum compatibility with older mail clients.
2248 On the other hand the POSIX standard defines a locale-independent 7-bit
2249 .Dq portable character set
2250 that should be used when overall portability is an issue, the even more
2251 restricted subset named
2252 .Dq portable filename character set
2253 consists of A-Z, a-z, 0-9, period
2254 .Ql \&. ,
2255 underscore
2256 .Ql _
2257 and hyphen-minus
2258 .Ql - .
2259 .\" }}}
2261 .\" .Ss "Message states" {{{
2262 .Ss "Message states"
2264 \*(UA differentiates in between several message states; the current
2265 state will be reflected in the summary of
2266 .Ic headers
2267 if the
2268 .Va attrlist
2269 of the configured
2270 .Va headline
2271 allows, and
2272 .Sx "Specifying messages"
2273 dependent on their state is possible.
2274 When operating on the system
2275 .Va inbox ,
2276 or in any other
2277 .Mx -sx
2278 .Sx "primary system mailbox" ,
2279 special actions, like the automatic moving of messages to the
2280 .Mx -sx
2281 .Sx "secondary mailbox"
2282 .Ev MBOX ,
2283 may be applied when the mailbox is left (also implicitly by program
2284 termination, unless the command
2285 .Ic exit
2286 was used) \(en however, because this may be irritating to users which
2287 are used to
2288 .Dq more modern
2289 mail-user-agents, the provided global
2290 .Pa \*(UR
2291 template sets the internal
2292 .Va hold
2294 .Va keepsave
2295 variables in order to suppress this behaviour.
2297 .Bl -hang -width ".It Ql new"
2298 .It Ql new
2299 Message has neither been viewed nor moved to any other state.
2300 Such messages are retained even in the
2301 .Mx -sx
2302 .Sx "primary system mailbox" .
2304 .It Ql unread
2305 Message has neither been viewed nor moved to any other state, but the
2306 message was present already when the mailbox has been opened last:
2307 Such messages are retained even in the
2308 .Mx -sx
2309 .Sx "primary system mailbox" .
2311 .It Ql read
2312 The message has been processed by one of the following commands:
2313 .Ic ~f ,
2314 .Ic ~m ,
2315 .Ic ~F ,
2316 .Ic ~M ,
2317 .Ic copy ,
2318 .Ic mbox ,
2319 .Ic next ,
2320 .Ic pipe  ,
2321 .Ic Print ,
2322 .Ic print ,
2323 .Ic top ,
2324 .Ic Type ,
2325 .Ic type ,
2326 .Ic undelete .
2327 The commands
2328 .Ic dp
2330 .Ic dt
2331 will always try to automatically
2332 .Dq step
2334 .Ic type
2336 .Dq next
2337 logical message, and may thus mark multiple messages as read, the
2338 .Ic delete
2339 command will do so if the internal variable
2340 .Va autoprint
2341 is set.
2343 Except when the
2344 .Ic exit
2345 command is used, messages that are in a
2346 .Mx -sx
2347 .Sx "primary system mailbox"
2348 and are in
2349 .Ql read
2350 state when the mailbox is left will be saved in the
2351 .Mx -sx
2352 .Sx "secondary mailbox"
2353 .Ev MBOX
2354 unless the internal variable
2355 .Va hold
2356 it set.
2358 .It Ql deleted
2359 The message has been processed by one of the following commands:
2360 .Ic delete ,
2361 .Ic dp ,
2362 .Ic dt .
2363 Only
2364 .Ic undelete
2365 can be used to access such messages.
2367 .It Ql preserved
2368 The message has been processed by a
2369 .Ic preserve
2370 command and it will be retained in its current location.
2372 .It Ql saved
2373 The message has been processed by one of the following commands:
2374 .Ic save
2376 .Ic write .
2377 Unless when the
2378 .Ic exit
2379 command is used, messages that are in a
2380 .Mx -sx
2381 .Sx "primary system mailbox"
2382 and are in
2383 .Ql saved
2384 state when the mailbox is left will be deleted; they will be saved in the
2385 .Mx -sx
2386 .Sx "secondary mailbox"
2387 .Ev MBOX
2388 when the internal variable
2389 .Va keepsave
2390 is set.
2394 In addition to these message states, flags which otherwise have no
2395 technical meaning in the mail system except allowing special ways of
2396 addressing them when
2397 .Sx "Specifying messages"
2398 can be set on messages.
2399 These flags are saved with messages and are thus persistent, and are
2400 portable between a set of widely used MUAs.
2402 .Bl -hang -width ".It Ic answered"
2403 .It Ic answered
2404 Mark messages as having been answered.
2405 .It Ic draft
2406 Mark messages as being a draft.
2407 .It Ic flag
2408 Mark messages which need special attention.
2410 .\" }}}
2412 .\" .Ss "Specifying messages" {{{
2413 .Ss "Specifying messages"
2415 \*(NQ
2416 .Ic COMMANDS
2417 which take
2418 .Sx "Message list arguments" ,
2419 such as
2420 .Ic search ,
2421 .Ic type ,
2422 .Ic copy ,
2424 .Ic delete ,
2425 can perform actions on a number of messages at once.
2426 Specifying invalid messages, or using illegal syntax, will cause errors
2427 to be reported through the
2428 .Sx "INTERNAL VARIABLES"
2429 .Va \&! ,
2430 .Va ^ERR
2431 and companions, as well as the command exit status
2432 .Va \&? .
2435 For example,
2436 .Ql delete 1 2
2437 deletes the messages 1 and 2,
2438 whereas
2439 .Ql delete 1-5
2440 will delete the messages 1 through 5.
2441 In sorted or threaded mode (see the
2442 .Ic sort
2443 command),
2444 .Ql delete 1-5
2445 will delete the messages that are located between (and including)
2446 messages 1 through 5 in the sorted/threaded order, as shown in the
2447 .Ic headers
2448 summary.
2451 Errors can for example be
2452 .Va ^ERR Ns -BADMSG
2453 when requesting an invalid message,
2454 .Va ^ERR Ns -NOMSG
2455 if no applicable message can be found,
2456 .Va ^ERR Ns -CANCELED
2457 for missing informational data (mostly thread-related).
2458 .Va ^ERR Ns -INVAL
2459 for invalid syntax as well as
2460 .Va ^ERR Ns -IO
2461 for input/output errors can happen.
2462 The following special message names exist:
2465 .Bl -tag -width ".It Ar BaNg"
2466 .It Ar \&.
2467 The current message, the so-called
2468 .Dq dot .
2470 .It Ar \&;
2471 The message that was previously the current message; needs to be quoted.
2473 .It Ar \&,
2474 The parent message of the current message,
2475 that is the message with the Message-ID given in the
2476 .Ql In-Reply-To:
2477 field or the last entry of the
2478 .Ql References:
2479 field of the current message.
2481 .It Ar -
2482 The previous undeleted message, or the previous deleted message for the
2483 .Ic undelete
2484 command; In
2485 .Ic sort Ns
2486 ed or
2487 .Ql thread Ns
2488 ed mode, the previous such message in the according order.
2490 .It Ar +
2491 The next undeleted message, or the next deleted message for the
2492 .Ic undelete
2493 command; In
2494 .Ic sort Ns
2495 ed or
2496 .Ql thread Ns
2497 ed mode, the next such message in the according order.
2499 .It Ar ^
2500 The first undeleted message,
2501 or the first deleted message for the
2502 .Ic undelete
2503 command; In
2504 .Ic sort Ns
2505 ed or
2506 .Ql thread Ns
2507 ed mode, the first such message in the according order.
2509 .It Ar $
2510 The last message; In
2511 .Ic sort Ns
2512 ed or
2513 .Ql thread Ns
2514 ed mode, the last such message in the according order.
2515 Needs to be quoted.
2517 .It Ar & Ns Ar x
2519 .Ql thread Ns
2521 .Ic sort
2522 mode, selects the message addressed with
2523 .Ar x ,
2524 where
2525 .Ar x
2526 is any other message specification,
2527 and all messages from the thread that begins at it.
2528 Otherwise it is identical to
2529 .Ar x .
2531 .Ar x
2532 is omitted,
2533 the thread beginning with the current message is selected.
2535 .It Ar *
2536 All messages.
2538 .It Ar `
2539 All messages that were included in the
2540 .Sx "Message list arguments"
2541 of the previous command; needs to be quoted.
2542 (A convenient way to read all new messages is to select them via
2543 .Ql from :n ,
2544 as below, and then to read them in order with the default command \(em
2545 .Ic next
2546 \(em simply by successively typing
2547 .Ql ` ;
2548 for this to work
2549 .Va showlast
2550 must be set.)
2552 .It Ar x-y
2553 An inclusive range of message numbers.
2554 Selectors that may also be used as endpoints include any of
2555 .Ar .;-+^$ .
2557 .It Ar address
2558 A case-insensitive
2559 .Dq any substring matches
2560 search against the
2561 .Ql From:
2562 header, which will match addresses (too) even if
2563 .Va showname
2564 is set (and POSIX says
2565 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2566 However, if the
2567 .Va allnet
2568 variable is set, only the local part of the address is evaluated
2569 for the comparison, not ignoring case, and the setting of
2570 .Va showname
2571 is completely ignored.
2572 For finer control and match boundaries use the
2573 .Ql @
2574 search expression.
2576 .It Ar / Ns Ar string
2577 All messages that contain
2578 .Ar string
2579 in the subject field (case ignored according to locale).
2580 See also the
2581 .Va searchheaders
2582 variable.
2584 .Ar string
2585 is empty,
2586 the string from the previous specification of that type is used again.
2589 .It Xo Op Ar @ Ns Ar name-list Ns
2590 .Ar @ Ns Ar expr
2592 All messages that contain the given case-insensitive search
2593 .Ar expr Ns
2594 ession;  If the \*(OPal regular expression support is available
2595 .Ar expr
2596 will be interpreted as (an extended) one if any of the
2597 .Mx -sx
2598 .Sx "magic regular expression characters"
2599 is seen.
2600 If the optional
2601 .Ar @ Ns Ar name-list
2602 part is missing the search is restricted to the subject field body,
2603 but otherwise
2604 .Ar name-list
2605 specifies a comma-separated list of header fields to search, for example
2608 .Dl '@to,from,cc@Someone i ought to know'
2611 In order to search for a string that includes a
2612 .Ql @
2613 (commercial at) character the
2614 .Ar name-list
2615 is effectively non-optional, but may be given as the empty string.
2616 Also, specifying an empty search
2617 .Ar expr Ns
2618 ession will effectively test for existence of the given header fields.
2619 Some special header fields may be abbreviated:
2620 .Ql f ,
2621 .Ql t ,
2622 .Ql c ,
2623 .Ql b
2625 .Ql s
2626 will match
2627 .Ql From ,
2628 .Ql To ,
2629 .Ql Cc ,
2630 .Ql Bcc
2632 .Ql Subject ,
2633 respectively and case-insensitively.
2634 \*(OPally, and just like
2635 .Ar expr ,
2636 .Ar name-list
2637 will be interpreted as (an extended) regular expression if any of the
2638 .Mx -sx
2639 .Sx "magic regular expression characters"
2640 is seen.
2643 The special names
2644 .Ql header
2646 .Ql <
2647 can be used to search in (all of) the header(s) of the message, and the
2648 special names
2649 .Ql body
2651 .Ql >
2653 .Ql text
2655 .Ql =
2656 will perform full text searches \(en whereas the former searches only
2657 the body, the latter also searches the message header (\*(ID this mode
2658 yet brute force searches over the entire decoded content of messages,
2659 including administrativa strings).
2662 This specification performs full text comparison, but even with
2663 regular expression support it is almost impossible to write a search
2664 expression that safely matches only a specific address domain.
2665 To request that the body content of the header is treated as a list of
2666 addresses, and to strip those down to the plain email address which the
2667 search expression is to be matched against, prefix the effective
2668 .Ar name-list
2669 with a tilde
2670 .Ql ~ :
2673 .Dl '@~f,c@@a\e.safe\e.domain\e.match$'
2676 .It Ar :c
2677 All messages of state or with matching condition
2678 .Ql c ,
2679 where
2680 .Ql c
2681 is one or multiple of the following colon modifiers:
2683 .Bl -tag -compact -width ".It Ar :M"
2684 .It Ar a
2685 .Ic answered
2686 messages (cf. the variable
2687 .Va markanswered ) .
2688 .It Ar d
2689 .Ql deleted
2690 messages (for the
2691 .Ic undelete
2693 .Ic from
2694 commands only).
2695 .It Ar f
2696 .Ic flag Ns
2697 ged messages.
2698 .It Ar L
2699 Messages with receivers that match
2700 .Ic mlsubscribe Ns
2701 d addresses.
2702 .It Ar l
2703 Messages with receivers that match
2704 .Ic mlist Ns
2705 ed addresses.
2706 .It Ar n
2707 .Ql new
2708 messages.
2709 .It Ar o
2710 Old messages (any not in state
2711 .Ql read
2713 .Ql new ) .
2714 .It Ar r
2715 .Ql read
2716 messages.
2717 .It Ar S
2718 \*(OP Messages with unsure spam classification (see
2719 .Sx "Handling spam" ) .
2720 .It Ar s
2721 \*(OP Messages classified as spam.
2722 .It Ar t
2723 Messages marked as
2724 .Ic draft .
2725 .It Ar u
2726 .Ql unread
2727 messages.
2733 \*(OP IMAP-style SEARCH expressions may also be used.
2734 These consist of keywords and criterions, and because
2735 .Sx "Message list arguments"
2736 are split into tokens according to
2737 .Sx "Shell-style argument quoting"
2738 it is necessary to quote the entire IMAP search expression in order to
2739 ensure that it remains a single token.
2740 This addressing mode is available with all types of mailbox
2741 .Ic folder Ns
2742 s; \*(UA will perform the search locally as necessary.
2743 Strings must be enclosed by double quotation marks
2744 .Ql \&"
2745 in their entirety if they contain whitespace or parentheses;
2746 within the quotes, only reverse solidus
2747 .Ql \e
2748 is recognized as an escape character.
2749 All string searches are case-insensitive.
2750 When the description indicates that the
2751 .Dq envelope
2752 representation of an address field is used,
2753 this means that the search string is checked against both a list
2754 constructed as
2756 .Bd -literal -offset indent
2757 \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)'
2761 for each address,
2762 and the addresses without real names from the respective header field.
2763 These search expressions can be nested using parentheses, see below for
2764 examples.
2767 .Bl -tag -compact -width ".It Ar _n_u"
2768 .It Ar ( criterion )
2769 All messages that satisfy the given
2770 .Ar criterion .
2771 .It Ar ( criterion1 criterion2 ... criterionN )
2772 All messages that satisfy all of the given criteria.
2774 .It Ar ( or criterion1 criterion2 )
2775 All messages that satisfy either
2776 .Ar criterion1
2778 .Ar criterion2 ,
2779 or both.
2780 To connect more than two criteria using
2781 .Ql or
2782 specifications have to be nested using additional parentheses,
2783 as with
2784 .Ql (or a (or b c)) ,
2785 since
2786 .Ql (or a b c)
2787 really means
2788 .Ql ((a or b) and c) .
2789 For a simple
2790 .Ql or
2791 operation of independent criteria on the lowest nesting level,
2792 it is possible to achieve similar effects by using three separate
2793 criteria, as with
2794 .Ql (a) (b) (c) .
2796 .It Ar ( not criterion )
2797 All messages that do not satisfy
2798 .Ar criterion .
2799 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2800 All messages that contain
2801 .Ar string
2802 in the envelope representation of the
2803 .Ql Bcc:
2804 field.
2805 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2806 All messages that contain
2807 .Ar string
2808 in the envelope representation of the
2809 .Ql Cc:
2810 field.
2811 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2812 All messages that contain
2813 .Ar string
2814 in the envelope representation of the
2815 .Ql From:
2816 field.
2817 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2818 All messages that contain
2819 .Ar string
2820 in the
2821 .Ql Subject:
2822 field.
2823 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2824 All messages that contain
2825 .Ar string
2826 in the envelope representation of the
2827 .Ql To:
2828 field.
2829 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2830 All messages that contain
2831 .Ar string
2832 in the specified
2833 .Ql Name:
2834 field.
2835 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2836 All messages that contain
2837 .Ar string
2838 in their body.
2839 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2840 All messages that contain
2841 .Ar string
2842 in their header or body.
2843 .It Ar ( larger size )
2844 All messages that are larger than
2845 .Ar size
2846 (in bytes).
2847 .It Ar ( smaller size )
2848 All messages that are smaller than
2849 .Ar size
2850 (in bytes).
2852 .It Ar ( before date )
2853 All messages that were received before
2854 .Ar date ,
2855 which must be in the form
2856 .Ql d[d]-mon-yyyy ,
2857 where
2858 .Ql d
2859 denotes the day of the month as one or two digits,
2860 .Ql mon
2861 is the name of the month \(en one of
2862 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2864 .Ql yyyy
2865 is the year as four digits, for example
2866 .Ql 28-Dec-2012 .
2868 .It Ar ( on date )
2869 All messages that were received on the specified date.
2870 .It Ar ( since date )
2871 All messages that were received since the specified date.
2872 .It Ar ( sentbefore date )
2873 All messages that were sent on the specified date.
2874 .It Ar ( senton date )
2875 All messages that were sent on the specified date.
2876 .It Ar ( sentsince date )
2877 All messages that were sent since the specified date.
2878 .It Ar ()
2879 The same criterion as for the previous search.
2880 This specification cannot be used as part of another criterion.
2881 If the previous command line contained more than one independent
2882 criterion then the last of those criteria is used.
2884 .\" }}}
2886 .\" .Ss "On terminal control and line editor" {{{ review
2887 .Ss "On terminal control and line editor"
2889 \*(OP Terminal control through one of the standard
2891 libraries,
2892 .Lb libtermcap
2894 .Lb libterminfo ,
2895 may be available.
2896 For the
2897 .Ev TERM Ns
2898 inal defined in the environment interactive usage aspects, for example
2899 .Sx "Coloured display" ,
2900 and insight of cursor and function keys for the Mailx-Line-Editor
2901 (MLE), will be enhanced or enabled.
2902 Library interaction can be disabled on a per-invocation basis via
2903 .Va termcap-disable ,
2904 whereas the internal variable
2905 .Va termcap
2906 is always used as a preferred source of terminal capabilities.
2907 (For a usage example see the
2908 .Sx FAQ
2909 entry
2910 .Sx "Not \(dqdefunctional\(dq, but the editor key does not work" . )
2913 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2914 environments which comply to the ISO C standard
2915 .St -isoC-amd1 ,
2916 and will support wide glyphs if possible (the necessary functionality
2917 had been removed from ISO C, but was included in
2918 .St -xpg4 ) .
2919 Usage of a line editor in interactive mode can be prevented by setting
2920 .Va line-editor-disable .
2921 Especially if the \*(OPal terminal control support is missing setting
2922 entries in
2923 .Va termcap
2924 will help shall the MLE misbehave, see there for more.
2925 The MLE can support a little bit of
2926 .Ic colour .
2929 \*(OP If the
2930 .Ic history
2931 feature is available then input from line editor prompts will be saved
2932 in a history list that can be searched in and be expanded from.
2933 Such saving can be prevented by prefixing input with any amount of
2934 whitespace.
2935 Aspects of history, like allowed content and maximum size, as well as
2936 whether history shall be saved persistently, can be configured with the
2937 internal variables
2938 .Va history-file ,
2939 .Va history-gabby ,
2940 .Va history-gabby-persist
2942 .Va history-size .
2943 There also exists the macro hook
2944 .Va on-history-addition
2945 which can be used to apply finer control on what enters history.
2948 The MLE supports a set of editing and control commands.
2949 By default (as) many (as possible) of these will be assigned to a set of
2950 single-letter control codes, which should work on any terminal (and can
2951 be generated by holding the
2952 .Dq control
2953 key while pressing the key of desire, for example
2954 .Ql control-D ) .
2955 If the \*(OPal
2956 .Ic bind
2957 command is available then the MLE commands can also be accessed freely
2958 by assigning the command name, which is shown in parenthesis in the list
2959 below, to any desired key-sequence, and the MLE will instead and also use
2960 .Ic bind
2961 to establish its built-in key bindings
2962 (more of them if the \*(OPal terminal control is available),
2963 an action which can then be suppressed completely by setting
2964 .Va line-editor-no-defaults .
2965 .Sx "Shell-style argument quoting"
2966 notation is used in the following:
2970 .Bl -tag -compact -width ".It Ql \eBa"
2971 .It Ql \ecA
2972 Go to the start of the line
2974 .Pf ( Cd mle-go-home ) .
2976 .It Ql \ecB
2977 Move the cursor backward one character
2979 .Pf ( Cd mle-go-bwd ) .
2981 .It Ql \ecC
2982 .Xr raise 3
2983 .Ql SIGINT
2985 .Pf ( Cd mle-raise-int ) .
2987 .It Ql \ecD
2988 Forward delete the character under the cursor;
2989 quits \*(UA if used on the empty line unless the internal variable
2990 .Va ignoreeof
2991 is set
2993 .Pf ( Cd mle-del-fwd ) .
2995 .It Ql \ecE
2996 Go to the end of the line
2998 .Pf ( Cd mle-go-end ) .
3000 .It Ql \ecF
3001 Move the cursor forward one character
3003 .Pf ( Cd mle-go-fwd ) .
3005 .It Ql \ecG
3006 Cancel current operation, full reset.
3007 If there is an active history search or tabulator expansion then this
3008 command will first reset that, reverting to the former line content;
3009 thus a second reset is needed for a full reset in this case
3011 .Pf ( Cd mle-reset ) .
3013 .It Ql \ecH
3014 Backspace: backward delete one character
3016 .Pf ( Cd mle-del-bwd ) .
3018 .It Ql \ecI
3019 \*(NQ
3020 Horizontal tabulator:
3021 try to expand the word before the cursor, supporting the usual
3022 .Sx "Filename transformations"
3024 .Pf ( Cd mle-complete ;
3025 this is affected by
3026 .Cd mle-quote-rndtrip
3028 .Va line-editor-cpl-word-breaks ) .
3030 .It Ql \ecJ
3031 Newline:
3032 commit the current line
3034 .Pf ( Cd mle-commit ) .
3036 .It Ql \ecK
3037 Cut all characters from the cursor to the end of the line
3039 .Pf ( Cd mle-snarf-end ) .
3041 .It Ql \ecL
3042 Repaint the line
3044 .Pf ( Cd mle-repaint ) .
3046 .It Ql \ecN
3047 \*(OP Go to the next history entry
3049 .Pf ( Cd mle-hist-fwd ) .
3051 .It Ql \ecO
3052 (\*(OPally context-dependent) Invokes the command
3053 .Ic dt .
3055 .It Ql \ecP
3056 \*(OP Go to the previous history entry
3058 .Pf ( Cd mle-hist-bwd ) .
3060 .It Ql \ecQ
3061 Toggle roundtrip mode shell quotes, where produced,
3062 on and off
3064 .Pf ( Cd mle-quote-rndtrip ) .
3065 This setting is temporary, and will be forgotten once the command line
3066 is committed; also see
3067 .Ic shcodec .
3069 .It Ql \ecR
3070 \*(OP Complete the current line from (the remaining) older history entries
3072 .Pf ( Cd mle-hist-srch-bwd ) .
3074 .It Ql \ecS
3075 \*(OP Complete the current line from (the remaining) newer history entries
3077 .Pf ( Cd mle-hist-srch-fwd ) .
3079 .It Ql \ecT
3080 Paste the snarf buffer
3082 .Pf ( Cd mle-paste ) .
3084 .It Ql \ecU
3085 The same as
3086 .Ql \ecA
3087 followed by
3088 .Ql \ecK
3090 .Pf ( Cd mle-snarf-line ) .
3092 .It Ql \ecV
3093 Prompts for a Unicode character (hexadecimal number without prefix, see
3094 .Ic vexpr )
3095 to be inserted
3097 .Pf ( Cd mle-prompt-char ) .
3098 Note this command needs to be assigned to a single-letter control code
3099 in order to become recognized and executed during input of
3100 a key-sequence (only three single-letter control codes can be used for
3101 that shortcut purpose); this control code is then special-treated and
3102 thus cannot be part of any other sequence (because it will trigger the
3103 .Cd \&\&mle-prompt-char
3104 function immediately).
3106 .It Ql \ecW
3107 Cut the characters from the one preceding the cursor to the preceding
3108 word boundary
3110 .Pf ( Cd mle-snarf-word-bwd ) .
3112 .It Ql \ecX
3113 Move the cursor forward one word boundary
3115 .Pf ( Cd mle-go-word-fwd ) .
3117 .It Ql \ecY
3118 Move the cursor backward one word boundary
3120 .Pf ( Cd mle-go-word-bwd ) .
3122 .It Ql \ecZ
3123 .Xr raise 3
3124 .Ql SIGTSTP
3126 .Pf ( Cd mle-raise-tstp ) .
3128 .It Ql \ec[
3129 Escape: reset a possibly used multibyte character input state machine
3130 and \*(OPally a lingering, incomplete key binding
3132 .Pf ( Cd mle-cancel ) .
3133 This command needs to be assigned to a single-letter control code in
3134 order to become recognized and executed during input of a key-sequence
3135 (only three single-letter control codes can be used for that shortcut
3136 purpose).
3137 This control code may also be part of a multi-byte sequence, but if
3138 a sequence is active and the very control code is currently also an
3139 expected input, then the active sequence takes precedence and will
3140 consume the control code.
3142 .It Ql \ec\e
3143 (\*(OPally context-dependent) Invokes the command
3144 .Ql Ic z Ns + .
3146 .It Ql \ec]
3147 (\*(OPally context-dependent) Invokes the command
3148 .Ql Ic z Ns $ .
3150 .It Ql \ec^
3151 (\*(OPally context-dependent) Invokes the command
3152 .Ql Ic z Ns 0 .
3154 .It Ql \ec_
3155 Cut the characters from the one after the cursor to the succeeding word
3156 boundary
3158 .Pf ( Cd mle-snarf-word-fwd ) .
3160 .It Ql \ec?
3161 Backspace:
3162 .Cd mle-del-bwd .
3164 .It \(en
3166 .Cd mle-bell :
3167 ring the audible bell.
3169 .It \(en
3170 \*(OP
3172 .Cd mle-clear-screen :
3173 move the cursor home and clear the screen.
3175 .It \(en
3177 .Cd mle-fullreset :
3178 different to
3179 .Cd mle-reset
3180 this will immediately reset a possibly active search etc.
3182 .It \(en
3184 .Cd mle-go-screen-bwd :
3185 move the cursor backward one screen width.
3187 .It \(en
3189 .Cd mle-go-screen-fwd :
3190 move the cursor forward one screen width.
3192 .It \(en
3194 .Cd mle-raise-quit:
3195 .Xr raise 3
3196 .Ql SIGQUIT .
3198 .\" }}}
3200 .\" .Ss "Coloured display" {{{ review
3201 .Ss "Coloured display"
3203 \*(OP Colours and font attributes through ANSI a.k.a. ISO 6429 SGR
3204 (select graphic rendition) escape sequences are optionally supported.
3205 Usage of colours and font attributes solely depends upon the
3206 capability of the detected terminal type
3207 .Pf ( Ev TERM ) ,
3208 and as fine-tuned through
3209 .Va termcap .
3210 Colours and font attributes can be managed with the multiplexer command
3211 .Ic colour ,
3213 .Ic uncolour
3214 removes the given mappings.
3215 Setting
3216 .Va colour-disable
3217 suppresses usage of colour and font attribute sequences, while leaving
3218 established mappings unchanged.
3221 Whether actually applicable colour and font attribute sequences should
3222 also be generated when output is going to be paged through the external
3223 .Ev PAGER
3224 (also see
3225 .Va crt Ns
3226 ) depends upon the setting of
3227 .Va colour-pager ,
3228 because pagers usually need to be configured in order to support ISO
3229 escape sequences.
3230 Knowledge of some widely used pagers is however built-in, and in a clean
3231 environment it is often enough to simply set
3232 .Va colour-pager ;
3233 please refer to that variable for more on this topic.
3236 It might make sense to conditionalize colour setup on interactive mode via
3237 .Ic if
3238 .Pf ( Ql terminal
3239 indeed means
3240 .Dq interactive ) :
3242 .Bd -literal -offset indent
3243 if terminal && "$features" =% ,+colour,
3244   colour iso view-msginfo ft=bold,fg=green
3245   colour iso view-header ft=bold,fg=red (from|subject) # regex
3246   colour iso view-header fg=red
3248   uncolour iso view-header from,subject
3249   colour iso view-header ft=bold,fg=magenta,bg=cyan
3250   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
3251   colour mono view-header ft=bold
3252   colour mono view-header ft=bold,ft=reverse subject,from
3253 endif
3255 .\" }}}
3257 .\" .Ss "Handling spam" {{{
3258 .Ss "Handling spam"
3260 \*(OP \*(UA can make use of several spam interfaces for the purpose of
3261 identification of, and, in general, dealing with spam messages.
3262 A precondition of most commands in order to function is that the
3263 .Va spam-interface
3264 variable is set to one of the supported interfaces.
3265 .Sx "Specifying messages"
3266 that have been identified as spam is possible via their (volatile)
3267 .Ql is-spam
3268 state by using the
3269 .Ql Ar :s
3271 .Ql Ar :S
3272 specifications, and their
3273 .Va attrlist
3274 entries will be used when displaying the
3275 .Va headline
3276 in the summary of
3277 .Ic headers .
3279 .Bl -bullet
3281 .Ic spamrate
3282 rates the given messages and sets their
3283 .Ql is-spam
3284 flag accordingly.
3285 If the spam interface offers spam scores these can be shown in
3286 .Va headline
3287 by using the format
3288 .Ql %$ .
3290 .Ic spamham ,
3291 .Ic spamspam
3293 .Ic spamforget
3294 will interact with the Bayesian filter of the chosen interface and learn
3295 the given messages as
3296 .Dq ham
3298 .Dq spam ,
3299 respectively; the last command can be used to cause
3300 .Dq unlearning
3301 of messages; it adheres to their current
3302 .Ql is-spam
3303 state and thus reverts previous teachings.
3305 .Ic spamclear
3307 .Ic spamset
3308 will simply set and clear, respectively, the mentioned volatile
3309 .Ql is-spam
3310 message flag, without any interface interaction.
3315 .Xr spamassassin 1
3316 based
3317 .Va spam-interface
3318 .Ql spamc
3319 requires a running instance of the
3320 .Xr spamd 1
3321 server in order to function, started with the option
3322 .Fl -allow-tell
3323 shall Bayesian filter learning be possible.
3325 .Bd -literal -offset indent
3326 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3327 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3328     --daemonize [--local] [--allow-tell]
3332 Thereafter \*(UA can make use of these interfaces:
3334 .Bd -literal -offset indent
3335 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3336     -Sspamc-command=/usr/local/bin/spamc \e
3337     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3339 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3340     -Sspamc-command=/usr/local/bin/spamc \e
3341     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3345 Using the generic filter approach allows usage of programs like
3346 .Xr bogofilter 1 .
3347 Here is an example, requiring it to be accessible via
3348 .Ev PATH :
3350 .Bd -literal -offset indent
3351 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3352     -Sspamfilter-ham="bogofilter -n" \e
3353     -Sspamfilter-noham="bogofilter -N" \e
3354     -Sspamfilter-nospam="bogofilter -S" \e
3355     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3356     -Sspamfilter-spam="bogofilter -s" \e
3357     -Sspamfilter-rate-scanscore="1;^(.+)$"
3361 Because messages must exist on local storage in order to be scored (or
3362 used for Bayesian filter training), it is possibly a good idea to
3363 perform the local spam check last.
3364 Spam can be checked automatically when opening specific folders by
3365 setting a specialized form of the internal variable
3366 .Va folder-hook .
3368 .Bd -literal -offset indent
3369 define spamdelhook {
3370   # Server side DCC
3371   spamset (header x-dcc-brand-metrics "bulk")
3372   # Server-side spamassassin(1)
3373   spamset (header x-spam-flag "YES")
3374   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3375   move :S +maybe-spam
3376   spamrate :u
3377   del :s
3378   move :S +maybe-spam
3380 set folder-hook-SOMEFOLDER=spamdelhook
3384 See also the documentation for the variables
3385 .Va spam-interface , spam-maxsize ,
3386 .Va spamc-command , spamc-arguments , spamc-user ,
3387 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3388   spamfilter-rate
3390 .Va spamfilter-rate-scanscore .
3391 .\" }}}
3393 .\" }}} (DESCRIPTION)
3396 .\" .Sh COMMANDS {{{
3397 .Sh COMMANDS
3399 \*(UA reads input in lines.
3400 An unquoted reverse solidus
3401 .Ql \e
3402 at the end of a command line
3403 .Dq escapes
3404 the newline character: it is discarded and the next line of input is
3405 used as a follow-up line, with all leading whitespace removed;
3406 once an entire line is completed, the whitespace characters
3407 .Cm space , tabulator , newline
3408 as well as those defined by the variable
3409 .Va ifs
3410 are removed from the beginning and end.
3411 Placing any whitespace characters at the beginning of a line will
3412 prevent a possible addition of the command line to the \*(OPal
3413 .Ic history .
3416 The beginning of such input lines is then scanned for the name of
3417 a known command: command names may be abbreviated, in which case the
3418 first command that matches the given prefix will be used.
3419 .Sx "Command modifiers"
3420 may prefix a command in order to modify its behaviour.
3421 A name may also be a
3422 .Ic commandalias ,
3423 which will become expanded until no more expansion is possible.
3424 Once the command that shall be executed is known, the remains of the
3425 input line will be interpreted according to command-specific rules,
3426 documented in the following.
3429 This behaviour is different to the
3430 .Xr sh 1 Ns
3431 ell, which is a programming language with syntactic elements of clearly
3432 defined semantics, and therefore capable to sequentially expand and
3433 evaluate individual elements of a line.
3434 .Ql \&? set one=value two=$one
3435 for example will never possibly assign value to one, because the
3436 variable assignment is performed no sooner but by the command
3437 .Pf ( Ic set ) ,
3438 long after the expansion happened.
3441 A list of all commands in lookup order is dumped by the command
3442 .Ic list .
3443 \*(OPally the command
3444 .Ic help
3446 .Ic \&? ) ,
3447 when given an argument, will show a documentation string for the
3448 command matching the expanded argument, as in
3449 .Ql \&?t ,
3450 which should be a shorthand of
3451 .Ql \&?type ;
3452 with these documentation strings both commands support a more
3453 .Va verbose
3454 listing mode which includes the argument type of the command and other
3455 information which applies; a handy suggestion might thus be:
3457 .Bd -literal -offset indent
3458 ? define __xv {
3459   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3460   localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}
3462 ? commandalias xv '\ecall __xv'
3463 ? xv help set
3466 .\" .Ss "Command modifiers" {{{
3467 .Ss "Command modifiers"
3469 Commands may be prefixed by none to multiple command modifiers.
3470 Some command modifiers can be used with a restricted set of commands
3471 only, the
3472 .Va verbose
3473 version of
3474 .Ic list
3475 will (\*(OPally) show which modifiers apply.
3477 .Bl -bullet
3479 The modifier reverse solidus
3481 .Cm \e ,
3482 to be placed first, prevents
3483 .Ic commandalias
3484 expansions on the remains of the line, for example
3485 .Ql \eecho
3486 will always evaluate the command
3487 .Ic echo ,
3488 even if an (command)alias of the same name exists.
3489 .Ic commandalias
3490 content may itself contain further command modifiers, including
3491 an initial reverse solidus to prevent further expansions.
3494 The modifier
3496 .Cm ignerr
3497 indicates that any error generated by the following command should be
3498 ignored by the state machine and not cause a program exit with enabled
3499 .Va errexit
3500 or for the standardized exit cases in
3501 .Va posix
3502 mode.
3503 .Va \&? ,
3504 one of the
3505 .Sx "INTERNAL VARIABLES" ,
3506 will be set to the real exit status of the command regardless.
3510 .Cm local
3511 will alter the called command to apply changes only temporarily,
3512 local to block-scope, and can thus only be used inside of a
3513 .Ic define Ns
3514 d macro or an
3515 .Ic account
3516 definition.
3517 Specifying it implies the modifier
3518 .Cm wysh .
3519 Local variables will not be inherited by macros deeper in the
3520 .Ic call
3521 chain, and all local settings will be garbage collected once the local
3522 scope is left.
3523 To record and unroll changes in the global scope use the command
3524 .Ic localopts .
3528 .Cm scope
3529 does yet not implement any functionality.
3533 .Cm u
3534 does yet not implement any functionality.
3537 Some commands support the
3539 .Cm vput
3540 modifier: if used, they expect the name of a variable, which can itself
3541 be a variable, i.e., shell expansion is applied, as their first
3542 argument, and will place their computation result in it instead of the
3543 default location (it is usually written to standard output).
3545 The given name will be tested for being a valid
3546 .Xr sh 1
3547 variable name, and may therefore only consist of upper- and lowercase
3548 characters, digits, and the underscore; the hyphen-minus may be used as
3549 a non-portable extension; digits may not be used as first, hyphen-minus
3550 may not be used as last characters.
3551 In addition the name may either not be one of the known
3552 .Sx "INTERNAL VARIABLES" ,
3553 or must otherwise refer to a writable (non-boolean) value variable.
3554 The actual put operation may fail nonetheless, for example if the
3555 variable expects a number argument only a number will be accepted.
3556 Any error during these operations causes the command as such to fail,
3557 and the error number
3558 .Va \&!
3559 will be set to
3560 .Va ^ERR Ns -NOTSUP ,
3561 the exit status
3562 .Va \&?
3563 should be set to
3564 .Ql -1 ,
3565 but some commands deviate from the latter, which is documented.
3568 Last, but not least, the modifier
3570 .Cm wysh
3571 can be used for some old and established commands to choose the new
3572 .Sx "Shell-style argument quoting"
3573 rules over the traditional
3574 .Sx "Old-style argument quoting" .
3575 This modifier is implied if
3576 .Va v15-compat
3577 is set to a non-empty value.
3579 .\" }}}
3581 .\" .Ss "Old-style argument quoting" v15-compat: rename Obsolete.. {{{
3582 .Ss "Old-style argument quoting"
3584 \*(ID This section documents the traditional and POSIX standardized
3585 style of quoting non-message list arguments to commands which expect
3586 this type of arguments: whereas still used by the majority of such
3587 commands, the new
3588 .Sx "Shell-style argument quoting"
3589 may be available even for those via
3590 .Cm wysh ,
3591 one of the
3592 .Sx "Command modifiers" .
3593 Nonetheless care must be taken, because only new commands have been
3594 designed with all the capabilities of the new quoting rules in mind,
3595 which can, for example generate control characters.
3598 .Bl -bullet -offset indent
3600 An argument can be enclosed between paired double-quotes
3601 .Ql """argument"""
3603 single-quotes
3604 .Ql 'argument' ;
3605 any whitespace, shell word expansion, or reverse solidus characters
3606 (except as described next) within the quotes are treated literally as
3607 part of the argument.
3608 A double-quote will be treated literally within single-quotes and vice
3609 versa.
3610 Inside such a quoted string the actually used quote character can be
3611 used nonetheless by escaping it with a reverse solidus
3612 .Ql \e ,
3613 as in
3614 .Ql """y\e""ou""" .
3617 An argument that is not enclosed in quotes, as above, can usually still
3618 contain space characters if those spaces are reverse solidus escaped, as in
3619 .Ql you\e are .
3622 A reverse solidus outside of the enclosing quotes is discarded
3623 and the following character is treated literally as part of the argument.
3625 .\" }}}
3627 .\" .Ss "Shell-style argument quoting" {{{
3628 .Ss "Shell-style argument quoting"
3630 .Xr sh 1 Ns
3631 ell-style, and therefore POSIX standardized, argument parsing and
3632 quoting rules are used by most commands.
3633 \*(ID Most new commands only support these new rules and are flagged
3634 \*(NQ, some elder ones can use them with the command modifier
3635 .Cm wysh ;
3636 in the future only this type of argument quoting will remain.
3639 A command line is parsed from left to right and an input token is
3640 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3641 Metacharacters are vertical bar
3642 .Cm \&| ,
3643 ampersand
3644 .Cm & ,
3645 semicolon
3646 .Cm \&; ,
3647 as well as all characters from the variable
3648 .Va ifs ,
3649 and / or
3650 .Cm space , tabulator , newline .
3651 The additional metacharacters left and right parenthesis
3652 .Cm \&( , \&)
3653 and less-than and greater-than signs
3654 .Cm < , >
3655 that the
3656 .Xr sh 1
3657 supports are not used, and are treated as ordinary characters: for one
3658 these characters are a vivid part of email addresses, and it seems
3659 highly unlikely that their function will become meaningful to \*(UA.
3661 .Bd -filled -offset indent
3662 .Sy Compatibility note:
3663 \*(ID Please note that even many new-style commands do not yet honour
3664 .Va ifs
3665 to parse their arguments: whereas the
3666 .Xr sh 1 Ns
3667 ell is a language with syntactic elements of clearly defined semantics,
3668 \*(UA parses entire input lines and decides on a per-command base what
3669 to do with the rest of the line.
3670 This also means that whenever an unknown command is seen all that \*(UA
3671 can do is cancellation of the processing of the remains of the line.
3673 It also often depends on an actual subcommand of a multiplexer command
3674 how the rest of the line should be treated, and until v15 we are not
3675 capable to perform this deep inspection of arguments.
3676 Nonetheless, at least the following commands which work with positional
3677 parameters fully support
3678 .Va ifs
3679 for an almost shell-compatible field splitting:
3680 .Ic call , call_if , read , vpospar , xcall .
3684 Any unquoted number sign
3685 .Ql #
3686 at the beginning of a new token starts a comment that extends to the end
3687 of the line, and therefore ends argument processing.
3688 An unquoted dollar sign
3689 .Ql $
3690 will cause variable expansion of the given name, which must be a valid
3691 .Xr sh 1 Ns
3692 ell-style variable name (see
3693 .Cm vput ) :
3694 .Sx "INTERNAL VARIABLES"
3695 as well as
3696 .Sx ENVIRONMENT
3697 (shell) variables can be accessed through this mechanism, brace
3698 enclosing the name is supported (i.e., to subdivide a token).
3701 Whereas the metacharacters
3702 .Cm space , tabulator , newline
3703 only complete an input token, vertical bar
3704 .Cm \&| ,
3705 ampersand
3706 .Cm &
3707 and semicolon
3708 .Cm \&;
3709 also act as control operators and perform control functions.
3710 For now supported is semicolon
3711 .Cm \&; ,
3712 which terminates a single command, therefore sequencing the command line
3713 and making the remainder of the line a subject to reevaluation.
3714 With sequencing, multiple command argument types and quoting rules may
3715 therefore apply to a single line, which can become problematic before
3716 v15: e.g., the first of the following will cause surprising results.
3719 .Dl ? echo one; set verbose; echo verbose=$verbose.
3720 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3723 Quoting is a mechanism that will remove the special meaning of
3724 metacharacters and reserved words, and will prevent expansion.
3725 There are four quoting mechanisms: the escape character, single-quotes,
3726 double-quotes and dollar-single-quotes:
3729 .Bl -bullet -offset indent
3731 The literal value of any character can be preserved by preceding it
3732 with the escape character reverse solidus
3733 .Ql \e .
3736 Arguments which are enclosed in
3737 .Ql 'single-\:quotes'
3738 retain their literal value.
3739 A single-quote cannot occur within single-quotes.
3742 The literal value of all characters enclosed in
3743 .Ql \(dqdouble-\:quotes\(dq
3744 is retained, with the exception of dollar sign
3745 .Ql $ ,
3746 which will cause variable expansion, as above, backquote (grave accent)
3747 .Ql ` ,
3748 (which not yet means anything special), reverse solidus
3749 .Ql \e ,
3750 which will escape any of the characters dollar sign
3751 .Ql $
3752 (to prevent variable expansion), backquote (grave accent)
3753 .Ql ` ,
3754 double-quote
3755 .Ql \(dq
3756 (to prevent ending the quote) and reverse solidus
3757 .Ql \e
3758 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3759 but has no special meaning otherwise.
3762 Arguments enclosed in
3763 .Ql $'dollar-\:single-\:quotes'
3764 extend normal single quotes in that reverse solidus escape sequences are
3765 expanded as follows:
3767 .Bl -tag -compact -width ".Ql \eNNN"
3768 .It Ql \ea
3769 bell control character (ASCII and ISO-10646 BEL).
3770 .It Ql \eb
3771 backspace control character (ASCII and ISO-10646 BS).
3772 .It Ql \eE
3773 escape control character (ASCII and ISO-10646 ESC).
3774 .It Ql \ee
3775 the same.
3776 .It Ql \ef
3777 form feed control character (ASCII and ISO-10646 FF).
3778 .It Ql \en
3779 line feed control character (ASCII and ISO-10646 LF).
3780 .It Ql \er
3781 carriage return control character (ASCII and ISO-10646 CR).
3782 .It Ql \et
3783 horizontal tabulator control character (ASCII and ISO-10646 HT).
3784 .It Ql \ev
3785 vertical tabulator control character (ASCII and ISO-10646 VT).
3786 .It Ql \e\e
3787 emits a reverse solidus character.
3788 .It Ql \e'
3789 single quote.
3790 .It Ql \e"
3791 double quote (escaping is optional).
3792 .It Ql \eNNN
3793 eight-bit byte with the octal value
3794 .Ql NNN
3795 (one to three octal digits), optionally prefixed by an additional
3796 .Ql 0 .
3797 A 0 byte will suppress further output for the quoted argument.
3798 .It Ql \exHH
3799 eight-bit byte with the hexadecimal value
3800 .Ql HH
3801 (one or two hexadecimal characters, no prefix, see
3802 .Ic vexpr ) .
3803 A 0 byte will suppress further output for the quoted argument.
3804 .It Ql \eUHHHHHHHH
3805 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3806 .Ql HHHHHHHH
3807 (one to eight hexadecimal characters) \(em note that Unicode defines the
3808 maximum codepoint ever to be supported as
3809 .Ql 0x10FFFF
3810 (in planes of
3811 .Ql 0xFFFF
3812 characters each).
3813 This escape is only supported in locales that support Unicode (see
3814 .Sx "Character sets" ) ,
3815 in other cases the sequence will remain unexpanded unless the given code
3816 point is ASCII compatible or (if the \*(OPal character set conversion is
3817 available) can be represented in the current locale.
3818 The character NUL will suppress further output for the quoted argument.
3819 .It Ql \euHHHH
3820 Identical to
3821 .Ql \eUHHHHHHHH
3822 except it takes only one to four hexadecimal characters.
3823 .It Ql \ecX
3824 Emits the non-printable (ASCII and compatible) C0 control codes
3825 0 (NUL) to 31 (US), and 127 (DEL).
3826 Printable representations of ASCII control codes can be created by
3827 mapping them to a different, visible part of the ASCII character set.
3828 Adding the number 64 achieves this for the codes 0 to 31, here 7 (BEL):
3829 .Ql 7 + 64 = 71 = G .
3830 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3831 .Ic vexpr ) ,
3832 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3833 .Ql \&?\0vexpr\0^\0127\064 .
3835 Whereas historically circumflex notation has often been used for
3836 visualization purposes of control codes, as in
3837 .Ql ^G ,
3838 the reverse solidus notation has been standardized:
3839 .Ql \ecG .
3840 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3841 as shown above
3842 .Pf ( Ql \ea ,
3843 .Ql \en ,
3844 .Ql \et
3845 etc) :
3846 whenever such an alias exists it will be used for display purposes.
3847 The control code NUL
3848 .Pf ( Ql \ec@ ,
3849 a non-standard extension) will suppress further output for the remains
3850 of the token (which may extend beyond the current quote), or, depending
3851 on the context, the remains of all arguments for the current command.
3852 .It Ql \e$NAME
3853 Non-standard extension: expand the given variable name, as above.
3854 Brace enclosing the name is supported.
3855 .It Ql \e`{command}
3856 Not yet supported, just to raise awareness: Non-standard extension.
3861 Caveats:
3863 .Bd -literal -offset indent
3864 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3865 ? echo Quotes ${HOME} and tokens differ! # comment
3866 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3868 .\" }}}
3870 .\" .Ss "Message list arguments" {{{
3871 .Ss "Message list arguments"
3873 Many commands operate on message list specifications, as documented in
3874 .Sx "Specifying messages" .
3875 The argument input is first split into individual tokens via
3876 .Sx "Shell-style argument quoting" ,
3877 which are then interpreted as the mentioned specifications.
3878 If no explicit message list has been specified, many commands will
3879 search for and use the next message forward that satisfies the commands'
3880 requirements, and if there are no messages forward of the current
3881 message, the search proceeds backwards;
3882 if there are no good messages at all to be found, an error message is
3883 shown and the command is aborted.
3885 .Va verbose
3886 output of the command
3887 .Ic list
3888 will indicate whether a command searches for a default message, or not.
3889 .\" }}}
3891 .\" .Ss "Raw data arguments for codec commands" {{{
3892 .Ss "Raw data arguments for codec commands"
3894 A special set of commands, which all have the string
3895 .Dq codec
3896 in their name, like
3897 .Ic addrcodec ,
3898 .Ic shcodec ,
3899 .Ic urlcodec ,
3900 take raw string data as input, which means that the content of the
3901 command input line is passed completely unexpanded and otherwise
3902 unchanged: like this the effect of the actual codec is visible without
3903 any noise of possible shell quoting rules etc., i.e., the user can input
3904 one-to-one the desired or questionable data.
3905 To gain a level of expansion, the entire command line can be
3906 .Ic eval Ns
3907 uated first, for example
3909 .Bd -literal -offset indent
3910 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3911 ? echo $res
3912 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3913 ? shcodec d $res
3914 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3915 ? eval shcodec d $res
3916 /usr/Sch\[:o]nes Wetter/heute.txt
3918 .\" }}}
3920 .\" .Ss "Filename transformations" {{{
3921 .Ss "Filename transformations"
3923 Filenames, where expected, and unless documented otherwise, are
3924 subsequently subject to the following filename transformations, in
3925 sequence:
3927 .Bl -bullet -offset indent
3929 If the given name is a registered
3930 .Ic shortcut ,
3931 it will be replaced with the expanded shortcut.
3932 This step is mostly taken for
3933 .Ic folder Ns
3934 s only.
3937 The filename is matched against the following patterns or strings.
3938 But for plus
3939 .Ar +file
3940 .Va folder
3941 expansion this step is mostly taken for
3942 .Ic folder Ns
3943 s only.
3947 .Bl -hang -compact -width ".Ar %user"
3948 .It Ar #
3949 (Number sign) is expanded to the previous file.
3951 .It Ar %
3952 (Percent sign) is replaced by the invoking
3953 .Mx -ix "primary system mailbox"
3954 user's primary system mailbox, which either is the (itself expandable)
3955 .Va inbox
3956 if that is set, the standardized absolute pathname indicated by
3957 .Ev MAIL
3958 if that is set, or a built-in compile-time default otherwise.
3959 When opening a
3960 .Ic folder
3961 the used name is actively checked for being a primary mailbox, first
3962 against
3963 .Va \&\&inbox ,
3964 then against
3965 .Ev MAIL .
3967 .It Ar %user
3968 Expands to the primary system mailbox of
3969 .Ar user
3970 (and never the value of
3971 .Va inbox ,
3972 regardless of its actual setting).
3974 .It Ar &
3975 (Ampersand) is replaced with the invoking user's
3976 .Mx -ix "secondary mailbox"
3977 secondary mailbox, the
3978 .Ev MBOX .
3980 .It Ar +file
3981 Refers to a
3982 .Ar file
3983 in the
3984 .Va folder
3985 directory (if that variable is set).
3987 .It Ar %:filespec
3988 Expands to the same value as
3989 .Ar filespec ,
3990 but has special meaning when used with, for example, the command
3991 .Ic folder :
3992 the file will be treated as a primary system mailbox by, among others, the
3993 .Ic mbox
3995 .Ic save
3996 commands, meaning that messages that have been read in the current
3997 session will be moved to the
3998 .Ev MBOX
3999 mailbox instead of simply being flagged as read.
4004 Meta expansions may be applied to the resulting filename, as allowed by
4005 the operation and applicable to the resulting access protocol (also see
4006 .Sx "On URL syntax and credential lookup" ) .
4007 For the file-protocol, a leading tilde
4008 .Ql ~
4009 character will be replaced by the expansion of
4010 .Ev HOME ,
4011 except when followed by a valid user name, in which case the home
4012 directory of the given user is used instead.
4014 A shell expansion as if specified in double-quotes (see
4015 .Sx "Shell-style argument quoting" )
4016 may be applied, so that any occurrence of
4017 .Ql $VARIABLE
4019 .Ql ${VARIABLE} )
4020 will be replaced by the expansion of the variable, if possible;
4021 .Sx "INTERNAL VARIABLES"
4022 as well as
4023 .Sx ENVIRONMENT
4024 (shell) variables can be accessed through this mechanism.
4026 Shell pathname wildcard pattern expansions
4027 .Pf ( Xr glob 7 )
4028 may be applied as documented.
4029 If the fully expanded filename results in multiple pathnames and the
4030 command is expecting only one file, an error results.
4032 In interactive context, in order to allow simple value acceptance (via
4033 .Dq ENTER ) ,
4034 arguments will usually be displayed in a properly quoted form, so a file
4035 .Ql diet\e is \ecurd.txt
4036 may be displayed as
4037 .Ql 'diet\e is \ecurd.txt' .
4039 .\" }}}
4041 .\" .Ss "Commands" {{{
4042 .Ss "Commands"
4044 The following commands are available:
4046 .Bl -tag -width ".It Ic BaNg"
4050 .It Ic \&!
4051 Executes the
4052 .Ev SHELL
4053 command which follows, replacing unescaped exclamation marks with the
4054 previously executed command if the internal variable
4055 .Va bang
4056 is set.
4057 This command supports
4058 .Cm vput
4059 as documented in
4060 .Sx "Command modifiers" ,
4061 and manages the error number
4062 .Va \&! .
4063 A 0 or positive exit status
4064 .Va \&?
4065 reflects the exit status of the command, negative ones that
4066 an error happened before the command was executed, or that the program
4067 did not exit cleanly, but maybe due to a signal: the error number is
4068 .Va ^ERR Ns -CHILD ,
4069 then.
4072 In conjunction with the
4073 .Cm vput
4074 modifier the following special cases exist:
4075 a negative exit status occurs if the collected data could not be stored
4076 in the given variable, which is a
4077 .Va ^ERR Ns -NOTSUP
4078 error that should otherwise not occur.
4079 .Va ^ERR Ns -CANCELED
4080 indicates that no temporary file could be created to collect the command
4081 output at first glance.
4082 In case of catchable out-of-memory situations
4083 .Va ^ERR Ns -NOMEM
4084 will occur and \*(UA will try to store the empty string, just like with
4085 all other detected error conditions.
4089 .It Ic #
4090 The comment-command causes the entire line to be ignored.
4091 .Sy Note:
4092 this really is a normal command which' purpose is to discard its
4093 arguments, not a
4094 .Dq comment-start
4095 indicating special character, which means that for example trailing
4096 comments on a line are not possible (except for commands which use
4097 .Sx "Shell-style argument quoting" ) .
4100 .It Ic +
4101 Goes to the next message in sequence and types it
4102 (like
4103 .Dq ENTER ) .
4106 .It Ic -
4107 Display the preceding message, or the n'th previous message if given
4108 a numeric argument n.
4111 .It Ic =
4112 Shows the message number of the current message (the
4113 .Dq dot )
4114 when used without arguments, that of the given list otherwise.
4115 Output numbers will be separated from each other with the first
4116 character of
4117 .Va ifs ,
4118 and followed by the first character of
4119 .Va if-ws ,
4120 if that is not empty and not identical to the first.
4121 If that results in no separation at all a
4122 .Cm space
4123 character is used.
4124 This command supports
4125 .Cm vput
4126 (see
4127 .Sx "Command modifiers" ) ,
4128 and manages the error number
4129 .Va \&! .
4132 .It Ic \&?
4133 \*(OP Show a brief summary of commands.
4134 \*(OP Given an argument a synopsis for the command in question is
4135 shown instead; commands can be abbreviated in general and this command
4136 can be used to see the full expansion of an abbreviation including the
4137 synopsis, try, for example
4138 .Ql \&?h ,
4139 .Ql \&?hel
4141 .Ql \&?help
4142 and see how the output changes.
4143 To avoid that aliases are resolved the modifier
4144 .Cm \e
4145 can be prepended to the argument, but note it must be quoted.
4146 This mode also supports a more
4147 .Va verbose
4148 output, which will provide the information documented for
4149 .Ic list .
4152 .It Ic \&|
4153 A synonym for the
4154 .Ic pipe
4155 command.
4159 .It Ic account , unaccount
4160 (ac, una) Creates, selects or lists (an) account(s).
4161 Accounts are special incarnations of
4162 .Ic define Ns d
4163 macros and group commands and variable settings which together usually
4164 arrange the environment for the purpose of creating an email account.
4165 Different to normal macros settings which are covered by
4166 .Ic localopts
4167 \(en here by default enabled! \(en will not be reverted before the
4168 .Ic account
4169 is changed again.
4170 The special account
4171 .Ql null
4172 (case-insensitive) always exists, and all but it can be deleted by the
4173 latter command, and in one operation with the special name
4174 .Ql * .
4175 Also for all but it a possibly set
4176 .Va on-account-cleanup
4177 hook is called once they are left, also for program exit.
4179 Without arguments a listing of all defined accounts is shown.
4180 With one argument the given account is activated: the system
4181 .Va inbox
4182 of that account will be activated (as via
4183 .Ic folder ) ,
4184 a possibly installed
4185 .Va folder-hook
4186 will be run, and the internal variable
4187 .Va account
4188 will be updated.
4189 The two argument form behaves identical to defining a macro as via
4190 .Ic define .
4191 Important settings for accounts include
4192 .Va folder , from , hostname , inbox , mta , password
4194 .Va user
4195 .Pf ( Sx "On URL syntax and credential lookup" ) ,
4196 as well as things like
4197 .Va tls-config-pairs
4198 .Pf ( Sx "Encrypted network communication" ) ,
4199 and protocol specifics like
4200 .Va imap-auth , pop3-auth , smtp-auth .
4201 .Bd -literal -offset indent
4202 account myisp {
4203   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
4204   set from='(My Name) myname@myisp.example'
4205   set mta=smtp://mylogin@smtp.myisp.example
4211 .It Ic addrcodec
4212 Perform email address codec transformations on raw-data argument, rather
4213 according to email standards (RFC 5322; \*(ID will furtherly improve).
4214 Supports
4215 .Cm vput
4216 (see
4217 .Sx "Command modifiers" ) ,
4218 and manages the error number
4219 .Va \&! .
4220 The first argument must be either
4221 .Ar [+[+[+]]]e[ncode] ,
4222 .Ar d[ecode] ,
4223 .Ar s[kin]
4225 .Ar skinl[ist]
4226 and specifies the operation to perform on the rest of the line.
4229 Decoding will show how a standard-compliant MUA will display the given
4230 argument, which should be an email address.
4231 Please be aware that most MUAs have difficulties with the address
4232 standards, and vary wildly when (comments) in parenthesis,
4233 .Dq double-quoted
4234 strings, or quoted-pairs, as below, become involved.
4235 \*(ID \*(UA currently does not perform decoding when displaying addresses.
4238 Skinning is identical to decoding but only outputs the plain address,
4239 without any string, comment etc. components.
4240 Another difference is that it may fail with the error number
4241 .Va \&!
4242 set to
4243 .Va ^ERR Ns -INVAL
4244 if decoding fails to find a(n) (valid) email address, in which case the
4245 unmodified input will be output again.
4248 .Ar skinlist
4249 first performs a skin operation, and thereafter checks a valid
4250 address for whether it is a registered mailing list (see
4251 .Ic mlist
4253 .Ic mlsubscribe ) ,
4254 eventually reporting that state in the error number
4255 .Va \&!
4257 .Va ^ERR Ns -EXIST .
4258 (This state could later become overwritten by an I/O error, though.)
4261 Encoding supports four different modes, lesser automated versions can be
4262 chosen by prefixing one, two or three plus signs: the standard imposes
4263 a special meaning on some characters, which thus have to be transformed
4264 to so-called quoted-pairs by pairing them with a reverse solidus
4265 .Ql \e
4266 in order to remove the special meaning; this might change interpretation
4267 of the entire argument from what has been desired, however!
4268 Specify one plus sign to remark that parenthesis shall be left alone,
4269 two for not turning double quotation marks into quoted-pairs, and three
4270 for also leaving any user-specified reverse solidus alone.
4271 The result will always be valid, if a successful exit status is reported
4272 (\*(ID the current parser fails this assertion for some constructs).
4273 \*(ID Addresses need to be specified in between angle brackets
4274 .Ql < ,
4275 .Ql >
4276 if the construct becomes more difficult, otherwise the current parser
4277 will fail; it is not smart enough to guess right.
4279 .Bd -literal -offset indent
4280 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
4281 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4282 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4283 "Hey, you", \e out\e there <diet@exam.ple>
4284 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4285 diet@exam.ple
4291 .It Ic alias , unalias
4292 \*(NQ(a, una) Define or list, and remove, respectively, address aliases,
4293 which are a method of creating personal distribution lists that map
4294 a single name to none to multiple receivers, to be expanded after
4295 .Sx "Compose mode"
4296 is left; the expansion correlates with
4297 .Va metoo .
4298 The latter command removes all given aliases, the special name asterisk
4299 .Ql *
4300 will remove all existing aliases.
4301 When used without arguments the former shows a list of all currently
4302 known aliases, with one argument only the target(s) of the given one.
4303 When given two arguments, hyphen-minus
4304 .Ql -
4305 being the first, the target(s) of the second is/are expanded recursively.
4308 In all other cases the given alias is newly defined, or will be appended
4309 to: arguments must either be themselves valid alias names, or any
4310 other address type (see
4311 .Sx "On sending mail, and non-interactive mode" ) .
4312 Recursive expansion of aliases can be prevented by prefixing the desired
4313 argument with the modifier reverse solidus
4314 .Cm \&\&\e .
4315 A valid alias name conforms to
4316 .Va mta-aliases
4317 syntax, but follow-up characters can also be the number sign
4318 .Ql # ,
4319 colon
4320 .Ql \&: ,
4321 commercial at
4322 .Ql @,
4323 exclamation mark
4324 .Ql \&! ,
4325 period
4326 .Ql \&.
4327 as well as
4328 .Dq any character that has the high bit set .
4329 The dollar sign
4330 .Ql $
4331 may be the last character.
4332 The number sign
4333 .Ql #
4334 may need
4335 .Sx "Shell-style argument quoting" .
4338 .\" ALIASCOLON next sentence
4339 \*(ID Unfortunately the colon is currently not supported, as it
4340 interferes with normal address parsing rules.
4341 .\" ALIASCOLON next sentence
4342 \*(ID Such high bit characters will likely cause warnings at the moment
4343 for the same reasons why colon is unsupported; also, in the future
4344 locale dependent character set validity checks will be performed.
4346 .Bd -literal -offset indent
4347 ? alias cohorts  bill jkf mark kridle@ucbcory ~/cohorts.mbox
4348 ? alias mark  mark@exam.ple
4349 ? set mta-aliases=/etc/aliases
4355 .It Ic alternates , unalternates
4356 \*(NQ (alt) Manage a list of alternate addresses or names of the active
4357 user, members of which will be removed from recipient lists (except one).
4358 There is a set of implicit alternates which is formed of the values of
4359 .Ev LOGNAME ,
4360 .Va from ,
4361 .Va sender
4363 .Va reply-to .
4364 .Va from
4365 will not be used if
4366 .Va sender
4367 is set.
4368 The latter command removes the given list of alternates, the special name
4369 .Ql *
4370 will discard all existing alternate names.
4372 The former command manages the error number
4373 .Va \&! .
4374 It shows the current set of alternates when used without arguments; in
4375 this mode only it also supports
4376 .Cm vput
4377 (see
4378 .Sx "Command modifiers" ) .
4379 Otherwise the given arguments (after being checked for validity) are
4380 appended to the list of alternate names; in
4381 .Va posix
4382 mode they replace that list instead.
4386 .It Ic answered , unanswered
4387 Take a message lists and mark each message as (not) having been answered.
4388 Messages will be marked answered when being
4389 .Ic reply Ns d
4390 to automatically if the
4391 .Va markanswered
4392 variable is set.
4393 See the section
4394 .Sx "Message states" .
4399 .It Ic bind , unbind
4400 \*(OP\*(NQ The bind command extends the MLE (see
4401 .Sx "On terminal control and line editor" )
4402 with freely configurable key bindings.
4403 The latter command removes from the given context the given key binding,
4404 both of which may be specified as a wildcard
4405 .Ql * ,
4406 so that
4407 .Ql unbind * *
4408 will remove all bindings of all contexts.
4409 Due to initialization order unbinding will not work for built-in key
4410 bindings upon program startup, however: please use
4411 .Va line-editor-no-defaults
4412 for this purpose instead.
4415 With zero arguments, or with a context name the former command shows
4416 all key bindings (of the given context; an asterisk
4417 .Ql *
4418 will iterate over all contexts); a more verbose listing will be
4419 produced if either of
4420 .Va debug
4422 .Va verbose
4423 are set.
4424 With two or more arguments a specific binding is shown, or
4425 (re)established: the first argument is the context to which the binding
4426 shall apply, the second argument is a comma-separated list of the
4427 .Dq keys
4428 which form the binding.
4429 Further arguments will be joined to form the expansion, and cause the
4430 binding to be created or updated.
4431 To indicate that a binding shall not be auto-committed, but that the
4432 expansion shall instead be furtherly editable by the user, a commercial at
4433 .Ql @
4434 (that will be removed) can be placed last in the expansion, from which
4435 leading and trailing whitespace will finally be removed.
4436 Reverse solidus cannot be used as the last character of expansion.
4437 An empty expansion will be rejected.
4440 Contexts define when a binding applies, i.e., a binding will not be seen
4441 unless the context for which it is defined for is currently active.
4442 This is not true for the shared binding
4443 .Ql base ,
4444 which is the foundation for all other bindings and as such always
4445 applies, its bindings, however, only apply secondarily.
4446 The available contexts are the shared
4447 .Ql base ,
4449 .Ql default
4450 context which is used in all not otherwise documented situations, and
4451 .Ql compose ,
4452 which applies only to
4453 .Sx "Compose mode" .
4456 Bindings are specified as a comma-separated list of byte-sequences,
4457 where each list entry corresponds to one
4458 .Dq key
4459 (press).
4460 Byte sequence boundaries will be forcefully terminated after
4461 .Va bind-inter-byte-timeout
4462 milliseconds, whereas key sequences can be timed out via
4463 .Va bind-inter-key-timeout .
4464 A list entry may, indicated by a leading colon character
4465 .Ql \&: ,
4466 also refer to the name of a terminal capability; several dozen names
4467 are compiled in and may be specified either by their
4468 .Xr terminfo 5 ,
4469 or, if existing, by their
4470 .Xr termcap 5
4471 name, regardless of the actually used \*(OPal terminal control library.
4472 But any capability may be used, as long as the name is resolvable by the
4473 \*(OPal control library, or was defined via the internal variable
4474 .Va termcap .
4475 Input sequences are not case-normalized, an exact match is required to
4476 update or remove a binding.
4477 It is advisable to use an initial escape or other control character (like
4478 .Ql \ecA )
4479 for user (as opposed to purely terminal capability based) bindings in
4480 order to avoid ambiguities; it also reduces search time.
4481 Examples:
4483 .Bd -literal -offset indent
4484 ? bind base a,b echo one
4485 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4486 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete
4487 ? bind default $'\ecA',:khome,w 'echo Editable binding@'
4488 ? bind default a,b,c rm -irf / @  # Also editable
4489 ? bind default :kf1 File %
4490 ? bind compose :kf1 ~v
4494 Note that the entire comma-separated list is first parsed (over) as a
4495 shell-token with whitespace as the field separator, then parsed and
4496 expanded for real with comma as the field separator, therefore
4497 whitespace needs to be properly quoted, see
4498 .Sx "Shell-style argument quoting" .
4499 Using Unicode reverse solidus escape sequences renders a binding
4500 defunctional if the locale does not support Unicode (see
4501 .Sx "Character sets" ) ,
4502 and using terminal capabilities does so if no (corresponding) terminal
4503 control support is (currently) available.
4504 Adding, deleting or modifying a key binding invalidates the internal
4505 prebuilt lookup tree, it will be recreated as necessary: this process
4506 will be visualized in most
4507 .Va verbose
4508 as well as in
4509 .Va debug
4510 mode.
4513 The following terminal capability names are built-in and can be used in
4514 .Xr terminfo 5
4515 or (if available) the two-letter
4516 .Xr termcap 5
4517 notation.
4518 See the respective manual for a list of capabilities.
4519 The program
4520 .Xr infocmp 1
4521 can be used to show all the capabilities of
4522 .Ev TERM
4523 or the given terminal type;
4524 using the
4525 .Fl \&\&x
4526 flag will also show supported (non-standard) extensions.
4529 .Bl -tag -compact -width kcuuf_or_kcuuf
4530 .It Cd kbs Ns \0or Cd kb
4531 Backspace.
4532 .It Cd kdch1 Ns \0or Cd kD
4533 Delete character.
4534 .It Cd kDC Ns \0or Cd *4
4535 \(em shifted variant.
4536 .It Cd kel Ns \0or Cd kE
4537 Clear to end of line.
4538 .It Cd kext Ns \0or Cd @9
4539 Exit.
4540 .It Cd kich1 Ns \0or Cd kI
4541 Insert character.
4542 .It Cd kIC Ns \0or Cd #3
4543 \(em shifted variant.
4544 .It Cd khome Ns \0or Cd kh
4545 Home.
4546 .It Cd kHOM Ns \0or Cd #2
4547 \(em shifted variant.
4548 .It Cd kend Ns \0or Cd @7
4549 End.
4550 .It Cd knp Ns \0or Cd kN
4551 Next page.
4552 .It Cd kpp Ns \0or Cd kP
4553 Previous page.
4554 .It Cd kcub1 Ns \0or Cd kl
4555 Left cursor (with more modifiers: see below).
4556 .It Cd kLFT Ns \0or Cd #4
4557 \(em shifted variant.
4558 .It Cd kcuf1 Ns \0or Cd kr
4559 Right cursor (ditto).
4560 .It Cd kRIT Ns \0or Cd %i
4561 \(em shifted variant.
4562 .It Cd kcud1 Ns \0or Cd kd
4563 Down cursor (ditto).
4564 .It Cd kDN
4565 \(em shifted variant (only terminfo).
4566 .It Cd kcuu1 Ns \0or Cd ku
4567 Up cursor (ditto).
4568 .It Cd kUP
4569 \(em shifted variant (only terminfo).
4570 .It Cd kf0 Ns \0or Cd k0
4571 Function key 0.
4572 Add one for each function key up to
4573 .Cd kf9
4575 .Cd k9 ,
4576 respectively.
4577 .It Cd kf10 Ns \0or Cd k;
4578 Function key 10.
4579 .It Cd kf11 Ns \0or Cd F1
4580 Function key 11.
4581 Add one for each function key up to
4582 .Cd kf19
4584 .Cd F9 ,
4585 respectively.
4589 Some terminals support key-modifier combination extensions, e.g.,
4590 .Ql Alt+Shift+xy .
4591 For example, the delete key,
4592 .Cd kdch1 :
4593 in its shifted variant, the name is mutated to
4594 .Cd  kDC ,
4595 then a number is appended for the states
4596 .Ql Alt
4597 .Pf ( Cd kDC3 ) ,
4598 .Ql Shift+Alt
4599 .Pf ( Cd kDC4 ) ,
4600 .Ql Control
4601 .Pf ( Cd kDC5 ) ,
4602 .Ql Shift+Control
4603 .Pf ( Cd kDC6 ) ,
4604 .Ql Alt+Control
4605 .Pf ( Cd kDC7 ) ,
4606 finally
4607 .Ql Shift+Alt+Control
4608 .Pf ( Cd kDC8 ) .
4609 The same for the left cursor key,
4610 .Cd kcub1 :
4611 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4615 .It Ic call
4616 \*(NQ Calls the given macro, which must have been created via
4617 .Ic define
4618 (see there for more), otherwise an
4619 .Va ^ERR Ns -NOENT
4620 error occurs.
4621 Calling macros recursively will at some time excess the stack size
4622 limit, causing a hard program abortion; if recursively calling a macro
4623 is the last command of the current macro, consider to use the command
4624 .Ic xcall ,
4625 which will first release all resources of the current macro before
4626 replacing the current macro with the called one.
4630 .It Ic call_if
4631 Identical to
4632 .Ic call
4633 if the given macro has been created via
4634 .Ic define ,
4635 but does not fail nor warn if the macro does not exist.
4638 .It Ic cd
4639 Synonym for
4640 .Ic chdir .
4643 .It Ic certsave
4644 \*(OP Only applicable to S/MIME signed messages.
4645 Takes an optional message list and a filename and saves the certificates
4646 contained within the message signatures to the named file in both
4647 human-readable and PEM format.
4648 The certificates can later be used to send encrypted messages to the
4649 respective message senders by setting
4650 .Va smime-encrypt-USER@HOST
4651 variables.
4655 .It Ic charsetalias , uncharsetalias
4656 \*(NQ Manage alias mappings for (conversion of)
4657 .Sx "Character sets" .
4658 Alias processing is not performed for
4659 .Sx "INTERNAL VARIABLES" ,
4660 for example
4661 .Va charset-8bit ,
4662 and mappings are ineffective if character set conversion is not available
4663 .Pf ( Va features
4664 does not announce
4665 .Ql ,+iconv, ) .
4666 Expansion happens recursively for cases where aliases point to other
4667 aliases (built-in loop limit: 8).
4669 The latter command deletes all aliases given as arguments,
4670 or all at once when given the asterisk
4671 .Ql * .
4672 The former shows the list of all currently defined aliases if used
4673 without arguments, or the target of the given single argument;
4674 when given two arguments, hyphen-minus
4675 .Ql -
4676 being the first, the second is instead expanded recursively.
4677 In all other cases the given arguments are treated as pairs of character
4678 sets and their desired target alias name, creating new or updating
4679 already existing aliases.
4682 .It Ic chdir
4683 \*(NQ(ch) Change the working directory to
4684 .Ev HOME
4685 or the given argument.
4686 Synonym for
4687 .Ic cd .
4691 .It Ic collapse , uncollapse
4692 Only applicable to
4693 .Ql thread Ns
4695 .Ic sort
4696 mode.
4697 Takes a message list and makes all replies to these messages invisible
4698 in header summaries, except for
4699 .Ql new
4700 messages and the
4701 .Dq dot .
4702 Also when a message with collapsed replies is displayed,
4703 all of these are automatically uncollapsed.
4704 The latter command undoes collapsing.
4707 .\" FIXME review until this point
4710 .It Ic colour , uncolour
4711 \*(OP\*(NQ Manage colour mappings of and for a
4712 .Sx "Coloured display" .
4713 Without arguments the former shows all currently defined mappings.
4714 Otherwise a colour type is expected (case-insensitively),
4715 it must be one of
4716 .Ql 256
4717 for 256-colour terminals,
4718 .Ql 8 ,
4719 .Ql ansi
4721 .Ql iso
4722 for the standard 8-colour ANSI / ISO 6429 colour palette, and
4723 .Ql 1
4725 .Ql mono
4726 for monochrome terminals, which only support (some) font attributes.
4727 Without further arguments the list of all currently defined mappings
4728 of the given type is shown (here the special
4729 .Ql all
4731 .Ql *
4732 also show all currently defined mappings).
4735 Otherwise the second argument defines the mappable slot, the third
4736 argument a (comma-separated list of) colour and font attribute
4737 specification(s), and the optionally supported fourth argument can be
4738 used to specify a precondition: if conditioned mappings exist they are
4739 tested in (creation) order unless a (case-insensitive) match has been
4740 found, and the default mapping (if any has been established) will only
4741 be chosen as a last resort.
4742 The types of available preconditions depend on the mappable slot,
4743 the following of which exist:
4746 Mappings prefixed with
4747 .Ql mle-
4748 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4749 .Sx "On terminal control and line editor" )
4750 and do not support preconditions.
4752 .Bl -tag -compact -width view-partinfo
4753 .It Ar mle-position
4754 This mapping is used for the position indicator that is visible when
4755 a line cannot be fully displayed on the screen.
4756 .It Ar mle-prompt
4757 Used for the
4758 .Va prompt .
4759 .It Ar mle-error
4760 Used for the occasionally appearing error indicator that is joined onto
4761 .Va prompt .
4762 \*(ID Also used for error messages written on standard error .
4766 Mappings prefixed with
4767 .Ql sum-
4768 are used in header summaries, and they all understand the preconditions
4769 .Ql dot
4770 (the current message) and
4771 .Ql older
4772 for elder messages (only honoured in conjunction with
4773 .Va datefield-markout-older ) .
4775 .Bl -tag -compact -width view-partinfo
4776 .It Ar sum-dotmark
4777 This mapping is used for the
4778 .Dq dotmark
4779 that can be created with the
4780 .Ql %>
4782 .Ql %<
4783 formats of the variable
4784 .Va headline .
4785 .It Ar sum-header
4786 For the complete header summary line except the
4787 .Dq dotmark
4788 and the thread structure.
4789 .It Ar sum-thread
4790 For the thread structure which can be created with the
4791 .Ql %i
4792 format of the variable
4793 .Va headline .
4797 Mappings prefixed with
4798 .Ql view-
4799 are used when displaying messages.
4801 .Bl -tag -compact -width view-partinfo
4802 .It Ar view-from_
4803 This mapping is used for so-called
4804 .Ql From_
4805 lines, which are MBOX file format specific header lines (also see
4806 .Va mbox-rfc4155 ) .
4807 .It Ar view-header
4808 For header lines.
4809 A comma-separated list of headers to which the mapping applies may be
4810 given as a precondition; if the \*(OPal regular expression support is
4811 available then if any of the
4812 .Mx -sx
4813 .Sx "magic regular expression characters"
4814 is seen the precondition will be evaluated as (an extended) one.
4815 .It Ar view-msginfo
4816 For the introductional message info line.
4817 .It Ar view-partinfo
4818 For MIME part info lines.
4822 The following (case-insensitive) colour definitions and font attributes
4823 are understood, multiple of which can be specified in a comma-separated
4824 list:
4826 .Bl -tag -width ft=
4827 .It Ar ft=
4828 a font attribute:
4829 .Ql bold ,
4830 .Ql reverse
4832 .Ql underline .
4833 It is possible (and often applicable) to specify multiple font
4834 attributes for a single mapping.
4836 .It Ar fg=
4837 foreground colour attribute, in order (numbers 0 - 7)
4838 .Ql black ,
4839 .Ql red ,
4840 .Ql green ,
4841 .Ql brown ,
4842 .Ql blue ,
4843 .Ql magenta ,
4844 .Ql cyan
4846 .Ql white .
4847 To specify a 256-colour mode a decimal number colour specification in
4848 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4850 .Bl -tag -compact -width "999 - 999"
4851 .It 0 - 7
4852 the standard ISO 6429 colours, as above.
4853 .It 8 - 15
4854 high intensity variants of the standard colours.
4855 .It 16 - 231
4856 216 colours in tuples of 6.
4857 .It 232 - 255
4858 grayscale from black to white in 24 steps.
4860 .Bd -literal -offset indent
4861 #!/bin/sh -
4862 fg() { printf "\e033[38;5;${1}m($1)"; }
4863 bg() { printf "\e033[48;5;${1}m($1)"; }
4865 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4866 printf "\e033[0m\en"
4868 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4869 printf "\e033[0m\en"
4872 .It Ar bg=
4873 background colour attribute (see
4874 .Cd fg=
4875 for possible values).
4879 The command
4880 .Ic \&uncolour
4881 will remove for the given colour type (the special type
4882 .Ql *
4883 selects all) the given mapping; if the optional precondition argument is
4884 given only the exact tuple of mapping and precondition is removed.
4885 The special name
4886 .Ql *
4887 will remove all mappings (no precondition allowed), thus
4888 .Ql uncolour * *
4889 will remove all established mappings.
4894 .It Ic commandalias , uncommandalias
4895 \*(NQ Define or list, and remove, respectively, command aliases.
4896 An (command)alias can be used everywhere a normal command can be used,
4897 but always takes precedence: any arguments that are given to the command
4898 alias are joined onto the alias expansion, and the resulting string
4899 forms the command line that is, in effect, executed.
4900 The latter command removes all given aliases, the special name asterisk
4901 .Ql *
4902 will remove all existing aliases.
4903 When used without arguments the former shows a list of all currently
4904 known aliases, with one argument only the expansion of the given one.
4906 With two or more arguments a command alias is defined or updated: the
4907 first argument is the name under which the remaining command line should
4908 be accessible, the content of which can be just about anything.
4909 An alias may itself expand to another alias, but to avoid expansion loops
4910 further expansion will be prevented if an alias refers to itself or if
4911 an expansion depth limit is reached.
4912 Explicit expansion prevention is available via reverse solidus
4913 .Cm \e ,
4914 one of the
4915 .Sx "Command modifiers" .
4916 .Bd -literal -offset indent
4917 ? commandalias xx
4918 \*(uA: `commandalias': no such alias: xx
4919 ? commandalias xx echo hello,
4920 ? commandalias xx
4921 commandalias xx 'echo hello,'
4922 ? xx
4923 hello,
4924 ? xx world
4925 hello, world
4929 .It Ic Copy
4930 (C) Similar to
4931 .Ic copy ,
4932 but copy the messages to a file named after the local part of the
4933 sender of the first message instead of taking a filename argument;
4934 .Va outfolder
4935 is inspected to decide on the actual storage location.
4938 .It Ic copy
4939 (c) Copy messages to the named file and do not mark them as being saved;
4940 otherwise identical to
4941 .Ic save .
4945 .It Ic csop
4946 \*(NQ A multiplexer command which provides C-style string operations on
4947 8-bit bytes without a notion of locale settings and character sets,
4948 effectively assuming ASCII data.
4949 For numeric and other operations refer to
4950 .Ic vexpr .
4951 .Cm vput ,
4952 one of the
4953 .Sx "Command modifiers" ,
4954 is supported.
4955 The error result is
4956 .Ql -1
4957 for usage errors and numeric results, the empty string otherwise;
4958 missing data errors, as for unsuccessful searches, result in the
4959 .Va \&!
4960 error number being set to
4961 .Va ^ERR Ns -NODATA .
4962 Where the question mark
4963 .Ql \&?
4964 modifier suffix is supported, a case-insensitive (ASCII mapping)
4965 operation mode is supported; the keyword
4966 .Ql case
4967 is optional so that
4968 .Ql find?
4970 .Ql find?case
4971 are identical.
4973 .Bl -hang -width ".It Cm length"
4974 .It Cm length
4975 Queries the length of the given argument.
4977 .It Cm hash , Cm hash32
4978 Calculates a hash value of the given argument.
4979 The latter will return a 32-bit result regardless of host environment.
4980 .Ql \&?
4981 modifier suffix is supported.
4982 These use Chris Torek's hash algorithm, the resulting hash value is
4983 bit mixed as shown by Bret Mulvey.
4985 .It Cm find
4986 Search for the second in the first argument.
4987 Shows the resulting 0-based offset shall it have been found.
4988 .Ql \&?
4989 modifier suffix is supported.
4991 .It Cm substring
4992 Creates a substring of its first argument.
4993 The optional second argument is the 0-based starting offset,
4994 a negative one counts from the end;
4995 the optional third argument specifies the length of the desired result,
4996 a negative length leaves off the given number of bytes at the end of the
4997 original string; by default the entire string is used.
4998 This operation tries to work around faulty arguments (set
4999 .Va verbose
5000 for error logs), but reports them via the error number
5001 .Va \&!
5003 .Va ^ERR Ns -OVERFLOW .
5005 .It Cm trim
5006 Trim away whitespace characters from both ends of the argument.
5008 .It Cm trim-front
5009 Trim away whitespace characters from the begin of the argument.
5011 .It Cm trim-end
5012 Trim away whitespace characters from the end of the argument.
5017 .It Ic cwd
5018 Show the name of the current working directory, as reported by
5019 .Xr getcwd 3 .
5020 Supports
5021 .Cm vput
5022 (see
5023 .Sx "Command modifiers" ) .
5024 The return status is tracked via
5025 .Va \&? .
5028 .It Ic Decrypt
5029 \*(OP For unencrypted messages this command is identical to
5030 .Ic Copy ;
5031 Encrypted messages are first decrypted, if possible, and then copied.
5034 .It Ic decrypt
5035 \*(OP For unencrypted messages this command is identical to
5036 .Ic copy ;
5037 Encrypted messages are first decrypted, if possible, and then copied.
5042 .It Ic define , undefine
5043 The latter command deletes the given macro, the special name
5044 .Ql *
5045 will discard all existing macros.
5046 Deletion of (a) macro(s) can be performed from within running (a)
5047 macro(s), including self-deletion.
5048 Without arguments the former command prints the current list of macros,
5049 including their content, otherwise it defines a macro, replacing an
5050 existing one of the same name as applicable.
5053 A defined macro can be invoked explicitly by using the
5054 .Ic call ,
5055 .Ic call_if
5057 .Ic xcall
5058 commands, or implicitly if a macro hook is triggered, for example a
5059 .Va folder-hook .
5060 Execution of a macro body can be stopped from within by calling
5061 .Ic return .
5064 Temporary macro block-scope variables can be created or deleted with the
5065 .Cm local
5066 command modifier in conjunction with the commands
5067 .Ic set
5069 .Ic unset ,
5070 respectively.
5071 To enforce unrolling of changes made to (global)
5072 .Sx "INTERNAL VARIABLES"
5073 the command
5074 .Ic localopts
5075 can be used instead; its covered scope depends on how (i.e.,
5076 .Dq as what :
5077 normal macro, folder hook, hook,
5078 .Ic account
5079 switch) the macro is invoked.
5082 Inside a
5083 .Ic call Ns
5084 ed macro, the given positional parameters are implicitly local
5085 to the macro's scope, and may be accessed via the variables
5086 .Va * ,
5087 .Va @ ,
5088 .Va #
5090 .Va 1
5091 and any other positive unsigned decimal number less than or equal to
5092 .Va # .
5093 Positional parameters can be
5094 .Ic shift Ns
5095 ed, or become completely replaced, removed etc. via
5096 .Ic vpospar .
5097 A helpful command for numeric computation and string evaluations is
5098 .Ic vexpr ,
5099 .Ic csop
5100 offers C-style byte string operations.
5102 .Bd -literal -offset indent
5103 define name {
5104   command1
5105   command2
5106   ...
5107   commandN
5110 define exmac {
5111   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
5112   return 1000 0
5114 call exmac Hello macro exmac!
5115 echo ${?}/${!}/${^ERRNAME}
5121 .It Ic delete , undelete
5122 (d, u) Marks the given message list as being or not being
5123 .Ql deleted ,
5124 respectively; if no argument has been specified then the usual search
5125 for a visible message is performed, as documented for
5126 .Sx "Message list arguments" ,
5127 showing only the next input prompt if the search fails.
5128 Deleted messages will neither be saved in the
5129 .Mx -sx
5130 .Sx "secondary mailbox"
5131 .Ev MBOX
5132 nor will they be available for most other commands.
5133 If the
5134 .Va autoprint
5135 variable is set, the new
5136 .Dq dot
5137 or the last message restored, respectively, is automatically
5138 .Ic type Ns
5139 d; also see
5140 .Ic dp ,
5141 .Ic dt .
5145 .It Ic digmsg
5146 \*(NQ Digging (information out of) messages is possible through
5147 .Ic \&\&digmsg
5148 objects, which can be
5149 .Cm create Ns
5150 d for the given message number; in
5151 .Sx "Compose mode"
5152 the hyphen-minus
5153 .Ql -
5154 will instead open the message that is being composed.
5155 If a hyphen-minus is given as the optional third argument then output
5156 will be generated on the standard output channel instead of being
5157 subject to consumption by the
5158 .Ic readall
5160 .Ic read
5162 .Ic readsh )
5163 command(s).
5164 Note: output must be consumed before normal processing can continue; for
5165 .Ic \&\&digmsg
5166 objects this means each command output has to be read until the end of
5167 file (EOF) state occurs.
5170 The objects may be
5171 .Cm remove Ns
5172 d again by giving the same identifier used for creation;
5173 this step could be omitted: objects will be automatically closed
5174 when the active
5175 .Ic folder
5176 (mailbox) or the compose mode is left, respectively.
5177 In all other use cases the second argument is an object identifier,
5178 and the third and all following arguments are interpreted as via
5179 .Ic ~^
5180 (see
5181 .Sx "COMMAND ESCAPES" ) :
5183 .Bd -literal -offset indent
5184 ? vput = msgno; digmsg create $msgno
5185 ? digmsg $msgno header list;   readall x;   echon $x
5186 210 Subject From To Message-ID References In-Reply-To
5187 ? digmsg $msgno header show Subject;readall x;echon $x
5188 212 Subject
5189 \(aqHello, world'
5191 ? digmsg remove $msgno
5196 .It Ic discard
5197 (di) Identical to
5198 .Ic ignore .
5199 Superseded by the multiplexer
5200 .Ic headerpick .
5204 .It Ic dp , dt
5205 Delete the given messages and automatically
5206 .Ic type
5207 the new
5208 .Dq dot
5209 if one exists, regardless of the setting of
5210 .Va autoprint .
5213 .It Ic dotmove
5214 Move the
5215 .Dq dot
5216 up or down by one message when given
5217 .Ql +
5219 .Ql -
5220 argument, respectively.
5224 .It Ic draft , undraft
5225 Take message lists and mark each given message as being draft, or not
5226 being draft, respectively, as documented in the section
5227 .Sx "Message states" .
5230 .It Ic echo
5231 \*(NQ(ec) Print the given strings, equivalent to the shell utility
5232 .Xr echo 1 ,
5233 that is,
5234 .Sx "Shell-style argument quoting"
5235 expansion is performed and, different to the otherwise identical
5236 .Ic echon ,
5237 a trailing newline is echoed.
5238 .Cm vput
5239 as documented in
5240 .Sx "Command modifiers"
5241 is supported, and the error number
5242 .Va \&!
5243 is managed: if data is stored in a variable then the return value
5244 reflects the length of the result string in case of success and is
5245 .Ql -1
5246 on error.
5248 .Sy Remarks:
5249 this command traditionally (in BSD Mail) also performed
5250 .Sx "Filename transformations" ,
5251 which is standard incompatible and hard to handle because quoting
5252 transformation patterns is not possible; the subcommand
5253 .Cm file-expand
5255 .Ic vexpr
5256 can be used to expand filenames.
5259 .It Ic echoerr
5260 \*(NQ Identical to
5261 .Ic echo ,
5262 but the message is written to standard error, and prefixed by
5263 .Va log-prefix .
5264 Also see
5265 .Ic echoerrn .
5266 In interactive sessions the \*(OPal message ring queue for
5267 .Ic errors
5268 will be used instead, if available and
5269 .Cm vput
5270 was not used.
5273 .It Ic echon
5274 \*(NQ Identical to
5275 .Ic echo ,
5276 but does not write or store a trailing newline.
5279 .It Ic echoerrn
5280 \*(NQ Identical to
5281 .Ic echoerr ,
5282 but does not write or store a trailing newline.
5285 .It Ic edit
5286 (e) Point the text
5287 .Ev EDITOR
5288 at each message from the given list in turn.
5289 Modified contents are discarded unless the
5290 .Va writebackedited
5291 variable is set, and are not used unless the mailbox can be written to
5292 and the editor returns a successful exit status.
5293 .Ic visual
5294 can be used instead for a more display oriented editor.
5297 .It Ic elif
5298 Part of the
5299 .Ic if
5300 (see there for more),
5301 .Ic elif , else , endif
5302 conditional \(em if the condition of a preceding
5303 .Ic if
5304 was false, check the following condition and execute the following block
5305 if it evaluates true.
5308 .It Ic else
5309 (el) Part of the
5310 .Ic if
5311 (see there for more),
5312 .Ic elif , else , endif
5313 conditional \(em if none of the conditions of the preceding
5314 .Ic if
5316 .Ic elif
5317 commands was true, the
5318 .Ic else
5319 block is executed.
5322 .It Ic endif
5323 (en) Marks the end of an
5324 .Ic if
5325 (see there for more),
5326 .Ic elif , else , endif
5327 conditional execution block.
5331 .It Ic environ
5332 \*(NQ There is a strict separation in between
5333 .Sx "INTERNAL VARIABLES"
5334 and the program
5335 .Sx ENVIRONMENT ,
5336 which is inherited by child processes.
5337 Some variables of the latter are however vivid for program operation,
5338 their purpose is known, therefore they have been integrated
5339 transparently into handling of the former, as accessible via
5340 .Ic set
5342 .Ic unset .
5343 To integrate any other environment variable, and/or to export internal
5344 variables into the process environment where they normally are not, a
5345 .Cm link
5346 needs to become established with this command, for example
5349 .Dl environ link PERL5LIB TZ
5352 Afterwards changing such variables with
5353 .Ic set
5354 will cause automatic updates of the environment, too.
5355 Sufficient system support provided (it was in BSD as early as 1987, and
5356 is standardized since Y2K) removing such variables with
5357 .Ic unset
5358 will remove them also from the environment, but in any way the knowledge
5359 they ever have been
5360 .Cm link Ns
5361 ed will be lost.
5362 This implies that
5363 .Ic localopts
5364 may cause loss of such links.
5367 The subcommand
5368 .Cm unlink
5369 removes an existing link without otherwise touching variables, the
5370 .Cm set
5372 .Cm unset
5373 subcommands are identical to
5374 .Ic set
5376 .Ic unset ,
5377 but additionally update the program environment accordingly; removing
5378 a variable breaks any freely established
5379 .Cm link .
5383 .It Ic errors
5384 \*(OP As console user interfaces at times scroll error messages by too
5385 fast and/or out of scope, data can additionally be sent to an error queue
5386 manageable by this command:
5387 .Ar show
5388 or no argument will display and clear the queue,
5389 .Ar clear
5390 will only clear it.
5391 As the queue becomes filled with
5392 .Va errors-limit
5393 entries the eldest entries are being dropped.
5394 There are also the variables
5395 .Va ^ERRQUEUE-COUNT
5397 .Va ^ERRQUEUE-EXISTS .
5400 .It Ic eval
5401 \*(NQ Construct a command by concatenating the arguments, separated with
5402 a single space character, and then evaluate the result.
5403 This command passes through the exit status
5404 .Va \&?
5405 and error number
5406 .Va \&!
5407 of the evaluated command; also see
5408 .Ic call .
5409 .Bd -literal -offset indent
5410 define xxx {
5411   echo "xxx arg <$1>"
5412   shift
5413   if $# -gt 0
5414     \excall xxx "$@"
5415   endif
5417 define yyy {
5418   eval "$@ ' ball"
5420 call yyy '\ecall xxx' "b\e$'\et'u ' "
5421 call xxx arg <b      u>
5422 call xxx arg <  >
5423 call xxx arg <ball>
5427 .It Ic exit
5428 (ex or x) Exit from \*(UA without changing the active mailbox and skip
5429 any saving of messages in the
5430 .Mx -sx
5431 .Sx "secondary mailbox"
5432 .Ev MBOX ,
5433 as well as a possibly tracked line editor
5434 .Va history-file .
5435 A possibly set
5436 .Va on-account-cleanup
5437 will be invoked, however.
5438 The optional status number argument will be passed through to
5439 .Xr exit 3 .
5440 \*(ID For now it can happen that the given status will be overwritten,
5441 later this will only occur if a later error needs to be reported onto an
5442 otherwise success indicating status.
5445 .It Ic File
5446 (Fi) Like
5447 .Ic folder ,
5448 but open the mailbox read-only.
5451 .It Ic file
5452 (fi) See
5453 .Ic folder .
5457 .It Ic filetype , unfiletype
5458 \*(NQ Define, list, and remove, respectively, file handler hooks,
5459 which provide (shell) commands that enable \*(UA to load and save MBOX
5460 files from and to files with the registered file extensions, as shown
5461 and described for
5462 .Ic folder .
5463 The extensions are used case-insensitively, yet the auto-completion
5464 feature of for example
5465 .Ic folder
5466 will only work case-sensitively.
5467 An intermediate temporary file will be used to store the expanded data.
5468 The latter command will remove hooks for all given extensions, asterisk
5469 .Ql *
5470 will remove all existing handlers.
5472 When used without arguments the former shows a list of all currently
5473 defined file hooks, with one argument the expansion of the given alias.
5474 Otherwise three arguments are expected, the first specifying the file
5475 extension for which the hook is meant, and the second and third defining
5476 the load- and save commands to deal with the file type, respectively,
5477 both of which must read from standard input and write to standard
5478 output.
5479 Changing hooks will not affect already opened mailboxes (\*(ID except below).
5480 \*(ID For now too much work is done, and files are oftened read in twice
5481 where once would be sufficient: this can cause problems if a filetype is
5482 changed while such a file is opened; this was already so with the
5483 built-in support of .gz etc. in Heirloom, and will vanish in v15.
5484 \*(ID For now all handler strings are passed to the
5485 .Ev SHELL for evaluation purposes; in the future a
5486 .Ql \&!
5487 prefix to load and save commands may mean to bypass this shell instance:
5488 placing a leading space will avoid any possible misinterpretations.
5489 .Bd -literal -offset indent
5490 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
5491     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
5492     zst 'zstd -dc' 'zstd -19 -zc' \e
5493     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5494 ? set record=+sent.zst.pgp
5499 .It Ic flag , unflag
5500 Take message lists and mark the messages as being flagged, or not being
5501 flagged, respectively, for urgent/special attention.
5502 See the section
5503 .Sx "Message states" .
5506 .It Ic Folder
5507 (Fold) Like
5508 .Ic folder ,
5509 but open the mailbox read-only.
5513 .It Ic folder
5514 (fold) Open a new, or show status information of the current mailbox.
5515 If an argument is given, changes (such as deletions) will be written
5516 out, a new mailbox will be opened, the internal variables
5517 .Va mailbox-resolved
5519 .Va mailbox-display
5520 will be updated, a set according
5521 .Va folder-hook
5522 is executed, and optionally a summary of
5523 .Ic headers
5524 is displayed if the variable
5525 .Va header
5526 is set.
5529 .Sx "Filename transformations"
5530 will be applied to the
5531 .Ar name
5532 argument, and
5533 .Ql protocol://
5534 prefixes are, i.e., URL (see
5535 .Sx "On URL syntax and credential lookup" )
5536 syntax is understood, as in
5537 .Ql mbox:///tmp/somefolder .
5538 If a protocol prefix is used the mailbox type is fixated, otherwise
5539 opening none-existing
5540 .Ic folders
5541 uses the protocol defined in
5542 .Va newfolders .
5545 For the protocols
5546 .Ar mbox
5548 .Ar file
5549 (MBOX database), as well as
5550 .Ar eml
5551 (electronic mail message \*(ID read-only) the list of all registered
5552 .Ic filetype Ns
5553 s is traversed to check whether hooks shall be used to load (and save)
5554 data from (and to) the given
5555 .Ar name .
5556 Changing hooks will not affect already opened mailboxes.
5557 For example, the following creates hooks for the
5558 .Xr gzip 1
5559 compression tool and a combined compressed and encrypted format:
5561 .Bd -literal -offset indent
5562 ? filetype \e
5563     gzip 'gzip -dc' 'gzip -c' \e
5564     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5568 For historic reasons
5569 .Ic filetype Ns
5570 s provide limited (case-sensitive) auto-completion capabilities.
5571 For example
5572 .Ql mbox.gz
5573 will be found for
5574 .Ql \&? file mbox ,
5575 provided that corresponding handlers are installed.
5576 It will neither find
5577 .Ql mbox.GZ
5579 .Ql mbox.Gz
5580 however, but an explicit
5581 .Ql \&? file mbox.GZ
5582 will find and use the handler for
5583 .Ql gz .
5584 \*(ID The latter mode can only be used for MBOX files.
5587 EML files consist of only one mail message,
5588 \*(ID and can only be opened read-only.
5589 When reading MBOX files tolerant POSIX rules are used by default.
5590 Invalid message boundaries that can be found quite often in historic
5591 MBOX files will be complained about (even more with
5592 .Va debug ) :
5593 in this case the method described for
5594 .Va mbox-rfc4155
5595 can be used to create a valid MBOX database from the invalid input.
5598 MBOX databases and EML files will always be protected via file-region locks
5599 .Pf ( Xr fcntl 2 )
5600 during file operations to protect against concurrent modifications.
5601 .Mx -ix "dotlock files"
5602 \*(OP An MBOX
5603 .Va inbox
5604 .Pf ( Ev MAIL )
5606 .Mx -sx
5607 .Sx "primary system mailbox"
5608 will also be protected by so-called dotlock files,
5609 the traditional way of mail spool file locking: for any file
5610 .Ql x
5611 a lock file
5612 .Ql x.lock
5613 will be created during the synchronization, in the same directory and
5614 with the same user and group identities as the file of interest \(em
5615 as necessary created by an external privileged dotlock helper.
5616 .Va dotlock-disable
5617 disables dotlock files.
5618 Also see
5619 .Sx FAQ :
5620 .Sx "Howto handle stale dotlock files" .
5623 \*(OP If no protocol has been fixated, and
5624 .Ar name
5625 refers to a directory with the subdirectories
5626 .Ql tmp ,
5627 .Ql new
5629 .Ql cur ,
5630 then it is treated as a folder in
5631 .Dq Maildir
5632 format.
5633 The maildir format stores each message in its own file, and has been
5634 designed so that file locking is not necessary when reading or writing
5635 files.
5638 \*(OPally URLs can be used to access network resources, securely via
5639 .Sx "Encrypted network communication" ,
5640 if so supported.
5641 Network communication socket timeouts are configurable via
5642 .Va socket-connect-timeout .
5643 All network traffic may be proxied over a SOCKS server via
5644 .Va socks-proxy .
5647 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
5648 .Dl \*(OU protocol://[user@]host[:port][/path]
5651 \*(OPally supported network protocols are
5652 .Ar pop3
5653 (POP3) and
5654 .Ar pop3s
5655 (POP3 with TLS encrypted transport),
5656 .Ar imap
5658 .Ar imaps .
5660 .Ar [/path]
5661 part is valid only for IMAP; there it defaults to
5662 .Ar INBOX .
5663 Network URLs require a special encoding as documented in the section
5664 .Sx "On URL syntax and credential lookup" .
5668 .It Ic folders
5669 Lists the names of all folders below the given argument or
5670 .Va folder .
5671 For file-based protocols
5672 .Ev LISTER
5673 will be used for display purposes.
5677 .It Ic Followup , followup
5678 \*(CM(F,fo) Similar to
5679 .Ic Reply ,
5681 .Ic reply ,
5682 respectively, but save the message in a file named after the local part
5683 of the (first) recipient's address, possibly overwriting
5684 .Va record ,
5685 and honouring
5686 .Va outfolder .
5687 Also see
5688 .Ic Copy
5690 .Ic Save .
5693 .It Ic Forward
5694 \*(CM Similar to
5695 .Ic forward ,
5696 but saves the message in a file named after the local part of the
5697 recipient's address (instead of in
5698 .Va record Ns ).
5701 .It Ic forward
5702 \*(CM Take a message list and the address of a recipient, subject to
5703 .Va fullnames ,
5704 to whom the messages are sent.
5705 The text of the original message is included in the new one,
5706 enclosed by the values of
5707 .Va forward-inject-head
5709 .Va forward-inject-tail .
5710 .Va content-description-forwarded-message
5711 is inspected.
5712 The list of included headers can be filtered with the
5713 .Ql forward
5714 slot of the white- and blacklisting command
5715 .Ic headerpick .
5716 Only the first part of a multipart message is included but for
5717 .Va forward-as-attachment .
5719 This may generate the errors
5720 .Va ^ERR Ns -DESTADDRREQ
5721 if no receiver has been specified, or was rejected by
5722 .Va expandaddr
5723 policy,
5724 .Va ^ERR Ns -IO
5725 if an I/O error occurs,
5726 .Va ^ERR Ns -NOTSUP
5727 if a necessary character set conversion fails, and
5728 .Va ^ERR Ns -INVAL
5729 for other errors.
5730 It can also fail with errors of
5731 .Sx "Specifying messages" .
5732 Any error stops processing of further messages.
5735 .It Ic from
5736 (f) Takes a list of message specifications and displays a summary of
5737 their message headers, exactly as via
5738 .Ic headers ,
5739 making the first message of the result the new
5740 .Dq dot
5741 (the last message if
5742 .Va showlast
5743 is set).
5744 An alias of this command is
5745 .Ic search .
5746 Also see
5747 .Sx "Specifying messages" .
5749 .It Ic Fwd
5750 \*(OB Alias for
5751 .Ic Forward .
5753 .It Ic fwd
5754 \*(OB Alias for
5755 .Ic forward .
5757 .It Ic fwdignore
5758 \*(OB Superseded by the multiplexer
5759 .Ic headerpick .
5761 .It Ic fwdretain
5762 \*(OB Superseded by the multiplexer
5763 .Ic headerpick .
5765 .It Ic ghost , unghost
5766 \*(OB Replaced by
5767 .Ic commandalias ,
5768 .Ic uncommandalias .
5772 .It Ic headerpick , unheaderpick
5773 \*(NQ Multiplexer command to manage white- and blacklisting
5774 selections of header fields for a variety of applications.
5775 Without arguments the set of contexts that have settings is displayed.
5776 When given arguments, the first argument is the context to which the
5777 command applies, one of (case-insensitive)
5778 .Ql type
5779 for display purposes (for example
5780 .Ic type ) ,
5781 .Ql save
5782 for selecting which headers shall be stored persistently when
5783 .Ic save ,
5784 .Ic copy ,
5785 .Ic move
5786 or even
5787 .Ic decrypt Ns
5788 ing messages (note that MIME related etc. header fields should not be
5789 ignored in order to not destroy usability of the message in this case),
5790 .Ql forward
5791 for stripping down messages when
5792 .Ic forward Ns
5793 ing message (has no effect if
5794 .Va forward-as-attachment
5795 is set), and
5796 .Ql top
5797 for defining user-defined set of fields for the command
5798 .Ic top .
5800 The current settings of the given context are displayed if it is the
5801 only argument.
5802 A second argument denotes the type of restriction that is to be chosen,
5803 it may be (a case-insensitive prefix of)
5804 .Ql retain
5806 .Ql ignore
5807 for white- and blacklisting purposes, respectively.
5808 Establishing a whitelist suppresses inspection of the corresponding
5809 blacklist.
5811 If no further argument is given the current settings of the given type
5812 will be displayed, otherwise the remaining arguments specify header
5813 fields, which \*(OPally may be given as regular expressions, to be added
5814 to the given type.
5815 The special wildcard field (asterisk,
5816 .Ql * )
5817 will establish a (fast) shorthand setting which covers all fields.
5819 The latter command always takes three or more arguments and can be used
5820 to remove selections, i.e., from the given context, the given type of
5821 list, all the given headers will be removed, the special argument
5822 .Ql *
5823 will remove all headers.
5826 .It Ic headers
5827 (h) Show the current group of headers, the size of which depends on
5828 the variable
5829 .Va screen
5830 in interactive mode, and the format of which can be defined with
5831 .Va headline .
5832 If a message-specification is given the group of headers containing the
5833 first message therein is shown and the message at the top of the screen
5834 becomes the new
5835 .Dq dot ;
5836 the last message is targeted if
5837 .Va showlast
5838 is set.
5841 .It Ic help
5842 (hel) A synonym for
5843 .Ic \&? .
5846 .It Ic history
5847 \*(OP Without arguments or when given
5848 .Cm show
5849 all history entries are shown (this mode also supports a more
5850 .Va verbose
5851 output).
5852 .Cm load
5853 will replace the list of entries with the content of
5854 .Va history-file ,
5856 .Cm save
5857 will dump all entries to said file, replacing former content, and
5858 .Cm clear
5859 will delete all entries.
5860 The argument can also be a signed decimal
5861 .Ar NUMBER ,
5862 which will select and evaluate the respective history entry, and move it
5863 to the top of the history; a negative number is used as an offset to the
5864 current command so that
5865 .Ql -1
5866 will select the last command, the history top, whereas
5867 .Cm delete
5868 will delete all given entries
5869 .Pf ( Ar :NUMBER: ) .
5870 Also see
5871 .Sx "On terminal control and line editor" .
5874 .It Ic hold
5875 (ho, also
5876 .Ic preserve )
5877 Takes a message list and marks each message therein to be saved in the
5878 user's system
5879 .Va inbox
5880 instead of in the
5881 .Mx -sx
5882 .Sx "secondary mailbox"
5883 .Ev MBOX .
5884 Does not override the
5885 .Ic delete
5886 command.
5887 \*(UA deviates from the POSIX standard with this command, because a
5888 .Ic next
5889 command issued after
5890 .Ic hold
5891 will display the following message, not the current one.
5895 .It Ic if
5896 (i) Part of the
5897 .Ic \&\&if , Ic elif , else , endif
5898 conditional execution construct \(em if the given condition is true then
5899 the encapsulated block is executed.
5900 The POSIX standard only supports the (case-insensitive) conditions
5901 .Ql r Ns
5902 eceive
5904 .Ql s Ns
5905 end, the remaining are non-portable extensions.
5906 \*(ID In conjunction with the
5907 .Cm wysh
5908 command prefix(es)
5909 .Sx "Shell-style argument quoting"
5910 and more test operators are available.
5912 .Bd -literal -offset indent
5913 if receive
5914   commands ...
5915 else
5916   commands ...
5917 endif
5921 Further (case-insensitive) one-argument conditions are
5922 .Ql t Ns
5923 erminal which evaluates to true in interactive terminal sessions
5924 (running with standard input or standard output attached to a terminal,
5925 and none of the
5926 .Dq quickrun
5927 command line options
5928 .Fl e ,
5929 .Fl H
5931 .Fl L
5932 have been used), as well as any boolean value (see
5933 .Sx "INTERNAL VARIABLES"
5934 for textual boolean representations) to mark an enwrapped block as
5935 .Dq never execute
5937 .Dq always execute .
5938 (Remarks: condition syntax errors skip all branches until
5939 .Ic endif . )
5942 \*(OU and without
5943 .Cm wysh :
5944 It is possible to check
5945 .Sx "INTERNAL VARIABLES"
5946 as well as
5947 .Sx ENVIRONMENT
5948 variables for existence or compare their expansion against a user given
5949 value or another variable by using the
5950 .Ql $
5951 .Pf ( Dq variable next )
5952 conditional trigger character;
5953 a variable on the right hand side may be signalled using the same
5954 mechanism.
5955 Variable names may be enclosed in a pair of matching braces.
5956 When this mode has been triggered, several operators are available
5957 (\*(IN and
5958 .Cm wysh :
5959 they are always available, and there is no trigger: variables will have
5960 been expanded by the shell-compatible parser before the
5961 .Ic if
5962 etc. command sees them).
5965 \*(IN Two argument conditions.
5966 Variables can be tested for existence and expansion:
5967 .Ql -N
5968 will test whether the given variable exists, so that
5969 .Ql -N editalong
5970 will evaluate to true when
5971 .Va editalong
5972 is set, whereas
5973 .Ql -Z editalong
5974 will if it is not.
5975 .Ql -n """$editalong"""
5976 will be true if the variable is set and expands to a non-empty string,
5977 .Ql -z $'\e$editalong'
5978 only if the expansion is empty, whether the variable exists or not.
5979 The remaining conditions take three arguments.
5982 Integer operators treat the arguments on the left and right hand side of
5983 the operator as integral numbers and compare them arithmetically.
5984 It is an error if any of the operands is not a valid integer, an empty
5985 argument (which implies it had been quoted) is treated as if it were 0.
5986 Via the question mark
5987 .Ql \&?
5988 modifier suffix a saturated operation mode is available where numbers
5989 will linger at the minimum or maximum possible value, instead of
5990 overflowing (or trapping), the keyword
5991 .Ql saturated
5992 is optional,
5993 .Ql ==? ,
5994 .Ql ==?satu
5996 .Ql ==?saturated
5997 are therefore identical.
5998 Available operators are
5999 .Ql -lt
6000 (less than),
6001 .Ql -le
6002 (less than or equal to),
6003 .Ql -eq
6004 (equal),
6005 .Ql -ne
6006 (not equal),
6007 .Ql -ge
6008 (greater than or equal to), and
6009 .Ql -gt
6010 (greater than).
6013 String and regular expression data operators compare the left and right
6014 hand side according to their textual content.
6015 Unset variables are treated as the empty string.
6016 Via the question mark
6017 .Ql \&?
6018 modifier suffix a case-insensitive operation mode is available, the keyword
6019 .Ql case
6020 is optional,
6021 .Ql ==?
6023 .Ql ==?case
6024 are identical.
6027 Available string operators are
6028 .Ql <
6029 (less than),
6030 .Ql <=
6031 (less than or equal to),
6032 .Ql ==
6033 (equal),
6034 .Ql !=
6035 (not equal),
6036 .Ql >=
6037 (greater than or equal to),
6038 .Ql >
6039 (greater than),
6040 .Ql =%
6041 (is substring of) and
6042 .Ql !%
6043 (is not substring of).
6044 By default these operators work on bytes and (therefore) do not take
6045 into account character set specifics.
6046 If the case-insensitivity modifier has been used, case is ignored
6047 according to the rules of the US-ASCII encoding, i.e., bytes are
6048 still compared.
6051 When the \*(OPal regular expression support is available, the additional
6052 string operators
6053 .Ql =~
6055 .Ql !~
6056 can be used.
6057 They treat the right hand side as an extended regular expression that is
6058 matched according to the active locale (see
6059 .Sx "Character sets" ) ,
6060 i.e., character sets should be honoured correctly.
6063 Conditions can be joined via AND-OR lists (where the AND operator is
6064 .Ql &&
6065 and the OR operator is
6066 .Ql || ) ,
6067 which have equal precedence and will be evaluated with left
6068 associativity, thus using the same syntax that is known for the
6069 .Xr sh 1 .
6070 It is also possible to form groups of conditions and lists by enclosing
6071 them in pairs of brackets
6072 .Ql [\ \&.\&.\&.\ ] ,
6073 which may be interlocked within each other, and also be joined via
6074 AND-OR lists.
6077 The results of individual conditions and entire groups may be modified
6078 via unary operators: the unary operator
6079 .Ql \&!
6080 will reverse the result.
6082 .Bd -literal -offset indent
6083 wysh set v15-compat=yes # with value: automatic "wysh"!
6084 if -N debug;echo *debug* set;else;echo not;endif
6085 if "$ttycharset" == UTF-8 || "$ttycharset" ==?cas UTF8
6086   echo ttycharset is UTF-8, the former case-sensitive!
6087 endif
6088 set t1=one t2=one
6089 if [ "${t1}" == "${t2}" ]
6090   echo These two variables are equal
6091 endif
6092 if "$features" =% ,+regex, && "$TERM" =~?case ^xterm\&.*
6093   echo ..in an X terminal
6094 endif
6095 if [ [ true ] && [ [ "${debug}" != '' ] || \e
6096     [ "$verbose" != '' ] ] ]
6097   echo Noisy, noisy
6098 endif
6099 if true && [ -n "$debug" || -n "${verbose}" ]
6100   echo Left associativity, as is known from the shell
6101 endif
6106 .It Ic ignore
6107 (ig) Identical to
6108 .Ic discard .
6109 Superseded by the multiplexer
6110 .Ic headerpick .
6113 .It Ic list
6114 Shows the names of all available commands, in command lookup order.
6115 \*(OP In conjunction with a set variable
6116 .Va verbose
6117 additional information will be provided for each command: the argument
6118 type will be indicated, the documentation string will be shown,
6119 and the set of command flags will show up:
6121 .Bl -tag -compact -width ".It Ql NEEDS_BOX"
6122 .It Ql "`local'"
6123 command supports the command modifier
6124 .Cm local .
6125 .It Ql "`vput'"
6126 command supports the command modifier
6127 .Cm vput .
6128 .It Ql "*!*"
6129 the error number is tracked in
6130 .Va \&! .
6131 .It Ql needs-box
6132 whether the command needs an active mailbox, a
6133 .Ic folder .
6134 .It Ql ok:
6135 indicators whether command is \&.\h'.3m'.\h'.3m'.
6136 .Bl -tag -compact -width ".It Ql SUBPROCESS"
6137 .It Ql batch/interactive
6138 usable in interactive or batch mode
6139 .Pf ( Fl # ) .
6140 .It Ql send-mode
6141 usable in send mode.
6142 .It Ql subprocess
6143 allowed to be used when running in a subprocess instance,
6144 for example from within a macro that is called via
6145 .Va on-compose-splice .
6147 .It Ql not ok:
6148 indicators whether command is not \&.\h'.3m'.\h'.3m'.
6149 .Bl -tag -compact -width ".It Ql COMPOSE_MODE"
6150 .It Ql compose mode
6151 available in
6152 .Sx "Compose mode".
6153 .It Ql startup
6154 available during program startup, like in
6155 .Sx "Resource files" .
6157 .It Ql "gabby"
6158 The command produces
6159 .Va history-gabby
6160 .Ic history
6161 entries.
6166 .It Ic localopts
6167 Enforce change localization of
6168 .Ic environ
6169 (linked)
6170 .Sx ENVIRONMENT
6171 as well as (global)
6172 .Sx "INTERNAL VARIABLES" ,
6173 meaning that their state will be reverted to the former one once the
6174 .Dq covered scope
6175 is left.
6176 Just like the command modifier
6177 .Cm local ,
6178 which provides block-scope localization for some commands (instead),
6179 it can only be used inside of macro definition blocks introduced by
6180 .Ic account
6182 .Ic define .
6183 The covered scope of an
6184 .Ic account
6185 is left once a different account is activated, and some macros, notably
6186 .Va folder-hook Ns s ,
6187 use their own specific notion of covered scope, here it will be extended
6188 until the folder is left again.
6191 This setting stacks up: i.e., if
6192 .Ql macro1
6193 enables change localization and calls
6194 .Ql macro2 ,
6195 which explicitly resets localization, then any value changes within
6196 .Ql macro2
6197 will still be reverted when the scope of
6198 .Ql macro1
6199 is left.
6200 (Caveats: if in this example
6201 .Ql macro2
6202 changes to a different
6203 .Ic account
6204 which sets some variables that are already covered by localizations,
6205 their scope will be extended, and in fact leaving the
6206 .Ic account
6207 will (thus) restore settings in (likely) global scope which actually
6208 were defined in a local, macro private context!)
6211 This command takes one or two arguments, the optional first one
6212 specifies an attribute that may be one of
6213 .Cm \&\&scope ,
6214 which refers to the current scope and is thus the default,
6215 .Cm call ,
6216 which causes any macro that is being
6217 .Ic call Ns
6218 ed to be started with localization enabled by default, as well as
6219 .Cm call-fixate ,
6220 which (if enabled) disallows any called macro to turn off localization:
6221 like this it can be ensured that once the current scope regains control,
6222 any changes made in deeper levels have been reverted.
6223 The latter two are mutually exclusive, and neither affects
6224 .Ic xcall .
6225 The (second) argument is interpreted as a boolean (string, see
6226 .Sx "INTERNAL VARIABLES" )
6227 and states whether the given attribute shall be turned on or off.
6229 .Bd -literal -offset indent
6230 define temporary_settings {
6231   set possibly_global_option1
6232   localopts on
6233   set localized_option1
6234   set localized_option2
6235   localopts scope off
6236   set possibly_global_option2
6243 .It Ic Lfollowup , Lreply
6244 \*(CM Reply to messages that come in via known
6245 .Pf ( Ic mlist )
6246 or subscribed
6247 .Pf ( Ic mlsubscribe )
6248 mailing lists, or pretend to do so (see
6249 .Sx "Mailing lists" ) :
6250 on top of the usual
6251 .Ic followup
6253 .Ic reply ,
6254 respectively, functionality this will actively resort and even remove
6255 message recipients in order to generate a message that is supposed to be
6256 sent to a mailing list.
6257 For example it will also implicitly generate a
6258 .Ql Mail-Followup-To:
6259 header if that seems useful, regardless of the setting of the variable
6260 .Va followup-to .
6261 For more documentation please refer to
6262 .Sx "On sending mail, and non-interactive mode" .
6264 This may generate the errors
6265 .Va ^ERR Ns -DESTADDRREQ
6266 if no receiver has been specified,
6267 .Va ^ERR Ns -PERM
6268 if some addressees where rejected by
6269 .Va expandaddr ,
6270 .Va ^ERR Ns -IO
6271 if an I/O error occurs,
6272 .Va ^ERR Ns -NOTSUP
6273 if a necessary character set conversion fails, and
6274 .Va ^ERR Ns -INVAL
6275 for other errors.
6276 It can also fail with errors of
6277 .Sx "Specifying messages" .
6278 Occurrence of some of the errors depend on the value of
6279 .Va expandaddr .
6280 Any error stops processing of further messages.
6283 .It Ic Mail
6284 \*(CM Similar to
6285 .Ic mail ,
6286 but saves the message in a file named after the local part of the first
6287 recipient's address (instead of in
6288 .Va record Ns ).
6291 .It Ic mail
6292 \*(CM(m) Takes a (list of) recipient address(es) as (an) argument(s),
6293 or asks on standard input if none were given;
6294 then collects the remaining mail content and sends it out.
6295 Unless the internal variable
6296 .Va fullnames
6297 is set recipient addresses will be stripped from comments, names etc.
6298 For more documentation please refer to
6299 .Sx "On sending mail, and non-interactive mode" .
6301 This may generate the errors
6302 .Va ^ERR Ns -DESTADDRREQ
6303 if no receiver has been specified,
6304 .Va ^ERR Ns -PERM
6305 if some addressees where rejected by
6306 .Va expandaddr ,
6307 .Va ^ERR Ns -NOTSUP
6308 if multiple messages have been specified,
6309 .Va ^ERR Ns -IO
6310 if an I/O error occurs,
6311 .Va ^ERR Ns -NOTSUP
6312 if a necessary character set conversion fails, and
6313 .Va ^ERR Ns -INVAL
6314 for other errors.
6315 It can also fail with errors of
6316 .Sx "Specifying messages" .
6317 Occurrence of some of the errors depend on the value of
6318 .Va expandaddr .
6321 .It Ic mailcap
6322 \*(OP When used without arguments or if
6323 .Ar show
6324 has been given the content of
6325 .Sx "The Mailcap files"
6326 cache is shown, (re-)initializing it first (as necessary.
6327 If the argument is
6328 .Ar load
6329 then the cache will only be (re-)initialized, and
6330 .Ar clear
6331 will remove its contents.
6332 Note that \*(UA will try to load the files only once, use
6333 .Ql Ic \&\&mailcap Ns \:\0\:clear
6334 to unlock further attempts.
6335 Loading and parsing can be made more
6336 .Va verbose .
6339 .It Ic mbox
6340 (mb) The given message list is to be sent to the
6341 .Mx -sx
6342 .Sx "secondary mailbox"
6343 .Ev MBOX
6344 when \*(UA is quit; this is the default action unless the variable
6345 .Va hold
6346 is set.
6347 \*(ID This command can only be used in a
6348 .Mx -sx
6349 .Sx "primary system mailbox" .
6353 .It Ic mimetype , unmimetype
6354 \*(NQ Without arguments the content of the MIME type cache will displayed;
6355 a more verbose listing will be produced if either of
6356 .Va debug
6358 .Va verbose
6359 are set.
6360 When given arguments they will be joined, interpreted as shown in
6361 .Sx "The mime.types files"
6362 (also see
6363 .Sx "HTML mail and MIME attachments" ) ,
6364 and the resulting entry will be added (prepended) to the cache.
6365 In any event MIME type sources are loaded first as necessary \(en
6366 .Va mimetypes-load-control
6367 can be used to fine-tune which sources are actually loaded.
6369 The latter command deletes all specifications of the given MIME type, thus
6370 .Ql \&? unmimetype text/plain
6371 will remove all registered specifications for the MIME type
6372 .Ql text/plain .
6373 The special name
6374 .Ql *
6375 will discard all existing MIME types, just as will
6376 .Ql reset ,
6377 but which also reenables cache initialization via
6378 .Va mimetypes-load-control .
6381 .It Ic mimeview
6382 \*(ID Only available in interactive mode, this command allows execution
6383 of external MIME type handlers which do not integrate into the normal
6384 .Ic type
6385 output (see
6386 .Sx "HTML mail and MIME attachments" ) .
6387 (\*(ID No syntax to directly address parts, this restriction may vanish.)
6388 The user will be asked for each non-text part of the given message in
6389 turn whether the registered handler shall be used to display the part.
6393 .It Ic mlist , unmlist
6394 \*(NQ Manage the list of known
6395 .Sx "Mailing lists" ;
6396 subscriptions are controlled via
6397 .Ic mlsubscribe .
6398 The latter command deletes all given arguments,
6399 or all at once when given the asterisk
6400 .Ql * .
6401 The former shows the list of all currently known lists if used
6402 without arguments, otherwise the given arguments will become known.
6403 \*(OP In the latter case, arguments which contain any of the
6404 .Mx -sx
6405 .Sx "magic regular expression characters"
6406 will be interpreted as one, possibly matching many addresses;
6407 these will be sequentially matched via linked lists instead of being
6408 looked up in a dictionary.
6412 .It Ic mlsubscribe , unmlsubscribe
6413 Building upon the command pair
6414 .Ic mlist , unmlist ,
6415 but only managing the subscription attribute of mailing lists.
6416 (The former will also create not yet existing mailing lists.)
6419 .It Ic Move
6420 Similar to
6421 .Ic move ,
6422 but move the messages to a file named after the local part of the
6423 sender of the first message instead of taking a filename argument;
6424 .Va outfolder
6425 is inspected to decide on the actual storage location.
6428 .It Ic move
6429 Acts like
6430 .Ic copy
6431 but marks the messages for deletion if they were transferred
6432 successfully.
6435 .It Ic More
6436 Like
6437 .Ic more ,
6438 but also displays header fields which would not pass the
6439 .Ic headerpick
6440 selection, and all MIME parts.
6441 Identical to
6442 .Ic Page .
6445 .It Ic more
6446 Invokes the
6447 .Ev PAGER
6448 on the given messages, even in non-interactive mode and as long as the
6449 standard output is a terminal.
6450 Identical to
6451 .Ic page .
6454 .It Ic mtaaliases
6455 \*(OP When used without arguments or if
6456 .Ar show
6457 has been given the content of the
6458 .Va mta-aliases
6459 cache is shown, (re-)initializing it first (as necessary).
6460 If the argument is
6461 .Ar load
6462 then the cache will only be (re-)initialized, and
6463 .Ar clear
6464 will remove its contents.
6467 .It Ic netrc
6468 \*(OP When used without arguments, or when the argument was
6469 .Ar show
6470 the content of the
6471 .Pa \*(VN
6472 cache is shown, initializing it as necessary.
6473 If the argument is
6474 .Ar load
6475 then the cache will be (re)loaded, whereas
6476 .Ar clear
6477 removes it.
6478 Loading and parsing can be made more
6479 .Va verbose .
6480 .Ar lookup
6481 will query the cache for the URL given as the second argument
6482 .Pf ( Ql [USER@]HOST ) .
6484 .Va netrc-lookup ,
6485 .Va netrc-pipe
6486 and the section
6487 .Sx "On URL syntax and credential lookup" ;
6488 the section
6489 .Sx "The .netrc file"
6490 documents the file format in detail.
6493 .It Ic newmail
6494 Checks for new mail in the current folder without committing any changes
6495 before.
6496 If new mail is present, a message is shown.
6497 If the
6498 .Va header
6499 variable is set,
6500 the headers of each new message are also shown.
6501 This command is not available for all mailbox types.
6504 .It Ic next
6505 (n) (like
6506 .Ql +
6508 .Dq ENTER )
6509 Goes to the next message in sequence and types it.
6510 With an argument list, types the next matching message.
6513 .It Ic New
6514 Same as
6515 .Ic Unread .
6518 .It Ic new
6519 Same as
6520 .Ic unread .
6523 .It Ic noop
6524 If the current folder is accessed via a network connection, a
6525 .Dq NOOP
6526 command is sent, otherwise no operation is performed.
6529 .It Ic Page
6530 Like
6531 .Ic page ,
6532 but also displays header fields which would not pass the
6533 .Ic headerpick
6534 selection, and all MIME parts.
6535 Identical to
6536 .Ic More .
6539 .It Ic page
6540 Invokes the
6541 .Ev PAGER
6542 on the given messages, even in non-interactive mode and as long as the
6543 standard output is a terminal.
6544 Identical to
6545 .Ic more .
6548 .It Ic Pipe
6549 Like
6550 .Ic pipe
6551 but also pipes header fields which would not pass the
6552 .Ic headerpick
6553 selection, and all parts of MIME
6554 .Ql multipart/alternative
6555 messages.
6558 .It Ic pipe
6559 (pi) Takes an optional message list and shell command (that defaults to
6560 .Va cmd ) ,
6561 and pipes the messages through the command.
6562 If the
6563 .Va page
6564 variable is set,
6565 every message is followed by a formfeed character.
6568 .It Ic preserve
6569 (pre) A synonym for
6570 .Ic hold .
6573 .It Ic Print
6574 (P) Alias for
6575 .Ic Type .
6578 .It Ic print
6579 (p) Research
6581 equivalent of
6582 .Ic type .
6585 .It Ic quit
6586 (q) Terminates the session, saving all undeleted, unsaved messages in
6587 the current
6588 .Mx -sx
6589 .Sx "secondary mailbox"
6590 .Ev MBOX ,
6591 preserving all messages marked with
6592 .Ic hold
6594 .Ic preserve
6595 or never referenced in the system
6596 .Va inbox ,
6597 and removing all other messages from the
6598 .Mx -sx
6599 .Sx "primary system mailbox" .
6600 If new mail has arrived during the session,
6601 the message
6602 .Dq You have new mail
6603 will be shown.
6604 If given while editing a mailbox file with the command line option
6605 .Fl f ,
6606 then the edit file is rewritten.
6607 A return to the shell is effected,
6608 unless the rewrite of edit file fails,
6609 in which case the user can escape with the exit command.
6610 The optional status number argument will be passed through to
6611 .Xr exit 3 .
6612 \*(ID For now it can happen that the given status will be overwritten,
6613 later this will only occur if a later error needs to be reported onto an
6614 otherwise success indicating status.
6617 .It Ic read
6618 \*(NQ Read a line from standard input, or the channel set active via
6619 .Ic readctl ,
6620 and assign the data, which will be split as indicated by
6621 .Va ifs ,
6622 to the given variables.
6623 The variable names are checked by the same rules as documented for
6624 .Cm vput ,
6625 and the same error codes will be seen in
6626 .Va \&! ;
6627 the exit status
6628 .Va \&?
6629 indicates the number of bytes read, it will be
6630 .Ql -1
6631 with the error number
6632 .Va \&!
6633 set to
6634 .Va ^ERR Ns -BADF
6635 in case of I/O errors, or
6636 .Va ^ERR Ns -NONE
6637 upon End-Of-File.
6638 If there are more fields than variables, assigns successive fields to the
6639 last given variable.
6640 If there are less fields than variables, assigns the empty string to the
6641 remains.
6642 .Bd -literal -offset indent
6643 ? read a b c
6644    H  e  l  l  o
6645 ? echo "<$a> <$b> <$c>"
6646 <H> <e> <l  l  o>
6647 ? wysh set ifs=:; read a b c;unset ifs
6648 hey2.0,:"'you    ",:world!:mars.:
6649 ? echo $?/$^ERRNAME / <$a><$b><$c>
6650 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
6654 .It Ic readsh
6655 \*(NQ Like
6656 .Ic read ,
6657 but splits on shell token boundaries (see
6658 .Sx "Shell-style argument quoting" )
6659 rather than at
6660 .Va ifs .
6661 \*(ID Could become a
6662 .Ic commandalias ,
6663 maybe
6664 .Ql read --tokenize -- .
6667 .It Ic readall
6668 \*(NQ Read anything from standard input, or the channel set active via
6669 .Ic readctl ,
6670 and assign the data to the given variable.
6671 The variable name is checked by the same rules as documented for
6672 .Cm vput ,
6673 and the same error codes will be seen in
6674 .Va \&! ;
6675 the exit status
6676 .Va \&?
6677 indicates the number of bytes read, it will be
6678 .Ql -1
6679 with the error number
6680 .Va \&!
6681 set to
6682 .Va ^ERR Ns -BADF
6683 in case of I/O errors, or
6684 .Va ^ERR Ns -NONE
6685 upon End-Of-File.
6686 \*(ID The input data length is restricted to 31-bits.
6689 .It Ic readctl
6690 \*(NQ Manages input channels for
6691 .Ic read ,
6692 .Ic readsh
6694 .Ic readall ,
6695 to be used to avoid complicated or impracticable code, like calling
6696 .Ic \&\&read
6697 from within a macro in non-interactive mode.
6698 Without arguments, or when the first argument is
6699 .Cm show ,
6700 a listing of all known channels is printed.
6701 Channels can otherwise be
6702 .Cm create Ns
6703 d, and existing channels can be
6704 .Cm set
6705 active and
6706 .Cm remove Ns
6707 d by giving the string used for creation.
6709 The channel name is expected to be a file descriptor number, or,
6710 if parsing the numeric fails, an input file name that undergoes
6711 .Sx "Filename transformations" .
6712 For example (this example requires a modern shell):
6713 .Bd -literal -offset indent
6714 $ printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
6715   \*(uA -R#
6716 hey, you
6717 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
6718   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
6719 hey, you
6723 .It Ic remove
6724 \*(NQ Removes the named files or directories.
6725 If a name refers to a mailbox, say a Maildir mailbox, then a mailbox
6726 type specific removal will be performed, deleting the complete mailbox.
6727 In interactive mode the user is asked for confirmation.
6730 .It Ic rename
6731 \*(NQ Takes the name of an existing folder
6732 and the name for the new folder
6733 and renames the first to the second one.
6734 .Sx "Filename transformations"
6735 including shell pathname wildcard pattern expansions
6736 .Pf ( Xr glob 7 )
6737 are performed on both arguments.
6738 Both folders must be of the same type.
6742 .It Ic Reply , Respond
6743 \*(CM(R) Identical to
6744 .Ic reply
6745 except that it replies to only the sender of each message of the given
6746 list, by using the first message as the template to quote, for the
6747 .Ql Subject:
6748 etc.; setting
6749 .Va flipr
6750 will exchange this command with
6751 .Ic reply .
6755 .It Ic reply , respond
6756 \*(CM(r) Take a message (list) and group-respond (to each in turn)
6757 by addressing the sender and all recipients, subject to
6758 .Va fullnames
6760 .Ic alternates
6761 processing.
6762 .Va followup-to ,
6763 .Va followup-to-honour ,
6764 .Va reply-to-honour
6765 as well as
6766 .Va recipients-in-cc
6767 influence response behaviour.
6768 .Va quote
6769 as well as
6770 .Va quote-as-attachment
6771 configure whether responded-to message shall be quoted etc.,
6772 .Va content-description-quote-attachment
6773 may be used.
6774 Setting
6775 .Va flipr
6776 will exchange this command with
6777 .Ic Reply .
6778 The command
6779 .Ic Lreply
6780 offers special support for replying to mailing lists.
6781 For more documentation please refer to
6782 .Sx "On sending mail, and non-interactive mode" .
6784 This may generate the errors
6785 .Va ^ERR Ns -DESTADDRREQ
6786 if no receiver has been specified, or was rejected by
6787 .Va expandaddr
6788 policy,
6789 .Va ^ERR Ns -IO
6790 if an I/O error occurs,
6791 .Va ^ERR Ns -NOTSUP
6792 if a necessary character set conversion fails, and
6793 .Va ^ERR Ns -INVAL
6794 for other errors.
6795 It can also fail with errors of
6796 .Sx "Specifying messages" .
6797 Any error stops processing of further messages.
6800 .It Ic Resend
6801 Like
6802 .Ic resend ,
6803 but does not add any header lines.
6804 This is not a way to hide the sender's identity,
6805 but useful for sending a message again to the same recipients.
6808 .It Ic resend
6809 Takes a list of messages and a name,
6810 and sends each message to the given addressee, which is subject to
6811 .Va fullnames .
6812 .Ql Resent-From:
6813 and related header fields are prepended to the new copy of the message.
6814 Saving in
6815 .Va record
6816 is only performed if
6817 .Va record-resent
6818 is set.
6819 \*(ID\*(CM is not entered, the only supported hooks are
6820 .Va on-resend-enter
6822 .Va on-resend-cleanup .
6824 This may generate the errors
6825 .Va ^ERR Ns -DESTADDRREQ
6826 if no receiver has been specified, or was rejected by
6827 .Va expandaddr
6828 policy,
6829 .Va ^ERR Ns -IO
6830 if an I/O error occurs,
6831 .Va ^ERR Ns -NOTSUP
6832 if a necessary character set conversion fails, and
6833 .Va ^ERR Ns -INVAL
6834 for other errors.
6835 It can also fail with errors of
6836 .Sx "Specifying messages" .
6837 Any error stops processing of further messages.
6840 .It Ic retain
6841 (ret) Superseded by the multiplexer
6842 .Ic headerpick .
6845 .It Ic return
6846 Only available inside of a
6847 .Ic define Ns
6848 d macro or an
6849 .Ic account ,
6850 this command returns control of execution to the outer scope.
6851 The two optional parameters are positive decimal numbers and default to 0:
6852 the first specifies the 32-bit return value (stored in
6853 .Va \&?
6854 \*(ID and later extended to 64-bit),
6855 the second the 32-bit error number (stored in
6856 .Va \&! ) .
6857 As documented for
6858 .Va \&?
6859 a non-0 exit status may cause the program to exit.
6862 .It Ic Save
6863 (S) Similar to
6864 .Ic save,
6865 but saves the messages in a file named after the local part of the
6866 sender of the first message instead of taking a filename argument;
6867 .Va outfolder
6868 is inspected to decide on the actual storage location.
6871 .It Ic save
6872 (s) Takes a message list and a filename and appends each message in turn
6873 to the end of the file.
6874 .Sx "Filename transformations"
6875 including shell pathname wildcard pattern expansions
6876 .Pf ( Xr glob 7 )
6877 is performed on the filename.
6878 If no filename is given, the
6879 .Mx -sx
6880 .Sx "secondary mailbox"
6881 .Ev MBOX
6882 is used.
6883 The filename in quotes, followed by the generated character count
6884 is echoed on the user's terminal.
6885 If editing a
6886 .Mx -sx
6887 .Sx "primary system mailbox"
6888 the messages are marked for deletion.
6889 To filter the saved header fields to the desired subset use the
6890 .Ql save
6891 slot of the white- and blacklisting command
6892 .Ic headerpick .
6893 Also see
6894 .Ic Copy .
6896 .It Ic savediscard
6897 \*(OB Superseded by the multiplexer
6898 .Ic headerpick .
6900 .It Ic saveignore
6901 \*(OB Superseded by the multiplexer
6902 .Ic headerpick .
6904 .It Ic saveretain
6905 \*(OB Superseded by the multiplexer
6906 .Ic headerpick .
6909 .It Ic search
6910 Takes a message specification (list) and displays a header summary of
6911 all matching messages, as via
6912 .Ic headers .
6913 This command is an alias of
6914 .Ic from .
6915 Also see
6916 .Sx "Specifying messages" .
6919 .It Ic seen
6920 Takes a message list and marks all messages as having been read.
6925 .It Ic set , unset
6926 (se, \*(NQ uns) The latter command will delete all given global
6927 variables, or only block-scope local ones if the
6928 .Cm local
6929 command modifier has been used.
6930 The former, when used without arguments, will show all
6931 currently known variables, being more verbose if either of
6932 .Va debug
6934 .Va verbose
6935 is set.
6936 Remarks: this list mode will not automatically link-in (known)
6937 .Sx ENVIRONMENT
6938 variables, this only happens for explicit addressing, examples are
6939 .Ic varshow ,
6940 using a variable in an
6941 .Ic if
6942 condition or a string passed to
6943 .Ic echo ,
6944 explicit
6945 .Ic \&\&set Ns
6946 ting, as well as some program-internal use cases (look-ups).
6949 Otherwise the given variables (and arguments) are set or adjusted.
6950 Arguments are of the form
6951 .Ql name=value
6952 (no space before or after
6953 .Ql = ) ,
6954 or plain
6955 .Ql name
6956 if there is no value, i.e., a boolean variable.
6957 If a name begins with
6958 .Ql no ,
6959 as in
6960 .Ql set nosave ,
6961 the effect is the same as invoking the
6962 .Ic \&\&unset
6963 command with the remaining part of the variable
6964 .Pf ( Ql unset save ) .
6965 \*(ID In conjunction with the
6966 .Cm wysh
6967 .Pf (or\0 Cm local )
6968 command prefix(es)
6969 .Sx "Shell-style argument quoting"
6970 can be used to quote arguments as necessary.
6971 \*(ID Otherwise quotation marks may be placed around any part of the
6972 assignment statement to quote blanks or tabs.
6975 When operating in global scope any
6976 .Ql name
6977 that is known to map to an environment variable will automatically cause
6978 updates in the program environment (unsetting a variable in the
6979 environment requires corresponding system support) \(em use the command
6980 .Ic environ
6981 for further environmental control.
6982 If the command modifier
6983 .Cm local
6984 has been used to enforce local scoping then the given user variables
6985 will be garbage collected when the local scope is left;
6987 .Sx "INTERNAL VARIABLES" ,
6988 however,
6989 .Cm local
6990 behaves the same as if
6991 .Ic localopts
6992 would have been set (temporarily), which means that changes are
6993 inherited by deeper scopes.
6994 Also see
6995 .Ic varshow
6996 and the sections
6997 .Sx "INTERNAL VARIABLES"
6999 .Sx ENVIRONMENT .
7001 .Bd -literal -offset indent
7002 ? wysh set indentprefix=' -> '
7003 ? wysh set atab=$'\t' aspace=' ' zero=0
7008 .It Ic shcodec
7009 Apply shell quoting rules to the given raw-data arguments.
7010 Supports
7011 .Cm vput
7012 (see
7013 .Sx "Command modifiers" ) .
7014 The first argument specifies the operation:
7015 .Ar [+]e[ncode]
7017 .Ar d[ecode]
7018 cause shell quoting to be applied to the remains of the line, and
7019 expanded away thereof, respectively.
7020 If the former is prefixed with a plus-sign, the quoted result will not
7021 be roundtrip enabled, and thus can be decoded only in the very same
7022 environment that was used to perform the encode; also see
7023 .Cd mle-quote-rndtrip .
7024 If the coding operation fails the error number
7025 .Va \&!
7026 is set to
7027 .Va ^ERR Ns -CANCELED ,
7028 and the unmodified input is used as the result; the error number may
7029 change again due to output or result storage errors.
7032 .It Ic shell
7033 \*(NQ (sh) Invokes an interactive version of the shell,
7034 and returns its exit status.
7038 .It Ic shortcut , unshortcut
7039 \*(NQ Manage the file- or pathname shortcuts as documented for
7040 .Ic folder .
7041 The latter command deletes all shortcuts given as arguments,
7042 or all at once when given the asterisk
7043 .Ql * .
7044 The former shows the list of all currently defined shortcuts if used
7045 without arguments, the target of the given with a single argument.
7046 Otherwise arguments are treated as pairs of shortcuts and their desired
7047 expansion, creating new or updating already existing ones.
7050 .It Ic shift
7051 \*(NQ Shift the positional parameter stack (starting at
7052 .Va 1 )
7053 by the given number (which must be a positive decimal),
7054 or 1 if no argument has been given.
7055 It is an error if the value exceeds the number of positional parameters.
7056 If the given number is 0, no action is performed, successfully.
7057 The stack as such can be managed via
7058 .Ic vpospar .
7059 Note this command will fail in
7060 .Ic account
7061 and hook macros unless the positional parameter stack has been
7062 explicitly created in the current context via
7063 .Ic vpospar .
7066 .It Ic show
7067 Like
7068 .Ic type ,
7069 but performs neither MIME decoding nor decryption, so that the raw
7070 message text is shown.
7073 .It Ic size
7074 (si) Shows the size in characters of each message of the given
7075 message list.
7078 .It Ic sleep
7079 \*(NQ Sleep for the specified number of seconds (and optionally
7080 milliseconds), by default interruptible.
7081 If a third argument is given the sleep will be uninterruptible,
7082 otherwise the error number
7083 .Va \&!
7084 will be set to
7085 .Va ^ERR Ns -INTR
7086 if the sleep has been interrupted.
7087 The command will fail and the error number will be
7088 .Va ^ERR Ns -OVERFLOW
7089 if the given duration(s) overflow the time datatype, and
7090 .Va ^ERR Ns -INVAL
7091 if the given durations are no valid integers.
7096 .It Ic sort , unsort
7097 The latter command disables sorted or threaded mode, returns to normal
7098 message order and, if the
7099 .Va header
7100 variable is set,
7101 displays a header summary.
7102 The former command shows the current sorting criterion when used without
7103 an argument, but creates a sorted representation of the current folder
7104 otherwise, and changes the
7105 .Ic next
7106 command and the addressing modes such that they refer to messages in
7107 the sorted order.
7108 Message numbers are the same as in regular mode.
7109 If the
7110 .Va header
7111 variable is set,
7112 a header summary in the new order is also displayed.
7113 Automatic folder sorting can be enabled by setting the
7114 .Va autosort
7115 variable, as in
7116 .Ql set autosort=thread .
7117 Possible sorting criterions are:
7120 .Bl -tag -compact -width "subject"
7121 .It Ar date
7122 Sort the messages by their
7123 .Ql Date:
7124 field, that is by the time they were sent.
7125 .It Ar from
7126 Sort messages by the value of their
7127 .Ql From:
7128 field, that is by the address of the sender.
7129 If the
7130 .Va showname
7131 variable is set, the sender's real name (if any) is used.
7132 .It Ar size
7133 Sort the messages by their size.
7134 .It spam
7135 \*(OP Sort the message by their spam score, as has been classified by
7136 .Ic spamrate .
7137 .It Ar status
7138 Sort the messages by their message status.
7139 .It Ar subject
7140 Sort the messages by their subject.
7141 .It Ar thread
7142 Create a threaded display.
7143 .It Ar to
7144 Sort messages by the value of their
7145 .Ql To:
7146 field, that is by the address of the recipient.
7147 If the
7148 .Va showname
7149 variable is set, the recipient's real name (if any) is used.
7154 .It Ic source
7155 \*(NQ (so) The source command reads commands from the given file.
7156 .Sx "Filename transformations"
7157 will be applied.
7158 If the given expanded argument ends with a vertical bar
7159 .Ql |
7160 then the argument will instead be interpreted as a shell command and
7161 \*(UA will read the output generated by it.
7162 Dependent on the settings of
7163 .Va posix
7165 .Va errexit ,
7166 and also dependent on whether the command modifier
7167 .Cm ignerr
7168 had been used, encountering errors will stop sourcing of the given input.
7169 \*(ID Note that
7170 .Ic \&\&source
7171 cannot be used from within macros that execute as
7172 .Va folder-hook Ns s
7174 .Ic account Ns s ,
7175 i.e., it can only be called from macros that were
7176 .Ic call Ns ed .
7179 .It Ic source_if
7180 \*(NQ The difference to
7181 .Ic source
7182 (beside not supporting pipe syntax aka shell command input) is that
7183 this command will not generate an error nor warn if the given file
7184 argument cannot be opened successfully.
7187 .It Ic spamclear
7188 \*(OP Takes a list of messages and clears their
7189 .Ql is-spam
7190 flag.
7193 .It Ic spamforget
7194 \*(OP Takes a list of messages and causes the
7195 .Va spam-interface
7196 to forget it has ever used them to train its Bayesian filter.
7197 Unless otherwise noted the
7198 .Ql is-spam
7199 flag of the message is inspected to chose whether a message shall be
7200 forgotten to be
7201 .Dq ham
7203 .Dq spam .
7206 .It Ic spamham
7207 \*(OP Takes a list of messages and informs the Bayesian filter of the
7208 .Va spam-interface
7209 that they are
7210 .Dq ham .
7211 This also clears the
7212 .Ql is-spam
7213 flag of the messages in question.
7216 .It Ic spamrate
7217 \*(OP Takes a list of messages and rates them using the configured
7218 .Va spam-interface ,
7219 without modifying the messages, but setting their
7220 .Ql is-spam
7221 flag as appropriate; because the spam rating headers are lost the rate
7222 will be forgotten once the mailbox is left.
7223 Refer to the manual section
7224 .Sx "Handling spam"
7225 for the complete picture of spam handling in \*(UA.
7228 .It Ic spamset
7229 \*(OP Takes a list of messages and sets their
7230 .Ql is-spam
7231 flag.
7234 .It Ic spamspam
7235 \*(OP Takes a list of messages and informs the Bayesian filter of the
7236 .Va spam-interface
7237 that they are
7238 .Dq spam .
7239 This also sets the
7240 .Ql is-spam
7241 flag of the messages in question.
7243 .It Ic thread
7244 \*(OB The same as
7245 .Ql sort thread
7246 (consider using a
7247 .Ql commandalias
7248 as necessary).
7252 .It Ic tls
7253 \*(NQ TLS information and management command multiplexer to aid in
7254 .Sx "Encrypted network communication" ,
7255 mostly available only if the term
7256 .Ql ,+sockets,
7257 is included in
7258 .Va features .
7259 Commands support
7260 .Cm vput
7261 if so documented (see
7262 .Sx "Command modifiers" ) .
7263 The result that is shown in case of errors is always the empty string,
7264 errors can be identified via the error number
7265 .Va \&! .
7266 For example, string length overflows are caught and set
7267 .Va \&!
7269 .Va ^ERR Ns -OVERFLOW .
7270 The TLS configuration is honoured, especially
7271 .Va tls-verify .
7273 .Bd -literal -offset indent
7274 ? vput tls result fingerprint pop3s://ex.am.ple
7275 ? echo $?/$!/$^ERRNAME: $result
7278 .Bl -hang -width ".It Cm random"
7279 .It Cm certchain
7280 Show the complete verified peer certificate chain.
7281 Includes informational fields in conjunction with
7282 .Va verbose .
7283 .It Cm certificate
7284 Show only the peer certificate, without any signers.
7285 Includes informational fields in conjunction with
7286 .Va verbose .
7287 .It Cm fingerprint
7288 Show the
7289 .Va tls-fingerprint-digest Ns
7290 ed fingerprint of the certificate of the given HOST
7291 .Pf ( Ql server:port ,
7292 where the port defaults to the HTTPS port, 443).
7293 .Va tls-fingerprint
7294 is actively ignored for the runtime of this command.
7299 .It Ic Top
7300 Like
7301 .Ic top
7302 but always uses the
7303 .Ic headerpick
7304 .Ql type
7305 slot for white- and blacklisting header fields.
7308 .It Ic top
7309 (to) Takes a message list and types out the first
7310 .Va toplines
7311 lines of each message on the user's terminal.
7312 Unless a special selection has been established for the
7313 .Ql top
7314 slot of the
7315 .Ic headerpick
7316 command, the only header fields that are displayed are
7317 .Ql From: ,
7318 .Ql To: ,
7319 .Ql Cc: ,
7321 .Ql Subject: .
7322 .Ic Top
7323 will always use the
7324 .Ql type
7325 .Ic headerpick
7326 selection instead.
7327 It is possible to apply compression to what is displayed by setting
7328 .Va topsqueeze .
7329 Messages are decrypted and converted to the terminal character set
7330 if necessary.
7333 .It Ic touch
7334 (tou) Takes a message list and marks the messages for saving in the
7335 .Mx -sx
7336 .Sx "secondary mailbox"
7337 .Ev MBOX .
7338 \*(UA deviates from the POSIX standard with this command,
7339 as a following
7340 .Ic next
7341 command will display the following message instead of the current one.
7344 .It Ic Type
7345 (T) Like
7346 .Ic type
7347 but also displays header fields which would not pass the
7348 .Ic headerpick
7349 selection, and all visualizable parts of MIME
7350 .Ql multipart/alternative
7351 messages.
7354 .It Ic type
7355 (t) Takes a message list and types out each message on the user's terminal.
7356 The display of message headers is selectable via
7357 .Ic headerpick .
7358 For MIME multipart messages, all parts with a content type of
7359 .Ql text ,
7360 all parts which have a registered MIME type handler (see
7361 .Sx "HTML mail and MIME attachments" )
7362 which produces plain text output, and all
7363 .Ql message
7364 parts are shown, others are hidden except for their headers.
7365 Messages are decrypted and converted to the terminal character set
7366 if necessary.
7367 The command
7368 .Ic mimeview
7369 can be used to display parts which are not displayable as plain text.
7371 .It Ic unaccount
7373 .Ic account .
7375 .It Ic unalias
7376 (una) See
7377 .Ic alias .
7379 .It Ic unanswered
7381 .Ic answered .
7383 .It Ic unbind
7385 .Ic bind .
7387 .It Ic uncollapse
7389 .Ic collapse .
7391 .It Ic uncolour
7393 .Ic colour .
7395 .It Ic undefine
7397 .Ic define .
7399 .It Ic undelete
7401 .Ic delete .
7403 .It Ic undraft
7405 .Ic draft .
7407 .It Ic unflag
7409 .Ic flag .
7411 .It Ic unfwdignore
7412 \*(OB Superseded by the multiplexer
7413 .Ic headerpick .
7415 .It Ic unfwdretain
7416 \*(OB Superseded by the multiplexer
7417 .Ic headerpick .
7420 .It Ic unignore
7421 Superseded by the multiplexer
7422 .Ic headerpick .
7424 .It Ic unmimetype
7426 .Ic mimetype .
7428 .It Ic unmlist
7430 .Ic mlist .
7432 .It Ic unmlsubscribe
7434 .Ic mlsubscribe .
7437 .It Ic Unread
7438 Same as
7439 .Ic unread .
7442 .It Ic unread
7443 Takes a message list and marks each message as not having been read.
7446 .It Ic unretain
7447 Superseded by the multiplexer
7448 .Ic headerpick .
7450 .It Ic unsaveignore
7451 \*(OB Superseded by the multiplexer
7452 .Ic headerpick .
7454 .It Ic unsaveretain
7455 \*(OB Superseded by the multiplexer
7456 .Ic headerpick .
7458 .It Ic unset
7459 \*(NQ (uns) See
7460 .Ic set .
7462 .It Ic unshortcut
7464 .Ic shortcut .
7466 .It Ic unsort
7468 .Ic short .
7470 .It Ic unthread
7471 \*(OB
7472 Same as
7473 .Ic unsort .
7476 .It Ic urlcodec
7477 Perform URL percent codec operations on the raw-data argument, rather
7478 according to RFC 3986.
7479 The first argument specifies the operation:
7480 .Ar e[ncode]
7482 .Ar d[ecode]
7483 perform plain URL percent en- and decoding, respectively.
7484 .Ar p[ath]enc[ode]
7486 .Ar p[ath]dec[ode]
7487 perform a slightly modified operation which should be better for
7488 pathnames: it does not allow a tilde
7489 .Ql ~ ,
7490 and will neither accept hyphen-minus
7491 .Ql -
7492 nor dot
7493 .Ql .
7494 as an initial character.
7495 The remains of the line form the URL data which is to be converted.
7496 This is a character set agnostic operation,
7497 and it may thus decode bytes which are invalid in the current
7498 .Va ttycharset .
7500 Supports
7501 .Cm vput
7502 (see
7503 .Sx "Command modifiers" ) ,
7504 and manages the error number
7505 .Va \&! .
7506 If the coding operation fails the error number
7507 .Va \&!
7508 is set to
7509 .Va ^ERR Ns -CANCELED ,
7510 and the unmodified input is used as the result; the error number may
7511 change again due to output or result storage errors.
7512 \*(ID This command does not know about URLs beside what is documented.
7513 .Pf ( Ic vexpr
7514 offers a
7515 .Cm makeprint
7516 subcommand, shall the URL be displayed.)
7519 .It Ic varshow
7520 \*(NQ This command produces the same output as the listing mode of
7521 .Ic set ,
7522 including
7523 .Va verbose Ns
7524 ity adjustments, but only for the given variables.
7527 .It Ic verify
7528 \*(OP Takes a message list and verifies each message.
7529 If a message is not a S/MIME signed message,
7530 verification will fail for it.
7531 The verification process checks if the message was signed using a valid
7532 certificate,
7533 if the message sender's email address matches one of those contained
7534 within the certificate,
7535 and if the message content has been altered.
7538 .It Ic version
7539 Shows the
7540 .Va version
7542 .Va features
7543 of \*(UA, optionally in a more
7544 .Va verbose
7545 form which also includes the build and running system environment.
7546 This command supports
7547 .Cm vput
7548 (see
7549 .Sx "Command modifiers" ) .
7553 .It Ic vexpr
7554 \*(NQ A multiplexer command which offers signed 64-bit numeric
7555 calculations, as well as other, mostly string-based operations.
7556 C-style byte string operations are available via
7557 .Ic csop .
7558 The first argument defines the number, type, and meaning of the
7559 remaining arguments.
7560 An empty number argument is treated as 0.
7561 Supports
7562 .Cm vput
7563 (see
7564 .Sx "Command modifiers" ) .
7565 The result shown in case of errors is
7566 .Ql -1
7567 for usage errors and numeric operations, the empty string otherwise;
7568 .Dq soft
7569 errors, like when a search operation failed, will also set the
7570 .Va \&!
7571 error number to
7572 .Va ^ERR Ns -NODATA .
7573 Except when otherwise noted numeric arguments are parsed as signed 64-bit
7574 numbers, and errors will be reported in the error number
7575 .Va \&!
7576 as the numeric error
7577 .Va ^ERR Ns -RANGE .
7580 Numeric operations work on one or two signed 64-bit integers.
7581 Numbers prefixed with
7582 .Ql 0x
7584 .Ql 0X
7585 are interpreted as hexadecimal (base 16) numbers, whereas
7586 .Ql 0
7587 indicates octal (base 8), and
7588 .Ql 0b
7589 as well as
7590 .Ql 0B
7591 denote binary (base 2) numbers.
7592 It is possible to use any base in between 2 and 36, inclusive, with the
7593 .Ql BASE#number
7594 notation, where the base is given as an unsigned decimal number, so
7595 .Ql 16#AFFE
7596 is a different way of specifying a hexadecimal number.
7597 Unsigned interpretation of a number can be enforced by prefixing an
7598 .Ql u
7599 (case-insensitively), as in
7600 .Ql u-110 ;
7601 this is not necessary for power-of-two bases (2, 4, 8, 16 and 32),
7602 which will be interpreted as unsigned by default, but it still makes
7603 a difference regarding overflow detection and overflow constant.
7604 It is possible to enforce signed interpretation by (instead) prefixing a
7605 .Ql s
7606 (case-insensitively).
7607 The number sign notation uses a permissive parse mode and as such
7608 supports complicated conditions out of the box:
7609 .Bd -literal -offset indent
7610 ? wysh set ifs=:;read i;unset ifs;echo $i;vexpr pb 2 10#$i
7611    -009
7612 <   -009>
7613 0b1001
7617 One integer is expected by assignment (equals sign
7618 .Ql = ) ,
7619 which does nothing but parsing the argument, thus detecting validity and
7620 possible overflow conditions, unary not (tilde
7621 .Ql ~ ) ,
7622 which creates the bitwise complement, and unary plus and minus.
7623 Two integers are used by addition (plus sign
7624 .Ql + ) ,
7625 subtraction (hyphen-minus
7626 .Ql - ) ,
7627 multiplication (asterisk
7628 .Ql * ) ,
7629 division (solidus
7630 .Ql / )
7631 and modulo (percent sign
7632 .Ql % ) ,
7633 as well as for the bitwise operators logical or (vertical bar
7634 .Ql | ,
7635 to be quoted) ,
7636 bitwise and (ampersand
7637 .Ql \&& ,
7638 to be quoted) ,
7639 bitwise xor (circumflex
7640 .Ql ^ ) ,
7641 the bitwise signed left- and right shifts
7642 .Pf ( Ql << ,
7643 .Ql >> ) ,
7644 as well as for the unsigned right shift
7645 .Ql >>> .
7648 Another numeric operation is
7649 .Cm pbase ,
7650 which takes a number base in between 2 and 36, inclusive, and will act
7651 on the second number given just the same as what equals sign
7652 .Ql =
7653 does, but the number result will be formatted in the base given, as
7654 a signed 64-bit number unless unsigned interpretation of the input
7655 number had been forced (with an u prefix).
7658 Numeric operations support a saturated mode via the question mark
7659 .Ql \&?
7660 modifier suffix; the keyword
7661 .Ql saturated
7662 is optional,
7663 .Ql +? ,
7664 .Ql +?satu ,
7666 .Ql +?saturated
7667 are therefore identical.
7668 In saturated mode overflow errors and division and modulo by zero are no
7669 longer reported via the exit status, but the result will linger at the
7670 minimum or maximum possible value, instead of overflowing (or trapping).
7671 This is true also for the argument parse step.
7672 For the bitwise shifts, the saturated maximum is 63.
7673 Any caught overflow will be reported via the error number
7674 .Va \&!
7676 .Va ^ERR Ns -OVERFLOW .
7678 .Bd -literal -offset indent
7679 ? vput vexpr res -? +1 -9223372036854775808
7680 ? echo $?/$!/$^ERRNAME:$res
7681 0/75/OVERFLOW:-9223372036854775808
7685 Character set agnostic string functions have no notion of locale
7686 settings and character sets.
7688 .Bl -hang -width ".It Cm random"
7689 .It Cm date-utc
7690 Outputs the current date and time in UTC (Coordinated Universal Time)
7691 with values named such that
7692 .Ql vput vexpr x date-utc; eval wysh set $x
7693 creates accessible variables.
7694 .It Cm date-stamp-utc
7695 Outputs a RFC 3339 internet date/time format of UTC.
7696 .It Cm epoch
7697 The seconds and nanoseconds since the Unix epoch (1970-01-01T00:00:00)
7698 named
7699 .Ql epoch_sec
7701 .Ql epoch_nsec
7702 such that
7703 .Ql vput vexpr x epoch; eval wysh set $x
7704 creates accessible variables.
7705 .It Cm file-expand
7706 Performs the usual
7707 .Sx "Filename transformations"
7708 on its argument.
7709 .It Cm file-stat , file-lstat
7710 Perform the usual
7711 .Sx "Filename transformations"
7712 on the argument, then call
7713 .Xr stat 2
7715 .Xr lstat 2 ,
7716 respectively, and output values such that
7717 .Ql vput vexpr x file-stat FILE; eval wysh set $x
7718 creates accessible variables.
7719 The variable
7720 .Ql st_type
7721 uses solidus
7722 .Ql /
7723 to denote directories, commercial at
7724 .Ql @
7725 for links, number sign
7726 .Ql #
7727 for block devices, percent sign
7728 .Ql %
7729 for for character devices, vertical bar
7730 .Ql |
7731 for FIFOs, equal sign
7732 .Ql =
7733 for sockets, and the period
7734 .Ql \&.
7735 for the rest.
7736 .It Cm random
7737 Generates a random string of the given length, or of
7738 .Dv \&\&PATH_MAX
7739 bytes (a constant from
7740 .Pa /usr/include )
7741 if the value 0 is given; the random string will be base64url encoded
7742 according to RFC 4648, and thus be usable as a (portable) filename.
7746 String operations work, sufficient support provided, according to the
7747 active user's locale encoding and character set (see
7748 .Sx "Character sets" ) .
7749 Where the question mark
7750 .Ql \&?
7751 modifier suffix is supported, a case-insensitive operation mode is
7752 available; the keyword
7753 .Ql case
7754 is optional,
7755 .Ql regex?
7757 .Ql regex?case
7758 are therefore identical.
7760 .Bl -hang -width ".It Cm regex"
7761 .It Cm makeprint
7762 (One-way) Converts the argument to something safely printable on the
7763 terminal.
7765 .It Cm regex
7766 \*(OP A string operation that will try to match the first argument with
7767 the regular expression given as the second argument.
7768 .Ql \&?
7769 modifier suffix is supported.
7770 If the optional third argument has been given then instead of showing
7771 the match offset a replacement operation is performed: the third
7772 argument is treated as if specified within dollar-single-quote (see
7773 .Sx "Shell-style argument quoting" ) ,
7774 and any occurrence of a positional parameter, for example
7775 .Va \&0 , 1
7776 etc. is replaced with the according match group of the regular expression:
7777 .Bd -literal -offset indent
7778 ? vput vexpr res regex bananarama \e
7779     (.*)NanA(.*) '\e${1}au\e$2'
7780 ? echo $?/$!/$^ERRNAME:$res:
7781 1/61/NODATA::
7782 ? vput vexpr res regex?case bananarama \e
7783     (.*)NanA(.*) '\e${1}uauf\e$2'
7784 ? echo $?/$!/$^ERRNAME:$res:
7785 0/0/NONE:bauauframa:
7791 .It Ic vpospar
7792 \*(NQ Manage the positional parameter stack (see
7793 .Va 1 , # , * , @
7794 as well as
7795 .Ic shift ) .
7796 If the first argument is
7797 .Ql clear ,
7798 then the positional parameter stack of the current context, or the
7799 global one, if there is none, is cleared.
7800 If it is
7801 .Ql set ,
7802 then the remaining arguments will be used to (re)create the stack,
7803 if the parameter stack size limit is excessed an
7804 .Va ^ERR Ns -OVERFLOW
7805 error will occur.
7808 If the first argument is
7809 .Ql quote ,
7810 a round-trip capable representation of the stack contents is created,
7811 with each quoted parameter separated from each other with the first
7812 character of
7813 .Va ifs ,
7814 and followed by the first character of
7815 .Va if-ws ,
7816 if that is not empty and not identical to the first.
7817 If that results in no separation at all a
7818 .Cm space
7819 character is used.
7820 This mode supports
7821 .Cm vput
7822 (see
7823 .Sx "Command modifiers" ) .
7824 I.e., the subcommands
7825 .Ql set
7827 .Ql quote
7828 can be used (in conjunction with
7829 .Ic eval )
7830 to (re)create an argument stack from and to a single variable losslessly.
7832 .Bd -literal -offset indent
7833 ? vpospar set hey, "'you    ", world!
7834 ? echo $#: <${1}><${2}><${3}>
7835 ? vput vpospar x quote
7836 ? vpospar clear
7837 ? echo $#: <${1}><${2}><${3}>
7838 ? eval vpospar set ${x}
7839 ? echo $#: <${1}><${2}><${3}>
7844 .It Ic visual
7845 (v) Takes a message list and invokes the
7846 .Ev VISUAL
7847 display editor on each message.
7848 Modified contents are discarded unless the
7849 .Va writebackedited
7850 variable is set, and are not used unless the mailbox can be written to
7851 and the editor returns a successful exit status.
7852 .Ic edit
7853 can be used instead for a less display oriented editor.
7856 .It Ic write
7857 (w) For conventional messages the body without all headers is written.
7858 The original message is never marked for deletion in the originating
7859 mail folder.
7860 The output is decrypted and converted to its native format as necessary.
7861 If the output file exists, the text is appended.
7862 If a message is in MIME multipart format its first part is written to
7863 the specified file as for conventional messages, handling of the remains
7864 depends on the execution mode.
7865 No special handling of compressed files is performed.
7867 In interactive mode the user is consecutively asked for the filenames of
7868 the processed parts.
7869 For convenience saving of each part may be skipped by giving an empty
7870 value, the same result as writing it to
7871 .Pa /dev/null .
7872 Shell piping the part content by specifying a leading vertical bar
7873 .Ql |
7874 character for the filename is supported.
7875 Other user input undergoes the usual
7876 .Sx "Filename transformations" ,
7877 including shell pathname wildcard pattern expansions
7878 .Pf ( Xr glob 7 )
7879 and shell variable expansion for the message as such, not the individual
7880 parts, and contents of the destination file are overwritten if the file
7881 previously existed.
7882 Character set conversion to
7883 .Va ttycharset
7884 is performed when saving text data.
7886 \*(ID In non-interactive mode any part which does not specify a filename
7887 is ignored, and suspicious parts of filenames of the remaining parts are
7888 URL percent encoded (as via
7889 .Ic urlcodec )
7890 to prevent injection of malicious character sequences, resulting in
7891 a filename that will be written into the current directory.
7892 Existing files will not be overwritten, instead the part number or
7893 a dot are appended after a number sign
7894 .Ql #
7895 to the name until file creation succeeds (or fails due to other
7896 reasons).
7899 .It Ic xcall
7900 \*(NQ The sole difference to
7901 .Ic call
7902 is that the new macro is executed in place of the current one, which
7903 will not regain control: all resources of the current macro will be
7904 released first.
7905 This implies that any setting covered by
7906 .Ic localopts
7907 will be forgotten and covered variables will become cleaned up.
7908 If this command is not used from within a
7909 .Ic call Ns
7910 ed macro it will silently be (a more expensive variant of)
7911 .Ic call .
7914 .It Ic xit
7915 (x) A synonym for
7916 .Ic exit .
7919 .It Ic z
7920 \*(NQ \*(UA presents message headers in
7921 .Va screen Ns
7922 fuls as described under the
7923 .Ic headers
7924 command.
7925 Without arguments this command scrolls to the next window of messages,
7926 likewise if the argument is
7927 .Ql + .
7928 An argument of
7929 .Ql -
7930 scrolls to the last,
7931 .Ql ^
7932 scrolls to the first, and
7933 .Ql $
7934 to the last
7935 .Va \&\&screen
7936 of messages.
7937 A number argument prefixed by
7938 .Ql +
7940 .Ql \-
7941 indicates that the window is calculated in relation to the current
7942 position, and a number without a prefix specifies an absolute position.
7945 .It Ic Z
7946 \*(NQ Similar to
7947 .Ic z ,
7948 but scrolls to the next or previous window that contains at least one
7949 .Ql new
7951 .Ic flag Ns
7952 ged message.
7954 .\" }}}
7956 .\" }}}
7959 .\" .Sh COMMAND ESCAPES {{{
7960 .Sh "COMMAND ESCAPES"
7962 Command escapes are available in
7963 .Sx "Compose mode"
7964 during interactive usage, when explicitly requested via
7965 .Fl ~ ,
7966 and in batch mode
7967 .Pf ( Fl # ) .
7968 They perform special functions, like editing headers of the message
7969 being composed, calling normal
7970 .Sx COMMANDS ,
7971 yielding a shell, etc.
7972 Command escapes are only recognized at the beginning of lines, and
7973 consist of an escape followed by a command character.
7974 The default
7975 .Va escape
7976 character is the tilde
7977 .Ql ~ .
7980 Unless otherwise documented command escapes ensure proper updates of
7981 the error number
7982 .Va \&!
7983 and the exit status
7984 .Va \&? .
7985 The variable
7986 .Va errexit
7987 controls whether a failed operation errors out message compose mode and
7988 causes program exit.
7989 Escapes may be prefixed by none to multiple single character command
7990 modifiers, interspersed whitespace is ignored:
7992 .Bl -bullet
7994 An effect equivalent to the command modifier
7995 .Cm ignerr
7996 can be achieved with hyphen-minus
7997 .Ql - ,
7998 overriding
7999 .Va errexit .
8001 The modifier dollar
8002 .Ql $
8003 .Ic eval Ns
8004 uates the remains of the line; also see
8005 .Sx "Shell-style argument quoting" .
8006 \*(ID For now the entire input line is evaluated as a whole; to avoid
8007 that control operators like semicolon
8008 .Cm \&;
8009 are interpreted unintentionally, they must be quoted.
8013 Addition of the command line to the \*(OPal history can be prevented by
8014 placing whitespace directly after
8015 .Va escape .
8016 The \*(OPal key
8017 .Ic bind Ns
8018 ings support a compose mode specific context.
8019 The following command escapes are supported:
8022 .Bl -tag -width ".It Ic BaNg"
8024 .It Ic ~~ Ar string
8025 Insert the string of text in the message prefaced by a single
8026 .Ql ~ .
8027 (If the escape character has been changed,
8028 that character must be doubled instead.)
8031 .It Ic ~! Ar command
8032 Execute the indicated shell
8033 .Ar command
8034 which follows, replacing unescaped exclamation marks with the previously
8035 executed command if the internal variable
8036 .Va bang
8037 is set, then return to the message.
8040 .It Ic ~.
8041 End compose mode and send the message.
8042 The hooks
8043 .Va on-compose-splice-shell
8045 .Va on-compose-splice ,
8046 in order, will be called when set, after which, in interactive mode
8047 .Va askatend
8048 (leading to
8049 .Va askcc , askbcc )
8051 .Va askattach
8052 will be checked as well as
8053 .Va asksend ,
8054 after which a set
8055 .Va on-compose-leave
8056 hook will be called,
8057 .Va autocc
8059 .Va autobcc
8060 will be joined in if set,
8061 finally a given
8062 .Va message-inject-tail
8063 will be incorporated, after which the compose mode is left.
8066 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
8067 Can be used to execute
8068 .Sx COMMANDS
8069 (which are allowed in compose mode).
8072 .It Ic ~< Ar filename
8073 Identical to
8074 .Ic ~r .
8077 .It Ic ~<! Ar command
8078 .Ar command
8079 is executed using the shell.
8080 Its standard output is inserted into the message.
8083 .It Ic ~?
8084 \*(OP Write a summary of command escapes.
8087 .It Ic ~@ Op Ar filename...
8088 Append or edit the list of attachments.
8089 Does not manage the error number
8090 .Va \&!
8091 and the exit status
8092 .Va \&?
8093 (please use
8094 .Ic ~^
8095 if error handling is necessary).
8096 The append mode expects a list of
8097 .Ar filename
8098 arguments as shell tokens (see
8099 .Sx "Shell-style argument quoting" ;
8100 token-separating commas are ignored, too), to be
8101 interpreted as documented for the command line option
8102 .Fl a ,
8103 with the message number exception as below.
8105 Without
8106 .Ar filename
8107 arguments the attachment list is edited, entry by entry;
8108 if a filename is left empty, that attachment is deleted from the list;
8109 once the end of the list is reached either new attachments may be
8110 entered or the session can be quit by committing an empty
8111 .Dq new
8112 attachment.
8113 In non-interactive mode or in batch mode
8114 .Pf ( Fl # )
8115 the list of attachments is effectively not edited but instead recreated;
8116 again, an empty input ends list creation.
8118 For all modes, if a given filename solely consists of the number sign
8119 .Ql #
8120 followed by either a valid message number of the currently active
8121 mailbox, or by a period
8122 .Ql \&. ,
8123 referring to the current message of the active mailbox, the so-called
8124 .Dq dot ,
8125 then the given message is attached as a
8126 .Ql message/rfc822
8127 MIME message part.
8128 The number sign must be quoted to avoid misinterpretation as a shell
8129 comment character.
8132 .It Ic ~| Ar command
8133 Pipe the message text through the specified filter command.
8134 If the command gives no output or terminates abnormally,
8135 retain the original text of the message.
8136 The command
8137 .Xr fmt 1
8138 is often used as a rejustifying filter.
8140 If the first character of the command is a vertical bar, then the entire
8141 message including header fields is subject to the filter command, so
8142 .Ql ~|| echo Fcc: /tmp/test; cat
8143 will prepend a file-carbon-copy message header.
8144 Also see
8145 .Ic ~e , ~v .
8149 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
8150 Inspect and modify the message using the semantics of
8151 .Ic digmsg ,
8152 therefore arguments are evaluated according to
8153 .Sx "Shell-style argument quoting" .
8154 Error number
8155 .Va \&!
8156 and exit status
8157 .Va \&?
8158 are not managed: errors are handled via the protocol,
8159 and hard errors like I/O failures cannot be handled.
8162 The protocol consists of command lines followed by (a) response line(s).
8163 The first field of the response line represents a status code
8164 which specifies whether a command was successful or not, whether result
8165 data is to be expected, and if, the format of the result data.
8166 Response data will be shell quoted as necessary for consumption by
8167 .Ic readsh ,
8169 .Ic eval
8171 .Ic vpospar ,
8172 to name a few.
8173 Error status code lines may optionally contain additional context:
8177 .Bl -tag -compact -width ".It Ql 210"
8178 .It Ql 210
8179 Status ok; the remains of the line are the result.
8181 .It Ql 211
8182 Status ok; the rest of the line is optionally used for more status.
8183 What follows are lines of result addresses, terminated by an empty line.
8184 All the input, including the empty line, must be consumed before further
8185 commands can be issued.
8186 Address lines consist of two token, first the plain network address, e.g.,
8187 .Ql bob@exam.ple ,
8188 followed by the (quoted) full address as known:
8189 .Ql '(Lovely) Bob <bob@exam.ple>' .
8190 Non-network addresses use the first field to indicate the type (hyphen-minus
8191 .Ql -
8192 for files, vertical bar
8193 .Ql |
8194 for pipes, and number sign
8195 .Ql #
8196 for names which will undergo
8197 .Ic alias
8198 processing) instead, the actual value will be in the second field.
8200 .It Ql 212
8201 Status ok; the rest of the line is optionally used for more status.
8202 What follows are lines of furtherly unspecified (quoted) string content,
8203 terminated by an empty line.
8204 All the input, including the empty line, must be consumed before further
8205 commands can be issued.
8207 .It Ql 500
8208 Syntax error; invalid command.
8210 .It Ql 501
8211 Syntax error or otherwise invalid parameters or arguments.
8213 .It Ql 505
8214 Error: an argument fails verification.
8215 For example an invalid address has been specified (also see
8216 .Va expandaddr ) ,
8217 or an attempt was made to modify anything in \*(UA's own namespace,
8218 or a modifying subcommand has been used on a read-only message.
8220 .It Ql 506
8221 Error: an otherwise valid argument is rendered invalid due to context.
8222 For example, a second address is added to a header which may consist of
8223 a single address only.
8228 If a command indicates failure then the message will have remained
8229 unmodified.
8230 Most commands can fail with
8231 .Ql 500
8232 if required arguments are missing, or excessive arguments have been
8233 given (false command usage).
8234 (\*(ID The latter does not yet occur regularly, because as stated in
8235 .Sx "Shell-style argument quoting"
8236 our argument parser is not yet smart enough to work on subcommand base;
8237 for example one might get excess argument error for a three argument
8238 subcommand that receives four arguments, but not for a four argument
8239 subcommand which receives six arguments: here excess will be joined.)
8240 The following (case-insensitive) commands are supported:
8243 .Bl -hang -width ".It Cm version"
8244 .It Cm attachment
8245 This command allows listing, removal and addition of message attachments.
8246 The second argument specifies the subcommand to apply, one of:
8248 .Bl -hang -width ".It Cm remove"
8249 .It Cm attribute
8250 This uses the same search mechanism as described for
8251 .Cm remove
8252 and prints any known attributes of the first found attachment via
8253 .Ql 212
8254 upon success or
8255 .Ql 501
8256 if no such attachment can be found.
8257 The attributes are written as lines with a keyword and a value token.
8259 .It Cm attribute-at
8260 This uses the same search mechanism as described for
8261 .Cm remove-at
8262 and is otherwise identical to
8263 .Cm attribute .
8265 .It Cm attribute-set
8266 This uses the same search mechanism as described for
8267 .Cm remove ,
8268 and will set the attribute given as the fourth to the value given as
8269 the fifth token argument.
8270 If the value is an empty token, then the given attribute is removed,
8271 or reset to a default value if existence of the attribute is crucial.
8273 It returns via
8274 .Ql 210
8275 upon success, with the index of the found attachment following,
8276 .Ql 505
8277 for message attachments or if the given keyword is invalid, and
8278 .Ql 501
8279 if no such attachment can be found.
8280 The following keywords may be used (case-insensitively):
8282 .Bl -hang -compact -width ".It Ql filename"
8283 .It Ql filename
8284 Sets the filename of the MIME part, i.e., the name that is used for
8285 display and when (suggesting a name for) saving (purposes).
8286 .It Ql content-description
8287 Associate some descriptive information to the attachment's content, used
8288 in favour of the plain filename by some MUAs.
8289 .It Ql content-id
8290 May be used for uniquely identifying MIME entities in several contexts;
8291 this expects a special reference address format as defined in RFC 2045
8292 and generates a
8293 .Ql 505
8294 upon address content verification failure.
8295 .It Ql content-type
8296 Defines the media type/subtype of the part, which is managed
8297 automatically, but can be overwritten.
8298 .It Ql content-disposition
8299 Automatically set to the string
8300 .Ql attachment .
8303 .It Cm attribute-set-at
8304 This uses the same search mechanism as described for
8305 .Cm remove-at
8306 and is otherwise identical to
8307 .Cm attribute-set .
8309 .It Cm insert
8310 Adds the attachment given as the third argument, specified exactly as
8311 documented for the command line option
8312 .Fl a ,
8313 and supporting the message number extension as documented for
8314 .Ic ~@ .
8315 This reports
8316 .Ql 210
8317 upon success, with the index of the new attachment following,
8318 .Ql 505
8319 if the given file cannot be opened,
8320 .Ql 506
8321 if an on-the-fly performed character set conversion fails, otherwise
8322 .Ql 501
8323 is reported; this is also reported if character set conversion is
8324 requested but not available.
8326 .It Cm list
8327 List all attachments via
8328 .Ql 212 ,
8329 or report
8330 .Ql 501
8331 if no attachments exist.
8332 This command is the default command of
8333 .Cm attachment
8334 if no second argument has been given.
8336 .It Cm remove
8337 This will remove the attachment given as the third argument, and report
8338 .Ql 210
8339 upon success or
8340 .Ql 501
8341 if no such attachment can be found.
8342 If there exists any path component in the given argument, then an exact
8343 match of the path which has been used to create the attachment is used
8344 directly, but if only the basename of that path matches then all
8345 attachments are traversed to find an exact match first, and the removal
8346 occurs afterwards; if multiple basenames match, a
8347 .Ql 506
8348 error occurs.
8349 Message attachments are treated as absolute pathnames.
8351 If no path component exists in the given argument, then all attachments
8352 will be searched for
8353 .Ql filename=
8354 parameter matches as well as for matches of the basename of the path
8355 which has been used when the attachment has been created; multiple
8356 matches result in a
8357 .Ql 506 .
8359 .It Cm remove-at
8360 This will interpret the third argument as a number and remove the
8361 attachment at that list position (counting from one!), reporting
8362 .Ql 210
8363 upon success or
8364 .Ql 505
8365 if the argument is not a number or
8366 .Ql 501
8367 if no such attachment exists.
8371 .It Cm header
8372 This command allows listing, inspection, and editing of message headers.
8373 Header name case is not normalized, so that case-insensitive comparison
8374 should be used when matching names.
8375 The second argument specifies the subcommand to apply, one of:
8378 .Bl -hang -width ".It Cm remove"
8379 .It Cm insert
8380 Create a new or an additional instance of the header given in the third
8381 argument, with the header body content as given in the fourth token.
8382 It may return
8383 .Ql 501
8384 if the third argument specifies a free-form header field name that is
8385 invalid, or if body content extraction fails to succeed,
8386 .Ql 505
8387 if any extracted address does not pass syntax and/or security checks or
8388 on \*(UA namespace violations, and
8389 .Ql 506
8390 to indicate prevention of excessing a single-instance header \(em note that
8391 .Ql Subject:
8392 can be appended to (a space separator will be added automatically first).
8393 .Ql To: ,
8394 .Ql Cc:
8396 .Ql Bcc:
8397 support the
8398 .Ql ?single
8399 modifier to enforce treatment as a single addressee, for example
8400 .Ql header insert To?single: 'exa, <m@ple>' ;
8401 the word
8402 .Ql single
8403 is optional.
8405 .Ql 210
8406 is returned upon success, followed by the name of the header and the list
8407 position of the newly inserted instance.
8408 The list position is always 1 for single-instance header fields.
8409 All free-form header fields are managed in a single list; also see
8410 .Va customhdr .
8412 .It Cm list
8413 Without a third argument a list of all yet existing headers is given via
8414 .Ql 210 ;
8415 this command is the default command of
8416 .Cm header
8417 if no second argument has been given.
8418 A third argument restricts output to the given header only, which may
8419 fail with
8420 .Ql 501
8421 if no such field is defined.
8423 .It Cm remove
8424 This will remove all instances of the header given as the third
8425 argument, reporting
8426 .Ql 210
8427 upon success,
8428 .Ql 501
8429 if no such header can be found, and
8430 .Ql 505
8431 on \*(UA namespace violations.
8433 .It Cm remove-at
8434 This will remove from the header given as the third argument the
8435 instance at the list position (counting from one!) given with the fourth
8436 argument, reporting
8437 .Ql 210
8438 upon success or
8439 .Ql 505
8440 if the list position argument is not a number or on \*(UA namespace
8441 violations, and
8442 .Ql 501
8443 if no such header instance exists.
8445 .It Cm show
8446 Shows the content of the header given as the third argument.
8447 Dependent on the header type this may respond with
8448 .Ql 211
8450 .Ql 212 ;
8451 any failure results in
8452 .Ql 501 .
8457 In compose-mode read-only access to optional pseudo headers in the \*(UA
8458 private namespace is available:
8462 .Bl -tag -compact -width ".It Va BaNg"
8463 .It Ql Mailx-Command:
8464 The name of the command that generates the message, one of
8465 .Ql forward ,
8466 .Ql Lreply ,
8467 .Ql mail ,
8468 .Ql Reply ,
8469 .Ql reply ,
8470 .Ql resend .
8471 This pseudo header always exists (in compose-mode).
8473 .It Ql Mailx-Raw-To:
8474 .It Ql Mailx-Raw-Cc:
8475 .It Ql Mailx-Raw-Bcc:
8476 Represent the frozen initial state of these headers before any
8477 transformation
8478 .Pf ( Ic alias ,
8479 .Ic alternates ,
8480 .Va recipients-in-cc
8481 etc.) took place.
8483 .It Ql Mailx-Orig-Sender:
8484 .It Ql Mailx-Orig-From:
8485 .It Ql Mailx-Orig-To:
8486 .It Ql Mailx-Orig-Cc:
8487 .It Ql Mailx-Orig-Bcc:
8488 The values of said headers of the original message which has been
8489 addressed by any of
8490 .Ic reply , forward , resend .
8491 The sender field is special as it is filled in with the sole sender
8492 according to RFC 5322 rules, it may thus be equal to the from field.
8496 .It Cm help , \&?
8497 Show an abstract of the above commands via
8498 .Ql 211 .
8500 .It Cm version
8501 This command will print the protocol version via
8502 .Ql 210 .
8507 .It Ic ~A
8508 The same as
8509 .Ql Ic ~i Ns \| Va Sign .
8512 .It Ic ~a
8513 The same as
8514 .Ql Ic ~i Ns \| Va sign .
8517 .It Ic ~b Ar name ...
8518 Add the given names to the list of blind carbon copy recipients.
8521 .It Ic ~c Ar name ...
8522 Add the given names to the list of carbon copy recipients.
8525 .It Ic ~d
8526 Read the file specified by the
8527 .Ev DEAD
8528 variable into the message.
8531 .It Ic ~e
8532 Invoke the text
8533 .Ev EDITOR
8534 on the message collected so far, then return to compose mode.
8535 .Ic ~v
8536 can be used for a more display oriented editor, and
8537 .Ic ~| Ns |
8538 offers a pipe-based editing approach.
8541 .It Ic ~F Ar messages
8542 Read the named messages into the message being sent, including all
8543 message headers and MIME parts, and honouring
8544 .Va forward-add-cc
8545 as well as
8546 .Va forward-inject-head
8548 .Va forward-inject-tail .
8549 If no messages are specified, read in the current message, the
8550 .Dq dot .
8553 .It Ic ~f Ar messages
8554 Read the named messages into the message being sent.
8555 If no messages are specified, read in the current message, the
8556 .Dq dot .
8557 Strips down the list of header fields according to the
8558 .Ql forward
8559 (with
8560 .Va posix :
8561 .Ql type )
8562 white- and blacklist selection of
8563 .Ic headerpick ,
8564 and honours
8565 .Va forward-add-cc
8566 as well as
8567 .Va forward-inject-head
8569 .Va forward-inject-tail .
8570 For MIME multipart messages,
8571 only the first displayable part is included.
8574 .It Ic ~H
8575 In interactive mode, edit the message header fields
8576 .Ql From: ,
8577 .Ql Reply-To:
8579 .Ql Sender:
8580 by typing each one in turn and allowing the user to edit the field.
8581 The default values for these fields originate from the
8582 .Va from , reply-to
8584 .Va sender
8585 variables.
8586 In non-interactive mode this sets
8587 .Va ^ERR Ns -NOTTY .
8590 .It Ic ~h
8591 In interactive mode, edit the message header fields
8592 .Ql To: ,
8593 .Ql Cc: ,
8594 .Ql Bcc:
8596 .Ql Subject:
8597 by typing each one in turn and allowing the user to edit the field.
8598 In non-interactive mode this sets
8599 .Va ^ERR Ns -NOTTY .
8602 .It Ic ~I Ar variable
8603 Insert the value of the specified variable into the message.
8604 The message remains unaltered if the variable is unset or empty.
8605 Any embedded character sequences
8606 .Ql \et
8607 horizontal tabulator and
8608 .Ql \en
8609 line feed are expanded in
8610 .Va posix
8611 mode; otherwise the expansion should occur at
8612 .Ic set
8613 time (\*(ID by using the command modifier
8614 .Va wysh ) .
8617 .It Ic ~i Ar variable
8618 Like
8619 .Ic ~I ,
8620 but appends a newline character.
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 Honours
8630 .Va forward-add-cc
8631 as well as
8632 .Va forward-inject-head
8634 .Va forward-inject-tail .
8637 .It Ic ~m Ar messages
8638 Read the named messages into the message being sent,
8639 indented by
8640 .Va indentprefix .
8641 If no messages are specified, read the current message, the
8642 .Dq dot .
8643 Strips down the list of header fields according to the
8644 .Ql type
8645 white- and blacklist selection of
8646 .Ic headerpick .
8647 Honours
8648 .Va forward-add-cc
8649 as well as
8650 .Va forward-inject-head
8652 .Va forward-inject-tail .
8653 For MIME multipart messages,
8654 only the first displayable part is included.
8657 .It Ic ~p
8658 Display the message collected so far,
8659 prefaced by the message header fields
8660 and followed by the attachment list, if any.
8663 .It Ic ~Q
8664 Read in the given / current message(s) using the algorithm of
8665 .Va quote
8666 (except that is implicitly assumed, even if not set), honouring
8667 .Va quote-add-cc .
8670 .It Ic ~q
8671 Abort the message being sent,
8672 copying it to the file specified by the
8673 .Ev DEAD
8674 variable if
8675 .Va save
8676 is set.
8679 .It Ic ~R Ar filename
8680 Identical to
8681 .Ic ~r ,
8682 but indent each line that has been read by
8683 .Va indentprefix .
8686 .It Ic ~r Ar filename Op Ar HERE-delimiter
8687 Read the named file, object to
8688 .Sx "Filename transformations"
8689 excluding shell globs and variable expansions, into the message; if
8690 .Ar filename
8691 is the hyphen-minus
8692 .Ql -
8693 then standard input is used (for pasting, for example).
8694 Only in this latter mode
8695 .Ar HERE-delimiter
8696 may be given: if it is data will be read in until the given
8697 .Ar HERE-delimiter
8698 is seen on a line by itself, and encountering EOF is an error; the
8699 .Ar HERE-delimiter
8700 is a required argument in non-interactive mode; if it is single-quote
8701 quoted then the pasted content will not be expanded, \*(ID otherwise
8702 a future version of \*(UA may perform shell-style expansion on the content.
8705 .It Ic ~s Ar string
8706 Cause the named string to become the current subject field.
8707 Newline (NL) and carriage-return (CR) bytes are invalid and will be
8708 normalized to space (SP) characters.
8711 .It Ic ~t Ar name ...
8712 Add the given name(s) to the direct recipient list.
8715 .It Ic ~U Ar messages
8716 Read in the given / current message(s) excluding all headers, indented by
8717 .Va indentprefix .
8718 Honours
8719 .Va forward-add-cc
8720 as well as
8721 .Va forward-inject-head
8723 .Va forward-inject-tail .
8726 .It Ic ~u Ar messages
8727 Read in the given / current message(s), excluding all headers.
8728 Honours
8729 .Va forward-add-cc
8730 as well as
8731 .Va forward-inject-head
8733 .Va forward-inject-tail .
8736 .It Ic ~v
8737 Invoke the
8738 .Ev VISUAL
8739 editor on the message collected so far, then return to compose mode.
8740 .Ic ~e
8741 can be used for a less display oriented editor, and
8742 .Ic ~| Ns |
8743 offers a pipe-based editing approach.
8746 .It Ic ~w Ar filename
8747 Write the message onto the named file, which is object to the usual
8748 .Sx "Filename transformations" .
8749 If the file exists,
8750 the message is appended to it.
8753 .It Ic ~x
8754 Same as
8755 .Ic ~q ,
8756 except that the message is not saved at all.
8759 .\" }}}
8762 .\" .Sh INTERNAL VARIABLES {{{
8763 .Sh "INTERNAL VARIABLES"
8765 Internal \*(UA variables are controlled via the
8766 .Ic set
8768 .Ic unset
8769 commands; prefixing a variable name with the string
8770 .Ql no
8771 and calling
8772 .Ic set
8773 has the same effect as using
8774 .Ic unset :
8775 .Ql unset crt
8777 .Ql set nocrt
8778 do the same thing.
8779 .Ic varshow
8780 will give more insight on the given variable(s), and
8781 .Ic set ,
8782 when called without arguments, will show a listing of all variables.
8783 Both commands support a more
8784 .Va verbose
8785 listing mode.
8786 Some well-known variables will also become inherited from the
8787 program
8788 .Sx ENVIRONMENT
8789 implicitly, others can be imported explicitly with the command
8790 .Ic environ
8791 and henceforth share said properties.
8794 Two different kinds of internal variables exist, and both of which can
8795 also form chains.
8796 There are boolean variables, which can only be in one of the two states
8797 .Dq set
8799 .Dq unset ,
8800 and value variables with a(n optional) string value.
8801 For the latter proper quoting is necessary upon assignment time, the
8802 introduction of the section
8803 .Sx COMMANDS
8804 documents the supported quoting rules.
8806 .Bd -literal -offset indent
8807 ? wysh set one=val\e 1 two="val 2" \e
8808     three='val "3"' four=$'val \e'4\e''; \e
8809     varshow one two three four; \e
8810     unset one two three four
8814 Dependent upon the actual option string values may become interpreted as
8815 colour names, command specifications, normal text, etc.
8816 They may be treated as numbers, in which case decimal values are
8817 expected if so documented, but otherwise any numeric format and
8818 base that is valid and understood by the
8819 .Ic vexpr
8820 command may be used, too.
8823 There also exists a special kind of string value, the
8824 .Dq boolean string ,
8825 which must either be a decimal integer (in which case
8826 .Ql 0
8827 is false and
8828 .Ql 1
8829 and any other value is true) or any of the (case-insensitive) strings
8830 .Ql off ,
8831 .Ql no ,
8832 .Ql n
8834 .Ql false
8835 for a false boolean and
8836 .Ql on ,
8837 .Ql yes ,
8838 .Ql y
8840 .Ql true
8841 for a true boolean;
8842 .Mx -ix quadoption
8843 a special kind of boolean string is the
8844 .Dq quadoption :
8845 it can optionally be prefixed with the (case-insensitive) term
8846 .Ql ask- ,
8847 as in
8848 .Ql ask-yes ;
8849 in interactive mode the user will be prompted, otherwise the actual
8850 boolean is used.
8853 Variable chains extend a plain
8854 .Ql variable
8855 with
8856 .Ql variable-HOST
8858 .Ql variable-USER@HOST
8859 variants.
8860 Here
8861 .Ql HOST
8862 will be converted to all lowercase when looked up (but not when the
8863 variable is set or unset!), \*(OPally IDNA converted, and indeed means
8864 .Ql server:port
8865 if a
8866 .Ql port
8867 had been specified in the contextual Uniform Resource Locator URL, see
8868 .Sx "On URL syntax and credential lookup" .
8869 Even though this mechanism is based on URLs no URL percent encoding may
8870 be applied to neither of
8871 .Ql USER
8873 .Ql HOST ,
8874 variable chains need to be specified using raw data;
8875 the mentioned section contains examples.
8876 Variables which support chains are explicitly documented as such, and
8877 \*(UA treats the base name of any such variable special, meaning that
8878 users should not create custom names like
8879 .Ql variable-xyz
8880 in order to avoid false classifications and treatment of such variables.
8882 .\" .Ss "Initial settings" {{{
8883 .\" (Keep in SYNC: mx/nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
8884 .Ss "Initial settings"
8886 The standard POSIX 2008/Cor 2-2016 mandates the following initial
8887 variable settings:
8888 .Pf no Va allnet ,
8889 .Pf no Va append ,
8890 .Va asksub ,
8891 .Pf no Va askbcc ,
8892 .Pf no Va autoprint ,
8893 .Pf no Va bang ,
8894 .Pf no Va cmd ,
8895 .Pf no Va crt ,
8896 .Pf no Va debug ,
8897 .Pf no Va dot ,
8898 .Va escape
8899 set to
8900 .Ql ~ ,
8901 .Pf no Va flipr ,
8902 .Pf no Va folder ,
8903 .Va header ,
8904 .Pf no Va hold ,
8905 .Pf no Va ignore ,
8906 .Pf no Va ignoreeof ,
8907 .Pf no Va keep ,
8908 .Pf no Va keepsave ,
8909 .Pf no Va metoo ,
8910 .Pf no Va outfolder ,
8911 .Pf no Va page ,
8912 .Va prompt
8913 set to
8914 .Ql \&?\0 ,
8915 .Pf no Va quiet ,
8916 .Pf no Va record ,
8917 .Va save ,
8918 .Pf no Va sendwait ,
8919 .Pf no Va showto ,
8920 .Pf no Va Sign ,
8921 .Pf no Va sign ,
8922 .Va toplines
8923 set to
8924 .Ql 5 .
8927 However, \*(UA has built-in some initial (and some default) settings
8928 which (may) diverge, others may become adjusted by one of the
8929 .Sx "Resource files" .
8930 Displaying the former is accomplished via
8931 .Ic set :
8932 .Ql $ \*(uA -:/ -v -Xset -Xx .
8933 In general this implementation sets (and has extended the meaning of)
8934 .Va sendwait ,
8935 and does not support the
8936 .Pf no Va onehop
8937 variable \(en use command line options or
8938 .Va mta-arguments
8939 to pass options through to a
8940 .Va mta .
8941 The default global resource file sets, among others, the variables
8942 .Va hold ,
8943 .Va keep
8945 .Va keepsave ,
8946 establishes a default
8947 .Ic headerpick
8948 selection etc., and should thus be taken into account.
8949 .\" }}}
8951 .\" .Ss "Variables" {{{
8952 .Ss "Variables"
8954 .Bl -tag -width ".It Va BaNg"
8957 .It Va \&?
8958 \*(RO The exit status of the last command, or the
8959 .Ic return
8960 value of the macro
8961 .Ic call Ns
8962 ed last.
8963 This status has a meaning in the state machine: in conjunction with
8964 .Va errexit
8965 any non-0 exit status will cause a program exit, and in
8966 .Va posix
8967 mode any error while loading (any of the) resource files will have the
8968 same effect.
8969 .Cm ignerr ,
8970 one of the
8971 .Sx "Command modifiers" ,
8972 can be used to instruct the state machine to ignore errors.
8975 .It Va \&!
8976 \*(RO The current error number
8977 .Pf ( Xr errno 3 ) ,
8978 which is set after an error occurred; it is also available via
8979 .Va ^ERR ,
8980 and the error name and documentation string can be queried via
8981 .Va ^ERRNAME
8983 .Va ^ERRDOC .
8984 \*(ID This machinery is new and the error number is only really usable
8985 if a command explicitly states that it manages the variable
8986 .Va \&! ,
8987 for others errno will be used in case of errors, or
8988 .Va ^ERR Ns -INVAL
8989 if that is 0: it thus may or may not reflect the real error.
8990 The error number may be set with the command
8991 .Ic return .
8995 .It Va ^
8996 \*(RO This is a multiplexer variable which performs dynamic expansion of
8997 the requested state or condition, of which there are:
8999 .Bl -tag -width ".It Va BaNg"
9003 .It Va ^ERR , ^ERRDOC , ^ERRNAME
9004 The number, documentation, and name of the current
9005 .Xr errno 3 ,
9006 respectively, which is usually set after an error occurred.
9007 The documentation is an \*(OP, the name is used if not available.
9008 \*(ID This machinery is new and is usually reliable only if a command
9009 explicitly states that it manages the variable
9010 .Va \&! ,
9011 which is effectively identical to
9012 .Va \&\&^ERR .
9013 Each of those variables can be suffixed with a hyphen minus followed by
9014 a name or number, in which case the expansion refers to the given error.
9015 Note this is a direct mapping of (a subset of) the system error values:
9016 .Bd -literal -offset indent
9017 define work {
9018   eval echo \e$1: \e$^ERR-$1:\e
9019     \e$^ERRNAME-$1: \e$^ERRDOC-$1
9020   vput vexpr i + "$1" 1
9021   if [ $i -lt 16 ]
9022     \excall work $i
9023   end
9025 call work 0
9030 .It Va ^ERRQUEUE-COUNT , ^ERRQUEUE-EXISTS
9031 The number of messages in the \*(OPal queue of
9032 .Ic errors ,
9033 and a string indicating queue state: empty or (translated)
9034 .Dq ERROR .
9035 Always 0 and the empty string, respectively, unless
9036 .Va features
9037 includes
9038 .Ql ,+errors, .
9043 .It Va *
9044 \*(RO Expands all positional parameters (see
9045 .Va 1 ) ,
9046 separated by the first character of the value of
9047 .Va ifs .
9048 \*(ID The special semantics of the equally named special parameter of the
9049 .Xr sh 1
9050 are not yet supported.
9053 .It Va @
9054 \*(RO Expands all positional parameters (see
9055 .Va 1 ) ,
9056 separated by a space character.
9057 If placed in double quotation marks, each positional parameter is
9058 properly quoted to expand to a single parameter again.
9061 .It Va #
9062 \*(RO Expands to the number of positional parameters, i.e., the size of
9063 the positional parameter stack in decimal.
9066 .It Va \&0
9067 \*(RO Inside the scope of a
9068 .Ic define Ns
9069 d and
9070 .Ic call Ns
9071 ed macro this expands to the name of the calling macro, or to the empty
9072 string if the macro is running from top-level.
9073 For the \*(OPal regular expression search and replace operator of
9074 .Ic vexpr
9075 this expands to the entire matching expression.
9076 It represents the program name in global context.
9079 .It Va 1
9080 \*(RO Access of the positional parameter stack.
9081 All further parameters can be accessed with this syntax, too,
9082 .Ql 2 ,
9083 .Ql 3
9084 etc.; positional parameters can be shifted off the stack by calling
9085 .Ic shift .
9086 The parameter stack contains, for example, the arguments of a
9087 .Ic call Ns
9089 .Ic define Ns
9090 d macro, the matching groups of the \*(OPal regular expression search
9091 and replace expression of
9092 .Ic vexpr ,
9093 and can be explicitly created or overwritten with the command
9094 .Ic vpospar .
9097 .It Va account
9098 \*(RO Is set to the active
9099 .Ic account .
9102 .It Va add-file-recipients
9103 \*(BO When file or pipe recipients have been specified,
9104 mention them in the corresponding address fields of the message instead
9105 of silently stripping them from their recipient list.
9106 By default such addressees are not mentioned.
9109 .It Va allnet
9110 \*(BO Causes only the local part to be evaluated
9111 when comparing addresses.
9114 .It Va append
9115 \*(BO Causes messages saved in the
9116 .Mx -sx
9117 .Sx "secondary mailbox"
9118 .Ev MBOX
9119 to be appended to the end rather than prepended.
9120 This should always be set.
9123 .It Va askatend
9124 \*(BO Causes the prompts for
9125 .Ql Cc:
9127 .Ql Bcc:
9128 lists to appear after the message has been edited.
9131 .It Va askattach
9132 \*(BO If set, \*(UA asks an interactive user for files to attach at the
9133 end of each message; An empty line finalizes the list.
9136 .It Va askcc
9137 \*(BO Causes the interactive user to be prompted for carbon copy
9138 recipients (at the end of each message if
9139 .Va askatend
9141 .Va bsdcompat
9142 are set).
9145 .It Va askbcc
9146 \*(BO Causes the interactive user to be prompted for blind carbon copy
9147 recipients (at the end of each message if
9148 .Va askatend
9150 .Va bsdcompat
9151 are set).
9154 .It Va asksend
9155 \*(BO Causes the interactive user to be prompted for confirmation to
9156 send the message or reenter compose mode after having been shown
9157 a preliminary envelope summary.
9160 .It Va asksign
9161 \*(BO\*(OP Causes the interactive user to be prompted if the message is
9162 to be signed at the end of each message.
9164 .Va smime-sign
9165 variable is ignored when this variable is set.
9168 .It Va asksub
9169 .\" The alternative *ask* is not documented on purpose
9170 \*(BO Causes \*(UA to prompt the interactive user for the subject upon
9171 entering compose mode unless a subject already exists.
9174 .It Va attrlist
9175 A sequence of characters to display in the
9176 .Ql attribute
9177 column of the
9178 .Va headline
9179 as shown in the display of
9180 .Ic headers ;
9181 each for one type of messages (see
9182 .Sx "Message states" ) ,
9183 with the default being
9184 .Ql NUROSPMFAT+\-$~
9186 .Ql NU\ \ *HMFAT+\-$~
9187 if the
9188 .Va bsdflags
9189 variable is set, in the following order:
9191 .Bl -tag -compact -width ".It Ql _"
9192 .It Ql N
9193 new.
9194 .It Ql U
9195 unread but old.
9196 .It Ql R
9197 new but read.
9198 .It Ql O
9199 read and old.
9200 .It Ql S
9201 saved.
9202 .It Ql P
9203 preserved.
9204 .It Ql M
9205 mboxed.
9206 .It Ql F
9207 flagged.
9208 .It Ql A
9209 answered.
9210 .It Ql T
9211 draft.
9212 .It Ql +
9213 \*(ID start of a (collapsed) thread in threaded mode (see
9214 .Va autosort ,
9215 .Ic thread ) ;
9216 .It Ql -
9217 \*(ID an uncollapsed thread in threaded mode; only used in conjunction with
9218 .Fl L .
9219 .It Ql $
9220 classified as spam.
9221 .It Ql ~
9222 classified as possible spam.
9227 .It Va autobcc
9228 Specifies a list of recipients to which a blind carbon copy of each
9229 outgoing message will be sent automatically.
9232 .It Va autocc
9233 Specifies a list of recipients to which a carbon copy of each outgoing
9234 message will be sent automatically.
9237 .It Va autocollapse
9238 \*(BO Causes threads to be collapsed automatically when .Ql thread Ns
9240 .Ic sort
9241 mode is entered (see the
9242 .Ic collapse
9243 command).
9246 .It Va autoprint
9247 \*(BO Enable automatic
9248 .Ic type Ns
9249 ing of a(n existing)
9250 .Dq successive
9251 message after
9252 .Ic delete
9254 .Ic undelete
9255 commands: the message that becomes the new
9256 .Dq dot
9257 is shown automatically, as via
9258 .Ic dp
9260 .Ic dt .
9263 .It Va autosort
9264 Causes sorted mode (see the
9265 .Ic sort
9266 command) to be entered automatically with the value of this variable as
9267 sorting method when a folder is opened, for example
9268 .Ql set autosort=thread .
9271 .It Va bang
9272 \*(BO Enables the substitution of all not (reverse-solidus) escaped
9273 exclamation mark
9274 .Ql \&!
9275 characters by the contents of the last executed command for the
9276 .Ic \&!
9277 shell escape command and
9278 .Ic ~! ,
9279 one of the compose mode
9280 .Sx "COMMAND ESCAPES" .
9281 If this variable is not set no reverse solidus stripping is performed.
9284 .It Va bind-timeout
9285 \*(OB Predecessor of
9286 .Va bind-inter-byte-timeout .
9287 \*(ID Setting this automatically sets the successor.
9290 .It Va bind-inter-byte-timeout
9291 \*(OP Terminals may generate multi-byte sequences for special function
9292 keys, for example, but these sequences may not become read as a unit.
9293 And multi-byte sequences can be defined freely via
9294 .Ic bind .
9295 This variable specifies the timeout in milliseconds that the MLE (see
9296 .Sx "On terminal control and line editor" )
9297 waits for more bytes to arrive unless it considers a sequence
9298 .Dq complete .
9299 The default is 200, the maximum is about 10 seconds.
9300 In the following example the comments state which sequences are
9301 affected by this timeout:
9302 .Bd -literal -offset indent
9303 ? bind base abc echo 0 # abc
9304 ? bind base ab,c echo 1 # ab
9305 ? bind base abc,d echo 2 # abc
9306 ? bind base ac,d echo 3 # ac
9307 ? bind base a,b,c echo 4
9308 ? bind base a,b,c,d echo 5
9309 ? bind base a,b,cc,dd echo 6 # cc and dd
9313 .It Va bind-inter-key-timeout
9314 \*(OP Multi-key
9315 .Ic bind
9316 sequences do not time out by default.
9317 If this variable is set, then the current key sequence is forcefully
9318 terminated once the timeout (in milliseconds) triggers.
9319 The value should be (maybe significantly) larger than
9320 .Va bind-inter-byte-timeout ,
9321 but may not excess the maximum, too.
9324 .It Va bsdcompat
9325 \*(BO Sets some cosmetical features to traditional BSD style;
9326 has the same affect as setting
9327 .Va askatend
9328 and all other variables prefixed with
9329 .Ql bsd ;
9330 it also changes the behaviour of
9331 .Va emptystart
9332 (which does not exist in BSD).
9335 .It Va bsdflags
9336 \*(BO Changes the letters shown in the first column of a header
9337 summary to traditional BSD style.
9340 .It Va bsdheadline
9341 \*(BO Changes the display of columns in a header summary to traditional
9342 BSD style.
9345 .It Va bsdmsgs
9346 \*(BO Changes some informational messages to traditional BSD style.
9349 .It Va bsdorder
9350 \*(BO Causes the
9351 .Ql Subject:
9352 field to appear immediately after the
9353 .Ql To:
9354 field in message headers and with the
9355 .Ic ~h
9356 .Sx "COMMAND ESCAPES" .
9362 .It Va build-cc , build-ld , build-os , build-rest
9363 \*(RO The build environment, including the compiler, the linker, the
9364 operating system \*(UA has been build for, usually taken from
9365 .Xr uname 1
9367 .Ql uname -s ,
9368 and then lowercased, as well as all the possibly interesting rest of the
9369 configuration and build environment.
9370 This information is also available in the
9371 .Va verbose
9372 output of the command
9373 .Ic version .
9376 .It Va charset-7bit
9377 The value that should appear in the
9378 .Ql charset=
9379 parameter of
9380 .Ql Content-Type:
9381 MIME header fields when no character set conversion of the message data
9382 was performed.
9383 This defaults to US-ASCII, and the chosen character set should be
9384 US-ASCII compatible.
9387 .It Va charset-8bit
9388 \*(OP The default 8-bit character set that is used as an implicit last
9389 member of the variable
9390 .Va sendcharsets .
9391 This defaults to UTF-8 if character set conversion capabilities are
9392 available, and to ISO-8859-1 otherwise (unless the operating system
9393 environment is known to always and exclusively support UTF-8 locales),
9394 in which case the only supported character set is
9395 .Va ttycharset
9396 and this variable is effectively ignored.
9399 .It Va charset-unknown-8bit
9400 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
9401 .Dq upgrade
9402 the content of a mail message by using a character set with the name
9403 .Ql unknown-8bit .
9404 Because of the unclassified nature of this character set \*(UA will not
9405 be capable to convert this character set to any other character set.
9406 If this variable is set any message part which uses the character set
9407 .Ql unknown-8bit
9408 is assumed to really be in the character set given in the value,
9409 otherwise the (final) value of
9410 .Va charset-8bit
9411 is used for this purpose.
9413 This variable will also be taken into account if a MIME type (see
9414 .Sx "The mime.types files" )
9415 of a MIME message part that uses the
9416 .Ql binary
9417 character set is forcefully treated as text.
9420 .It Va cmd
9421 The default value for the
9422 .Ic pipe
9423 command.
9426 .It Va colour-disable
9427 \*(BO\*(OP Forcefully disable usage of colours.
9428 Also see the section
9429 .Sx "Coloured display" .
9432 .It Va colour-pager
9433 \*(BO\*(OP Whether colour shall be used for output that is paged through
9434 .Ev PAGER .
9435 Note that pagers may need special command line options, for example
9436 .Xr less 1
9437 requires the option
9438 .Fl \&\&R
9440 .Xr lv 1
9441 the option
9442 .Fl \&\&c
9443 in order to support colours.
9444 Often doing manual adjustments is unnecessary since \*(UA may perform
9445 adjustments dependent on the value of the environment variable
9446 .Ev PAGER
9447 (see there for more).
9451 .It Va contact-mail , contact-web
9452 \*(RO Addresses for contact per email and web, respectively, for
9453 bug reports, suggestions, or anything else regarding \*(UA.
9454 The former can be used directly:
9455 .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
9461 .It Va content-description-forwarded-message , \
9462     content-description-quote-attachment , \
9463     content-description-smime-message , \
9464     content-description-smime-signature
9465 \*(OP(partially) Strings which will be placed in according
9466 .Ql Content-Description:
9467 headers if non-empty.
9468 They all have default values, for example
9469 .Ql Forwarded message .
9472 .It Va crt
9473 In a(n interactive) terminal session, then if this valued variable is
9474 set it will be used as a threshold to determine how many lines the given
9475 output has to span before it will be displayed via the configured
9476 .Ev PAGER ;
9477 Usage of the
9478 .Ev PAGER
9479 can be forced by setting this to the value
9480 .Ql 0 ,
9481 setting it without a value will deduce the current height of the
9482 terminal screen to compute the threshold (see
9483 .Ev LINES ,
9484 .Va screen
9486 .Xr stty 1 ) .
9487 \*(ID At the moment this uses the count of lines of the message in wire
9488 format, which, dependent on the
9489 .Va mime-encoding
9490 of the message, is unrelated to the number of display lines.
9491 (The software is old and historically the relation was a given thing.)
9494 .It Va customhdr
9495 Define a set of custom headers to be injected into newly composed or
9496 forwarded messages.
9497 A custom header consists of the field name followed by a colon
9498 .Ql \&:
9499 and the field content body.
9500 Standard header field names cannot be overwritten by a custom header,
9501 with the exception of
9502 .Ql Comments:
9504 .Ql Keywords: .
9505 Different to the command line option
9506 .Fl C
9507 the variable value is interpreted as a comma-separated list of custom
9508 headers: to include commas in header bodies they need to become escaped
9509 with reverse solidus
9510 .Ql \e .
9511 Headers can be managed more freely in
9512 .Sx "Compose mode"
9514 .Ic ~^ .
9516 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
9519 .It Va datefield
9520 Controls the appearance of the
9521 .Ql %d
9522 date and time format specification of the
9523 .Va headline
9524 variable, that is used, for example, when viewing the summary of
9525 .Ic headers .
9526 If unset, then the local receiving date is used and displayed
9527 unformatted, otherwise the message sending
9528 .Ql Date: .
9529 It is possible to assign a
9530 .Xr strftime 3
9531 format string and control formatting, but embedding newlines via the
9532 .Ql %n
9533 format is not supported, and will result in display errors.
9534 The default is
9535 .Ql %Y-%m-%d %H:%M ,
9536 and also see
9537 .Va datefield-markout-older .
9540 .It Va datefield-markout-older
9541 Only used in conjunction with
9542 .Va datefield .
9543 Can be used to create a visible distinction of messages dated more than
9544 a day in the future, or older than six months, a concept comparable to the
9545 .Fl \&\&l
9546 option of the POSIX utility
9547 .Xr ls 1 .
9548 If set to the empty string, then the plain month, day and year of the
9549 .Ql Date:
9550 will be displayed, but a
9551 .Xr strftime 3
9552 format string to control formatting can be assigned.
9553 The default is
9554 .Ql %Y-%m-%d .
9557 .It Va debug
9558 \*(BO (Almost) Enter a debug-only sandbox mode which generates many
9559 log messages, disables the actual delivery of messages, and also implies
9560 .Pf no Va record
9561 as well as
9562 .Pf no Va save .
9563 Also see
9564 .Va verbose .
9567 .It Va disposition-notification-send
9568 \*(BO\*(OP Emit a
9569 .Ql Disposition-Notification-To:
9570 header (RFC 3798) with the message.
9571 This requires the
9572 .Va from
9573 variable to be set.
9574 .\" TODO .It Va disposition-notification-send-HOST
9575 .\"Overrides
9576 .\".Va disposition-notification-send
9577 .\" for SMTP accounts on a specific host.
9578 .\" TODO .It Va disposition-notification-send-USER@HOST
9579 .\"Overrides
9580 .\".Va disposition-notification-send
9581 .\"for a specific account.
9584 .It Va dot
9585 \*(BO When dot is set, a period
9586 .Ql \&.
9587 on a line by itself during message input in (interactive or batch
9588 .Fl # )
9589 .Sx "Compose mode"
9590 will be treated as end-of-message (in addition to the
9591 normal end-of-file condition).
9592 This behaviour is implied in
9593 .Va posix
9594 mode with a set
9595 .Va ignoreeof .
9598 .It Va dotlock-disable
9599 \*(BO\*(OP Disable creation of
9600 .Mx -sx
9601 .Sx "dotlock files"
9602 for MBOX databases.
9604 .It Va dotlock-ignore-error
9605 \*(OB\*(BO\*(OP Ignore failures when creating
9606 .Mx -sx
9607 .Sx "dotlock files" .
9608 Please use
9609 .Va dotlock-disable
9610 instead.
9613 .It Va editalong
9614 If this variable is set then the editor is started automatically when
9615 a message is composed in interactive mode.
9616 If the value starts with the letter
9617 .Ql v
9618 then this acts as if
9619 .Ic ~v ,
9620 otherwise as if
9621 .Ic ~e
9622 .Pf (see\0 Sx "COMMAND ESCAPES" )
9623 had been specified.
9625 .Va editheaders
9626 variable is implied for this automatically spawned editor session.
9629 .It Va editheaders
9630 \*(BO When a message is edited while being composed,
9631 its header is included in the editable text.
9634 .It Va emptystart
9635 \*(BO When entering interactive mode \*(UA normally writes
9636 .Dq \&No mail for user
9637 and exits immediately if a mailbox is empty or does not exist.
9638 If this variable is set \*(UA starts even with an empty or non-existent
9639 mailbox (the latter behaviour furtherly depends upon
9640 .Va bsdcompat ,
9641 though).
9644 .It Va errexit
9645 \*(BO Let each command with a non-0 exit status, including every
9646 .Ic call Ns
9647 ed macro which
9648 .Ic return Ns
9649 s a non-0 status, cause a program exit unless prefixed by
9650 .Cm ignerr
9651 (see
9652 .Sx "Command modifiers" ) .
9653 This also affects
9654 .Sx "COMMAND ESCAPES" ,
9655 but which use a different modifier for ignoring the error.
9656 Please refer to the variable
9657 .Va \&?
9658 for more on this topic.
9661 .It Va errors-limit
9662 \*(OP Maximum number of entries in the
9663 .Ic errors
9664 queue.
9667 .It Va escape
9668 The first character of this value defines the escape character for
9669 .Sx "COMMAND ESCAPES"
9671 .Sx "Compose mode" .
9672 The default value is the character tilde
9673 .Ql ~ .
9674 If set to the empty string, command escapes are disabled.
9678 .It Va expandaddr
9679 If unset only user name and email address recipients are allowed
9680 .Sx "On sending mail, and non-interactive mode" .
9681 If set without value all possible recipient types will be accepted.
9682 A value is parsed as a comma-separated list of case-insensitive strings,
9683 and if that contains
9684 .Ql restrict
9685 behaviour equals the former except when in interactive mode or if
9686 .Sx "COMMAND ESCAPES"
9687 were enabled via
9688 .Fl ~
9690 .Fl # ,
9691 in which case it equals the latter, allowing all address types.
9692 .Ql restrict
9693 really acts like
9694 .Ql restrict,\:-all,\:+name,\:+addr ,
9695 so care for ordering issues must be taken.
9698 Recipient types can be added and removed with a plus sign
9699 .Ql +
9700 or hyphen-minus
9701 .Ql -
9702 prefix, respectively.
9703 By default invalid or disallowed types are filtered out and
9704 cause a warning, hard send errors need to be enforced by including
9705 .Ql fail .
9706 The value
9707 .Ql all
9708 covers all types,
9709 .Ql fcc
9710 whitelists
9711 .Ql Fcc:
9712 header targets regardless of other settings,
9713 .Ql file
9714 file targets (it includes
9715 .Ql fcc ) ,
9716 .Ql pipe
9717 command pipeline targets,
9718 .Ql name
9719 user names still unexpanded after
9720 .Ic alias
9722 .Va mta-aliases
9723 processing and thus left for expansion by the
9724 .Va mta
9725 (invalid for the built-in SMTP one), and
9726 .Ql addr
9727 network addresses.
9728 Targets are interpreted in the given order, so that
9729 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
9730 will cause hard errors for any non-network address recipient address
9731 unless running interactively or having been started with the option
9732 .Fl ~
9734 .Fl # ;
9735 in the latter case(s) any type may be used.
9738 User name receivers addressing valid local users can be expanded to
9739 fully qualified network addresses (also see
9740 .Va hostname )
9741 by including
9742 .Ql nametoaddr
9743 in the list.
9744 Historically invalid recipients were stripped off without causing
9745 errors, this can be changed by making
9746 .Ql failinvaddr
9747 an entry of the list (it really acts like
9748 .Ql failinvaddr,\:+addr ) .
9749 Likewise,
9750 .Ql domaincheck
9751 .Pf (really\0\: Ql domaincheck,\:+addr )
9752 compares address domain names against a whitelist and strips off
9753 .Pf ( Ql fail
9754 for hard errors) addressees which fail this test; the domain name
9755 .Ql localhost
9756 and the non-empty value of
9757 .Va hostname
9758 (the real hostname otherwise) are always whitelisted,
9759 .Va expandaddr-domaincheck
9760 can be set to extend this list.
9761 Finally some address providers (for example
9762 .Fl b , c
9763 and all other command line recipients) will be evaluated as
9764 if specified within dollar-single-quotes (see
9765 .Sx "Shell-style argument quoting" )
9766 if the value list contains the string
9767 .Ql shquote .
9771 .It Va expandaddr-domaincheck
9772 Can be set to a comma-separated list of domain names which should be
9773 whitelisted for the evaluation of the
9774 .Ql domaincheck
9775 mode of
9776 .Va expandaddr .
9777 IDNA encoding is not automatically performed,
9778 .Ic addrcodec
9779 can be used to prepare the domain (of an address).
9782 .It Va expandargv
9783 Unless this variable is set additional
9784 .Va mta
9785 (Mail-Transfer-Agent)
9786 arguments from the command line, as can be given after a
9787 .Fl \&\&-
9788 separator, results in a program termination with failure status.
9789 The same can be accomplished by using the special (case-insensitive) value
9790 .Ql fail .
9791 A lesser strict variant is the otherwise identical
9792 .Ql restrict ,
9793 which does accept such arguments in interactive mode, or if tilde
9794 commands were enabled explicitly by using one of the command line options
9795 .Fl ~
9797 .Fl # .
9798 The empty value will allow unconditional usage.
9801 .It Va features
9802 \*(RO String giving a list of optional features.
9803 Features are preceded with a plus sign
9804 .Ql +
9805 if they are available, with a hyphen-minus
9806 .Ql -
9807 otherwise.
9808 To ease substring matching the string starts and ends with a comma.
9809 The output of the command
9810 .Ic version
9811 includes this information in a more pleasant output.
9814 .It Va flipr
9815 \*(BO This setting reverses the meanings of a set of reply commands,
9816 turning the lowercase variants, which by default address all recipients
9817 included in the header of a message
9818 .Pf ( Ic reply , respond , followup )
9819 into the uppercase variants, which by default address the sender only
9820 .Pf ( Ic Reply , Respond , Followup )
9821 and vice versa.
9824 .It Va folder
9825 The default path under which mailboxes are to be saved:
9826 filenames that begin with the plus sign
9827 .Ql +
9828 will have the plus sign replaced with the value of this variable if set,
9829 otherwise the plus sign will remain unchanged when doing
9830 .Sx "Filename transformations" ;
9831 also see
9832 .Ic folder
9833 for more on this topic, and know about standard imposed implications of
9834 .Va outfolder .
9835 The value supports a subset of transformations itself, and if the
9836 non-empty value does not start with a solidus
9837 .Ql / ,
9838 then the value of
9839 .Ev HOME
9840 will be prefixed automatically.
9841 Once the actual value is evaluated first, the internal variable
9842 .Va folder-resolved
9843 will be updated for caching purposes.
9845 .Mx Va folder-hook
9846 .It Va folder-hook-FOLDER , Va folder-hook
9847 Names a
9848 .Ic define Ns d
9849 macro which will be called whenever a
9850 .Ic folder
9851 is opened.
9852 The macro will also be invoked when new mail arrives,
9853 but message lists for commands executed from the macro
9854 only include newly arrived messages then.
9855 .Ic localopts
9856 are activated by default in a folder hook, causing the covered settings
9857 to be reverted once the folder is left again.
9859 The specialized form will override the generic one if
9860 .Ql FOLDER
9861 matches the file that is opened.
9862 Unlike other folder specifications, the fully expanded name of a folder,
9863 without metacharacters, is used to avoid ambiguities.
9864 However, if the mailbox resides under
9865 .Va folder
9866 then the usual
9867 .Ql +
9868 specification is tried in addition, so that if
9869 .Va \&\&folder
9871 .Dq mail
9872 (and thus relative to the user's home directory) then
9873 .Pa /home/usr1/mail/sent
9874 will be tried as
9875 .Ql folder-hook-/home/usr1/mail/sent
9876 first, but then followed by
9877 .Ql folder-hook-+sent .
9880 .It Va folder-resolved
9881 \*(RO Set to the fully resolved path of
9882 .Va folder
9883 once that evaluation has occurred; rather internal.
9886 .It Va followup-to
9887 \*(BO Controls whether a
9888 .Ql Mail-Followup-To:
9889 header is generated when sending messages to known mailing lists.
9890 The user as determined via
9891 .Va from
9892 (or, if that contains multiple addresses,
9893 .Va sender )
9894 will be placed in there if any list addressee is not a subscribed list.
9895 Also see
9896 .Va followup-to-honour
9897 and the commands
9898 .Ic mlist , mlsubscribe , reply
9900 .Ic Lreply .
9903 .It Va followup-to-add-cc
9904 \*(BO Controls whether the user will be added to the messages'
9905 .Ql Cc:
9906 list in addition to placing an entry in
9907 .Ql Mail-Followup-To:
9908 (see
9909 .Va followup-to ) .
9912 .It Va followup-to-honour
9913 Controls whether a
9914 .Ql Mail-Followup-To:
9915 header is honoured when group-replying to a message via
9916 .Ic reply
9918 .Ic Lreply .
9919 This is a
9920 .Mx -sx
9921 .Sx quadoption ;
9922 if set without a value it defaults to
9923 .Dq yes ,
9924 and see
9925 .Va followup-to .
9928 .It Va forward-add-cc
9929 \*(BO Whether senders of messages forwarded via
9930 .Ic ~F , ~f , ~m , ~U
9932 .Ic ~u
9933 shall be made members of the carbon copies
9934 .Ql Cc:
9935 list.
9938 .It Va forward-as-attachment
9939 \*(BO Original messages are normally sent as inline text with the
9940 .Ic forward
9941 command,
9942 and only the first part of a multipart message is included.
9943 With this setting enabled messages are sent as unmodified MIME
9944 .Ql message/rfc822
9945 attachments with all of their parts included.
9949 .It Va forward-inject-head , forward-inject-tail
9950 The strings to put before and after the text of a message with the
9951 .Ic forward
9952 command, respectively.
9953 The former defaults to
9954 .Ql -------- Original Message --------\en .
9955 Special format directives in these strings will be expanded if possible,
9956 and if so configured the output will be folded according to
9957 .Va quote-fold ;
9958 for more please refer to
9959 .Va quote-inject-head .
9960 Injections will not be performed by
9961 .Ic forward
9962 if the variable
9963 .Va forward-as-attachment
9964 is set \(em the
9965 .Sx "COMMAND ESCAPES"
9966 .Ic ~F , ~f , ~M , ~m , ~U , ~u
9967 always inject.
9971 .It Va from
9972 The address (or a list of addresses) to put into the
9973 .Ql From:
9974 field of the message header, quoting RFC 5322:
9975 the author(s) of the message, that is, the mailbox(es) of the person(s)
9976 or system(s) responsible for the writing of the message.
9977 According to that RFC setting the
9978 .Va sender
9979 variable is required if
9980 .Va \&\&from
9981 contains more than one address.
9982 \*(ID Please expect automatic management of the
9983 .Va from
9985 .Va sender
9986 relationship.
9987 Dependent on the context these addresses are handled as if they were in
9988 the list of
9989 .Ic alternates .
9992 If a file-based MTA is used, then
9993 .Va \&\&from
9994 (or, if that contains multiple addresses,
9995 .Va sender )
9996 can nonetheless be used as the envelope sender address at the MTA
9997 protocol level (the RFC 5321 reverse-path), either via the
9998 .Fl r
9999 command line option (without argument; see there for more), or by setting
10000 .Va r-option-implicit .
10003 If the machine's hostname is not valid at the Internet (for example at
10004 a dialup machine), then either this variable or
10005 .Va hostname
10006 (\*(IN a SMTP-based
10007 .Va mta
10008 adds even more fine-tuning capabilities with
10009 .Va smtp-hostname )
10010 have to be set: if so the message and MIME part related unique ID fields
10011 .Ql Message-ID:
10013 .Ql Content-ID:
10014 will be created (except when disallowed by
10015 .Va message-id-disable
10017 .Va stealthmua ) .
10021 .It Va fullnames
10022 \*(BO Due to historical reasons comments and name parts of email
10023 addresses are removed by default when sending mail, replying to or
10024 forwarding a message.
10025 If this variable is set such stripping is not performed.
10027 .It Va fwdheading
10028 \*(OB Predecessor of
10029 .Va forward-inject-head .
10032 .It Va header
10033 \*(BO Causes the header summary to be written at startup and after
10034 commands that affect the number of messages or the order of messages in
10035 the current
10036 .Ic folder .
10037 Unless in
10038 .Va posix
10039 mode a header summary will also be displayed on folder changes.
10040 The command line option
10041 .Fl N
10042 can be used to set
10043 .Pf no Va header .
10047 .It Va headline
10048 A format string to use for the summary of
10049 .Ic headers .
10050 Format specifiers in the given string start with a percent sign
10051 .Ql %
10052 and may be followed by an optional decimal number indicating the field
10053 width \(em if that is negative, the field is to be left-aligned.
10054 Names and addresses are subject to modifications according to
10055 .Va showname
10057 .Va showto .
10058 Valid format specifiers are:
10061 .Bl -tag -compact -width ".It Ql _%%_"
10062 .It Ql %%
10063 A plain percent sign.
10064 .It Ql %>
10065 .Dq Dotmark :
10066 a space character but for the current message
10067 .Pf ( Dq dot ) ,
10068 for which it expands to
10069 .Ql >
10070 (dependent on
10071 .Va headline-plain ) .
10072 .It Ql %<
10073 .Dq Dotmark :
10074 a space character but for the current message
10075 .Pf ( Dq dot ) ,
10076 for which it expands to
10077 .Ql <
10078 (dependent on
10079 .Va headline-plain ) .
10080 .It Ql %$
10081 \*(OP The spam score of the message, as has been classified via the
10082 command
10083 .Ic spamrate .
10084 Shows only a replacement character if there is no spam support.
10085 .It Ql %a
10086 Message attribute character (status flag); the actual content can be
10087 adjusted by setting
10088 .Va attrlist .
10089 .It Ql %d
10090 The date found in the
10091 .Ql Date:
10092 header of the message when
10093 .Va datefield
10094 is set (the default), otherwise the date when the message was received.
10095 Formatting can be controlled by assigning a
10096 .Xr strftime 3
10097 format string to
10098 .Va datefield
10099 (and
10100 .Va datefield-markout-older ) .
10101 .It Ql %e
10102 The indenting level in
10103 .Ql thread Ns
10105 .Ic sort
10106 mode.
10107 .It Ql %f
10108 The address of the message sender.
10109 .It Ql %i
10110 The message thread tree structure.
10111 (Note that this format does not support a field width, and honours
10112 .Va headline-plain . )
10113 .It Ql %L
10114 Mailing list status: is the addressee of the message a known
10115 .Ql l
10116 .Pf ( Ic mlist )
10118 .Ql L
10119 .Ic mlsubscribe Ns
10120 d mailing list?
10121 The letter
10122 .Ql P
10123 announces the presence of a RFC 2369
10124 .Ql List-Post:
10125 header, which makes a message a valuable target of
10126 .Ic Lreply .
10127 .It Ql %l
10128 The number of lines of the message, if available.
10129 .It Ql %m
10130 Message number.
10131 .It Ql %o
10132 The number of octets (bytes) in the message, if available.
10133 .It Ql %S
10134 Message subject (if any) in double quotes.
10135 .It Ql %s
10136 Message subject (if any).
10137 .It Ql %t
10138 The position in threaded/sorted order.
10139 .It Ql \&%U
10140 The value 0 except in an IMAP mailbox,
10141 where it expands to the UID of the message.
10144 The default is
10145 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
10147 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
10149 .Va bsdcompat
10150 is set.
10151 Also see
10152 .Va attrlist ,
10153 .Va headline-plain
10155 .Va headline-bidi .
10159 .It Va headline-bidi
10160 Bidirectional text requires special treatment when displaying headers,
10161 because numbers (in dates or for file sizes etc.) will not affect the
10162 current text direction, in effect resulting in ugly line layouts when
10163 arabic or other right-to-left text is to be displayed.
10164 On the other hand only a minority of terminals is capable to correctly
10165 handle direction changes, so that user interaction is necessary for
10166 acceptable results.
10167 Note that extended host system support is required nonetheless, e.g.,
10168 detection of the terminal character set is one precondition;
10169 and this feature only works in an Unicode (i.e., UTF-8) locale.
10171 In general setting this variable will cause \*(UA to encapsulate text
10172 fields that may occur when displaying
10173 .Va headline
10174 (and some other fields, like dynamic expansions in
10175 .Va prompt )
10176 with special Unicode control sequences;
10177 it is possible to fine-tune the terminal support level by assigning
10178 a value:
10179 no value (or any value other than
10180 .Ql 1 ,
10181 .Ql 2
10183 .Ql 3 )
10184 will make \*(UA assume that the terminal is capable to properly deal
10185 with Unicode version 6.3, in which case text is embedded in a pair of
10186 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
10187 characters.
10188 In addition no space on the line is reserved for these characters.
10190 Weaker support is chosen by using the value
10191 .Ql 1
10192 (Unicode 6.3, but reserve the room of two spaces for writing the control
10193 sequences onto the line).
10194 The values
10195 .Ql 2
10197 .Ql 3
10198 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
10199 again reserves room for two spaces in addition.
10202 .It Va headline-plain
10203 \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are
10204 used by default for certain entries of
10205 .Va headline .
10206 If this variable is set only basic US-ASCII symbols will be used.
10209 .It Va history-file
10210 \*(OP The (expandable) location of a permanent
10211 .Ic history
10212 file for the MLE line editor
10213 .Pf ( Sx "On terminal control and line editor" ) .
10214 Also see
10215 .Va history-size .
10218 .It Va history-gabby
10219 \*(OP Add more entries to the MLE
10220 .Ic history
10221 as is normally done.
10222 A comma-separated list of case-insensitive strings can be used to
10223 fine-tune which gabby entries shall be allowed.
10224 If it contains
10225 .Ql errors ,
10226 erroneous commands will also be added.
10227 .Ql all
10228 adds all optional entries, and is the fallback chattiness identifier of
10229 .Va on-history-addition .
10232 .It Va history-gabby-persist
10233 \*(BO\*(OP The
10234 .Va history-gabby
10235 entries will not be saved in persistent storage unless this variable is set.
10236 The knowledge of whether a persistent entry was gabby is not lost.
10237 Also see
10238 .Va history-file .
10241 .It Va history-size
10242 \*(OP Setting this variable imposes a limit on the number of concurrent
10243 .Ic history
10244 entries.
10245 If set to the value 0 then no further history entries will be added,
10246 and loading and incorporation of the
10247 .Va history-file
10248 upon program startup can also be suppressed by doing this.
10249 Runtime changes will not be reflected before the
10250 .Ic history
10251 is saved or loaded (again).
10254 .It Va hold
10255 \*(BO This setting controls whether messages are held in the system
10256 .Va inbox ,
10257 and it is set by default.
10260 .It Va hostname
10261 Used instead of the value obtained from
10262 .Xr uname 3
10264 .Xr getaddrinfo 3
10265 as the hostname when expanding local addresses, for example in
10266 .Ql From:
10267 (also see
10268 .Sx "On sending mail, and non-interactive mode" ,
10269 for expansion of addresses that have a valid user-, but no domain
10270 name in angle brackets).
10271 If either of
10272 .Va from
10273 or this variable is set the message and MIME part related unique ID fields
10274 .Ql Message-ID:
10276 .Ql Content-ID:
10277 will be created (except when disallowed by
10278 .Va message-id-disable
10280 .Va stealthmua ) .
10281 If the \*(OPal IDNA support is available (see
10282 .Va idna-disable )
10283 variable assignment is aborted when a necessary conversion fails.
10285 Setting it to the empty string will cause the normal hostname to be
10286 used, but nonetheless enables creation of said ID fields.
10287 \*(IN in conjunction with the built-in SMTP
10288 .Va mta
10289 .Va smtp-hostname
10290 also influences the results:
10291 one should produce some test messages with the desired combination of
10292 .Va \&\&hostname ,
10293 and/or
10294 .Va from ,
10295 .Va sender
10296 etc. first.
10299 .It Va idna-disable
10300 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
10301 names according to the rules of IDNA (internationalized domain names
10302 for applications).
10303 Since the IDNA code assumes that domain names are specified with the
10304 .Va ttycharset
10305 character set, an UTF-8 locale charset is required to represent all
10306 possible international domain names (before conversion, that is).
10309 .It Va ifs
10310 The input field separator that is used (\*(ID by some functions) to
10311 determine where to split input data.
10313 .Bl -tag -compact -width ".It MMM"
10314 .It 1.
10315 Unsetting is treated as assigning the default value,
10316 .Ql \& \et\en .
10317 .It 2.
10318 If set to the empty value, no field splitting will be performed.
10319 .It 3.
10320 If set to a non-empty value, all whitespace characters are extracted
10321 and assigned to the variable
10322 .Va ifs-ws .
10325 .Bl -tag -compact -width ".It MMM"
10326 .It a.
10327 .Va \&\&ifs-ws
10328 will be ignored at the beginning and end of input.
10329 Diverging from POSIX shells default whitespace is removed in addition,
10330 which is owed to the entirely different line content extraction rules.
10331 .It b.
10332 Each occurrence of a character of
10333 .Va \&\&ifs
10334 will cause field-splitting, any adjacent
10335 .Va \&\&ifs-ws
10336 characters will be skipped.
10340 .It Va ifs-ws
10341 \*(RO Automatically deduced from the whitespace characters in
10342 .Va ifs .
10345 .It Va ignore
10346 \*(BO Ignore interrupt signals from the terminal while entering
10347 messages; instead echo them as
10348 .Ql @
10349 characters and discard the current line.
10352 .It Va ignoreeof
10353 \*(BO Ignore end-of-file conditions
10354 .Pf ( Ql control-D )
10356 .Sx "Compose mode"
10357 on message input and in interactive command input.
10358 If set an interactive command input session can only be left by
10359 explicitly using one of the commands
10360 .Ic exit
10362 .Ic quit ,
10363 and message input in compose mode can only be terminated by entering
10364 a period
10365 .Ql \&.
10366 on a line by itself or by using the
10367 .Ic ~.
10368 .Sx "COMMAND ESCAPES" ;
10369 Setting this implies the behaviour that
10370 .Va dot
10371 describes in
10372 .Va posix
10373 mode.
10376 .It Va inbox
10377 If this is set to a non-empty string it will specify the user's
10378 .Mx -sx
10379 .Sx "primary system mailbox" ,
10380 overriding
10381 .Ev MAIL
10382 and the system-dependent default, and (thus) be used to replace
10383 .Ql %
10384 when doing
10385 .Sx "Filename transformations" ;
10386 also see
10387 .Ic folder
10388 for more on this topic.
10389 The value supports a subset of transformations itself.
10391 .It Va indentprefix
10392 String used by the
10393 .Ic ~m , ~M
10395 .Ic ~R
10396 .Sx "COMMAND ESCAPES"
10397 and by the
10398 .Va quote
10399 option for indenting messages,
10400 in place of the POSIX mandated default tabulator character
10401 .Ql \et .
10402 Also see
10403 .Va quote-chars .
10406 .It Va keep
10407 \*(BO If set, an empty
10408 .Mx -sx
10409 .Sx "primary system mailbox"
10410 file is not removed.
10411 Note that, in conjunction with
10412 .Va posix
10413 mode any empty file will be removed unless this variable is set.
10414 This may improve the interoperability with other mail user agents
10415 when using a common folder directory, and prevents malicious users
10416 from creating fake mailboxes in a world-writable spool directory.
10417 \*(ID Only local regular (MBOX) files are covered, Maildir and other
10418 mailbox types will never be removed, even if empty.
10421 .It Va keep-content-length
10422 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
10423 be told to keep the
10424 .Ql Content-Length:
10426 .Ql Lines:
10427 header fields that some MUAs generate by setting this variable.
10428 Since \*(UA does neither use nor update these non-standardized header
10429 fields (which in itself shows one of their conceptual problems),
10430 stripping them should increase interoperability in between MUAs that
10431 work with with same mailbox files.
10432 Note that, if this is not set but
10433 .Va writebackedited ,
10434 as below, is, a possibly performed automatic stripping of these header
10435 fields already marks the message as being modified.
10436 \*(ID At some future time \*(UA will be capable to rewrite and apply an
10437 .Va mime-encoding
10438 to modified messages, and then those fields will be stripped silently.
10441 .It Va keepsave
10442 \*(BO When a message is saved it is usually discarded from the
10443 originating folder when \*(UA is quit.
10444 This setting causes all saved message to be retained.
10447 .It Va line-editor-cpl-word-breaks
10448 \*(OP List of bytes which are used by the
10449 .Cd mle-complete
10450 tabulator completion to decide where word boundaries exist, by default
10451 .Ql """'@=;|:
10452 \*(ID This mechanism is yet restricted.
10455 .It Va line-editor-disable
10456 \*(BO Turn off any line editing capabilities (from \*(UAs POW, see
10457 .Sx "On terminal control and line editor"
10458 for more).
10461 .It Va line-editor-no-defaults
10462 \*(BO\*(OP Do not establish any default key binding.
10465 .It Va log-prefix
10466 Error log message prefix string
10467 .Pf ( Ql "\*(uA: " ) .
10470 .It Va mailbox-display
10471 \*(RO The name of the current mailbox
10472 .Pf ( Ic folder ) ,
10473 possibly abbreviated for display purposes.
10476 .It Va mailbox-resolved
10477 \*(RO The fully resolved path of the current mailbox.
10480 .It Va mailcap-disable
10481 \*(BO\*(OP Turn off consideration of MIME type handlers from,
10482 and implicit loading of
10483 .Sx "The Mailcap files" .
10486 .It Va mailx-extra-rc
10487 An additional startup file that is loaded as the last of the
10488 .Sx "Resource files" .
10489 Use this file for commands that are not understood by other POSIX
10490 .Xr mailx 1
10491 implementations, i.e., mostly anything which is not covered by
10492 .Sx "Initial settings" .
10495 .It Va markanswered
10496 \*(BO When a message is replied to and this variable is set,
10497 it is marked as having been
10498 .Ic answered .
10499 See the section
10500 .Sx "Message states" .
10503 .It Va mbox-fcc-and-pcc
10504 \*(BO By default all file and pipe message receivers (see
10505 .Va expandaddr )
10506 will be fed valid MBOX database entry message data (see
10507 .Ic folder ,
10508 .Va mbox-rfc4155 ) ,
10509 and existing file targets will become extended in compliance to RFC 4155.
10510 If this variable is unset then a plain standalone RFC 5322 message will
10511 be written, and existing file targets will be overwritten.
10514 .It Va mbox-rfc4155
10515 \*(BO When opening MBOX mailbox databases, and in order to achieve
10516 compatibility with old software, the very tolerant POSIX standard rules
10517 for detecting message boundaries (so-called
10518 .Ql From_
10519 lines) are used instead of the stricter rules from the standard RFC 4155.
10520 This behaviour can be switched by setting this variable.
10522 This may temporarily be handy when \*(UA complains about invalid
10523 .Ql From_
10524 lines when opening a MBOX: in this case setting this variable and
10525 re-opening the mailbox in question may correct the result.
10526 If so, copying the entire mailbox to some other file, as in
10527 .Ql copy * SOME-FILE ,
10528 will perform proper, all-compatible
10529 .Ql From_
10530 quoting for all detected messages, resulting in a valid MBOX mailbox.
10531 (\*(ID The better and non-destructive approach is to re-encode invalid
10532 messages, as if it would be created anew, instead of mangling the
10533 .Ql From_
10534 lines; this requires the structural code changes of the v15 rewrite.)
10535 Finally the variable can be unset again:
10536 .Bd -literal -offset indent
10537 define mboxfix {
10538   localopts yes; wysh set mbox-rfc4155;\e
10539     wysh File "${1}"; copy * "${2}"
10541 call mboxfix /tmp/bad.mbox /tmp/good.mbox
10545 .It Va memdebug
10546 \*(BO Internal development variable.
10547 (Keeps memory debug enabled even if
10548 .Va debug
10549 is not set.)
10552 .It Va message-id-disable
10553 \*(BO By setting this variable the generation of
10554 .Ql Message-ID:
10556 .Ql Content-ID:
10557 message and MIME part headers can be completely suppressed, effectively
10558 leaving this task up to the
10559 .Va mta
10560 (Mail-Transfer-Agent) or the SMTP server.
10561 Note that according to RFC 5321 a SMTP server is not required to add this
10562 field by itself, so it should be ensured that it accepts messages without
10563 .Ql Message-ID .
10566 .It Va message-inject-head
10567 A string to put at the beginning of each new message, followed by a newline.
10568 \*(OB The escape sequences tabulator
10569 .Ql \et
10570 and newline
10571 .Ql \en
10572 are understood (use the
10573 .Cm wysh
10574 prefix when
10575 .Ic set Ns
10576 ting the variable(s) instead).
10579 .It Va message-inject-tail
10580 A string to put at the end of each new message, followed by a newline.
10581 \*(OB The escape sequences tabulator
10582 .Ql \et
10583 and newline
10584 .Ql \en
10585 are understood (use the
10586 .Cm wysh
10587 prefix when
10588 .Ic set Ns
10589 ting the variable(s) instead).
10590 Also see
10591 .Va on-compose-leave .
10594 .It Va metoo
10595 \*(BO Usually, when an
10596 .Ic alias
10597 expansion contains the sender, the sender is removed from the expansion.
10598 Setting this option suppresses these removals.
10599 Note that a set
10600 .Va metoo
10601 also causes a
10602 .Ql -m
10603 option to be passed through to the
10604 .Va mta
10605 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
10606 this flag, no MTA is known which does not support it (for historical
10607 compatibility).
10610 .It Va mime-allow-text-controls
10611 \*(BO When sending messages, each part of the message is MIME-inspected
10612 in order to classify the
10613 .Ql Content-Type:
10615 .Ql Content-Transfer-Encoding:
10616 (see
10617 .Va mime-encoding )
10618 that is required to send this part over mail transport, i.e.,
10619 a computation rather similar to what the
10620 .Xr file 1
10621 command produces when used with the
10622 .Ql --mime
10623 option.
10625 This classification however treats text files which are encoded in
10626 UTF-16 (seen for HTML files) and similar character sets as binary
10627 octet-streams, forcefully changing any
10628 .Ql text/plain
10630 .Ql text/html
10631 specification to
10632 .Ql application/octet-stream :
10633 If that actually happens a yet unset charset MIME parameter is set to
10634 .Ql binary ,
10635 effectively making it impossible for the receiving MUA to automatically
10636 interpret the contents of the part.
10638 If this variable is set, and the data was unambiguously identified as
10639 text data at first glance (by a
10640 .Ql .txt
10642 .Ql .html
10643 file extension), then the original
10644 .Ql Content-Type:
10645 will not be overwritten.
10648 .It Va mime-alternative-favour-rich
10649 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
10650 HTML) will be preferred in favour of included plain text versions when
10651 displaying messages, provided that a handler exists which produces
10652 output that can be (re)integrated into \*(UA's normal visual display.
10655 .It Va mime-counter-evidence
10656 Normally the
10657 .Ql Content-Type:
10658 field is used to decide how to handle MIME parts.
10659 Some MUAs, however, do not use
10660 .Sx "The mime.types files"
10661 (also see
10662 .Sx "HTML mail and MIME attachments" )
10663 or a similar mechanism to correctly classify content, but specify an
10664 unspecific MIME type
10665 .Pf ( Ql application/octet-stream )
10666 even for plain text attachments.
10667 If this variable is set then \*(UA will try to re-classify such MIME
10668 message parts, if possible, for example via a possibly existing
10669 attachment filename.
10670 A non-empty value may also be given, in which case a number is expected,
10671 actually a carrier of bits, best specified as a binary value, like
10672 .Ql 0b1111 .
10674 .Bl -bullet -compact
10676 If bit two is set (counting from 1, decimal 2) then the detected
10677 .Ic mimetype
10678 will be carried along with the message and be used for deciding which
10679 MIME handler is to be used, for example;
10680 when displaying such a MIME part the part-info will indicate the
10681 overridden content-type by showing a plus sign
10682 .Ql + .
10684 If bit three is set (decimal 4) then the counter-evidence is always
10685 produced and a positive result will be used as the MIME type, even
10686 forcefully overriding the parts given MIME type.
10688 If bit four is set (decimal 8) as a last resort the actual content of
10689 .Ql application/octet-stream
10690 parts will be inspected, so that data which looks like plain text can be
10691 treated as such.
10692 This mode is even more relaxed when data is to be displayed to the user
10693 or used as a message quote (data consumers which mangle data for display
10694 purposes, which includes masking of control characters, for example).
10699 .It Va mime-encoding
10700 The MIME
10701 .Ql Content-Transfer-Encoding
10702 to use in outgoing text messages and message parts, where applicable
10703 (7-bit clean text messages are without an encoding if possible):
10706 .Bl -tag -compact -width ".It Ql _%%_"
10707 .It Ql 8bit
10708 .Pf (Or\0 Ql 8b . )
10709 8-bit transport effectively causes the raw data be passed through
10710 unchanged, but may cause problems when transferring mail messages over
10711 channels that are not ESMTP (RFC 1869) compliant.
10712 Also, several input data constructs are not allowed by the
10713 specifications and may cause a different transfer-encoding to be used.
10714 By established rules and popular demand occurrences of
10715 .Ql ^From_
10716 (see
10717 .Va mbox-rfc4155 )
10718 will be MBOXO quoted (prefixed with greater-than sign
10719 .Ql > )
10720 instead of causing a non-destructive encoding like
10721 .Ql quoted-printable
10722 to be chosen, unless context (like message signing) requires otherwise.
10724 .It Ql quoted-printable
10725 .Pf (Or\0 Ql qp . )
10726 Quoted-printable encoding is 7-bit clean and has the property that ASCII
10727 characters are passed through unchanged, so that an english message can
10728 be read as-is; it is also acceptable for other single-byte locales that
10729 share many characters with ASCII, for example ISO-8859-1.
10730 The encoding will cause a large overhead for messages in other character
10731 sets: for example it will require up to twelve (12) bytes to encode
10732 a single UTF-8 character of four (4) bytes.
10733 It is the default encoding.
10735 .It Ql base64
10736 .Pf (Or\0 Ql b64 . )
10737 This encoding is 7-bit clean and will always be used for binary data.
10738 This encoding has a constant input:output ratio of 3:4, regardless of
10739 the character set of the input data it will encode three bytes of input
10740 to four bytes of output.
10741 This transfer-encoding is not human readable without performing
10742 a decoding step.
10747 .It Va mime-force-sendout
10748 \*(BO\*(OP Whenever it is not acceptable to fail sending out messages
10749 because of non-convertible character content this variable may be set.
10750 It will, as a last resort, classify the part content as
10751 .Ql application/octet-stream .
10752 Please refer to the section
10753 .Sx "Character sets"
10754 for the complete picture of character set conversion, and
10755 .Sx "HTML mail and MIME attachments"
10756 for how to internally or externally handle part content.
10759 .It Va mimetypes-load-control
10760 Can be used to control which of
10761 .Sx "The mime.types files"
10762 are loaded: if the letter
10763 .Ql u
10764 is part of the option value, then the user's personal
10765 .Pa \*(vU
10766 file will be loaded (if it exists); likewise the letter
10767 .Ql s
10768 controls loading of the system wide
10769 .Pa \*(vS ;
10770 directives found in the user file take precedence, letter matching is
10771 case-insensitive.
10772 If this variable is not set \*(UA will try to load both files.
10773 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
10774 but they will be matched last (the order can be listed via
10775 .Ic mimetype ) .
10777 More sources can be specified by using a different syntax: if the
10778 value string contains an equals sign
10779 .Ql =
10780 then it is instead parsed as a comma-separated list of the described
10781 letters plus
10782 .Ql f=FILENAME
10783 pairs; the given filenames will be expanded and loaded, and their
10784 content may use the extended syntax that is described in the section
10785 .Sx "The mime.types files" .
10786 Directives found in such files always take precedence (are prepended to
10787 the MIME type cache).
10791 .It Va mta
10792 Select an alternate Mail-Transfer-Agent by either specifying the full
10793 pathname of an executable (a
10794 .Ql file://
10795 prefix may be given), or \*(OPally a SMTP aka SUBMISSION protocol URL \*(IN:
10797 .Dl submissions://[user[:password]@]server[:port]
10799 (\*(OU:
10800 .Ql [smtp://]server[:port] . )
10801 The default has been chosen at compile time.
10802 MTA data transfers are always performed in asynchronous child processes,
10803 and without supervision unless either the
10804 .Va sendwait
10805 or the
10806 .Va verbose
10807 variable is set.
10808 Also see
10809 .Va mta-bcc-ok .
10810 \*(OPally expansion of
10811 .Xr aliases 5
10812 can be performed by setting
10813 .Va mta-aliases .
10816 For testing purposes there is the
10817 .Ql test
10818 pseudo-MTA, which dumps to standard output or optionally to a file,
10819 and honours
10820 .Va mbox-fcc-and-pcc :
10822 .Bd -literal -offset indent
10823 $ echo text | \*(uA -:/ -Smta=test -s ubject ex@am.ple
10824 $ </dev/null \*(uA -:/ -Smta=test://./xy ex@am.ple
10828 For a file-based MTA it may be necessary to set
10829 .Va mta-argv0
10830 in in order to choose the right target of a modern
10831 .Xr mailwrapper 8
10832 environment.
10833 It will be passed command line arguments from several possible sources:
10834 from the variable
10835 .Va mta-arguments
10836 if set, from the command line if given and the variable
10837 .Va expandargv
10838 allows their use.
10839 Argument processing of the MTA will be terminated with a
10840 .Fl \&\&-
10841 separator.
10844 The otherwise occurring implicit usage of the following MTA command
10845 line arguments can be disabled by setting the boolean variable
10846 .Va mta-no-default-arguments
10847 (which will also disable passing
10848 .Fl \&\&-
10849 to the MTA):
10850 .Fl \&\&i
10851 (for not treating a line with only a dot
10852 .Ql \&.
10853 character as the end of input),
10854 .Fl \&\&m
10855 (shall the variable
10856 .Va metoo
10857 be set) and
10858 .Fl \&\&v
10859 (if the
10860 .Va verbose
10861 variable is set); in conjunction with the
10862 .Fl r
10863 command line option or
10864 .Va r-option-implicit
10865 .Fl \&\&f
10866 as well as possibly
10867 .Fl \&\&F
10868 will (not) be passed.
10871 \*(OPally \*(UA can send mail over SMTP aka SUBMISSION network
10872 connections to a single defined smart host by setting this variable to
10873 a SMTP or SUBMISSION URL (see
10874 .Sx "On URL syntax and credential lookup" ) .
10875 An authentication scheme can be specified via the variable chain
10876 .Va smtp-auth .
10877 Encrypted network connections are \*(OPally available, the section
10878 .Sx "Encrypted network communication"
10879 should give an overview and provide links to more information on this.
10880 Note that with some mail providers it may be necessary to set the
10881 .Va smtp-hostname
10882 variable in order to use a specific combination of
10883 .Va from ,
10884 .Va hostname
10886 .Va mta .
10887 Network communication socket timeouts are configurable via
10888 .Va socket-connect-timeout .
10889 All generated network traffic may be proxied over a SOCKS
10890 .Va socks-proxy ,
10891 it can be logged by setting
10892 .Va verbose
10893 twice.
10894 The following SMTP variants may be used:
10896 .Bl -bullet
10898 The plain SMTP protocol (RFC 5321) that normally lives on the
10899 server port 25 and requires setting the
10900 .Va smtp-use-starttls
10901 variable to enter a TLS encrypted session state.
10902 Assign a value like \*(IN
10903 .Ql smtp://[user[:password]@]server[:port]
10904 (\*(OU
10905 .Ql smtp://server[:port] )
10906 to choose this protocol.
10908 The so-called SMTPS which is supposed to live on server port 465
10909 and is automatically TLS secured.
10910 Unfortunately it never became a standardized protocol and may thus not
10911 be supported by your hosts network service database
10912 \(en in fact the port number has already been reassigned to other
10913 protocols!
10915 SMTPS is nonetheless a commonly offered protocol and thus can be
10916 chosen by assigning a value like \*(IN
10917 .Ql smtps://[user[:password]@]server[:port]
10918 (\*(OU
10919 .Ql smtps://server[:port] ) ;
10920 due to the mentioned problems it is usually necessary to explicitly
10921 specify the port as
10922 .Ql :465 ,
10923 however.
10925 The SUBMISSION protocol (RFC 6409) lives on server port 587 and
10926 is identically to the SMTP protocol from \*(UA's point of view;
10927 it requires setting
10928 .Va smtp-use-starttls
10929 to enter a TLS secured session state; e.g., \*(IN
10930 .Ql submission://[user[:password]@]server[:port] .
10932 The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is
10933 TLS secured by default.
10934 It can be chosen by assigning a value like \*(IN
10935 .Ql submissions://[user[:password]@]server[:port] .
10936 Due to the problems mentioned for SMTPS above and the fact that
10937 SUBMISSIONS is new and a successor that lives on the same port as the
10938 historical engineering mismanagement named SMTPS, it is usually
10939 necessary to explicitly specify the port as
10940 .Ql :465 .
10945 .It Va mta-aliases
10946 \*(OP If set to a path pointing to a text file in valid MTA (Postfix)
10947 .Xr aliases 5
10948 format, the file is loaded and cached (manageable with
10949 .Ic mtaaliases ) ,
10950 and henceforth plain
10951 .Ql name
10952 (see
10953 .Va expandaddr )
10954 message receiver names are recursively expanded as a last expansion
10955 step, after the distribution lists which can be created with
10956 .Ic alias .
10957 Constraints on
10958 .Xr \&\&aliases 5
10959 content support: only local addresses (names) which are valid usernames
10960 .Pf ( Ql [a-z_][a-z0-9_-]*[$]? )
10961 are treated as expandable aliases, and \*(ID
10962 .Ql :include:/file/name
10963 directives are not supported.
10964 By including
10965 .Ql -name
10967 .Va expandaddr
10968 it can be asserted that only expanded names (mail addresses) are passed
10969 through to the MTA.
10972 .It Va mta-arguments
10973 Arguments to pass through to a file-based
10974 .Va mta
10975 (Mail-Transfer-Agent), parsed according to
10976 .Sx "Shell-style argument quoting"
10977 into an array of arguments which will be joined onto MTA options
10978 from other sources, for example
10979 .Ql \&? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
10982 .It Va mta-no-default-arguments
10983 \*(BO Avoids passing standard command line options to a file-based
10984 .Va mta
10985 (please see there).
10988 .It Va mta-no-receiver-arguments
10989 \*(BO By default all receiver addresses will be passed as command line
10990 options to a file-based
10991 .Va mta .
10992 Setting this variable disables this behaviour to aid those MTAs which
10993 employ special treatment of such arguments.
10994 Doing so can make it necessary to pass a
10995 .Fl \&\&t
10997 .Va mta-arguments ,
10998 to testify the MTA that it should use the passed message as a template.
11001 .It Va mta-argv0
11002 Many systems use a so-called
11003 .Xr mailwrapper 8
11004 environment to ensure compatibility with
11005 .Xr sendmail 1 .
11006 This works by inspecting the name that was used to invoke the mail
11007 delivery system.
11008 If this variable is set then the mailwrapper (the program that is
11009 actually executed when calling the file-based
11010 .Va mta )
11011 will treat its contents as that name.
11014 .It Va mta-bcc-ok
11015 \*(BO In violation of RFC 5322 some MTAs do not remove
11016 .Ql Bcc:
11017 header lines from transported messages after having noted the respective
11018 receivers for addressing purposes.
11019 (The MTAs Exim and Courier for example require the command line option
11020 .Fl \&\&t
11021 to enforce removal.)
11022 Unless this is set corresponding receivers are addressed by
11023 protocol-specific means or MTA command line options only, the header
11024 itself is stripped before being sent over the wire.
11026 .Mx Va netrc-lookup
11027 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
11028 \*(BO\*(IN\*(OP Used to control usage of the user's
11029 .Pa \*(VN
11030 file for lookup of account credentials, as documented in the section
11031 .Sx "On URL syntax and credential lookup"
11032 and for the command
11033 .Ic netrc ;
11034 the section
11035 .Sx "The .netrc file"
11036 documents the file format.
11037 Also see
11038 .Va netrc-pipe .
11041 .It Va netrc-pipe
11042 \*(IN\*(OP When
11043 .Pa \*(VN
11044 is loaded (see
11045 .Ic netrc
11047 .Va netrc-lookup )
11048 then \*(UA will read the output of a shell pipe instead of the user's
11049 .Pa \*(VN
11050 file if this variable is set (to the desired shell command).
11051 This can be used to, for example, store
11052 .Pa \*(VN
11053 in encrypted form:
11054 .Ql \&? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
11057 .It Va newfolders
11058 \*(OP If this variable has the value
11059 .Ql maildir ,
11060 newly created local folders will be in Maildir instead of MBOX format.
11063 .It Va newmail
11064 Checks for new mail in the current folder each time the prompt is shown.
11065 A Maildir folder must be re-scanned to determine if new mail has arrived.
11066 If this variable is set to the special value
11067 .Ql nopoll
11068 then a Maildir folder will not be rescanned completely, but only
11069 timestamp changes are detected.
11070 Maildir folders are \*(OPal.
11073 .It Va outfolder
11074 \*(BO Causes a non-absolute filename specified in
11075 .Va record ,
11076 as well as the sender-based filenames of the
11077 .Ic Copy ,
11078 .Ic Save ,
11079 .Ic Followup
11081 .Ic followup
11082 commands to be interpreted relative to the
11083 .Va folder
11084 directory rather than relative to the current directory.
11086 .Mx Va on-account-cleanup
11087 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
11088 Macro hook which will be called once an
11089 .Ic account
11090 is left, as the very last step before unrolling per-account
11091 .Ic localopts .
11092 This hook is run even in case of fatal errors, including those generated
11093 by switching to the account as such, and it is advisable to perform only
11094 absolutely necessary actions, like cleaning up
11095 .Ic alternates ,
11096 for example.
11097 The specialized form is used in favour of the generic one if found.
11100 .It Va on-compose-cleanup
11101 Macro hook which will be called after the message has been sent (or not,
11102 in case of failures), as the very last step before unrolling compose mode
11103 .Ic localopts .
11104 This hook is run even in case of fatal errors, and it is advisable to
11105 perform only absolutely necessary actions, like cleaning up
11106 .Ic alternates ,
11107 for example.
11109 For compose mode hooks that may affect the message content please see
11110 .Va on-compose-enter , on-compose-leave , on-compose-splice .
11111 \*(ID This hook exists because
11112 .Ic alias , alternates , commandalias , shortcut ,
11113 to name a few, are neither covered by
11114 .Ic localopts
11115 nor by
11116 .Cm local :
11117 changes applied in compose mode will continue to be in effect thereafter.
11122 .It Va on-compose-enter , on-compose-leave
11123 Macro hooks which will be called once compose mode is entered,
11124 and after composing has been finished, respectively;
11125 the exact order of the steps taken is documented for
11126 .Ic ~. ,
11127 one of the
11128 .Sx "COMMAND ESCAPES" .
11129 Context about the message being worked on can be queried via
11130 .Ic digmsg .
11131 .Ic localopts
11132 are enabled for these hooks, and changes on variables will be forgotten
11133 after the message has been sent.
11134 .Va on-compose-cleanup
11135 can be used to perform other necessary cleanup steps.
11138 Here is an example that injects a signature via
11139 .Va message-inject-tail ;
11140 instead using
11141 .Va on-compose-splice
11142 to simply inject the file of desire via
11143 .Ic ~<
11145 .Ic ~<!
11146 may be a better approach.
11148 .Bd -literal -offset indent
11149 define t_ocl {
11150   vput ! i cat ~/.mysig
11151   if $? -eq 0
11152      vput csop message-inject-tail trim-end $i
11153   end
11155   # Alternatively
11156   readctl create ~/.mysig
11157   if $? -eq 0
11158     readall i
11159     if $? -eq 0
11160       vput csop message-inject-tail trim-end $i
11161     end
11162     readctl remove ~/.mysig
11163   end
11165 set on-compose-leave=t_ocl
11171 .It Va on-compose-splice , on-compose-splice-shell
11172 These hooks run once the normal compose mode is finished, but before the
11173 .Va on-compose-leave
11174 macro hook is called etc.
11175 Both hooks will be executed in a subprocess, with their input and output
11176 connected to \*(UA such that they can act as if they would be an
11177 interactive user.
11178 The difference in between them is that the latter is a
11179 .Ev SHELL
11180 command, whereas the former is a normal
11181 .Ic define Ns
11182 d macro, but which is restricted to a small set of commands (the
11183 .Va verbose
11184 output of for example
11185 .Ic list
11186 will indicate said capability).
11187 .Ic localopts
11188 are enabled for these hooks (in the parent process), causing any setting
11189 to be forgotten after the message has been sent;
11190 .Va on-compose-cleanup
11191 can be used to perform other cleanup as necessary.
11194 During execution of these hooks \*(UA will temporarily forget whether it
11195 has been started in interactive mode, (a restricted set of)
11196 .Sx "COMMAND ESCAPES"
11197 will always be available, and for guaranteed reproducibilities sake
11198 .Va escape
11200 .Va ifs
11201 will be set to their defaults.
11202 The compose mode command
11203 .Ic ~^
11204 has been especially designed for scriptability (via these hooks).
11205 The first line the hook will read on its standard input is the protocol
11206 version of said command escape, currently
11207 .Dq 0 0 2 :
11208 backward incompatible protocol changes have to be expected.
11211 Care must be taken to avoid deadlocks and other false control flow:
11212 if both involved processes wait for more input to happen at the
11213 same time, or one does not expect more input but the other is stuck
11214 waiting for consumption of its output, etc.
11215 There is no automatic synchronization of the hook: it will not be
11216 stopped automatically just because it, e.g., emits
11217 .Ql ~x .
11218 The hooks will however receive a termination signal if the parent enters
11219 an error condition.
11220 \*(ID Protection against and interaction with signals is not yet given;
11221 it is likely that in the future these scripts will be placed in an
11222 isolated session, which is signalled in its entirety as necessary.
11224 .Bd -literal -offset indent
11225 define ocs_signature {
11226   read version
11227   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
11229 set on-compose-splice=ocs_signature
11231 wysh set on-compose-splice-shell=$'\e
11232   read version;\e
11233   printf "hello $version!  Headers: ";\e
11234   echo \e'~^header list\e';\e
11235   read status result;\e
11236   echo "status=$status result=$result";\e
11237   '
11239 define ocsm {
11240   read version
11241   echo Splice protocol version is $version
11242   echo '~^h l'; read hl; vput csop es subs "${hl}" 0 1
11243   if "$es" != 2
11244     echoerr 'Cannot read header list'; echo '~x'; xit
11245   endif
11246   if "$hl" !%?case ' cc'
11247     echo '~^h i cc "Diet is your <mirr.or>"'; read es;\e
11248       vput csop es substring "${es}" 0 1
11249     if "$es" != 2
11250       echoerr 'Cannot insert Cc: header'; echo '~x'
11251       # (no xit, macro finishes anyway)
11252     endif
11253   endif
11255 set on-compose-splice=ocsm
11260 .It Va on-history-addition
11261 This hook will be called if an entry is about to be added to the
11262 .Ic history
11263 of the MLE, as documented in
11264 .Sx "On terminal control and line editor" .
11265 It will be called with three arguments: the first is the name of the
11266 input context (see
11267 .Ic bind ) ,
11268 the second is either an empty string or the matching
11269 .Va history-gabby
11270 type, and the third being the complete command line to be added.
11271 The entry will not be added to history if the hook uses a non-0
11272 .Ic return .
11273 \*(ID A future version will give the expanded command name as the third
11274 argument, followed by the tokenized command line as parsed in the
11275 remaining arguments, the first of which is the original unexpanded
11276 command name; i.e., one may do
11277 .Ql Ic shift Ns \| 4
11278 and will then be able to access the positional parameters as usual via
11279 .Va * , # , 1
11280 etc.
11283 .It Va on-main-loop-tick
11284 This hook will be called whenever the program's main event loop is
11285 about to read the next input line.
11286 Note variable and other changes it performs are not scoped as via
11287 .Ic localopts !
11290 .It Va on-program-exit
11291 This hook will be called when the program exits, whether via
11292 .Ic exit
11294 .Ic quit ,
11295 or because the send mode is done.
11296 .Sy Note:
11297 this runs late and so terminal settings etc. are already teared down.
11300 .It Va on-resend-cleanup
11301 \*(ID Identical to
11302 .Va on-compose-cleanup ,
11303 but is only triggered by
11304 .Ic resend .
11307 .It Va on-resend-enter
11308 \*(ID Identical to
11309 .Va on-compose-enter ,
11310 but is only triggered by
11311 .Ic resend ;
11312 currently there is no
11313 .Ic digmsg
11314 support, for example.
11317 .It Va page
11318 \*(BO If set, each message feed through the command given for
11319 .Ic pipe
11320 is followed by a formfeed character
11321 .Ql \ef .
11323 .Mx Va password
11324 .It Va password-USER@HOST , password-HOST , password
11325 \*(IN Variable chain that sets a password, which is used in case none has
11326 been given in the protocol and account-specific URL;
11327 as a last resort \*(UA will ask for a password on the user's terminal if
11328 the authentication method requires a password.
11329 Specifying passwords in a startup file is generally a security risk;
11330 the file should be readable by the invoking user only.
11332 .It Va password-USER@HOST
11333 \*(OU (see the chain above for \*(IN)
11334 Set the password for
11335 .Ql USER
11336 when connecting to
11337 .Ql HOST .
11338 If no such variable is defined for a host,
11339 the user will be asked for a password on standard input.
11340 Specifying passwords in a startup file is generally a security risk;
11341 the file should be readable by the invoking user only.
11344 .It Va piperaw
11345 \*(BO Send messages to the
11346 .Ic pipe
11347 command without performing MIME and character set conversions.
11350 .It Va pipe-EXTENSION
11351 Identical to
11352 .Va pipe-TYPE/SUBTYPE
11353 except that
11354 .Ql EXTENSION
11355 (normalized to lowercase using character mappings of the ASCII charset)
11356 denotes a file extension, for example
11357 .Ql xhtml .
11358 Handlers registered using this method take precedence.
11362 .It Va pipe-TYPE/SUBTYPE
11363 A MIME message part identified as
11364 .Ql TYPE/SUBTYPE
11365 (case-insensitive, normalized to lowercase using character mappings of
11366 the ASCII charset) is displayed or quoted,
11367 its text is filtered through the value of this variable interpreted as
11368 a shell command.
11369 Unless noted only parts displayable as inline plain text (see
11370 .Cd copiousoutput )
11371 are covered, other MIME parts will only be considered by and for
11372 .Ic mimeview .
11375 The special value question mark
11376 .Ql \&?
11377 forces interpretation of the message part as plain text, for example
11378 .Ql set pipe-application/xml=? .
11379 (This can also be achieved by adding a MIME type-marker via
11380 .Ic mimetype . )
11381 \*(OPally MIME type handlers may be defined via
11382 .Sx "The Mailcap files"
11383 to which should be referred to for documentation of flags like
11384 .Cd copiousoutput .
11385 Question mark is indeed a trigger character to indicate flags that
11386 adjust behaviour and usage of the rest of the value, the shell command,
11387 for example:
11389 .Bd -literal -offset indent
11390 ? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}'
11394 .Bl -tag -compact -width ".It Ql __"
11395 .It Ql *
11396 The command output can be reintegrated into this MUA's normal processing:
11397 .Cd copiousoutput .
11398 Implied when using a plain
11399 .Ql \& .
11401 .It Ql #
11402 Only use this handler for display, not for quoting a message:
11403 .Cd x-mailx-noquote .
11405 .It Ql &
11406 Run the command asynchronously, do not wait for the handler to exit:
11407 .Cd x-mailx-async .
11408 The standard output of the command will go to
11409 .Pa /dev/null .
11411 .It Ql \&!
11412 The command must be run on an interactive terminal, the terminal will
11413 temporarily be released for it to run:
11414 .Cd needsterminal .
11416 .It Ql +
11417 Request creation of a zero-sized temporary file, the absolute pathname
11418 of which will be made accessible via the environment variable
11419 .Ev MAILX_FILENAME_TEMPORARY :
11420 .Cd x-mailx-tmpfile .
11421 If given twice then the file will be unlinked automatically by \*(UA
11422 when the command loop is entered again at latest:
11423 .Cd x-mailx-tmpfile-unlink ;
11424 it is an error to use automatic deletion in conjunction with
11425 .Cd x-mailx-async .
11427 .It Ql =
11428 Normally the MIME part content is passed to the handler via standard
11429 input; with this the data will instead be written into
11430 .Ev MAILX_FILENAME_TEMPORARY
11431 .Pf ( Cd x-mailx-tmpfile-fill ) ,
11432 the creation of which is implied; in order to cause automatic deletion
11433 of the temporary file two plus signs
11434 .Ql ++
11435 still have to be used.
11437 .It Ql t
11438 Text type-marker: display this as normal plain text (for type-markers:
11439 .Sx "The mime.types files" ) .
11440 Identical to only giving plain
11441 .Ql \&? ,
11442 implies
11443 .Cd copiousoutput .
11445 .It Ql h
11446 \*(OP HTML type-marker: display via built-in HTML-to-text filter.
11447 Implies
11448 .Cd copiousoutput .
11450 .It Ql \&?
11451 To avoid ambiguities with normal shell command content another
11452 question mark can be used to forcefully terminate interpretation of
11453 remaining characters.
11454 (Any character not in this list will have the same effect.)
11458 Some information about the MIME part to be displayed is embedded into
11459 the environment of the shell command:
11462 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
11464 .It Ev MAILX_CONTENT
11465 The MIME content-type of the part, if known, the empty string otherwise.
11468 .It Ev MAILX_CONTENT_EVIDENCE
11470 .Va mime-counter-evidence
11471 includes the carry-around-bit (2), then this will be set to the detected
11472 MIME content-type; not only then identical to
11473 .Ev \&\&MAILX_CONTENT
11474 otherwise.
11477 .It Ev MAILX_EXTERNAL_BODY_URL
11478 MIME parts of type
11479 .Ql message/external-body access-type=url
11480 will store the access URL in this variable, it is empty otherwise.
11481 URL targets should not be activated automatically, without supervision.
11484 .It Ev MAILX_FILENAME
11485 The filename, if any is set, the empty string otherwise.
11488 .It Ev MAILX_FILENAME_GENERATED
11489 A random string.
11492 .It Ev MAILX_FILENAME_TEMPORARY
11493 If temporary file creation has been requested through the command prefix
11494 this variable will be set and contain the absolute pathname of the
11495 temporary file.
11499 .Mx Va pop3-auth
11500 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
11501 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
11502 Supported are the default
11503 .Ql plain ,
11504 \*(IN
11505 .Ql oauthbearer
11506 (see
11507 .Sx FAQ
11508 entry
11509 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) ,
11510 as well as \*(IN
11511 .Ql external
11513 .Ql externanon
11514 for TLS secured connections which pass a client certificate via
11515 .Va tls-config-pairs .
11516 There may be the \*(OPal method \*(IN
11517 .Ql gssapi .
11518 .Ql externanon
11519 does not need any user credentials,
11520 .Ql external
11522 .Ql gssapi
11523 need a
11524 .Va user ,
11525 the remains also require a
11526 .Va password .
11527 .Ql externanon
11528 solely builds upon the credentials passed via a client certificate,
11529 and is usually the way to go since tested servers do not actually follow
11530 RFC 4422, and fail if additional credentials are actually passed.
11531 Unless
11532 .Va pop3-no-apop
11533 is set the
11534 .Ql plain
11535 method will \*(OPally be replaced with APOP if possible (see there).
11537 .Mx Va pop3-bulk-load
11538 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
11539 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
11540 the messages, and only requests the message bodies on user request.
11541 For the POP3 protocol this means that the message headers will be
11542 downloaded twice.
11543 If this variable is set then \*(UA will download only complete messages
11544 from the given POP3 server(s) instead.
11546 .Mx Va pop3-keepalive
11547 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
11548 \*(OP POP3 servers close the connection after a period of inactivity;
11549 the standard requires this to be at least 10 minutes,
11550 but practical experience may vary.
11551 Setting this variable to a numeric value greater than
11552 .Ql 0
11553 causes a
11554 .Ql NOOP
11555 command to be sent each value seconds if no other operation is performed.
11557 .Mx Va pop3-no-apop
11558 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
11559 \*(BO\*(OP Unless this variable is set the MD5 based
11560 .Ql APOP
11561 authentication method will be used instead of a chosen
11562 .Ql plain
11563 .Va pop3-auth
11564 when connecting to a POP3 server that advertises support.
11565 The advantage of
11566 .Ql APOP
11567 is that only a single packet is sent for the user/password tuple.
11568 (Originally also that the password is not sent in clear text over the
11569 wire, but for one MD5 does not any longer offer sufficient security,
11570 and then today transport is almost ever TLS secured.)
11571 Note that
11572 .Va pop3-no-apop-HOST
11573 requires \*(IN.
11575 .Mx Va pop3-use-starttls
11576 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
11577 \*(BO\*(OP Causes \*(UA to issue a
11578 .Ql STLS
11579 command to make an unencrypted POP3 session TLS encrypted.
11580 This functionality is not supported by all servers,
11581 and is not used if the session is already encrypted by the POP3S method.
11582 Note that
11583 .Va pop3-use-starttls-HOST
11584 requires \*(IN.
11588 .It Va posix
11589 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
11590 where that deviates from standardized behaviour.
11591 It is automatically squared with the environment variable
11592 .Ev POSIXLY_CORRECT ,
11593 changing the one will adjust the other.
11594 The following behaviour is covered and enforced by this mechanism:
11597 .Bl -bullet -compact
11599 In non-interactive mode, any error encountered while loading resource
11600 files during program startup will cause a program exit, whereas in
11601 interactive mode such errors will stop loading of the currently loaded
11602 (stack of) file(s, i.e., recursively).
11603 These exits can be circumvented on a per-command base by using
11604 .Cm ignerr ,
11605 one of the
11606 .Sx "Command modifiers" ,
11607 for each command which shall be allowed to fail.
11610 .Ic alternates
11611 will replace the list of alternate addresses instead of appending to it.
11612 In addition alternates will only be honoured for any sort of message
11613 .Ic reply ,
11614 and for aliases.
11617 The variable inserting
11618 .Sx "COMMAND ESCAPES"
11619 .Ic ~A ,
11620 .Ic ~a ,
11621 .Ic ~I
11623 .Ic ~i
11624 will expand embedded character sequences
11625 .Ql \et
11626 horizontal tabulator and
11627 .Ql \en
11628 line feed.
11629 \*(ID For compatibility reasons this step will always be performed.
11632 Reading in messages via
11633 .Ic ~f
11634 .Pf ( Sx "COMMAND ESCAPES" )
11635 will use the
11636 .Ql type
11637 not the
11638 .Ql forward
11639 .Ic headerpick
11640 selection.
11643 Upon changing the active
11644 .Ic folder
11645 no summary of
11646 .Ic headers
11647 will be displayed even if
11648 .Va header
11649 is set.
11652 Setting
11653 .Va ignoreeof
11654 implies the behaviour described by
11655 .Va dot .
11658 The variable
11659 .Va keep
11660 is extended to cover any empty mailbox, not only empty
11661 .Mx -sx
11662 .Sx "primary system mailbox" Ns
11663 es: they will be removed when they are left in empty state otherwise.
11666 Each command has an exit
11667 .Va \&?
11668 and error
11669 .Va \&!
11670 status that overwrites that of the last command.
11671 In POSIX mode the program exit status will signal failure regardless
11672 unless all messages were successfully sent out to the
11673 .Va mta ;
11674 also see
11675 .Va sendwait .
11680 .It Va print-alternatives
11681 \*(BO When a MIME message part of type
11682 .Ql multipart/alternative
11683 is displayed and it contains a subpart of type
11684 .Ql text/plain ,
11685 other parts are normally discarded.
11686 Setting this variable causes all subparts to be displayed,
11687 just as if the surrounding part was of type
11688 .Ql multipart/mixed .
11691 .It Va prompt
11692 The string used as a prompt in interactive mode.
11693 Whenever the variable is evaluated the value is treated as if specified
11694 within dollar-single-quotes (see
11695 .Sx "Shell-style argument quoting" ) .
11696 This (post-assignment, i.e., second) expansion can be used to embed
11697 status information, for example
11698 .Va \&? ,
11699 .Va \&! ,
11700 .Va account
11702 .Va mailbox-display .
11704 In order to embed characters which should not be counted when
11705 calculating the visual width of the resulting string, enclose the
11706 characters of interest in a pair of reverse solidus escaped brackets:
11707 .Ql \e[\eE[0m\e] ;
11708 a slot for coloured prompts is also available with the \*(OPal command
11709 .Ic colour .
11710 Prompting may be prevented by setting this to the null string
11711 (aka\|
11712 .Ql set noprompt ) .
11715 .It Va prompt2
11716 This string is used for secondary prompts, but is otherwise identical to
11717 .Va prompt .
11718 The default is
11719 .Ql ..\0 .
11722 .It Va quiet
11723 \*(BO Suppresses the printing of the version when first invoked.
11726 .It Va quote
11727 If set messages processed by variants of
11728 .Ic followup
11730 .Ic reply
11731 will start with the original message, lines of which prefixed by
11732 .Va indentprefix ,
11733 taking into account
11734 .Va quote-chars
11736 .Va quote-fold .
11737 No headers will be quoted when set without value or for
11738 .Ql noheading ,
11740 .Ql headers
11742 .Ql type
11743 .Ic headerpick
11744 selection will be included in the quote,
11745 .Ql allbodies
11746 embeds the (body) contents of all MIME parts, and
11747 .Ql allheaders
11748 also includes all headers.
11749 The quoted message will be enclosed by the expansions of
11750 .Va quote-inject-head
11752 .Va quote-inject-tail .
11753 Also see
11754 .Va quote-add-cc ,
11755 .Va quote-as-attachment
11757 .Ic ~Q ,
11758 one of the
11759 .Sx "COMMAND ESCAPES" .
11762 .It Va quote-add-cc
11763 \*(BO Whether senders of messages quoted via
11764 .Ic ~Q
11765 shall be made members of the carbon copies
11766 .Ql Cc:
11767 list.
11770 .It Va quote-as-attachment
11771 \*(BO Add the original message in its entirety as a
11772 .Ql message/rfc822
11773 MIME attachment when replying to a message.
11774 Note this works regardless of the setting of
11775 .Va quote .
11778 .It Va quote-chars
11779 Can be set to a string consisting of non-whitespace ASCII characters
11780 which shall be treated as quotation leaders, the default being
11781 .Ql >|}: .
11784 .It Va quote-fold
11785 \*(OP Can be set in addition to
11786 .Va indentprefix ,
11787 and creates a more fancy quotation in that leading quotation characters
11788 .Pf ( Va quote-chars )
11789 are compressed and overlong lines are folded.
11790 .Va \&\&quote-fold
11791 can be set to either one, two or three (space separated) numeric values,
11792 which are interpreted as the maximum (goal) and the minimum line length,
11793 respectively, in a spirit rather equal to the
11794 .Xr fmt 1
11795 program, but line- instead of paragraph-based.
11796 The third value is used as the maximum line length instead of the first
11797 if no better break point can be found; it is ignored unless it is larger
11798 than the minimum and smaller than the maximum.
11799 If not set explicitly the minimum will reflect the goal algorithmically.
11800 The goal cannot be smaller than the length of
11801 .Va indentprefix
11802 plus some additional pad; necessary adjustments take place silently.
11807 .It Va quote-inject-head , quote-inject-tail
11808 The strings to put before and after the text of a
11809 .Va quote Ns
11810 d message, if non-empty, and respectively.
11811 The former defaults to
11812 .Ql %f wrote:\en\en .
11813 Special format directives will be expanded if possible, and if so
11814 configured the output will be folded according to
11815 .Va quote-fold .
11816 Format specifiers in the given strings start with a percent sign
11817 .Ql %
11818 and expand values of the original message, unless noted otherwise.
11819 Note that names and addresses are not subject to the setting of
11820 .Va showto .
11821 Valid format specifiers are:
11824 .Bl -tag -compact -width ".It Ql _%%_"
11825 .It Ql %%
11826 A plain percent sign.
11827 .It Ql %a
11828 The address(es) of the sender(s).
11829 .It Ql %d
11830 The date found in the
11831 .Ql Date:
11832 header of the message when
11833 .Va datefield
11834 is set (the default), otherwise the date when the message was received.
11835 Formatting can be controlled by assigning a
11836 .Xr strftime 3
11837 format string to
11838 .Va datefield
11839 (and
11840 .Va datefield-markout-older ) .
11841 .It Ql %f
11842 The full name(s) (name and address, as given) of the sender(s).
11843 .It Ql %i
11845 .Ql Message-ID: .
11846 .It Ql %n
11847 The real name(s) of the sender(s) if there is one and
11848 .Va showname
11849 allows usage, the address(es) otherwise.
11850 .It Ql %r
11851 The senders real name(s) if there is one, the address(es) otherwise.
11856 .It Va r-option-implicit
11857 \*(BO Setting this option evaluates the contents of
11858 .Va from
11859 (or, if that contains multiple addresses,
11860 .Va sender )
11861 and passes the results onto the used (file-based) MTA as described for the
11862 .Fl r
11863 option (empty argument case).
11866 .It Va recipients-in-cc
11867 \*(BO When doing a
11868 .Ic reply ,
11869 the original
11870 .Ql From:
11872 .Ql To:
11873 as well as addressees which possibly came in via
11874 .Ql Reply-To:
11876 .Ql Mail-Followup-To:
11877 are by default merged into the new
11878 .Ql To: .
11879 If this variable is set a sensitive algorithm tries to place in
11880 .Ql To:
11881 only the sender of the message being replied to, others are placed in
11882 .Ql Cc: .
11885 .It Va record
11886 Unless this variable is defined, no copies of outgoing mail will be saved.
11887 If defined it gives the pathname, subject to the usual
11888 .Sx "Filename transformations" ,
11889 of a folder where all new, replied-to or forwarded messages are saved:
11890 when saving to this folder fails the message is not sent, but instead
11891 .Va save Ns
11892 d to
11893 .Ev DEAD .
11894 The standard defines that relative (fully expanded) paths are to be
11895 interpreted relative to the current directory
11896 .Pf ( Ic cwd ) ,
11897 to force interpretation relative to
11898 .Va folder
11899 .Va outfolder
11900 needs to be set in addition.
11903 .It Va record-files
11904 \*(BO If this variable is set the meaning of
11905 .Va record
11906 will be extended to cover messages which target only file and pipe
11907 recipients (see
11908 .Va expandaddr ) .
11909 These address types will not appear in recipient lists unless
11910 .Va add-file-recipients
11911 is also set.
11914 .It Va record-resent
11915 \*(BO If this variable is set the meaning of
11916 .Va record
11917 will be extended to also cover the
11918 .Ic resend
11920 .Ic Resend
11921 commands.
11924 .It Va reply-in-same-charset
11925 \*(BO If this variable is set \*(UA first tries to use the same
11926 character set of the original message for replies.
11927 If this fails, the mechanism described in
11928 .Sx "Character sets"
11929 is evaluated as usual.
11932 .It Va reply-strings
11933 Can be set to a comma-separated list of (case-insensitive according to
11934 ASCII rules) strings which shall be recognized in addition to the
11935 built-in strings as
11936 .Ql Subject:
11937 reply message indicators \(en built-in are
11938 .Ql Re: ,
11939 which is mandated by RFC 5322, as well as the german
11940 .Ql Aw: ,
11941 .Ql Antw: ,
11942 and the
11943 .Ql Wg:
11944 which often has been seen in the wild;
11945 I.e., the separating colon has to be specified explicitly.
11948 .It Va reply-to
11949 A list of addresses to put into the
11950 .Ql Reply-To:
11951 field of the message header.
11952 Members of this list are handled as if they were in the
11953 .Ic alternates
11954 list.
11956 .It Va replyto
11957 \*(OB Variant of
11958 .Va reply-to .
11961 .It Va reply-to-honour
11962 Controls whether a
11963 .Ql Reply-To:
11964 header is honoured when replying to a message via
11965 .Ic reply
11967 .Ic Lreply .
11968 This is a
11969 .Mx -sx
11970 .Sx quadoption ;
11971 if set without a value it defaults to
11972 .Dq yes .
11975 .It Va reply-to-swap-in
11976 Standards like DKIM and (in conjunction with) DMARC caused many
11977 .Sx "Mailing lists"
11978 to use sender address rewriting in the style of
11979 .Ql Name via List <list@address> ,
11980 where the original sender address often being placed in
11981 .Ql Reply-To: .
11982 If this is set and a
11983 .Ql Reply-To:
11984 exists, and consists of only one addressee (!), then that is used in
11985 place of the pretended sender.
11986 This works independently from
11987 .Va reply-to-honour .
11988 The optional value, a comma-separated list of strings, offers more
11989 fine-grained control on when swapping shall be used; for now supported is
11990 .Va mlist ,
11991 here swapping occurs if the sender is a mailing-list as defined by
11992 .Ic mlist .
11995 .It Va rfc822-body-from_
11996 \*(BO This variable can be used to force displaying a so-called
11997 .Ql From_
11998 line for messages that are embedded into an envelope mail via the
11999 .Ql message/rfc822
12000 MIME mechanism, for more visual convenience, also see
12001 .Va mbox-rfc4155 .
12004 .It Va save
12005 \*(BO Enable saving of (partial) messages in
12006 .Ev DEAD
12007 upon interrupt or delivery error.
12010 .It Va screen
12011 The number of lines that represents a
12012 .Dq screenful
12013 of lines, used in
12014 .Ic headers
12015 summary display,
12016 .Ic from
12017 .Ic search Ns
12018 ing, message
12019 .Ic top Ns
12020 line display and scrolling via
12021 .Ic z .
12022 If this variable is not set \*(UA falls back to a calculation based upon
12023 the detected terminal window size and the baud rate: the faster the
12024 terminal, the more will be shown.
12025 Overall screen dimensions and pager usage is influenced by the
12026 environment variables
12027 .Ev COLUMNS
12029 .Ev LINES
12030 and the variable
12031 .Va crt .
12034 .It Va searchheaders
12035 \*(BO Expand message list specifiers in the form
12036 .Ql /x:y
12037 to all messages containing the substring
12038 .Dq y
12039 in the header field
12040 .Ql x .
12041 The string search is case insensitive.
12044 .It Va sendcharsets
12045 \*(OP A comma-separated list of character set names that can be used in
12046 outgoing internet mail.
12047 The value of the variable
12048 .Va charset-8bit
12049 is automatically appended to this list of character sets.
12050 If no character set conversion capabilities are compiled into \*(UA then
12051 the only supported charset is
12052 .Va ttycharset .
12053 Also see
12054 .Va sendcharsets-else-ttycharset
12055 and refer to the section
12056 .Sx "Character sets"
12057 for the complete picture of character set conversion in \*(UA.
12060 .It Va sendcharsets-else-ttycharset
12061 \*(BO\*(OP If this variable is set, but
12062 .Va sendcharsets
12063 is not, then \*(UA acts as if
12064 .Va sendcharsets
12065 had been set to the value of the variable
12066 .Va ttycharset .
12067 In effect this combination passes through the message data in the
12068 character set of the current locale encoding:
12069 therefore mail message text will be (assumed to be) in ISO-8859-1
12070 encoding when send from within a ISO-8859-1 locale, and in UTF-8
12071 encoding when send from within an UTF-8 locale.
12073 The 8-bit fallback
12074 .Va charset-8bit
12075 never comes into play as
12076 .Va ttycharset
12077 is implicitly assumed to be 8-bit and capable to represent all files the
12078 user may specify (as is the case when no character set conversion
12079 support is available in \*(UA and the only supported character set is
12080 .Va ttycharset ,
12082 .Sx "Character sets" ) .
12083 This might be a problem for scripts which use the suggested
12084 .Ql LC_ALL=C
12085 setting, since in this case the character set is US-ASCII by definition,
12086 so that it is better to also override
12087 .Va ttycharset ,
12088 then; and/or do something like the following in the resource file:
12089 .Bd -literal -offset indent
12090 # Avoid ASCII "propagates to 8-bit" when scripting
12091 \eif ! t && "$LC_ALL" != C && "$LC_CTYPE" != C
12092   \eset sendcharsets-else-ttycharset
12093 \eend
12097 .It Va sender
12098 An address that is put into the
12099 .Ql Sender:
12100 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
12101 responsible for the actual transmission of the message.
12102 This field should normally not be used unless the
12103 .Va from
12104 field contains more than one address, on which case it is required.
12105 \*(ID Please expect automatic management of the
12106 .Va from
12108 .Va sender
12109 relationship.
12110 Dependent on the context this address is handled as if it were in
12111 the list of
12112 .Ic alternates .
12113 Also see
12114 .Fl r ,
12115 .Va r-option-implicit .
12117 .It Va sendmail
12118 \*(OB Predecessor of
12119 .Va mta .
12121 .It Va sendmail-arguments
12122 \*(OB Predecessor of
12123 .Va mta-arguments .
12125 .It Va sendmail-no-default-arguments
12126 \*(OB\*(BO Predecessor of
12127 .Va mta-no-default-arguments .
12129 .It Va sendmail-progname
12130 \*(OB Predecessor of
12131 .Va mta-argv0 .
12134 .It Va sendwait
12135 Sending messages to the chosen
12136 .Va mta
12137 or to command-pipe receivers (see
12138 .Sx "On sending mail, and non-interactive mode" )
12139 will be performed asynchronously.
12140 This means that only startup errors of the respective program will be
12141 recognizable, but no delivery errors.
12142 Also, no guarantees can be made as to when the respective program will
12143 actually run, as well as to when they will have produced output.
12145 If this variable is set then child program exit is waited for, and its
12146 exit status code is used to decide about success.
12147 Remarks: in conflict with the POSIX standard this variable is built-in
12148 to be initially set.
12149 Another difference is that it can have a value, which is interpreted as
12150 a comma-separated list of case-insensitive strings naming specific
12151 subsystems for which synchronousness shall be ensured (only).
12152 Possible values are
12153 .Ql mta
12155 .Va mta
12156 delivery, and
12157 .Ql pcc
12158 for command-pipe receivers.
12161 .It Va showlast
12162 \*(BO This setting causes \*(UA to start at the last message
12163 instead of the first one when opening a mail folder, as well as with
12164 .Ic from
12166 .Ic headers .
12169 .It Va showname
12170 \*(BO Causes \*(UA to use the sender's real name instead of the plain
12171 address in the header field summary and in message specifications.
12174 .It Va showto
12175 \*(BO Causes the recipient of the message to be shown in the header
12176 summary if the message was sent by the user.
12179 .It Va Sign
12180 The value backing
12181 .Ic ~A ,
12182 one of the
12183 .Sx "COMMAND ESCAPES" .
12184 Also see
12185 .Va message-inject-tail ,
12186 .Va on-compose-leave
12188 .Va on-compose-splice .
12191 .It Va sign
12192 The value backing
12193 .Ic ~a ,
12194 one of the
12195 .Sx "COMMAND ESCAPES" .
12196 Also see
12197 .Va message-inject-tail ,
12198 .Va on-compose-leave
12200 .Va on-compose-splice .
12203 .It Va signature
12204 \*(OB Please use
12205 .Va on-compose-splice
12207 .Va on-compose-splice-shell
12209 .Va on-compose-leave
12210 and (if necessary)
12211 .Va message-inject-tail
12212 instead!
12215 .It Va skipemptybody
12216 \*(BO If an outgoing message has an empty first or only message part, do
12217 not send, but discard it, successfully (also see the command line option
12218 .Fl E ) .
12222 .It Va smime-ca-dir , smime-ca-file
12223 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
12224 Enhanced Mail) for the purpose of verification of S/MIME signed messages.
12225 .Va tls-ca-dir
12226 documents the necessary preparation steps to use the former.
12227 The set of CA certificates which are built into the TLS library can
12228 be explicitly turned off by setting
12229 .Va smime-ca-no-defaults ,
12230 and further fine-tuning is possible via
12231 .Va smime-ca-flags .
12234 .It Va smime-ca-flags
12235 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
12236 storage, and the certificate verification that is used.
12237 The actual values and their meanings are documented for
12238 .Va tls-ca-flags .
12241 .It Va smime-ca-no-defaults
12242 \*(BO\*(OP Do not load the default CA locations that are built into the
12243 used to TLS library to verify S/MIME signed messages.
12245 .Mx Va smime-cipher
12246 .It Va smime-cipher-USER@HOST , smime-cipher
12247 \*(OP Specifies the cipher to use when generating S/MIME encrypted
12248 messages (for the specified account).
12249 RFC 5751 mandates a default of
12250 .Ql aes128
12251 (AES-128 CBC).
12252 Possible values are (case-insensitive and) in decreasing cipher strength:
12253 .Ql aes256
12254 (AES-256 CBC),
12255 .Ql aes192
12256 (AES-192 CBC),
12257 .Ql aes128
12258 (AES-128 CBC),
12259 .Ql des3
12260 (DES EDE3 CBC, 168 bits; default if
12261 .Ql aes128
12262 is not available) and
12263 .Ql des
12264 (DES CBC, 56 bits).
12266 The actually available cipher algorithms depend on the cryptographic
12267 library that \*(UA uses.
12268 \*(OP Support for more cipher algorithms may be available through
12269 dynamic loading via
12270 .Xr EVP_get_cipherbyname 3
12271 (OpenSSL) if \*(UA has been compiled to support this.
12274 .It Va smime-crl-dir
12275 \*(OP Specifies a directory that contains files with CRLs in PEM format
12276 to use when verifying S/MIME messages.
12279 .It Va smime-crl-file
12280 \*(OP Specifies a file that contains a CRL in PEM format to use when
12281 verifying S/MIME messages.
12284 .It Va smime-encrypt-USER@HOST
12285 \*(OP If this variable is set, messages send to the given receiver are
12286 encrypted before sending.
12287 The value of the variable must be set to the name of a file that
12288 contains a certificate in PEM format.
12290 If a message is sent to multiple recipients,
12291 each of them for whom a corresponding variable is set will receive an
12292 individually encrypted message;
12293 other recipients will continue to receive the message in plain text
12294 unless the
12295 .Va smime-force-encryption
12296 variable is set.
12297 It is recommended to sign encrypted messages, i.e., to also set the
12298 .Va smime-sign
12299 variable.
12300 .Va content-description-smime-message
12301 will be inspected for messages which become encrypted.
12304 .It Va smime-force-encryption
12305 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
12308 .It Va smime-sign
12309 \*(BO\*(OP S/MIME sign outgoing messages with the user's
12310 .Pf ( Va from )
12311 private key and include the users certificate as a MIME attachment.
12312 Signing a message enables a recipient to verify that the sender used
12313 a valid certificate,
12314 that the email addresses in the certificate match those in the message
12315 header and that the message content has not been altered.
12316 It does not change the message text,
12317 and people will be able to read the message as usual.
12318 .Va content-description-smime-signature
12319 will be inspected.
12320 Also see
12321 .Va smime-sign-cert , smime-sign-include-certs
12323 .Va smime-sign-digest .
12325 .Mx Va smime-sign-cert
12326 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
12327 \*(OP Points to a file in PEM format.
12328 For the purpose of signing and decryption this file needs to contain the
12329 user's private key, followed by his certificate.
12331 For message signing
12332 .Ql USER@HOST
12333 is always derived from the value of
12334 .Va from
12335 (or, if that contains multiple addresses,
12336 .Va sender ) .
12337 For the purpose of encryption the recipients public encryption key
12338 (certificate) is expected; the command
12339 .Ic certsave
12340 can be used to save certificates of signed messages (the section
12341 .Sx "Signed and encrypted messages with S/MIME"
12342 gives some details).
12343 This mode of operation is usually driven by the specialized form.
12345 When decrypting messages the account is derived from the recipient
12346 fields
12347 .Pf ( Ql To:
12349 .Ql Cc: )
12350 of the message, which are searched for addresses for which such
12351 a variable is set.
12352 \*(UA always uses the first address that matches,
12353 so if the same message is sent to more than one of the user addresses
12354 using different encryption keys, decryption might fail.
12356 Password-encrypted keys may be used for signing and decryption.
12357 Automated password lookup is possible via the
12358 .Dq pseudo-hosts
12359 .Ql USER@HOST.smime-cert-key
12360 for the private key, and
12361 .Ql USER@HOST.smime-cert-cert
12362 for the certificate stored in the same file.
12363 For example, the hypothetical address
12364 .Ql bob@exam.ple
12365 could be driven with a private key / certificate pair path defined in
12366 .Va \&\&smime-sign-cert-bob@exam.ple ,
12367 and the needed passwords would then be looked up as
12368 .Ql bob@exam.ple.smime-cert-key
12370 .Ql bob@exam.ple.smime-cert-cert .
12371 When decrypting the value of
12372 .Va from
12373 will be tried as a fallback to provide the necessary
12374 .Ql USER@HOST .
12375 To include intermediate certificates, use
12376 .Va smime-sign-include-certs .
12377 The possible password sources are documented in
12378 .Sx "On URL syntax and credential lookup" .
12380 .Mx Va smime-sign-digest
12381 .It Va smime-sign-digest-USER@HOST , smime-sign-digest
12382 \*(OP Specifies the message digest to use when signing S/MIME messages.
12383 Please remember that for this use case
12384 .Ql USER@HOST
12385 refers to the variable
12386 .Va from
12387 (or, if that contains multiple addresses,
12388 .Va sender ) .
12389 The available algorithms depend on the used cryptographic library, but
12390 at least one usable built-in algorithm is ensured as a default.
12391 If possible the standard RFC 5751 will be violated by using
12392 .Ql SHA512
12393 instead of the mandated
12394 .Ql SHA1
12395 due to security concerns.
12396 This variable is ignored for very old (released before 2010)
12397 cryptographic libraries which do not offer the necessary interface:
12398 it will be logged if that happened.
12400 \*(UA will try to add built-in support for the following message
12401 digests, names are case-insensitive:
12402 .Ql BLAKE2b512 ,
12403 .Ql BLAKE2s256 ,
12404 .Ql SHA3-512 ,
12405 .Ql SHA3-384 ,
12406 .Ql SHA3-256 ,
12407 .Ql SHA3-224 ,
12408 as well as the widely available
12409 .Ql SHA512 ,
12410 .Ql SHA384 ,
12411 .Ql SHA256 ,
12412 .Ql SHA224 ,
12413 and the proposed insecure
12414 .Ql SHA1 ,
12415 finally
12416 .Ql MD5 .
12417 More digests may \*(OPally be available through dynamic loading via the
12418 OpenSSL function
12419 .Xr EVP_get_digestbyname 3 .
12421 .Mx Va smime-sign-include-certs
12422 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
12423 \*(OP If used, this is supposed to a consist of a comma-separated list
12424 of files, each of which containing a single certificate in PEM format to
12425 be included in the S/MIME message in addition to the
12426 .Va smime-sign-cert
12427 certificate.
12428 This can be used to include intermediate certificates of the certificate
12429 authority, in order to allow the receiver's S/MIME implementation to
12430 perform a verification of the entire certificate chain, starting from
12431 a local root certificate, over the intermediate certificates, down to the
12432 .Va smime-sign-cert .
12433 Even though top level certificates may also be included in the chain,
12434 they will not be used for the verification on the receiver's side.
12436 For the purpose of the mechanisms involved here,
12437 .Ql USER@HOST
12438 refers to the content of the internal variable
12439 .Va from
12440 (or, if that contains multiple addresses,
12441 .Va sender ) .
12442 The pseudo-host
12443 .Ql USER@HOST.smime-include-certs
12444 will be used for performing password lookups for these certificates,
12445 shall they have been given one, therefore the lookup can be automated
12446 via the mechanisms described in
12447 .Sx "On URL syntax and credential lookup" .
12449 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
12450 \*(OB\*(OP Predecessor(s) of
12451 .Va smime-sign-digest .
12453 .It Va smtp
12454 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
12455 .Va mta .
12456 \*(ID For compatibility reasons a set
12457 .Va smtp
12458 is used in preference of
12459 .Va mta .
12461 .Mx Va smtp-auth
12462 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
12463 \*(OP Variable chain that controls the SMTP
12464 .Va mta
12465 authentication method, possible values are
12466 .Ql none
12467 (\*(OU default),
12468 .Ql plain
12469 (\*(IN default),
12470 .Ql login ,
12471 \*(IN
12472 .Ql oauthbearer
12473 (see
12474 .Sx FAQ
12475 entry
12476 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" )
12477 as well as \*(IN
12478 .Ql external
12480 .Ql externanon
12481 for TLS secured connections which pass a client certificate via
12482 .Va tls-config-pairs .
12483 There may be the \*(OPal methods
12484 .Ql cram-md5
12486 .Ql gssapi .
12487 .Ql none
12489 .Ql externanon
12490 do not need any user credentials,
12491 .Ql external
12493 .Ql gssapi
12494 require a user name, and all other methods require a
12495 .Va user
12496 name and a
12497 .Va password .
12498 .Ql externanon
12499 solely builds upon the credentials passed via a client certificate,
12500 and is usually the way to go since tested servers do not actually follow
12501 RFC 4422 aka RFC 4954, and fail if additional credentials are passed.
12502 Also see
12503 .Va mta .
12504 Note that
12505 .Va smtp-auth-HOST
12506 is \*(IN.
12507 (\*(OU Requires
12508 .Va smtp-auth-password
12510 .Va smtp-auth-user .
12511 Note for
12512 .Va smtp-auth-USER@HOST :
12513 may override dependent on sender address in the variable
12514 .Va from . )
12516 .It Va smtp-auth-password
12517 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
12518 If the authentication method requires a password, but neither
12519 .Va smtp-auth-password
12520 nor a matching
12521 .Va smtp-auth-password-USER@HOST
12522 can be found,
12523 \*(UA will ask for a password on the user's terminal.
12525 .It Va smtp-auth-password-USER@HOST
12526 \*(OU Overrides
12527 .Va smtp-auth-password
12528 for specific values of sender addresses, dependent upon the variable
12529 .Va from .
12531 .It Va smtp-auth-user
12532 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
12533 If the authentication method requires a user name, but neither
12534 .Va smtp-auth-user
12535 nor a matching
12536 .Va smtp-auth-user-USER@HOST
12537 can be found,
12538 \*(UA will ask for a user name on the user's terminal.
12540 .It Va smtp-auth-user-USER@HOST
12541 \*(OU Overrides
12542 .Va smtp-auth-user
12543 for specific values of sender addresses, dependent upon the variable
12544 .Va from .
12547 .It Va smtp-hostname
12548 \*(OP\*(IN Normally \*(UA uses the variable
12549 .Va from
12550 to derive the necessary
12551 .Ql USER@HOST
12552 information in order to issue a
12553 .Ql MAIL FROM:<>
12554 SMTP
12555 .Va mta
12556 command.
12557 Setting
12558 .Va smtp-hostname
12559 can be used to use the
12560 .Ql USER
12561 from the SMTP account
12562 .Pf ( Va mta
12563 or the
12564 .Va user
12565 variable chain)
12566 and the given
12567 .Ql HOST
12568 .Pf ( Va hostname
12569 if the empty string is given, or the local hostname as a last resort).
12570 This often allows using an address that is itself valid but hosted by
12571 a provider other than from which (in
12572 .Va from )
12573 the message is sent.
12574 Setting this variable also influences generated
12575 .Ql Message-ID:
12577 .Ql Content-ID:
12578 header fields.
12579 If the \*(OPal IDNA support is available (see
12580 .Va idna-disable )
12581 variable assignment is aborted when a necessary conversion fails.
12583 .Mx Va smtp-use-starttls
12584 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
12585 \*(BO\*(OP Causes \*(UA to issue a
12586 .Ql STARTTLS
12587 command to make an SMTP
12588 .Va mta
12589 session TLS encrypted, i.e., to enable transport layer security.
12592 .It Va socket-connect-timeout
12593 \*(OP A positive number that defines the timeout to wait for
12594 establishing a socket connection before forcing
12595 .Va ^ERR Ns -TIMEDOUT .
12597 .Mx Va socks-proxy
12598 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
12599 \*(OP If set to the URL of a SOCKS5 server then all network activities
12600 are proxied through it, except for the single DNS name lookup necessary
12601 to resolve the proxy URL (unnecessary when given an already resolved IP
12602 address).
12603 It is automatically squared with the environment variable
12604 .Ev SOCKS5_PROXY ,
12605 changing the one will adjust the other.
12606 This example creates a local SOCKS5 proxy on port 10000 that forwards to
12607 the machine
12608 .Ql HOST
12609 (with identity
12610 .Ql USER ) ,
12611 and from which actual network traffic happens:
12612 .Bd -literal -offset indent
12613 $ ssh -D 10000 USER@HOST
12614 $ \*(uA -Ssocks-proxy=[socks5://]localhost:10000
12615 # or =localhost:10000; no local DNS: =127.0.0.1:10000
12619 .It Va spam-interface
12620 \*(OP In order to use any of the spam-related commands (like
12621 .Ic spamrate )
12622 the desired spam interface must be defined by setting this variable.
12623 Please refer to the manual section
12624 .Sx "Handling spam"
12625 for the complete picture of spam handling in \*(UA.
12626 All or none of the following interfaces may be available:
12628 .Bl -tag -width ".It Ql _ilte_"
12629 .It Ql spamc
12630 Interaction with
12631 .Xr spamc 1
12632 from the
12633 .Xr spamassassin 1
12634 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
12635 suite.
12636 Different to the generic filter interface \*(UA will automatically add
12637 the correct arguments for a given command and has the necessary
12638 knowledge to parse the program's output.
12639 A default value for
12640 .Va spamc-command
12641 will have been compiled into the \*(UA binary if
12642 .Xr spamc 1
12643 has been found in
12644 .Ev PATH
12645 during compilation.
12646 Shall it be necessary to define a specific connection type (rather than
12647 using a configuration file for that), the variable
12648 .Va spamc-arguments
12649 can be used as in for example
12650 .Ql -d server.example.com -p 783 .
12651 It is also possible to specify a per-user configuration via
12652 .Va spamc-user .
12653 Note that this interface does not inspect the
12654 .Ql is-spam
12655 flag of a message for the command
12656 .Ic spamforget .
12658 .It Ql filter
12659 generic spam filter support via freely configurable hooks.
12660 This interface is meant for programs like
12661 .Xr bogofilter 1
12662 and requires according behaviour in respect to the hooks' exit
12663 status for at least the command
12664 .Ic spamrate
12665 .Pf ( Ql 0
12666 meaning a message is spam,
12667 .Ql 1
12668 for non-spam,
12669 .Ql 2
12670 for unsure and any other return value indicating a hard error);
12671 since the hooks can include shell code snippets diverting behaviour
12672 can be intercepted as necessary.
12673 The hooks are
12674 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
12675   spamfilter-rate
12677 .Va spamfilter-spam ;
12678 the manual section
12679 .Sx "Handling spam"
12680 contains examples for some programs.
12681 The process environment of the hooks will have the variable
12682 .Ev MAILX_FILENAME_GENERATED
12683 set.
12684 Note that spam score support for
12685 .Ic spamrate
12686 is not supported unless the \*(OPtional regular expression support is
12687 available and the
12688 .Va spamfilter-rate-scanscore
12689 variable is set.
12694 .It Va spam-maxsize
12695 \*(OP Messages that exceed this size will not be passed through to the
12696 configured
12697 .Va spam-interface .
12698 If unset or 0, the default of 420000 bytes is used.
12701 .It Va spamc-command
12702 \*(OP The path to the
12703 .Xr spamc 1
12704 program for the
12705 .Ql spamc
12706 .Va spam-interface .
12707 Note that the path is not expanded, but used
12708 .Dq as is .
12709 A fallback path will have been compiled into the \*(UA binary if the
12710 executable had been found during compilation.
12713 .It Va spamc-arguments
12714 \*(OP Even though \*(UA deals with most arguments for the
12715 .Ql spamc
12716 .Va spam-interface
12717 automatically, it may at least sometimes be desirable to specify
12718 connection-related ones via this variable, for example
12719 .Ql -d server.example.com -p 783 .
12722 .It Va spamc-user
12723 \*(OP Specify a username for per-user configuration files for the
12724 .Ql spamc
12725 .Va spam-interface .
12726 If this is set to the empty string then \*(UA will use the name of the
12727 current
12728 .Va user .
12735 .It Va spamfilter-ham , spamfilter-noham , \
12736   spamfilter-nospam , spamfilter-rate , spamfilter-spam
12737 \*(OP Command and argument hooks for the
12738 .Ql filter
12739 .Va spam-interface .
12740 The manual section
12741 .Sx "Handling spam"
12742 contains examples for some programs.
12745 .It Va spamfilter-rate-scanscore
12746 \*(OP Because of the generic nature of the
12747 .Ql filter
12748 .Va spam-interface
12749 spam scores are not supported for it by default, but if the \*(OPnal
12750 regular expression support is available then setting this variable can
12751 be used to overcome this restriction.
12752 It is interpreted as follows: first a number (digits) is parsed that
12753 must be followed by a semicolon
12754 .Ql \&;
12755 and an extended regular expression.
12756 Then the latter is used to parse the first output line of the
12757 .Va spamfilter-rate
12758 hook, and, in case the evaluation is successful, the group that has been
12759 specified via the number is interpreted as a floating point scan score.
12761 .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\
12762   ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file
12763 \*(OB\*(OP Predecessors of
12764 .Va tls-ca-file ,
12765 .Va tls-ca-dir .
12767 .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags
12768 \*(OB\*(OP Predecessor of
12769 .Va tls-ca-flags .
12771 .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\
12772   ssl-ca-no-defaults
12773 \*(OB\*(BO\*(OP Predecessor of
12774 .Va tls-ca-no-defaults .
12776 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
12777 \*(OB\*(OP Please use the
12778 .Cd Certificate
12779 slot of
12780 .Va tls-config-pairs .
12782 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
12783 \*(OB\*(OP Please use the
12784 .Cd CipherString
12785 slot of
12786 .Va tls-config-pairs .
12788 .It Va ssl-config-file
12789 \*(OB\*(OP Predecessor of
12790 .Va tls-config-file .
12792 .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\
12793   ssl-config-module
12794 \*(OB\*(OP Predecessor of
12795 .Va tls-config-module .
12797 .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs
12798 \*(OB\*(OP Predecessor of
12799 .Va tls-config-pairs .
12801 .It Va ssl-crl-dir , ssl-crl-file
12802 \*(OB\*(OP Predecessors of
12803 .Va tls-crl-dir ,
12804 .Va tls-crl-file .
12806 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
12807 \*(OB\*(OP Please use the
12808 .Cd Curves
12809 slot of
12810 .Va tls-config-pairs .
12812 .It Va ssl-features
12813 \*(OB\*(OP\*(RO Predecessor of
12814 .Va tls-features .
12816 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
12817 \*(OB\*(OP Please use the
12818 .Cd PrivateKey
12819 slot of
12820 .Va tls-config-pairs .
12822 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
12823 \*(OB\*(OP Please use the
12824 .Cd Protocol
12825 slot of
12826 .Va tls-config-pairs .
12828 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
12829 \*(OB\*(OP Please use the
12830 .Cd Protocol
12831 slot of
12832 .Va tls-config-pairs .
12834 .It Va ssl-rand-file
12835 \*(OB\*(OP Predecessor of
12836 .Va tls-rand-file .
12838 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
12839 \*(OB\*(OP Predecessor of
12840 .Va tls-verify .
12843 .It Va stealthmua
12844 If only set without an assigned value, then this setting inhibits the
12845 generation of the
12846 .Ql Message-ID: ,
12847 .Ql Content-ID:
12849 .Ql User-Agent:
12850 header fields that include obvious references to \*(UA.
12851 There are two pitfalls associated with this:
12852 First, the message id of outgoing messages is not known anymore.
12853 Second, an expert may still use the remaining information in the header
12854 to track down the originating mail user agent.
12855 If set to the value
12856 .Ql noagent ,
12857 then the mentioned
12858 .Ql Message-ID:
12860 .Ql Content-ID:
12861 suppression does not occur.
12864 .It Va system-mailrc
12865 \*(RO The compiled in path of the system wide initialization file
12866 one of the
12867 .Sx "Resource files" :
12868 .Pa \*(UR .
12872 .It Va termcap
12873 (\*(OP) This specifies a comma-separated list of
12874 .Lb libterminfo
12875 and/or
12876 .Lb libtermcap
12877 capabilities (see
12878 .Sx "On terminal control and line editor" ,
12879 escape commas with reverse solidus
12880 .Ql \e )
12881 to be used to overwrite or define entries.
12882 .Sy Note
12883 this variable will only be queried once at program startup and can
12884 thus only be specified in resource files or on the command line.
12885 It will always be inspected, regardless of whether
12886 .Va features
12887 denotes termcap/terminfo library support via
12888 .Ql ,+termcap, .
12891 String capabilities form
12892 .Ql cap=value
12893 pairs and are expected unless noted otherwise.
12894 Numerics have to be notated as
12895 .Ql cap#number
12896 where the number is expected in normal decimal notation.
12897 Finally, booleans do not have any value but indicate a true or false
12898 state simply by being defined or not; this indeed means that \*(UA
12899 does not support undefining an existing boolean.
12900 String capability values will undergo some expansions before use:
12901 for one notations like
12902 .Ql ^LETTER
12903 stand for
12904 .Ql control-LETTER ,
12905 and for clarification purposes
12906 .Ql \eE
12907 can be used to specify
12908 .Ql escape
12909 (the control notation
12910 .Ql ^[
12911 could lead to misreadings when a left bracket follows, which it does for
12912 the standard CSI sequence);
12913 finally three letter octal sequences, as in
12914 .Ql \e061 ,
12915 are supported.
12916 To specify that a terminal supports 256-colours, and to define sequences
12917 that home the cursor and produce an audible bell, one might write:
12919 .Bd -literal -offset indent
12920 ? set termcap='Co#256,home=\eE[H,bel=^G'
12924 The following terminal capabilities are or may be meaningful for the
12925 operation of the built-in line editor or \*(UA in general:
12928 .Bl -tag -compact -width ".It Cd yay"
12929 .It Cd am
12930 .Cd auto_right_margin :
12931 boolean which indicates if the right margin needs special treatment; the
12932 .Cd xenl
12933 capability is related, for more see
12934 .Ev COLUMNS .
12935 This capability is only used when backed by library support.
12937 .It Cd clear Ns \0or Cd cl
12938 .Cd clear_screen :
12939 clear the screen and home cursor.
12940 (Will be simulated via
12941 .Cd ho
12942 plus
12943 .Cd cd . )
12945 .\" mx_HAVE_COLOUR
12946 .It Cd colors Ns \0or Cd Co
12947 .Cd max_colors :
12948 numeric capability specifying the maximum number of colours.
12949 Note that \*(UA does not actually care about the terminal beside that,
12950 but always emits ANSI / ISO 6429 escape sequences; also see
12951 .Ic colour .
12953 .It Cd cr
12954 .Cd carriage_return :
12955 move to the first column in the current row.
12956 The default built-in fallback is
12957 .Ql \er .
12959 .It Cd cub1 Ns \0or Cd le
12960 .Cd cursor_left :
12961 move the cursor left one space (non-destructively).
12962 The default built-in fallback is
12963 .Ql \eb .
12965 .It Cd cuf1 Ns \0or Cd nd
12966 .Cd cursor_right :
12967 move the cursor right one space (non-destructively).
12968 The default built-in fallback is
12969 .Ql \eE[C ,
12970 which is used by most terminals.
12971 Less often occur
12972 .Ql \eEC
12974 .Ql \eEOC .
12976 .It Cd ed Ns \0or Cd cd
12977 .Cd clr_eos :
12978 clear the screen.
12980 .\" mx_HAVE_MLE
12981 .It Cd el Ns \0or Cd ce
12982 .Cd clr_eol :
12983 clear to the end of line.
12984 (Will be simulated via
12985 .Cd ch
12986 plus repetitions of space characters.)
12988 .It Cd home Ns \0or Cd ho
12989 .Cd cursor_home :
12990 home cursor.
12992 .It Cd hpa Ns \0or Cd ch
12993 .Cd column_address :
12994 move the cursor (to the given column parameter) in the current row.
12995 (Will be simulated via
12996 .Cd cr
12997 plus
12998 .Cd nd . )
13000 .\" mx_HAVE_TERMCAP
13001 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
13002 .Cd exit_ca_mode
13004 .Cd enter_ca_mode ,
13005 respectively: exit and enter the alternative screen ca-mode,
13006 effectively turning \*(UA into a fullscreen application.
13007 This must be enabled explicitly by setting
13008 .Va termcap-ca-mode .
13010 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
13011 .Cd keypad_xmit
13013 .Cd keypad_local ,
13014 respectively: enable and disable the keypad.
13015 This is always enabled if available, because it seems even keyboards
13016 without keypads generate other key codes for, e.g., cursor keys in that
13017 case, and only if enabled we see the codes that we are interested in.
13019 .It Cd xenl Ns \0or Cd xn
13020 .Cd eat_newline_glitch :
13021 boolean which indicates whether a newline written in the last column of an
13022 .Cd auto_right_margin
13023 indicating terminal is ignored.
13024 With it the full terminal width is available even on autowrap terminals.
13025 This will be inspected even without
13026 .Ql ,+termcap,
13027 .Va features .
13031 Many more capabilities which describe key-sequences are documented for
13032 .Ic bind .
13036 .It Va termcap-ca-mode
13037 \*(OP Allow usage of the
13038 .Cd exit_ca_mode
13040 .Cd enter_ca_mode
13041 .Va termcap Ns
13042 abilities in order to enter an alternative exclusive screen, the
13043 so-called ca-mode; this usually requires special configuration of the
13044 .Ev PAGER ,
13045 also dependent on the value of
13046 .Va crt .
13047 .Sy Note
13048 this variable will only be queried once at program startup and can
13049 thus only be specified in resource files or on the command line.
13052 .It Va termcap-disable
13053 \*(OP Disable any interaction with a terminal control library.
13054 If set only some generic fallback built-ins and possibly the content of
13055 .Va termcap
13056 describe the terminal to \*(UA.
13057 .Sy Note
13058 this variable will only be queried once at program startup and can
13059 thus only be specified in resource files or on the command line.
13061 .Mx Va tls-ca-file
13062 .Mx Va tls-ca-dir
13063 .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\
13064   tls-ca-file-USER@HOST , tls-ca-file-HOST , tls-ca-file
13065 \*(OP Directory and file, respectively, for pools of trusted CA
13066 certificates in PEM (Privacy Enhanced Mail) format, for the purpose of
13067 verification of TLS server certificates.
13068 Concurrent use is possible, the file is loaded once needed first, the
13069 directory lookup is performed anew as a last resort whenever necessary.
13070 The CA certificate pool built into the TLS library can be disabled via
13071 .Va tls-ca-no-defaults ,
13072 further fine-tuning is possible via
13073 .Va tls-ca-flags .
13074 The directory search requires special filename conventions, please see
13075 .Xr SSL_CTX_load_verify_locations 3
13077 .Xr verify 1
13079 .Xr c_rehash 1 ) .
13082 .Mx Va tls-ca-flags
13083 .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags
13084 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
13085 storage, and the certificate verification that is used (also see
13086 .Va tls-verify ) .
13087 The value is expected to consist of a comma-separated list of
13088 configuration directives, with any intervening whitespace being ignored.
13089 The directives directly map to flags that can be passed to
13090 .Xr X509_STORE_set_flags 3 ,
13091 which are usually defined in a file
13092 .Pa openssl/x509_vfy.h ,
13093 and the availability of which depends on the used TLS library
13094 version: a directive without mapping is ignored (error log subject to
13095 .Va debug ) .
13096 Directives currently understood (case-insensitively) include:
13099 .Bl -tag -compact -width ".It Cd BaNg"
13100 .It Cd no-alt-chains
13101 If the initial chain is not trusted, do not attempt to build an
13102 alternative chain.
13103 Setting this flag will make OpenSSL certificate verification match that
13104 of older OpenSSL versions, before automatic building and checking of
13105 alternative chains has been implemented; also see
13106 .Cd trusted-first .
13107 .It Cd no-check-time
13108 Do not check certificate/CRL validity against current time.
13109 .It Cd partial-chain
13110 By default partial, incomplete chains which cannot be verified up to the
13111 chain top, a self-signed root certificate, will not verify.
13112 With this flag set, a chain succeeds to verify if at least one signing
13113 certificate of the chain is in any of the configured trusted stores of
13114 CA certificates.
13115 The OpenSSL manual page
13116 .Xr SSL_CTX_load_verify_locations 3
13117 gives some advise how to manage your own trusted store of CA certificates.
13118 .It Cd strict
13119 Disable workarounds for broken certificates.
13120 .It Cd trusted-first
13121 Try building a chain using issuers in the trusted store first to avoid
13122 problems with server-sent legacy intermediate certificates.
13123 Newer versions of OpenSSL support alternative chain checking and enable
13124 it by default, resulting in the same behaviour; also see
13125 .Cd no-alt-chains .
13129 .Mx Va tls-ca-no-defaults
13130 .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\
13131   tls-ca-no-defaults
13132 \*(BO\*(OP Do not load the default CA locations that are built into the
13133 used to TLS library to verify TLS server certificates.
13136 .It Va tls-config-file
13137 \*(OP If this variable is set
13138 .Xr CONF_modules_load_file 3
13139 (if announced via
13140 .Ql ,+modules-load-file,
13142 .Va tls-features )
13143 is used to allow resource file based configuration of the TLS library.
13144 This happens once the library is used first, which may also be early
13145 during startup (logged with
13146 .Va verbose ) !
13147 If a non-empty value is given then the given file, after performing
13148 .Sx "Filename transformations" ,
13149 will be used instead of the TLS libraries global default, and it is an
13150 error if the file cannot be loaded.
13151 The application name will always be passed as
13152 .Ql \*(uA .
13153 Some TLS libraries support application-specific configuration via
13154 resource files loaded like this, please see
13155 .Va tls-config-module .
13157 .Mx Va tls-config-module
13158 .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\
13159   tls-config-module
13160 \*(OP If file based application-specific configuration via
13161 .Va tls-config-file
13162 is available, announced as
13163 .Ql ,+ctx-config,
13165 .Va tls-features ,
13166 indicating availability of
13167 .Xr SSL_CTX_config 3 ,
13168 then, it becomes possible to use a central TLS configuration file
13169 for all programs, including \*(uA, for example
13170 .Bd -literal -offset indent
13171 # Register a configuration section for \*(uA
13172 \*(uA = mailx_master
13173 # The top configuration section creates a relation
13174 # in between dynamic SSL configuration and an actual
13175 # program specific configuration section
13176 [mailx_master]
13177 ssl_conf = mailx_tls_config
13178 # And that program specific configuration section now
13179 # can map diverse tls-config-module names to sections,
13180 # as in: tls-config-module=account_xy
13181 [mailx_tls_config]
13182 account_xy = mailx_account_xy
13183 account_yz = mailx_account_yz
13184 [mailx_account_xy]
13185 MinProtocol = TLSv1.2
13186 Curves=P-521
13187 [mailx_account_yz]
13188 CipherString = TLSv1.2:!aNULL:!eNULL:
13189 MinProtocol = TLSv1.1
13190 Options = Bugs
13194 .Mx Va tls-config-pairs
13195 .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs
13196 \*(OP The value of this variable chain will be interpreted as
13197 a comma-separated list of directive/value pairs.
13198 Directives and values need to be separated by equals signs
13199 .Ql = ,
13200 any whitespace surrounding pair members is removed.
13201 Keys are (usually) case-insensitive.
13202 Different to when placing these pairs in a
13203 .Va tls-config-module
13204 section of a
13205 .Va tls-config-file ,
13206 commas
13207 .Ql \&,
13208 need to be escaped with a reverse solidus
13209 .Ql \e
13210 when included in pairs; also different: if the equals sign
13211 .Ql =
13212 is preceded with an asterisk
13213 .Ql *
13214 .Sx "Filename transformations"
13215 will be performed on the value; it is an error if these fail.
13216 Unless proper support is announced by
13217 .Va tls-features
13218 .Pf ( Ql ,+conf-ctx, )
13219 only the keys below are supported, otherwise the pairs will be used
13220 directly as arguments to the function
13221 .Xr SSL_CONF_cmd 3 .
13224 .Bl -tag -compact -width ".It Cd C_rtificate_"
13225 .It Cd Certificate
13226 Filename of a TLS client certificate (chain) required by some servers.
13227 Fallback support via
13228 .Xr SSL_CTX_use_certificate_chain_file 3 .
13229 .Sx "Filename transformations"
13230 are performed.
13231 .Cd PrivateKey
13232 will be set to the same value if not initialized explicitly.
13233 Some services support so-called
13234 .Ql external
13235 authentication if a TLS client certificate was successfully presented
13236 during connection establishment
13237 .Pf ( Dq connecting is authenticating ) .
13239 .It Cd CipherString
13240 A list of ciphers for TLS connections, see
13241 .Xr ciphers 1 .
13242 By default no list of ciphers is set, resulting in a
13243 .Cd Protocol Ns - Ns
13244 specific list of ciphers (the protocol standards define lists of
13245 acceptable ciphers; possibly cramped by the used TLS library).
13246 Fallback support via
13247 .Xr SSL_CTX_set_cipher_list 3 .
13249 .It Cd Ciphersuites
13250 A list of ciphers used for TLSv1.3 connections, see
13251 .Xr ciphers 1 .
13252 These will be joined onto the list of ciphers from
13253 .Cd CipherString .
13254 Available if
13255 .Va tls-features
13256 announces
13257 .Ql ,+ctx-set-ciphersuites, ,
13258 as necessary via
13259 .Xr SSL_CTX_set_ciphersuites 3 .
13261 .It Cd Curves
13262 A list of supported elliptic curves, if applicable.
13263 By default no curves are set.
13264 Fallback support via
13265 .Xr SSL_CTX_set1_curves_list 3 ,
13266 if available.
13268 .It Cd MaxProtocol , MinProtocol
13269 The maximum and minimum supported TLS versions, respectively.
13270 Available if
13271 .Va tls-features
13272 announces
13273 .Ql ,+ctx-set-maxmin-proto, ,
13274 as necessary via
13275 .Xr SSL_CTX_set_max_proto_version 3
13277 .Xr SSL_CTX_set_min_proto_version 3 ;
13278 these fallbacks use an internal parser which understands the strings
13279 .Ql SSLv3 ,
13280 .Ql TLSv1 ,
13281 .Ql TLSv1.1 ,
13282 .Ql TLSv1.2 ,
13283 .Ql TLSv1.3 ,
13284 and the special value
13285 .Ql None ,
13286 which disables the given limit.
13288 .It Cd Options
13289 Various flags to set.
13290 Fallback via
13291 .Xr SSL_CTX_set_options 3 ,
13292 in which case any other value but (exactly)
13293 .Ql Bugs
13294 results in an error.
13296 .It Cd PrivateKey
13297 Filename of the private key in PEM format of a TLS client certificate.
13298 If unset, the value of
13299 .Cd Certificate
13300 is used.
13301 .Sx "Filename transformations"
13302 are performed.
13303 Fallback via
13304 .Xr SSL_CTX_use_PrivateKey_file 3 .
13306 .It Cd Protocol
13307 The used TLS protocol.
13309 .Va tls-features
13310 announces
13311 .Ql ,+conf-ctx,
13313 .Ql ctx-set-maxmin-proto
13314 then using
13315 .Cd MaxProtocol
13317 .Cd MinProtocol
13318 is preferable.
13319 Fallback is
13320 .Xr SSL_CTX_set_options 3 ,
13321 driven via an internal parser which understands the strings
13322 .Ql SSLv3 ,
13323 .Ql TLSv1 ,
13324 .Ql TLSv1.1 ,
13325 .Ql TLSv1.2 ,
13326 .Ql TLSv1.3 ,
13327 and the special value
13328 .Ql ALL .
13329 Multiple protocols may be given as a comma-separated list, any
13330 whitespace is ignored, an optional plus sign
13331 .Ql +
13332 prefix enables, a hyphen-minus
13333 .Ql -
13334 prefix disables a protocol, so that
13335 .Ql -ALL, TLSv1.2
13336 enables only the TLSv1.2 protocol.
13342 .It Va tls-crl-dir , tls-crl-file
13343 \*(OP Specify a directory / a file, respectively, that contains a CRL in
13344 PEM format to use when verifying TLS server certificates.
13347 .It Va tls-features
13348 \*(OP\*(RO This expands to a comma-separated list of the TLS library
13349 identity and optional features.
13350 To ease substring matching the string starts and ends with a comma.
13351 Currently supported identities are
13352 .Ql libressl
13353 (LibreSSL) ,
13354 .Ql libssl-0x30000
13355 (OpenSSL v3.0.0 series),
13356 .Ql libssl-0x10100
13357 (OpenSSL v1.1.x series)
13359 .Ql libssl-0x10000
13360 (elder OpenSSL series, other clones).
13361 Optional features are preceded with a plus sign
13362 .Ql +
13363 when available, and with a hyphen-minus
13364 .Ql -
13365 otherwise.
13367 Currently known features are
13368 .Ql conf-ctx
13369 .Pf ( Va tls-config-pairs ) ,
13370 .Ql ctx-config
13371 .Pf ( Va tls-config-module ) ,
13372 .Ql ctx-set-ciphersuites
13373 .Pf ( Cd Ciphersuites
13374 slot of
13375 .Va tls-config-pairs ) ,
13376 .Ql ctx-set-maxmin-proto
13377 .Pf ( Va tls-config-pairs ) ,
13378 .Ql modules-load-file
13379 .Pf ( Va tls-config-file ) ,
13381 .Ql tls-rand-file
13382 .Pf ( Va tls-rand-file ) .
13384 .Mx Va tls-fingerprint
13385 .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint
13386 \*(OP It is possible to replace the verification of the connection
13387 peer certificate against the entire local pool of CAs (for more see
13388 .Sx "Encrypted network communication" )
13389 with the comparison against a precalculated certificate message digest,
13390 the so-called fingerprint, to be specified as the used
13391 .Va tls-fingerprint-digest .
13392 This fingerprint can for example be calculated with
13393 .Ql Ic tls Ns \:\0\:fingerprint HOST .
13395 .Mx Va tls-fingerprint-digest
13396 .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \
13397   tls-fingerprint-digest
13398 \*(OP The message digest to be used when creating TLS certificate
13399 fingerprints, the defaults, if available, in test order, being
13400 .Ql BLAKE2s256 ,
13401 .Ql SHA256 .
13402 For the complete list of digest algorithms refer to
13403 .Va smime-sign-digest .
13406 .It Va tls-rand-file
13407 \*(OP If
13408 .Va tls-features
13409 announces
13410 .Ql ,+tls-rand-file,
13411 then this will be queried to find a file with random entropy data which
13412 can be used to seed the P(seudo)R(andom)N(umber)G(enerator), see
13413 .Xr RAND_load_file 3 .
13414 The default filename
13415 .Pf ( Xr RAND_file_name 3 ,
13416 normally
13417 .Pa ~/.rnd )
13418 will be used if this variable is not set or empty, or if the
13419 .Sx "Filename transformations"
13420 fail.
13421 Shall seeding the PRNG have been successful,
13422 .Xr RAND_write_file 3
13423 will be called to update the entropy.
13424 Remarks: libraries which do not announce this feature seed the PRNG by
13425 other means.
13427 .Mx Va tls-verify
13428 .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify
13429 \*(OP Variable chain that sets the action to be performed if an error
13430 occurs during TLS server certificate validation against the
13431 specified or default trust stores
13432 .Va tls-ca-dir ,
13433 .Va tls-ca-file ,
13434 or the TLS library built-in defaults (unless usage disallowed via
13435 .Va tls-ca-no-defaults ) ,
13436 and as fine-tuned via
13437 .Va tls-ca-flags .
13438 Valid (case-insensitive) values are
13439 .Ql strict
13440 (fail and close connection immediately),
13441 .Ql ask
13442 (ask whether to continue on standard input),
13443 .Ql warn
13444 (show a warning and continue),
13445 .Ql ignore
13446 (do not perform validation).
13447 The default is
13448 .Ql ask .
13450 .It Va toplines
13451 If defined, gives the number of lines of a message to be displayed
13452 with the command
13453 .Ic top ;
13454 if unset, the first five lines are printed, if set to 0 the variable
13455 .Va screen
13456 is inspected.
13457 If the value is negative then its absolute value will be used for
13458 unsigned right shifting (see
13459 .Ic vexpr )
13461 .Va screen
13462 height.
13465 .It Va topsqueeze
13466 \*(BO If set then the
13467 .Ic top
13468 command series will strip adjacent empty lines and quotations.
13471 .It Va ttycharset
13472 The character set of the terminal \*(UA operates on,
13473 and the one and only supported character set that \*(UA can use if no
13474 character set conversion capabilities have been compiled into it,
13475 in which case it defaults to ISO-8859-1.
13476 Otherwise it defaults to UTF-8.
13477 Sufficient locale support provided the default will be preferably
13478 deduced from the locale environment if that is set (for example
13479 .Ev LC_CTYPE ,
13480 see there for more); runtime locale changes will be reflected by
13481 .Va \&\&ttycharset
13482 except during the program startup phase and if
13483 .Fl S
13484 had been used to freeze the given value.
13485 Refer to the section
13486 .Sx "Character sets"
13487 for the complete picture about character sets.
13490 .It Va typescript-mode
13491 \*(BO A special multiplex variable that disables all variables and
13492 settings which result in behaviour that interferes with running \*(UA in
13493 .Xr script 1 ;
13494 it sets
13495 .Va colour-disable ,
13496 .Va line-editor-disable
13497 and (before startup completed only)
13498 .Va termcap-disable .
13499 Unsetting it does not restore the former state of the covered settings.
13502 .It Va umask
13503 For a safe-by-default policy the process file mode creation mask
13504 .Xr umask 2
13505 will be set to
13506 .Ql 0077
13507 on program startup after the resource files have been loaded,
13508 and unless this variable is set.
13509 By assigning this an empty value the active setting will not be changed,
13510 otherwise the given value will be made the new file mode creation mask.
13511 Child processes inherit the file mode creation mask of their parent.
13513 .Mx Va user
13514 .It Va user-HOST , user
13515 \*(IN Variable chain that sets a global fallback user name, used in case
13516 none has been given in the protocol and account-specific URL.
13517 This variable defaults to the name of the user who runs \*(UA.
13520 .It Va v15-compat
13521 Enable upward compatibility with \*(UA version 15.0 in respect to which
13522 configuration options are available and how they are handled.
13523 If set to a non-empty value the command modifier
13524 .Cm wysh
13525 is implied and thus enforces
13526 .Sx "Shell-style argument quoting"
13527 over
13528 .Sx "Old-style argument quoting"
13529 for all commands which support both.
13530 This manual uses \*(IN and \*(OU to refer to the new and the old way of
13531 doing things, respectively.
13534 .It Va verbose
13535 Verbose mode enables logging of informational context messages.
13536 Historically a \*(BO variable, this can either be set multiple times
13537 (what the command line option
13538 .Fl v
13539 uses), or be assigned a numeric value in order to increase verbosity.
13540 Assigning the value 0 disables verbosity and thus (almost) equals
13541 .Ic unset .
13542 The maximum number is 3.
13543 Also see
13544 .Va debug .
13552 .It Va version , version-date , \
13553   version-hexnum , version-major , version-minor , version-update
13554 \*(RO \*(UA version information: the first variable is a string with
13555 the complete version identification, the second the release date in ISO
13556 8601 notation without time.
13557 The third is a 32-bit hexadecimal number with the upper 8 bits storing
13558 the major, followed by the minor and update version numbers which occupy
13559 12 bits each.
13560 The latter three variables contain only decimal digits: the major, minor
13561 and update version numbers.
13562 The output of the command
13563 .Ic version
13564 will include this information.
13567 .It Va writebackedited
13568 If this variable is set messages modified using the
13569 .Ic edit
13571 .Ic visual
13572 commands are written back to the current folder when it is quit;
13573 it is only honoured for writable folders in MBOX format, though.
13574 Note that the editor will be pointed to the raw message content in that
13575 case, i.e., neither MIME decoding nor decryption will have been
13576 performed, and proper
13577 .Va mbox-rfc4155
13578 .Ql From_
13579 quoting of newly added or edited content is also left as an exercise
13580 to the user.
13582 .\" }}} (Variables)
13584 .\" }}} (INTERNAL VARIABLES)
13587 .\" .Sh ENVIRONMENT {{{
13588 .Sh ENVIRONMENT
13590 The term
13591 .Dq environment variable
13592 should be considered an indication that these variables are either
13593 standardized as vivid parts of process environments, or that they are
13594 commonly found in there.
13595 The process environment is inherited from the
13596 .Xr sh 1
13597 once \*(UA is started, and unless otherwise explicitly noted handling of
13598 the following variables transparently integrates into that of the
13599 .Sx "INTERNAL VARIABLES"
13600 from \*(UA's point of view.
13601 This means they can be managed via
13602 .Ic set
13604 .Ic unset ,
13605 causing automatic program environment updates (to be inherited by
13606 newly created child processes).
13609 In order to integrate other environment variables equally they need to
13610 be imported (linked) with the command
13611 .Ic environ .
13612 This command can also be used to set and unset non-integrated
13613 environment variables from scratch, sufficient system support provided.
13614 The following example, applicable to a POSIX shell, sets the
13615 .Ev COLUMNS
13616 environment variable for \*(UA only, and beforehand exports the
13617 .Ev EDITOR
13618 in order to affect any further processing in the running shell:
13620 .Bd -literal -offset indent
13621 $ EDITOR="vim -u ${HOME}/.vimrc"
13622 $ export EDITOR
13623 $ COLUMNS=80 \*(uA -R
13626 .Bl -tag -width ".It Ev BaNg"
13628 .It Ev COLUMNS
13629 The user's preferred width in column positions for the terminal screen.
13630 Queried and used once on program startup in interactive or batch
13631 .Pf ( Fl \&# )
13632 mode, actively managed for child processes and the MLE (see
13633 .Sx "On terminal control and line editor" )
13634 in interactive mode thereafter.
13635 Non-interactive mode always uses, and the fallback default is
13636 a compile-time constant, by default 80 columns.
13637 If in batch mode
13638 .Ev \&\&COLUMNS
13640 .Ev LINES
13641 are both set but not both are usable (empty, not a number, or 0) at
13642 program startup, then the real terminal screen size will be (tried to
13643 be) determined once.
13644 (Normally the
13645 .Xr sh 1
13646 manages these variables, and unsets them for pipe specifications etc.)
13649 .It Ev DEAD
13650 The name of the (mailbox)
13651 .Ic folder
13652 to use for saving aborted messages if
13653 .Va save
13654 is set; this defaults to
13655 .Pa \*(VD .
13656 If the variable
13657 .Va debug
13658 is set no output will be generated, otherwise the contents of the file
13659 will be replaced.
13660 Except shell globs
13661 .Sx "Filename transformations"
13662 (also see
13663 .Ic folder )
13664 will be performed.
13667 .It Ev EDITOR
13668 Pathname of the text editor to use for the
13669 .Ic edit
13670 command and
13671 .Ic ~e
13672 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
13673 .Ev VISUAL
13674 is used for a more display oriented editor.
13677 .It Ev HOME
13678 The user's home directory.
13679 This variable is only used when it resides in the process environment.
13680 The calling user's home directory will be used instead if this directory
13681 does not exist, is not accessible or cannot be read;
13682 it will always be used for the root user.
13683 (No test for being writable is performed to allow usage by
13684 non-privileged users within read-only jails, but dependent on settings
13685 this directory is a default write target for, for example,
13686 .Ev DEAD ,
13687 .Ev MBOX
13688 and more.)
13693 .It Ev LC_ALL , LC_CTYPE , LANG
13694 \*(OP The (names in lookup order of the)
13695 .Xr locale 7
13696 (and / or see
13697 .Xr setlocale 3 )
13698 which indicates the used
13699 .Sx "Character sets" .
13700 Runtime changes trigger automatic updates of the entire locale system,
13701 which includes updating
13702 .Va ttycharset
13703 (except during startup if the variable has been frozen via
13704 .Fl S ) .
13707 .It Ev LINES
13708 The user's preferred number of lines for the terminal screen.
13709 The behaviour is as described for
13710 .Ev COLUMNS ,
13711 yet the compile-time constant used in non-interactive mode and as
13712 a fallback defaults to 24 (lines).
13715 .It Ev LISTER
13716 Pathname of the directory lister to use in the
13717 .Ic folders
13718 command when operating on local mailboxes.
13719 Default is
13720 .Xr ls 1
13721 (path search through
13722 .Ev SHELL ) .
13725 .It Ev LOGNAME
13726 Upon startup \*(UA will actively ensure that this variable refers to the
13727 name of the user who runs \*(UA, in order to be able to pass a verified
13728 name to any newly created child process.
13731 .It Ev MAIL
13732 Is used as the user's
13733 .Mx -sx
13734 .Sx "primary system mailbox"
13735 unless
13736 .Va inbox
13737 is set.
13738 If the environmental fallback is also not set, a built-in compile-time
13739 default is used.
13740 This is assumed to be an absolute pathname.
13743 .It Ev MAILCAPS
13744 \*(OP Override the default path search of
13745 .Sx "The Mailcap files" :
13746 any existing file therein will be loaded in sequence, appending any
13747 content to the list of MIME type handler directives.
13748 The RFC 1524 standard imposed default value is assigned otherwise:
13749 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
13750 (The default value is a compile-time \*(OP.)
13753 .It Ev MAILRC
13754 Is used as a startup file instead of
13755 .Pa \*(ur
13756 if set.
13757 In order to avoid side-effects from configuration files scripts should
13758 either set this variable to
13759 .Pa /dev/null
13760 or the
13761 .Fl \&:
13762 command line option should be used.
13765 .It Ev MAILX_NO_SYSTEM_RC
13766 If this variable is set then reading of
13767 .Pa \*(UR
13768 (aka\&
13769 .Va system-mailrc )
13770 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
13771 had been started up with the option
13772 .Fl \&:
13773 (and according argument) or
13774 .Fl n .
13775 This variable is only used when it resides in the process environment.
13778 .It Ev MBOX
13779 The name of the user's
13780 .Mx -sx
13781 .Sx "secondary mailbox"
13782 file.
13783 A logical subset of the special
13784 .Sx "Filename transformations"
13785 (also see
13786 .Ic folder )
13787 are supported.
13788 The default is
13789 .Pa \*(VM .
13790 Traditionally this MBOX is used as the file to save messages from the
13791 .Mx -sx
13792 .Sx "primary system mailbox"
13793 that have been read.
13794 Also see
13795 .Sx "Message states" .
13798 .It Ev NETRC
13799 \*(IN\*(OP This variable overrides the default location of the user's
13800 .Pa \*(VN
13801 file.
13804 .It Ev PAGER
13805 Pathname of the program to use for backing the command
13806 .Ic more ,
13807 and when the
13808 .Va crt
13809 variable enforces usage of a pager for output.
13810 The default paginator is
13811 .Xr more 1
13812 (path search through
13813 .Ev SHELL ) .
13815 \*(UA inspects the contents of this variable: if its contains the string
13816 .Dq less
13817 then a non-existing environment variable
13818 .Ev LESS
13819 will be set to (the portable)
13820 .Ql RI ,
13821 likewise for
13822 .Dq lv
13823 .Ev LV
13824 will optionally be set to
13825 .Ql -c .
13826 Also see
13827 .Va colour-pager .
13830 .It Ev PATH
13831 A colon-separated list of directories that is searched by the shell when
13832 looking for commands, for example
13833 .Ql /bin:/usr/bin:/usr/local/bin .
13836 .It Ev POSIXLY_CORRECT
13837 This environment entry is automatically squared with
13838 .Va posix .
13841 .It Ev SHELL
13842 The shell to use for the commands
13843 .Ic \&! ,
13844 .Ic shell ,
13846 .Ic ~!
13847 .Sx "COMMAND ESCAPES"
13848 and when starting subprocesses.
13849 A default shell is used if this environment variable is not defined.
13852 .It Ev SOCKS5_PROXY
13853 This environment entry is automatically squared with
13854 .Va socks-proxy .
13857 .It Ev SOURCE_DATE_EPOCH
13858 Specifies a time in seconds since the Unix epoch (1970-01-01) to be
13859 used in place of the current time.
13860 This variable is looked up upon program startup, and its existence will
13861 switch \*(UA to a reproducible mode
13862 .Pf ( Lk https://reproducible-builds.org )
13863 which uses deterministic random numbers, a special fixated pseudo
13864 .Ev LOGNAME
13865 and more.
13866 This operation mode is used for development and by software packagers.
13867 \*(ID Currently an invalid setting is only ignored, rather than causing
13868 a program abortion.
13870 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
13873 .It Ev TERM
13874 \*(OP The terminal type for which output is to be prepared.
13875 For extended colour and font control please refer to
13876 .Sx "Coloured display" ,
13877 and for terminal management in general to
13878 .Sx "On terminal control and line editor" .
13881 .It Ev TMPDIR
13882 Except for the root user this variable defines the directory for
13883 temporary files to be used instead of
13884 .Pa \*(VT
13885 (or the given compile-time constant) if set, existent, accessible as
13886 well as read- and writable.
13887 This variable is only used when it resides in the process environment,
13888 but \*(UA will ensure at startup that this environment variable is
13889 updated to contain a usable temporary directory.
13892 .It Ev USER
13893 Identical to
13894 .Ev LOGNAME
13895 (see there), but this variable is not standardized, should therefore not
13896 be used, and is only corrected if already set.
13899 .It Ev VISUAL
13900 Pathname of the text editor to use for the
13901 .Ic visual
13902 command and
13903 .Ic ~v
13904 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
13905 .Ev EDITOR
13906 is used for a less display oriented editor.
13909 .\" }}}
13912 .\" .Sh FILES {{{
13913 .Sh FILES
13915 .\" file list {{{
13916 .Bl -tag -width ".It Pa BaNg"
13919 .It Pa ~/.mailcap , /etc/mailcap
13920 \*(OP Personal and system-wide MIME type handler definition files, see
13921 .Sx "The Mailcap files" .
13922 (The shown names are part of the RFC 1524 standard search path
13923 .Ev MAILCAPS . )
13925 .It Pa \*(ur , \*(UR
13926 User-specific and system-wide files giving initial commands, the
13927 .Sx "Resource files" .
13928 (The used filenames come from
13929 .Va MAILRC
13931 .Va system-mailrc ,
13932 respectively.)
13935 .It Pa \*(VM
13936 The default value for
13937 .Ev MBOX .
13941 .It Pa \*(vU , \*(vS
13942 Personal and system-wide MIME types, see
13943 .Sx "The mime.types files" .
13946 .It Pa \*(VN
13947 \*(IN\*(OP The default location of the user's
13948 .Pa .netrc
13949 file \(en the section
13950 .Sx "The .netrc file"
13951 documents the file format.
13952 The used path can be set via
13953 .Ev NETRC .
13956 .It Pa /dev/null
13957 The data sink
13958 .Xr null 4 .
13961 .It Pa ~/.rnd
13962 \*(OP Possible location for persistent random entropy seed storage, see
13963 .Va tls-rand-file .
13965 .\" }}}
13967 .\" .Ss "Resource files" {{{
13968 .Ss "Resource files"
13970 Upon startup \*(UA reads in several resource files, in order:
13972 .Bl -tag -width ".It Pa BaNg"
13974 .It Pa \*(UR
13975 System wide initialization file
13976 .Pf ( Va system-mailrc ) .
13977 Reading of this file can be suppressed, either by using the
13978 .Fl \&:
13979 (and according argument) or
13980 .Fl n
13981 command line options, or by setting the
13982 .Sx ENVIRONMENT
13983 variable
13984 .Ev MAILX_NO_SYSTEM_RC .
13987 .It Pa \*(ur
13988 File giving initial commands.
13989 A different file can be chosen by setting the
13990 .Sx ENVIRONMENT
13991 variable
13992 .Ev MAILRC .
13993 Reading of this file can be suppressed with the
13994 .Fl \&:
13995 command line option.
13997 .It Va mailx-extra-rc
13998 Defines a startup file to be read after all other resource files.
13999 It can be used to specify settings that are not understood by other
14000 .Xr mailx 1
14001 implementations, for example.
14005 The content of these files is interpreted as follows:
14008 .Bl -bullet -compact
14010 The whitespace characters space, tabulator and newline,
14011 as well as those defined by the variable
14012 .Va ifs ,
14013 are removed from the beginning and end of input lines.
14015 Empty lines are ignored.
14017 Any other line is interpreted as a command.
14018 It may be spread over multiple input lines if the newline character is
14019 .Dq escaped
14020 by placing a reverse solidus character
14021 .Ql \e
14022 as the last character of the line; whereas any leading whitespace of
14023 follow lines is ignored, trailing whitespace before a escaped newline
14024 remains in the input.
14026 If the line (content) starts with the number sign
14027 .Ql #
14028 then it is a comment-command and also ignored.
14029 (The comment-command is a real command, which does nothing, and
14030 therefore the usual follow lines mechanism applies!)
14034 Errors while loading these files are subject to the settings of
14035 .Va errexit
14037 .Va posix .
14038 More files with syntactically equal content can be
14039 .Ic source Ns ed .
14040 The following, saved in a file, would be an examplary content:
14042 .Bd -literal -offset indent
14043  # This line is a comment command.  And y\e
14044     es, it is really continued here.
14045 set debug \e
14046     verbose
14047     set editheaders
14049 .\" }}}
14051 .\" .Ss "The mime.types files" {{{
14052 .Ss "The mime.types files"
14054 As stated in
14055 .Sx "HTML mail and MIME attachments"
14056 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
14057 media types in order to classify message and attachment content.
14058 One source for them are
14059 .Pa mime.types
14060 files, the loading of which can be controlled by setting the variable
14061 .Va mimetypes-load-control .
14062 Another is the command
14063 .Ic mimetype ,
14064 which also offers access to \*(UAs MIME type cache.
14065 .Pa mime.types
14066 files have the following syntax:
14068 .Bd -literal -offset indent
14069 type/subtype extension [extension ...]
14070 # For example text/html html htm
14074 where
14075 .Ql type/subtype
14076 define the MIME media type, as standardized in RFC 2046:
14077 .Ql type
14078 is used to declare the general type of data, while the
14079 .Ql subtype
14080 specifies a specific format for that type of data.
14081 One or multiple filename
14082 .Ql extension Ns
14083 s, separated by whitespace, can be bound to the media type format.
14084 Comments may be introduced anywhere on a line with a number sign
14085 .Ql # ,
14086 causing the remaining line to be discarded.
14088 \*(UA also supports an extended, non-portable syntax in especially
14089 crafted files, which can be loaded via the alternative value syntax of
14090 .Va mimetypes-load-control ,
14091 and prepends an optional
14092 .Ql type-marker :
14095 .Dl [type-marker ]type/subtype extension [extension ...]
14098 The following type markers are supported:
14101 .Bl -tag -compact -width ".It Ar _n_u"
14102 .It Ar \&?
14103 Treat message parts with this content as plain text.
14104 .It Ar ?t
14105 The same as plain
14106 .Ar \&? .
14107 .It Ar ?h
14108 Treat message parts with this content as HTML tagsoup.
14109 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
14110 the content as plain text instead.
14111 .It Ar ?H
14112 Likewise
14113 .Ar ?h ,
14114 but instead of falling back to plain text require an explicit content
14115 handler to be defined.
14116 .It Ar ?q
14117 If no handler can be found a text message is displayed which says so.
14118 This can be annoying, for example signatures serve a contextual purpose,
14119 their content is of no use by itself.
14120 This marker will avoid displaying the text message.
14124 Further reading:
14125 for sending messages:
14126 .Ic mimetype ,
14127 .Va mime-allow-text-controls ,
14128 .Va mimetypes-load-control .
14129 For reading etc. messages:
14130 .Sx "HTML mail and MIME attachments" ,
14131 .Sx "The Mailcap files" ,
14132 .Ic mimetype ,
14133 .Va mime-counter-evidence ,
14134 .Va mimetypes-load-control ,
14135 .Va pipe-TYPE/SUBTYPE ,
14136 .Va pipe-EXTENSION .
14137 .\" }}}
14139 .\" .Ss "The Mailcap files" {{{ review
14140 .Ss "The Mailcap files"
14142 \*(OP RFC 1524 defines a
14143 .Dq User Agent Configuration Mechanism
14144 to be used to inform mail user agent programs about the locally
14145 installed facilities for handling various data formats, i.e., about
14146 commands and how they can be used to display, edit et cetera MIME part
14147 contents, as well as a default path search that includes multiple
14148 possible locations of resource files, and the
14149 .Ev MAILCAPS
14150 environment variable to overwrite that.
14151 Handlers found from doing the path search will be cached, the command
14152 .Ic mailcap
14153 operates on that cache, and the variable
14154 .Va mailcap-disable
14155 will suppress automatic loading, and usage of any mailcap handlers.
14156 .Sx "HTML mail and MIME attachments"
14157 gives a general overview of how MIME types are handled.
14160 .Dq Mailcap
14161 files consist of a set of newline separated entries.
14162 Comment lines start with a number sign
14163 .Ql #
14164 (in the first column!) and are ignored.
14165 Empty lines are ignored.
14166 All other lines are interpreted as mailcap entries.
14167 An entry definition may be split over multiple lines by placing the
14168 reverse solidus character
14169 .Ql \e
14170 last in all but the final line.
14171 The standard does not specify how leading whitespace of successive lines
14172 is to be treated, therefore they are retained.
14175 .Dq Mailcap
14176 entries consist of a number of semicolon
14177 .Ql \&;
14178 separated fields.
14179 The first two fields are mandatory and must occur in the specified
14180 order, the remaining fields are optional and may appear in any order.
14181 Leading and trailing whitespace of field content is ignored (removed).
14182 The reverse solidus
14183 .Ql \e
14184 character can be used to escape any following character including
14185 semicolon and itself in the content of the second field, and in value
14186 parts of any optional key/value field.
14189 The first field defines the MIME
14190 .Ql TYPE/SUBTYPE
14191 the entry is about to handle (case-insensitively).
14192 If the subtype is specified as an asterisk
14193 .Ql *
14194 the entry is meant to match all subtypes of the named type, e.g.,
14195 .Ql audio/*
14196 would match any audio type.
14197 The second field is the
14198 .Cd view
14199 shell command used to display MIME parts of the given type.
14202 Data consuming shell commands will be fed message (MIME part) data on
14203 standard input unless one or more instances of the (unquoted) string
14204 .Ql %s
14205 are used: these formats will be replaced with a temporary file(name)
14206 that has been prefilled with the parts data.
14207 Data producing shell commands are expected to generata data on their
14208 standard output unless that format is used.
14209 In all cases any given
14210 .Ql %s
14211 format is replaced with a properly shell quoted filename.
14212 When a command requests a temporary file via
14213 .Ql %s
14214 then that will be removed again, as if the
14215 .Cd x-mailx-tmpfile
14217 .Cd x-mailx-tmpfile-fill
14218 flags had been set; unless the command requests
14219 .Cd x-mailx-async
14221 .Cd x-mailx-tmpfile-unlink
14222 flag is also implied; see below for more.
14225 Optional fields define single-word flags (case-insensitive), or key
14226 / value pairs consisting of a case-insensitive keyword, an equals sign
14227 .Ql = ,
14228 and a shell command; whitespace surrounding the equals sign is removed.
14229 Optional fields include the following:
14232 .Bl -tag -width ".It Cd BaNg"
14233 .It Cd compose
14234 A program that can be used to compose a new body or body part in the
14235 given format.
14236 (Currently unused.)
14238 .It Cd composetyped
14239 Similar to the
14240 .Cd compose
14241 field, but is to be used when the composing program needs to specify the
14242 .Ql Content-type:
14243 header field to be applied to the composed data.
14244 (Currently unused.)
14247 .It Cd copiousoutput
14248 A flag field which indicates that the output of the
14249 .Cd view
14250 command is integrable into \*(UAs normal visual display.
14251 It is mutually exclusive with
14252 .Cd needsterminal .
14254 .It Cd description
14255 A textual description that describes this type of data.
14256 The text may optionally be enclosed within double quotation marks
14257 .Ql \&" .
14259 .It Cd edit
14260 A program that can be used to edit a body or body part in the given
14261 format.
14262 (Currently unused.)
14264 .It Cd nametemplate
14265 This field specifies a filename format for the
14266 .Ql %s
14267 format used in the shell command fields, in which
14268 .Ql %s
14269 will be replaced by a random string.
14270 (The filename is also stored in and passed to subprocesses via
14271 .Ev MAILX_FILENAME_TEMPORARY . )
14272 The standard says this is
14273 .Dq only expected to be relevant in environments \
14274   where filename extensions are meaningful ,
14275 and so this field is ignored unless the
14276 .Ql %s
14277 is a prefix, optionally followed by (ASCII) alphabetic and numeric
14278 characters, the underscore and the period.
14279 For example, to specify that a JPG file is to be passed to an image
14280 viewer with a name ending in
14281 .Ql .jpg ,
14282 .Ql nametemplate=%s.jpg
14283 can be used.
14286 .It Cd needsterminal
14287 This flag field indicates that the given shell command must be run on
14288 an interactive terminal.
14289 \*(UA will temporarily release the terminal to the given command in
14290 interactive mode, in non-interactive mode this entry will be entirely
14291 ignored; this flag implies
14292 .Cd x-mailx-noquote .
14294 .It Cd print
14295 A program that can be used to print a message or body part in the given
14296 format.
14297 (Currently unused.)
14299 .It Cd test
14300 Specifies a program to be run to test some condition, for example, the
14301 machine architecture, or the window system in use, to determine whether
14302 or not this mailcap entry applies.
14303 If the test fails, a subsequent mailcap entry should be sought; also see
14304 .Cd x-mailx-test-once .
14305 Standard I/O of the test program is redirected from and to
14306 .Pa /dev/null ,
14307 and the format
14308 .Ql %s
14309 is not supported (the data does not yet exist).
14311 .It Cd textualnewlines
14312 A flag field which indicates that this type of data is line-oriented and
14313 that, if encoded in
14314 .Ql base64 ,
14315 all newlines should be converted to canonical form (CRLF) before
14316 encoding, and will be in that form after decoding.
14317 (Currently unused.)
14319 .It Cd x11-bitmap
14320 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
14321 icon to be used to visually denote the presence of this kind of data.
14322 This field is not used by \*(UA.
14325 .It Cd x-mailx-async
14326 Extension flag field that denotes that the given
14327 .Cd view
14328 command shall be executed asynchronously, without blocking \*(UA.
14329 Cannot be used in conjunction with
14330 .Cd needsterminal ;
14331 the standard output of the command will go to
14332 .Pa /dev/null .
14335 .It Cd x-mailx-noquote
14336 An extension flag field that indicates that even a
14337 .Cd copiousoutput
14338 .Cd view
14339 command shall not be used when
14340 .Va quote Ns
14341 ing messages, as it would by default.
14344 .It Cd x-mailx-test-once
14345 Extension flag which denotes whether the given
14346 .Cd test
14347 command shall be evaluated once only with its exit status being cached.
14348 This is handy if some global unchanging condition is to be queried, like
14349 .Dq running under the X Window System .
14352 .It Cd x-mailx-tmpfile
14353 Extension flag field that requests creation of a zero-sized temporary
14354 file, the name of which is to be placed in the environment variable
14355 .Ev MAILX_FILENAME_TEMPORARY .
14356 It is an error to use this flag with commands that include a
14357 .Ql %s
14358 format (because that is implemented by means of this temporary file).
14361 .It Cd x-mailx-tmpfile-fill
14362 Normally the MIME part content is passed to the handler via standard
14363 input; if this flag is set then the data will instead be written into
14364 the implied
14365 .Cd x-mailx-tmpfile .
14366 In order to cause deletion of the temporary file you will have to set
14367 .Cd x-mailx-tmpfile-unlink
14368 explicitly!
14369 It is an error to use this flag with commands that include a
14370 .Ql %s
14371 format.
14374 .It Cd x-mailx-tmpfile-unlink
14375 Extension flag field that requests that the temporary file shall be
14376 deleted automatically when the command loop is entered again at latest.
14377 It is an error to use this flag with commands that include a
14378 .Ql %s
14379 format, or in conjunction with
14380 .Cd x-mailx-async .
14381 .Cd x-mailx-tmpfile
14382 is implied.
14385 .It Cd x-mailx-last-resort
14386 An extension flag that indicates that this handler shall only be used
14387 as a last resort, when no other source (see
14388 .Sx "HTML mail and MIME attachments" )
14389 provides a MIME handler.
14392 .It Cd x-mailx-ignore
14393 An extension that enforces that this handler is not used at all.
14398 The standard includes the possibility to define any number of additional
14399 fields, prefixed by
14400 .Ql x- .
14401 Flag fields apply to the entire
14402 .Dq Mailcap
14403 entry \(em in some unusual cases, this may not be desirable, but
14404 differentiation can be accomplished via separate entries, taking
14405 advantage of the fact that subsequent entries are searched if an earlier
14406 one does not provide enough information.
14407 For example, if a
14408 .Cd view
14409 command needs to specify the
14410 .Cd needsterminal
14411 flag, but the
14412 .Cd compose
14413 command shall not, the following will help out the latter:
14415 .Bd -literal -offset indent
14416 application/postscript; ps-to-terminal %s; needsterminal
14417 application/postscript; ps-to-terminal %s; compose=idraw %s
14421 In value parts of command fields any occurrence of the format string
14422 .Ql %t
14423 will be replaced by the
14424 .Ql TYPE/SUBTYPE
14425 specification.
14426 Any named parameter from a messages'
14427 .Ql Content-type:
14428 field may be embedded into the command line using the format
14429 .Ql %{
14430 followed by the parameter name and a closing brace
14431 .Ql }
14432 character.
14433 The entire parameter should appear as a single command line argument,
14434 regardless of embedded spaces, shell quoting will be performed by the
14435 RFC 1524 processor, thus:
14437 .Bd -literal -offset indent
14438 # Message
14439 Content-type:  multipart/mixed; boundary=42
14441 # Mailcap file
14442 multipart/*; /usr/local/bin/showmulti \e
14443   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
14445 # Executed shell command
14446 /usr/local/bin/showmulti multipart/mixed 42
14450 Note that \*(UA does not support handlers for multipart MIME parts as
14451 shown in this example (as of today).
14452 It does not support the additional formats
14453 .Ql %n
14455 .Ql %F .
14456 An example file, also showing how to properly deal with the expansion of
14457 .Ql %s ,
14458 which includes any quotes that are necessary to make it a valid shell
14459 argument by itself and thus will cause undesired behaviour when placed
14460 in additional user-provided quotes:
14462 .Bd -literal -offset indent
14463 # Comment line
14464 text/richtext; richtext %s; copiousoutput
14466 text/x-perl; perl -cWT %s; nametemplate = %s.pl
14468 # Exit EX_TEMPFAIL=75 on signal
14469 application/pdf; \e
14470   infile=%s\e; \e
14471     trap "rm -f ${infile}" EXIT\e; \e
14472     trap "exit 75" INT QUIT TERM\e; \e
14473     mupdf "${infile}"; \e
14474   test = [ -n "${DISPLAY}" ]; \e
14475   nametemplate = %s.pdf; x-mailx-async
14476 application/pdf; pdftotext -layout - -; copiousoutput
14478 application/*; echo "This is \e\e"%t\e\e" but \e
14479     is 50 \e% Greek to me" \e; < %s head -c 512 | cat -vet; \e
14480   copiousoutput; x-mailx-noquote; x-mailx-last-resort
14484 Further reading:
14485 .Sx "HTML mail and MIME attachments" ,
14486 .Sx "The mime.types files" ,
14487 .Ic mimetype ,
14488 .Ev MAILCAPS ,
14489 .Va mime-counter-evidence ,
14490 .Va pipe-TYPE/SUBTYPE ,
14491 .Va pipe-EXTENSION .
14492 .\" }}}
14494 .\" .Ss "The .netrc file" {{{ review
14495 .Ss "The .netrc file"
14497 User credentials for machine accounts (see
14498 .Sx "On URL syntax and credential lookup" )
14499 can be placed in the
14500 .Pa .netrc
14501 file, which will be loaded and cached when requested by
14502 .Va netrc-lookup .
14503 The default location
14504 .Pa \*(VN
14505 may be overridden by the
14506 .Ev NETRC
14507 environment variable.
14508 As long as syntax constraints are honoured the file source may be
14509 replaced with the output of the shell command set in
14510 .Va netrc-pipe ,
14511 to load an encrypted file, for example.
14512 The cache can be managed with the command
14513 .Ic netrc .
14516 The file consists of space, tabulator or newline separated tokens.
14517 This parser implements a superset of the original BSD syntax, but users
14518 should nonetheless be aware of portability glitches, shall their
14519 .Pa .netrc
14520 be usable across multiple programs and platforms:
14523 .Bl -bullet -compact
14525 BSD only supports double quotation marks, for example
14526 .Ql password """pass with spaces""" .
14528 BSD (only?) supports escaping of single characters via a reverse solidus
14529 (a space could be escaped via
14530 .Ql \e\0 ) ,
14531 in- as well as outside of a quoted string.
14532 This method is assumed to be present, and will actively be used to quote
14533 double quotation marks
14534 .Ql \&"
14535 and reverse solidus
14536 .Ql \e
14537 characters inside the
14538 .Cd login
14540 .Cd password
14541 tokens, for example for display purposes.
14543 BSD does not require a final quotation mark of the last user input token.
14545 The original BSD (Berknet) parser also supported a format which allowed
14546 tokens to be separated with commas \(en whereas at least Hewlett-Packard
14547 still seems to support this syntax, this parser does not!
14549 As a non-portable extension some widely-used programs support
14550 shell-style comments: if an input line starts, after any amount of
14551 whitespace, with a number sign
14552 .Ql # ,
14553 then the rest of the line is ignored.
14555 Whereas other programs may require that the
14556 .Pa .netrc
14557 file is accessible by only the user if it contains a
14558 .Cd password
14559 token for any other
14560 .Cd login
14561 than
14562 .Dq anonymous ,
14563 this parser will always require these strict permissions.
14567 Of the following list of supported tokens this parser uses (and caches)
14568 .Cd machine ,
14569 .Cd login
14571 .Cd password .
14572 An existing
14573 .Cd default
14574 entry will not be used.
14576 .Bl -tag -width ".It Cd BaNg"
14577 .It Cd machine Ar name
14578 The hostname of the entries' machine, lowercase-normalized before use.
14579 Any further file content, until either end-of-file or the occurrence
14580 of another
14581 .Cd machine
14582 or a
14583 .Cd default
14584 first-class token is bound (only related) to the machine
14585 .Ar name .
14587 As an extension that should not be the cause of any worries this parser
14588 supports a single wildcard prefix for
14589 .Ar name :
14590 .Bd -literal -offset indent
14591 machine *.example.com login USER password PASS
14592 machine pop3.example.com login USER password PASS
14593 machine smtp.example.com login USER password PASS
14596 which would match
14597 .Ql xy.example.com
14598 as well as
14599 .Ql pop3.example.com ,
14600 but neither
14601 .Ql example.com
14603 .Ql local.smtp.example.com .
14604 In the example neither
14605 .Ql pop3.example.com
14607 .Ql smtp.example.com
14608 will be matched by the wildcard, since the exact matches take
14609 precedence (it is however faster to specify it the other way around).
14611 .It Cd default
14612 This is the same as
14613 .Cd machine
14614 except that it is a fallback entry that is used shall none of the
14615 specified machines match; only one default token may be specified,
14616 and it must be the last first-class token.
14618 .It Cd login Ar name
14619 The user name on the remote machine.
14621 .It Cd password Ar string
14622 The user's password on the remote machine.
14624 .It Cd account Ar string
14625 Supply an additional account password.
14626 This is merely for FTP purposes.
14628 .It Cd macdef Ar name
14629 Define a macro.
14630 A macro is defined with the specified
14631 .Ar name ;
14632 it is formed from all lines beginning with the next line and continuing
14633 until a blank line is (consecutive newline characters are) encountered.
14634 (Note that
14635 .Cd macdef
14636 entries cannot be utilized by multiple machines, too, but must be
14637 defined following the
14638 .Ic machine
14639 they are intended to be used with.)
14640 If a macro named
14641 .Ar init
14642 exists, it is automatically run as the last step of the login process.
14643 This is merely for FTP purposes.
14645 .\" }}}
14647 .\" }}}
14650 .\" .Sh EXAMPLES {{{
14651 .Sh EXAMPLES
14653 .\" .Ss "An example configuration" {{{
14654 .Ss "An example configuration"
14656 .Bd -literal -offset indent
14657 # This example assumes v15.0 compatibility mode
14658 set v15-compat
14660 # Request strict TLL transport layer security checks
14661 set tls-verify=strict
14663 # Where are the up-to-date TLS certificates?
14664 # (Since we manage up-to-date ones explicitly, do not use any,
14665 # possibly outdated, default certificates shipped with OpenSSL)
14666 #set tls-ca-dir=/etc/ssl/certs
14667 set tls-ca-file=/etc/ssl/certs/ca-certificates.crt
14668 set tls-ca-no-defaults
14669 #set tls-ca-flags=partial-chain
14670 wysh set smime-ca-file="${tls-ca-file}" \e
14671   smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}"
14673 # This could be outsourced to a central configuration file via
14674 # tls-config-file plus tls-config-module if the used library allows.
14675 # CipherString: explicitly define the list of ciphers, which may
14676 #   improve security, especially with protocols older than TLS v1.2.
14677 #   See ciphers(1).  Possibly best to only use tls-config-pairs-HOST
14678 #   (or -USER@HOST), as necessary, again..
14679 #   Note that TLSv1.3 uses Ciphersuites= instead, which will join
14680 #   with CipherString (if protocols older than v1.3 are allowed)
14681 # Curves: especially with TLSv1.3 curves selection may be desired.
14682 # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.
14683 #   Change this only when the remote server does not support it:
14684 #   maybe use chain support via tls-config-pairs-HOST / -USER@HOST
14685 #   to define such explicit exceptions, then, e.g.,
14686 #     MinProtocol=TLSv1.1
14687 if "$tls-features" =% ,+ctx-set-maxmin-proto,
14688   wysh set tls-config-pairs='\e
14689       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
14690       Curves=P-521:P-384:P-256,\e
14691       MinProtocol=TLSv1.1'
14692 else
14693   wysh set tls-config-pairs='\e
14694       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
14695       Curves=P-521:P-384:P-256,\e
14696       Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2\e, +TLSv1.3'
14697 endif
14699 # Essential setting: select allowed character sets
14700 set sendcharsets=utf-8,iso-8859-1
14702 # A very kind option: when replying to a message, first try to
14703 # use the same encoding that the original poster used herself!
14704 set reply-in-same-charset
14706 # When replying, do not merge From: and To: of the original message
14707 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
14708 set recipients-in-cc
14710 # When sending messages, wait until the Mail-Transfer-Agent finishs.
14711 # Only like this you will be able to see errors reported through the
14712 # exit status of the MTA (including the built-in SMTP one)!
14713 set sendwait
14715 # Only use built-in MIME types, no mime.types(5) files
14716 set mimetypes-load-control
14718 # Default directory where we act in (relative to $HOME)
14719 set folder=mail
14720 # A leading "+" (often) means: under *folder*
14721 # *record* is used to save copies of sent messages
14722 set MBOX=+mbox.mbox DEAD=+dead.txt \e
14723   record=+sent.mbox record-files record-resent
14725 # Make "file mymbox" and "file myrec" go to..
14726 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
14728 # Not really optional, e.g., for S/MIME
14729 set from='Your Name <address@exam.ple>'
14731 # It may be necessary to set hostname and/or smtp-hostname
14732 # if the "SERVER" of mta and "domain" of from do not match.
14733 # The `urlencode' command can be used to encode USER and PASS
14734 set mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \e
14735   smtp-auth=login/plain... \e
14736   smtp-use-starttls
14738 # Never refuse to start into interactive mode, and more
14739 set emptystart \e
14740   colour-pager crt= \e
14741   followup-to followup-to-honour=ask-yes fullnames \e
14742   history-file=+.\*(uAhist history-size=-1 history-gabby \e
14743   mime-counter-evidence=0b1111 \e
14744   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
14745   reply-to-honour=ask-yes \e
14746   umask=
14748 # Only include the selected header fields when typing messages
14749 headerpick type retain from_ date from to cc subject \e
14750   message-id mail-followup-to reply-to
14751 # ...when forwarding messages
14752 headerpick forward retain subject date from to cc
14753 # ...when saving message, etc.
14754 #headerpick save ignore ^Original-.*$ ^X-.*$
14756 # Some mailing lists
14757 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
14758 mlsubscribe '^xfans@xfans\e.xyz$'
14760 # Handle a few file extensions (to store MBOX databases)
14761 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
14762   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
14763   zst 'zstd -dc' 'zstd -19 -zc' \e
14764   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
14766 # A real life example of a very huge free mail provider
14767 # Instead of directly placing content inside `account',
14768 # we `define' a macro: like that we can switch "accounts"
14769 # from within *on-compose-splice*, for example!
14770 define XooglX {
14771   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
14772   set from='Your Name <address@examp.ple>'
14774   set pop3-no-apop-pop.gmXil.com
14775   shortcut pop %:pop3s://pop.gmXil.com
14776   shortcut imap %:imaps://imap.gmXil.com
14777   # Or, entirely IMAP based setup
14778   #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e
14779   #   imap-cache=~/spool/cache
14781   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
14782   # Alternatively:
14783   set mta=smtps://USER:PASS@smtp.gmail.com:465
14785 account XooglX {
14786   \ecall XooglX
14789 # Here is a pretty large one which does not allow sending mails
14790 # if there is a domain name mismatch on the SMTP protocol level,
14791 # which would bite us if the value of from does not match, e.g.,
14792 # for people who have a sXXXXeforge project and want to speak
14793 # with the mailing list under their project account (in from),
14794 # still sending the message through their normal mail provider
14795 define XandeX {
14796   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
14797   set from='Your Name <address@exam.ple>'
14799   shortcut pop %:pop3s://pop.yaXXex.com
14800   shortcut imap %:imaps://imap.yaXXex.com
14802   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
14803     hostname=yaXXex.com smtp-hostname=
14805 account XandeX {
14806   \ecall Xandex
14809 # Create some new commands so that, e.g., `ls /tmp' will..
14810 commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS'
14811 commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS'
14813 set pipe-message/external-body='?* echo $MAILX_EXTERNAL_BODY_URL'
14815 # We do not support gpg(1) directly yet.  But simple --clearsign'd
14816 # message parts can be dealt with as follows:
14817 define V {
14818   localopts yes
14819   wysh set pipe-text/plain=$'?*#++=?\e
14820     < "${MAILX_FILENAME_TEMPORARY}" awk \e
14821         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
14822       BEGIN{done=0}\e
14823       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
14824         if(done++ != 0)\e
14825           next;\e
14826         print "--- GPG --verify ---";\e
14827         system("gpg --verify " TMPFILE " 2>&1");\e
14828         print "--- GPG --verify ---";\e
14829         print "";\e
14830         next;\e
14831       }\e
14832       /^-----BEGIN PGP SIGNATURE-----/,\e
14833           /^-----END PGP SIGNATURE-----/{\e
14834         next;\e
14835       }\e
14836       {print}\e
14837     \e''
14838     print
14840 commandalias V '\e'call V
14844 When storing passwords in
14845 .Pa \*(ur
14846 appropriate permissions should be set on this file with
14847 .Ql $ chmod 0600 \*(ur .
14848 If the \*(OPal
14849 .Va netrc-lookup
14850 is available user credentials can be stored in the central
14851 .Pa \*(VN
14852 file instead; e.g., here is a different version of the example account
14853 that sets up SMTP and POP3:
14855 .Bd -literal -offset indent
14856 define XandeX {
14857   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
14858   set from='Your Name <address@exam.ple>'
14859   set netrc-lookup
14860   # Load an encrypted ~/.netrc by uncommenting the next line
14861   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
14863   set mta=smtps://smtp.yXXXXx.ru:465 \e
14864       smtp-hostname= hostname=yXXXXx.com
14865   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
14866   commandalias xp fi pop3s://pop.yXXXXx.ru
14868 account XandeX {
14869   \ecall XandeX
14874 and, in the
14875 .Pa \*(VN
14876 file:
14878 .Bd -literal -offset indent
14879 machine *.yXXXXx.ru login USER password PASS
14883 This configuration should now work just fine:
14886 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
14887 .\" }}}
14889 .\" .Ss "S/MIME step by step" {{{
14890 .Ss "S/MIME step by step"
14892 \*(OP The first thing that is needed for
14893 .Sx "Signed and encrypted messages with S/MIME"
14894 is a personal certificate, and a private key.
14895 The certificate contains public information, in particular a name and
14896 email address(es), and the public key that can be used by others to
14897 encrypt messages for the certificate holder (the owner of the private
14898 key), and to
14899 .Ic verify
14900 signed messages generated with that certificate('s private key).
14901 Whereas the certificate is included in each signed message, the private
14902 key must be kept secret.
14903 It is used to decrypt messages that were previously encrypted with the
14904 public key, and to sign messages.
14907 For personal use it is recommended to get a S/MIME certificate from
14908 one of the major CAs on the Internet.
14909 Many CAs offer such certificates for free.
14910 Usually offered is a combined certificate and private key in PKCS#12
14911 format which \*(UA does not accept directly.
14912 To convert it to PEM format, the following shell command can be used;
14913 please read on for how to use these PEM files.
14915 .Bd -literal -offset indent
14916 $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes
14917 $ # Alternatively
14918 $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys
14919 $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes
14923 There is also
14924 .Lk https://www.CAcert.org
14925 which issues client and server certificates to members of their
14926 community for free; their root certificate
14927 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
14928 is often not in the default set of trusted CA root certificates, though,
14929 which means their root certificate has to be downloaded separately,
14930 and needs to be part of the S/MIME certificate validation chain by
14931 including it in
14932 .Va smime-ca-dir
14933 or as a vivid member of the
14934 .Va smime-ca-file .
14935 But let us take a step-by-step tour on how to setup S/MIME with
14936 a certificate from CAcert.org despite this situation!
14939 First of all you will have to become a member of the CAcert.org
14940 community, simply by registrating yourself via the web interface.
14941 Once you are, create and verify all email addresses you want to be able
14942 to create signed and encrypted messages for/with using the corresponding
14943 entries of the web interface.
14944 Now ready to create S/MIME certificates, so let us create a new
14945 .Dq client certificate ,
14946 ensure to include all email addresses that should be covered by the
14947 certificate in the following web form, and also to use your name as the
14948 .Dq common name .
14951 Create a private key and a certificate request on your local computer
14952 (please see the manual pages of the used commands for more in-depth
14953 knowledge on what the used arguments etc. do):
14956 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
14959 Afterwards copy-and-paste the content of
14960 .Dq creq.pem
14961 into the certificate-request (CSR) field of the web form on the
14962 CAcert.org website (you may need to unfold some
14963 .Dq advanced options
14964 to see the corresponding text field).
14965 This last step will ensure that your private key (which never left your
14966 box) and the certificate belong together (through the public key that
14967 will find its way into the certificate via the certificate-request).
14968 You are now ready and can create your CAcert certified certificate.
14969 Download and store or copy-and-paste it as
14970 .Dq pub.crt .
14973 Yay.
14974 In order to use your new S/MIME setup a combined private key/public key
14975 (certificate) file has to be created:
14978 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
14981 This is the file \*(UA will work with.
14982 If you have created your private key with a passphrase then \*(UA will
14983 ask you for it whenever a message is signed or decrypted, unless this
14984 operation has been automated as described in
14985 .Sx "Signed and encrypted messages with S/MIME" .
14986 Set the following variables to henceforth use S/MIME (setting
14987 .Va smime-ca-file
14988 is of interest for verification only):
14990 .Bd -literal -offset indent
14991 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
14992     smime-sign-cert=ME@HERE.com.paired \e
14993     smime-sign-digest=SHA512 \e
14994     smime-sign from=myname@my.host
14997 .\" }}}
14999 .\" .Ss "Using CRLs with S/MIME or TLS" {{{
15000 .Ss "Using CRLs with S/MIME or TLS"
15002 \*(OP Certification authorities (CAs) issue certificate revocation
15003 lists (CRLs) on a regular basis.
15004 These lists contain the serial numbers of certificates that have been
15005 declared invalid after they have been issued.
15006 Such usually happens because the private key for the certificate has
15007 been compromised,
15008 because the owner of the certificate has left the organization that is
15009 mentioned in the certificate, etc.
15010 To seriously use S/MIME or TLS verification,
15011 an up-to-date CRL is required for each trusted CA.
15012 There is otherwise no method to distinguish between valid and
15013 invalidated certificates.
15014 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
15015 the Internet, so they have to be retrieved by some external mechanism.
15018 \*(UA accepts CRLs in PEM format only;
15019 CRLs in DER format must be converted, like, e.\|g.:
15022 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
15025 To tell \*(UA about the CRLs, a directory that contains all CRL files
15026 (and no other files) must be created.
15028 .Va smime-crl-dir
15030 .Va tls-crl-dir
15031 variables, respectively, must then be set to point to that directory.
15032 After that, \*(UA requires a CRL to be present for each CA that is used
15033 to verify a certificate.
15034 .\" }}}
15036 .\" }}} (Examples)
15039 .\" .Sh "FAQ" {{{
15040 .Sh "FAQ"
15042 In general it is a good idea to turn on
15043 .Va debug
15044 .Pf ( Fl d )
15045 and / or
15046 .Va verbose
15047 .Pf ( Fl v ,
15048 twice) if something does not work well.
15049 Very often a diagnostic message can be produced that leads to the
15050 problems' solution.
15052 .\" .Ss "\*(UA shortly hangs on startup" {{{
15053 .Ss "\*(UA shortly hangs on startup"
15055 This can have two reasons, one is the necessity to wait for a file lock
15056 and cannot be helped, the other being that \*(UA calls the function
15057 .Xr uname 2
15058 in order to query the nodename of the box (sometimes the real one is
15059 needed instead of the one represented by the internal variable
15060 .Va hostname ) .
15061 One may have varying success by ensuring that the real hostname and
15062 .Ql localhost
15063 have entries in
15064 .Pa /etc/hosts ,
15065 or, more generally, that the name service is properly setup \(en
15066 and does
15067 .Xr hostname 1
15068 return the expected value?
15069 Does this local hostname have a domain suffix?
15070 RFC 6762 standardized the link-local top-level domain
15071 .Ql .local ,
15072 try again after adding an (additional) entry with this extension.
15073 .\" }}}
15075 .\" .Ss "I cannot login to Google mail (via OAuth)" {{{
15076 .Ss "I cannot login to Google mail \&(via OAuth\&)"
15078 Since 2014 some free service providers classify programs as
15079 .Dq less secure
15080 unless they use a special authentication method (OAuth 2.0) which
15081 was not standardized for non-HTTP protocol authentication token query
15082 until August 2015 (RFC 7628).
15085 Different to Kerberos / GSSAPI, which is developed since the mid of the
15086 1980s, where a user can easily create a local authentication ticket for
15087 her- and himself with the locally installed
15088 .Xr kinit 1
15089 program, that protocol has no such local part but instead requires
15090 a world-wide-web query to create or fetch a token; since there is no
15091 local cache this query would have to be performed whenever \*(UA is
15092 invoked (in interactive sessions situation may differ).
15095 \*(UA does not directly support OAuth.
15096 It, however, supports XOAUTH2 / OAUTHBEARER, see
15097 .Sx "But, how about XOAUTH2 / OAUTHBEARER?"
15098 If that is not used it is necessary to declare \*(UA a
15099 .Dq less secure app
15100 (on the providers account web page) in order to read and send mail.
15101 However, it also seems possible to take the following steps instead:
15104 .Bl -enum -compact
15106 give the provider the number of a mobile phone,
15108 enable
15109 .Dq 2-Step Verification ,
15111 create an application specific password (16 characters), and
15113 use that special password instead of the real Google account password in
15114 \*(UA (for more on that see the section
15115 .Sx "On URL syntax and credential lookup" ) .
15117 .\" }}}
15119 .\" .Ss "But, how about XOAUTH2 / OAUTHBEARER?" {{{
15120 .Ss "But, how about XOAUTH2 / OAUTHBEARER?"
15122 Following up
15123 .Sx "I cannot login to Google mail \&(via OAuth\&)"
15124 one OAuth-based authentication method is available:
15125 the OAuth 2.0 bearer token usage as standardized in RFC 6750 (according
15126 SASL mechanism in RFC 7628), also known as XOAUTH2 and OAUTHBEARER,
15127 allows fetching a temporary access token via the web that can locally be
15128 used as a
15129 .Va password .
15130 The protocol is simple and extendable, token updates or even password
15131 changes via a simple TLS secured server login would be possible in
15132 theory, but today a web browser and an external support tool are
15133 prerequisites for using this authentication method.
15134 The token times out and must be periodically refreshed via the web.
15137 Some hurdles must be taken before being able to use this method.
15138 Using GMail as an example, an application (that is a name) must be
15139 registered, for which credentials, a
15140 .Dq client ID
15141 and a
15142 .Dq client secret ,
15143 need to be created and saved locally (in a secure way).
15144 These initial configuration steps can be performed at
15145 .Lk https://console.developers.google.com/apis/credentials .
15146 Thereafter a refresh token can be requested;
15147 a python program to do this for GMail accounts is
15148 .Lk https://github.com/google/\:gmail-oauth2-tools/\:raw/\:\
15149 master/\:python/\:oauth2.py :
15151 .Bd -literal -offset indent
15152 $ python oauth2.py --user=EMAIL \e
15153   --client-id=THE-ID --client-secret=THE-SECRET \e
15154   --generate_oauth2_token
15155 To authorize token, visit this url and follow the directions:
15156   https://accounts.google.com/o/oauth2/auth?client_id=...
15157   Enter verification code: ...
15158   Refresh Token: ...
15159   Access Token: ...
15160   Access Token Expiration Seconds: 3600
15161 $ # Of which the last three are actual token responses.
15162 $ # Thereafter access tokens can regularly be refreshed
15163 $ # via the created refresh token (read on)
15167 The generated refresh token must also be saved locally (securely).
15168 The procedure as a whole can be read at
15169 .Lk https://github.com/google/\:gmail-oauth2-tools/\:wiki/\:\
15170 OAuth2DotPyRunThrough .
15171 Since periodic timers are not yet supported, keeping an access token
15172 up-to-date (from within \*(UA) can only be performed via the hook
15173 .Va on-main-loop-tick ,
15174 or (for sending only)
15175 .Va on-compose-enter
15176 (for more on authentication please see the section
15177 .Sx "On URL syntax and credential lookup" ) :
15179 .Bd -literal -offset indent
15180 set on-main-loop-tick=o-m-l-t on-compose-enter=o-c-e
15181 define o-m-l-t {
15182   xcall update_access_token
15184 define o-c-e {
15185   xcall update_access_token
15188 set access_token_=0
15189 define update_access_token {
15190   local set i epoch_sec epoch_nsec
15191   vput vexpr i epoch
15192   eval set $i # set epoch_sec/_nsec of vexpr epoch
15193   vput vexpr i + $access_token_ 2100
15194   if $epoch_sec -ge $i
15195     vput ! password python oauth2.py --user=EMAIL \e
15196         --client-id=THE-ID --client-secret=THE-SECRET \e
15197         --refresh-token=THE-REFRESH-TOKEN |\e
15198       sed '1b PASS;d; :PASS s/^.\e{1,\e}:\e(.\e{1,\e}\e)$/\e1/'
15199     vput csop password trim "$password"
15200     if -n "$verbose"
15201       echo password is <$password>
15202     endif
15203     set access_token_=$epoch_sec
15204   endif
15207 .\" }}}
15209 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{ review
15210 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
15212 Two thinkable situations: the first is a shadowed sequence; setting
15213 .Va debug ,
15214 or the most possible
15215 .Va verbose
15216 mode, causes a printout of the
15217 .Ic bind
15218 tree after that is built; being a cache, this happens only upon startup
15219 or after modifying bindings.
15222 Or second, terminal libraries (see
15223 .Sx "On terminal control and line editor",
15224 .Ic bind ,
15225 .Va termcap )
15226 may report different codes than the terminal really sends, rendering
15227 bindings dysfunctional because expected and received data do not match; the
15228 .Va verbose
15229 listing of
15230 .Ic bind Ns
15231 ings will show the byte sequences that are expected.
15232 (One common source of problems is that the \(em possibly even
15233 non-existing \(em keypad is not turned on, and the resulting layout
15234 reports the keypad control codes for the normal keyboard keys.)
15237 To overcome the situation use for example the program
15238 .Xr cat 1
15239 with its option
15240 .Fl \&\&v ,
15241 if available, to see the byte sequences which are actually produced
15242 by keypresses, and use the variable
15243 .Va termcap
15244 to make \*(UA aware of them.
15245 The terminal this is typed on produces some unexpected sequences,
15246 here for an example the shifted home key:
15248 .Bd -literal -offset indent
15249 ? set verbose
15250 ? bind*
15251 # 1B 5B=[ 31=1 3B=; 32=2 48=H
15252   bind base :kHOM z0
15253 ? x
15254 $ cat -v
15255 ^[[H
15256 $ \*(uA -v -Stermcap='kHOM=\eE[H'
15257 ? bind*
15258 # 1B 5B=[ 48=H
15259   bind base :kHOM z0
15261 .\" }}}
15263 .\" .Ss "Can \*(UA git-send-email?" {{{
15264 .Ss "Can \*(UA git-send-email?"
15266 Yes.
15267 Put (at least parts of) the following in your
15268 .Pa ~/.gitconfig :
15270 .Bd -literal -offset indent
15271 [sendemail]
15272 smtpserver = /usr/bin/\*(uA
15273 smtpserveroption = -t
15274 #smtpserveroption = -Sexpandaddr
15275 smtpserveroption = -Athe-account-you-need
15277 suppresscc = all
15278 suppressfrom = false
15279 assume8bitEncoding = UTF-8
15280 #to = /tmp/OUT
15281 confirm = always
15282 chainreplyto = true
15283 multiedit = false
15284 thread = true
15285 quiet = true
15286 annotate = true
15290 Newer
15291 .Xr git 1
15292 versions (v2.33.0) added the option
15293 .Cm sendmailCmd .
15294 Patches can also be send directly, for example:
15296 .Bd -literal -offset indent
15297 $ git format-patch -M --stdout HEAD^ |
15298   \*(uA -A the-account-you-need -t RECEIVER
15300 .\" }}}
15302 .\" .Ss "Howto handle stale dotlock files" {{{
15303 .Ss "Howto handle stale dotlock files"
15305 .Ic folder
15306 sometimes fails to open MBOX mail databases because creation of
15307 .Mx -sx
15308 .Sx "dotlock files"
15309 is impossible due to existing but unowned lock files.
15310 \*(UA does not offer an option to deal with those files, because it is
15311 considered a site policy what counts as unowned, and what not.
15312 The site policy is usually defined by administrator(s), and expressed in
15313 the configuration of a locally installed MTA (for example Postfix
15314 .Ql stale_lock_time=500s ) .
15315 Therefore the suggestion:
15317 .Bd -literal -offset indent
15318 $ </dev/null \*(uA -s 'MTA: be no frog, handle lock' $LOGNAME
15322 By sending a mail to yourself the local MTA can use its normal queue
15323 mechanism to try the delivery multiple times, finally decide a lock file
15324 has become stale, and remove it.
15325 .\" }}}
15327 .\" }}}
15330 .\" .Sh "IMAP CLIENT" {{{
15331 .Sh "IMAP CLIENT"
15333 \*(OPally there is IMAP client support available.
15334 This part of the program is obsolete and will vanish in v15 with the
15335 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
15336 and makes excessive use of signal based long code jumps.
15337 Support can hopefully be readded later based on a new-style I/O, with
15338 SysV signal handling.
15339 In fact the IMAP support had already been removed from the codebase, but
15340 was reinstantiated on user demand: in effect the IMAP code is at the
15341 level of \*(UA v14.8.16 (with
15342 .Ic imapcodec
15343 being the sole exception), and should be treated with some care.
15346 IMAP uses the
15347 .Ql imap://
15349 .Ql imaps://
15350 protocol prefixes, and an IMAP-based
15351 .Va folder
15352 may be used.
15353 IMAP URLs (paths) undergo inspections and possible transformations
15354 before use (and the command
15355 .Ic imapcodec
15356 can be used to manually apply them to any given argument).
15357 Hierarchy delimiters are normalized, a step which is configurable via the
15358 .Va imap-delim
15359 variable chain, but defaults to the first seen delimiter otherwise.
15360 \*(UA supports internationalised IMAP names, and en- and decodes the
15361 names from and to the
15362 .Va ttycharset
15363 as necessary and possible.
15364 If a mailbox name is expanded (see
15365 .Sx "Filename transformations" )
15366 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
15367 mailboxes below the
15368 .Va folder
15369 target box, while folder names prefixed by `@' refer to folders below
15370 the hierarchy base, so the following will list all folders below the
15371 current one when in an IMAP mailbox:
15372 .Ql folders @ .
15375 Note: some IMAP servers do not accept the creation of mailboxes in
15376 the hierarchy base, but require that they are created as subfolders of
15377 `INBOX' \(en with such servers a folder name of the form
15379 .Dl imaps://mylogin@imap.myisp.example/INBOX.
15381 should be used (the last character is the server's hierarchy
15382 delimiter).
15383 The following IMAP-specific commands exist:
15386 .Bl -tag -width ".It Ic BaNg"
15388 .It Ic cache
15389 Only applicable to cached IMAP mailboxes;
15390 takes a message list and reads the specified messages into the IMAP
15391 cache.
15394 .It Ic connect
15395 If operating in disconnected mode on an IMAP mailbox,
15396 switch to online mode and connect to the mail server while retaining
15397 the mailbox status.
15398 See the description of the
15399 .Va disconnected
15400 variable for more information.
15403 .It Ic disconnect
15404 If operating in online mode on an IMAP mailbox,
15405 switch to disconnected mode while retaining the mailbox status.
15406 See the description of the
15407 .Va disconnected
15408 variable for more.
15409 A list of messages may optionally be given as argument;
15410 the respective messages are then read into the cache before the
15411 connection is closed, thus
15412 .Ql disco *
15413 makes the entire mailbox available for disconnected use.
15416 .It Ic imap
15417 Sends command strings directly to the current IMAP server.
15418 \*(UA operates always in IMAP `selected state' on the current mailbox;
15419 commands that change this will produce undesirable results and should be
15420 avoided.
15421 Useful IMAP commands are:
15422 .Bl -tag -offset indent -width ".Ic getquotearoot"
15423 .It create
15424 Takes the name of an IMAP mailbox as an argument and creates it.
15425 .It getquotaroot
15426 (RFC 2087) Takes the name of an IMAP mailbox as an argument
15427 and prints the quotas that apply to the mailbox.
15428 Not all IMAP servers support this command.
15429 .It namespace
15430 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
15431 the Other User's Namespaces and the Shared Namespaces.
15432 Each namespace type is printed in parentheses;
15433 if there are multiple namespaces of the same type,
15434 inner parentheses separate them.
15435 For each namespace a prefix and a hierarchy separator is listed.
15436 Not all IMAP servers support this command.
15440 .It Ic imapcodec
15441 Perform IMAP path transformations.
15442 Supports
15443 .Cm vput
15444 (see
15445 .Sx "Command modifiers" ) ,
15446 and manages the error number
15447 .Va \&! .
15448 The first argument specifies the operation:
15449 .Ar e[ncode]
15450 normalizes hierarchy delimiters (see
15451 .Va imap-delim )
15452 and converts the strings from the locale
15453 .Va ttycharset
15454 to the internationalized variant used by IMAP,
15455 .Ar d[ecode]
15456 performs the reverse operation.
15457 Encoding will honour the (global) value of
15458 .Va imap-delim .
15463 The following IMAP-specific internal variables exist:
15466 .Bl -tag -width ".It Va BaNg"
15468 .It Va disconnected
15469 \*(BO When an IMAP mailbox is selected and this variable is set,
15470 no connection to the server is initiated.
15471 Instead, data is obtained from the local cache (see
15472 .Va imap-cache Ns
15474 Mailboxes that are not present in the cache
15475 and messages that have not yet entirely been fetched from the server
15476 are not available;
15477 to fetch all messages in a mailbox at once,
15478 the command
15479 .No ` Ns Li copy * /dev/null Ns '
15480 can be used while still in connected mode.
15481 Changes that are made to IMAP mailboxes in disconnected mode are queued
15482 and committed later when a connection to that server is made.
15483 This procedure is not completely reliable since it cannot be guaranteed
15484 that the IMAP unique identifiers (UIDs) on the server still match the
15485 ones in the cache at that time.
15486 Data is saved to
15487 .Ev DEAD
15488 when this problem occurs.
15490 .It Va disconnected-USER@HOST
15491 The specified account is handled as described for the
15492 .Va disconnected
15493 variable above,
15494 but other accounts are not affected.
15496 .Mx Va imap-auth
15497 .It Va imap-auth-USER@HOST , imap-auth
15498 Sets the IMAP authentication method.
15499 Supported are the default
15500 .Ql login
15501 (called
15502 .Ql plain
15503 by some servers),
15504 \*(IN
15505 .Ql oauthbearer
15506 (see
15507 .Sx FAQ
15508 entry
15509 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) ,
15510 \*(IN
15511 .Ql external
15513 .Ql externanon
15514 (for TLS secured connections which pass a client certificate via
15515 .Va tls-config-pairs ) ,
15516 as well as the \*(OPal
15517 .Ql cram-md5
15519 .Ql gssapi .
15520 All methods need a
15521 .Va user
15522 and a
15523 .Va password
15524 except
15525 .Ql gssapi
15527 .Ql external ,
15528 which only need the former.
15529 .Ql externanon
15530 solely builds upon the credentials passed via a client certificate,
15531 and is usually the way to go since tested servers do not actually follow
15532 RFC 4422, and fail if additional credentials are actually passed.
15535 .It Va imap-cache
15536 Enables caching of IMAP mailboxes.
15537 The value of this variable must point to a directory that is either
15538 existent or can be created by \*(UA.
15539 All contents of the cache can be deleted by \*(UA at any time;
15540 it is not safe to make assumptions about them.
15542 .Mx Va imap-delim
15543 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
15544 The hierarchy separator used by the IMAP server.
15545 Whenever an IMAP path is specified it will undergo normalization.
15546 One of the normalization steps is the squeezing and adjustment of
15547 hierarchy separators.
15548 If this variable is set, any occurrence of any character of the given
15549 value that exists in the path will be replaced by the first member of
15550 the value; an empty value will cause the default to be used, it is
15551 .Ql /. .
15552 If not set, we will reuse the first hierarchy separator character that
15553 is discovered in a user-given mailbox name.
15555 .Mx Va imap-keepalive
15556 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
15557 IMAP servers may close the connection after a period of
15558 inactivity; the standard requires this to be at least 30 minutes,
15559 but practical experience may vary.
15560 Setting this variable to a numeric `value' greater than 0 causes
15561 a `NOOP' command to be sent each `value' seconds if no other operation
15562 is performed.
15565 .It Va imap-list-depth
15566 When retrieving the list of folders on an IMAP server, the
15567 .Ic folders
15568 command stops after it has reached a certain depth to avoid possible
15569 infinite loops.
15570 The value of this variable sets the maximum depth allowed.
15571 The default is 2.
15572 If the folder separator on the current IMAP server is a slash `/',
15573 this variable has no effect and the
15574 .Ic folders
15575 command does not descend to subfolders.
15577 .Mx Va imap-use-starttls
15578 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
15579 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
15580 IMAP session TLS encrypted.
15581 This functionality is not supported by all servers,
15582 and is not used if the session is already encrypted by the IMAPS method.
15585 .\" }}}
15588 .\" .Sh "SEE ALSO" {{{
15589 .Sh "SEE ALSO"
15591 .Xr bogofilter 1 ,
15592 .Xr gpg 1 ,
15593 .Xr more 1 ,
15594 .Xr newaliases 1 ,
15595 .Xr openssl 1 ,
15596 .Xr sendmail 1 ,
15597 .Xr sh 1 ,
15598 .Xr spamassassin 1 ,
15599 .Xr iconv 3 ,
15600 .Xr setlocale 3 ,
15601 .Xr aliases 5 ,
15602 .Xr termcap 5 ,
15603 .Xr terminfo 5 ,
15604 .Xr locale 7 ,
15605 .Xr mailaddr 7 ,
15606 .Xr re_format 7
15607 .Pf (or\0 Xr regex 7 ) ,
15608 .Xr mailwrapper 8 ,
15609 .Xr sendmail 8
15611 .\" }}}
15614 .\" .Sh HISTORY {{{
15615 .Sh HISTORY
15617 M. Douglas McIlroy writes in his article
15618 .Dq A Research UNIX Reader: Annotated Excerpts \
15619 from the Programmer's Manual, 1971-1986
15620 that a
15621 .Xr mail 1
15622 command already appeared in First Edition
15624 in 1971:
15626 .Bd -ragged -offset indent
15627 Electronic mail was there from the start.
15628 Never satisfied with its exact behavior, everybody touched it at one
15629 time or another: to assure the safety of simultaneous access, to improve
15630 privacy, to survive crashes, to exploit uucp, to screen out foreign
15631 freeloaders, or whatever.
15632 Not until v7 did the interface change (Thompson).
15633 Later, as mail became global in its reach, Dave Presotto took charge and
15634 brought order to communications with a grab-bag of external networks
15635 (v8).
15640 Mail, in large parts compatible with
15642 mail, was written in 1978 by Kurt Shoens and developed as part of the
15645 distribution until 1995.
15646 This manual page is derived from
15647 .Dq The Mail Reference Manual
15648 that Kurt Shoens wrote for Mail 1.3, included in 3BSD in 1980.
15649 The common
15653 denominator became standardized as
15654 .Xr mailx 1
15655 in the X/Open Portability Guide Issue 2 (January 1987).
15656 After the rise of Open Source
15658 variants
15659 Mail saw continuous development in the individual code forks,
15660 noticeably by Christos Zoulas in
15661 .Pf Net Bx .
15662 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
15663 Ritter in the years 2000 until 2008.
15664 Since 2012 S-nail is maintained by Steffen Nurpmeso.
15667 Electronic mail exchange in general is a concept even older.
15668 The earliest well documented electronic mail system was part of the
15669 Compatible Time Sharing System (CTSS) at MIT, its MAIL command had been
15670 proposed in a staff planning memo at the end of 1964 and was implemented
15671 in mid-1965 when Tom Van Vleck and Noel Morris wrote the necessary code.
15672 Similar communication programs were built for other timesharing systems.
15673 One of the most ambitious and influential was Murray Turoff's EMISARI.
15674 Created in 1971 for the United States Office of Emergency Preparedness,
15675 EMISARI combined private electronic messages with a chat system, public
15676 postings, voting, and a user directory.
15679 During the 1960s it was common to connect a large number of terminals to
15680 a single, central computer.
15681 Connecting two computers together was relatively unusual.
15682 This began to change with the development of the ARPANET, the ancestor
15683 of today's Internet.
15684 In 1971 Ray Tomlinson adapted the SNDMSG program, originally developed
15685 for the University of California at Berkeley timesharing system, to give
15686 it the ability to transmit a message across the network into the mailbox
15687 of a user on a different computer.
15688 For the first time it was necessary to specify the recipient's computer
15689 as well as an account name.
15690 Tomlinson decided that the underused commercial at
15691 .Ql @
15692 would work to separate the two.
15695 Sending a message across the network was originally treated as a special
15696 instance of transmitting a file, and so a MAIL command was included in
15697 RFC 385 on file transfer in 1972.
15698 Because it was not always clear when or where a message had come from,
15699 RFC 561 in 1973 aimed to formalize electronic mail headers, including
15700 .Dq from ,
15701 .Dq date ,
15703 .Dq subject .
15704 In 1975 RFC 680 described fields to help with the transmission of
15705 messages to multiple users, including
15706 .Dq to ,
15707 .Dq cc ,
15709 .Dq bcc .
15710 In 1977 these features and others went from best practices to a binding
15711 standard in RFC 733.
15712 Queen Elizabeth II of England became the first head of state to send
15713 electronic mail on March 26 1976 while ceremonially opening a building
15714 in the British Royal Signals and Radar Establishment (RSRE) in Malvern.
15715 .\" }}}
15718 .Sh AUTHORS
15720 .An -nosplit
15721 .An "Kurt Shoens" ,
15722 .An "Edward Wang" ,
15723 .An "Keith Bostic" ,
15724 .An "Christos Zoulas" ,
15725 .An "Gunnar Ritter" .
15726 \*(UA is developed by
15727 .An "Steffen Nurpmeso" Aq s-mailx@lists.sdaoden.eu .
15730 .\" .Sh CAVEATS {{{
15731 .Sh CAVEATS
15733 \*(ID Interrupting an operation via
15734 .Dv \&\&SIGINT
15736 .Ql control-C
15737 from anywhere else but a command prompt is very problematic and likely
15738 to leave the program in an undefined state: many library functions
15739 cannot deal with the
15740 .Fn siglongjmp 3
15741 that this software (still) performs; even though efforts have been taken
15742 to address this, no sooner but in v15 it will have been worked out:
15743 interruptions have not been disabled in order to allow forceful breakage
15744 of hanging network connections, for example (all this is unrelated to
15745 .Va ignore ) .
15748 The SMTP and POP3 protocol support of \*(UA is very basic.
15749 Also, if it fails to contact its upstream SMTP server, it will not make
15750 further attempts to transfer the message at a later time (setting
15751 .Va save
15753 .Va sendwait
15754 may be useful).
15755 If this is a concern, it might be better to set up a local SMTP server
15756 that is capable of message queuing.
15758 .\" }}}
15761 .Sh BUGS
15763 When a network-based mailbox is open, directly changing to another
15764 network-based mailbox of a different protocol (i.e., from POP3 to IMAP
15765 or vice versa) will cause a
15766 .Dq deadlock .
15769 After deleting some message of a POP3 mailbox the header summary falsely
15770 claims that there are no messages to display, one needs to perform
15771 a scroll or dot movement to restore proper state.
15775 .Ql thread Ns
15777 .Ic sort
15778 mode a power user may encounter crashes very occasionally (this is may
15779 and very).
15782 Please report bugs to the
15783 .Va contact-mail
15784 address, for example from within \*(uA:
15785 .\" v15-compat: drop eval as `mail' will expand variable?
15786 .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
15787 Including the
15788 .Va verbose
15789 output of the command
15790 .Ic version
15791 may be helpful:
15793 .Bd -literal -offset indent
15794 ? wysh set escape=! verbose; vput version xy; unset verbose;\e
15795   eval mail $contact-mail
15796 Bug subject
15797 !I xy
15802 Information on the web at
15803 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ; x' .
15805 .\" s-ts-mode