Bump S-nail v14.9.18 ("It is spring time, what a bliss"), 2020-04-18
[s-mailx.git] / nail.1
blobea8e5ed88a2e377a1c204c83cebf8a3aa2dedeef
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.18 / 2020-04-18
20 .Dd April 18, 2020
21 .ds VV \\%v14.9.18
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 .\"
48 .if !d str-Lb-libterminfo \
49   .ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo)
51 .Dt "\*(UU" 1
52 .Os
53 .Mx -enable
56 .Sh NAME
57 .Nm \*(UA \%[\*(VV]
58 .Nd send and receive Internet mail
61 .\" .Sh SYNOPSIS {{{
62 .Sh SYNOPSIS
64 .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
65 .Nm \*(uA
66 .Bk -words
67 .Op Fl DdEFinv~#
68 .Op Fl \&: Ar spec
69 .Op Fl A Ar account
70 .Op : Ns Fl a Ar attachment Ns \&:
71 .Op : Ns Fl b Ar bcc-addr Ns \&:
72 .Op : Ns Fl C Ar """field:\0body""" Ns \&:
73 .Op : Ns Fl c Ar cc-addr Ns \&:
74 .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
75 .Op Fl r Ar from-addr
76 .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
77 .Op Fl s Ar subject
78 .Op : Ns Fl T Ar """field:\0addr""" Ns \&:
79 .Op : Ns Fl X Ar cmd Ns \&:
80 .Op : Ns Fl Y Ar cmd Ns \&:
81 .Op Fl \&.
82 .Pf : Ar to-addr Ns \&:
83 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
84 .Ek
85 .Pp
86 .Nm \*(uA
87 .Bk -words
88 .Op Fl DdEeHiNnRv~#
89 .Op Fl \&: Ar spec
90 .Op Fl A Ar account
91 .Op : Ns Fl C Ar """field:\0body""" Ns \&:
92 .Op Fl L Ar spec
93 .Op Fl r Ar from-addr
94 .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
95 .Op Fl u Ar user
96 .Op : Ns Fl X Ar cmd Ns \&:
97 .Op : Ns Fl Y Ar cmd Ns \&:
98 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
99 .Ek
100 .Nm \*(uA
101 .Bk -words
102 .Op Fl DdEeHiNnRv~#
103 .Op Fl \&: Ar spec
104 .Op Fl A Ar account
105 .Op : Ns Fl C Ar """field:\0body""" Ns \&:
106 .Fl f
107 .Op Fl L Ar spec
108 .Op Fl r Ar from-addr
109 .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
110 .Op : Ns Fl X Ar cmd Ns \&:
111 .Op : Ns Fl Y Ar cmd Ns \&:
112 .Op Ar file
113 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
116 .Nm \*(uA
117 .Fl h | Fl Fl help
118 .Nm \*(uA
119 .Fl V | Fl Fl version
121 .\" }}}
124 .Mx -toc -tree html pdf ps xhtml
127 .\" .Sh DESCRIPTION {{{
128 .Sh DESCRIPTION
130 .Bd -filled -compact -offset indent
131 .Sy Note:
132 S-nail (\*(UA) will see major changes in v15.0 (circa 2020).
133 Some backward incompatibilities cannot be avoided.
134 .Sx COMMANDS
135 change to
136 .Sx "Shell-style argument quoting" ,
137 and shell metacharacters will become (more) meaningful.
138 Some commands accept new syntax today via
139 .Cm wysh
140 .Pf ( Sx "Command modifiers" ) .
141 Behaviour is flagged \*(IN and \*(OU,
142 .Ic set Ns
143 ting
144 .Va v15-compat
145 .Pf ( Sx "INTERNAL VARIABLES" )
146 will choose new behaviour when applicable;
147 giving it a value makes
148 .Cm wysh
149 an implied default.
150 \*(OB flags what will vanish.
152 .Sy Warning!
153 .Va v15-compat
154 (with value) will be a default in v14.10.0!
158 \*(UA provides a simple and friendly environment for sending and
159 receiving mail.
160 It is intended to provide the functionality of the POSIX
161 .Xr mailx 1
162 command, but is MIME capable and optionally offers extensions for
163 line editing, S/MIME, SMTP and POP3, among others.
164 \*(UA divides incoming mail into its constituent messages and allows
165 the user to deal with them in any order.
166 It offers many
167 .Sx COMMANDS
169 .Sx "INTERNAL VARIABLES"
170 for manipulating messages and sending mail.
171 It provides the user simple editing capabilities to ease the composition
172 of outgoing messages, and increasingly powerful and reliable
173 non-interactive scripting capabilities.
175 .\" .Ss "Options" {{{
176 .Ss "Options"
178 .Bl -tag -width ".It Fl BaNg"
180 .It Fl \&: Ar spec , Fl Fl resource-files Ns =..
181 Explicitly control which of the
182 .Sx "Resource files"
183 shall be
184 .Ic source Ns
185 d (loaded): if the letter
186 .Ql s
187 is (case-insensitively) part of
188 .Ar spec
189 then the system wide
190 .Pa \*(UR
191 is sourced,
192 .Ql u
193 controls sourcing of the user's personal file
194 .Pa \*(ur .
195 The (original, unmodified) system resource file content is also
196 available in the binary itself, and can be sourced without accessing
197 the filesystem via
198 .Ql x .
199 The letters
200 .Ql -
202 .Ql /
203 explicitly forbid sourcing of any resource files.
204 The default is
205 .Ql su .
207 Scripts should use this option: to avoid environmental noise they should
208 .Dq detach
209 from any configuration and create a script-specific environment, setting
210 any of the desired
211 .Sx "INTERNAL VARIABLES"
213 .Fl S
214 and running configurating commands via
215 .Fl X .
216 This option overrides
217 .Fl n .
220 .It Fl A Ar name , Fl Fl account Ns =..
221 Executes an
222 .Ic account
223 command for the given user email account
224 .Ar name
225 after program startup is complete (all resource files are loaded, any
226 .Fl S
227 setting is being established, but
228 .Fl X
229 commands have not been evaluated yet).
230 Being a special incarnation of
231 .Ic define Ns d
232 macros for the purpose of bundling longer-lived
233 .Ic set Ns
234 tings, activating such an email account also switches to the accounts
235 .Mx -sx
236 .Sx "primary system mailbox"
237 (most likely the
238 .Va inbox ) .
239 If the operation fails the program will exit if it is used
240 non-interactively, or if any of
241 .Va errexit
243 .Va posix
244 are set.
247 .It Fl a Ar file Ns Oo Ar =input-charset Ns Oo Ar #output-charset Oc Oc , \
248   Fl Fl attach Ns =..
249 Attach
250 .Ar file
251 to the message (for compose mode opportunities refer to
252 .Ic ~@
254 .Ic ~^ ) ,
255 after applying tilde expansion (see
256 .Sx "Filename transformations"
258 .Ic folder ) .
259 Shall
260 .Ar file
261 not be accessible but contain a
262 .Ql =
263 character, then anything before the last
264 .Ql =
265 will be used as the filename, anything thereafter as a character set
266 specification.
268 If an input character set is specified,
269 .Mx -ix "character set specification"
270 but no output character set, then the given input character set is fixed
271 as-is, and no conversion will be applied;
272 giving the empty string or the special string hyphen-minus
273 .Ql -
274 will be treated as if
275 .Va ttycharset
276 has been specified (the default).
278 If an output character set has also been given then the conversion will
279 be performed exactly as specified and on-the-fly, not considering the
280 file type and content.
281 As an exception the empty string or hyphen-minus
282 .Ql -
283 select the default conversion algorithm (see
284 .Sx "Character sets" ) :
285 no conversion is performed on-the-fly,
286 .Ar file
287 and its contents will be MIME-classified
288 .Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files") ;
289 Only this mode is available unless character set conversion is supported
290 .Pf ( Va features
291 includes
292 .Ql +iconv ) .
294 .It Fl B
295 (\*(OB: \*(UA will always use line-buffered output, to gain
296 line-buffered input even in batch mode enable batch mode via
297 .Fl # . )
300 .It Fl b Ar addr , Fl Fl bcc Ns =..
301 Send a blind carbon copy to recipient
302 .Ar addr ,
303 if the
304 .Ic set Ns
305 ting of
306 .Va expandaddr ,
307 one of the
308 .Sx "INTERNAL VARIABLES" ,
309 allows; the
310 .Ql shquote
311 .Va expandaddr
312 flag is supported.
313 The option may be used multiple times.
314 Also see the section
315 .Sx "On sending mail, and non-interactive mode" .
318 .It Fl C Ar """field: body""" , Fl Fl custom-header Ns =..
319 Create a custom header which persists for an entire session.
320 A custom header consists of the field name followed by a colon
321 .Ql \&:
322 and the field content body, for example
323 .Ql -C """Blah: Neminem laede; imo omnes, quantum potes, juva""" .
324 Standard header field names cannot be overwritten by custom headers.
325 Runtime adjustable custom headers are available via the variable
326 .Va customhdr ,
327 and in compose mode
328 .Ic ~^ ,
329 one of the
330 .Sx "COMMAND ESCAPES" ,
331 as well as
332 .Ic digmsg
333 are the most flexible and powerful options to manage message headers.
334 This option may be used multiple times.
337 .It Fl c Ar addr , Fl Fl cc Ns =..
338 Just like
339 .Fl b ,
340 except it places the argument in the list of carbon copies.
343 .It Fl D , Fl Fl disconnected
344 (\*(OP) Startup with
345 .Va disconnected
346 .Ic set .
349 .It Fl d , Fl Fl debug
350 Enter a debug-only sandbox mode by setting the internal variable
351 .Va debug ;
352 the same can be achieved via
353 .Ql Fl S Va \&\&debug
355 .Ql Ic set Va \&\&debug .
356 Also see
357 .Fl v .
360 .It Fl E , Fl Fl discard-empty-messages
361 .Ic set
362 .Va skipemptybody
363 and thus discard messages with an empty message part body.
366 .It Fl e , Fl Fl check-and-exit
367 Just check if mail is present (in the system
368 .Va inbox
369 or the one specified via
370 .Fl f ) :
371 if yes, return an exit status of zero, a non-zero value otherwise.
372 To restrict the set of mails to consider in this evaluation a message
373 specification can be added with the option
374 .Fl L .
375 Quickrun: does not open an interactive session.
378 .It Fl F
379 Save the message to send in a file named after the local part of the
380 first recipient's address (instead of in
381 .Va record Ns ).
384 .It Fl f , Fl Fl file
385 Read in the contents of the user's
386 .Mx -sx
387 .Sx "secondary mailbox"
388 .Ev MBOX
389 (or the specified file) for processing;
390 when \*(UA is quit, it writes undeleted messages back to this file
391 (but be aware of the
392 .Va hold
393 option).
394 The optional
395 .Ar file
396 argument will undergo some special
397 .Sx "Filename transformations"
398 (as via
399 .Ic folder ) .
400 Note that
401 .Ar file
402 is not an argument to the flag
403 .Fl \&\&f ,
404 but is instead taken from the command line after option processing has
405 been completed.
406 In order to use a
407 .Ar file
408 that starts with a hyphen-minus, prefix with a relative path, as in
409 .Ql ./-hyphenbox.mbox .
412 .It Fl H , Fl Fl header-summary
413 Display a summary of
414 .Ic headers
415 for the given
416 .Ic folder
417 (depending on
418 .Fl u ,
419 .Va inbox
421 .Ev MAIL ,
422 or as specified via
423 .Fl f ) ,
424 then exit.
425 A configurable summary view is available via the option
426 .Fl L .
427 This mode does not honour
428 .Va showlast .
429 Quickrun: does not open an interactive session.
432 .It Fl h , Fl Fl help
433 Show a brief usage summary; use
434 .Fl Fl long-help
435 for a list long options.
438 .It Fl i
439 .Ic set
440 .Va ignore
441 to ignore tty interrupt signals.
444 .It Fl L Ar spec , Fl Fl search Ns =..
445 Display a summary of
446 .Ic headers
447 of all messages that match the given
448 .Ar spec
449 in the
450 .Ic folder
451 found by the same algorithm used by
452 .Fl H ,
453 then exit.
454 See the section
455 .Sx "Specifying messages"
456 for the format of
457 .Ar spec .
458 This mode does not honour
459 .Va showlast .
461 If the
462 .Fl e
463 option has been given in addition no header summary is produced,
464 but \*(UA will instead indicate via its exit status whether
465 .Ar spec
466 matched any messages
467 .Pf ( Ql 0 )
468 or not
469 .Pf ( Ql 1 ) ;
470 note that any verbose output is suppressed in this mode and must instead
471 be enabled explicitly (see
472 .Fl v ) .
473 Quickrun: does not open an interactive session.
476 .It Fl M Ar type
477 Special send mode that will flag standard input with the MIME
478 .Ql Content-Type:
479 set to the given known
480 .Ar type
481 .Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files" )
482 and use it as the main message body.
483 \*(ID Using this option will bypass processing of
484 .Va message-inject-head
486 .Va message-inject-tail .
487 Also see
488 .Fl q , m , t .
491 .It Fl m Ar file
492 Special send mode that will MIME classify the specified
493 .Ar file ,
494 and use it as the main message body.
495 \*(ID Using this option will bypass processing of
496 .Va message-inject-head
498 .Va message-inject-tail .
499 Also see
500 .Fl q , M , t .
503 .It Fl N , Fl Fl no-header-summary
504 inhibit the initial display of message headers when reading mail or
505 editing a mailbox
506 .Ic folder
507 by calling
508 .Ic unset
509 for the internal variable
510 .Va header .
513 .It Fl n
514 Standard flag that inhibits reading the system wide
515 .Pa \*(UR
516 upon startup.
517 The option
518 .Fl \&:
519 allows more control over the startup sequence; also see
520 .Sx "Resource files" .
523 .It Fl q Ar file , Fl Fl quote-file Ns =..
524 Special send mode that will initialize the message body with the
525 contents of the specified
526 .Ar file ,
527 which may be standard input
528 .Ql -
529 only in non-interactive context.
530 Also see
531 .Fl M , m , t .
534 .It Fl R , Fl Fl read-only
535 Any mailbox
536 .Ic folder
537 aka\&
538 .Ic folder
539 opened will be in read-only mode.
543 .It Fl r Ar from-addr , Fl Fl from-address Ns =..
544 The RFC 5321 reverse-path used for relaying and delegating messages to
545 its destination(s), for example to report delivery errors, is normally
546 derived from the address which appears in the
547 .Va from
548 header (or, if that contains multiple addresses, in
549 .Va sender ) .
550 A file-based aka local executable
551 .Va mta
552 (Mail-Transfer-Agent), however, instead uses the local identity of the
553 initiating user.
556 When this command line option is used the given single addressee
557 .Ar from-addr
558 will be assigned to the internal variable
559 .Va from ,
560 but in addition the command line option
561 .Fl \&\&f Ar from-addr
562 will be passed to a file-based
563 .Va mta
564 whenever a message is sent.
565 Shall
566 .Ar from-addr
567 include a user name the address components will be separated and
568 the name part will be passed to a file-based
569 .Va mta
570 individually via
571 .Fl \&\&F Ar name .
572 Even though not a recipient the
573 .Ql shquote
574 .Va expandaddr
575 flag is supported.
578 If an empty string is passed as
579 .Ar from-addr
580 then the content of the variable
581 .Va from
582 (or, if that contains multiple addresses,
583 .Va sender )
584 will be evaluated and used for this purpose whenever the file-based
585 .Va mta
586 is contacted.
587 By default, without
588 .Fl \&\&r
589 that is, neither
590 .Fl \&\&f
592 .Fl \&\&F
593 command line options are used when contacting a file-based MTA, unless
594 this automatic deduction is enforced by
595 .Ic set Ns
596 ing the internal variable
597 .Va r-option-implicit .
600 Remarks: many default installations and sites disallow overriding the
601 local user identity like this unless either the MTA has been configured
602 accordingly or the user is member of a group with special privileges.
603 Passing an invalid address will cause an error.
607 .It Fl S Ar var Ns Oo = Ns value Oc , Fl Fl set Ns =..
608 .Ic set
609 (or, with a prefix string
610 .Ql no ,
611 as documented in
612 .Sx "INTERNAL VARIABLES" ,
613 .Ic unset )
614 .Ar var Ns
615 iable and optionally assign
616 .Ar value ,
617 if supported; \*(ID the entire expression is evaluated as if specified
618 within dollar-single-quotes (see
619 .Sx "Shell-style argument quoting" )
620 if the internal variable
621 .Va v15-compat
622 is set.
623 If the operation fails the program will exit if any of
624 .Va errexit
626 .Va posix
627 are set.
628 Settings established via
629 .Fl \&\&S
630 cannot be changed from within
631 .Sx "Resource files"
632 or an account switch initiated by
633 .Fl A .
634 They will become mutable again before commands registered via
635 .Fl X
636 are executed.
639 .It Fl s Ar subject , Fl Fl subject Ns =..
640 Specify the subject of the message to be sent.
641 Newline (NL) and carriage-return (CR) bytes are invalid and will be
642 normalized to space (SP) characters.
645 .It Fl T Ar """field: addr""" , Fl Fl target Ns =..
647 .Ar addr
648 to the list of receivers targeted by
649 .Ar field ,
650 for now supported are only
651 .Ql bcc ,
652 .Ql cc ,
653 .Ql fcc ,
655 .Ql to .
656 Field and body (address) are separated by a colon
657 .Ql \&:
658 and optionally blank (space, tabulator) characters.
660 .Ql shquote
661 .Va expandaddr
662 flag is supported.
663 .Ar addr
664 is parsed like a message header address line, as if it would be part of
665 a template message fed in via
666 .Fl t ,
667 and the same modifier suffix is supported.
668 This option may be used multiple times.
671 .It Fl t , Fl Fl template
672 The text message given (on standard input) is expected to contain,
673 separated from the message body by an empty line, one or multiple
674 plain text message headers.
675 \*(ID Readily prepared MIME mail messages cannot be passed.
676 Headers can span multiple consecutive lines if follow lines start with
677 any amount of whitespace.
678 A line starting with the number sign
679 .Ql #
680 in the first column is ignored.
681 Message recipients can be given via the message headers
682 .Ql To: ,
683 .Ql Cc: ,
684 .Ql Bcc:
685 (the
686 .Ql ?single
687 modifier enforces treatment as a single addressee, for example
688 .Ql To?single: exa, <m@ple> )
690 .Ql Fcc: ,
691 they will be added to any recipients specified on the command line,
692 and are likewise subject to
693 .Va expandaddr
694 validity checks.
695 If a message subject is specified via
696 .Ql Subject:
697 then it will be used in favour of one given on the command line.
699 More optional headers are
700 .Ql Reply-To:
701 (possibly overriding
702 .Va reply-to ) ,
703 .Ql Sender:
704 .Pf ( Va sender ) ,
705 .Ql From:
706 .Pf ( Va from
707 and / or option
708 .Fl r ) .
709 .Ql Message-ID: ,
710 .Ql In-Reply-To: ,
711 .Ql References:
713 .Ql Mail-Followup-To: ,
714 by default created automatically dependent on message context, will
715 be used if specified (a special address massage will however still occur
716 for the latter).
717 Any other custom header field (also see
718 .Fl C ,
719 .Va customhdr
721 .Ic ~^ )
722 is passed through entirely
723 unchanged, and in conjunction with the options
724 .Fl ~
726 .Fl #
727 it is possible to embed
728 .Sx "COMMAND ESCAPES" .
729 Also see
730 .Fl M , m , q .
733 .It Fl u Ar user , Fl Fl inbox-of Ns =..
734 Initially read the
735 .Mx -sx
736 .Sx "primary system mailbox"
738 .Ar user ,
739 appropriate privileges presumed; effectively identical to
740 .Ql Fl \&\&f Ns \0%user .
743 .It Fl V , Fl Fl version
744 Show \*(UAs
745 .Va version
746 and exit.
747 The command
748 .Ic version
749 will also show the list of
750 .Va features :
751 .Ql $ \*(uA -:/ -Xversion -Xx .
754 .It Fl v , Fl Fl verbose
755 .Ic set Ns
756 s the internal variable
757 .Va verbose
758 to enable logging of informational context messages.
759 (Increases level of verbosity when used multiple times.)
760 Also see
761 .Fl d .
764 .It Fl X Ar cmd , Fl Fl startup-cmd Ns =..
765 Add the given (or multiple for a multiline argument)
766 .Ar cmd
767 to a list of commands to be executed before normal operation starts.
768 The commands will be evaluated as a unit, just as via
769 .Ic source .
770 Correlates with
771 .Fl #
773 .Va errexit .
776 .It Fl Y Ar cmd , Fl Fl cmd Ns =..
777 Add the given (or multiple for a multiline argument)
778 .Ar cmd
779 to a list of commands to be executed after normal operation has started.
780 The commands will be evaluated successively in the given order, and as
781 if given on the program's standard input \(em before interactive
782 prompting begins in interactive mode, after standard input has been
783 consumed otherwise.
786 .It Fl ~ , Fl Fl enable-cmd-escapes
787 Enable
788 .Sx "COMMAND ESCAPES"
789 in compose mode even in non-interactive use cases.
790 This can for example be used to automatically format the composed
791 message text before sending the message:
792 .Bd -literal -offset indent
793 $ ( echo 'line    one. Word.     Word2.';\e
794     echo '~| /usr/bin/fmt -tuw66' ) |\e
795   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
799 .It Fl # , Fl Fl batch-mode
800 Enables batch mode: standard input is made line buffered, the complete
801 set of (interactive) commands is available, processing of
802 .Sx "COMMAND ESCAPES"
803 is enabled in compose mode, and diverse
804 .Sx "INTERNAL VARIABLES"
805 are adjusted for batch necessities, exactly as if done via
806 .Fl S :
807 .Va emptystart ,
808 .Pf no Va errexit ,
809 .Pf no Va header ,
810 .Pf no Va posix ,
811 .Va quiet ,
812 .Va sendwait ,
813 .Va typescript-mode
814 as well as
815 .Ev MAIL ,
816 .Ev MBOX
818 .Va inbox
819 (the latter three to
820 .Pa /dev/null ) .
821 Also, the values of
822 .Ev COLUMNS
824 .Ev LINES
825 are looked up, and acted upon.
826 The following prepares an email message in a batched dry run:
827 .Bd -literal -offset indent
828 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
829   LC_ALL=C \*(uA -d#:x -X'alias bob bob@exam.ple'
833 .It Fl \&. , Fl Fl end-options
834 This flag forces termination of option processing in order to prevent
835 .Dq option injection
836 (attacks).
837 It also forcefully puts \*(UA into send mode, see
838 .Sx "On sending mail, and non-interactive mode" .
842 All given
843 .Ar to-addr
844 arguments and all receivers established via
845 .Fl b
847 .Fl c
848 as well as
849 .Fl T
850 are subject to the checks established by
851 .Va expandaddr ,
852 one of the
853 .Sx "INTERNAL VARIABLES" ;
854 they all support the flag
855 .Ql shquote .
856 If the setting of
857 .Va expandargv
858 allows their recognition all
859 .Ar mta-option
860 arguments given at the end of the command line after a
861 .Ql --
862 separator will be passed through to a file-based
863 .Va mta
864 (Mail-Transfer-Agent) and persist for the entire session.
865 .Va expandargv
866 constraints do not apply to the content of
867 .Va mta-arguments .
868 .\" }}}
870 .\" .Ss "A starter" {{{ review
871 .Ss "A starter"
873 \*(UA is a direct descendant of
875 Mail, itself a successor to the Research
877 mail which
878 .Dq was there from the start
879 according to
880 .Sx HISTORY .
881 It thus represents the user side of the
883 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
884 traditionally taken by
885 .Xr sendmail 8
886 (and most MTAs provide a binary of this name for compatibility reasons).
887 If the \*(OPal SMTP
888 .Va mta
889 is included in the
890 .Va features
891 of \*(UA then the system side is not a mandatory precondition for mail
892 delivery.
895 \*(UA strives for compliance with the POSIX
896 .Xr mailx 1
897 standard, but
898 .Va posix ,
899 one of the
900 .Sx "INTERNAL VARIABLES"
901 (or its
902 .Sx ENVIRONMENT Ns
903 al equivalent
904 .Ev POSIXLY_CORRECT ) ,
905 needs to be set to adjust behaviour to be almost on par.
906 Almost, because there is one important difference: POSIX
907 .Sx "Shell-style argument quoting"
908 is (\*(ID increasingly) used instead of the
909 .Sx "Old-style argument quoting"
910 that the standard documents, which is believed to be a feature.
911 The builtin as well as the (default) global
912 .Pa \*(UR
913 .Sx "Resource files"
914 already bend the standard imposed settings a bit.
917 For example,
918 .Va hold
920 .Va keepsave
922 .Ic set
923 in order to suppress the automatic moving of messages to the
924 .Mx -sx
925 .Sx "secondary mailbox"
926 .Ev MBOX
927 that would otherwise occur (see
928 .Sx "Message states" ) ,
930 .Va keep
931 to not remove empty system MBOX mailbox files (or all empty such files in
932 .Va posix
933 mode) to avoid mangling of file permissions when files eventually get
934 recreated.
937 To enter interactive mode even if the initial mailbox is empty
938 .Va emptystart
939 is set,
940 .Va editheaders
941 to allow editing of headers as well as
942 .Va fullnames
943 to not strip down addresses in compose mode, and
944 .Va quote
945 to include the message that is being responded to when
946 .Ic reply Ns
947 ing, which is indented by an
948 .Va indentprefix
949 that also deviates from standard imposed settings.
950 .Va mime-counter-evidence
951 is fully enabled, too.
952 It sets
953 .Va followup-to-honour
955 .Va reply-to-honour
956 to comply with reply address desires.
959 Random remarks.
960 The file mode creation mask can be managed explicitly via the variable
961 .Va umask .
962 Files and shell pipe output can be
963 .Ic source Ns
964 d for
965 .Ic eval Ns
966 uation, also during startup from within the
967 .Sx "Resource files" .
968 Informational context can be available by
969 .Ic set Ns
970 ting
971 .Va verbose
973 .Va debug
974 (as via
975 .Fl v , d ) .
976 .\" }}}
978 .\" .Ss "On sending mail, and non-interactive mode" {{{
979 .Ss "On sending mail, and non-interactive mode"
981 To send a message to one or more people, using a local or built-in
982 .Va mta
983 (Mail-Transfer-Agent) transport to actually deliver the generated mail
984 message, \*(UA can be invoked with arguments which are the names of
985 people to whom the mail will be sent, and the command line options
986 .Fl b
988 .Fl c
989 can be used to add (blind) carbon copy receivers:
991 .Bd -literal -offset indent
992 # Via test MTA
993 $ echo Hello, world | \*(uA -:/ -Smta=test -s test $LOGNAME
995 # Via sendmail(1) MTA
996 $ </dev/null \*(uA -:x -s test $LOGNAME
998 # Debug dry-run mode:
999 $ </dev/null LC_ALL=C \*(uA -d -:/ \e
1000    -Sttycharset=utf8 -Sfullnames \e
1001    -b bcc@exam.ple -c cc@exam.ple -. \e
1002    '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
1004 # With SMTP (no real sending due to -d debug dry-run)
1005 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Sttycharset=utf8 \e
1006     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
1007     -S from=scriptreply@exam.ple \e
1008     -a /etc/mail.rc --end-options \e
1009     eric@exam.ple < /tmp/letter.txt
1013 If standard input is a terminal rather than the message to be sent,
1014 the user is expected to type in the message contents.
1015 In this compose mode \*(UA treats lines beginning with the character
1016 .Ql ~
1017 special \(en these are so-called
1018 .Sx "COMMAND ESCAPES" ,
1019 which can be used to read in files, process shell commands, add and edit
1020 attachments and more; for example
1021 .Ic ~v
1023 .Ic ~e
1024 will start the
1025 .Ev VISUAL
1026 text
1027 .Ev EDITOR ,
1028 respectively, to revise the message in its current state,
1029 .Ic ~h
1030 allows editing of the most important message headers, with the potent
1031 .Ic ~^
1032 custom headers can be created, for example (more specifically than with
1033 .Fl C
1035 .Va customhdr ) .
1036 \*(OPally
1037 .Ic ~?
1038 gives an overview of most other available command escapes.
1041 The command escape
1042 .Ic ~.
1043 (see there) will call hooks, insert automatic injections and receivers,
1044 leave compose mode and send the message once it is completed.
1045 Aborting letter composition is possible with either of
1046 .Ic ~x
1048 .Ic ~q ,
1049 the latter of which will save the message in the file denoted by
1050 .Ev DEAD
1051 unless
1052 .Pf no Va save
1053 is set.
1054 And unless
1055 .Va ignoreeof
1056 is set the effect of
1057 .Ic ~.
1058 can also be achieved by typing end-of-transmission (EOT) via
1059 .Ql control-D
1060 .Pf ( Ql ^D )
1061 at the beginning of an empty line, and
1062 .Ic ~q
1063 is always reachable by typing end-of-text (ETX) twice via
1064 .Ql control-C
1065 .Pf ( Ql ^C ) .
1068 A number of
1069 .Sx ENVIRONMENT
1071 .Sx "INTERNAL VARIABLES"
1072 can be used to alter default behavior.
1073 .Ic set Ns
1074 ting (also via
1075 .Fl S )
1076 .Va editalong
1077 will automatically startup an editor when compose mode is entered, and
1078 editing of headers additionally to plain body content can be enabled via
1079 .Va editheaders :
1080 \*(ID some, but not all headers can be created, edited or deleted in an
1081 editor, then.
1082 .Va askcc
1084 .Va askbcc
1085 will cause the user to be prompted actively for (blind) carbon-copy
1086 recipients, respectively, and (the default)
1087 .Va asksend
1088 will request confirmation whether the message shall be sent.
1091 The envelope sender address is defined by
1092 .Va from ,
1093 explicitly defining an originating
1094 .Va hostname
1095 may be desirable, especially with the built-in SMTP Mail-Transfer-Agent
1096 .Va mta .
1097 .Sx "Character sets"
1098 for outgoing message and MIME part content are configurable via
1099 .Va sendcharsets ,
1100 whereas input data is assumed to be in
1101 .Va ttycharset .
1102 Message data will be passed over the wire in a
1103 .Va mime-encoding .
1104 MIME parts aka attachments need to be assigned a
1105 .Ic mimetype ,
1106 usually taken out of
1107 .Sx "The mime.types files" .
1108 Saving a copy of sent messages in a
1109 .Va record
1110 mailbox may be desirable \(en as for most mailbox
1111 .Ic folder
1112 targets the value will undergo
1113 .Sx "Filename transformations" .
1114 Some introductional
1115 .Fl d
1117 .Va debug
1118 sandbox dry-run tests will prove correctness.
1121 Message recipients are subject to
1122 .Ic alternates
1123 filtering, and may not only be email addresses, but can also be names
1124 of mailboxes and even complete shell command pipe specifications.
1125 If the variable
1126 .Va expandaddr
1127 is not set then only email addresses like
1128 .Ql bob@exam.ple
1129 and plain user names (including MTA aliases) may be used, other types
1130 will be filtered out, giving a warning message.
1131 .Va expandaddr
1132 indeed allows further control over and adjustments of message recipients,
1133 for example user names can be expanded to network addresses by specifying
1134 .Ql nametoaddr .
1135 A network address that contains no domain-, but only a valid local user
1136 .Ql <name>
1137 in angle brackets will be automatically expanded to a valid address when
1138 .Va hostname
1139 is not set, or set to a non-empty value; setting it to the empty value
1140 instructs \*(UA that the used
1141 .Va mta
1142 will perform the necessary expansion.
1143 The command
1144 .Ic addrcodec
1145 may help to generate standard compliant network addresses.
1147 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
1148 .\" grep the latter for the complete picture
1150 If the variable
1151 .Va expandaddr
1152 is set then an extended set of recipient addresses will be accepted:
1153 Any name that starts with a vertical bar
1154 .Ql |
1155 character specifies a command pipe \(en the command string following the
1156 .Ql |
1157 is executed and the message is sent to its standard input;
1158 Likewise, any name that consists only of hyphen-minus
1159 .Ql -
1160 or starts with the character solidus
1161 .Ql /
1162 or the character sequence dot solidus
1163 .Ql ./
1164 is treated as a file, regardless of the remaining content.
1165 Any other name which contains a commercial at
1166 .Ql @
1167 character is a network address;
1168 Any other name which starts with a plus sign
1169 .Ql +
1170 character is a mailbox name;
1171 Any other name which contains a solidus
1172 .Ql /
1173 character but no exclamation mark
1174 .Ql \&!
1175 or percent sign
1176 .Ql %
1177 character before is also a mailbox name;
1178 What remains is treated as a network address.
1180 .Bd -literal -offset indent
1181 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1182 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1183 $ echo safe | LC_ALL=C \e
1184     \*(uA -:/ -Sv15-compat -Sttycharset=utf8 \e
1185       --set mime-force-sendout \e
1186       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1187       --end-options bob@exam.ple
1191 To create file-carbon-copies the special recipient header
1192 .Ql Fcc:
1193 may be used as often as desired.
1194 Its entire value (or body in standard terms) is interpreted as a
1195 .Ic folder
1196 target, after having been subject to
1197 .Sx "Filename transformations" .
1198 Beside using the command escape
1199 .Ic ~^
1200 (to create a
1201 .Ql Fcc
1202 header) this is the only way to create a file-carbon-copy without
1203 introducing an ambiguity regarding the interpretation of the address,
1204 file names with leading vertical bars or commercial ats can be used.
1205 Like all other recipients
1206 .Ql Fcc:
1207 is subject to the checks of
1208 .Va expandaddr .
1209 Any local file and pipe command addressee honours the setting of
1210 .Va mbox-fcc-and-pcc .
1213 It is possible to create personal distribution lists via the
1214 .Ic alias
1215 command, so that, for instance, the user can send mail to
1216 .Ql cohorts
1217 and have it go to a group of people.
1218 Different to the alias mechanism of most local
1219 .Va mta Ns
1220 s, often documented in
1221 .Xr aliases 5
1222 and subject to the
1223 .Ql name
1224 constraint of
1225 .Va expandaddr ,
1226 personal aliases will be expanded by \*(UA before the message is sent.
1227 They are thus a convenient alternative to specifying each addressee by
1228 itself, correlate with the active set of
1229 .Ic alternates ,
1230 and are subject to
1231 .Va metoo
1232 filtering.
1233 \*(OPally MTA aliases can be expanded before sending messages by setting
1234 .Va mta-aliases .
1236 .Bd -literal -offset indent
1237 ? alias  cohorts  bill jkf mark kridle@ucbcory ~/cohorts.mbox
1238 ? alias  mark  mark@exam.ple
1239 ? set mta-aliases=/etc/aliases
1243 For the purpose of arranging a complete environment of settings that can
1244 be switched to with a single command or command line option there are
1245 .Ic account Ns s .
1246 Alternatively it is also possible to use a flat configuration, making use
1247 of so-called variable chains which automatically pick
1248 .Ql USER@HOST
1250 .Ql HOST
1251 context-dependent variable variants: for example addressing
1252 .Ql Ic Folder Ns \& pop3://yaa@exam.ple
1253 would find
1254 .Va \&\&pop3-no-apop-yaa@exam.ple ,
1255 .Va \&\&pop3-no-apop-exam.ple
1257 .Va pop3-no-apop
1258 in order.
1260 .Sx "On URL syntax and credential lookup"
1262 .Sx "INTERNAL VARIABLES" .
1265 The compose mode hooks
1266 .Va on-compose-enter , on-compose-splice , on-compose-leave
1268 .Va on-compose-cleanup
1269 may be set to
1270 .Ic define Ns
1271 d macros and provide reliable and increasingly powerful mechanisms to
1272 perform automated message adjustments dependent on message context,
1273 for example addition of message signatures
1274 .Pf ( Va message-inject-head , message-inject-tail )
1275 or creation of additional receiver lists (also by setting
1276 .Va autocc , autobcc ) .
1277 To achieve that the command
1278 .Ic digmsg
1279 may be used in order to query and adjust status of message(s).
1280 The splice hook can also make use of
1281 .Sx "COMMAND ESCAPES" .
1282 (\*(ID The compose mode hooks work for
1283 .Ic forward , mail , reply
1284 and variants;
1285 .Ic resend
1287 .Ic Resend
1288 only provide the hooks
1289 .Va on-resend-enter
1291 .Va on-resend-cleanup ,
1292 which are pretty restricted due to the nature of the operation.)
1295 To avoid environmental noise scripts should
1296 .Dq detach
1297 \*(UA from any configuration files and create a script-local
1298 environment, ideally with the command line options
1299 .Fl \&:
1300 to disable any configuration file in conjunction with repetitions of
1301 .Fl S
1302 to specify variables:
1304 .Bd -literal -offset indent
1305 $ env LC_ALL=C \*(uA -:/ \e
1306     -Sv15-compat \e
1307     -Sttycharset=utf-8 -Smime-force-sendout \e
1308     -Sexpandaddr=fail,-all,failinvaddr \e
1309     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1310     -S from=scriptreply@exam.ple \e
1311     -s 'Subject to go' -a attachment_file \e
1312     -Sfullnames -. \e
1313     'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1314     < content_file
1318 As shown, scripts can
1319 .Dq fake
1320 a locale environment, the above specifies the all-compatible 7-bit clean
1321 .Ev LC_ALL
1322 .Dq C ,
1323 but will nonetheless take and send UTF-8 in the message text by using
1324 .Va ttycharset .
1325 If character set conversion is compiled in
1326 .Pf ( Va features
1327 includes the term
1328 .Ql +iconv )
1329 invalid (according to
1330 .Va ttycharset )
1331 character input data would normally cause errors; setting
1332 .Va mime-force-sendout
1333 will instead, as a last resort, classify the input as binary data, and
1334 therefore allow message creation to be successful.
1335 (Such content can then be inspected either by installing a
1336 .Va pipe-TYPE/SUBTYPE
1337 handler for
1338 .Ql application/octet-stream ,
1339 or possibly automatically through
1340 .Va mime-counter-evidence ) .
1343 In interactive mode, which is introduced in the next section, messages
1344 can be sent by calling the
1345 .Ic mail
1346 command with a list of recipient addresses:
1348 .Bd -literal -offset indent
1349 $ \*(uA -d -Squiet -Semptystart
1350 "/var/spool/mail/user": 0 messages
1351 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1352 \&...
1353 ? # Will do the right thing (tm)
1354 ? m rec1@exam.ple rec2@exam.ple
1356 .\" }}}
1358 .\" .Ss "On reading mail, and interactive mode" {{{
1359 .Ss "On reading mail, and interactive mode"
1361 When invoked without addressees \*(UA enters interactive mode in which
1362 mails may be read.
1363 When used like that the user's system
1364 .Va inbox
1365 (for more on mailbox types please see the command
1366 .Ic folder )
1367 is read in and a one line header of each message therein is displayed if
1368 the variable
1369 .Va header
1370 is set.
1371 The visual style of this summary of
1372 .Ic headers
1373 can be adjusted through the variable
1374 .Va headline
1375 and the possible sorting criterion via
1376 .Va autosort .
1377 Scrolling through
1378 .Va screen Ns
1379 fuls of
1380 .Ic headers
1381 can be performed with the command
1382 .Ic z .
1383 If the initially opened mailbox is empty \*(UA will instead exit
1384 immediately (after displaying a message) unless the variable
1385 .Va emptystart
1386 is set.
1389 At the
1390 .Va prompt
1391 the command
1392 .Ic list
1393 will give a listing of all available commands and
1394 .Ic help
1395 will \*(OPally give a summary of some common ones.
1396 If the \*(OPal documentation strings are available (see
1397 .Va features )
1398 one can type
1399 .Ql help X
1400 .Pf "(or " Ql \&?X )
1401 and see the actual expansion of
1402 .Ql X
1403 and what its purpose is, i.e., commands can be abbreviated
1404 (note that POSIX defines some abbreviations, so that the alphabetical
1405 order of commands does not necessarily relate to the abbreviations; it is
1406 however possible to define overwrites with
1407 .Ic commandalias ) .
1408 These commands can also produce a more
1409 .Va verbose
1410 output.
1413 Messages are given numbers (starting at 1) which uniquely identify
1414 messages; the current message \(en the
1415 .Dq dot
1416 \(en will either be the first new message, or the first unread message,
1417 or the first message of the mailbox; the internal variable
1418 .Va showlast
1419 will instead cause usage of the last message for this purpose.
1420 The command
1421 .Ic headers
1422 will display a
1423 .Va screen Ns
1424 ful of header summaries containing the
1425 .Dq dot ,
1426 whereas
1427 .Ic from
1428 will display only the summaries of the given messages, defaulting to the
1429 .Dq dot .
1432 Message content can be displayed with the command
1433 .Ic type
1434 .Pf ( Ql t ,
1435 alias
1436 .Ic print ) .
1437 Here the variable
1438 .Va crt
1439 controls whether and when \*(UA will use the configured
1440 .Ev PAGER
1441 for display instead of directly writing to the user terminal
1442 .Va screen ,
1443 the sole difference to the command
1444 .Ic more ,
1445 which will always use the
1446 .Ev PAGER .
1447 The command
1448 .Ic top
1449 will instead only show the first
1450 .Va toplines
1451 of a message (maybe even compressed if
1452 .Va topsqueeze
1453 is set).
1454 Message display experience may improve by setting and adjusting
1455 .Va mime-counter-evidence ,
1456 and also see
1457 .Sx "HTML mail and MIME attachments" .
1460 By default the current message
1461 .Pf ( Dq dot )
1462 is displayed, but like with many other commands it is possible to give
1463 a fancy message specification (see
1464 .Sx "Specifying messages" ) ,
1465 for example
1466 .Ql t:u
1467 will display all unread messages,
1468 .Ql t.
1469 will display the
1470 .Dq dot ,
1471 .Ql t 1 5
1472 will type the messages 1 and 5,
1473 .Ql t 1-5
1474 will type the messages 1 through 5, and
1475 .Ql t-
1477 .Ql t+
1478 will display the previous and the next message, respectively.
1479 The command
1480 .Ic search
1481 (a more substantial alias for
1482 .Ic from )
1483 will display a header summary of the given message specification list
1484 instead of their content; the following will search for subjects:
1487 .Dl ? from "'@Some subject to search for'"
1490 In the default setup all header fields of a message will be
1491 .Ic type Ns
1492 d, but fields can be white- or blacklisted for a variety of
1493 applications by using the command
1494 .Ic headerpick ,
1495 e.g., to restrict their display to a very restricted set for
1496 .Ic type :
1497 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1498 In order to display all header fields of a message regardless of
1499 currently active ignore or retain lists, use the commands
1500 .Ic Type
1502 .Ic Top ;
1503 .Ic Show
1504 will show the raw message content.
1505 Note that historically the global
1506 .Pa \*(UR
1507 not only adjusts the list of displayed headers, but also sets
1508 .Va crt .
1509 (\*(ID A yet somewhat restricted) Reliable scriptable message
1510 inspection is available via
1511 .Ic digmsg .
1514 Dependent upon the configuration a line editor (see the section
1515 .Sx "On terminal control and line editor" )
1516 aims at making the user experience with the many
1517 .Sx COMMANDS
1518 a bit nicer.
1519 When reading the system
1520 .Va inbox ,
1521 or when
1522 .Fl f
1524 .Ic folder )
1525 specified a mailbox explicitly prefixed with the special
1526 .Ql %:
1527 modifier (to propagate it to a
1528 .Mx -sx
1529 .Sx "primary system mailbox" ) ,
1530 then messages which have been read
1531 .Pf (see\0 Sx "Message states" )
1532 will be automatically moved to a
1533 .Mx -sx
1534 .Sx "secondary mailbox" ,
1535 the user's
1536 .Ev MBOX
1537 file, when the mailbox is left, either by changing the active mailbox or
1538 by quitting \*(UA \(en this automatic moving from a system- or primary-
1539 to the secondary mailbox is not performed when the variable
1540 .Va hold
1541 is set.
1542 Messages can also be explicitly
1543 .Ic move Ns
1544 d to other mailboxes, whereas
1545 .Ic copy
1546 keeps the original message.
1547 .Ic write
1548 can be used to write out data content of specific parts of messages.
1551 After examining a message the user can
1552 .Ic reply Ql r
1553 to the sender and all recipients (which will also be placed in
1554 .Ql To:
1555 unless
1556 .Va recipients-in-cc
1557 is set), or
1558 .Ic Reply Ql R
1559 exclusively to the sender(s).
1560 To comply with with the receivers desired reply address the
1561 .Mx -sx
1562 .Sx quadoption Ns
1564 .Va followup-to-honour
1566 .Va reply-to-honour
1567 should usually be set.
1568 The commands
1569 .Ic Lreply
1571 .Ic Lfollowup
1572 know how to apply a special addressee massage, see
1573 .Sx "Mailing lists" .
1574 Dependent on the presence and value of
1575 .Va quote
1576 the message being replied to will be included in a quoted form.
1577 .Ic forward Ns
1578 ing a message will allow editing the new message: the original message
1579 will be contained in the message body, adjusted according to
1580 .Ic headerpick .
1581 It is possible to
1582 .Ic resend
1584 .Ic Resend
1585 messages: the former will add a series of
1586 .Ql Resent-
1587 headers, whereas the latter will not; different to newly created
1588 messages editing is not possible and no copy will be saved even with
1589 .Va record
1590 unless the additional variable
1591 .Va record-resent
1592 is set.
1593 When sending, replying or forwarding messages comments and full names
1594 will be stripped from recipient addresses unless the internal variable
1595 .Va fullnames
1596 is set.
1599 Of course messages can be
1600 .Ic delete Ql d ,
1601 and they can spring into existence again via
1602 .Ic undelete ,
1603 or when the \*(UA session is ended via the
1604 .Ic exit
1606 .Ic xit
1607 commands to perform a quick program termation.
1608 To end a mail processing session regulary and perform a full program
1609 exit one may issue the command
1610 .Ic quit .
1611 It will, among others, move read messages to the
1612 .Mx -sx
1613 .Sx "secondary mailbox"
1614 .Ev MBOX
1615 as necessary, discard deleted messages in the current mailbox,
1616 and update the \*(OPal (see
1617 .Va features )
1618 line editor
1619 .Va history-file .
1620 By the way, whenever the main event loop is about to look out for the
1621 next input line it will trigger the hook
1622 .Va on-main-loop-tick .
1623 .\" }}}
1625 .\" .Ss "HTML mail and MIME attachments" {{{ review
1626 .Ss "HTML mail and MIME attachments"
1628 HTML-only messages become more and more common, and many messages come
1629 bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions)
1630 parts and attachments.
1631 To get a notion of MIME types \*(UA has a default set of types built-in,
1632 onto which the content of
1633 .Sx "The mime.types files"
1634 will be added (as configured and allowed by
1635 .Va mimetypes-load-control ) .
1636 Types can also become registered with the command
1637 .Ic mimetype .
1638 To improve interaction with the faulty MIME part declarations of real life
1639 .Va mime-counter-evidence
1640 will allow verification of the given assertion, and the possible
1641 provision of an alternative, better MIME type.
1644 Whereas a simple HTML-to-text filter for displaying HTML messages is
1645 \*(OPally supported (indicated by
1646 .Ql +filter-html-tagsoup
1648 .Va features ) ,
1649 MIME types other than plain text cannot be handled directly.
1650 Instead programs need to become registered to deal with specific MIME
1651 types or file extensions, either to prepare (re-)integrable plain text
1652 versions of their input (a mode which is called
1653 .Cd copiousoutput ) ,
1654 or to display the content externally, for example in a graphical window:
1655 the latter type is only considered by and for the command
1656 .Ic mimeview .
1659 To install a handler program for a MIME type an according
1660 .Va pipe-TYPE/SUBTYPE
1661 variable needs to be set; to define a handler for a file extension
1662 .Va pipe-EXTENSION
1663 can be used \(en these handlers take precedence.
1664 \*(OPally mail user agent configuration is supported (see
1665 .Sx "The Mailcap files" ) ,
1666 and will be queried for display or quote handlers after the former ones.
1667 Type-markers registered via
1668 .Ic mimetype
1669 are the last possible source for information how to handle a MIME type.
1672 For example, to display HTML messages integrated via the text browsers
1673 .Xr lynx 1
1675 .Xr elinks 1 ,
1676 register a MathML MIME type and enable its plain text display, and to
1677 open PDF attachments in an external PDF viewer, asynchronously and with
1678 some other magic attached:
1680 .Bd -literal -offset indent
1681 ? if "$features" !% +filter-html-tagsoup
1682 ?   #set pipe-text/html='?* elinks -force-html -dump 1'
1683 ?   set pipe-text/html='?* lynx -stdin -dump -force_html'
1684 ?   # Display HTML as plain text instead
1685 ?   #set pipe-text/html=?t
1686 ? endif
1687 ? mimetype ?t application/mathml+xml mathml
1688 ? wysh set pipe-application/pdf='?&=? \e
1689     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1690     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1691     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1693 .\" }}}
1695 .\" .Ss "Mailing lists" {{{
1696 .Ss "Mailing lists"
1698 Known or subscribed-to mailing lists may be flagged in the summary of
1699 .Ic headers
1700 .Pf ( Va headline
1701 format character
1702 .Ql %L ) ,
1703 and will gain special treatment when sending mails: the variable
1704 .Va followup-to-honour
1705 will ensure that a
1706 .Ql Mail-\:Followup-\:To:
1707 header is honoured when a message is being replied to
1708 .Pf ( Ic reply ,
1709 .Ic followup ,
1710 .Ic Lreply ,
1711 .Ic Lfollowup ) ,
1713 .Va followup-to
1714 controls creation of this header when creating
1715 .Ic mail Ns
1716 s, if the necessary user setup
1717 .Pf ( from , sender ) ;
1718 is available; then, it may also be created automatically, for example
1719 when list-replying via
1720 .Ic Lreply
1722 .Ic Lfollowup ,
1723 when
1724 .Ic followup
1726 .Ic reply
1727 is used and the messages
1728 .Ql Mail-Followup-To:
1729 is honoured etc.
1732 The commands
1733 .Ic mlist
1735 .Ic mlsubscribe
1736 manage \*(UAs notion of which addresses are mailing lists.
1737 With the \*(OPal regular expression support any address
1738 .Mx -ix "magic regular expression characters"
1739 which contains any of the magic regular expression characters
1740 .Ql ( ^[*+?|$ ;
1742 .Xr re_format 7
1744 .Xr regex 7 ,
1745 dependent on the host system)
1746 will be compiled and used as one, possibly matching many addresses.
1747 It is not possible to escape the
1748 .Dq magic :
1749 in order to match special characters as-is, bracket expressions must be
1750 used, for example
1751 .Ql Ic search Li @subject@'[[]open bracket' .
1753 .Bd -literal -offset indent
1754 ? set followup-to followup-to-honour=ask-yes \e
1755     reply-to-honour=ask-yes
1756 ? mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1757 ? mlsubscribe a4@b4.c4 exact@lists.c3
1761 Known and subscribed lists differ in that for the latter the
1762 .Va user Ns
1763 s address is not part of a generated
1764 .Ql Mail-Followup-To: .
1765 There are exceptions, for example if multiple lists are addressed and
1766 not all have the subscription attribute.
1767 When replying to a message its list address
1768 .Pf ( Ql List-Post:
1769 header) is automatically and temporarily treated like a known
1770 .Ic mlist ;
1771 dependent on the variable
1772 .Va reply-to-honour
1773 an existing
1774 .Ql Reply-To:
1775 is used instead (if it is a single address on the same domain as
1776 .Ql List-Post: )
1777 in order to accept a list administrator's wish that is supposed to have
1778 been manifested like that.
1781 For convenience and compatibility with mail programs that do not honour
1782 the non-standard M-F-T, an automatic user entry in the carbon-copy
1783 .Ql Cc:
1784 address list of generated message can be created by setting
1785 .Va followup-to-add-cc .
1786 This entry will be added whenever the user will be placed in the
1787 .Ql Mail-Followup-To:
1788 list, and is not a regular addressee already.
1789 .Va reply-to-swap-in
1790 tries to deal with the address rewriting that many mailing-lists nowadays
1791 perform to work around DKIM / DMARC etc. standard imposed problems.
1792 .\" }}}
1794 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1795 .Ss "Signed and encrypted messages with S/MIME"
1797 \*(OP S/MIME provides two central mechanisms:
1798 message signing and message encryption.
1799 A signed message contains some data in addition to the regular text.
1800 The data can be used to verify that the message has been sent using
1801 a valid certificate, that the sender address matches that in the
1802 certificate, and that the message text has not been altered.
1803 Signing a message does not change its regular text;
1804 it can be read regardless of whether the recipients software is able to
1805 handle S/MIME.
1806 It is thus usually possible to sign all outgoing messages if so desired.
1809 Encryption, in contrast, makes the message text invisible for all people
1810 except those who have access to the secret decryption key.
1811 To encrypt a message, the specific recipients public encryption key
1812 must be known.
1813 It is therefore not possible to send encrypted mail to people unless their
1814 key has been retrieved from either previous communication or public key
1815 directories.
1816 Because signing is performed with private keys, and encryption with
1817 public keys, messages should always be signed before being encrypted.
1820 A central concept to S/MIME is that of the certification authority (CA).
1821 A CA is a trusted institution that issues certificates.
1822 For each of these certificates it can be verified that it really
1823 originates from the CA, provided that the CA's own certificate is
1824 previously known.
1825 A set of CA certificates is usually delivered and installed together
1826 with the cryptographical library that is used on the local system.
1827 Therefore reasonable security for S/MIME on the Internet is provided if
1828 the source that provides that library installation is trusted.
1829 It is also possible to use a specific pool of trusted certificates.
1830 If this is desired,
1831 .Va smime-ca-no-defaults
1832 should be set to avoid using the default certificate pool, and
1833 .Va smime-ca-file
1834 and/or
1835 .Va smime-ca-dir
1836 should be pointed to a trusted pool of certificates.
1837 A certificate cannot be more secure than the method its CA certificate
1838 has been retrieved with.
1841 This trusted pool of certificates is used by the command
1842 .Ic verify
1843 to ensure that the given S/MIME messages can be trusted.
1844 If so, verified sender certificates that were embedded in signed
1845 messages can be saved locally with the command
1846 .Ic certsave ,
1847 and used by \*(UA to encrypt further communication with these senders:
1849 .Bd -literal -offset indent
1850 ? certsave FILENAME
1851 ? set smime-encrypt-USER@HOST=FILENAME \e
1852     smime-cipher-USER@HOST=AES256
1856 To sign outgoing messages, in order to allow receivers to verify the
1857 origin of these messages, a personal S/MIME certificate is required.
1858 \*(UA supports password-protected personal certificates (and keys), see
1859 .Va smime-sign-cert .
1860 The section
1861 .Sx "On URL syntax and credential lookup"
1862 gives an overview of the possible sources of user credentials, and
1863 .Sx "S/MIME step by step"
1864 shows examplarily how a private S/MIME certificate can be obtained.
1865 In general, if such a private key plus certificate
1866 .Dq pair
1867 is available, all that needs to be done is to set some variables:
1869 .Bd -literal -offset indent
1870 ? set smime-sign-cert=ME@exam.ple.paired \e
1871     smime-sign-digest=SHA512 \e
1872     smime-sign from=myname@my.host
1876 Variables of interest for S/MIME in general are
1877 .Va smime-ca-dir ,
1878 .Va smime-ca-file ,
1879 .Va smime-ca-flags ,
1880 .Va smime-ca-no-defaults ,
1881 .Va smime-crl-dir ,
1882 .Va smime-crl-file .
1883 For S/MIME signing of interest are
1884 .Va smime-sign ,
1885 .Va smime-sign-cert ,
1886 .Va smime-sign-include-certs
1888 .Va smime-sign-digest .
1889 Additional variables of interest for S/MIME en- and decryption:
1890 .Va smime-cipher
1892 .Va smime-encrypt-USER@HOST .
1893 Variables of secondary interest may be
1894 .Va content-description-smime-message
1896 .Va content-description-smime-signature .
1897 S/MIME is available if
1898 .Ql +smime
1899 is included in
1900 .Va features .
1903 \*(ID Note that neither S/MIME signing nor encryption applies to
1904 message subjects or other header fields yet.
1905 Thus they may not contain sensitive information for encrypted messages,
1906 and cannot be trusted even if the message content has been verified.
1907 When sending signed messages,
1908 it is recommended to repeat any important header information in the
1909 message text.
1910 .\" }}}
1912 .\" .Ss "On URL syntax and credential lookup" {{{ review
1913 .Ss "On URL syntax and credential lookup"
1915 For accessing protocol-specific resources Uniform Resource Locators
1916 (URL, RFC 3986) have become omnipresent.
1917 Here they are expected in a
1918 .Dq normalized
1919 variant, not used in data exchange, but only meant as a compact,
1920 easy-to-use way of defining and representing information in a well-known
1921 notation; as such they do not conform to any real standard.
1922 Optional parts are placed in brackets
1923 .Ql [] ,
1924 optional either because there also exist other ways to define the
1925 information, or because the part is protocol specific.
1926 .Ql /path
1927 for example is used by the \*(OPal Maildir
1928 .Ic folder
1929 type and the IMAP protocol, but not by POP3.
1931 .Ql USER
1933 .Ql PASSWORD
1934 are included in an URL server specification, URL percent encoded
1935 (RFC 3986) forms are needed, generable with
1936 .Ic urlcodec .
1939 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1942 Often
1943 .Sx "INTERNAL VARIABLES"
1944 exist in multiple versions, called
1945 .Dq variable chains
1946 in this document: the plain
1947 .Ql variable
1948 as well as
1949 .Ql variable-HOST
1951 .Ql variable-USER@HOST .
1952 If a port was specified
1953 .Ql HOST
1954 really means
1955 .Ql server:port ,
1957 .Ql server .
1958 And this
1959 .Ql USER
1960 is never in URL percent encoded form.
1961 For example, whether the hypothetical
1962 .Ql smtp://\:wings\:%3A\:of\:@a.dove
1963 including user and password was used, or whether it was
1964 .Ql smtp://a.dove
1965 and it came from a different source, to lookup the chain
1966 .Va tls-config-pairs
1967 first
1968 .Ql tls-\:config-\:pairs-\:wings:of@a.dove
1969 is looked up, then
1970 .Ql tls-\:config-pairs\-\:a.dove ,
1971 before finally looking up the plain variable.
1974 The logic to collect (an
1975 .Ic account Ns
1976 s) credential information is as follows:
1978 .Bl -bullet
1980 A user is always required.
1981 If no
1982 .Ql USER
1983 has been given in the URL the variables
1984 .Va user-HOST
1986 .Va user
1987 are looked up.
1988 Afterwards, when enforced by the \*(OPal variables
1989 .Va netrc-lookup-HOST
1991 .Va netrc-lookup ,
1992 .Sx "The .netrc file"
1993 of the user will be searched for a
1994 .Ql HOST
1995 specific entry which provides a
1996 .Ql login
1997 name: only unambiguous entries are used (one possible matching entry for
1998 .Ql HOST ) .
2000 If there is still no
2001 .Ql USER
2002 then the verified
2003 .Ev LOGNAME ,
2004 known to be a valid user on the current host, is used.
2007 Authentication: unless otherwise noted the chain
2008 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
2009 is checked, falling back to a protocol-specific default as necessary.
2012 If no
2013 .Ql PASSWORD
2014 has been given in the URL, then if the
2015 .Ql USER
2016 has been found through the \*(OPal
2017 .Va netrc-lookup ,
2018 that may have also provided the password.
2019 Otherwise the chain
2020 .Va password-USER@HOST , password-HOST , password
2021 is looked up.
2023 Thereafter the (now complete) \*(OPal chain
2024 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
2025 is checked, if set the
2026 .Ic netrc
2027 cache is searched for a password only (multiple user accounts for
2028 a single machine may exist as well as a fallback entry without user
2029 but with a password).
2031 If at that point there is still no password available, but the
2032 (protocols') chosen authentication type requires a password, then in
2033 interactive mode the user will be prompted on the terminal.
2037 .Sy Note:
2038 S/MIME verification works relative to the values found in the
2039 .Ql From:
2041 .Ql Sender: )
2042 header field(s), which means the values of
2043 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
2045 .Va smime-sign-digest
2046 will not be looked up using the
2047 .Ql USER
2049 .Ql HOST
2050 chains from above, but instead use the corresponding values from the
2051 message that is being worked on.
2052 If no address matches we assume and use the setting of
2053 .Va from .
2054 In unusual cases multiple and different
2055 .Ql USER
2057 .Ql HOST
2058 combinations may therefore be involved \(en on the other hand those
2059 unusual cases become possible.
2060 The usual case is as short as:
2062 .Bd -literal -offset indent
2063 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
2064     smime-sign smime-sign-cert=+smime.pair \e
2065     from=myname@my.host
2069 The section
2070 .Sx EXAMPLES
2071 contains complete example configurations.
2072 .\" }}}
2074 .\" .Ss "Encrypted network communication" {{{ review
2075 .Ss "Encrypted network communication"
2077 \*(OP SSL (Secure Sockets Layer) aka its successor TLS (Transport Layer
2078 Security) are protocols which aid in securing communication by providing
2079 a safely initiated and encrypted network connection.
2080 A central concept of TLS are certificates: as part of each network
2081 connection setup a (set of) certificates will be exchanged through which
2082 the identity of the network peer can be cryptographically verified;
2083 if possible the TLS/SNI (ServerNameIndication) extension will be enabled
2084 to allow servers fine-grained control over the certificates being used.
2085 A locally installed pool of trusted certificates will then be inspected,
2086 and verification will succeed if it contains a(n in)direct signer of the
2087 presented certificate(s).
2090 The local pool of trusted so-called CA (Certification Authority)
2091 certificates is usually delivered with and used along the TLS library.
2092 A custom pool of trusted certificates can be selected by pointing
2093 .Va tls-ca-file
2094 and/or (with special preparation)
2095 .Va tls-ca-dir
2096 to the desired location; setting
2097 .Va tls-ca-no-defaults
2098 in addition will avoid additional inspection of the default pool.
2099 A certificate cannot be more secure than the method its CA certificate
2100 has been retrieved with.
2101 For inspection or other purposes, the certificate of a server (as seen
2102 when connecting to it) can be fetched with the command
2103 .Ic tls
2104 (port can usually be the protocol name, too, and
2105 .Va tls-verify
2106 is taken into account here):
2108 .Bd -literal -offset indent
2109 $ \*(uA -vX 'tls certchain SERVER-URL[:PORT]; x'
2113 A local pool of CA certificates is not strictly necessary, however,
2114 server certificates can also be verified via their fingerprint.
2115 For this a message digest will be calculated and compared against the
2116 variable chain
2117 .Va tls-fingerprint ,
2118 and verification will succeed if the fingerprint matches.
2119 The message digest (algorithm) can be configured via the variable chain
2120 .Va tls-fingerprint-digest ;
2121 .Ic tls
2122 can again be used:
2124 .Bd -literal -offset indent
2125 $ \*(uA -X 'wysh set verbose; tls fingerprint SERVER-URL[:PORT]; x'
2129 It depends on the used protocol whether encrypted communication is
2130 possible, and which configuration steps have to be taken to enable it.
2131 Some protocols, like POP3S, are implicitly encrypted, others, like
2132 POP3, can upgrade a plain text connection if so requested.
2133 For example, to use the
2134 .Ql STLS
2135 that POP3 offers (a member of) the variable (chain)
2136 .Va pop3-use-starttls
2137 needs to be set, with convenience via
2138 .Ic shortcut :
2140 .Bd -literal -offset indent
2141 shortcut encpop1 pop3s://pop1.exam.ple
2143 shortcut encpop2 pop3://pop2.exam.ple
2144 set pop3-use-starttls-pop2.exam.ple
2146 set mta=smtps://smtp.exam.ple:465
2147 set mta=smtp://smtp.exam.ple smtp-use-starttls
2151 Normally that is all there is to do, given that TLS libraries try to
2152 provide safe defaults, plenty of knobs however exist to adjust settings.
2153 For example certificate verification settings can be fine-tuned via
2154 .Va tls-ca-flags ,
2155 and the TLS configuration basics are accessible via
2156 .Va tls-config-pairs ,
2157 for example to control protocol versions or cipher lists.
2158 In the past hints on how to restrict the set of protocols to highly
2159 secure ones were indicated, but as of the time of this writing the list
2160 of protocols or ciphers may need to become relaxed in order to be able
2161 to connect to some servers; the following example allows connecting to a
2162 .Dq Lion
2163 that uses OpenSSL 0.9.8za from June 2014 (refer to
2164 .Sx "INTERNAL VARIABLES"
2165 for more on variable chains):
2167 .Bd -literal -offset indent
2168 wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e
2169     CipherString=TLSv1.2:!aNULL:!eNULL:\e
2170       ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
2171       DHE-RSA-AES256-SHA:@STRENGTH'
2175 The OpenSSL program
2176 .Xr ciphers 1
2177 should be referred to when creating a custom cipher list.
2178 Variables of interest for TLS in general are
2179 .Va tls-ca-dir ,
2180 .Va tls-ca-file ,
2181 .Va tls-ca-flags ,
2182 .Va tls-ca-no-defaults ,
2183 .Va tls-config-file ,
2184 .Va tls-config-module ,
2185 .Va tls-config-pairs ,
2186 .Va tls-crl-dir ,
2187 .Va tls-crl-file ,
2188 .Va tls-rand-file
2189 as well as
2190 .Va tls-verify .
2191 Also see
2192 .Va tls-features .
2193 TLS is available if
2194 .Ql +tls
2195 is included in
2196 .Va features .
2197 .\" }}}
2199 .\" .Ss "Character sets" {{{
2200 .Ss "Character sets"
2202 \*(OP \*(UA detects the character set of the terminal by using
2203 mechanisms that are controlled by the
2204 .Ev LC_CTYPE
2205 environment variable
2206 (in fact
2207 .Ev LC_ALL ,
2208 .Ev \&\&LC_CTYPE ,
2209 .Ev LANG ,
2210 in that order, see there).
2211 The internal variable
2212 .Va ttycharset
2213 will be set to the detected terminal character set accordingly,
2214 and will thus show up in the output of commands like
2215 .Ic set
2217 .Ic varshow .
2220 However, the user may give
2221 .Va ttycharset
2222 a value during startup, making it possible to send mail in a completely
2223 .Dq faked
2224 locale environment, an option which can be used to generate and send for
2225 example 8-bit UTF-8 input data in a pure 7-bit US-ASCII
2226 .Ql LC_ALL=C
2227 environment (an example of this can be found in the section
2228 .Sx "On sending mail, and non-interactive mode" ) .
2229 Changing the value does not mean much beside that, because several
2230 aspects of the real character set are implied by the locale environment
2231 of the system, which stays unaffected by
2232 .Va ttycharset .
2235 Messages and attachments which consist of 7-bit clean data will be
2236 classified as consisting of
2237 .Va charset-7bit
2238 character data.
2239 This is a problem if the
2240 .Va ttycharset
2241 character set is a multibyte character set that is also 7-bit clean.
2242 For example, the Japanese character set ISO-2022-JP is 7-bit clean but
2243 capable to encode the rich set of Japanese Kanji, Hiragana and Katakana
2244 characters: in order to notify receivers of this character set the mail
2245 message must be MIME encoded so that the character set ISO-2022-JP can
2246 be advertised!
2247 To achieve this, the variable
2248 .Va charset-7bit
2249 must be set to ISO-2022-JP.
2250 (Today a better approach regarding email is the usage of UTF-8, which
2251 uses 8-bit bytes for non-US-ASCII data.)
2254 If the \*(OPal character set conversion capabilities are not available
2255 .Pf ( Va features
2256 does not include the term
2257 .Ql +iconv ) ,
2258 then
2259 .Va ttycharset
2260 will be the only supported character set,
2261 it is simply assumed that it can be used to exchange 8-bit messages
2262 (over the wire an intermediate, configurable
2263 .Va mime-encoding
2264 may be applied),
2265 and the rest of this section does not apply;
2266 it may however still be necessary to explicitly set it if automatic
2267 detection fails, since in that case it defaults to
2268 .\" (Keep in SYNC: ./nail.1:"Character sets", mx-config.h:CHARSET_*!)
2269 LATIN1 aka ISO-8859-1 unless the operating system environment is
2270 known to always and exclusively support UTF-8 locales.
2273 \*(OP When reading messages, their text is converted into
2274 .Va ttycharset
2275 as necessary in order to display them on the user's terminal.
2276 Unprintable characters and invalid byte sequences are detected
2277 and replaced by proper substitution characters.
2278 Character set mappings for source character sets can be established with
2279 the command
2280 .Ic charsetalias ,
2281 which may be handy to work around faulty character set catalogues (one
2282 could add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
2283 of one character set as another one (maybe interpret LATIN1 as CP1252).
2284 Also see
2285 .Va charset-unknown-8bit
2286 to deal with another hairy aspect of message interpretation.
2289 When sending messages their parts and attachments are classified.
2290 Whereas no character set conversion is performed on those parts which
2291 appear to be binary data,
2292 the character set being used must be declared within the MIME header of
2293 an outgoing text part if it contains characters that do not conform to
2294 the set of characters that are allowed by the email standards.
2295 Permissible values for character sets used in outgoing messages can be
2296 declared using the
2297 .Va sendcharsets
2298 variable, and
2299 .Va charset-8bit ,
2300 which defines a catch-all last-resort fallback character set that is
2301 implicitly appended to the list of character sets in
2302 .Va sendcharsets .
2305 When replying to a message and the variable
2306 .Va reply-in-same-charset
2307 is set, then the character set of the message being replied to
2308 is tried first (still being a subject of
2309 .Ic charsetalias ) .
2310 And it is also possible to make \*(UA work even more closely related to
2311 the current locale setting automatically by using the variable
2312 .Va sendcharsets-else-ttycharset ,
2313 please see there for more information.
2316 All the specified character sets are tried in order unless the
2317 conversion of the part or attachment succeeds.
2318 If none of the tried (8-bit) character sets is capable to represent the
2319 content of the part or attachment,
2320 then the message will not be send and its text will optionally be
2321 .Va save Ns d
2323 .Ev DEAD .
2324 If that is not acceptable, the variable
2325 .Va mime-force-sendout
2326 can be set in order to force sending of non-convertible text as
2327 .Ql application/octet-stream
2328 classified binary content instead; like this receivers still have the
2329 option to inspect message content (for example by setting
2330 .Va mime-counter-evidence ) .
2333 In general, if a message saying
2334 .Dq cannot convert from a to b
2335 appears, either some characters are not appropriate for the currently
2336 selected (terminal) character set,
2337 or the needed conversion is not supported by the system.
2338 In the first case, it is necessary to set an appropriate
2339 .Ev LC_CTYPE
2340 locale and/or the variable
2341 .Va ttycharset .
2342 The best results are usually achieved when \*(UA is run in a UTF-8
2343 locale on an UTF-8 capable terminal, in which case the full Unicode
2344 spectrum of characters is available.
2345 In this setup characters from various countries can be displayed,
2346 while it is still possible to use more simple character sets for sending
2347 to retain maximum compatibility with older mail clients.
2350 On the other hand the POSIX standard defines a locale-independent 7-bit
2351 .Dq portable character set
2352 that should be used when overall portability is an issue, the even more
2353 restricted subset named
2354 .Dq portable filename character set
2355 consists of A-Z, a-z, 0-9, period
2356 .Ql \&. ,
2357 underscore
2358 .Ql _
2359 and hyphen-minus
2360 .Ql - .
2361 .\" }}}
2363 .\" .Ss "Message states" {{{
2364 .Ss "Message states"
2366 \*(UA differentiates in between several message states; the current
2367 state will be reflected in the summary of
2368 .Ic headers
2369 if the
2370 .Va attrlist
2371 of the configured
2372 .Va headline
2373 allows, and
2374 .Sx "Specifying messages"
2375 dependent on their state is possible.
2376 When operating on the system
2377 .Va inbox ,
2378 or in any other
2379 .Mx -sx
2380 .Sx "primary system mailbox" ,
2381 special actions, like the automatic moving of messages to the
2382 .Mx -sx
2383 .Sx "secondary mailbox"
2384 .Ev MBOX ,
2385 may be applied when the mailbox is left (also implicitly by program
2386 termination, unless the command
2387 .Ic exit
2388 was used) \(en however, because this may be irritating to users which
2389 are used to
2390 .Dq more modern
2391 mail-user-agents, the provided global
2392 .Pa \*(UR
2393 template sets the internal
2394 .Va hold
2396 .Va keepsave
2397 variables in order to suppress this behaviour.
2399 .Bl -hang -width ".It Ql new"
2400 .It Ql new
2401 Message has neither been viewed nor moved to any other state.
2402 Such messages are retained even in the
2403 .Mx -sx
2404 .Sx "primary system mailbox" .
2406 .It Ql unread
2407 Message has neither been viewed nor moved to any other state, but the
2408 message was present already when the mailbox has been opened last:
2409 Such messages are retained even in the
2410 .Mx -sx
2411 .Sx "primary system mailbox" .
2413 .It Ql read
2414 The message has been processed by one of the following commands:
2415 .Ic ~f ,
2416 .Ic ~m ,
2417 .Ic ~F ,
2418 .Ic ~M ,
2419 .Ic copy ,
2420 .Ic mbox ,
2421 .Ic next ,
2422 .Ic pipe  ,
2423 .Ic Print ,
2424 .Ic print ,
2425 .Ic top ,
2426 .Ic Type ,
2427 .Ic type ,
2428 .Ic undelete .
2429 The commands
2430 .Ic dp
2432 .Ic dt
2433 will always try to automatically
2434 .Dq step
2436 .Ic type
2438 .Dq next
2439 logical message, and may thus mark multiple messages as read, the
2440 .Ic delete
2441 command will do so if the internal variable
2442 .Va autoprint
2443 is set.
2445 Except when the
2446 .Ic exit
2447 command is used, messages that are in a
2448 .Mx -sx
2449 .Sx "primary system mailbox"
2450 and are in
2451 .Ql read
2452 state when the mailbox is left will be saved in the
2453 .Mx -sx
2454 .Sx "secondary mailbox"
2455 .Ev MBOX
2456 unless the internal variable
2457 .Va hold
2458 it set.
2460 .It Ql deleted
2461 The message has been processed by one of the following commands:
2462 .Ic delete ,
2463 .Ic dp ,
2464 .Ic dt .
2465 Only
2466 .Ic undelete
2467 can be used to access such messages.
2469 .It Ql preserved
2470 The message has been processed by a
2471 .Ic preserve
2472 command and it will be retained in its current location.
2474 .It Ql saved
2475 The message has been processed by one of the following commands:
2476 .Ic save
2478 .Ic write .
2479 Unless when the
2480 .Ic exit
2481 command is used, messages that are in a
2482 .Mx -sx
2483 .Sx "primary system mailbox"
2484 and are in
2485 .Ql saved
2486 state when the mailbox is left will be deleted; they will be saved in the
2487 .Mx -sx
2488 .Sx "secondary mailbox"
2489 .Ev MBOX
2490 when the internal variable
2491 .Va keepsave
2492 is set.
2496 In addition to these message states, flags which otherwise have no
2497 technical meaning in the mail system except allowing special ways of
2498 addressing them when
2499 .Sx "Specifying messages"
2500 can be set on messages.
2501 These flags are saved with messages and are thus persistent, and are
2502 portable between a set of widely used MUAs.
2504 .Bl -hang -width ".It Ic answered"
2505 .It Ic answered
2506 Mark messages as having been answered.
2507 .It Ic draft
2508 Mark messages as being a draft.
2509 .It Ic flag
2510 Mark messages which need special attention.
2512 .\" }}}
2514 .\" .Ss "Specifying messages" {{{
2515 .Ss "Specifying messages"
2517 \*(NQ
2518 .Ic COMMANDS
2519 which take
2520 .Sx "Message list arguments" ,
2521 such as
2522 .Ic search ,
2523 .Ic type ,
2524 .Ic copy ,
2526 .Ic delete ,
2527 can perform actions on a number of messages at once.
2528 Specifying invalid messages, or using illegal syntax, will cause errors
2529 to be reported through the
2530 .Sx "INTERNAL VARIABLES"
2531 .Va \&! ,
2532 .Va ^ERR
2533 and companions, as well as the command exit status
2534 .Va \&? .
2537 For example,
2538 .Ql delete 1 2
2539 deletes the messages 1 and 2,
2540 whereas
2541 .Ql delete 1-5
2542 will delete the messages 1 through 5.
2543 In sorted or threaded mode (see the
2544 .Ic sort
2545 command),
2546 .Ql delete 1-5
2547 will delete the messages that are located between (and including)
2548 messages 1 through 5 in the sorted/threaded order, as shown in the
2549 .Ic headers
2550 summary.
2553 Errors can for example be
2554 .Va ^ERR Ns -BADMSG
2555 when requesting an invalid message,
2556 .Va ^ERR Ns -NOMSG
2557 if no applicable message can be found,
2558 .Va ^ERR Ns -CANCELED
2559 for missing informational data (mostly thread-related).
2560 .Va ^ERR Ns -INVAL
2561 for invalid syntax as well as
2562 .Va ^ERR Ns -IO
2563 for input/output errors can happen.
2564 The following special message names exist:
2567 .Bl -tag -width ".It Ar BaNg"
2568 .It Ar \&.
2569 The current message, the so-called
2570 .Dq dot .
2572 .It Ar \&;
2573 The message that was previously the current message; needs to be quoted.
2575 .It Ar \&,
2576 The parent message of the current message,
2577 that is the message with the Message-ID given in the
2578 .Ql In-Reply-To:
2579 field or the last entry of the
2580 .Ql References:
2581 field of the current message.
2583 .It Ar -
2584 The previous undeleted message, or the previous deleted message for the
2585 .Ic undelete
2586 command; In
2587 .Ic sort Ns
2588 ed or
2589 .Ql thread Ns
2590 ed mode, the previous such message in the according order.
2592 .It Ar +
2593 The next undeleted message, or the next deleted message for the
2594 .Ic undelete
2595 command; In
2596 .Ic sort Ns
2597 ed or
2598 .Ql thread Ns
2599 ed mode, the next such message in the according order.
2601 .It Ar ^
2602 The first undeleted message,
2603 or the first deleted message for the
2604 .Ic undelete
2605 command; In
2606 .Ic sort Ns
2607 ed or
2608 .Ql thread Ns
2609 ed mode, the first such message in the according order.
2611 .It Ar $
2612 The last message; In
2613 .Ic sort Ns
2614 ed or
2615 .Ql thread Ns
2616 ed mode, the last such message in the according order.
2617 Needs to be quoted.
2619 .It Ar & Ns Ar x
2621 .Ql thread Ns
2623 .Ic sort
2624 mode, selects the message addressed with
2625 .Ar x ,
2626 where
2627 .Ar x
2628 is any other message specification,
2629 and all messages from the thread that begins at it.
2630 Otherwise it is identical to
2631 .Ar x .
2633 .Ar x
2634 is omitted,
2635 the thread beginning with the current message is selected.
2637 .It Ar *
2638 All messages.
2640 .It Ar `
2641 All messages that were included in the
2642 .Sx "Message list arguments"
2643 of the previous command; needs to be quoted.
2644 (A convenient way to read all new messages is to select them via
2645 .Ql from :n ,
2646 as below, and then to read them in order with the default command \(em
2647 .Ic next
2648 \(em simply by successively typing
2649 .Ql ` ;
2650 for this to work
2651 .Va showlast
2652 must be set.)
2654 .It Ar x-y
2655 An inclusive range of message numbers.
2656 Selectors that may also be used as endpoints include any of
2657 .Ar .;-+^$ .
2659 .It Ar address
2660 A case-insensitive
2661 .Dq any substring matches
2662 search against the
2663 .Ql From:
2664 header, which will match addresses (too) even if
2665 .Va showname
2666 is set (and POSIX says
2667 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2668 However, if the
2669 .Va allnet
2670 variable is set, only the local part of the address is evaluated
2671 for the comparison, not ignoring case, and the setting of
2672 .Va showname
2673 is completely ignored.
2674 For finer control and match boundaries use the
2675 .Ql @
2676 search expression.
2678 .It Ar / Ns Ar string
2679 All messages that contain
2680 .Ar string
2681 in the subject field (case ignored according to locale).
2682 See also the
2683 .Va searchheaders
2684 variable.
2686 .Ar string
2687 is empty,
2688 the string from the previous specification of that type is used again.
2691 .It Xo Op Ar @ Ns Ar name-list Ns
2692 .Ar @ Ns Ar expr
2694 All messages that contain the given case-insensitive search
2695 .Ar expr Ns
2696 ession;  If the \*(OPal regular expression support is available
2697 .Ar expr
2698 will be interpreted as (an extended) one if any of the
2699 .Mx -sx
2700 .Sx "magic regular expression characters"
2701 is seen.
2702 If the optional
2703 .Ar @ Ns Ar name-list
2704 part is missing the search is restricted to the subject field body,
2705 but otherwise
2706 .Ar name-list
2707 specifies a comma-separated list of header fields to search, for example
2710 .Dl '@to,from,cc@Someone i ought to know'
2713 In order to search for a string that includes a
2714 .Ql @
2715 (commercial at) character the
2716 .Ar name-list
2717 is effectively non-optional, but may be given as the empty string.
2718 Also, specifying an empty search
2719 .Ar expr Ns
2720 ession will effectively test for existence of the given header fields.
2721 Some special header fields may be abbreviated:
2722 .Ql f ,
2723 .Ql t ,
2724 .Ql c ,
2725 .Ql b
2727 .Ql s
2728 will match
2729 .Ql From ,
2730 .Ql To ,
2731 .Ql Cc ,
2732 .Ql Bcc
2734 .Ql Subject ,
2735 respectively and case-insensitively.
2736 \*(OPally, and just like
2737 .Ar expr ,
2738 .Ar name-list
2739 will be interpreted as (an extended) regular expression if any of the
2740 .Mx -sx
2741 .Sx "magic regular expression characters"
2742 is seen.
2745 The special names
2746 .Ql header
2748 .Ql <
2749 can be used to search in (all of) the header(s) of the message, and the
2750 special names
2751 .Ql body
2753 .Ql >
2755 .Ql text
2757 .Ql =
2758 will perform full text searches \(en whereas the former searches only
2759 the body, the latter also searches the message header (\*(ID this mode
2760 yet brute force searches over the entire decoded content of messages,
2761 including administrativa strings).
2764 This specification performs full text comparison, but even with
2765 regular expression support it is almost impossible to write a search
2766 expression that safely matches only a specific address domain.
2767 To request that the body content of the header is treated as a list of
2768 addresses, and to strip those down to the plain email address which the
2769 search expression is to be matched against, prefix the effective
2770 .Ar name-list
2771 with a tilde
2772 .Ql ~ :
2775 .Dl '@~f,c@@a\e.safe\e.domain\e.match$'
2778 .It Ar :c
2779 All messages of state or with matching condition
2780 .Ql c ,
2781 where
2782 .Ql c
2783 is one or multiple of the following colon modifiers:
2785 .Bl -tag -compact -width ".It Ar :M"
2786 .It Ar a
2787 .Ic answered
2788 messages (cf. the variable
2789 .Va markanswered ) .
2790 .It Ar d
2791 .Ql deleted
2792 messages (for the
2793 .Ic undelete
2795 .Ic from
2796 commands only).
2797 .It Ar f
2798 .Ic flag Ns
2799 ged messages.
2800 .It Ar L
2801 Messages with receivers that match
2802 .Ic mlsubscribe Ns
2803 d addresses.
2804 .It Ar l
2805 Messages with receivers that match
2806 .Ic mlist Ns
2807 ed addresses.
2808 .It Ar n
2809 .Ql new
2810 messages.
2811 .It Ar o
2812 Old messages (any not in state
2813 .Ql read
2815 .Ql new ) .
2816 .It Ar r
2817 .Ql read
2818 messages.
2819 .It Ar S
2820 \*(OP Messages with unsure spam classification (see
2821 .Sx "Handling spam" ) .
2822 .It Ar s
2823 \*(OP Messages classified as spam.
2824 .It Ar t
2825 Messages marked as
2826 .Ic draft .
2827 .It Ar u
2828 .Ql unread
2829 messages.
2835 \*(OP IMAP-style SEARCH expressions may also be used.
2836 These consist of keywords and criterions, and because
2837 .Sx "Message list arguments"
2838 are split into tokens according to
2839 .Sx "Shell-style argument quoting"
2840 it is necessary to quote the entire IMAP search expression in order to
2841 ensure that it remains a single token.
2842 This addressing mode is available with all types of mailbox
2843 .Ic folder Ns
2844 s; \*(UA will perform the search locally as necessary.
2845 Strings must be enclosed by double quotation marks
2846 .Ql \&"
2847 in their entirety if they contain whitespace or parentheses;
2848 within the quotes, only reverse solidus
2849 .Ql \e
2850 is recognized as an escape character.
2851 All string searches are case-insensitive.
2852 When the description indicates that the
2853 .Dq envelope
2854 representation of an address field is used,
2855 this means that the search string is checked against both a list
2856 constructed as
2858 .Bd -literal -offset indent
2859 \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)'
2863 for each address,
2864 and the addresses without real names from the respective header field.
2865 These search expressions can be nested using parentheses, see below for
2866 examples.
2869 .Bl -tag -compact -width ".It Ar _n_u"
2870 .It Ar ( criterion )
2871 All messages that satisfy the given
2872 .Ar criterion .
2873 .It Ar ( criterion1 criterion2 ... criterionN )
2874 All messages that satisfy all of the given criteria.
2876 .It Ar ( or criterion1 criterion2 )
2877 All messages that satisfy either
2878 .Ar criterion1
2880 .Ar criterion2 ,
2881 or both.
2882 To connect more than two criteria using
2883 .Ql or
2884 specifications have to be nested using additional parentheses,
2885 as with
2886 .Ql (or a (or b c)) ,
2887 since
2888 .Ql (or a b c)
2889 really means
2890 .Ql ((a or b) and c) .
2891 For a simple
2892 .Ql or
2893 operation of independent criteria on the lowest nesting level,
2894 it is possible to achieve similar effects by using three separate
2895 criteria, as with
2896 .Ql (a) (b) (c) .
2898 .It Ar ( not criterion )
2899 All messages that do not satisfy
2900 .Ar criterion .
2901 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2902 All messages that contain
2903 .Ar string
2904 in the envelope representation of the
2905 .Ql Bcc:
2906 field.
2907 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2908 All messages that contain
2909 .Ar string
2910 in the envelope representation of the
2911 .Ql Cc:
2912 field.
2913 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2914 All messages that contain
2915 .Ar string
2916 in the envelope representation of the
2917 .Ql From:
2918 field.
2919 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2920 All messages that contain
2921 .Ar string
2922 in the
2923 .Ql Subject:
2924 field.
2925 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2926 All messages that contain
2927 .Ar string
2928 in the envelope representation of the
2929 .Ql To:
2930 field.
2931 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2932 All messages that contain
2933 .Ar string
2934 in the specified
2935 .Ql Name:
2936 field.
2937 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2938 All messages that contain
2939 .Ar string
2940 in their body.
2941 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2942 All messages that contain
2943 .Ar string
2944 in their header or body.
2945 .It Ar ( larger size )
2946 All messages that are larger than
2947 .Ar size
2948 (in bytes).
2949 .It Ar ( smaller size )
2950 All messages that are smaller than
2951 .Ar size
2952 (in bytes).
2954 .It Ar ( before date )
2955 All messages that were received before
2956 .Ar date ,
2957 which must be in the form
2958 .Ql d[d]-mon-yyyy ,
2959 where
2960 .Ql d
2961 denotes the day of the month as one or two digits,
2962 .Ql mon
2963 is the name of the month \(en one of
2964 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2966 .Ql yyyy
2967 is the year as four digits, for example
2968 .Ql 28-Dec-2012 .
2970 .It Ar ( on date )
2971 All messages that were received on the specified date.
2972 .It Ar ( since date )
2973 All messages that were received since the specified date.
2974 .It Ar ( sentbefore date )
2975 All messages that were sent on the specified date.
2976 .It Ar ( senton date )
2977 All messages that were sent on the specified date.
2978 .It Ar ( sentsince date )
2979 All messages that were sent since the specified date.
2980 .It Ar ()
2981 The same criterion as for the previous search.
2982 This specification cannot be used as part of another criterion.
2983 If the previous command line contained more than one independent
2984 criterion then the last of those criteria is used.
2986 .\" }}}
2988 .\" .Ss "On terminal control and line editor" {{{ review
2989 .Ss "On terminal control and line editor"
2991 \*(OP Terminal control through one of the standard
2993 libraries,
2994 .Lb libtermcap
2996 .Lb libterminfo ,
2997 may be available.
2998 For the
2999 .Ev TERM Ns
3000 inal defined in the environment interactive usage aspects, for example
3001 .Sx "Coloured display" ,
3002 and insight of cursor and function keys for the Mailx-Line-Editor
3003 (MLE), will be enhanced or enabled.
3004 Library interaction can be disabled on a per-invocation basis via
3005 .Va termcap-disable ,
3006 whereas the internal variable
3007 .Va termcap
3008 is always used as a preferred source of terminal capabilities.
3009 (For a usage example see the
3010 .Sx FAQ
3011 entry
3012 .Sx "Not \(dqdefunctional\(dq, but the editor key does not work" . )
3015 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
3016 environments which comply to the ISO C standard
3017 .St -isoC-amd1 ,
3018 and will support wide glyphs if possible (the necessary functionality
3019 had been removed from ISO C, but was included in
3020 .St -xpg4 ) .
3021 Usage of a line editor in interactive mode can be prevented by setting
3022 .Va line-editor-disable .
3023 Especially if the \*(OPal terminal control support is missing setting
3024 entries in
3025 .Va termcap
3026 will help shall the MLE misbehave, see there for more.
3027 The MLE can support a little bit of
3028 .Ic colour .
3031 \*(OP If the
3032 .Ic history
3033 feature is available then input from line editor prompts will be saved
3034 in a history list that can be searched in and be expanded from.
3035 Such saving can be prevented by prefixing input with any amount of
3036 whitespace.
3037 Aspects of history, like allowed content and maximum size, as well as
3038 whether history shall be saved persistently, can be configured with the
3039 internal variables
3040 .Va history-file ,
3041 .Va history-gabby ,
3042 .Va history-gabby-persist
3044 .Va history-size .
3045 There also exists the macro hook
3046 .Va on-history-addition
3047 which can be used to apply finer control on what enters history.
3050 The MLE supports a set of editing and control commands.
3051 By default (as) many (as possible) of these will be assigned to a set of
3052 single-letter control codes, which should work on any terminal (and can
3053 be generated by holding the
3054 .Dq control
3055 key while pressing the key of desire, for example
3056 .Ql control-D ) .
3057 If the \*(OPal
3058 .Ic bind
3059 command is available then the MLE commands can also be accessed freely
3060 by assigning the command name, which is shown in parenthesis in the list
3061 below, to any desired key-sequence, and the MLE will instead and also use
3062 .Ic bind
3063 to establish its built-in key bindings
3064 (more of them if the \*(OPal terminal control is available),
3065 an action which can then be suppressed completely by setting
3066 .Va line-editor-no-defaults .
3067 .Sx "Shell-style argument quoting"
3068 notation is used in the following:
3072 .Bl -tag -compact -width ".It Ql \eBa"
3073 .It Ql \ecA
3074 Go to the start of the line
3076 .Pf ( Cd mle-go-home ) .
3078 .It Ql \ecB
3079 Move the cursor backward one character
3081 .Pf ( Cd mle-go-bwd ) .
3083 .It Ql \ecC
3084 .Xr raise 3
3085 .Ql SIGINT
3087 .Pf ( Cd mle-raise-int ) .
3089 .It Ql \ecD
3090 Forward delete the character under the cursor;
3091 quits \*(UA if used on the empty line unless the internal variable
3092 .Va ignoreeof
3093 is set
3095 .Pf ( Cd mle-del-fwd ) .
3097 .It Ql \ecE
3098 Go to the end of the line
3100 .Pf ( Cd mle-go-end ) .
3102 .It Ql \ecF
3103 Move the cursor forward one character
3105 .Pf ( Cd mle-go-fwd ) .
3107 .It Ql \ecG
3108 Cancel current operation, full reset.
3109 If there is an active history search or tabulator expansion then this
3110 command will first reset that, reverting to the former line content;
3111 thus a second reset is needed for a full reset in this case
3113 .Pf ( Cd mle-reset ) .
3115 .It Ql \ecH
3116 Backspace: backward delete one character
3118 .Pf ( Cd mle-del-bwd ) .
3120 .It Ql \ecI
3121 \*(NQ
3122 Horizontal tabulator:
3123 try to expand the word before the cursor, supporting the usual
3124 .Sx "Filename transformations"
3126 .Pf ( Cd mle-complete ;
3127 this is affected by
3128 .Cd mle-quote-rndtrip
3130 .Va line-editor-cpl-word-breaks ) .
3132 .It Ql \ecJ
3133 Newline:
3134 commit the current line
3136 .Pf ( Cd mle-commit ) .
3138 .It Ql \ecK
3139 Cut all characters from the cursor to the end of the line
3141 .Pf ( Cd mle-snarf-end ) .
3143 .It Ql \ecL
3144 Repaint the line
3146 .Pf ( Cd mle-repaint ) .
3148 .It Ql \ecN
3149 \*(OP Go to the next history entry
3151 .Pf ( Cd mle-hist-fwd ) .
3153 .It Ql \ecO
3154 (\*(OPally context-dependent) Invokes the command
3155 .Ic dt .
3157 .It Ql \ecP
3158 \*(OP Go to the previous history entry
3160 .Pf ( Cd mle-hist-bwd ) .
3162 .It Ql \ecQ
3163 Toggle roundtrip mode shell quotes, where produced,
3164 on and off
3166 .Pf ( Cd mle-quote-rndtrip ) .
3167 This setting is temporary, and will be forgotten once the command line
3168 is committed; also see
3169 .Ic shcodec .
3171 .It Ql \ecR
3172 \*(OP Complete the current line from (the remaining) older history entries
3174 .Pf ( Cd mle-hist-srch-bwd ) .
3176 .It Ql \ecS
3177 \*(OP Complete the current line from (the remaining) newer history entries
3179 .Pf ( Cd mle-hist-srch-fwd ) .
3181 .It Ql \ecT
3182 Paste the snarf buffer
3184 .Pf ( Cd mle-paste ) .
3186 .It Ql \ecU
3187 The same as
3188 .Ql \ecA
3189 followed by
3190 .Ql \ecK
3192 .Pf ( Cd mle-snarf-line ) .
3194 .It Ql \ecV
3195 Prompts for a Unicode character (hexadecimal number without prefix, see
3196 .Ic vexpr )
3197 to be inserted
3199 .Pf ( Cd mle-prompt-char ) .
3200 Note this command needs to be assigned to a single-letter control code
3201 in order to become recognized and executed during input of
3202 a key-sequence (only three single-letter control codes can be used for
3203 that shortcut purpose); this control code is then special-treated and
3204 thus cannot be part of any other sequence (because it will trigger the
3205 .Cd \&\&mle-prompt-char
3206 function immediately).
3208 .It Ql \ecW
3209 Cut the characters from the one preceding the cursor to the preceding
3210 word boundary
3212 .Pf ( Cd mle-snarf-word-bwd ) .
3214 .It Ql \ecX
3215 Move the cursor forward one word boundary
3217 .Pf ( Cd mle-go-word-fwd ) .
3219 .It Ql \ecY
3220 Move the cursor backward one word boundary
3222 .Pf ( Cd mle-go-word-bwd ) .
3224 .It Ql \ecZ
3225 .Xr raise 3
3226 .Ql SIGTSTP
3228 .Pf ( Cd mle-raise-tstp ) .
3230 .It Ql \ec[
3231 Escape: reset a possibly used multibyte character input state machine
3232 and \*(OPally a lingering, incomplete key binding
3234 .Pf ( Cd mle-cancel ) .
3235 This command needs to be assigned to a single-letter control code in
3236 order to become recognized and executed during input of a key-sequence
3237 (only three single-letter control codes can be used for that shortcut
3238 purpose).
3239 This control code may also be part of a multi-byte sequence, but if
3240 a sequence is active and the very control code is currently also an
3241 expected input, then the active sequence takes precedence and will
3242 consume the control code.
3244 .It Ql \ec\e
3245 (\*(OPally context-dependent) Invokes the command
3246 .Ql Ic z Ns + .
3248 .It Ql \ec]
3249 (\*(OPally context-dependent) Invokes the command
3250 .Ql Ic z Ns $ .
3252 .It Ql \ec^
3253 (\*(OPally context-dependent) Invokes the command
3254 .Ql Ic z Ns 0 .
3256 .It Ql \ec_
3257 Cut the characters from the one after the cursor to the succeeding word
3258 boundary
3260 .Pf ( Cd mle-snarf-word-fwd ) .
3262 .It Ql \ec?
3263 Backspace:
3264 .Cd mle-del-bwd .
3266 .It \(en
3268 .Cd mle-bell :
3269 ring the audible bell.
3271 .It \(en
3272 \*(OP
3274 .Cd mle-clear-screen :
3275 move the cursor home and clear the screen.
3277 .It \(en
3279 .Cd mle-fullreset :
3280 different to
3281 .Cd mle-reset
3282 this will immediately reset a possibly active search etc.
3284 .It \(en
3286 .Cd mle-go-screen-bwd :
3287 move the cursor backward one screen width.
3289 .It \(en
3291 .Cd mle-go-screen-fwd :
3292 move the cursor forward one screen width.
3294 .It \(en
3296 .Cd mle-raise-quit:
3297 .Xr raise 3
3298 .Ql SIGQUIT .
3300 .\" }}}
3302 .\" .Ss "Coloured display" {{{ review
3303 .Ss "Coloured display"
3305 \*(OP Colours and font attributes through ANSI a.k.a. ISO 6429 SGR
3306 (select graphic rendition) escape sequences are optionally supported.
3307 Usage of colours and font attributes solely depends upon the
3308 capability of the detected terminal type
3309 .Pf ( Ev TERM ) ,
3310 and as fine-tuned through
3311 .Va termcap .
3312 Colours and font attributes can be managed with the multiplexer command
3313 .Ic colour ,
3315 .Ic uncolour
3316 removes the given mappings.
3317 Setting
3318 .Va colour-disable
3319 suppresses usage of colour and font attribute sequences, while leaving
3320 established mappings unchanged.
3323 Whether actually applicable colour and font attribute sequences should
3324 also be generated when output is going to be paged through the external
3325 .Ev PAGER
3326 (also see
3327 .Va crt Ns
3328 ) depends upon the setting of
3329 .Va colour-pager ,
3330 because pagers usually need to be configured in order to support ISO
3331 escape sequences.
3332 Knowledge of some widely used pagers is however built-in, and in a clean
3333 environment it is often enough to simply set
3334 .Va colour-pager ;
3335 please refer to that variable for more on this topic.
3338 It might make sense to conditionalize colour setup on interactive mode via
3339 .Ic if
3340 .Pf ( Ql terminal
3341 indeed means
3342 .Dq interactive ) :
3344 .Bd -literal -offset indent
3345 if terminal && "$features" =% +colour
3346   colour iso view-msginfo ft=bold,fg=green
3347   colour iso view-header ft=bold,fg=red (from|subject) # regex
3348   colour iso view-header fg=red
3350   uncolour iso view-header from,subject
3351   colour iso view-header ft=bold,fg=magenta,bg=cyan
3352   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
3353   colour mono view-header ft=bold
3354   colour mono view-header ft=bold,ft=reverse subject,from
3355 endif
3357 .\" }}}
3359 .\" .Ss "Handling spam" {{{
3360 .Ss "Handling spam"
3362 \*(OP \*(UA can make use of several spam interfaces for the purpose of
3363 identification of, and, in general, dealing with spam messages.
3364 A precondition of most commands in order to function is that the
3365 .Va spam-interface
3366 variable is set to one of the supported interfaces.
3367 .Sx "Specifying messages"
3368 that have been identified as spam is possible via their (volatile)
3369 .Ql is-spam
3370 state by using the
3371 .Ql Ar :s
3373 .Ql Ar :S
3374 specifications, and their
3375 .Va attrlist
3376 entries will be used when displaying the
3377 .Va headline
3378 in the summary of
3379 .Ic headers .
3381 .Bl -bullet
3383 .Ic spamrate
3384 rates the given messages and sets their
3385 .Ql is-spam
3386 flag accordingly.
3387 If the spam interface offers spam scores these can be shown in
3388 .Va headline
3389 by using the format
3390 .Ql %$ .
3392 .Ic spamham ,
3393 .Ic spamspam
3395 .Ic spamforget
3396 will interact with the Bayesian filter of the chosen interface and learn
3397 the given messages as
3398 .Dq ham
3400 .Dq spam ,
3401 respectively; the last command can be used to cause
3402 .Dq unlearning
3403 of messages; it adheres to their current
3404 .Ql is-spam
3405 state and thus reverts previous teachings.
3407 .Ic spamclear
3409 .Ic spamset
3410 will simply set and clear, respectively, the mentioned volatile
3411 .Ql is-spam
3412 message flag, without any interface interaction.
3417 .Xr spamassassin 1
3418 based
3419 .Va spam-interface
3420 .Ql spamc
3421 requires a running instance of the
3422 .Xr spamd 1
3423 server in order to function, started with the option
3424 .Fl -allow-tell
3425 shall Bayesian filter learning be possible.
3427 .Bd -literal -offset indent
3428 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3429 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3430     --daemonize [--local] [--allow-tell]
3434 Thereafter \*(UA can make use of these interfaces:
3436 .Bd -literal -offset indent
3437 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3438     -Sspamc-command=/usr/local/bin/spamc \e
3439     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3441 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3442     -Sspamc-command=/usr/local/bin/spamc \e
3443     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3447 Using the generic filter approach allows usage of programs like
3448 .Xr bogofilter 1 .
3449 Here is an example, requiring it to be accessible via
3450 .Ev PATH :
3452 .Bd -literal -offset indent
3453 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3454     -Sspamfilter-ham="bogofilter -n" \e
3455     -Sspamfilter-noham="bogofilter -N" \e
3456     -Sspamfilter-nospam="bogofilter -S" \e
3457     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3458     -Sspamfilter-spam="bogofilter -s" \e
3459     -Sspamfilter-rate-scanscore="1;^(.+)$"
3463 Because messages must exist on local storage in order to be scored (or
3464 used for Bayesian filter training), it is possibly a good idea to
3465 perform the local spam check last.
3466 Spam can be checked automatically when opening specific folders by
3467 setting a specialized form of the internal variable
3468 .Va folder-hook .
3470 .Bd -literal -offset indent
3471 define spamdelhook {
3472   # Server side DCC
3473   spamset (header x-dcc-brand-metrics "bulk")
3474   # Server-side spamassassin(1)
3475   spamset (header x-spam-flag "YES")
3476   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3477   move :S +maybe-spam
3478   spamrate :u
3479   del :s
3480   move :S +maybe-spam
3482 set folder-hook-SOMEFOLDER=spamdelhook
3486 See also the documentation for the variables
3487 .Va spam-interface , spam-maxsize ,
3488 .Va spamc-command , spamc-arguments , spamc-user ,
3489 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3490   spamfilter-rate
3492 .Va spamfilter-rate-scanscore .
3493 .\" }}}
3495 .\" }}} (DESCRIPTION)
3498 .\" .Sh COMMANDS {{{
3499 .Sh COMMANDS
3501 \*(UA reads input in lines.
3502 An unquoted reverse solidus
3503 .Ql \e
3504 at the end of a command line
3505 .Dq escapes
3506 the newline character: it is discarded and the next line of input is
3507 used as a follow-up line, with all leading whitespace removed;
3508 once an entire line is completed, the whitespace characters
3509 .Cm space , tabulator , newline
3510 as well as those defined by the variable
3511 .Va ifs
3512 are removed from the beginning and end.
3513 Placing any whitespace characters at the beginning of a line will
3514 prevent a possible addition of the command line to the \*(OPal
3515 .Ic history .
3518 The beginning of such input lines is then scanned for the name of
3519 a known command: command names may be abbreviated, in which case the
3520 first command that matches the given prefix will be used.
3521 .Sx "Command modifiers"
3522 may prefix a command in order to modify its behaviour.
3523 A name may also be a
3524 .Ic commandalias ,
3525 which will become expanded until no more expansion is possible.
3526 Once the command that shall be executed is known, the remains of the
3527 input line will be interpreted according to command-specific rules,
3528 documented in the following.
3531 This behaviour is different to the
3532 .Xr sh 1 Ns
3533 ell, which is a programming language with syntactic elements of clearly
3534 defined semantics, and therefore capable to sequentially expand and
3535 evaluate individual elements of a line.
3536 \*(UA will never be able to handle
3537 .Ql \&? set one=value two=$one
3538 in a single statement, because the variable assignment is performed by
3539 the command
3540 .Pf ( Ic set ) ,
3541 not the language.
3544 A list of all commands in lookup order is dumped by the command
3545 .Ic list .
3546 \*(OPally the command
3547 .Ic help
3549 .Ic \&? ) ,
3550 when given an argument, will show a documentation string for the
3551 command matching the expanded argument, as in
3552 .Ql \&?t ,
3553 which should be a shorthand of
3554 .Ql \&?type ;
3555 with these documentation strings both commands support a more
3556 .Va verbose
3557 listing mode which includes the argument type of the command and other
3558 information which applies; a handy suggestion might thus be:
3560 .Bd -literal -offset indent
3561 ? define __xv {
3562   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3563   localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}
3565 ? commandalias xv '\ecall __xv'
3566 ? xv help set
3569 .\" .Ss "Command modifiers" {{{
3570 .Ss "Command modifiers"
3572 Commands may be prefixed by none to multiple command modifiers.
3573 Some command modifiers can be used with a restricted set of commands
3574 only, the
3575 .Va verbose
3576 version of
3577 .Ic list
3578 will (\*(OPally) show which modifiers apply.
3580 .Bl -bullet
3582 The modifier reverse solidus
3584 .Cm \e ,
3585 to be placed first, prevents
3586 .Ic commandalias
3587 expansions on the remains of the line, for example
3588 .Ql \eecho
3589 will always evaluate the command
3590 .Ic echo ,
3591 even if an (command)alias of the same name exists.
3592 .Ic commandalias
3593 content may itself contain further command modifiers, including
3594 an initial reverse solidus to prevent further expansions.
3597 The modifier
3599 .Cm ignerr
3600 indicates that any error generated by the following command should be
3601 ignored by the state machine and not cause a program exit with enabled
3602 .Va errexit
3603 or for the standardized exit cases in
3604 .Va posix
3605 mode.
3606 .Va \&? ,
3607 one of the
3608 .Sx "INTERNAL VARIABLES" ,
3609 will be set to the real exit status of the command regardless.
3613 .Cm local
3614 will alter the called command to apply changes only temporarily,
3615 local to block-scope, and can thus only be used inside of a
3616 .Ic define Ns
3617 d macro or an
3618 .Ic account
3619 definition.
3620 Specifying it implies the modifier
3621 .Cm wysh .
3622 Block-scope settings will not be inherited by macros deeper in the
3623 .Ic call
3624 chain, and will be garbage collected once the current block is left.
3625 To record and unroll changes in the global scope use the command
3626 .Ic localopts .
3630 .Cm scope
3631 does yet not implement any functionality.
3635 .Cm u
3636 does yet not implement any functionality.
3639 Some commands support the
3641 .Cm vput
3642 modifier: if used, they expect the name of a variable, which can itself
3643 be a variable, i.e., shell expansion is applied, as their first
3644 argument, and will place their computation result in it instead of the
3645 default location (it is usually written to standard output).
3647 The given name will be tested for being a valid
3648 .Xr sh 1
3649 variable name, and may therefore only consist of upper- and lowercase
3650 characters, digits, and the underscore; the hyphen-minus may be used as
3651 a non-portable extension; digits may not be used as first, hyphen-minus
3652 may not be used as last characters.
3653 In addition the name may either not be one of the known
3654 .Sx "INTERNAL VARIABLES" ,
3655 or must otherwise refer to a writable (non-boolean) value variable.
3656 The actual put operation may fail nonetheless, for example if the
3657 variable expects a number argument only a number will be accepted.
3658 Any error during these operations causes the command as such to fail,
3659 and the error number
3660 .Va \&!
3661 will be set to
3662 .Va ^ERR Ns -NOTSUP ,
3663 the exit status
3664 .Va \&?
3665 should be set to
3666 .Ql -1 ,
3667 but some commands deviate from the latter, which is documented.
3670 Last, but not least, the modifier
3672 .Cm wysh
3673 can be used for some old and established commands to choose the new
3674 .Sx "Shell-style argument quoting"
3675 rules over the traditional
3676 .Sx "Old-style argument quoting" .
3677 This modifier is implied if
3678 .Va v15-compat
3679 is set to a non-empty value.
3681 .\" }}}
3683 .\" .Ss "Old-style argument quoting" v15-compat: rename Obsolete.. {{{
3684 .Ss "Old-style argument quoting"
3686 \*(ID This section documents the traditional and POSIX standardized
3687 style of quoting non-message list arguments to commands which expect
3688 this type of arguments: whereas still used by the majority of such
3689 commands, the new
3690 .Sx "Shell-style argument quoting"
3691 may be available even for those via
3692 .Cm wysh ,
3693 one of the
3694 .Sx "Command modifiers" .
3695 Nonetheless care must be taken, because only new commands have been
3696 designed with all the capabilities of the new quoting rules in mind,
3697 which can, for example generate control characters.
3700 .Bl -bullet -offset indent
3702 An argument can be enclosed between paired double-quotes
3703 .Ql """argument"""
3705 single-quotes
3706 .Ql 'argument' ;
3707 any whitespace, shell word expansion, or reverse solidus characters
3708 (except as described next) within the quotes are treated literally as
3709 part of the argument.
3710 A double-quote will be treated literally within single-quotes and vice
3711 versa.
3712 Inside such a quoted string the actually used quote character can be
3713 used nonetheless by escaping it with a reverse solidus
3714 .Ql \e ,
3715 as in
3716 .Ql """y\e""ou""" .
3719 An argument that is not enclosed in quotes, as above, can usually still
3720 contain space characters if those spaces are reverse solidus escaped, as in
3721 .Ql you\e are .
3724 A reverse solidus outside of the enclosing quotes is discarded
3725 and the following character is treated literally as part of the argument.
3727 .\" }}}
3729 .\" .Ss "Shell-style argument quoting" {{{
3730 .Ss "Shell-style argument quoting"
3732 .Xr sh 1 Ns
3733 ell-style, and therefore POSIX standardized, argument parsing and
3734 quoting rules are used by most commands.
3735 \*(ID Most new commands only support these new rules and are flagged
3736 \*(NQ, some elder ones can use them with the command modifier
3737 .Cm wysh ;
3738 in the future only this type of argument quoting will remain.
3741 A command line is parsed from left to right and an input token is
3742 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3743 Metacharacters are vertical bar
3744 .Cm \&| ,
3745 ampersand
3746 .Cm & ,
3747 semicolon
3748 .Cm \&; ,
3749 as well as all characters from the variable
3750 .Va ifs ,
3751 and / or
3752 .Cm space , tabulator , newline .
3753 The additional metacharacters left and right parenthesis
3754 .Cm \&( , \&)
3755 and less-than and greater-than signs
3756 .Cm < , >
3757 that the
3758 .Xr sh 1
3759 supports are not used, and are treated as ordinary characters: for one
3760 these characters are a vivid part of email addresses, and it seems
3761 highly unlikely that their function will become meaningful to \*(UA.
3763 .Bd -filled -offset indent
3764 .Sy Compatibility note:
3765 \*(ID Please note that even many new-style commands do not yet honour
3766 .Va ifs
3767 to parse their arguments: whereas the
3768 .Xr sh 1 Ns
3769 ell is a language with syntactic elements of clearly defined semantics,
3770 \*(UA parses entire input lines and decides on a per-command base what
3771 to do with the rest of the line.
3772 This also means that whenever an unknown command is seen all that \*(UA
3773 can do is cancellation of the processing of the remains of the line.
3775 It also often depends on an actual subcommand of a multiplexer command
3776 how the rest of the line should be treated, and until v15 we are not
3777 capable to perform this deep inspection of arguments.
3778 Nonetheless, at least the following commands which work with positional
3779 parameters fully support
3780 .Va ifs
3781 for an almost shell-compatible field splitting:
3782 .Ic call , call_if , read , vpospar , xcall .
3786 Any unquoted number sign
3787 .Ql #
3788 at the beginning of a new token starts a comment that extends to the end
3789 of the line, and therefore ends argument processing.
3790 An unquoted dollar sign
3791 .Ql $
3792 will cause variable expansion of the given name, which must be a valid
3793 .Xr sh 1 Ns
3794 ell-style variable name (see
3795 .Cm vput ) :
3796 .Sx "INTERNAL VARIABLES"
3797 as well as
3798 .Sx ENVIRONMENT
3799 (shell) variables can be accessed through this mechanism, brace
3800 enclosing the name is supported (i.e., to subdivide a token).
3803 Whereas the metacharacters
3804 .Cm space , tabulator , newline
3805 only complete an input token, vertical bar
3806 .Cm \&| ,
3807 ampersand
3808 .Cm &
3809 and semicolon
3810 .Cm \&;
3811 also act as control operators and perform control functions.
3812 For now supported is semicolon
3813 .Cm \&; ,
3814 which terminates a single command, therefore sequencing the command line
3815 and making the remainder of the line a subject to reevaluation.
3816 With sequencing, multiple command argument types and quoting rules may
3817 therefore apply to a single line, which can become problematic before
3818 v15: e.g., the first of the following will cause surprising results.
3821 .Dl ? echo one; set verbose; echo verbose=$verbose.
3822 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3825 Quoting is a mechanism that will remove the special meaning of
3826 metacharacters and reserved words, and will prevent expansion.
3827 There are four quoting mechanisms: the escape character, single-quotes,
3828 double-quotes and dollar-single-quotes:
3831 .Bl -bullet -offset indent
3833 The literal value of any character can be preserved by preceding it
3834 with the escape character reverse solidus
3835 .Ql \e .
3838 Arguments which are enclosed in
3839 .Ql 'single-\:quotes'
3840 retain their literal value.
3841 A single-quote cannot occur within single-quotes.
3844 The literal value of all characters enclosed in
3845 .Ql \(dqdouble-\:quotes\(dq
3846 is retained, with the exception of dollar sign
3847 .Ql $ ,
3848 which will cause variable expansion, as above, backquote (grave accent)
3849 .Ql ` ,
3850 (which not yet means anything special), reverse solidus
3851 .Ql \e ,
3852 which will escape any of the characters dollar sign
3853 .Ql $
3854 (to prevent variable expansion), backquote (grave accent)
3855 .Ql ` ,
3856 double-quote
3857 .Ql \(dq
3858 (to prevent ending the quote) and reverse solidus
3859 .Ql \e
3860 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3861 but has no special meaning otherwise.
3864 Arguments enclosed in
3865 .Ql $'dollar-\:single-\:quotes'
3866 extend normal single quotes in that reverse solidus escape sequences are
3867 expanded as follows:
3869 .Bl -tag -compact -width ".Ql \eNNN"
3870 .It Ql \ea
3871 bell control character (ASCII and ISO-10646 BEL).
3872 .It Ql \eb
3873 backspace control character (ASCII and ISO-10646 BS).
3874 .It Ql \eE
3875 escape control character (ASCII and ISO-10646 ESC).
3876 .It Ql \ee
3877 the same.
3878 .It Ql \ef
3879 form feed control character (ASCII and ISO-10646 FF).
3880 .It Ql \en
3881 line feed control character (ASCII and ISO-10646 LF).
3882 .It Ql \er
3883 carriage return control character (ASCII and ISO-10646 CR).
3884 .It Ql \et
3885 horizontal tabulator control character (ASCII and ISO-10646 HT).
3886 .It Ql \ev
3887 vertical tabulator control character (ASCII and ISO-10646 VT).
3888 .It Ql \e\e
3889 emits a reverse solidus character.
3890 .It Ql \e'
3891 single quote.
3892 .It Ql \e"
3893 double quote (escaping is optional).
3894 .It Ql \eNNN
3895 eight-bit byte with the octal value
3896 .Ql NNN
3897 (one to three octal digits), optionally prefixed by an additional
3898 .Ql 0 .
3899 A 0 byte will suppress further output for the quoted argument.
3900 .It Ql \exHH
3901 eight-bit byte with the hexadecimal value
3902 .Ql HH
3903 (one or two hexadecimal characters, no prefix, see
3904 .Ic vexpr ) .
3905 A 0 byte will suppress further output for the quoted argument.
3906 .It Ql \eUHHHHHHHH
3907 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3908 .Ql HHHHHHHH
3909 (one to eight hexadecimal characters) \(em note that Unicode defines the
3910 maximum codepoint ever to be supported as
3911 .Ql 0x10FFFF
3912 (in planes of
3913 .Ql 0xFFFF
3914 characters each).
3915 This escape is only supported in locales that support Unicode (see
3916 .Sx "Character sets" ) ,
3917 in other cases the sequence will remain unexpanded unless the given code
3918 point is ASCII compatible or (if the \*(OPal character set conversion is
3919 available) can be represented in the current locale.
3920 The character NUL will suppress further output for the quoted argument.
3921 .It Ql \euHHHH
3922 Identical to
3923 .Ql \eUHHHHHHHH
3924 except it takes only one to four hexadecimal characters.
3925 .It Ql \ecX
3926 Emits the non-printable (ASCII and compatible) C0 control codes
3927 0 (NUL) to 31 (US), and 127 (DEL).
3928 Printable representations of ASCII control codes can be created by
3929 mapping them to a different, visible part of the ASCII character set.
3930 Adding the number 64 achieves this for the codes 0 to 31, here 7 (BEL):
3931 .Ql 7 + 64 = 71 = G .
3932 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3933 .Ic vexpr ) ,
3934 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3935 .Ql \&?\0vexpr\0^\0127\064 .
3937 Whereas historically circumflex notation has often been used for
3938 visualization purposes of control codes, as in
3939 .Ql ^G ,
3940 the reverse solidus notation has been standardized:
3941 .Ql \ecG .
3942 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3943 as shown above
3944 .Pf ( Ql \ea ,
3945 .Ql \en ,
3946 .Ql \et
3947 etc) :
3948 whenever such an alias exists it will be used for display purposes.
3949 The control code NUL
3950 .Pf ( Ql \ec@ ,
3951 a non-standard extension) will suppress further output for the remains
3952 of the token (which may extend beyond the current quote), or, depending
3953 on the context, the remains of all arguments for the current command.
3954 .It Ql \e$NAME
3955 Non-standard extension: expand the given variable name, as above.
3956 Brace enclosing the name is supported.
3957 .It Ql \e`{command}
3958 Not yet supported, just to raise awareness: Non-standard extension.
3963 Caveats:
3965 .Bd -literal -offset indent
3966 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3967 ? echo Quotes ${HOME} and tokens differ! # comment
3968 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3970 .\" }}}
3972 .\" .Ss "Message list arguments" {{{
3973 .Ss "Message list arguments"
3975 Many commands operate on message list specifications, as documented in
3976 .Sx "Specifying messages" .
3977 The argument input is first split into individual tokens via
3978 .Sx "Shell-style argument quoting" ,
3979 which are then interpreted as the mentioned specifications.
3980 If no explicit message list has been specified, many commands will
3981 search for and use the next message forward that satisfies the commands'
3982 requirements, and if there are no messages forward of the current
3983 message, the search proceeds backwards;
3984 if there are no good messages at all to be found, an error message is
3985 shown and the command is aborted.
3987 .Va verbose
3988 output of the command
3989 .Ic list
3990 will indicate whether a command searches for a default message, or not.
3991 .\" }}}
3993 .\" .Ss "Raw data arguments for codec commands" {{{
3994 .Ss "Raw data arguments for codec commands"
3996 A special set of commands, which all have the string
3997 .Dq codec
3998 in their name, like
3999 .Ic addrcodec ,
4000 .Ic shcodec ,
4001 .Ic urlcodec ,
4002 take raw string data as input, which means that the content of the
4003 command input line is passed completely unexpanded and otherwise
4004 unchanged: like this the effect of the actual codec is visible without
4005 any noise of possible shell quoting rules etc., i.e., the user can input
4006 one-to-one the desired or questionable data.
4007 To gain a level of expansion, the entire command line can be
4008 .Ic eval Ns
4009 uated first, for example
4011 .Bd -literal -offset indent
4012 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
4013 ? echo $res
4014 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
4015 ? shcodec d $res
4016 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
4017 ? eval shcodec d $res
4018 /usr/Sch\[:o]nes Wetter/heute.txt
4020 .\" }}}
4022 .\" .Ss "Filename transformations" {{{
4023 .Ss "Filename transformations"
4025 Filenames, where expected, and unless documented otherwise, are
4026 subsequently subject to the following filename transformations, in
4027 sequence:
4029 .Bl -bullet -offset indent
4031 If the given name is a registered
4032 .Ic shortcut ,
4033 it will be replaced with the expanded shortcut.
4034 This step is mostly taken for
4035 .Ic folder Ns
4036 s only.
4039 The filename is matched against the following patterns or strings.
4040 But for plus
4041 .Ar +file
4042 .Va folder
4043 expansion this step is mostly taken for
4044 .Ic folder Ns
4045 s only.
4049 .Bl -hang -compact -width ".Ar %user"
4050 .It Ar #
4051 (Number sign) is expanded to the previous file.
4053 .It Ar %
4054 (Percent sign) is replaced by the invoking
4055 .Mx -ix "primary system mailbox"
4056 user's primary system mailbox, which either is the (itself expandable)
4057 .Va inbox
4058 if that is set, the standardized absolute pathname indicated by
4059 .Ev MAIL
4060 if that is set, or a built-in compile-time default otherwise.
4061 When opening a
4062 .Ic folder
4063 the used name is actively checked for being a primary mailbox, first
4064 against
4065 .Va \&\&inbox ,
4066 then against
4067 .Ev MAIL .
4069 .It Ar %user
4070 Expands to the primary system mailbox of
4071 .Ar user
4072 (and never the value of
4073 .Va inbox ,
4074 regardless of its actual setting).
4076 .It Ar &
4077 (Ampersand) is replaced with the invoking user's
4078 .Mx -ix "secondary mailbox"
4079 secondary mailbox, the
4080 .Ev MBOX .
4082 .It Ar +file
4083 Refers to a
4084 .Ar file
4085 in the
4086 .Va folder
4087 directory (if that variable is set).
4089 .It Ar %:filespec
4090 Expands to the same value as
4091 .Ar filespec ,
4092 but has special meaning when used with, for example, the command
4093 .Ic folder :
4094 the file will be treated as a primary system mailbox by, among others, the
4095 .Ic mbox
4097 .Ic save
4098 commands, meaning that messages that have been read in the current
4099 session will be moved to the
4100 .Ev MBOX
4101 mailbox instead of simply being flagged as read.
4106 Meta expansions may be applied to the resulting filename, as allowed by
4107 the operation and applicable to the resulting access protocol (also see
4108 .Sx "On URL syntax and credential lookup" ) .
4109 For the file-protocol, a leading tilde
4110 .Ql ~
4111 character will be replaced by the expansion of
4112 .Ev HOME ,
4113 except when followed by a valid user name, in which case the home
4114 directory of the given user is used instead.
4116 A shell expansion as if specified in double-quotes (see
4117 .Sx "Shell-style argument quoting" )
4118 may be applied, so that any occurrence of
4119 .Ql $VARIABLE
4121 .Ql ${VARIABLE} )
4122 will be replaced by the expansion of the variable, if possible;
4123 .Sx "INTERNAL VARIABLES"
4124 as well as
4125 .Sx ENVIRONMENT
4126 (shell) variables can be accessed through this mechanism.
4128 Shell pathname wildcard pattern expansions
4129 .Pf ( Xr glob 7 )
4130 may be applied as documented.
4131 If the fully expanded filename results in multiple pathnames and the
4132 command is expecting only one file, an error results.
4134 In interactive context, in order to allow simple value acceptance (via
4135 .Dq ENTER ) ,
4136 arguments will usually be displayed in a properly quoted form, so a file
4137 .Ql diet\e is \ecurd.txt
4138 may be displayed as
4139 .Ql 'diet\e is \ecurd.txt' .
4141 .\" }}}
4143 .\" .Ss "Commands" {{{
4144 .Ss "Commands"
4146 The following commands are available:
4148 .Bl -tag -width ".It Ic BaNg"
4152 .It Ic \&!
4153 Executes the
4154 .Ev SHELL
4155 command which follows, replacing unescaped exclamation marks with the
4156 previously executed command if the internal variable
4157 .Va bang
4158 is set.
4159 This command supports
4160 .Cm vput
4161 as documented in
4162 .Sx "Command modifiers" ,
4163 and manages the error number
4164 .Va \&! .
4165 A 0 or positive exit status
4166 .Va \&?
4167 reflects the exit status of the command, negative ones that
4168 an error happened before the command was executed, or that the program
4169 did not exit cleanly, but maybe due to a signal: the error number is
4170 .Va ^ERR Ns -CHILD ,
4171 then.
4174 In conjunction with the
4175 .Cm vput
4176 modifier the following special cases exist:
4177 a negative exit status occurs if the collected data could not be stored
4178 in the given variable, which is a
4179 .Va ^ERR Ns -NOTSUP
4180 error that should otherwise not occur.
4181 .Va ^ERR Ns -CANCELED
4182 indicates that no temporary file could be created to collect the command
4183 output at first glance.
4184 In case of catchable out-of-memory situations
4185 .Va ^ERR Ns -NOMEM
4186 will occur and \*(UA will try to store the empty string, just like with
4187 all other detected error conditions.
4191 .It Ic #
4192 The comment-command causes the entire line to be ignored.
4193 .Sy Note:
4194 this really is a normal command which' purpose is to discard its
4195 arguments, not a
4196 .Dq comment-start
4197 indicating special character, which means that for example trailing
4198 comments on a line are not possible (except for commands which use
4199 .Sx "Shell-style argument quoting" ) .
4202 .It Ic +
4203 Goes to the next message in sequence and types it
4204 (like
4205 .Dq ENTER ) .
4208 .It Ic -
4209 Display the preceding message, or the n'th previous message if given
4210 a numeric argument n.
4213 .It Ic =
4214 Shows the message number of the current message (the
4215 .Dq dot )
4216 when used without arguments, that of the given list otherwise.
4217 Output numbers will be separated from each other with the first
4218 character of
4219 .Va ifs ,
4220 and followed by the first character of
4221 .Va if-ws ,
4222 if that is not empty and not identical to the first.
4223 If that results in no separation at all a
4224 .Cm space
4225 character is used.
4226 This command supports
4227 .Cm vput
4228 (see
4229 .Sx "Command modifiers" ) ,
4230 and manages the error number
4231 .Va \&! .
4234 .It Ic \&?
4235 \*(OP Show a brief summary of commands.
4236 \*(OP Given an argument a synopsis for the command in question is
4237 shown instead; commands can be abbreviated in general and this command
4238 can be used to see the full expansion of an abbreviation including the
4239 synopsis, try, for example
4240 .Ql \&?h ,
4241 .Ql \&?hel
4243 .Ql \&?help
4244 and see how the output changes.
4245 To avoid that aliases are resolved the modifier
4246 .Cm \e
4247 can be prepended to the argument, but note it must be quoted.
4248 This mode also supports a more
4249 .Va verbose
4250 output, which will provide the information documented for
4251 .Ic list .
4254 .It Ic \&|
4255 A synonym for the
4256 .Ic pipe
4257 command.
4261 .It Ic account , unaccount
4262 (ac, una) Creates, selects or lists (an) account(s).
4263 Accounts are special incarnations of
4264 .Ic define Ns d
4265 macros and group commands and variable settings which together usually
4266 arrange the environment for the purpose of creating an email account.
4267 Different to normal macros settings which are covered by
4268 .Ic localopts
4269 \(en here by default enabled! \(en will not be reverted before the
4270 .Ic account
4271 is changed again.
4272 The special account
4273 .Ql null
4274 (case-insensitive) always exists, and all but it can be deleted by the
4275 latter command, and in one operation with the special name
4276 .Ql * .
4277 Also for all but it a possibly set
4278 .Va on-account-cleanup
4279 hook is called once they are left, including program exit.
4281 Without arguments a listing of all defined accounts is shown.
4282 With one argument the given account is activated: the system
4283 .Va inbox
4284 of that account will be activated (as via
4285 .Ic folder ) ,
4286 a possibly installed
4287 .Va folder-hook
4288 will be run, and the internal variable
4289 .Va account
4290 will be updated.
4291 The two argument form is identical to defining a macro as via
4292 .Ic define :
4293 .Bd -literal -offset indent
4294 account myisp {
4295   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
4296   set from='(My Name) myname@myisp.example'
4297   set mta=smtp://mylogin@smtp.myisp.example
4303 .It Ic addrcodec
4304 Perform email address codec transformations on raw-data argument, rather
4305 according to email standards (RFC 5322; \*(ID will furtherly improve).
4306 Supports
4307 .Cm vput
4308 (see
4309 .Sx "Command modifiers" ) ,
4310 and manages the error number
4311 .Va \&! .
4312 The first argument must be either
4313 .Ar [+[+[+]]]e[ncode] ,
4314 .Ar d[ecode] ,
4315 .Ar s[kin]
4317 .Ar skinl[ist]
4318 and specifies the operation to perform on the rest of the line.
4321 Decoding will show how a standard-compliant MUA will display the given
4322 argument, which should be an email address.
4323 Please be aware that most MUAs have difficulties with the address
4324 standards, and vary wildly when (comments) in parenthesis,
4325 .Dq double-quoted
4326 strings, or quoted-pairs, as below, become involved.
4327 \*(ID \*(UA currently does not perform decoding when displaying addresses.
4330 Skinning is identical to decoding but only outputs the plain address,
4331 without any string, comment etc. components.
4332 Another difference is that it may fail with the error number
4333 .Va \&!
4334 set to
4335 .Va ^ERR Ns -INVAL
4336 if decoding fails to find a(n) (valid) email address, in which case the
4337 unmodified input will be output again.
4340 .Ar skinlist
4341 first performs a skin operation, and thereafter checks a valid
4342 address for whether it is a registered mailing list (see
4343 .Ic mlist
4345 .Ic mlsubscribe ) ,
4346 eventually reporting that state in the error number
4347 .Va \&!
4349 .Va ^ERR Ns -EXIST .
4350 (This state could later become overwritten by an I/O error, though.)
4353 Encoding supports four different modes, lesser automated versions can be
4354 chosen by prefixing one, two or three plus signs: the standard imposes
4355 a special meaning on some characters, which thus have to be transformed
4356 to so-called quoted-pairs by pairing them with a reverse solidus
4357 .Ql \e
4358 in order to remove the special meaning; this might change interpretation
4359 of the entire argument from what has been desired, however!
4360 Specify one plus sign to remark that parenthesis shall be left alone,
4361 two for not turning double quotation marks into quoted-pairs, and three
4362 for also leaving any user-specified reverse solidus alone.
4363 The result will always be valid, if a successful exit status is reported
4364 (\*(ID the current parser fails this assertion for some constructs).
4365 \*(ID Addresses need to be specified in between angle brackets
4366 .Ql < ,
4367 .Ql >
4368 if the construct becomes more difficult, otherwise the current parser
4369 will fail; it is not smart enough to guess right.
4371 .Bd -literal -offset indent
4372 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
4373 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4374 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4375 "Hey, you", \e out\e there <diet@exam.ple>
4376 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4377 diet@exam.ple
4383 .It Ic alias , unalias
4384 \*(NQ(a, una) Define or list, and remove, respectively, address aliases.
4385 Address aliases are a method of creating personal distribution lists
4386 that map a single alias name to none to multiple receivers;
4387 aliases are expanded after message composing is completed.
4388 The latter command removes all given aliases, the special name asterisk
4389 .Ql *
4390 will remove all existing aliases.
4391 When used without arguments the former shows a list of all currently
4392 known aliases, with one argument only the target(s) of the given one.
4393 When given two arguments, hyphen-minus
4394 .Ql -
4395 being the first, the target(s) of the second is/are expanded recursively.
4397 In all other cases the given address alias is newly defined or will be
4398 appended to: target arguments must either be valid alias names, or any
4399 other address type.
4400 Recursive expansion of (what looks like) alias name(s) targets can be
4401 prevented by prefixing the target with the modifier reverse solidus
4402 .Cm \e .
4403 A valid alias name conforms to
4404 .Va mta-aliases
4405 syntax, but follow-up characters can also be the number sign
4406 .Ql # ,
4407 colon
4408 .Ql : ,
4409 commercial at
4410 .Ql @,
4411 exclamation mark
4412 .Ql \&! ,
4413 period
4414 .Ql \&.
4415 as well as
4416 .Dq any character that has the high bit set .
4417 The dollar sign
4418 .Ql $
4419 may be the last character.
4420 The number sign may need be quoted to avoid misinterpretation as the
4421 shell comment character.
4423 .\" ALIASCOLON next sentence
4424 \*(ID Unfortunately the colon is currently not supported, as it
4425 interferes with normal address parsing rules.
4426 .\" ALIASCOLON next sentence
4427 \*(ID Such high bit characters will likely cause warnings at the moment
4428 for the same reasons why colon is unsupported; also, in the future
4429 locale dependent character set validity checks will be performed.
4433 .It Ic alternates , unalternates
4434 \*(NQ (alt) Manage a list of alternate addresses or names of the active
4435 user, members of which will be removed from recipient lists (except one).
4436 There is a set of implicit alternates which is formed of the values of
4437 .Ev LOGNAME ,
4438 .Va from ,
4439 .Va sender
4441 .Va reply-to .
4442 .Va from
4443 will not be used if
4444 .Va sender
4445 is set.
4446 The latter command removes the given list of alternates, the special name
4447 .Ql *
4448 will discard all existing alternate names.
4450 The former command manages the error number
4451 .Va \&! .
4452 It shows the current set of alternates when used without arguments; in
4453 this mode only it also supports
4454 .Cm vput
4455 (see
4456 .Sx "Command modifiers" ) .
4457 Otherwise the given arguments (after being checked for validity) are
4458 appended to the list of alternate names; in
4459 .Va posix
4460 mode they replace that list instead.
4464 .It Ic answered , unanswered
4465 Take a message lists and mark each message as (not) having been answered.
4466 Messages will be marked answered when being
4467 .Ic reply Ns d
4468 to automatically if the
4469 .Va markanswered
4470 variable is set.
4471 See the section
4472 .Sx "Message states" .
4477 .It Ic bind , unbind
4478 \*(OP\*(NQ The bind command extends the MLE (see
4479 .Sx "On terminal control and line editor" )
4480 with freely configurable key bindings.
4481 The latter command removes from the given context the given key binding,
4482 both of which may be specified as a wildcard
4483 .Ql * ,
4484 so that
4485 .Ql unbind * *
4486 will remove all bindings of all contexts.
4487 Due to initialization order unbinding will not work for built-in key
4488 bindings upon program startup, however: please use
4489 .Va line-editor-no-defaults
4490 for this purpose instead.
4493 With zero arguments, or with a context name the former command shows
4494 all key bindings (of the given context; an asterisk
4495 .Ql *
4496 will iterate over all contexts); a more verbose listing will be
4497 produced if either of
4498 .Va debug
4500 .Va verbose
4501 are set.
4502 With two or more arguments a specific binding is shown, or
4503 (re)established: the first argument is the context to which the binding
4504 shall apply, the second argument is a comma-separated list of the
4505 .Dq keys
4506 which form the binding.
4507 Further arguments will be joined to form the expansion, and cause the
4508 binding to be created or updated.
4509 To indicate that a binding shall not be auto-committed, but that the
4510 expansion shall instead be furtherly editable by the user, a commercial at
4511 .Ql @
4512 (that will be removed) can be placed last in the expansion, from which
4513 leading and trailing whitespace will finally be removed.
4514 Reverse solidus cannot be used as the last character of expansion.
4515 An empty expansion will be rejected.
4518 Contexts define when a binding applies, i.e., a binding will not be seen
4519 unless the context for which it is defined for is currently active.
4520 This is not true for the shared binding
4521 .Ql base ,
4522 which is the foundation for all other bindings and as such always
4523 applies, its bindings, however, only apply secondarily.
4524 The available contexts are the shared
4525 .Ql base ,
4527 .Ql default
4528 context which is used in all not otherwise documented situations, and
4529 .Ql compose ,
4530 which applies to compose mode only.
4533 Bindings are specified as a comma-separated list of byte-sequences,
4534 where each list entry corresponds to one
4535 .Dq key
4536 (press).
4537 Byte sequence boundaries will be forcefully terminated after
4538 .Va bind-inter-byte-timeout
4539 milliseconds, whereas key sequences can be timed out via
4540 .Va bind-inter-key-timeout .
4541 A list entry may, indicated by a leading colon character
4542 .Ql \&: ,
4543 also refer to the name of a terminal capability; several dozen names
4544 are compiled in and may be specified either by their
4545 .Xr terminfo 5 ,
4546 or, if existing, by their
4547 .Xr termcap 5
4548 name, regardless of the actually used \*(OPal terminal control library.
4549 But any capability may be used, as long as the name is resolvable by the
4550 \*(OPal control library, or was defined via the internal variable
4551 .Va termcap .
4552 Input sequences are not case-normalized, an exact match is required to
4553 update or remove a binding.
4554 It is advisable to use an initial escape or other control character (like
4555 .Ql \ecA )
4556 for user (as opposed to purely terminal capability based) bindings in
4557 order to avoid ambiguities; it also reduces search time.
4558 Examples:
4560 .Bd -literal -offset indent
4561 ? bind base a,b echo one
4562 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4563 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete
4564 ? bind default $'\ecA',:khome,w 'echo Editable binding@'
4565 ? bind default a,b,c rm -irf / @  # Also editable
4566 ? bind default :kf1 File %
4567 ? bind compose :kf1 ~v
4571 Note that the entire comma-separated list is first parsed (over) as a
4572 shell-token with whitespace as the field separator, then parsed and
4573 expanded for real with comma as the field separator, therefore
4574 whitespace needs to be properly quoted, see
4575 .Sx "Shell-style argument quoting" .
4576 Using Unicode reverse solidus escape sequences renders a binding
4577 defunctional if the locale does not support Unicode (see
4578 .Sx "Character sets" ) ,
4579 and using terminal capabilities does so if no (corresponding) terminal
4580 control support is (currently) available.
4581 Adding, deleting or modifying a key binding invalidates the internal
4582 prebuilt lookup tree, it will be recreated as necessary: this process
4583 will be visualized in most
4584 .Va verbose
4585 as well as in
4586 .Va debug
4587 mode.
4590 The following terminal capability names are built-in and can be used in
4591 .Xr terminfo 5
4592 or (if available) the two-letter
4593 .Xr termcap 5
4594 notation.
4595 See the respective manual for a list of capabilities.
4596 The program
4597 .Xr infocmp 1
4598 can be used to show all the capabilities of
4599 .Ev TERM
4600 or the given terminal type;
4601 using the
4602 .Fl \&\&x
4603 flag will also show supported (non-standard) extensions.
4606 .Bl -tag -compact -width kcuuf_or_kcuuf
4607 .It Cd kbs Ns \0or Cd kb
4608 Backspace.
4609 .It Cd kdch1 Ns \0or Cd kD
4610 Delete character.
4611 .It Cd kDC Ns \0or Cd *4
4612 \(em shifted variant.
4613 .It Cd kel Ns \0or Cd kE
4614 Clear to end of line.
4615 .It Cd kext Ns \0or Cd @9
4616 Exit.
4617 .It Cd kich1 Ns \0or Cd kI
4618 Insert character.
4619 .It Cd kIC Ns \0or Cd #3
4620 \(em shifted variant.
4621 .It Cd khome Ns \0or Cd kh
4622 Home.
4623 .It Cd kHOM Ns \0or Cd #2
4624 \(em shifted variant.
4625 .It Cd kend Ns \0or Cd @7
4626 End.
4627 .It Cd knp Ns \0or Cd kN
4628 Next page.
4629 .It Cd kpp Ns \0or Cd kP
4630 Previous page.
4631 .It Cd kcub1 Ns \0or Cd kl
4632 Left cursor (with more modifiers: see below).
4633 .It Cd kLFT Ns \0or Cd #4
4634 \(em shifted variant.
4635 .It Cd kcuf1 Ns \0or Cd kr
4636 Right cursor (ditto).
4637 .It Cd kRIT Ns \0or Cd %i
4638 \(em shifted variant.
4639 .It Cd kcud1 Ns \0or Cd kd
4640 Down cursor (ditto).
4641 .It Cd kDN
4642 \(em shifted variant (only terminfo).
4643 .It Cd kcuu1 Ns \0or Cd ku
4644 Up cursor (ditto).
4645 .It Cd kUP
4646 \(em shifted variant (only terminfo).
4647 .It Cd kf0 Ns \0or Cd k0
4648 Function key 0.
4649 Add one for each function key up to
4650 .Cd kf9
4652 .Cd k9 ,
4653 respectively.
4654 .It Cd kf10 Ns \0or Cd k;
4655 Function key 10.
4656 .It Cd kf11 Ns \0or Cd F1
4657 Function key 11.
4658 Add one for each function key up to
4659 .Cd kf19
4661 .Cd F9 ,
4662 respectively.
4666 Some terminals support key-modifier combination extensions, e.g.,
4667 .Ql Alt+Shift+xy .
4668 For example, the delete key,
4669 .Cd kdch1 :
4670 in its shifted variant, the name is mutated to
4671 .Cd  kDC ,
4672 then a number is appended for the states
4673 .Ql Alt
4674 .Pf ( Cd kDC3 ) ,
4675 .Ql Shift+Alt
4676 .Pf ( Cd kDC4 ) ,
4677 .Ql Control
4678 .Pf ( Cd kDC5 ) ,
4679 .Ql Shift+Control
4680 .Pf ( Cd kDC6 ) ,
4681 .Ql Alt+Control
4682 .Pf ( Cd kDC7 ) ,
4683 finally
4684 .Ql Shift+Alt+Control
4685 .Pf ( Cd kDC8 ) .
4686 The same for the left cursor key,
4687 .Cd kcub1 :
4688 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4692 .It Ic call
4693 \*(NQ Calls the given macro, which must have been created via
4694 .Ic define
4695 (see there for more), otherwise an
4696 .Va ^ERR Ns -NOENT
4697 error occurs.
4698 Calling macros recursively will at some time excess the stack size
4699 limit, causing a hard program abortion; if recursively calling a macro
4700 is the last command of the current macro, consider to use the command
4701 .Ic xcall ,
4702 which will first release all resources of the current macro before
4703 replacing the current macro with the called one.
4707 .It Ic call_if
4708 Identical to
4709 .Ic call
4710 if the given macro has been created via
4711 .Ic define ,
4712 but does not fail nor warn if the macro does not exist.
4715 .It Ic cd
4716 Synonym for
4717 .Ic chdir .
4720 .It Ic certsave
4721 \*(OP Only applicable to S/MIME signed messages.
4722 Takes an optional message list and a filename and saves the certificates
4723 contained within the message signatures to the named file in both
4724 human-readable and PEM format.
4725 The certificates can later be used to send encrypted messages to the
4726 respective message senders by setting
4727 .Va smime-encrypt-USER@HOST
4728 variables.
4732 .It Ic charsetalias , uncharsetalias
4733 \*(NQ Manage alias mappings for (conversion of)
4734 .Sx "Character sets" .
4735 Alias processing is not performed for
4736 .Sx "INTERNAL VARIABLES" ,
4737 for example
4738 .Va charset-8bit ,
4739 and mappings are ineffective if character set conversion is not available
4740 .Pf ( Va features
4741 does not announce
4742 .Ql +iconv ) .
4743 Expansion happens recursively for cases where aliases point to other
4744 aliases (built-in loop limit: 8).
4746 The latter command deletes all aliases given as arguments,
4747 or all at once when given the asterisk
4748 .Ql * .
4749 The former shows the list of all currently defined aliases if used
4750 without arguments, or the target of the given single argument;
4751 when given two arguments, hyphen-minus
4752 .Ql -
4753 being the first, the second is instead expanded recursively.
4754 In all other cases the given arguments are treated as pairs of character
4755 sets and their desired target alias name, creating new or updating
4756 already existing aliases.
4759 .It Ic chdir
4760 \*(NQ(ch) Change the working directory to
4761 .Ev HOME
4762 or the given argument.
4763 Synonym for
4764 .Ic cd .
4768 .It Ic collapse , uncollapse
4769 Only applicable to
4770 .Ql thread Ns
4772 .Ic sort
4773 mode.
4774 Takes a message list and makes all replies to these messages invisible
4775 in header summaries, except for
4776 .Ql new
4777 messages and the
4778 .Dq dot .
4779 Also when a message with collapsed replies is displayed,
4780 all of these are automatically uncollapsed.
4781 The latter command undoes collapsing.
4784 .\" FIXME review until this point
4787 .It Ic colour , uncolour
4788 \*(OP\*(NQ Manage colour mappings of and for a
4789 .Sx "Coloured display" .
4790 Without arguments the former shows all currently defined mappings.
4791 Otherwise a colour type is expected (case-insensitively),
4792 it must be one of
4793 .Ql 256
4794 for 256-colour terminals,
4795 .Ql 8 ,
4796 .Ql ansi
4798 .Ql iso
4799 for the standard 8-colour ANSI / ISO 6429 colour palette, and
4800 .Ql 1
4802 .Ql mono
4803 for monochrome terminals, which only support (some) font attributes.
4804 Without further arguments the list of all currently defined mappings
4805 of the given type is shown (here the special
4806 .Ql all
4808 .Ql *
4809 also show all currently defined mappings).
4812 Otherwise the second argument defines the mappable slot, the third
4813 argument a (comma-separated list of) colour and font attribute
4814 specification(s), and the optionally supported fourth argument can be
4815 used to specify a precondition: if conditioned mappings exist they are
4816 tested in (creation) order unless a (case-insensitive) match has been
4817 found, and the default mapping (if any has been established) will only
4818 be chosen as a last resort.
4819 The types of available preconditions depend on the mappable slot,
4820 the following of which exist:
4823 Mappings prefixed with
4824 .Ql mle-
4825 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4826 .Sx "On terminal control and line editor" )
4827 and do not support preconditions.
4829 .Bl -tag -compact -width view-partinfo
4830 .It Ar mle-position
4831 This mapping is used for the position indicator that is visible when
4832 a line cannot be fully displayed on the screen.
4833 .It Ar mle-prompt
4834 Used for the
4835 .Va prompt .
4836 .It Ar mle-error
4837 Used for the occasionally appearing error indicator that is joined onto
4838 .Va prompt .
4839 \*(ID Also used for error messages written on standard error .
4843 Mappings prefixed with
4844 .Ql sum-
4845 are used in header summaries, and they all understand the preconditions
4846 .Ql dot
4847 (the current message) and
4848 .Ql older
4849 for elder messages (only honoured in conjunction with
4850 .Va datefield-markout-older ) .
4852 .Bl -tag -compact -width view-partinfo
4853 .It Ar sum-dotmark
4854 This mapping is used for the
4855 .Dq dotmark
4856 that can be created with the
4857 .Ql %>
4859 .Ql %<
4860 formats of the variable
4861 .Va headline .
4862 .It Ar sum-header
4863 For the complete header summary line except the
4864 .Dq dotmark
4865 and the thread structure.
4866 .It Ar sum-thread
4867 For the thread structure which can be created with the
4868 .Ql %i
4869 format of the variable
4870 .Va headline .
4874 Mappings prefixed with
4875 .Ql view-
4876 are used when displaying messages.
4878 .Bl -tag -compact -width view-partinfo
4879 .It Ar view-from_
4880 This mapping is used for so-called
4881 .Ql From_
4882 lines, which are MBOX file format specific header lines (also see
4883 .Va mbox-rfc4155 ) .
4884 .It Ar view-header
4885 For header lines.
4886 A comma-separated list of headers to which the mapping applies may be
4887 given as a precondition; if the \*(OPal regular expression support is
4888 available then if any of the
4889 .Mx -sx
4890 .Sx "magic regular expression characters"
4891 is seen the precondition will be evaluated as (an extended) one.
4892 .It Ar view-msginfo
4893 For the introductional message info line.
4894 .It Ar view-partinfo
4895 For MIME part info lines.
4899 The following (case-insensitive) colour definitions and font attributes
4900 are understood, multiple of which can be specified in a comma-separated
4901 list:
4903 .Bl -tag -width ft=
4904 .It Ar ft=
4905 a font attribute:
4906 .Ql bold ,
4907 .Ql reverse
4909 .Ql underline .
4910 It is possible (and often applicable) to specify multiple font
4911 attributes for a single mapping.
4913 .It Ar fg=
4914 foreground colour attribute:
4915 .Ql black ,
4916 .Ql blue ,
4917 .Ql green ,
4918 .Ql red ,
4919 .Ql brown ,
4920 .Ql magenta ,
4921 .Ql cyan
4923 .Ql white .
4924 To specify a 256-colour mode a decimal number colour specification in
4925 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4927 .Bl -tag -compact -width "999 - 999"
4928 .It 0 - 7
4929 the standard ISO 6429 colours, as above.
4930 .It 8 - 15
4931 high intensity variants of the standard colours.
4932 .It 16 - 231
4933 216 colours in tuples of 6.
4934 .It 232 - 255
4935 grayscale from black to white in 24 steps.
4937 .Bd -literal -offset indent
4938 #!/bin/sh -
4939 fg() { printf "\e033[38;5;${1}m($1)"; }
4940 bg() { printf "\e033[48;5;${1}m($1)"; }
4942 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4943 printf "\e033[0m\en"
4945 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4946 printf "\e033[0m\en"
4949 .It Ar bg=
4950 background colour attribute (see
4951 .Cd fg=
4952 for possible values).
4956 The command
4957 .Ic \&uncolour
4958 will remove for the given colour type (the special type
4959 .Ql *
4960 selects all) the given mapping; if the optional precondition argument is
4961 given only the exact tuple of mapping and precondition is removed.
4962 The special name
4963 .Ql *
4964 will remove all mappings (no precondition allowed), thus
4965 .Ql uncolour * *
4966 will remove all established mappings.
4971 .It Ic commandalias , uncommandalias
4972 \*(NQ Define or list, and remove, respectively, command aliases.
4973 An (command)alias can be used everywhere a normal command can be used,
4974 but always takes precedence: any arguments that are given to the command
4975 alias are joined onto the alias expansion, and the resulting string
4976 forms the command line that is, in effect, executed.
4977 The latter command removes all given aliases, the special name asterisk
4978 .Ql *
4979 will remove all existing aliases.
4980 When used without arguments the former shows a list of all currently
4981 known aliases, with one argument only the expansion of the given one.
4983 With two or more arguments a command alias is defined or updated: the
4984 first argument is the name under which the remaining command line should
4985 be accessible, the content of which can be just about anything.
4986 An alias may itself expand to another alias, but to avoid expansion loops
4987 further expansion will be prevented if an alias refers to itself or if
4988 an expansion depth limit is reached.
4989 Explicit expansion prevention is available via reverse solidus
4990 .Cm \e ,
4991 one of the
4992 .Sx "Command modifiers" .
4993 .Bd -literal -offset indent
4994 ? commandalias xx
4995 \*(uA: `commandalias': no such alias: xx
4996 ? commandalias xx echo hello,
4997 ? commandalias xx
4998 commandalias xx 'echo hello,'
4999 ? xx
5000 hello,
5001 ? xx world
5002 hello, world
5006 .It Ic Copy
5007 (C) Similar to
5008 .Ic copy ,
5009 but copy the messages to a file named after the local part of the
5010 sender of the first message instead of taking a filename argument;
5011 .Va outfolder
5012 is inspected to decide on the actual storage location.
5015 .It Ic copy
5016 (c) Copy messages to the named file and do not mark them as being saved;
5017 otherwise identical to
5018 .Ic save .
5022 .It Ic csop
5023 \*(NQ A multiplexer command which provides C-style string operations on
5024 8-bit bytes without a notion of locale settings and character sets,
5025 effectively assuming ASCII data.
5026 For numeric and other operations refer to
5027 .Ic vexpr .
5028 .Cm vput ,
5029 one of the
5030 .Sx "Command modifiers" ,
5031 is supported.
5032 The error result is
5033 .Ql -1
5034 for usage errors and numeric results, the empty string otherwise;
5035 missing data errors, as for unsuccessful searches, result in the
5036 .Va \&!
5037 error number being set to
5038 .Va ^ERR Ns -NODATA .
5039 Where the question mark
5040 .Ql \&?
5041 modifier suffix is supported, a case-insensitive (ASCII mapping)
5042 operation mode is supported; the keyword
5043 .Ql case
5044 is optional so that
5045 .Ql find?
5047 .Ql find?case
5048 are identical.
5050 .Bl -hang -width ".It Cm length"
5051 .It Cm length
5052 Queries the length of the given argument.
5054 .It Cm hash , Cm hash32
5055 Calculates a hash value of the given argument.
5056 The latter will return a 32-bit result regardless of host environment.
5057 .Ql \&?
5058 modifier suffix is supported.
5059 These use Chris Torek's hash algorithm, the resulting hash value is
5060 bit mixed as shown by Bret Mulvey.
5062 .It Cm find
5063 Search for the second in the first argument.
5064 Shows the resulting 0-based offset shall it have been found.
5065 .Ql \&?
5066 modifier suffix is supported.
5068 .It Cm substring
5069 Creates a substring of its first argument.
5070 The optional second argument is the 0-based starting offset,
5071 a negative one counts from the end;
5072 the optional third argument specifies the length of the desired result,
5073 a negative length leaves off the given number of bytes at the end of the
5074 original string; by default the entire string is used.
5075 This operation tries to work around faulty arguments (set
5076 .Va verbose
5077 for error logs), but reports them via the error number
5078 .Va \&!
5080 .Va ^ERR Ns -OVERFLOW .
5082 .It Cm trim
5083 Trim away whitespace characters from both ends of the argument.
5085 .It Cm trim-front
5086 Trim away whitespace characters from the begin of the argument.
5088 .It Cm trim-end
5089 Trim away whitespace characters from the end of the argument.
5094 .It Ic cwd
5095 Show the name of the current working directory, as reported by
5096 .Xr getcwd 3 .
5097 Supports
5098 .Cm vput
5099 (see
5100 .Sx "Command modifiers" ) .
5101 The return status is tracked via
5102 .Va \&? .
5105 .It Ic Decrypt
5106 \*(OP For unencrypted messages this command is identical to
5107 .Ic Copy ;
5108 Encrypted messages are first decrypted, if possible, and then copied.
5111 .It Ic decrypt
5112 \*(OP For unencrypted messages this command is identical to
5113 .Ic copy ;
5114 Encrypted messages are first decrypted, if possible, and then copied.
5119 .It Ic define , undefine
5120 The latter command deletes the given macro, the special name
5121 .Ql *
5122 will discard all existing macros.
5123 Deletion of (a) macro(s) can be performed from within running (a)
5124 macro(s), including self-deletion.
5125 Without arguments the former command prints the current list of macros,
5126 including their content, otherwise it defines a macro, replacing an
5127 existing one of the same name as applicable.
5130 A defined macro can be invoked explicitly by using the
5131 .Ic call ,
5132 .Ic call_if
5134 .Ic xcall
5135 commands, or implicitly if a macro hook is triggered, for example a
5136 .Va folder-hook .
5137 Execution of a macro body can be stopped from within by calling
5138 .Ic return .
5141 Temporary macro block-scope variables can be created or deleted with the
5142 .Cm local
5143 command modifier in conjunction with the commands
5144 .Ic set
5146 .Ic unset ,
5147 respectively.
5148 To enforce unrolling of changes made to (global)
5149 .Sx "INTERNAL VARIABLES"
5150 the command
5151 .Ic localopts
5152 can be used instead; its covered scope depends on how (i.e.,
5153 .Dq as what :
5154 normal macro, folder hook, hook,
5155 .Ic account
5156 switch) the macro is invoked.
5159 Inside a
5160 .Ic call Ns
5161 ed macro, the given positional parameters are implicitly local
5162 to the macro's scope, and may be accessed via the variables
5163 .Va * ,
5164 .Va @ ,
5165 .Va #
5167 .Va 1
5168 and any other positive unsigned decimal number less than or equal to
5169 .Va # .
5170 Positional parameters can be
5171 .Ic shift Ns
5172 ed, or become completely replaced, removed etc. via
5173 .Ic vpospar .
5174 A helpful command for numeric computation and string evaluations is
5175 .Ic vexpr ,
5176 .Ic csop
5177 offers C-style byte string operations.
5179 .Bd -literal -offset indent
5180 define name {
5181   command1
5182   command2
5183   ...
5184   commandN
5187 define exmac {
5188   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
5189   return 1000 0
5191 call exmac Hello macro exmac!
5192 echo ${?}/${!}/${^ERRNAME}
5198 .It Ic delete , undelete
5199 (d, u) Marks the given message list as being or not being
5200 .Ql deleted ,
5201 respectively; if no argument has been specified then the usual search
5202 for a visible message is performed, as documented for
5203 .Sx "Message list arguments" ,
5204 showing only the next input prompt if the search fails.
5205 Deleted messages will neither be saved in the
5206 .Mx -sx
5207 .Sx "secondary mailbox"
5208 .Ev MBOX
5209 nor will they be available for most other commands.
5210 If the
5211 .Va autoprint
5212 variable is set, the new
5213 .Dq dot
5214 or the last message restored, respectively, is automatically
5215 .Ic type Ns
5216 d; also see
5217 .Ic dp ,
5218 .Ic dt .
5222 .It Ic digmsg
5223 \*(NQ Digging (information out of) messages is possible through
5224 .Ic \&\&digmsg
5225 objects, which can be
5226 .Cm create Ns
5227 d for the given message number; in compose mode the hyphen-minus
5228 .Ql -
5229 will instead open the message that is being composed.
5230 If a hyphen-minus is given as the optional third argument then output
5231 will be generated on the standard output channel instead of being
5232 subject to consumation by the
5233 .Ic readsh
5234 (here better than
5235 .Ic read
5237 .Ic readall )
5238 command.
5240 The objects may be
5241 .Cm remove Ns
5242 d again by giving the same identifier used for creation;
5243 this step could be omitted: objects will be automatically closed
5244 when the active mailbox or the compose mode is left, respectively.
5245 In all other use cases the second argument is an object identifier,
5246 and the third and all following arguments are interpreted as via
5247 .Ic ~^
5248 (see
5249 .Sx "COMMAND ESCAPES" ) :
5250 .Bd -literal -offset indent
5251 ? vput = msgno; digmsg create $msgno
5252 ? digmsg $msgno header list;   readall x;   echon $x
5253 210 Subject From To Message-ID References In-Reply-To
5254 ? digmsg $msgno header show Subject;readall x;echon $x
5255 212 Subject
5256 'Hello, world'
5258 ? digmsg remove $msgno
5263 .It Ic discard
5264 (di) Identical to
5265 .Ic ignore .
5266 Superseded by the multiplexer
5267 .Ic headerpick .
5271 .It Ic dp , dt
5272 Delete the given messages and automatically
5273 .Ic type
5274 the new
5275 .Dq dot
5276 if one exists, regardless of the setting of
5277 .Va autoprint .
5280 .It Ic dotmove
5281 Move the
5282 .Dq dot
5283 up or down by one message when given
5284 .Ql +
5286 .Ql -
5287 argument, respectively.
5291 .It Ic draft , undraft
5292 Take message lists and mark each given message as being draft, or not
5293 being draft, respectively, as documented in the section
5294 .Sx "Message states" .
5297 .It Ic echo
5298 \*(NQ(ec) Echoes arguments to standard output and writes a trailing
5299 newline, whereas the otherwise identical
5300 .Ic echon
5301 does not.
5302 .Sx "Shell-style argument quoting"
5303 is used,
5304 .Sx "Filename transformations"
5305 are applied to the expanded arguments.
5306 This command also supports
5307 .Cm vput
5308 as documented in
5309 .Sx "Command modifiers" ,
5310 and manages the error number
5311 .Va \&! :
5312 if data is stored in a variable then the return value reflects the
5313 length of the result string in case of success and is
5314 .Ql -1
5315 on error.
5318 .It Ic echoerr
5319 \*(NQ Identical to
5320 .Ic echo ,
5321 but the message is written to standard error, and prefixed by
5322 .Va log-prefix .
5323 Also see
5324 .Ic echoerrn .
5325 In interactive sessions the \*(OPal message ring queue for
5326 .Ic errors
5327 will be used instead, if available and
5328 .Cm vput
5329 was not used.
5332 .It Ic echon
5333 \*(NQ Identical to
5334 .Ic echo ,
5335 but does not write or store a trailing newline.
5338 .It Ic echoerrn
5339 \*(NQ Identical to
5340 .Ic echoerr ,
5341 but does not write or store a trailing newline.
5344 .It Ic edit
5345 (e) Point the text
5346 .Ev EDITOR
5347 at each message from the given list in turn.
5348 Modified contents are discarded unless the
5349 .Va writebackedited
5350 variable is set, and are not used unless the mailbox can be written to
5351 and the editor returns a successful exit status.
5352 .Ic visual
5353 can be used instead for a more display oriented editor.
5356 .It Ic elif
5357 Part of the
5358 .Ic if
5359 (see there for more),
5360 .Ic elif , else , endif
5361 conditional \(em if the condition of a preceding
5362 .Ic if
5363 was false, check the following condition and execute the following block
5364 if it evaluates true.
5367 .It Ic else
5368 (el) Part of the
5369 .Ic if
5370 (see there for more),
5371 .Ic elif , else , endif
5372 conditional \(em if none of the conditions of the preceding
5373 .Ic if
5375 .Ic elif
5376 commands was true, the
5377 .Ic else
5378 block is executed.
5381 .It Ic endif
5382 (en) Marks the end of an
5383 .Ic if
5384 (see there for more),
5385 .Ic elif , else , endif
5386 conditional execution block.
5390 .It Ic environ
5391 \*(NQ There is a strict separation in between
5392 .Sx "INTERNAL VARIABLES"
5393 and the program
5394 .Sx ENVIRONMENT ,
5395 which is inherited by child processes.
5396 Some variables of the latter are however vivid for program operation,
5397 their purpose is known, therefore they have been integrated
5398 transparently into handling of the former, as accessible via
5399 .Ic set
5401 .Ic unset .
5402 To integrate any other environment variable, and/or to export internal
5403 variables into the process environment where they normally are not, a
5404 .Cm link
5405 needs to become established with this command, for example
5408 .Dl environ link PERL5LIB TZ
5411 Afterwards changing such variables with
5412 .Ic set
5413 will cause automatic updates of the environment, too.
5414 Sufficient system support provided (it was in BSD as early as 1987, and
5415 is standardized since Y2K) removing such variables with
5416 .Ic unset
5417 will remove them also from the environment, but in any way the knowledge
5418 they ever have been
5419 .Cm link Ns
5420 ed will be lost.
5421 This implies that
5422 .Ic localopts
5423 may cause loss of such links.
5426 The subcommand
5427 .Cm unlink
5428 removes an existing link without otherwise touching variables, the
5429 .Cm set
5431 .Cm unset
5432 subcommands are identical to
5433 .Ic set
5435 .Ic unset ,
5436 but additionally update the program environment accordingly; removing
5437 a variable breaks any freely established
5438 .Cm link .
5442 .It Ic errors
5443 \*(OP Since \*(UA uses the console as a user interface it can happen
5444 that messages scroll by too fast to become recognized.
5445 Therefore an error log queue is available which can be managed by
5446 .Ic errors :
5447 .Ar show
5448 or no argument will display and clear the queue,
5449 .Ar clear
5450 will only clear the queue.
5451 The queue is finite: if its maximum size is reached any new message
5452 replaces the eldest.
5453 There are also the variables
5454 .Va ^ERRQUEUE-COUNT
5456 .Va ^ERRQUEUE-EXISTS .
5459 .It Ic eval
5460 \*(NQ Construct a command by concatenating the arguments, separated with
5461 a single space character, and then evaluate the result.
5462 This command passes through the exit status
5463 .Va \&?
5464 and error number
5465 .Va \&!
5466 of the evaluated command; also see
5467 .Ic call .
5468 .Bd -literal -offset indent
5469 define xxx {
5470   echo "xxx arg <$1>"
5471   shift
5472   if $# -gt 0
5473     \excall xxx "$@"
5474   endif
5476 define yyy {
5477   eval "$@ ' ball"
5479 call yyy '\ecall xxx' "b\e$'\et'u ' "
5480 call xxx arg <b      u>
5481 call xxx arg <  >
5482 call xxx arg <ball>
5486 .It Ic exit
5487 (ex or x) Exit from \*(UA without changing the active mailbox and skip
5488 any saving of messages in the
5489 .Mx -sx
5490 .Sx "secondary mailbox"
5491 .Ev MBOX ,
5492 as well as a possibly tracked line editor
5493 .Va history-file .
5494 A possibly set
5495 .Va on-account-cleanup
5496 will be invoked, however.
5497 The optional status number argument will be passed through to
5498 .Xr exit 3 .
5499 \*(ID For now it can happen that the given status will be overwritten,
5500 later this will only occur if a later error needs to be reported onto an
5501 otherwise success indicating status.
5504 .It Ic File
5505 (Fi) Like
5506 .Ic folder ,
5507 but open the mailbox read-only.
5510 .It Ic file
5511 (fi) See
5512 .Ic folder .
5516 .It Ic filetype , unfiletype
5517 \*(NQ Define, list, and remove, respectively, file handler hooks,
5518 which provide (shell) commands that enable \*(UA to load and save MBOX
5519 files from and to files with the registered file extensions, as shown
5520 and described for
5521 .Ic folder .
5522 The extensions are used case-insensitively, yet the auto-completion
5523 feature of for example
5524 .Ic folder
5525 will only work case-sensitively.
5526 An intermediate temporary file will be used to store the expanded data.
5527 The latter command will remove hooks for all given extensions, asterisk
5528 .Ql *
5529 will remove all existing handlers.
5531 When used without arguments the former shows a list of all currently
5532 defined file hooks, with one argument the expansion of the given alias.
5533 Otherwise three arguments are expected, the first specifying the file
5534 extension for which the hook is meant, and the second and third defining
5535 the load- and save commands to deal with the file type, respectively,
5536 both of which must read from standard input and write to standard
5537 output.
5538 Changing hooks will not affect already opened mailboxes (\*(ID except below).
5539 \*(ID For now too much work is done, and files are oftened read in twice
5540 where once would be sufficient: this can cause problems if a filetype is
5541 changed while such a file is opened; this was already so with the
5542 built-in support of .gz etc. in Heirloom, and will vanish in v15.
5543 \*(ID For now all handler strings are passed to the
5544 .Ev SHELL for evaluation purposes; in the future a
5545 .Ql \&!
5546 prefix to load and save commands may mean to bypass this shell instance:
5547 placing a leading space will avoid any possible misinterpretations.
5548 .Bd -literal -offset indent
5549 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
5550     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
5551     zst 'zstd -dc' 'zstd -19 -zc' \e
5552     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5553 ? set record=+sent.zst.pgp
5558 .It Ic flag , unflag
5559 Take message lists and mark the messages as being flagged, or not being
5560 flagged, respectively, for urgent/special attention.
5561 See the section
5562 .Sx "Message states" .
5565 .It Ic Folder
5566 (Fold) Like
5567 .Ic folder ,
5568 but open the mailbox read-only.
5572 .It Ic folder
5573 (fold) Open a new, or show status information of the current mailbox.
5574 If an argument is given, changes (such as deletions) will be written
5575 out, a new mailbox will be opened, the internal variables
5576 .Va mailbox-resolved
5578 .Va mailbox-display
5579 will be updated, a set according
5580 .Va folder-hook
5581 is executed, and optionally a summary of
5582 .Ic headers
5583 is displayed if the variable
5584 .Va header
5585 is set.
5588 .Sx "Filename transformations"
5589 will be applied to the
5590 .Ar name
5591 argument, and
5592 .Ql protocol://
5593 prefixes are, i.e., URL (see
5594 .Sx "On URL syntax and credential lookup" )
5595 syntax is understood, as in
5596 .Ql mbox:///tmp/somefolder .
5597 If a protocol prefix is used the mailbox type is fixated, otherwise
5598 opening none-existing
5599 .Ic folders
5600 uses the protocol defined in
5601 .Va newfolders .
5604 For the protocols
5605 .Ar mbox
5607 .Ar file
5608 (MBOX database), as well as
5609 .Ar eml
5610 (electronic mail message \*(ID read-only) the list of all registered
5611 .Ic filetype Ns
5612 s is traversed to check whether hooks shall be used to load (and save)
5613 data from (and to) the given
5614 .Ar name .
5615 Changing hooks will not affect already opened mailboxes.
5616 For example, the following creates hooks for the
5617 .Xr gzip 1
5618 compression tool and a combined compressed and encrypted format:
5620 .Bd -literal -offset indent
5621 ? filetype \e
5622     gzip 'gzip -dc' 'gzip -c' \e
5623     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5627 For historic reasons
5628 .Ic filetype Ns
5629 s provide limited (case-sensitive) auto-completion capabilities.
5630 For example
5631 .Ql mbox.gz
5632 will be found for
5633 .Ql \&? file mbox ,
5634 provided that corresponding handlers are installed.
5635 It will neither find
5636 .Ql mbox.GZ
5638 .Ql mbox.Gz
5639 however, but an explicit
5640 .Ql \&? file mbox.GZ
5641 will find and use the handler for
5642 .Ql gz .
5643 \*(ID The latter mode can only be used for MBOX files.
5646 EML files consist of only one mail message,
5647 \*(ID and can only be opened read-only.
5648 When reading MBOX files tolerant POSIX rules are used by default.
5649 Invalid message boundaries that can be found quite often in historic
5650 MBOX files will be complained about (even more with
5651 .Va debug ):
5652 in this case the method described for
5653 .Va mbox-rfc4155
5654 can be used to create a valid MBOX database from the invalid input.
5657 MBOX databases and EML files will always be protected via file-region locks
5658 .Pf ( Xr fcntl 2 )
5659 during file operations to protect against concurrent modifications.
5660 .Mx -ix "dotlock files"
5661 \*(OP An MBOX
5662 .Va inbox
5663 .Pf ( Ev MAIL )
5665 .Mx -sx
5666 .Sx "primary system mailbox"
5667 will also be protected by so-called dotlock files,
5668 the traditional way of mail spool file locking: for any file
5669 .Ql x
5670 a lock file
5671 .Ql x.lock
5672 will be created during the synchronization, in the same directory and
5673 with the same user and group identities as the file of interest \(em
5674 as necessary created by an external privileged dotlock helper.
5675 .Va dotlock-disable
5676 disables dotlock files.
5677 Also see
5678 .Sx FAQ :
5679 .Sx "Howto handle stale dotlock files" .
5682 \*(OP If no protocol has been fixated, and
5683 .Ar name
5684 refers to a directory with the subdirectories
5685 .Ql tmp ,
5686 .Ql new
5688 .Ql cur ,
5689 then it is treated as a folder in
5690 .Dq Maildir
5691 format.
5692 The maildir format stores each message in its own file, and has been
5693 designed so that file locking is not necessary when reading or writing
5694 files.
5697 \*(OPally URLs can be used to access network resources, securely via
5698 .Sx "Encrypted network communication" ,
5699 if so supported.
5700 Network communication socket timeouts are configurable via
5701 .Va socket-connect-timeout .
5702 All network traffic may be proxied over a SOCKS server via
5703 .Va socks-proxy .
5706 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
5707 .Dl \*(OU protocol://[user@]host[:port][/path]
5710 \*(OPally supported network protocols are
5711 .Ar pop3
5712 (POP3) and
5713 .Ar pop3s
5714 (POP3 with TLS encrypted transport),
5715 .Ar imap
5717 .Ar imaps .
5719 .Ar [/path]
5720 part is valid only for IMAP; there it defaults to
5721 .Ar INBOX .
5722 Network URLs require a special encoding as documented in the section
5723 .Sx "On URL syntax and credential lookup" .
5727 .It Ic folders
5728 Lists the names of all folders below the given argument or
5729 .Va folder .
5730 For file-based protocols
5731 .Ev LISTER
5732 will be used for display purposes.
5736 .It Ic Followup , followup
5737 \*(CM(F,fo) Similar to
5738 .Ic Reply ,
5740 .Ic reply ,
5741 respectively, but save the message in a file named after the local part
5742 of the (first) recipient's address, possibly overwriting
5743 .Va record ,
5744 and honouring
5745 .Va outfolder .
5746 Also see
5747 .Ic Copy
5749 .Ic Save .
5752 .It Ic Forward
5753 \*(CM Similar to
5754 .Ic forward ,
5755 but saves the message in a file named after the local part of the
5756 recipient's address (instead of in
5757 .Va record Ns ).
5760 .It Ic forward
5761 \*(CM Take a message list and the address of a recipient, subject to
5762 .Va fullnames ,
5763 to whom the messages are sent.
5764 The text of the original message is included in the new one,
5765 enclosed by the values of
5766 .Va forward-inject-head
5768 .Va forward-inject-tail .
5769 .Va content-description-forwarded-message
5770 is inspected.
5771 The list of included headers can be filtered with the
5772 .Ql forward
5773 slot of the white- and blacklisting command
5774 .Ic headerpick .
5775 Only the first part of a multipart message is included but for
5776 .Va forward-as-attachment .
5778 This may generate the errors
5779 .Va ^ERR Ns -DESTADDRREQ
5780 if no receiver has been specified, or was rejected by
5781 .Va expandaddr
5782 policy,
5783 .Va ^ERR Ns -IO
5784 if an I/O error occurs,
5785 .Va ^ERR Ns -NOTSUP
5786 if a necessary character set conversion fails, and
5787 .Va ^ERR Ns -INVAL
5788 for other errors.
5789 It can also fail with errors of
5790 .Sx "Specifying messages" .
5791 Any error stops processing of further messages.
5794 .It Ic from
5795 (f) Takes a list of message specifications and displays a summary of
5796 their message headers, exactly as via
5797 .Ic headers ,
5798 making the first message of the result the new
5799 .Dq dot
5800 (the last message if
5801 .Va showlast
5802 is set).
5803 An alias of this command is
5804 .Ic search .
5805 Also see
5806 .Sx "Specifying messages" .
5808 .It Ic Fwd
5809 \*(OB Alias for
5810 .Ic Forward .
5812 .It Ic fwd
5813 \*(OB Alias for
5814 .Ic forward .
5816 .It Ic fwdignore
5817 \*(OB Superseded by the multiplexer
5818 .Ic headerpick .
5820 .It Ic fwdretain
5821 \*(OB Superseded by the multiplexer
5822 .Ic headerpick .
5824 .It Ic ghost , unghost
5825 \*(OB Replaced by
5826 .Ic commandalias ,
5827 .Ic uncommandalias .
5831 .It Ic headerpick , unheaderpick
5832 \*(NQ Multiplexer command to manage white- and blacklisting
5833 selections of header fields for a variety of applications.
5834 Without arguments the set of contexts that have settings is displayed.
5835 When given arguments, the first argument is the context to which the
5836 command applies, one of (case-insensitive)
5837 .Ql type
5838 for display purposes (for example
5839 .Ic type ) ,
5840 .Ql save
5841 for selecting which headers shall be stored persistently when
5842 .Ic save ,
5843 .Ic copy ,
5844 .Ic move
5845 or even
5846 .Ic decrypt Ns
5847 ing messages (note that MIME related etc. header fields should not be
5848 ignored in order to not destroy usability of the message in this case),
5849 .Ql forward
5850 for stripping down messages when
5851 .Ic forward Ns
5852 ing message (has no effect if
5853 .Va forward-as-attachment
5854 is set), and
5855 .Ql top
5856 for defining user-defined set of fields for the command
5857 .Ic top .
5859 The current settings of the given context are displayed if it is the
5860 only argument.
5861 A second argument denotes the type of restriction that is to be chosen,
5862 it may be (a case-insensitive prefix of)
5863 .Ql retain
5865 .Ql ignore
5866 for white- and blacklisting purposes, respectively.
5867 Establishing a whitelist suppresses inspection of the corresponding
5868 blacklist.
5870 If no further argument is given the current settings of the given type
5871 will be displayed, otherwise the remaining arguments specify header
5872 fields, which \*(OPally may be given as regular expressions, to be added
5873 to the given type.
5874 The special wildcard field (asterisk,
5875 .Ql * )
5876 will establish a (fast) shorthand setting which covers all fields.
5878 The latter command always takes three or more arguments and can be used
5879 to remove selections, i.e., from the given context, the given type of
5880 list, all the given headers will be removed, the special argument
5881 .Ql *
5882 will remove all headers.
5885 .It Ic headers
5886 (h) Show the current group of headers, the size of which depends on
5887 the variable
5888 .Va screen
5889 in interactive mode, and the format of which can be defined with
5890 .Va headline .
5891 If a message-specification is given the group of headers containing the
5892 first message therein is shown and the message at the top of the screen
5893 becomes the new
5894 .Dq dot ;
5895 the last message is targeted if
5896 .Va showlast
5897 is set.
5900 .It Ic help
5901 (hel) A synonym for
5902 .Ic \&? .
5905 .It Ic history
5906 \*(OP Without arguments or when given
5907 .Cm show
5908 all history entries are shown (this mode also supports a more
5909 .Va verbose
5910 output).
5911 .Cm load
5912 will replace the list of entries with the content of
5913 .Va history-file ,
5915 .Cm save
5916 will dump the current list to said file, replacing former content.
5917 .Cm clear
5918 will delete all history entries.
5919 The argument can also be a signed decimal
5920 .Ar NUMBER ,
5921 which will select and evaluate the respective history entry, and move it
5922 to the top of the history; a negative number is used as an offset to the
5923 current command so that
5924 .Ql -1
5925 will select the last command, the history top.
5926 An entry may be deleted by giving
5927 .Cm delete
5928 followed by a
5929 .Ar NUMBER .
5930 Also see
5931 .Sx "On terminal control and line editor" .
5934 .It Ic hold
5935 (ho, also
5936 .Ic preserve )
5937 Takes a message list and marks each message therein to be saved in the
5938 user's system
5939 .Va inbox
5940 instead of in the
5941 .Mx -sx
5942 .Sx "secondary mailbox"
5943 .Ev MBOX .
5944 Does not override the
5945 .Ic delete
5946 command.
5947 \*(UA deviates from the POSIX standard with this command, because a
5948 .Ic next
5949 command issued after
5950 .Ic hold
5951 will display the following message, not the current one.
5955 .It Ic if
5956 (i) Part of the
5957 .Ic \&\&if , Ic elif , else , endif
5958 conditional execution construct \(em if the given condition is true then
5959 the encapsulated block is executed.
5960 The POSIX standard only supports the (case-insensitive) conditions
5961 .Ql r Ns
5962 eceive
5964 .Ql s Ns
5965 end, the remaining are non-portable extensions.
5966 \*(ID In conjunction with the
5967 .Cm wysh
5968 command prefix(es)
5969 .Sx "Shell-style argument quoting"
5970 and more test operators are available.
5972 .Bd -literal -offset indent
5973 if receive
5974   commands ...
5975 else
5976   commands ...
5977 endif
5981 Further (case-insensitive) one-argument conditions are
5982 .Ql t Ns
5983 erminal which evaluates to true in interactive terminal sessions
5984 (running with standard input or standard output attached to a terminal,
5985 and none of the
5986 .Dq quickrun
5987 command line options
5988 .Fl e ,
5989 .Fl H
5991 .Fl L
5992 have been used), as well as any boolean value (see
5993 .Sx "INTERNAL VARIABLES"
5994 for textual boolean representations) to mark an enwrapped block as
5995 .Dq never execute
5997 .Dq always execute .
5998 (Remarks: condition syntax errors skip all branches until
5999 .Ic endif . )
6002 \*(OU and without
6003 .Cm wysh :
6004 It is possible to check
6005 .Sx "INTERNAL VARIABLES"
6006 as well as
6007 .Sx ENVIRONMENT
6008 variables for existence or compare their expansion against a user given
6009 value or another variable by using the
6010 .Ql $
6011 .Pf ( Dq variable next )
6012 conditional trigger character;
6013 a variable on the right hand side may be signalled using the same
6014 mechanism.
6015 Variable names may be enclosed in a pair of matching braces.
6016 When this mode has been triggered, several operators are available
6017 (\*(IN and
6018 .Cm wysh :
6019 they are always available, and there is no trigger: variables will have
6020 been expanded by the shell-compatible parser before the
6021 .Ic if
6022 etc. command sees them).
6025 \*(IN Two argument conditions.
6026 Variables can be tested for existence and expansion:
6027 .Ql -N
6028 will test whether the given variable exists, so that
6029 .Ql -N editalong
6030 will evaluate to true when
6031 .Va editalong
6032 is set, whereas
6033 .Ql -Z editalong
6034 will if it is not.
6035 .Ql -n """$editalong"""
6036 will be true if the variable is set and expands to a non-empty string,
6037 .Ql -z $'\e$editalong'
6038 only if the expansion is empty, whether the variable exists or not.
6039 The remaining conditions take three arguments.
6042 Integer operators treat the arguments on the left and right hand side of
6043 the operator as integral numbers and compare them arithmetically.
6044 It is an error if any of the operands is not a valid integer, an empty
6045 argument (which implies it had been quoted) is treated as if it were 0.
6046 Via the question mark
6047 .Ql \&?
6048 modifier suffix a saturated operation mode is available where numbers
6049 will linger at the minimum or maximum possible value, instead of
6050 overflowing (or trapping), the keyword
6051 .Ql saturated
6052 is optional,
6053 .Ql ==? ,
6054 .Ql ==?satu
6056 .Ql ==?saturated
6057 are therefore identical.
6058 Available operators are
6059 .Ql -lt
6060 (less than),
6061 .Ql -le
6062 (less than or equal to),
6063 .Ql -eq
6064 (equal),
6065 .Ql -ne
6066 (not equal),
6067 .Ql -ge
6068 (greater than or equal to), and
6069 .Ql -gt
6070 (greater than).
6073 String and regular expression data operators compare the left and right
6074 hand side according to their textual content.
6075 Unset variables are treated as the empty string.
6076 Via the question mark
6077 .Ql \&?
6078 modifier suffix a case-insensitive operation mode is available, the keyword
6079 .Ql case
6080 is optional,
6081 .Ql ==?
6083 .Ql ==?case
6084 are identical.
6087 Available string operators are
6088 .Ql <
6089 (less than),
6090 .Ql <=
6091 (less than or equal to),
6092 .Ql ==
6093 (equal),
6094 .Ql !=
6095 (not equal),
6096 .Ql >=
6097 (greater than or equal to),
6098 .Ql >
6099 (greater than),
6100 .Ql =%
6101 (is substring of) and
6102 .Ql !%
6103 (is not substring of).
6104 By default these operators work on bytes and (therefore) do not take
6105 into account character set specifics.
6106 If the case-insensitivity modifier has been used, case is ignored
6107 according to the rules of the US-ASCII encoding, i.e., bytes are
6108 still compared.
6111 When the \*(OPal regular expression support is available, the additional
6112 string operators
6113 .Ql =~
6115 .Ql !~
6116 can be used.
6117 They treat the right hand side as an extended regular expression that is
6118 matched according to the active locale (see
6119 .Sx "Character sets" ) ,
6120 i.e., character sets should be honoured correctly.
6123 Conditions can be joined via AND-OR lists (where the AND operator is
6124 .Ql &&
6125 and the OR operator is
6126 .Ql || ) ,
6127 which have equal precedence and will be evaluated with left
6128 associativity, thus using the same syntax that is known for the
6129 .Xr sh 1 .
6130 It is also possible to form groups of conditions and lists by enclosing
6131 them in pairs of brackets
6132 .Ql [\ \&.\&.\&.\ ] ,
6133 which may be interlocked within each other, and also be joined via
6134 AND-OR lists.
6137 The results of individual conditions and entire groups may be modified
6138 via unary operators: the unary operator
6139 .Ql \&!
6140 will reverse the result.
6142 .Bd -literal -offset indent
6143 wysh set v15-compat=yes # with value: automatic "wysh"!
6144 if -N debug;echo *debug* set;else;echo not;endif
6145 if [ "$ttycharset" == UTF-8 ] || \e
6146     [ "$ttycharset" ==?case UTF8 ]
6147   echo *ttycharset* is UTF-8, the former case-sensitive!
6148 endif
6149 set t1=one t2=one
6150 if [ "${t1}" == "${t2}" ]
6151   echo These two variables are equal
6152 endif
6153 if "$features" =% +regex && "$TERM" =~?case "^xterm\&.*"
6154   echo ..in an X terminal
6155 endif
6156 if [ [ true ] && [ [ "${debug}" != '' ] || \e
6157     [ "$verbose" != '' ] ] ]
6158   echo Noisy, noisy
6159 endif
6160 if true && [ -n "$debug" || -n "${verbose}" ]
6161   echo Left associativity, as is known from the shell
6162 endif
6167 .It Ic ignore
6168 (ig) Identical to
6169 .Ic discard .
6170 Superseded by the multiplexer
6171 .Ic headerpick .
6174 .It Ic list
6175 Shows the names of all available commands, in command lookup order.
6176 \*(OP In conjunction with a set variable
6177 .Va verbose
6178 additional information will be provided for each command: the argument
6179 type will be indicated, the documentation string will be shown,
6180 and the set of command flags will show up:
6182 .Bl -tag -compact -width ".It Ql NEEDS_BOX"
6183 .It Ql "`local'"
6184 command supports the command modifier
6185 .Cm local .
6186 .It Ql "`vput'"
6187 command supports the command modifier
6188 .Cm vput .
6189 .It Ql "*!*"
6190 the error number is tracked in
6191 .Va \&! .
6192 .It Ql needs-box
6193 whether the command needs an active mailbox, a
6194 .Ic folder .
6195 .It Ql ok:
6196 indicators whether command is \&.\h'.3m'.\h'.3m'.
6197 .Bl -tag -compact -width ".It Ql SUBPROCESS"
6198 .It Ql batch/interactive
6199 usable in interactive or batch mode
6200 .Pf ( Fl # ) .
6201 .It Ql send-mode
6202 usable in send mode.
6203 .It Ql subprocess
6204 allowed to be used when running in a subprocess instance,
6205 for example from within a macro that is called via
6206 .Va on-compose-splice .
6208 .It Ql not ok:
6209 indicators whether command is not \&.\h'.3m'.\h'.3m'.
6210 .Bl -tag -compact -width ".It Ql COMPOSE_MODE"
6211 .It Ql compose-mode
6212 available in compose mode.
6213 .It Ql startup
6214 available during program startup, like in
6215 .Sx "Resource files" .
6217 .It Ql "gabby"
6218 The command produces
6219 .Va history-gabby
6220 .Ic history
6221 entries.
6226 .It Ic localopts
6227 Enforce change localization of
6228 .Ic environ
6229 (linked)
6230 .Sx ENVIRONMENT
6231 as well as (global)
6232 .Sx "INTERNAL VARIABLES" ,
6233 meaning that their state will be reverted to the former one once the
6234 .Dq covered scope
6235 is left.
6236 Just like the command modifier
6237 .Cm local ,
6238 which provides block-scope localization for some commands (instead),
6239 it can only be used inside of macro definition blocks introduced by
6240 .Ic account
6242 .Ic define .
6243 The covered scope of an
6244 .Ic account
6245 is left once a different account is activated, and some macros, notably
6246 .Va folder-hook Ns s ,
6247 use their own specific notion of covered scope, here it will be extended
6248 until the folder is left again.
6251 This setting stacks up: i.e., if
6252 .Ql macro1
6253 enables change localization and calls
6254 .Ql macro2 ,
6255 which explicitly resets localization, then any value changes within
6256 .Ql macro2
6257 will still be reverted when the scope of
6258 .Ql macro1
6259 is left.
6260 (Caveats: if in this example
6261 .Ql macro2
6262 changes to a different
6263 .Ic account
6264 which sets some variables that are already covered by localizations,
6265 their scope will be extended, and in fact leaving the
6266 .Ic account
6267 will (thus) restore settings in (likely) global scope which actually
6268 were defined in a local, macro private context!)
6271 This command takes one or two arguments, the optional first one
6272 specifies an attribute that may be one of
6273 .Cm \&\&scope ,
6274 which refers to the current scope and is thus the default,
6275 .Cm call ,
6276 which causes any macro that is being
6277 .Ic call Ns
6278 ed to be started with localization enabled by default, as well as
6279 .Cm call-fixate ,
6280 which (if enabled) disallows any called macro to turn off localization:
6281 like this it can be ensured that once the current scope regains control,
6282 any changes made in deeper levels have been reverted.
6283 The latter two are mutually exclusive, and neither affects
6284 .Ic xcall .
6285 The (second) argument is interpreted as a boolean (string, see
6286 .Sx "INTERNAL VARIABLES" )
6287 and states whether the given attribute shall be turned on or off.
6289 .Bd -literal -offset indent
6290 define temporary_settings {
6291   set possibly_global_option1
6292   localopts on
6293   set localized_option1
6294   set localized_option2
6295   localopts scope off
6296   set possibly_global_option2
6303 .It Ic Lfollowup , Lreply
6304 \*(CM Reply to messages that come in via known
6305 .Pf ( Ic mlist )
6306 or subscribed
6307 .Pf ( Ic mlsubscribe )
6308 mailing lists, or pretend to do so (see
6309 .Sx "Mailing lists" ) :
6310 on top of the usual
6311 .Ic followup
6313 .Ic reply ,
6314 respectively, functionality this will actively resort and even remove
6315 message recipients in order to generate a message that is supposed to be
6316 sent to a mailing list.
6317 For example it will also implicitly generate a
6318 .Ql Mail-Followup-To:
6319 header if that seems useful, regardless of the setting of the variable
6320 .Va followup-to .
6321 For more documentation please refer to
6322 .Sx "On sending mail, and non-interactive mode" .
6324 This may generate the errors
6325 .Va ^ERR Ns -DESTADDRREQ
6326 if no receiver has been specified,
6327 .Va ^ERR Ns -PERM
6328 if some addressees where rejected by
6329 .Va expandaddr ,
6330 .Va ^ERR Ns -IO
6331 if an I/O error occurs,
6332 .Va ^ERR Ns -NOTSUP
6333 if a necessary character set conversion fails, and
6334 .Va ^ERR Ns -INVAL
6335 for other errors.
6336 It can also fail with errors of
6337 .Sx "Specifying messages" .
6338 Occurrence of some of the errors depend on the value of
6339 .Va expandaddr .
6340 Any error stops processing of further messages.
6343 .It Ic Mail
6344 \*(CM Similar to
6345 .Ic mail ,
6346 but saves the message in a file named after the local part of the first
6347 recipient's address (instead of in
6348 .Va record Ns ).
6351 .It Ic mail
6352 \*(CM(m) Takes a (list of) recipient address(es) as (an) argument(s),
6353 or asks on standard input if none were given;
6354 then collects the remaining mail content and sends it out.
6355 Unless the internal variable
6356 .Va fullnames
6357 is set recipient addresses will be stripped from comments, names etc.
6358 For more documentation please refer to
6359 .Sx "On sending mail, and non-interactive mode" .
6361 This may generate the errors
6362 .Va ^ERR Ns -DESTADDRREQ
6363 if no receiver has been specified,
6364 .Va ^ERR Ns -PERM
6365 if some addressees where rejected by
6366 .Va expandaddr ,
6367 .Va ^ERR Ns -NOTSUP
6368 if multiple messages have been specified,
6369 .Va ^ERR Ns -IO
6370 if an I/O error occurs,
6371 .Va ^ERR Ns -NOTSUP
6372 if a necessary character set conversion fails, and
6373 .Va ^ERR Ns -INVAL
6374 for other errors.
6375 It can also fail with errors of
6376 .Sx "Specifying messages" .
6377 Occurrence of some of the errors depend on the value of
6378 .Va expandaddr .
6381 .It Ic mailcap
6382 \*(OP When used without arguments or if
6383 .Ar show
6384 has been given the content of
6385 .Sx "The Mailcap files"
6386 cache is shown, (re-)initializing it first (as necessary.
6387 If the argument is
6388 .Ar load
6389 then the cache will only be (re-)initialized, and
6390 .Ar clear
6391 will remove its contents.
6392 Note that \*(UA will try to load the files only once, use
6393 .Ql Ic \&\&mailcap Ns \:\0\:clear
6394 to unlock further attempts.
6395 Loading and parsing can be made more
6396 .Va verbose .
6399 .It Ic mbox
6400 (mb) The given message list is to be sent to the
6401 .Mx -sx
6402 .Sx "secondary mailbox"
6403 .Ev MBOX
6404 when \*(UA is quit; this is the default action unless the variable
6405 .Va hold
6406 is set.
6407 \*(ID This command can only be used in a
6408 .Mx -sx
6409 .Sx "primary system mailbox" .
6413 .It Ic mimetype , unmimetype
6414 \*(NQ Without arguments the content of the MIME type cache will displayed;
6415 a more verbose listing will be produced if either of
6416 .Va debug
6418 .Va verbose
6419 are set.
6420 When given arguments they will be joined, interpreted as shown in
6421 .Sx "The mime.types files"
6422 (also see
6423 .Sx "HTML mail and MIME attachments" ) ,
6424 and the resulting entry will be added (prepended) to the cache.
6425 In any event MIME type sources are loaded first as necessary \(en
6426 .Va mimetypes-load-control
6427 can be used to fine-tune which sources are actually loaded.
6429 The latter command deletes all specifications of the given MIME type, thus
6430 .Ql \&? unmimetype text/plain
6431 will remove all registered specifications for the MIME type
6432 .Ql text/plain .
6433 The special name
6434 .Ql *
6435 will discard all existing MIME types, just as will
6436 .Ql reset ,
6437 but which also reenables cache initialization via
6438 .Va mimetypes-load-control .
6441 .It Ic mimeview
6442 \*(ID Only available in interactive mode, this command allows execution
6443 of external MIME type handlers which do not integrate into the normal
6444 .Ic type
6445 output (see
6446 .Sx "HTML mail and MIME attachments" ) .
6447 (\*(ID No syntax to directly address parts, this restriction may vanish.)
6448 The user will be asked for each non-text part of the given message in
6449 turn whether the registered handler shall be used to display the part.
6453 .It Ic mlist , unmlist
6454 \*(NQ Manage the list of known
6455 .Sx "Mailing lists" ;
6456 subscriptions are controlled via
6457 .Ic mlsubscribe .
6458 The latter command deletes all given arguments,
6459 or all at once when given the asterisk
6460 .Ql * .
6461 The former shows the list of all currently known lists if used
6462 without arguments, otherwise the given arguments will become known.
6463 \*(OP In the latter case, arguments which contain any of the
6464 .Mx -sx
6465 .Sx "magic regular expression characters"
6466 will be interpreted as one, possibly matching many addresses;
6467 these will be sequentially matched via linked lists instead of being
6468 looked up in a dictionary.
6472 .It Ic mlsubscribe , unmlsubscribe
6473 Building upon the command pair
6474 .Ic mlist , unmlist ,
6475 but only managing the subscription attribute of mailing lists.
6476 (The former will also create not yet existing mailing lists.)
6479 .It Ic Move
6480 Similar to
6481 .Ic move ,
6482 but move the messages to a file named after the local part of the
6483 sender of the first message instead of taking a filename argument;
6484 .Va outfolder
6485 is inspected to decide on the actual storage location.
6488 .It Ic move
6489 Acts like
6490 .Ic copy
6491 but marks the messages for deletion if they were transferred
6492 successfully.
6495 .It Ic More
6496 Like
6497 .Ic more ,
6498 but also displays header fields which would not pass the
6499 .Ic headerpick
6500 selection, and all MIME parts.
6501 Identical to
6502 .Ic Page .
6505 .It Ic more
6506 Invokes the
6507 .Ev PAGER
6508 on the given messages, even in non-interactive mode and as long as the
6509 standard output is a terminal.
6510 Identical to
6511 .Ic page .
6514 .It Ic mtaaliases
6515 \*(OP When used without arguments or if
6516 .Ar show
6517 has been given the content of the
6518 .Va mta-aliases
6519 cache is shown, (re-)initializing it first (as necessary).
6520 If the argument is
6521 .Ar load
6522 then the cache will only be (re-)initialized, and
6523 .Ar clear
6524 will remove its contents.
6527 .It Ic netrc
6528 \*(OP When used without arguments, or when the argument was
6529 .Ar show
6530 the content of the
6531 .Pa \*(VN
6532 cache is shown, initializing it as necessary.
6533 If the argument is
6534 .Ar load
6535 then the cache will be (re)loaded, whereas
6536 .Ar clear
6537 removes it.
6538 Loading and parsing can be made more
6539 .Va verbose .
6540 .Ar lookup
6541 will query the cache for the URL given as the second argument
6542 .Pf ( Ql [USER@]HOST ) .
6544 .Va netrc-lookup ,
6545 .Va netrc-pipe
6546 and the section
6547 .Sx "On URL syntax and credential lookup" ;
6548 the section
6549 .Sx "The .netrc file"
6550 documents the file format in detail.
6553 .It Ic newmail
6554 Checks for new mail in the current folder without committing any changes
6555 before.
6556 If new mail is present, a message is shown.
6557 If the
6558 .Va header
6559 variable is set,
6560 the headers of each new message are also shown.
6561 This command is not available for all mailbox types.
6564 .It Ic next
6565 (n) (like
6566 .Ql +
6568 .Dq ENTER )
6569 Goes to the next message in sequence and types it.
6570 With an argument list, types the next matching message.
6573 .It Ic New
6574 Same as
6575 .Ic Unread .
6578 .It Ic new
6579 Same as
6580 .Ic unread .
6583 .It Ic noop
6584 If the current folder is accessed via a network connection, a
6585 .Dq NOOP
6586 command is sent, otherwise no operation is performed.
6589 .It Ic Page
6590 Like
6591 .Ic page ,
6592 but also displays header fields which would not pass the
6593 .Ic headerpick
6594 selection, and all MIME parts.
6595 Identical to
6596 .Ic More .
6599 .It Ic page
6600 Invokes the
6601 .Ev PAGER
6602 on the given messages, even in non-interactive mode and as long as the
6603 standard output is a terminal.
6604 Identical to
6605 .Ic more .
6608 .It Ic Pipe
6609 Like
6610 .Ic pipe
6611 but also pipes header fields which would not pass the
6612 .Ic headerpick
6613 selection, and all parts of MIME
6614 .Ql multipart/alternative
6615 messages.
6618 .It Ic pipe
6619 (pi) Takes an optional message list and shell command (that defaults to
6620 .Va cmd ) ,
6621 and pipes the messages through the command.
6622 If the
6623 .Va page
6624 variable is set,
6625 every message is followed by a formfeed character.
6628 .It Ic preserve
6629 (pre) A synonym for
6630 .Ic hold .
6633 .It Ic Print
6634 (P) Alias for
6635 .Ic Type .
6638 .It Ic print
6639 (p) Research
6641 equivalent of
6642 .Ic type .
6645 .It Ic quit
6646 (q) Terminates the session, saving all undeleted, unsaved messages in
6647 the current
6648 .Mx -sx
6649 .Sx "secondary mailbox"
6650 .Ev MBOX ,
6651 preserving all messages marked with
6652 .Ic hold
6654 .Ic preserve
6655 or never referenced in the system
6656 .Va inbox ,
6657 and removing all other messages from the
6658 .Mx -sx
6659 .Sx "primary system mailbox" .
6660 If new mail has arrived during the session,
6661 the message
6662 .Dq You have new mail
6663 will be shown.
6664 If given while editing a mailbox file with the command line option
6665 .Fl f ,
6666 then the edit file is rewritten.
6667 A return to the shell is effected,
6668 unless the rewrite of edit file fails,
6669 in which case the user can escape with the exit command.
6670 The optional status number argument will be passed through to
6671 .Xr exit 3 .
6672 \*(ID For now it can happen that the given status will be overwritten,
6673 later this will only occur if a later error needs to be reported onto an
6674 otherwise success indicating status.
6677 .It Ic read
6678 \*(NQ Read a line from standard input, or the channel set active via
6679 .Ic readctl ,
6680 and assign the data, which will be split as indicated by
6681 .Va ifs ,
6682 to the given variables.
6683 The variable names are checked by the same rules as documented for
6684 .Cm vput ,
6685 and the same error codes will be seen in
6686 .Va \&! ;
6687 the exit status
6688 .Va \&?
6689 indicates the number of bytes read, it will be
6690 .Ql -1
6691 with the error number
6692 .Va \&!
6693 set to
6694 .Va ^ERR Ns -BADF
6695 in case of I/O errors, or
6696 .Va ^ERR Ns -NONE
6697 upon End-Of-File.
6698 If there are more fields than variables, assigns successive fields to the
6699 last given variable.
6700 If there are less fields than variables, assigns the empty string to the
6701 remains.
6702 .Bd -literal -offset indent
6703 ? read a b c
6704    H  e  l  l  o
6705 ? echo "<$a> <$b> <$c>"
6706 <H> <e> <l  l  o>
6707 ? wysh set ifs=:; read a b c;unset ifs
6708 hey2.0,:"'you    ",:world!:mars.:
6709 ? echo $?/$^ERRNAME / <$a><$b><$c>
6710 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
6714 .It Ic readsh
6715 \*(NQ Like
6716 .Ic read ,
6717 but splits on shell token boundaries (see
6718 .Sx "Shell-style argument quoting" )
6719 rather than at
6720 .Va ifs .
6721 \*(ID Could become a
6722 .Ic commandalias ,
6723 maybe
6724 .Ql read --tokenize -- .
6727 .It Ic readall
6728 \*(NQ Read anything from standard input, or the channel set active via
6729 .Ic readctl ,
6730 and assign the data to the given variable.
6731 The variable name is checked by the same rules as documented for
6732 .Cm vput ,
6733 and the same error codes will be seen in
6734 .Va \&! ;
6735 the exit status
6736 .Va \&?
6737 indicates the number of bytes read, it will be
6738 .Ql -1
6739 with the error number
6740 .Va \&!
6741 set to
6742 .Va ^ERR Ns -BADF
6743 in case of I/O errors, or
6744 .Va ^ERR Ns -NONE
6745 upon End-Of-File.
6746 \*(ID The input data length is restricted to 31-bits.
6749 .It Ic readctl
6750 \*(NQ Manages input channels for
6751 .Ic read ,
6752 .Ic readsh
6754 .Ic readall ,
6755 to be used to avoid complicated or impracticable code, like calling
6756 .Ic \&\&read
6757 from within a macro in non-interactive mode.
6758 Without arguments, or when the first argument is
6759 .Cm show ,
6760 a listing of all known channels is printed.
6761 Channels can otherwise be
6762 .Cm create Ns
6763 d, and existing channels can be
6764 .Cm set
6765 active and
6766 .Cm remove Ns
6767 d by giving the string used for creation.
6769 The channel name is expected to be a file descriptor number, or,
6770 if parsing the numeric fails, an input file name that undergoes
6771 .Sx "Filename transformations" .
6772 For example (this example requires a modern shell):
6773 .Bd -literal -offset indent
6774 $ printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
6775   \*(uA -R#
6776 hey, you
6777 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
6778   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
6779 hey, you
6783 .It Ic remove
6784 \*(NQ Removes the named files or directories.
6785 If a name refers to a mailbox, say a Maildir mailbox, then a mailbox
6786 type specific removal will be performed, deleting the complete mailbox.
6787 In interactive mode the user is asked for confirmation.
6790 .It Ic rename
6791 \*(NQ Takes the name of an existing folder
6792 and the name for the new folder
6793 and renames the first to the second one.
6794 .Sx "Filename transformations"
6795 including shell pathname wildcard pattern expansions
6796 .Pf ( Xr glob 7 )
6797 are performed on both arguments.
6798 Both folders must be of the same type.
6802 .It Ic Reply , Respond
6803 \*(CM(R) Identical to
6804 .Ic reply
6805 except that it replies to only the sender of each message of the given
6806 list, by using the first message as the template to quote, for the
6807 .Ql Subject:
6808 etc.; setting
6809 .Va flipr
6810 will exchange this command with
6811 .Ic reply .
6815 .It Ic reply , respond
6816 \*(CM(r) Take a message (list) and group-respond (to each in turn)
6817 by addressing the sender and all recipients, subject to
6818 .Va fullnames
6820 .Ic alternates
6821 processing.
6822 .Va followup-to ,
6823 .Va followup-to-honour ,
6824 .Va reply-to-honour
6825 as well as
6826 .Va recipients-in-cc
6827 influence response behaviour.
6828 .Va quote
6829 as well as
6830 .Va quote-as-attachment
6831 configure whether responded-to message shall be quoted etc.,
6832 .Va content-description-quote-attachment
6833 may be used.
6834 Setting
6835 .Va flipr
6836 will exchange this command with
6837 .Ic Reply .
6838 The command
6839 .Ic Lreply
6840 offers special support for replying to mailing lists.
6841 For more documentation please refer to
6842 .Sx "On sending mail, and non-interactive mode" .
6844 This may generate the errors
6845 .Va ^ERR Ns -DESTADDRREQ
6846 if no receiver has been specified, or was rejected by
6847 .Va expandaddr
6848 policy,
6849 .Va ^ERR Ns -IO
6850 if an I/O error occurs,
6851 .Va ^ERR Ns -NOTSUP
6852 if a necessary character set conversion fails, and
6853 .Va ^ERR Ns -INVAL
6854 for other errors.
6855 It can also fail with errors of
6856 .Sx "Specifying messages" .
6857 Any error stops processing of further messages.
6860 .It Ic Resend
6861 Like
6862 .Ic resend ,
6863 but does not add any header lines.
6864 This is not a way to hide the sender's identity,
6865 but useful for sending a message again to the same recipients.
6868 .It Ic resend
6869 Takes a list of messages and a name,
6870 and sends each message to the given addressee, which is subject to
6871 .Va fullnames .
6872 .Ql Resent-From:
6873 and related header fields are prepended to the new copy of the message.
6874 Saving in
6875 .Va record
6876 is only performed if
6877 .Va record-resent
6878 is set.
6879 \*(ID\*(CM is not entered, the only supported hooks are
6880 .Va on-resend-enter
6882 .Va on-resend-cleanup .
6884 This may generate the errors
6885 .Va ^ERR Ns -DESTADDRREQ
6886 if no receiver has been specified, or was rejected by
6887 .Va expandaddr
6888 policy,
6889 .Va ^ERR Ns -IO
6890 if an I/O error occurs,
6891 .Va ^ERR Ns -NOTSUP
6892 if a necessary character set conversion fails, and
6893 .Va ^ERR Ns -INVAL
6894 for other errors.
6895 It can also fail with errors of
6896 .Sx "Specifying messages" .
6897 Any error stops processing of further messages.
6900 .It Ic retain
6901 (ret) Superseded by the multiplexer
6902 .Ic headerpick .
6905 .It Ic return
6906 Only available inside of a
6907 .Ic define Ns
6908 d macro or an
6909 .Ic account ,
6910 this command returns control of execution to the outer scope.
6911 The two optional parameters are positive decimal numbers and default to 0:
6912 the first specifies the 32-bit return value (stored in
6913 .Va \&?
6914 \*(ID and later extended to 64-bit),
6915 the second the 32-bit error number (stored in
6916 .Va \&! ) .
6917 As documented for
6918 .Va \&?
6919 a non-0 exit status may cause the program to exit.
6922 .It Ic Save
6923 (S) Similar to
6924 .Ic save,
6925 but saves the messages in a file named after the local part of the
6926 sender of the first message instead of taking a filename argument;
6927 .Va outfolder
6928 is inspected to decide on the actual storage location.
6931 .It Ic save
6932 (s) Takes a message list and a filename and appends each message in turn
6933 to the end of the file.
6934 .Sx "Filename transformations"
6935 including shell pathname wildcard pattern expansions
6936 .Pf ( Xr glob 7 )
6937 is performed on the filename.
6938 If no filename is given, the
6939 .Mx -sx
6940 .Sx "secondary mailbox"
6941 .Ev MBOX
6942 is used.
6943 The filename in quotes, followed by the generated character count
6944 is echoed on the user's terminal.
6945 If editing a
6946 .Mx -sx
6947 .Sx "primary system mailbox"
6948 the messages are marked for deletion.
6949 To filter the saved header fields to the desired subset use the
6950 .Ql save
6951 slot of the white- and blacklisting command
6952 .Ic headerpick .
6953 Also see
6954 .Ic Copy .
6956 .It Ic savediscard
6957 \*(OB Superseded by the multiplexer
6958 .Ic headerpick .
6960 .It Ic saveignore
6961 \*(OB Superseded by the multiplexer
6962 .Ic headerpick .
6964 .It Ic saveretain
6965 \*(OB Superseded by the multiplexer
6966 .Ic headerpick .
6969 .It Ic search
6970 Takes a message specification (list) and displays a header summary of
6971 all matching messages, as via
6972 .Ic headers .
6973 This command is an alias of
6974 .Ic from .
6975 Also see
6976 .Sx "Specifying messages" .
6979 .It Ic seen
6980 Takes a message list and marks all messages as having been read.
6985 .It Ic set , unset
6986 (se, \*(NQ uns) The latter command will delete all given global
6987 variables, or only block-scope local ones if the
6988 .Cm local
6989 command modifier has been used.
6990 The former, when used without arguments, will show all
6991 currently known variables, being more verbose if either of
6992 .Va debug
6994 .Va verbose
6995 is set.
6996 Remarks: this list mode will not automatically link-in known
6997 .Sx ENVIRONMENT
6998 variables, but only explicit addressing will do so, examples are
6999 .Ic varshow ,
7000 using a variable in an
7001 .Ic if
7002 condition or a string passed to
7003 .Ic echo ,
7004 explicit
7005 .Ic \&\&set Ns
7006 ting, as well as some program-internal use cases.
7009 Otherwise the given variables (and arguments) are set or adjusted.
7010 Arguments are of the form
7011 .Ql name=value
7012 (no space before or after
7013 .Ql = ) ,
7014 or plain
7015 .Ql name
7016 if there is no value, i.e., a boolean variable.
7017 If a name begins with
7018 .Ql no ,
7019 as in
7020 .Ql set nosave ,
7021 the effect is the same as invoking the
7022 .Ic \&\&unset
7023 command with the remaining part of the variable
7024 .Pf ( Ql unset save ) .
7025 \*(ID In conjunction with the
7026 .Cm wysh
7027 .Pf (or\0 Cm local )
7028 command prefix(es)
7029 .Sx "Shell-style argument quoting"
7030 can be used to quote arguments as necessary.
7031 \*(ID Otherwise quotation marks may be placed around any part of the
7032 assignment statement to quote blanks or tabs.
7035 When operating in global scope any
7036 .Ql name
7037 that is known to map to an environment variable will automatically cause
7038 updates in the program environment (unsetting a variable in the
7039 environment requires corresponding system support) \(em use the command
7040 .Ic environ
7041 for further environmental control.
7042 If the command modifier
7043 .Cm local
7044 has been used to alter the command to work in block-scope all variables
7045 have values (may they be empty), and creation of names which shadow
7046 .Sx "INTERNAL VARIABLES"
7047 is actively prevented (\*(ID shadowing of linked
7048 .Sx ENVIRONMENT
7049 variables and free-form versions of variable chains is not yet detected).
7050 Also see
7051 .Ic varshow
7052 and the sections
7053 .Sx "INTERNAL VARIABLES"
7055 .Sx ENVIRONMENT .
7057 .Bd -literal -offset indent
7058 ? wysh set indentprefix=' -> '
7059 ? wysh set atab=$'\t' aspace=' ' zero=0
7064 .It Ic shcodec
7065 Apply shell quoting rules to the given raw-data arguments.
7066 Supports
7067 .Cm vput
7068 (see
7069 .Sx "Command modifiers" ) .
7070 The first argument specifies the operation:
7071 .Ar [+]e[ncode]
7073 .Ar d[ecode]
7074 cause shell quoting to be applied to the remains of the line, and
7075 expanded away thereof, respectively.
7076 If the former is prefixed with a plus-sign, the quoted result will not
7077 be roundtrip enabled, and thus can be decoded only in the very same
7078 environment that was used to perform the encode; also see
7079 .Cd mle-quote-rndtrip .
7080 If the coding operation fails the error number
7081 .Va \&!
7082 is set to
7083 .Va ^ERR Ns -CANCELED ,
7084 and the unmodified input is used as the result; the error number may
7085 change again due to output or result storage errors.
7088 .It Ic shell
7089 \*(NQ (sh) Invokes an interactive version of the shell,
7090 and returns its exit status.
7094 .It Ic shortcut , unshortcut
7095 \*(NQ Manage the file- or pathname shortcuts as documented for
7096 .Ic folder .
7097 The latter command deletes all shortcuts given as arguments,
7098 or all at once when given the asterisk
7099 .Ql * .
7100 The former shows the list of all currently defined shortcuts if used
7101 without arguments, the target of the given with a single argument.
7102 Otherwise arguments are treated as pairs of shortcuts and their desired
7103 expansion, creating new or updating already existing ones.
7106 .It Ic shift
7107 \*(NQ Shift the positional parameter stack (starting at
7108 .Va 1 )
7109 by the given number (which must be a positive decimal),
7110 or 1 if no argument has been given.
7111 It is an error if the value exceeds the number of positional parameters.
7112 If the given number is 0, no action is performed, successfully.
7113 The stack as such can be managed via
7114 .Ic vpospar .
7115 Note this command will fail in
7116 .Ic account
7117 and hook macros unless the positional parameter stack has been
7118 explicitly created in the current context via
7119 .Ic vpospar .
7122 .It Ic show
7123 Like
7124 .Ic type ,
7125 but performs neither MIME decoding nor decryption, so that the raw
7126 message text is shown.
7129 .It Ic size
7130 (si) Shows the size in characters of each message of the given
7131 message list.
7134 .It Ic sleep
7135 \*(NQ Sleep for the specified number of seconds (and optionally
7136 milliseconds), by default interruptible.
7137 If a third argument is given the sleep will be uninterruptible,
7138 otherwise the error number
7139 .Va \&!
7140 will be set to
7141 .Va ^ERR Ns -INTR
7142 if the sleep has been interrupted.
7143 The command will fail and the error number will be
7144 .Va ^ERR Ns -OVERFLOW
7145 if the given duration(s) overflow the time datatype, and
7146 .Va ^ERR Ns -INVAL
7147 if the given durations are no valid integers.
7152 .It Ic sort , unsort
7153 The latter command disables sorted or threaded mode, returns to normal
7154 message order and, if the
7155 .Va header
7156 variable is set,
7157 displays a header summary.
7158 The former command shows the current sorting criterion when used without
7159 an argument, but creates a sorted representation of the current folder
7160 otherwise, and changes the
7161 .Ic next
7162 command and the addressing modes such that they refer to messages in
7163 the sorted order.
7164 Message numbers are the same as in regular mode.
7165 If the
7166 .Va header
7167 variable is set,
7168 a header summary in the new order is also displayed.
7169 Automatic folder sorting can be enabled by setting the
7170 .Va autosort
7171 variable, as in
7172 .Ql set autosort=thread .
7173 Possible sorting criterions are:
7176 .Bl -tag -compact -width "subject"
7177 .It Ar date
7178 Sort the messages by their
7179 .Ql Date:
7180 field, that is by the time they were sent.
7181 .It Ar from
7182 Sort messages by the value of their
7183 .Ql From:
7184 field, that is by the address of the sender.
7185 If the
7186 .Va showname
7187 variable is set, the sender's real name (if any) is used.
7188 .It Ar size
7189 Sort the messages by their size.
7190 .It spam
7191 \*(OP Sort the message by their spam score, as has been classified by
7192 .Ic spamrate .
7193 .It Ar status
7194 Sort the messages by their message status.
7195 .It Ar subject
7196 Sort the messages by their subject.
7197 .It Ar thread
7198 Create a threaded display.
7199 .It Ar to
7200 Sort messages by the value of their
7201 .Ql To:
7202 field, that is by the address of the recipient.
7203 If the
7204 .Va showname
7205 variable is set, the recipient's real name (if any) is used.
7210 .It Ic source
7211 \*(NQ (so) The source command reads commands from the given file.
7212 .Sx "Filename transformations"
7213 will be applied.
7214 If the given expanded argument ends with a vertical bar
7215 .Ql |
7216 then the argument will instead be interpreted as a shell command and
7217 \*(UA will read the output generated by it.
7218 Dependent on the settings of
7219 .Va posix
7221 .Va errexit ,
7222 and also dependent on whether the command modifier
7223 .Cm ignerr
7224 had been used, encountering errors will stop sourcing of the given input.
7225 \*(ID Note that
7226 .Ic \&\&source
7227 cannot be used from within macros that execute as
7228 .Va folder-hook Ns s
7230 .Ic account Ns s ,
7231 i.e., it can only be called from macros that were
7232 .Ic call Ns ed .
7235 .It Ic source_if
7236 \*(NQ The difference to
7237 .Ic source
7238 (beside not supporting pipe syntax aka shell command input) is that
7239 this command will not generate an error nor warn if the given file
7240 argument cannot be opened successfully.
7243 .It Ic spamclear
7244 \*(OP Takes a list of messages and clears their
7245 .Ql is-spam
7246 flag.
7249 .It Ic spamforget
7250 \*(OP Takes a list of messages and causes the
7251 .Va spam-interface
7252 to forget it has ever used them to train its Bayesian filter.
7253 Unless otherwise noted the
7254 .Ql is-spam
7255 flag of the message is inspected to chose whether a message shall be
7256 forgotten to be
7257 .Dq ham
7259 .Dq spam .
7262 .It Ic spamham
7263 \*(OP Takes a list of messages and informs the Bayesian filter of the
7264 .Va spam-interface
7265 that they are
7266 .Dq ham .
7267 This also clears the
7268 .Ql is-spam
7269 flag of the messages in question.
7272 .It Ic spamrate
7273 \*(OP Takes a list of messages and rates them using the configured
7274 .Va spam-interface ,
7275 without modifying the messages, but setting their
7276 .Ql is-spam
7277 flag as appropriate; because the spam rating headers are lost the rate
7278 will be forgotten once the mailbox is left.
7279 Refer to the manual section
7280 .Sx "Handling spam"
7281 for the complete picture of spam handling in \*(UA.
7284 .It Ic spamset
7285 \*(OP Takes a list of messages and sets their
7286 .Ql is-spam
7287 flag.
7290 .It Ic spamspam
7291 \*(OP Takes a list of messages and informs the Bayesian filter of the
7292 .Va spam-interface
7293 that they are
7294 .Dq spam .
7295 This also sets the
7296 .Ql is-spam
7297 flag of the messages in question.
7299 .It Ic thread
7300 \*(OB The same as
7301 .Ql sort thread
7302 (consider using a
7303 .Ql commandalias
7304 as necessary).
7308 .It Ic tls
7309 \*(NQ TLS information and management command multiplexer to aid in
7310 .Sx "Encrypted network communication" ,
7311 mostly available only if the term
7312 .Ql +sockets
7313 is included in
7314 .Va features .
7315 Commands support
7316 .Cm vput
7317 if so documented (see
7318 .Sx "Command modifiers" ) .
7319 The result that is shown in case of errors is always the empty string,
7320 errors can be identified via the error number
7321 .Va \&! .
7322 For example, string length overflows are caught and set
7323 .Va \&!
7325 .Va ^ERR Ns -OVERFLOW .
7326 The TLS configuration is honoured, especially
7327 .Va tls-verify .
7329 .Bd -literal -offset indent
7330 ? vput tls result fingerprint pop3s://ex.am.ple
7331 ? echo $?/$!/$^ERRNAME: $result
7334 .Bl -hang -width ".It Cm random"
7335 .It Cm certchain
7336 Show the complete verified peer certificate chain.
7337 Includes informational fields in conjunction with
7338 .Va verbose .
7339 .It Cm certificate
7340 Show only the peer certificate, without any signers.
7341 Includes informational fields in conjunction with
7342 .Va verbose .
7343 .It Cm fingerprint
7344 Show the
7345 .Va tls-fingerprint-digest Ns
7346 ed fingerprint of the certificate of the given HOST
7347 .Pf ( Ql server:port ,
7348 where the port defaults to the HTTPS port, 443).
7349 .Va tls-fingerprint
7350 is actively ignored for the runtime of this command.
7355 .It Ic Top
7356 Like
7357 .Ic top
7358 but always uses the
7359 .Ic headerpick
7360 .Ql type
7361 slot for white- and blacklisting header fields.
7364 .It Ic top
7365 (to) Takes a message list and types out the first
7366 .Va toplines
7367 lines of each message on the user's terminal.
7368 Unless a special selection has been established for the
7369 .Ql top
7370 slot of the
7371 .Ic headerpick
7372 command, the only header fields that are displayed are
7373 .Ql From: ,
7374 .Ql To: ,
7375 .Ql Cc: ,
7377 .Ql Subject: .
7378 .Ic Top
7379 will always use the
7380 .Ql type
7381 .Ic headerpick
7382 selection instead.
7383 It is possible to apply compression to what is displayed by setting
7384 .Va topsqueeze .
7385 Messages are decrypted and converted to the terminal character set
7386 if necessary.
7389 .It Ic touch
7390 (tou) Takes a message list and marks the messages for saving in the
7391 .Mx -sx
7392 .Sx "secondary mailbox"
7393 .Ev MBOX .
7394 \*(UA deviates from the POSIX standard with this command,
7395 as a following
7396 .Ic next
7397 command will display the following message instead of the current one.
7400 .It Ic Type
7401 (T) Like
7402 .Ic type
7403 but also displays header fields which would not pass the
7404 .Ic headerpick
7405 selection, and all visualizable parts of MIME
7406 .Ql multipart/alternative
7407 messages.
7410 .It Ic type
7411 (t) Takes a message list and types out each message on the user's terminal.
7412 The display of message headers is selectable via
7413 .Ic headerpick .
7414 For MIME multipart messages, all parts with a content type of
7415 .Ql text ,
7416 all parts which have a registered MIME type handler (see
7417 .Sx "HTML mail and MIME attachments" )
7418 which produces plain text output, and all
7419 .Ql message
7420 parts are shown, others are hidden except for their headers.
7421 Messages are decrypted and converted to the terminal character set
7422 if necessary.
7423 The command
7424 .Ic mimeview
7425 can be used to display parts which are not displayable as plain text.
7427 .It Ic unaccount
7429 .Ic account .
7431 .It Ic unalias
7432 (una) See
7433 .Ic alias .
7435 .It Ic unanswered
7437 .Ic answered .
7439 .It Ic unbind
7441 .Ic bind .
7443 .It Ic uncollapse
7445 .Ic collapse .
7447 .It Ic uncolour
7449 .Ic colour .
7451 .It Ic undefine
7453 .Ic define .
7455 .It Ic undelete
7457 .Ic delete .
7459 .It Ic undraft
7461 .Ic draft .
7463 .It Ic unflag
7465 .Ic flag .
7467 .It Ic unfwdignore
7468 \*(OB Superseded by the multiplexer
7469 .Ic headerpick .
7471 .It Ic unfwdretain
7472 \*(OB Superseded by the multiplexer
7473 .Ic headerpick .
7476 .It Ic unignore
7477 Superseded by the multiplexer
7478 .Ic headerpick .
7480 .It Ic unmimetype
7482 .Ic mimetype .
7484 .It Ic unmlist
7486 .Ic mlist .
7488 .It Ic unmlsubscribe
7490 .Ic mlsubscribe .
7493 .It Ic Unread
7494 Same as
7495 .Ic unread .
7498 .It Ic unread
7499 Takes a message list and marks each message as not having been read.
7502 .It Ic unretain
7503 Superseded by the multiplexer
7504 .Ic headerpick .
7506 .It Ic unsaveignore
7507 \*(OB Superseded by the multiplexer
7508 .Ic headerpick .
7510 .It Ic unsaveretain
7511 \*(OB Superseded by the multiplexer
7512 .Ic headerpick .
7514 .It Ic unset
7515 \*(NQ (uns) See
7516 .Ic set .
7518 .It Ic unshortcut
7520 .Ic shortcut .
7522 .It Ic unsort
7524 .Ic short .
7526 .It Ic unthread
7527 \*(OB
7528 Same as
7529 .Ic unsort .
7532 .It Ic urlcodec
7533 Perform URL percent codec operations on the raw-data argument, rather
7534 according to RFC 3986.
7535 The first argument specifies the operation:
7536 .Ar e[ncode]
7538 .Ar d[ecode]
7539 perform plain URL percent en- and decoding, respectively.
7540 .Ar p[ath]enc[ode]
7542 .Ar p[ath]dec[ode]
7543 perform a slightly modified operation which should be better for
7544 pathnames: it does not allow a tilde
7545 .Ql ~ ,
7546 and will neither accept hyphen-minus
7547 .Ql -
7548 nor dot
7549 .Ql .
7550 as an initial character.
7551 The remains of the line form the URL data which is to be converted.
7552 This is a character set agnostic operation,
7553 and it may thus decode bytes which are invalid in the current
7554 .Va ttycharset .
7556 Supports
7557 .Cm vput
7558 (see
7559 .Sx "Command modifiers" ) ,
7560 and manages the error number
7561 .Va \&! .
7562 If the coding operation fails the error number
7563 .Va \&!
7564 is set to
7565 .Va ^ERR Ns -CANCELED ,
7566 and the unmodified input is used as the result; the error number may
7567 change again due to output or result storage errors.
7568 \*(ID This command does not know about URLs beside what is documented.
7569 .Pf ( Ic vexpr
7570 offers a
7571 .Cm makeprint
7572 subcommand, shall the URL be displayed.)
7575 .It Ic varshow
7576 \*(NQ This command produces the same output as the listing mode of
7577 .Ic set ,
7578 including
7579 .Va verbose Ns
7580 ity adjustments, but only for the given variables.
7583 .It Ic verify
7584 \*(OP Takes a message list and verifies each message.
7585 If a message is not a S/MIME signed message,
7586 verification will fail for it.
7587 The verification process checks if the message was signed using a valid
7588 certificate,
7589 if the message sender's email address matches one of those contained
7590 within the certificate,
7591 and if the message content has been altered.
7594 .It Ic version
7595 Shows the
7596 .Va version
7598 .Va features
7599 of \*(UA, optionally in a more
7600 .Va verbose
7601 form which also includes the build and running system environment.
7602 This command supports
7603 .Cm vput
7604 (see
7605 .Sx "Command modifiers" ) .
7609 .It Ic vexpr
7610 \*(NQ A multiplexer command which offers signed 64-bit numeric
7611 calculations, as well as other, mostly string-based operations.
7612 C-style byte string operations are available via
7613 .Ic csop .
7614 The first argument defines the number, type, and meaning of the
7615 remaining arguments.
7616 An empty number argument is treated as 0.
7617 Supports
7618 .Cm vput
7619 (see
7620 .Sx "Command modifiers" ) .
7621 The result shown in case of errors is
7622 .Ql -1
7623 for usage errors and numeric operations, the empty string otherwise;
7624 .Dq soft
7625 errors, like when a search operation failed, will also set the
7626 .Va \&!
7627 error number to
7628 .Va ^ERR Ns -NODATA .
7629 Except when otherwise noted numeric arguments are parsed as signed 64-bit
7630 numbers, and errors will be reported in the error number
7631 .Va \&!
7632 as the numeric error
7633 .Va ^ERR Ns -RANGE .
7636 Numeric operations work on one or two signed 64-bit integers.
7637 Numbers prefixed with
7638 .Ql 0x
7640 .Ql 0X
7641 are interpreted as hexadecimal (base 16) numbers, whereas
7642 .Ql 0
7643 indicates octal (base 8), and
7644 .Ql 0b
7645 as well as
7646 .Ql 0B
7647 denote binary (base 2) numbers.
7648 It is possible to use any base in between 2 and 36, inclusive, with the
7649 .Ql BASE#number
7650 notation, where the base is given as an unsigned decimal number, so
7651 .Ql 16#AFFE
7652 is a different way of specifying a hexadecimal number.
7653 Unsigned interpretation of a number can be enforced by prefixing an
7654 .Ql u
7655 (case-insensitively), as in
7656 .Ql u-110 ;
7657 this is not necessary for power-of-two bases (2, 4, 8, 16 and 32),
7658 which will be interpreted as unsigned by default, but it still makes
7659 a difference regarding overflow detection and overflow constant.
7660 It is possible to enforce signed interpretation by (instead) prefixing a
7661 .Ql s
7662 (case-insensitively).
7663 The number sign notation uses a permissive parse mode and as such
7664 supports complicated conditions out of the box:
7665 .Bd -literal -offset indent
7666 ? wysh set ifs=:;read i;unset ifs;echo $i;vexpr pb 2 10#$i
7667    -009
7668 <   -009>
7669 0b1001
7673 One integer is expected by assignment (equals sign
7674 .Ql = ) ,
7675 which does nothing but parsing the argument, thus detecting validity and
7676 possible overflow conditions, unary not (tilde
7677 .Ql ~ ) ,
7678 which creates the bitwise complement, and unary plus and minus.
7679 Two integers are used by addition (plus sign
7680 .Ql + ) ,
7681 subtraction (hyphen-minus
7682 .Ql - ) ,
7683 multiplication (asterisk
7684 .Ql * ) ,
7685 division (solidus
7686 .Ql / )
7687 and modulo (percent sign
7688 .Ql % ) ,
7689 as well as for the bitwise operators logical or (vertical bar
7690 .Ql | ,
7691 to be quoted) ,
7692 bitwise and (ampersand
7693 .Ql \&& ,
7694 to be quoted) ,
7695 bitwise xor (circumflex
7696 .Ql ^ ) ,
7697 the bitwise signed left- and right shifts
7698 .Pf ( Ql << ,
7699 .Ql >> ) ,
7700 as well as for the unsigned right shift
7701 .Ql >>> .
7704 Another numeric operation is
7705 .Cm pbase ,
7706 which takes a number base in between 2 and 36, inclusive, and will act
7707 on the second number given just the same as what equals sign
7708 .Ql =
7709 does, but the number result will be formatted in the base given, as
7710 a signed 64-bit number unless unsigned interpretation of the input
7711 number had been forced (with an u prefix).
7714 Numeric operations support a saturated mode via the question mark
7715 .Ql \&?
7716 modifier suffix; the keyword
7717 .Ql saturated
7718 is optional,
7719 .Ql +? ,
7720 .Ql +?satu ,
7722 .Ql +?saturated
7723 are therefore identical.
7724 In saturated mode overflow errors and division and modulo by zero are no
7725 longer reported via the exit status, but the result will linger at the
7726 minimum or maximum possible value, instead of overflowing (or trapping).
7727 This is true also for the argument parse step.
7728 For the bitwise shifts, the saturated maximum is 63.
7729 Any caught overflow will be reported via the error number
7730 .Va \&!
7732 .Va ^ERR Ns -OVERFLOW .
7734 .Bd -literal -offset indent
7735 ? vput vexpr res -? +1 -9223372036854775808
7736 ? echo $?/$!/$^ERRNAME:$res
7737 0/75/OVERFLOW:-9223372036854775808
7741 Character set agnostic string functions have no notion of locale
7742 settings and character sets.
7744 .Bl -hang -width ".It Cm random"
7745 .It Cm date-utc
7746 Outputs the current date and time in UTC (Coordinated Universal Time)
7747 with values named such that
7748 .Ql vput vexpr x date-utc; eval wysh set $x
7749 creates accessible variables.
7750 .It Cm date-stamp-utc
7751 Outputs a RFC 3339 internet date/time format of UTC.
7752 .It Cm epoch
7753 The seconds and nanoseconds since the Unix epoch (1970-01-01T00:00:00)
7754 named
7755 .Ql epoch_sec
7757 .Ql epoch_nsec
7758 such that
7759 .Ql vput vexpr x epoch; eval wysh set $x
7760 creates accessible variables.
7761 .It Cm file-expand
7762 Performs the usual
7763 .Sx "Filename transformations"
7764 on its argument.
7765 .It Cm file-stat , file-lstat
7766 Perform the usual
7767 .Sx "Filename transformations"
7768 on the argument, then call
7769 .Xr stat 2
7771 .Xr lstat 2 ,
7772 respectively, and output values such that
7773 .Ql vput vexpr x file-stat FILE; eval wysh set $x
7774 creates accessible variables.
7775 The variable
7776 .Ql st_type
7777 uses solidus
7778 .Ql /
7779 to denote directories, commercial at
7780 .Ql @
7781 for links, number sign
7782 .Ql #
7783 for block devices, percent sign
7784 .Ql %
7785 for for character devices, vertical bar
7786 .Ql |
7787 for FIFOs, equal sign
7788 .Ql =
7789 for sockets, and the period
7790 .Ql \&.
7791 for the rest.
7792 .It Cm random
7793 Generates a random string of the given length, or of
7794 .Dv \&\&PATH_MAX
7795 bytes (a constant from
7796 .Pa /usr/include )
7797 if the value 0 is given; the random string will be base64url encoded
7798 according to RFC 4648, and thus be usable as a (portable) filename.
7802 String operations work, sufficient support provided, according to the
7803 active user's locale encoding and character set (see
7804 .Sx "Character sets" ) .
7805 Where the question mark
7806 .Ql \&?
7807 modifier suffix is supported, a case-insensitive operation mode is
7808 available; the keyword
7809 .Ql case
7810 is optional,
7811 .Ql regex?
7813 .Ql regex?case
7814 are therefore identical.
7816 .Bl -hang -width ".It Cm regex"
7817 .It Cm makeprint
7818 (One-way) Converts the argument to something safely printable on the
7819 terminal.
7821 .It Cm regex
7822 \*(OP A string operation that will try to match the first argument with
7823 the regular expression given as the second argument.
7824 .Ql \&?
7825 modifier suffix is supported.
7826 If the optional third argument has been given then instead of showing
7827 the match offset a replacement operation is performed: the third
7828 argument is treated as if specified within dollar-single-quote (see
7829 .Sx "Shell-style argument quoting" ) ,
7830 and any occurrence of a positional parameter, for example
7831 .Va \&0 , 1
7832 etc. is replaced with the according match group of the regular expression:
7833 .Bd -literal -offset indent
7834 ? vput vexpr res regex bananarama \e
7835     (.*)NanA(.*) '\e${1}au\e$2'
7836 ? echo $?/$!/$^ERRNAME:$res:
7837 1/61/NODATA::
7838 ? vput vexpr res regex?case bananarama \e
7839     (.*)NanA(.*) '\e${1}uauf\e$2'
7840 ? echo $?/$!/$^ERRNAME:$res:
7841 0/0/NONE:bauauframa:
7847 .It Ic vpospar
7848 \*(NQ Manage the positional parameter stack (see
7849 .Va 1 , # , * , @
7850 as well as
7851 .Ic shift ) .
7852 If the first argument is
7853 .Ql clear ,
7854 then the positional parameter stack of the current context, or the
7855 global one, if there is none, is cleared.
7856 If it is
7857 .Ql set ,
7858 then the remaining arguments will be used to (re)create the stack,
7859 if the parameter stack size limit is excessed an
7860 .Va ^ERR Ns -OVERFLOW
7861 error will occur.
7864 If the first argument is
7865 .Ql quote ,
7866 a round-trip capable representation of the stack contents is created,
7867 with each quoted parameter separated from each other with the first
7868 character of
7869 .Va ifs ,
7870 and followed by the first character of
7871 .Va if-ws ,
7872 if that is not empty and not identical to the first.
7873 If that results in no separation at all a
7874 .Cm space
7875 character is used.
7876 This mode supports
7877 .Cm vput
7878 (see
7879 .Sx "Command modifiers" ) .
7880 I.e., the subcommands
7881 .Ql set
7883 .Ql quote
7884 can be used (in conjunction with
7885 .Ic eval )
7886 to (re)create an argument stack from and to a single variable losslessly.
7888 .Bd -literal -offset indent
7889 ? vpospar set hey, "'you    ", world!
7890 ? echo $#: <${1}><${2}><${3}>
7891 ? vput vpospar x quote
7892 ? vpospar clear
7893 ? echo $#: <${1}><${2}><${3}>
7894 ? eval vpospar set ${x}
7895 ? echo $#: <${1}><${2}><${3}>
7900 .It Ic visual
7901 (v) Takes a message list and invokes the
7902 .Ev VISUAL
7903 display editor on each message.
7904 Modified contents are discarded unless the
7905 .Va writebackedited
7906 variable is set, and are not used unless the mailbox can be written to
7907 and the editor returns a successful exit status.
7908 .Ic edit
7909 can be used instead for a less display oriented editor.
7912 .It Ic write
7913 (w) For conventional messages the body without all headers is written.
7914 The original message is never marked for deletion in the originating
7915 mail folder.
7916 The output is decrypted and converted to its native format as necessary.
7917 If the output file exists, the text is appended.
7918 If a message is in MIME multipart format its first part is written to
7919 the specified file as for conventional messages, handling of the remains
7920 depends on the execution mode.
7921 No special handling of compressed files is performed.
7923 In interactive mode the user is consecutively asked for the filenames of
7924 the processed parts.
7925 For convenience saving of each part may be skipped by giving an empty
7926 value, the same result as writing it to
7927 .Pa /dev/null .
7928 Shell piping the part content by specifying a leading vertical bar
7929 .Ql |
7930 character for the filename is supported.
7931 Other user input undergoes the usual
7932 .Sx "Filename transformations" ,
7933 including shell pathname wildcard pattern expansions
7934 .Pf ( Xr glob 7 )
7935 and shell variable expansion for the message as such, not the individual
7936 parts, and contents of the destination file are overwritten if the file
7937 previously existed.
7938 Character set conversion to
7939 .Va ttycharset
7940 is performed when saving text data.
7942 \*(ID In non-interactive mode any part which does not specify a filename
7943 is ignored, and suspicious parts of filenames of the remaining parts are
7944 URL percent encoded (as via
7945 .Ic urlcodec )
7946 to prevent injection of malicious character sequences, resulting in
7947 a filename that will be written into the current directory.
7948 Existing files will not be overwritten, instead the part number or
7949 a dot are appended after a number sign
7950 .Ql #
7951 to the name until file creation succeeds (or fails due to other
7952 reasons).
7955 .It Ic xcall
7956 \*(NQ The sole difference to
7957 .Ic call
7958 is that the new macro is executed in place of the current one, which
7959 will not regain control: all resources of the current macro will be
7960 released first.
7961 This implies that any setting covered by
7962 .Ic localopts
7963 will be forgotten and covered variables will become cleaned up.
7964 If this command is not used from within a
7965 .Ic call Ns
7966 ed macro it will silently be (a more expensive variant of)
7967 .Ic call .
7970 .It Ic xit
7971 (x) A synonym for
7972 .Ic exit .
7975 .It Ic z
7976 \*(NQ \*(UA presents message headers in
7977 .Va screen Ns
7978 fuls as described under the
7979 .Ic headers
7980 command.
7981 Without arguments this command scrolls to the next window of messages,
7982 likewise if the argument is
7983 .Ql + .
7984 An argument of
7985 .Ql -
7986 scrolls to the last,
7987 .Ql ^
7988 scrolls to the first, and
7989 .Ql $
7990 to the last
7991 .Va \&\&screen
7992 of messages.
7993 A number argument prefixed by
7994 .Ql +
7996 .Ql \-
7997 indicates that the window is calculated in relation to the current
7998 position, and a number without a prefix specifies an absolute position.
8001 .It Ic Z
8002 \*(NQ Similar to
8003 .Ic z ,
8004 but scrolls to the next or previous window that contains at least one
8005 .Ql new
8007 .Ic flag Ns
8008 ged message.
8010 .\" }}}
8012 .\" }}}
8015 .\" .Sh COMMAND ESCAPES {{{
8016 .Sh "COMMAND ESCAPES"
8018 When composing messages command escapes are available in interactive
8019 mode, when explicitly requested via
8020 .Fl ~ ,
8021 as well as in batch mode
8022 .Pf ( Fl # ) .
8023 They perform special functions, like editing headers of the message
8024 being composed, calling normal
8025 .Sx COMMANDS ,
8026 yielding a shell, etc.
8027 Command escapes are only recognized at the beginning of lines, and
8028 consist of an escape followed by a command character.
8029 The default
8030 .Va escape
8031 character is the tilde
8032 .Ql ~ .
8035 Unless otherwise documented command escapes ensure proper updates of
8036 the error number
8037 .Va \&!
8038 and the exit status
8039 .Va \&? .
8040 The variable
8041 .Va errexit
8042 controls whether a failed operation errors out message compose mode and
8043 causes program exit.
8044 Escapes may be prefixed by none to multiple single character command
8045 modifiers, interspersed whitespace is ignored:
8047 .Bl -bullet
8049 An effect equivalent to the command modifier
8050 .Cm ignerr
8051 can be achieved with hyphen-minus
8052 .Ql - ,
8053 overriding
8054 .Va errexit .
8056 The modifier dollar
8057 .Ql $
8058 .Ic eval Ns
8059 uates the remains of the line; also see
8060 .Sx "Shell-style argument quoting" .
8061 \*(ID For now the entire input line is evaluated as a whole; to avoid
8062 that control operators like semicolon
8063 .Cm \&;
8064 are interpreted unintentionally, they must be quoted.
8068 Addition of the command line to the \*(OPal history can be prevented by
8069 placing whitespace directly after
8070 .Va escape .
8071 The \*(OPal key
8072 .Ic bind Ns
8073 ings support a compose mode specific context.
8074 The following command escapes are supported:
8077 .Bl -tag -width ".It Ic BaNg"
8079 .It Ic ~~ Ar string
8080 Insert the string of text in the message prefaced by a single
8081 .Ql ~ .
8082 (If the escape character has been changed,
8083 that character must be doubled instead.)
8086 .It Ic ~! Ar command
8087 Execute the indicated shell
8088 .Ar command
8089 which follows, replacing unescaped exclamation marks with the previously
8090 executed command if the internal variable
8091 .Va bang
8092 is set, then return to the message.
8095 .It Ic ~.
8096 End compose mode and send the message.
8097 The hooks
8098 .Va on-compose-splice-shell
8100 .Va on-compose-splice ,
8101 in order, will be called when set, after which, in interactive mode
8102 .Va askatend
8103 (leading to
8104 .Va askcc , askbcc )
8106 .Va askattach
8107 will be checked as well as
8108 .Va asksend ,
8109 after which a set
8110 .Va on-compose-leave
8111 hook will be called,
8112 .Va autocc
8114 .Va autobcc
8115 will be joined in if set,
8116 finally a given
8117 .Va message-inject-tail
8118 will be incorporated, after which the compose mode is left.
8121 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
8122 Can be used to execute
8123 .Sx COMMANDS
8124 (which are allowed in compose mode).
8127 .It Ic ~< Ar filename
8128 Identical to
8129 .Ic ~r .
8132 .It Ic ~<! Ar command
8133 .Ar command
8134 is executed using the shell.
8135 Its standard output is inserted into the message.
8138 .It Ic ~?
8139 \*(OP Write a summary of command escapes.
8142 .It Ic ~@ Op Ar filename...
8143 Append or edit the list of attachments.
8144 Does not manage the error number
8145 .Va \&!
8146 and the exit status
8147 .Va \&?
8148 (please use
8149 .Ic ~^
8150 if error handling is necessary).
8151 The append mode expects a list of
8152 .Ar filename
8153 arguments as shell tokens (see
8154 .Sx "Shell-style argument quoting" ;
8155 token-separating commas are ignored, too), to be
8156 interpreted as documented for the command line option
8157 .Fl a ,
8158 with the message number exception as below.
8160 Without
8161 .Ar filename
8162 arguments the attachment list is edited, entry by entry;
8163 if a filename is left empty, that attachment is deleted from the list;
8164 once the end of the list is reached either new attachments may be
8165 entered or the session can be quit by committing an empty
8166 .Dq new
8167 attachment.
8168 In non-interactive mode or in batch mode
8169 .Pf ( Fl # )
8170 the list of attachments is effectively not edited but instead recreated;
8171 again, an empty input ends list creation.
8173 For all modes, if a given filename solely consists of the number sign
8174 .Ql #
8175 followed by either a valid message number of the currently active
8176 mailbox, or by a period
8177 .Ql \&. ,
8178 referring to the current message of the active mailbox, the so-called
8179 .Dq dot ,
8180 then the given message is attached as a
8181 .Ql message/rfc822
8182 MIME message part.
8183 The number sign must be quoted to avoid misinterpretation as a shell
8184 comment character.
8187 .It Ic ~| Ar command
8188 Pipe the message text through the specified filter command.
8189 If the command gives no output or terminates abnormally,
8190 retain the original text of the message.
8191 The command
8192 .Xr fmt 1
8193 is often used as a rejustifying filter.
8195 If the first character of the command is a vertical bar, then the entire
8196 message including header fields is subject to the filter command, so
8197 .Ql ~|| echo Fcc: /tmp/test; cat
8198 will prepend a file-carbon-copy message header.
8199 Also see
8200 .Ic ~e , ~v .
8204 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
8205 Low-level compose mode command which shares semantics with
8206 .Ic digmsg ,
8207 and therefore evaluates its command line as documented in
8208 .Sx "Shell-style argument quoting" .
8209 Does not manage the error number
8210 .Va \&!
8211 and the exit status
8212 .Va \&? :
8213 errors are handled via the protocol, and hard errors like I/O failures
8214 cannot be handled.
8217 The protocol consists of command lines followed by (a) response line(s).
8218 The first field of the response line represents a status code
8219 which specifies whether a command was successful or not, whether result
8220 data is to be expected, and if, the format of the result data.
8221 Response data will be shell quoted as necessary for consumption by
8222 .Ic readsh ,
8224 .Ic eval
8226 .Ic vpospar ,
8227 to name a few.
8228 Error status code lines may optionally contain additional context:
8232 .Bl -tag -compact -width ".It Ql 210"
8233 .It Ql 210
8234 Status ok; the remains of the line are the result.
8236 .It Ql 211
8237 Status ok; the rest of the line is optionally used for more status.
8238 What follows are lines of result addresses, terminated by an empty line.
8239 All the input, including the empty line, must be consumed before further
8240 commands can be issued.
8241 Address lines consist of two token, first the plain network address, e.g.,
8242 .Ql bob@exam.ple ,
8243 followed by the (quoted) full address as known:
8244 .Ql '(Lovely) Bob <bob@exam.ple>' .
8245 Non-network addresses use the first field to indicate the type (hyphen-minus
8246 .Ql -
8247 for files, vertical bar
8248 .Ql |
8249 for pipes, and number sign
8250 .Ql #
8251 for names which will undergo
8252 .Ic alias
8253 processing) instead, the actual value will be in the second field.
8255 .It Ql 212
8256 Status ok; the rest of the line is optionally used for more status.
8257 What follows are lines of furtherly unspecified (quoted) string content,
8258 terminated by an empty line.
8259 All the input, including the empty line, must be consumed before further
8260 commands can be issued.
8262 .It Ql 500
8263 Syntax error; invalid command.
8265 .It Ql 501
8266 Syntax error in parameters or arguments.
8268 .It Ql 505
8269 Error: an argument fails verification.
8270 For example an invalid address has been specified (also see
8271 .Va expandaddr ) ,
8272 or an attempt was made to modify anything in \*(UA's own namespace,
8273 or a modifying subcommand has been used on a read-only message.
8275 .It Ql 506
8276 Error: an otherwise valid argument is rendered invalid due to context.
8277 For example, a second address is added to a header which may consist of
8278 a single address only.
8283 If a command indicates failure then the message will have remained
8284 unmodified.
8285 Most commands can fail with
8286 .Ql 500
8287 if required arguments are missing, or excessive arguments have been
8288 given (false command usage).
8289 (\*(ID The latter does not yet occur regulary, because as stated in
8290 .Sx "Shell-style argument quoting"
8291 our argument parser is not yet smart enough to work on subcommand base;
8292 for example one might get excess argument error for a three argument
8293 subcommand that receives four arguments, but not for a four argument
8294 subcommand which receives six arguments: here excess will be joined.)
8295 The following (case-insensitive) commands are supported:
8298 .Bl -hang -width ".It Cm version"
8299 .It Cm attachment
8300 This command allows listing, removal and addition of message attachments.
8301 The second argument specifies the subcommand to apply, one of:
8303 .Bl -hang -width ".It Cm remove"
8304 .It Cm attribute
8305 This uses the same search mechanism as described for
8306 .Cm remove
8307 and prints any known attributes of the first found attachment via
8308 .Ql 212
8309 upon success or
8310 .Ql 501
8311 if no such attachment can be found.
8312 The attributes are written as lines with a keyword and a value token.
8314 .It Cm attribute-at
8315 This uses the same search mechanism as described for
8316 .Cm remove-at
8317 and is otherwise identical to
8318 .Cm attribute .
8320 .It Cm attribute-set
8321 This uses the same search mechanism as described for
8322 .Cm remove ,
8323 and will set the attribute given as the fourth to the value given as
8324 the fifth token argument.
8325 If the value is an empty token, then the given attribute is removed,
8326 or reset to a default value if existence of the attribute is crucial.
8328 It returns via
8329 .Ql 210
8330 upon success, with the index of the found attachment following,
8331 .Ql 505
8332 for message attachments or if the given keyword is invalid, and
8333 .Ql 501
8334 if no such attachment can be found.
8335 The following keywords may be used (case-insensitively):
8337 .Bl -hang -compact -width ".It Ql filename"
8338 .It Ql filename
8339 Sets the filename of the MIME part, i.e., the name that is used for
8340 display and when (suggesting a name for) saving (purposes).
8341 .It Ql content-description
8342 Associate some descriptive information to the attachment's content, used
8343 in favour of the plain filename by some MUAs.
8344 .It Ql content-id
8345 May be used for uniquely identifying MIME entities in several contexts;
8346 this expects a special reference address format as defined in RFC 2045
8347 and generates a
8348 .Ql 505
8349 upon address content verification failure.
8350 .It Ql content-type
8351 Defines the media type/subtype of the part, which is managed
8352 automatically, but can be overwritten.
8353 .It Ql content-disposition
8354 Automatically set to the string
8355 .Ql attachment .
8358 .It Cm attribute-set-at
8359 This uses the same search mechanism as described for
8360 .Cm remove-at
8361 and is otherwise identical to
8362 .Cm attribute-set .
8364 .It Cm insert
8365 Adds the attachment given as the third argument, specified exactly as
8366 documented for the command line option
8367 .Fl a ,
8368 and supporting the message number extension as documented for
8369 .Ic ~@ .
8370 This reports
8371 .Ql 210
8372 upon success, with the index of the new attachment following,
8373 .Ql 505
8374 if the given file cannot be opened,
8375 .Ql 506
8376 if an on-the-fly performed character set conversion fails, otherwise
8377 .Ql 501
8378 is reported; this is also reported if character set conversion is
8379 requested but not available.
8381 .It Cm list
8382 List all attachments via
8383 .Ql 212 ,
8384 or report
8385 .Ql 501
8386 if no attachments exist.
8387 This command is the default command of
8388 .Cm attachment
8389 if no second argument has been given.
8391 .It Cm remove
8392 This will remove the attachment given as the third argument, and report
8393 .Ql 210
8394 upon success or
8395 .Ql 501
8396 if no such attachment can be found.
8397 If there exists any path component in the given argument, then an exact
8398 match of the path which has been used to create the attachment is used
8399 directly, but if only the basename of that path matches then all
8400 attachments are traversed to find an exact match first, and the removal
8401 occurs afterwards; if multiple basenames match, a
8402 .Ql 506
8403 error occurs.
8404 Message attachments are treated as absolute pathnames.
8406 If no path component exists in the given argument, then all attachments
8407 will be searched for
8408 .Ql filename=
8409 parameter matches as well as for matches of the basename of the path
8410 which has been used when the attachment has been created; multiple
8411 matches result in a
8412 .Ql 506 .
8414 .It Cm remove-at
8415 This will interpret the third argument as a number and remove the
8416 attachment at that list position (counting from one!), reporting
8417 .Ql 210
8418 upon success or
8419 .Ql 505
8420 if the argument is not a number or
8421 .Ql 501
8422 if no such attachment exists.
8426 .It Cm header
8427 This command allows listing, inspection, and editing of message headers.
8428 Header name case is not normalized, so that case-insensitive comparison
8429 should be used when matching names.
8430 The second argument specifies the subcommand to apply, one of:
8433 .Bl -hang -width ".It Cm remove"
8434 .It Cm insert
8435 Create a new or an additional instance of the header given in the third
8436 argument, with the header body content as given in the fourth token.
8437 It may return
8438 .Ql 501
8439 if the third argument specifies a free-form header field name that is
8440 invalid, or if body content extraction fails to succeed,
8441 .Ql 505
8442 if any extracted address does not pass syntax and/or security checks or
8443 on \*(UA namespace violations, and
8444 .Ql 506
8445 to indicate prevention of excessing a single-instance header \(em note that
8446 .Ql Subject:
8447 can be appended to (a space separator will be added automatically first).
8448 .Ql To: ,
8449 .Ql Cc:
8451 .Ql Bcc:
8452 support the
8453 .Ql ?single
8454 modifier to enforce treatment as a single addressee, for example
8455 .Ql header insert To?single: 'exa, <m@ple>' ;
8456 the word
8457 .Ql single
8458 is optional.
8460 .Ql 210
8461 is returned upon success, followed by the name of the header and the list
8462 position of the newly inserted instance.
8463 The list position is always 1 for single-instance header fields.
8464 All free-form header fields are managed in a single list.
8466 .It Cm list
8467 Without a third argument a list of all yet existing headers is given via
8468 .Ql 210 ;
8469 this command is the default command of
8470 .Cm header
8471 if no second argument has been given.
8472 A third argument restricts output to the given header only, which may
8473 fail with
8474 .Ql 501
8475 if no such field is defined.
8477 .It Cm remove
8478 This will remove all instances of the header given as the third
8479 argument, reporting
8480 .Ql 210
8481 upon success,
8482 .Ql 501
8483 if no such header can be found, and
8484 .Ql 505
8485 on \*(UA namespace violations.
8487 .It Cm remove-at
8488 This will remove from the header given as the third argument the
8489 instance at the list position (counting from one!) given with the fourth
8490 argument, reporting
8491 .Ql 210
8492 upon success or
8493 .Ql 505
8494 if the list position argument is not a number or on \*(UA namespace
8495 violations, and
8496 .Ql 501
8497 if no such header instance exists.
8499 .It Cm show
8500 Shows the content of the header given as the third argument.
8501 Dependent on the header type this may respond with
8502 .Ql 211
8504 .Ql 212 ;
8505 any failure results in
8506 .Ql 501 .
8511 In compose-mode read-only access to optional pseudo headers in the \*(UA
8512 private namespace is available:
8516 .Bl -tag -compact -width ".It Va BaNg"
8517 .It Ql Mailx-Command:
8518 The name of the command that generates the message, one of
8519 .Ql forward ,
8520 .Ql Lreply ,
8521 .Ql mail ,
8522 .Ql Reply ,
8523 .Ql reply ,
8524 .Ql resend .
8525 This pseudo header always exists (in compose-mode).
8527 .It Ql Mailx-Raw-To:
8528 .It Ql Mailx-Raw-Cc:
8529 .It Ql Mailx-Raw-Bcc:
8530 Represent the frozen initial state of these headers before any
8531 transformation
8532 .Pf ( Ic alias ,
8533 .Ic alternates ,
8534 .Va recipients-in-cc
8535 etc.) took place.
8537 .It Ql Mailx-Orig-Sender:
8538 .It Ql Mailx-Orig-From:
8539 .It Ql Mailx-Orig-To:
8540 .It Ql Mailx-Orig-Cc:
8541 .It Ql Mailx-Orig-Bcc:
8542 The values of said headers of the original message which has been
8543 addressed by any of
8544 .Ic reply , forward , resend .
8545 The sender field is special as it is filled in with the sole sender
8546 according to RFC 5322 rules, it may thus be equal to the from field.
8550 .It Cm help , \&?
8551 Show an abstract of the above commands via
8552 .Ql 211 .
8554 .It Cm version
8555 This command will print the protocol version via
8556 .Ql 210 .
8561 .It Ic ~A
8562 The same as
8563 .Ql Ic ~i Ns \| Va Sign .
8566 .It Ic ~a
8567 The same as
8568 .Ql Ic ~i Ns \| Va sign .
8571 .It Ic ~b Ar name ...
8572 Add the given names to the list of blind carbon copy recipients.
8575 .It Ic ~c Ar name ...
8576 Add the given names to the list of carbon copy recipients.
8579 .It Ic ~d
8580 Read the file specified by the
8581 .Ev DEAD
8582 variable into the message.
8585 .It Ic ~e
8586 Invoke the text
8587 .Ev EDITOR
8588 on the message collected so far, then return to compose mode.
8589 .Ic ~v
8590 can be used for a more display oriented editor, and
8591 .Ic ~| Ns |
8592 offers a pipe-based editing approach.
8595 .It Ic ~F Ar messages
8596 Read the named messages into the message being sent, including all
8597 message headers and MIME parts, and honouring
8598 .Va forward-add-cc
8599 as well as
8600 .Va forward-inject-head
8602 .Va forward-inject-tail .
8603 If no messages are specified, read in the current message, the
8604 .Dq dot .
8607 .It Ic ~f Ar messages
8608 Read the named messages into the message being sent.
8609 If no messages are specified, read in the current message, the
8610 .Dq dot .
8611 Strips down the list of header fields according to the
8612 .Ql forward
8613 (with
8614 .Va posix :
8615 .Ql type )
8616 white- and blacklist selection of
8617 .Ic headerpick ,
8618 and honours
8619 .Va forward-add-cc
8620 as well as
8621 .Va forward-inject-head
8623 .Va forward-inject-tail .
8624 For MIME multipart messages,
8625 only the first displayable part is included.
8628 .It Ic ~H
8629 In interactive mode, edit the message header fields
8630 .Ql From: ,
8631 .Ql Reply-To:
8633 .Ql Sender:
8634 by typing each one in turn and allowing the user to edit the field.
8635 The default values for these fields originate from the
8636 .Va from , reply-to
8638 .Va sender
8639 variables.
8640 In non-interactive mode this sets
8641 .Va ^ERR Ns -NOTTY .
8644 .It Ic ~h
8645 In interactive mode, edit the message header fields
8646 .Ql To: ,
8647 .Ql Cc: ,
8648 .Ql Bcc:
8650 .Ql Subject:
8651 by typing each one in turn and allowing the user to edit the field.
8652 In non-interactive mode this sets
8653 .Va ^ERR Ns -NOTTY .
8656 .It Ic ~I Ar variable
8657 Insert the value of the specified variable into the message.
8658 The message remains unaltered if the variable is unset or empty.
8659 Any embedded character sequences
8660 .Ql \et
8661 horizontal tabulator and
8662 .Ql \en
8663 line feed are expanded in
8664 .Va posix
8665 mode; otherwise the expansion should occur at
8666 .Ic set
8667 time (\*(ID by using the command modifier
8668 .Va wysh ) .
8671 .It Ic ~i Ar variable
8672 Like
8673 .Ic ~I ,
8674 but appends a newline character.
8677 .It Ic ~M Ar messages
8678 Read the named messages into the message being sent,
8679 indented by
8680 .Va indentprefix .
8681 If no messages are specified, read the current message, the
8682 .Dq dot .
8683 Honours
8684 .Va forward-add-cc
8685 as well as
8686 .Va forward-inject-head
8688 .Va forward-inject-tail .
8691 .It Ic ~m Ar messages
8692 Read the named messages into the message being sent,
8693 indented by
8694 .Va indentprefix .
8695 If no messages are specified, read the current message, the
8696 .Dq dot .
8697 Strips down the list of header fields according to the
8698 .Ql type
8699 white- and blacklist selection of
8700 .Ic headerpick .
8701 Honours
8702 .Va forward-add-cc
8703 as well as
8704 .Va forward-inject-head
8706 .Va forward-inject-tail .
8707 For MIME multipart messages,
8708 only the first displayable part is included.
8711 .It Ic ~p
8712 Display the message collected so far,
8713 prefaced by the message header fields
8714 and followed by the attachment list, if any.
8717 .It Ic ~Q
8718 Read in the given / current message(s) using the algorithm of
8719 .Va quote
8720 (except that is implicitly assumed, even if not set), honouring
8721 .Va quote-add-cc .
8724 .It Ic ~q
8725 Abort the message being sent,
8726 copying it to the file specified by the
8727 .Ev DEAD
8728 variable if
8729 .Va save
8730 is set.
8733 .It Ic ~R Ar filename
8734 Identical to
8735 .Ic ~r ,
8736 but indent each line that has been read by
8737 .Va indentprefix .
8740 .It Ic ~r Ar filename Op Ar HERE-delimiter
8741 Read the named file, object to
8742 .Sx "Filename transformations"
8743 excluding shell globs and variable expansions, into the message; if
8744 .Ar filename
8745 is the hyphen-minus
8746 .Ql -
8747 then standard input is used (for pasting, for example).
8748 Only in this latter mode
8749 .Ar HERE-delimiter
8750 may be given: if it is data will be read in until the given
8751 .Ar HERE-delimiter
8752 is seen on a line by itself, and encountering EOF is an error; the
8753 .Ar HERE-delimiter
8754 is a required argument in non-interactive mode; if it is single-quote
8755 quoted then the pasted content will not be expanded, \*(ID otherwise
8756 a future version of \*(UA may perform shell-style expansion on the content.
8759 .It Ic ~s Ar string
8760 Cause the named string to become the current subject field.
8761 Newline (NL) and carriage-return (CR) bytes are invalid and will be
8762 normalized to space (SP) characters.
8765 .It Ic ~t Ar name ...
8766 Add the given name(s) to the direct recipient list.
8769 .It Ic ~U Ar messages
8770 Read in the given / current message(s) excluding all headers, indented by
8771 .Va indentprefix .
8772 Honours
8773 .Va forward-add-cc
8774 as well as
8775 .Va forward-inject-head
8777 .Va forward-inject-tail .
8780 .It Ic ~u Ar messages
8781 Read in the given / current message(s), excluding all headers.
8782 Honours
8783 .Va forward-add-cc
8784 as well as
8785 .Va forward-inject-head
8787 .Va forward-inject-tail .
8790 .It Ic ~v
8791 Invoke the
8792 .Ev VISUAL
8793 editor on the message collected so far, then return to compose mode.
8794 .Ic ~e
8795 can be used for a less display oriented editor, and
8796 .Ic ~| Ns |
8797 offers a pipe-based editing approach.
8800 .It Ic ~w Ar filename
8801 Write the message onto the named file, which is object to the usual
8802 .Sx "Filename transformations" .
8803 If the file exists,
8804 the message is appended to it.
8807 .It Ic ~x
8808 Same as
8809 .Ic ~q ,
8810 except that the message is not saved at all.
8813 .\" }}}
8816 .\" .Sh INTERNAL VARIABLES {{{
8817 .Sh "INTERNAL VARIABLES"
8819 Internal \*(UA variables are controlled via the
8820 .Ic set
8822 .Ic unset
8823 commands; prefixing a variable name with the string
8824 .Ql no
8825 and calling
8826 .Ic set
8827 has the same effect as using
8828 .Ic unset :
8829 .Ql unset crt
8831 .Ql set nocrt
8832 do the same thing.
8833 .Ic varshow
8834 will give more insight on the given variable(s), and
8835 .Ic set ,
8836 when called without arguments, will show a listing of all variables.
8837 Both commands support a more
8838 .Va verbose
8839 listing mode.
8840 Some well-known variables will also become inherited from the
8841 program
8842 .Sx ENVIRONMENT
8843 implicitly, others can be imported explicitly with the command
8844 .Ic environ
8845 and henceforth share said properties.
8848 Two different kinds of internal variables exist, and both of which can
8849 also form chains.
8850 There are boolean variables, which can only be in one of the two states
8851 .Dq set
8853 .Dq unset ,
8854 and value variables with a(n optional) string value.
8855 For the latter proper quoting is necessary upon assignment time, the
8856 introduction of the section
8857 .Sx COMMANDS
8858 documents the supported quoting rules.
8860 .Bd -literal -offset indent
8861 ? wysh set one=val\e 1 two="val 2" \e
8862     three='val "3"' four=$'val \e'4\e''; \e
8863     varshow one two three four; \e
8864     unset one two three four
8868 Dependent upon the actual option string values may become interpreted as
8869 colour names, command specifications, normal text, etc.
8870 They may be treated as numbers, in which case decimal values are
8871 expected if so documented, but otherwise any numeric format and
8872 base that is valid and understood by the
8873 .Ic vexpr
8874 command may be used, too.
8877 There also exists a special kind of string value, the
8878 .Dq boolean string ,
8879 which must either be a decimal integer (in which case
8880 .Ql 0
8881 is false and
8882 .Ql 1
8883 and any other value is true) or any of the (case-insensitive) strings
8884 .Ql off ,
8885 .Ql no ,
8886 .Ql n
8888 .Ql false
8889 for a false boolean and
8890 .Ql on ,
8891 .Ql yes ,
8892 .Ql y
8894 .Ql true
8895 for a true boolean;
8896 .Mx -ix quadoption
8897 a special kind of boolean string is the
8898 .Dq quadoption :
8899 it can optionally be prefixed with the (case-insensitive) term
8900 .Ql ask- ,
8901 as in
8902 .Ql ask-yes ;
8903 in interactive mode the user will be prompted, otherwise the actual
8904 boolean is used.
8907 Variable chains extend a plain
8908 .Ql variable
8909 with
8910 .Ql variable-HOST
8912 .Ql variable-USER@HOST
8913 variants.
8914 Here
8915 .Ql HOST
8916 will be converted to all lowercase when looked up (but not when the
8917 variable is set or unset!), \*(OPally IDNA converted, and indeed means
8918 .Ql server:port
8919 if a
8920 .Ql port
8921 had been specified in the contextual Uniform Resource Locator URL, see
8922 .Sx "On URL syntax and credential lookup" .
8923 Even though this mechanism is based on URLs no URL percent encoding may
8924 be applied to neither of
8925 .Ql USER
8927 .Ql HOST ,
8928 variable chains need to be specified using raw data;
8929 the mentioned section contains examples.
8930 Variables which support chains are explicitly documented as such, and
8931 \*(UA treats the base name of any such variable special, meaning that
8932 users should not create custom names like
8933 .Ql variable-xyz
8934 in order to avoid false classifications and treatment of such variables.
8936 .\" .Ss "Initial settings" {{{
8937 .\" (Keep in SYNC: mx/nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
8938 .Ss "Initial settings"
8940 The standard POSIX 2008/Cor 2-2016 mandates the following initial
8941 variable settings:
8942 .Pf no Va allnet ,
8943 .Pf no Va append ,
8944 .Va asksub ,
8945 .Pf no Va askbcc ,
8946 .Pf no Va autoprint ,
8947 .Pf no Va bang ,
8948 .Pf no Va cmd ,
8949 .Pf no Va crt ,
8950 .Pf no Va debug ,
8951 .Pf no Va dot ,
8952 .Va escape
8953 set to
8954 .Ql ~ ,
8955 .Pf no Va flipr ,
8956 .Pf no Va folder ,
8957 .Va header ,
8958 .Pf no Va hold ,
8959 .Pf no Va ignore ,
8960 .Pf no Va ignoreeof ,
8961 .Pf no Va keep ,
8962 .Pf no Va keepsave ,
8963 .Pf no Va metoo ,
8964 .Pf no Va outfolder ,
8965 .Pf no Va page ,
8966 .Va prompt
8967 set to
8968 .Ql \&?\0 ,
8969 .Pf no Va quiet ,
8970 .Pf no Va record ,
8971 .Va save ,
8972 .Pf no Va sendwait ,
8973 .Pf no Va showto ,
8974 .Pf no Va Sign ,
8975 .Pf no Va sign ,
8976 .Va toplines
8977 set to
8978 .Ql 5 .
8981 However, \*(UA has built-in some initial (and some default) settings
8982 which (may) diverge, others may become adjusted by one of the
8983 .Sx "Resource files" .
8984 Displaying the former is accomplished via
8985 .Ic set :
8986 .Ql $ \*(uA -:/ -v -Xset -Xx .
8987 In general this implementation sets (and has extended the meaning of)
8988 .Va sendwait ,
8989 and does not support the
8990 .Pf no Va onehop
8991 variable \(en use command line options or
8992 .Va mta-arguments
8993 to pass options through to a
8994 .Va mta .
8995 The default global resource file sets, among others, the variables
8996 .Va hold ,
8997 .Va keep
8999 .Va keepsave ,
9000 establishes a default
9001 .Ic headerpick
9002 selection etc., and should thus be taken into account.
9003 .\" }}}
9005 .\" .Ss "Variables" {{{
9006 .Ss "Variables"
9008 .Bl -tag -width ".It Va BaNg"
9011 .It Va \&?
9012 \*(RO The exit status of the last command, or the
9013 .Ic return
9014 value of the macro
9015 .Ic call Ns
9016 ed last.
9017 This status has a meaning in the state machine: in conjunction with
9018 .Va errexit
9019 any non-0 exit status will cause a program exit, and in
9020 .Va posix
9021 mode any error while loading (any of the) resource files will have the
9022 same effect.
9023 .Cm ignerr ,
9024 one of the
9025 .Sx "Command modifiers" ,
9026 can be used to instruct the state machine to ignore errors.
9029 .It Va \&!
9030 \*(RO The current error number
9031 .Pf ( Xr errno 3 ) ,
9032 which is set after an error occurred; it is also available via
9033 .Va ^ERR ,
9034 and the error name and documentation string can be queried via
9035 .Va ^ERRNAME
9037 .Va ^ERRDOC .
9038 \*(ID This machinery is new and the error number is only really usable
9039 if a command explicitly states that it manages the variable
9040 .Va \&! ,
9041 for others errno will be used in case of errors, or
9042 .Va ^ERR Ns -INVAL
9043 if that is 0: it thus may or may not reflect the real error.
9044 The error number may be set with the command
9045 .Ic return .
9049 .It Va ^
9050 \*(RO This is a multiplexer variable which performs dynamic expansion of
9051 the requested state or condition, of which there are:
9053 .Bl -tag -width ".It Va BaNg"
9057 .It Va ^ERR , ^ERRDOC , ^ERRNAME
9058 The number, documentation, and name of the current
9059 .Xr errno 3 ,
9060 respectively, which is usually set after an error occurred.
9061 The documentation is an \*(OP, the name is used if not available.
9062 \*(ID This machinery is new and is usually reliable only if a command
9063 explicitly states that it manages the variable
9064 .Va \&! ,
9065 which is effectively identical to
9066 .Va \&\&^ERR .
9067 Each of those variables can be suffixed with a hyphen minus followed by
9068 a name or number, in which case the expansion refers to the given error.
9069 Note this is a direct mapping of (a subset of) the system error values:
9070 .Bd -literal -offset indent
9071 define work {
9072   eval echo \e$1: \e$^ERR-$1:\e
9073     \e$^ERRNAME-$1: \e$^ERRDOC-$1
9074   vput vexpr i + "$1" 1
9075   if [ $i -lt 16 ]
9076     \excall work $i
9077   end
9079 call work 0
9084 .It Va ^ERRQUEUE-COUNT , ^ERRQUEUE-EXISTS
9085 The number of messages present in the \*(OPal log queue of
9086 .Ic errors ,
9087 and a boolean which indicates whether the queue is not empty,
9088 respectively; both are always 0 unless
9089 .Va features
9090 indicates
9091 .Ql +errors .
9096 .It Va *
9097 \*(RO Expands all positional parameters (see
9098 .Va 1 ) ,
9099 separated by the first character of the value of
9100 .Va ifs .
9101 \*(ID The special semantics of the equally named special parameter of the
9102 .Xr sh 1
9103 are not yet supported.
9106 .It Va @
9107 \*(RO Expands all positional parameters (see
9108 .Va 1 ) ,
9109 separated by a space character.
9110 If placed in double quotation marks, each positional parameter is
9111 properly quoted to expand to a single parameter again.
9114 .It Va #
9115 \*(RO Expands to the number of positional parameters, i.e., the size of
9116 the positional parameter stack in decimal.
9119 .It Va \&0
9120 \*(RO Inside the scope of a
9121 .Ic define Ns
9122 d and
9123 .Ic call Ns
9124 ed macro this expands to the name of the calling macro, or to the empty
9125 string if the macro is running from top-level.
9126 For the \*(OPal regular expression search and replace operator of
9127 .Ic vexpr
9128 this expands to the entire matching expression.
9129 It represents the program name in global context.
9132 .It Va 1
9133 \*(RO Access of the positional parameter stack.
9134 All further parameters can be accessed with this syntax, too,
9135 .Ql 2 ,
9136 .Ql 3
9137 etc.; positional parameters can be shifted off the stack by calling
9138 .Ic shift .
9139 The parameter stack contains, for example, the arguments of a
9140 .Ic call Ns
9142 .Ic define Ns
9143 d macro, the matching groups of the \*(OPal regular expression search
9144 and replace expression of
9145 .Ic vexpr ,
9146 and can be explicitly created or overwritten with the command
9147 .Ic vpospar .
9150 .It Va account
9151 \*(RO Is set to the active
9152 .Ic account .
9155 .It Va add-file-recipients
9156 \*(BO When file or pipe recipients have been specified,
9157 mention them in the corresponding address fields of the message instead
9158 of silently stripping them from their recipient list.
9159 By default such addressees are not mentioned.
9162 .It Va allnet
9163 \*(BO Causes only the local part to be evaluated
9164 when comparing addresses.
9167 .It Va append
9168 \*(BO Causes messages saved in the
9169 .Mx -sx
9170 .Sx "secondary mailbox"
9171 .Ev MBOX
9172 to be appended to the end rather than prepended.
9173 This should always be set.
9176 .It Va askatend
9177 \*(BO Causes the prompts for
9178 .Ql Cc:
9180 .Ql Bcc:
9181 lists to appear after the message has been edited.
9184 .It Va askattach
9185 \*(BO If set, \*(UA asks an interactive user for files to attach at the
9186 end of each message; An empty line finalizes the list.
9189 .It Va askcc
9190 \*(BO Causes the interactive user to be prompted for carbon copy
9191 recipients (at the end of each message if
9192 .Va askatend
9194 .Va bsdcompat
9195 are set).
9198 .It Va askbcc
9199 \*(BO Causes the interactive user to be prompted for blind carbon copy
9200 recipients (at the end of each message if
9201 .Va askatend
9203 .Va bsdcompat
9204 are set).
9207 .It Va asksend
9208 \*(BO Causes the interactive user to be prompted for confirmation to
9209 send the message or reenter compose mode after having been shown an
9210 envelope summary.
9211 This is by default enabled.
9214 .It Va asksign
9215 \*(BO\*(OP Causes the interactive user to be prompted if the message is
9216 to be signed at the end of each message.
9218 .Va smime-sign
9219 variable is ignored when this variable is set.
9222 .It Va asksub
9223 .\" The alternative *ask* is not documented on purpose
9224 \*(BO Causes \*(UA to prompt the interactive user for the subject upon
9225 entering compose mode unless a subject already exists.
9228 .It Va attrlist
9229 A sequence of characters to display in the
9230 .Ql attribute
9231 column of the
9232 .Va headline
9233 as shown in the display of
9234 .Ic headers ;
9235 each for one type of messages (see
9236 .Sx "Message states" ) ,
9237 with the default being
9238 .Ql NUROSPMFAT+\-$~
9240 .Ql NU\ \ *HMFAT+\-$~
9241 if the
9242 .Va bsdflags
9243 variable is set, in the following order:
9245 .Bl -tag -compact -width ".It Ql _"
9246 .It Ql N
9247 new.
9248 .It Ql U
9249 unread but old.
9250 .It Ql R
9251 new but read.
9252 .It Ql O
9253 read and old.
9254 .It Ql S
9255 saved.
9256 .It Ql P
9257 preserved.
9258 .It Ql M
9259 mboxed.
9260 .It Ql F
9261 flagged.
9262 .It Ql A
9263 answered.
9264 .It Ql T
9265 draft.
9266 .It Ql +
9267 \*(ID start of a (collapsed) thread in threaded mode (see
9268 .Va autosort ,
9269 .Ic thread ) ;
9270 .It Ql -
9271 \*(ID an uncollapsed thread in threaded mode; only used in conjunction with
9272 .Fl L .
9273 .It Ql $
9274 classified as spam.
9275 .It Ql ~
9276 classified as possible spam.
9281 .It Va autobcc
9282 Specifies a list of recipients to which a blind carbon copy of each
9283 outgoing message will be sent automatically.
9286 .It Va autocc
9287 Specifies a list of recipients to which a carbon copy of each outgoing
9288 message will be sent automatically.
9291 .It Va autocollapse
9292 \*(BO Causes threads to be collapsed automatically when .Ql thread Ns
9294 .Ic sort
9295 mode is entered (see the
9296 .Ic collapse
9297 command).
9300 .It Va autoprint
9301 \*(BO Enable automatic
9302 .Ic type Ns
9303 ing of a(n existing)
9304 .Dq successive
9305 message after
9306 .Ic delete
9308 .Ic undelete
9309 commands: the message that becomes the new
9310 .Dq dot
9311 is shown automatically, as via
9312 .Ic dp
9314 .Ic dt .
9317 .It Va autosort
9318 Causes sorted mode (see the
9319 .Ic sort
9320 command) to be entered automatically with the value of this variable as
9321 sorting method when a folder is opened, for example
9322 .Ql set autosort=thread .
9325 .It Va bang
9326 \*(BO Enables the substitution of all not (reverse-solidus) escaped
9327 exclamation mark
9328 .Ql \&!
9329 characters by the contents of the last executed command for the
9330 .Ic \&!
9331 shell escape command and
9332 .Ic ~! ,
9333 one of the compose mode
9334 .Sx "COMMAND ESCAPES" .
9335 If this variable is not set no reverse solidus stripping is performed.
9338 .It Va bind-timeout
9339 \*(OB Predecessor of
9340 .Va bind-inter-byte-timeout .
9341 \*(ID Setting this automatically sets the successor.
9344 .It Va bind-inter-byte-timeout
9345 \*(OP Terminals may generate multi-byte sequences for special function
9346 keys, for example, but these sequences may not become read as a unit.
9347 And multi-byte sequences can be defined freely via
9348 .Ic bind .
9349 This variable specifies the timeout in milliseconds that the MLE (see
9350 .Sx "On terminal control and line editor" )
9351 waits for more bytes to arrive unless it considers a sequence
9352 .Dq complete .
9353 The default is 200, the maximum is about 10 seconds.
9354 In the following example the comments state which sequences are
9355 affected by this timeout:
9356 .Bd -literal -offset indent
9357 ? bind base abc echo 0 # abc
9358 ? bind base ab,c echo 1 # ab
9359 ? bind base abc,d echo 2 # abc
9360 ? bind base ac,d echo 3 # ac
9361 ? bind base a,b,c echo 4
9362 ? bind base a,b,c,d echo 5
9363 ? bind base a,b,cc,dd echo 6 # cc and dd
9367 .It Va bind-inter-key-timeout
9368 \*(OP Multi-key
9369 .Ic bind
9370 sequences do not time out by default.
9371 If this variable is set, then the current key sequence is forcefully
9372 terminated once the timeout (in milliseconds) triggers.
9373 The value should be (maybe significantly) larger than
9374 .Va bind-inter-byte-timeout ,
9375 but may not excess the maximum, too.
9378 .It Va bsdcompat
9379 \*(BO Sets some cosmetical features to traditional BSD style;
9380 has the same affect as setting
9381 .Va askatend
9382 and all other variables prefixed with
9383 .Ql bsd ;
9384 it also changes the behaviour of
9385 .Va emptystart
9386 (which does not exist in BSD).
9389 .It Va bsdflags
9390 \*(BO Changes the letters shown in the first column of a header
9391 summary to traditional BSD style.
9394 .It Va bsdheadline
9395 \*(BO Changes the display of columns in a header summary to traditional
9396 BSD style.
9399 .It Va bsdmsgs
9400 \*(BO Changes some informational messages to traditional BSD style.
9403 .It Va bsdorder
9404 \*(BO Causes the
9405 .Ql Subject:
9406 field to appear immediately after the
9407 .Ql To:
9408 field in message headers and with the
9409 .Ic ~h
9410 .Sx "COMMAND ESCAPES" .
9416 .It Va build-cc , build-ld , build-os , build-rest
9417 \*(RO The build environment, including the compiler, the linker, the
9418 operating system \*(UA has been build for, usually taken from
9419 .Xr uname 1
9421 .Ql uname -s ,
9422 and then lowercased, as well as all the possibly interesting rest of the
9423 configuration and build environment.
9424 This information is also available in the
9425 .Va verbose
9426 output of the command
9427 .Ic version .
9430 .It Va charset-7bit
9431 The value that should appear in the
9432 .Ql charset=
9433 parameter of
9434 .Ql Content-Type:
9435 MIME header fields when no character set conversion of the message data
9436 was performed.
9437 This defaults to US-ASCII, and the chosen character set should be
9438 US-ASCII compatible.
9441 .It Va charset-8bit
9442 \*(OP The default 8-bit character set that is used as an implicit last
9443 member of the variable
9444 .Va sendcharsets .
9445 This defaults to UTF-8 if character set conversion capabilities are
9446 available, and to ISO-8859-1 otherwise (unless the operating system
9447 environment is known to always and exclusively support UTF-8 locales),
9448 in which case the only supported character set is
9449 .Va ttycharset
9450 and this variable is effectively ignored.
9453 .It Va charset-unknown-8bit
9454 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
9455 .Dq upgrade
9456 the content of a mail message by using a character set with the name
9457 .Ql unknown-8bit .
9458 Because of the unclassified nature of this character set \*(UA will not
9459 be capable to convert this character set to any other character set.
9460 If this variable is set any message part which uses the character set
9461 .Ql unknown-8bit
9462 is assumed to really be in the character set given in the value,
9463 otherwise the (final) value of
9464 .Va charset-8bit
9465 is used for this purpose.
9467 This variable will also be taken into account if a MIME type (see
9468 .Sx "The mime.types files" )
9469 of a MIME message part that uses the
9470 .Ql binary
9471 character set is forcefully treated as text.
9474 .It Va cmd
9475 The default value for the
9476 .Ic pipe
9477 command.
9480 .It Va colour-disable
9481 \*(BO\*(OP Forcefully disable usage of colours.
9482 Also see the section
9483 .Sx "Coloured display" .
9486 .It Va colour-pager
9487 \*(BO\*(OP Whether colour shall be used for output that is paged through
9488 .Ev PAGER .
9489 Note that pagers may need special command line options, for example
9490 .Xr less 1
9491 requires the option
9492 .Fl \&\&R
9494 .Xr lv 1
9495 the option
9496 .Fl \&\&c
9497 in order to support colours.
9498 Often doing manual adjustments is unnecessary since \*(UA may perform
9499 adjustments dependent on the value of the environment variable
9500 .Ev PAGER
9501 (see there for more).
9505 .It Va contact-mail , contact-web
9506 \*(RO Addresses for contact per email and web, respectively, for
9507 bug reports, suggestions, or anything else regarding \*(UA.
9508 The former can be used directly:
9509 .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
9515 .It Va content-description-forwarded-message , \
9516     content-description-quote-attachment , \
9517     content-description-smime-message , \
9518     content-description-smime-signature
9519 \*(OP(partially) Strings which will be placed in according
9520 .Ql Content-Description:
9521 headers if non-empty.
9522 They all have default values, for example
9523 .Ql Forwarded message .
9526 .It Va crt
9527 In a(n interactive) terminal session, then if this valued variable is
9528 set it will be used as a threshold to determine how many lines the given
9529 output has to span before it will be displayed via the configured
9530 .Ev PAGER ;
9531 Usage of the
9532 .Ev PAGER
9533 can be forced by setting this to the value
9534 .Ql 0 ,
9535 setting it without a value will deduce the current height of the
9536 terminal screen to compute the threshold (see
9537 .Ev LINES ,
9538 .Va screen
9540 .Xr stty 1 ) .
9541 \*(ID At the moment this uses the count of lines of the message in wire
9542 format, which, dependent on the
9543 .Va mime-encoding
9544 of the message, is unrelated to the number of display lines.
9545 (The software is old and historically the relation was a given thing.)
9548 .It Va customhdr
9549 Define a set of custom headers to be injected into newly composed or
9550 forwarded messages.
9551 A custom header consists of the field name followed by a colon
9552 .Ql \&:
9553 and the field content body.
9554 Standard header field names cannot be overwritten by a custom header.
9555 Different to the command line option
9556 .Fl C
9557 the variable value is interpreted as a comma-separated list of custom
9558 headers: to include commas in header bodies they need to become escaped
9559 with reverse solidus
9560 .Ql \e .
9561 Headers can be managed more freely in compose mode via
9562 .Ic ~^ .
9564 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
9567 .It Va datefield
9568 Controls the appearance of the
9569 .Ql %d
9570 date and time format specification of the
9571 .Va headline
9572 variable, that is used, for example, when viewing the summary of
9573 .Ic headers .
9574 If unset, then the local receiving date is used and displayed
9575 unformatted, otherwise the message sending
9576 .Ql Date: .
9577 It is possible to assign a
9578 .Xr strftime 3
9579 format string and control formatting, but embedding newlines via the
9580 .Ql %n
9581 format is not supported, and will result in display errors.
9582 The default is
9583 .Ql %Y-%m-%d %H:%M ,
9584 and also see
9585 .Va datefield-markout-older .
9588 .It Va datefield-markout-older
9589 Only used in conjunction with
9590 .Va datefield .
9591 Can be used to create a visible distinction of messages dated more than
9592 a day in the future, or older than six months, a concept comparable to the
9593 .Fl \&\&l
9594 option of the POSIX utility
9595 .Xr ls 1 .
9596 If set to the empty string, then the plain month, day and year of the
9597 .Ql Date:
9598 will be displayed, but a
9599 .Xr strftime 3
9600 format string to control formatting can be assigned.
9601 The default is
9602 .Ql %Y-%m-%d .
9605 .It Va debug
9606 \*(BO (Almost) Enter a debug-only sandbox mode which generates many
9607 log messages, disables the actual delivery of messages, and also implies
9608 .Pf no Va record
9609 as well as
9610 .Pf no Va save .
9611 Also see
9612 .Va verbose .
9615 .It Va disposition-notification-send
9616 \*(BO\*(OP Emit a
9617 .Ql Disposition-Notification-To:
9618 header (RFC 3798) with the message.
9619 This requires the
9620 .Va from
9621 variable to be set.
9622 .\" TODO .It Va disposition-notification-send-HOST
9623 .\"Overrides
9624 .\".Va disposition-notification-send
9625 .\" for SMTP accounts on a specific host.
9626 .\" TODO .It Va disposition-notification-send-USER@HOST
9627 .\"Overrides
9628 .\".Va disposition-notification-send
9629 .\"for a specific account.
9632 .It Va dot
9633 \*(BO When dot is set, a period
9634 .Ql \&.
9635 on a line by itself during message input in (interactive or batch
9636 .Fl # )
9637 compose mode will be treated as end-of-message (in addition to the
9638 normal end-of-file condition).
9639 This behaviour is implied in
9640 .Va posix
9641 mode with a set
9642 .Va ignoreeof .
9645 .It Va dotlock-disable
9646 \*(BO\*(OP Disable creation of
9647 .Mx -sx
9648 .Sx "dotlock files"
9649 for MBOX databases.
9651 .It Va dotlock-ignore-error
9652 \*(OB\*(BO\*(OP Ignore failures when creating
9653 .Mx -sx
9654 .Sx "dotlock files" .
9655 Please use
9656 .Va dotlock-disable
9657 instead.
9660 .It Va editalong
9661 If this variable is set then the editor is started automatically when
9662 a message is composed in interactive mode.
9663 If the value starts with the letter
9664 .Ql v
9665 then this acts as if
9666 .Ic ~v ,
9667 otherwise as if
9668 .Ic ~e
9669 .Pf (see\0 Sx "COMMAND ESCAPES" )
9670 had been specified.
9672 .Va editheaders
9673 variable is implied for this automatically spawned editor session.
9676 .It Va editheaders
9677 \*(BO When a message is edited while being composed,
9678 its header is included in the editable text.
9681 .It Va emptystart
9682 \*(BO When entering interactive mode \*(UA normally writes
9683 .Dq \&No mail for user
9684 and exits immediately if a mailbox is empty or does not exist.
9685 If this variable is set \*(UA starts even with an empty or non-existent
9686 mailbox (the latter behaviour furtherly depends upon
9687 .Va bsdcompat ,
9688 though).
9691 .It Va errexit
9692 \*(BO Let each command with a non-0 exit status, including every
9693 .Ic call Ns
9694 ed macro which
9695 .Ic return Ns
9696 s a non-0 status, cause a program exit unless prefixed by
9697 .Cm ignerr
9698 (see
9699 .Sx "Command modifiers" ) .
9700 This also affects
9701 .Sx "COMMAND ESCAPES" ,
9702 but which use a different modifier for ignoring the error.
9703 Please refer to the variable
9704 .Va \&?
9705 for more on this topic.
9708 .It Va escape
9709 The first character of this value defines the escape character for
9710 .Sx "COMMAND ESCAPES"
9711 in compose mode.
9712 The default value is the character tilde
9713 .Ql ~ .
9714 If set to the empty string, command escapes are disabled.
9718 .It Va expandaddr
9719 If unset then file and command pipeline address targets are not allowed,
9720 and any such address will be filtered out, giving a warning message.
9721 If set then all possible recipient address specifications will be
9722 accepted, unless the optional value is more specific (also see
9723 .Sx "On sending mail, and non-interactive mode" ) .
9724 If the value contains
9725 .Ql restrict
9726 then behaviour equals the former unless in interactive mode, or when
9727 tilde commands were enabled explicitly via
9728 .Fl ~
9730 .Fl # ,
9731 in which case it equals the latter, and thus allows all addressees.
9732 .Ql restrict
9733 really acts like
9734 .Ql restrict,\:-all,\:+name,\:+addr ,
9735 so care for ordering issues must be taken.
9738 Indeed the value is interpreted as a comma-separated list of
9739 case-insensitive strings.
9740 Hard send errors can be enforced for disallowed address types by setting
9741 .Ql fail ;
9742 by default these are only filtered out.
9743 User name receivers addressing valid local users can be expanded to
9744 a network address (also see
9745 .Va hostname )
9746 by setting
9747 .Ql nametoaddr .
9748 Address targets can be added and removed with a plus sign
9749 .Ql +
9750 or hyphen-minus
9751 .Ql -
9752 prefix, respectively: the value
9753 .Ql all
9754 addresses all possible specifications,
9755 .Ql fcc
9756 whitelists targets specified via
9757 .Ql Fcc:
9758 headers regardless of other settings,
9759 .Ql file
9760 file targets (it includes
9761 .Ql fcc ) ,
9762 .Ql pipe
9763 command pipeline targets,
9764 .Ql name
9765 plain user names left for further expansion by the MTA (implicitly
9766 disallowed for the SMTP based
9767 .Va mta ) ,
9769 .Ql addr
9770 network addresses.
9771 Targets are interpreted in the given order, so that
9772 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
9773 will cause hard errors for any non-network address recipient address
9774 unless running interactively or having been started with the option
9775 .Fl ~
9777 .Fl # ;
9778 in the latter case(s) any address may be used, then.
9781 Historically invalid network addressees were silently stripped off \(em
9782 shall they cause hard errors instead it must be ensured that
9783 .Ql failinvaddr
9784 is an entry of the list (it really acts like
9785 .Ql failinvaddr,\:+addr ) .
9786 Likewise,
9787 .Ql domaincheck
9788 .Pf (actually\0\: Ql domaincheck,\:+addr )
9789 compares address domain names against a whitelist and strips off
9790 .Pf ( Ql fail
9791 for hard errors) addressees which fail this test; the domain name
9792 .Ql localhost
9793 and the non-empty value of
9794 .Va hostname
9795 (the real hostname otherwise) are always whitelisted,
9796 .Va expandaddr-domaincheck
9797 can be set to extend this list.
9798 Finally some address providers (for example
9799 .Fl b , c
9800 and all other command line recipients) will be evaluated as
9801 if specified within dollar-single-quotes (see
9802 .Sx "Shell-style argument quoting" )
9803 if the value list contains the string
9804 .Ql shquote .
9808 .It Va expandaddr-domaincheck
9809 Can be set to a comma-separated list of domain names which should be
9810 whitelisted for the evaluation of the
9811 .Ql domaincheck
9812 mode of
9813 .Va expandaddr .
9814 IDNA encoding is not automatically performed,
9815 .Ic addrcodec
9816 can be used to prepare the domain (of an address).
9819 .It Va expandargv
9820 Unless this variable is set additional
9821 .Va mta
9822 (Mail-Transfer-Agent)
9823 arguments from the command line, as can be given after a
9824 .Fl \&\&-
9825 separator, results in a program termination with failure status.
9826 The same can be accomplished by using the special (case-insensitive) value
9827 .Ql fail .
9828 A lesser strict variant is the otherwise identical
9829 .Ql restrict ,
9830 which does accept such arguments in interactive mode, or if tilde
9831 commands were enabled explicitly by using one of the command line options
9832 .Fl ~
9834 .Fl # .
9835 The empty value will allow unconditional usage.
9838 .It Va features
9839 \*(RO String giving a list of optional features.
9840 Features are preceded with a plus sign
9841 .Ql +
9842 if they are available, with a hyphen-minus
9843 .Ql -
9844 otherwise.
9845 To ease substring matching the string starts and ends with a comma.
9846 The output of the command
9847 .Ic version
9848 includes this information in a more pleasant output.
9851 .It Va flipr
9852 \*(BO This setting reverses the meanings of a set of reply commands,
9853 turning the lowercase variants, which by default address all recipients
9854 included in the header of a message
9855 .Pf ( Ic reply , respond , followup )
9856 into the uppercase variants, which by default address the sender only
9857 .Pf ( Ic Reply , Respond , Followup )
9858 and vice versa.
9861 .It Va folder
9862 The default path under which mailboxes are to be saved:
9863 filenames that begin with the plus sign
9864 .Ql +
9865 will have the plus sign replaced with the value of this variable if set,
9866 otherwise the plus sign will remain unchanged when doing
9867 .Sx "Filename transformations" ;
9868 also see
9869 .Ic folder
9870 for more on this topic, and know about standard imposed implications of
9871 .Va outfolder .
9872 The value supports a subset of transformations itself, and if the
9873 non-empty value does not start with a solidus
9874 .Ql / ,
9875 then the value of
9876 .Ev HOME
9877 will be prefixed automatically.
9878 Once the actual value is evaluated first, the internal variable
9879 .Va folder-resolved
9880 will be updated for caching purposes.
9882 .Mx Va folder-hook
9883 .It Va folder-hook-FOLDER , Va folder-hook
9884 Names a
9885 .Ic define Ns d
9886 macro which will be called whenever a
9887 .Ic folder
9888 is opened.
9889 The macro will also be invoked when new mail arrives,
9890 but message lists for commands executed from the macro
9891 only include newly arrived messages then.
9892 .Ic localopts
9893 are activated by default in a folder hook, causing the covered settings
9894 to be reverted once the folder is left again.
9896 The specialized form will override the generic one if
9897 .Ql FOLDER
9898 matches the file that is opened.
9899 Unlike other folder specifications, the fully expanded name of a folder,
9900 without metacharacters, is used to avoid ambiguities.
9901 However, if the mailbox resides under
9902 .Va folder
9903 then the usual
9904 .Ql +
9905 specification is tried in addition, so that if
9906 .Va \&\&folder
9908 .Dq mail
9909 (and thus relative to the user's home directory) then
9910 .Pa /home/usr1/mail/sent
9911 will be tried as
9912 .Ql folder-hook-/home/usr1/mail/sent
9913 first, but then followed by
9914 .Ql folder-hook-+sent .
9917 .It Va folder-resolved
9918 \*(RO Set to the fully resolved path of
9919 .Va folder
9920 once that evaluation has occurred; rather internal.
9923 .It Va followup-to
9924 \*(BO Controls whether a
9925 .Ql Mail-Followup-To:
9926 header is generated when sending messages to known mailing lists.
9927 The user as determined via
9928 .Va from
9929 (or, if that contains multiple addresses,
9930 .Va sender )
9931 will be placed in there if any list addressee is not a subscribed list.
9932 Also see
9933 .Va followup-to-honour
9934 and the commands
9935 .Ic mlist , mlsubscribe , reply
9937 .Ic Lreply .
9940 .It Va followup-to-add-cc
9941 \*(BO Controls whether the user will be added to the messages'
9942 .Ql Cc:
9943 list in addition to placing an entry in
9944 .Ql Mail-Followup-To:
9945 (see
9946 .Va followup-to ) .
9949 .It Va followup-to-honour
9950 Controls whether a
9951 .Ql Mail-Followup-To:
9952 header is honoured when group-replying to a message via
9953 .Ic reply
9955 .Ic Lreply .
9956 This is a
9957 .Mx -sx
9958 .Sx quadoption ;
9959 if set without a value it defaults to
9960 .Dq yes ,
9961 and see
9962 .Va followup-to .
9965 .It Va forward-add-cc
9966 \*(BO Whether the sender of a message quoted via
9967 .Ic ~Q
9968 shall be added to the messages'
9969 .Ql Cc:
9970 list.
9973 .It Va forward-as-attachment
9974 \*(BO Original messages are normally sent as inline text with the
9975 .Ic forward
9976 command,
9977 and only the first part of a multipart message is included.
9978 With this setting enabled messages are sent as unmodified MIME
9979 .Ql message/rfc822
9980 attachments with all of their parts included.
9984 .It Va forward-inject-head , forward-inject-tail
9985 The strings to put before and after the text of a message with the
9986 .Ic forward
9987 command, respectively.
9988 The former defaults to
9989 .Ql -------- Original Message --------\en .
9990 Special format directives in these strings will be expanded if possible,
9991 and if so configured the output will be folded according to
9992 .Va quote-fold ;
9993 for more please refer to
9994 .Va quote-inject-head .
9995 Injections will not be performed by
9996 .Ic forward
9997 if the variable
9998 .Va forward-as-attachment
9999 is set \(em the
10000 .Sx "COMMAND ESCAPES"
10001 .Ic ~F , ~f , ~M , ~m , ~U , ~u
10002 always inject.
10006 .It Va from
10007 The address (or a list of addresses) to put into the
10008 .Ql From:
10009 field of the message header, quoting RFC 5322:
10010 the author(s) of the message, that is, the mailbox(es) of the person(s)
10011 or system(s) responsible for the writing of the message.
10012 According to that RFC setting the
10013 .Va sender
10014 variable is required if
10015 .Va \&\&from
10016 contains more than one address.
10017 \*(ID Please expect automatic management of the
10018 .Va from
10020 .Va sender
10021 relationship.
10022 Dependent on the context these addresses are handled as if they were in
10023 the list of
10024 .Ic alternates .
10027 If a file-based MTA is used, then
10028 .Va \&\&from
10029 (or, if that contains multiple addresses,
10030 .Va sender )
10031 can nonetheless be used as the envelope sender address at the MTA
10032 protocol level (the RFC 5321 reverse-path), either via the
10033 .Fl r
10034 command line option (without argument; see there for more), or by setting
10035 .Va r-option-implicit .
10038 If the machine's hostname is not valid at the Internet (for example at
10039 a dialup machine), then either this variable or
10040 .Va hostname
10041 (\*(IN a SMTP-based
10042 .Va mta
10043 adds even more fine-tuning capabilities with
10044 .Va smtp-hostname )
10045 have to be set: if so the message and MIME part related unique ID fields
10046 .Ql Message-ID:
10048 .Ql Content-ID:
10049 will be created (except when disallowed by
10050 .Va message-id-disable
10052 .Va stealthmua ) .
10056 .It Va fullnames
10057 \*(BO Due to historical reasons comments and name parts of email
10058 addresses are removed by default when sending mail, replying to or
10059 forwarding a message.
10060 If this variable is set such stripping is not performed.
10062 .It Va fwdheading
10063 \*(OB Predecessor of
10064 .Va forward-inject-head .
10067 .It Va header
10068 \*(BO Causes the header summary to be written at startup and after
10069 commands that affect the number of messages or the order of messages in
10070 the current
10071 .Ic folder .
10072 Unless in
10073 .Va posix
10074 mode a header summary will also be displayed on folder changes.
10075 The command line option
10076 .Fl N
10077 can be used to set
10078 .Pf no Va header .
10082 .It Va headline
10083 A format string to use for the summary of
10084 .Ic headers .
10085 Format specifiers in the given string start with a percent sign
10086 .Ql %
10087 and may be followed by an optional decimal number indicating the field
10088 width \(em if that is negative, the field is to be left-aligned.
10089 Names and addresses are subject to modifications according to
10090 .Va showname
10092 .Va showto .
10093 Valid format specifiers are:
10096 .Bl -tag -compact -width ".It Ql _%%_"
10097 .It Ql %%
10098 A plain percent sign.
10099 .It Ql %>
10100 .Dq Dotmark :
10101 a space character but for the current message
10102 .Pf ( Dq dot ) ,
10103 for which it expands to
10104 .Ql >
10105 (dependent on
10106 .Va headline-plain ) .
10107 .It Ql %<
10108 .Dq Dotmark :
10109 a space character but for the current message
10110 .Pf ( Dq dot ) ,
10111 for which it expands to
10112 .Ql <
10113 (dependent on
10114 .Va headline-plain ) .
10115 .It Ql %$
10116 \*(OP The spam score of the message, as has been classified via the
10117 command
10118 .Ic spamrate .
10119 Shows only a replacement character if there is no spam support.
10120 .It Ql %a
10121 Message attribute character (status flag); the actual content can be
10122 adjusted by setting
10123 .Va attrlist .
10124 .It Ql %d
10125 The date found in the
10126 .Ql Date:
10127 header of the message when
10128 .Va datefield
10129 is set (the default), otherwise the date when the message was received.
10130 Formatting can be controlled by assigning a
10131 .Xr strftime 3
10132 format string to
10133 .Va datefield
10134 (and
10135 .Va datefield-markout-older ) .
10136 .It Ql %e
10137 The indenting level in
10138 .Ql thread Ns
10140 .Ic sort
10141 mode.
10142 .It Ql %f
10143 The address of the message sender.
10144 .It Ql %i
10145 The message thread tree structure.
10146 (Note that this format does not support a field width, and honours
10147 .Va headline-plain . )
10148 .It Ql %L
10149 Mailing list status: is the addressee of the message a known
10150 .Ql l
10151 .Pf ( Ic mlist )
10153 .Ql L
10154 .Ic mlsubscribe Ns
10155 d mailing list?
10156 The letter
10157 .Ql P
10158 announces the presence of a RFC 2369
10159 .Ql List-Post:
10160 header, which makes a message a valuable target of
10161 .Ic Lreply .
10162 .It Ql %l
10163 The number of lines of the message, if available.
10164 .It Ql %m
10165 Message number.
10166 .It Ql %o
10167 The number of octets (bytes) in the message, if available.
10168 .It Ql %S
10169 Message subject (if any) in double quotes.
10170 .It Ql %s
10171 Message subject (if any).
10172 .It Ql %t
10173 The position in threaded/sorted order.
10174 .It Ql \&%U
10175 The value 0 except in an IMAP mailbox,
10176 where it expands to the UID of the message.
10179 The default is
10180 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
10182 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
10184 .Va bsdcompat
10185 is set.
10186 Also see
10187 .Va attrlist ,
10188 .Va headline-plain
10190 .Va headline-bidi .
10194 .It Va headline-bidi
10195 Bidirectional text requires special treatment when displaying headers,
10196 because numbers (in dates or for file sizes etc.) will not affect the
10197 current text direction, in effect resulting in ugly line layouts when
10198 arabic or other right-to-left text is to be displayed.
10199 On the other hand only a minority of terminals is capable to correctly
10200 handle direction changes, so that user interaction is necessary for
10201 acceptable results.
10202 Note that extended host system support is required nonetheless, e.g.,
10203 detection of the terminal character set is one precondition;
10204 and this feature only works in an Unicode (i.e., UTF-8) locale.
10206 In general setting this variable will cause \*(UA to encapsulate text
10207 fields that may occur when displaying
10208 .Va headline
10209 (and some other fields, like dynamic expansions in
10210 .Va prompt )
10211 with special Unicode control sequences;
10212 it is possible to fine-tune the terminal support level by assigning
10213 a value:
10214 no value (or any value other than
10215 .Ql 1 ,
10216 .Ql 2
10218 .Ql 3 )
10219 will make \*(UA assume that the terminal is capable to properly deal
10220 with Unicode version 6.3, in which case text is embedded in a pair of
10221 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
10222 characters.
10223 In addition no space on the line is reserved for these characters.
10225 Weaker support is chosen by using the value
10226 .Ql 1
10227 (Unicode 6.3, but reserve the room of two spaces for writing the control
10228 sequences onto the line).
10229 The values
10230 .Ql 2
10232 .Ql 3
10233 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
10234 again reserves room for two spaces in addition.
10237 .It Va headline-plain
10238 \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are
10239 used by default for certain entries of
10240 .Va headline .
10241 If this variable is set only basic US-ASCII symbols will be used.
10244 .It Va history-file
10245 \*(OP The (expandable) location of a permanent
10246 .Ic history
10247 file for the MLE line editor
10248 .Pf ( Sx "On terminal control and line editor" ) .
10249 Also see
10250 .Va history-size .
10253 .It Va history-gabby
10254 \*(OP Add more entries to the MLE
10255 .Ic history
10256 as is normally done.
10257 A comma-separated list of case-insensitive strings can be used to
10258 fine-tune which gabby entries shall be allowed.
10259 If it contains
10260 .Ql errors ,
10261 erroneous commands will also be added.
10262 .Ql all
10263 adds all optional entries, and is the fallback chattiness identifier of
10264 .Va on-history-addition .
10267 .It Va history-gabby-persist
10268 \*(BO\*(OP The
10269 .Va history-gabby
10270 entries will not be saved in persistent storage unless this variable is set.
10271 The knowledge of whether a persistent entry was gabby is not lost.
10272 Also see
10273 .Va history-file .
10276 .It Va history-size
10277 \*(OP Setting this variable imposes a limit on the number of concurrent
10278 .Ic history
10279 entries.
10280 If set to the value 0 then no further history entries will be added,
10281 and loading and incorporation of the
10282 .Va history-file
10283 upon program startup can also be suppressed by doing this.
10284 Runtime changes will not be reflected before the
10285 .Ic history
10286 is saved or loaded (again).
10289 .It Va hold
10290 \*(BO This setting controls whether messages are held in the system
10291 .Va inbox ,
10292 and it is set by default.
10295 .It Va hostname
10296 Used instead of the value obtained from
10297 .Xr uname 3
10299 .Xr getaddrinfo 3
10300 as the hostname when expanding local addresses, for example in
10301 .Ql From:
10302 (also see
10303 .Sx "On sending mail, and non-interactive mode" ,
10304 for expansion of addresses that have a valid user-, but no domain
10305 name in angle brackets).
10306 If either of
10307 .Va from
10308 or this variable is set the message and MIME part related unique ID fields
10309 .Ql Message-ID:
10311 .Ql Content-ID:
10312 will be created (except when disallowed by
10313 .Va message-id-disable
10315 .Va stealthmua ) .
10316 If the \*(OPal IDNA support is available (see
10317 .Va idna-disable )
10318 variable assignment is aborted when a necessary conversion fails.
10320 Setting it to the empty string will cause the normal hostname to be
10321 used, but nonetheless enables creation of said ID fields.
10322 \*(IN in conjunction with the built-in SMTP
10323 .Va mta
10324 .Va smtp-hostname
10325 also influences the results:
10326 one should produce some test messages with the desired combination of
10327 .Va \&\&hostname ,
10328 and/or
10329 .Va from ,
10330 .Va sender
10331 etc. first.
10334 .It Va idna-disable
10335 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
10336 names according to the rules of IDNA (internationalized domain names
10337 for applications).
10338 Since the IDNA code assumes that domain names are specified with the
10339 .Va ttycharset
10340 character set, an UTF-8 locale charset is required to represent all
10341 possible international domain names (before conversion, that is).
10344 .It Va ifs
10345 The input field separator that is used (\*(ID by some functions) to
10346 determine where to split input data.
10348 .Bl -tag -compact -width ".It MMM"
10349 .It 1.
10350 Unsetting is treated as assigning the default value,
10351 .Ql \& \et\en .
10352 .It 2.
10353 If set to the empty value, no field splitting will be performed.
10354 .It 3.
10355 If set to a non-empty value, all whitespace characters are extracted
10356 and assigned to the variable
10357 .Va ifs-ws .
10360 .Bl -tag -compact -width ".It MMM"
10361 .It a.
10362 .Va \&\&ifs-ws
10363 will be ignored at the beginning and end of input.
10364 Diverging from POSIX shells default whitespace is removed in addition,
10365 which is owed to the entirely different line content extraction rules.
10366 .It b.
10367 Each occurrence of a character of
10368 .Va \&\&ifs
10369 will cause field-splitting, any adjacent
10370 .Va \&\&ifs-ws
10371 characters will be skipped.
10375 .It Va ifs-ws
10376 \*(RO Automatically deduced from the whitespace characters in
10377 .Va ifs .
10380 .It Va ignore
10381 \*(BO Ignore interrupt signals from the terminal while entering
10382 messages; instead echo them as
10383 .Ql @
10384 characters and discard the current line.
10387 .It Va ignoreeof
10388 \*(BO Ignore end-of-file conditions
10389 .Pf ( Ql control-D )
10390 in compose mode on message input and in interactive command input.
10391 If set an interactive command input session can only be left by
10392 explicitly using one of the commands
10393 .Ic exit
10395 .Ic quit ,
10396 and message input in compose mode can only be terminated by entering
10397 a period
10398 .Ql \&.
10399 on a line by itself or by using the
10400 .Ic ~.
10401 .Sx "COMMAND ESCAPES" ;
10402 Setting this implies the behaviour that
10403 .Va dot
10404 describes in
10405 .Va posix
10406 mode.
10409 .It Va inbox
10410 If this is set to a non-empty string it will specify the user's
10411 .Mx -sx
10412 .Sx "primary system mailbox" ,
10413 overriding
10414 .Ev MAIL
10415 and the system-dependent default, and (thus) be used to replace
10416 .Ql %
10417 when doing
10418 .Sx "Filename transformations" ;
10419 also see
10420 .Ic folder
10421 for more on this topic.
10422 The value supports a subset of transformations itself.
10424 .It Va indentprefix
10425 String used by the
10426 .Ic ~m , ~M
10428 .Ic ~R
10429 .Sx "COMMAND ESCAPES"
10430 and by the
10431 .Va quote
10432 option for indenting messages,
10433 in place of the POSIX mandated default tabulator character
10434 .Ql \et .
10435 Also see
10436 .Va quote-chars .
10439 .It Va keep
10440 \*(BO If set, an empty
10441 .Mx -sx
10442 .Sx "primary system mailbox"
10443 file is not removed.
10444 Note that, in conjunction with
10445 .Va posix
10446 mode any empty file will be removed unless this variable is set.
10447 This may improve the interoperability with other mail user agents
10448 when using a common folder directory, and prevents malicious users
10449 from creating fake mailboxes in a world-writable spool directory.
10450 \*(ID Only local regular (MBOX) files are covered, Maildir and other
10451 mailbox types will never be removed, even if empty.
10454 .It Va keep-content-length
10455 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
10456 be told to keep the
10457 .Ql Content-Length:
10459 .Ql Lines:
10460 header fields that some MUAs generate by setting this variable.
10461 Since \*(UA does neither use nor update these non-standardized header
10462 fields (which in itself shows one of their conceptual problems),
10463 stripping them should increase interoperability in between MUAs that
10464 work with with same mailbox files.
10465 Note that, if this is not set but
10466 .Va writebackedited ,
10467 as below, is, a possibly performed automatic stripping of these header
10468 fields already marks the message as being modified.
10469 \*(ID At some future time \*(UA will be capable to rewrite and apply an
10470 .Va mime-encoding
10471 to modified messages, and then those fields will be stripped silently.
10474 .It Va keepsave
10475 \*(BO When a message is saved it is usually discarded from the
10476 originating folder when \*(UA is quit.
10477 This setting causes all saved message to be retained.
10480 .It Va line-editor-cpl-word-breaks
10481 \*(OP List of bytes which are used by the
10482 .Cd mle-complete
10483 tabulator completion to decide where word boundaries exist, by default
10484 .Ql """'@=;|:
10485 \*(ID This mechanism is yet restricted.
10488 .It Va line-editor-disable
10489 \*(BO Turn off any line editing capabilities (from \*(UAs POW, see
10490 .Sx "On terminal control and line editor"
10491 for more).
10494 .It Va line-editor-no-defaults
10495 \*(BO\*(OP Do not establish any default key binding.
10498 .It Va log-prefix
10499 Error log message prefix string
10500 .Pf ( Ql "\*(uA: " ) .
10503 .It Va mailbox-display
10504 \*(RO The name of the current mailbox
10505 .Pf ( Ic folder ) ,
10506 possibly abbreviated for display purposes.
10509 .It Va mailbox-resolved
10510 \*(RO The fully resolved path of the current mailbox.
10513 .It Va mailcap-disable
10514 \*(BO\*(OP Turn off consideration of MIME type handlers from,
10515 and implicit loading of
10516 .Sx "The Mailcap files" .
10519 .It Va mailx-extra-rc
10520 An additional startup file that is loaded as the last of the
10521 .Sx "Resource files" .
10522 Use this file for commands that are not understood by other POSIX
10523 .Xr mailx 1
10524 implementations, i.e., mostly anything which is not covered by
10525 .Sx "Initial settings" .
10528 .It Va markanswered
10529 \*(BO When a message is replied to and this variable is set,
10530 it is marked as having been
10531 .Ic answered .
10532 See the section
10533 .Sx "Message states" .
10536 .It Va mbox-fcc-and-pcc
10537 \*(BO By default all file and pipe message receivers (see
10538 .Va expandaddr )
10539 will be fed valid MBOX database entry message data (see
10540 .Ic folder ,
10541 .Va mbox-rfc4155 ) ,
10542 and existing file targets will become extended in compliance to RFC 4155.
10543 If this variable is unset then a plain standalone RFC 5322 message will
10544 be written, and existing file targets will be overwritten.
10547 .It Va mbox-rfc4155
10548 \*(BO When opening MBOX mailbox databases, and in order to achieve
10549 compatibility with old software, the very tolerant POSIX standard rules
10550 for detecting message boundaries (so-called
10551 .Ql From_
10552 lines) are used instead of the stricter rules from the standard RFC 4155.
10553 This behaviour can be switched by setting this variable.
10555 This may temporarily be handy when \*(UA complains about invalid
10556 .Ql From_
10557 lines when opening a MBOX: in this case setting this variable and
10558 re-opening the mailbox in question may correct the result.
10559 If so, copying the entire mailbox to some other file, as in
10560 .Ql copy * SOME-FILE ,
10561 will perform proper, all-compatible
10562 .Ql From_
10563 quoting for all detected messages, resulting in a valid MBOX mailbox.
10564 (\*(ID The better and non-destructive approach is to re-encode invalid
10565 messages, as if it would be created anew, instead of mangling the
10566 .Ql From_
10567 lines; this requires the structural code changes of the v15 rewrite.)
10568 Finally the variable can be unset again:
10569 .Bd -literal -offset indent
10570 define mboxfix {
10571   localopts yes; wysh set mbox-rfc4155;\e
10572     wysh File "${1}"; copy * "${2}"
10574 call mboxfix /tmp/bad.mbox /tmp/good.mbox
10578 .It Va memdebug
10579 \*(BO Internal development variable.
10580 (Keeps memory debug enabled even if
10581 .Va debug
10582 is not set.)
10585 .It Va message-id-disable
10586 \*(BO By setting this variable the generation of
10587 .Ql Message-ID:
10589 .Ql Content-ID:
10590 message and MIME part headers can be completely suppressed, effectively
10591 leaving this task up to the
10592 .Va mta
10593 (Mail-Transfer-Agent) or the SMTP server.
10594 Note that according to RFC 5321 a SMTP server is not required to add this
10595 field by itself, so it should be ensured that it accepts messages without
10596 .Ql Message-ID .
10599 .It Va message-inject-head
10600 A string to put at the beginning of each new message, followed by a newline.
10601 \*(OB The escape sequences tabulator
10602 .Ql \et
10603 and newline
10604 .Ql \en
10605 are understood (use the
10606 .Cm wysh
10607 prefix when
10608 .Ic set Ns
10609 ting the variable(s) instead).
10612 .It Va message-inject-tail
10613 A string to put at the end of each new message, followed by a newline.
10614 \*(OB The escape sequences tabulator
10615 .Ql \et
10616 and newline
10617 .Ql \en
10618 are understood (use the
10619 .Cm wysh
10620 prefix when
10621 .Ic set Ns
10622 ting the variable(s) instead).
10623 Also see
10624 .Va on-compose-leave .
10627 .It Va metoo
10628 \*(BO Usually, when an
10629 .Ic alias
10630 expansion contains the sender, the sender is removed from the expansion.
10631 Setting this option suppresses these removals.
10632 Note that a set
10633 .Va metoo
10634 also causes a
10635 .Ql -m
10636 option to be passed through to the
10637 .Va mta
10638 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
10639 this flag, no MTA is known which does not support it (for historical
10640 compatibility).
10643 .It Va mime-allow-text-controls
10644 \*(BO When sending messages, each part of the message is MIME-inspected
10645 in order to classify the
10646 .Ql Content-Type:
10648 .Ql Content-Transfer-Encoding:
10649 (see
10650 .Va mime-encoding )
10651 that is required to send this part over mail transport, i.e.,
10652 a computation rather similar to what the
10653 .Xr file 1
10654 command produces when used with the
10655 .Ql --mime
10656 option.
10658 This classification however treats text files which are encoded in
10659 UTF-16 (seen for HTML files) and similar character sets as binary
10660 octet-streams, forcefully changing any
10661 .Ql text/plain
10663 .Ql text/html
10664 specification to
10665 .Ql application/octet-stream :
10666 If that actually happens a yet unset charset MIME parameter is set to
10667 .Ql binary ,
10668 effectively making it impossible for the receiving MUA to automatically
10669 interpret the contents of the part.
10671 If this variable is set, and the data was unambiguously identified as
10672 text data at first glance (by a
10673 .Ql .txt
10675 .Ql .html
10676 file extension), then the original
10677 .Ql Content-Type:
10678 will not be overwritten.
10681 .It Va mime-alternative-favour-rich
10682 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
10683 HTML) will be preferred in favour of included plain text versions when
10684 displaying messages, provided that a handler exists which produces
10685 output that can be (re)integrated into \*(UA's normal visual display.
10688 .It Va mime-counter-evidence
10689 Normally the
10690 .Ql Content-Type:
10691 field is used to decide how to handle MIME parts.
10692 Some MUAs, however, do not use
10693 .Sx "The mime.types files"
10694 (also see
10695 .Sx "HTML mail and MIME attachments" )
10696 or a similar mechanism to correctly classify content, but specify an
10697 unspecific MIME type
10698 .Pf ( Ql application/octet-stream )
10699 even for plain text attachments.
10700 If this variable is set then \*(UA will try to re-classify such MIME
10701 message parts, if possible, for example via a possibly existing
10702 attachment filename.
10703 A non-empty value may also be given, in which case a number is expected,
10704 actually a carrier of bits, best specified as a binary value, like
10705 .Ql 0b1111 .
10707 .Bl -bullet -compact
10709 If bit two is set (counting from 1, decimal 2) then the detected
10710 .Ic mimetype
10711 will be carried along with the message and be used for deciding which
10712 MIME handler is to be used, for example;
10713 when displaying such a MIME part the part-info will indicate the
10714 overridden content-type by showing a plus sign
10715 .Ql + .
10717 If bit three is set (decimal 4) then the counter-evidence is always
10718 produced and a positive result will be used as the MIME type, even
10719 forcefully overriding the parts given MIME type.
10721 If bit four is set (decimal 8) as a last resort the actual content of
10722 .Ql application/octet-stream
10723 parts will be inspected, so that data which looks like plain text can be
10724 treated as such.
10725 This mode is even more relaxed when data is to be displayed to the user
10726 or used as a message quote (data consumers which mangle data for display
10727 purposes, which includes masking of control characters, for example).
10732 .It Va mime-encoding
10733 The MIME
10734 .Ql Content-Transfer-Encoding
10735 to use in outgoing text messages and message parts, where applicable
10736 (7-bit clean text messages are without an encoding if possible):
10739 .Bl -tag -compact -width ".It Ql _%%_"
10740 .It Ql 8bit
10741 .Pf (Or\0 Ql 8b . )
10742 8-bit transport effectively causes the raw data be passed through
10743 unchanged, but may cause problems when transferring mail messages over
10744 channels that are not ESMTP (RFC 1869) compliant.
10745 Also, several input data constructs are not allowed by the
10746 specifications and may cause a different transfer-encoding to be used.
10747 By established rules and popular demand occurrences of
10748 .Ql ^From_
10749 (see
10750 .Va mbox-rfc4155 )
10751 will be MBOXO quoted (prefixed with greater-than sign
10752 .Ql > )
10753 instead of causing a non-destructive encoding like
10754 .Ql quoted-printable
10755 to be chosen, unless context (like message signing) requires otherwise.
10757 .It Ql quoted-printable
10758 .Pf (Or\0 Ql qp . )
10759 Quoted-printable encoding is 7-bit clean and has the property that ASCII
10760 characters are passed through unchanged, so that an english message can
10761 be read as-is; it is also acceptable for other single-byte locales that
10762 share many characters with ASCII, for example ISO-8859-1.
10763 The encoding will cause a large overhead for messages in other character
10764 sets: for example it will require up to twelve (12) bytes to encode
10765 a single UTF-8 character of four (4) bytes.
10766 It is the default encoding.
10768 .It Ql base64
10769 .Pf (Or\0 Ql b64 . )
10770 This encoding is 7-bit clean and will always be used for binary data.
10771 This encoding has a constant input:output ratio of 3:4, regardless of
10772 the character set of the input data it will encode three bytes of input
10773 to four bytes of output.
10774 This transfer-encoding is not human readable without performing
10775 a decoding step.
10780 .It Va mime-force-sendout
10781 \*(BO\*(OP Whenever it is not acceptable to fail sending out messages
10782 because of non-convertible character content this variable may be set.
10783 It will, as a last resort, classify the part content as
10784 .Ql application/octet-stream .
10785 Please refer to the section
10786 .Sx "Character sets"
10787 for the complete picture of character set conversion in \*(UA.
10790 .It Va mimetypes-load-control
10791 Can be used to control which of
10792 .Sx "The mime.types files"
10793 are loaded: if the letter
10794 .Ql u
10795 is part of the option value, then the user's personal
10796 .Pa \*(vU
10797 file will be loaded (if it exists); likewise the letter
10798 .Ql s
10799 controls loading of the system wide
10800 .Pa \*(vS ;
10801 directives found in the user file take precedence, letter matching is
10802 case-insensitive.
10803 If this variable is not set \*(UA will try to load both files.
10804 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
10805 but they will be matched last (the order can be listed via
10806 .Ic mimetype ) .
10808 More sources can be specified by using a different syntax: if the
10809 value string contains an equals sign
10810 .Ql =
10811 then it is instead parsed as a comma-separated list of the described
10812 letters plus
10813 .Ql f=FILENAME
10814 pairs; the given filenames will be expanded and loaded, and their
10815 content may use the extended syntax that is described in the section
10816 .Sx "The mime.types files" .
10817 Directives found in such files always take precedence (are prepended to
10818 the MIME type cache).
10822 .It Va mta
10823 Select an alternate Mail-Transfer-Agent by either specifying the full
10824 pathname of an executable (a
10825 .Ql file://
10826 prefix may be given), or \*(OPally a SMTP aka SUBMISSION protocol URL \*(IN:
10828 .Dl submissions://[user[:password]@]server[:port]
10830 (\*(OU:
10831 .Ql [smtp://]server[:port] . )
10832 The default has been chosen at compile time.
10833 MTA data transfers are always performed in asynchronous child processes,
10834 and without supervision unless either the
10835 .Va sendwait
10836 or the
10837 .Va verbose
10838 variable is set.
10839 .Ql Bcc:
10840 headers are not passed through to MTAs as part of messages unless
10841 .Va mta-bcc-ok
10842 is set (see there); corresponding receivers are addressed by
10843 protocol-specific means or MTA command line options only until then.
10844 \*(OPally expansion of the well-known
10845 .Va mta-aliases
10846 .Pf ( Xr aliases 5 )
10847 can also be directly performed by \*(UA.
10850 For testing purposes there is the
10851 .Ql test
10852 pseudo-MTA, which dumps to standard output or optionally to a file,
10853 and honours
10854 .Va mbox-fcc-and-pcc :
10856 .Bd -literal -offset indent
10857 $ echo text | \*(uA -:/ -Smta=test -s ubject ex@am.ple
10858 $ </dev/null \*(uA -:/ -Smta=test://./xy ex@am.ple
10862 For a file-based MTA it may be necessary to set
10863 .Va mta-argv0
10864 in in order to choose the right target of a modern
10865 .Xr mailwrapper 8
10866 environment.
10867 It will be passed command line arguments from several possible sources:
10868 from the variable
10869 .Va mta-arguments
10870 if set, from the command line if given and the variable
10871 .Va expandargv
10872 allows their use.
10873 Argument processing of the MTA will be terminated with a
10874 .Fl \&\&-
10875 separator.
10878 The otherwise occurring implicit usage of the following MTA command
10879 line arguments can be disabled by setting the boolean variable
10880 .Va mta-no-default-arguments
10881 (which will also disable passing
10882 .Fl \&\&-
10883 to the MTA):
10884 .Fl \&\&i
10885 (for not treating a line with only a dot
10886 .Ql \&.
10887 character as the end of input),
10888 .Fl \&\&m
10889 (shall the variable
10890 .Va metoo
10891 be set) and
10892 .Fl \&\&v
10893 (if the
10894 .Va verbose
10895 variable is set); in conjunction with the
10896 .Fl r
10897 command line option \*(UA will also (not) pass
10898 .Fl \&\&f
10899 as well as possibly
10900 .Fl \&\&F .
10903 \*(OPally \*(UA can send mail over SMTP aka SUBMISSION network
10904 connections to a single defined smart host by setting this variable to
10905 a SMTP or SUBMISSION URL (see
10906 .Sx "On URL syntax and credential lookup" ) .
10907 An authentication scheme can be specified via the variable chain
10908 .Va smtp-auth .
10909 Encrypted network connections are \*(OPally available, the section
10910 .Sx "Encrypted network communication"
10911 should give an overview and provide links to more information on this.
10912 Note that with some mail providers it may be necessary to set the
10913 .Va smtp-hostname
10914 variable in order to use a specific combination of
10915 .Va from ,
10916 .Va hostname
10918 .Va mta .
10919 Network communication socket timeouts are configurable via
10920 .Va socket-connect-timeout .
10921 All generated network traffic may be proxied over a SOCKS
10922 .Va socks-proxy ,
10923 it can be logged by setting
10924 .Va verbose
10925 twice.
10926 The following SMTP variants may be used:
10928 .Bl -bullet
10930 The plain SMTP protocol (RFC 5321) that normally lives on the
10931 server port 25 and requires setting the
10932 .Va smtp-use-starttls
10933 variable to enter a TLS encrypted session state.
10934 Assign a value like \*(IN
10935 .Ql smtp://[user[:password]@]server[:port]
10936 (\*(OU
10937 .Ql smtp://server[:port] )
10938 to choose this protocol.
10940 The so-called SMTPS which is supposed to live on server port 465
10941 and is automatically TLS secured.
10942 Unfortunately it never became a standardized protocol and may thus not
10943 be supported by your hosts network service database
10944 \(en in fact the port number has already been reassigned to other
10945 protocols!
10947 SMTPS is nonetheless a commonly offered protocol and thus can be
10948 chosen by assigning a value like \*(IN
10949 .Ql smtps://[user[:password]@]server[:port]
10950 (\*(OU
10951 .Ql smtps://server[:port] ) ;
10952 due to the mentioned problems it is usually necessary to explicitly
10953 specify the port as
10954 .Ql :465 ,
10955 however.
10957 The SUBMISSION protocol (RFC 6409) lives on server port 587 and
10958 is identically to the SMTP protocol from \*(UA's point of view;
10959 it requires setting
10960 .Va smtp-use-starttls
10961 to enter a TLS secured session state; e.g., \*(IN
10962 .Ql submission://[user[:password]@]server[:port] .
10964 The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is
10965 TLS secured by default.
10966 It can be chosen by assigning a value like \*(IN
10967 .Ql submissions://[user[:password]@]server[:port] .
10968 Due to the problems mentioned for SMTPS above and the fact that
10969 SUBMISSIONS is new and a successor that lives on the same port as the
10970 historical engineering mismanagement named SMTPS, it is usually
10971 necessary to explicitly specify the port as
10972 .Ql :465 .
10977 .It Va mta-aliases
10978 \*(OP If set to a path pointing to a text file in valid MTA (Postfix)
10979 .Xr aliases 5
10980 format, the file is loaded and cached (manageable with
10981 .Ic mtaaliases ) ,
10982 and henceforth plain
10983 .Ql name
10984 (see
10985 .Va expandaddr )
10986 message receiver names are recursively expanded as a last expansion
10987 step, after the distribution lists which can be created with
10988 .Ic alias .
10989 Constraints on
10990 .Xr \&\&aliases 5
10991 content support: only local addresses (names) which are valid usernames
10992 .Pf ( Ql [a-z_][a-z0-9_-]*[$]? )
10993 are treated as expandable aliases, and \*(ID
10994 .Ql :include:/file/name
10995 directives are not supported.
10996 By including
10997 .Ql -name
10999 .Va expandaddr
11000 it can be asserted that only expanded names (mail addresses) are passed
11001 through to the MTA.
11004 .It Va mta-arguments
11005 Arguments to pass through to a file-based
11006 .Va mta
11007 can be given via this variable, which is parsed according to
11008 .Sx "Shell-style argument quoting"
11009 into an array of arguments, and which will be joined onto MTA options
11010 from other sources, and then passed individually to the MTA:
11011 .Ql \&? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
11014 .It Va mta-no-default-arguments
11015 \*(BO Unless this variable is set \*(UA will pass some well known
11016 standard command line options to a file-based
11017 .Va mta
11018 (Mail-Transfer-Agent), see there for more.
11021 .It Va mta-no-receiver-arguments
11022 \*(BO By default a file-based
11023 .Va mta
11024 will be passed all receiver addresses on the command line.
11025 Some MTAs impose special behaviour on such arguments, so setting this
11026 variable will suppress them altogether.
11027 This can make it necessary to pass a
11028 .Fl \&\&t
11030 .Va mta-arguments .
11033 .It Va mta-argv0
11034 Many systems use a so-called
11035 .Xr mailwrapper 8
11036 environment to ensure compatibility with
11037 .Xr sendmail 1 .
11038 This works by inspecting the name that was used to invoke the mail
11039 delivery system.
11040 If this variable is set then the mailwrapper (the program that is
11041 actually executed when calling the file-based
11042 .Va mta )
11043 will treat its contents as that name.
11046 .It Va mta-bcc-ok
11047 \*(BO By default
11048 .Ql Bcc:
11049 header lines are not passed through since some MTAs do not remove them
11050 before sending them over the wire, in violation of RFC 5322.
11051 (For example Exim and Courier would need to be started with the
11052 .Fl \&\&t
11053 command line option to force stripping.)
11054 Setting this enables pass-through, therefore avoids generation of
11055 mutilated message versions, and \*(ID improves performance.
11057 .Mx Va netrc-lookup
11058 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
11059 \*(BO\*(IN\*(OP Used to control usage of the user's
11060 .Pa \*(VN
11061 file for lookup of account credentials, as documented in the section
11062 .Sx "On URL syntax and credential lookup"
11063 and for the command
11064 .Ic netrc ;
11065 the section
11066 .Sx "The .netrc file"
11067 documents the file format.
11068 Also see
11069 .Va netrc-pipe .
11072 .It Va netrc-pipe
11073 \*(IN\*(OP When
11074 .Pa \*(VN
11075 is loaded (see
11076 .Ic netrc
11078 .Va netrc-lookup )
11079 then \*(UA will read the output of a shell pipe instead of the user's
11080 .Pa \*(VN
11081 file if this variable is set (to the desired shell command).
11082 This can be used to, for example, store
11083 .Pa \*(VN
11084 in encrypted form:
11085 .Ql \&? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
11088 .It Va newfolders
11089 \*(OP If this variable has the value
11090 .Ql maildir ,
11091 newly created local folders will be in Maildir instead of MBOX format.
11094 .It Va newmail
11095 Checks for new mail in the current folder each time the prompt is shown.
11096 A Maildir folder must be re-scanned to determine if new mail has arrived.
11097 If this variable is set to the special value
11098 .Ql nopoll
11099 then a Maildir folder will not be rescanned completely, but only
11100 timestamp changes are detected.
11101 Maildir folders are \*(OPal.
11104 .It Va outfolder
11105 \*(BO Causes a non-absolute filename specified in
11106 .Va record ,
11107 as well as the sender-based filenames of the
11108 .Ic Copy ,
11109 .Ic Save ,
11110 .Ic Followup
11112 .Ic followup
11113 commands to be interpreted relative to the
11114 .Va folder
11115 directory rather than relative to the current directory.
11117 .Mx Va on-account-cleanup
11118 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
11119 Macro hook which will be called once an
11120 .Ic account
11121 is left, as the very last step before unrolling per-account
11122 .Ic localopts .
11123 This hook is run even in case of fatal errors, including those generated
11124 by switching to the account as such, and it is advisable to perform only
11125 absolutely necessary actions, like cleaning up
11126 .Ic alternates ,
11127 for example.
11128 The specialized form is used in favour of the generic one if found.
11131 .It Va on-compose-cleanup
11132 Macro hook which will be called after the message has been sent (or not,
11133 in case of failures), as the very last step before unrolling compose mode
11134 .Ic localopts .
11135 This hook is run even in case of fatal errors, and it is advisable to
11136 perform only absolutely necessary actions, like cleaning up
11137 .Ic alternates ,
11138 for example.
11140 For compose mode hooks that may affect the message content please see
11141 .Va on-compose-enter , on-compose-leave , on-compose-splice .
11142 \*(ID This hook exists because
11143 .Ic alias , alternates , commandalias , shortcut ,
11144 to name a few, are neither covered by
11145 .Ic localopts
11146 nor by
11147 .Cm local :
11148 changes applied in compose mode will continue to be in effect thereafter.
11153 .It Va on-compose-enter , on-compose-leave
11154 Macro hooks which will be called once compose mode is entered,
11155 and after composing has been finished, respectively;
11156 the exact order of the steps taken is documented for
11157 .Ic ~. ,
11158 one of the
11159 .Sx "COMMAND ESCAPES" .
11160 Context about the message being worked on can be queried via
11161 .Ic digmsg .
11162 .Ic localopts
11163 are enabled for these hooks, and changes on variables will be forgotten
11164 after the message has been sent.
11165 .Va on-compose-cleanup
11166 can be used to perform other necessary cleanup steps.
11169 Here is an example that injects a signature via
11170 .Va message-inject-tail ;
11171 instead using
11172 .Va on-compose-splice
11173 to simply inject the file of desire via
11174 .Ic ~<
11176 .Ic ~<!
11177 may be a better approach.
11179 .Bd -literal -offset indent
11180 define t_ocl {
11181   vput ! i cat ~/.mysig
11182   if $? -eq 0
11183      vput csop message-inject-tail trim-end $i
11184   end
11186   # Alternatively
11187   readctl create ~/.mysig
11188   if $? -eq 0
11189     readall i
11190     if $? -eq 0
11191       vput csop message-inject-tail trim-end $i
11192     end
11193     readctl remove ~/.mysig
11194   end
11196 set on-compose-leave=t_ocl
11202 .It Va on-compose-splice , on-compose-splice-shell
11203 These hooks run once the normal compose mode is finished, but before the
11204 .Va on-compose-leave
11205 macro hook is called etc.
11206 Both hooks will be executed in a subprocess, with their input and output
11207 connected to \*(UA such that they can act as if they would be an
11208 interactive user.
11209 The difference in between them is that the latter is a
11210 .Ev SHELL
11211 command, whereas the former is a normal
11212 .Ic define Ns
11213 d macro, but which is restricted to a small set of commands (the
11214 .Va verbose
11215 output of for example
11216 .Ic list
11217 will indicate said capability).
11218 .Ic localopts
11219 are enabled for these hooks (in the parent process), causing any setting
11220 to be forgotten after the message has been sent;
11221 .Va on-compose-cleanup
11222 can be used to perform other cleanup as necessary.
11225 During execution of these hooks \*(UA will temporarily forget whether it
11226 has been started in interactive mode, (a restricted set of)
11227 .Sx "COMMAND ESCAPES"
11228 will always be available, and for guaranteed reproducibilities sake
11229 .Va escape
11231 .Va ifs
11232 will be set to their defaults.
11233 The compose mode command
11234 .Ic ~^
11235 has been especially designed for scriptability (via these hooks).
11236 The first line the hook will read on its standard input is the protocol
11237 version of said command escape, currently
11238 .Dq 0 0 2 :
11239 backward incompatible protocol changes have to be expected.
11242 Care must be taken to avoid deadlocks and other false control flow:
11243 if both involved processes wait for more input to happen at the
11244 same time, or one does not expect more input but the other is stuck
11245 waiting for consumption of its output, etc.
11246 There is no automatic synchronization of the hook: it will not be
11247 stopped automatically just because it, e.g., emits
11248 .Ql ~x .
11249 The hooks will however receive a termination signal if the parent enters
11250 an error condition.
11251 \*(ID Protection against and interaction with signals is not yet given;
11252 it is likely that in the future these scripts will be placed in an
11253 isolated session, which is signalled in its entirety as necessary.
11255 .Bd -literal -offset indent
11256 define ocs_signature {
11257   read version
11258   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
11260 set on-compose-splice=ocs_signature
11262 wysh set on-compose-splice-shell=$'\e
11263   read version;\e
11264   printf "hello $version!  Headers: ";\e
11265   echo \e'~^header list\e';\e
11266   read status result;\e
11267   echo "status=$status result=$result";\e
11268   '
11270 define ocsm {
11271   read version
11272   echo Splice protocol version is $version
11273   echo '~^h l'; read hl; vput csop es subs "${hl}" 0 1
11274   if "$es" != 2
11275     echoerr 'Cannot read header list'; echo '~x'; xit
11276   endif
11277   if "$hl" !%?case ' cc'
11278     echo '~^h i cc "Diet is your <mirr.or>"'; read es;\e
11279       vput csop es substring "${es}" 0 1
11280     if "$es" != 2
11281       echoerr 'Cannot insert Cc: header'; echo '~x'
11282       # (no xit, macro finishes anyway)
11283     endif
11284   endif
11286 set on-compose-splice=ocsm
11291 .It Va on-history-addition
11292 This hook will be called if an entry is about to be added to the
11293 .Ic history
11294 of the MLE, as documented in
11295 .Sx "On terminal control and line editor" .
11296 It will be called with three arguments: the first is the name of the
11297 input context (see
11298 .Ic bind ) ,
11299 the second is either an empty string or the matching
11300 .Va history-gabby
11301 type, and the third being the complete command line to be added.
11302 The entry will not be added to history if the hook uses a non-0
11303 .Ic return .
11304 \*(ID A future version will give the expanded command name as the third
11305 argument, followed by the tokenized command line as parsed in the
11306 remaining arguments, the first of which is the original unexpanded
11307 command name; i.e., one may do
11308 .Ql Ic shift Ns \| 4
11309 and will then be able to access the positional parameters as usual via
11310 .Va * , # , 1
11311 etc.
11314 .It Va on-main-loop-tick
11315 This hook will be called whenever the program's main event loop is
11316 about to read the next input line.
11317 Note variable and other changes it performs are not scoped as via
11318 .Ic localopts !
11321 .It Va on-program-exit
11322 This hook will be called when the program exits, whether via
11323 .Ic exit
11325 .Ic quit ,
11326 or because the send mode is done.
11329 .It Va on-resend-cleanup
11330 \*(ID Identical to
11331 .Va on-compose-cleanup ,
11332 but is only triggered by
11333 .Ic resend .
11336 .It Va on-resend-enter
11337 \*(ID Identical to
11338 .Va on-compose-enter ,
11339 but is only triggered by
11340 .Ic resend ;
11341 currently there is no
11342 .Ic digmsg
11343 support, for example.
11346 .It Va page
11347 \*(BO If set, each message feed through the command given for
11348 .Ic pipe
11349 is followed by a formfeed character
11350 .Ql \ef .
11352 .Mx Va password
11353 .It Va password-USER@HOST , password-HOST , password
11354 \*(IN Variable chain that sets a password, which is used in case none has
11355 been given in the protocol and account-specific URL;
11356 as a last resort \*(UA will ask for a password on the user's terminal if
11357 the authentication method requires a password.
11358 Specifying passwords in a startup file is generally a security risk;
11359 the file should be readable by the invoking user only.
11361 .It Va password-USER@HOST
11362 \*(OU (see the chain above for \*(IN)
11363 Set the password for
11364 .Ql USER
11365 when connecting to
11366 .Ql HOST .
11367 If no such variable is defined for a host,
11368 the user will be asked for a password on standard input.
11369 Specifying passwords in a startup file is generally a security risk;
11370 the file should be readable by the invoking user only.
11373 .It Va piperaw
11374 \*(BO Send messages to the
11375 .Ic pipe
11376 command without performing MIME and character set conversions.
11380 .It Va pipe-TYPE/SUBTYPE
11381 When a MIME message part of type
11382 .Ql TYPE/SUBTYPE
11383 (case-insensitive) is displayed or quoted,
11384 its text is filtered through the value of this variable interpreted as
11385 a shell command.
11386 Note that only parts which can be displayed inline as plain text (see
11387 .Cd copiousoutput )
11388 are displayed unless otherwise noted, other MIME parts will only be
11389 considered by and for the command
11390 .Ic mimeview .
11393 The special value question mark
11394 .Ql \&?
11395 forces interpretation of the message part as plain text, for example
11396 .Ql set pipe-application/xml=?
11397 will henceforth display XML
11398 .Dq as is .
11399 (The same could also be achieved by adding a MIME type marker with the
11400 .Ic mimetype
11401 command.
11402 And \*(OPally MIME type handlers may be defined via
11403 .Sx "The Mailcap files"
11404 \(em these directives,
11405 .Cd copiousoutput
11406 has already been used, should be referred to for further documentation.
11409 The question mark
11410 .Ql \&?
11411 can in fact be used as a trigger character to adjust usage and behaviour
11412 of a following shell command specification more thoroughly by appending
11413 more special characters which refer to further mailcap directives, for
11414 example the following hypothetical command specification could be used:
11416 .Bd -literal -offset indent
11417 ? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}'
11421 .Bl -tag -compact -width ".It Ql __"
11422 .It Ql *
11423 The command produces plain text to be integrated in \*(UAs output:
11424 .Cd copiousoutput .
11426 .It Ql #
11427 If set the handler will not be invoked when a message is to be quoted,
11428 but only when it will be displayed:
11429 .Cd x-mailx-noquote .
11431 .It Ql &
11432 Run the command asynchronously, i.e., without blocking \*(UA:
11433 .Cd x-mailx-async .
11434 The standard output of the command will go to
11435 .Pa /dev/null .
11437 .It Ql \&!
11438 The command must be run on an interactive terminal, \*(UA will
11439 temporarily release the terminal to it:
11440 .Cd needsterminal .
11442 .It Ql +
11443 Request creation of a zero-sized temporary file, the absolute pathname
11444 of which will be made accessible via the environment variable
11445 .Ev MAILX_FILENAME_TEMPORARY :
11446 .Cd x-mailx-tmpfile .
11447 If given twice then the file will be unlinked automatically by \*(UA
11448 when the command loop is entered again at latest:
11449 .Cd x-mailx-tmpfile-unlink ;
11450 it is an error to use automatic deletion in conjunction with
11451 .Cd x-mailx-async .
11453 .It Ql =
11454 Normally the MIME part content is passed to the handler via standard
11455 input; if this flag is set then the data will instead be written into
11456 .Ev MAILX_FILENAME_TEMPORARY
11457 .Pf ( Cd x-mailx-tmpfile-fill ) ,
11458 the creation of which is implied; in order to cause automatic deletion
11459 of the temporary file two plus signs
11460 .Ql ++
11461 still have to be used.
11463 .It Ql \&?
11464 To avoid ambiguities with normal shell command content another
11465 question mark can be used to forcefully terminate interpretation of
11466 remaining characters.
11467 (Any character not in this list will have the same effect.)
11471 Some information about the MIME part to be displayed is embedded into
11472 the environment of the shell command:
11475 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
11477 .It Ev MAILX_CONTENT
11478 The MIME content-type of the part, if known, the empty string otherwise.
11481 .It Ev MAILX_CONTENT_EVIDENCE
11483 .Va mime-counter-evidence
11484 includes the carry-around-bit (2), then this will be set to the detected
11485 MIME content-type; not only then identical to
11486 .Ev \&\&MAILX_CONTENT
11487 otherwise.
11490 .It Ev MAILX_EXTERNAL_BODY_URL
11491 MIME parts of type
11492 .Ql message/external-body access-type=url
11493 will store the access URL in this variable, it is empty otherwise.
11494 URL targets should not be activated automatically, without supervision.
11497 .It Ev MAILX_FILENAME
11498 The filename, if any is set, the empty string otherwise.
11501 .It Ev MAILX_FILENAME_GENERATED
11502 A random string.
11505 .It Ev MAILX_FILENAME_TEMPORARY
11506 If temporary file creation has been requested through the command prefix
11507 this variable will be set and contain the absolute pathname of the
11508 temporary file.
11513 .It Va pipe-EXTENSION
11514 This is identical to
11515 .Va pipe-TYPE/SUBTYPE
11516 except that
11517 .Ql EXTENSION
11518 (normalized to lowercase using character mappings of the ASCII charset)
11519 names a file extension, for example
11520 .Ql xhtml .
11521 Handlers registered using this method take precedence.
11523 .Mx Va pop3-auth
11524 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
11525 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
11526 Supported are the default
11527 .Ql plain ,
11528 \*(IN
11529 .Ql oauthbearer
11530 (see
11531 .Sx FAQ
11532 entry
11533 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) ,
11534 as well as \*(IN
11535 .Ql external
11537 .Ql externanon
11538 for TLS secured connections which pass a client certificate via
11539 .Va tls-config-pairs .
11540 There may be the \*(OPal method \*(IN
11541 .Ql gssapi .
11542 .Ql externanon
11543 does not need any user credentials,
11544 .Ql external
11546 .Ql gssapi
11547 need a
11548 .Va user ,
11549 the remains also require a
11550 .Va password .
11551 .Ql externanon
11552 solely builds upon the credentials passed via a client certificate,
11553 and is usually the way to go since tested servers do not actually follow
11554 RFC 4422, and fail if additional credentials are actually passed.
11555 Unless
11556 .Va pop3-no-apop
11557 is set the
11558 .Ql plain
11559 method will \*(OPally be replaced with APOP if possible (see there).
11561 .Mx Va pop3-bulk-load
11562 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
11563 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
11564 the messages, and only requests the message bodies on user request.
11565 For the POP3 protocol this means that the message headers will be
11566 downloaded twice.
11567 If this variable is set then \*(UA will download only complete messages
11568 from the given POP3 server(s) instead.
11570 .Mx Va pop3-keepalive
11571 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
11572 \*(OP POP3 servers close the connection after a period of inactivity;
11573 the standard requires this to be at least 10 minutes,
11574 but practical experience may vary.
11575 Setting this variable to a numeric value greater than
11576 .Ql 0
11577 causes a
11578 .Ql NOOP
11579 command to be sent each value seconds if no other operation is performed.
11581 .Mx Va pop3-no-apop
11582 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
11583 \*(BO\*(OP Unless this variable is set the MD5 based
11584 .Ql APOP
11585 authentication method will be used instead of a chosen
11586 .Ql plain
11587 .Va pop3-auth
11588 when connecting to a POP3 server that advertises support.
11589 The advantage of
11590 .Ql APOP
11591 is that only a single packet is sent for the user/password tuple.
11592 (Originally also that the password is not sent in clear text over the
11593 wire, but for one MD5 does not any longer offer sufficient security,
11594 and then today transport is almost ever TLS secured.)
11595 Note that
11596 .Va pop3-no-apop-HOST
11597 requires \*(IN.
11599 .Mx Va pop3-use-starttls
11600 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
11601 \*(BO\*(OP Causes \*(UA to issue a
11602 .Ql STLS
11603 command to make an unencrypted POP3 session TLS encrypted.
11604 This functionality is not supported by all servers,
11605 and is not used if the session is already encrypted by the POP3S method.
11606 Note that
11607 .Va pop3-use-starttls-HOST
11608 requires \*(IN.
11612 .It Va posix
11613 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
11614 where that deviates from standardized behaviour.
11615 It is automatically squared with the environment variable
11616 .Ev POSIXLY_CORRECT ,
11617 changing the one will adjust the other.
11618 The following behaviour is covered and enforced by this mechanism:
11621 .Bl -bullet -compact
11623 In non-interactive mode, any error encountered while loading resource
11624 files during program startup will cause a program exit, whereas in
11625 interactive mode such errors will stop loading of the currently loaded
11626 (stack of) file(s, i.e., recursively).
11627 These exits can be circumvented on a per-command base by using
11628 .Cm ignerr ,
11629 one of the
11630 .Sx "Command modifiers" ,
11631 for each command which shall be allowed to fail.
11634 .Ic alternates
11635 will replace the list of alternate addresses instead of appending to it.
11636 In addition alternates will only be honoured for any sort of message
11637 .Ic reply ,
11638 and for aliases.
11641 The variable inserting
11642 .Sx "COMMAND ESCAPES"
11643 .Ic ~A ,
11644 .Ic ~a ,
11645 .Ic ~I
11647 .Ic ~i
11648 will expand embedded character sequences
11649 .Ql \et
11650 horizontal tabulator and
11651 .Ql \en
11652 line feed.
11653 \*(ID For compatibility reasons this step will always be performed.
11656 Reading in messages via
11657 .Ic ~f
11658 .Pf ( Sx "COMMAND ESCAPES" )
11659 will use the
11660 .Ql type
11661 not the
11662 .Ql forward
11663 .Ic headerpick
11664 selection.
11667 Upon changing the active
11668 .Ic folder
11669 no summary of
11670 .Ic headers
11671 will be displayed even if
11672 .Va header
11673 is set.
11676 Setting
11677 .Va ignoreeof
11678 implies the behaviour described by
11679 .Va dot .
11682 The variable
11683 .Va keep
11684 is extended to cover any empty mailbox, not only empty
11685 .Mx -sx
11686 .Sx "primary system mailbox" Ns
11687 es: they will be removed when they are left in empty state otherwise.
11692 .It Va print-alternatives
11693 \*(BO When a MIME message part of type
11694 .Ql multipart/alternative
11695 is displayed and it contains a subpart of type
11696 .Ql text/plain ,
11697 other parts are normally discarded.
11698 Setting this variable causes all subparts to be displayed,
11699 just as if the surrounding part was of type
11700 .Ql multipart/mixed .
11703 .It Va prompt
11704 The string used as a prompt in interactive mode.
11705 Whenever the variable is evaluated the value is treated as if specified
11706 within dollar-single-quotes (see
11707 .Sx "Shell-style argument quoting" ) .
11708 This (post-assignment, i.e., second) expansion can be used to embed
11709 status information, for example
11710 .Va \&? ,
11711 .Va \&! ,
11712 .Va account
11714 .Va mailbox-display .
11716 In order to embed characters which should not be counted when
11717 calculating the visual width of the resulting string, enclose the
11718 characters of interest in a pair of reverse solidus escaped brackets:
11719 .Ql \e[\eE[0m\e] ;
11720 a slot for coloured prompts is also available with the \*(OPal command
11721 .Ic colour .
11722 Prompting may be prevented by setting this to the null string
11723 (aka\|
11724 .Ql set noprompt ) .
11727 .It Va prompt2
11728 This string is used for secondary prompts, but is otherwise identical to
11729 .Va prompt .
11730 The default is
11731 .Ql ..\0 .
11734 .It Va quiet
11735 \*(BO Suppresses the printing of the version when first invoked.
11738 .It Va quote
11739 If set messages processed by
11740 .Ic followup ,
11741 .Ic reply
11742 and variants will be prefixed with the quoted original message,
11743 the lines of which prefixed by
11744 .Va indentprefix ,
11745 taking into account
11746 .Va quote-chars
11748 .Va quote-fold .
11749 No headers will be quoted when set without value or if the value is
11750 .Ql noheading ,
11751 if it is
11752 .Ql headers
11754 .Ql type
11755 .Ic headerpick
11756 selection will be included in the quotation,
11757 whereas all headers and all MIME parts are included for
11758 .Ql allheaders .
11759 The quoted message will be enclosed by the expansions of
11760 .Va quote-inject-head
11762 .Va quote-inject-tail .
11763 Also see
11764 .Va quote-add-cc ,
11765 .Va quote-as-attachment
11767 .Ic ~Q ,
11768 one of the
11769 .Sx "COMMAND ESCAPES" .
11772 .It Va quote-add-cc
11773 \*(BO Whether the sender of a message quoted via
11774 .Ic ~Q
11775 shall be added to the messages'
11776 .Ql Cc:
11777 list.
11780 .It Va quote-as-attachment
11781 \*(BO Add the original message in its entirety as a
11782 .Ql message/rfc822
11783 MIME attachment when replying to a message.
11784 Note this works regardless of the setting of
11785 .Va quote .
11788 .It Va quote-chars
11789 Can be set to a string consisting of non-whitespace ASCII characters
11790 which shall be treated as quotation leaders, the default being
11791 .Ql >|}: .
11794 .It Va quote-fold
11795 \*(OP Can be set in addition to
11796 .Va indentprefix ,
11797 and creates a more fancy quotation in that leading quotation characters
11798 .Pf ( Va quote-chars )
11799 are compressed and overlong lines are folded.
11800 .Va \&\&quote-fold
11801 can be set to either one, two or three (space separated) numeric values,
11802 which are interpreted as the maximum (goal) and the minimum line length,
11803 respectively, in a spirit rather equal to the
11804 .Xr fmt 1
11805 program, but line- instead of paragraph-based.
11806 The third value is used as the maximum line length instead of the first
11807 if no better break point can be found; it is ignored unless it is larger
11808 than the minimum and smaller than the maximum.
11809 If not set explicitly the minimum will reflect the goal algorithmically.
11810 The goal cannot be smaller than the length of
11811 .Va indentprefix
11812 plus some additional pad; necessary adjustments take place silently.
11817 .It Va quote-inject-head , quote-inject-tail
11818 The strings to put before and after the text of a
11819 .Va quote Ns
11820 d message, if non-empty, and respectively.
11821 The former defaults to
11822 .Ql %f wrote:\en\en .
11823 Special format directives will be expanded if possible, and if so
11824 configured the output will be folded according to
11825 .Va quote-fold .
11826 Format specifiers in the given strings start with a percent sign
11827 .Ql %
11828 and expand values of the original message, unless noted otherwise.
11829 Note that names and addresses are not subject to the setting of
11830 .Va showto .
11831 Valid format specifiers are:
11834 .Bl -tag -compact -width ".It Ql _%%_"
11835 .It Ql %%
11836 A plain percent sign.
11837 .It Ql %a
11838 The address(es) of the sender(s).
11839 .It Ql %d
11840 The date found in the
11841 .Ql Date:
11842 header of the message when
11843 .Va datefield
11844 is set (the default), otherwise the date when the message was received.
11845 Formatting can be controlled by assigning a
11846 .Xr strftime 3
11847 format string to
11848 .Va datefield
11849 (and
11850 .Va datefield-markout-older ) .
11851 .It Ql %f
11852 The full name(s) (name and address, as given) of the sender(s).
11853 .It Ql %i
11855 .Ql Message-ID: .
11856 .It Ql %n
11857 The real name(s) of the sender(s) if there is one and
11858 .Va showname
11859 allows usage, the address(es) otherwise.
11860 .It Ql %r
11861 The senders real name(s) if there is one, the address(es) otherwise.
11866 .It Va r-option-implicit
11867 \*(BO Setting this option evaluates the contents of
11868 .Va from
11869 (or, if that contains multiple addresses,
11870 .Va sender )
11871 and passes the results onto the used (file-based) MTA as described for the
11872 .Fl r
11873 option (empty argument case).
11876 .It Va recipients-in-cc
11877 \*(BO When doing a
11878 .Ic reply ,
11879 the original
11880 .Ql From:
11882 .Ql To:
11883 as well as addressees which possibly came in via
11884 .Ql Reply-To:
11886 .Ql Mail-Followup-To:
11887 are by default merged into the new
11888 .Ql To: .
11889 If this variable is set a sensitive algorithm tries to place in
11890 .Ql To:
11891 only the sender of the message being replied to, others are placed in
11892 .Ql Cc: .
11895 .It Va record
11896 Unless this variable is defined, no copies of outgoing mail will be saved.
11897 If defined it gives the pathname, subject to the usual
11898 .Sx "Filename transformations" ,
11899 of a folder where all new, replied-to or forwarded messages are saved:
11900 when saving to this folder fails the message is not sent, but instead
11901 .Va save Ns
11902 d to
11903 .Ev DEAD .
11904 The standard defines that relative (fully expanded) paths are to be
11905 interpreted relative to the current directory
11906 .Pf ( Ic cwd ) ,
11907 to force interpretation relative to
11908 .Va folder
11909 .Va outfolder
11910 needs to be set in addition.
11913 .It Va record-files
11914 \*(BO If this variable is set the meaning of
11915 .Va record
11916 will be extended to cover messages which target only file and pipe
11917 recipients (see
11918 .Va expandaddr ) .
11919 These address types will not appear in recipient lists unless
11920 .Va add-file-recipients
11921 is also set.
11924 .It Va record-resent
11925 \*(BO If this variable is set the meaning of
11926 .Va record
11927 will be extended to also cover the
11928 .Ic resend
11930 .Ic Resend
11931 commands.
11934 .It Va reply-in-same-charset
11935 \*(BO If this variable is set \*(UA first tries to use the same
11936 character set of the original message for replies.
11937 If this fails, the mechanism described in
11938 .Sx "Character sets"
11939 is evaluated as usual.
11942 .It Va reply-strings
11943 Can be set to a comma-separated list of (case-insensitive according to
11944 ASCII rules) strings which shall be recognized in addition to the
11945 built-in strings as
11946 .Ql Subject:
11947 reply message indicators \(en built-in are
11948 .Ql Re: ,
11949 which is mandated by RFC 5322, as well as the german
11950 .Ql Aw: ,
11951 .Ql Antw: ,
11952 and the
11953 .Ql Wg:
11954 which often has been seen in the wild;
11955 I.e., the separating colon has to be specified explicitly.
11958 .It Va reply-to
11959 A list of addresses to put into the
11960 .Ql Reply-To:
11961 field of the message header.
11962 Members of this list are handled as if they were in the
11963 .Ic alternates
11964 list.
11966 .It Va replyto
11967 \*(OB Variant of
11968 .Va reply-to .
11971 .It Va reply-to-honour
11972 Controls whether a
11973 .Ql Reply-To:
11974 header is honoured when replying to a message via
11975 .Ic reply
11977 .Ic Lreply .
11978 This is a
11979 .Mx -sx
11980 .Sx quadoption ;
11981 if set without a value it defaults to
11982 .Dq yes .
11985 .It Va reply-to-swap-in
11986 Standards like DKIM and (in conjunction with) DMARC caused many
11987 .Sx "Mailing lists"
11988 to use sender address rewriting in the style of
11989 .Ql Name via List <list@address> ,
11990 where the original sender address often being placed in
11991 .Ql Reply-To: .
11992 If this is set and a
11993 .Ql Reply-To:
11994 exists then that is used in place of the pretended sender.
11995 This works independently from
11996 .Va reply-to-honour .
11997 The optional value, a comma-separated list of strings, offers more
11998 fine-grained control on when swapping shall be used; for now supported is
11999 .Va mlist ,
12000 here swapping occurs if the sender is a mailing-list as defined by
12001 .Ic mlist .
12004 .It Va rfc822-body-from_
12005 \*(BO This variable can be used to force displaying a so-called
12006 .Ql From_
12007 line for messages that are embedded into an envelope mail via the
12008 .Ql message/rfc822
12009 MIME mechanism, for more visual convenience, also see
12010 .Va mbox-rfc4155 .
12013 .It Va save
12014 \*(BO Enable saving of (partial) messages in
12015 .Ev DEAD
12016 upon interrupt or delivery error.
12019 .It Va screen
12020 The number of lines that represents a
12021 .Dq screenful
12022 of lines, used in
12023 .Ic headers
12024 summary display,
12025 .Ic from
12026 .Ic search Ns
12027 ing, message
12028 .Ic top Ns
12029 line display and scrolling via
12030 .Ic z .
12031 If this variable is not set \*(UA falls back to a calculation based upon
12032 the detected terminal window size and the baud rate: the faster the
12033 terminal, the more will be shown.
12034 Overall screen dimensions and pager usage is influenced by the
12035 environment variables
12036 .Ev COLUMNS
12038 .Ev LINES
12039 and the variable
12040 .Va crt .
12043 .It Va searchheaders
12044 \*(BO Expand message list specifiers in the form
12045 .Ql /x:y
12046 to all messages containing the substring
12047 .Dq y
12048 in the header field
12049 .Ql x .
12050 The string search is case insensitive.
12053 .It Va sendcharsets
12054 \*(OP A comma-separated list of character set names that can be used in
12055 outgoing internet mail.
12056 The value of the variable
12057 .Va charset-8bit
12058 is automatically appended to this list of character sets.
12059 If no character set conversion capabilities are compiled into \*(UA then
12060 the only supported charset is
12061 .Va ttycharset .
12062 Also see
12063 .Va sendcharsets-else-ttycharset
12064 and refer to the section
12065 .Sx "Character sets"
12066 for the complete picture of character set conversion in \*(UA.
12069 .It Va sendcharsets-else-ttycharset
12070 \*(BO\*(OP If this variable is set, but
12071 .Va sendcharsets
12072 is not, then \*(UA acts as if
12073 .Va sendcharsets
12074 had been set to the value of the variable
12075 .Va ttycharset .
12076 In effect this combination passes through the message data in the
12077 character set of the current locale encoding:
12078 therefore mail message text will be (assumed to be) in ISO-8859-1
12079 encoding when send from within a ISO-8859-1 locale, and in UTF-8
12080 encoding when send from within an UTF-8 locale.
12082 The 8-bit fallback
12083 .Va charset-8bit
12084 never comes into play as
12085 .Va ttycharset
12086 is implicitly assumed to be 8-bit and capable to represent all files the
12087 user may specify (as is the case when no character set conversion
12088 support is available in \*(UA and the only supported character set is
12089 .Va ttycharset ,
12091 .Sx "Character sets" ) .
12092 This might be a problem for scripts which use the suggested
12093 .Ql LC_ALL=C
12094 setting, since in this case the character set is US-ASCII by definition,
12095 so that it is better to also override
12096 .Va ttycharset ,
12097 then; and/or do something like the following in the resource file:
12098 .Bd -literal -offset indent
12099 if [ "$LC_ALL" == C ] || [ "$LC_CTYPE" == C ]
12100   unset sendcharsets-else-ttycharset
12105 .It Va sender
12106 An address that is put into the
12107 .Ql Sender:
12108 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
12109 responsible for the actual transmission of the message.
12110 This field should normally not be used unless the
12111 .Va from
12112 field contains more than one address, on which case it is required.
12113 \*(ID Please expect automatic management of the
12114 .Va from
12116 .Va sender
12117 relationship.
12118 Dependent on the context this address is handled as if it were in
12119 the list of
12120 .Ic alternates .
12121 Also see
12122 .Fl r ,
12123 .Va r-option-implicit .
12125 .It Va sendmail
12126 \*(OB Predecessor of
12127 .Va mta .
12129 .It Va sendmail-arguments
12130 \*(OB Predecessor of
12131 .Va mta-arguments .
12133 .It Va sendmail-no-default-arguments
12134 \*(OB\*(BO Predecessor of
12135 .Va mta-no-default-arguments .
12137 .It Va sendmail-progname
12138 \*(OB Predecessor of
12139 .Va mta-argv0 .
12142 .It Va sendwait
12143 Sending messages to the chosen
12144 .Va mta
12145 or to command-pipe receivers (see
12146 .Sx "On sending mail, and non-interactive mode" )
12147 will be performed asynchronously.
12148 This means that only startup errors of the respective program will be
12149 recognizable, but no delivery errors.
12150 Also, no guarantees can be made as to when the respective program will
12151 actually run, as well as to when they will have produced output.
12153 If this variable is set then child program exit is waited for, and its
12154 exit status code is used to decide about success.
12155 Remarks: in conflict with the POSIX standard this variable is built-in
12156 to be initially set.
12157 Another difference is that it can have a value, which is interpreted as
12158 a comma-separated list of case-insensitive strings naming specific
12159 subsystems for which synchronousness shall be ensured (only).
12160 Possible values are
12161 .Ql mta
12163 .Va mta
12164 delivery, and
12165 .Ql pcc
12166 for command-pipe receivers.
12169 .It Va showlast
12170 \*(BO This setting causes \*(UA to start at the last message
12171 instead of the first one when opening a mail folder, as well as with
12172 .Ic from
12174 .Ic headers .
12177 .It Va showname
12178 \*(BO Causes \*(UA to use the sender's real name instead of the plain
12179 address in the header field summary and in message specifications.
12182 .It Va showto
12183 \*(BO Causes the recipient of the message to be shown in the header
12184 summary if the message was sent by the user.
12187 .It Va Sign
12188 The value backing
12189 .Ic ~A ,
12190 one of the
12191 .Sx "COMMAND ESCAPES" .
12192 Also see
12193 .Va message-inject-tail ,
12194 .Va on-compose-leave
12196 .Va on-compose-splice .
12199 .It Va sign
12200 The value backing
12201 .Ic ~a ,
12202 one of the
12203 .Sx "COMMAND ESCAPES" .
12204 Also see
12205 .Va message-inject-tail ,
12206 .Va on-compose-leave
12208 .Va on-compose-splice .
12211 .It Va signature
12212 \*(OB Please use
12213 .Va on-compose-splice
12215 .Va on-compose-splice-shell
12217 .Va on-compose-leave
12218 and (if necessary)
12219 .Va message-inject-tail
12220 instead!
12223 .It Va skipemptybody
12224 \*(BO If an outgoing message does not contain any text in its first or
12225 only message part, do not send it but discard it silently (see also the
12226 command line option
12227 .Fl E ) .
12231 .It Va smime-ca-dir , smime-ca-file
12232 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
12233 Enhanced Mail) for the purpose of verification of S/MIME signed messages.
12234 .Va tls-ca-dir
12235 documents the necessary preparation steps to use the former.
12236 The set of CA certificates which are built into the TLS library can
12237 be explicitly turned off by setting
12238 .Va smime-ca-no-defaults ,
12239 and further fine-tuning is possible via
12240 .Va smime-ca-flags .
12243 .It Va smime-ca-flags
12244 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
12245 storage, and the certificate verification that is used.
12246 The actual values and their meanings are documented for
12247 .Va tls-ca-flags .
12250 .It Va smime-ca-no-defaults
12251 \*(BO\*(OP Do not load the default CA locations that are built into the
12252 used to TLS library to verify S/MIME signed messages.
12254 .Mx Va smime-cipher
12255 .It Va smime-cipher-USER@HOST , smime-cipher
12256 \*(OP Specifies the cipher to use when generating S/MIME encrypted
12257 messages (for the specified account).
12258 RFC 5751 mandates a default of
12259 .Ql aes128
12260 (AES-128 CBC).
12261 Possible values are (case-insensitive and) in decreasing cipher strength:
12262 .Ql aes256
12263 (AES-256 CBC),
12264 .Ql aes192
12265 (AES-192 CBC),
12266 .Ql aes128
12267 (AES-128 CBC),
12268 .Ql des3
12269 (DES EDE3 CBC, 168 bits; default if
12270 .Ql aes128
12271 is not available) and
12272 .Ql des
12273 (DES CBC, 56 bits).
12275 The actually available cipher algorithms depend on the cryptographic
12276 library that \*(UA uses.
12277 \*(OP Support for more cipher algorithms may be available through
12278 dynamic loading via
12279 .Xr EVP_get_cipherbyname 3
12280 (OpenSSL) if \*(UA has been compiled to support this.
12283 .It Va smime-crl-dir
12284 \*(OP Specifies a directory that contains files with CRLs in PEM format
12285 to use when verifying S/MIME messages.
12288 .It Va smime-crl-file
12289 \*(OP Specifies a file that contains a CRL in PEM format to use when
12290 verifying S/MIME messages.
12293 .It Va smime-encrypt-USER@HOST
12294 \*(OP If this variable is set, messages send to the given receiver are
12295 encrypted before sending.
12296 The value of the variable must be set to the name of a file that
12297 contains a certificate in PEM format.
12299 If a message is sent to multiple recipients,
12300 each of them for whom a corresponding variable is set will receive an
12301 individually encrypted message;
12302 other recipients will continue to receive the message in plain text
12303 unless the
12304 .Va smime-force-encryption
12305 variable is set.
12306 It is recommended to sign encrypted messages, i.e., to also set the
12307 .Va smime-sign
12308 variable.
12309 .Va content-description-smime-message
12310 will be inspected for messages which become encrypted.
12313 .It Va smime-force-encryption
12314 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
12317 .It Va smime-sign
12318 \*(BO\*(OP S/MIME sign outgoing messages with the user's
12319 .Pf ( Va from )
12320 private key and include the users certificate as a MIME attachment.
12321 Signing a message enables a recipient to verify that the sender used
12322 a valid certificate,
12323 that the email addresses in the certificate match those in the message
12324 header and that the message content has not been altered.
12325 It does not change the message text,
12326 and people will be able to read the message as usual.
12327 .Va content-description-smime-signature
12328 will be inspected.
12329 Also see
12330 .Va smime-sign-cert , smime-sign-include-certs
12332 .Va smime-sign-digest .
12334 .Mx Va smime-sign-cert
12335 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
12336 \*(OP Points to a file in PEM format.
12337 For the purpose of signing and decryption this file needs to contain the
12338 user's private key, followed by his certificate.
12340 For message signing
12341 .Ql USER@HOST
12342 is always derived from the value of
12343 .Va from
12344 (or, if that contains multiple addresses,
12345 .Va sender ) .
12346 For the purpose of encryption the recipients public encryption key
12347 (certificate) is expected; the command
12348 .Ic certsave
12349 can be used to save certificates of signed messages (the section
12350 .Sx "Signed and encrypted messages with S/MIME"
12351 gives some details).
12352 This mode of operation is usually driven by the specialized form.
12354 When decrypting messages the account is derived from the recipient
12355 fields
12356 .Pf ( Ql To:
12358 .Ql Cc: )
12359 of the message, which are searched for addresses for which such
12360 a variable is set.
12361 \*(UA always uses the first address that matches,
12362 so if the same message is sent to more than one of the user addresses
12363 using different encryption keys, decryption might fail.
12365 Password-encrypted keys may be used for signing and decryption.
12366 Automated password lookup is possible via the
12367 .Dq pseudo-hosts
12368 .Ql USER@HOST.smime-cert-key
12369 for the private key, and
12370 .Ql USER@HOST.smime-cert-cert
12371 for the certificate stored in the same file.
12372 For example, the hypothetical address
12373 .Ql bob@exam.ple
12374 could be driven with a private key / certificate pair path defined in
12375 .Va \&\&smime-sign-cert-bob@exam.ple ,
12376 and the needed passwords would then be looked up as
12377 .Ql bob@exam.ple.smime-cert-key
12379 .Ql bob@exam.ple.smime-cert-cert .
12380 When decrypting the value of
12381 .Va from
12382 will be tried as a fallback to provide the necessary
12383 .Ql USER@HOST .
12384 To include intermediate certificates, use
12385 .Va smime-sign-include-certs .
12386 The possible password sources are documented in
12387 .Sx "On URL syntax and credential lookup" .
12389 .Mx Va smime-sign-digest
12390 .It Va smime-sign-digest-USER@HOST , smime-sign-digest
12391 \*(OP Specifies the message digest to use when signing S/MIME messages.
12392 Please remember that for this use case
12393 .Ql USER@HOST
12394 refers to the variable
12395 .Va from
12396 (or, if that contains multiple addresses,
12397 .Va sender ) .
12398 The available algorithms depend on the used cryptographic library, but
12399 at least one usable built-in algorithm is ensured as a default.
12400 If possible the standard RFC 5751 will be violated by using
12401 .Ql SHA512
12402 instead of the mandated
12403 .Ql SHA1
12404 due to security concerns.
12406 \*(UA will try to add built-in support for the following message
12407 digests, names are case-insensitive:
12408 .Ql BLAKE2b512 ,
12409 .Ql BLAKE2s256 ,
12410 .Ql SHA3-512 ,
12411 .Ql SHA3-384 ,
12412 .Ql SHA3-256 ,
12413 .Ql SHA3-224 ,
12414 as well as the widely available
12415 .Ql SHA512 ,
12416 .Ql SHA384 ,
12417 .Ql SHA256 ,
12418 .Ql SHA224 ,
12419 and the proposed insecure
12420 .Ql SHA1 ,
12421 finally
12422 .Ql MD5 .
12423 More digests may \*(OPally be available through dynamic loading via the
12424 OpenSSL function
12425 .Xr EVP_get_digestbyname 3 .
12427 .Mx Va smime-sign-include-certs
12428 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
12429 \*(OP If used, this is supposed to a consist of a comma-separated list
12430 of files, each of which containing a single certificate in PEM format to
12431 be included in the S/MIME message in addition to the
12432 .Va smime-sign-cert
12433 certificate.
12434 This can be used to include intermediate certificates of the certificate
12435 authority, in order to allow the receiver's S/MIME implementation to
12436 perform a verification of the entire certificate chain, starting from
12437 a local root certificate, over the intermediate certificates, down to the
12438 .Va smime-sign-cert .
12439 Even though top level certificates may also be included in the chain,
12440 they will not be used for the verification on the receiver's side.
12442 For the purpose of the mechanisms involved here,
12443 .Ql USER@HOST
12444 refers to the content of the internal variable
12445 .Va from
12446 (or, if that contains multiple addresses,
12447 .Va sender ) .
12448 The pseudo-host
12449 .Ql USER@HOST.smime-include-certs
12450 will be used for performing password lookups for these certificates,
12451 shall they have been given one, therefore the lookup can be automated
12452 via the mechanisms described in
12453 .Sx "On URL syntax and credential lookup" .
12455 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
12456 \*(OB\*(OP Predecessor(s) of
12457 .Va smime-sign-digest .
12459 .It Va smtp
12460 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
12461 .Va mta .
12462 \*(ID For compatibility reasons a set
12463 .Va smtp
12464 is used in preference of
12465 .Va mta .
12467 .Mx Va smtp-auth
12468 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
12469 \*(OP Variable chain that controls the SMTP
12470 .Va mta
12471 authentication method, possible values are
12472 .Ql none
12473 (\*(OU default),
12474 .Ql plain
12475 (\*(IN default),
12476 .Ql login ,
12477 \*(IN
12478 .Ql oauthbearer
12479 (see
12480 .Sx FAQ
12481 entry
12482 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" )
12483 as well as \*(IN
12484 .Ql external
12486 .Ql externanon
12487 for TLS secured connections which pass a client certificate via
12488 .Va tls-config-pairs .
12489 There may be the \*(OPal methods
12490 .Ql cram-md5
12492 .Ql gssapi .
12493 .Ql none
12495 .Ql externanon
12496 do not need any user credentials,
12497 .Ql external
12499 .Ql gssapi
12500 require a user name, and all other methods require a
12501 .Va user
12502 name and a
12503 .Va password .
12504 .Ql externanon
12505 solely builds upon the credentials passed via a client certificate,
12506 and is usually the way to go since tested servers do not actually follow
12507 RFC 4422 aka RFC 4954, and fail if additional credentials are passed.
12508 Also see
12509 .Va mta .
12510 Note that
12511 .Va smtp-auth-HOST
12512 is \*(IN.
12513 (\*(OU Requires
12514 .Va smtp-auth-password
12516 .Va smtp-auth-user .
12517 Note for
12518 .Va smtp-auth-USER@HOST :
12519 may override dependent on sender address in the variable
12520 .Va from . )
12522 .It Va smtp-auth-password
12523 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
12524 If the authentication method requires a password, but neither
12525 .Va smtp-auth-password
12526 nor a matching
12527 .Va smtp-auth-password-USER@HOST
12528 can be found,
12529 \*(UA will ask for a password on the user's terminal.
12531 .It Va smtp-auth-password-USER@HOST
12532 \*(OU Overrides
12533 .Va smtp-auth-password
12534 for specific values of sender addresses, dependent upon the variable
12535 .Va from .
12537 .It Va smtp-auth-user
12538 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
12539 If the authentication method requires a user name, but neither
12540 .Va smtp-auth-user
12541 nor a matching
12542 .Va smtp-auth-user-USER@HOST
12543 can be found,
12544 \*(UA will ask for a user name on the user's terminal.
12546 .It Va smtp-auth-user-USER@HOST
12547 \*(OU Overrides
12548 .Va smtp-auth-user
12549 for specific values of sender addresses, dependent upon the variable
12550 .Va from .
12553 .It Va smtp-hostname
12554 \*(OP\*(IN Normally \*(UA uses the variable
12555 .Va from
12556 to derive the necessary
12557 .Ql USER@HOST
12558 information in order to issue a
12559 .Ql MAIL FROM:<>
12560 SMTP
12561 .Va mta
12562 command.
12563 Setting
12564 .Va smtp-hostname
12565 can be used to use the
12566 .Ql USER
12567 from the SMTP account
12568 .Pf ( Va mta
12569 or the
12570 .Va user
12571 variable chain)
12572 and the given
12573 .Ql HOST
12574 .Pf ( Va hostname
12575 if the empty string is given, or the local hostname as a last resort).
12576 This often allows using an address that is itself valid but hosted by
12577 a provider other than from which (in
12578 .Va from )
12579 the message is sent.
12580 Setting this variable also influences generated
12581 .Ql Message-ID:
12583 .Ql Content-ID:
12584 header fields.
12585 If the \*(OPal IDNA support is available (see
12586 .Va idna-disable )
12587 variable assignment is aborted when a necessary conversion fails.
12589 .Mx Va smtp-use-starttls
12590 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
12591 \*(BO\*(OP Causes \*(UA to issue a
12592 .Ql STARTTLS
12593 command to make an SMTP
12594 .Va mta
12595 session TLS encrypted, i.e., to enable transport layer security.
12598 .It Va socket-connect-timeout
12599 \*(OP A positive number that defines the timeout to wait for
12600 establishing a socket connection before forcing
12601 .Va ^ERR Ns -TIMEDOUT .
12603 .Mx Va socks-proxy
12604 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
12605 \*(OP If set to the URL of a SOCKS5 server then all network activities
12606 are proxied through it, except for the single DNS name lookup necessary
12607 to resolve the proxy URL (unnecessary when given an already resolved IP
12608 address).
12609 It is automatically squared with the environment variable
12610 .Ev SOCKS5_PROXY ,
12611 changing the one will adjust the other.
12612 This example creates a local SOCKS5 proxy on port 10000 that forwards to
12613 the machine
12614 .Ql HOST
12615 (with identity
12616 .Ql USER ) ,
12617 and from which actual network traffic happens:
12618 .Bd -literal -offset indent
12619 $ ssh -D 10000 USER@HOST
12620 $ \*(uA -Ssocks-proxy=[socks5://]localhost:10000
12621 # or =localhost:10000; no local DNS: =127.0.0.1:10000
12625 .It Va spam-interface
12626 \*(OP In order to use any of the spam-related commands (like
12627 .Ic spamrate )
12628 the desired spam interface must be defined by setting this variable.
12629 Please refer to the manual section
12630 .Sx "Handling spam"
12631 for the complete picture of spam handling in \*(UA.
12632 All or none of the following interfaces may be available:
12634 .Bl -tag -width ".It Ql _ilte_"
12635 .It Ql spamc
12636 Interaction with
12637 .Xr spamc 1
12638 from the
12639 .Xr spamassassin 1
12640 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
12641 suite.
12642 Different to the generic filter interface \*(UA will automatically add
12643 the correct arguments for a given command and has the necessary
12644 knowledge to parse the program's output.
12645 A default value for
12646 .Va spamc-command
12647 will have been compiled into the \*(UA binary if
12648 .Xr spamc 1
12649 has been found in
12650 .Ev PATH
12651 during compilation.
12652 Shall it be necessary to define a specific connection type (rather than
12653 using a configuration file for that), the variable
12654 .Va spamc-arguments
12655 can be used as in for example
12656 .Ql -d server.example.com -p 783 .
12657 It is also possible to specify a per-user configuration via
12658 .Va spamc-user .
12659 Note that this interface does not inspect the
12660 .Ql is-spam
12661 flag of a message for the command
12662 .Ic spamforget .
12664 .It Ql filter
12665 generic spam filter support via freely configurable hooks.
12666 This interface is meant for programs like
12667 .Xr bogofilter 1
12668 and requires according behaviour in respect to the hooks' exit
12669 status for at least the command
12670 .Ic spamrate
12671 .Pf ( Ql 0
12672 meaning a message is spam,
12673 .Ql 1
12674 for non-spam,
12675 .Ql 2
12676 for unsure and any other return value indicating a hard error);
12677 since the hooks can include shell code snippets diverting behaviour
12678 can be intercepted as necessary.
12679 The hooks are
12680 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
12681   spamfilter-rate
12683 .Va spamfilter-spam ;
12684 the manual section
12685 .Sx "Handling spam"
12686 contains examples for some programs.
12687 The process environment of the hooks will have the variable
12688 .Ev MAILX_FILENAME_GENERATED
12689 set.
12690 Note that spam score support for
12691 .Ic spamrate
12692 is not supported unless the \*(OPtional regular expression support is
12693 available and the
12694 .Va spamfilter-rate-scanscore
12695 variable is set.
12700 .It Va spam-maxsize
12701 \*(OP Messages that exceed this size will not be passed through to the
12702 configured
12703 .Va spam-interface .
12704 If unset or 0, the default of 420000 bytes is used.
12707 .It Va spamc-command
12708 \*(OP The path to the
12709 .Xr spamc 1
12710 program for the
12711 .Ql spamc
12712 .Va spam-interface .
12713 Note that the path is not expanded, but used
12714 .Dq as is .
12715 A fallback path will have been compiled into the \*(UA binary if the
12716 executable had been found during compilation.
12719 .It Va spamc-arguments
12720 \*(OP Even though \*(UA deals with most arguments for the
12721 .Ql spamc
12722 .Va spam-interface
12723 automatically, it may at least sometimes be desirable to specify
12724 connection-related ones via this variable, for example
12725 .Ql -d server.example.com -p 783 .
12728 .It Va spamc-user
12729 \*(OP Specify a username for per-user configuration files for the
12730 .Ql spamc
12731 .Va spam-interface .
12732 If this is set to the empty string then \*(UA will use the name of the
12733 current
12734 .Va user .
12741 .It Va spamfilter-ham , spamfilter-noham , \
12742   spamfilter-nospam , spamfilter-rate , spamfilter-spam
12743 \*(OP Command and argument hooks for the
12744 .Ql filter
12745 .Va spam-interface .
12746 The manual section
12747 .Sx "Handling spam"
12748 contains examples for some programs.
12751 .It Va spamfilter-rate-scanscore
12752 \*(OP Because of the generic nature of the
12753 .Ql filter
12754 .Va spam-interface
12755 spam scores are not supported for it by default, but if the \*(OPnal
12756 regular expression support is available then setting this variable can
12757 be used to overcome this restriction.
12758 It is interpreted as follows: first a number (digits) is parsed that
12759 must be followed by a semicolon
12760 .Ql \&;
12761 and an extended regular expression.
12762 Then the latter is used to parse the first output line of the
12763 .Va spamfilter-rate
12764 hook, and, in case the evaluation is successful, the group that has been
12765 specified via the number is interpreted as a floating point scan score.
12767 .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\
12768   ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file
12769 \*(OB\*(OP Predecessors of
12770 .Va tls-ca-file ,
12771 .Va tls-ca-dir .
12773 .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags
12774 \*(OB\*(OP Predecessor of
12775 .Va tls-ca-flags .
12777 .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\
12778   ssl-ca-no-defaults
12779 \*(OB\*(BO\*(OP Predecessor of
12780 .Va tls-ca-no-defaults .
12782 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
12783 \*(OB\*(OP Please use the
12784 .Cd Certificate
12785 slot of
12786 .Va tls-config-pairs .
12788 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
12789 \*(OB\*(OP Please use the
12790 .Cd CipherString
12791 slot of
12792 .Va tls-config-pairs .
12794 .It Va ssl-config-file
12795 \*(OB\*(OP Predecessor of
12796 .Va tls-config-file .
12798 .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\
12799   ssl-config-module
12800 \*(OB\*(OP Predecessor of
12801 .Va tls-config-module .
12803 .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs
12804 \*(OB\*(OP Predecessor of
12805 .Va tls-config-pairs .
12807 .It Va ssl-crl-dir , ssl-crl-file
12808 \*(OB\*(OP Predecessors of
12809 .Va tls-crl-dir ,
12810 .Va tls-crl-file .
12812 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
12813 \*(OB\*(OP Please use the
12814 .Cd Curves
12815 slot of
12816 .Va tls-config-pairs .
12818 .It Va ssl-features
12819 \*(OB\*(OP\*(RO Predecessor of
12820 .Va tls-features .
12822 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
12823 \*(OB\*(OP Please use the
12824 .Cd PrivateKey
12825 slot of
12826 .Va tls-config-pairs .
12828 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
12829 \*(OB\*(OP Please use the
12830 .Cd Protocol
12831 slot of
12832 .Va tls-config-pairs .
12834 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
12835 \*(OB\*(OP Please use the
12836 .Cd Protocol
12837 slot of
12838 .Va tls-config-pairs .
12840 .It Va ssl-rand-file
12841 \*(OB\*(OP Predecessor of
12842 .Va tls-rand-file .
12844 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
12845 \*(OB\*(OP Predecessor of
12846 .Va tls-verify .
12849 .It Va stealthmua
12850 If only set without an assigned value, then this setting inhibits the
12851 generation of the
12852 .Ql Message-ID: ,
12853 .Ql Content-ID:
12855 .Ql User-Agent:
12856 header fields that include obvious references to \*(UA.
12857 There are two pitfalls associated with this:
12858 First, the message id of outgoing messages is not known anymore.
12859 Second, an expert may still use the remaining information in the header
12860 to track down the originating mail user agent.
12861 If set to the value
12862 .Ql noagent ,
12863 then the mentioned
12864 .Ql Message-ID:
12866 .Ql Content-ID:
12867 suppression does not occur.
12870 .It Va system-mailrc
12871 \*(RO The compiled in path of the system wide initialization file
12872 one of the
12873 .Sx "Resource files" :
12874 .Pa \*(UR .
12878 .It Va termcap
12879 (\*(OP) This specifies a comma-separated list of
12880 .Lb libterminfo
12881 and/or
12882 .Lb libtermcap
12883 capabilities (see
12884 .Sx "On terminal control and line editor" ,
12885 escape commas with reverse solidus) to be used to overwrite or define
12886 entries.
12887 .Sy Note
12888 this variable will only be queried once at program startup and can
12889 thus only be specified in resource files or on the command line.
12892 String capabilities form
12893 .Ql cap=value
12894 pairs and are expected unless noted otherwise.
12895 Numerics have to be notated as
12896 .Ql cap#number
12897 where the number is expected in normal decimal notation.
12898 Finally, booleans do not have any value but indicate a true or false
12899 state simply by being defined or not; this indeed means that \*(UA
12900 does not support undefining an existing boolean.
12901 String capability values will undergo some expansions before use:
12902 for one notations like
12903 .Ql ^LETTER
12904 stand for
12905 .Ql control-LETTER ,
12906 and for clarification purposes
12907 .Ql \eE
12908 can be used to specify
12909 .Ql escape
12910 (the control notation
12911 .Ql ^[
12912 could lead to misreadings when a left bracket follows, which it does for
12913 the standard CSI sequence);
12914 finally three letter octal sequences, as in
12915 .Ql \e061 ,
12916 are supported.
12917 To specify that a terminal supports 256-colours, and to define sequences
12918 that home the cursor and produce an audible bell, one might write:
12920 .Bd -literal -offset indent
12921 ? set termcap='Co#256,home=\eE[H,bel=^G'
12925 The following terminal capabilities are or may be meaningful for the
12926 operation of the built-in line editor or \*(UA in general:
12929 .Bl -tag -compact -width ".It Cd yay"
12930 .It Cd am
12931 .Cd auto_right_margin :
12932 boolean which indicates if the right margin needs special treatment; the
12933 .Cd xenl
12934 capability is related, for more see
12935 .Ev COLUMNS .
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.
13028 Many more capabilities which describe key-sequences are documented for
13029 .Ic bind .
13033 .It Va termcap-ca-mode
13034 \*(OP Allow usage of the
13035 .Cd exit_ca_mode
13037 .Cd enter_ca_mode
13038 .Va termcap Ns
13039 abilities in order to enter an alternative exclusive screen, the
13040 so-called ca-mode; this usually requires special configuration of the
13041 .Ev PAGER ,
13042 also dependent on the value of
13043 .Va crt .
13044 .Sy Note
13045 this variable will only be queried once at program startup and can
13046 thus only be specified in resource files or on the command line.
13049 .It Va termcap-disable
13050 \*(OP Disable any interaction with a terminal control library.
13051 If set only some generic fallback built-ins and possibly the content of
13052 .Va termcap
13053 describe the terminal to \*(UA.
13054 .Sy Note
13055 this variable will only be queried once at program startup and can
13056 thus only be specified in resource files or on the command line.
13058 .Mx Va tls-ca-file
13059 .Mx Va tls-ca-dir
13060 .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\
13061   tls-ca-file-USER@HOST , tls-ca-file-HOST , tls-ca-file
13062 \*(OP Directory and file, respectively, for pools of trusted CA
13063 certificates in PEM (Privacy Enhanced Mail) format, for the purpose of
13064 verification of TLS server certificates.
13065 Concurrent use is possible, the file is loaded once needed first, the
13066 directory lookup is performed anew as a last resort whenever necessary.
13067 The CA certificate pool built into the TLS library can be disabled via
13068 .Va tls-ca-no-defaults ,
13069 further fine-tuning is possible via
13070 .Va tls-ca-flags .
13071 The directory search requires special filename conventions, please see
13072 .Xr SSL_CTX_load_verify_locations 3
13074 .Xr verify 1
13076 .Xr c_rehash 1 ) .
13079 .Mx Va tls-ca-flags
13080 .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags
13081 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
13082 storage, and the certificate verification that is used (also see
13083 .Va tls-verify ) .
13084 The value is expected to consist of a comma-separated list of
13085 configuration directives, with any intervening whitespace being ignored.
13086 The directives directly map to flags that can be passed to
13087 .Xr X509_STORE_set_flags 3 ,
13088 which are usually defined in a file
13089 .Pa openssl/x509_vfy.h ,
13090 and the availability of which depends on the used TLS library
13091 version: a directive without mapping is ignored (error log subject to
13092 .Va debug ) .
13093 Directives currently understood (case-insensitively) include:
13096 .Bl -tag -compact -width ".It Cd BaNg"
13097 .It Cd no-alt-chains
13098 If the initial chain is not trusted, do not attempt to build an
13099 alternative chain.
13100 Setting this flag will make OpenSSL certificate verification match that
13101 of older OpenSSL versions, before automatic building and checking of
13102 alternative chains has been implemented; also see
13103 .Cd trusted-first .
13104 .It Cd no-check-time
13105 Do not check certificate/CRL validity against current time.
13106 .It Cd partial-chain
13107 By default partial, incomplete chains which cannot be verified up to the
13108 chain top, a self-signed root certificate, will not verify.
13109 With this flag set, a chain succeeds to verify if at least one signing
13110 certificate of the chain is in any of the configured trusted stores of
13111 CA certificates.
13112 The OpenSSL manual page
13113 .Xr SSL_CTX_load_verify_locations 3
13114 gives some advise how to manage your own trusted store of CA certificates.
13115 .It Cd strict
13116 Disable workarounds for broken certificates.
13117 .It Cd trusted-first
13118 Try building a chain using issuers in the trusted store first to avoid
13119 problems with server-sent legacy intermediate certificates.
13120 Newer versions of OpenSSL support alternative chain checking and enable
13121 it by default, resulting in the same behaviour; also see
13122 .Cd no-alt-chains .
13126 .Mx Va tls-ca-no-defaults
13127 .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\
13128   tls-ca-no-defaults
13129 \*(BO\*(OP Do not load the default CA locations that are built into the
13130 used to TLS library to verify TLS server certificates.
13133 .It Va tls-config-file
13134 \*(OP If this variable is set
13135 .Xr CONF_modules_load_file 3
13136 (if announced via
13137 .Ql +modules-load-file
13139 .Va tls-features )
13140 is used to allow resource file based configuration of the TLS library.
13141 This happens once the library is used first, which may also be early
13142 during startup (logged with
13143 .Va verbose ) !
13144 If a non-empty value is given then the given file, after performing
13145 .Sx "Filename transformations" ,
13146 will be used instead of the TLS libraries global default, and it is an
13147 error if the file cannot be loaded.
13148 The application name will always be passed as
13149 .Ql \*(uA .
13150 Some TLS libraries support application-specific configuration via
13151 resource files loaded like this, please see
13152 .Va tls-config-module .
13154 .Mx Va tls-config-module
13155 .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\
13156   tls-config-module
13157 \*(OP If file based application-specific configuration via
13158 .Va tls-config-file
13159 is available, announced as
13160 .Ql +ctx-config
13162 .Va tls-features ,
13163 indicating availability of
13164 .Xr SSL_CTX_config 3 ,
13165 then, it becomes possible to use a central TLS configuration file
13166 for all programs, including \*(uA, for example
13167 .Bd -literal -offset indent
13168 # Register a configuration section for \*(uA
13169 \*(uA = mailx_master
13170 # The top configuration section creates a relation
13171 # in between dynamic SSL configuration and an actual
13172 # program specific configuration section
13173 [mailx_master]
13174 ssl_conf = mailx_tls_config
13175 # And that program specific configuration section now
13176 # can map diverse tls-config-module names to sections,
13177 # as in: tls-config-module=account_xy
13178 [mailx_tls_config]
13179 account_xy = mailx_account_xy
13180 account_yz = mailx_account_yz
13181 [mailx_account_xy]
13182 MinProtocol = TLSv1.2
13183 Curves=P-521
13184 [mailx_account_yz]
13185 CipherString = TLSv1.2:!aNULL:!eNULL:
13186 MinProtocol = TLSv1.1
13187 Options = Bugs
13191 .Mx Va tls-config-pairs
13192 .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs
13193 \*(OP The value of this variable chain will be interpreted as
13194 a comma-separated list of directive/value pairs.
13195 Directives and values need to be separated by equals signs
13196 .Ql = ,
13197 any whitespace surrounding pair members is removed.
13198 Keys are (usually) case-insensitive.
13199 Different to when placing these pairs in a
13200 .Va tls-config-module
13201 section of a
13202 .Va tls-config-file ,
13203 commas
13204 .Ql \&,
13205 need to be escaped with a reverse solidus
13206 .Ql \e
13207 when included in pairs; also different: if the equals sign
13208 .Ql =
13209 is preceded with an asterisk
13210 .Ql *
13211 .Sx "Filename transformations"
13212 will be performed on the value; it is an error if these fail.
13213 Unless proper support is announced by
13214 .Va tls-features
13215 .Pf ( Ql +conf-ctx )
13216 only the keys below are supported, otherwise the pairs will be used
13217 directly as arguments to the function
13218 .Xr SSL_CONF_cmd 3 .
13221 .Bl -tag -compact -width ".It Cd C_rtificate_"
13222 .It Cd Certificate
13223 Filename of a TLS client certificate (chain) required by some servers.
13224 Fallback support via
13225 .Xr SSL_CTX_use_certificate_chain_file 3 .
13226 .Sx "Filename transformations"
13227 are performed.
13228 .Cd PrivateKey
13229 will be set to the same value if not initialized explicitly.
13230 Some services support so-called
13231 .Ql external
13232 authentication if a TLS client certificate was successfully presented
13233 during connection establishment
13234 .Pf ( Dq connecting is authenticating ) .
13236 .It Cd CipherString
13237 A list of ciphers for TLS connections, see
13238 .Xr ciphers 1 .
13239 By default no list of ciphers is set, resulting in a
13240 .Cd Protocol Ns - Ns
13241 specific list of ciphers (the protocol standards define lists of
13242 acceptable ciphers; possibly cramped by the used TLS library).
13243 Fallback support via
13244 .Xr SSL_CTX_set_cipher_list 3 .
13246 .It Cd Ciphersuites
13247 A list of ciphers used for TLSv1.3 connections, see
13248 .Xr ciphers 1 .
13249 These will be joined onto the list of ciphers from
13250 .Cd CipherString .
13251 Available if
13252 .Va tls-features
13253 announces
13254 .Ql +ctx-set-ciphersuites ,
13255 as necessary via
13256 .Xr SSL_CTX_set_ciphersuites 3 .
13258 .It Cd Curves
13259 A list of supported elliptic curves, if applicable.
13260 By default no curves are set.
13261 Fallback support via
13262 .Xr SSL_CTX_set1_curves_list 3 ,
13263 if available.
13265 .It Cd MaxProtocol , MinProtocol
13266 The maximum and minimum supported TLS versions, respectively.
13267 Available if
13268 .Va tls-features
13269 announces
13270 .Ql +ctx-set-maxmin-proto ,
13271 as necessary via
13272 .Xr SSL_CTX_set_max_proto_version 3
13274 .Xr SSL_CTX_set_min_proto_version 3 ;
13275 these fallbacks use an internal parser which understands the strings
13276 .Ql SSLv3 ,
13277 .Ql TLSv1 ,
13278 .Ql TLSv1.1 ,
13279 .Ql TLSv1.2 ,
13280 .Ql TLSv1.3 ,
13281 and the special value
13282 .Ql None ,
13283 which disables the given limit.
13285 .It Cd Options
13286 Various flags to set.
13287 Fallback via
13288 .Xr SSL_CTX_set_options 3 ,
13289 in which case any other value but (exactly)
13290 .Ql Bugs
13291 results in an error.
13293 .It Cd PrivateKey
13294 Filename of the private key in PEM format of a TLS client certificate.
13295 If unset, the value of
13296 .Cd Certificate
13297 is used.
13298 .Sx "Filename transformations"
13299 are performed.
13300 Fallback via
13301 .Xr SSL_CTX_use_PrivateKey_file 3 .
13303 .It Cd Protocol
13304 The used TLS protocol.
13306 .Va tls-features
13307 announces
13308 .Ql +conf-ctx
13310 .Ql ctx-set-maxmin-proto
13311 then using
13312 .Cd MaxProtocol
13314 .Cd MinProtocol
13315 is preferable.
13316 Fallback is
13317 .Xr SSL_CTX_set_options 3 ,
13318 driven via an internal parser which understands the strings
13319 .Ql SSLv3 ,
13320 .Ql TLSv1 ,
13321 .Ql TLSv1.1 ,
13322 .Ql TLSv1.2 ,
13323 .Ql TLSv1.3 ,
13324 and the special value
13325 .Ql ALL .
13326 Multiple protocols may be given as a comma-separated list, any
13327 whitespace is ignored, an optional plus sign
13328 .Ql +
13329 prefix enables, a hyphen-minus
13330 .Ql -
13331 prefix disables a protocol, so that
13332 .Ql -ALL, TLSv1.2
13333 enables only the TLSv1.2 protocol.
13339 .It Va tls-crl-dir , tls-crl-file
13340 \*(OP Specify a directory / a file, respectively, that contains a CRL in
13341 PEM format to use when verifying TLS server certificates.
13344 .It Va tls-features
13345 \*(OP\*(RO This expands to a comma-separated list of the TLS library
13346 identity and optional features.
13347 To ease substring matching the string starts and ends with a comma.
13348 Currently supported identities are
13349 .Ql libressl
13350 (LibreSSL) ,
13351 .Ql libssl-0x10100
13352 (OpenSSL v1.1.x series)
13354 .Ql libssl-0x10000
13355 (elder OpenSSL series, other clones).
13356 Optional features are preceded with a plus sign
13357 .Ql +
13358 when available, and with a hyphen-minus
13359 .Ql -
13360 otherwise.
13362 Currently known features are
13363 .Ql conf-ctx
13364 .Pf ( Va tls-config-pairs ) ,
13365 .Ql ctx-config
13366 .Pf ( Va tls-config-module ) ,
13367 .Ql ctx-set-ciphersuites
13368 .Pf ( Cd Ciphersuites
13369 slot of
13370 .Va tls-config-pairs ) ,
13371 .Ql ctx-set-maxmin-proto
13372 .Pf ( Va tls-config-pairs ) ,
13373 .Ql modules-load-file
13374 .Pf ( Va tls-config-file ) ,
13376 .Ql tls-rand-file
13377 .Pf ( Va tls-rand-file ) .
13379 .Mx Va tls-fingerprint
13380 .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint
13381 \*(OP It is possible to replace the verification of the connection
13382 peer certificate against the entire local pool of CAs (for more see
13383 .Sx "Encrypted network communication" )
13384 with the comparison against a precalculated certificate message digest,
13385 the so-called fingerprint, to be specified as the used
13386 .Va tls-fingerprint-digest .
13387 This fingerprint can for example be calculated with
13388 .Ql Ic tls Ns \:\0\:fingerprint HOST .
13390 .Mx Va tls-fingerprint-digest
13391 .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \
13392   tls-fingerprint-digest
13393 \*(OP The message digest to be used when creating TLS certificate
13394 fingerprints, the defaults, if available, in test order, being
13395 .Ql BLAKE2s256 ,
13396 .Ql SHA256 .
13397 For the complete list of digest algorithms refer to
13398 .Va smime-sign-digest .
13401 .It Va tls-rand-file
13402 \*(OP If
13403 .Va tls-features
13404 announces
13405 .Ql +tls-rand-file
13406 then this will be queried to find a file with random entropy data which
13407 can be used to seed the P(seudo)R(andom)N(umber)G(enerator), see
13408 .Xr RAND_load_file 3 .
13409 The default filename
13410 .Pf ( Xr RAND_file_name 3 ,
13411 normally
13412 .Pa ~/.rnd )
13413 will be used if this variable is not set or empty, or if the
13414 .Sx "Filename transformations"
13415 fail.
13416 Shall seeding the PRNG have been successful,
13417 .Xr RAND_write_file 3
13418 will be called to update the entropy.
13419 Remarks: libraries which do not announce this feature seed the PRNG by
13420 other means.
13422 .Mx Va tls-verify
13423 .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify
13424 \*(OP Variable chain that sets the action to be performed if an error
13425 occurs during TLS server certificate validation against the
13426 specified or default trust stores
13427 .Va tls-ca-dir ,
13428 .Va tls-ca-file ,
13429 or the TLS library built-in defaults (unless usage disallowed via
13430 .Va tls-ca-no-defaults ) ,
13431 and as fine-tuned via
13432 .Va tls-ca-flags .
13433 Valid (case-insensitive) values are
13434 .Ql strict
13435 (fail and close connection immediately),
13436 .Ql ask
13437 (ask whether to continue on standard input),
13438 .Ql warn
13439 (show a warning and continue),
13440 .Ql ignore
13441 (do not perform validation).
13442 The default is
13443 .Ql ask .
13445 .It Va toplines
13446 If defined, gives the number of lines of a message to be displayed
13447 with the command
13448 .Ic top ;
13449 if unset, the first five lines are printed, if set to 0 the variable
13450 .Va screen
13451 is inspected.
13452 If the value is negative then its absolute value will be used for
13453 unsigned right shifting (see
13454 .Ic vexpr )
13456 .Va screen
13457 height.
13460 .It Va topsqueeze
13461 \*(BO If set then the
13462 .Ic top
13463 command series will strip adjacent empty lines and quotations.
13466 .It Va ttycharset
13467 The character set of the terminal \*(UA operates on,
13468 and the one and only supported character set that \*(UA can use if no
13469 character set conversion capabilities have been compiled into it,
13470 in which case it defaults to ISO-8859-1.
13471 Otherwise it defaults to UTF-8.
13472 Sufficient locale support provided the default will be preferably
13473 deduced from the locale environment if that is set (for example
13474 .Ev LC_CTYPE ,
13475 see there for more); runtime locale changes will be reflected by
13476 .Va \&\&ttycharset
13477 except during the program startup phase and if
13478 .Fl S
13479 had been used to freeze the given value.
13480 Refer to the section
13481 .Sx "Character sets"
13482 for the complete picture about character sets.
13485 .It Va typescript-mode
13486 \*(BO A special multiplex variable that disables all variables and
13487 settings which result in behaviour that interferes with running \*(UA in
13488 .Xr script 1 ;
13489 it sets
13490 .Va colour-disable ,
13491 .Va line-editor-disable
13492 and (before startup completed only)
13493 .Va termcap-disable .
13494 Unsetting it does not restore the former state of the covered settings.
13497 .It Va umask
13498 For a safe-by-default policy the process file mode creation mask
13499 .Xr umask 2
13500 will be set to
13501 .Ql 0077
13502 on program startup after the resource files have been loaded,
13503 and unless this variable is set.
13504 By assigning this an empty value the active setting will not be changed,
13505 otherwise the given value will be made the new file mode creation mask.
13506 Child processes inherit the file mode creation mask of their parent.
13508 .Mx Va user
13509 .It Va user-HOST , user
13510 \*(IN Variable chain that sets a global fallback user name, used in case
13511 none has been given in the protocol and account-specific URL.
13512 This variable defaults to the name of the user who runs \*(UA.
13515 .It Va v15-compat
13516 Enable upward compatibility with \*(UA version 15.0 in respect to which
13517 configuration options are available and how they are handled.
13518 If set to a non-empty value the command modifier
13519 .Cm wysh
13520 is implied and thus enforces
13521 .Sx "Shell-style argument quoting"
13522 over
13523 .Sx "Old-style argument quoting"
13524 for all commands which support both.
13525 This manual uses \*(IN and \*(OU to refer to the new and the old way of
13526 doing things, respectively.
13529 .It Va verbose
13530 Verbose mode enables logging of informational context messages.
13531 Historically a \*(BO variable, this can either be set multiple times
13532 (what the command line option
13533 .Fl v
13534 uses), or be assigned a numeric value in order to increase verbosity.
13535 Assigning the value 0 disables verbosity and thus (almost) equals
13536 .Ic unset .
13537 The maximum number is 3.
13538 Also see
13539 .Va debug .
13547 .It Va version , version-date , \
13548   version-hexnum , version-major , version-minor , version-update
13549 \*(RO \*(UA version information: the first variable is a string with
13550 the complete version identification, the second the release date in ISO
13551 8601 notation without time.
13552 The third is a 32-bit hexadecimal number with the upper 8 bits storing
13553 the major, followed by the minor and update version numbers which occupy
13554 12 bits each.
13555 The latter three variables contain only decimal digits: the major, minor
13556 and update version numbers.
13557 The output of the command
13558 .Ic version
13559 will include this information.
13562 .It Va writebackedited
13563 If this variable is set messages modified using the
13564 .Ic edit
13566 .Ic visual
13567 commands are written back to the current folder when it is quit;
13568 it is only honoured for writable folders in MBOX format, though.
13569 Note that the editor will be pointed to the raw message content in that
13570 case, i.e., neither MIME decoding nor decryption will have been
13571 performed, and proper
13572 .Va mbox-rfc4155
13573 .Ql From_
13574 quoting of newly added or edited content is also left as an exercise
13575 to the user.
13577 .\" }}} (Variables)
13579 .\" }}} (INTERNAL VARIABLES)
13582 .\" .Sh ENVIRONMENT {{{
13583 .Sh ENVIRONMENT
13585 The term
13586 .Dq environment variable
13587 should be considered an indication that these variables are either
13588 standardized as vivid parts of process environments, or that they are
13589 commonly found in there.
13590 The process environment is inherited from the
13591 .Xr sh 1
13592 once \*(UA is started, and unless otherwise explicitly noted handling of
13593 the following variables transparently integrates into that of the
13594 .Sx "INTERNAL VARIABLES"
13595 from \*(UA's point of view.
13596 This means they can be managed via
13597 .Ic set
13599 .Ic unset ,
13600 causing automatic program environment updates (to be inherited by
13601 newly created child processes).
13604 In order to integrate other environment variables equally they need to
13605 be imported (linked) with the command
13606 .Ic environ .
13607 This command can also be used to set and unset non-integrated
13608 environment variables from scratch, sufficient system support provided.
13609 The following example, applicable to a POSIX shell, sets the
13610 .Ev COLUMNS
13611 environment variable for \*(UA only, and beforehand exports the
13612 .Ev EDITOR
13613 in order to affect any further processing in the running shell:
13615 .Bd -literal -offset indent
13616 $ EDITOR="vim -u ${HOME}/.vimrc"
13617 $ export EDITOR
13618 $ COLUMNS=80 \*(uA -R
13621 .Bl -tag -width ".It Ev BaNg"
13623 .It Ev COLUMNS
13624 The user's preferred width in column positions for the terminal screen.
13625 Queried and used once on program startup in interactive or batch
13626 .Pf ( Fl \&# )
13627 mode, actively managed for child processes and the MLE (see
13628 .Sx "On terminal control and line editor" )
13629 in interactive mode thereafter.
13630 Non-interactive mode always uses, and the fallback default is
13631 a compile-time constant, by default 80 columns.
13632 If in batch mode
13633 .Ev \&\&COLUMNS
13635 .Ev LINES
13636 are both set but not both are usable (empty, not a number, or 0) at
13637 program startup, then the real terminal screen size will be (tried to
13638 be) determined once.
13639 (Normally the
13640 .Xr sh 1
13641 manages these variables, and unsets them for pipe specifications etc.)
13644 .It Ev DEAD
13645 The name of the (mailbox)
13646 .Ic folder
13647 to use for saving aborted messages if
13648 .Va save
13649 is set; this defaults to
13650 .Pa \*(VD .
13651 If the variable
13652 .Va debug
13653 is set no output will be generated, otherwise the contents of the file
13654 will be replaced.
13655 Except shell globs
13656 .Sx "Filename transformations"
13657 (also see
13658 .Ic folder )
13659 will be performed.
13662 .It Ev EDITOR
13663 Pathname of the text editor to use for the
13664 .Ic edit
13665 command and
13666 .Ic ~e
13667 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
13668 .Ev VISUAL
13669 is used for a more display oriented editor.
13672 .It Ev HOME
13673 The user's home directory.
13674 This variable is only used when it resides in the process environment.
13675 The calling user's home directory will be used instead if this directory
13676 does not exist, is not accessible or cannot be read;
13677 it will always be used for the root user.
13678 (No test for being writable is performed to allow usage by
13679 non-privileged users within read-only jails, but dependent on settings
13680 this directory is a default write target for, for example,
13681 .Ev DEAD ,
13682 .Ev MBOX
13683 and more.)
13688 .It Ev LC_ALL , LC_CTYPE , LANG
13689 \*(OP The (names in lookup order of the)
13690 .Xr locale 7
13691 (and / or see
13692 .Xr setlocale 3 )
13693 which indicates the used
13694 .Sx "Character sets" .
13695 Runtime changes trigger automatic updates of the entire locale system,
13696 which includes updating
13697 .Va ttycharset
13698 (except during startup if the variable has been frozen via
13699 .Fl S ) .
13702 .It Ev LINES
13703 The user's preferred number of lines for the terminal screen.
13704 The behaviour is as described for
13705 .Ev COLUMNS ,
13706 yet the compile-time constant used in non-interactive mode and as
13707 a fallback defaults to 24 (lines).
13710 .It Ev LISTER
13711 Pathname of the directory lister to use in the
13712 .Ic folders
13713 command when operating on local mailboxes.
13714 Default is
13715 .Xr ls 1
13716 (path search through
13717 .Ev SHELL ) .
13720 .It Ev LOGNAME
13721 Upon startup \*(UA will actively ensure that this variable refers to the
13722 name of the user who runs \*(UA, in order to be able to pass a verified
13723 name to any newly created child process.
13726 .It Ev MAIL
13727 Is used as the user's
13728 .Mx -sx
13729 .Sx "primary system mailbox"
13730 unless
13731 .Va inbox
13732 is set.
13733 If the environmental fallback is also not set, a built-in compile-time
13734 default is used.
13735 This is assumed to be an absolute pathname.
13738 .It Ev MAILCAPS
13739 \*(OP Override the default path search of
13740 .Sx "The Mailcap files" :
13741 any existing file therein will be loaded in sequence, appending any
13742 content to the list of MIME type handler directives.
13743 The RFC 1524 standard imposed default value is assigned otherwise:
13744 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
13745 (The default value is a compile-time \*(OP.)
13748 .It Ev MAILRC
13749 Is used as a startup file instead of
13750 .Pa \*(ur
13751 if set.
13752 In order to avoid side-effects from configuration files scripts should
13753 either set this variable to
13754 .Pa /dev/null
13755 or the
13756 .Fl \&:
13757 command line option should be used.
13760 .It Ev MAILX_NO_SYSTEM_RC
13761 If this variable is set then reading of
13762 .Pa \*(UR
13763 (aka\&
13764 .Va system-mailrc )
13765 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
13766 had been started up with the option
13767 .Fl \&:
13768 (and according argument) or
13769 .Fl n .
13770 This variable is only used when it resides in the process environment.
13773 .It Ev MBOX
13774 The name of the user's
13775 .Mx -sx
13776 .Sx "secondary mailbox"
13777 file.
13778 A logical subset of the special
13779 .Sx "Filename transformations"
13780 (also see
13781 .Ic folder )
13782 are supported.
13783 The default is
13784 .Pa \*(VM .
13785 Traditionally this MBOX is used as the file to save messages from the
13786 .Mx -sx
13787 .Sx "primary system mailbox"
13788 that have been read.
13789 Also see
13790 .Sx "Message states" .
13793 .It Ev NETRC
13794 \*(IN\*(OP This variable overrides the default location of the user's
13795 .Pa \*(VN
13796 file.
13799 .It Ev PAGER
13800 Pathname of the program to use for backing the command
13801 .Ic more ,
13802 and when the
13803 .Va crt
13804 variable enforces usage of a pager for output.
13805 The default paginator is
13806 .Xr more 1
13807 (path search through
13808 .Ev SHELL ) .
13810 \*(UA inspects the contents of this variable: if its contains the string
13811 .Dq less
13812 then a non-existing environment variable
13813 .Ev LESS
13814 will be set to
13815 .Ql Ri ,
13816 likewise for
13817 .Dq lv
13818 .Ev LV
13819 will optionally be set to
13820 .Ql -c .
13821 Also see
13822 .Va colour-pager .
13825 .It Ev PATH
13826 A colon-separated list of directories that is searched by the shell when
13827 looking for commands, for example
13828 .Ql /bin:/usr/bin:/usr/local/bin .
13831 .It Ev POSIXLY_CORRECT
13832 This environment entry is automatically squared with
13833 .Va posix .
13836 .It Ev SHELL
13837 The shell to use for the commands
13838 .Ic \&! ,
13839 .Ic shell ,
13841 .Ic ~!
13842 .Sx "COMMAND ESCAPES"
13843 and when starting subprocesses.
13844 A default shell is used if this environment variable is not defined.
13847 .It Ev SOCKS5_PROXY
13848 This environment entry is automatically squared with
13849 .Va socks-proxy .
13852 .It Ev SOURCE_DATE_EPOCH
13853 Specifies a time in seconds since the Unix epoch (1970-01-01) to be
13854 used in place of the current time.
13855 This variable is looked up upon program startup, and its existence will
13856 switch \*(UA to a reproducible mode
13857 .Pf ( Lk https://reproducible-builds.org )
13858 which uses deterministic random numbers, a special fixated pseudo
13859 .Ev LOGNAME
13860 and more.
13861 This operation mode is used for development and by software packagers.
13862 \*(ID Currently an invalid setting is only ignored, rather than causing
13863 a program abortion.
13865 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
13868 .It Ev TERM
13869 \*(OP The terminal type for which output is to be prepared.
13870 For extended colour and font control please refer to
13871 .Sx "Coloured display" ,
13872 and for terminal management in general to
13873 .Sx "On terminal control and line editor" .
13876 .It Ev TMPDIR
13877 Except for the root user this variable defines the directory for
13878 temporary files to be used instead of
13879 .Pa \*(VT
13880 (or the given compile-time constant) if set, existent, accessible as
13881 well as read- and writable.
13882 This variable is only used when it resides in the process environment,
13883 but \*(UA will ensure at startup that this environment variable is
13884 updated to contain a usable temporary directory.
13887 .It Ev USER
13888 Identical to
13889 .Ev LOGNAME
13890 (see there), but this variable is not standardized, should therefore not
13891 be used, and is only corrected if already set.
13894 .It Ev VISUAL
13895 Pathname of the text editor to use for the
13896 .Ic visual
13897 command and
13898 .Ic ~v
13899 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
13900 .Ev EDITOR
13901 is used for a less display oriented editor.
13904 .\" }}}
13907 .\" .Sh FILES {{{
13908 .Sh FILES
13910 .\" file list {{{
13911 .Bl -tag -width ".It Pa BaNg"
13914 .It Pa ~/.mailcap , /etc/mailcap
13915 \*(OP Personal and system-wide MIME type handler definition files, see
13916 .Sx "The Mailcap files" .
13917 (The shown names are part of the RFC 1524 standard search path
13918 .Ev MAILCAPS . )
13920 .It Pa \*(ur , \*(UR
13921 User-specific and system-wide files giving initial commands, the
13922 .Sx "Resource files" .
13923 (The used filenames come from
13924 .Va MAILRC
13926 .Va system-mailrc ,
13927 respectively.)
13930 .It Pa \*(VM
13931 The default value for
13932 .Ev MBOX .
13936 .It Pa \*(vU , \*(vS
13937 Personal and system-wide MIME types, see
13938 .Sx "The mime.types files" .
13941 .It Pa \*(VN
13942 \*(IN\*(OP The default location of the user's
13943 .Pa .netrc
13944 file \(en the section
13945 .Sx "The .netrc file"
13946 documents the file format.
13947 The used path can be set via
13948 .Ev NETRC .
13951 .It Pa /dev/null
13952 The data sink
13953 .Xr null 4 .
13956 .It Pa ~/.rnd
13957 \*(OP Possible location for persistent random entropy seed storage, see
13958 .Va tls-rand-file .
13960 .\" }}}
13962 .\" .Ss "Resource files" {{{
13963 .Ss "Resource files"
13965 Upon startup \*(UA reads in several resource files, in order:
13967 .Bl -tag -width ".It Pa BaNg"
13969 .It Pa \*(UR
13970 System wide initialization file
13971 .Pf ( Va system-mailrc ) .
13972 Reading of this file can be suppressed, either by using the
13973 .Fl \&:
13974 (and according argument) or
13975 .Fl n
13976 command line options, or by setting the
13977 .Sx ENVIRONMENT
13978 variable
13979 .Ev MAILX_NO_SYSTEM_RC .
13982 .It Pa \*(ur
13983 File giving initial commands.
13984 A different file can be chosen by setting the
13985 .Sx ENVIRONMENT
13986 variable
13987 .Ev MAILRC .
13988 Reading of this file can be suppressed with the
13989 .Fl \&:
13990 command line option.
13992 .It Va mailx-extra-rc
13993 Defines a startup file to be read after all other resource files.
13994 It can be used to specify settings that are not understood by other
13995 .Xr mailx 1
13996 implementations, for example.
14000 The content of these files is interpreted as follows:
14003 .Bl -bullet -compact
14005 The whitespace characters space, tabulator and newline,
14006 as well as those defined by the variable
14007 .Va ifs ,
14008 are removed from the beginning and end of input lines.
14010 Empty lines are ignored.
14012 Any other line is interpreted as a command.
14013 It may be spread over multiple input lines if the newline character is
14014 .Dq escaped
14015 by placing a reverse solidus character
14016 .Ql \e
14017 as the last character of the line; whereas any leading whitespace of
14018 follow lines is ignored, trailing whitespace before a escaped newline
14019 remains in the input.
14021 If the line (content) starts with the number sign
14022 .Ql #
14023 then it is a comment-command and also ignored.
14024 (The comment-command is a real command, which does nothing, and
14025 therefore the usual follow lines mechanism applies!)
14029 Errors while loading these files are subject to the settings of
14030 .Va errexit
14032 .Va posix .
14033 More files with syntactically equal content can be
14034 .Ic source Ns ed .
14035 The following, saved in a file, would be an examplary content:
14037 .Bd -literal -offset indent
14038  # This line is a comment command.  And y\e
14039     es, it is really continued here.
14040 set debug \e
14041     verbose
14042     set editheaders
14044 .\" }}}
14046 .\" .Ss "The mime.types files" {{{
14047 .Ss "The mime.types files"
14049 As stated in
14050 .Sx "HTML mail and MIME attachments"
14051 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
14052 media types in order to classify message and attachment content.
14053 One source for them are
14054 .Pa mime.types
14055 files, the loading of which can be controlled by setting the variable
14056 .Va mimetypes-load-control .
14057 Another is the command
14058 .Ic mimetype ,
14059 which also offers access to \*(UAs MIME type cache.
14060 .Pa mime.types
14061 files have the following syntax:
14063 .Bd -literal -offset indent
14064 type/subtype extension [extension ...]
14065 # For example text/html html htm
14069 where
14070 .Ql type/subtype
14071 define the MIME media type, as standardized in RFC 2046:
14072 .Ql type
14073 is used to declare the general type of data, while the
14074 .Ql subtype
14075 specifies a specific format for that type of data.
14076 One or multiple filename
14077 .Ql extension Ns
14078 s, separated by whitespace, can be bound to the media type format.
14079 Comments may be introduced anywhere on a line with a number sign
14080 .Ql # ,
14081 causing the remaining line to be discarded.
14083 \*(UA also supports an extended, non-portable syntax in especially
14084 crafted files, which can be loaded via the alternative value syntax of
14085 .Va mimetypes-load-control ,
14086 and prepends an optional
14087 .Ql type-marker :
14090 .Dl [type-marker ]type/subtype extension [extension ...]
14093 The following type markers are supported:
14096 .Bl -tag -compact -width ".It Ar _n_u"
14097 .It Ar \&?
14098 Treat message parts with this content as plain text.
14099 .It Ar ?t
14100 The same as plain
14101 .Ar \&? .
14102 .It Ar ?h
14103 Treat message parts with this content as HTML tagsoup.
14104 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
14105 the content as plain text instead.
14106 .It Ar ?H
14107 Likewise
14108 .Ar ?h ,
14109 but instead of falling back to plain text require an explicit content
14110 handler to be defined.
14111 .It Ar ?q
14112 If no handler can be found a text message is displayed which says so.
14113 This can be annoying, for example signatures serve a contextual purpose,
14114 their content is of no use by itself.
14115 This marker will avoid displaying the text message.
14119 Further reading:
14120 for sending messages:
14121 .Ic mimetype ,
14122 .Va mime-allow-text-controls ,
14123 .Va mimetypes-load-control .
14124 For reading etc. messages:
14125 .Sx "HTML mail and MIME attachments" ,
14126 .Sx "The Mailcap files" ,
14127 .Ic mimetype ,
14128 .Va mime-counter-evidence ,
14129 .Va mimetypes-load-control ,
14130 .Va pipe-TYPE/SUBTYPE ,
14131 .Va pipe-EXTENSION .
14132 .\" }}}
14134 .\" .Ss "The Mailcap files" {{{ review
14135 .Ss "The Mailcap files"
14137 \*(OP RFC 1524 defines a
14138 .Dq User Agent Configuration Mechanism
14139 to be used to inform mail user agent programs about the locally
14140 installed facilities for handling various data formats, i.e., about
14141 commands and how they can be used to display, edit et cetera MIME part
14142 contents, as well as a default path search that includes multiple
14143 possible locations of resource files, and the
14144 .Ev MAILCAPS
14145 environment variable to overwrite that.
14146 Handlers found from doing the path search will be cached, the command
14147 .Ic mailcap
14148 operates on that cache, and the variable
14149 .Va mailcap-disable
14150 will suppress automatic loading, and usage of any mailcap handlers.
14151 .Sx "HTML mail and MIME attachments"
14152 gives a general overview of how MIME types are handled.
14155 .Dq Mailcap
14156 files consist of a set of newline separated entries.
14157 Comment lines start with a number sign
14158 .Ql #
14159 (in the first column!) and are ignored.
14160 Empty lines are ignored.
14161 All other lines are interpreted as mailcap entries.
14162 An entry definition may be split over multiple lines by placing the
14163 reverse solidus character
14164 .Ql \e
14165 last in all but the final line.
14166 The standard does not specify how leading whitespace of successive lines
14167 is to be treated, therefore they are retained.
14170 .Dq Mailcap
14171 entries consist of a number of semicolon
14172 .Ql \&;
14173 separated fields.
14174 The first two fields are mandatory and must occur in the specified
14175 order, the remaining fields are optional and may appear in any order.
14176 Leading and trailing whitespace of field content is ignored (removed).
14177 The reverse solidus
14178 .Ql \e
14179 character can be used to escape any following character including
14180 semicolon and itself in the content of the second field, and in value
14181 parts of any optional key/value field.
14184 The first field defines the MIME
14185 .Ql TYPE/SUBTYPE
14186 the entry is about to handle (case-insensitively).
14187 If the subtype is specified as an asterisk
14188 .Ql *
14189 the entry is meant to match all subtypes of the named type, e.g.,
14190 .Ql audio/*
14191 would match any audio type.
14192 The second field is the
14193 .Cd view
14194 shell command used to display MIME parts of the given type.
14197 Data consuming shell commands will be fed message (MIME part) data on
14198 standard input unless one or more instances of the (unquoted) string
14199 .Ql %s
14200 are used: these formats will be replaced with a temporary file(name)
14201 that has been prefilled with the parts data.
14202 Data producing shell commands are expected to generata data on their
14203 standard output unless that format is used.
14204 In all cases any given
14205 .Ql %s
14206 format is replaced with a properly shell quoted filename.
14207 When a command requests a temporary file via
14208 .Ql %s
14209 then that will be removed again, as if the
14210 .Cd x-mailx-tmpfile
14212 .Cd x-mailx-tmpfile-fill
14213 flags had been set; unless the command requests
14214 .Cd x-mailx-async
14216 .Cd x-mailx-tmpfile-unlink
14217 flag is also implied; see below for more.
14220 Optional fields define single-word flags (case-insensitive), or key
14221 / value pairs consisting of a case-insensitive keyword, an equals sign
14222 .Ql = ,
14223 and a shell command; whitespace surrounding the equals sign is removed.
14224 Optional fields include the following:
14227 .Bl -tag -width ".It Cd BaNg"
14228 .It Cd compose
14229 A program that can be used to compose a new body or body part in the
14230 given format.
14231 (Currently unused.)
14233 .It Cd composetyped
14234 Similar to the
14235 .Cd compose
14236 field, but is to be used when the composing program needs to specify the
14237 .Ql Content-type:
14238 header field to be applied to the composed data.
14239 (Currently unused.)
14242 .It Cd copiousoutput
14243 A flag field which indicates that the output of the
14244 .Cd view
14245 command is integrable into \*(UAs normal visual display.
14246 It is mutually exclusive with
14247 .Cd needsterminal .
14249 .It Cd description
14250 A textual description that describes this type of data.
14251 The text may optionally be enclosed within double quotation marks
14252 .Ql \&" .
14254 .It Cd edit
14255 A program that can be used to edit a body or body part in the given
14256 format.
14257 (Currently unused.)
14259 .It Cd nametemplate
14260 This field specifies a filename format for the
14261 .Ql %s
14262 format used in the shell command fields, in which
14263 .Ql %s
14264 will be replaced by a random string.
14265 (The filename is also stored in and passed to subprocesses via
14266 .Ev MAILX_FILENAME_TEMPORARY . )
14267 The standard says this is
14268 .Dq only expected to be relevant in environments \
14269   where filename extensions are meaningful ,
14270 and so this field is ignored unless the
14271 .Ql %s
14272 is a prefix, optionally followed by (ASCII) alphabetic and numeric
14273 characters, the underscore and the period.
14274 For example, to specify that a JPG file is to be passed to an image
14275 viewer with a name ending in
14276 .Ql .jpg ,
14277 .Ql nametemplate=%s.jpg
14278 can be used.
14281 .It Cd needsterminal
14282 This flag field indicates that the given shell command must be run on
14283 an interactive terminal.
14284 \*(UA will temporarily release the terminal to the given command in
14285 interactive mode, in non-interactive mode this entry will be entirely
14286 ignored; this flag implies
14287 .Cd x-mailx-noquote .
14289 .It Cd print
14290 A program that can be used to print a message or body part in the given
14291 format.
14292 (Currently unused.)
14294 .It Cd test
14295 Specifies a program to be run to test some condition, for example, the
14296 machine architecture, or the window system in use, to determine whether
14297 or not this mailcap entry applies.
14298 If the test fails, a subsequent mailcap entry should be sought; also see
14299 .Cd x-mailx-test-once .
14300 Standard I/O of the test program is redirected from and to
14301 .Pa /dev/null ,
14302 and the format
14303 .Ql %s
14304 is not supported (the data does not yet exist).
14306 .It Cd textualnewlines
14307 A flag field which indicates that this type of data is line-oriented and
14308 that, if encoded in
14309 .Ql base64 ,
14310 all newlines should be converted to canonical form (CRLF) before
14311 encoding, and will be in that form after decoding.
14312 (Currently unused.)
14314 .It Cd x11-bitmap
14315 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
14316 icon to be used to visually denote the presence of this kind of data.
14317 This field is not used by \*(UA.
14320 .It Cd x-mailx-async
14321 Extension flag field that denotes that the given
14322 .Cd view
14323 command shall be executed asynchronously, without blocking \*(UA.
14324 Cannot be used in conjunction with
14325 .Cd needsterminal ;
14326 the standard output of the command will go to
14327 .Pa /dev/null .
14330 .It Cd x-mailx-noquote
14331 An extension flag field that indicates that even a
14332 .Cd copiousoutput
14333 .Cd view
14334 command shall not be used when
14335 .Va quote Ns
14336 ing messages, as it would by default.
14339 .It Cd x-mailx-test-once
14340 Extension flag which denotes whether the given
14341 .Cd test
14342 command shall be evaluated once only with its exit status being cached.
14343 This is handy if some global unchanging condition is to be queried, like
14344 .Dq running under the X Window System .
14347 .It Cd x-mailx-tmpfile
14348 Extension flag field that requests creation of a zero-sized temporary
14349 file, the name of which is to be placed in the environment variable
14350 .Ev MAILX_FILENAME_TEMPORARY .
14351 It is an error to use this flag with commands that include a
14352 .Ql %s
14353 format (because that is implemented by means of this temporary file).
14356 .It Cd x-mailx-tmpfile-fill
14357 Normally the MIME part content is passed to the handler via standard
14358 input; if this flag is set then the data will instead be written into
14359 the implied
14360 .Cd x-mailx-tmpfile .
14361 In order to cause deletion of the temporary file you will have to set
14362 .Cd x-mailx-tmpfile-unlink
14363 explicitly!
14364 It is an error to use this flag with commands that include a
14365 .Ql %s
14366 format.
14369 .It Cd x-mailx-tmpfile-unlink
14370 Extension flag field that requests that the temporary file shall be
14371 deleted automatically when the command loop is entered again at latest.
14372 It is an error to use this flag with commands that include a
14373 .Ql %s
14374 format, or in conjunction with
14375 .Cd x-mailx-async .
14376 .Cd x-mailx-tmpfile
14377 is implied.
14382 The standard includes the possibility to define any number of additional
14383 fields, prefixed by
14384 .Ql x- .
14385 Flag fields apply to the entire
14386 .Dq Mailcap
14387 entry \(em in some unusual cases, this may not be desirable, but
14388 differentiation can be accomplished via separate entries, taking
14389 advantage of the fact that subsequent entries are searched if an earlier
14390 one does not provide enough information.
14391 For example, if a
14392 .Cd view
14393 command needs to specify the
14394 .Cd needsterminal
14395 flag, but the
14396 .Cd compose
14397 command shall not, the following will help out the latter:
14399 .Bd -literal -offset indent
14400 application/postscript; ps-to-terminal %s; needsterminal
14401 application/postscript; ps-to-terminal %s; compose=idraw %s
14405 In value parts of command fields any occurrence of the format string
14406 .Ql %t
14407 will be replaced by the
14408 .Ql TYPE/SUBTYPE
14409 specification.
14410 Any named parameter from a messages'
14411 .Ql Content-type:
14412 field may be embedded into the command line using the format
14413 .Ql %{
14414 followed by the parameter name and a closing brace
14415 .Ql }
14416 character.
14417 The entire parameter should appear as a single command line argument,
14418 regardless of embedded spaces, shell quoting will be performed by the
14419 RFC 1524 processor, thus:
14421 .Bd -literal -offset indent
14422 # Message
14423 Content-type:  multipart/mixed; boundary=42
14425 # Mailcap file
14426 multipart/*; /usr/local/bin/showmulti \e
14427   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
14429 # Executed shell command
14430 /usr/local/bin/showmulti multipart/mixed 42
14434 Note that \*(UA does not support handlers for multipart MIME parts as
14435 shown in this example (as of today).
14436 It does not support the additional formats
14437 .Ql %n
14439 .Ql %F .
14440 An example file, also showing how to properly deal with the expansion of
14441 .Ql %s ,
14442 which includes any quotes that are necessary to make it a valid shell
14443 argument by itself and thus will cause undesired behaviour when placed
14444 in additional user-provided quotes:
14446 .Bd -literal -offset indent
14447 # Comment line
14448 text/richtext; richtext %s; copiousoutput
14450 text/x-perl; perl -cWT %s; nametemplate = %s.pl
14452 # Exit EX_TEMPFAIL=75 on signal
14453 application/pdf; \e
14454   infile=%s\e; \e
14455     trap "rm -f ${infile}" EXIT\e; \e
14456     trap "exit 75" INT QUIT TERM\e; \e
14457     mupdf "${infile}"; \e
14458   test = [ -n "${DISPLAY}" ]; \e
14459   nametemplate = %s.pdf; x-mailx-async
14460 application/pdf; pdftotext -layout - -; copiousoutput
14462 application/*; echo "This is \e\e"%t\e\e" but \e
14463     is 50 \e% Greek to me" \e; < %s head -c 512 | cat -vet; \e
14464   copiousoutput; x-mailx-noquote
14468 Further reading:
14469 .Sx "HTML mail and MIME attachments" ,
14470 .Sx "The mime.types files" ,
14471 .Ic mimetype ,
14472 .Ev MAILCAPS ,
14473 .Va mime-counter-evidence ,
14474 .Va pipe-TYPE/SUBTYPE ,
14475 .Va pipe-EXTENSION .
14476 .\" }}}
14478 .\" .Ss "The .netrc file" {{{ review
14479 .Ss "The .netrc file"
14481 User credentials for machine accounts (see
14482 .Sx "On URL syntax and credential lookup" )
14483 can be placed in the
14484 .Pa .netrc
14485 file, which will be loaded and cached when requested by
14486 .Va netrc-lookup .
14487 The default location
14488 .Pa \*(VN
14489 may be overridden by the
14490 .Ev NETRC
14491 environment variable.
14492 As long as syntax constraints are honoured the file source may be
14493 replaced with the output of the shell command set in
14494 .Va netrc-pipe ,
14495 to load an encrypted file, for example.
14496 The cache can be managed with the command
14497 .Ic netrc .
14500 The file consists of space, tabulator or newline separated tokens.
14501 This parser implements a superset of the original BSD syntax, but users
14502 should nonetheless be aware of portability glitches, shall their
14503 .Pa .netrc
14504 be usable across multiple programs and platforms:
14507 .Bl -bullet -compact
14509 BSD only supports double quotation marks, for example
14510 .Ql password """pass with spaces""" .
14512 BSD (only?) supports escaping of single characters via a reverse solidus
14513 (a space could be escaped via
14514 .Ql \e\0 ) ,
14515 in- as well as outside of a quoted string.
14516 This method is assumed to be present, and will actively be used to quote
14517 double quotation marks
14518 .Ql \&"
14519 and reverse solidus
14520 .Ql \e
14521 characters inside the
14522 .Cd login
14524 .Cd password
14525 tokens, for example for display purposes.
14527 BSD does not require a final quotation mark of the last user input token.
14529 The original BSD (Berknet) parser also supported a format which allowed
14530 tokens to be separated with commas \(en whereas at least Hewlett-Packard
14531 still seems to support this syntax, this parser does not!
14533 As a non-portable extension some widely-used programs support
14534 shell-style comments: if an input line starts, after any amount of
14535 whitespace, with a number sign
14536 .Ql # ,
14537 then the rest of the line is ignored.
14539 Whereas other programs may require that the
14540 .Pa .netrc
14541 file is accessible by only the user if it contains a
14542 .Cd password
14543 token for any other
14544 .Cd login
14545 than
14546 .Dq anonymous ,
14547 this parser will always require these strict permissions.
14551 Of the following list of supported tokens this parser uses (and caches)
14552 .Cd machine ,
14553 .Cd login
14555 .Cd password .
14556 An existing
14557 .Cd default
14558 entry will not be used.
14560 .Bl -tag -width ".It Cd BaNg"
14561 .It Cd machine Ar name
14562 The hostname of the entries' machine, lowercase-normalized before use.
14563 Any further file content, until either end-of-file or the occurrence
14564 of another
14565 .Cd machine
14566 or a
14567 .Cd default
14568 first-class token is bound (only related) to the machine
14569 .Ar name .
14571 As an extension that should not be the cause of any worries this parser
14572 supports a single wildcard prefix for
14573 .Ar name :
14574 .Bd -literal -offset indent
14575 machine *.example.com login USER password PASS
14576 machine pop3.example.com login USER password PASS
14577 machine smtp.example.com login USER password PASS
14580 which would match
14581 .Ql xy.example.com
14582 as well as
14583 .Ql pop3.example.com ,
14584 but neither
14585 .Ql example.com
14587 .Ql local.smtp.example.com .
14588 In the example neither
14589 .Ql pop3.example.com
14591 .Ql smtp.example.com
14592 will be matched by the wildcard, since the exact matches take
14593 precedence (it is however faster to specify it the other way around).
14595 .It Cd default
14596 This is the same as
14597 .Cd machine
14598 except that it is a fallback entry that is used shall none of the
14599 specified machines match; only one default token may be specified,
14600 and it must be the last first-class token.
14602 .It Cd login Ar name
14603 The user name on the remote machine.
14605 .It Cd password Ar string
14606 The user's password on the remote machine.
14608 .It Cd account Ar string
14609 Supply an additional account password.
14610 This is merely for FTP purposes.
14612 .It Cd macdef Ar name
14613 Define a macro.
14614 A macro is defined with the specified
14615 .Ar name ;
14616 it is formed from all lines beginning with the next line and continuing
14617 until a blank line is (consecutive newline characters are) encountered.
14618 (Note that
14619 .Cd macdef
14620 entries cannot be utilized by multiple machines, too, but must be
14621 defined following the
14622 .Ic machine
14623 they are intended to be used with.)
14624 If a macro named
14625 .Ar init
14626 exists, it is automatically run as the last step of the login process.
14627 This is merely for FTP purposes.
14629 .\" }}}
14631 .\" }}}
14634 .\" .Sh EXAMPLES {{{
14635 .Sh EXAMPLES
14637 .\" .Ss "An example configuration" {{{
14638 .Ss "An example configuration"
14640 .Bd -literal -offset indent
14641 # This example assumes v15.0 compatibility mode
14642 set v15-compat
14644 # Request strict TLL transport layer security checks
14645 set tls-verify=strict
14647 # Where are the up-to-date TLS certificates?
14648 # (Since we manage up-to-date ones explicitly, do not use any,
14649 # possibly outdated, default certificates shipped with OpenSSL)
14650 #set tls-ca-dir=/etc/ssl/certs
14651 set tls-ca-file=/etc/ssl/certs/ca-certificates.crt
14652 set tls-ca-no-defaults
14653 #set tls-ca-flags=partial-chain
14654 wysh set smime-ca-file="${tls-ca-file}" \e
14655   smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}"
14657 # This could be outsourced to a central configuration file via
14658 # tls-config-file plus tls-config-module if the used library allows.
14659 # CipherString: explicitly define the list of ciphers, which may
14660 #   improve security, especially with protocols older than TLS v1.2.
14661 #   See ciphers(1).  Possibly best to only use tls-config-pairs-HOST
14662 #   (or -USER@HOST), as necessary, again..
14663 #   Note that TLSv1.3 uses Ciphersuites= instead, which will join
14664 #   with CipherString (if protocols older than v1.3 are allowed)
14665 # Curves: especially with TLSv1.3 curves selection may be desired.
14666 # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.
14667 #   Change this only when the remote server does not support it:
14668 #   maybe use chain support via tls-config-pairs-HOST / -USER@HOST
14669 #   to define such explicit exceptions, then, e.g.,
14670 #     MinProtocol=TLSv1.1
14671 if [ "$tls-features" =% +ctx-set-maxmin-proto ]
14672   wysh set tls-config-pairs='\e
14673       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
14674       Curves=P-521:P-384:P-256,\e
14675       MinProtocol=TLSv1.1'
14676 else
14677   wysh set tls-config-pairs='\e
14678       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
14679       Curves=P-521:P-384:P-256,\e
14680       Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2\e, +TLSv1.3'
14681 endif
14683 # Essential setting: select allowed character sets
14684 set sendcharsets=utf-8,iso-8859-1
14686 # A very kind option: when replying to a message, first try to
14687 # use the same encoding that the original poster used herself!
14688 set reply-in-same-charset
14690 # When replying, do not merge From: and To: of the original message
14691 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
14692 set recipients-in-cc
14694 # When sending messages, wait until the Mail-Transfer-Agent finishs.
14695 # Only like this you will be able to see errors reported through the
14696 # exit status of the MTA (including the built-in SMTP one)!
14697 set sendwait
14699 # Only use built-in MIME types, no mime.types(5) files
14700 set mimetypes-load-control
14702 # Default directory where we act in (relative to $HOME)
14703 set folder=mail
14704 # A leading "+" (often) means: under *folder*
14705 # *record* is used to save copies of sent messages
14706 set MBOX=+mbox.mbox DEAD=+dead.txt \e
14707   record=+sent.mbox record-files record-resent
14709 # Make "file mymbox" and "file myrec" go to..
14710 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
14712 # Not really optional, e.g., for S/MIME
14713 set from='Your Name <address@exam.ple>'
14715 # It may be necessary to set hostname and/or smtp-hostname
14716 # if the "SERVER" of mta and "domain" of from do not match.
14717 # The `urlencode' command can be used to encode USER and PASS
14718 set mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \e
14719   smtp-auth=login/plain... \e
14720   smtp-use-starttls
14722 # Never refuse to start into interactive mode, and more
14723 set emptystart \e
14724   colour-pager crt= \e
14725   followup-to followup-to-honour=ask-yes fullnames \e
14726   history-file=+.\*(uAhist history-size=-1 history-gabby \e
14727   mime-counter-evidence=0b1111 \e
14728   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
14729   reply-to-honour=ask-yes \e
14730   umask=
14732 # Only include the selected header fields when typing messages
14733 headerpick type retain from_ date from to cc subject \e
14734   message-id mail-followup-to reply-to
14735 # ...when forwarding messages
14736 headerpick forward retain subject date from to cc
14737 # ...when saving message, etc.
14738 #headerpick save ignore ^Original-.*$ ^X-.*$
14740 # Some mailing lists
14741 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
14742 mlsubscribe '^xfans@xfans\e.xyz$'
14744 # Handle a few file extensions (to store MBOX databases)
14745 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
14746   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
14747   zst 'zstd -dc' 'zstd -19 -zc' \e
14748   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
14750 # A real life example of a very huge free mail provider
14751 # Instead of directly placing content inside `account',
14752 # we `define' a macro: like that we can switch "accounts"
14753 # from within *on-compose-splice*, for example!
14754 define XooglX {
14755   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
14756   set from='Your Name <address@examp.ple>'
14758   set pop3-no-apop-pop.gmXil.com
14759   shortcut pop %:pop3s://pop.gmXil.com
14760   shortcut imap %:imaps://imap.gmXil.com
14761   # Or, entirely IMAP based setup
14762   #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e
14763   #   imap-cache=~/spool/cache
14765   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
14766   # Alternatively:
14767   set mta=smtps://USER:PASS@smtp.gmail.com:465
14769 account XooglX {
14770   \ecall XooglX
14773 # Here is a pretty large one which does not allow sending mails
14774 # if there is a domain name mismatch on the SMTP protocol level,
14775 # which would bite us if the value of from does not match, e.g.,
14776 # for people who have a sXXXXeforge project and want to speak
14777 # with the mailing list under their project account (in from),
14778 # still sending the message through their normal mail provider
14779 define XandeX {
14780   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
14781   set from='Your Name <address@exam.ple>'
14783   shortcut pop %:pop3s://pop.yaXXex.com
14784   shortcut imap %:imaps://imap.yaXXex.com
14786   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
14787     hostname=yaXXex.com smtp-hostname=
14789 account XandeX {
14790   \ecall Xandex
14793 # Create some new commands so that, e.g., `ls /tmp' will..
14794 commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS'
14795 commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS'
14797 set pipe-message/external-body='?* echo $MAILX_EXTERNAL_BODY_URL'
14799 # We do not support gpg(1) directly yet.  But simple --clearsign'd
14800 # message parts can be dealt with as follows:
14801 define V {
14802   localopts yes
14803   wysh set pipe-text/plain=$'?*#++=?\e
14804     < "${MAILX_FILENAME_TEMPORARY}" awk \e
14805         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
14806       BEGIN{done=0}\e
14807       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
14808         if(done++ != 0)\e
14809           next;\e
14810         print "--- GPG --verify ---";\e
14811         system("gpg --verify " TMPFILE " 2>&1");\e
14812         print "--- GPG --verify ---";\e
14813         print "";\e
14814         next;\e
14815       }\e
14816       /^-----BEGIN PGP SIGNATURE-----/,\e
14817           /^-----END PGP SIGNATURE-----/{\e
14818         next;\e
14819       }\e
14820       {print}\e
14821     \e''
14822     print
14824 commandalias V '\e'call V
14828 When storing passwords in
14829 .Pa \*(ur
14830 appropriate permissions should be set on this file with
14831 .Ql $ chmod 0600 \*(ur .
14832 If the \*(OPal
14833 .Va netrc-lookup
14834 is available user credentials can be stored in the central
14835 .Pa \*(VN
14836 file instead; e.g., here is a different version of the example account
14837 that sets up SMTP and POP3:
14839 .Bd -literal -offset indent
14840 define XandeX {
14841   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
14842   set from='Your Name <address@exam.ple>'
14843   set netrc-lookup
14844   # Load an encrypted ~/.netrc by uncommenting the next line
14845   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
14847   set mta=smtps://smtp.yXXXXx.ru:465 \e
14848       smtp-hostname= hostname=yXXXXx.com
14849   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
14850   commandalias xp fi pop3s://pop.yXXXXx.ru
14852 account XandeX {
14853   \ecall XandeX
14858 and, in the
14859 .Pa \*(VN
14860 file:
14862 .Bd -literal -offset indent
14863 machine *.yXXXXx.ru login USER password PASS
14867 This configuration should now work just fine:
14870 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
14871 .\" }}}
14873 .\" .Ss "S/MIME step by step" {{{
14874 .Ss "S/MIME step by step"
14876 \*(OP The first thing that is needed for
14877 .Sx "Signed and encrypted messages with S/MIME"
14878 is a personal certificate, and a private key.
14879 The certificate contains public information, in particular a name and
14880 email address(es), and the public key that can be used by others to
14881 encrypt messages for the certificate holder (the owner of the private
14882 key), and to
14883 .Ic verify
14884 signed messages generated with that certificate('s private key).
14885 Whereas the certificate is included in each signed message, the private
14886 key must be kept secret.
14887 It is used to decrypt messages that were previously encrypted with the
14888 public key, and to sign messages.
14891 For personal use it is recommended to get a S/MIME certificate from
14892 one of the major CAs on the Internet.
14893 Many CAs offer such certificates for free.
14894 Usually offered is a combined certificate and private key in PKCS#12
14895 format which \*(UA does not accept directly.
14896 To convert it to PEM format, the following shell command can be used;
14897 please read on for how to use these PEM files.
14899 .Bd -literal -offset indent
14900 $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes
14901 $ # Alternatively
14902 $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys
14903 $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes
14907 There is also
14908 .Lk https://www.CAcert.org
14909 which issues client and server certificates to members of their
14910 community for free; their root certificate
14911 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
14912 is often not in the default set of trusted CA root certificates, though,
14913 which means their root certificate has to be downloaded separately,
14914 and needs to be part of the S/MIME certificate validation chain by
14915 including it in
14916 .Va smime-ca-dir
14917 or as a vivid member of the
14918 .Va smime-ca-file .
14919 But let us take a step-by-step tour on how to setup S/MIME with
14920 a certificate from CAcert.org despite this situation!
14923 First of all you will have to become a member of the CAcert.org
14924 community, simply by registrating yourself via the web interface.
14925 Once you are, create and verify all email addresses you want to be able
14926 to create signed and encrypted messages for/with using the corresponding
14927 entries of the web interface.
14928 Now ready to create S/MIME certificates, so let us create a new
14929 .Dq client certificate ,
14930 ensure to include all email addresses that should be covered by the
14931 certificate in the following web form, and also to use your name as the
14932 .Dq common name .
14935 Create a private key and a certificate request on your local computer
14936 (please see the manual pages of the used commands for more in-depth
14937 knowledge on what the used arguments etc. do):
14940 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
14943 Afterwards copy-and-paste the content of
14944 .Dq creq.pem
14945 into the certificate-request (CSR) field of the web form on the
14946 CAcert.org website (you may need to unfold some
14947 .Dq advanced options
14948 to see the corresponding text field).
14949 This last step will ensure that your private key (which never left your
14950 box) and the certificate belong together (through the public key that
14951 will find its way into the certificate via the certificate-request).
14952 You are now ready and can create your CAcert certified certificate.
14953 Download and store or copy-and-paste it as
14954 .Dq pub.crt .
14957 Yay.
14958 In order to use your new S/MIME setup a combined private key/public key
14959 (certificate) file has to be created:
14962 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
14965 This is the file \*(UA will work with.
14966 If you have created your private key with a passphrase then \*(UA will
14967 ask you for it whenever a message is signed or decrypted, unless this
14968 operation has been automated as described in
14969 .Sx "Signed and encrypted messages with S/MIME" .
14970 Set the following variables to henceforth use S/MIME (setting
14971 .Va smime-ca-file
14972 is of interest for verification only):
14974 .Bd -literal -offset indent
14975 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
14976     smime-sign-cert=ME@HERE.com.paired \e
14977     smime-sign-digest=SHA512 \e
14978     smime-sign from=myname@my.host
14981 .\" }}}
14983 .\" .Ss "Using CRLs with S/MIME or TLS" {{{
14984 .Ss "Using CRLs with S/MIME or TLS"
14986 \*(OP Certification authorities (CAs) issue certificate revocation
14987 lists (CRLs) on a regular basis.
14988 These lists contain the serial numbers of certificates that have been
14989 declared invalid after they have been issued.
14990 Such usually happens because the private key for the certificate has
14991 been compromised,
14992 because the owner of the certificate has left the organization that is
14993 mentioned in the certificate, etc.
14994 To seriously use S/MIME or TLS verification,
14995 an up-to-date CRL is required for each trusted CA.
14996 There is otherwise no method to distinguish between valid and
14997 invalidated certificates.
14998 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
14999 the Internet, so they have to be retrieved by some external mechanism.
15002 \*(UA accepts CRLs in PEM format only;
15003 CRLs in DER format must be converted, like, e.\|g.:
15006 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
15009 To tell \*(UA about the CRLs, a directory that contains all CRL files
15010 (and no other files) must be created.
15012 .Va smime-crl-dir
15014 .Va tls-crl-dir
15015 variables, respectively, must then be set to point to that directory.
15016 After that, \*(UA requires a CRL to be present for each CA that is used
15017 to verify a certificate.
15018 .\" }}}
15020 .\" }}} (Examples)
15023 .\" .Sh "FAQ" {{{
15024 .Sh "FAQ"
15026 In general it is a good idea to turn on
15027 .Va debug
15028 .Pf ( Fl d )
15029 and / or
15030 .Va verbose
15031 .Pf ( Fl v ,
15032 twice) if something does not work well.
15033 Very often a diagnostic message can be produced that leads to the
15034 problems' solution.
15036 .\" .Ss "\*(UA shortly hangs on startup" {{{
15037 .Ss "\*(UA shortly hangs on startup"
15039 This can have two reasons, one is the necessity to wait for a file lock
15040 and cannot be helped, the other being that \*(UA calls the function
15041 .Xr uname 2
15042 in order to query the nodename of the box (sometimes the real one is
15043 needed instead of the one represented by the internal variable
15044 .Va hostname ) .
15045 One may have varying success by ensuring that the real hostname and
15046 .Ql localhost
15047 have entries in
15048 .Pa /etc/hosts ,
15049 or, more generally, that the name service is properly setup \(en
15050 and does
15051 .Xr hostname 1
15052 return the expected value?
15053 Does this local hostname have a domain suffix?
15054 RFC 6762 standardized the link-local top-level domain
15055 .Ql .local ,
15056 try again after adding an (additional) entry with this extension.
15057 .\" }}}
15059 .\" .Ss "I cannot login to Google mail (via OAuth)" {{{
15060 .Ss "I cannot login to Google mail \&(via OAuth\&)"
15062 Since 2014 some free service providers classify programs as
15063 .Dq less secure
15064 unless they use a special authentication method (OAuth 2.0) which
15065 was not standardized for non-HTTP protocol authentication token query
15066 until August 2015 (RFC 7628).
15069 Different to Kerberos / GSSAPI, which is developed since the mid of the
15070 1980s, where a user can easily create a local authentication ticket for
15071 her- and himself with the locally installed
15072 .Xr kinit 1
15073 program, that protocol has no such local part but instead requires
15074 a world-wide-web query to create or fetch a token; since there is no
15075 local cache this query would have to be performed whenever \*(UA is
15076 invoked (in interactive sessions situation may differ).
15079 \*(UA does not directly support OAuth.
15080 It, however, supports XOAUTH2 / OAUTHBEARER, see
15081 .Sx "But, how about XOAUTH2 / OAUTHBEARER?"
15082 If that is not used it is necessary to declare \*(UA a
15083 .Dq less secure app
15084 (on the providers account web page) in order to read and send mail.
15085 However, it also seems possible to take the following steps instead:
15088 .Bl -enum -compact
15090 give the provider the number of a mobile phone,
15092 enable
15093 .Dq 2-Step Verification ,
15095 create an application specific password (16 characters), and
15097 use that special password instead of the real Google account password in
15098 \*(UA (for more on that see the section
15099 .Sx "On URL syntax and credential lookup" ) .
15101 .\" }}}
15103 .\" .Ss "But, how about XOAUTH2 / OAUTHBEARER?" {{{
15104 .Ss "But, how about XOAUTH2 / OAUTHBEARER?"
15106 Following up
15107 .Sx "I cannot login to Google mail \&(via OAuth\&)"
15108 one OAuth-based authentication method is available:
15109 the OAuth 2.0 bearer token usage as standardized in RFC 6750 (according
15110 SASL mechanism in RFC 7628), also known as XOAUTH2 and OAUTHBEARER,
15111 allows fetching a temporary access token via the web that can locally be
15112 used as a
15113 .Va password .
15114 The protocol is simple and extendable, token updates or even password
15115 changes via a simple TLS secured server login would be possible in
15116 theory, but today a web browser and an external support tool are
15117 prerequisites for using this authentication method.
15118 The token times out and must be periodically refreshed via the web.
15121 Some hurdles must be taken before being able to use this method.
15122 Using GMail as an example, an application (that is a name) must be
15123 registered, for which credentials, a
15124 .Dq client ID
15125 and a
15126 .Dq client secret ,
15127 need to be created and saved locally (in a secure way).
15128 These initial configuration steps can be performed at
15129 .Lk https://console.developers.google.com/apis/credentials .
15130 Thereafter a refresh token can be requested;
15131 a python program to do this for GMail accounts is
15132 .Lk https://github.com/google/\:gmail-oauth2-tools/\:raw/\:\
15133 master/\:python/\:oauth2.py :
15135 .Bd -literal -offset indent
15136 $ python oauth2.py --user=EMAIL \e
15137   --client-id=THE-ID --client-secret=THE-SECRET \e
15138   --generate_oauth2_token
15139 To authorize token, visit this url and follow the directions:
15140   https://accounts.google.com/o/oauth2/auth?client_id=...
15141   Enter verification code: ...
15142   Refresh Token: ...
15143   Access Token: ...
15144   Access Token Expiration Seconds: 3600
15145 $ # Of which the last three are actual token responses.
15146 $ # Thereafter access tokens can regulary be refreshed
15147 $ # via the created refresh token (read on)
15151 The generated refresh token must also be saved locally (securely).
15152 The procedure as a whole can be read at
15153 .Lk https://github.com/google/\:gmail-oauth2-tools/\:wiki/\:\
15154 OAuth2DotPyRunThrough .
15155 Since periodic timers are not yet supported, keeping an access token
15156 up-to-date (from within \*(UA) can only be performed via the hook
15157 .Va on-main-loop-tick ,
15158 or (for sending only)
15159 .Va on-compose-enter
15160 (for more on authentication please see the section
15161 .Sx "On URL syntax and credential lookup" ) :
15163 .Bd -literal -offset indent
15164 set on-main-loop-tick=o-m-l-t on-compose-enter=o-c-e
15165 define o-m-l-t {
15166   xcall update_access_token
15168 define o-c-e {
15169   xcall update_access_token
15172 set access_token_=0
15173 define update_access_token {
15174   local set i epoch_sec epoch_nsec
15175   vput vexpr i epoch
15176   eval set $i # set epoch_sec/_nsec of vexpr epoch
15177   vput vexpr i + $access_token_ 2100
15178   if $epoch_sec -ge $i
15179     vput ! password python oauth2.py --user=EMAIL \e
15180         --client-id=THE-ID --client-secret=THE-SECRET \e
15181         --refresh-token=THE-REFRESH-TOKEN |\e
15182       sed '1b PASS;d; :PASS s/^.\e{1,\e}:\e(.\e{1,\e}\e)$/\e1/'
15183     vput csop password trim "$password"
15184     if -n "$verbose"
15185       echo password is <$password>
15186     endif
15187     set access_token_=$epoch_sec
15188   endif
15191 .\" }}}
15193 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{ review
15194 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
15196 Two thinkable situations: the first is a shadowed sequence; setting
15197 .Va debug ,
15198 or the most possible
15199 .Va verbose
15200 mode, causes a printout of the
15201 .Ic bind
15202 tree after that is built; being a cache, this happens only upon startup
15203 or after modifying bindings.
15206 Or second, terminal libraries (see
15207 .Sx "On terminal control and line editor",
15208 .Ic bind ,
15209 .Va termcap )
15210 may report different codes than the terminal really sends, rendering
15211 bindings dysfunctional because expected and received data do not match; the
15212 .Va verbose
15213 listing of
15214 .Ic bind Ns
15215 ings will show the byte sequences that are expected.
15216 (One common source of problems is that the \(em possibly even
15217 non-existing \(em keypad is not turned on, and the resulting layout
15218 reports the keypad control codes for the normal keyboard keys.)
15221 To overcome the situation use for example the program
15222 .Xr cat 1
15223 with its option
15224 .Fl \&\&v ,
15225 if available, to see the byte sequences which are actually produced
15226 by keypresses, and use the variable
15227 .Va termcap
15228 to make \*(UA aware of them.
15229 The terminal this is typed on produces some unexpected sequences,
15230 here for an example the shifted home key:
15232 .Bd -literal -offset indent
15233 ? set verbose
15234 ? bind*
15235 # 1B 5B=[ 31=1 3B=; 32=2 48=H
15236   bind base :kHOM z0
15237 ? x
15238 $ cat -v
15239 ^[[H
15240 $ \*(uA -v -Stermcap='kHOM=\eE[H'
15241 ? bind*
15242 # 1B 5B=[ 48=H
15243   bind base :kHOM z0
15245 .\" }}}
15247 .\" .Ss "Can \*(UA git-send-email?" {{{
15248 .Ss "Can \*(UA git-send-email?"
15250 Yes.
15251 Put (at least parts of) the following in your
15252 .Pa ~/.gitconfig :
15254 .Bd -literal -offset indent
15255 [sendemail]
15256 smtpserver = /usr/bin/\*(uA
15257 smtpserveroption = -t
15258 #smtpserveroption = -Sexpandaddr
15259 smtpserveroption = -Athe-account-you-need
15261 suppresscc = all
15262 suppressfrom = false
15263 assume8bitEncoding = UTF-8
15264 #to = /tmp/OUT
15265 confirm = always
15266 chainreplyto = true
15267 multiedit = false
15268 thread = true
15269 quiet = true
15270 annotate = true
15274 Patches can also be send directly, for example:
15276 .Bd -literal -offset indent
15277 $ git mail-patch HEAD^ |
15278   \*(uA -Athe-account-you-need -t RECEIVER
15280 .\" }}}
15282 .\" .Ss "Howto handle stale dotlock files" {{{
15283 .Ss "Howto handle stale dotlock files"
15285 .Ic folder
15286 sometimes fails to open MBOX mail databases because creation of
15287 .Mx -sx
15288 .Sx "dotlock files"
15289 is impossible due to existing but unowned lock files.
15290 \*(UA does not offer an option to deal with those files, because it is
15291 considered a site policy what counts as unowned, and what not.
15292 The site policy is usually defined by administrator(s), and expressed in
15293 the configuration of a locally installed MTA (for example Postfix
15294 .Ql stale_lock_time=500s ) .
15295 Therefore the suggestion:
15297 .Bd -literal -offset indent
15298 $ </dev/null \*(uA -s 'MTA: be no frog, handle lock' $LOGNAME
15302 By sending a mail to yourself the local MTA can use its normal queue
15303 mechanism to try the delivery multiple times, finally decide a lock file
15304 has become stale, and remove it.
15305 .\" }}}
15307 .\" }}}
15310 .\" .Sh "IMAP CLIENT" {{{
15311 .Sh "IMAP CLIENT"
15313 \*(OPally there is IMAP client support available.
15314 This part of the program is obsolete and will vanish in v15 with the
15315 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
15316 and makes excessive use of signal based long code jumps.
15317 Support can hopefully be readded later based on a new-style I/O, with
15318 SysV signal handling.
15319 In fact the IMAP support had already been removed from the codebase, but
15320 was reinstantiated on user demand: in effect the IMAP code is at the
15321 level of \*(UA v14.8.16 (with
15322 .Ic imapcodec
15323 being the sole exception), and should be treated with some care.
15326 IMAP uses the
15327 .Ql imap://
15329 .Ql imaps://
15330 protocol prefixes, and an IMAP-based
15331 .Va folder
15332 may be used.
15333 IMAP URLs (paths) undergo inspections and possible transformations
15334 before use (and the command
15335 .Ic imapcodec
15336 can be used to manually apply them to any given argument).
15337 Hierarchy delimiters are normalized, a step which is configurable via the
15338 .Va imap-delim
15339 variable chain, but defaults to the first seen delimiter otherwise.
15340 \*(UA supports internationalised IMAP names, and en- and decodes the
15341 names from and to the
15342 .Va ttycharset
15343 as necessary and possible.
15344 If a mailbox name is expanded (see
15345 .Sx "Filename transformations" )
15346 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
15347 mailboxes below the
15348 .Va folder
15349 target box, while folder names prefixed by `@' refer to folders below
15350 the hierarchy base, so the following will list all folders below the
15351 current one when in an IMAP mailbox:
15352 .Ql folders @ .
15355 Note: some IMAP servers do not accept the creation of mailboxes in
15356 the hierarchy base, but require that they are created as subfolders of
15357 `INBOX' \(en with such servers a folder name of the form
15359 .Dl imaps://mylogin@imap.myisp.example/INBOX.
15361 should be used (the last character is the server's hierarchy
15362 delimiter).
15363 The following IMAP-specific commands exist:
15366 .Bl -tag -width ".It Ic BaNg"
15368 .It Ic cache
15369 Only applicable to cached IMAP mailboxes;
15370 takes a message list and reads the specified messages into the IMAP
15371 cache.
15374 .It Ic connect
15375 If operating in disconnected mode on an IMAP mailbox,
15376 switch to online mode and connect to the mail server while retaining
15377 the mailbox status.
15378 See the description of the
15379 .Va disconnected
15380 variable for more information.
15383 .It Ic disconnect
15384 If operating in online mode on an IMAP mailbox,
15385 switch to disconnected mode while retaining the mailbox status.
15386 See the description of the
15387 .Va disconnected
15388 variable for more.
15389 A list of messages may optionally be given as argument;
15390 the respective messages are then read into the cache before the
15391 connection is closed, thus
15392 .Ql disco *
15393 makes the entire mailbox available for disconnected use.
15396 .It Ic imap
15397 Sends command strings directly to the current IMAP server.
15398 \*(UA operates always in IMAP `selected state' on the current mailbox;
15399 commands that change this will produce undesirable results and should be
15400 avoided.
15401 Useful IMAP commands are:
15402 .Bl -tag -offset indent -width ".Ic getquotearoot"
15403 .It create
15404 Takes the name of an IMAP mailbox as an argument and creates it.
15405 .It getquotaroot
15406 (RFC 2087) Takes the name of an IMAP mailbox as an argument
15407 and prints the quotas that apply to the mailbox.
15408 Not all IMAP servers support this command.
15409 .It namespace
15410 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
15411 the Other User's Namespaces and the Shared Namespaces.
15412 Each namespace type is printed in parentheses;
15413 if there are multiple namespaces of the same type,
15414 inner parentheses separate them.
15415 For each namespace a prefix and a hierarchy separator is listed.
15416 Not all IMAP servers support this command.
15420 .It Ic imapcodec
15421 Perform IMAP path transformations.
15422 Supports
15423 .Cm vput
15424 (see
15425 .Sx "Command modifiers" ) ,
15426 and manages the error number
15427 .Va \&! .
15428 The first argument specifies the operation:
15429 .Ar e[ncode]
15430 normalizes hierarchy delimiters (see
15431 .Va imap-delim )
15432 and converts the strings from the locale
15433 .Va ttycharset
15434 to the internationalized variant used by IMAP,
15435 .Ar d[ecode]
15436 performs the reverse operation.
15437 Encoding will honour the (global) value of
15438 .Va imap-delim .
15443 The following IMAP-specific internal variables exist:
15446 .Bl -tag -width ".It Va BaNg"
15448 .It Va disconnected
15449 \*(BO When an IMAP mailbox is selected and this variable is set,
15450 no connection to the server is initiated.
15451 Instead, data is obtained from the local cache (see
15452 .Va imap-cache Ns
15454 Mailboxes that are not present in the cache
15455 and messages that have not yet entirely been fetched from the server
15456 are not available;
15457 to fetch all messages in a mailbox at once,
15458 the command
15459 .No ` Ns Li copy * /dev/null Ns '
15460 can be used while still in connected mode.
15461 Changes that are made to IMAP mailboxes in disconnected mode are queued
15462 and committed later when a connection to that server is made.
15463 This procedure is not completely reliable since it cannot be guaranteed
15464 that the IMAP unique identifiers (UIDs) on the server still match the
15465 ones in the cache at that time.
15466 Data is saved to
15467 .Ev DEAD
15468 when this problem occurs.
15470 .It Va disconnected-USER@HOST
15471 The specified account is handled as described for the
15472 .Va disconnected
15473 variable above,
15474 but other accounts are not affected.
15476 .Mx Va imap-auth
15477 .It Va imap-auth-USER@HOST , imap-auth
15478 Sets the IMAP authentication method.
15479 Supported are the default
15480 .Ql login ,
15481 \*(IN
15482 .Ql oauthbearer
15483 (see
15484 .Sx FAQ
15485 entry
15486 .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) ,
15487 \*(IN
15488 .Ql external
15490 .Ql externanon
15491 (for TLS secured connections which pass a client certificate via
15492 .Va tls-config-pairs ) ,
15493 as well as the \*(OPal
15494 .Ql cram-md5
15496 .Ql gssapi .
15497 All methods need a
15498 .Va user
15499 and a
15500 .Va password
15501 except
15502 .Ql gssapi
15504 .Ql external ,
15505 which only need the former.
15506 .Ql externanon
15507 solely builds upon the credentials passed via a client certificate,
15508 and is usually the way to go since tested servers do not actually follow
15509 RFC 4422, and fail if additional credentials are actually passed.
15512 .It Va imap-cache
15513 Enables caching of IMAP mailboxes.
15514 The value of this variable must point to a directory that is either
15515 existent or can be created by \*(UA.
15516 All contents of the cache can be deleted by \*(UA at any time;
15517 it is not safe to make assumptions about them.
15519 .Mx Va imap-delim
15520 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
15521 The hierarchy separator used by the IMAP server.
15522 Whenever an IMAP path is specified it will undergo normalization.
15523 One of the normalization steps is the squeezing and adjustment of
15524 hierarchy separators.
15525 If this variable is set, any occurrence of any character of the given
15526 value that exists in the path will be replaced by the first member of
15527 the value; an empty value will cause the default to be used, it is
15528 .Ql /. .
15529 If not set, we will reuse the first hierarchy separator character that
15530 is discovered in a user-given mailbox name.
15532 .Mx Va imap-keepalive
15533 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
15534 IMAP servers may close the connection after a period of
15535 inactivity; the standard requires this to be at least 30 minutes,
15536 but practical experience may vary.
15537 Setting this variable to a numeric `value' greater than 0 causes
15538 a `NOOP' command to be sent each `value' seconds if no other operation
15539 is performed.
15542 .It Va imap-list-depth
15543 When retrieving the list of folders on an IMAP server, the
15544 .Ic folders
15545 command stops after it has reached a certain depth to avoid possible
15546 infinite loops.
15547 The value of this variable sets the maximum depth allowed.
15548 The default is 2.
15549 If the folder separator on the current IMAP server is a slash `/',
15550 this variable has no effect and the
15551 .Ic folders
15552 command does not descend to subfolders.
15554 .Mx Va imap-use-starttls
15555 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
15556 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
15557 IMAP session TLS encrypted.
15558 This functionality is not supported by all servers,
15559 and is not used if the session is already encrypted by the IMAPS method.
15562 .\" }}}
15565 .\" .Sh "SEE ALSO" {{{
15566 .Sh "SEE ALSO"
15568 .Xr bogofilter 1 ,
15569 .Xr gpg 1 ,
15570 .Xr more 1 ,
15571 .Xr newaliases 1 ,
15572 .Xr openssl 1 ,
15573 .Xr sendmail 1 ,
15574 .Xr sh 1 ,
15575 .Xr spamassassin 1 ,
15576 .Xr iconv 3 ,
15577 .Xr setlocale 3 ,
15578 .Xr aliases 5 ,
15579 .Xr termcap 5 ,
15580 .Xr terminfo 5 ,
15581 .Xr locale 7 ,
15582 .Xr mailaddr 7 ,
15583 .Xr re_format 7
15584 .Pf (or\0 Xr regex 7 ) ,
15585 .Xr mailwrapper 8 ,
15586 .Xr sendmail 8
15588 .\" }}}
15591 .\" .Sh HISTORY {{{
15592 .Sh HISTORY
15594 M. Douglas McIlroy writes in his article
15595 .Dq A Research UNIX Reader: Annotated Excerpts \
15596 from the Programmer's Manual, 1971-1986
15597 that a
15598 .Xr mail 1
15599 command already appeared in First Edition
15601 in 1971:
15603 .Bd -ragged -offset indent
15604 Electronic mail was there from the start.
15605 Never satisfied with its exact behavior, everybody touched it at one
15606 time or another: to assure the safety of simultaneous access, to improve
15607 privacy, to survive crashes, to exploit uucp, to screen out foreign
15608 freeloaders, or whatever.
15609 Not until v7 did the interface change (Thompson).
15610 Later, as mail became global in its reach, Dave Presotto took charge and
15611 brought order to communications with a grab-bag of external networks
15612 (v8).
15617 Mail, in large parts compatible with
15619 mail, was written in 1978 by Kurt Shoens and developed as part of the
15622 distribution until 1995.
15623 This manual page is derived from
15624 .Dq The Mail Reference Manual
15625 that Kurt Shoens wrote for Mail 1.3, included in 3BSD in 1980.
15626 The common
15630 denominator became standardized as
15631 .Xr mailx 1
15632 in the X/Open Portability Guide Issue 2 (January 1987).
15633 After the rise of Open Source
15635 variants
15636 Mail saw continuous development in the individual code forks,
15637 noticeably by Christos Zoulas in
15638 .Pf Net Bx .
15639 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
15640 Ritter in the years 2000 until 2008.
15641 Since 2012 S-nail is maintained by Steffen Nurpmeso.
15644 Electronic mail exchange in general is a concept even older.
15645 The earliest well documented electronic mail system was part of the
15646 Compatible Time Sharing System (CTSS) at MIT, its MAIL command had been
15647 proposed in a staff planning memo at the end of 1964 and was implemented
15648 in mid-1965 when Tom Van Vleck and Noel Morris wrote the necessary code.
15649 Similar communication programs were built for other timesharing systems.
15650 One of the most ambitious and influential was Murray Turoff's EMISARI.
15651 Created in 1971 for the United States Office of Emergency Preparedness,
15652 EMISARI combined private electronic messages with a chat system, public
15653 postings, voting, and a user directory.
15656 During the 1960s it was common to connect a large number of terminals to
15657 a single, central computer.
15658 Connecting two computers together was relatively unusual.
15659 This began to change with the development of the ARPANET, the ancestor
15660 of today's Internet.
15661 In 1971 Ray Tomlinson adapted the SNDMSG program, originally developed
15662 for the University of California at Berkeley timesharing system, to give
15663 it the ability to transmit a message across the network into the mailbox
15664 of a user on a different computer.
15665 For the first time it was necessary to specify the recipient's computer
15666 as well as an account name.
15667 Tomlinson decided that the underused commercial at
15668 .Ql @
15669 would work to separate the two.
15672 Sending a message across the network was originally treated as a special
15673 instance of transmitting a file, and so a MAIL command was included in
15674 RFC 385 on file transfer in 1972.
15675 Because it was not always clear when or where a message had come from,
15676 RFC 561 in 1973 aimed to formalize electronic mail headers, including
15677 .Dq from ,
15678 .Dq date ,
15680 .Dq subject .
15681 In 1975 RFC 680 described fields to help with the transmission of
15682 messages to multiple users, including
15683 .Dq to ,
15684 .Dq cc ,
15686 .Dq bcc .
15687 In 1977 these features and others went from best practices to a binding
15688 standard in RFC 733.
15689 Queen Elizabeth II of England became the first head of state to send
15690 electronic mail on March 26 1976 while ceremonially opening a building
15691 in the British Royal Signals and Radar Establishment (RSRE) in Malvern.
15692 .\" }}}
15695 .Sh AUTHORS
15697 .An -nosplit
15698 .An "Kurt Shoens" ,
15699 .An "Edward Wang" ,
15700 .An "Keith Bostic" ,
15701 .An "Christos Zoulas" ,
15702 .An "Gunnar Ritter" .
15703 \*(UA is developed by
15704 .An "Steffen Nurpmeso" Aq s-mailx@lists.sdaoden.eu .
15707 .\" .Sh CAVEATS {{{
15708 .Sh CAVEATS
15710 \*(ID Interrupting an operation via
15711 .Dv \&\&SIGINT
15713 .Ql control-C
15714 from anywhere else but a command prompt is very problematic and likely
15715 to leave the program in an undefined state: many library functions
15716 cannot deal with the
15717 .Fn siglongjmp 3
15718 that this software (still) performs; even though efforts have been taken
15719 to address this, no sooner but in v15 it will have been worked out:
15720 interruptions have not been disabled in order to allow forceful breakage
15721 of hanging network connections, for example (all this is unrelated to
15722 .Va ignore ) .
15725 The SMTP and POP3 protocol support of \*(UA is very basic.
15726 Also, if it fails to contact its upstream SMTP server, it will not make
15727 further attempts to transfer the message at a later time (setting
15728 .Va save
15730 .Va sendwait
15731 may be useful).
15732 If this is a concern, it might be better to set up a local SMTP server
15733 that is capable of message queuing.
15735 .\" }}}
15738 .Sh BUGS
15740 When a network-based mailbox is open, directly changing to another
15741 network-based mailbox of a different protocol (i.e., from POP3 to IMAP
15742 or vice versa) will cause a
15743 .Dq deadlock .
15746 After deleting some message of a POP3 mailbox the header summary falsely
15747 claims that there are no messages to display, one needs to perform
15748 a scroll or dot movement to restore proper state.
15752 .Ql thread Ns
15754 .Ic sort
15755 mode a power user may encounter crashes very occasionally (this is may
15756 and very).
15759 Please report bugs to the
15760 .Va contact-mail
15761 address, for example from within \*(uA:
15762 .\" v15-compat: drop eval as `mail' will expand variable?
15763 .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
15764 Including the
15765 .Va verbose
15766 output of the command
15767 .Ic version
15768 may be helpful:
15770 .Bd -literal -offset indent
15771 ? wysh set escape=! verbose; vput version xy; unset verbose;\e
15772   eval mail $contact-mail
15773 Bug subject
15774 !I xy
15779 Information on the web at
15780 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ; x' .
15782 .\" s-ts-mode