Tweak previous: allow non-interactive `mimeview' only for tests!
[s-mailx.git] / nail.1
blobc9e6e80155195181e2e9e8a3d228f1507ef44522
1 .\"@ nail.1 - S-nail(1) reference manual.
2 .\"
3 .\" Copyright (c) 2000-2008 Gunnar Ritter, Freiburg i. Br., Germany.
4 .\" Copyright (c) 2012 - 2018 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
5 .\"
6 .\" Copyright (c) 1980, 1990, 1993
7 .\"      The Regents of the University of California.  All rights reserved.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"--MKREL-START--
34 .\"@ S-nail v14.9.11 / 2018-08-08
35 .Dd August 08, 2018
36 .ds VV \\%v14.9.11
37 .\"--MKREL-END--
38 .\"--MKMAN-START--
39 .ds UU \\%S-NAIL
40 .ds UA \\%S-nail
41 .ds uA \\%s-nail
42 .ds UR \\%s-nail.rc
43 .ds ur \\%~/.mailrc
44 .ds VD \\%~/dead.letter
45 .ds VM \\%~/mbox
46 .ds VN \\%~/.netrc
47 .ds VT \\%/tmp
48 .ds vS /etc/mime.types
49 .ds vU ~/.mime.types
50 .\"--MKMAN-END--
51 .\" --BEGINSTRIP--
52 .\"
53 .ds OB [Obsolete]
54 .ds OP [Option]
55 .ds IN [v15-compat]
56 .ds OU [no v15-compat]
57 .ds ID [v15 behaviour may differ]
58 .ds NQ [Only new quoting rules]
59 .ds BO (Boolean)
60 .ds RO (Read-only)
61 .\"
62 .if !d str-Lb-libterminfo \
63   .ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo)
65 .Dt "\*(UU" 1
66 .Os
67 .Mx -enable
70 .Sh NAME
71 .Nm \*(UA \%[\*(VV]
72 .Nd send and receive Internet mail
75 .\" .Sh SYNOPSIS {{{
76 .Sh SYNOPSIS
78 .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
79 .Nm \*(uA
80 .Bk -words
81 .Op Fl DdEFinv~#
82 .Op Fl \&: Ar spec
83 .Op Fl A Ar account
84 .Op : Ns Fl a Ar attachment Ns \&:
85 .Op : Ns Fl b Ar bcc-addr Ns \&:
86 .Op : Ns Fl C Ar """custom:\0header""" Ns \&:
87 .Op : Ns Fl c Ar cc-addr Ns \&:
88 .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
89 .Op Fl r Ar from-addr
90 .Oo : Ns
91 .Fl S\0 Ns Ar var Ns Op Ns = Ns Ar value Ns
92 .Pf \&: Oc
93 .Op Fl s Ar subject
94 .Op : Ns Fl X Ar cmd Ns \&:
95 .Op Fl \&.
96 .Pf : Ar to-addr Ns \&:
97 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
98 .Ek
99 .Pp
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 """custom:\0header""" Ns \&:
106 .Op Fl L Ar spec
107 .Op Fl r Ar from-addr
108 .Oo : Ns
109 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
110 .Pf \&: Oc
111 .Op Fl u Ar user
112 .Op : Ns Fl X Ar cmd Ns \&:
113 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
115 .Nm \*(uA
116 .Bk -words
117 .Op Fl DdEeHiNnRv~#
118 .Op Fl \&: Ar spec
119 .Op Fl A Ar account
120 .Op : Ns Fl C Ar """custom:\0header""" Ns \&:
121 .Fl f
122 .Op Fl L Ar spec
123 .Op Fl r Ar from-addr
124 .Oo : Ns
125 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
126 .Pf \&: Oc
127 .Op : Ns Fl X Ar cmd Ns \&:
128 .Op Ar file
129 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
132 .Nm \*(uA
133 .Fl h | Fl Fl help
134 .Nm \*(uA
135 .Fl V | Fl Fl version
137 .\" }}}
140 .Mx -toc -tree html pdf ps xhtml
143 .\" .Sh DESCRIPTION {{{
144 .Sh DESCRIPTION
146 .Bd -filled -compact -offset indent
147 .Sy Compatibility note:
148 S-nail (\*(UA) will wrap up into \%S-mailx in v15.0 (circa 2020).
149 Backward incompatibility has to be expected \(en
150 .Sx COMMANDS
151 will use
152 .Sx "Shell-style argument quoting"
153 rules, for example, and shell metacharacters will become meaningful.
154 Many old-style commands accept new syntax via
155 .Cm wysh ,
156 one of the
157 .Sx "Command modifiers" .
158 New and old behaviour is flagged \*(IN and \*(OU, and setting
159 .Va v15-compat ,
160 one of the many
161 .Sx "INTERNAL VARIABLES" ,
162 will choose new behaviour when applicable.
163 \*(OB flags what will vanish, and enabling
164 .Fl d
166 .Fl v
167 enables obsoletion warnings.
171 \*(UA provides a simple and friendly environment for sending and
172 receiving mail.
173 It is intended to provide the functionality of the POSIX
174 .Xr mailx 1
175 command, but is MIME capable and optionally offers extensions for
176 line editing, S/MIME, SMTP and POP3, among others.
177 \*(UA divides incoming mail into its constituent messages and allows
178 the user to deal with them in any order.
179 It offers many
180 .Sx COMMANDS
182 .Sx "INTERNAL VARIABLES"
183 for manipulating messages and sending mail.
184 It provides the user simple editing capabilities to ease the composition
185 of outgoing messages, and increasingly powerful and reliable
186 non-interactive scripting capabilities.
188 .\" .Ss "Options" {{{
189 .Ss "Options"
191 .Bl -tag -width ".It Fl BaNg"
193 .It Fl \&: Ar spec
194 Explicitly control which of the
195 .Sx "Resource files"
196 shall be
197 .Ic source Ns
198 d (loaded): if the letter
199 .Ql s
200 is (case-insensitively) part of the
201 .Ar spec
202 then the system wide
203 .Pa \*(UR
204 is sourced, likewise the letter
205 .Ql u
206 controls sourcing of the user's personal
207 .Pa \*(ur
208 file, whereas the letters
209 .Ql -
211 .Ql /
212 explicitly forbid sourcing of any resource files.
213 Scripts should use this option: to avoid environmental noise they should
214 .Dq detach
215 from any configuration and create a script-specific environment, setting
216 any of the desired
217 .Sx "INTERNAL VARIABLES"
219 .Fl S
220 and running configurating commands via
221 .Fl X .
222 This option overrides
223 .Fl n .
226 .It Fl A Ar account
227 Executes an
228 .Ic account
229 command for the given user email
230 .Ar account
231 after program startup is complete (all resource files are loaded, any
232 .Fl S
233 setting is being established; only
234 .Fl X
235 commands have not been evaluated yet).
236 Being a special incarnation of
237 .Ic define Ns d
238 macros for the purpose of bundling longer-lived
239 .Ic set Ns
240 tings, activating such an email account also switches to the accounts
241 .Mx -sx
242 .Sx "primary system mailbox"
243 (most likely the
244 .Va inbox ) .
245 If the operation fails the program will exit if it is used
246 non-interactively, or if any of
247 .Va errexit
249 .Va posix
250 are set.
253 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
254 Attach
255 .Ar file
256 to the message (for compose mode opportunities refer to
257 .Ic ~@
259 .Ic ~^ ) .
260 .Sx "Filename transformations"
261 (also see
262 .Ic file )
263 will be performed, except that shell variables are not expanded.
264 Shall
265 .Ar file
266 not be accessible but contain a
267 .Ql =
268 character, then anything before the last
269 .Ql =
270 will be used as the filename, anything thereafter as a character set
271 specification.
273 If an input character set is specified,
274 .Mx -ix "character set specification"
275 but no output character set, then the given input character set is fixed
276 as-is, and no conversion will be applied;
277 giving the empty string or the special string hyphen-minus
278 .Ql -
279 will be treated as if
280 .Va ttycharset
281 has been specified (the default).
283 If an output character set has also been given then the conversion will
284 be performed exactly as specified and on-the-fly, not considering the
285 file type and content.
286 As an exception, if the output character set is specified as the empty
287 string or hyphen-minus
288 .Ql - ,
289 then the default conversion algorithm (see
290 .Sx "Character sets" )
291 is applied (therefore no conversion is performed on-the-fly,
292 .Ar file
293 will be MIME-classified and its contents will be inspected first) \(em
294 without support for character set conversions
295 .Pf ( Va features
296 does not include the term
297 .Ql +iconv )
298 only this argument is supported.
300 .It Fl B
301 (\*(OB: \*(UA will always use line-buffered output, to gain
302 line-buffered input even in batch mode enable batch mode via
303 .Fl # . )
306 .It Fl b Ar addr
307 Send a blind carbon copy to
308 .Ar addr Ns
309 ess, if the
310 .Ic set Ns
311 ting of
312 .Va expandaddr ,
313 one of the
314 .Sx "INTERNAL VARIABLES" ,
315 allows; the
316 .Ql shquote
317 .Va expandaddr
318 flag is supported.
319 The option may be used multiple times.
320 Also see the section
321 .Sx "On sending mail, and non-interactive mode" .
324 .It Fl C Ar """field: body"""
325 Create a custom header which persists for an entire session.
326 A custom header consists of the field name followed by a colon
327 .Ql \&:
328 and the field content body, e.g.,
329 .Ql -C """Blah: Neminem laede; imo omnes, quantum potes, juva""" .
330 Standard header field names cannot be overwritten by custom headers.
331 Runtime adjustable custom headers are available via the variable
332 .Va customhdr ,
333 and in compose mode
334 .Ic ~^ ,
335 one of the
336 .Sx "COMMAND ESCAPES" ,
337 as well as
338 .Ic digmsg
339 are the most flexible and powerful options to manage message headers.
340 This option may be used multiple times.
343 .It Fl c Ar addr
344 Just like
345 .Fl b ,
346 except it places the argument in the list of carbon copies.
349 .It Fl D
350 (\*(OP) Startup with
351 .Va disconnected
352 .Ic set .
355 .It Fl d
356 Almost enable a sandbox mode with the internal variable
357 .Va debug ;
358 the same can be achieved via
359 .Ql Fl S Va \&\&debug
361 .Ql Ic set Va \&\&debug .
364 .It Fl E
365 .Ic set
366 .Va skipemptybody
367 and thus discard messages with an empty message part body.
370 .It Fl e
371 Just check if mail is present (in the system
372 .Va inbox
373 or the one specified via
374 .Fl f ) :
375 if yes, return an exit status of zero, a non-zero value otherwise.
376 To restrict the set of mails to consider in this evaluation a message
377 specification can be added with the option
378 .Fl L .
381 .It Fl F
382 Save the message to send in a file named after the local part of the
383 first recipient's address (instead of in
384 .Va record Ns ).
387 .It Fl f
388 Read in the contents of the user's
389 .Mx -sx
390 .Sx "secondary mailbox"
391 .Ev MBOX
392 (or the specified file) for processing;
393 when \*(UA is quit, it writes undeleted messages back to this file
394 (but be aware of the
395 .Va hold
396 option).
397 The optional
398 .Ar file
399 argument will undergo some special
400 .Sx "Filename transformations"
401 (as via
402 .Ic file ) .
403 Note that
404 .Ar file
405 is not an argument to the flag
406 .Fl \&\&f ,
407 but is instead taken from the command line after option processing has
408 been completed.
409 In order to use a
410 .Ar file
411 that starts with a hyphen-minus, prefix with a relative path, as in
412 .Ql ./-hyphenbox.mbox .
415 .It Fl H
416 Display a summary of
417 .Ic headers
418 for the given
419 .Ic file
420 (depending on
421 .Fl u ,
422 .Va inbox
424 .Ev MAIL ,
425 or as specified via
426 .Fl f ) .
427 A configurable summary view is available via the option
428 .Fl L .
429 This mode does not honour
430 .Va showlast .
433 .It Fl h
434 Show a short usage summary.
437 .It Fl i
438 .Ic set
439 .Va ignore
440 to ignore tty interrupt signals.
443 .It Fl L Ar spec
444 Display a summary of
445 .Ic headers
446 of all messages that match the given
447 .Ar spec
448 in the
449 .Ic file
450 found by the same algorithm used by
451 .Fl H ,
452 then exit.
453 See the section
454 .Sx "Specifying messages"
455 for the format of
456 .Ar spec .
457 This mode does not honour
458 .Va showlast .
460 If the
461 .Fl e
462 option has been given in addition no header summary is produced,
463 but \*(UA will instead indicate via its exit status whether
464 .Ar spec
465 matched any messages
466 .Pf ( Ql 0 )
467 or not
468 .Pf ( Ql 1 ) ;
469 note that any verbose output is suppressed in this mode and must instead
470 be enabled explicitly (e.g., by using the option
471 .Fl v ) .
474 .It Fl M Ar type
475 Special send mode that will flag standard input with the MIME
476 .Ql Content-Type:
477 set to the given
478 .Ar type
479 and use it as the main message body.
480 \*(ID Using this option will bypass processing of
481 .Va message-inject-head
483 .Va message-inject-tail .
484 Also see
485 .Fl q , m , t .
488 .It Fl m Ar file
489 Special send mode that will MIME classify the specified
490 .Ar file
491 and use it as the main message body.
492 \*(ID Using this option will bypass processing of
493 .Va message-inject-head
495 .Va message-inject-tail .
496 Also see
497 .Fl q , M , t .
500 .It Fl N
501 inhibit the initial display of message headers when reading mail or
502 editing a mailbox
503 .Ic folder
504 by calling
505 .Ic unset
506 for the internal variable
507 .Va header .
510 .It Fl n
511 Standard flag that inhibits reading the system wide
512 .Pa \*(UR
513 upon startup.
514 The option
515 .Fl \&:
516 allows more control over the startup sequence; also see
517 .Sx "Resource files" .
520 .It Fl q Ar file
521 Special send mode that will initialize the message body with the
522 contents of the specified
523 .Ar file ,
524 which may be standard input
525 .Ql -
526 only in non-interactive context.
527 Also see
528 .Fl M , m , t .
531 .It Fl R
532 Any mailbox
533 .Ic folder
534 a.k.a.\&
535 .Ic file
536 opened will be in read-only mode.
540 .It Fl r Ar from-addr
541 Whereas the source address that appears in the
542 .Va from
543 header of a message (or in the
544 .Va sender
545 header if the former contains multiple addresses) is honoured by the
546 built-in SMTP transport, it is not used by a file-based
547 .Va mta
548 (Mail-Transfer-Agent) for the RFC 5321 reverse-path used for relaying
549 and delegating a message to its destination(s), for delivery errors
550 etc., but it instead uses the local identity of the initiating user.
553 When this command line option is used the given
554 .Ar from-addr
555 will be assigned to the internal variable
556 .Va from ,
557 but in addition the command line option
558 .Fl \&\&f Ar from-addr
559 will be passed to a file-based
560 .Va mta
561 whenever a message is sent.
562 Shall
563 .Ar from-addr
564 include a user name the address components will be separated and
565 the name part will be passed to a file-based
566 .Va mta
567 individually via
568 .Fl \&\&F Ar name .
571 If an empty string is passed as
572 .Ar from-addr
573 then the content of the variable
574 .Va from
575 (or, if that contains multiple addresses,
576 .Va sender )
577 will be evaluated and used for this purpose whenever the file-based
578 .Va mta
579 is contacted.
580 By default, without
581 .Fl \&\&r
582 that is, neither
583 .Fl \&\&f
585 .Fl \&\&F
586 command line options are used when contacting a file-based MTA, unless
587 this automatic deduction is enforced by
588 .Ic set Ns
589 ing the internal variable
590 .Va r-option-implicit .
593 Remarks: many default installations and sites disallow overriding the
594 local user identity like this unless either the MTA has been configured
595 accordingly or the user is member of a group with special privileges.
596 Passing an invalid address will cause an error.
600 .It Fl S Ar var Ns Op = Ns value
601 .Ic set
602 (or, with a prefix string
603 .Ql no ,
604 as documented in
605 .Sx "INTERNAL VARIABLES" ,
606 .Ic unset )
607 .Ar var Ns
608 iable and optionally assign
609 .Ar value ,
610 if supported; \*(ID the entire expression is evaluated as if specified
611 within dollar-single-quotes (see
612 .Sx "Shell-style argument quoting" )
613 if the internal variable
614 .Va v15-compat
615 is set.
616 If the operation fails the program will exit if any of
617 .Va errexit
619 .Va posix
620 are set.
621 Settings established via
622 .Fl \&\&S
623 cannot be changed from within
624 .Sx "Resource files"
625 or an account switch initiated by
626 .Fl A .
627 They will become mutable again before commands registered via
628 .Fl X
629 are executed.
632 .It Fl s Ar subject
633 Specify the subject of the message to be sent.
634 Newline (NL) and carriage-return (CR) bytes are invalid and will be
635 normalized to space (SP) characters.
638 .It Fl t
639 The message given (on standard input) is expected to contain, separated
640 from the message body by an empty line, one or multiple message headers.
641 Headers can span multiple consecutive lines if follow lines start with
642 any amount of whitespace.
643 A line starting with the number sign
644 .Ql #
645 in the first column is ignored.
646 Message recipients can be given via the message headers
647 .Ql To: ,
648 .Ql Cc: ,
649 .Ql Bcc:
651 .Ql Fcc: ,
652 they will be added to any recipients specified on the command line,
653 and are likewise subject to
654 .Va expandaddr
655 validity checks.
656 If a message subject is specified via
657 .Ql Subject:
658 then it will be used in favour of one given on the command line.
660 More optional headers are
661 .Ql Reply-To:
662 (possibly overriding
663 .Va reply-to ) ,
664 .Ql Sender:
665 .Pf ( Va sender ) ,
666 .Ql From:
667 .Pf ( Va from
668 and / or option
669 .Fl r ) .
670 .Ql Message-ID: ,
671 .Ql In-Reply-To: ,
672 .Ql References:
674 .Ql Mail-Followup-To: ,
675 by default created automatically dependent on message context, will
676 be used if specified (a special address massage will however still occur
677 for the latter).
678 Any other custom header field (also see
679 .Fl C ,
680 .Va customhdr
682 .Ic ~^ )
683 is passed through entirely
684 unchanged, and in conjunction with the options
685 .Fl ~
687 .Fl #
688 it is possible to embed
689 .Sx "COMMAND ESCAPES" .
690 Also see
691 .Fl M , m , q .
694 .It Fl u Ar user
695 Initially read the
696 .Mx -sx
697 .Sx "primary system mailbox"
699 .Ar user ,
700 appropriate privileges presumed; effectively identical to
701 .Ql Fl \&\&f Ns \0%user .
704 .It Fl V
705 Show \*(UAs
706 .Va version
707 and exit.
708 The command
709 .Ic version
710 will also show the list of
711 .Va features :
712 .Ql $ \*(uA -Xversion -Xx .
715 .It Fl v
716 .Ic set Ns
717 ting the internal variable
718 .Va verbose
719 enables display of some informational context messages.
720 Using it twice increases the level of verbosity.
723 .It Fl X Ar cmd
724 Add the given (or multiple for a multiline argument)
725 .Ar cmd
726 to the list of commands to be executed,
727 as a last step of program startup, before normal operation starts.
728 This is the only possibility to execute commands in non-interactive mode
729 when reading startup files has been disabled.
730 The commands will be evaluated as a unit, just as via
731 .Ic source .
732 Correlates with
733 .Fl #
735 .Va errexit .
738 .It Fl ~
739 Enable
740 .Sx "COMMAND ESCAPES"
741 in compose mode even in non-interactive use cases.
742 This can be used to, e.g., automatically format the composed message
743 text before sending the message:
744 .Bd -literal -offset indent
745 $ ( echo 'line    one. Word.     Word2.';\e
746     echo '~| /usr/bin/fmt -tuw66' ) |\e
747   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
751 .It Fl #
752 Enables batch mode: standard input is made line buffered, the complete
753 set of (interactive) commands is available, processing of
754 .Sx "COMMAND ESCAPES"
755 is enabled in compose mode, and diverse
756 .Sx "INTERNAL VARIABLES"
757 are adjusted for batch necessities, exactly as if done via
758 .Ic set :
759 .Va emptystart ,
760 .Pf no Va errexit ,
761 .Pf no Va header ,
762 .Pf no Va posix ,
763 .Va quiet ,
764 .Va sendwait ,
765 .Va typescript-mode
766 as well as
767 .Ev MAIL ,
768 .Ev MBOX
770 .Va inbox
771 (the latter three to
772 .Pa /dev/null ) .
773 Also, the values of
774 .Ev COLUMNS
776 .Ev LINES
777 are looked up, and acted upon.
778 The following prepares an email message in a batched dry run:
779 .Bd -literal -offset indent
780 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
781   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
785 .It Fl \&.
786 This flag forces termination of option processing in order to prevent
787 .Dq option injection
788 (attacks).
789 It also forcefully puts \*(UA into send mode, see
790 .Sx "On sending mail, and non-interactive mode" .
794 All given
795 .Ar to-addr
796 arguments and all receivers established via
797 .Fl b
799 .Fl c
800 are subject to the checks established by
801 .Va expandaddr ,
802 one of the
803 .Sx "INTERNAL VARIABLES" ;
804 they all support the flag
805 .Ql shquote .
806 If the setting of
807 .Va expandargv
808 allows their recognition all
809 .Ar mta-option
810 arguments given at the end of the command line after a
811 .Ql --
812 separator will be passed through to a file-based
813 .Va mta
814 (Mail-Transfer-Agent) and persist for the entire session.
815 .Va expandargv
816 constraints do not apply to the content of
817 .Va mta-arguments .
818 .\" }}}
820 .\" .Ss "A starter" {{{
821 .Ss "A starter"
823 \*(UA is a direct descendant of
825 Mail, itself a successor to the Research
827 mail which
828 .Dq was there from the start
829 according to
830 .Sx HISTORY .
831 It thus represents the user side of the
833 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
834 traditionally taken by
835 .Xr sendmail 8 ,
836 and most MTAs provide a binary of this name for compatibility purposes.
837 If the \*(OPal SMTP
838 .Va mta
839 is included in the
840 .Va features
841 of \*(UA then the system side is not a mandatory precondition for mail
842 delivery.
845 Because \*(UA strives for compliance with POSIX
846 .Xr mailx 1
847 it is likely that some configuration settings have to be adjusted before
848 using it is a smooth experience.
849 (Rather complete configuration examples can be found in the section
850 .Sx EXAMPLES . )
851 The provided global
852 .Pa \*(UR
853 (one of the
854 .Sx "Resource files" )
855 template bends those standard imposed settings of the
856 .Sx "INTERNAL VARIABLES"
857 a bit towards more user friendliness and safety, however.
860 For example, it
861 .Ic set Ns s
862 .Va hold
864 .Va keepsave
865 in order to suppress the automatic moving of messages to the
866 .Mx -sx
867 .Sx "secondary mailbox"
868 .Ev MBOX
869 that would otherwise occur (see
870 .Sx "Message states" ) ,
872 .Va keep
873 to not remove empty system MBOX mailbox files (or all empty such files if
874 .Va posix
875 .Pf a.k.a.\0 Ev POSIXLY_CORRECT
876 mode has been enabled) to avoid mangling of file permissions when files
877 eventually get recreated.
879 It also enables
880 .Va sendwait
881 in order to synchronize \*(UA with the exit status report of the used
882 .Va mta
883 when sending mails.
885 .Ic set Ns
887 .Va emptystart
888 to enter interactive startup even if the initial mailbox is empty,
889 .Va editheaders
890 to allow editing of headers as well as
891 .Va fullnames
892 to not strip down addresses in compose mode, and
893 .Va quote
894 to include the message that is being responded to when
895 .Ic reply Ns
896 ing, which is indented by an
897 .Va indentprefix
898 that also deviates from standard imposed settings.
899 .Va mime-counter-evidence
900 is fully enabled, too.
903 Some random remarks.
904 The file mode creation mask can be managed explicitly via the variable
905 .Va umask .
906 Sufficient system support provided symbolic links will not be followed
907 when files are opened for writing.
908 Files and shell pipe output can be
909 .Ic source Ns
910 d for evaluation, also during startup from within the
911 .Sx "Resource files" .
912 .\" }}}
914 .\" .Ss "On sending mail, and non-interactive mode" {{{
915 .Ss "On sending mail, and non-interactive mode"
917 To send a message to one or more people, using a local or built-in
918 .Va mta
919 (Mail-Transfer-Agent) transport to actually deliver the generated mail
920 message, \*(UA can be invoked with arguments which are the names of
921 people to whom the mail will be sent, and the command line options
922 .Fl b
924 .Fl c
925 can be used to add (blind) carbon copy receivers:
927 .Bd -literal -offset indent
928 # Via sendmail(1)
929 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
931 # But... try it in an isolated dry-run mode (-d) first
932 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
933    -b bcc@exam.ple -c cc@exam.ple \e
934    -Sfullnames -. \e
935    '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
937 # With SMTP
938 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
939     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
940     -S from=scriptreply@exam.ple \e
941     -a /etc/mail.rc \e
942     -. eric@exam.ple < /tmp/letter.txt
946 If standard input is a terminal rather than the message to be sent,
947 the user is expected to type in the message contents.
948 In this compose mode \*(UA treats lines beginning with the character
949 .Ql ~
950 special \(en these are so-called
951 .Sx "COMMAND ESCAPES" ,
952 which can be used to read in files, process shell commands, add and edit
953 attachments and more; e.g.,
954 .Ic ~v
956 .Ic ~e
957 will start the
958 .Ev VISUAL
959 text
960 .Ev EDITOR ,
961 respectively, to revise the message in its current state,
962 .Ic ~h
963 allows editing of the most important message headers, with the potent
964 .Ic ~^
965 custom headers can be created, for example (more specifically than with
966 .Fl C
968 .Va customhdr ) .
969 \*(OPally
970 .Ic ~?
971 gives an overview of most other available command escapes.
974 The command escape
975 .Ic ~.
976 (see there) will call hooks, insert automatic injections and receivers,
977 leave compose mode and send the message once it is completed.
978 Aborting letter composition is possible with either of
979 .Ic ~x
981 .Ic ~q ,
982 the latter of which will save the message in the file denoted by
983 .Ev DEAD
984 unless
985 .Pf no Va save
986 is set.
987 And unless
988 .Va ignoreeof
989 is set the effect of
990 .Ic ~.
991 can also be achieved by typing end-of-transmission (EOT) via
992 .Ql control-D
993 .Pf ( Ql ^D )
994 at the beginning of an empty line, and
995 .Ic ~q
996 is always reachable by typing end-of-text (ETX) twice via
997 .Ql control-C
998 .Pf ( Ql ^C ) .
1001 A number of
1002 .Sx ENVIRONMENT
1004 .Sx "INTERNAL VARIABLES"
1005 can be used to alter default behavior.
1006 E.g., messages are sent asynchronously, without supervision, unless the
1007 internal variable
1008 .Va sendwait
1009 is set, therefore send errors will not be recognizable until then.
1010 .Ic set Ns
1011 ting (also via
1012 .Fl S )
1013 .Va editalong
1014 will automatically startup an editor when compose mode is entered, and
1015 editing of headers additionally to plain body content can be enabled via
1016 .Va editheaders :
1017 \*(ID some, but not all headers can be created, edited or deleted in an
1018 editor, then.
1019 .Va askcc
1021 .Va askbcc
1022 will cause the user to be prompted actively for (blind) carbon-copy
1023 recipients, respectively, and (the default)
1024 .Va asksend
1025 will request confirmation whether the message shall be sent.
1028 The envelope sender address is defined by
1029 .Va from ,
1030 explicitly defining an originating
1031 .Va hostname
1032 may be desirable, especially with the built-in SMTP Mail-Transfer-Agent
1033 .Va mta .
1034 .Sx "Character sets"
1035 for outgoing message and MIME part content are configurable via
1036 .Va sendcharsets ,
1037 whereas input data is assumed to be in
1038 .Va ttycharset .
1039 Message data will be passed over the wire in a
1040 .Va mime-encoding .
1041 MIME parts a.k.a. attachments need to be assigned a
1042 .Ic mimetype ,
1043 usually taken out of
1044 .Sx "The mime.types files" .
1045 Saving a copy of sent messages in a
1046 .Va record
1047 mailbox may be desirable \(en as for most mailbox
1048 .Ic file
1049 targets the value will undergo
1050 .Sx "Filename transformations" .
1051 Some introductional
1052 .Fl d
1054 .Va debug
1055 sandbox dry-run tests will prove correctness.
1058 Message recipients (as specified on the command line or defined in
1059 .Ql To: ,
1060 .Ql Cc:
1062 .Ql Bcc: )
1063 are subject to
1064 .Ic alternates
1065 filtering, and may not only be email addressees but can also be names of
1066 mailboxes and even complete shell command pipe specifications.
1067 If the variable
1068 .Va expandaddr
1069 is not set then only network addresses (see
1070 .Xr mailaddr 7
1071 for a description of mail addresses) and plain user names (including MTA
1072 aliases) may be used, other types will be filtered out, giving a warning
1073 message.
1074 A network address that contains no domain-, but only a valid local user
1075 .Ql <name>
1076 in angle brackets will be automatically expanded to a valid address when
1077 .Va hostname
1078 is set to a non-empty value; setting it to the empty value instructs
1079 \*(UA that the used
1080 .Va mta
1081 will perform the necessary expansion.
1082 The command
1083 .Ic addrcodec
1084 may help to generate standard compliant network addresses.
1086 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
1087 .\" grep the latter for the complete picture
1089 If the variable
1090 .Va expandaddr
1091 is set then an extended set of recipient addresses will be accepted:
1092 Any name that starts with a vertical bar
1093 .Ql |
1094 character specifies a command pipe \(en the command string following the
1095 .Ql |
1096 is executed and the message is sent to its standard input;
1097 Likewise, any name that consists only of hyphen-minus
1098 .Ql -
1099 or starts with the character solidus
1100 .Ql /
1101 or the character sequence dot solidus
1102 .Ql ./
1103 is treated as a file, regardless of the remaining content.
1104 Any other name which contains a commercial at
1105 .Ql @
1106 character is a network address;
1107 Any other name which starts with a plus sign
1108 .Ql +
1109 character is a mailbox name;
1110 Any other name which contains a solidus
1111 .Ql /
1112 character but no exclamation mark
1113 .Ql \&!
1114 or percent sign
1115 .Ql %
1116 character before is also a mailbox name;
1117 What remains is treated as a network address.
1119 .Bd -literal -offset indent
1120 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1121 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1122 $ echo safe | LC_ALL=C \e
1123     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
1124       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1125       -. bob@exam.ple
1129 To create file-carbon-copies the special recipient header
1130 .Ql Fcc:
1131 may be used as often as desired.
1132 Its entire value (or body in standard terms) is interpreted as a
1133 .Ic file
1134 target, after having been subject to
1135 .Sx "Filename transformations" .
1136 Beside using the command escape
1137 .Ic ~^
1138 (to create a
1139 .Ql Fcc
1140 header) this is the only way to create a file-carbon-copy without
1141 introducing an ambiguity regarding the interpretation of the address,
1142 e.g., to use file names with leading vertical bars or commercial ats.
1143 Like all other recipients
1144 .Ql Fcc:
1145 is subject to the checks of
1146 .Va expandaddr .
1149 It is possible to create personal distribution lists via the
1150 .Ic alias
1151 command, so that, for instance, the user can send mail to
1152 .Ql cohorts
1153 and have it go to a group of people.
1154 Different to the alias mechanism of a local
1155 .Va mta ,
1156 which is often tracked in a file
1157 .Pa /etc/aliases ,
1158 documented in
1159 .Xr aliases 5 ,
1160 and the names of which are subject to the
1161 .Ql name
1162 constraint of
1163 .Va expandaddr ,
1164 personal aliases will be expanded by \*(UA before the message is sent.
1165 They are thus a convenient alternative to specifying each addressee by
1166 itself, correlate with the active set of
1167 .Ic alternates ,
1168 and are subject to
1169 .Va metoo
1170 filtering.
1172 .Bd -literal -offset indent
1173 ? alias  cohorts  bill jkf mark kridle@ucbcory ~/cohorts.mbox
1174 ? alias  mark  mark@exam.ple
1178 For the purpose of arranging a complete environment of settings that can
1179 be switched to with a single command or command line option there are
1180 .Ic account Ns s .
1181 Alternatively it is also possible to use a flat configuration, making use
1182 of so-called variable chains which automatically pick
1183 .Ql USER@HOST
1185 .Ql HOST
1186 context-dependent variable variants: for example addressing
1187 .Ql Ic File Ns \& pop3://yaa@exam.ple
1188 would find
1189 .Va \&\&pop3-no-apop-yaa@exam.ple ,
1190 .Va \&\&pop3-no-apop-exam.ple
1192 .Va pop3-no-apop
1193 in order.
1195 .Sx "On URL syntax and credential lookup"
1197 .Sx "INTERNAL VARIABLES" .
1200 The compose mode hooks
1201 .Va on-compose-enter , on-compose-splice , on-compose-leave
1203 .Va on-compose-cleanup
1204 may be set to
1205 .Ic define Ns
1206 d macros and provide reliable and increasingly powerful mechanisms to
1207 perform automated message adjustments dependent on message context,
1208 for example addition of message signatures
1209 .Pf ( Va message-inject-head , message-inject-tail )
1210 or creation of additional receiver lists (also by setting
1211 .Va autocc , autobcc ) .
1212 To achieve that the command
1213 .Ic digmsg
1214 may be used in order to query and adjust status of message(s).
1215 The splice hook can also make use of
1216 .Sx "COMMAND ESCAPES" .
1217 (\*(ID The compose mode hooks work for
1218 .Ic forward , mail , reply
1219 and variants;
1220 .Ic resend
1222 .Ic Resend
1223 only provide the hooks
1224 .Va on-resend-enter
1226 .Va on-resend-cleanup ,
1227 which are pretty restricted due to the nature of the operation.)
1230 To avoid environmental noise scripts should
1231 .Dq detach
1232 \*(UA from any configuration files and create a script-local
1233 environment, ideally with the command line options
1234 .Fl \&:
1235 to disable any configuration file in conjunction with repetitions of
1236 .Fl S
1237 to specify variables:
1239 .Bd -literal -offset indent
1240 $ env LC_ALL=C \*(uA -:/ \e
1241     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1242     -Sexpandaddr=fail,-all,failinvaddr \e
1243     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1244     -S from=scriptreply@exam.ple \e
1245     -s 'Subject to go' -a attachment_file \e
1246     -Sfullnames -. \e
1247     'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1248     < content_file
1252 As shown, scripts can
1253 .Dq fake
1254 a locale environment, the above specifies the all-compatible 7-bit clean
1255 .Ev LC_ALL
1256 .Dq C ,
1257 but will nonetheless take and send UTF-8 in the message text by using
1258 .Va ttycharset .
1259 In interactive mode, which is introduced in the next section, messages
1260 can be sent by calling the
1261 .Ic mail
1262 command with a list of recipient addresses:
1264 .Bd -literal -offset indent
1265 $ \*(uA -d -Squiet -Semptystart
1266 "/var/spool/mail/user": 0 messages
1267 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1268 \&...
1269 ? # Will do the right thing (tm)
1270 ? m rec1@exam.ple rec2@exam.ple
1272 .\" }}}
1274 .\" .Ss "On reading mail, and interactive mode" {{{
1275 .Ss "On reading mail, and interactive mode"
1277 When invoked without addressees \*(UA enters interactive mode in which
1278 mails may be read.
1279 When used like that the user's system
1280 .Va inbox
1281 (for more on mailbox types please see the command
1282 .Ic file )
1283 is read in and a one line header of each message therein is displayed if
1284 the variable
1285 .Va header
1286 is set.
1287 The visual style of this summary of
1288 .Ic headers
1289 can be adjusted through the variable
1290 .Va headline
1291 and the possible sorting criterion via
1292 .Va autosort .
1293 Scrolling through
1294 .Va screen Ns
1295 fuls of
1296 .Ic headers
1297 can be performed with the command
1298 .Ic z .
1299 If the initially opened mailbox is empty \*(UA will instead exit
1300 immediately (after displaying a message) unless the variable
1301 .Va emptystart
1302 is set.
1305 At the
1306 .Va prompt
1307 the command
1308 .Ic list
1309 will give a listing of all available commands and
1310 .Ic help
1311 will \*(OPally give a summary of some common ones.
1312 If the \*(OPal documentation strings are available (see
1313 .Va features )
1314 one can type
1315 .Ql help X
1316 .Pf "(or " Ql ?X )
1317 and see the actual expansion of
1318 .Ql X
1319 and what its purpose is, i.e., commands can be abbreviated
1320 (note that POSIX defines some abbreviations, so that the alphabetical
1321 order of commands does not necessarily relate to the abbreviations; it is
1322 however possible to define overwrites with
1323 .Ic commandalias ) .
1324 These commands can also produce a more
1325 .Va verbose
1326 output.
1329 Messages are given numbers (starting at 1) which uniquely identify
1330 messages; the current message \(en the
1331 .Dq dot
1332 \(en will either be the first new message, or the first unread message,
1333 or the first message of the mailbox; the internal variable
1334 .Va showlast
1335 will instead cause usage of the last message for this purpose.
1336 The command
1337 .Ic headers
1338 will display a
1339 .Va screen Ns
1340 ful of header summaries containing the
1341 .Dq dot ,
1342 whereas
1343 .Ic from
1344 will display only the summaries of the given messages, defaulting to the
1345 .Dq dot .
1348 Message content can be displayed with the command
1349 .Ic type
1350 .Pf ( Ql t ,
1351 alias
1352 .Ic print ) .
1353 Here the variable
1354 .Va crt
1355 controls whether and when \*(UA will use the configured
1356 .Ev PAGER
1357 for display instead of directly writing to the user terminal
1358 .Va screen ,
1359 the sole difference to the command
1360 .Ic more ,
1361 which will always use the
1362 .Ev PAGER .
1363 The command
1364 .Ic top
1365 will instead only show the first
1366 .Va toplines
1367 of a message (maybe even compressed if
1368 .Va topsqueeze
1369 is set).
1370 Message display experience may improve by setting and adjusting
1371 .Va mime-counter-evidence ,
1372 and also see
1373 .Sx "HTML mail and MIME attachments" .
1376 By default the current message
1377 .Pf ( Dq dot )
1378 is displayed, but like with many other commands it is possible to give
1379 a fancy message specification (see
1380 .Sx "Specifying messages" ) ,
1381 e.g.,
1382 .Ql t:u
1383 will display all unread messages,
1384 .Ql t.
1385 will display the
1386 .Dq dot ,
1387 .Ql t 1 5
1388 will type the messages 1 and 5,
1389 .Ql t 1-5
1390 will type the messages 1 through 5, and
1391 .Ql t-
1393 .Ql t+
1394 will display the previous and the next message, respectively.
1395 The command
1396 .Ic search
1397 (a more substantial alias for
1398 .Ic from )
1399 will display a header summary of the given message specification list
1400 instead of their content, e.g., the following will search for subjects:
1403 .Dl ? from "'@Some subject to search for'"
1406 In the default setup all header fields of a message will be
1407 .Ic type Ns
1408 d, but fields can be white- or blacklisted for a variety of
1409 applications by using the command
1410 .Ic headerpick ,
1411 e.g., to restrict their display to a very restricted set for
1412 .Ic type :
1413 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1414 In order to display all header fields of a message regardless of
1415 currently active ignore or retain lists, use the commands
1416 .Ic Type
1418 .Ic Top ;
1419 .Ic Show
1420 will show the raw message content.
1421 Note that historically the global
1422 .Pa \*(UR
1423 not only adjusts the list of displayed headers, but also sets
1424 .Va crt .
1425 (\*(ID A yet somewhat restricted) Reliable scriptable message
1426 inspection is available via
1427 .Ic digmsg .
1430 Dependent upon the configuration a line editor (see the section
1431 .Sx "On terminal control and line editor" )
1432 aims at making the user experience with the many
1433 .Sx COMMANDS
1434 a bit nicer.
1435 When reading the system
1436 .Va inbox ,
1437 or when
1438 .Fl f
1440 .Ic file )
1441 specified a mailbox explicitly prefixed with the special
1442 .Ql %:
1443 modifier (to propagate it to a
1444 .Mx -sx
1445 .Sx "primary system mailbox" ) ,
1446 then messages which have been read
1447 .Pf (see\0 Sx "Message states" )
1448 will be automatically moved to a
1449 .Mx -sx
1450 .Sx "secondary mailbox" ,
1451 the user's
1452 .Ev MBOX
1453 file, when the mailbox is left, either by changing the active mailbox or
1454 by quitting \*(UA \(en this automatic moving from a system- or primary-
1455 to the secondary mailbox is not performed when the variable
1456 .Va hold
1457 is set.
1458 Messages can also be explicitly
1459 .Ic move Ns
1460 d to other mailboxes, whereas
1461 .Ic copy
1462 keeps the original message.
1463 .Ic write
1464 can be used to write out data content of specific parts of messages.
1467 After examining a message the user can
1468 .Ic reply Ql r
1469 to the sender and all recipients (which will also be placed in
1470 .Ql To:
1471 unless
1472 .Va recipients-in-cc
1473 is set), or
1474 .Ic Reply Ql R
1475 exclusively to the sender(s).
1476 The command
1477 .Ic Lreply
1478 knows how to apply a special addressee massage, see
1479 .Sx "Mailing lists" .
1480 Dependent on the presence and value of
1481 .Va quote
1482 the message being replied to will be included in a quoted form.
1483 .Ic forward Ns
1484 ing a message will allow editing the new message: the original message
1485 will be contained in the message body, adjusted according to
1486 .Ic headerpick .
1487 It is possible to
1488 .Ic resend
1490 .Ic Resend
1491 messages: the former will add a series of
1492 .Ql Resent-
1493 headers, whereas the latter will not; different to newly created
1494 messages editing is not possible and no copy will be saved even with
1495 .Va record
1496 unless the additional variable
1497 .Va record-resent
1498 is set.
1499 When sending, replying or forwarding messages comments and full names
1500 will be stripped from recipient addresses unless the internal variable
1501 .Va fullnames
1502 is set.
1505 Of course messages can be
1506 .Ic delete Ql d ,
1507 and they can spring into existence again via
1508 .Ic undelete ,
1509 or when the \*(UA session is ended via the
1510 .Ic exit
1512 .Ic xit
1513 commands to perform a quick program termation.
1514 To end a mail processing session regulary and perform a full program
1515 exit one may issue the command
1516 .Ic quit .
1517 It will, among others, move read messages to the
1518 .Mx -sx
1519 .Sx "secondary mailbox"
1520 .Ev MBOX
1521 as necessary, discard deleted messages in the current mailbox,
1522 and update the \*(OPal (see
1523 .Va features )
1524 line editor
1525 .Va history-file .
1526 .\" }}}
1528 .\" .Ss "HTML mail and MIME attachments" {{{
1529 .Ss "HTML mail and MIME attachments"
1531 Messages which are HTML-only become more and more common, and of course
1532 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1533 Mail Extensions) parts.
1534 To get a notion of MIME types \*(UA has a default set of types built-in,
1535 onto which the content of
1536 .Sx "The mime.types files"
1537 will be added (as configured and allowed by
1538 .Va mimetypes-load-control ) .
1539 Types can also become registered with the command
1540 .Ic mimetype .
1541 To improve interaction with faulty MIME part declarations which are
1542 often seen in real-life messages, setting
1543 .Va mime-counter-evidence
1544 will allow verification of the given assertion, and possible provision
1545 of an alternative, better MIME type.
1548 Whereas \*(UA \*(OPally supports a simple HTML-to-text filter for
1549 displaying HTML messages, it cannot handle MIME types other than plain
1550 text itself.
1551 Instead programs need to become registered to deal with specific MIME
1552 types or file extensions.
1553 These programs may either prepare plain text versions of their input in
1554 order to enable \*(UA to integrate their output neatlessly in its own
1555 message visualization (a mode which is called
1556 .Cd copiousoutput ) ,
1557 or display the content themselves, for example in an external graphical
1558 window: such handlers will only be considered by and for the command
1559 .Ic mimeview .
1562 To install a handler program for a specific MIME type an according
1563 .Va pipe-TYPE/SUBTYPE
1564 variable needs to be set; to instead define a handler for a specific
1565 file extension the respective
1566 .Va pipe-EXTENSION
1567 variable can be used \(en these handlers take precedence.
1568 \*(OPally \*(UA supports mail user agent configuration as defined in
1569 RFC 1524; this mechanism (see
1570 .Sx "The Mailcap files" )
1571 will be queried for display or quote handlers if none of the former two
1572 .\" TODO v15-compat "will be" -> "is"
1573 did; it will be the sole source for handlers of other purpose.
1574 A last source for handlers is the MIME type definition itself, if
1575 a type-marker has been registered with the command
1576 .Ic mimetype ,
1577 which many of the built-in MIME types do.
1580 For example, to display a HTML message inline (converted to a more fancy
1581 plain text representation than the built-in filter is capable to produce)
1582 with either of the text-mode browsers
1583 .Xr lynx 1
1585 .Xr elinks 1 ,
1586 teach \*(UA about MathML documents and make it display them as plain
1587 text, and to open PDF attachments in an external PDF viewer,
1588 asynchronously and with some other magic attached:
1590 .Bd -literal -offset indent
1591 ? if [ "$features" !% +filter-html-tagsoup ]
1592 ?   #set pipe-text/html='@* elinks -force-html -dump 1'
1593 ?   set pipe-text/html='@* lynx -stdin -dump -force_html'
1594 ?   # Display HTML as plain text instead
1595 ?   #set pipe-text/html=@
1596 ? endif
1597 ? mimetype @ application/mathml+xml mathml
1598 ? wysh set pipe-application/pdf='@&=@ \e
1599     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1600     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1601     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1603 .\" }}}
1605 .\" .Ss "Mailing lists" {{{
1606 .Ss "Mailing lists"
1608 \*(UA offers some support to ease handling of mailing lists.
1609 The command
1610 .Ic mlist
1611 promotes all given arguments to known mailing lists, and
1612 .Ic mlsubscribe
1613 sets their subscription attribute, creating them first as necessary.
1614 (On the other hand
1615 .Ic unmlsubscribe
1616 does not
1617 .Ic unmlist
1618 automatically, but only resets the subscription attribute.)
1619 Using the commands without arguments will show (a subset of) all
1620 currently defined mailing lists.
1622 .Va headline
1623 format
1624 .Ql \&%T
1625 can be used to mark out messages with configured list addresses
1626 in the display of
1627 .Ic headers .
1630 If the \*(OPal regular expression support is available a mailing list
1631 specification that contains any of the
1632 .Dq magical
1633 regular expression characters
1634 .Ql ^[]*+?|$
1635 (see
1636 .Xr re_format 7 )
1637 will be interpreted as one, which allows matching of many addresses with
1638 a single expression.
1639 However, all fully qualified list addresses are matched via a fast
1640 dictionary, whereas expressions are placed in (a) list(s) which is
1641 (are) matched sequentially.
1643 .Bd -literal -offset indent
1644 ? set followup-to followup-to-honour=ask-yes \e
1645     reply-to-honour=ask-yes
1646 ? wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1647 ? mlsubscribe a4@b4.c4 exact@lists.c3
1651 The variable
1652 .Va followup-to-honour
1653 will ensure that a
1654 .Ql Mail-\:Followup-\:To:
1655 header is honoured when the message is being replied to (via
1656 .Ic reply
1658 .Ic Lreply )
1660 .Va followup-to
1661 controls whether this header is created when sending mails; it will be
1662 created automatically for a couple of reasons, too, like when the
1663 special
1664 .Dq mailing list specific
1665 respond command
1666 .Ic Lreply
1667 is used, when
1668 .Ic reply
1669 is used to respond to a message with its
1670 .Ql Mail-Followup-To:
1671 being honoured etc.
1674 A difference in between the handling of known and subscribed lists is
1675 that the address of the user is usually not part of a generated
1676 .Ql Mail-Followup-To:
1677 when addressing the latter, whereas it is for the former kind of lists.
1678 Usually because there are exceptions: say, if multiple lists are
1679 addressed and not all of them are subscribed lists.
1681 For convenience \*(UA will, temporarily, automatically add a list
1682 address that is presented in the
1683 .Ql List-Post:
1684 header of a message that is being responded to to the list of known
1685 mailing lists.
1686 Shall that header have existed \*(UA will instead, dependent on the
1687 variable
1688 .Va reply-to-honour ,
1689 use an also set
1690 .Ql Reply-To:
1691 for this purpose (if it provides a single address which resides on the
1692 same domain as what is stated in
1693 .Ql List-Post: )
1694 in order to accept a list administrator's wish that is supposed to have
1695 been manifested like that.
1696 .\" }}}
1698 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1699 .Ss "Signed and encrypted messages with S/MIME"
1701 \*(OP S/MIME provides two central mechanisms:
1702 message signing and message encryption.
1703 A signed message contains some data in addition to the regular text.
1704 The data can be used to verify that the message has been sent using
1705 a valid certificate, that the sender address matches that in the
1706 certificate, and that the message text has not been altered.
1707 Signing a message does not change its regular text;
1708 it can be read regardless of whether the recipients software is able to
1709 handle S/MIME.
1710 It is thus usually possible to sign all outgoing messages if so desired.
1713 Encryption, in contrast, makes the message text invisible for all people
1714 except those who have access to the secret decryption key.
1715 To encrypt a message, the specific recipients public encryption key
1716 must be known.
1717 It is therefore not possible to send encrypted mail to people unless their
1718 key has been retrieved from either previous communication or public key
1719 directories.
1720 Because signing is performed with private keys, and encryption with
1721 public keys, messages should always be signed before becoming encrypted.
1724 A central concept to S/MIME is that of the certification authority (CA).
1725 A CA is a trusted institution that issues certificates.
1726 For each of these certificates it can be verified that it really
1727 originates from the CA, provided that the CA's own certificate is
1728 previously known.
1729 A set of CA certificates is usually delivered and installed together
1730 with the cryptographical library that is used on the local system.
1731 Therefore reasonable security for S/MIME on the Internet is provided if
1732 the source that provides that library installation is trusted.
1733 It is also possible to use a specific pool of trusted certificates.
1734 If this is desired,
1735 .Va smime-ca-no-defaults
1736 should be set to avoid using the default certificate pool, and
1737 .Va smime-ca-file
1738 and/or
1739 .Va smime-ca-dir
1740 should be pointed to a trusted pool of certificates.
1741 A certificate cannot be more secure than the method its CA certificate
1742 has been retrieved with.
1745 This trusted pool of certificates is used by the command
1746 .Ic verify
1747 to ensure that the given S/MIME messages can be trusted.
1748 If so, verified sender certificates that were embedded in signed
1749 messages can be saved locally with the command
1750 .Ic certsave ,
1751 and used by \*(UA to encrypt further communication with these senders:
1753 .Bd -literal -offset indent
1754 ? certsave FILENAME
1755 ? set smime-encrypt-USER@HOST=FILENAME \e
1756     smime-cipher-USER@HOST=AES256
1760 To sign outgoing messages, in order to allow receivers to verify the
1761 origin of these messages, a personal S/MIME certificate is required.
1762 \*(UA supports password-protected personal certificates (and keys), see
1763 .Va smime-sign-cert .
1764 The section
1765 .Sx "On URL syntax and credential lookup"
1766 gives an overview of the possible sources of user credentials, and
1767 .Sx "S/MIME step by step"
1768 shows examplarily how a private S/MIME certificate can be obtained.
1769 In general, if such a private key plus certificate
1770 .Dq pair
1771 is available, all that needs to be done is to set some variables:
1773 .Bd -literal -offset indent
1774 ? set smime-sign-cert=ME@exam.ple.paired \e
1775     smime-sign-digest=SHA512 \e
1776     smime-sign
1780 Variables of interest for S/MIME in general are
1781 .Va smime-ca-dir ,
1782 .Va smime-ca-file ,
1783 .Va smime-ca-flags ,
1784 .Va smime-ca-no-defaults ,
1785 .Va smime-crl-dir ,
1786 .Va smime-crl-file .
1787 For S/MIME signing of interest are
1788 .Va smime-sign ,
1789 .Va smime-sign-cert ,
1790 .Va smime-sign-include-certs
1792 .Va smime-sign-digest .
1793 Additional variables of interest for S/MIME en- and decryption:
1794 .Va smime-cipher
1796 .Va smime-encrypt-USER@HOST .
1799 \*(ID Note that neither S/MIME signing nor encryption applies to
1800 message subjects or other header fields yet.
1801 Thus they may not contain sensitive information for encrypted messages,
1802 and cannot be trusted even if the message content has been verified.
1803 When sending signed messages,
1804 it is recommended to repeat any important header information in the
1805 message text.
1806 .\" }}}
1808 .\" .Ss "On URL syntax and credential lookup" {{{
1809 .Ss "On URL syntax and credential lookup"
1811 \*(IN For accessing protocol-specific resources usage of Uniform
1812 Resource Locators (URL, RFC 1738) has become omnipresent.
1813 \*(UA expects and understands URLs in the following form;
1814 parts in brackets
1815 .Ql []
1816 denote optional parts, optional either because there also exist other
1817 ways to define the information in question or because support of the
1818 part is protocol-specific, e.g.,
1819 .Ql /path
1820 is used by the \*(OPal Maildir directory and the IMAP protocol, but not
1821 by POP3; If any of
1822 .Ql USER
1824 .Ql PASSWORD
1825 are specified they must be given in URL percent encoded form (RFC 3986;
1826 the command
1827 .Ic urlcodec
1828 may be helpful):
1831 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1834 Note that these \*(UA URLs most often do not conform to any real
1835 standard, but instead represent a normalized variant of RFC 1738 \(en
1836 they are not used in data exchange but only meant as a compact,
1837 easy-to-use way of defining and representing information in
1838 a well-known notation.
1841 Many internal variables of \*(UA exist in multiple versions, called
1842 variable chains for the rest of this document: the plain
1843 .Ql variable
1844 as well as
1845 .Ql variable-HOST
1847 .Ql variable-USER@HOST .
1848 Here
1849 .Ql HOST
1850 indeed means
1851 .Ql server:port
1852 if a
1853 .Ql port
1854 had been specified in the respective URL, otherwise it refers to the plain
1855 .Ql server .
1856 Also,
1857 .Ql USER
1858 is not truly the
1859 .Ql USER
1860 that had been found when doing the user chain lookup as is described
1861 below, i.e., this
1862 .Ql USER
1863 will never be in URL percent encoded form, whether it came from an URL
1864 or not; i.e., variable chain name extensions of
1865 .Sx "INTERNAL VARIABLES"
1866 must not be URL percent encoded.
1869 For example, whether an hypothetical URL
1870 .Ql smtp://hey%3Ayou@our.house
1871 had been given that includes a user, or whether the URL was
1872 .Ql smtp://our.house
1873 and the user had been found differently, to lookup the variable chain
1874 .Va smtp-use-starttls
1875 \*(UA first looks for whether
1876 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
1877 is defined, then whether
1878 .Ql smtp-\:use-\:starttls-\:our.house
1879 exists before finally ending up looking at the plain variable itself.
1882 \*(UA obeys the following logic scheme when dealing with the
1883 necessary credential information of an account:
1885 .Bl -bullet
1887 If no
1888 .Ql USER
1889 has been given in the URL the variables
1890 .Va user-HOST
1892 .Va user
1893 are looked up.
1894 If no such variable(s) can be found then \*(UA will,
1895 when enforced by the \*(OPal variables
1896 .Va netrc-lookup-HOST
1898 .Va netrc-lookup ,
1899 search
1900 .Sx "The .netrc file"
1901 of the user for a
1902 .Ql HOST
1903 specific entry which provides a
1904 .Ql login
1905 name: this lookup will only succeed if unambiguous (one possible matching
1906 entry for
1907 .Ql HOST ) .
1909 If there is still no
1910 .Ql USER
1911 then \*(UA will fall back to the user who is supposed to run \*(UA,
1912 the identity of which has been fixated during \*(UA startup and is
1913 known to be a valid user on the current host.
1916 Authentication: unless otherwise noted this will lookup the
1917 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1918 variable chain, falling back to a protocol-specific default should this
1919 have no success.
1922 If no
1923 .Ql PASSWORD
1924 has been given in the URL, then if the
1925 .Ql USER
1926 has been found through the \*(OPal
1927 .Va netrc-lookup
1928 that may have already provided the password, too.
1929 Otherwise the variable chain
1930 .Va password-USER@HOST , password-HOST , password
1931 is looked up and used if existent.
1933 Afterwards the complete \*(OPal variable chain
1934 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1935 is looked up.
1936 If set, the
1937 .Ic netrc
1938 cache is searched for a password only (multiple user accounts for
1939 a single machine may exist as well as a fallback entry without user
1940 but with a password).
1942 If at that point there is still no password available, but the
1943 (protocols') chosen authentication type requires a password, then in
1944 interactive mode the user will be prompted on the terminal.
1948 .Sy Note:
1949 S/MIME verification works relative to the values found in the
1950 .Ql From:
1952 .Ql Sender: )
1953 header field(s), which means that the values of
1954 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1956 .Va smime-sign-digest
1957 will not be looked up using the
1958 .Ql USER
1960 .Ql HOST
1961 chains from above but instead use the corresponding values from the
1962 message that is being worked on.
1963 In unusual cases multiple and different
1964 .Ql USER
1966 .Ql HOST
1967 combinations may therefore be involved \(en on the other hand those
1968 unusual cases become possible.
1969 The usual case is as short as:
1971 .Bd -literal -offset indent
1972 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1973     smime-sign smime-sign-cert=+smime.pair
1977 The section
1978 .Sx EXAMPLES
1979 contains complete example configurations.
1980 .\" }}}
1982 .\" .Ss "Encrypted network communication" {{{
1983 .Ss "Encrypted network communication"
1985 SSL (Secure Sockets Layer) a.k.a. its successor TLS (Transport Layer
1986 Security) are protocols which aid in securing communication by providing
1987 a safely initiated and encrypted network connection.
1988 A central concept of TLS is that of certificates: as part of each
1989 network connection setup a (set of) certificates will be exchanged, and
1990 by using those the identity of the network peer can be cryptographically
1991 verified; if possible the TLS/SNI (ServerNameIndication) extension will
1992 be enabled in order to allow servers fine-grained control over the
1993 certificates being used.
1994 TLS works by using a locally installed pool of trusted certificates,
1995 and verifying the connection peer succeeds if that provides
1996 a certificate which has been issued or is trusted by any certificate in
1997 the trusted local pool.
2000 The local pool of trusted so-called CA (Certification Authority)
2001 certificates is usually delivered with the used TLS library, and
2002 will be selected automatically.
2003 It is also possible to use a specific pool of trusted certificates.
2004 If this is desired,
2005 .Va tls-ca-no-defaults
2006 should be set to avoid using the default certificate pool, and
2007 .Va tls-ca-file
2008 and/or (with special preparation)
2009 .Va tls-ca-dir
2010 should be pointed to a trusted pool of certificates.
2011 A certificate cannot be more secure than the method its CA certificate
2012 has been retrieved with.
2013 For inspection or other purposes, the certificate of a server (as seen
2014 when connecting to it) can be fetched like this:
2016 .Bd -literal -offset indent
2017 $ </dev/null openssl s_client -showcerts -connect \e
2018     the-server.example:pop3s 2>&1 | tee log.txt
2022 \*(UA also supports a mode of operation in which certificates are not
2023 at all matched against a local pool of CA certificates.
2024 Instead a message digest will be calculated for the certificate
2025 presented by the connection peer, and be compared against
2026 .Va tls-fingerprint
2027 (a variable chain that picks up
2028 .Ql USER@HOST
2030 .Ql HOST
2031 context-dependent variable variants), and the connection will succeed if
2032 the calculated digest equals the expected one.
2033 The used message digest can be configured via (the chain)
2034 .Va tls-fingerprint-digest .
2035 The command
2036 .Ic tls
2037 may be helpful.
2040 It depends on the used protocol whether encrypted communication is
2041 possible, and which configuration steps have to be taken to enable it.
2042 Some protocols, e.g., POP3S, are implicitly encrypted, others, like
2043 POP3, can upgrade a plain text connection if so requested.
2044 For example, to use the
2045 .Ql STLS
2046 that POP3 offers (a member of) the variable (chain)
2047 .Va pop3-use-starttls
2048 needs to be set:
2050 .Bd -literal -offset indent
2051 shortcut encpop1 pop3s://pop1.exam.ple
2053 shortcut encpop2 pop3://pop2.exam.ple
2054 set pop3-use-starttls-pop2.exam.ple
2056 set mta=smtps://smtp.exam.ple:465
2057 set mta=smtp://smtp.exam.ple smtp-use-starttls
2061 Normally that is all there is to do, given that TLS libraries try to
2062 provide safe defaults, plenty of knobs however exist to adjust settings.
2063 For example certificate verification settings can be fine-tuned via
2064 .Va tls-ca-flags ,
2065 and the TLS configuration basics are accessible via
2066 .Va tls-config-pairs ,
2067 for example to specify the allowed protocols or cipher lists that
2068 a communication channel may use.
2069 In the past hints on how to restrict the set of protocols to highly
2070 secure ones were indicated, but as of the time of this writing the list
2071 of protocols or ciphers may need to become relaxed in order to be able
2072 to connect to some servers; the following example allows connecting to a
2073 .Dq Lion
2074 that uses OpenSSL 0.9.8za from June 2014 (refer to
2075 .Sx "INTERNAL VARIABLES"
2076 for more on variable chains):
2078 .Bd -literal -offset indent
2079 wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e
2080     CipherString=TLSv1.2:!aNULL:!eNULL:\e
2081       ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
2082       DHE-RSA-AES256-SHA:@STRENGTH'
2086 The OpenSSL program
2087 .Xr ciphers 1
2088 can be used and should be referred to when creating a custom cipher list.
2089 Variables of interest for TLS in general are
2090 .Va tls-ca-dir ,
2091 .Va tls-ca-file ,
2092 .Va tls-ca-flags ,
2093 .Va tls-ca-no-defaults ,
2094 .Va tls-config-file ,
2095 .Va tls-config-module ,
2096 .Va tls-config-pairs ,
2097 .Va tls-crl-dir ,
2098 .Va tls-crl-file ,
2099 .Va tls-rand-file
2100 as well as
2101 .Va tls-verify .
2102 .\" }}}
2104 .\" .Ss "Character sets" {{{
2105 .Ss "Character sets"
2107 \*(OP \*(UA detects the character set of the terminal by using
2108 mechanisms that are controlled by the
2109 .Ev LC_CTYPE
2110 environment variable
2111 (in fact
2112 .Ev LC_ALL ,
2113 .Ev \&\&LC_CTYPE ,
2114 .Ev LANG ,
2115 in that order, see there).
2116 The internal variable
2117 .Va ttycharset
2118 will be set to the detected terminal character set accordingly,
2119 and will thus show up in the output of commands like, e.g.,
2120 .Ic set
2122 .Ic varshow .
2125 However, the user may give
2126 .Va ttycharset
2127 a value during startup, making it possible to send mail in a completely
2128 .Dq faked
2129 locale environment, an option which can be used to generate and send,
2130 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
2131 .Ql LC_ALL=C
2132 environment (an example of this can be found in the section
2133 .Sx "On sending mail, and non-interactive mode" ) .
2134 Changing the value does not mean much beside that, because several
2135 aspects of the real character set are implied by the locale environment
2136 of the system, which stays unaffected by
2137 .Va ttycharset .
2140 Messages and attachments which consist of 7-bit clean data will be
2141 classified as consisting of
2142 .Va charset-7bit
2143 character data.
2144 This is a problem if the
2145 .Va ttycharset
2146 character set is a multibyte character set that is also 7-bit clean.
2147 For example, the Japanese character set ISO-2022-JP is 7-bit clean but
2148 capable to encode the rich set of Japanese Kanji, Hiragana and Katakana
2149 characters: in order to notify receivers of this character set the mail
2150 message must be MIME encoded so that the character set ISO-2022-JP can
2151 be advertised!
2152 To achieve this, the variable
2153 .Va charset-7bit
2154 must be set to ISO-2022-JP.
2155 (Today a better approach regarding email is the usage of UTF-8, which
2156 uses 8-bit bytes for non-US-ASCII data.)
2159 If the \*(OPal character set conversion capabilities are not available
2160 .Pf ( Va features
2161 does not include the term
2162 .Ql +iconv ) ,
2163 then
2164 .Va ttycharset
2165 will be the only supported character set,
2166 it is simply assumed that it can be used to exchange 8-bit messages
2167 (over the wire an intermediate, configurable
2168 .Va mime-encoding
2169 may be applied),
2170 and the rest of this section does not apply;
2171 it may however still be necessary to explicitly set it if automatic
2172 detection fails, since in that case it defaults to
2173 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
2174 LATIN1 a.k.a. ISO-8859-1 unless the operating system environment is
2175 known to always and exclusively support UTF-8 locales.
2178 \*(OP When reading messages, their text is converted into
2179 .Va ttycharset
2180 as necessary in order to display them on the user's terminal.
2181 Unprintable characters and invalid byte sequences are detected
2182 and replaced by proper substitution characters.
2183 Character set mappings for source character sets can be established with
2184 the command
2185 .Ic charsetalias ,
2186 which may be handy to work around faulty character set catalogues (e.g.,
2187 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
2188 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
2189 Also see
2190 .Va charset-unknown-8bit
2191 to deal with another hairy aspect of message interpretation.
2194 When sending messages their parts and attachments are classified.
2195 Whereas no character set conversion is performed on those parts which
2196 appear to be binary data,
2197 the character set being used must be declared within the MIME header of
2198 an outgoing text part if it contains characters that do not conform to
2199 the set of characters that are allowed by the email standards.
2200 Permissible values for character sets used in outgoing messages can be
2201 declared using the
2202 .Va sendcharsets
2203 variable, and
2204 .Va charset-8bit ,
2205 which defines a catch-all last-resort fallback character set that is
2206 implicitly appended to the list of character sets in
2207 .Va sendcharsets .
2210 When replying to a message and the variable
2211 .Va reply-in-same-charset
2212 is set, then the character set of the message being replied to
2213 is tried first (still being a subject of
2214 .Ic charsetalias ) .
2215 And it is also possible to make \*(UA work even more closely related to
2216 the current locale setting automatically by using the variable
2217 .Va sendcharsets-else-ttycharset ,
2218 please see there for more information.
2221 All the specified character sets are tried in order unless the
2222 conversion of the part or attachment succeeds.
2223 If none of the tried (8-bit) character sets is capable to represent the
2224 content of the part or attachment,
2225 then the message will not be send and its text will optionally be
2226 .Va save Ns d
2228 .Ev DEAD .
2229 In general, if a message saying
2230 .Dq cannot convert from a to b
2231 appears, either some characters are not appropriate for the currently
2232 selected (terminal) character set,
2233 or the needed conversion is not supported by the system.
2234 In the first case, it is necessary to set an appropriate
2235 .Ev LC_CTYPE
2236 locale and/or the variable
2237 .Va ttycharset .
2240 The best results are usually achieved when \*(UA is run in a UTF-8
2241 locale on an UTF-8 capable terminal, in which case the full Unicode
2242 spectrum of characters is available.
2243 In this setup characters from various countries can be displayed,
2244 while it is still possible to use more simple character sets for sending
2245 to retain maximum compatibility with older mail clients.
2248 On the other hand the POSIX standard defines a locale-independent 7-bit
2249 .Dq portable character set
2250 that should be used when overall portability is an issue, the even more
2251 restricted subset named
2252 .Dq portable filename character set
2253 consists of A-Z, a-z, 0-9, period
2254 .Ql \&. ,
2255 underscore
2256 .Ql _
2257 and hyphen-minus
2258 .Ql - .
2259 .\" }}}
2261 .\" .Ss "Message states" {{{
2262 .Ss "Message states"
2264 \*(UA differentiates in between several message states; the current
2265 state will be reflected in the summary of
2266 .Ic headers
2267 if the
2268 .Va attrlist
2269 of the configured
2270 .Va headline
2271 allows, and
2272 .Sx "Specifying messages"
2273 dependent on their state is possible.
2274 When operating on the system
2275 .Va inbox ,
2276 or in any other
2277 .Mx -sx
2278 .Sx "primary system mailbox" ,
2279 special actions, like the automatic moving of messages to the
2280 .Mx -sx
2281 .Sx "secondary mailbox"
2282 .Ev MBOX ,
2283 may be applied when the mailbox is left (also implicitly by program
2284 termination, unless the command
2285 .Ic exit
2286 was used) \(en however, because this may be irritating to users which
2287 are used to
2288 .Dq more modern
2289 mail-user-agents, the provided global
2290 .Pa \*(UR
2291 template sets the internal
2292 .Va hold
2294 .Va keepsave
2295 variables in order to suppress this behaviour.
2297 .Bl -hang -width ".It Ql new"
2298 .It Ql new
2299 Message has neither been viewed nor moved to any other state.
2300 Such messages are retained even in the
2301 .Mx -sx
2302 .Sx "primary system mailbox" .
2304 .It Ql unread
2305 Message has neither been viewed nor moved to any other state, but the
2306 message was present already when the mailbox has been opened last:
2307 Such messages are retained even in the
2308 .Mx -sx
2309 .Sx "primary system mailbox" .
2311 .It Ql read
2312 The message has been processed by one of the following commands:
2313 .Ic ~f ,
2314 .Ic ~m ,
2315 .Ic ~F ,
2316 .Ic ~M ,
2317 .Ic copy ,
2318 .Ic mbox ,
2319 .Ic next ,
2320 .Ic pipe  ,
2321 .Ic Print ,
2322 .Ic print ,
2323 .Ic top ,
2324 .Ic Type ,
2325 .Ic type ,
2326 .Ic undelete .
2327 The commands
2328 .Ic dp
2330 .Ic dt
2331 will always try to automatically
2332 .Dq step
2334 .Ic type
2336 .Dq next
2337 logical message, and may thus mark multiple messages as read, the
2338 .Ic delete
2339 command will do so if the internal variable
2340 .Va autoprint
2341 is set.
2343 Except when the
2344 .Ic exit
2345 command is used, messages that are in a
2346 .Mx -sx
2347 .Sx "primary system mailbox"
2348 and are in
2349 .Ql read
2350 state when the mailbox is left will be saved in the
2351 .Mx -sx
2352 .Sx "secondary mailbox"
2353 .Ev MBOX
2354 unless the internal variable
2355 .Va hold
2356 it set.
2358 .It Ql deleted
2359 The message has been processed by one of the following commands:
2360 .Ic delete ,
2361 .Ic dp ,
2362 .Ic dt .
2363 Only
2364 .Ic undelete
2365 can be used to access such messages.
2367 .It Ql preserved
2368 The message has been processed by a
2369 .Ic preserve
2370 command and it will be retained in its current location.
2372 .It Ql saved
2373 The message has been processed by one of the following commands:
2374 .Ic save
2376 .Ic write .
2377 Unless when the
2378 .Ic exit
2379 command is used, messages that are in a
2380 .Mx -sx
2381 .Sx "primary system mailbox"
2382 and are in
2383 .Ql saved
2384 state when the mailbox is left will be deleted; they will be saved in the
2385 .Mx -sx
2386 .Sx "secondary mailbox"
2387 .Ev MBOX
2388 when the internal variable
2389 .Va keepsave
2390 is set.
2394 In addition to these message states, flags which otherwise have no
2395 technical meaning in the mail system except allowing special ways of
2396 addressing them when
2397 .Sx "Specifying messages"
2398 can be set on messages.
2399 These flags are saved with messages and are thus persistent, and are
2400 portable between a set of widely used MUAs.
2402 .Bl -hang -width ".It Ic answered"
2403 .It Ic answered
2404 Mark messages as having been answered.
2405 .It Ic draft
2406 Mark messages as being a draft.
2407 .It Ic flag
2408 Mark messages which need special attention.
2410 .\" }}}
2412 .\" .Ss "Specifying messages" {{{
2413 .Ss "Specifying messages"
2415 \*(NQ Commands which take
2416 .Sx "Message list arguments" ,
2417 such as
2418 .Ic from
2419 a.k.a.\&
2420 .Ic search ,
2421 .Ic type
2423 .Ic delete ,
2424 can be given a list of message numbers as arguments to apply to a number
2425 of messages at once.
2426 Thus
2427 .Ql delete 1 2
2428 deletes messages 1 and 2,
2429 whereas
2430 .Ql delete 1-5
2431 will delete the messages 1 through 5.
2432 In sorted or threaded mode (see the
2433 .Ic sort
2434 command),
2435 .Ql delete 1-5
2436 will delete the messages that are located between (and including)
2437 messages 1 through 5 in the sorted/threaded order, as shown in the
2438 .Ic headers
2439 summary.
2440 The following special message names exist:
2443 .Bl -tag -width ".It Ar BaNg"
2444 .It Ar \&.
2445 The current message, the so-called
2446 .Dq dot .
2448 .It Ar \&;
2449 The message that was previously the current message; needs to be quoted.
2451 .It Ar \&,
2452 The parent message of the current message,
2453 that is the message with the Message-ID given in the
2454 .Ql In-Reply-To:
2455 field or the last entry of the
2456 .Ql References:
2457 field of the current message.
2459 .It Ar -
2460 The previous undeleted message, or the previous deleted message for the
2461 .Ic undelete
2462 command; In
2463 .Ic sort Ns
2464 ed or
2465 .Ql thread Ns
2466 ed mode, the previous such message in the according order.
2468 .It Ar +
2469 The next undeleted message, or the next deleted message for the
2470 .Ic undelete
2471 command; In
2472 .Ic sort Ns
2473 ed or
2474 .Ql thread Ns
2475 ed mode, the next such message in the according order.
2477 .It Ar ^
2478 The first undeleted message,
2479 or the first deleted message for the
2480 .Ic undelete
2481 command; In
2482 .Ic sort Ns
2483 ed or
2484 .Ql thread Ns
2485 ed mode, the first such message in the according order.
2487 .It Ar $
2488 The last message; In
2489 .Ic sort Ns
2490 ed or
2491 .Ql thread Ns
2492 ed mode, the last such message in the according order.
2493 Needs to be quoted.
2495 .It Ar & Ns Ar x
2497 .Ql thread Ns
2499 .Ic sort
2500 mode, selects the message addressed with
2501 .Ar x ,
2502 where
2503 .Ar x
2504 is any other message specification,
2505 and all messages from the thread that begins at it.
2506 Otherwise it is identical to
2507 .Ar x .
2509 .Ar x
2510 is omitted,
2511 the thread beginning with the current message is selected.
2513 .It Ar *
2514 All messages.
2516 .It Ar `
2517 All messages that were included in the
2518 .Sx "Message list arguments"
2519 of the previous command; needs to be quoted.
2521 .It Ar x-y
2522 An inclusive range of message numbers.
2523 Selectors that may also be used as endpoints include any of
2524 .Ar .;-+^$ .
2526 .It Ar address
2527 A case-insensitive
2528 .Dq any substring matches
2529 search against the
2530 .Ql From:
2531 header, which will match addresses (too) even if
2532 .Va showname
2533 is set (and POSIX says
2534 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2535 However, if the
2536 .Va allnet
2537 variable is set, only the local part of the address is evaluated
2538 for the comparison, not ignoring case, and the setting of
2539 .Va showname
2540 is completely ignored.
2541 For finer control and match boundaries use the
2542 .Ql @
2543 search expression.
2545 .It Ar / Ns Ar string
2546 All messages that contain
2547 .Ar string
2548 in the subject field (case ignored according to locale).
2549 See also the
2550 .Va searchheaders
2551 variable.
2553 .Ar string
2554 is empty,
2555 the string from the previous specification of that type is used again.
2558 .It Xo Op Ar @ Ns Ar name-list Ns
2559 .Ar @ Ns Ar expr
2561 All messages that contain the given case-insensitive search
2562 .Ar expr Ns
2563 ession;  If the \*(OPal regular expression support is available
2564 .Ar expr
2565 will be interpreted as (an extended) one if any of the
2566 .Dq magical
2567 regular expression characters
2568 .Ql ^[]*+?|$
2569 is seen (see
2570 .Xr re_format 7 ) .
2571 If the optional
2572 .Ar @ Ns Ar name-list
2573 part is missing the search is restricted to the subject field body,
2574 but otherwise
2575 .Ar name-list
2576 specifies a comma-separated list of header fields to search, e.g.,
2579 .Dl '@to,from,cc@Someone i ought to know'
2582 In order to search for a string that includes a
2583 .Ql @
2584 (commercial at) character the
2585 .Ar name-list
2586 is effectively non-optional, but may be given as the empty string.
2587 Also, specifying an empty search
2588 .Ar expr Ns
2589 ession will effectively test for existence of the given header fields.
2590 Some special header fields may be abbreviated:
2591 .Ql f ,
2592 .Ql t ,
2593 .Ql c ,
2594 .Ql b
2596 .Ql s
2597 will match
2598 .Ql From ,
2599 .Ql To ,
2600 .Ql Cc ,
2601 .Ql Bcc
2603 .Ql Subject ,
2604 respectively and case-insensitively.
2605 \*(OPally, and just like
2606 .Ar expr ,
2607 .Ar name-list
2608 will be interpreted as (an extended) regular expression if any of the
2609 .Dq magical
2610 regular expression characters is seen.
2613 The special names
2614 .Ql header
2616 .Ql <
2617 can be used to search in (all of) the header(s) of the message, and the
2618 special names
2619 .Ql body
2621 .Ql >
2623 .Ql text
2625 .Ql =
2626 will perform full text searches \(en whereas the former searches only
2627 the body, the latter also searches the message header (\*(ID this mode
2628 yet brute force searches over the entire decoded content of messages,
2629 including administrativa strings).
2632 This specification performs full text comparison, but even with
2633 regular expression support it is almost impossible to write a search
2634 expression that safely matches only a specific address domain.
2635 To request that the body content of the header is treated as a list of
2636 addresses, and to strip those down to the plain email address which the
2637 search expression is to be matched against, prefix the effective
2638 .Ar name-list
2639 with a tilde
2640 .Ql ~ :
2643 .Dl '@~f,c@@a\e.safe\e.domain\e.match$'
2646 .It Ar :c
2647 All messages of state or with matching condition
2648 .Ql c ,
2649 where
2650 .Ql c
2651 is one or multiple of the following colon modifiers:
2653 .Bl -tag -compact -width ".It Ar :M"
2654 .It Ar a
2655 .Ic answered
2656 messages (cf. the variable
2657 .Va markanswered ) .
2658 .It Ar d
2659 .Ql deleted
2660 messages (for the
2661 .Ic undelete
2663 .Ic from
2664 commands only).
2665 .It Ar f
2666 .Ic flag Ns
2667 ged messages.
2668 .It Ar L
2669 Messages with receivers that match
2670 .Ic mlsubscribe Ns
2671 d addresses.
2672 .It Ar l
2673 Messages with receivers that match
2674 .Ic mlist Ns
2675 ed addresses.
2676 .It Ar n
2677 .Ql new
2678 messages.
2679 .It Ar o
2680 Old messages (any not in state
2681 .Ql read
2683 .Ql new ) .
2684 .It Ar r
2685 .Ql read
2686 messages.
2687 .It Ar S
2688 \*(OP Messages with unsure spam classification (see
2689 .Sx "Handling spam" ) .
2690 .It Ar s
2691 \*(OP Messages classified as spam.
2692 .It Ar t
2693 Messages marked as
2694 .Ic draft .
2695 .It Ar u
2696 .Ql unread
2697 messages.
2703 \*(OP IMAP-style SEARCH expressions may also be used.
2704 These consist of keywords and criterions, and because
2705 .Sx "Message list arguments"
2706 are split into tokens according to
2707 .Sx "Shell-style argument quoting"
2708 it is necessary to quote the entire IMAP search expression in order to
2709 ensure that it remains a single token.
2710 This addressing mode is available with all types of mailbox
2711 .Ic folder Ns
2712 s; \*(UA will perform the search locally as necessary.
2713 Strings must be enclosed by double quotes
2714 .Ql \&"
2715 in their entirety if they contain whitespace or parentheses;
2716 within the quotes, only reverse solidus
2717 .Ql \e
2718 is recognized as an escape character.
2719 All string searches are case-insensitive.
2720 When the description indicates that the
2721 .Dq envelope
2722 representation of an address field is used,
2723 this means that the search string is checked against both a list
2724 constructed as
2726 .Bd -literal -offset indent
2727 \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)'
2731 for each address,
2732 and the addresses without real names from the respective header field.
2733 These search expressions can be nested using parentheses, see below for
2734 examples.
2737 .Bl -tag -compact -width ".It Ar _n_u"
2738 .It Ar ( criterion )
2739 All messages that satisfy the given
2740 .Ar criterion .
2741 .It Ar ( criterion1 criterion2 ... criterionN )
2742 All messages that satisfy all of the given criteria.
2744 .It Ar ( or criterion1 criterion2 )
2745 All messages that satisfy either
2746 .Ar criterion1
2748 .Ar criterion2 ,
2749 or both.
2750 To connect more than two criteria using
2751 .Ql or
2752 specifications have to be nested using additional parentheses,
2753 as with
2754 .Ql (or a (or b c)) ,
2755 since
2756 .Ql (or a b c)
2757 really means
2758 .Ql ((a or b) and c) .
2759 For a simple
2760 .Ql or
2761 operation of independent criteria on the lowest nesting level,
2762 it is possible to achieve similar effects by using three separate
2763 criteria, as with
2764 .Ql (a) (b) (c) .
2766 .It Ar ( not criterion )
2767 All messages that do not satisfy
2768 .Ar criterion .
2769 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2770 All messages that contain
2771 .Ar string
2772 in the envelope representation of the
2773 .Ql Bcc:
2774 field.
2775 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2776 All messages that contain
2777 .Ar string
2778 in the envelope representation of the
2779 .Ql Cc:
2780 field.
2781 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2782 All messages that contain
2783 .Ar string
2784 in the envelope representation of the
2785 .Ql From:
2786 field.
2787 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2788 All messages that contain
2789 .Ar string
2790 in the
2791 .Ql Subject:
2792 field.
2793 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2794 All messages that contain
2795 .Ar string
2796 in the envelope representation of the
2797 .Ql To:
2798 field.
2799 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2800 All messages that contain
2801 .Ar string
2802 in the specified
2803 .Ql Name:
2804 field.
2805 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2806 All messages that contain
2807 .Ar string
2808 in their body.
2809 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2810 All messages that contain
2811 .Ar string
2812 in their header or body.
2813 .It Ar ( larger size )
2814 All messages that are larger than
2815 .Ar size
2816 (in bytes).
2817 .It Ar ( smaller size )
2818 All messages that are smaller than
2819 .Ar size
2820 (in bytes).
2822 .It Ar ( before date )
2823 All messages that were received before
2824 .Ar date ,
2825 which must be in the form
2826 .Ql d[d]-mon-yyyy ,
2827 where
2828 .Ql d
2829 denotes the day of the month as one or two digits,
2830 .Ql mon
2831 is the name of the month \(en one of
2832 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2834 .Ql yyyy
2835 is the year as four digits, e.g.,
2836 .Ql 28-Dec-2012 .
2838 .It Ar ( on date )
2839 All messages that were received on the specified date.
2840 .It Ar ( since date )
2841 All messages that were received since the specified date.
2842 .It Ar ( sentbefore date )
2843 All messages that were sent on the specified date.
2844 .It Ar ( senton date )
2845 All messages that were sent on the specified date.
2846 .It Ar ( sentsince date )
2847 All messages that were sent since the specified date.
2848 .It Ar ()
2849 The same criterion as for the previous search.
2850 This specification cannot be used as part of another criterion.
2851 If the previous command line contained more than one independent
2852 criterion then the last of those criteria is used.
2854 .\" }}}
2856 .\" .Ss "On terminal control and line editor" {{{
2857 .Ss "On terminal control and line editor"
2859 \*(OP Terminal control will be realized through one of the standard
2861 libraries, either the
2862 .Lb libtermcap ,
2863 or, alternatively, the
2864 .Lb libterminfo ,
2865 both of which will be initialized to work with the environment variable
2866 .Ev TERM .
2867 Terminal control will enhance or enable interactive usage aspects, e.g.,
2868 .Sx "Coloured display" ,
2869 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2870 byte-sequences of keys like the cursor- and function-keys.
2873 The internal variable
2874 .Va termcap
2875 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2876 Actual library interaction can be disabled completely by setting
2877 .Va termcap-disable ;
2878 .Va termcap
2879 will be queried regardless, which is true even if the \*(OPal library
2880 support has not been enabled at configuration time as long as some other
2881 \*(OP which (may) query terminal control sequences has been enabled.
2882 \*(UA can be told to enter an alternative exclusive screen, the
2883 so-called ca-mode, by setting
2884 .Va termcap-ca-mode ;
2885 this requires sufficient terminal support, and the used
2886 .Ev PAGER
2887 may also need special configuration, dependent on the value of
2888 .Va crt .
2891 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2892 environments which comply to the ISO C standard
2893 .St -isoC-amd1 ,
2894 and will support wide glyphs if possible (the necessary functionality
2895 had been removed from ISO C, but was included in
2896 .St -xpg4 ) .
2897 Usage of a line editor in interactive mode can be prevented by setting
2898 .Va line-editor-disable .
2899 Especially if the \*(OPal terminal control support is missing setting
2900 entries in the internal variable
2901 .Va termcap
2902 will help shall the MLE misbehave, see there for more.
2903 The MLE can support a little bit of
2904 .Ic colour .
2907 \*(OP If the
2908 .Ic history
2909 feature is available then input from line editor prompts will be saved
2910 in a history list that can be searched in and be expanded from.
2911 Such saving can be prevented by prefixing input with any amount of
2912 whitespace.
2913 Aspects of history, like allowed content and maximum size, as well as
2914 whether history shall be saved persistently, can be configured with the
2915 internal variables
2916 .Va history-file ,
2917 .Va history-gabby ,
2918 .Va history-gabby-persist
2920 .Va history-size .
2923 The MLE supports a set of editing and control commands.
2924 By default (as) many (as possible) of these will be assigned to a set of
2925 single-letter control codes, which should work on any terminal (and can
2926 be generated by holding the
2927 .Dq control
2928 key while pressing the key of desire, e.g.,
2929 .Ql control-D ) .
2930 If the \*(OPal
2931 .Ic bind
2932 command is available then the MLE commands can also be accessed freely
2933 by assigning the command name, which is shown in parenthesis in the list
2934 below, to any desired key-sequence, and the MLE will instead and also use
2935 .Ic bind
2936 to establish its built-in key bindings
2937 (more of them if the \*(OPal terminal control is available),
2938 an action which can then be suppressed completely by setting
2939 .Va line-editor-no-defaults .
2940 .Sx "Shell-style argument quoting"
2941 notation is used in the following;
2942 combinations not mentioned either cause job control signals or do not
2943 generate a (unique) keycode:
2947 .Bl -tag -compact -width ".It Ql \eBa"
2948 .It Ql \ecA
2949 Go to the start of the line
2951 .Pf ( Cd mle-go-home ) .
2953 .It Ql \ecB
2954 Move the cursor backward one character
2956 .Pf ( Cd mle-go-bwd ) .
2958 .It Ql \ecD
2959 Forward delete the character under the cursor;
2960 quits \*(UA if used on the empty line unless the internal variable
2961 .Va ignoreeof
2962 is set
2964 .Pf ( Cd mle-del-fwd ) .
2966 .It Ql \ecE
2967 Go to the end of the line
2969 .Pf ( Cd mle-go-end ) .
2971 .It Ql \ecF
2972 Move the cursor forward one character
2974 .Pf ( Cd mle-go-fwd ) .
2976 .It Ql \ecG
2977 Cancel current operation, full reset.
2978 If there is an active history search or tabulator expansion then this
2979 command will first reset that, reverting to the former line content;
2980 thus a second reset is needed for a full reset in this case
2982 .Pf ( Cd mle-reset ) .
2984 .It Ql \ecH
2985 Backspace: backward delete one character
2987 .Pf ( Cd mle-del-bwd ) .
2989 .It Ql \ecI
2990 \*(NQ
2991 Horizontal tabulator:
2992 try to expand the word before the cursor, supporting the usual
2993 .Sx "Filename transformations"
2995 .Pf ( Cd mle-complete ;
2996 this is affected by
2997 .Cd mle-quote-rndtrip ) .
2999 .It Ql \ecJ
3000 Newline:
3001 commit the current line
3003 .Pf ( Cd mle-commit ) .
3005 .It Ql \ecK
3006 Cut all characters from the cursor to the end of the line
3008 .Pf ( Cd mle-snarf-end ) .
3010 .It Ql \ecL
3011 Repaint the line
3013 .Pf ( Cd mle-repaint ) .
3015 .It Ql \ecN
3016 \*(OP Go to the next history entry
3018 .Pf ( Cd mle-hist-fwd ) .
3020 .It Ql \ecO
3021 (\*(OPally context-dependent) Invokes the command
3022 .Ic dt .
3024 .It Ql \ecP
3025 \*(OP Go to the previous history entry
3027 .Pf ( Cd mle-hist-bwd ) .
3029 .It Ql \ecQ
3030 Toggle roundtrip mode shell quotes, where produced,
3031 on and off
3033 .Pf ( Cd mle-quote-rndtrip ) .
3034 This setting is temporary, and will be forgotten once the command line
3035 is committed; also see
3036 .Ic shcodec .
3038 .It Ql \ecR
3039 \*(OP Complete the current line from (the remaining) older history entries
3041 .Pf ( Cd mle-hist-srch-bwd ) .
3043 .It Ql \ecS
3044 \*(OP Complete the current line from (the remaining) newer history entries
3046 .Pf ( Cd mle-hist-srch-fwd ) .
3048 .It Ql \ecT
3049 Paste the snarf buffer
3051 .Pf ( Cd mle-paste ) .
3053 .It Ql \ecU
3054 The same as
3055 .Ql \ecA
3056 followed by
3057 .Ql \ecK
3059 .Pf ( Cd mle-snarf-line ) .
3061 .It Ql \ecV
3062 Prompts for a Unicode character (hexadecimal number without prefix, see
3063 .Ic vexpr )
3064 to be inserted
3066 .Pf ( Cd mle-prompt-char ) .
3067 Note this command needs to be assigned to a single-letter control code
3068 in order to become recognized and executed during input of
3069 a key-sequence (only three single-letter control codes can be used for
3070 that shortcut purpose); this control code is then special-treated and
3071 thus cannot be part of any other sequence (because it will trigger the
3072 .Cd mle-prompt-char
3073 function immediately).
3075 .It Ql \ecW
3076 Cut the characters from the one preceding the cursor to the preceding
3077 word boundary
3079 .Pf ( Cd mle-snarf-word-bwd ) .
3081 .It Ql \ecX
3082 Move the cursor forward one word boundary
3084 .Pf ( Cd mle-go-word-fwd ) .
3086 .It Ql \ecY
3087 Move the cursor backward one word boundary
3089 .Pf ( Cd mle-go-word-bwd ) .
3091 .It Ql \ec[
3092 Escape: reset a possibly used multibyte character input state machine
3093 and \*(OPally a lingering, incomplete key binding
3095 .Pf ( Cd mle-cancel ) .
3096 This command needs to be assigned to a single-letter control code in
3097 order to become recognized and executed during input of a key-sequence
3098 (only three single-letter control codes can be used for that shortcut
3099 purpose).
3100 This control code may also be part of a multi-byte sequence, but if
3101 a sequence is active and the very control code is currently also an
3102 expected input, then the active sequence takes precedence and will
3103 consume the control code.
3105 .It Ql \ec\e
3106 (\*(OPally context-dependent) Invokes the command
3107 .Ql Ic z Ns + .
3109 .It Ql \ec]
3110 (\*(OPally context-dependent) Invokes the command
3111 .Ql Ic z Ns $ .
3113 .It Ql \ec^
3114 (\*(OPally context-dependent) Invokes the command
3115 .Ql Ic z Ns 0 .
3117 .It Ql \ec_
3118 Cut the characters from the one after the cursor to the succeeding word
3119 boundary
3121 .Pf ( Cd mle-snarf-word-fwd ) .
3123 .It Ql \ec?
3124 Backspace:
3125 .Cd mle-del-bwd .
3127 .It \(en
3128 Move the cursor forward one screen width
3130 .Pf ( Cd mle-go-screen-fwd ) .
3132 .It \(en
3133 Move the cursor backward one screen width
3135 .Pf ( Cd mle-go-screen-bwd ) .
3137 .It \(en
3138 \*(OP Move the cursor home and clear the screen
3140 .Pf ( Cd mle-clear-screen ) .
3142 .It \(en
3144 .Cd mle-fullreset :
3145 different to
3146 .Cd mle-reset
3147 this will immediately reset a possibly active search etc.
3149 .It \(en
3151 .Cd mle-bell :
3152 ring the audible bell.
3154 .\" }}}
3156 .\" .Ss "Coloured display" {{{
3157 .Ss "Coloured display"
3159 \*(OP \*(UA can be configured to support a coloured display and font
3160 attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic
3161 rendition) escape sequences.
3162 Usage of colours and font attributes solely depends upon the
3163 capability of the detected terminal type that is defined by the
3164 environment variable
3165 .Ev TERM
3166 and which can be fine-tuned by the user via the internal variable
3167 .Va termcap .
3170 On top of what \*(UA knows about the terminal the boolean variable
3171 .Va colour-pager
3172 defines whether the actually applicable colour and font attribute
3173 sequences should also be generated when output is going to be paged
3174 through the external program defined by the environment variable
3175 .Ev PAGER
3176 (also see
3177 .Va crt Ns
3179 This is not enabled by default because different pager programs need
3180 different command line switches or other configuration in order to
3181 support those sequences.
3182 \*(UA however knows about some widely used pagers and in a clean
3183 environment it is often enough to simply set
3184 .Va colour-pager ;
3185 please refer to that variable for more on this topic.
3188 Colours and font attributes can be managed with the multiplexer command
3189 .Ic colour ,
3191 .Ic uncolour
3192 can be used to remove mappings of a given colour type.
3193 If the variable
3194 .Va colour-disable
3195 is set then any active usage of colour and font attribute sequences
3196 is suppressed without affecting possibly established
3197 .Ic colour
3198 mappings.
3199 Since colours are only available in interactive mode, it may make
3200 sense to conditionalize the colour setup by encapsulating it with
3201 .Ic if :
3203 .Bd -literal -offset indent
3204 if terminal && [ "$features" =% +colour ]
3205   colour iso view-msginfo ft=bold,fg=green
3206   colour iso view-header ft=bold,fg=red from,subject
3207   colour iso view-header fg=red
3209   uncolour iso view-header from,subject
3210   colour iso view-header ft=bold,fg=magenta,bg=cyan
3211   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
3212   colour mono view-header ft=bold
3213   colour mono view-header ft=bold,ft=reverse subject,from
3214 endif
3216 .\" }}}
3218 .\" .Ss "Handling spam" {{{
3219 .Ss "Handling spam"
3221 \*(OP \*(UA can make use of several spam interfaces for the purpose of
3222 identification of, and, in general, dealing with spam messages.
3223 A precondition of most commands in order to function is that the
3224 .Va spam-interface
3225 variable is set to one of the supported interfaces.
3226 .Sx "Specifying messages"
3227 that have been identified as spam is possible via their (volatile)
3228 .Ql is-spam
3229 state by using the
3230 .Ql Ar :s
3232 .Ql Ar :S
3233 specifications, and their
3234 .Va attrlist
3235 entries will be used when displaying the
3236 .Va headline
3237 in the summary of
3238 .Ic headers .
3240 .Bl -bullet
3242 .Ic spamrate
3243 rates the given messages and sets their
3244 .Ql is-spam
3245 flag accordingly.
3246 If the spam interface offers spam scores these can be shown in
3247 .Va headline
3248 by using the format
3249 .Ql %$ .
3251 .Ic spamham ,
3252 .Ic spamspam
3254 .Ic spamforget
3255 will interact with the Bayesian filter of the chosen interface and learn
3256 the given messages as
3257 .Dq ham
3259 .Dq spam ,
3260 respectively; the last command can be used to cause
3261 .Dq unlearning
3262 of messages; it adheres to their current
3263 .Ql is-spam
3264 state and thus reverts previous teachings.
3266 .Ic spamclear
3268 .Ic spamset
3269 will simply set and clear, respectively, the mentioned volatile
3270 .Ql is-spam
3271 message flag, without any interface interaction.
3276 .Xr spamassassin 1
3277 based
3278 .Va spam-interface
3279 .Ql spamc
3280 requires a running instance of the
3281 .Xr spamd 1
3282 server in order to function, started with the option
3283 .Fl -allow-tell
3284 shall Bayesian filter learning be possible.
3286 .Bd -literal -offset indent
3287 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3288 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3289     --daemonize [--local] [--allow-tell]
3293 Thereafter \*(UA can make use of these interfaces:
3295 .Bd -literal -offset indent
3296 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3297     -Sspamc-command=/usr/local/bin/spamc \e
3298     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3300 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3301     -Sspamc-command=/usr/local/bin/spamc \e
3302     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3306 Using the generic filter approach allows usage of programs like
3307 .Xr bogofilter 1 .
3308 Here is an example, requiring it to be accessible via
3309 .Ev PATH :
3311 .Bd -literal -offset indent
3312 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3313     -Sspamfilter-ham="bogofilter -n" \e
3314     -Sspamfilter-noham="bogofilter -N" \e
3315     -Sspamfilter-nospam="bogofilter -S" \e
3316     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3317     -Sspamfilter-spam="bogofilter -s" \e
3318     -Sspamfilter-rate-scanscore="1;^(.+)$"
3322 Because messages must exist on local storage in order to be scored (or
3323 used for Bayesian filter training), it is possibly a good idea to
3324 perform the local spam check last.
3325 Spam can be checked automatically when opening specific folders by
3326 setting a specialized form of the internal variable
3327 .Va folder-hook .
3329 .Bd -literal -offset indent
3330 define spamdelhook {
3331   # Server side DCC
3332   spamset (header x-dcc-brand-metrics "bulk")
3333   # Server-side spamassassin(1)
3334   spamset (header x-spam-flag "YES")
3335   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3336   move :S +maybe-spam
3337   spamrate :u
3338   del :s
3339   move :S +maybe-spam
3341 set folder-hook-SOMEFOLDER=spamdelhook
3345 See also the documentation for the variables
3346 .Va spam-interface , spam-maxsize ,
3347 .Va spamc-command , spamc-arguments , spamc-user ,
3348 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3349   spamfilter-rate
3351 .Va spamfilter-rate-scanscore .
3352 .\" }}}
3354 .\" }}} (DESCRIPTION)
3357 .\" .Sh COMMANDS {{{
3358 .Sh COMMANDS
3360 \*(UA reads input in lines.
3361 An unquoted reverse solidus
3362 .Ql \e
3363 at the end of a command line
3364 .Dq escapes
3365 the newline character: it is discarded and the next line of input is
3366 used as a follow-up line, with all leading whitespace removed;
3367 once an entire line is completed, the whitespace characters
3368 .Cm space , tabulator , newline
3369 as well as those defined by the variable
3370 .Va ifs
3371 are removed from the beginning and end.
3372 Placing any whitespace characters at the beginning of a line will
3373 prevent a possible addition of the command line to the \*(OPal
3374 .Ic history .
3377 The beginning of such input lines is then scanned for the name of
3378 a known command: command names may be abbreviated, in which case the
3379 first command that matches the given prefix will be used.
3380 .Sx "Command modifiers"
3381 may prefix a command in order to modify its behaviour.
3382 A name may also be a
3383 .Ic commandalias ,
3384 which will become expanded until no more expansion is possible.
3385 Once the command that shall be executed is known, the remains of the
3386 input line will be interpreted according to command-specific rules,
3387 documented in the following.
3390 This behaviour is different to the
3391 .Xr sh 1 Ns
3392 ell, which is a programming language with syntactic elements of clearly
3393 defined semantics, and therefore capable to sequentially expand and
3394 evaluate individual elements of a line.
3395 \*(UA will never be able to handle
3396 .Ql ? set one=value two=$one
3397 in a single statement, because the variable assignment is performed by
3398 the command
3399 .Pf ( Ic set ) ,
3400 not the language.
3403 The command
3404 .Ic list
3405 can be used to show the list of all commands, either alphabetically
3406 sorted or in prefix search order (these do not match, also because the
3407 POSIX standard prescribes a set of abbreviations).
3408 \*(OPally the command
3409 .Ic help
3411 .Ic \&? ) ,
3412 when given an argument, will show a documentation string for the
3413 command matching the expanded argument, as in
3414 .Ql ?t ,
3415 which should be a shorthand of
3416 .Ql ?type ;
3417 with these documentation strings both commands support a more
3418 .Va verbose
3419 listing mode which includes the argument type of the command and other
3420 information which applies; a handy suggestion might thus be:
3422 .Bd -literal -offset indent
3423 ? define __xv {
3424   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3425   localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}
3427 ? commandalias xv '\ecall __xv'
3428 ? xv help set
3431 .\" .Ss "Command modifiers" {{{
3432 .Ss "Command modifiers"
3434 Commands may be prefixed by one or multiple command modifiers.
3435 Some command modifiers can be used with a restricted set of commands
3436 only, the
3437 .Va verbose
3438 version of
3439 .Ic list
3440 will (\*(OPally) show which modifiers apply.
3442 .Bl -bullet
3444 The modifier reverse solidus
3446 .Cm \e ,
3447 to be placed first, prevents
3448 .Ic commandalias
3449 expansions on the remains of the line, e.g.,
3450 .Ql \eecho
3451 will always evaluate the command
3452 .Ic echo ,
3453 even if an (command)alias of the same name exists.
3454 .Ic commandalias
3455 content may itself contain further command modifiers, including
3456 an initial reverse solidus to prevent further expansions.
3459 The modifier
3461 .Cm ignerr
3462 indicates that any error generated by the following command should be
3463 ignored by the state machine and not cause a program exit with enabled
3464 .Va errexit
3465 or for the standardized exit cases in
3466 .Va posix
3467 mode.
3468 .Va \&? ,
3469 one of the
3470 .Sx "INTERNAL VARIABLES" ,
3471 will be set to the real exit status of the command regardless.
3475 .Cm local
3476 will alter the called command to apply changes only temporarily,
3477 local to block-scope, and can thus only be used inside of a
3478 .Ic define Ns
3479 d macro or an
3480 .Ic account
3481 definition.
3482 Specifying it implies the modifier
3483 .Cm wysh .
3484 Block-scope settings will not be inherited by macros deeper in the
3485 .Ic call
3486 chain, and will be garbage collected once the current block is left.
3487 To record and unroll changes in the global scope use the command
3488 .Ic localopts .
3492 .Cm scope
3493 does yet not implement any functionality.
3497 .Cm u
3498 does yet not implement any functionality.
3501 Some commands support the
3503 .Cm vput
3504 modifier: if used, they expect the name of a variable, which can itself
3505 be a variable, i.e., shell expansion is applied, as their first
3506 argument, and will place their computation result in it instead of the
3507 default location (it is usually written to standard output).
3509 The given name will be tested for being a valid
3510 .Xr sh 1
3511 variable name, and may therefore only consist of upper- and lowercase
3512 characters, digits, and the underscore; the hyphen-minus may be used as
3513 a non-portable extension; digits may not be used as first, hyphen-minus
3514 may not be used as last characters.
3515 In addition the name may either not be one of the known
3516 .Sx "INTERNAL VARIABLES" ,
3517 or must otherwise refer to a writable (non-boolean) value variable.
3518 The actual put operation may fail nonetheless, e.g., if the variable
3519 expects a number argument only a number will be accepted.
3520 Any error during these operations causes the command as such to fail,
3521 and the error number
3522 .Va \&!
3523 will be set to
3524 .Va ^ERR Ns -NOTSUP ,
3525 the exit status
3526 .Va \&?
3527 should be set to
3528 .Ql -1 ,
3529 but some commands deviate from the latter, which is documented.
3532 Last, but not least, the modifier
3534 .Cm wysh
3535 can be used for some old and established commands to choose the new
3536 .Sx "Shell-style argument quoting"
3537 rules over the traditional
3538 .Sx "Old-style argument quoting" .
3540 .\" }}}
3542 .\" .Ss "Old-style argument quoting" {{{
3543 .Ss "Old-style argument quoting"
3545 \*(ID This section documents the old, traditional style of quoting
3546 non-message-list arguments to commands which expect this type of
3547 arguments: whereas still used by the majority of such commands, the new
3548 .Sx "Shell-style argument quoting"
3549 may be available even for those via
3550 .Cm wysh ,
3551 one of the
3552 .Sx "Command modifiers" .
3553 Nonetheless care must be taken, because only new commands have been
3554 designed with all the capabilities of the new quoting rules in mind,
3555 which can, e.g., generate control characters.
3558 .Bl -bullet -offset indent
3560 An argument can be enclosed between paired double-quotes
3561 .Ql """argument"""
3563 single-quotes
3564 .Ql 'argument' ;
3565 any whitespace, shell word expansion, or reverse solidus characters
3566 (except as described next) within the quotes are treated literally as
3567 part of the argument.
3568 A double-quote will be treated literally within single-quotes and vice
3569 versa.
3570 Inside such a quoted string the actually used quote character can be
3571 used nonetheless by escaping it with a reverse solidus
3572 .Ql \e ,
3573 as in
3574 .Ql """y\e""ou""" .
3577 An argument that is not enclosed in quotes, as above, can usually still
3578 contain space characters if those spaces are reverse solidus escaped, as in
3579 .Ql you\e are .
3582 A reverse solidus outside of the enclosing quotes is discarded
3583 and the following character is treated literally as part of the argument.
3585 .\" }}}
3587 .\" .Ss "Shell-style argument quoting" {{{
3588 .Ss "Shell-style argument quoting"
3590 .Xr sh 1 Ns
3591 ell-style, and therefore POSIX standardized, argument parsing and
3592 quoting rules are used by most commands.
3593 \*(ID Most new commands only support these new rules and are flagged
3594 \*(NQ, some elder ones can use them with the command modifier
3595 .Cm wysh ;
3596 in the future only this type of argument quoting will remain.
3599 A command line is parsed from left to right and an input token is
3600 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3601 Metacharacters are vertical bar
3602 .Cm \&| ,
3603 ampersand
3604 .Cm & ,
3605 semicolon
3606 .Cm \&; ,
3607 as well as all characters from the variable
3608 .Va ifs ,
3609 and / or
3610 .Cm space , tabulator , newline .
3611 The additional metacharacters left and right parenthesis
3612 .Cm \&( , \&)
3613 and less-than and greater-than signs
3614 .Cm < , >
3615 that the
3616 .Xr sh 1
3617 supports are not used, and are treated as ordinary characters: for one
3618 these characters are a vivid part of email addresses, and it seems
3619 highly unlikely that their function will become meaningful to \*(UA.
3621 .Bd -filled -offset indent
3622 .Sy Compatibility note:
3623 \*(ID Please note that even many new-style commands do not yet honour
3624 .Va ifs
3625 to parse their arguments: whereas the
3626 .Xr sh 1 Ns
3627 ell is a language with syntactic elements of clearly defined semantics,
3628 \*(UA parses entire input lines and decides on a per-command base what
3629 to do with the rest of the line.
3630 This also means that whenever an unknown command is seen all that \*(UA
3631 can do is cancellation of the processing of the remains of the line.
3633 It also often depends on an actual subcommand of a multiplexer command
3634 how the rest of the line should be treated, and until v15 we are not
3635 capable to perform this deep inspection of arguments.
3636 Nonetheless, at least the following commands which work with positional
3637 parameters fully support
3638 .Va ifs
3639 for an almost shell-compatible field splitting:
3640 .Ic call , call_if , read , vpospar , xcall .
3644 Any unquoted number sign
3645 .Ql #
3646 at the beginning of a new token starts a comment that extends to the end
3647 of the line, and therefore ends argument processing.
3648 An unquoted dollar sign
3649 .Ql $
3650 will cause variable expansion of the given name, which must be a valid
3651 .Xr sh 1 Ns
3652 ell-style variable name (see
3653 .Cm vput ) :
3654 .Sx "INTERNAL VARIABLES"
3655 as well as
3656 .Sx ENVIRONMENT
3657 (shell) variables can be accessed through this mechanism, brace
3658 enclosing the name is supported (i.e., to subdivide a token).
3661 Whereas the metacharacters
3662 .Cm space , tabulator , newline
3663 only complete an input token, vertical bar
3664 .Cm \&| ,
3665 ampersand
3666 .Cm &
3667 and semicolon
3668 .Cm \&;
3669 also act as control operators and perform control functions.
3670 For now supported is semicolon
3671 .Cm \&; ,
3672 which terminates a single command, therefore sequencing the command line
3673 and making the remainder of the line a subject to reevaluation.
3674 With sequencing, multiple command argument types and quoting rules may
3675 therefore apply to a single line, which can become problematic before
3676 v15: e.g., the first of the following will cause surprising results.
3679 .Dl ? echo one; set verbose; echo verbose=$verbose.
3680 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3683 Quoting is a mechanism that will remove the special meaning of
3684 metacharacters and reserved words, and will prevent expansion.
3685 There are four quoting mechanisms: the escape character, single-quotes,
3686 double-quotes and dollar-single-quotes:
3689 .Bl -bullet -offset indent
3691 The literal value of any character can be preserved by preceding it
3692 with the escape character reverse solidus
3693 .Ql \e .
3696 Arguments which are enclosed in
3697 .Ql 'single-\:quotes'
3698 retain their literal value.
3699 A single-quote cannot occur within single-quotes.
3702 The literal value of all characters enclosed in
3703 .Ql \(dqdouble-\:quotes\(dq
3704 is retained, with the exception of dollar sign
3705 .Ql $ ,
3706 which will cause variable expansion, as above, backquote (grave accent)
3707 .Ql ` ,
3708 (which not yet means anything special), reverse solidus
3709 .Ql \e ,
3710 which will escape any of the characters dollar sign
3711 .Ql $
3712 (to prevent variable expansion), backquote (grave accent)
3713 .Ql ` ,
3714 double-quote
3715 .Ql \(dq
3716 (to prevent ending the quote) and reverse solidus
3717 .Ql \e
3718 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3719 but has no special meaning otherwise.
3722 Arguments enclosed in
3723 .Ql $'dollar-\:single-\:quotes'
3724 extend normal single quotes in that reverse solidus escape sequences are
3725 expanded as follows:
3727 .Bl -tag -compact -width ".Ql \eNNN"
3728 .It Ql \ea
3729 bell control character (ASCII and ISO-10646 BEL).
3730 .It Ql \eb
3731 backspace control character (ASCII and ISO-10646 BS).
3732 .It Ql \eE
3733 escape control character (ASCII and ISO-10646 ESC).
3734 .It Ql \ee
3735 the same.
3736 .It Ql \ef
3737 form feed control character (ASCII and ISO-10646 FF).
3738 .It Ql \en
3739 line feed control character (ASCII and ISO-10646 LF).
3740 .It Ql \er
3741 carriage return control character (ASCII and ISO-10646 CR).
3742 .It Ql \et
3743 horizontal tabulator control character (ASCII and ISO-10646 HT).
3744 .It Ql \ev
3745 vertical tabulator control character (ASCII and ISO-10646 VT).
3746 .It Ql \e\e
3747 emits a reverse solidus character.
3748 .It Ql \e'
3749 single quote.
3750 .It Ql \e"
3751 double quote (escaping is optional).
3752 .It Ql \eNNN
3753 eight-bit byte with the octal value
3754 .Ql NNN
3755 (one to three octal digits), optionally prefixed by an additional
3756 .Ql 0 .
3757 A 0 byte will suppress further output for the quoted argument.
3758 .It Ql \exHH
3759 eight-bit byte with the hexadecimal value
3760 .Ql HH
3761 (one or two hexadecimal characters, no prefix, see
3762 .Ic vexpr ) .
3763 A 0 byte will suppress further output for the quoted argument.
3764 .It Ql \eUHHHHHHHH
3765 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3766 .Ql HHHHHHHH
3767 (one to eight hexadecimal characters) \(em note that Unicode defines the
3768 maximum codepoint ever to be supported as
3769 .Ql 0x10FFFF
3770 (in planes of
3771 .Ql 0xFFFF
3772 characters each).
3773 This escape is only supported in locales that support Unicode (see
3774 .Sx "Character sets" ) ,
3775 in other cases the sequence will remain unexpanded unless the given code
3776 point is ASCII compatible or (if the \*(OPal character set conversion is
3777 available) can be represented in the current locale.
3778 The character NUL will suppress further output for the quoted argument.
3779 .It Ql \euHHHH
3780 Identical to
3781 .Ql \eUHHHHHHHH
3782 except it takes only one to four hexadecimal characters.
3783 .It Ql \ecX
3784 Emits the non-printable (ASCII and compatible) C0 control codes
3785 0 (NUL) to 31 (US), and 127 (DEL).
3786 Printable representations of ASCII control codes can be created by
3787 mapping them to a different, visible part of the ASCII character set.
3788 Adding the number 64 achieves this for the codes 0 to 31, e.g., 7 (BEL):
3789 .Ql 7 + 64 = 71 = G .
3790 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3791 .Ic vexpr ) ,
3792 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3793 .Ql ? vexpr ^ 127 64 .
3795 Whereas historically circumflex notation has often been used for
3796 visualization purposes of control codes, e.g.,
3797 .Ql ^G ,
3798 the reverse solidus notation has been standardized:
3799 .Ql \ecG .
3800 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3801 as shown above (e.g.,
3802 .Ql \ea ,
3803 .Ql \en ,
3804 .Ql \et ) :
3805 whenever such an alias exists it will be used for display purposes.
3806 The control code NUL
3807 .Pf ( Ql \ec@ ,
3808 a non-standard extension) will suppress further output for the remains
3809 of the token (which may extend beyond the current quote), or, depending
3810 on the context, the remains of all arguments for the current command.
3811 .It Ql \e$NAME
3812 Non-standard extension: expand the given variable name, as above.
3813 Brace enclosing the name is supported.
3814 .It Ql \e`{command}
3815 Not yet supported, just to raise awareness: Non-standard extension.
3820 Caveats:
3822 .Bd -literal -offset indent
3823 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3824 ? echo Quotes ${HOME} and tokens differ! # comment
3825 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3827 .\" }}}
3829 .\" .Ss "Message list arguments" {{{
3830 .Ss "Message list arguments"
3832 Many commands operate on message list specifications, as documented in
3833 .Sx "Specifying messages" .
3834 The argument input is first split into individual tokens via
3835 .Sx "Shell-style argument quoting" ,
3836 which are then interpreted as the mentioned specifications.
3837 If no explicit message list has been specified, many commands will
3838 search for and use the next message forward that satisfies the commands'
3839 requirements, and if there are no messages forward of the current
3840 message, the search proceeds backwards;
3841 if there are no good messages at all to be found, an error message is
3842 shown and the command is aborted.
3844 .Va verbose
3845 output of the command
3846 .Ic list
3847 will indicate whether a command searches for a default message, or not.
3848 .\" }}}
3850 .\" .Ss "Raw data arguments for codec commands" {{{
3851 .Ss "Raw data arguments for codec commands"
3853 A special set of commands, which all have the string
3854 .Dq codec
3855 in their name, e.g.,
3856 .Ic addrcodec ,
3857 .Ic shcodec ,
3858 .Ic urlcodec ,
3859 take raw string data as input, which means that the content of the
3860 command input line is passed completely unexpanded and otherwise
3861 unchanged: like this the effect of the actual codec is visible without
3862 any noise of possible shell quoting rules etc., i.e., the user can input
3863 one-to-one the desired or questionable data.
3864 To gain a level of expansion, the entire command line can be
3865 .Ic eval Ns
3866 uated first, e.g.,
3868 .Bd -literal -offset indent
3869 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3870 ? echo $res
3871 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3872 ? shcodec d $res
3873 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3874 ? eval shcodec d $res
3875 /usr/Sch\[:o]nes Wetter/heute.txt
3877 .\" }}}
3879 .\" .Ss "Filename transformations" {{{
3880 .Ss "Filename transformations"
3882 Filenames, where expected, and unless documented otherwise, are
3883 subsequently subject to the following filename transformations, in
3884 sequence:
3886 .Bl -bullet -offset indent
3888 If the given name is a registered
3889 .Ic shortcut ,
3890 it will be replaced with the expanded shortcut.
3893 The filename is matched against the following patterns or strings:
3895 .Bl -hang -compact -width ".Ar %user"
3896 .It Ar #
3897 (Number sign) is expanded to the previous file.
3898 .It Ar %
3899 (Percent sign) is replaced by the invoking
3900 .Mx -ix "primary system mailbox"
3901 user's primary system mailbox, which either is the (itself expandable)
3902 .Va inbox
3903 if that is set, the standardized absolute pathname indicated by
3904 .Ev MAIL
3905 if that is set, or a built-in compile-time default otherwise.
3906 .It Ar %user
3907 Expands to the primary system mailbox of
3908 .Ar user
3909 (and never the value of
3910 .Va inbox ,
3911 regardless of its actual setting).
3912 .It Ar &
3913 (Ampersand) is replaced with the invoking user's
3914 .Mx -ix "secondary mailbox"
3915 secondary mailbox, the
3916 .Ev MBOX .
3917 .It Ar +file
3918 Refers to a
3919 .Ar file
3920 in the
3921 .Va folder
3922 directory (if that variable is set).
3923 .It Ar %:filespec
3924 Expands to the same value as
3925 .Ar filespec ,
3926 but has special meaning when used with, e.g., the command
3927 .Ic file :
3928 the file will be treated as a primary system mailbox by, e.g., the
3929 .Ic mbox
3931 .Ic save
3932 commands, meaning that messages that have been read in the current
3933 session will be moved to the
3934 .Ev MBOX
3935 mailbox instead of simply being flagged as read.
3939 Meta expansions may be applied to the resulting filename, as allowed by
3940 the operation and applicable to the resulting access protocol (also see
3941 .Sx "On URL syntax and credential lookup" ) .
3942 For the file-protocol, a leading tilde
3943 .Ql ~
3944 character will be replaced by the expansion of
3945 .Ev HOME ,
3946 except when followed by a valid user name, in which case the home
3947 directory of the given user is used instead.
3949 A shell expansion as if specified in double-quotes (see
3950 .Sx "Shell-style argument quoting" )
3951 may be applied, so that any occurrence of
3952 .Ql $VARIABLE
3954 .Ql ${VARIABLE} )
3955 will be replaced by the expansion of the variable, if possible;
3956 .Sx "INTERNAL VARIABLES"
3957 as well as
3958 .Sx ENVIRONMENT
3959 (shell) variables can be accessed through this mechanism.
3961 Shell pathname wildcard pattern expansions
3962 .Pf ( Xr glob 7 )
3963 may be applied as documented.
3964 If the fully expanded filename results in multiple pathnames and the
3965 command is expecting only one file, an error results.
3967 In interactive context, in order to allow simple value acceptance (via
3968 .Dq ENTER ) ,
3969 arguments will usually be displayed in a properly quoted form, e.g., a file
3970 .Ql diet\e is \ecurd.txt
3971 may be displayed as
3972 .Ql 'diet\e is \ecurd.txt' .
3974 .\" }}}
3976 .\" .Ss "Commands" {{{
3977 .Ss "Commands"
3979 The following commands are available:
3981 .Bl -tag -width ".It Ic BaNg"
3985 .It Ic \&!
3986 Executes the
3987 .Ev SHELL
3988 command which follows, replacing unescaped exclamation marks with the
3989 previously executed command if the internal variable
3990 .Va bang
3991 is set.
3992 This command supports
3993 .Cm vput
3994 as documented in
3995 .Sx "Command modifiers" ,
3996 and manages the error number
3997 .Va \&! .
3998 A 0 or positive exit status
3999 .Va \&?
4000 reflects the exit status of the command, negative ones that
4001 an error happened before the command was executed, or that the program
4002 did not exit cleanly, but, e.g., due to a signal: the error number is
4003 .Va ^ERR Ns -CHILD ,
4004 then.
4007 In conjunction with the
4008 .Cm vput
4009 modifier the following special cases exist:
4010 a negative exit status occurs if the collected data could not be stored
4011 in the given variable, which is a
4012 .Va ^ERR Ns -NOTSUP
4013 error that should otherwise not occur.
4014 .Va ^ERR Ns -CANCELED
4015 indicates that no temporary file could be created to collect the command
4016 output at first glance.
4017 In case of catchable out-of-memory situations
4018 .Va ^ERR Ns -NOMEM
4019 will occur and \*(UA will try to store the empty string, just like with
4020 all other detected error conditions.
4024 .It Ic #
4025 The comment-command causes the entire line to be ignored.
4026 .Sy Note:
4027 this really is a normal command which' purpose is to discard its
4028 arguments, not a
4029 .Dq comment-start
4030 indicating special character, which means that, e.g., trailing comments
4031 on a line are not possible (except for commands which use
4032 .Sx "Shell-style argument quoting" ) .
4035 .It Ic +
4036 Goes to the next message in sequence and types it
4037 (like
4038 .Dq ENTER ) .
4041 .It Ic -
4042 Display the preceding message, or the n'th previous message if given
4043 a numeric argument n.
4046 .It Ic =
4047 Shows the message number of the current message (the
4048 .Dq dot )
4049 when used without arguments, that of the given list otherwise.
4050 Output numbers will be separated from each other with the first
4051 character of
4052 .Va ifs ,
4053 and followed by the first character of
4054 .Va if-ws ,
4055 if that is not empty and not identical to the first.
4056 If that results in no separation at all a
4057 .Cm space
4058 character is used.
4059 This command supports
4060 .Cm vput
4061 (see
4062 .Sx "Command modifiers" ) ,
4063 and manages the error number
4064 .Va \&! .
4067 .It Ic \&?
4068 \*(OP Show a brief summary of commands.
4069 \*(OP Given an argument a synopsis for the command in question is
4070 shown instead; commands can be abbreviated in general and this command
4071 can be used to see the full expansion of an abbreviation including the
4072 synopsis, try, e.g.,
4073 .Ql ?h ,
4074 .Ql ?hel
4076 .Ql ?help
4077 and see how the output changes.
4078 This mode also supports a more
4079 .Va verbose
4080 output, which will provide the information documented for
4081 .Ic list .
4084 .It Ic \&|
4085 A synonym for the
4086 .Ic pipe
4087 command.
4091 .It Ic account , unaccount
4092 (ac, una) Creates, selects or lists (an) account(s).
4093 Accounts are special incarnations of
4094 .Ic define Ns d
4095 macros and group commands and variable settings which together usually
4096 arrange the environment for the purpose of creating an email account.
4097 Different to normal macros settings which are covered by
4098 .Ic localopts
4099 \(en here by default enabled! \(en will not be reverted before the
4100 .Ic account
4101 is changed again.
4102 The special account
4103 .Ql null
4104 (case-insensitive) always exists, and all but it can be deleted by the
4105 latter command, and in one operation with the special name
4106 .Ql * .
4107 Also for all but it a possibly set
4108 .Va on-account-cleanup
4109 hook is called once they are left.
4111 Without arguments a listing of all defined accounts is shown.
4112 With one argument the given account is activated: the system
4113 .Va inbox
4114 of that account will be activated (as via
4115 .Ic file ) ,
4116 a possibly installed
4117 .Va folder-hook
4118 will be run, and the internal variable
4119 .Va account
4120 will be updated.
4121 The two argument form is identical to defining a macro as via
4122 .Ic define :
4123 .Bd -literal -offset indent
4124 account myisp {
4125   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
4126   set from='(My Name) myname@myisp.example'
4127   set mta=smtp://mylogin@smtp.myisp.example
4133 .It Ic addrcodec
4134 Perform email address codec transformations on raw-data argument, rather
4135 according to email standards (RFC 5322; \*(ID will furtherly improve).
4136 Supports
4137 .Cm vput
4138 (see
4139 .Sx "Command modifiers" ) ,
4140 and manages the error number
4141 .Va \&! .
4142 The first argument must be either
4143 .Ar [+[+[+]]]e[ncode] ,
4144 .Ar d[ecode] ,
4145 .Ar s[kin]
4147 .Ar skinl[ist]
4148 and specifies the operation to perform on the rest of the line.
4151 Decoding will show how a standard-compliant MUA will display the given
4152 argument, which should be an email address.
4153 Please be aware that most MUAs have difficulties with the address
4154 standards, and vary wildly when (comments) in parenthesis,
4155 .Dq double-quoted
4156 strings, or quoted-pairs, as below, become involved.
4157 \*(ID \*(UA currently does not perform decoding when displaying addresses.
4160 Skinning is identical to decoding but only outputs the plain address,
4161 without any string, comment etc. components.
4162 Another difference is that it may fail with the error number
4163 .Va \&!
4164 set to
4165 .Va ^ERR Ns -INVAL
4166 if decoding fails to find a(n) (valid) email address, in which case the
4167 unmodified input will be output again.
4170 .Ar skinlist
4171 first performs a skin operation, and thereafter checks a valid
4172 address for whether it is a registered mailing list (see
4173 .Ic mlist
4175 .Ic mlsubscribe ) ,
4176 eventually reporting that state in the error number
4177 .Va \&!
4179 .Va ^ERR Ns -EXIST .
4180 (This state could later become overwritten by an I/O error, though.)
4183 Encoding supports four different modes, lesser automated versions can be
4184 chosen by prefixing one, two or three plus signs: the standard imposes
4185 a special meaning on some characters, which thus have to be transformed
4186 to so-called quoted-pairs by pairing them with a reverse solidus
4187 .Ql \e
4188 in order to remove the special meaning; this might change interpretation
4189 of the entire argument from what has been desired, however!
4190 Specify one plus sign to remark that parenthesis shall be left alone,
4191 two for not turning double quotation marks into quoted-pairs, and three
4192 for also leaving any user-specified reverse solidus alone.
4193 The result will always be valid, if a successful exit status is reported
4194 (\*(ID the current parser fails this assertion for some constructs).
4195 \*(ID Addresses need to be specified in between angle brackets
4196 .Ql < ,
4197 .Ql >
4198 if the construct becomes more difficult, otherwise the current parser
4199 will fail; it is not smart enough to guess right.
4201 .Bd -literal -offset indent
4202 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
4203 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4204 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4205 "Hey, you", \e out\e there <diet@exam.ple>
4206 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4207 diet@exam.ple
4213 .It Ic alias , unalias
4214 (a, una) Aliases are a method of creating personal distribution lists
4215 that map a single alias name to none to multiple real receivers;
4216 these aliases become expanded after message composing is completed.
4217 The latter command removes the given list of aliases, the special name
4218 .Ql *
4219 will discard all existing aliases.
4221 The former command shows all currently defined aliases when used without
4222 arguments, and with one argument the expansion of the given alias.
4223 With more than one argument, creates or appends to the alias name given
4224 as the first argument the remaining arguments.
4225 Alias names adhere to the Postfix MTA
4226 .Xr aliases 5
4227 rules and are thus restricted to alphabetic characters, digits, the
4228 underscore, hyphen-minus, the number sign, colon and commercial at,
4229 a dollar sign is allowed but in the first position;
4230 As extensions the exclamation mark
4231 .Ql \&! ,
4232 period
4233 .Ql \&.
4234 as well as
4235 .Dq any haracter that has the high bit set
4236 may be used:
4237 .Ql [[:alnum:]_#:@-][[:alnum:]_#:@$;.-]* .
4239 .\" ALIASCOLON next sentence
4240 \*(ID Unfortunately the colon is currently not supported, as it
4241 interferes with normal address parsing rules.
4242 .\" ALIASCOLON next sentence
4243 \*(ID Such high bit characters will likely cause warnings at the moment
4244 for the same reasons why colon is unsupported; also, in the future
4245 locale dependent character set validity checks will be performed.
4249 .It Ic alternates , unalternates
4250 \*(NQ (alt) Manage a list of alternate addresses or names of the active
4251 user, members of which will be removed from recipient lists (except one).
4252 There is a set of implicit alternates which is formed of the values of
4253 .Ev LOGNAME ,
4254 .Va from ,
4255 .Va sender
4257 .Va reply-to .
4258 .Va from
4259 will not be used if
4260 .Va sender
4261 is set.
4262 The latter command removes the given list of alternates, the special name
4263 .Ql *
4264 will discard all existing alternate names.
4266 The former command manages the error number
4267 .Va \&! .
4268 It shows the current set of alternates when used without arguments; in
4269 this mode only it also supports
4270 .Cm vput
4271 (see
4272 .Sx "Command modifiers" ) .
4273 Otherwise the given arguments (after being checked for validity) are
4274 appended to the list of alternate names; in
4275 .Va posix
4276 mode they replace that list instead.
4280 .It Ic answered , unanswered
4281 Take a message lists and mark each message as (not) having been answered.
4282 Messages will be marked answered when being
4283 .Ic reply Ns d
4284 to automatically if the
4285 .Va markanswered
4286 variable is set.
4287 See the section
4288 .Sx "Message states" .
4293 .It Ic bind , unbind
4294 \*(OP\*(NQ The bind command extends the MLE (see
4295 .Sx "On terminal control and line editor" )
4296 with freely configurable key bindings.
4297 The latter command removes from the given context the given key binding,
4298 both of which may be specified as a wildcard
4299 .Ql * ,
4300 so that, e.g.,
4301 .Ql unbind * *
4302 will remove all bindings of all contexts.
4303 Due to initialization order unbinding will not work for built-in key
4304 bindings upon program startup, however: please use
4305 .Va line-editor-no-defaults
4306 for this purpose instead.
4309 With one argument the former command shows all key bindings for the
4310 given context, specifying an asterisk
4311 .Ql *
4312 will show the bindings of all contexts; a more verbose listing will be
4313 produced if either of
4314 .Va debug
4316 .Va verbose
4317 are set.
4318 With two or more arguments a binding is (re)established:
4319 the first argument is the context to which the binding shall apply,
4320 the second argument is a comma-separated list of the
4321 .Dq keys
4322 which form the binding, and any remaining arguments form the expansion.
4323 To indicate that a binding shall not be auto-committed, but that the
4324 expansion shall instead be furtherly editable by the user, a commercial at
4325 .Ql @
4326 (that will be removed) can be placed last in the expansion, from which
4327 leading and trailing whitespace will finally be removed.
4328 Reverse solidus cannot be used as the last character of expansion.
4331 Contexts define when a binding applies, i.e., a binding will not be seen
4332 unless the context for which it is defined for is currently active.
4333 This is not true for the shared binding
4334 .Ql base ,
4335 which is the foundation for all other bindings and as such always
4336 applies, its bindings, however, only apply secondarily.
4337 The available contexts are the shared
4338 .Ql base ,
4340 .Ql default
4341 context which is used in all not otherwise documented situations, and
4342 .Ql compose ,
4343 which applies to compose mode only.
4346 .Dq Keys
4347 which form the binding are specified as a comma-separated list of
4348 byte-sequences, where each list entry corresponds to one key(press).
4349 A list entry may, indicated by a leading colon character
4350 .Ql \&: ,
4351 also refer to the name of a terminal capability; several dozen names
4352 will be compiled in and may be specified either by their
4353 .Xr terminfo 5 ,
4354 or, if existing, by their
4355 .Xr termcap 5
4356 name, regardless of the actually used \*(OPal terminal control library.
4357 It is possible to use any capability, as long as the name is resolvable
4358 by the \*(OPal control library or was defined via the internal variable
4359 .Va termcap .
4360 Input sequences are not case-normalized, so that an exact match is
4361 required to update or remove a binding.
4362 Examples:
4364 .Bd -literal -offset indent
4365 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4366 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete
4367 ? bind default $'\ecA',:khome,w 'echo Editable binding@'
4368 ? bind default a,b,c rm -irf / @  # Also editable
4369 ? bind default :kf1 File %
4370 ? bind compose :kf1 ~v
4374 Note that the entire comma-separated list is first parsed (over) as a
4375 shell-token with whitespace as the field separator, before being parsed
4376 and expanded for real with comma as the field separator, therefore
4377 whitespace needs to be properly quoted, see
4378 .Sx "Shell-style argument quoting" .
4379 Using Unicode reverse solidus escape sequences renders a binding
4380 defunctional if the locale does not support Unicode (see
4381 .Sx "Character sets" ) ,
4382 and using terminal capabilities does so if no (corresponding) terminal
4383 control support is (currently) available.
4386 The following terminal capability names are built-in and can be used in
4387 .Xr terminfo 5
4388 or (if available) the two-letter
4389 .Xr termcap 5
4390 notation.
4391 See the respective manual for a list of capabilities.
4392 The program
4393 .Xr infocmp 1
4394 can be used to show all the capabilities of
4395 .Ev TERM
4396 or the given terminal type;
4397 using the
4398 .Fl \&\&x
4399 flag will also show supported (non-standard) extensions.
4402 .Bl -tag -compact -width kcuuf_or_kcuuf
4403 .It Cd kbs Ns \0or Cd kb
4404 Backspace.
4405 .It Cd kdch1 Ns \0or Cd kD
4406 Delete character.
4407 .It Cd kDC Ns \0or Cd *4
4408 \(em shifted variant.
4409 .It Cd kel Ns \0or Cd kE
4410 Clear to end of line.
4411 .It Cd kext Ns \0or Cd @9
4412 Exit.
4413 .It Cd kich1 Ns \0or Cd kI
4414 Insert character.
4415 .It Cd kIC Ns \0or Cd #3
4416 \(em shifted variant.
4417 .It Cd khome Ns \0or Cd kh
4418 Home.
4419 .It Cd kHOM Ns \0or Cd #2
4420 \(em shifted variant.
4421 .It Cd kend Ns \0or Cd @7
4422 End.
4423 .It Cd knp Ns \0or Cd kN
4424 Next page.
4425 .It Cd kpp Ns \0or Cd kP
4426 Previous page.
4427 .It Cd kcub1 Ns \0or Cd kl
4428 Left cursor (with more modifiers: see below).
4429 .It Cd kLFT Ns \0or Cd #4
4430 \(em shifted variant.
4431 .It Cd kcuf1 Ns \0or Cd kr
4432 Right cursor (ditto).
4433 .It Cd kRIT Ns \0or Cd %i
4434 \(em shifted variant.
4435 .It Cd kcud1 Ns \0or Cd kd
4436 Down cursor (ditto).
4437 .It Cd kDN
4438 \(em shifted variant (only terminfo).
4439 .It Cd kcuu1 Ns \0or Cd ku
4440 Up cursor (ditto).
4441 .It Cd kUP
4442 \(em shifted variant (only terminfo).
4443 .It Cd kf0 Ns \0or Cd k0
4444 Function key 0.
4445 Add one for each function key up to
4446 .Cd kf9
4448 .Cd k9 ,
4449 respectively.
4450 .It Cd kf10 Ns \0or Cd k;
4451 Function key 10.
4452 .It Cd kf11 Ns \0or Cd F1
4453 Function key 11.
4454 Add one for each function key up to
4455 .Cd kf19
4457 .Cd F9 ,
4458 respectively.
4462 Some terminals support key-modifier combination extensions, e.g.,
4463 .Ql Alt+Shift+xy .
4464 For example, the delete key,
4465 .Cd kdch1 :
4466 in its shifted variant, the name is mutated to
4467 .Cd  kDC ,
4468 then a number is appended for the states
4469 .Ql Alt
4470 .Pf ( Cd kDC3 ) ,
4471 .Ql Shift+Alt
4472 .Pf ( Cd kDC4 ) ,
4473 .Ql Control
4474 .Pf ( Cd kDC5 ) ,
4475 .Ql Shift+Control
4476 .Pf ( Cd kDC6 ) ,
4477 .Ql Alt+Control
4478 .Pf ( Cd kDC7 ) ,
4479 finally
4480 .Ql Shift+Alt+Control
4481 .Pf ( Cd kDC8 ) .
4482 The same for the left cursor key,
4483 .Cd kcub1 :
4484 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4487 It is advisable to use an initial escape or other control character (e.g.,
4488 .Ql \ecA )
4489 for bindings which describe user key combinations (as opposed to purely
4490 terminal capability based ones), in order to avoid ambiguities whether
4491 input belongs to key sequences or not; it also reduces search time.
4492 Adjusting
4493 .Va bind-timeout
4494 may help shall keys and sequences be falsely recognized.
4498 .It Ic call
4499 \*(NQ Calls the given macro, which must have been created via
4500 .Ic define
4501 (see there for more), otherwise an
4502 .Va ^ERR Ns -NOENT
4503 error occurs.
4504 Calling macros recursively will at some time excess the stack size
4505 limit, causing a hard program abortion; if recursively calling a macro
4506 is the last command of the current macro, consider to use the command
4507 .Ic xcall ,
4508 which will first release all resources of the current macro before
4509 replacing the current macro with the called one.
4513 .It Ic call_if
4514 Identical to
4515 .Ic call
4516 if the given macro has been created via
4517 .Ic define ,
4518 but does not fail nor warn if the macro does not exist.
4521 .It Ic cd
4522 (ch) Change the working directory to
4523 .Ev HOME
4524 or the given argument.
4525 Synonym for
4526 .Ic chdir .
4529 .It Ic certsave
4530 \*(OP Only applicable to S/MIME signed messages.
4531 Takes an optional message list and a filename and saves the certificates
4532 contained within the message signatures to the named file in both
4533 human-readable and PEM format.
4534 The certificates can later be used to send encrypted messages to the
4535 respective message senders by setting
4536 .Va smime-encrypt-USER@HOST
4537 variables.
4541 .It Ic charsetalias , uncharsetalias
4542 \*(NQ Manage alias mappings for (conversion of)
4543 .Sx "Character sets" .
4544 Mappings are ineffective if character set conversion is not available
4545 .Pf ( Va features
4546 does not announce
4547 .Ql +iconv ) .
4548 Expansion happens recursively, but expansion is not performed for
4549 .Sx "INTERNAL VARIABLES" ,
4550 e.g.,
4551 .Va charset-8bit .
4553 The latter command deletes all aliases given as arguments,
4554 all aliases can be deleted at once with the special argument
4555 .Ql * .
4556 The former shows the list of all currently defined aliases if used
4557 without arguments, the expansion of the given alias with one argument.
4558 Otherwise all given arguments are treated as pairs of character sets and
4559 their desired target alias name, creating new or changing already
4560 existing aliases, as necessary.
4563 .It Ic chdir
4564 (ch) Change the working directory to
4565 .Ev HOME
4566 or the given argument.
4567 Synonym for
4568 .Ic cd .
4572 .It Ic collapse , uncollapse
4573 Only applicable to
4574 .Ql thread Ns
4576 .Ic sort
4577 mode.
4578 Takes a message list and makes all replies to these messages invisible
4579 in header summaries, except for
4580 .Ql new
4581 messages and the
4582 .Dq dot .
4583 Also when a message with collapsed replies is displayed,
4584 all of these are automatically uncollapsed.
4585 The latter command undoes collapsing.
4588 .\" FIXME review until this point
4591 .It Ic colour , uncolour
4592 \*(OP\*(NQ Manage colour mappings of and for a
4593 .Sx "Coloured display" .
4594 The type of colour is given as the (case-insensitive) first argument,
4595 which must be one of
4596 .Ql 256
4597 for 256-colour terminals,
4598 .Ql 8 ,
4599 .Ql ansi
4601 .Ql iso
4602 for the standard 8-colour ANSI / ISO 6429 colour palette and
4603 .Ql 1
4605 .Ql mono
4606 for monochrome terminals.
4607 Monochrome terminals cannot deal with colours, but only (some) font
4608 attributes.
4611 Without further arguments the list of all currently defined mappings
4612 for the given colour type is shown (as a special case giving
4613 .Ql all
4615 .Ql *
4616 will show the mappings of all types).
4617 Otherwise the second argument defines the mappable slot, and the third
4618 argument a (comma-separated list of) colour and font attribute
4619 specification(s), and the optional fourth argument can be used to
4620 specify a precondition: if conditioned mappings exist they are tested in
4621 (creation) order unless a (case-insensitive) match has been found, and
4622 the default mapping (if any has been established) will only be chosen as
4623 a last resort.
4624 The types of precondition available depend on the mappable slot (see
4625 .Sx "Coloured display"
4626 for some examples), the following of which exist:
4629 Mappings prefixed with
4630 .Ql mle-
4631 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4632 .Sx "On terminal control and line editor" )
4633 and do not support preconditions.
4635 .Bl -tag -compact -width view-partinfo
4636 .It Ar mle-position
4637 This mapping is used for the position indicator that is visible when
4638 a line cannot be fully displayed on the screen.
4639 .It Ar mle-prompt
4640 Used for the
4641 .Va prompt .
4645 Mappings prefixed with
4646 .Ql sum-
4647 are used in header summaries, and they all understand the preconditions
4648 .Ql dot
4649 (the current message) and
4650 .Ql older
4651 for elder messages (only honoured in conjunction with
4652 .Va datefield-markout-older ) .
4654 .Bl -tag -compact -width view-partinfo
4655 .It Ar sum-dotmark
4656 This mapping is used for the
4657 .Dq dotmark
4658 that can be created with the
4659 .Ql %>
4661 .Ql %<
4662 formats of the variable
4663 .Va headline .
4664 .It Ar sum-header
4665 For the complete header summary line except the
4666 .Dq dotmark
4667 and the thread structure.
4668 .It Ar sum-thread
4669 For the thread structure which can be created with the
4670 .Ql %i
4671 format of the variable
4672 .Va headline .
4676 Mappings prefixed with
4677 .Ql view-
4678 are used when displaying messages.
4680 .Bl -tag -compact -width view-partinfo
4681 .It Ar view-from_
4682 This mapping is used for so-called
4683 .Ql From_
4684 lines, which are MBOX file format specific header lines.
4685 .It Ar view-header
4686 For header lines.
4687 A comma-separated list of headers to which the mapping applies may be
4688 given as a precondition; if the \*(OPal regular expression support is
4689 available then if any of the
4690 .Dq magical
4691 (extended) regular expression characters is seen the precondition will
4692 be evaluated as (an extended) one.
4693 .It Ar view-msginfo
4694 For the introductional message info line.
4695 .It Ar view-partinfo
4696 For MIME part info lines.
4700 The following (case-insensitive) colour definitions and font attributes
4701 are understood, multiple of which can be specified in a comma-separated
4702 list:
4704 .Bl -tag -width ft=
4705 .It Ar ft=
4706 a font attribute:
4707 .Ql bold ,
4708 .Ql reverse
4710 .Ql underline .
4711 It is possible (and often applicable) to specify multiple font
4712 attributes for a single mapping.
4714 .It Ar fg=
4715 foreground colour attribute:
4716 .Ql black ,
4717 .Ql blue ,
4718 .Ql green ,
4719 .Ql red ,
4720 .Ql brown ,
4721 .Ql magenta ,
4722 .Ql cyan
4724 .Ql white .
4725 To specify a 256-colour mode a decimal number colour specification in
4726 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4728 .Bl -tag -compact -width "999 - 999"
4729 .It 0 - 7
4730 the standard ISO 6429 colours, as above.
4731 .It 8 - 15
4732 high intensity variants of the standard colours.
4733 .It 16 - 231
4734 216 colours in tuples of 6.
4735 .It 232 - 255
4736 grayscale from black to white in 24 steps.
4738 .Bd -literal -offset indent
4739 #!/bin/sh -
4740 fg() { printf "\e033[38;5;${1}m($1)"; }
4741 bg() { printf "\e033[48;5;${1}m($1)"; }
4743 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4744 printf "\e033[0m\en"
4746 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4747 printf "\e033[0m\en"
4750 .It Ar bg=
4751 background colour attribute (see
4752 .Cd fg=
4753 for possible values).
4757 The command
4758 .Ic \&uncolour
4759 will remove for the given colour type (the special type
4760 .Ql *
4761 selects all) the given mapping; if the optional precondition argument is
4762 given only the exact tuple of mapping and precondition is removed.
4763 The special name
4764 .Ql *
4765 will remove all mappings (no precondition allowed), thus
4766 .Ql uncolour * *
4767 will remove all established mappings.
4772 .It Ic commandalias , uncommandalias
4773 \*(NQ Define or list, and remove, respectively, command aliases.
4774 An (command)alias can be used everywhere a normal command can be used,
4775 but always takes precedence: any arguments that are given to the command
4776 alias are joined onto the alias expansion, and the resulting string
4777 forms the command line that is, in effect, executed.
4778 The latter command removes all given aliases, the special name
4779 .Ql *
4780 will remove all existing aliases.
4781 When used without arguments the former shows a list of all currently
4782 known aliases, with one argument only the expansion of the given one.
4784 With two or more arguments a command alias is defined or updated: the
4785 first argument is the name under which the remaining command line should
4786 be accessible, the content of which can be just about anything.
4787 An alias may itself expand to another alias, but to avoid expansion loops
4788 further expansion will be prevented if an alias refers to itself or if
4789 an expansion depth limit is reached.
4790 Explicit expansion prevention is available via reverse solidus
4791 .Cm \e ,
4792 one of the
4793 .Sx "Command modifiers" .
4794 .Bd -literal -offset indent
4795 ? commandalias xx
4796 \*(uA: `commandalias': no such alias: xx
4797 ? commandalias xx echo hello,
4798 ? commandalias xx
4799 commandalias xx 'echo hello,'
4800 ? xx
4801 hello,
4802 ? xx world
4803 hello, world
4807 .It Ic Copy
4808 (C) Copy messages to files whose names are derived from the author of
4809 the respective message and do not mark them as being saved;
4810 otherwise identical to
4811 .Ic Save .
4814 .It Ic copy
4815 (c) Copy messages to the named file and do not mark them as being saved;
4816 otherwise identical to
4817 .Ic save .
4820 .It Ic cwd
4821 Show the name of the current working directory, as reported by
4822 .Xr getcwd 3 .
4823 Supports
4824 .Cm vput
4825 (see
4826 .Sx "Command modifiers" ) .
4827 The return status is tracked via
4828 .Va \&? .
4831 .It Ic Decrypt
4832 \*(OP For unencrypted messages this command is identical to
4833 .Ic Copy ;
4834 Encrypted messages are first decrypted, if possible, and then copied.
4837 .It Ic decrypt
4838 \*(OP For unencrypted messages this command is identical to
4839 .Ic copy ;
4840 Encrypted messages are first decrypted, if possible, and then copied.
4845 .It Ic define , undefine
4846 The latter command deletes the given macro, the special name
4847 .Ql *
4848 will discard all existing macros.
4849 Deletion of (a) macro(s) can be performed from within running (a)
4850 macro(s), including self-deletion.
4851 Without arguments the former command prints the current list of macros,
4852 including their content, otherwise it defines a macro, replacing an
4853 existing one of the same name as applicable.
4856 A defined macro can be invoked explicitly by using the
4857 .Ic call ,
4858 .Ic call_if
4860 .Ic xcall
4861 commands, or implicitly if a macro hook is triggered, e.g., a
4862 .Va folder-hook .
4863 Execution of a macro body can be stopped from within by calling
4864 .Ic return .
4867 Temporary macro block-scope variables can be created or deleted with the
4868 .Cm local
4869 command modifier in conjunction with the commands
4870 .Ic set
4872 .Ic unset ,
4873 respectively.
4874 To enforce unrolling of changes made to (global)
4875 .Sx "INTERNAL VARIABLES"
4876 the command
4877 .Ic localopts
4878 can be used instead; its covered scope depends on how (i.e.,
4879 .Dq as what :
4880 normal macro, folder hook, hook,
4881 .Ic account
4882 switch) the macro is invoked.
4885 Inside a
4886 .Ic call Ns
4887 ed macro, the given positional parameters are implicitly local
4888 to the macro's scope, and may be accessed via the variables
4889 .Va * ,
4890 .Va @ ,
4891 .Va #
4893 .Va 1
4894 and any other positive unsigned decimal number less than or equal to
4895 .Va # .
4896 Positional parameters can be
4897 .Ic shift Ns
4898 ed, or become completely replaced, removed etc. via
4899 .Ic vpospar .
4900 A helpful command to perform many sorts of number and string evaluations is
4901 .Ic vexpr .
4903 .Bd -literal -offset indent
4904 define name {
4905   command1
4906   command2
4907   ...
4908   commandN
4911 # E.g.
4912 define exmac {
4913   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4914   return 1000 0
4916 call exmac Hello macro exmac!
4917 echo ${?}/${!}/${^ERRNAME}
4923 .It Ic delete , undelete
4924 (d, u) Marks the given message list as being or not being
4925 .Ql deleted ,
4926 respectively; if no argument has been specified then the usual search
4927 for a visible message is performed, as documented for
4928 .Sx "Message list arguments" ,
4929 showing only the next input prompt if the search fails.
4930 Deleted messages will neither be saved in the
4931 .Mx -sx
4932 .Sx "secondary mailbox"
4933 .Ev MBOX
4934 nor will they be available for most other commands.
4935 If the
4936 .Va autoprint
4937 variable is set, the new
4938 .Dq dot
4939 or the last message restored, respectively, is automatically
4940 .Ic type Ns
4941 d; also see
4942 .Ic dp ,
4943 .Ic dt .
4947 .It Ic digmsg
4948 \*(NQ Digging (information out of) messages is possible through
4949 .Ic \&\&digmsg
4950 objects, which can be
4951 .Cm create Ns
4952 d for the given message number; in compose mode the hyphen-minus
4953 .Ql -
4954 will instead open the message that is being composed.
4955 If a hyphen-minus is given as the optional third argument then output
4956 will be generated on the standard output channel instead of being
4957 subject to consumation by the
4958 .Ic read
4960 .Ic readall
4961 commands.
4963 The objects may be
4964 .Cm remove Ns
4965 d again by giving the same identifier used for creation;
4966 this step could be omitted: objects will be automatically closed
4967 when the active mailbox or the compose mode is left, respectively.
4968 In all other cases the second argument is an object identifier,
4969 and the third and all following arguments are interpreted as via
4970 .Ic ~^
4971 (see
4972 .Sx "COMMAND ESCAPES" ) :
4973 .Bd -literal -offset indent
4974 ? vput = msgno; digmsg create $msgno
4975 ? digmsg $msgno header list;   readall x;   echon $x
4976 210 Subject From To Message-ID References In-Reply-To Status
4977 ? digmsg $msgno header show Status;readall x;echon $x
4978 212 Status
4981 ? digmsg remove $msgno
4986 .It Ic discard
4987 (di) Identical to
4988 .Ic ignore .
4989 Superseded by the multiplexer
4990 .Ic headerpick .
4994 .It Ic dp , dt
4995 Delete the given messages and automatically
4996 .Ic type
4997 the new
4998 .Dq dot
4999 if one exists, regardless of the setting of
5000 .Va autoprint .
5003 .It Ic dotmove
5004 Move the
5005 .Dq dot
5006 up or down by one message when given
5007 .Ql +
5009 .Ql -
5010 argument, respectively.
5014 .It Ic draft , undraft
5015 Take message lists and mark each given message as being draft, or not
5016 being draft, respectively, as documented in the section
5017 .Sx "Message states" .
5020 .It Ic echo
5021 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
5022 newline, whereas the otherwise identical
5023 .Ic echon
5024 does not.
5025 .Sx "Shell-style argument quoting"
5026 is used,
5027 .Sx "Filename transformations"
5028 are applied to the expanded arguments.
5029 This command also supports
5030 .Cm vput
5031 as documented in
5032 .Sx "Command modifiers" ,
5033 and manages the error number
5034 .Va \&! :
5035 if data is stored in a variable then the return value reflects the
5036 length of the result string in case of success and is
5037 .Ql -1
5038 on error.
5041 .It Ic echoerr
5042 \*(NQ Identical to
5043 .Ic echo
5044 except that is echoes to standard error.
5045 Also see
5046 .Ic echoerrn .
5047 In interactive sessions the \*(OPal message ring queue for
5048 .Ic errors
5049 will be used instead, if available and
5050 .Cm vput
5051 was not used.
5054 .It Ic echon
5055 \*(NQ Identical to
5056 .Ic echo ,
5057 but does not write or store a trailing newline.
5060 .It Ic echoerrn
5061 \*(NQ Identical to
5062 .Ic echoerr ,
5063 but does not write or store a trailing newline.
5066 .It Ic edit
5067 (e) Point the text
5068 .Ev EDITOR
5069 at each message from the given list in turn.
5070 Modified contents are discarded unless the
5071 .Va writebackedited
5072 variable is set, and are not used unless the mailbox can be written to
5073 and the editor returns a successful exit status.
5074 .Ic visual
5075 can be used instead for a more display oriented editor.
5078 .It Ic elif
5079 Part of the
5080 .Ic if
5081 (see there for more),
5082 .Ic elif , else , endif
5083 conditional \(em if the condition of a preceding
5084 .Ic if
5085 was false, check the following condition and execute the following block
5086 if it evaluates true.
5089 .It Ic else
5090 (el) Part of the
5091 .Ic if
5092 (see there for more),
5093 .Ic elif , else , endif
5094 conditional \(em if none of the conditions of the preceding
5095 .Ic if
5097 .Ic elif
5098 commands was true, the
5099 .Ic else
5100 block is executed.
5103 .It Ic endif
5104 (en) Marks the end of an
5105 .Ic if
5106 (see there for more),
5107 .Ic elif , else , endif
5108 conditional execution block.
5112 .It Ic environ
5113 \*(NQ \*(UA has a strict notion about which variables are
5114 .Sx "INTERNAL VARIABLES"
5115 and which are managed in the program
5116 .Sx ENVIRONMENT .
5117 Since some of the latter are a vivid part of \*(UAs functioning,
5118 however, they are transparently integrated into the normal handling of
5119 internal variables via
5120 .Ic set
5122 .Ic unset .
5123 To integrate other environment variables of choice into this
5124 transparent handling, and also to export internal variables into the
5125 process environment where they normally are not, a
5126 .Ql link
5127 needs to become established with this command, as in, e.g.,
5130 .Dl environ link PERL5LIB TZ
5133 Afterwards changing such variables with
5134 .Ic set
5135 will cause automatic updates of the program environment, and therefore
5136 be inherited by newly created child processes.
5137 Sufficient system support provided (it was in BSD as early as 1987, and
5138 is standardized since Y2K) removing such variables with
5139 .Ic unset
5140 will remove them also from the program environment, but in any way
5141 the knowledge they ever have been
5142 .Ql link Ns
5143 ed will be lost.
5144 Note that this implies that
5145 .Ic localopts
5146 may cause loss of such links.
5149 The command
5150 .Ql unlink
5151 will remove an existing link, but leaves the variables as such intact.
5152 Additionally the subcommands
5153 .Ql set
5155 .Ql unset
5156 are provided, which work exactly the same as the documented commands
5157 .Ic set
5159 .Ic unset ,
5160 but (additionally un)link the variable(s) with the program environment
5161 and thus immediately export them to, or remove them from (if possible),
5162 respectively, the program environment.
5166 .It Ic errors
5167 \*(OP Since \*(UA uses the console as a user interface it can happen
5168 that messages scroll by too fast to become recognized.
5169 An error message ring queue is available which stores duplicates of any
5170 error message and notifies the user in interactive sessions whenever
5171 a new error has occurred.
5172 The queue is finite: if its maximum size is reached any new message
5173 replaces the eldest.
5174 The command
5175 .Ic errors
5176 can be used to manage this message queue: if given
5177 .Ar show
5178 or no argument the queue will be displayed and cleared,
5179 .Ar clear
5180 will only clear all messages from the queue.
5183 .It Ic eval
5184 \*(NQ Construct a command by concatenating the arguments, separated with
5185 a single space character, and then evaluate the result.
5186 This command passes through the exit status
5187 .Va \&?
5188 and error number
5189 .Va \&!
5190 of the evaluated command; also see
5191 .Ic call .
5192 .Bd -literal -offset indent
5193 define xxx {
5194   echo "xxx arg <$1>"
5195   shift
5196   if [ $# -gt 0 ]
5197     \excall xxx "$@"
5198   endif
5200 define yyy {
5201   eval "$@ ' ball"
5203 call yyy '\ecall xxx' "b\e$'\et'u ' "
5204 call xxx arg <b      u>
5205 call xxx arg <  >
5206 call xxx arg <ball>
5210 .It Ic exit
5211 (ex or x) Exit from \*(UA without changing the active mailbox and skip
5212 any saving of messages in the
5213 .Mx -sx
5214 .Sx "secondary mailbox"
5215 .Ev MBOX ,
5216 as well as a possibly tracked line editor
5217 .Va history-file .
5218 The optional status number argument will be passed through to
5219 .Xr exit 3 .
5220 \*(ID For now it can happen that the given status will be overwritten,
5221 later this will only occur if a later error needs to be reported onto an
5222 otherwise success indicating status.
5225 .It Ic File
5226 (Fi) Like
5227 .Ic file ,
5228 but open the mailbox read-only.
5232 .It Ic file
5233 (fi) The file command switches to a new mailbox.
5234 Without arguments it shows status information of the current mailbox.
5235 If an argument is given, it will write out changes (such as deletions)
5236 the user has made, open a new mailbox, update the internal variables
5237 .Va mailbox-resolved
5239 .Va mailbox-display ,
5240 execute an according
5241 .Va folder-hook ,
5242 if one is installed, and optionally display a summary of
5243 .Ic headers
5244 if the variable
5245 .Va header
5246 is set.
5249 .Sx "Filename transformations"
5250 will be applied to the
5251 .Ar name
5252 argument, and
5253 .Ql protocol://
5254 prefixes are, i.e., URL syntax is understood, e.g.,
5255 .Ql mbox:///tmp/mdirbox :
5256 if a protocol prefix is used the mailbox type is fixated and neither
5257 the auto-detection (read on) nor the
5258 .Va newfolders
5259 mechanisms apply.
5260 \*(OPally URLs can also be used to access network resources, which may
5261 be accessed securely via
5262 .Sx "Encrypted network communication"
5263 if so supported, and it is possible to proxy all network traffic over
5264 a SOCKS5 server given via
5265 .Va socks-proxy .
5268 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
5269 .Dl \*(OU protocol://[user@]host[:port][/path]
5272 \*(OPally supported network protocols are
5273 .Ar pop3
5274 (POP3) and
5275 .Ar pop3s
5276 (POP3 with TLS encrypted transport),
5277 .Ar imap
5279 .Ar imaps .
5281 .Ar [/path]
5282 part is valid only for IMAP; there it defaults to
5283 .Ar INBOX .
5284 Network URLs require a special encoding as documented in the section
5285 .Sx "On URL syntax and credential lookup" .
5288 If the resulting file protocol (MBOX database)
5289 .Ar name
5290 is located on a local filesystem then the list of all registered
5291 .Ic filetype Ns
5292 s is traversed in order to see whether a transparent intermediate
5293 conversion step is necessary to handle the given mailbox, in which case
5294 \*(UA will use the found hook to load and save data into and from
5295 a temporary file, respectively.
5296 Changing hooks will not affect already opened mailboxes.
5297 For example, the following creates hooks for the
5298 .Xr gzip 1
5299 compression tool and a combined compressed and encrypted format:
5301 .Bd -literal -offset indent
5302 ? filetype \e
5303     gzip 'gzip -dc' 'gzip -c' \e
5304     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5308 MBOX databases will always be protected via file-region locks
5309 .Pf ( Xr fcntl 2 )
5310 during file operations in order to avoid inconsistencies due to
5311 concurrent modifications.
5312 .Mx -ix "dotlock files"
5313 \*(OP In addition mailbox files treated as the system
5314 .Va inbox
5315 .Pf ( Ev MAIL ) ,
5316 as well as
5317 .Mx -sx
5318 .Sx "primary system mailbox" Ns
5319 es in general will also be protected by so-called dotlock files,
5320 the traditional way of mail spool file locking: for any file
5321 .Ql x
5322 a lock file
5323 .Ql x.lock
5324 will be created for the duration of the synchronization \(em
5325 as necessary an external privileged dotlock helper will be used
5326 to create the dotlock file in the same directory and with the same user
5327 and group identities as the file of interest.
5328 .Va dotlock-disable
5329 can be used to turn off additional dotlock files, shall the need arise.
5332 \*(UA by default uses tolerant POSIX rules when reading MBOX database
5333 files, but it will detect invalid message boundaries in this mode and
5334 complain (even more with
5335 .Va debug )
5336 if any is seen: in this case
5337 .Va mbox-rfc4155
5338 can be used to create a valid MBOX database from the invalid input.
5341 \*(OP If no protocol has been fixated, and
5342 .Ar name
5343 refers to a directory with the subdirectories
5344 .Ql tmp ,
5345 .Ql new
5347 .Ql cur ,
5348 then it is treated as a folder in
5349 .Dq Maildir
5350 format.
5351 The maildir format stores each message in its own file, and has been
5352 designed so that file locking is not necessary when reading or writing
5353 files.
5356 \*(ID If no protocol has been fixated and no existing file has
5357 been found, the variable
5358 .Va newfolders
5359 controls the format of mailboxes yet to be created.
5364 .It Ic filetype , unfiletype
5365 \*(NQ Define or list, and remove, respectively, file handler hooks,
5366 which provide (shell) commands that enable \*(UA to load and save MBOX
5367 files from and to files with the registered file extensions;
5368 it will use an intermediate temporary file to store the plain data.
5369 The latter command removes the hooks for all given extensions,
5370 .Ql *
5371 will remove all existing handlers.
5373 When used without arguments the former shows a list of all currently
5374 defined file hooks, with one argument the expansion of the given alias.
5375 Otherwise three arguments are expected, the first specifying the file
5376 extension for which the hook is meant, and the second and third defining
5377 the load- and save commands, respectively, to deal with the file type,
5378 both of which must read from standard input and write to standard
5379 output.
5380 Changing hooks will not affect already opened mailboxes (\*(ID except below).
5381 \*(ID For now too much work is done, and files are oftened read in twice
5382 where once would be sufficient: this can cause problems if a filetype is
5383 changed while such a file is opened; this was already so with the
5384 built-in support of .gz etc. in Heirloom, and will vanish in v15.
5385 \*(ID For now all handler strings are passed to the
5386 .Ev SHELL for evaluation purposes; in the future a
5387 .Ql \&!
5388 prefix to load and save commands may mean to bypass this shell instance:
5389 placing a leading space will avoid any possible misinterpretations.
5390 .Bd -literal -offset indent
5391 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
5392     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
5393     zst 'zstd -dc' 'zstd -19 -zc' \e
5394     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5395 ? set record=+sent.zst.pgp
5400 .It Ic flag , unflag
5401 Take message lists and mark the messages as being flagged, or not being
5402 flagged, respectively, for urgent/special attention.
5403 See the section
5404 .Sx "Message states" .
5407 .It Ic folder
5408 (fold) The same as
5409 .Ic file .
5412 .It Ic folders
5413 With no arguments, list the names of the folders in the folder directory.
5414 With an existing folder as an argument,
5415 lists the names of folders below the named folder.
5418 .It Ic Followup
5419 (F) Similar to
5420 .Ic Respond ,
5421 but saves the message in a file named after the local part of the first
5422 recipient's address (instead of in
5423 .Va record Ns ).
5426 .It Ic followup
5427 (fo) Similar to
5428 .Ic respond ,
5429 but saves the message in a file named after the local part of the first
5430 recipient's address (instead of in
5431 .Va record Ns ).
5434 .It Ic followupall
5435 Similar to
5436 .Ic followup ,
5437 but responds to all recipients regardless of the
5438 .Va flipr
5439 variable.
5442 .It Ic followupsender
5443 Similar to
5444 .Ic Followup ,
5445 but responds to the sender only regardless of the
5446 .Va flipr
5447 variable.
5450 .It Ic Forward
5451 Similar to
5452 .Ic forward ,
5453 but saves the message in a file named after the local part of the
5454 recipient's address (instead of in
5455 .Va record Ns ).
5458 .It Ic forward
5459 Takes a message and the address of a recipient
5460 and forwards the message to him.
5461 The text of the original message is included in the new one,
5462 with the value of the
5463 .Va forward-inject-head
5464 variable preceding, and the value of
5465 .Va forward-inject-tail
5466 succeeding it.
5467 To filter the included header fields to the desired subset use the
5468 .Ql forward
5469 slot of the white- and blacklisting command
5470 .Ic headerpick .
5471 Only the first part of a multipart message is included unless
5472 .Va forward-as-attachment ,
5473 and recipient addresses will be stripped from comments, names
5474 etc. unless the internal variable
5475 .Va fullnames
5476 is set.
5478 This may generate the errors
5479 .Va ^ERR Ns -DESTADDRREQ
5480 if no receiver has been specified,
5481 .Va ^ERR Ns -PERM
5482 if some addressees where rejected by
5483 .Va expandaddr ,
5484 .Va ^ERR Ns -NODATA
5485 if no applicable messages have been given,
5486 .Va ^ERR Ns -NOTSUP
5487 if multiple messages have been specified,
5488 .Va ^ERR Ns -IO
5489 if an I/O error occurs,
5490 .Va ^ERR Ns -NOTSUP
5491 if a necessary character set conversion fails, and
5492 .Va ^ERR Ns -INVAL
5493 for other errors.
5496 .It Ic from
5497 (f) Takes a list of message specifications and displays a summary of
5498 their message headers, exactly as via
5499 .Ic headers ,
5500 making the first message of the result the new
5501 .Dq dot
5502 (the last message if
5503 .Va showlast
5504 is set).
5505 An alias of this command is
5506 .Ic search .
5507 Also see
5508 .Sx "Specifying messages" .
5510 .It Ic Fwd
5511 \*(OB Alias for
5512 .Ic Forward .
5514 .It Ic fwd
5515 \*(OB Alias for
5516 .Ic forward .
5518 .It Ic fwdignore
5519 \*(OB Superseded by the multiplexer
5520 .Ic headerpick .
5522 .It Ic fwdretain
5523 \*(OB Superseded by the multiplexer
5524 .Ic headerpick .
5526 .It Ic ghost , unghost
5527 \*(OB Replaced by
5528 .Ic commandalias ,
5529 .Ic uncommandalias .
5533 .It Ic headerpick , unheaderpick
5534 \*(NQ Multiplexer command to manage white- and blacklisting
5535 selections of header fields for a variety of applications.
5536 Without arguments the set of contexts that have settings is displayed.
5537 When given arguments, the first argument is the context to which the
5538 command applies, one of (case-insensitive)
5539 .Ql type
5540 for display purposes (via, e.g.,
5541 .Ic type ) ,
5542 .Ql save
5543 for selecting which headers shall be stored persistently when
5544 .Ic save ,
5545 .Ic copy ,
5546 .Ic move
5547 or even
5548 .Ic decrypt Ns
5549 ing messages (note that MIME related etc. header fields should not be
5550 ignored in order to not destroy usability of the message in this case),
5551 .Ql forward
5552 for stripping down messages when
5553 .Ic forward Ns
5554 ing message (has no effect if
5555 .Va forward-as-attachment
5556 is set), and
5557 .Ql top
5558 for defining user-defined set of fields for the command
5559 .Ic top .
5561 The current settings of the given context are displayed if it is the
5562 only argument.
5563 A second argument denotes the type of restriction that is to be chosen,
5564 it may be (a case-insensitive prefix of)
5565 .Ql retain
5567 .Ql ignore
5568 for white- and blacklisting purposes, respectively.
5569 Establishing a whitelist suppresses inspection of the corresponding
5570 blacklist.
5572 If no further argument is given the current settings of the given type
5573 will be displayed, otherwise the remaining arguments specify header
5574 fields, which \*(OPally may be given as regular expressions, to be added
5575 to the given type.
5576 The special wildcard field (asterisk,
5577 .Ql * )
5578 will establish a (fast) shorthand setting which covers all fields.
5580 The latter command always takes three or more arguments and can be used
5581 to remove selections, i.e., from the given context, the given type of
5582 list, all the given headers will be removed, the special argument
5583 .Ql *
5584 will remove all headers.
5587 .It Ic headers
5588 (h) Show the current group of headers, the size of which depends on
5589 the variable
5590 .Va screen
5591 in interactive mode, and the format of which can be defined with
5592 .Va headline .
5593 If a message-specification is given the group of headers containing the
5594 first message therein is shown and the message at the top of the screen
5595 becomes the new
5596 .Dq dot ;
5597 the last message is targeted if
5598 .Va showlast
5599 is set.
5602 .It Ic help
5603 (hel) A synonym for
5604 .Ic \&? .
5607 .It Ic history
5608 \*(OP Without arguments or when given
5609 .Cm show
5610 all history entries are shown (this mode also supports a more
5611 .Va verbose
5612 output).
5613 .Cm load
5614 will replace the list of entries with the content of
5615 .Va history-file ,
5617 .Cm save
5618 will dump the current list to said file, replacing former content.
5619 .Cm clear
5620 will delete all history entries.
5621 The argument can also be a signed decimal
5622 .Ar NUMBER ,
5623 which will select and evaluate the respective history entry, and move it
5624 to the top of the history; a negative number is used as an offset to the
5625 current command, e.g.,
5626 .Ql -1
5627 will select the last command, the history top.
5628 Please see
5629 .Sx "On terminal control and line editor"
5630 for more on this topic.
5633 .It Ic hold
5634 (ho, also
5635 .Ic preserve )
5636 Takes a message list and marks each message therein to be saved in the
5637 user's system
5638 .Va inbox
5639 instead of in the
5640 .Mx -sx
5641 .Sx "secondary mailbox"
5642 .Ev MBOX .
5643 Does not override the
5644 .Ic delete
5645 command.
5646 \*(UA deviates from the POSIX standard with this command, because a
5647 .Ic next
5648 command issued after
5649 .Ic hold
5650 will display the following message, not the current one.
5654 .It Ic if
5655 (i) Part of the
5656 .Ic \&\&if , Ic elif , else , endif
5657 conditional execution construct \(em if the given condition is true then
5658 the encapsulated block is executed.
5659 The POSIX standard only supports the (case-insensitive) conditions
5660 .Ql r Ns
5661 eceive
5663 .Ql s Ns
5664 end, the remaining are non-portable extensions.
5665 \*(ID These commands do not yet use
5666 .Sx "Shell-style argument quoting"
5667 and therefore do not know about input tokens, so that syntax
5668 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5669 all conditions bracket group wise and consider the tokens, representing
5670 values and operators, therein, which also means that variables will
5671 already have been expanded at that time (just like in the shell).
5673 .Bd -literal -offset indent
5674 if receive
5675   commands ...
5676 else
5677   commands ...
5678 endif
5682 The (case-insensitive) condition
5683 .Ql t Ns
5684 erminal will evaluate to true if the standard input is a terminal, i.e.,
5685 in interactive sessions.
5686 Another condition can be any boolean value (see the section
5687 .Sx "INTERNAL VARIABLES"
5688 for textual boolean representations) to mark an enwrapped block as
5689 .Dq never execute
5691 .Dq always execute .
5692 (It shall be remarked that a faulty condition skips all branches until
5693 .Ic endif . )
5696 (\*(ID In v15
5697 .Sx "Shell-style argument quoting"
5698 will be used, and this command will simply interpret expanded tokens.)
5699 It is possible to check
5700 .Sx "INTERNAL VARIABLES"
5701 as well as
5702 .Sx ENVIRONMENT
5703 variables for existence or compare their expansion against a user given
5704 value or another variable by using the
5705 .Ql $
5706 .Pf ( Dq variable next )
5707 conditional trigger character;
5708 a variable on the right hand side may be signalled using the same
5709 mechanism.
5710 Variable names may be enclosed in a pair of matching braces.
5711 When this mode has been triggered, several operators are available:
5714 Integer operators treat the arguments on the left and right hand side of
5715 the operator as integral numbers and compare them arithmetically.
5716 It is an error if any of the operands is not a valid integer, an empty
5717 argument (which implies it had been quoted) is treated as if it were 0.
5718 Available operators are
5719 .Ql -lt
5720 (less than),
5721 .Ql -le
5722 (less than or equal to),
5723 .Ql -eq
5724 (equal),
5725 .Ql -ne
5726 (not equal),
5727 .Ql -ge
5728 (greater than or equal to), and
5729 .Ql -gt
5730 (greater than).
5733 String data operators compare the left and right hand side according to
5734 their textual content.
5735 Unset variables are treated as the empty string.
5736 The behaviour of string operators can be adjusted by prefixing the
5737 operator with the modifier trigger commercial at
5738 .Ql @ ,
5739 followed by none to multiple modifiers: for now supported is
5740 .Ql i ,
5741 which turns the comparison into a case-insensitive one: this is
5742 implied if no modifier follows the trigger.
5745 Available string operators are
5746 .Ql <
5747 (less than),
5748 .Ql <=
5749 (less than or equal to),
5750 .Ql ==
5751 (equal),
5752 .Ql !=
5753 (not equal),
5754 .Ql >=
5755 (greater than or equal to),
5756 .Ql >
5757 (greater than),
5758 .Ql =%
5759 (is substring of) and
5760 .Ql !%
5761 (is not substring of).
5762 By default these operators work on bytes and (therefore) do not take
5763 into account character set specifics.
5764 If the case-insensitivity modifier has been used, case is ignored
5765 according to the rules of the US-ASCII encoding, i.e., bytes are
5766 still compared.
5769 When the \*(OPal regular expression support is available, the additional
5770 string operators
5771 .Ql =~
5773 .Ql !~
5774 can be used.
5775 They treat the right hand side as an extended regular expression that is
5776 matched according to the active locale (see
5777 .Sx "Character sets" ) ,
5778 i.e., character sets should be honoured correctly.
5781 Conditions can be joined via AND-OR lists (where the AND operator is
5782 .Ql &&
5783 and the OR operator is
5784 .Ql || ) ,
5785 which have equal precedence and will be evaluated with left
5786 associativity, thus using the same syntax that is known for the
5787 .Xr sh 1 .
5788 It is also possible to form groups of conditions and lists by enclosing
5789 them in pairs of brackets
5790 .Ql [\ \&.\&.\&.\ ] ,
5791 which may be interlocked within each other, and also be joined via
5792 AND-OR lists.
5795 The results of individual conditions and entire groups may be modified
5796 via unary operators: the unary operator
5797 .Ql \&!
5798 will reverse the result.
5800 .Bd -literal -offset indent
5801 # (This not in v15, there [ -n "$debug"]!)
5802 if $debug
5803   echo *debug* is set
5804 endif
5805 if [ "$ttycharset" == UTF-8 ] || \e
5806     [ "$ttycharset" @i== UTF8 ]
5807   echo *ttycharset* is UTF-8, the former case-sensitive!
5808 endif
5809 set t1=one t2=one
5810 if [ "${t1}" == "${t2}" ]
5811   echo These two variables are equal
5812 endif
5813 if [ "$features" =% +regex ] && \e
5814     [ "$TERM" @i=~ "^xterm\&.*" ]
5815   echo ..in an X terminal
5816 endif
5817 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5818     [ "$verbose" != '' ] ] ]
5819   echo Noisy, noisy
5820 endif
5821 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5822   echo Left associativity, as is known from the shell
5823 endif
5828 .It Ic ignore
5829 (ig) Identical to
5830 .Ic discard .
5831 Superseded by the multiplexer
5832 .Ic headerpick .
5835 .It Ic list
5836 Shows the names of all available commands, alphabetically sorted.
5837 If given any non-whitespace argument the list will be shown in the order
5838 in which command prefixes are searched.
5839 \*(OP In conjunction with a set variable
5840 .Va verbose
5841 additional information will be provided for each command: the argument
5842 type will be indicated, the documentation string will be shown,
5843 and the set of command flags will show up:
5845 .Bl -tag -compact -width ".It Ql NEEDS_BOX"
5846 .It Ql "`local'"
5847 command supports the command modifier
5848 .Cm local .
5849 .It Ql "`vput'"
5850 command supports the command modifier
5851 .Cm vput .
5852 .It Ql "*!*"
5853 the error number is tracked in
5854 .Va \&! .
5855 .It Ql needs-box
5856 whether the command needs an active mailbox, a
5857 .Ic file .
5858 .It Ql ok:
5859 indicators whether command is \&.\h'.3m'.\h'.3m'.
5860 .Bl -tag -compact -width ".It Ql SUBPROCESS"
5861 .It Ql batch/interactive
5862 usable in interactive or batch mode
5863 .Pf ( Fl # ) .
5864 .It Ql send-mode
5865 usable in send mode.
5866 .It Ql subprocess
5867 allowed to be used when running in a subprocess instance,
5868 e.g., from within a macro that is called via
5869 .Va on-compose-splice .
5871 .It Ql not ok:
5872 indicators whether command is not \&.\h'.3m'.\h'.3m'.
5873 .Bl -tag -compact -width ".It Ql COMPOSE_MODE"
5874 .It Ql compose-mode
5875 available in compose mode.
5876 .It Ql startup
5877 available during program startup, e.g., in
5878 .Sx "Resource files" .
5880 .It Ql "gabby"
5881 The command produces
5882 .Va history-gabby
5883 .Ic history
5884 entries.
5889 .It Ic localopts
5890 This command can be used to localize changes to (linked)
5891 .Sx ENVIRONMENT
5892 as well as (global)
5893 .Sx "INTERNAL VARIABLES" ,
5894 meaning that their state will be reverted to the former one once the
5895 .Dq covered scope
5896 is left.
5897 Just like the command modifier
5898 .Cm local ,
5899 which provides block-scope localization for some commands (instead),
5900 it can only be used inside of macro definition blocks introduced by
5901 .Ic account
5903 .Ic define .
5904 The covered scope of an
5905 .Ic account
5906 is left once a different account is activated, and some macros, notably
5907 .Va folder-hook Ns s ,
5908 use their own specific notion of covered scope, here it will be extended
5909 until the folder is left again.
5912 This setting stacks up: i.e., if
5913 .Ql macro1
5914 enables change localization and calls
5915 .Ql macro2 ,
5916 which explicitly resets localization, then any value changes within
5917 .Ql macro2
5918 will still be reverted when the scope of
5919 .Ql macro1
5920 is left.
5921 (Caveats: if in this example
5922 .Ql macro2
5923 changes to a different
5924 .Ic account
5925 which sets some variables that are already covered by localizations,
5926 their scope will be extended, and in fact leaving the
5927 .Ic account
5928 will (thus) restore settings in (likely) global scope which actually
5929 were defined in a local, macro private context!)
5932 This command takes one or two arguments, the optional first one
5933 specifies an attribute that may be one of
5934 .Cm \&\&scope ,
5935 which refers to the current scope and is thus the default,
5936 .Cm call ,
5937 which causes any macro that is being
5938 .Ic call Ns
5939 ed to be started with localization enabled by default, as well as
5940 .Cm call-fixate ,
5941 which (if enabled) disallows any called macro to turn off localization:
5942 like this it can be ensured that once the current scope regains control,
5943 any changes made in deeper levels have been reverted.
5944 The latter two are mutually exclusive, and neither affects
5945 .Ic xcall .
5946 The (second) argument is interpreted as a boolean (string, see
5947 .Sx "INTERNAL VARIABLES" )
5948 and states whether the given attribute shall be turned on or off.
5950 .Bd -literal -offset indent
5951 define temporary_settings {
5952   set possibly_global_option1
5953   localopts on
5954   set localized_option1
5955   set localized_option2
5956   localopts scope off
5957   set possibly_global_option2
5963 .It Ic Lreply
5964 Reply to messages that come in via known
5965 .Pf ( Ic mlist )
5966 or subscribed
5967 .Pf ( Ic mlsubscribe )
5968 mailing lists, or pretend to do so (see
5969 .Sx "Mailing lists" ) :
5970 on top of the usual
5971 .Ic reply
5972 functionality this will actively resort and even remove message
5973 recipients in order to generate a message that is supposed to be sent to
5974 a mailing list.
5975 For example it will also implicitly generate a
5976 .Ql Mail-Followup-To:
5977 header if that seems useful, regardless of the setting of the variable
5978 .Va followup-to .
5979 For more documentation please refer to
5980 .Sx "On sending mail, and non-interactive mode" .
5982 This may generate the errors
5983 .Va ^ERR Ns -DESTADDRREQ
5984 if no receiver has been specified,
5985 .Va ^ERR Ns -PERM
5986 if some addressees where rejected by
5987 .Va expandaddr ,
5988 .Va ^ERR Ns -NODATA
5989 if no applicable messages have been given,
5990 .Va ^ERR Ns -IO
5991 if an I/O error occurs,
5992 .Va ^ERR Ns -NOTSUP
5993 if a necessary character set conversion fails, and
5994 .Va ^ERR Ns -INVAL
5995 for other errors.
5996 Occurrence of some of the errors depend on the value of
5997 .Va expandaddr .
5998 Any error stops processing of further messages.
6001 .It Ic Mail
6002 Similar to
6003 .Ic mail ,
6004 but saves the message in a file named after the local part of the first
6005 recipient's address (instead of in
6006 .Va record Ns ).
6009 .It Ic mail
6010 (m) Takes a (list of) recipient address(es) as (an) argument(s),
6011 or asks on standard input if none were given;
6012 then collects the remaining mail content and sends it out.
6013 Unless the internal variable
6014 .Va fullnames
6015 is set recipient addresses will be stripped from comments, names etc.
6016 For more documentation please refer to
6017 .Sx "On sending mail, and non-interactive mode" .
6019 This may generate the errors
6020 .Va ^ERR Ns -DESTADDRREQ
6021 if no receiver has been specified,
6022 .Va ^ERR Ns -PERM
6023 if some addressees where rejected by
6024 .Va expandaddr ,
6025 .Va ^ERR Ns -NODATA
6026 if no applicable messages have been given,
6027 .Va ^ERR Ns -NOTSUP
6028 if multiple messages have been specified,
6029 .Va ^ERR Ns -IO
6030 if an I/O error occurs,
6031 .Va ^ERR Ns -NOTSUP
6032 if a necessary character set conversion fails, and
6033 .Va ^ERR Ns -INVAL
6034 for other errors.
6035 Occurrence of some of the errors depend on the value of
6036 .Va expandaddr .
6039 .It Ic mbox
6040 (mb) The given message list is to be sent to the
6041 .Mx -sx
6042 .Sx "secondary mailbox"
6043 .Ev MBOX
6044 when \*(UA is quit; this is the default action unless the variable
6045 .Va hold
6046 is set.
6047 \*(ID This command can only be used in a
6048 .Mx -sx
6049 .Sx "primary system mailbox" .
6053 .It Ic mimetype , unmimetype
6054 Without arguments the content of the MIME type cache will displayed;
6055 a more verbose listing will be produced if either of
6056 .Va debug
6058 .Va verbose
6059 are set.
6060 When given arguments they will be joined, interpreted as shown in
6061 .Sx "The mime.types files"
6062 (also see
6063 .Sx "HTML mail and MIME attachments" ) ,
6064 and the resulting entry will be added (prepended) to the cache.
6065 In any event MIME type sources are loaded first as necessary \(en
6066 .Va mimetypes-load-control
6067 can be used to fine-tune which sources are actually loaded.
6069 The latter command deletes all specifications of the given MIME type, thus
6070 .Ql ? unmimetype text/plain
6071 will remove all registered specifications for the MIME type
6072 .Ql text/plain .
6073 The special name
6074 .Ql *
6075 will discard all existing MIME types, just as will
6076 .Ql reset ,
6077 but which also reenables cache initialization via
6078 .Va mimetypes-load-control .
6082 .It Ic mlist , unmlist
6083 The latter command removes all given mailing lists, the special name
6084 .Ql *
6085 can be used to remove all registered lists.
6086 The former will list all currently defined mailing lists (and their
6087 attributes, if any) when used without arguments; a more verbose listing
6088 will be produced if either of
6089 .Va debug
6091 .Va verbose
6092 are set.
6093 Otherwise all given arguments will be added and henceforth be recognized
6094 as mailing lists.
6095 If the \*(OPal regular expression support is available then any argument
6096 which contains any of the
6097 .Dq magical
6098 regular expression characters
6099 .Ql ^[]*+?|$
6100 (see
6101 .Xr re_format 7 )
6102 will be interpreted as one, which allows matching of many addresses with
6103 a single expression.
6105 .Ic mlsubscribe
6106 pair of commands manages subscription attributes of mailing lists.
6109 .It Ic mimeview
6110 \*(ID Only available in interactive mode, this command allows one to
6111 display MIME parts which require external MIME handler programs to run
6112 which do not integrate in \*(UAs normal
6113 .Ic type
6114 output (see
6115 .Sx "HTML mail and MIME attachments" ) .
6116 (\*(ID No syntax to directly address parts, this restriction may vanish.)
6117 The user will be asked for each non-text part of the given message in
6118 turn whether the registered handler shall be used to display the part.
6122 .It Ic mlsubscribe , unmlsubscribe
6123 The latter command removes the subscription attribute from all given
6124 mailing lists, the special name
6125 .Ql *
6126 can be used to do so for any registered list.
6127 The former will list all currently defined mailing lists which have
6128 a subscription attribute when used without arguments; a more verbose
6129 listing will be produced if either of
6130 .Va debug
6132 .Va verbose
6133 are set.
6134 Otherwise this attribute will be set for all given mailing lists,
6135 newly creating them as necessary (as via
6136 .Ic mlist ) .
6137 Also see
6138 .Va followup-to .
6141 .It Ic Move
6142 Similar to
6143 .Ic move ,
6144 but moves the messages to a file named after the local part of the
6145 sender address of the first message (instead of in
6146 .Va record Ns ).
6149 .It Ic move
6150 Acts like
6151 .Ic copy
6152 but marks the messages for deletion if they were transferred
6153 successfully.
6156 .It Ic More
6157 Like
6158 .Ic more ,
6159 but also displays header fields which would not pass the
6160 .Ic headerpick
6161 selection, and all MIME parts.
6162 Identical to
6163 .Ic Page .
6166 .It Ic more
6167 Invokes the
6168 .Ev PAGER
6169 on the given messages, even in non-interactive mode and as long as the
6170 standard output is a terminal.
6171 Identical to
6172 .Ic page .
6175 .It Ic netrc
6176 \*(OP When used without arguments or if
6177 .Ar show
6178 has been given the content of the
6179 .Pa \*(VN
6180 cache is shown, loading it first as necessary.
6181 If the argument is
6182 .Ar load
6183 then the cache will only be initialized and
6184 .Ar clear
6185 will remove its contents.
6186 Note that \*(UA will try to load the file only once, use
6187 .Ql Ic \&\&netrc Ns \:\0\:clear
6188 to unlock further attempts.
6190 .Va netrc-lookup ,
6191 .Va netrc-pipe
6192 and the section
6193 .Sx "On URL syntax and credential lookup" ;
6194 the section
6195 .Sx "The .netrc file"
6196 documents the file format in detail.
6199 .It Ic newmail
6200 Checks for new mail in the current folder without committing any changes
6201 before.
6202 If new mail is present, a message is shown.
6203 If the
6204 .Va header
6205 variable is set,
6206 the headers of each new message are also shown.
6207 This command is not available for all mailbox types.
6210 .It Ic next
6211 (n) (like
6212 .Ql +
6214 .Dq ENTER )
6215 Goes to the next message in sequence and types it.
6216 With an argument list, types the next matching message.
6219 .It Ic New
6220 Same as
6221 .Ic Unread .
6224 .It Ic new
6225 Same as
6226 .Ic unread .
6229 .It Ic noop
6230 If the current folder is accessed via a network connection, a
6231 .Dq NOOP
6232 command is sent, otherwise no operation is performed.
6235 .It Ic Page
6236 Like
6237 .Ic page ,
6238 but also displays header fields which would not pass the
6239 .Ic headerpick
6240 selection, and all MIME parts.
6241 Identical to
6242 .Ic More .
6245 .It Ic page
6246 Invokes the
6247 .Ev PAGER
6248 on the given messages, even in non-interactive mode and as long as the
6249 standard output is a terminal.
6250 Identical to
6251 .Ic more .
6254 .It Ic Pipe
6255 Like
6256 .Ic pipe
6257 but also pipes header fields which would not pass the
6258 .Ic headerpick
6259 selection, and all parts of MIME
6260 .Ql multipart/alternative
6261 messages.
6264 .It Ic pipe
6265 (pi) Takes an optional message list and shell command (that defaults to
6266 .Va cmd ) ,
6267 and pipes the messages through the command.
6268 If the
6269 .Va page
6270 variable is set,
6271 every message is followed by a formfeed character.
6274 .It Ic preserve
6275 (pre) A synonym for
6276 .Ic hold .
6279 .It Ic Print
6280 (P) Alias for
6281 .Ic Type .
6284 .It Ic print
6285 (p) Research
6287 equivalent of
6288 .Ic type .
6291 .It Ic quit
6292 (q) Terminates the session, saving all undeleted, unsaved messages in
6293 the current
6294 .Mx -sx
6295 .Sx "secondary mailbox"
6296 .Ev MBOX ,
6297 preserving all messages marked with
6298 .Ic hold
6300 .Ic preserve
6301 or never referenced in the system
6302 .Va inbox ,
6303 and removing all other messages from the
6304 .Mx -sx
6305 .Sx "primary system mailbox" .
6306 If new mail has arrived during the session,
6307 the message
6308 .Dq You have new mail
6309 will be shown.
6310 If given while editing a mailbox file with the command line option
6311 .Fl f ,
6312 then the edit file is rewritten.
6313 A return to the shell is effected,
6314 unless the rewrite of edit file fails,
6315 in which case the user can escape with the exit command.
6316 The optional status number argument will be passed through to
6317 .Xr exit 3 .
6318 \*(ID For now it can happen that the given status will be overwritten,
6319 later this will only occur if a later error needs to be reported onto an
6320 otherwise success indicating status.
6323 .It Ic read
6324 \*(NQ Read a line from standard input, or the channel set active via
6325 .Ic readctl ,
6326 and assign the data, which will be split as indicated by
6327 .Va ifs ,
6328 to the given variables.
6329 The variable names are checked by the same rules as documented for
6330 .Cm vput ,
6331 and the same error codes will be seen in
6332 .Va \&! ;
6333 the exit status
6334 .Va \&?
6335 indicates the number of bytes read, it will be
6336 .Ql -1
6337 with the error number
6338 .Va \&!
6339 set to
6340 .Va ^ERR Ns -BADF
6341 in case of I/O errors, or
6342 .Va ^ERR Ns -NONE
6343 upon End-Of-File.
6344 If there are more fields than variables, assigns successive fields to the
6345 last given variable.
6346 If there are less fields than variables, assigns the empty string to the
6347 remains.
6348 .Bd -literal -offset indent
6349 ? read a b c
6350    H  e  l  l  o
6351 ? echo "<$a> <$b> <$c>"
6352 <H> <e> <l  l  o>
6353 ? wysh set ifs=:; read a b c;unset ifs
6354 hey2.0,:"'you    ",:world!:mars.:
6355 ? echo $?/$^ERRNAME / <$a><$b><$c>
6356 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
6360 .It Ic readall
6361 \*(NQ Read anything from standard input, or the channel set active via
6362 .Ic readctl ,
6363 and assign the data to the given variable.
6364 The variable name is checked by the same rules as documented for
6365 .Cm vput ,
6366 and the same error codes will be seen in
6367 .Va \&! ;
6368 the exit status
6369 .Va \&?
6370 indicates the number of bytes read, it will be
6371 .Ql -1
6372 with the error number
6373 .Va \&!
6374 set to
6375 .Va ^ERR Ns -BADF
6376 in case of I/O errors, or
6377 .Va ^ERR Ns -NONE
6378 upon End-Of-File.
6379 \*(ID The input data length is restricted to 31-bits.
6382 .It Ic readctl
6383 \*(NQ Manages input channels for
6384 .Ic read
6386 .Ic readall ,
6387 to be used to avoid complicated or impracticable code, like calling
6388 .Ic \&\&read
6389 from within a macro in non-interactive mode.
6390 Without arguments, or when the first argument is
6391 .Cm show ,
6392 a listing of all known channels is printed.
6393 Channels can otherwise be
6394 .Cm create Ns
6395 d, and existing channels can be
6396 .Cm set
6397 active and
6398 .Cm remove Ns
6399 d by giving the string used for creation.
6401 The channel name is expected to be a file descriptor number, or,
6402 if parsing the numeric fails, an input file name that undergoes
6403 .Sx "Filename transformations" .
6404 E.g. (this example requires a modern shell):
6405 .Bd -literal -offset indent
6406 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
6407   LC_ALL=C \*(uA -R#
6408 hey, you
6409 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
6410   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
6411 hey, you
6415 .It Ic remove
6416 Removes the named files or directories.
6417 .Sx "Filename transformations"
6418 including shell pathname wildcard pattern expansions
6419 .Pf ( Xr glob 7 )
6420 are performed on the arguments.
6421 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
6422 type specific removal will be performed, deleting the complete mailbox.
6423 The user is asked for confirmation in interactive mode.
6426 .It Ic rename
6427 Takes the name of an existing folder
6428 and the name for the new folder
6429 and renames the first to the second one.
6430 .Sx "Filename transformations"
6431 including shell pathname wildcard pattern expansions
6432 .Pf ( Xr glob 7 )
6433 are performed on both arguments.
6434 Both folders must be of the same type.
6437 .It Ic Reply
6438 (R) Identical to
6439 .Ic reply
6440 except that it replies to only the sender of each message of the given
6441 list, by using the first message as the template to quote, for the
6442 .Ql Subject:
6443 etc.; setting
6444 .Va flipr
6445 will exchange this command with
6446 .Ic reply .
6449 .It Ic reply
6450 (r) Take a message and group-responds to it by addressing the sender
6451 and all recipients, subject to
6452 .Ic alternates
6453 processing.
6454 .Va followup-to ,
6455 .Va followup-to-honour ,
6456 .Va reply-to-honour
6457 as well as
6458 .Va recipients-in-cc
6459 influence response behaviour.
6460 Unless the internal variable
6461 .Va fullnames
6462 is set recipient addresses will be stripped from comments, names etc.
6463 .Va quote
6464 as well as
6465 .Va quote-as-attachment
6466 configure whether responded-to message shall be quoted etc.; setting
6467 .Va flipr
6468 will exchange this command with
6469 .Ic Reply .
6470 The command
6471 .Ic Lreply
6472 offers special support for replying to mailing lists.
6473 For more documentation please refer to
6474 .Sx "On sending mail, and non-interactive mode" .
6476 This may generate the errors
6477 .Va ^ERR Ns -DESTADDRREQ
6478 if no receiver has been specified,
6479 .Va ^ERR Ns -PERM
6480 if some addressees where rejected by
6481 .Va expandaddr ,
6482 .Va ^ERR Ns -NODATA
6483 if no applicable messages have been given,
6484 .Va ^ERR Ns -IO
6485 if an I/O error occurs,
6486 .Va ^ERR Ns -NOTSUP
6487 if a necessary character set conversion fails, and
6488 .Va ^ERR Ns -INVAL
6489 for other errors.
6490 Occurrence of some of the errors depend on the value of
6491 .Va expandaddr .
6492 Any error stops processing of further messages.
6495 .It Ic replyall
6496 Similar to
6497 .Ic reply ,
6498 but initiates a group-reply regardless of the value of
6499 .Va flipr .
6502 .It Ic replysender
6503 Similar to
6504 .Ic Reply ,
6505 but responds to the sender only regardless of the value of
6506 .Va flipr .
6509 .It Ic Resend
6510 Like
6511 .Ic resend ,
6512 but does not add any header lines.
6513 This is not a way to hide the sender's identity,
6514 but useful for sending a message again to the same recipients.
6517 .It Ic resend
6518 Takes a list of messages and a user name
6519 and sends each message to the named user.
6520 .Ql Resent-From:
6521 and related header fields are prepended to the new copy of the message.
6522 Saving in
6523 .Va record
6524 is only performed if
6525 .Va record-resent
6526 is set.
6528 This may generate the errors
6529 .Va ^ERR Ns -DESTADDRREQ
6530 if no receiver has been specified,
6531 .Va ^ERR Ns -PERM
6532 if some addressees where rejected by
6533 .Va expandaddr ,
6534 .Va ^ERR Ns -NODATA
6535 if no applicable messages have been given,
6536 .Va ^ERR Ns -IO
6537 if an I/O error occurs,
6538 .Va ^ERR Ns -NOTSUP
6539 if a necessary character set conversion fails, and
6540 .Va ^ERR Ns -INVAL
6541 for other errors.
6542 Occurrence of some of the errors depend on the value of
6543 .Va expandaddr .
6544 Any error stops processing of further messages.
6547 .It Ic Respond
6548 Same as
6549 .Ic Reply .
6552 .It Ic respond
6553 Same as
6554 .Ic reply .
6557 .It Ic respondall
6558 Same as
6559 .Ic replyall .
6562 .It Ic respondsender
6563 Same as
6564 .Ic replysender .
6567 .It Ic retain
6568 (ret) Superseded by the multiplexer
6569 .Ic headerpick .
6572 .It Ic return
6573 Only available inside the scope of a
6574 .Ic define Ns
6575 d macro or an
6576 .Ic account ,
6577 this will stop evaluation of any further macro content, and return
6578 execution control to the caller.
6579 The two optional parameters must be specified as positive decimal
6580 numbers and default to the value 0:
6581 the first argument specifies the signed 32-bit return value (stored in
6582 .Va \&?
6583 \*(ID and later extended to signed 64-bit),
6584 the second the signed 32-bit error number (stored in
6585 .Va \&! ) .
6586 As documented for
6587 .Va \&?
6588 a non-0 exit status may cause the program to exit.
6591 .It Ic Save
6592 (S) Similar to
6593 .Ic save,
6594 but saves the messages in a file named after the local part of the
6595 sender of the first message instead of (in
6596 .Va record
6597 and) taking a filename argument; the variable
6598 .Va outfolder
6599 is inspected to decide on the actual storage location.
6602 .It Ic save
6603 (s) Takes a message list and a filename and appends each message in turn
6604 to the end of the file.
6605 .Sx "Filename transformations"
6606 including shell pathname wildcard pattern expansions
6607 .Pf ( Xr glob 7 )
6608 is performed on the filename.
6609 If no filename is given, the
6610 .Mx -sx
6611 .Sx "secondary mailbox"
6612 .Ev MBOX
6613 is used.
6614 The filename in quotes, followed by the generated character count
6615 is echoed on the user's terminal.
6616 If editing a
6617 .Mx -sx
6618 .Sx "primary system mailbox"
6619 the messages are marked for deletion.
6620 .Sx "Filename transformations"
6621 will be applied.
6622 To filter the saved header fields to the desired subset use the
6623 .Ql save
6624 slot of the white- and blacklisting command
6625 .Ic headerpick .
6627 .It Ic savediscard
6628 \*(OB Superseded by the multiplexer
6629 .Ic headerpick .
6631 .It Ic saveignore
6632 \*(OB Superseded by the multiplexer
6633 .Ic headerpick .
6635 .It Ic saveretain
6636 \*(OB Superseded by the multiplexer
6637 .Ic headerpick .
6640 .It Ic search
6641 Takes a message specification (list) and displays a header summary of
6642 all matching messages, as via
6643 .Ic headers .
6644 This command is an alias of
6645 .Ic from .
6646 Also see
6647 .Sx "Specifying messages" .
6650 .It Ic seen
6651 Takes a message list and marks all messages as having been read.
6656 .It Ic set , unset
6657 (se, \*(NQ uns) The latter command will delete all given global
6658 variables, or only block-scope local ones if the
6659 .Cm local
6660 command modifier has been used.
6661 The former, when used without arguments, will show all
6662 currently known variables, being more verbose if either of
6663 .Va debug
6665 .Va verbose
6666 is set.
6667 Remarks: this list mode will not automatically link-in known
6668 .Sx ENVIRONMENT
6669 variables, but only explicit addressing will, e.g., via
6670 .Ic varshow ,
6671 using a variable in an
6672 .Ic if
6673 condition or a string passed to
6674 .Ic echo ,
6675 explicit
6676 .Ic \&\&set Ns
6677 ting, as well as some program-internal use cases.
6680 Otherwise the given variables (and arguments) are set or adjusted.
6681 Arguments are of the form
6682 .Ql name=value
6683 (no space before or after
6684 .Ql = ) ,
6685 or plain
6686 .Ql name
6687 if there is no value, i.e., a boolean variable.
6688 If a name begins with
6689 .Ql no ,
6690 as in
6691 .Ql set nosave ,
6692 the effect is the same as invoking the
6693 .Ic \&\&unset
6694 command with the remaining part of the variable
6695 .Pf ( Ql unset save ) .
6696 \*(ID In conjunction with the
6697 .Cm wysh
6698 .Pf (or\0 Cm local )
6699 command prefix(es)
6700 .Sx "Shell-style argument quoting"
6701 can be used to quote arguments as necessary.
6702 \*(ID Otherwise quotation marks may be placed around any part of the
6703 assignment statement to quote blanks or tabs.
6706 When operating in global scope any
6707 .Ql name
6708 that is known to map to an environment variable will automatically cause
6709 updates in the program environment (unsetting a variable in the
6710 environment requires corresponding system support) \(em use the command
6711 .Ic environ
6712 for further environmental control.
6713 If the command modifier
6714 .Cm local
6715 has been used to alter the command to work in block-scope all variables
6716 have values (may they be empty), and creation of names which shadow
6717 .Sx "INTERNAL VARIABLES"
6718 is actively prevented (\*(ID shadowing of linked
6719 .Sx ENVIRONMENT
6720 variables and free-form versions of variable chains is not yet detected).
6721 Also see
6722 .Ic varshow
6723 and the sections
6724 .Sx "INTERNAL VARIABLES"
6726 .Sx ENVIRONMENT .
6728 .Bd -literal -offset indent
6729 ? wysh set indentprefix=' -> '
6730 ? wysh set atab=$'\t' aspace=' ' zero=0
6735 .It Ic shcodec
6736 Apply shell quoting rules to the given raw-data arguments.
6737 Supports
6738 .Cm vput
6739 (see
6740 .Sx "Command modifiers" ) .
6741 The first argument specifies the operation:
6742 .Ar [+]e[ncode]
6744 .Ar d[ecode]
6745 cause shell quoting to be applied to the remains of the line, and
6746 expanded away thereof, respectively.
6747 If the former is prefixed with a plus-sign, the quoted result will not
6748 be roundtrip enabled, and thus can be decoded only in the very same
6749 environment that was used to perform the encode; also see
6750 .Cd mle-quote-rndtrip .
6751 If the coding operation fails the error number
6752 .Va \&!
6753 is set to
6754 .Va ^ERR Ns -CANCELED ,
6755 and the unmodified input is used as the result; the error number may
6756 change again due to output or result storage errors.
6759 .It Ic shell
6760 \*(NQ (sh) Invokes an interactive version of the shell,
6761 and returns its exit status.
6765 .It Ic shortcut , unshortcut
6766 Without arguments the list of all currently defined shortcuts is
6767 shown, with one argument the expansion of the given shortcut.
6768 Otherwise all given arguments are treated as pairs of shortcuts and
6769 their expansions, creating new or changing already existing shortcuts,
6770 as necessary.
6771 The latter command will remove all given shortcuts, the special name
6772 .Ql *
6773 will remove all registered shortcuts.
6776 .It Ic shift
6777 \*(NQ Shift the positional parameter stack (starting at
6778 .Va 1 )
6779 by the given number (which must be a positive decimal),
6780 or 1 if no argument has been given.
6781 It is an error if the value exceeds the number of positional parameters.
6782 If the given number is 0, no action is performed, successfully.
6783 The stack as such can be managed via
6784 .Ic vpospar .
6785 Note this command will fail in
6786 .Ic account
6787 and hook macros unless the positional parameter stack has been
6788 explicitly created in the current context via
6789 .Ic vpospar .
6792 .It Ic show
6793 Like
6794 .Ic type ,
6795 but performs neither MIME decoding nor decryption, so that the raw
6796 message text is shown.
6799 .It Ic size
6800 (si) Shows the size in characters of each message of the given
6801 message-list.
6804 .It Ic sleep
6805 \*(NQ Sleep for the specified number of seconds (and optionally
6806 milliseconds), by default interruptable.
6807 If a third argument is given the sleep will be uninterruptible,
6808 otherwise the error number
6809 .Va \&!
6810 will be set to
6811 .Va ^ERR Ns -INTR
6812 if the sleep has been interrupted.
6813 The command will fail and the error number will be
6814 .Va ^ERR Ns -OVERFLOW
6815 if the given duration(s) overflow the time datatype, and
6816 .Va ^ERR Ns -INVAL
6817 if the given durations are no valid integers.
6822 .It Ic sort , unsort
6823 The latter command disables sorted or threaded mode, returns to normal
6824 message order and, if the
6825 .Va header
6826 variable is set,
6827 displays a header summary.
6828 The former command shows the current sorting criterion when used without
6829 an argument, but creates a sorted representation of the current folder
6830 otherwise, and changes the
6831 .Ic next
6832 command and the addressing modes such that they refer to messages in
6833 the sorted order.
6834 Message numbers are the same as in regular mode.
6835 If the
6836 .Va header
6837 variable is set,
6838 a header summary in the new order is also displayed.
6839 Automatic folder sorting can be enabled by setting the
6840 .Va autosort
6841 variable, as in, e.g.,
6842 .Ql set autosort=thread .
6843 Possible sorting criterions are:
6846 .Bl -tag -compact -width "subject"
6847 .It Ar date
6848 Sort the messages by their
6849 .Ql Date:
6850 field, that is by the time they were sent.
6851 .It Ar from
6852 Sort messages by the value of their
6853 .Ql From:
6854 field, that is by the address of the sender.
6855 If the
6856 .Va showname
6857 variable is set, the sender's real name (if any) is used.
6858 .It Ar size
6859 Sort the messages by their size.
6860 .It spam
6861 \*(OP Sort the message by their spam score, as has been classified by
6862 .Ic spamrate .
6863 .It Ar status
6864 Sort the messages by their message status.
6865 .It Ar subject
6866 Sort the messages by their subject.
6867 .It Ar thread
6868 Create a threaded display.
6869 .It Ar to
6870 Sort messages by the value of their
6871 .Ql To:
6872 field, that is by the address of the recipient.
6873 If the
6874 .Va showname
6875 variable is set, the recipient's real name (if any) is used.
6880 .It Ic source
6881 \*(NQ (so) The source command reads commands from the given file.
6882 .Sx "Filename transformations"
6883 will be applied.
6884 If the given expanded argument ends with a vertical bar
6885 .Ql |
6886 then the argument will instead be interpreted as a shell command and
6887 \*(UA will read the output generated by it.
6888 Dependent on the settings of
6889 .Va posix
6891 .Va errexit ,
6892 and also dependent on whether the command modifier
6893 .Cm ignerr
6894 had been used, encountering errors will stop sourcing of the given input.
6895 \*(ID Note that
6896 .Ic \&\&source
6897 cannot be used from within macros that execute as
6898 .Va folder-hook Ns s
6900 .Ic account Ns s ,
6901 i.e., it can only be called from macros that were
6902 .Ic call Ns ed .
6905 .It Ic source_if
6906 \*(NQ The difference to
6907 .Ic source
6908 (beside not supporting pipe syntax aka shell command input) is that
6909 this command will not generate an error nor warn if the given file
6910 argument cannot be opened successfully.
6913 .It Ic spamclear
6914 \*(OP Takes a list of messages and clears their
6915 .Ql is-spam
6916 flag.
6919 .It Ic spamforget
6920 \*(OP Takes a list of messages and causes the
6921 .Va spam-interface
6922 to forget it has ever used them to train its Bayesian filter.
6923 Unless otherwise noted the
6924 .Ql is-spam
6925 flag of the message is inspected to chose whether a message shall be
6926 forgotten to be
6927 .Dq ham
6929 .Dq spam .
6932 .It Ic spamham
6933 \*(OP Takes a list of messages and informs the Bayesian filter of the
6934 .Va spam-interface
6935 that they are
6936 .Dq ham .
6937 This also clears the
6938 .Ql is-spam
6939 flag of the messages in question.
6942 .It Ic spamrate
6943 \*(OP Takes a list of messages and rates them using the configured
6944 .Va spam-interface ,
6945 without modifying the messages, but setting their
6946 .Ql is-spam
6947 flag as appropriate; because the spam rating headers are lost the rate
6948 will be forgotten once the mailbox is left.
6949 Refer to the manual section
6950 .Sx "Handling spam"
6951 for the complete picture of spam handling in \*(UA.
6954 .It Ic spamset
6955 \*(OP Takes a list of messages and sets their
6956 .Ql is-spam
6957 flag.
6960 .It Ic spamspam
6961 \*(OP Takes a list of messages and informs the Bayesian filter of the
6962 .Va spam-interface
6963 that they are
6964 .Dq spam .
6965 This also sets the
6966 .Ql is-spam
6967 flag of the messages in question.
6969 .It Ic thread
6970 \*(OB The same as
6971 .Ql sort thread
6972 (consider using a
6973 .Ql commandalias
6974 as necessary).
6978 .It Ic tls
6979 \*(NQ TLS information and management command multiplexer to aid in
6980 .Sx "Encrypted network communication" .
6981 Commands support
6982 .Cm vput
6983 if so documented (see
6984 .Sx "Command modifiers" ) .
6985 The result that is shown in case of errors is always the empty string,
6986 errors can be identified via the error number
6987 .Va \&! .
6988 For example, string length overflows are caught and set
6989 .Va \&!
6991 .Va ^ERR Ns -OVERFLOW .
6992 Note this command of course honours the overall TLS configuration.
6993 .Bd -literal -offset indent
6994 ? vput tls result fingerprint pop3s://ex.am.ple
6995 ? echo $?/$!/$^ERRNAME: $result
6998 .Bl -hang -width ".It Cm random"
6999 .It Cm fingerprint
7000 Show the
7001 .Va tls-fingerprint-digest Ns
7002 ed fingerprint of the certificate of the given HOST
7003 .Pf ( Ql server:port ,
7004 where the port defaults to the HTTPS port, 443).
7005 .Va tls-fingerprint
7006 is actively ignored for the runtime of this command.
7007 Only available if the term
7008 .Ql +sockets
7009 is included in
7010 .Va features .
7015 .It Ic Top
7016 Like
7017 .Ic top
7018 but always uses the
7019 .Ic headerpick
7020 .Ql type
7021 slot for white- and blacklisting header fields.
7024 .It Ic top
7025 (to) Takes a message list and types out the first
7026 .Va toplines
7027 lines of each message on the user's terminal.
7028 Unless a special selection has been established for the
7029 .Ql top
7030 slot of the
7031 .Ic headerpick
7032 command, the only header fields that are displayed are
7033 .Ql From: ,
7034 .Ql To: ,
7035 .Ql CC: ,
7037 .Ql Subject: .
7038 .Ic Top
7039 will always use the
7040 .Ql type
7041 .Ic headerpick
7042 selection instead.
7043 It is possible to apply compression to what is displayed by setting
7044 .Va topsqueeze .
7045 Messages are decrypted and converted to the terminal character set
7046 if necessary.
7049 .It Ic touch
7050 (tou) Takes a message list and marks the messages for saving in the
7051 .Mx -sx
7052 .Sx "secondary mailbox"
7053 .Ev MBOX .
7054 \*(UA deviates from the POSIX standard with this command,
7055 as a following
7056 .Ic next
7057 command will display the following message instead of the current one.
7060 .It Ic Type
7061 (T) Like
7062 .Ic type
7063 but also displays header fields which would not pass the
7064 .Ic headerpick
7065 selection, and all visualizable parts of MIME
7066 .Ql multipart/alternative
7067 messages.
7070 .It Ic type
7071 (t) Takes a message list and types out each message on the user's terminal.
7072 The display of message headers is selectable via
7073 .Ic headerpick .
7074 For MIME multipart messages, all parts with a content type of
7075 .Ql text ,
7076 all parts which have a registered MIME type handler (see
7077 .Sx "HTML mail and MIME attachments" )
7078 which produces plain text output, and all
7079 .Ql message
7080 parts are shown, others are hidden except for their headers.
7081 Messages are decrypted and converted to the terminal character set
7082 if necessary.
7083 The command
7084 .Ic mimeview
7085 can be used to display parts which are not displayable as plain text.
7087 .It Ic unaccount
7089 .Ic account .
7091 .It Ic unalias
7092 (una) See
7093 .Ic alias .
7095 .It Ic unanswered
7097 .Ic answered .
7099 .It Ic unbind
7101 .Ic bind .
7103 .It Ic uncollapse
7105 .Ic collapse .
7107 .It Ic uncolour
7109 .Ic colour .
7111 .It Ic undefine
7113 .Ic define .
7115 .It Ic undelete
7117 .Ic delete .
7119 .It Ic undraft
7121 .Ic draft .
7123 .It Ic unflag
7125 .Ic flag .
7127 .It Ic unfwdignore
7128 \*(OB Superseded by the multiplexer
7129 .Ic headerpick .
7131 .It Ic unfwdretain
7132 \*(OB Superseded by the multiplexer
7133 .Ic headerpick .
7136 .It Ic unignore
7137 Superseded by the multiplexer
7138 .Ic headerpick .
7140 .It Ic unmimetype
7142 .Ic mimetype .
7144 .It Ic unmlist
7146 .Ic mlist .
7148 .It Ic unmlsubscribe
7150 .Ic mlsubscribe .
7153 .It Ic Unread
7154 Same as
7155 .Ic unread .
7158 .It Ic unread
7159 Takes a message list and marks each message as not having been read.
7162 .It Ic unretain
7163 Superseded by the multiplexer
7164 .Ic headerpick .
7166 .It Ic unsaveignore
7167 \*(OB Superseded by the multiplexer
7168 .Ic headerpick .
7170 .It Ic unsaveretain
7171 \*(OB Superseded by the multiplexer
7172 .Ic headerpick .
7174 .It Ic unset
7175 \*(NQ (uns) See
7176 .Ic set .
7178 .It Ic unshortcut
7180 .Ic shortcut .
7182 .It Ic unsort
7184 .Ic short .
7186 .It Ic unthread
7187 \*(OB
7188 Same as
7189 .Ic unsort .
7192 .It Ic urlcodec
7193 Perform URL percent codec operations on the raw-data argument, rather
7194 according to RFC 3986.
7195 Supports
7196 .Cm vput
7197 (see
7198 .Sx "Command modifiers" ) ,
7199 and manages the error number
7200 .Va \&! .
7201 This is a character set agnostic and thus locale dependent operation,
7202 and it may decode bytes which are invalid in the current
7203 .Va ttycharset .
7204 \*(ID This command does not know about URLs beside that.
7206 The first argument specifies the operation:
7207 .Ar e[ncode]
7209 .Ar d[ecode]
7210 perform plain URL percent en- and decoding, respectively.
7211 .Ar p[ath]enc[ode]
7213 .Ar p[ath]dec[ode]
7214 perform a slightly modified operation which should be better for
7215 pathnames: it does not allow a tilde
7216 .Ql ~ ,
7217 and will neither accept hyphen-minus
7218 .Ql -
7219 nor dot
7220 .Ql .
7221 as an initial character.
7222 The remains of the line form the URL data which is to be converted.
7223 If the coding operation fails the error number
7224 .Va \&!
7225 is set to
7226 .Va ^ERR Ns -CANCELED ,
7227 and the unmodified input is used as the result; the error number may
7228 change again due to output or result storage errors.
7231 .It Ic varshow
7232 \*(NQ This command produces the same output as the listing mode of
7233 .Ic set ,
7234 including
7235 .Va verbose Ns
7236 ity adjustments, but only for the given variables.
7239 .It Ic verify
7240 \*(OP Takes a message list and verifies each message.
7241 If a message is not a S/MIME signed message,
7242 verification will fail for it.
7243 The verification process checks if the message was signed using a valid
7244 certificate,
7245 if the message sender's email address matches one of those contained
7246 within the certificate,
7247 and if the message content has been altered.
7250 .It Ic version
7251 Shows the
7252 .Va version
7254 .Va features
7255 of \*(UA, as well as the build and running system environment.
7256 This command can produce a more
7257 .Va verbose
7258 output, and supports
7259 .Cm vput
7260 (see
7261 .Sx "Command modifiers" ) .
7265 .It Ic vexpr
7266 \*(NQ Evaluate arguments according to a given operator.
7267 This is a multiplexer command which can be used to perform signed 64-bit
7268 numeric calculations as well as byte string and string operations.
7269 It uses polish notation, i.e., the operator is the first argument and
7270 defines the number and type, and the meaning of the remaining arguments.
7271 An empty argument is replaced with a 0 if a number is expected.
7272 Supports
7273 .Cm vput
7274 (see
7275 .Sx "Command modifiers" ) .
7278 The result that is shown in case of errors is always
7279 .Ql -1
7280 for usage errors and numeric operations, and the empty string for byte
7281 string and string operations;
7282 if the latter two fail to provide result data for
7283 .Dq soft
7284 errors, e.g., when a search operation failed, they also set the
7285 .Va \&!
7286 error number to
7287 .Va ^ERR Ns -NODATA .
7288 Except when otherwise noted numeric arguments are parsed as signed 64-bit
7289 numbers, and errors will be reported in the error number
7290 .Va \&!
7291 as the numeric error
7292 .Va ^ERR Ns -RANGE .
7295 Numeric operations work on one or two signed 64-bit integers.
7296 Numbers prefixed with
7297 .Ql 0x
7299 .Ql 0X
7300 are interpreted as hexadecimal (base 16) numbers, whereas
7301 .Ql 0
7302 indicates octal (base 8), and
7303 .Ql 0b
7304 as well as
7305 .Ql 0B
7306 denote binary (base 2) numbers.
7307 It is possible to use any base in between 2 and 36, inclusive, with the
7308 .Ql BASE#number
7309 notation, where the base is given as an unsigned decimal number, e.g.,
7310 .Ql 16#AFFE
7311 is a different way of specifying a hexadecimal number.
7312 Unsigned interpretation of a number can be enforced by prefixing an
7313 .Ql u
7314 (case-insensitively), e.g.,
7315 .Ql u-110 ;
7316 this is not necessary for power-of-two bases (2, 4, 8, 16 and 32),
7317 which will be interpreted as unsigned by default, but it still makes
7318 a difference regarding overflow detection and overflow constant.
7319 It is possible to enforce signed interpretation by (instead) prefixing a
7320 .Ql s
7321 (case-insensitively).
7324 One integer is expected by assignment (equals sign
7325 .Ql = ) ,
7326 which does nothing but parsing the argument, thus detecting validity and
7327 possible overflow conditions, and unary not (tilde
7328 .Ql ~ ) ,
7329 which creates the bitwise complement.
7330 Two integers are used by addition (plus sign
7331 .Ql + ) ,
7332 subtraction (hyphen-minus
7333 .Ql - ) ,
7334 multiplication (asterisk
7335 .Ql * ) ,
7336 division (solidus
7337 .Ql / )
7338 and modulo (percent sign
7339 .Ql % ) ,
7340 as well as for the bitwise operators logical or (vertical bar
7341 .Ql | ,
7342 to be quoted) ,
7343 bitwise and (ampersand
7344 .Ql \&& ,
7345 to be quoted) ,
7346 bitwise xor (circumflex
7347 .Ql ^ ) ,
7348 the bitwise signed left- and right shifts
7349 .Pf ( Ql << ,
7350 .Ql >> ) ,
7351 as well as for the unsigned right shift
7352 .Ql >>> .
7355 Another numeric operation is
7356 .Cm pbase ,
7357 which takes a number base in between 2 and 36, inclusive, and will act
7358 on the second number given just the same as what equals sign
7359 .Ql =
7360 does, but the number result will be formatted in the base given.
7363 All numeric operators can be prefixed with a commercial at
7364 .Ql @ ,
7365 e.g.,
7366 .Ql @* :
7367 this will turn the operation into a saturated one, which means that
7368 overflow errors and division and modulo by zero are no longer reported
7369 via the exit status, but the result will linger at the minimum or
7370 maximum possible value, instead of overflowing (or trapping).
7371 This is true also for the argument parse step.
7372 For the bitwise shifts, the saturated maximum is 63.
7373 Any caught overflow will be reported via the error number
7374 .Va \&!
7376 .Va ^ERR Ns -OVERFLOW .
7377 .Bd -literal -offset indent
7378 ? vexpr @- +1 -9223372036854775808
7379 ? echo $?/$!/$^ERRNAME
7383 Character set agnostic string functions have no notion of locale
7384 settings and character sets.
7386 .Bl -hang -width ".It Cm random"
7387 .It Cm file-expand
7388 Performs the usual
7389 .Sx "Filename transformations"
7390 on its argument.
7391 .It Cm random
7392 Generates a random string of the given length, or of
7393 .Dv \&\&PATH_MAX
7394 bytes (a constant from
7395 .Pa /usr/include )
7396 if the value 0 is given; the random string will be base64url encoded
7397 according to RFC 4648, and thus be usable as a (portable) filename.
7401 Byte string operations work on 8-bit bytes and have no notion of locale
7402 settings and character sets, effectively assuming ASCII data.
7405 .Bl -hang -width ".It Cm length"
7406 .It Cm length
7407 Queries the length of the given argument.
7409 .It Cm hash
7410 Calculates the Chris Torek hash of the given argument.
7412 .It Cm find
7413 Byte-searches in the first for the second argument.
7414 Shows the resulting 0-based offset shall it have been found.
7416 .It Cm ifind
7417 Identical to
7418 .Cm find ,
7419 but works case-insensitively according to the rules of the ASCII
7420 character set.
7422 .It Cm substring
7423 Creates a substring of its first argument.
7424 The second argument is the 0-based starting offset, a negative one
7425 counts from the end;
7426 the optional third argument specifies the length of the desired result,
7427 a negative length leaves off the given number of bytes at the end of the
7428 original string, by default the entire string is used;
7429 this operation tries to work around faulty arguments (set
7430 .Va verbose
7431 for error logs), but reports them via the error number
7432 .Va \&!
7434 .Va ^ERR Ns -OVERFLOW .
7436 .It Cm trim
7437 Trim away whitespace characters from both ends of the argument.
7439 .It Cm trim-front
7440 Trim away whitespace characters from the begin of the argument.
7442 .It Cm trim-end
7443 Trim away whitespace characters from the end of the argument.
7448 String operations work, sufficient support provided, according to the
7449 active user's locale encoding and character set (see
7450 .Sx "Character sets" ) .
7453 .Bl -hang -width ".It Cm regex"
7454 .It Cm makeprint
7455 (One-way) Converts the argument to something safely printable on the
7456 terminal.
7458 .It Cm regex
7459 \*(OP A string operation that will try to match the first argument with
7460 the regular expression given as the second argument.
7461 If the optional third argument has been given then instead of showing
7462 the match offset a replacement operation is performed: the third
7463 argument is treated as if specified within dollar-single-quote (see
7464 .Sx "Shell-style argument quoting" ) ,
7465 and any occurrence of a positional parameter, e.g.,
7466 .Va 1 ,
7467 is replaced by the corresponding match group of the regular expression:
7468 .Bd -literal -offset indent
7469 ? vput vexpr res regex bananarama \e
7470     (.*)NanA(.*) '\e${1}au\e$2'
7471 ? echo $?/$!/$^ERRNAME: $res
7474 .It Cm iregex
7475 On otherwise identical case-insensitive equivalent to
7476 .Cm regex :
7477 .Bd -literal -offset indent
7478 ? vput vexpr res ire bananarama \e
7479     (.*)NanA(.*) '\e${1}au\e$2'
7480 ? echo $?/$!/$^ERRNAME: $res
7486 .It Ic vpospar
7487 \*(NQ Manage the positional parameter stack (see
7488 .Va 1 , # , * , @
7489 as well as
7490 .Ic shift ) .
7491 If the first argument is
7492 .Ql clear ,
7493 then the positional parameter stack of the current context, or the
7494 global one, if there is none, is cleared.
7495 If it is
7496 .Ql set ,
7497 then the remaining arguments will be used to (re)create the stack,
7498 if the parameter stack size limit is excessed an
7499 .Va ^ERR Ns -OVERFLOW
7500 error will occur.
7503 If the first argument is
7504 .Ql quote ,
7505 a round-trip capable representation of the stack contents is created,
7506 with each quoted parameter separated from each other with the first
7507 character of
7508 .Va ifs ,
7509 and followed by the first character of
7510 .Va if-ws ,
7511 if that is not empty and not identical to the first.
7512 If that results in no separation at all a
7513 .Cm space
7514 character is used.
7515 This mode supports
7516 .Cm vput
7517 (see
7518 .Sx "Command modifiers" ) .
7519 I.e., the subcommands
7520 .Ql set
7522 .Ql quote
7523 can be used (in conjunction with
7524 .Ic eval )
7525 to (re)create an argument stack from and to a single variable losslessly.
7527 .Bd -literal -offset indent
7528 ? vpospar set hey, "'you    ", world!
7529 ? echo $#: <${1}><${2}><${3}>
7530 ? vput vpospar x quote
7531 ? vpospar clear
7532 ? echo $#: <${1}><${2}><${3}>
7533 ? eval vpospar set ${x}
7534 ? echo $#: <${1}><${2}><${3}>
7539 .It Ic visual
7540 (v) Takes a message list and invokes the
7541 .Ev VISUAL
7542 display editor on each message.
7543 Modified contents are discarded unless the
7544 .Va writebackedited
7545 variable is set, and are not used unless the mailbox can be written to
7546 and the editor returns a successful exit status.
7547 .Ic edit
7548 can be used instead for a less display oriented editor.
7551 .It Ic write
7552 (w) For conventional messages the body without all headers is written.
7553 The original message is never marked for deletion in the originating
7554 mail folder.
7555 The output is decrypted and converted to its native format as necessary.
7556 If the output file exists, the text is appended.
7557 If a message is in MIME multipart format its first part is written to
7558 the specified file as for conventional messages, handling of the remains
7559 depends on the execution mode.
7560 No special handling of compressed files is performed.
7562 In interactive mode the user is consecutively asked for the filenames of
7563 the processed parts.
7564 For convience saving of each part may be skipped by giving an empty
7565 value, the same result as writing it to
7566 .Pa /dev/null .
7567 Shell piping the part content by specifying a leading vertical bar
7568 .Ql |
7569 character for the filename is supported.
7570 Other user input undergoes the usual
7571 .Sx "Filename transformations" ,
7572 including shell pathname wildcard pattern expansions
7573 .Pf ( Xr glob 7 )
7574 and shell variable expansion for the message as such, not the individual
7575 parts, and contents of the destination file are overwritten if the file
7576 previously existed.
7578 \*(ID In non-interactive mode any part which does not specify a filename
7579 is ignored, and suspicious parts of filenames of the remaining parts are
7580 URL percent encoded (as via
7581 .Ic urlcodec )
7582 to prevent injection of malicious character sequences, resulting in
7583 a filename that will be written into the current directory.
7584 Existing files will not be overwritten, instead the part number or
7585 a dot are appended after a number sign
7586 .Ql #
7587 to the name until file creation succeeds (or fails due to other
7588 reasons).
7591 .It Ic xcall
7592 \*(NQ The sole difference to
7593 .Ic call
7594 is that the new macro is executed in place of the current one, which
7595 will not regain control: all resources of the current macro will be
7596 released first.
7597 This implies that any setting covered by
7598 .Ic localopts
7599 will be forgotten and covered variables will become cleaned up.
7600 If this command is not used from within a
7601 .Ic call Ns
7602 ed macro it will silently be (a more expensive variant of)
7603 .Ic call .
7606 .It Ic xit
7607 (x) A synonym for
7608 .Ic exit .
7611 .It Ic z
7612 \*(NQ \*(UA presents message headers in
7613 .Va screen Ns
7614 fuls as described under the
7615 .Ic headers
7616 command.
7617 Without arguments this command scrolls to the next window of messages,
7618 likewise if the argument is
7619 .Ql + .
7620 An argument of
7621 .Ql -
7622 scrolls to the last,
7623 .Ql ^
7624 scrolls to the first, and
7625 .Ql $
7626 to the last
7627 .Va \&\&screen
7628 of messages.
7629 A number argument prefixed by
7630 .Ql +
7632 .Ql \-
7633 indicates that the window is calculated in relation to the current
7634 position, and a number without a prefix specifies an absolute position.
7637 .It Ic Z
7638 \*(NQ Similar to
7639 .Ic z ,
7640 but scrolls to the next or previous window that contains at least one
7641 .Ql new
7643 .Ic flag Ns
7644 ged message.
7646 .\" }}}
7648 .\" }}}
7651 .\" .Sh COMMAND ESCAPES {{{
7652 .Sh "COMMAND ESCAPES"
7654 Command escapes are available in compose mode, and are used to perform
7655 special functions when composing messages.
7656 Command escapes are only recognized at the beginning of lines, and
7657 consist of a trigger (escape), and a command character.
7658 The actual escape character can be set via the internal variable
7659 .Va escape ,
7660 it defaults to the tilde
7661 .Ql ~ .
7662 Otherwise ignored whitespace characters following the escape character
7663 will prevent a possible addition of the command line to the \*(OPal
7664 history.
7667 Unless otherwise noted all compose mode command escapes ensure proper
7668 updates of the variables which represent the error number
7669 .Va \&!
7670 and the exit status
7671 .Va \&? .
7672 If the variable
7673 .Va errexit
7674 is set they will, unless stated otherwise, error out message compose mode
7675 and cause a program exit if an operation fails;
7676 an effect equivalent to the command modifier
7677 .Cm ignerr
7678 can however be achieved by placing a hyphen-minus
7679 .Ql -
7680 after (possible whitespace following) the escape character.
7681 If the \*(OPal key bindings are available it is possible to create
7682 .Ic bind Ns
7683 ings specifically for the compose mode.
7686 .Bl -tag -width ".It Ic BaNg"
7688 .It Ic ~~ Ar string
7689 Insert the string of text in the message prefaced by a single
7690 .Ql ~ .
7691 (If the escape character has been changed,
7692 that character must be doubled instead.)
7695 .It Ic ~! Ar command
7696 Execute the indicated shell
7697 .Ar command
7698 which follows, replacing unescaped exclamation marks with the previously
7699 executed command if the internal variable
7700 .Va bang
7701 is set, then return to the message.
7704 .It Ic ~.
7705 End compose mode and send the message.
7706 The hooks
7707 .Va on-compose-splice-shell
7709 .Va on-compose-splice ,
7710 in order, will be called when set, after which, in interactive mode
7711 .Va askatend
7712 (leading to
7713 .Va askcc , askbcc )
7715 .Va askattach
7716 will be checked as well as
7717 .Va asksend ,
7718 after which a set
7719 .Va on-compose-leave
7720 hook will be called,
7721 .Va autocc
7723 .Va autobcc
7724 will be joined in if set,
7725 finally a given
7726 .Va message-inject-tail
7727 will be incorporated, after which the compose mode is left.
7730 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
7731 Execute the given \*(UA command.
7732 Not all commands, however, are allowed.
7735 .It Ic ~< Ar filename
7736 Identical to
7737 .Ic ~r .
7740 .It Ic ~<! Ar command
7741 .Ar command
7742 is executed using the shell.
7743 Its standard output is inserted into the message.
7746 .It Ic ~?
7747 \*(OP Write a summary of command escapes.
7750 .It Ic ~@ Op Ar filename...
7751 Append or edit the list of attachments.
7752 Does not manage the error number
7753 .Va \&!
7754 and the exit status
7755 .Va \&?
7756 (please use
7757 .Ic ~^
7758 instead if this is a concern).
7759 The append mode expects a list of
7760 .Ar filename
7761 arguments as shell tokens (see
7762 .Sx "Shell-style argument quoting" ;
7763 token-separating commas are ignored, too), to be
7764 interpreted as documented for the command line option
7765 .Fl a ,
7766 with the message number exception as below.
7768 Without
7769 .Ar filename
7770 arguments the attachment list is edited, entry by entry;
7771 if a filename is left empty, that attachment is deleted from the list;
7772 once the end of the list is reached either new attachments may be
7773 entered or the session can be quit by committing an empty
7774 .Dq new
7775 attachment.
7776 In non-interactive mode or in batch mode
7777 .Pf ( Fl # )
7778 the list of attachments is effectively not edited but instead recreated;
7779 again, an empty input ends list creation.
7781 For all modes, if a given filename solely consists of the number sign
7782 .Ql #
7783 followed by either a valid message number of the currently active
7784 mailbox, or by a period
7785 .Ql \&. ,
7786 referring to the current message of the active mailbox, the so-called
7787 .Dq dot ,
7788 then the given message is attached as a
7789 .Ql message/rfc822
7790 MIME message part.
7791 The number sign must be quoted to avoid misinterpretation with the shell
7792 comment character.
7795 .It Ic ~| Ar command
7796 Pipe the message text through the specified filter command.
7797 If the command gives no output or terminates abnormally,
7798 retain the original text of the message.
7799 E.g., the command
7800 .Xr fmt 1
7801 is often used as a rejustifying filter.
7803 If the first character of the command is a vertical bar, then the entire
7804 message including header fields is subject to the filter command, e.g.,
7805 .Ql ~|| echo Fcc: /tmp/test; cat
7806 will prepend a file-carbon-copy message header.
7807 Also see
7808 .Ic ~e , ~v .
7812 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7813 Low-level compose mode command which shares semantic with
7814 .Ic digmsg .
7815 In general the first field of a response line represents a status code
7816 which specifies whether a command was successful or not, whether result
7817 data is to be expected, and if, the format of the result data.
7818 Does not manage the error number
7819 .Va \&!
7820 and the exit status
7821 .Va \&? ,
7822 because errors are reported via the protocol
7823 (hard errors like I/O failures cannot be handled).
7826 This command has read-only access to several virtual pseudo headers in
7827 the \*(UA private namespace which optionally (except for the
7828 non-optional first) exist in compose mode:
7832 .Bl -tag -compact -width ".It Va BaNg"
7833 .It Ql Mailx-Command:
7834 The name of the command that generates the message, one of
7835 .Ql forward ,
7836 .Ql Lreply ,
7837 .Ql mail ,
7838 .Ql Reply ,
7839 .Ql reply ,
7840 .Ql resend .
7842 .It Ql Mailx-Raw-To:
7843 .It Ql Mailx-Raw-Cc:
7844 .It Ql Mailx-Raw-Bcc:
7845 Represent the frozen initial state of these headers before any
7846 transformation (e.g.,
7847 .Ic alias ,
7848 .Ic alternates ,
7849 .Va recipients-in-cc
7850 etc.) took place.
7852 .It Ql Mailx-Orig-From:
7853 .It Ql Mailx-Orig-To:
7854 .It Ql Mailx-Orig-Cc:
7855 .It Ql Mailx-Orig-Bcc:
7856 The values of said headers of the original message which has been
7857 addressed by any of
7858 .Ic reply , forward , resend .
7863 Error status code lines may optionally contain additional context.
7864 The status codes are:
7868 .Bl -tag -compact -width ".It Ql 210"
7869 .It Ql 210
7870 Status ok; the remains of the line are the result.
7872 .It Ql 211
7873 Status ok; the rest of the line is optionally used for more status.
7874 What follows are lines of result addresses, terminated by an empty line.
7875 The address lines consist of two fields, the first of which is the
7876 plain address, e.g.,
7877 .Ql bob@exam.ple ,
7878 separated by a single ASCII SP space from the second which contains the
7879 unstripped address, even if that is identical to the first field, e.g.,
7880 .Ql (Lovely) Bob <bob@exam.ple> .
7881 Non-network addressees, however, place a single-letter indicating
7882 the address type in the first field (hyphen-minus
7883 .Ql -
7884 for files, vertical bar
7885 .Ql |
7886 for pipes, and number sign
7887 .Ql #
7888 for names: what is supposed to become expanded via
7889 .Ic alias Ns
7890 ), and only the second field contains a value.
7891 All the input, including the empty line, must be consumed before further
7892 commands can be issued.
7894 .It Ql 212
7895 Status ok; the rest of the line is optionally used for more status.
7896 What follows are lines of furtherly unspecified string content,
7897 terminated by an empty line.
7898 All the input, including the empty line, must be consumed before further
7899 commands can be issued.
7901 .It Ql 500
7902 Syntax error; invalid command.
7904 .It Ql 501
7905 Syntax error in parameters or arguments.
7907 .It Ql 505
7908 Error: an argument fails verification.
7909 For example an invalid address has been specified (also see
7910 .Va expandaddr ) ,
7911 or an attempt was made to modify anything in \*(UA's own namespace,
7912 or a modifying subcommand has been used on a read-only message.
7914 .It Ql 506
7915 Error: an otherwise valid argument is rendered invalid due to context.
7916 For example, a second address is added to a header which may consist of
7917 a single address only.
7922 If a command indicates failure then the message will have remained
7923 unmodified.
7924 Most commands can fail with
7925 .Ql 500
7926 if required arguments are missing (false command usage).
7927 The following (case-insensitive) commands are supported:
7930 .Bl -hang -width ".It Cm version"
7931 .It Cm version
7932 This command will print the protocol version via 210.
7934 .It Cm header
7935 This command allows listing, inspection, and editing of message headers.
7936 Header name case is not normalized, and case-insensitive comparison
7937 should be used when matching names.
7938 The second argument specifies the subcommand to apply, one of:
7940 .Bl -hang -width ".It Cm remove"
7941 .It Cm list
7942 Without a third argument a list of all yet existing headers is given via
7943 .Ql 210 ;
7944 this command is the default command of
7945 .Cm header
7946 if no second argument has been given.
7947 A third argument restricts output to the given header only, which may
7948 fail with
7949 .Ql 501
7950 if no such field is defined.
7952 .It Cm show
7953 Shows the content of the header given as the third argument.
7954 Dependent on the header type this may respond with
7955 .Ql 211
7957 .Ql 212 ;
7958 any failure results in
7959 .Ql 501 .
7961 .It Cm remove
7962 This will remove all instances of the header given as the third
7963 argument, reporting
7964 .Ql 210
7965 upon success,
7966 .Ql 501
7967 if no such header can be found, and
7968 Ql 505
7969 on \*(UA namespace violations.
7971 .It Cm remove-at
7972 This will remove from the header given as the third argument the
7973 instance at the list position (counting from one!) given with the fourth
7974 argument, reporting
7975 .Ql 210
7976 upon success or
7977 .Ql 505
7978 if the list position argument is not a number or on \*(UA namespace
7979 violations, and
7980 .Ql 501
7981 if no such header instance exists.
7983 .It Cm insert
7984 Create a new or an additional instance of the header given in the third
7985 argument, with the header body content as given in the fourth argument
7986 (the remains of the line).
7987 It may return
7988 .Ql 501
7989 if the third argument specifies a free-form header field name that is
7990 invalid, or if body content extraction fails to succeed,
7991 .Ql 505
7992 if any extracted address does not pass syntax and/or security checks or
7993 on \*(UA namespace violations, and
7994 .Ql 506
7995 to indicate prevention of excessing a single-instance header \(em note that
7996 .Ql Subject:
7997 can be appended to (a space separator will be added automatically first).
7999 .Ql 210
8000 is returned upon success, followed by the name of the header and the list
8001 position of the newly inserted instance.
8002 The list position is always 1 for single-instance header fields.
8003 All free-form header fields are managed in a single list.
8007 .It Cm attachment
8008 This command allows listing, removal and addition of message attachments.
8009 The second argument specifies the subcommand to apply, one of:
8011 .Bl -hang -width ".It Cm remove"
8012 .It Cm list
8013 List all attachments via
8014 .Ql 212 ,
8015 or report
8016 .Ql 501
8017 if no attachments exist.
8018 This command is the default command of
8019 .Cm attachment
8020 if no second argument has been given.
8022 .It Cm remove
8023 This will remove the attachment given as the third argument, and report
8024 .Ql 210
8025 upon success or
8026 .Ql 501
8027 if no such attachment can be found.
8028 If there exists any path component in the given argument, then an exact
8029 match of the path which has been used to create the attachment is used
8030 directly, but if only the basename of that path matches then all
8031 attachments are traversed to find an exact match first, and the removal
8032 occurs afterwards; if multiple basenames match, a
8033 .Ql 506
8034 error occurs.
8035 Message attachments are treated as absolute pathnames.
8037 If no path component exists in the given argument, then all attachments
8038 will be searched for
8039 .Ql filename=
8040 parameter matches as well as for matches of the basename of the path
8041 which has been used when the attachment has been created; multiple
8042 matches result in a
8043 .Ql 506 .
8045 .It Cm remove-at
8046 This will interpret the third argument as a number and remove the
8047 attachment at that list position (counting from one!), reporting
8048 .Ql 210
8049 upon success or
8050 .Ql 505
8051 if the argument is not a number or
8052 .Ql 501
8053 if no such attachment exists.
8055 .It Cm insert
8056 Adds the attachment given as the third argument, specified exactly as
8057 documented for the command line option
8058 .Fl a ,
8059 and supporting the message number extension as documented for
8060 .Ic ~@ .
8061 This reports
8062 .Ql 210
8063 upon success, with the index of the new attachment following,
8064 .Ql 505
8065 if the given file cannot be opened,
8066 .Ql 506
8067 if an on-the-fly performed character set conversion fails, otherwise
8068 .Ql 501
8069 is reported; this is also reported if character set conversion is
8070 requested but not available.
8072 .It Cm attribute
8073 This uses the same search mechanism as described for
8074 .Cm remove
8075 and prints any known attributes of the first found attachment via
8076 .Ql 212
8077 upon success or
8078 .Ql 501
8079 if no such attachment can be found.
8080 The attributes are written as lines of keyword and value tuples, the
8081 keyword being separated from the rest of the line with an ASCII SP space
8082 character.
8084 .It Cm attribute-at
8085 This uses the same search mechanism as described for
8086 .Cm remove-at
8087 and is otherwise identical to
8088 .Cm attribute .
8090 .It Cm attribute-set
8091 This uses the same search mechanism as described for
8092 .Cm remove ,
8093 and will assign the attribute given as the fourth argument, which is
8094 expected to be a value tuple of keyword and other data, separated by
8095 a ASCII SP space or TAB tabulator character.
8096 If the value part is empty, then the given attribute is removed, or
8097 reset to a default value if existence of the attribute is crucial.
8099 It returns via
8100 .Ql 210
8101 upon success, with the index of the found attachment following,
8102 .Ql 505
8103 for message attachments or if the given keyword is invalid, and
8104 .Ql 501
8105 if no such attachment can be found.
8106 The following keywords may be used (case-insensitively):
8108 .Bl -hang -compact -width ".It Ql filename"
8109 .It Ql filename
8110 Sets the filename of the MIME part, i.e., the name that is used for
8111 display and when (suggesting a name for) saving (purposes).
8112 .It Ql content-description
8113 Associate some descriptive information to the attachment's content, used
8114 in favour of the plain filename by some MUAs.
8115 .It Ql content-id
8116 May be used for uniquely identifying MIME entities in several contexts;
8117 this expects a special reference address format as defined in RFC 2045
8118 and generates a
8119 .Ql 505
8120 upon address content verification failure.
8121 .It Ql content-type
8122 Defines the media type/subtype of the part, which is managed
8123 automatically, but can be overwritten.
8124 .It Ql content-disposition
8125 Automatically set to the string
8126 .Ql attachment .
8129 .It Cm attribute-set-at
8130 This uses the same search mechanism as described for
8131 .Cm remove-at
8132 and is otherwise identical to
8133 .Cm attribute-set .
8139 .It Ic ~A
8140 The same as
8141 .Ql Ic ~i Ns \| Va Sign .
8144 .It Ic ~a
8145 The same as
8146 .Ql Ic ~i Ns \| Va sign .
8149 .It Ic ~b Ar name ...
8150 Add the given names to the list of blind carbon copy recipients.
8153 .It Ic ~c Ar name ...
8154 Add the given names to the list of carbon copy recipients.
8157 .It Ic ~d
8158 Read the file specified by the
8159 .Ev DEAD
8160 variable into the message.
8163 .It Ic ~e
8164 Invoke the text
8165 .Ev EDITOR
8166 on the message collected so far, then return to compose mode.
8167 .Ic ~v
8168 can be used for a more display oriented editor, and
8169 .Ic ~| Ns |
8170 offers a pipe-based editing approach.
8173 .It Ic ~F Ar messages
8174 Read the named messages into the message being sent, including all
8175 message headers and MIME parts.
8176 If no messages are specified, read in the current message, the
8177 .Dq dot .
8180 .It Ic ~f Ar messages
8181 Read the named messages into the message being sent.
8182 If no messages are specified, read in the current message, the
8183 .Dq dot .
8184 Strips down the list of header fields according to the
8185 .Ql type
8186 white- and blacklist selection of
8187 .Ic headerpick .
8188 For MIME multipart messages,
8189 only the first displayable part is included.
8192 .It Ic ~H
8193 Edit the message header fields
8194 .Ql From: ,
8195 .Ql Reply-To:
8197 .Ql Sender:
8198 by typing each one in turn and allowing the user to edit the field.
8199 The default values for these fields originate from the
8200 .Va from , reply-to
8202 .Va sender
8203 variables.
8206 .It Ic ~h
8207 Edit the message header fields
8208 .Ql To: ,
8209 .Ql Cc: ,
8210 .Ql Bcc:
8212 .Ql Subject:
8213 by typing each one in turn and allowing the user to edit the field.
8216 .It Ic ~I Ar variable
8217 Insert the value of the specified variable into the message.
8218 The message remains unaltered if the variable is unset or empty.
8219 Any embedded character sequences
8220 .Ql \et
8221 horizontal tabulator and
8222 .Ql \en
8223 line feed are expanded in
8224 .Va posix
8225 mode; otherwise the expansion should occur at
8226 .Ic set
8227 time (\*(ID by using the command modifier
8228 .Va wysh ) .
8231 .It Ic ~i Ar variable
8232 Like
8233 .Ic ~I ,
8234 but appends a newline character.
8237 .It Ic ~M Ar messages
8238 Read the named messages into the message being sent,
8239 indented by
8240 .Va indentprefix .
8241 If no messages are specified, read the current message, the
8242 .Dq dot .
8245 .It Ic ~m Ar messages
8246 Read the named messages into the message being sent,
8247 indented by
8248 .Va indentprefix .
8249 If no messages are specified, read the current message, the
8250 .Dq dot .
8251 Strips down the list of header fields according to the
8252 .Ql type
8253 white- and blacklist selection of
8254 .Ic headerpick .
8255 For MIME multipart messages,
8256 only the first displayable part is included.
8259 .It Ic ~p
8260 Display the message collected so far,
8261 prefaced by the message header fields
8262 and followed by the attachment list, if any.
8265 .It Ic ~Q
8266 Read in the given / current message(s) according to the algorithm of
8267 .Va quote .
8270 .It Ic ~q
8271 Abort the message being sent,
8272 copying it to the file specified by the
8273 .Ev DEAD
8274 variable if
8275 .Va save
8276 is set.
8279 .It Ic ~R Ar filename
8280 Identical to
8281 .Ic ~r ,
8282 but indent each line that has been read by
8283 .Va indentprefix .
8286 .It Ic ~r Ar filename Op Ar HERE-delimiter
8287 Read the named file, object to the usual
8288 .Sx "Filename transformations" ,
8289 into the message; if (the expanded)
8290 .Ar filename
8291 is the hyphen-minus
8292 .Ql -
8293 then standard input is used, e.g., for pasting purposes.
8294 Only in this latter mode
8295 .Ar HERE-delimiter
8296 may be given: if it is data will be read in until the given
8297 .Ar HERE-delimiter
8298 is seen on a line by itself, and encountering EOF is an error; the
8299 .Ar HERE-delimiter
8300 is a required argument in non-interactive mode; if it is single-quote
8301 quoted then the pasted content will not be expanded, \*(ID otherwise
8302 a future version of \*(UA may perform shell-style expansion on the content.
8305 .It Ic ~s Ar string
8306 Cause the named string to become the current subject field.
8307 Newline (NL) and carriage-return (CR) bytes are invalid and will be
8308 normalized to space (SP) characters.
8311 .It Ic ~t Ar name ...
8312 Add the given name(s) to the direct recipient list.
8315 .It Ic ~U Ar messages
8316 Read in the given / current message(s) excluding all headers, indented by
8317 .Va indentprefix .
8320 .It Ic ~u Ar messages
8321 Read in the given / current message(s), excluding all headers.
8324 .It Ic ~v
8325 Invoke the
8326 .Ev VISUAL
8327 editor on the message collected so far, then return to compose mode.
8328 .Ic ~e
8329 can be used for a less display oriented editor, and
8330 .Ic ~| Ns |
8331 offers a pipe-based editing approach.
8334 .It Ic ~w Ar filename
8335 Write the message onto the named file, which is object to the usual
8336 .Sx "Filename transformations" .
8337 If the file exists,
8338 the message is appended to it.
8341 .It Ic ~x
8342 Same as
8343 .Ic ~q ,
8344 except that the message is not saved at all.
8347 .\" }}}
8350 .\" .Sh INTERNAL VARIABLES {{{
8351 .Sh "INTERNAL VARIABLES"
8353 Internal \*(UA variables are controlled via the
8354 .Ic set
8356 .Ic unset
8357 commands; prefixing a variable name with the string
8358 .Ql no
8359 and calling
8360 .Ic set
8361 has the same effect as using
8362 .Ic unset :
8363 .Ql unset crt
8365 .Ql set nocrt
8366 do the same thing.
8367 .Ic varshow
8368 will give more insight on the given variable(s), and
8369 .Ic set ,
8370 when called without arguments, will show a listing of all variables.
8371 Both commands support a more
8372 .Va verbose
8373 listing mode.
8374 Some well-known variables will also become inherited from the
8375 program
8376 .Sx ENVIRONMENT
8377 implicitly, others can be imported explicitly with the command
8378 .Ic environ
8379 and henceforth share said properties.
8382 Two different kinds of internal variables exist, and both of which can
8383 also form chains.
8384 There are boolean variables, which can only be in one of the two states
8385 .Dq set
8387 .Dq unset ,
8388 and value variables with a(n optional) string value.
8389 For the latter proper quoting is necessary upon assignment time, the
8390 introduction of the section
8391 .Sx COMMANDS
8392 documents the supported quoting rules.
8394 .Bd -literal -offset indent
8395 ? wysh set one=val\e 1 two="val 2" \e
8396     three='val "3"' four=$'val \e'4\e''; \e
8397     varshow one two three four; \e
8398     unset one two three four
8402 Dependent upon the actual option string values may become interpreted as
8403 colour names, command specifications, normal text, etc.
8404 They may be treated as numbers, in which case decimal values are
8405 expected if so documented, but otherwise any numeric format and
8406 base that is valid and understood by the
8407 .Ic vexpr
8408 command may be used, too.
8411 There also exists a special kind of string value, the
8412 .Dq boolean string ,
8413 which must either be a decimal integer (in which case
8414 .Ql 0
8415 is false and
8416 .Ql 1
8417 and any other value is true) or any of the (case-insensitive) strings
8418 .Ql off ,
8419 .Ql no ,
8420 .Ql n
8422 .Ql false
8423 for a false boolean and
8424 .Ql on ,
8425 .Ql yes ,
8426 .Ql y
8428 .Ql true
8429 for a true boolean; a special kind of boolean string is the
8430 .Dq quadoption ,
8431 which is a boolean string that can optionally be prefixed with the
8432 (case-insensitive) term
8433 .Ql ask- ,
8434 as in
8435 .Ql ask-yes ,
8436 which causes prompting of the user in interactive mode, with the given
8437 boolean as the default value.
8440 Variable chains extend a plain
8441 .Ql variable
8442 with
8443 .Ql variable-HOST
8445 .Ql variable-USER@HOST
8446 variants.
8447 Here
8448 .Ql HOST
8449 will be converted to all lowercase when looked up (but not when the
8450 variable is set or unset!), \*(OPally IDNA converted, and indeed means
8451 .Ql server:port
8452 if a
8453 .Ql port
8454 had been specified in the contextual Uniform Resource Locator URL, see
8455 .Sx "On URL syntax and credential lookup" .
8456 Even though this mechanism is based on URLs no URL percent encoding may
8457 be applied to neither of
8458 .Ql USER
8460 .Ql HOST ,
8461 variable chains need to be specified using raw data;
8462 the mentioned section contains examples.
8463 Variables which support chains are explicitly documented as such, and
8464 \*(UA treats the base name of any such variable special, meaning that
8465 users should not create custom names like
8466 .Ql variable-xyz
8467 in order to avoid false classifications and treatment of such variables.
8469 .\" .Ss "Initial settings" {{{
8470 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
8471 .Ss "Initial settings"
8473 The standard POSIX 2008/Cor 2-2016 mandates the following initial
8474 variable settings:
8475 .Pf no Va allnet ,
8476 .Pf no Va append ,
8477 .Va asksub ,
8478 .Pf no Va askbcc ,
8479 .Pf no Va autoprint ,
8480 .Pf no Va bang ,
8481 .Pf no Va cmd ,
8482 .Pf no Va crt ,
8483 .Pf no Va debug ,
8484 .Pf no Va dot ,
8485 .Va escape
8486 set to
8487 .Ql ~ ,
8488 .Pf no Va flipr ,
8489 .Pf no Va folder ,
8490 .Va header ,
8491 .Pf no Va hold ,
8492 .Pf no Va ignore ,
8493 .Pf no Va ignoreeof ,
8494 .Pf no Va keep ,
8495 .Pf no Va keepsave ,
8496 .Pf no Va metoo ,
8497 .Pf no Va outfolder ,
8498 .Pf no Va page ,
8499 .Va prompt
8500 set to
8501 .Ql ?\0 ,
8502 .Pf no Va quiet ,
8503 .Pf no Va record ,
8504 .Va save ,
8505 .Pf no Va sendwait ,
8506 .Pf no Va showto ,
8507 .Pf no Va Sign ,
8508 .Pf no Va sign ,
8509 .Va toplines
8510 set to
8511 .Ql 5 .
8514 Notes: \*(UA does not support the
8515 .Pf no Va onehop
8516 variable \(en use command line options or
8517 .Va mta-arguments
8518 to pass options through to a
8519 .Va mta .
8520 And the default global
8521 .Pa \*(UR
8522 file, which is loaded unless the
8523 .Fl \&:
8524 (with according argument) or
8525 .Fl n
8526 command line options have been used, or the
8527 .Ev MAILX_NO_SYSTEM_RC
8528 environment variable is set (see
8529 .Sx "Resource files" )
8530 bends those initial settings a bit, e.g., it sets the variables
8531 .Va hold ,
8532 .Va keepsave
8534 .Va keep ,
8535 to name a few, establishes a default
8536 .Ic headerpick
8537 selection etc., and should thus be taken into account.
8538 .\" }}}
8540 .\" .Ss "Variables" {{{
8541 .Ss "Variables"
8543 .Bl -tag -width ".It Va BaNg"
8546 .It Va \&?
8547 \*(RO The exit status of the last command, or the
8548 .Ic return
8549 value of the macro
8550 .Ic call Ns
8551 ed last.
8552 This status has a meaning in the state machine: in conjunction with
8553 .Va errexit
8554 any non-0 exit status will cause a program exit, and in
8555 .Va posix
8556 mode any error while loading (any of the) resource files will have the
8557 same effect.
8558 .Cm ignerr ,
8559 one of the
8560 .Sx "Command modifiers" ,
8561 can be used to instruct the state machine to ignore errors.
8564 .It Va \&!
8565 \*(RO The current error number
8566 .Pf ( Xr errno 3 ) ,
8567 which is set after an error occurred; it is also available via
8568 .Va ^ERR ,
8569 and the error name and documentation string can be queried via
8570 .Va ^ERRNAME
8572 .Va ^ERRDOC .
8573 \*(ID This machinery is new and the error number is only really usable
8574 if a command explicitly states that it manages the variable
8575 .Va \&! ,
8576 for others errno will be used in case of errors, or
8577 .Va ^ERR Ns -INVAL
8578 if that is 0: it thus may or may not reflect the real error.
8579 The error number may be set with the command
8580 .Ic return .
8584 .It Va ^
8585 \*(RO This is a multiplexer variable which performs dynamic expansion of
8586 the requested state or condition, of which there are:
8589 .Bl -tag -compact -width ".It Va BaNg"
8593 .It Va ^ERR , ^ERRDOC , ^ERRNAME
8594 The number, documentation, and name of the current
8595 .Xr errno 3 ,
8596 respectively, which is usually set after an error occurred.
8597 The documentation is an \*(OP, the name is used if not available.
8598 \*(ID This machinery is new and is usually reliable only if a command
8599 explicitly states that it manages the variable
8600 .Va \&! ,
8601 which is effectively identical to
8602 .Va \&\&^ERR .
8603 Each of those variables can be suffixed with a hyphen minus followed by
8604 a name or number, in which case the expansion refers to the given error.
8605 Note this is a direct mapping of (a subset of) the system error values:
8606 .Bd -literal -offset indent
8607 define work {
8608   eval echo \e$1: \e$^ERR-$1:\e
8609     \e$^ERRNAME-$1: \e$^ERRDOC-$1
8610   vput vexpr i + "$1" 1
8611   if [ $i -lt 16 ]
8612     \excall work $i
8613   end
8615 call work 0
8621 .It Va *
8622 \*(RO Expands all positional parameters (see
8623 .Va 1 ) ,
8624 separated by the first character of the value of
8625 .Va ifs .
8626 \*(ID The special semantics of the equally named special parameter of the
8627 .Xr sh 1
8628 are not yet supported.
8631 .It Va @
8632 \*(RO Expands all positional parameters (see
8633 .Va 1 ) ,
8634 separated by a space character.
8635 If placed in double quotation marks, each positional parameter is
8636 properly quoted to expand to a single parameter again.
8639 .It Va #
8640 \*(RO Expands to the number of positional parameters, i.e., the size of
8641 the positional parameter stack in decimal.
8644 .It Va \&0
8645 \*(RO Inside the scope of a
8646 .Ic define Ns
8647 d and
8648 .Ic call Ns
8649 ed macro this expands to the name of the calling macro, or to the empty
8650 string if the macro is running from top-level.
8651 For the \*(OPal regular expression search and replace operator of
8652 .Ic vexpr
8653 this expands to the entire matching expression.
8654 It represents the program name in global context.
8657 .It Va 1
8658 \*(RO Access of the positional parameter stack.
8659 All further parameters can be accessed with this syntax, too, e.g.,
8660 .Ql 2 ,
8661 .Ql 3
8662 etc.; positional parameters can be shifted off the stack by calling
8663 .Ic shift .
8664 The parameter stack contains, e.g., the arguments of a
8665 .Ic call Ns
8667 .Ic define Ns
8668 d macro, the matching groups of the \*(OPal regular expression search
8669 and replace expression of
8670 .Ic vexpr ,
8671 and can be explicitly created or overwritten with the command
8672 .Ic vpospar .
8675 .It Va account
8676 \*(RO Is set to the active
8677 .Ic account .
8680 .It Va add-file-recipients
8681 \*(BO When file or pipe recipients have been specified,
8682 mention them in the corresponding address fields of the message instead
8683 of silently stripping them from their recipient list.
8684 By default such addressees are not mentioned.
8687 .It Va allnet
8688 \*(BO Causes only the local part to be evaluated
8689 when comparing addresses.
8692 .It Va append
8693 \*(BO Causes messages saved in the
8694 .Mx -sx
8695 .Sx "secondary mailbox"
8696 .Ev MBOX
8697 to be appended to the end rather than prepended.
8698 This should always be set.
8701 .It Va askatend
8702 \*(BO Causes the prompts for
8703 .Ql Cc:
8705 .Ql Bcc:
8706 lists to appear after the message has been edited.
8709 .It Va askattach
8710 \*(BO If set, \*(UA asks for files to attach at the end of each message.
8711 An empty line finalizes the list.
8714 .It Va askcc
8715 \*(BO Causes the user to be prompted for carbon copy recipients
8716 (at the end of each message if
8717 .Va askatend
8719 .Va bsdcompat
8720 are set).
8723 .It Va askbcc
8724 \*(BO Causes the user to be prompted for blind carbon copy
8725 recipients (at the end of each message if
8726 .Va askatend
8728 .Va bsdcompat
8729 are set).
8732 .It Va asksend
8733 \*(BO Causes the user to be prompted for confirmation to send the
8734 message or reenter compose mode after having been shown an envelope
8735 summary.
8736 This is by default enabled.
8739 .It Va asksign
8740 \*(BO\*(OP Causes the user to be prompted if the message is to be
8741 signed at the end of each message.
8743 .Va smime-sign
8744 variable is ignored when this variable is set.
8747 .It Va asksub
8748 .\" The alternative *ask* is not documented on purpose
8749 \*(BO Causes \*(UA to prompt for the subject upon entering compose mode
8750 unless a subject already exists.
8753 .It Va attrlist
8754 A sequence of characters to display in the
8755 .Ql attribute
8756 column of the
8757 .Va headline
8758 as shown in the display of
8759 .Ic headers ;
8760 each for one type of messages (see
8761 .Sx "Message states" ) ,
8762 with the default being
8763 .Ql NUROSPMFAT+\-$~
8765 .Ql NU\ \ *HMFAT+\-$~
8766 if the
8767 .Va bsdflags
8768 variable is set, in the following order:
8770 .Bl -tag -compact -width ".It Ql _"
8771 .It Ql N
8772 new.
8773 .It Ql U
8774 unread but old.
8775 .It Ql R
8776 new but read.
8777 .It Ql O
8778 read and old.
8779 .It Ql S
8780 saved.
8781 .It Ql P
8782 preserved.
8783 .It Ql M
8784 mboxed.
8785 .It Ql F
8786 flagged.
8787 .It Ql A
8788 answered.
8789 .It Ql T
8790 draft.
8791 .It Ql +
8792 \*(ID start of a (collapsed) thread in threaded mode (see
8793 .Va autosort ,
8794 .Ic thread ) ;
8795 .It Ql -
8796 \*(ID an uncollapsed thread in threaded mode; only used in conjunction with
8797 .Fl L .
8798 .It Ql $
8799 classified as spam.
8800 .It Ql ~
8801 classified as possible spam.
8806 .It Va autobcc
8807 Specifies a list of recipients to which a blind carbon copy of each
8808 outgoing message will be sent automatically.
8811 .It Va autocc
8812 Specifies a list of recipients to which a carbon copy of each outgoing
8813 message will be sent automatically.
8816 .It Va autocollapse
8817 \*(BO Causes threads to be collapsed automatically when .Ql thread Ns
8819 .Ic sort
8820 mode is entered (see the
8821 .Ic collapse
8822 command).
8825 .It Va autoprint
8826 \*(BO Enable automatic
8827 .Ic type Ns
8828 ing of a(n existing)
8829 .Dq successive
8830 message after
8831 .Ic delete
8833 .Ic undelete
8834 commands, e.g., the message that becomes the new
8835 .Dq dot
8836 is shown automatically, as via
8837 .Ic dp
8839 .Ic dt .
8842 .It Va autosort
8843 Causes sorted mode (see the
8844 .Ic sort
8845 command) to be entered automatically with the value of this variable as
8846 sorting method when a folder is opened, e.g.,
8847 .Ql set autosort=thread .
8850 .It Va bang
8851 \*(BO Enables the substitution of all not (reverse-solidus) escaped
8852 exclamation mark
8853 .Ql \&!
8854 characters by the contents of the last executed command for the
8855 .Ic \&!
8856 shell escape command and
8857 .Ic ~! ,
8858 one of the compose mode
8859 .Sx "COMMAND ESCAPES" .
8860 If this variable is not set no reverse solidus stripping is performed.
8863 .It Va bind-timeout
8864 \*(OP Terminals generate multi-byte sequences for certain forms of
8865 input, for example for function and other special keys.
8866 Some terminals however do not write these multi-byte sequences as
8867 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
8868 This variable specifies the timeout in milliseconds that the MLE (see
8869 .Sx "On terminal control and line editor" )
8870 waits for more bytes to arrive unless it considers a sequence
8871 .Dq complete .
8872 The default is 200.
8875 .It Va bsdcompat
8876 \*(BO Sets some cosmetical features to traditional BSD style;
8877 has the same affect as setting
8878 .Va askatend
8879 and all other variables prefixed with
8880 .Ql bsd ;
8881 it also changes the behaviour of
8882 .Va emptystart
8883 (which does not exist in BSD).
8886 .It Va bsdflags
8887 \*(BO Changes the letters shown in the first column of a header
8888 summary to traditional BSD style.
8891 .It Va bsdheadline
8892 \*(BO Changes the display of columns in a header summary to traditional
8893 BSD style.
8896 .It Va bsdmsgs
8897 \*(BO Changes some informational messages to traditional BSD style.
8900 .It Va bsdorder
8901 \*(BO Causes the
8902 .Ql Subject:
8903 field to appear immediately after the
8904 .Ql To:
8905 field in message headers and with the
8906 .Ic ~h
8907 .Sx "COMMAND ESCAPES" .
8913 .It Va build-cc , build-ld , build-os , build-rest
8914 \*(RO The build environment, including the compiler, the linker, the
8915 operating system \*(UA has been build for, usually taken from
8916 .Xr uname 1
8918 .Ql uname -s ,
8919 and then lowercased, as well as all the rest that may possibly be useful
8920 to include in a bug report, respectively.
8923 .It Va charset-7bit
8924 The value that should appear in the
8925 .Ql charset=
8926 parameter of
8927 .Ql Content-Type:
8928 MIME header fields when no character set conversion of the message data
8929 was performed.
8930 This defaults to US-ASCII, and the chosen character set should be
8931 US-ASCII compatible.
8934 .It Va charset-8bit
8935 \*(OP The default 8-bit character set that is used as an implicit last
8936 member of the variable
8937 .Va sendcharsets .
8938 This defaults to UTF-8 if character set conversion capabilities are
8939 available, and to ISO-8859-1 otherwise (unless the operating system
8940 environment is known to always and exclusively support UTF-8 locales),
8941 in which case the only supported character set is
8942 .Va ttycharset
8943 and this variable is effectively ignored.
8944 Refer to the section
8945 .Sx "Character sets"
8946 for the complete picture of character set conversion in \*(UA.
8949 .It Va charset-unknown-8bit
8950 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8951 .Dq upgrade
8952 the content of a mail message by using a character set with the name
8953 .Ql unknown-8bit .
8954 Because of the unclassified nature of this character set \*(UA will not
8955 be capable to convert this character set to any other character set.
8956 If this variable is set any message part which uses the character set
8957 .Ql unknown-8bit
8958 is assumed to really be in the character set given in the value,
8959 otherwise the (final) value of
8960 .Va charset-8bit
8961 is used for this purpose.
8963 This variable will also be taken into account if a MIME type (see
8964 .Sx "The mime.types files" )
8965 of a MIME message part that uses the
8966 .Ql binary
8967 character set is forcefully treated as text.
8970 .It Va cmd
8971 The default value for the
8972 .Ic pipe
8973 command.
8976 .It Va colour-disable
8977 \*(BO\*(OP Forcefully disable usage of colours.
8978 Also see the section
8979 .Sx "Coloured display" .
8982 .It Va colour-pager
8983 \*(BO\*(OP Whether colour shall be used for output that is paged through
8984 .Ev PAGER .
8985 Note that pagers may need special command line options, e.g.,
8986 .Xr less 1
8987 requires the option
8988 .Fl \&\&R
8990 .Xr lv 1
8991 the option
8992 .Fl \&\&c
8993 in order to support colours.
8994 Often doing manual adjustments is unnecessary since \*(UA may perform
8995 adjustments dependent on the value of the environment variable
8996 .Ev PAGER
8997 (see there for more).
9001 .It Va contact-mail , contact-web
9002 \*(RO Addresses for contact per email and web, respectively, e.g., for
9003 bug reports, suggestions, or help regarding \*(UA.
9004 The former can be used directly:
9005 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
9008 .It Va crt
9009 In a(n interactive) terminal session, then if this valued variable is
9010 set it will be used as a threshold to determine how many lines the given
9011 output has to span before it will be displayed via the configured
9012 .Ev PAGER ;
9013 Usage of the
9014 .Ev PAGER
9015 can be forced by setting this to the value
9016 .Ql 0 ,
9017 setting it without a value will deduce the current height of the
9018 terminal screen to compute the threshold (see
9019 .Ev LINES ,
9020 .Va screen
9022 .Xr stty 1 ) .
9023 \*(ID At the moment this uses the count of lines of the message in wire
9024 format, which, dependent on the
9025 .Va mime-encoding
9026 of the message, is unrelated to the number of display lines.
9027 (The software is old and historically the relation was a given thing.)
9030 .It Va customhdr
9031 Define a set of custom headers to be injected into newly composed or
9032 forwarded messages.
9033 A custom header consists of the field name followed by a colon
9034 .Ql \&:
9035 and the field content body.
9036 Standard header field names cannot be overwritten by a custom header.
9037 Different to the command line option
9038 .Fl C
9039 the variable value is interpreted as a comma-separated list of custom
9040 headers: to include commas in header bodies they need to become escaped
9041 with reverse solidus
9042 .Ql \e .
9043 Headers can be managed more freely in compose mode via
9044 .Ic ~^ .
9046 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
9049 .It Va datefield
9050 Controls the appearance of the
9051 .Ql %d
9052 date and time format specification of the
9053 .Va headline
9054 variable, that is used, for example, when viewing the summary of
9055 .Ic headers .
9056 If unset, then the local receiving date is used and displayed
9057 unformatted, otherwise the message sending
9058 .Ql Date: .
9059 It is possible to assign a
9060 .Xr strftime 3
9061 format string and control formatting, but embedding newlines via the
9062 .Ql %n
9063 format is not supported, and will result in display errors.
9064 The default is
9065 .Ql %Y-%m-%d %H:%M ,
9066 and also see
9067 .Va datefield-markout-older .
9070 .It Va datefield-markout-older
9071 Only used in conjunction with
9072 .Va datefield .
9073 Can be used to create a visible distinction of messages dated more than
9074 a day in the future, or older than six months, a concept comparable to the
9075 .Fl \&\&l
9076 option of the POSIX utility
9077 .Xr ls 1 .
9078 If set to the empty string, then the plain month, day and year of the
9079 .Ql Date:
9080 will be displayed, but a
9081 .Xr strftime 3
9082 format string to control formatting can be assigned.
9083 The default is
9084 .Ql %Y-%m-%d .
9087 .It Va debug
9088 \*(BO Enables debug messages and obsoletion warnings, disables the
9089 actual delivery of messages and also implies
9090 .Pf no Va record
9091 as well as
9092 .Pf no Va save .
9095 .It Va disposition-notification-send
9096 \*(BO\*(OP Emit a
9097 .Ql Disposition-Notification-To:
9098 header (RFC 3798) with the message.
9099 This requires the
9100 .Va from
9101 variable to be set.
9102 .\" TODO .It Va disposition-notification-send-HOST
9103 .\"Overrides
9104 .\".Va disposition-notification-send
9105 .\" for SMTP accounts on a specific host.
9106 .\" TODO .It Va disposition-notification-send-USER@HOST
9107 .\"Overrides
9108 .\".Va disposition-notification-send
9109 .\"for a specific account.
9112 .It Va dot
9113 \*(BO When dot is set, a period
9114 .Ql \&.
9115 on a line by itself during message input in (interactive or batch
9116 .Fl # )
9117 compose mode will be treated as end-of-message (in addition to the
9118 normal end-of-file condition).
9119 This behaviour is implied in
9120 .Va posix
9121 mode with a set
9122 .Va ignoreeof .
9125 .It Va dotlock-disable
9126 \*(BO\*(OP Disable creation of
9127 .Mx -sx
9128 .Sx "dotlock files"
9129 for MBOX databases.
9131 .It Va dotlock-ignore-error
9132 \*(OB\*(BO\*(OP Ignore failures when creating
9133 .Mx -sx
9134 .Sx "dotlock files" .
9135 Please use
9136 .Va dotlock-disable
9137 instead.
9140 .It Va editalong
9141 If this variable is set then the editor is started automatically when
9142 a message is composed in interactive mode.
9143 If the value starts with the letter
9144 .Ql v
9145 then this acts as if
9146 .Ic ~v ,
9147 otherwise as if
9148 .Ic ~e
9149 .Pf (see\0 Sx "COMMAND ESCAPES" )
9150 had been specified.
9152 .Va editheaders
9153 variable is implied for this automatically spawned editor session.
9156 .It Va editheaders
9157 \*(BO When a message is edited while being composed,
9158 its header is included in the editable text.
9161 .It Va emptystart
9162 \*(BO When entering interactive mode \*(UA normally writes
9163 .Dq \&No mail for user
9164 and exits immediately if a mailbox is empty or does not exist.
9165 If this variable is set \*(UA starts even with an empty or non-existent
9166 mailbox (the latter behaviour furtherly depends upon
9167 .Va bsdcompat ,
9168 though).
9171 .It Va errexit
9172 \*(BO Let each command with a non-0 exit status, including every
9173 .Ic call Ns
9174 ed macro which
9175 .Ic return Ns
9176 s a non-0 status, cause a program exit unless prefixed by
9177 .Cm ignerr
9178 (see
9179 .Sx "Command modifiers" ) .
9180 This also affects
9181 .Sx "COMMAND ESCAPES" ,
9182 but which use a different modifier for ignoring the error.
9183 Please refer to the variable
9184 .Va \&?
9185 for more on this topic.
9188 .It Va escape
9189 The first character of this value defines the escape character for
9190 .Sx "COMMAND ESCAPES"
9191 in compose mode.
9192 The default value is the character tilde
9193 .Ql ~ .
9194 If set to the empty string, command escapes are disabled.
9197 .It Va expandaddr
9198 If unset then file and command pipeline address targets are not allowed,
9199 and any such address will be filtered out, giving a warning message.
9200 If set then all possible recipient address specifications will be
9201 accepted unless a possible value content is more specific (also see
9202 .Sx "On sending mail, and non-interactive mode" ) ;
9203 if desired so only in interactive mode, or when tilde commands were
9204 enabled explicitly via
9205 .Fl ~
9207 .Fl # ,
9208 the (case-insensitive) value
9209 .Ql restrict
9210 can be used (this really acts like
9211 .Ql restrict,-all,+name,+addr ,
9212 so that care for ordering issues must be taken).
9214 The value is actually interpreted as a comma-separated list.
9215 If that contains
9216 .Ql fail
9217 the existence of disallowed addressees is treated as a hard send error
9218 instead of only causing them to be filtered out.
9219 Address targets can be added and subtracted by prefixing with a plus sign
9220 .Ql +
9221 or hyphen-minus
9222 .Ql -
9223 prefix: the value
9224 .Ql all
9225 addresses all possible address specifications,
9226 .Ql file
9227 file targets,
9228 .Ql pipe
9229 command pipeline targets,
9230 .Ql name
9231 plain user names and (MTA) aliases and
9232 .Ql addr
9233 network addresses;
9234 Targets are interpreted in the given order, so that
9235 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
9236 will cause hard errors for any non-network address recipient address
9237 unless \*(UA is in interactive mode or has been started with the
9238 .Fl ~
9240 .Fl #
9241 command line option; in the latter case(s) any address may be used, then.
9243 Historically invalid network addressees were silently stripped off.
9244 To change this so that any encountered invalid email address causes
9245 a hard error it must be ensured that
9246 .Ql failinvaddr
9247 is an entry in the above list, which automatically enables network
9248 addressees; it really acts like
9249 .Ql failinvaddr,+addr ,
9250 so that care for ordering issues must be taken.
9251 \*(ID If the value
9252 .Ql shquote
9253 is present a few address providers (for example
9254 .Fl b , c
9255 and all recipients given on the command line) will be will evaluated as
9256 if specified within dollar-single-quotes (see
9257 .Sx "Shell-style argument quoting" ) .
9260 .It Va expandargv
9261 Unless this variable is set additional
9262 .Va mta
9263 (Mail-Transfer-Agent)
9264 arguments from the command line, as can be given after a
9265 .Fl \&\&-
9266 separator, results in a program termination with failure status.
9267 The same can be accomplished by using the special (case-insensitive) value
9268 .Ql fail .
9269 A lesser strict variant is the otherwise identical
9270 .Ql restrict ,
9271 which does accept such arguments in interactive mode, or if tilde
9272 commands were enabled explicitly by using one of the command line options
9273 .Fl ~
9275 .Fl # .
9276 The empty value will allow unconditional usage.
9279 .It Va features
9280 \*(RO String giving a list of optional features.
9281 Features are preceded with a plus sign
9282 .Ql +
9283 if they are available, with a hyphen-minus
9284 .Ql -
9285 otherwise.
9286 The output of the command
9287 .Ic version
9288 will include this information in a more pleasant output.
9291 .It Va flipr
9292 \*(BO This setting reverses the meanings of a set of reply commands,
9293 turning the lowercase variants, which by default address all recipients
9294 included in the header of a message
9295 .Pf ( Ic reply , respond , followup )
9296 into the uppercase variants, which by default address the sender only
9297 .Pf ( Ic Reply , Respond , Followup )
9298 and vice versa.
9299 The commands
9300 .Ic replysender , respondsender , followupsender
9301 as well as
9302 .Ic replyall , respondall , followupall
9303 are not affected by the current setting of
9304 .Va flipr .
9307 .It Va folder
9308 The default path under which mailboxes are to be saved:
9309 filenames that begin with the plus sign
9310 .Ql +
9311 will have the plus sign replaced with the value of this variable if set,
9312 otherwise the plus sign will remain unchanged when doing
9313 .Sx "Filename transformations" ;
9314 also see
9315 .Ic file
9316 for more on this topic, and know about standard imposed implications of
9317 .Va outfolder .
9318 The value supports a subset of transformations itself, and if the
9319 non-empty value does not start with a solidus
9320 .Ql / ,
9321 then the value of
9322 .Ev HOME
9323 will be prefixed automatically.
9324 Once the actual value is evaluated first, the internal variable
9325 .Va folder-resolved
9326 will be updated for caching purposes.
9328 .Mx Va folder-hook
9329 .It Va folder-hook-FOLDER , Va folder-hook
9330 Names a
9331 .Ic define Ns d
9332 macro which will be called whenever a
9333 .Ic file
9334 is opened.
9335 The macro will also be invoked when new mail arrives,
9336 but message lists for commands executed from the macro
9337 only include newly arrived messages then.
9338 .Ic localopts
9339 are activated by default in a folder hook, causing the covered settings
9340 to be reverted once the folder is left again.
9342 The specialized form will override the generic one if
9343 .Ql FOLDER
9344 matches the file that is opened.
9345 Unlike other folder specifications, the fully expanded name of a folder,
9346 without metacharacters, is used to avoid ambiguities.
9347 However, if the mailbox resides under
9348 .Va folder
9349 then the usual
9350 .Ql +
9351 specification is tried in addition, e.g., if
9352 .Va \&\&folder
9354 .Dq mail
9355 (and thus relative to the user's home directory) then
9356 .Pa /home/usr1/mail/sent
9357 will be tried as
9358 .Ql folder-hook-/home/usr1/mail/sent
9359 first, but then followed by
9360 .Ql folder-hook-+sent .
9363 .It Va folder-resolved
9364 \*(RO Set to the fully resolved path of
9365 .Va folder
9366 once that evaluation has occurred; rather internal.
9369 .It Va followup-to
9370 \*(BO Controls whether a
9371 .Ql Mail-Followup-To:
9372 header is generated when sending messages to known mailing lists.
9373 Also see
9374 .Va followup-to-honour
9375 and the commands
9376 .Ic mlist , mlsubscribe , reply
9378 .Ic Lreply .
9381 .It Va followup-to-honour
9382 Controls whether a
9383 .Ql Mail-Followup-To:
9384 header is honoured when group-replying to a message via
9385 .Ic reply
9387 .Ic Lreply .
9388 This is a quadoption; if set without a value it defaults to
9389 .Dq yes .
9390 Also see
9391 .Va followup-to
9392 and the commands
9393 .Ic mlist
9395 .Ic mlsubscribe .
9398 .It Va forward-as-attachment
9399 \*(BO Original messages are normally sent as inline text with the
9400 .Ic forward
9401 command,
9402 and only the first part of a multipart message is included.
9403 With this setting enabled messages are sent as unmodified MIME
9404 .Ql message/rfc822
9405 attachments with all of their parts included.
9409 .It Va forward-inject-head , forward-inject-tail
9410 The strings to put before and after the text of a message with the
9411 .Ic forward
9412 command, respectively.
9413 The former defaults to
9414 .Ql -------- Original Message --------\en .
9415 Special format directives in these strings will be expanded if possible,
9416 and if so configured the output will be folded according to
9417 .Va quote-fold ;
9418 for more please refer to
9419 .Va quote-inject-head .
9420 These variables are ignored if the
9421 .Va forward-as-attachment
9422 variable is set.
9426 .It Va from
9427 The address (or a list of addresses) to put into the
9428 .Ql From:
9429 field of the message header, quoting RFC 5322:
9430 the author(s) of the message, that is, the mailbox(es) of the person(s)
9431 or system(s) responsible for the writing of the message.
9432 According to that RFC setting the
9433 .Va sender
9434 variable is required if
9435 .Va \&\&from
9436 contains more than one address.
9437 Dependent on the context these addresses are handled as if they were in
9438 the list of
9439 .Ic alternates .
9442 If a file-based MTA is used, then
9443 .Va \&\&from
9444 (or, if that contains multiple addresses,
9445 .Va sender )
9446 can nonetheless be enforced to appear as the envelope sender address at
9447 the MTA protocol level (the RFC 5321 reverse-path), either by using the
9448 .Fl r
9449 command line option (with an empty argument; see there for the complete
9450 picture on this topic), or by setting the internal variable
9451 .Va r-option-implicit .
9454 If the machine's hostname is not valid at the Internet (for example at
9455 a dialup machine) then either this variable or
9456 .Va hostname
9457 (\*(IN a SMTP-based
9458 .Va mta
9459 adds even more fine-tuning capabilities with
9460 .Va smtp-hostname )
9461 have to be set: if so the message and MIME part related unique ID fields
9462 .Ql Message-ID:
9464 .Ql Content-ID:
9465 will be created (except when disallowed by
9466 .Va message-id-disable
9468 .Va stealthmua ) .
9472 .It Va fullnames
9473 \*(BO Due to historical reasons comments and name parts of email
9474 addresses are removed by default when sending mail, replying to or
9475 forwarding a message.
9476 If this variable is set such stripping is not performed.
9478 .It Va fwdheading
9479 \*(OB Predecessor of
9480 .Va forward-inject-head .
9483 .It Va header
9484 \*(BO Causes the header summary to be written at startup and after
9485 commands that affect the number of messages or the order of messages in
9486 the current
9487 .Ic folder .
9488 Unless in
9489 .Va posix
9490 mode a header summary will also be displayed on folder changes.
9491 The command line option
9492 .Fl N
9493 can be used to set
9494 .Pf no Va header .
9498 .It Va headline
9499 A format string to use for the summary of
9500 .Ic headers .
9501 Format specifiers in the given string start with a percent sign
9502 .Ql %
9503 and may be followed by an optional decimal number indicating the field
9504 width \(em if that is negative, the field is to be left-aligned.
9505 Names and addresses are subject to modifications according to
9506 .Va showname
9508 .Va showto .
9509 Valid format specifiers are:
9512 .Bl -tag -compact -width ".It Ql _%%_"
9513 .It Ql %%
9514 A plain percent sign.
9515 .It Ql %>
9516 .Dq Dotmark :
9517 a space character but for the current message
9518 .Pf ( Dq dot ) ,
9519 for which it expands to
9520 .Ql >
9521 (dependent on
9522 .Va headline-plain ) .
9523 .It Ql %<
9524 .Dq Dotmark :
9525 a space character but for the current message
9526 .Pf ( Dq dot ) ,
9527 for which it expands to
9528 .Ql <
9529 (dependent on
9530 .Va headline-plain ) .
9531 .It Ql %$
9532 \*(OP The spam score of the message, as has been classified via the
9533 command
9534 .Ic spamrate .
9535 Shows only a replacement character if there is no spam support.
9536 .It Ql %a
9537 Message attribute character (status flag); the actual content can be
9538 adjusted by setting
9539 .Va attrlist .
9540 .It Ql %d
9541 The date found in the
9542 .Ql Date:
9543 header of the message when
9544 .Va datefield
9545 is set (the default), otherwise the date when the message was received.
9546 Formatting can be controlled by assigning a
9547 .Xr strftime 3
9548 format string to
9549 .Va datefield
9550 (and
9551 .Va datefield-markout-older ) .
9552 .It Ql %e
9553 The indenting level in
9554 .Ql thread Ns
9556 .Ic sort
9557 mode.
9558 .It Ql %f
9559 The address of the message sender.
9560 .It Ql %i
9561 The message thread tree structure.
9562 (Note that this format does not support a field width, and honours
9563 .Va headline-plain . )
9564 .It Ql %l
9565 The number of lines of the message, if available.
9566 .It Ql %m
9567 Message number.
9568 .It Ql %o
9569 The number of octets (bytes) in the message, if available.
9570 .It Ql %s
9571 Message subject (if any).
9572 .It Ql %S
9573 Message subject (if any) in double quotes.
9574 .It Ql \&%T
9575 Message recipient flags: is the addressee of the message a known or
9576 subscribed mailing list \(en see
9577 .Ic mlist
9579 .Ic mlsubscribe .
9580 .It Ql %t
9581 The position in threaded/sorted order.
9582 .It Ql \&%U
9583 The value 0 except in an IMAP mailbox,
9584 where it expands to the UID of the message.
9587 The default is
9588 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
9590 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
9592 .Va bsdcompat
9593 is set.
9594 Also see
9595 .Va attrlist ,
9596 .Va headline-plain
9598 .Va headline-bidi .
9602 .It Va headline-bidi
9603 Bidirectional text requires special treatment when displaying headers,
9604 because numbers (in dates or for file sizes etc.) will not affect the
9605 current text direction, in effect resulting in ugly line layouts when
9606 arabic or other right-to-left text is to be displayed.
9607 On the other hand only a minority of terminals is capable to correctly
9608 handle direction changes, so that user interaction is necessary for
9609 acceptable results.
9610 Note that extended host system support is required nonetheless, e.g.,
9611 detection of the terminal character set is one precondition;
9612 and this feature only works in an Unicode (i.e., UTF-8) locale.
9614 In general setting this variable will cause \*(UA to encapsulate text
9615 fields that may occur when displaying
9616 .Va headline
9617 (and some other fields, like dynamic expansions in
9618 .Va prompt )
9619 with special Unicode control sequences;
9620 it is possible to fine-tune the terminal support level by assigning
9621 a value:
9622 no value (or any value other than
9623 .Ql 1 ,
9624 .Ql 2
9626 .Ql 3 )
9627 will make \*(UA assume that the terminal is capable to properly deal
9628 with Unicode version 6.3, in which case text is embedded in a pair of
9629 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
9630 characters.
9631 In addition no space on the line is reserved for these characters.
9633 Weaker support is chosen by using the value
9634 .Ql 1
9635 (Unicode 6.3, but reserve the room of two spaces for writing the control
9636 sequences onto the line).
9637 The values
9638 .Ql 2
9640 .Ql 3
9641 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
9642 again reserves room for two spaces in addition.
9645 .It Va headline-plain
9646 \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are
9647 used by default for certain entries of
9648 .Va headline .
9649 If this variable is set only basic US-ASCII symbols will be used.
9652 .It Va history-file
9653 \*(OP If a line editor is available then this can be set to
9654 name the (expandable) path of the location of a permanent
9655 .Ic history
9656 file; also see
9657 .Va history-size .
9660 .It Va history-gabby
9661 \*(BO\*(OP Add more entries to the
9662 .Ic history
9663 as is normally done.
9666 .It Va history-gabby-persist
9667 \*(BO\*(OP \*(UA's own MLE will not save the additional
9668 .Va history-gabby
9669 entries in persistent storage unless this variable is set.
9670 On the other hand it will not loose the knowledge of whether
9671 a persistent entry was gabby or not.
9672 Also see
9673 .Va history-file .
9676 .It Va history-size
9677 \*(OP Setting this variable imposes a limit on the number of concurrent
9678 .Ic history
9679 entries.
9680 If set to the value 0 then no further history entries will be added,
9681 and loading and incorporation of the
9682 .Va history-file
9683 upon program startup can also be suppressed by doing this.
9684 Runtime changes will not be reflected before the
9685 .Ic history
9686 is saved or loaded (again).
9689 .It Va hold
9690 \*(BO This setting controls whether messages are held in the system
9691 .Va inbox ,
9692 and it is set by default.
9695 .It Va hostname
9696 Used instead of the value obtained from
9697 .Xr uname 3
9699 .Xr getaddrinfo 3
9700 as the hostname when expanding local addresses, e.g., in
9701 .Ql From:
9702 (also see
9703 .Sx "On sending mail, and non-interactive mode" ,
9704 especially for expansion of network addresses that contain domain-less
9705 valid user names in angle brackets).
9706 If either of
9707 .Va from
9708 or this variable Is set the message and MIME part related unique ID fields
9709 .Ql Message-ID:
9711 .Ql Content-ID:
9712 will be created (except when disallowed by
9713 .Va message-id-disable
9715 .Va stealthmua ) .
9716 If the \*(OPal IDNA support is available (see
9717 .Va idna-disable )
9718 variable assignment is aborted when a necessary conversion fails.
9720 Setting it to the empty string will cause the normal hostname to be
9721 used, but nonetheless enables creation of said ID fields.
9722 \*(IN in conjunction with the built-in SMTP
9723 .Va mta
9724 .Va smtp-hostname
9725 also influences the results:
9726 one should produce some test messages with the desired combination of
9727 .Va \&\&hostname ,
9728 and/or
9729 .Va from ,
9730 .Va sender
9731 etc. first.
9734 .It Va idna-disable
9735 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
9736 names according to the rules of IDNA (internationalized domain names
9737 for applications).
9738 Since the IDNA code assumes that domain names are specified with the
9739 .Va ttycharset
9740 character set, an UTF-8 locale charset is required to represent all
9741 possible international domain names (before conversion, that is).
9744 .It Va ifs
9745 The input field separator that is used (\*(ID by some functions) to
9746 determine where to split input data.
9748 .Bl -tag -compact -width ".It MMM"
9749 .It 1.
9750 Unsetting is treated as assigning the default value,
9751 .Ql \& \et\en .
9752 .It 2.
9753 If set to the empty value, no field splitting will be performed.
9754 .It 3.
9755 If set to a non-empty value, all whitespace characters are extracted
9756 and assigned to the variable
9757 .Va ifs-ws .
9760 .Bl -tag -compact -width ".It MMM"
9761 .It a.
9762 .Va \&\&ifs-ws
9763 will be ignored at the beginning and end of input.
9764 Diverging from POSIX shells default whitespace is removed in addition,
9765 which is owed to the entirely different line content extraction rules.
9766 .It b.
9767 Each occurrence of a character of
9768 .Va \&\&ifs
9769 will cause field-splitting, any adjacent
9770 .Va \&\&ifs-ws
9771 characters will be skipped.
9775 .It Va ifs-ws
9776 \*(RO Automatically deduced from the whitespace characters in
9777 .Va ifs .
9780 .It Va ignore
9781 \*(BO Ignore interrupt signals from the terminal while entering
9782 messages; instead echo them as
9783 .Ql @
9784 characters and discard the current line.
9787 .It Va ignoreeof
9788 \*(BO Ignore end-of-file conditions
9789 .Pf ( Ql control-D )
9790 in compose mode on message input and in interactive command input.
9791 If set an interactive command input session can only be left by
9792 explicitly using one of the commands
9793 .Ic exit
9795 .Ic quit ,
9796 and message input in compose mode can only be terminated by entering
9797 a period
9798 .Ql \&.
9799 on a line by itself or by using the
9800 .Ic ~.
9801 .Sx "COMMAND ESCAPES" ;
9802 Setting this implies the behaviour that
9803 .Va dot
9804 describes in
9805 .Va posix
9806 mode.
9809 .It Va inbox
9810 If this is set to a non-empty string it will specify the user's
9811 .Mx -sx
9812 .Sx "primary system mailbox" ,
9813 overriding
9814 .Ev MAIL
9815 and the system-dependent default, and (thus) be used to replace
9816 .Ql %
9817 when doing
9818 .Sx "Filename transformations" ;
9819 also see
9820 .Ic file
9821 for more on this topic.
9822 The value supports a subset of transformations itself.
9825 .It Va indentprefix
9826 String used by the
9827 .Ic ~m , ~M
9829 .Ic ~R
9830 .Sx "COMMAND ESCAPES"
9831 and by the
9832 .Va quote
9833 option for indenting messages,
9834 in place of the POSIX mandated default tabulator character
9835 .Ql \et .
9836 Also see
9837 .Va quote-chars .
9840 .It Va keep
9841 \*(BO If set, an empty
9842 .Mx -sx
9843 .Sx "primary system mailbox"
9844 file is not removed.
9845 Note that, in conjunction with
9846 .Va posix
9847 mode any empty file will be removed unless this variable is set.
9848 This may improve the interoperability with other mail user agents
9849 when using a common folder directory, and prevents malicious users
9850 from creating fake mailboxes in a world-writable spool directory.
9851 \*(ID Only local regular (MBOX) files are covered, Maildir and other
9852 mailbox types will never be removed, even if empty.
9855 .It Va keep-content-length
9856 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
9857 be told to keep the
9858 .Ql Content-Length:
9860 .Ql Lines:
9861 header fields that some MUAs generate by setting this variable.
9862 Since \*(UA does neither use nor update these non-standardized header
9863 fields (which in itself shows one of their conceptual problems),
9864 stripping them should increase interoperability in between MUAs that
9865 work with with same mailbox files.
9866 Note that, if this is not set but
9867 .Va writebackedited ,
9868 as below, is, a possibly performed automatic stripping of these header
9869 fields already marks the message as being modified.
9870 \*(ID At some future time \*(UA will be capable to rewrite and apply an
9871 .Va mime-encoding
9872 to modified messages, and then those fields will be stripped silently.
9875 .It Va keepsave
9876 \*(BO When a message is saved it is usually discarded from the
9877 originating folder when \*(UA is quit.
9878 This setting causes all saved message to be retained.
9881 .It Va line-editor-disable
9882 \*(BO Turn off any enhanced line editing capabilities (see
9883 .Sx "On terminal control and line editor"
9884 for more).
9887 .It Va line-editor-no-defaults
9888 \*(BO\*(OP Do not establish any default key binding.
9891 .It Va log-prefix
9892 Error log message prefix string
9893 .Pf ( Ql "\*(uA: " ) .
9896 .It Va mailbox-display
9897 \*(RO The name of the current mailbox
9898 .Pf ( Ic file ) ,
9899 possibly abbreviated for display purposes.
9902 .It Va mailbox-resolved
9903 \*(RO The fully resolved path of the current mailbox.
9906 .It Va mailx-extra-rc
9907 An additional startup file that is loaded as the last of the
9908 .Sx "Resource files" .
9909 Use this file for commands that are not understood by other POSIX
9910 .Xr mailx 1
9911 implementations, i.e., mostly anything which is not covered by
9912 .Sx "Initial settings" .
9915 .It Va markanswered
9916 \*(BO When a message is replied to and this variable is set,
9917 it is marked as having been
9918 .Ic answered .
9919 See the section
9920 .Sx "Message states" .
9923 .It Va mbox-rfc4155
9924 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
9925 POSIX rules for detecting message boundaries (so-called
9926 .Ql From_
9927 lines) due to compatibility reasons, instead of the stricter rules that
9928 have been standardized in RFC 4155.
9929 This behaviour can be switched to the stricter RFC 4155 rules by
9930 setting this variable.
9931 (This is never necessary for any message newly generated by \*(UA,
9932 it only applies to messages generated by buggy or malicious MUAs, or may
9933 occur in old MBOX databases: \*(UA itself will choose a proper
9934 .Va mime-encoding
9935 to avoid false interpretation of
9936 .Ql From_
9937 content lines in the MBOX database.)
9939 This may temporarily be handy when \*(UA complains about invalid
9940 .Ql From_
9941 lines when opening a MBOX: in this case setting this variable and
9942 re-opening the mailbox in question may correct the result.
9943 If so, copying the entire mailbox to some other file, as in
9944 .Ql copy * SOME-FILE ,
9945 will perform proper, all-compatible
9946 .Ql From_
9947 quoting for all detected messages, resulting in a valid MBOX mailbox.
9948 Finally the variable can be unset again:
9949 .Bd -literal -offset indent
9950 define mboxfix {
9951   localopts yes; wysh set mbox-rfc4155;\e
9952     wysh File "${1}"; eval copy * "${2}"
9954 call mboxfix /tmp/bad.mbox /tmp/good.mbox
9958 .It Va memdebug
9959 \*(BO Internal development variable.
9962 .It Va message-id-disable
9963 \*(BO By setting this variable the generation of
9964 .Ql Message-ID:
9966 .Ql Content-ID:
9967 message and MIME part headers can be completely suppressed, effectively
9968 leaving this task up to the
9969 .Va mta
9970 (Mail-Transfer-Agent) or the SMTP server.
9971 Note that according to RFC 5321 a SMTP server is not required to add this
9972 field by itself, so it should be ensured that it accepts messages without
9973 .Ql Message-ID .
9976 .It Va message-inject-head
9977 A string to put at the beginning of each new message, followed by a newline.
9978 \*(OB The escape sequences tabulator
9979 .Ql \et
9980 and newline
9981 .Ql \en
9982 are understood (use the
9983 .Cm wysh
9984 prefix when
9985 .Ic set Ns
9986 ting the variable(s) instead).
9989 .It Va message-inject-tail
9990 A string to put at the end of each new message, followed by a newline.
9991 \*(OB The escape sequences tabulator
9992 .Ql \et
9993 and newline
9994 .Ql \en
9995 are understood (use the
9996 .Cm wysh
9997 prefix when
9998 .Ic set Ns
9999 ting the variable(s) instead).
10002 .It Va metoo
10003 \*(BO Usually, when an
10004 .Ic alias
10005 expansion contains the sender, the sender is removed from the expansion.
10006 Setting this option suppresses these removals.
10007 Note that a set
10008 .Va metoo
10009 also causes a
10010 .Ql -m
10011 option to be passed through to the
10012 .Va mta
10013 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
10014 this flag, no MTA is known which does not support it (for historical
10015 compatibility).
10018 .It Va mime-allow-text-controls
10019 \*(BO When sending messages, each part of the message is MIME-inspected
10020 in order to classify the
10021 .Ql Content-Type:
10023 .Ql Content-Transfer-Encoding:
10024 (see
10025 .Va mime-encoding )
10026 that is required to send this part over mail transport, i.e.,
10027 a computation rather similar to what the
10028 .Xr file 1
10029 command produces when used with the
10030 .Ql --mime
10031 option.
10033 This classification however treats text files which are encoded in
10034 UTF-16 (seen for HTML files) and similar character sets as binary
10035 octet-streams, forcefully changing any
10036 .Ql text/plain
10038 .Ql text/html
10039 specification to
10040 .Ql application/octet-stream :
10041 If that actually happens a yet unset charset MIME parameter is set to
10042 .Ql binary ,
10043 effectively making it impossible for the receiving MUA to automatically
10044 interpret the contents of the part.
10046 If this variable is set, and the data was unambiguously identified as
10047 text data at first glance (by a
10048 .Ql .txt
10050 .Ql .html
10051 file extension), then the original
10052 .Ql Content-Type:
10053 will not be overwritten.
10056 .It Va mime-alternative-favour-rich
10057 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
10058 HTML) will be preferred in favour of included plain text versions when
10059 displaying messages, provided that a handler exists which produces
10060 output that can be (re)integrated into \*(UA's normal visual display.
10061 (E.g., at the time of this writing some newsletters ship their full
10062 content only in the rich HTML part, whereas the plain text part only
10063 contains topic subjects.)
10066 .It Va mime-counter-evidence
10067 Normally the
10068 .Ql Content-Type:
10069 field is used to decide how to handle MIME parts.
10070 Some MUAs, however, do not use
10071 .Sx "The mime.types files"
10072 (also see
10073 .Sx "HTML mail and MIME attachments" )
10074 or a similar mechanism to correctly classify content, but specify an
10075 unspecific MIME type
10076 .Pf ( Ql application/octet-stream )
10077 even for plain text attachments.
10078 If this variable is set then \*(UA will try to re-classify such MIME
10079 message parts, if possible, for example via a possibly existing
10080 attachment filename.
10081 A non-empty value may also be given, in which case a number is expected,
10082 actually a carrier of bits, best specified as a binary value, e.g.,
10083 .Ql 0b1111 .
10085 .Bl -bullet -compact
10087 If bit two is set (counting from 1, decimal 2) then the detected
10088 .Ic mimetype
10089 will be carried along with the message and be used for deciding which
10090 MIME handler is to be used, for example;
10091 when displaying such a MIME part the part-info will indicate the
10092 overridden content-type by showing a plus sign
10093 .Ql + .
10095 If bit three is set (decimal 4) then the counter-evidence is always
10096 produced and a positive result will be used as the MIME type, even
10097 forcefully overriding the parts given MIME type.
10099 If bit four is set (decimal 8) as a last resort the actual content of
10100 .Ql application/octet-stream
10101 parts will be inspected, so that data which looks like plain text can be
10102 treated as such.
10103 This mode is even more relaxed when data is to be displayed to the user
10104 or used as a message quote (data consumers which mangle data for display
10105 purposes, which includes masking of control characters, for example).
10109 .It Va mime-encoding
10110 The MIME
10111 .Ql Content-Transfer-Encoding
10112 to use in outgoing text messages and message parts, where applicable.
10113 (7-bit clean text messages are sent as-is, without a transfer encoding.)
10114 Valid values are:
10116 .Bl -tag -compact -width ".It Ql _%%_"
10117 .It Ql 8bit
10118 .Pf (Or\0 Ql 8b . )
10119 8-bit transport effectively causes the raw data be passed through
10120 unchanged, but may cause problems when transferring mail messages over
10121 channels that are not ESMTP (RFC 1869) compliant.
10122 Also, several input data constructs are not allowed by the
10123 specifications and may cause a different transfer-encoding to be used.
10124 .It Ql quoted-printable
10125 .Pf (Or\0 Ql qp . )
10126 Quoted-printable encoding is 7-bit clean and has the property that ASCII
10127 characters are passed through unchanged, so that an english message can
10128 be read as-is; it is also acceptable for other single-byte locales that
10129 share many characters with ASCII, like, e.g., ISO-8859-1.
10130 The encoding will cause a large overhead for messages in other character
10131 sets: e.g., it will require up to twelve (12) bytes to encode a single
10132 UTF-8 character of four (4) bytes.
10133 It is the default encoding.
10134 .It Ql base64
10135 .Pf (Or\0 Ql b64 . )
10136 This encoding is 7-bit clean and will always be used for binary data.
10137 This encoding has a constant input:output ratio of 3:4, regardless of
10138 the character set of the input data it will encode three bytes of input
10139 to four bytes of output.
10140 This transfer-encoding is not human readable without performing
10141 a decoding step.
10145 .It Va mimetypes-load-control
10146 Can be used to control which of
10147 .Sx "The mime.types files"
10148 are loaded: if the letter
10149 .Ql u
10150 is part of the option value, then the user's personal
10151 .Pa \*(vU
10152 file will be loaded (if it exists); likewise the letter
10153 .Ql s
10154 controls loading of the system wide
10155 .Pa \*(vS ;
10156 directives found in the user file take precedence, letter matching is
10157 case-insensitive.
10158 If this variable is not set \*(UA will try to load both files.
10159 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
10160 but they will be matched last (the order can be listed via
10161 .Ic mimetype ) .
10163 More sources can be specified by using a different syntax: if the
10164 value string contains an equals sign
10165 .Ql =
10166 then it is instead parsed as a comma-separated list of the described
10167 letters plus
10168 .Ql f=FILENAME
10169 pairs; the given filenames will be expanded and loaded, and their
10170 content may use the extended syntax that is described in the section
10171 .Sx "The mime.types files" .
10172 Directives found in such files always take precedence (are prepended to
10173 the MIME type cache).
10177 .It Va mta
10178 To choose an alternate Mail-Transfer-Agent, set this option to either
10179 the full pathname of an executable (optionally prefixed with the protocol
10180 .Ql file:// ) ,
10181 or \*(OPally a SMTP a.k.a. SUBMISSION protocol URL, e.g., \*(IN
10183 .Dl submissions://[user[:password]@]server[:port]
10185 (\*(OU:
10186 .Ql [smtp://]server[:port] . )
10187 The default has been chosen at compile time.
10188 All supported data transfers are executed in child processes, which
10189 run asynchronously and without supervision unless either the
10190 .Va sendwait
10191 or the
10192 .Va verbose
10193 variable is set.
10194 If such a child receives a TERM signal, it will abort and
10195 .Va save
10196 the message to
10197 .Ev DEAD ,
10198 if so configured.
10201 For a file-based MTA it may be necessary to set
10202 .Va mta-argv0
10203 in in order to choose the right target of a modern
10204 .Xr mailwrapper 8
10205 environment.
10206 It will be passed command line arguments from several possible sources:
10207 from the variable
10208 .Va mta-arguments
10209 if set, from the command line if given and the variable
10210 .Va expandargv
10211 allows their use.
10212 Argument processing of the MTA will be terminated with a
10213 .Fl \&\&-
10214 separator.
10217 The otherwise occurring implicit usage of the following MTA command
10218 line arguments can be disabled by setting the boolean variable
10219 .Va mta-no-default-arguments
10220 (which will also disable passing
10221 .Fl \&\&-
10222 to the MTA):
10223 .Fl \&\&i
10224 (for not treating a line with only a dot
10225 .Ql \&.
10226 character as the end of input),
10227 .Fl \&\&m
10228 (shall the variable
10229 .Va metoo
10230 be set) and
10231 .Fl \&\&v
10232 (if the
10233 .Va verbose
10234 variable is set); in conjunction with the
10235 .Fl r
10236 command line option \*(UA will also (not) pass
10237 .Fl \&\&f
10238 as well as possibly
10239 .Fl \&\&F .
10242 \*(OPally \*(UA can send mail over SMTP a.k.a. SUBMISSION network
10243 connections to a single defined smart host by setting this variable to
10244 a SMTP or SUBMISSION URL (see
10245 .Sx "On URL syntax and credential lookup" ) .
10246 An authentication scheme can be specified via the variable chain
10247 .Va smtp-auth .
10248 Encrypted network connections are \*(OPally available, the section
10249 .Sx "Encrypted network communication"
10250 should give an overview and provide links to more information on this.
10251 Note that with some mail providers it may be necessary to set the
10252 .Va smtp-hostname
10253 variable in order to use a specific combination of
10254 .Va from ,
10255 .Va hostname
10257 .Va mta .
10258 \*(UA also supports forwarding of all network traffic over a specified
10259 .Va socks-proxy .
10260 The following SMTP variants may be used:
10262 .Bl -bullet
10264 The plain SMTP protocol (RFC 5321) that normally lives on the
10265 server port 25 and requires setting the
10266 .Va smtp-use-starttls
10267 variable to enter a TLS encrypted session state.
10268 Assign a value like \*(IN
10269 .Ql smtp://[user[:password]@]server[:port]
10270 (\*(OU
10271 .Ql smtp://server[:port] )
10272 to choose this protocol.
10274 The so-called SMTPS which is supposed to live on server port 465
10275 and is automatically TLS secured.
10276 Unfortunately it never became a standardized protocol and may thus not
10277 be supported by your hosts network service database
10278 \(en in fact the port number has already been reassigned to other
10279 protocols!
10281 SMTPS is nonetheless a commonly offered protocol and thus can be
10282 chosen by assigning a value like \*(IN
10283 .Ql smtps://[user[:password]@]server[:port]
10284 (\*(OU
10285 .Ql smtps://server[:port] ) ;
10286 due to the mentioned problems it is usually necessary to explicitly
10287 specify the port as
10288 .Ql :465 ,
10289 however.
10291 The SUBMISSION protocol (RFC 6409) lives on server port 587 and
10292 is identically to the SMTP protocol from \*(UA's point of view;
10293 it requires setting
10294 .Va smtp-use-starttls
10295 to enter a TLS secured session state; e.g., \*(IN
10296 .Ql submission://[user[:password]@]server[:port] .
10298 The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is
10299 TLS secured by default.
10300 It can be chosen by assigning a value like \*(IN
10301 .Ql submissions://[user[:password]@]server[:port] .
10302 Due to the problems mentioned for SMTPS above and the fact that
10303 SUBMISSIONS is new and a successor that lives on the same port as the
10304 historical engineering mismanagement named SMTPS, it is usually
10305 necessary to explicitly specify the port as
10306 .Ql :465 .
10311 .It Va mta-arguments
10312 Arguments to pass through to a file-based
10313 .Va mta
10314 can be given via this variable, which is parsed according to
10315 .Sx "Shell-style argument quoting"
10316 into an array of arguments, and which will be joined onto MTA options
10317 from other sources, and then passed individually to the MTA:
10318 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
10321 .It Va mta-no-default-arguments
10322 \*(BO Unless this variable is set \*(UA will pass some well known
10323 standard command line options to a file-based
10324 .Va mta
10325 (Mail-Transfer-Agent), see there for more.
10328 .It Va mta-no-receiver-arguments
10329 \*(BO By default a file-based
10330 .Va mta
10331 will be passed all receiver addresses on the command line.
10332 This variable can be set to suppress any such argument.
10335 .It Va mta-argv0
10336 Many systems use a so-called
10337 .Xr mailwrapper 8
10338 environment to ensure compatibility with
10339 .Xr sendmail 1 .
10340 This works by inspecting the name that was used to invoke the mail
10341 delivery system.
10342 If this variable is set then the mailwrapper (the program that is
10343 actually executed when calling the file-based
10344 .Va mta )
10345 will treat its contents as that name.
10347 .Mx Va netrc-lookup
10348 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
10349 \*(BO\*(IN\*(OP Used to control usage of the user's
10350 .Pa \*(VN
10351 file for lookup of account credentials, as documented in the section
10352 .Sx "On URL syntax and credential lookup"
10353 and for the command
10354 .Ic netrc ;
10355 the section
10356 .Sx "The .netrc file"
10357 documents the file format.
10358 Also see
10359 .Va netrc-pipe .
10362 .It Va netrc-pipe
10363 \*(IN\*(OP When
10364 .Pa \*(VN
10365 is loaded (see
10366 .Ic netrc
10368 .Va netrc-lookup )
10369 then \*(UA will read the output of a shell pipe instead of the user's
10370 .Pa \*(VN
10371 file if this variable is set (to the desired shell command).
10372 This can be used to, e.g., store
10373 .Pa \*(VN
10374 in encrypted form:
10375 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
10378 .It Va newfolders
10379 \*(OP If this variable has the value
10380 .Ql maildir ,
10381 newly created local folders will be in Maildir instead of MBOX format.
10384 .It Va newmail
10385 Checks for new mail in the current folder each time the prompt is shown.
10386 A Maildir folder must be re-scanned to determine if new mail has arrived.
10387 If this variable is set to the special value
10388 .Ql nopoll
10389 then a Maildir folder will not be rescanned completely, but only
10390 timestamp changes are detected.
10391 Maildir folders are \*(OPal.
10394 .It Va outfolder
10395 \*(BO Unless specified as absolute pathnames, causes the filename given
10396 in the
10397 .Va record
10398 variable
10399 and the sender-based filenames for the
10400 .Ic Copy
10402 .Ic Save
10403 commands to be interpreted relative to the directory given in the
10404 .Va folder
10405 variable rather than relative to the current directory.
10407 .Mx Va on-account-cleanup
10408 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
10409 Macro hook which will be called once an
10410 .Ic account
10411 is left, as the very last step before unrolling per-account
10412 .Ic localopts .
10413 This hook is run even in case of fatal errors, and it is advisable to
10414 perform only absolutely necessary actions, like cleaning up
10415 .Ic alternates ,
10416 for example.
10417 The specialized form is used in favour of the generic one if found.
10420 .It Va on-compose-cleanup
10421 Macro hook which will be called after the message has been sent (or not,
10422 in case of failures), as the very last step before unrolling compose mode
10423 .Ic localopts .
10424 This hook is run even in case of fatal errors, and it is advisable to
10425 perform only absolutely necessary actions, like cleaning up
10426 .Ic alternates ,
10427 for example.
10429 For compose mode hooks that may affect the message content please see
10430 .Va on-compose-enter , on-compose-leave , on-compose-splice .
10431 \*(ID This hook exists because
10432 .Ic alias , alternates , commandalias , shortcut ,
10433 to name a few, are neither covered by
10434 .Ic localopts
10435 nor by
10436 .Cm local :
10437 changes applied in compose mode will continue to be in effect thereafter.
10442 .It Va on-compose-enter , on-compose-leave
10443 Macro hooks which will be called once compose mode is entered,
10444 and after composing has been finished, respectively;
10445 the exact order of the steps taken is documented for
10446 .Ic ~. ,
10447 one of the
10448 .Sx "COMMAND ESCAPES" .
10449 Context about the message being worked on can be queried via
10450 .Ic digmsg .
10451 .Ic localopts
10452 are enabled for these hooks, and changes on variables will be forgotten
10453 after the message has been sent.
10454 .Va on-compose-cleanup
10455 can be used to perform other necessary cleanup steps.
10458 Here is am example that injects a signature via
10459 .Va message-inject-tail ;
10460 instead using
10461 .Va on-compose-splice
10462 to simply inject the file of desire via
10463 .Ic ~<
10465 .Ic ~<!
10466 may be a better approach.
10468 .Bd -literal -offset indent
10469 define t_ocl {
10470   vput ! i cat ~/.mysig
10471   if [ $? -eq 0 ]
10472      vput vexpr message-inject-tail trim-end $i
10473   end
10475   # Alternatively
10476   readctl create ~/.mysig
10477   if [ $? -eq 0 ]
10478     readall i
10479     if [ $? -eq 0 ]
10480       vput vexpr message-inject-tail trim-end $i
10481     end
10482     readctl remove ~/.mysig
10483   end
10485 set on-compose-leave=t_ocl
10491 .It Va on-compose-splice , on-compose-splice-shell
10492 These hooks run once the normal compose mode is finished, but before the
10493 .Va on-compose-leave
10494 macro hook is called etc.
10495 Both hooks will be executed in a subprocess, with their input and output
10496 connected to \*(UA such that they can act as if they would be an
10497 interactive user.
10498 The difference in between them is that the latter is a
10499 .Ev SHELL
10500 command, whereas the former is a normal
10501 .Ic define Ns
10502 d macro, but which is restricted to a small set of commands (the
10503 .Va verbose
10504 output of, e.g.,
10505 .Ic list
10506 will indicate said capability).
10507 .Ic localopts
10508 are enabled for these hooks (in the parent process), causing any setting
10509 to be forgotten after the message has been sent;
10510 .Va on-compose-cleanup
10511 can be used to perform other cleanup as necessary.
10514 During execution of these hooks \*(UA will temporarily forget whether it
10515 has been started in interactive mode, (a restricted set of)
10516 .Sx "COMMAND ESCAPES"
10517 will always be available, and for guaranteed reproducibilities sake
10518 .Va escape
10520 .Va ifs
10521 will be set to their defaults.
10522 The compose mode command
10523 .Ic ~^
10524 has been especially designed for scriptability (via these hooks).
10525 The first line the hook will read on its standard input is the protocol
10526 version of said command escape, currently
10527 .Dq 0 0 1 :
10528 backward incompatible protocol changes have to be expected.
10531 Care must be taken to avoid deadlocks and other false control flow:
10532 if both involved processes wait for more input to happen at the
10533 same time, or one does not expect more input but the other is stuck
10534 waiting for consumption of its output, etc.
10535 There is no automatic synchronization of the hook: it will not be
10536 stopped automatically just because it, e.g., emits
10537 .Ql ~x .
10538 The hooks will however receive a termination signal if the parent enters
10539 an error condition.
10540 \*(ID Protection against and interaction with signals is not yet given;
10541 it is likely that in the future these scripts will be placed in an
10542 isolated session, which is signalled in its entirety as necessary.
10544 .Bd -literal -offset indent
10545 define ocs_signature {
10546   read version
10547   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
10549 set on-compose-splice=ocs_signature
10551 wysh set on-compose-splice-shell=$'\e
10552   read version;\e
10553   printf "hello $version!  Headers: ";\e
10554   echo \e'~^header list\e';\e
10555   read status result;\e
10556   echo "status=$status result=$result";\e
10557   '
10559 define ocsm {
10560   read version
10561   echo Splice protocol version is $version
10562   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
10563   if [ "$es" != 2 ]
10564     echoerr 'Cannot read header list'; echo '~x'; xit
10565   endif
10566   if [ "$hl" @i!% ' cc' ]
10567     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
10568       vput vexpr es substring "${es}" 0 1
10569     if [ "$es" != 2 ]
10570       echoerr 'Cannot insert Cc: header'; echo '~x'
10571       # (no xit, macro finishs anyway)
10572     endif
10573   endif
10575 set on-compose-splice=ocsm
10580 .It Va on-resend-cleanup
10581 \*(ID Identical to
10582 .Va on-compose-cleanup ,
10583 but is only triggered by
10584 .Ic resend .
10587 .It Va on-resend-enter
10588 \*(ID Identical to
10589 .Va on-compose-enter ,
10590 but is only triggered by
10591 .Ic resend ;
10592 currently there is no
10593 .Ic digmsg
10594 support, for example.
10597 .It Va page
10598 \*(BO If set, each message feed through the command given for
10599 .Ic pipe
10600 is followed by a formfeed character
10601 .Ql \ef .
10603 .Mx Va password
10604 .It Va password-USER@HOST , password-HOST , password
10605 \*(IN Variable chain that sets a password, which is used in case none has
10606 been given in the protocol and account-specific URL;
10607 as a last resort \*(UA will ask for a password on the user's terminal if
10608 the authentication method requires a password.
10609 Specifying passwords in a startup file is generally a security risk;
10610 the file should be readable by the invoking user only.
10612 .It Va password-USER@HOST
10613 \*(OU (see the chain above for \*(IN)
10614 Set the password for
10615 .Ql USER
10616 when connecting to
10617 .Ql HOST .
10618 If no such variable is defined for a host,
10619 the user will be asked for a password on standard input.
10620 Specifying passwords in a startup file is generally a security risk;
10621 the file should be readable by the invoking user only.
10624 .It Va piperaw
10625 \*(BO Send messages to the
10626 .Ic pipe
10627 command without performing MIME and character set conversions.
10631 .It Va pipe-TYPE/SUBTYPE
10632 When a MIME message part of type
10633 .Ql TYPE/SUBTYPE
10634 (case-insensitive) is displayed or quoted,
10635 its text is filtered through the value of this variable interpreted as
10636 a shell command.
10637 Note that only parts which can be displayed inline as plain text (see
10638 .Cd copiousoutput )
10639 are displayed unless otherwise noted, other MIME parts will only be
10640 considered by and for the command
10641 .Ic mimeview .
10644 The special value commercial at
10645 .Ql @
10646 forces interpretation of the message part as plain text, e.g.,
10647 .Ql set pipe-application/xml=@
10648 will henceforth display XML
10649 .Dq as is .
10650 (The same could also be achieved by adding a MIME type marker with the
10651 .Ic mimetype
10652 command.
10653 And \*(OPally MIME type handlers may be defined via
10654 .Sx "The Mailcap files"
10655 \(em these directives,
10656 .Cd copiousoutput
10657 has already been used, should be referred to for further documentation.
10660 The commercial at
10661 .Ql @
10662 can in fact be used as a trigger character to adjust usage and behaviour
10663 of a following shell command specification more thoroughly by appending
10664 more special characters which refer to further mailcap directives, e.g.,
10665 the following hypothetical command specification could be used:
10667 .Bd -literal -offset indent
10668 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
10672 .Bl -tag -compact -width ".It Ql __"
10673 .It Ql *
10674 The command produces plain text to be integrated in \*(UAs output:
10675 .Cd copiousoutput .
10677 .It Ql #
10678 If set the handler will not be invoked when a message is to be quoted,
10679 but only when it will be displayed:
10680 .Cd x-mailx-noquote .
10682 .It Ql &
10683 Run the command asynchronously, i.e., without blocking \*(UA:
10684 .Cd x-mailx-async .
10686 .It Ql \&!
10687 The command must be run on an interactive terminal, \*(UA will
10688 temporarily release the terminal to it:
10689 .Cd needsterminal .
10691 .It Ql +
10692 Request creation of a zero-sized temporary file, the absolute pathname
10693 of which will be made accessible via the environment variable
10694 .Ev MAILX_FILENAME_TEMPORARY :
10695 .Cd x-mailx-tmpfile .
10696 If given twice then the file will be unlinked automatically by \*(UA
10697 when the command loop is entered again at latest:
10698 .Cd x-mailx-tmpfile-unlink .
10700 .It Ql =
10701 Normally the MIME part content is passed to the handler via standard
10702 input; if this flag is set then the data will instead be written into
10703 .Ev MAILX_FILENAME_TEMPORARY
10704 .Pf ( Cd x-mailx-tmpfile-fill ) ,
10705 the creation of which is implied; note however that in order to cause
10706 deletion of the temporary file you still have to use two plus signs
10707 .Ql ++
10708 explicitly!
10710 .It Ql @
10711 To avoid ambiguities with normal shell command content you can use
10712 another commercial at to forcefully terminate interpretation of
10713 remaining characters.
10714 (Any character not in this list will have the same effect.)
10718 Some information about the MIME part to be displayed is embedded into
10719 the environment of the shell command:
10722 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
10724 .It Ev MAILX_CONTENT
10725 The MIME content-type of the part, if known, the empty string otherwise.
10728 .It Ev MAILX_CONTENT_EVIDENCE
10730 .Va mime-counter-evidence
10731 includes the carry-around-bit (2), then this will be set to the detected
10732 MIME content-type; not only then identical to
10733 .Ev \&\&MAILX_CONTENT
10734 otherwise.
10737 .It Ev MAILX_EXTERNAL_BODY_URL
10738 MIME parts of type
10739 .Ql message/external-body access-type=url
10740 will store the access URL in this variable, it is empty otherwise.
10741 URL targets should not be activated automatically, without supervision.
10744 .It Ev MAILX_FILENAME
10745 The filename, if any is set, the empty string otherwise.
10748 .It Ev MAILX_FILENAME_GENERATED
10749 A random string.
10752 .It Ev MAILX_FILENAME_TEMPORARY
10753 If temporary file creation has been requested through the command prefix
10754 this variable will be set and contain the absolute pathname of the
10755 temporary file.
10760 .It Va pipe-EXTENSION
10761 This is identical to
10762 .Va pipe-TYPE/SUBTYPE
10763 except that
10764 .Ql EXTENSION
10765 (normalized to lowercase using character mappings of the ASCII charset)
10766 names a file extension, e.g.,
10767 .Ql xhtml .
10768 Handlers registered using this method take precedence.
10770 .Mx Va pop3-auth
10771 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
10772 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
10773 The only possible value as of now is
10774 .Ql plain ,
10775 which is thus the default.
10777 .Mx Va pop3-bulk-load
10778 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
10779 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
10780 the messages, and only requests the message bodies on user request.
10781 For the POP3 protocol this means that the message headers will be
10782 downloaded twice.
10783 If this variable is set then \*(UA will download only complete messages
10784 from the given POP3 server(s) instead.
10786 .Mx Va pop3-keepalive
10787 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
10788 \*(OP POP3 servers close the connection after a period of inactivity;
10789 the standard requires this to be at least 10 minutes,
10790 but practical experience may vary.
10791 Setting this variable to a numeric value greater than
10792 .Ql 0
10793 causes a
10794 .Ql NOOP
10795 command to be sent each value seconds if no other operation is performed.
10797 .Mx Va pop3-no-apop
10798 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
10799 \*(BO\*(OP Unless this variable is set the
10800 .Ql APOP
10801 authentication method will be used when connecting to a POP3 server that
10802 advertises support.
10803 The advantage of
10804 .Ql APOP
10805 is that the password is not sent in clear text over the wire and that
10806 only a single packet is sent for the user/password tuple.
10807 Note that
10808 .Va pop3-no-apop-HOST
10809 requires \*(IN.
10811 .Mx Va pop3-use-starttls
10812 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
10813 \*(BO\*(OP Causes \*(UA to issue a
10814 .Ql STLS
10815 command to make an unencrypted POP3 session TLS encrypted.
10816 This functionality is not supported by all servers,
10817 and is not used if the session is already encrypted by the POP3S method.
10818 Note that
10819 .Va pop3-use-starttls-HOST
10820 requires \*(IN.
10824 .It Va posix
10825 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
10826 where that deviates from standardized behaviour.
10827 It will be set implicitly before the
10828 .Sx "Resource files"
10829 are loaded if the environment variable
10830 .Ev POSIXLY_CORRECT
10831 is set, and adjusting any of those two will be reflected by the other
10832 one implicitly.
10833 The following behaviour is covered and enforced by this mechanism:
10836 .Bl -bullet -compact
10838 In non-interactive mode, any error encountered while loading resource
10839 files during program startup will cause a program exit, whereas in
10840 interactive mode such errors will stop loading of the currently loaded
10841 (stack of) file(s, i.e., recursively).
10842 These exits can be circumvented on a per-command base by using
10843 .Cm ignerr ,
10844 one of the
10845 .Sx "Command modifiers" ,
10846 for each command which shall be allowed to fail.
10849 .Ic alternates
10850 will replace the list of alternate addresses instead of appending to it.
10851 In addition alternates will only be honoured for any sort of message
10852 .Ic reply ,
10853 and for aliases.
10856 The variable inserting
10857 .Sx "COMMAND ESCAPES"
10858 .Ic ~A ,
10859 .Ic ~a ,
10860 .Ic ~I
10862 .Ic ~i
10863 will expand embedded character sequences
10864 .Ql \et
10865 horizontal tabulator and
10866 .Ql \en
10867 line feed.
10868 \*(ID For compatibility reasons this step will always be performed.
10871 Upon changing the active
10872 .Ic file
10873 no summary of
10874 .Ic headers
10875 will be displayed even if
10876 .Va header
10877 is set.
10880 Setting
10881 .Va ignoreeof
10882 implies the behaviour described by
10883 .Va dot .
10886 The variable
10887 .Va keep
10888 is extended to cover any empty mailbox, not only empty
10889 .Mx -sx
10890 .Sx "primary system mailbox" Ns
10891 es: they will be removed when they are left in empty state otherwise.
10896 .It Va print-alternatives
10897 \*(BO When a MIME message part of type
10898 .Ql multipart/alternative
10899 is displayed and it contains a subpart of type
10900 .Ql text/plain ,
10901 other parts are normally discarded.
10902 Setting this variable causes all subparts to be displayed,
10903 just as if the surrounding part was of type
10904 .Ql multipart/mixed .
10907 .It Va prompt
10908 The string used as a prompt in interactive mode.
10909 Whenever the variable is evaluated the value is treated as if specified
10910 within dollar-single-quotes (see
10911 .Sx "Shell-style argument quoting" ) .
10912 This (post-assignment, i.e., second) expansion can be used to embed
10913 status information, for example
10914 .Va \&? ,
10915 .Va \&! ,
10916 .Va account
10918 .Va mailbox-display .
10920 In order to embed characters which should not be counted when
10921 calculating the visual width of the resulting string, enclose the
10922 characters of interest in a pair of reverse solidus escaped brackets:
10923 .Ql \e[\eE[0m\e] ;
10924 a slot for coloured prompts is also available with the \*(OPal command
10925 .Ic colour .
10926 Prompting may be prevented by setting this to the null string
10927 (a.k.a.\|
10928 .Ql set noprompt ) .
10931 .It Va prompt2
10932 This string is used for secondary prompts, but is otherwise identical to
10933 .Va prompt .
10934 The default is
10935 .Ql ..\0 .
10938 .It Va quiet
10939 \*(BO Suppresses the printing of the version when first invoked.
10942 .It Va quote
10943 If set a
10944 .Ic reply
10945 message is started with the quoted original message,
10946 the lines of which are prefixed by the value of the variable
10947 .Va indentprefix ,
10948 taking into account
10949 .Va quote-chars
10951 .Va quote-fold .
10952 If set to the empty value, the quoted message will be preceded and
10953 followed by the expansions of the values of
10954 .Va quote-inject-head
10956 .Va quote-inject-tail ,
10957 respectively.
10958 None of the headers of the quoted message is included in the quote if
10959 the value equals
10960 .Ql noheading ,
10961 and only the headers selected by the
10962 .Ql type
10963 .Ic headerpick
10964 selection are put above the message body for
10965 .Ql headers ,
10966 whereas all headers and all MIME parts are included for
10967 .Ql allheaders .
10968 Also see
10969 .Va quote-as-attachment
10971 .Ic ~Q ,
10972 one of the
10973 .Sx "COMMAND ESCAPES" .
10976 .It Va quote-as-attachment
10977 \*(BO Add the original message in its entirety as a
10978 .Ql message/rfc822
10979 MIME attachment when replying to a message.
10980 Note this works regardless of the setting of
10981 .Va quote .
10984 .It Va quote-chars
10985 Can be set to a string consisting of non-whitespace ASCII characters
10986 which shall be treated as quotation leaders, the default being
10987 .Ql >|}: .
10990 .It Va quote-fold
10991 \*(OP Can be set in addition to
10992 .Va indentprefix ,
10993 and creates a more fancy quotation in that leading quotation characters
10994 .Pf ( Va quote-chars )
10995 are compressed and overlong lines are folded.
10996 .Va \&\&quote-fold
10997 can be set to either one, two or three (space separated) numeric values,
10998 which are interpreted as the maximum (goal) and the minimum line length,
10999 respectively, in a spirit rather equal to the
11000 .Xr fmt 1
11001 program, but line- instead of paragraph-based.
11002 The third value is used as the maximum line length instead of the first
11003 if no better break point can be found; it is ignored unless it is larger
11004 than the minimum and smaller than the maximum.
11005 If not set explicitly the minimum will reflect the goal algorithmically.
11006 The goal cannot be smaller than the length of
11007 .Va indentprefix
11008 plus some additional pad; necessary adjustments take place silently.
11013 .It Va quote-inject-head , quote-inject-tail
11014 The strings to put before and after the text of a
11015 .Va quote Ns
11016 d message, respectively.
11017 The former defaults to
11018 .Ql %f wrote:\en\en .
11019 Special format directives will be expanded if possible, and if so
11020 configured the output will be folded according to
11021 .Va quote-fold .
11022 Format specifiers in the given strings start with a percent sign
11023 .Ql %
11024 and expand values of the original message, unless noted otherwise.
11025 Note that names and addresses are not subject to the setting of
11026 .Va showto .
11027 Valid format specifiers are:
11030 .Bl -tag -compact -width ".It Ql _%%_"
11031 .It Ql %%
11032 A plain percent sign.
11033 .It Ql %a
11034 The address(es) of the sender(s).
11035 .It Ql %d
11036 The date found in the
11037 .Ql Date:
11038 header of the message when
11039 .Va datefield
11040 is set (the default), otherwise the date when the message was received.
11041 Formatting can be controlled by assigning a
11042 .Xr strftime 3
11043 format string to
11044 .Va datefield
11045 (and
11046 .Va datefield-markout-older ) .
11047 .It Ql %f
11048 The full name(s) (name and address, as given) of the sender(s).
11049 .It Ql %i
11051 .Ql Message-ID: .
11052 .It Ql %n
11053 The real name(s) of the sender(s) if there is one and
11054 .Va showname
11055 allows usage, the address(es) otherwise.
11056 .It Ql %r
11057 The senders real name(s) if there is one, the address(es) otherwise.
11062 .It Va r-option-implicit
11063 \*(BO Setting this option evaluates the contents of
11064 .Va from
11065 (or, if that contains multiple addresses,
11066 .Va sender )
11067 and passes the results onto the used (file-based) MTA as described for the
11068 .Fl r
11069 option (empty argument case).
11072 .It Va recipients-in-cc
11073 \*(BO When doing a
11074 .Ic reply ,
11075 the original
11076 .Ql From:
11078 .Ql To:
11079 are by default merged into the new
11080 .Ql To: .
11081 If this variable is set, only the original
11082 .Ql From:
11083 ends in the new
11084 .Ql To: ,
11085 the rest is merged into
11086 .Ql Cc: .
11089 .It Va record
11090 Unless this variable is defined, no copies of outgoing mail will be saved.
11091 If defined it gives the pathname, subject to the usual
11092 .Sx "Filename transformations" ,
11093 of a folder where all new, replied-to or forwarded messages are saved:
11094 when saving to this folder fails the message is not sent, but instead
11095 .Va save Ns
11096 d to
11097 .Ev DEAD .
11098 The standard defines that relative (fully expanded) paths are to be
11099 interpreted relative to the current directory
11100 .Pf ( Ic cwd ) ,
11101 to force interpretation relative to
11102 .Va folder
11103 .Va outfolder
11104 needs to be set in addition.
11107 .It Va record-files
11108 \*(BO If this variable is set the meaning of
11109 .Va record
11110 will be extended to cover messages which target only file and pipe
11111 recipients (see
11112 .Va expandaddr ) .
11113 These address types will not appear in recipient lists unless
11114 .Va add-file-recipients
11115 is also set.
11118 .It Va record-resent
11119 \*(BO If this variable is set the meaning of
11120 .Va record
11121 will be extended to also cover the
11122 .Ic resend
11124 .Ic Resend
11125 commands.
11128 .It Va reply-in-same-charset
11129 \*(BO If this variable is set \*(UA first tries to use the same
11130 character set of the original message for replies.
11131 If this fails, the mechanism described in
11132 .Sx "Character sets"
11133 is evaluated as usual.
11136 .It Va reply-strings
11137 Can be set to a comma-separated list of (case-insensitive according to
11138 ASCII rules) strings which shall be recognized in addition to the
11139 built-in strings as
11140 .Ql Subject:
11141 reply message indicators \(en built-in are
11142 .Ql Re: ,
11143 which is mandated by RFC 5322, as well as the german
11144 .Ql Aw: ,
11145 .Ql Antw: ,
11146 and the
11147 .Ql Wg:
11148 which often has been seen in the wild;
11149 I.e., the separating colon has to be specified explicitly.
11152 .It Va reply-to
11153 A list of addresses to put into the
11154 .Ql Reply-To:
11155 field of the message header.
11156 Members of this list are handled as if they were in the
11157 .Ic alternates
11158 list.
11160 .It Va replyto
11161 \*(OB Variant of
11162 .Va reply-to .
11165 .It Va reply-to-honour
11166 Controls whether a
11167 .Ql Reply-To:
11168 header is honoured when replying to a message via
11169 .Ic reply
11171 .Ic Lreply .
11172 This is a quadoption; if set without a value it defaults to
11173 .Dq yes .
11176 .It Va rfc822-body-from_
11177 \*(BO This variable can be used to force displaying a so-called
11178 .Ql From_
11179 line for messages that are embedded into an envelope mail via the
11180 .Ql message/rfc822
11181 MIME mechanism, for more visual convenience.
11184 .It Va save
11185 \*(BO Enable saving of (partial) messages in
11186 .Ev DEAD
11187 upon interrupt or delivery error.
11190 .It Va screen
11191 The number of lines that represents a
11192 .Dq screenful
11193 of lines, used in
11194 .Ic headers
11195 summary display,
11196 .Ic from
11197 .Ic search Ns
11198 ing, message
11199 .Ic top Ns
11200 line display and scrolling via
11201 .Ic z .
11202 If this variable is not set \*(UA falls back to a calculation based upon
11203 the detected terminal window size and the baud rate: the faster the
11204 terminal, the more will be shown.
11205 Overall screen dimensions and pager usage is influenced by the
11206 environment variables
11207 .Ev COLUMNS
11209 .Ev LINES
11210 and the variable
11211 .Va crt .
11214 .It Va searchheaders
11215 \*(BO Expand message-list specifiers in the form
11216 .Ql /x:y
11217 to all messages containing the substring
11218 .Dq y
11219 in the header field
11220 .Ql x .
11221 The string search is case insensitive.
11224 .It Va sendcharsets
11225 \*(OP A comma-separated list of character set names that can be used in
11226 outgoing internet mail.
11227 The value of the variable
11228 .Va charset-8bit
11229 is automatically appended to this list of character sets.
11230 If no character set conversion capabilities are compiled into \*(UA then
11231 the only supported charset is
11232 .Va ttycharset .
11233 Also see
11234 .Va sendcharsets-else-ttycharset
11235 and refer to the section
11236 .Sx "Character sets"
11237 for the complete picture of character set conversion in \*(UA.
11240 .It Va sendcharsets-else-ttycharset
11241 \*(BO\*(OP If this variable is set, but
11242 .Va sendcharsets
11243 is not, then \*(UA acts as if
11244 .Va sendcharsets
11245 had been set to the value of the variable
11246 .Va ttycharset .
11247 In effect this combination passes through the message data in the
11248 character set of the current locale encoding:
11249 therefore mail message text will be (assumed to be) in ISO-8859-1
11250 encoding when send from within a ISO-8859-1 locale, and in UTF-8
11251 encoding when send from within an UTF-8 locale.
11253 The 8-bit fallback
11254 .Va charset-8bit
11255 never comes into play as
11256 .Va ttycharset
11257 is implicitly assumed to be 8-bit and capable to represent all files the
11258 user may specify (as is the case when no character set conversion
11259 support is available in \*(UA and the only supported character set is
11260 .Va ttycharset :
11261 .Sx "Character sets" ) .
11262 This might be a problem for scripts which use the suggested
11263 .Ql LC_ALL=C
11264 setting, since in this case the character set is US-ASCII by definition,
11265 so that it is better to also override
11266 .Va ttycharset ,
11267 then.
11270 .It Va sender
11271 An address that is put into the
11272 .Ql Sender:
11273 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
11274 responsible for the actual transmission of the message.
11275 This field should normally not be used unless the
11276 .Va from
11277 field contains more than one address, on which case it is required.
11278 Dependent on the context this address is handled as if it were in
11279 the list of
11280 .Ic alternates .
11281 Also see
11282 .Fl r ,
11283 .Va r-option-implicit .
11285 .It Va sendmail
11286 \*(OB Predecessor of
11287 .Va mta .
11289 .It Va sendmail-arguments
11290 \*(OB Predecessor of
11291 .Va mta-arguments .
11293 .It Va sendmail-no-default-arguments
11294 \*(OB\*(BO Predecessor of
11295 .Va mta-no-default-arguments .
11297 .It Va sendmail-progname
11298 \*(OB Predecessor of
11299 .Va mta-argv0 .
11302 .It Va sendwait
11303 \*(BO When sending a message wait until the
11304 .Va mta
11305 (including the built-in SMTP one) exits before accepting further commands.
11306 .Sy Only
11307 with this variable set errors reported by the MTA will be recognizable!
11308 If the MTA returns a non-zero exit status,
11309 the exit status of \*(UA will also be non-zero.
11312 .It Va showlast
11313 \*(BO This setting causes \*(UA to start at the last message
11314 instead of the first one when opening a mail folder, as well as with
11315 .Ic from
11317 .Ic headers .
11320 .It Va showname
11321 \*(BO Causes \*(UA to use the sender's real name instead of the plain
11322 address in the header field summary and in message specifications.
11325 .It Va showto
11326 \*(BO Causes the recipient of the message to be shown in the header
11327 summary if the message was sent by the user.
11330 .It Va Sign
11331 The value backing
11332 .Ic ~A ,
11333 one of the
11334 .Sx "COMMAND ESCAPES" .
11335 Also see
11336 .Va message-inject-tail ,
11337 .Va on-compose-leave
11339 .Va on-compose-splice .
11342 .It Va sign
11343 The value backing
11344 .Ic ~a ,
11345 one of the
11346 .Sx "COMMAND ESCAPES" .
11347 Also see
11348 .Va message-inject-tail ,
11349 .Va on-compose-leave
11351 .Va on-compose-splice .
11354 .It Va signature
11355 \*(OB Please use
11356 .Va on-compose-splice
11358 .Va on-compose-splice-shell
11360 .Va on-compose-leave
11361 and (if necessary)
11362 .Va message-inject-tail
11363 instead!
11366 .It Va skipemptybody
11367 \*(BO If an outgoing message does not contain any text in its first or
11368 only message part, do not send it but discard it silently (see also the
11369 command line option
11370 .Fl E ) .
11374 .It Va smime-ca-dir , smime-ca-file
11375 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
11376 Enhanced Mail) for the purpose of verification of S/MIME signed messages.
11377 .Va tls-ca-dir
11378 documents the necessary preparation steps to use the former.
11379 The set of CA certificates which are built into the TLS library can
11380 be explicitly turned off by setting
11381 .Va smime-ca-no-defaults ,
11382 and further fine-tuning is possible via
11383 .Va smime-ca-flags .
11386 .It Va smime-ca-flags
11387 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
11388 storage, and the certificate verification that is used.
11389 The actual values and their meanings are documented for
11390 .Va tls-ca-flags .
11393 .It Va smime-ca-no-defaults
11394 \*(BO\*(OP Do not load the default CA locations that are built into the
11395 used to TLS library to verify S/MIME signed messages.
11397 .Mx Va smime-cipher
11398 .It Va smime-cipher-USER@HOST , smime-cipher
11399 \*(OP Specifies the cipher to use when generating S/MIME encrypted
11400 messages (for the specified account).
11401 RFC 5751 mandates a default of
11402 .Ql aes128
11403 (AES-128 CBC).
11404 Possible values are (case-insensitive and) in decreasing cipher strength:
11405 .Ql aes256
11406 (AES-256 CBC),
11407 .Ql aes192
11408 (AES-192 CBC),
11409 .Ql aes128
11410 (AES-128 CBC),
11411 .Ql des3
11412 (DES EDE3 CBC, 168 bits; default if
11413 .Ql aes128
11414 is not available) and
11415 .Ql des
11416 (DES CBC, 56 bits).
11418 The actually available cipher algorithms depend on the cryptographic
11419 library that \*(UA uses.
11420 \*(OP Support for more cipher algorithms may be available through
11421 dynamic loading via, e.g.,
11422 .Xr EVP_get_cipherbyname 3
11423 (OpenSSL) if \*(UA has been compiled to support this.
11426 .It Va smime-crl-dir
11427 \*(OP Specifies a directory that contains files with CRLs in PEM format
11428 to use when verifying S/MIME messages.
11431 .It Va smime-crl-file
11432 \*(OP Specifies a file that contains a CRL in PEM format to use when
11433 verifying S/MIME messages.
11436 .It Va smime-encrypt-USER@HOST
11437 \*(OP If this variable is set, messages send to the given receiver are
11438 encrypted before sending.
11439 The value of the variable must be set to the name of a file that
11440 contains a certificate in PEM format.
11442 If a message is sent to multiple recipients,
11443 each of them for whom a corresponding variable is set will receive an
11444 individually encrypted message;
11445 other recipients will continue to receive the message in plain text
11446 unless the
11447 .Va smime-force-encryption
11448 variable is set.
11449 It is recommended to sign encrypted messages, i.e., to also set the
11450 .Va smime-sign
11451 variable.
11454 .It Va smime-force-encryption
11455 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
11458 .It Va smime-sign
11459 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
11460 and include the user's certificate as a MIME attachment.
11461 Signing a message enables a recipient to verify that the sender used
11462 a valid certificate,
11463 that the email addresses in the certificate match those in the message
11464 header and that the message content has not been altered.
11465 It does not change the message text,
11466 and people will be able to read the message as usual.
11467 Also see
11468 .Va smime-sign-cert , smime-sign-include-certs
11470 .Va smime-sign-digest .
11472 .Mx Va smime-sign-cert
11473 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
11474 \*(OP Points to a file in PEM format.
11475 For the purpose of signing and decryption this file needs to contain the
11476 user's private key, followed by his certificate.
11478 For message signing
11479 .Ql USER@HOST
11480 is always derived from the value of
11481 .Va from
11482 (or, if that contains multiple addresses,
11483 .Va sender ) .
11484 For the purpose of encryption the recipient's public encryption key
11485 (certificate) is expected; the command
11486 .Ic certsave
11487 can be used to save certificates of signed messages (the section
11488 .Sx "Signed and encrypted messages with S/MIME"
11489 gives some details).
11490 This mode of operation is usually driven by the specialized form.
11492 When decrypting messages the account is derived from the recipient
11493 fields
11494 .Pf ( Ql To:
11496 .Ql Cc: )
11497 of the message, which are searched for addresses for which such
11498 a variable is set.
11499 \*(UA always uses the first address that matches,
11500 so if the same message is sent to more than one of the user's addresses
11501 using different encryption keys, decryption might fail.
11503 For signing and decryption purposes it is possible to use encrypted
11504 keys, and the pseudo-host(s)
11505 .Ql USER@HOST.smime-cert-key
11506 for the private key
11507 (and
11508 .Ql USER@HOST.smime-cert-cert
11509 for the certificate stored in the same file)
11510 will be used for performing any necessary password lookup,
11511 therefore the lookup can be automated via the mechanisms described in
11512 .Sx "On URL syntax and credential lookup" .
11513 For example, the hypothetical address
11514 .Ql bob@exam.ple
11515 could be driven with a private key / certificate pair path defined in
11516 .Va \&\&smime-sign-cert-bob@exam.ple ,
11517 and needed passwords would then be looked up via the pseudo hosts
11518 .Ql bob@exam.ple.smime-cert-key
11519 (and
11520 .Ql bob@exam.ple.smime-cert-cert ) .
11521 To include intermediate certificates, use
11522 .Va smime-sign-include-certs .
11524 .Mx Va smime-sign-digest
11525 .It Va smime-sign-digest-USER@HOST , smime-sign-digest
11526 \*(OP Specifies the message digestto use when signing S/MIME messages.
11527 Please remember that for this use case
11528 .Ql USER@HOST
11529 refers to the variable
11530 .Va from
11531 (or, if that contains multiple addresses,
11532 .Va sender ) .
11533 The available algorithms depend on the used cryptographic library, but
11534 at least one usable builtin algorithm is ensured as a default.
11535 If possible the standard RFC 5751 will be violated by using
11536 .Ql SHA512
11537 instead of the mandated
11538 .Ql SHA1
11539 due to security concerns.
11541 \*(UA will try to add built-in support for the following message
11542 digests, names are case-insensitive:
11543 .Ql BLAKE2b512 ,
11544 .Ql BLAKE2s256 ,
11545 .Ql SHA3-512 ,
11546 .Ql SHA3-384 ,
11547 .Ql SHA3-256 ,
11548 .Ql SHA3-224 ,
11549 as well as the widely available
11550 .Ql SHA512 ,
11551 .Ql SHA384 ,
11552 .Ql SHA256 ,
11553 .Ql SHA224 ,
11554 and the proposed insecure
11555 .Ql SHA1
11557 .Ql MD5 .
11558 More digests may \*(OPally be available through dynamic loading via,
11559 e.g., the OpenSSL function
11560 .Xr EVP_get_digestbyname 3 .
11562 .Mx Va smime-sign-include-certs
11563 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
11564 \*(OP If used, this is supposed to a consist of a comma-separated list
11565 of files, each of which containing a single certificate in PEM format to
11566 be included in the S/MIME message in addition to the
11567 .Va smime-sign-cert
11568 certificate.
11569 This can be used to include intermediate certificates of the certificate
11570 authority, in order to allow the receiver's S/MIME implementation to
11571 perform a verification of the entire certificate chain, starting from
11572 a local root certificate, over the intermediate certificates, down to the
11573 .Va smime-sign-cert .
11574 Even though top level certificates may also be included in the chain,
11575 they won't be used for the verification on the receiver's side.
11577 For the purpose of the mechanisms involved here,
11578 .Ql USER@HOST
11579 refers to the content of the internal variable
11580 .Va from
11581 (or, if that contains multiple addresses,
11582 .Va sender ) .
11583 The pseudo-host
11584 .Ql USER@HOST.smime-include-certs
11585 will be used for performing password lookups for these certificates,
11586 shall they have been given one, therefore the lookup can be automated
11587 via the mechanisms described in
11588 .Sx "On URL syntax and credential lookup" .
11590 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
11591 \*(OB\*(OP Predecessor(s) of
11592 .Va smime-sign-digest .
11594 .It Va smtp
11595 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
11596 .Va mta .
11597 \*(ID For compatibility reasons a set
11598 .Va smtp
11599 is used in preference of
11600 .Va mta .
11602 .Mx Va smtp-auth
11603 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
11604 \*(OP Variable chain that controls the SMTP
11605 .Va mta
11606 authentication method, possible values are
11607 .Ql none
11608 (\*(OU default),
11609 .Ql plain
11610 (\*(IN default),
11611 .Ql login
11612 as well as the \*(OPal methods
11613 .Ql cram-md5
11615 .Ql gssapi .
11617 .Ql none
11618 method does not need any user credentials,
11619 .Ql gssapi
11620 requires a user name and all other methods require a user name and
11621 a password.
11622 See \*(IN
11623 .Va mta ,
11624 .Va user
11626 .Va password
11627 (\*(OU
11628 .Va smtp-auth-password
11630 .Va smtp-auth-user ) .
11631 Note that
11632 .Va smtp-auth-HOST
11633 is \*(IN.
11634 \*(OU: Note for
11635 .Va smtp-auth-USER@HOST :
11636 may override dependent on sender address in the variable
11637 .Va from .
11639 .It Va smtp-auth-password
11640 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
11641 If the authentication method requires a password, but neither
11642 .Va smtp-auth-password
11643 nor a matching
11644 .Va smtp-auth-password-USER@HOST
11645 can be found,
11646 \*(UA will ask for a password on the user's terminal.
11648 .It Va smtp-auth-password-USER@HOST
11649 \*(OU Overrides
11650 .Va smtp-auth-password
11651 for specific values of sender addresses, dependent upon the variable
11652 .Va from .
11654 .It Va smtp-auth-user
11655 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
11656 If the authentication method requires a user name, but neither
11657 .Va smtp-auth-user
11658 nor a matching
11659 .Va smtp-auth-user-USER@HOST
11660 can be found,
11661 \*(UA will ask for a user name on the user's terminal.
11663 .It Va smtp-auth-user-USER@HOST
11664 \*(OU Overrides
11665 .Va smtp-auth-user
11666 for specific values of sender addresses, dependent upon the variable
11667 .Va from .
11670 .It Va smtp-hostname
11671 \*(OP\*(IN Normally \*(UA uses the variable
11672 .Va from
11673 to derive the necessary
11674 .Ql USER@HOST
11675 information in order to issue a
11676 .Ql MAIL FROM:<>
11677 SMTP
11678 .Va mta
11679 command.
11680 Setting
11681 .Va smtp-hostname
11682 can be used to use the
11683 .Ql USER
11684 from the SMTP account
11685 .Pf ( Va mta
11686 or the
11687 .Va user
11688 variable chain)
11689 and the
11690 .Ql HOST
11691 from the content of this variable (or, if that is the empty string,
11692 .Va hostname
11693 or the local hostname as a last resort).
11694 This often allows using an address that is itself valid but hosted by
11695 a provider other than which (in
11696 .Va from )
11697 is about to send the message.
11698 Setting this variable also influences generated
11699 .Ql Message-ID:
11701 .Ql Content-ID:
11702 header fields.
11703 If the \*(OPal IDNA support is available (see
11704 .Va idna-disable )
11705 variable assignment is aborted when a necessary conversion fails.
11707 .Mx Va smtp-use-starttls
11708 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
11709 \*(BO\*(OP Causes \*(UA to issue a
11710 .Ql STARTTLS
11711 command to make an SMTP
11712 .Va mta
11713 session TLS encrypted, i.e., to enable transport layer security.
11715 .Mx Va socks-proxy
11716 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
11717 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
11718 \*(UA will proxy all of its network activities through it.
11719 This can be used to proxy SMTP, POP3 etc. network traffic through the
11720 Tor anonymizer, for example.
11721 The following would create a local SOCKS proxy on port 10000 that
11722 forwards to the machine
11723 .Ql HOST ,
11724 and from which the network traffic is actually instantiated:
11725 .Bd -literal -offset indent
11726 # Create local proxy server in terminal 1 forwarding to HOST
11727 $ ssh -D 10000 USER@HOST
11728 # Then, start a client that uses it in terminal 2
11729 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
11733 .It Va spam-interface
11734 \*(OP In order to use any of the spam-related commands (like, e.g.,
11735 .Ic spamrate )
11736 the desired spam interface must be defined by setting this variable.
11737 Please refer to the manual section
11738 .Sx "Handling spam"
11739 for the complete picture of spam handling in \*(UA.
11740 All or none of the following interfaces may be available:
11742 .Bl -tag -width ".It Ql _ilte_"
11743 .It Ql spamc
11744 Interaction with
11745 .Xr spamc 1
11746 from the
11747 .Xr spamassassin 1
11748 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
11749 suite.
11750 Different to the generic filter interface \*(UA will automatically add
11751 the correct arguments for a given command and has the necessary
11752 knowledge to parse the program's output.
11753 A default value for
11754 .Va spamc-command
11755 will have been compiled into the \*(UA binary if
11756 .Xr spamc 1
11757 has been found in
11758 .Ev PATH
11759 during compilation.
11760 Shall it be necessary to define a specific connection type (rather than
11761 using a configuration file for that), the variable
11762 .Va spamc-arguments
11763 can be used as in, e.g.,
11764 .Ql -d server.example.com -p 783 .
11765 It is also possible to specify a per-user configuration via
11766 .Va spamc-user .
11767 Note that this interface does not inspect the
11768 .Ql is-spam
11769 flag of a message for the command
11770 .Ic spamforget .
11772 .It Ql filter
11773 generic spam filter support via freely configurable hooks.
11774 This interface is meant for programs like
11775 .Xr bogofilter 1
11776 and requires according behaviour in respect to the hooks' exit
11777 status for at least the command
11778 .Ic spamrate
11779 .Pf ( Ql 0
11780 meaning a message is spam,
11781 .Ql 1
11782 for non-spam,
11783 .Ql 2
11784 for unsure and any other return value indicating a hard error);
11785 since the hooks can include shell code snippets diverting behaviour
11786 can be intercepted as necessary.
11787 The hooks are
11788 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
11789   spamfilter-rate
11791 .Va spamfilter-spam ;
11792 the manual section
11793 .Sx "Handling spam"
11794 contains examples for some programs.
11795 The process environment of the hooks will have the variable
11796 .Ev MAILX_FILENAME_GENERATED
11797 set.
11798 Note that spam score support for
11799 .Ic spamrate
11800 is not supported unless the \*(OPtional regular expression support is
11801 available and the
11802 .Va spamfilter-rate-scanscore
11803 variable is set.
11808 .It Va spam-maxsize
11809 \*(OP Messages that exceed this size will not be passed through to the
11810 configured
11811 .Va spam-interface .
11812 If unset or 0, the default of 420000 bytes is used.
11815 .It Va spamc-command
11816 \*(OP The path to the
11817 .Xr spamc 1
11818 program for the
11819 .Ql spamc
11820 .Va spam-interface .
11821 Note that the path is not expanded, but used
11822 .Dq as is .
11823 A fallback path will have been compiled into the \*(UA binary if the
11824 executable had been found during compilation.
11827 .It Va spamc-arguments
11828 \*(OP Even though \*(UA deals with most arguments for the
11829 .Ql spamc
11830 .Va spam-interface
11831 automatically, it may at least sometimes be desirable to specify
11832 connection-related ones via this variable, e.g.,
11833 .Ql -d server.example.com -p 783 .
11836 .It Va spamc-user
11837 \*(OP Specify a username for per-user configuration files for the
11838 .Ql spamc
11839 .Va spam-interface .
11840 If this is set to the empty string then \*(UA will use the name of the
11841 current
11842 .Va user .
11849 .It Va spamfilter-ham , spamfilter-noham , \
11850   spamfilter-nospam , spamfilter-rate , spamfilter-spam
11851 \*(OP Command and argument hooks for the
11852 .Ql filter
11853 .Va spam-interface .
11854 The manual section
11855 .Sx "Handling spam"
11856 contains examples for some programs.
11859 .It Va spamfilter-rate-scanscore
11860 \*(OP Because of the generic nature of the
11861 .Ql filter
11862 .Va spam-interface
11863 spam scores are not supported for it by default, but if the \*(OPnal
11864 regular expression support is available then setting this variable can
11865 be used to overcome this restriction.
11866 It is interpreted as follows: first a number (digits) is parsed that
11867 must be followed by a semicolon
11868 .Ql \&;
11869 and an extended regular expression.
11870 Then the latter is used to parse the first output line of the
11871 .Va spamfilter-rate
11872 hook, and, in case the evaluation is successful, the group that has been
11873 specified via the number is interpreted as a floating point scan score.
11875 .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\
11876   ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file
11877 \*(OB\*(OP Predecessors of
11878 .Va tls-ca-file ,
11879 .Va tls-ca-dir .
11881 .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags
11882 \*(OB\*(OP Predecessor of
11883 .Va tls-ca-flags .
11885 .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\
11886   ssl-ca-no-defaults
11887 \*(OB\*(BO\*(OP Predecessor of
11888 .Va tls-ca-no-defaults .
11890 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
11891 \*(OB\*(OP Please use the
11892 .Cd Certificate
11893 slot of
11894 .Va tls-config-pairs .
11896 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
11897 \*(OB\*(OP Please use the
11898 .Cd CipherString
11899 slot of
11900 .Va tls-config-pairs .
11902 .It Va ssl-config-file
11903 \*(OB\*(OP Predecessor of
11904 .Va tls-config-file .
11906 .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\
11907   ssl-config-module
11908 \*(OB\*(OP Predecessor of
11909 .Va tls-config-module .
11911 .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs
11912 \*(OB\*(OP Predecessor of
11913 .Va tls-config-pairs .
11915 .It Va ssl-crl-dir , ssl-crl-file
11916 \*(OB\*(OP Predecessors of
11917 .Va tls-crl-dir ,
11918 .Va tls-crl-file .
11920 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
11921 \*(OB\*(OP Please use the
11922 .Cd Curves
11923 slot of
11924 .Va tls-config-pairs .
11926 .It Va ssl-features
11927 \*(OB\*(OP\*(RO Predecessor of
11928 .Va tls-features .
11930 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
11931 \*(OB\*(OP Please use the
11932 .Cd PrivateKey
11933 slot of
11934 .Va tls-config-pairs .
11936 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
11937 \*(OB\*(OP Please use the
11938 .Cd Protocol
11939 slot of
11940 .Va tls-config-pairs .
11942 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
11943 \*(OB\*(OP Please use the
11944 .Cd Protocol
11945 slot of
11946 .Va tls-config-pairs .
11948 .It Va ssl-rand-file
11949 \*(OB\*(OP Predecessor of
11950 .Va tls-rand-file .
11952 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
11953 \*(OB\*(OP Predecessor of
11954 .Va tls-verify .
11957 .It Va stealthmua
11958 If only set without an assigned value, then this setting inhibits the
11959 generation of the
11960 .Ql Message-ID: ,
11961 .Ql Content-ID:
11963 .Ql User-Agent:
11964 header fields that include obvious references to \*(UA.
11965 There are two pitfalls associated with this:
11966 First, the message id of outgoing messages is not known anymore.
11967 Second, an expert may still use the remaining information in the header
11968 to track down the originating mail user agent.
11969 If set to the value
11970 .Ql noagent ,
11971 then the mentioned
11972 .Ql Message-ID:
11974 .Ql Content-ID:
11975 suppression does not occur.
11978 .It Va system-mailrc
11979 \*(RO The compiled in path of the system wide initialization file
11980 one of the
11981 .Sx "Resource files" :
11982 .Pa \*(UR .
11986 .It Va termcap
11987 (\*(OP) This specifies a comma-separated list of
11988 .Lb libterminfo
11989 and/or
11990 .Lb libtermcap
11991 capabilities (see
11992 .Sx "On terminal control and line editor" ,
11993 escape commas with reverse solidus) to be used to overwrite or define
11994 entries.
11995 .Sy Note
11996 this variable will only be queried once at program startup and can
11997 thus only be specified in resource files or on the command line.
12000 String capabilities form
12001 .Ql cap=value
12002 pairs and are expected unless noted otherwise.
12003 Numerics have to be notated as
12004 .Ql cap#number
12005 where the number is expected in normal decimal notation.
12006 Finally, booleans do not have any value but indicate a true or false
12007 state simply by being defined or not; this indeed means that \*(UA
12008 does not support undefining an existing boolean.
12009 String capability values will undergo some expansions before use:
12010 for one notations like
12011 .Ql ^LETTER
12012 stand for
12013 .Ql control-LETTER ,
12014 and for clarification purposes
12015 .Ql \eE
12016 can be used to specify
12017 .Ql escape
12018 (the control notation
12019 .Ql ^[
12020 could lead to misreadings when a left bracket follows, which it does for
12021 the standard CSI sequence);
12022 finally three letter octal sequences, as in
12023 .Ql \e061 ,
12024 are supported.
12025 To specify that a terminal supports 256-colours, and to define sequences
12026 that home the cursor and produce an audible bell, one might write:
12028 .Bd -literal -offset indent
12029 ? set termcap='Co#256,home=\eE[H,bel=^G'
12033 The following terminal capabilities are or may be meaningful for the
12034 operation of the built-in line editor or \*(UA in general:
12037 .Bl -tag -compact -width ".It Cd yay"
12038 .\" HAVE_COLOUR
12039 .It Cd colors Ns \0or Cd Co
12040 .Cd max_colors :
12041 numeric capability specifying the maximum number of colours.
12042 Note that \*(UA does not actually care about the terminal beside that,
12043 but always emits ANSI / ISO 6429 escape sequences.
12045 .\" HAVE_TERMCAP
12046 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
12047 .Cd exit_ca_mode
12049 .Cd enter_ca_mode ,
12050 respectively: exit and enter the alternative screen ca-mode,
12051 effectively turning \*(UA into a fullscreen application.
12052 This must be enabled explicitly by setting
12053 .Va termcap-ca-mode .
12055 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
12056 .Cd keypad_xmit
12058 .Cd keypad_local ,
12059 respectively: enable and disable the keypad.
12060 This is always enabled if available, because it seems even keyboards
12061 without keypads generate other key codes for, e.g., cursor keys in that
12062 case, and only if enabled we see the codes that we are interested in.
12064 .It Cd ed Ns \0or Cd cd
12065 .Cd clr_eos :
12066 clear the screen.
12068 .It Cd clear Ns \0or Cd cl
12069 .Cd clear_screen :
12070 clear the screen and home cursor.
12071 (Will be simulated via
12072 .Cd ho
12073 plus
12074 .Cd cd . )
12076 .It Cd home Ns \0or Cd ho
12077 .Cd cursor_home :
12078 home cursor.
12080 .\" HAVE_MLE
12081 .It Cd el Ns \0or Cd ce
12082 .Cd clr_eol :
12083 clear to the end of line.
12084 (Will be simulated via
12085 .Cd ch
12086 plus repetitions of space characters.)
12088 .It Cd hpa Ns \0or Cd ch
12089 .Cd column_address :
12090 move the cursor (to the given column parameter) in the current row.
12091 (Will be simulated via
12092 .Cd cr
12093 plus
12094 .Cd nd . )
12096 .It Cd cr
12097 .Cd carriage_return :
12098 move to the first column in the current row.
12099 The default built-in fallback is
12100 .Ql \er .
12102 .It Cd cub1 Ns \0or Cd le
12103 .Cd cursor_left :
12104 move the cursor left one space (non-destructively).
12105 The default built-in fallback is
12106 .Ql \eb .
12108 .It Cd cuf1 Ns \0or Cd nd
12109 .Cd cursor_right :
12110 move the cursor right one space (non-destructively).
12111 The default built-in fallback is
12112 .Ql \eE[C ,
12113 which is used by most terminals.
12114 Less often occur
12115 .Ql \eEC
12117 .Ql \eEOC .
12121 Many more capabilities which describe key-sequences are documented for
12122 .Ic bind .
12126 .It Va termcap-ca-mode
12127 \*(OP Allow usage of the
12128 .Cd exit_ca_mode
12130 .Cd enter_ca_mode
12131 terminal capabilities, see
12132 .Va termcap .
12133 .Sy Note
12134 this variable will only be queried once at program startup and can
12135 thus only be specified in resource files or on the command line.
12138 .It Va termcap-disable
12139 \*(OP Disable any interaction with a terminal control library.
12140 If set only some generic fallback built-ins and possibly the content of
12141 .Va termcap
12142 describe the terminal to \*(UA.
12143 .Sy Note
12144 this variable will only be queried once at program startup and can
12145 thus only be specified in resource files or on the command line.
12147 .Mx Va tls-ca-file
12148 .Mx Va tls-ca-dir
12149 .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\
12150   tls-ca-file-USER@HOST , tls-ca-file-HOST , tls-ca-file
12151 \*(OP Directory and file, respectively, for pools of trusted CA
12152 certificates in PEM (Privacy Enhanced Mail) format, for the purpose of
12153 verification of TLS server certificates.
12154 Concurrent use is possible, the file is loaded once needed first, the
12155 directory lookup is performed anew as a last resort whenever necessary.
12156 The CA certificate pool built into the TLS library can be disabled via
12157 .Va tls-ca-no-defaults ,
12158 further fine-tuning is possible via
12159 .Va tls-ca-flags .
12160 Note the directory search variant requires the certificate files to
12161 adhere special filename conventions, please see
12162 .Xr SSL_CTX_load_verify_locations 3
12164 .Xr verify 1
12166 .Xr c_rehash 1 ) .
12169 .Mx Va tls-ca-flags
12170 .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags
12171 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
12172 storage, and the certificate verification that is used (also see
12173 .Va tls-verify ) .
12174 The value is expected to consist of a comma-separated list of
12175 configuration directives, with any intervening whitespace being ignored.
12176 The directives directly map to flags that can be passed to
12177 .Xr X509_STORE_set_flags 3 ,
12178 which are usually defined in a file
12179 .Pa openssl/x509_vfy.h ,
12180 and the availability of which depends on the used TLS library
12181 version: a directive without mapping is ignored (error log subject to
12182 .Va debug ) .
12183 Directives currently understood (case-insensitively) include:
12186 .Bl -tag -compact -width ".It Cd BaNg"
12187 .It Cd no-alt-chains
12188 If the initial chain is not trusted, do not attempt to build an
12189 alternative chain.
12190 Setting this flag will make OpenSSL certificate verification match that
12191 of older OpenSSL versions, before automatic building and checking of
12192 alternative chains has been implemented; also see
12193 .Cd trusted-first .
12194 .It Cd no-check-time
12195 Do not check certificate/CRL validity against current time.
12196 .It Cd partial-chain
12197 By default partial, incomplete chains which cannot be verified up to the
12198 chain top, a self-signed root certificate, will not verify.
12199 With this flag set, a chain succeeds to verify if at least one signing
12200 certificate of the chain is in any of the configured trusted stores of
12201 CA certificates.
12202 The OpenSSL manual page
12203 .Xr SSL_CTX_load_verify_locations 3
12204 gives some advise how to manage your own trusted store of CA certificates.
12205 .It Cd strict
12206 Disable workarounds for broken certificates.
12207 .It Cd trusted-first
12208 Try building a chain using issuers in the trusted store first to avoid
12209 problems with server-sent legacy intermediate certificates.
12210 Newer versions of OpenSSL support alternative chain checking and enable
12211 it by default, resulting in the same behaviour; also see
12212 .Cd no-alt-chains .
12216 .Mx Va tls-ca-no-defaults
12217 .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\
12218   tls-ca-no-defaults
12219 \*(BO\*(OP Do not load the default CA locations that are built into the
12220 used to TLS library to verify TLS server certificates.
12223 .It Va tls-config-file
12224 \*(OP If this variable is set
12225 .Xr CONF_modules_load_file 3
12226 (if announced via
12227 .Ql +modules-load-file
12229 .Va tls-features )
12230 is used to allow resource file based configuration of the TLS library.
12231 This happens once the library is used first, which may also be early
12232 during startup (logged with
12233 .Va verbose ) !
12234 If a non-empty value is given then the given file, after performing
12235 .Sx "Filename transformations" ,
12236 will be used instead of the TLS libraries global default, and it is an
12237 error if the file cannot be loaded.
12238 The application name will always be passed as
12239 .Ql \*(uA .
12240 Some TLS libraries support application-specific configuration via
12241 resource files loaded like this, please see
12242 .Va tls-config-module .
12244 .Mx Va tls-config-module
12245 .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\
12246   tls-config-module
12247 \*(OP If file based application-specific configuration via
12248 .Va tls-config-file
12249 is available, announced as
12250 .Ql +ctx-config
12252 .Va tls-features ,
12253 indicating availability of
12254 .Xr SSL_CTX_config 3 ,
12255 then, it becomes possible to use a central TLS configuration file
12256 for all programs, including \*(uA, e.g.:
12257 .Bd -literal -offset indent
12258 # Register a configuration section for \*(uA
12259 \*(uA = mailx_master
12260 # The top configuration section creates a relation
12261 # in between dynamic SSL configuration and an actual
12262 # program specific configuration section
12263 [mailx_master]
12264 ssl_conf = mailx_tls_config
12265 # Well that actual program specific configuration section
12266 # now can map individual tls-config-module names to sections,
12267 # e.g., tls-config-module=account_xy
12268 [mailx_tls_config]
12269 account_xy = mailx_account_xy
12270 account_yz = mailx_account_yz
12271 [mailx_account_xy]
12272 MinProtocol = TLSv1.2
12273 Curves=P-521
12274 [mailx_account_yz]
12275 CipherString = TLSv1.2:!aNULL:!eNULL:
12276 MinProtocol = TLSv1.1
12277 Options = Bugs
12281 .Mx Va tls-config-pairs
12282 .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs
12283 \*(OP The value of this variable chain will be interpreted as
12284 a comma-separated list of directive/value pairs.
12285 Directives and values need to be separated by equals signs
12286 .Ql = ,
12287 any whitespace surrounding pair members is removed.
12288 Keys are (usually) case-insensitive.
12289 Different to when placing these pairs in a
12290 .Va tls-config-module
12291 section of a
12292 .Va tls-config-file ,
12293 commas
12294 .Ql \&,
12295 need to be escaped with a reverse solidus
12296 .Ql \e
12297 when included in pairs; also different: if the equals sign
12298 .Ql =
12299 is preceded with an asterisk
12300 .Ql *
12301 .Sx "Filename transformations"
12302 will be performed on the value; it is an error if these fail.
12303 Unless proper support is announced by
12304 .Va tls-features
12305 .Pf ( Ql +conf-ctx )
12306 only the keys below are supported, otherwise the pairs will be used
12307 directly as arguments to the function
12308 .Xr SSL_CONF_cmd 3 .
12311 .Bl -tag -compact -width ".It Cd C_rtificate_"
12312 .It Cd Certificate
12313 Filename of a TLS client certificate (chain) required by some servers.
12314 Fallback support via
12315 .Xr SSL_CTX_use_certificate_chain_file 3 .
12316 .Sx "Filename transformations"
12317 are performed.
12318 .\" v15compat: remove the next sentence
12319 .Sy Note:
12320 if you use this you need to specify the private key via
12321 .Cd PrivateKey ,
12322 .Va tls-key
12323 will not be used!
12325 .It Cd CipherString
12326 A list of ciphers for TLS connections, see
12327 .Xr ciphers 1 .
12328 By default no list of ciphers is set, resulting in a
12329 .Cd Protocol Ns - Ns
12330 specific list of ciphers (the protocol standards define lists of
12331 acceptable ciphers; possibly cramped by the used TLS library).
12332 Fallback support via
12333 .Xr SSL_CTX_set_cipher_list 3 .
12335 .It Cd Ciphersuites
12336 A list of ciphers used for TLSv1.3 connections, see
12337 .Xr ciphers 1 .
12338 These will be joined onto the list of ciphers from
12339 .Cd CipherString .
12340 Available if
12341 .Va tls-features
12342 announces
12343 .Ql +ctx-set-ciphersuites ,
12344 as necessary via
12345 .Xr SSL_CTX_set_ciphersuites 3 .
12347 .It Cd Curves
12348 A list of supported elliptic curves, if applicable.
12349 By default no curves are set.
12350 Fallback support via
12351 .Xr SSL_CTX_set1_curves_list 3 ,
12352 if available.
12354 .It Cd MaxProtocol , MinProtocol
12355 The maximum and minimum supported TLS versions, respectively.
12356 Available if
12357 .Va tls-features
12358 announces
12359 .Ql +ctx-set-maxmin-proto ,
12360 as necessary via
12361 .Xr SSL_CTX_set_max_proto_version 3
12363 .Xr SSL_CTX_set_min_proto_version 3 ;
12364 these fallbacks use an internal parser which understands the strings
12365 .Ql SSLv3 ,
12366 .Ql TLSv1 ,
12367 .Ql TLSv1.1 ,
12368 .Ql TLSv1.2 ,
12369 .Ql TLSv1.3 ,
12370 and the special value
12371 .Ql None ,
12372 which disables the given limit.
12374 .It Cd Options
12375 Various flags to set.
12376 Fallback via
12377 .Xr SSL_CTX_set_options 3 ,
12378 in which case any other value but (exactly)
12379 .Ql Bugs
12380 results in an error.
12382 .It Cd PrivateKey
12383 Filename of the private key in PEM format of a TLS client certificate.
12384 If unset, the name of the certificate file is used.
12385 .Sx "Filename transformations"
12386 are performed.
12387 Fallback via
12388 .Xr SSL_CTX_use_PrivateKey_file 3 .
12389 .\" v15compat: remove the next sentence
12390 .Sy Note:
12391 if you use this you need to specify the certificate (chain) via
12392 .Cd Certificate ,
12393 .Va tls-cert
12394 will not be used!
12396 .It Cd Protocol
12397 The used TLS protocol.
12399 .Va tls-features
12400 announces
12401 .Ql +conf-ctx
12403 .Ql ctx-set-maxmin-proto
12404 then using
12405 .Cd MaxProtocol
12407 .Cd MinProtocol
12408 is preferable.
12409 Fallback is
12410 .Xr SSL_CTX_set_options 3 ,
12411 driven via an internal parser which understands the strings
12412 .Ql SSLv3 ,
12413 .Ql TLSv1 ,
12414 .Ql TLSv1.1 ,
12415 .Ql TLSv1.2 ,
12416 .Ql TLSv1.3 ,
12417 and the special value
12418 .Ql ALL .
12419 Multiple protocols may be given as a comma-separated list, any
12420 whitespace is ignored, an optional plus sign
12421 .Ql +
12422 prefix enables, a hyphen-minus
12423 .Ql -
12424 prefix disables a protocol, so that
12425 .Ql -ALL, TLSv1.2
12426 enables only the TLSv1.2 protocol.
12432 .It Va tls-crl-dir , tls-crl-file
12433 \*(OP Specify a directory / a file, respectively, that contains a CRL in
12434 PEM format to use when verifying TLS server certificates.
12437 .It Va tls-features
12438 \*(OP\*(RO This expands to a comma separated list of the TLS library
12439 identity and optional SSL library features.
12440 Currently supported identities are
12441 .Ql libressl
12442 (LibreSSL) ,
12443 .Ql libssl-0x10100
12444 (OpenSSL v1.1.x series)
12446 .Ql libssl-0x10000
12447 (elder OpenSSL series, other clones).
12448 Optional features are preceded with a plus sign
12449 .Ql +
12450 when available, and with a hyphen-minus
12451 .Ql -
12452 otherwise.
12454 Currently known features are
12455 .Ql modules-load-file
12456 .Pf ( Va tls-config-file ) ,
12457 .Ql conf-ctx
12458 .Pf ( Va tls-config-pairs ) ,
12459 .Ql ctx-config
12460 .Pf ( Va tls-config-module ) ,
12461 .Ql ctx-set-maxmin-proto
12462 .Pf ( Va tls-config-pairs ) ,
12463 .Ql ctx-set-ciphersuites
12464 (the
12465 .Cd Ciphersuites
12466 slot of
12467 .Va tls-config-pairs ) .
12469 .Mx Va tls-fingerprint
12470 .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint
12471 \*(OP It is possible to replace the verification of the connection
12472 peer certificate against the entire local pool of CAs (for more see
12473 .Sx "Encrypted network communication" )
12474 with the comparison against a precalculated certificate message digest,
12475 the so-called fingerprint, to be specified as the used
12476 .Va tls-fingerprint-digest .
12477 This fingerprint can be calculated with, e.g.,
12478 .Ql Ic tls Ns \:\0\:fingerprint HOST .
12480 .Mx Va tls-fingerprint-digest
12481 .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \
12482   tls-fingerprint-digest
12483 \*(OP The message digest to be used when creating TLS certificate
12484 fingerprints, the defaults, if available, in test order, being
12485 .Ql BLAKE2s256 ,
12486 .Ql SHA256 .
12487 For the complete list of digest algorithms refer to
12488 .Va smime-sign-digest .
12491 .It Va tls-rand-file
12492 \*(OP Gives the filename to a file with random entropy data, see
12493 .Xr RAND_load_file 3 .
12494 If this variable is not set, or set to the empty string, or if the
12495 .Sx "Filename transformations"
12496 fail, then
12497 .Xr RAND_file_name 3
12498 will be used to create the filename.
12499 If the SSL PRNG was seeded successfully
12500 The file will be updated
12501 .Pf ( Xr RAND_write_file 3 )
12502 if and only if seeding and buffer stirring succeeds.
12504 .Mx Va tls-verify
12505 .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify
12506 \*(OP Variable chain that sets the action to be performed if an error
12507 occurs during TLS server certificate validation against the
12508 specified or default trust stores
12509 .Va tls-ca-dir ,
12510 .Va tls-ca-file ,
12511 or the TLS library built-in defaults (unless usage disallowed via
12512 .Va tls-ca-no-defaults ) ,
12513 and as fine-tuned via
12514 .Va tls-ca-flags .
12515 Valid (case-insensitive) values are
12516 .Ql strict
12517 (fail and close connection immediately),
12518 .Ql ask
12519 (ask whether to continue on standard input),
12520 .Ql warn
12521 (show a warning and continue),
12522 .Ql ignore
12523 (do not perform validation).
12524 The default is
12525 .Ql ask .
12527 .It Va toplines
12528 If defined, gives the number of lines of a message to be displayed
12529 with the command
12530 .Ic top ;
12531 if unset, the first five lines are printed, if set to 0 the variable
12532 .Va screen
12533 is inspected.
12534 If the value is negative then its absolute value will be used for
12535 unsigned right shifting (see
12536 .Ic vexpr )
12538 .Va screen
12539 height.
12542 .It Va topsqueeze
12543 \*(BO If set then the
12544 .Ic top
12545 command series will strip adjacent empty lines and quotations.
12548 .It Va ttycharset
12549 The character set of the terminal \*(UA operates on,
12550 and the one and only supported character set that \*(UA can use if no
12551 character set conversion capabilities have been compiled into it,
12552 in which case it defaults to ISO-8859-1.
12553 Otherwise it defaults to UTF-8.
12554 Sufficient locale support provided the default will be preferably
12555 deduced from the locale environment if that is set (e.g.,
12556 .Ev LC_CTYPE ,
12557 see there for more); runtime locale changes will be reflected by
12558 .Va \&\&ttycharset
12559 except during the program startup phase and if
12560 .Fl S
12561 had been used to freeze the given value.
12562 Refer to the section
12563 .Sx "Character sets"
12564 for the complete picture about character sets.
12567 .It Va typescript-mode
12568 \*(BO A special multiplex variable that disables all variables and
12569 settings which result in behaviour that interferes with running \*(UA in
12570 .Xr script 1 ,
12571 e.g., it sets
12572 .Va colour-disable ,
12573 .Va line-editor-disable
12574 and (before startup completed only)
12575 .Va termcap-disable .
12576 Unsetting it does not restore the former state of the covered settings.
12579 .It Va umask
12580 For a safe-by-default policy the process file mode creation mask
12581 .Xr umask 2
12582 will be set to
12583 .Ql 0077
12584 on program startup by default.
12585 Child processes inherit the file mode creation mask of their parent, and
12586 by setting this variable to an empty value no change will be applied,
12587 and the inherited value will be used.
12588 Otherwise the given value will be made the new file mode creation mask.
12590 .Mx Va user
12591 .It Va user-HOST , user
12592 \*(IN Variable chain that sets a global fallback user name, which is
12593 used in case none has been given in the protocol and account-specific
12594 URL.
12595 This variable defaults to the name of the user who runs \*(UA.
12598 .It Va v15-compat
12599 \*(BO Setting this enables upward compatibility with \*(UA
12600 version 15.0 in respect to which configuration options are available and
12601 how they are handled.
12602 This manual uses \*(IN and \*(OU to refer to the new and the old way of
12603 doing things, respectively.
12606 .It Va verbose
12607 \*(BO This setting, also controllable via the command line option
12608 .Fl v ,
12609 causes \*(UA to be more verbose, e.g., it will display obsoletion
12610 warnings and TLS certificate chains.
12611 Even though marked \*(BO this option may be set twice in order to
12612 increase the level of verbosity even more, in which case even details of
12613 the actual message delivery and protocol conversations are shown.
12614 A single
12615 .Pf no Va verbose
12616 is sufficient to disable verbosity as such.
12623 .It Va version , version-date , \
12624   version-hexnum , version-major , version-minor , version-update
12625 \*(RO \*(UA version information: the first variable is a string with
12626 the complete version identification, the second the release date in ISO
12627 8601 notation without time.
12628 The third is a 32-bit hexadecimal number with the upper 8 bits storing
12629 the major, followed by the minor and update version numbers which occupy
12630 12 bits each.
12631 The latter three variables contain only decimal digits: the major, minor
12632 and update version numbers.
12633 The output of the command
12634 .Ic version
12635 will include this information.
12638 .It Va writebackedited
12639 If this variable is set messages modified using the
12640 .Ic edit
12642 .Ic visual
12643 commands are written back to the current folder when it is quit;
12644 it is only honoured for writable folders in MBOX format, though.
12645 Note that the editor will be pointed to the raw message content in that
12646 case, i.e., neither MIME decoding nor decryption will have been
12647 performed, and proper RFC 4155
12648 .Ql From_
12649 quoting of newly added or edited content is also left as an exercise to
12650 the user.
12652 .\" }}} (Variables)
12654 .\" }}} (INTERNAL VARIABLES)
12657 .\" .Sh ENVIRONMENT {{{
12658 .Sh ENVIRONMENT
12660 The term
12661 .Dq environment variable
12662 should be considered an indication that these variables are either
12663 standardized as vivid parts of process environments, or that they are
12664 commonly found in there.
12665 The process environment is inherited from the
12666 .Xr sh 1
12667 once \*(UA is started, and unless otherwise explicitly noted handling of
12668 the following variables transparently integrates into that of the
12669 .Sx "INTERNAL VARIABLES"
12670 from \*(UA's point of view.
12671 This means that, e.g., they can be managed via
12672 .Ic set
12674 .Ic unset ,
12675 causing automatic program environment updates (to be inherited by
12676 newly created child processes).
12679 In order to integrate other environment variables equally they need to
12680 be imported (linked) with the command
12681 .Ic environ .
12682 This command can also be used to set and unset non-integrated
12683 environment variables from scratch, sufficient system support provided.
12684 The following example, applicable to a POSIX shell, sets the
12685 .Ev COLUMNS
12686 environment variable for \*(UA only, and beforehand exports the
12687 .Ev EDITOR
12688 in order to affect any further processing in the running shell:
12690 .Bd -literal -offset indent
12691 $ EDITOR="vim -u ${HOME}/.vimrc"
12692 $ export EDITOR
12693 $ COLUMNS=80 \*(uA -R
12696 .Bl -tag -width ".It Ev BaNg"
12698 .It Ev COLUMNS
12699 The user's preferred width in column positions for the terminal screen.
12700 Queried and used once on program startup in interactive or batch
12701 .Pf ( Fl \&# )
12702 mode, actively managed for child processes and the MLE (see
12703 .Sx "On terminal control and line editor" )
12704 in interactive mode thereafter.
12705 Non-interactive mode always uses, and the fallback default is 80 columns.
12706 If in batch mode
12707 .Ev \&\&COLUMNS
12709 .Ev LINES
12710 are both set but not both are usable (empty, not a number, or 0) at
12711 program startup, then the real terminal screen size will be (tried to
12712 be) determined once.
12713 (Normally the
12714 .Xr sh 1
12715 manages these variables, and unsets them for pipe specifications etc.)
12718 .It Ev DEAD
12719 The name of the (mailbox)
12720 .Ic file
12721 to use for saving aborted messages if
12722 .Va save
12723 is set; this defaults to
12724 .Pa \*(VD .
12725 If the variable
12726 .Va debug
12727 is set no output will be generated, otherwise the contents of the file
12728 will be replaced.
12731 .It Ev EDITOR
12732 Pathname of the text editor to use for the
12733 .Ic edit
12734 command and
12735 .Ic ~e
12736 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
12737 .Ev VISUAL
12738 is used for a more display oriented editor.
12741 .It Ev HOME
12742 The user's home directory.
12743 This variable is only used when it resides in the process environment.
12744 The calling user's home directory will be used instead if this directory
12745 does not exist, is not accessible or cannot be read;
12746 it will always be used for the root user.
12747 (No test for being writable is performed to allow usage by
12748 non-privileged users within read-only jails, but dependent on the
12749 variable settings this directory is a default write target, e.g. for
12750 .Ev DEAD ,
12751 .Ev MBOX
12752 and more.)
12757 .It Ev LC_ALL , LC_CTYPE , LANG
12758 \*(OP The (names in lookup order of the)
12759 .Xr locale 7
12760 (and / or see
12761 .Xr setlocale 3 )
12762 which indicates the used
12763 .Sx "Character sets" .
12764 Runtime changes trigger automatic updates of the entire locale system,
12765 which includes updating
12766 .Va ttycharset
12767 (except during startup if the variable has been frozen via
12768 .Fl S ) .
12771 .It Ev LINES
12772 The user's preferred number of lines for the terminal screen.
12773 The behaviour is as described for
12774 .Ev COLUMNS ,
12775 yet the non-interactive and fallback default is 24 (lines).
12778 .It Ev LISTER
12779 Pathname of the directory lister to use in the
12780 .Ic folders
12781 command when operating on local mailboxes.
12782 Default is
12783 .Xr ls 1
12784 (path search through
12785 .Ev SHELL ) .
12788 .It Ev LOGNAME
12789 Upon startup \*(UA will actively ensure that this variable refers to the
12790 name of the user who runs \*(UA, in order to be able to pass a verified
12791 name to any newly created child process.
12794 .It Ev MAIL
12795 Is used as the user's
12796 .Mx -sx
12797 .Sx "primary system mailbox"
12798 unless
12799 .Va inbox
12800 is set.
12801 This is assumed to be an absolute pathname.
12802 If this environmental fallback is also not set, a built-in compile-time
12803 default is used.
12806 .It Ev MAILCAPS
12807 \*(OP Overrides the default path search for
12808 .Sx "The Mailcap files" ,
12809 which is defined in the standard RFC 1524 as
12810 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
12811 .\" TODO we should have a mailcaps-default virtual RDONLY option!
12812 (\*(UA makes it a configuration option, however.)
12813 Note this is not a search path, but a path search.
12816 .It Ev MAILRC
12817 Is used as a startup file instead of
12818 .Pa \*(ur
12819 if set.
12820 In order to avoid side-effects from configuration files scripts should
12821 either set this variable to
12822 .Pa /dev/null
12823 or the
12824 .Fl \&:
12825 command line option should be used.
12828 .It Ev MAILX_NO_SYSTEM_RC
12829 If this variable is set then reading of
12830 .Pa \*(UR
12831 (a.k.a.\&
12832 .Va system-mailrc )
12833 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
12834 had been started up with the option
12835 .Fl \&:
12836 (and according argument) or
12837 .Fl n .
12838 This variable is only used when it resides in the process environment.
12841 .It Ev MBOX
12842 The name of the user's
12843 .Mx -sx
12844 .Sx "secondary mailbox"
12845 file.
12846 A logical subset of the special
12847 .Sx "Filename transformations"
12848 (also see
12849 .Ic file )
12850 are supported.
12851 The default is
12852 .Pa \*(VM .
12853 Traditionally this MBOX is used as the file to save messages from the
12854 .Mx -sx
12855 .Sx "primary system mailbox"
12856 that have been read.
12857 Also see
12858 .Sx "Message states" .
12861 .It Ev NETRC
12862 \*(IN\*(OP This variable overrides the default location of the user's
12863 .Pa \*(VN
12864 file.
12867 .It Ev PAGER
12868 Pathname of the program to use for backing the command
12869 .Ic more ,
12870 and when the
12871 .Va crt
12872 variable enforces usage of a pager for output.
12873 The default paginator is
12874 .Xr more 1
12875 (path search through
12876 .Ev SHELL ) .
12878 \*(UA inspects the contents of this variable: if its contains the string
12879 .Dq less
12880 then a non-existing environment variable
12881 .Ev LESS
12882 will be set to
12883 .Ql Ri ,
12884 likewise for
12885 .Dq lv
12886 .Ev LV
12887 will optionally be set to
12888 .Ql -c .
12889 Alse see
12890 .Va colour-pager .
12893 .It Ev PATH
12894 A colon-separated list of directories that is searched by the shell when
12895 looking for commands, e.g.,
12896 .Ql /bin:/usr/bin:/usr/local/bin .
12899 .It Ev POSIXLY_CORRECT
12900 This variable is automatically looked for upon startup, see
12901 .Va posix
12902 for more.
12905 .It Ev SHELL
12906 The shell to use for the commands
12907 .Ic \&! ,
12908 .Ic shell ,
12910 .Ic ~!
12911 .Sx "COMMAND ESCAPES"
12912 and when starting subprocesses.
12913 A default shell is used if this environment variable is not defined.
12916 .It Ev SOURCE_DATE_EPOCH
12917 Specifies a time in seconds since the Unix epoch (1970-01-01) to be
12918 used in place of the current time.
12919 This variable is looked up upon program startup, and its existence will
12920 switch \*(UA to a reproducible mode
12921 .Pf ( Lk https://reproducible-builds.org )
12922 which uses deterministic random numbers, a special fixated pseudo
12923 .Ev LOGNAME
12924 and more.
12925 This operation mode is used for development and by software packagers.
12926 \*(ID Currently an invalid setting is only ignored, rather than causing
12927 a program abortion.
12929 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
12932 .It Ev TERM
12933 \*(OP The terminal type for which output is to be prepared.
12934 For extended colour and font control please refer to
12935 .Sx "Coloured display" ,
12936 and for terminal management in general to
12937 .Sx "On terminal control and line editor" .
12940 .It Ev TMPDIR
12941 Except for the root user this variable defines the directory for
12942 temporary files to be used instead of
12943 .Pa \*(VT
12944 (or the given compile-time constant) if set, existent, accessible as
12945 well as read- and writable.
12946 This variable is only used when it resides in the process environment,
12947 but \*(UA will ensure at startup that this environment variable is
12948 updated to contain a usable temporary directory.
12951 .It Ev USER
12952 Identical to
12953 .Ev LOGNAME
12954 (see there), but this variable is not standardized, should therefore not
12955 be used, and is only corrected if already set.
12958 .It Ev VISUAL
12959 Pathname of the text editor to use for the
12960 .Ic visual
12961 command and
12962 .Ic ~v
12963 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
12964 .Ev EDITOR
12965 is used for a less display oriented editor.
12968 .\" }}}
12971 .\" .Sh FILES {{{
12972 .Sh FILES
12974 .\" file list {{{
12975 .Bl -tag -width ".It Pa BaNg"
12976 .It Pa \*(ur
12977 User-specific file giving initial commands, one of the
12978 .Sx "Resource files" .
12979 The actual value is read from
12980 .Va MAILRC .
12982 .It Pa \*(UR
12983 System wide initialization file, one of the
12984 .Sx "Resource files" .
12985 The actual value is read from
12986 .Va system-mailrc .
12989 .It Pa ~/.mailcap
12990 \*(OP Personal MIME type handler definition file, see
12991 .Sx "The Mailcap files" .
12992 This location is part of the RFC 1524 standard search path, which is
12993 a configuration option and can be overridden via
12994 .Ev MAILCAPS .
12997 .It Pa /etc/mailcap
12998 \*(OP System wide MIME type handler definition file, see
12999 .Sx "The Mailcap files" .
13000 This location is part of the RFC 1524 standard search path, which is
13001 a configuration option and can be overridden via
13004 .It Pa \*(VM
13005 The default value for
13006 .Ev MBOX .
13009 .It Pa \*(vU
13010 Personal MIME types, see
13011 .Sx "The mime.types files" .
13014 .It Pa \*(vS
13015 System wide MIME types, see
13016 .Sx "The mime.types files" .
13019 .It Pa \*(VN
13020 \*(IN\*(OP The default location of the user's
13021 .Pa .netrc
13022 file \(en the section
13023 .Sx "The .netrc file"
13024 documents the file format.
13025 The actually used path can be overridden via
13026 .Ev NETRC .
13029 .It Pa /dev/null
13030 The data sink
13031 .Xr null 4 .
13033 .\" }}}
13035 .\" .Ss "Resource files" {{{
13036 .Ss "Resource files"
13038 Upon startup \*(UA reads in several resource files, in order:
13040 .Bl -tag -width ".It Pa BaNg"
13042 .It Pa \*(UR
13043 System wide initialization file
13044 .Pf ( Va system-mailrc ) .
13045 Reading of this file can be suppressed, either by using the
13046 .Fl \&:
13047 (and according argument) or
13048 .Fl n
13049 command line options, or by setting the
13050 .Sx ENVIRONMENT
13051 variable
13052 .Ev MAILX_NO_SYSTEM_RC .
13055 .It Pa \*(ur
13056 File giving initial commands.
13057 A different file can be chosen by setting the
13058 .Sx ENVIRONMENT
13059 variable
13060 .Ev MAILRC .
13061 Reading of this file can be suppressed with the
13062 .Fl \&:
13063 command line option.
13065 .It Va mailx-extra-rc
13066 Defines a startup file to be read after all other resource files.
13067 It can be used to specify settings that are not understood by other
13068 .Xr mailx 1
13069 implementations, for example.
13070 This variable is only honoured when defined in a resource file, e.g.,
13071 it is one of the
13072 .Sx "INTERNAL VARIABLES" .
13076 The content of these files is interpreted as follows:
13079 .Bl -bullet -compact
13081 The whitespace characters space, tabulator and newline,
13082 as well as those defined by the variable
13083 .Va ifs ,
13084 are removed from the beginning and end of input lines.
13086 Empty lines are ignored.
13088 Any other line is interpreted as a command.
13089 It may be spread over multiple input lines if the newline character is
13090 .Dq escaped
13091 by placing a reverse solidus character
13092 .Ql \e
13093 as the last character of the line; whereas any leading whitespace of
13094 follow lines is ignored, trailing whitespace before a escaped newline
13095 remains in the input.
13097 If the line (content) starts with the number sign
13098 .Ql #
13099 then it is a comment-command and also ignored.
13100 (The comment-command is a real command, which does nothing, and
13101 therefore the usual follow lines mechanism applies!)
13105 Unless \*(UA is about to enter interactive mode syntax errors that occur
13106 while loading these files are treated as errors and cause program exit.
13107 More files with syntactically equal content can be
13108 .Ic source Ns ed .
13109 The following, saved in a file, would be an examplary content:
13111 .Bd -literal -offset indent
13112  # This line is a comment command.  And y\e
13113     es, it is really continued here.
13114 set debug \e
13115     verbose
13116     set editheaders
13118 .\" }}}
13120 .\" .Ss "The mime.types files" {{{
13121 .Ss "The mime.types files"
13123 As stated in
13124 .Sx "HTML mail and MIME attachments"
13125 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
13126 media types in order to classify message and attachment content.
13127 One source for them are
13128 .Pa mime.types
13129 files, the loading of which can be controlled by setting the variable
13130 .Va mimetypes-load-control .
13131 Another is the command
13132 .Ic mimetype ,
13133 which also offers access to \*(UAs MIME type cache.
13134 .Pa mime.types
13135 files have the following syntax:
13137 .Bd -literal -offset indent
13138 type/subtype extension [extension ...]
13139 # E.g., text/html html htm
13143 where
13144 .Ql type/subtype
13145 define the MIME media type, as standardized in RFC 2046:
13146 .Ql type
13147 is used to declare the general type of data, while the
13148 .Ql subtype
13149 specifies a specific format for that type of data.
13150 One or multiple filename
13151 .Ql extension Ns
13152 s, separated by whitespace, can be bound to the media type format.
13153 Comments may be introduced anywhere on a line with a number sign
13154 .Ql # ,
13155 causing the remaining line to be discarded.
13157 \*(UA also supports an extended, non-portable syntax in especially
13158 crafted files, which can be loaded via the alternative value syntax of
13159 .Va mimetypes-load-control ,
13160 and prepends an optional
13161 .Ql type-marker :
13164 .Dl [type-marker ]type/subtype extension [extension ...]
13167 The following type markers are supported:
13170 .Bl -tag -compact -width ".It Ar _n_u"
13171 .It Ar @
13172 Treat message parts with this content as plain text.
13173 .It Ar @t
13174 The same as plain
13175 .Ar @ .
13176 .It Ar @h
13177 Treat message parts with this content as HTML tagsoup.
13178 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
13179 the content as plain text instead.
13180 .It Ar @H
13181 Likewise
13182 .Ar @h ,
13183 but instead of falling back to plain text require an explicit content
13184 handler to be defined.
13185 .It Ar @q
13186 If no handler can be found a text message is displayed which says so.
13187 This can be annoying, for example signatures serve a contextual purpose,
13188 their content is of no use by itself.
13189 This marker will avoid displaying the text message.
13193 Further reading:
13194 for sending messages:
13195 .Ic mimetype ,
13196 .Va mime-allow-text-controls ,
13197 .Va mimetypes-load-control .
13198 For reading etc. messages:
13199 .Sx "HTML mail and MIME attachments" ,
13200 .Sx "The Mailcap files" ,
13201 .Ic mimetype ,
13202 .Va mime-counter-evidence ,
13203 .Va mimetypes-load-control ,
13204 .Va pipe-TYPE/SUBTYPE ,
13205 .Va pipe-EXTENSION .
13206 .\" }}}
13208 .\" .Ss "The Mailcap files" {{{
13209 .Ss "The Mailcap files"
13211 .\" TODO MAILCAP DISABLED
13212 .Sy This feature is not available in v14.9.0, sorry!
13213 RFC 1524 defines a
13214 .Dq User Agent Configuration Mechanism
13215 which \*(UA \*(OPally supports (see
13216 .Sx "HTML mail and MIME attachments" ) .
13217 It defines a file format to be used to inform mail user agent programs
13218 about the locally-installed facilities for handling various data
13219 formats, i.e., about commands and how they can be used to display, edit
13220 et cetera MIME part contents, as well as a default path search that
13221 includes multiple possible locations of
13222 .Dq mailcap
13223 files and the
13224 .Ev MAILCAPS
13225 environment variable that can be used to overwrite that (repeating here
13226 that it is not a search path, but instead a path search specification).
13227 Any existing files will be loaded in sequence, appending any content to
13228 the list of MIME type handler directives.
13231 .Dq Mailcap
13232 files consist of a set of newline separated entries.
13233 Comment lines start with a number sign
13234 .Ql #
13235 (in the first column!) and are ignored.
13236 Empty lines are also ignored.
13237 All other lines form individual entries that must adhere to the syntax
13238 described below.
13239 To extend a single entry (not comment) its line can be continued on
13240 follow lines if newline characters are
13241 .Dq escaped
13242 by preceding them with the reverse solidus character
13243 .Ql \e .
13244 The standard does not specify how leading whitespace of follow lines
13245 is to be treated, therefore \*(UA retains it.
13248 .Dq Mailcap
13249 entries consist of a number of semicolon
13250 .Ql \&;
13251 separated fields, and the reverse solidus
13252 .Ql \e
13253 character can be used to escape any following character including
13254 semicolon and itself.
13255 The first two fields are mandatory and must occur in the specified
13256 order, the remaining fields are optional and may appear in any order.
13257 Leading and trailing whitespace of content is ignored (removed).
13260 The first field defines the MIME
13261 .Ql TYPE/SUBTYPE
13262 the entry is about to handle (case-insensitively, and no reverse solidus
13263 escaping is possible in this field).
13264 If the subtype is specified as an asterisk
13265 .Ql *
13266 the entry is meant to match all subtypes of the named type, e.g.,
13267 .Ql audio/*
13268 would match any audio type.
13269 The second field defines the shell command which shall be used to
13270 .Dq display
13271 MIME parts of the given type; it is implicitly called the
13272 .Cd view
13273 command.
13276 For data
13277 .Dq consuming
13278 shell commands message (MIME part) data is passed via standard input
13279 unless the given shell command includes one or more instances of the
13280 (unquoted) string
13281 .Ql %s ,
13282 in which case these instances will be replaced with a temporary filename
13283 and the data will have been stored in the file that is being pointed to.
13284 Likewise, for data
13285 .Dq producing
13286 shell commands data is assumed to be generated on standard output unless
13287 the given command includes (one ore multiple)
13288 .Ql %s .
13289 In any case any given
13290 .Ql %s
13291 format is replaced with a(n already) properly quoted filename.
13292 Note that when a command makes use of a temporary file via
13293 .Ql %s
13294 then \*(UA will remove it again, as if the
13295 .Cd x-mailx-tmpfile ,
13296 .Cd x-mailx-tmpfile-fill
13298 .Cd x-mailx-tmpfile-unlink
13299 flags had been set; see below for more.
13302 The optional fields either define a shell command or an attribute (flag)
13303 value, the latter being a single word and the former being a keyword
13304 naming the field followed by an equals sign
13305 .Ql =
13306 succeeded by a shell command, and as usual for any
13307 .Dq Mailcap
13308 content any whitespace surrounding the equals sign will be removed, too.
13309 Optional fields include the following:
13312 .Bl -tag -width ".It Cd BaNg"
13313 .It Cd compose
13314 A program that can be used to compose a new body or body part in the
13315 given format.
13316 (Currently unused.)
13318 .It Cd composetyped
13319 Similar to the
13320 .Cd compose
13321 field, but is to be used when the composing program needs to specify the
13322 .Ql Content-type:
13323 header field to be applied to the composed data.
13324 (Currently unused.)
13326 .It Cd edit
13327 A program that can be used to edit a body or body part in the given
13328 format.
13329 (Currently unused.)
13331 .It Cd print
13332 A program that can be used to print a message or body part in the given
13333 format.
13334 (Currently unused.)
13336 .It Cd test
13337 Specifies a program to be run to test some condition, e.g., the machine
13338 architecture, or the window system in use, to determine whether or not
13339 this mailcap entry applies.
13340 If the test fails, a subsequent mailcap entry should be sought; also see
13341 .Cd x-mailx-test-once .
13344 .It Cd needsterminal
13345 This flag field indicates that the given shell command must be run on
13346 an interactive terminal.
13347 \*(UA will temporarily release the terminal to the given command in
13348 interactive mode, in non-interactive mode this entry will be entirely
13349 ignored; this flag implies
13350 .Cd x-mailx-noquote .
13353 .It Cd copiousoutput
13354 A flag field which indicates that the output of the
13355 .Cd view
13356 command will be an extended stream of textual output that can be
13357 (re)integrated into \*(UA's normal visual display.
13358 It is mutually exclusive with
13359 .Cd needsterminal .
13361 .It Cd textualnewlines
13362 A flag field which indicates that this type of data is line-oriented and
13363 that, if encoded in
13364 .Ql base64 ,
13365 all newlines should be converted to canonical form (CRLF) before
13366 encoding, and will be in that form after decoding.
13367 (Currently unused.)
13369 .It Cd nametemplate
13370 This field gives a filename format, in which
13371 .Ql %s
13372 will be replaced by a random string, the joined combination of which
13373 will be used as the filename denoted by
13374 .Ev MAILX_FILENAME_TEMPORARY .
13375 One could specify that a GIF file being passed to an image viewer should
13376 have a name ending in
13377 .Ql .gif
13378 by using
13379 .Ql nametemplate=%s.gif .
13380 Note that \*(UA ignores the name template unless that solely specifies
13381 a filename suffix that consists of (ASCII) alphabetic and numeric
13382 characters, the underscore and dot only.
13384 .It Cd x11-bitmap
13385 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
13386 icon to be used to visually denote the presence of this kind of data.
13387 This field is not used by \*(UA.
13389 .It Cd description
13390 A textual description that describes this type of data.
13393 .It Cd x-mailx-even-if-not-interactive
13394 An extension flag test field \(em by default handlers without
13395 .Cd copiousoutput
13396 are entirely ignored in non-interactive mode, but if this flag is set
13397 then their use will be considered.
13398 It is an error if this flag is set for commands that use the flag
13399 .Cd needsterminal .
13402 .It Cd x-mailx-noquote
13403 An extension flag field that indicates that even a
13404 .Cd copiousoutput
13405 .Cd view
13406 command shall not be used to generate message quotes
13407 (as it would be by default).
13410 .It Cd x-mailx-async
13411 Extension flag field that denotes that the given
13412 .Cd view
13413 command shall be executed asynchronously, without blocking \*(UA.
13414 Cannot be used in conjunction with
13415 .Cd needsterminal .
13418 .It Cd x-mailx-test-once
13419 Extension flag which denotes whether the given
13420 .Cd test
13421 command shall be evaluated once only and the (boolean) result be cached.
13422 This is handy if some global unchanging condition is to be queried, like
13423 .Dq running under the X Window System .
13426 .It Cd x-mailx-tmpfile
13427 Extension flag field that requests creation of a zero-sized temporary
13428 file, the name of which is to be placed in the environment variable
13429 .Ev MAILX_FILENAME_TEMPORARY .
13430 It is an error to use this flag with commands that include a
13431 .Ql %s
13432 format.
13435 .It Cd x-mailx-tmpfile-fill
13436 Normally the MIME part content is passed to the handler via standard
13437 input; if this flag is set then the data will instead be written into
13438 the implied
13439 .Cd x-mailx-tmpfile .
13440 In order to cause deletion of the temporary file you will have to set
13441 .Cd x-mailx-tmpfile-unlink
13442 explicitly!
13443 It is an error to use this flag with commands that include a
13444 .Ql %s
13445 format.
13448 .It Cd x-mailx-tmpfile-unlink
13449 Extension flag field that requests that the temporary file shall be
13450 deleted automatically when the command loop is entered again at latest.
13451 (Do not use this for asynchronous handlers.)
13452 It is an error to use this flag with commands that include a
13453 .Ql %s
13454 format, or in conjunction with
13455 .Cd x-mailx-async ,
13456 or without also setting
13457 .Cd x-mailx-tmpfile
13459 .Cd x-mailx-tmpfile-fill .
13462 .It Cd x-mailx-tmpfile-keep
13463 Using the string
13464 .Ql %s
13465 implies the three tmpfile related flags above, but if you want, e.g.,
13466 .Cd x-mailx-async
13467 and deal with the temporary file yourself, you can add in this flag to
13468 forcefully ignore
13469 .Cd x-mailx-tmpfile-unlink .
13474 The standard includes the possibility to define any number of additional
13475 entry fields, prefixed by
13476 .Ql x- .
13477 Flag fields apply to the entire
13478 .Dq Mailcap
13479 entry \(em in some unusual cases, this may not be desirable, but
13480 differentiation can be accomplished via separate entries, taking
13481 advantage of the fact that subsequent entries are searched if an earlier
13482 one does not provide enough information.
13483 E.g., if a
13484 .Cd view
13485 command needs to specify the
13486 .Cd needsterminal
13487 flag, but the
13488 .Cd compose
13489 command shall not, the following will help out the latter (with enabled
13490 .Va debug
13491 or an increased
13492 .Va verbose
13493 level \*(UA will show information about handler evaluation):
13495 .Bd -literal -offset indent
13496 application/postscript; ps-to-terminal %s; needsterminal
13497 application/postscript; ps-to-terminal %s; compose=idraw %s
13501 In fields any occurrence of the format string
13502 .Ql %t
13503 will be replaced by the
13504 .Ql TYPE/SUBTYPE
13505 specification.
13506 Named parameters from the
13507 .Ql Content-type:
13508 field may be placed in the command execution line using
13509 .Ql %{
13510 followed by the parameter name and a closing
13511 .Ql }
13512 character.
13513 The entire parameter should appear as a single command line argument,
13514 regardless of embedded spaces; thus:
13516 .Bd -literal -offset indent
13517 # Message
13518 Content-type:  multipart/mixed; boundary=42
13520 # Mailcap file
13521 multipart/*; /usr/local/bin/showmulti \e
13522   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
13524 # Executed shell command
13525 /usr/local/bin/showmulti multipart/mixed 42
13529 .\" TODO v15: Mailcap: %n,%F
13530 Note that \*(UA does not support handlers for multipart MIME parts as
13531 shown in this example (as of today).
13532 \*(UA does not support the additional formats
13533 .Ql %n
13535 .Ql %F .
13536 An example file, also showing how to properly deal with the expansion of
13537 .Ql %s ,
13538 which includes any quotes that are necessary to make it a valid shell
13539 argument by itself and thus will cause undesired behaviour when placed
13540 in additional user-provided quotes:
13542 .Bd -literal -offset indent
13543 # Comment line
13544 text/richtext; richtext %s; copiousoutput
13546 text/x-perl; perl -cWT %s
13548 application/pdf; \e
13549   infile=%s\e; \e
13550     trap "rm -f ${infile}" EXIT\e; \e
13551     trap "exit 75" INT QUIT TERM\e; \e
13552     mupdf %s; \e
13553   x-mailx-async; x-mailx-tmpfile-keep
13555 application/*; echo "This is \e"%t\e" but \e
13556     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vet; \e
13557   copiousoutput; x-mailx-noquote
13561 Further reading:
13562 .Sx "HTML mail and MIME attachments" ,
13563 .Sx "The mime.types files" ,
13564 .Ic mimetype ,
13565 .Ev MAILCAPS ,
13566 .Va mime-counter-evidence ,
13567 .Va pipe-TYPE/SUBTYPE ,
13568 .Va pipe-EXTENSION .
13569 .\" }}}
13571 .\" .Ss "The .netrc file" {{{
13572 .Ss "The .netrc file"
13575 .Pa .netrc
13576 file contains user credentials for machine accounts.
13577 The default location
13578 .Pa \*(VN
13579 may be overridden by the
13580 .Ev NETRC
13581 environment variable.
13582 It is possible to load encrypted
13583 .Pa .netrc
13584 files by using an appropriate value in
13585 .Va netrc-pipe .
13588 The file consists of space, tabulator or newline separated tokens.
13589 \*(UA implements a parser that supports a superset of the original BSD
13590 syntax, but users should nonetheless be aware of portability glitches
13591 of that file format, shall their
13592 .Pa .netrc
13593 be usable across multiple programs and platforms:
13596 .Bl -bullet -compact
13598 BSD does not support single, but only double quotation marks, e.g.,
13599 .Ql password="pass with spaces" .
13601 BSD (only?) supports escaping of single characters via a reverse solidus
13602 (e.g., a space can be escaped via
13603 .Ql \e\0 ) ,
13604 in- as well as outside of a quoted string.
13606 BSD does not require a final quotation mark of the last user input token.
13608 The original BSD (Berknet) parser also supported a format which allowed
13609 tokens to be separated with commas \(en whereas at least Hewlett-Packard
13610 still seems to support this syntax, \*(UA does not!
13612 As a non-portable extension some widely-used programs support
13613 shell-style comments: if an input line starts, after any amount of
13614 whitespace, with a number sign
13615 .Ql # ,
13616 then the rest of the line is ignored.
13618 Whereas other programs may require that the
13619 .Pa .netrc
13620 file is accessible by only the user if it contains a
13621 .Cd password
13622 token for any other
13623 .Cd login
13624 than
13625 .Dq anonymous ,
13626 \*(UA will always require these strict permissions.
13630 Of the following list of supported tokens \*(UA only uses (and caches)
13631 .Cd machine ,
13632 .Cd login
13634 .Cd password .
13635 At runtime the command
13636 .Ic netrc
13637 can be used to control \*(UA's
13638 .Pa .netrc
13639 cache.
13641 .Bl -tag -width ".It Cd BaNg"
13642 .It Cd machine Ar name
13643 The hostname of the entries' machine, lowercase-normalized by \*(UA
13644 before use.
13645 Any further file content, until either end-of-file or the occurrence
13646 of another
13647 .Cd machine
13648 or a
13649 .Cd default
13650 first-class token is bound (only related) to the machine
13651 .Ar name .
13653 As an extension that should not be the cause of any worries
13654 \*(UA supports a single wildcard prefix for
13655 .Ar name :
13656 .Bd -literal -offset indent
13657 machine *.example.com login USER password PASS
13658 machine pop3.example.com login USER password PASS
13659 machine smtp.example.com login USER password PASS
13662 which would match
13663 .Ql xy.example.com
13664 as well as
13665 .Ql pop3.example.com ,
13666 but neither
13667 .Ql example.com
13669 .Ql local.smtp.example.com .
13670 Note that in the example neither
13671 .Ql pop3.example.com
13673 .Ql smtp.example.com
13674 will be matched by the wildcard, since the exact matches take
13675 precedence (it is however faster to specify it the other way around).
13677 .It Cd default
13678 This is the same as
13679 .Cd machine
13680 except that it is a fallback entry that is used shall none of the
13681 specified machines match; only one default token may be specified,
13682 and it must be the last first-class token.
13684 .It Cd login Ar name
13685 The user name on the remote machine.
13687 .It Cd password Ar string
13688 The user's password on the remote machine.
13690 .It Cd account Ar string
13691 Supply an additional account password.
13692 This is merely for FTP purposes.
13694 .It Cd macdef Ar name
13695 Define a macro.
13696 A macro is defined with the specified
13697 .Ar name ;
13698 it is formed from all lines beginning with the next line and continuing
13699 until a blank line is (consecutive newline characters are) encountered.
13700 (Note that
13701 .Cd macdef
13702 entries cannot be utilized by multiple machines, too, but must be
13703 defined following the
13704 .Ic machine
13705 they are intended to be used with.)
13706 If a macro named
13707 .Ar init
13708 exists, it is automatically run as the last step of the login process.
13709 This is merely for FTP purposes.
13711 .\" }}}
13713 .\" }}}
13716 .\" .Sh EXAMPLES {{{
13717 .Sh EXAMPLES
13719 .\" .Ss "An example configuration" {{{
13720 .Ss "An example configuration"
13722 .Bd -literal -offset indent
13723 # This example assumes v15.0 compatibility mode
13724 set v15-compat
13726 # Request strict TLL transport layer security checks
13727 set tls-verify=strict
13729 # Where are the up-to-date TLS certificates?
13730 # (Since we manage up-to-date ones explicitly, do not use any,
13731 # possibly outdated, default certificates shipped with OpenSSL)
13732 #set tls-ca-dir=/etc/ssl/certs
13733 set tls-ca-file=/etc/ssl/certs/ca-certificates.crt
13734 set tls-ca-no-defaults
13735 #set tls-ca-flags=partial-chain
13736 wysh set smime-ca-file="${tls-ca-file}" \e
13737   smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}"
13739 # This could be outsourced to a central configuration file via
13740 # tls-config-file plus tls-config-module if the used library allows.
13741 # CipherString: explicitly define the list of ciphers, which may
13742 #   improve security, especially with protocols older than TLS v1.2.
13743 #   See ciphers(1).  Possibly best to only use tls-config-pairs-HOST
13744 #   (or -USER@HOST), as necessary, again..
13745 #   Note that TLSv1.3 uses Ciphersuites= instead, which will join
13746 #   with CipherString (if protocols older than v1.3 are allowed)
13747 # Curves: especially with TLSv1.3 curves selection may be desired.
13748 # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.
13749 #   Change this only when the remote server does not support it:
13750 #   maybe use chain support via tls-config-pairs-HOST / -USER@HOST
13751 #   to define such explicit exceptions, then, e.g.
13752 #     MinProtocol=TLSv1.1
13753 if [ "$tls-features" =% +ctx-set-maxmin-proto ]
13754   wysh set tls-config-pairs='\e
13755       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
13756       Curves=P-521:P-384:P-256,\e
13757       MinProtocol=TLSv1.1'
13758 else
13759   wysh set tls-config-pairs='\e
13760       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
13761       Curves=P-521:P-384:P-256,\e
13762       Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2\e, +TLSv1.3'
13763 endif
13765 # Essential setting: select allowed character sets
13766 set sendcharsets=utf-8,iso-8859-1
13768 # A very kind option: when replying to a message, first try to
13769 # use the same encoding that the original poster used herself!
13770 set reply-in-same-charset
13772 # When replying, do not merge From: and To: of the original message
13773 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
13774 set recipients-in-cc
13776 # When sending messages, wait until the Mail-Transfer-Agent finishs.
13777 # Only like this you will be able to see errors reported through the
13778 # exit status of the MTA (including the built-in SMTP one)!
13779 set sendwait
13781 # Only use built-in MIME types, no mime.types(5) files
13782 set mimetypes-load-control
13784 # Default directory where we act in (relative to $HOME)
13785 set folder=mail
13786 # A leading "+" (often) means: under *folder*
13787 # *record* is used to save copies of sent messages
13788 set MBOX=+mbox.mbox DEAD=+dead.txt \e
13789   record=+sent.mbox record-files record-resent
13791 # Make "file mymbox" and "file myrec" go to..
13792 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
13794 # Not really optional, e.g., for S/MIME
13795 set from='Your Name <address@exam.ple>'
13797 # It may be necessary to set hostname and/or smtp-hostname
13798 # if the "SERVER" of mta and "domain" of from do not match.
13799 # The `urlencode' command can be used to encode USER and PASS
13800 set mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \e
13801   smtp-auth=login/plain... \e
13802   smtp-use-starttls
13804 # Never refuse to start into interactive mode, and more
13805 set emptystart \e
13806   colour-pager crt= \e
13807   followup-to followup-to-honour=ask-yes fullnames \e
13808   history-file=+.\*(uAhist history-size=-1 history-gabby \e
13809   mime-counter-evidence=0b1111 \e
13810   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
13811   reply-to-honour=ask-yes \e
13812   umask=
13814 # Only include the selected header fields when typing messages
13815 headerpick type retain from_ date from to cc subject \e
13816   message-id mail-followup-to reply-to
13817 # ...when forwarding messages
13818 headerpick forward retain subject date from to cc
13819 # ...when saving message, etc.
13820 #headerpick save ignore ^Original-.*$ ^X-.*$
13822 # Some mailing lists
13823 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
13824 mlsubscribe '^xfans@xfans\e.xyz$'
13826 # Handle a few file extensions (to store MBOX databases)
13827 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
13828   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
13829   zst 'zstd -dc' 'zstd -19 -zc' \e
13830   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
13832 # A real life example of a very huge free mail provider
13833 # Instead of directly placing content inside `account',
13834 # we `define' a macro: like that we can switch "accounts"
13835 # from within *on-compose-splice*, for example!
13836 define XooglX {
13837   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
13838   set from='Your Name <address@examp.ple>'
13840   set pop3-no-apop-pop.gmXil.com
13841   shortcut pop %:pop3s://pop.gmXil.com
13842   shortcut imap %:imaps://imap.gmXil.com
13843   # Or, entirely IMAP based setup
13844   #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e
13845   #   imap-cache=~/spool/cache
13847   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
13848   # Alternatively:
13849   set mta=smtps://USER:PASS@smtp.gmail.com:465
13851 account XooglX {
13852   \ecall XooglX
13855 # Here is a pretty large one which does not allow sending mails
13856 # if there is a domain name mismatch on the SMTP protocol level,
13857 # which would bite us if the value of from does not match, e.g.,
13858 # for people who have a sXXXXeforge project and want to speak
13859 # with the mailing list under their project account (in from),
13860 # still sending the message through their normal mail provider
13861 define XandeX {
13862   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
13863   set from='Your Name <address@exam.ple>'
13865   shortcut pop %:pop3s://pop.yaXXex.com
13866   shortcut imap %:imaps://imap.yaXXex.com
13868   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
13869     hostname=yaXXex.com smtp-hostname=
13871 account XandeX {
13872   \ecall Xandex
13875 # Create some new commands so that, e.g., `ls /tmp' will..
13876 commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS'
13877 commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS'
13879 set pipe-message/external-body='@* echo $MAILX_EXTERNAL_BODY_URL'
13881 # We do not support gpg(1) directly yet.  But simple --clearsign'd
13882 # message parts can be dealt with as follows:
13883 define V {
13884   localopts yes
13885   wysh set pipe-text/plain=$'@*#++=@\e
13886     < "${MAILX_FILENAME_TEMPORARY}" awk \e
13887         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
13888       BEGIN{done=0}\e
13889       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
13890         if(done++ != 0)\e
13891           next;\e
13892         print "--- GPG --verify ---";\e
13893         system("gpg --verify " TMPFILE " 2>&1");\e
13894         print "--- GPG --verify ---";\e
13895         print "";\e
13896         next;\e
13897       }\e
13898       /^-----BEGIN PGP SIGNATURE-----/,\e
13899           /^-----END PGP SIGNATURE-----/{\e
13900         next;\e
13901       }\e
13902       {print}\e
13903     \e''
13904     print
13906 commandalias V '\e'call V
13910 When storing passwords in
13911 .Pa \*(ur
13912 appropriate permissions should be set on this file with
13913 .Ql $ chmod 0600 \*(ur .
13914 If the \*(OPal
13915 .Va netrc-lookup
13916 is available user credentials can be stored in the central
13917 .Pa \*(VN
13918 file instead; e.g., here is a different version of the example account
13919 that sets up SMTP and POP3:
13921 .Bd -literal -offset indent
13922 define XandeX {
13923   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
13924   set from='Your Name <address@exam.ple>'
13925   set netrc-lookup
13926   # Load an encrypted ~/.netrc by uncommenting the next line
13927   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
13929   set mta=smtps://smtp.yXXXXx.ru:465 \e
13930       smtp-hostname= hostname=yXXXXx.com
13931   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
13932   commandalias xp fi pop3s://pop.yXXXXx.ru
13934 account XandeX {
13935   \ecall XandeX
13940 and, in the
13941 .Pa \*(VN
13942 file:
13944 .Bd -literal -offset indent
13945 machine *.yXXXXx.ru login USER password PASS
13949 This configuration should now work just fine:
13952 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
13953 .\" }}}
13955 .\" .Ss "S/MIME step by step" {{{
13956 .Ss "S/MIME step by step"
13958 \*(OP The first thing that is needed for
13959 .Sx "Signed and encrypted messages with S/MIME"
13960 is a personal certificate, and a private key.
13961 The certificate contains public information, in particular a name and
13962 email address(es), and the public key that can be used by others to
13963 encrypt messages for the certificate holder (the owner of the private
13964 key), and to
13965 .Ic verify
13966 signed messages generated with that certificate('s private key).
13967 Whereas the certificate is included in each signed message, the private
13968 key must be kept secret.
13969 It is used to decrypt messages that were previously encrypted with the
13970 public key, and to sign messages.
13973 For personal use it is recommended that get a S/MIME certificate from
13974 one of the major CAs on the Internet.
13975 Many CAs offer such certificates for free.
13976 Usually offered is a combined certificate and private key in PKCS#12
13977 format which \*(UA does not accept directly.
13978 To convert it to PEM format, the following shell command can be used;
13979 please read on for how to use these PEM files.
13981 .Bd -literal -offset indent
13982 $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes
13983 $ # Alternatively
13984 $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys
13985 $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes
13989 There is also
13990 .Lk https://www.CAcert.org
13991 which issues client and server certificates to members of their
13992 community for free; their root certificate
13993 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
13994 is often not in the default set of trusted CA root certificates, though,
13995 which means their root certificate has to be downloaded separately,
13996 and needs to be part of the S/MIME certificate validation chain by
13997 including it in
13998 .Va smime-ca-dir
13999 or as a vivid member of the
14000 .Va smime-ca-file .
14001 But let us take a step-by-step tour on how to setup S/MIME with
14002 a certificate from CAcert.org despite this situation!
14005 First of all you will have to become a member of the CAcert.org
14006 community, simply by registrating yourself via the web interface.
14007 Once you are, create and verify all email addresses you want to be able
14008 to create signed and encrypted messages for/with using the corresponding
14009 entries of the web interface.
14010 Now ready to create S/MIME certificates, so let us create a new
14011 .Dq client certificate ,
14012 ensure to include all email addresses that should be covered by the
14013 certificate in the following web form, and also to use your name as the
14014 .Dq common name .
14017 Create a private key and a certificate request on your local computer
14018 (please see the manual pages of the used commands for more in-depth
14019 knowledge on what the used arguments etc. do):
14022 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
14025 Afterwards copy-and-paste the content of
14026 .Dq creq.pem
14027 into the certificate-request (CSR) field of the web form on the
14028 CAcert.org website (you may need to unfold some
14029 .Dq advanced options
14030 to see the corresponding text field).
14031 This last step will ensure that your private key (which never left your
14032 box) and the certificate belong together (through the public key that
14033 will find its way into the certificate via the certificate-request).
14034 You are now ready and can create your CAcert certified certificate.
14035 Download and store or copy-and-paste it as
14036 .Dq pub.crt .
14039 Yay.
14040 In order to use your new S/MIME setup a combined private key/public key
14041 (certificate) file has to be created:
14044 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
14047 This is the file \*(UA will work with.
14048 If you have created your private key with a passphrase then \*(UA will
14049 ask you for it whenever a message is signed or decrypted, unless this
14050 operation has been automated as described in
14051 .Sx "Signed and encrypted messages with S/MIME" .
14052 Set the following variables to henceforth use S/MIME (setting
14053 .Va smime-ca-file
14054 is of interest for verification only):
14056 .Bd -literal -offset indent
14057 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
14058     smime-sign-cert=ME@HERE.com.paired \e
14059     smime-sign-digest=SHA512 \e
14060     smime-sign
14063 .\" }}}
14065 .\" .Ss "Using CRLs with S/MIME or TLS" {{{
14066 .Ss "Using CRLs with S/MIME or TLS"
14068 \*(OP Certification authorities (CAs) issue certificate revocation
14069 lists (CRLs) on a regular basis.
14070 These lists contain the serial numbers of certificates that have been
14071 declared invalid after they have been issued.
14072 Such usually happens because the private key for the certificate has
14073 been compromised,
14074 because the owner of the certificate has left the organization that is
14075 mentioned in the certificate, etc.
14076 To seriously use S/MIME or TLS verification,
14077 an up-to-date CRL is required for each trusted CA.
14078 There is otherwise no method to distinguish between valid and
14079 invalidated certificates.
14080 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
14081 the Internet, so they have to be retrieved by some external mechanism.
14084 \*(UA accepts CRLs in PEM format only;
14085 CRLs in DER format must be converted, like, e.\|g.:
14088 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
14091 To tell \*(UA about the CRLs, a directory that contains all CRL files
14092 (and no other files) must be created.
14094 .Va smime-crl-dir
14096 .Va tls-crl-dir
14097 variables, respectively, must then be set to point to that directory.
14098 After that, \*(UA requires a CRL to be present for each CA that is used
14099 to verify a certificate.
14100 .\" }}}
14102 .\" }}} (Examples)
14105 .\" .Sh "FAQ" {{{
14106 .Sh "FAQ"
14108 In general it is a good idea to turn on
14109 .Va debug
14110 .Pf ( Fl d )
14111 and / or
14112 .Va verbose
14113 .Pf ( Fl v ,
14114 twice) if something does not work well.
14115 Very often a diagnostic message can be produced that leads to the
14116 problems' solution.
14118 .\" .Ss "\*(UA shortly hangs on startup" {{{
14119 .Ss "\*(UA shortly hangs on startup"
14121 This can have two reasons, one is the necessity to wait for a file lock
14122 and cannot be helped, the other being that \*(UA calls the function
14123 .Xr uname 2
14124 in order to query the nodename of the box (sometimes the real one is
14125 needed instead of the one represented by the internal variable
14126 .Va hostname ) .
14127 One may have varying success by ensuring that the real hostname and
14128 .Ql localhost
14129 have entries in
14130 .Pa /etc/hosts ,
14131 or, more generally, that the name service is properly setup \(en
14132 and does
14133 .Xr hostname 1
14134 return the expected value?
14135 Does this local hostname have a domain suffix?
14136 RFC 6762 standardized the link-local top-level domain
14137 .Ql .local ,
14138 try again after adding an (additional) entry with this extension.
14139 .\" }}}
14141 .\" .Ss "I cannot login to Google mail aka GMail" {{{
14142 .Ss "I cannot login to Google mail aka GMail"
14144 Since 2014 some free service providers classify programs as
14145 .Dq less secure
14146 unless they use a special authentication method (OAuth 2.0) which
14147 was not standardized for non-HTTP protocol authentication token query
14148 until August 2015 (RFC 7628).
14151 Different to Kerberos / GSSAPI, which is developed since the mid of the
14152 1980s, where a user can easily create a local authentication ticket for
14153 her- and himself with the locally installed
14154 .Xr kinit 1
14155 program, that protocol has no such local part but instead requires
14156 a world-wide-web query to create or fetch a token; since there is no
14157 local cache this query would have to be performed whenever \*(UA is
14158 invoked (in interactive sessions situation may differ).
14161 \*(UA does not support OAuth.
14162 Because of this it is necessary to declare \*(UA a
14163 .Dq less secure app
14164 (on the providers account web page) in order to read and send mail.
14165 However, it also seems possible to take the following steps instead:
14168 .Bl -enum -compact
14170 give the provider the number of a mobile phone,
14172 enable
14173 .Dq 2-Step Verification ,
14175 create an application specific password (16 characters), and
14177 use that special password instead of the real Google account password in
14178 \*(UA (for more on that see the section
14179 .Sx "On URL syntax and credential lookup" ) .
14181 .\" }}}
14183 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
14184 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
14186 It can happen that the terminal library (see
14187 .Sx "On terminal control and line editor",
14188 .Ic bind ,
14189 .Va termcap )
14190 reports different codes than the terminal really sends, in which case
14191 \*(UA will tell that a key binding is functional, but will not be able to
14192 recognize it because the received data does not match anything expected.
14193 Especially without the \*(OPal terminal capability library support one
14194 reason for this may be that the (possibly even non-existing) keypad
14195 is not turned on and the resulting layout reports the keypad control
14196 codes for the normal keyboard keys.
14198 .Va verbose
14199 listing of
14200 .Ic bind Ns
14201 ings will show the byte sequences that are expected.
14204 To overcome the situation, use, e.g., the program
14205 .Xr cat 1 ,
14206 in conjunction with the command line option
14207 .Fl \&\&v ,
14208 if available, to see the byte sequences which are actually produced
14209 by keypresses, and use the variable
14210 .Va termcap
14211 to make \*(UA aware of them.
14212 E.g., the terminal this is typed on produces some false sequences, here
14213 an example showing the shifted home key:
14215 .Bd -literal -offset indent
14216 ? set verbose
14217 ? bind*
14218 # 1B 5B=[ 31=1 3B=; 32=2 48=H
14219   bind base :kHOM z0
14220 ? x
14221 $ cat -v
14222 ^[[H
14223 $ \*(uA -v -Stermcap='kHOM=\eE[H'
14224 ? bind*
14225 # 1B 5B=[ 48=H
14226   bind base :kHOM z0
14228 .\" }}}
14230 .\" .Ss "Can \*(UA git-send-email?" {{{
14231 .Ss "Can \*(UA git-send-email?"
14233 Yes.
14234 Put (at least parts of) the following in your
14235 .Pa ~/.gitconfig :
14237 .Bd -literal -offset indent
14238 [sendemail]
14239 smtpserver = /usr/bin/s-mailx
14240 smtpserveroption = -t
14241 #smtpserveroption = -Sexpandaddr
14242 smtpserveroption = -Athe-account-you-need
14244 suppresscc = all
14245 suppressfrom = false
14246 assume8bitEncoding = UTF-8
14247 #to = /tmp/OUT
14248 confirm = always
14249 chainreplyto = true
14250 multiedit = false
14251 thread = true
14252 quiet = true
14253 annotate = true
14255 .\" }}}
14257 .\" }}}
14260 .\" .Sh "IMAP CLIENT" {{{
14261 .Sh "IMAP CLIENT"
14263 \*(OPally there is IMAP client support available.
14264 This part of the program is obsolete and will vanish in v15 with the
14265 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
14266 and makes excessive use of signal based long code jumps.
14267 Support can hopefully be readded later based on a new-style I/O, with
14268 SysV signal handling.
14269 In fact the IMAP support had already been removed from the codebase, but
14270 was reinstantiated on user demand: in effect the IMAP code is at the
14271 level of \*(UA v14.8.16 (with
14272 .Ic imapcodec
14273 being the sole exception), and should be treated with some care.
14276 IMAP uses the
14277 .Ql imap://
14279 .Ql imaps://
14280 protocol prefixes, and an IMAP-based
14281 .Va folder
14282 may be used.
14283 IMAP URLs (paths) undergo inspections and possible transformations
14284 before use (and the command
14285 .Ic imapcodec
14286 can be used to manually apply them to any given argument).
14287 Hierarchy delimiters are normalized, a step which is configurable via the
14288 .Va imap-delim
14289 variable chain, but defaults to the first seen delimiter otherwise.
14290 \*(UA supports internationalised IMAP names, and en- and decodes the
14291 names from and to the
14292 .Va ttycharset
14293 as necessary and possible.
14294 If a mailbox name is expanded (see
14295 .Sx "Filename transformations" )
14296 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
14297 mailboxes below the
14298 .Va folder
14299 target box, while folder names prefixed by `@' refer to folders below
14300 the hierarchy base, e.g., the following lists all folders below the
14301 current one when in an IMAP mailbox:
14302 .Ql folders @ .
14305 Note: some IMAP servers do not accept the creation of mailboxes in
14306 the hierarchy base, but require that they are created as subfolders of
14307 `INBOX' \(en with such servers a folder name of the form
14309 .Dl imaps://mylogin@imap.myisp.example/INBOX.
14311 should be used (the last character is the server's hierarchy
14312 delimiter).
14313 The following IMAP-specific commands exist:
14316 .Bl -tag -width ".It Ic BaNg"
14318 .It Ic cache
14319 Only applicable to cached IMAP mailboxes;
14320 takes a message list and reads the specified messages into the IMAP
14321 cache.
14324 .It Ic connect
14325 If operating in disconnected mode on an IMAP mailbox,
14326 switch to online mode and connect to the mail server while retaining
14327 the mailbox status.
14328 See the description of the
14329 .Va disconnected
14330 variable for more information.
14333 .It Ic disconnect
14334 If operating in online mode on an IMAP mailbox,
14335 switch to disconnected mode while retaining the mailbox status.
14336 See the description of the
14337 .Va disconnected
14338 variable for more.
14339 A list of messages may optionally be given as argument;
14340 the respective messages are then read into the cache before the
14341 connection is closed, thus
14342 .Ql disco *
14343 makes the entire mailbox available for disconnected use.
14346 .It Ic imap
14347 Sends command strings directly to the current IMAP server.
14348 \*(UA operates always in IMAP `selected state' on the current mailbox;
14349 commands that change this will produce undesirable results and should be
14350 avoided.
14351 Useful IMAP commands are:
14352 .Bl -tag -offset indent -width ".Ic getquotearoot"
14353 .It create
14354 Takes the name of an IMAP mailbox as an argument and creates it.
14355 .It getquotaroot
14356 (RFC 2087) Takes the name of an IMAP mailbox as an argument
14357 and prints the quotas that apply to the mailbox.
14358 Not all IMAP servers support this command.
14359 .It namespace
14360 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
14361 the Other User's Namespaces and the Shared Namespaces.
14362 Each namespace type is printed in parentheses;
14363 if there are multiple namespaces of the same type,
14364 inner parentheses separate them.
14365 For each namespace a prefix and a hierarchy separator is listed.
14366 Not all IMAP servers support this command.
14370 .It Ic imapcodec
14371 Perform IMAP path transformations.
14372 Supports
14373 .Cm vput
14374 (see
14375 .Sx "Command modifiers" ) ,
14376 and manages the error number
14377 .Va \&! .
14378 The first argument specifies the operation:
14379 .Ar e[ncode]
14380 normalizes hierarchy delimiters (see
14381 .Va imap-delim )
14382 and converts the strings from the locale
14383 .Va ttycharset
14384 to the internationalized variant used by IMAP,
14385 .Ar d[ecode]
14386 performs the reverse operation.
14391 The following IMAP-specific internal variables exist:
14394 .Bl -tag -width ".It Va BaNg"
14396 .It Va disconnected
14397 \*(BO When an IMAP mailbox is selected and this variable is set,
14398 no connection to the server is initiated.
14399 Instead, data is obtained from the local cache (see
14400 .Va imap-cache Ns
14402 Mailboxes that are not present in the cache
14403 and messages that have not yet entirely been fetched from the server
14404 are not available;
14405 to fetch all messages in a mailbox at once,
14406 the command
14407 .No ` Ns Li copy * /dev/null Ns '
14408 can be used while still in connected mode.
14409 Changes that are made to IMAP mailboxes in disconnected mode are queued
14410 and committed later when a connection to that server is made.
14411 This procedure is not completely reliable since it cannot be guaranteed
14412 that the IMAP unique identifiers (UIDs) on the server still match the
14413 ones in the cache at that time.
14414 Data is saved to
14415 .Ev DEAD
14416 when this problem occurs.
14418 .It Va disconnected-USER@HOST
14419 The specified account is handled as described for the
14420 .Va disconnected
14421 variable above,
14422 but other accounts are not affected.
14424 .Mx Va imap-auth
14425 .It Va imap-auth-USER@HOST , imap-auth
14426 Sets the IMAP authentication method.
14427 Valid values are `login' for the usual password-based authentication
14428 (the default),
14429 `cram-md5', which is a password-based authentication that does not send
14430 the password over the network in clear text,
14431 and `gssapi' for GSS-API based authentication.
14434 .It Va imap-cache
14435 Enables caching of IMAP mailboxes.
14436 The value of this variable must point to a directory that is either
14437 existent or can be created by \*(UA.
14438 All contents of the cache can be deleted by \*(UA at any time;
14439 it is not safe to make assumptions about them.
14441 .Mx Va imap-delim
14442 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
14443 The hierarchy separator used by the IMAP server.
14444 Whenever an IMAP path is specified it will undergo normalization.
14445 One of the normalization steps is the squeezing and adjustment of
14446 hierarchy separators.
14447 If this variable is set, any occurrence of any character of the given
14448 value that exists in the path will be replaced by the first member of
14449 the value; an empty value will cause the default to be used, it is
14450 .Ql /. .
14451 If not set, we will reuse the first hierarchy separator character that
14452 is discovered in a user-given mailbox name.
14454 .Mx Va imap-keepalive
14455 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
14456 IMAP servers may close the connection after a period of
14457 inactivity; the standard requires this to be at least 30 minutes,
14458 but practical experience may vary.
14459 Setting this variable to a numeric `value' greater than 0 causes
14460 a `NOOP' command to be sent each `value' seconds if no other operation
14461 is performed.
14464 .It Va imap-list-depth
14465 When retrieving the list of folders on an IMAP server, the
14466 .Ic folders
14467 command stops after it has reached a certain depth to avoid possible
14468 infinite loops.
14469 The value of this variable sets the maximum depth allowed.
14470 The default is 2.
14471 If the folder separator on the current IMAP server is a slash `/',
14472 this variable has no effect and the
14473 .Ic folders
14474 command does not descend to subfolders.
14476 .Mx Va imap-use-starttls
14477 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
14478 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
14479 IMAP session TLS encrypted.
14480 This functionality is not supported by all servers,
14481 and is not used if the session is already encrypted by the IMAPS method.
14484 .\" }}}
14487 .\" .Sh "SEE ALSO" {{{
14488 .Sh "SEE ALSO"
14490 .Xr bogofilter 1 ,
14491 .Xr gpg 1 ,
14492 .Xr more 1 ,
14493 .Xr newaliases 1 ,
14494 .Xr openssl 1 ,
14495 .Xr sendmail 1 ,
14496 .Xr sh 1 ,
14497 .Xr spamassassin 1 ,
14498 .Xr iconv 3 ,
14499 .Xr setlocale 3 ,
14500 .Xr aliases 5 ,
14501 .Xr termcap 5 ,
14502 .Xr terminfo 5 ,
14503 .Xr locale 7 ,
14504 .Xr mailaddr 7 ,
14505 .Xr re_format 7 ,
14506 .Xr mailwrapper 8 ,
14507 .Xr sendmail 8
14509 .\" }}}
14512 .\" .Sh HISTORY {{{
14513 .Sh HISTORY
14515 M. Douglas McIlroy writes in his article
14516 .Dq A Research UNIX Reader: Annotated Excerpts \
14517 from the Programmer's Manual, 1971-1986
14518 that a
14519 .Xr mail 1
14520 command already appeared in First Edition
14522 in 1971:
14524 .Bd -ragged -offset indent
14525 Electronic mail was there from the start.
14526 Never satisfied with its exact behavior, everybody touched it at one
14527 time or another: to assure the safety of simultaneous access, to improve
14528 privacy, to survive crashes, to exploit uucp, to screen out foreign
14529 freeloaders, or whatever.
14530 Not until v7 did the interface change (Thompson).
14531 Later, as mail became global in its reach, Dave Presotto took charge and
14532 brought order to communications with a grab-bag of external networks
14533 (v8).
14538 Mail was written in 1978 by Kurt Shoens and developed as part of the
14541 distribution until 1995.
14542 Mail has then seen further development in open source
14544 variants, noticeably by Christos Zoulas in
14545 .Pf Net Bx .
14546 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
14547 Ritter in the years 2000 until 2008.
14548 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
14549 This man page is derived from
14550 .Dq The Mail Reference Manual
14551 that was originally written by Kurt Shoens.
14553 .\" }}}
14556 .Sh AUTHORS
14558 .An -nosplit
14559 .An "Kurt Shoens" ,
14560 .An "Edward Wang" ,
14561 .An "Keith Bostic" ,
14562 .An "Christos Zoulas" ,
14563 .An "Gunnar Ritter" .
14564 \*(UA is developed by
14565 .An "Steffen Nurpmeso" Aq s-mailx@lists.sdaoden.eu .
14568 .\" .Sh CAVEATS {{{
14569 .Sh CAVEATS
14571 \*(ID Interrupting an operation via
14572 .Dv \&\&SIGINT
14574 .Ql control-C
14575 from anywhere else but a command prompt is very problematic and likely
14576 to leave the program in an undefined state: many library functions
14577 cannot deal with the
14578 .Fn siglongjmp 3
14579 that this software (still) performs; even though efforts have been taken
14580 to address this, no sooner but in v15 it will have been worked out:
14581 interruptions have not been disabled in order to allow forceful breakage
14582 of hanging network connections, for example (all this is unrelated to
14583 .Va ignore ) .
14586 The SMTP and POP3 protocol support of \*(UA is very basic.
14587 Also, if it fails to contact its upstream SMTP server, it will not make
14588 further attempts to transfer the message at a later time (setting
14589 .Va save
14591 .Va sendwait
14592 may be useful).
14593 If this is a concern, it might be better to set up a local SMTP server
14594 that is capable of message queuing.
14596 .\" }}}
14599 .Sh BUGS
14601 After deleting some message of a POP3 mailbox the header summary falsely
14602 claims that there are no messages to display, one needs to perform
14603 a scroll or dot movement to restore proper state.
14606 .Ql thread Ns
14608 .Ic sort
14609 mode a power user may encounter crashes very occasionally (this is may
14610 and very).
14612 The file
14613 .Pa TODO
14614 in the source repository lists future directions.
14617 Please report bugs to the
14618 .Va contact-mail
14619 address, e.g., from within \*(uA:
14620 .\" v15-compat: drop eval as `mail' will expand variable?
14621 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
14622 Including the
14623 .Va verbose
14624 output of the command
14625 .Ic version
14626 may be helpful, e.g.,
14628 .Bd -literal -offset indent
14629 ? wysh set escape=! verbose; vput version xy; unset verbose;\e
14630   eval mail $contact-mail
14631 Bug subject
14632 !I xy
14637 Information on the web at
14638 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ' -Xx .
14640 .\" s-ts-mode