collect(): ~[FfMmUu]: should default to the "dot" (Andrew Gee)
[s-mailx.git] / nail.1
blob88d11b8c1e1aab7c601f7d84438db39bd1ed64ef
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.10 / 2018-03-25
35 .Dd March 25, 2018
36 .ds VV \\%v14.9.10
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)
62 .Dt "\*(UU" 1
63 .Os
64 .Mx -enable
67 .Sh NAME
68 .Nm \*(UA \%[\*(VV]
69 .Nd send and receive Internet mail
72 .\" .Sh SYNOPSIS {{{
73 .Sh SYNOPSIS
75 .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
76 .Nm \*(uA
77 .Fl h | Fl Fl help
78 .Pp
79 .Nm \*(uA
80 .Bk -words
81 .Op Fl BDdEFinv~#
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 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 BDdEeHiNnRv~#
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 BDdEeHiNnRv~#
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 .\" }}}
135 .Mx -toc -tree html pdf ps xhtml
138 .\" .Sh DESCRIPTION {{{
139 .Sh DESCRIPTION
141 .Bd -filled -compact -offset indent
142 .Sy Compatibility note:
143 S-nail (\*(UA) will wrap up into \%S-mailx in v15.0 (circa 2020).
144 Backward incompatibility has to be expected \(en
145 .Sx COMMANDS
146 will use
147 .Sx "Shell-style argument quoting"
148 rules, for example, and shell metacharacters will become meaningful.
149 New and old behaviour is flagged \*(IN and \*(OU, and setting
150 .Va v15-compat ,
151 one of the many
152 .Sx "INTERNAL VARIABLES" ,
153 will choose new behaviour when applicable.
154 \*(OB flags what will vanish, and enabling
155 .Fl d
157 .Fl v
158 enables obsoletion warnings.
162 \*(UA provides a simple and friendly environment for sending and
163 receiving mail.
164 It is intended to provide the functionality of the POSIX
165 .Xr mailx 1
166 command, but is MIME capable and optionally offers extensions for
167 line editing, S/MIME, SMTP and POP3, among others.
168 \*(UA divides incoming mail into its constituent messages and allows
169 the user to deal with them in any order.
170 It offers many
171 .Sx COMMANDS
173 .Sx "INTERNAL VARIABLES"
174 for manipulating messages and sending mail.
175 It provides the user simple editing capabilities to ease the composition
176 of outgoing messages, and increasingly powerful and reliable
177 non-interactive scripting capabilities.
179 .\" .Ss "Options" {{{
180 .Ss "Options"
182 .Bl -tag -width ".It Fl BaNg"
184 .It Fl \&: Ar spec
185 Explicitly control which of the
186 .Sx "Resource files"
187 shall be
188 .Ic source Ns
189 d (loaded): if the letter
190 .Ql s
191 is (case-insensitively) part of the
192 .Ar spec
193 then the system wide
194 .Pa \*(UR
195 is sourced, likewise the letter
196 .Ql u
197 controls sourcing of the user's personal
198 .Pa \*(ur
199 file, whereas the letters
200 .Ql -
202 .Ql /
203 explicitly forbid sourcing of any resource files.
204 Scripts should use this option: to avoid environmental noise they should
205 .Dq detach
206 from any configuration and create a script-specific environment, setting
207 any of the desired
208 .Sx "INTERNAL VARIABLES"
210 .Fl S
211 and running configurating commands via
212 .Fl X .
213 This option overrides
214 .Fl n .
217 .It Fl A Ar account
218 Executes an
219 .Ic account
220 command for the given user email
221 .Ar account
222 after program startup is complete (all resource files are loaded, any
223 .Fl S
224 setting is being established; only
225 .Fl X
226 commands have not been evaluated yet).
227 Being a special incarnation of
228 .Ic define Ns d
229 macros for the purpose of bundling longer-lived
230 .Ic set Ns
231 tings, activating such an email account also switches to the accounts
232 .Mx -sx
233 .Sx "primary system mailbox"
234 (most likely the
235 .Va inbox ) .
236 If the operation fails the program will exit if it is used
237 non-interactively, or if any of
238 .Va errexit
240 .Va posix
241 are set.
244 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
245 Attach
246 .Ar file
247 to the message (for compose mode opportunities refer to
248 .Ic ~@
250 .Ic ~^ ) .
251 .Sx "Filename transformations"
252 (also see
253 .Ic file )
254 will be performed, except that shell variables are not expanded.
255 Shall
256 .Ar file
257 not be accessible but contain a
258 .Ql =
259 character, then anything before the last
260 .Ql =
261 will be used as the filename, anything thereafter as a character set
262 specification.
264 If an input character set is specified,
265 .Mx -ix "character set specification"
266 but no output character set, then the given input character set is fixed
267 as-is, and no conversion will be applied;
268 giving the empty string or the special string hyphen-minus
269 .Ql -
270 will be treated as if
271 .Va ttycharset
272 has been specified (the default).
274 If an output character set has also been given then the conversion will
275 be performed exactly as specified and on-the-fly, not considering the
276 file type and content.
277 As an exception, if the output character set is specified as the empty
278 string or hyphen-minus
279 .Ql - ,
280 then the default conversion algorithm (see
281 .Sx "Character sets" )
282 is applied (therefore no conversion is performed on-the-fly,
283 .Ar file
284 will be MIME-classified and its contents will be inspected first) \(em
285 without support for character set conversions
286 .Pf ( Va features
287 does not include the term
288 .Ql +iconv )
289 only this argument is supported.
291 .It Fl B
292 (\*(OB: \*(UA will always use line-buffered output, to gain
293 line-buffered input even in batch mode enable batch mode via
294 .Fl # . )
297 .It Fl b Ar addr
298 Send a blind carbon copy to
299 .Ar addr Ns
300 ess, if the
301 .Ic set Ns
302 ting of
303 .Va expandaddr ,
304 one of the
305 .Sx "INTERNAL VARIABLES" ,
306 allows.
307 The option may be used multiple times.
308 Also see the section
309 .Sx "On sending mail, and non-interactive mode" .
312 .It Fl C Ar """field: body"""
313 Create a custom header which persists for an entire session.
314 A custom header consists of the field name followed by a colon
315 .Ql \&:
316 and the field content body, e.g.,
317 .Ql -C """Blah: Neminem laede; imo omnes, quantum potes, juva""" .
318 Standard header field names cannot be overwritten by custom headers.
319 Runtime adjustable custom headers are available via the variable
320 .Va customhdr ,
321 and in compose mode
322 .Ic ~^ ,
323 one of the
324 .Sx "COMMAND ESCAPES" ,
325 is the most flexible and powerful option to manage message headers.
326 This option may be used multiple times.
329 .It Fl c Ar addr
330 Send carbon copies to the given receiver, if so allowed by
331 .Va expandaddr .
332 May be used multiple times.
335 .It Fl D
336 (\*(OP) Startup with
337 .Va disconnected
338 .Ic set .
341 .It Fl d
342 Almost enable a sandbox mode with the internal variable
343 .Va debug ;
344 the same can be achieved via
345 .Ql Fl S Va \&\&debug
347 .Ql Ic set Va \&\&debug .
350 .It Fl E
351 .Ic set
352 .Va skipemptybody
353 and thus discard messages with an empty message part body.
356 .It Fl e
357 Just check if mail is present (in the system
358 .Va inbox
359 or the one specified via
360 .Fl f ) :
361 if yes, return an exit status of zero, a non-zero value otherwise.
362 To restrict the set of mails to consider in this evaluation a message
363 specification can be added with the option
364 .Fl L .
367 .It Fl F
368 Save the message to send in a file named after the local part of the
369 first recipient's address (instead of in
370 .Va record Ns ).
373 .It Fl f
374 Read in the contents of the user's
375 .Mx -sx
376 .Sx "secondary mailbox"
377 .Ev MBOX
378 (or the specified file) for processing;
379 when \*(UA is quit, it writes undeleted messages back to this file
380 (but be aware of the
381 .Va hold
382 option).
383 The optional
384 .Ar file
385 argument will undergo some special
386 .Sx "Filename transformations"
387 (also see
388 .Ic file ) .
389 Note that
390 .Ar file
391 is not an argument to the flag
392 .Fl \&\&f ,
393 but is instead taken from the command line after option processing has
394 been completed.
395 In order to use a
396 .Ar file
397 that starts with a hyphen-minus, prefix with a relative path, as in
398 .Ql ./-hyphenbox.mbox .
401 .It Fl H
402 Display a summary of
403 .Ic headers
404 and exit; a configurable summary view is available via the
405 .Fl L
406 option.
409 .It Fl h
410 Show a short usage summary.
413 .It Fl i
414 .Ic set
415 .Va ignore
416 to ignore tty interrupt signals.
419 .It Fl L Ar spec
420 Display a summary of
421 .Ic headers
422 of all messages that match the given
423 .Ar spec ,
424 then exit.
425 See the section
426 .Sx "Specifying messages"
427 for the format of
428 .Ar spec .
429 If the
430 .Fl e
431 option has been given in addition no header summary is produced,
432 but \*(UA will instead indicate via its exit status whether
433 .Ar spec
434 matched any messages
435 .Pf ( Ql 0 )
436 or not
437 .Pf ( Ql 1 ) ;
438 note that any verbose output is suppressed in this mode and must instead
439 be enabled explicitly (e.g., by using the option
440 .Fl v ) .
443 .It Fl M Ar type
444 Special send mode that will flag standard input with the MIME
445 .Ql Content-Type:
446 set to the given
447 .Ar type
448 and use it as the main message body.
449 \*(ID Using this option will bypass processing of
450 .Va message-inject-head
452 .Va message-inject-tail .
453 Also see
454 .Fl q , m , t .
457 .It Fl m Ar file
458 Special send mode that will MIME classify the specified
459 .Ar file
460 and use it as the main message body.
461 \*(ID Using this option will bypass processing of
462 .Va message-inject-head
464 .Va message-inject-tail .
465 Also see
466 .Fl q , M , t .
469 .It Fl N
470 inhibit the initial display of message headers when reading mail or
471 editing a mailbox
472 .Ic folder
473 by calling
474 .Ic unset
475 for the internal variable
476 .Va header .
479 .It Fl n
480 Standard flag that inhibits reading the system wide
481 .Pa \*(UR
482 upon startup.
483 The option
484 .Fl \&:
485 allows more control over the startup sequence; also see
486 .Sx "Resource files" .
489 .It Fl q Ar file
490 Special send mode that will initialize the message body with the
491 contents of the specified
492 .Ar file ,
493 which may be standard input
494 .Ql -
495 only in non-interactive context.
496 Also see
497 .Fl M , m , t .
500 .It Fl R
501 Any mailbox
502 .Ic folder
503 a.k.a.\&
504 .Ic file
505 opened will be in read-only mode.
509 .It Fl r Ar from-addr
510 Whereas the source address that appears in the
511 .Va from
512 header of a message (or in the
513 .Va sender
514 header if the former contains multiple addresses) is honoured by the
515 builtin SMTP transport, it is not used by a file-based
516 .Va mta
517 (Mail-Transfer-Agent) for the RFC 5321 reverse-path used for relaying
518 and delegating a message to its destination(s), for delivery errors
519 etc., but it instead uses the local identity of the initiating user.
522 When this command line option is used the given
523 .Ar from-addr
524 will be assigned to the internal variable
525 .Va from ,
526 but in addition the command line option
527 .Fl \&\&f Ar from-addr
528 will be passed to a file-based
529 .Va mta
530 whenever a message is sent.
531 Shall
532 .Ar from-addr
533 include a user name the address components will be separated and
534 the name part will be passed to a file-based
535 .Va mta
536 individually via
537 .Fl \&\&F Ar name .
540 If an empty string is passed as
541 .Ar from-addr
542 then the content of the variable
543 .Va from
544 (or, if that contains multiple addresses,
545 .Va sender )
546 will be evaluated and used for this purpose whenever the file-based
547 .Va mta
548 is contacted.
549 By default, without
550 .Fl \&\&r
551 that is, neither
552 .Fl \&\&f
554 .Fl \&\&F
555 command line options are used when contacting a file-based MTA, unless
556 this automatic deduction is enforced by
557 .Ic set Ns
558 ing the internal variable
559 .Va r-option-implicit .
562 Remarks: many default installations and sites disallow overriding the
563 local user identity like this unless either the MTA has been configured
564 accordingly or the user is member of a group with special privileges.
565 Passing an invalid address will cause an error.
569 .It Fl S Ar var Ns Op = Ns value
570 .Ic set
571 (or, with a prefix string
572 .Ql no ,
573 as documented in
574 .Sx "INTERNAL VARIABLES" ,
575 .Ic unset )
576 .Ar var Ns
577 iable and optionally assign
578 .Ar value ,
579 if supported; \*(ID the entire expression is evaluated as if specified
580 within dollar-single-quotes (see
581 .Sx "Shell-style argument quoting" )
582 if the internal variable
583 .Va v15-compat
584 is set.
585 If the operation fails the program will exit if any of
586 .Va errexit
588 .Va posix
589 are set.
590 Settings established via
591 .Fl \&\&S
592 cannot be changed from within
593 .Sx "Resource files"
594 or an account switch initiated by
595 .Fl A .
596 They will become mutable again before commands registered via
597 .Fl X
598 are executed.
601 .It Fl s Ar subject
602 Specify the subject of the message to be sent.
603 Newline (NL) and carriage-return (CR) bytes are invalid and will be
604 normalized to space (SP) characters.
607 .It Fl t
608 The message given (on standard input) is expected to contain, separated
609 from the message body by an empty line, a message header with
610 .Ql To: ,
611 .Ql Cc: ,
613 .Ql Bcc:
614 fields giving its recipients, which will be added to any recipients
615 specified on the command line.
616 If a message subject is specified via
617 .Ql Subject:
618 then it will be used in favour of one given on the command line.
620 Also understood are
621 .Ql Reply-To:
622 (possibly overriding
623 .Va reply-to ) ,
624 .Ql Sender:
625 .Pf ( Va sender ) ,
626 .Ql From:
627 .Pf ( Va from
628 and / or option
629 .Fl r ) .
630 .Ql Message-ID: ,
631 .Ql In-Reply-To: ,
632 .Ql References:
634 .Ql Mail-Followup-To: ,
635 by default created automatically dependent on message context, will
636 be used if specified (a special address massage will however still occur
637 for the latter).
638 Any other custom header field (also see
639 .Fl C ,
640 .Va customhdr
642 .Ic ~^ )
643 is passed through entirely
644 unchanged, and in conjunction with the options
645 .Fl ~
647 .Fl #
648 it is possible to embed
649 .Sx "COMMAND ESCAPES" .
650 Also see
651 .Fl M , m , q .
654 .It Fl u Ar user
655 Initially read the
656 .Mx -sx
657 .Sx "primary system mailbox"
659 .Ar user ,
660 appropriate privileges presumed; effectively identical to
661 .Ql Fl \&\&f Ns \0%user .
664 .It Fl V
665 Show \*(UAs
666 .Va version
667 and exit.
668 The command
669 .Ic version
670 will also show the list of
671 .Va features :
672 .Ql $ \*(uA -Xversion -Xx .
675 .It Fl v
676 .Ic set Ns
677 ting the internal variable
678 .Va verbose
679 enables display of some informational context messages.
680 Using it twice increases the level of verbosity.
683 .It Fl X Ar cmd
684 Add the given (or multiple for a multiline argument)
685 .Ar cmd
686 to the list of commands to be executed,
687 as a last step of program startup, before normal operation starts.
688 This is the only possibility to execute commands in non-interactive mode
689 when reading startup files has been disabled.
690 The commands will be evaluated as a unit, just as via
691 .Ic source .
692 Correlates with
693 .Fl #
695 .Va errexit .
698 .It Fl ~
699 Enable
700 .Sx "COMMAND ESCAPES"
701 in compose mode even in non-interactive use cases.
702 This can be used to, e.g., automatically format the composed message
703 text before sending the message:
704 .Bd -literal -offset indent
705 $ ( echo 'line    one. Word.     Word2.';\e
706     echo '~| /usr/bin/fmt -tuw66' ) |\e
707   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
711 .It Fl #
712 Enables batch mode: standard input is made line buffered, the complete
713 set of (interactive) commands is available, processing of
714 .Sx "COMMAND ESCAPES"
715 is enabled in compose mode, and diverse
716 .Sx "INTERNAL VARIABLES"
717 are adjusted for batch necessities, exactly as if done via
718 .Ic set :
719 .Va emptystart ,
720 .Pf no Va errexit ,
721 .Pf no Va header ,
722 .Pf no Va posix ,
723 .Va quiet ,
724 .Va sendwait ,
725 .Va typescript-mode
726 as well as
727 .Ev MAIL ,
728 .Ev MBOX
730 .Va inbox
731 (the latter three to
732 .Pa /dev/null ) .
733 The following prepares an email message in a batched dry run:
734 .Bd -literal -offset indent
735 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
736   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
740 .It Fl \&.
741 This flag forces termination of option processing in order to prevent
742 .Dq option injection
743 (attacks).
744 It also forcefully puts \*(UA into send mode, see
745 .Sx "On sending mail, and non-interactive mode" .
749 All given
750 .Ar to-addr
751 arguments and all receivers established via
752 .Fl b
754 .Fl c
755 are subject to the checks established by
756 .Va expandaddr ,
757 one of the
758 .Sx "INTERNAL VARIABLES" .
759 If the setting of
760 .Va expandargv
761 allows their recognition all
762 .Ar mta-option
763 arguments given at the end of the command line after a
764 .Ql --
765 separator will be passed through to a file-based
766 .Va mta
767 (Mail-Transfer-Agent) and persist for the entire session.
768 .Va expandargv
769 constraints do not apply to the content of
770 .Va mta-arguments .
771 .\" }}}
773 .\" .Ss "A starter" {{{
774 .Ss "A starter"
776 \*(UA is a direct descendant of
778 Mail, itself a successor of the Research
780 mail which
781 .Dq was there from the start
782 according to
783 .Sx HISTORY .
784 It thus represents the user side of the
786 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
787 traditionally taken by
788 .Xr sendmail 8 ,
789 and most MTAs provide a binary of this name for compatibility purposes.
790 If the \*(OPal SMTP
791 .Va mta
792 is included in the
793 .Va features
794 of \*(UA then the system side is not a mandatory precondition for mail
795 delivery.
798 Because \*(UA strives for compliance with POSIX
799 .Xr mailx 1
800 it is likely that some configuration settings have to be adjusted before
801 using it is a smooth experience.
802 (Rather complete configuration examples can be found in the section
803 .Sx EXAMPLES . )
804 The provided global
805 .Pa \*(UR
806 (one of the
807 .Sx "Resource files" )
808 template bends those standard imposed settings of the
809 .Sx "INTERNAL VARIABLES"
810 a bit towards more user friendliness and safety, however.
813 For example, it
814 .Ic set Ns s
815 .Va hold
817 .Va keepsave
818 in order to suppress the automatic moving of messages to the
819 .Mx -sx
820 .Sx "secondary mailbox"
821 .Ev MBOX
822 that would otherwise occur (see
823 .Sx "Message states" ) ,
825 .Va keep
826 to not remove empty system MBOX mailbox files (or all empty such files if
827 .Va posix
828 .Pf a.k.a.\0 Ev POSIXLY_CORRECT
829 mode has been enabled) to avoid mangling of file permissions when files
830 eventually get recreated.
832 It also enables
833 .Va sendwait
834 in order to synchronize \*(UA with the exit status report of the used
835 .Va mta
836 when sending mails.
838 .Ic set Ns
840 .Va emptystart
841 to enter interactive startup even if the initial mailbox is empty,
842 .Va editheaders
843 to allow editing of headers as well as
844 .Va fullnames
845 to not strip down addresses in compose mode, and
846 .Va quote
847 to include the message that is being responded to when
848 .Ic reply Ns
849 ing, which is indented by an
850 .Va indentprefix
851 that also deviates from standard imposed settings.
852 .Va mime-counter-evidence
853 is fully enabled, too.
856 Some random remarks.
857 The file mode creation mask can be managed explicitly via the variable
858 .Va umask .
859 Sufficient system support provided symbolic links will not be followed
860 when files are opened for writing.
861 Files and shell pipe output can be
862 .Ic source Ns
863 d for evaluation, also during startup from within the
864 .Sx "Resource files" .
865 .\" }}}
867 .\" .Ss "On sending mail, and non-interactive mode" {{{
868 .Ss "On sending mail, and non-interactive mode"
870 To send a message to one or more people, using a local or built-in
871 .Va mta
872 (Mail-Transfer-Agent) transport to actually deliver the generated mail
873 message, \*(UA can be invoked with arguments which are the names of
874 people to whom the mail will be sent, and the command line options
875 .Fl b
877 .Fl c
878 can be used to add (blind) carbon copy receivers:
880 .Bd -literal -offset indent
881 # Via sendmail(1)
882 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
884 # But... try it in an isolated dry-run mode (-d) first
885 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
886    -b bcc@exam.ple -c cc@exam.ple \e
887    -Sfullnames -. \e
888    '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
890 # With SMTP
891 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
892     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
893     -S from=scriptreply@exam.ple \e
894     -a /etc/mail.rc \e
895     -. eric@exam.ple
899 If standard input is a terminal rather than the message to be sent,
900 the user is expected to type in the message contents.
901 In this compose mode \*(UA treats lines beginning with the character
902 .Ql ~
903 special \(en these are so-called
904 .Sx "COMMAND ESCAPES" ,
905 which can be used to read in files, process shell commands, add and edit
906 attachments and more; e.g.,
907 .Ic ~v
909 .Ic ~e
910 will start the
911 .Ev VISUAL
912 text
913 .Ev EDITOR ,
914 respectively, to revise the message in its current state,
915 .Ic ~h
916 allows editing of the most important message headers, with the potent
917 .Ic ~^
918 custom headers can be created, for example (more specifically than with
919 .Fl C
921 .Va customhdr ) .
922 .Ic ~?
923 \*(OPally gives an overview of most other available command escapes.
924 The command escape
925 .Ic ~.
926 will leave compose mode and send the message once it is completed.
927 Aborting letter composition is possible with either of
928 .Ic ~x
930 .Ic ~q ,
931 the latter of which will save the message in the file denoted by
932 .Ev DEAD
933 unless
934 .Pf no Va save
935 is set.
936 Unless
937 .Va ignoreeof
938 is set the effect of
939 .Ic ~.
940 can also be achieved by typing end-of-transmission (EOT) via
941 .Ql control-D
942 .Pf ( Ql ^D )
943 at the beginning of an empty line, and
944 .Ic ~q
945 is always reachable by typing end-of-text (ETX) twice via
946 .Ql control-C
947 .Pf ( Ql ^C ) .
950 A number of
951 .Sx ENVIRONMENT
953 .Sx "INTERNAL VARIABLES"
954 can be used to alter default behavior.
955 E.g., messages are sent asynchronously, without supervision, unless the
956 internal variable
957 .Va sendwait
958 is set, therefore send errors will not be recognizable until then.
959 .Ic set Ns
960 ting (also via
961 .Fl S )
962 .Va editalong
963 will automatically startup an editor when compose mode is entered,
964 .Va editheaders
965 allows editing of headers additionally to plain body content,
966 .Va askcc
968 .Va askbcc
969 will cause the user to be prompted actively for (blind) carbon-copy
970 recipients, respectively, and (the default)
971 .Va asksend
972 will request confirmation whether the message shall be sent.
975 The envelope sender address is defined by
976 .Va from ,
977 explicitly defining an originating
978 .Va hostname
979 may be desirable, especially with the builtin SMTP Mail-Transfer-Agent
980 .Va mta .
981 .Sx "Character sets"
982 for outgoing message and MIME part content are configurable via
983 .Va sendcharsets ,
984 whereas input data is assumed to be in
985 .Va ttycharset .
986 Message data will be passed over the wire in a
987 .Va mime-encoding .
988 MIME parts a.k.a. attachments need to be assigned a
989 .Ic mimetype ,
990 usually taken out of
991 .Sx "The mime.types files" .
992 Saving a copy of sent messages in a
993 .Va record
994 mailbox may be desirable \(en as for most mailbox
995 .Ic file
996 targets the value will undergo
997 .Sx "Filename transformations" .
998 Some introductional
999 .Fl d
1001 .Va debug
1002 sandbox dry-run tests will prove correctness.
1005 Message recipients (as specified on the command line or defined in
1006 .Ql To: ,
1007 .Ql Cc:
1009 .Ql Bcc: )
1010 may not only be email addressees but can also be names of mailboxes and
1011 even complete shell command pipe specifications.
1012 If the variable
1013 .Va expandaddr
1014 is not set then only network addresses (see
1015 .Xr mailaddr 7
1016 for a description of mail addresses) and plain user names (including MTA
1017 aliases) may be used, other types will be filtered out, giving a warning
1018 message.
1019 A network address that contains no domain-, but only a valid local user
1020 .Ql <name>
1021 in angle brackets will be automatically expanded to a valid address when
1022 .Va hostname
1023 is set to a non-empty value; setting it to the empty value instructs
1024 \*(UA that the used
1025 .Va mta
1026 will perform the necessary expansion.
1027 The command
1028 .Ic addrcodec
1029 may help to generate standard compliant network addresses.
1031 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
1032 .\" grep the latter for the complete picture
1034 If the variable
1035 .Va expandaddr
1036 is set then an extended set of recipient addresses will be accepted:
1037 Any name that starts with a vertical bar
1038 .Ql |
1039 character specifies a command pipe \(en the command string following the
1040 .Ql |
1041 is executed and the message is sent to its standard input;
1042 Likewise, any name that starts with the character solidus
1043 .Ql /
1044 or the character sequence dot solidus
1045 .Ql ./
1046 is treated as a file, regardless of the remaining content;
1047 likewise a name that solely consists of a hyphen-minus
1048 .Ql - .
1049 Any other name which contains a commercial at
1050 .Ql @
1051 character is treated as a network address;
1052 Any other name which starts with a plus sign
1053 .Ql +
1054 character specifies a mailbox name;
1055 Any other name which contains a solidus
1056 .Ql /
1057 character but no exclamation mark
1058 .Ql \&!
1059 or percent sign
1060 .Ql %
1061 character before also specifies a mailbox name;
1062 What remains is treated as a network address.
1064 .Bd -literal -offset indent
1065 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1066 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1067 $ echo safe | LC_ALL=C \e
1068     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
1069       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1070       -. bob@exam.ple
1074 It is possible to create personal distribution lists via the
1075 .Ic alias
1076 command, so that, for instance, the user can send mail to
1077 .Ql cohorts
1078 and have it go to a group of people.
1079 Different to the alias mechanism of a local
1080 .Va mta ,
1081 which is often tracked in a file
1082 .Pa /etc/aliases ,
1083 documented in
1084 .Xr aliases 5 ,
1085 and the names of which are subject to the
1086 .Ql name
1087 constraint of
1088 .Va expandaddr ,
1089 personal aliases will be expanded by \*(UA before the message is sent.
1090 They are thus a convenient alternative to specifying each addressee by
1091 itself, correlate with the active set of
1092 .Ic alternates ,
1093 and are subject to
1094 .Va metoo
1095 filtering.
1097 .Bd -literal -offset indent
1098 ? alias  cohorts  bill jkf mark kridle@ucbcory ~/cohorts.mbox
1099 ? alias  mark  mark@exam.ple
1103 .Va on-compose-enter , on-compose-leave
1105 .Va on-compose-cleanup
1106 hook variables may be set to
1107 .Ic define Ns
1108 d macros to automatically adjust some settings dependent
1109 on receiver, sender or subject contexts, and via the
1110 .Va on-compose-splice
1111 as well as
1112 .Va on-compose-splice-shell
1113 variables, the former also to be set to a
1114 .Ic define Ns
1115 d macro, increasingly powerful mechanisms to perform automated message
1116 adjustments, including signature creation, are available.
1117 (\*(ID These hooks work for commands which newly create messages, namely
1118 .Ic forward , mail , reply
1119 and variants;
1120 .Ic resend
1122 .Ic Resend
1123 for now provide only the hooks
1124 .Va on-resend-enter
1126 .Va on-resend-cleanup . )
1129 For the purpose of arranging a complete environment of settings that can
1130 be switched to with a single command or command line option there are
1131 .Ic account Ns s .
1132 Alternatively it is also possible to use a flat configuration, making use
1133 of so-called variable chains which automatically pick
1134 .Ql USER@HOST
1136 .Ql HOST
1137 context-dependent variable variants: for example addressing
1138 .Ql Ic File Ns \& pop3://yaa@exam.ple
1139 would find
1140 .Va \&\&pop3-no-apop-yaa@exam.ple ,
1141 .Va \&\&pop3-no-apop-exam.ple
1143 .Va pop3-no-apop
1144 in order.
1146 .Sx "On URL syntax and credential lookup"
1148 .Sx "INTERNAL VARIABLES" .
1151 To avoid environmental noise scripts should
1152 .Dq detach
1153 \*(UA from any configuration files and create a script-local
1154 environment, ideally with the command line options
1155 .Fl \&:
1156 to disable any configuration file in conjunction with repetitions of
1157 .Fl S
1158 to specify variables:
1160 .Bd -literal -offset indent
1161 $ env LC_ALL=C \*(uA -:/ \e
1162     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1163     -Sexpandaddr=fail,-all,failinvaddr \e
1164     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1165     -S from=scriptreply@exam.ple \e
1166     -s 'Subject to go' -a attachment_file \e
1167     -Sfullnames -. \e
1168     'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1169     < content_file
1173 As shown, scripts can
1174 .Dq fake
1175 a locale environment, the above specifies the all-compatible 7-bit clean
1176 .Ev LC_ALL
1177 .Dq C ,
1178 but will nonetheless take and send UTF-8 in the message text by using
1179 .Va ttycharset .
1180 In interactive mode, which is introduced in the next section, messages
1181 can be sent by calling the
1182 .Ic mail
1183 command with a list of recipient addresses:
1185 .Bd -literal -offset indent
1186 $ \*(uA -d -Squiet -Semptystart
1187 "/var/spool/mail/user": 0 messages
1188 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1189 \&...
1190 ? # Will do the right thing (tm)
1191 ? m rec1@exam.ple rec2@exam.ple
1193 .\" }}}
1195 .\" .Ss "On reading mail, and interactive mode" {{{
1196 .Ss "On reading mail, and interactive mode"
1198 When invoked without addressees \*(UA enters interactive mode in which
1199 mails may be read.
1200 When used like that the user's system
1201 .Va inbox
1202 (for more on mailbox types please see the command
1203 .Ic file )
1204 is read in and a one line header of each message therein is displayed if
1205 the variable
1206 .Va header
1207 is set.
1208 The visual style of this summary of
1209 .Ic headers
1210 can be adjusted through the variable
1211 .Va headline
1212 and the possible sorting criterion via
1213 .Va autosort .
1214 Scrolling through
1215 .Va screen Ns
1216 fuls of
1217 .Ic headers
1218 can be performed with the command
1219 .Ic z .
1220 If the initially opened mailbox is empty \*(UA will instead exit
1221 immediately (after displaying a message) unless the variable
1222 .Va emptystart
1223 is set.
1226 At the
1227 .Va prompt
1228 the command
1229 .Ic list
1230 will give a listing of all available commands and
1231 .Ic help
1232 will \*(OPally give a summary of some common ones.
1233 If the \*(OPal documentation strings are available (see
1234 .Va features )
1235 one can type
1236 .Ql help X
1237 .Pf "(or " Ql ?X )
1238 and see the actual expansion of
1239 .Ql X
1240 and what its purpose is, i.e., commands can be abbreviated
1241 (note that POSIX defines some abbreviations, so that the alphabetical
1242 order of commands does not necessarily relate to the abbreviations; it is
1243 however possible to define overwrites with
1244 .Ic commandalias ) .
1245 These commands can also produce a more
1246 .Va verbose
1247 output.
1250 Messages are given numbers (starting at 1) which uniquely identify
1251 messages; the current message \(en the
1252 .Dq dot
1253 \(en will either be the first new message, or the first unread message,
1254 or the first message of the mailbox; the internal variable
1255 .Va showlast
1256 will instead cause usage of the last message for this purpose.
1257 The command
1258 .Ic headers
1259 will display a
1260 .Va screen Ns
1261 ful of header summaries containing the
1262 .Dq dot ,
1263 whereas
1264 .Ic from
1265 will display only the summaries of the given messages, defaulting to the
1266 .Dq dot .
1269 Message content can be displayed with the command
1270 .Ic type
1271 .Pf ( Ql t ,
1272 alias
1273 .Ic print ) .
1274 Here the variable
1275 .Va crt
1276 controls whether and when \*(UA will use the configured
1277 .Ev PAGER
1278 for display instead of directly writing to the user terminal
1279 .Va screen ,
1280 the sole difference to the command
1281 .Ic more ,
1282 which will always use the
1283 .Ev PAGER .
1284 The command
1285 .Ic top
1286 will instead only show the first
1287 .Va toplines
1288 of a message (maybe even compressed if
1289 .Va topsqueeze
1290 is set).
1291 Message display experience may improve by setting and adjusting
1292 .Va mime-counter-evidence ,
1293 and also see
1294 .Sx "HTML mail and MIME attachments" .
1297 By default the current message
1298 .Pf ( Dq dot )
1299 is displayed, but like with many other commands it is possible to give
1300 a fancy message specification (see
1301 .Sx "Specifying messages" ) ,
1302 e.g.,
1303 .Ql t:u
1304 will display all unread messages,
1305 .Ql t.
1306 will display the
1307 .Dq dot ,
1308 .Ql t 1 5
1309 will type the messages 1 and 5,
1310 .Ql t 1-5
1311 will type the messages 1 through 5, and
1312 .Ql t-
1314 .Ql t+
1315 will display the previous and the next message, respectively.
1316 The command
1317 .Ic search
1318 (a more substantial alias for
1319 .Ic from )
1320 will display a header summary of the given message specification list
1321 instead of their content, e.g., the following will search for subjects:
1324 .Dl ? from "'@Some subject to search for'"
1327 In the default setup all header fields of a message will be
1328 .Ic type Ns
1329 d, but fields can be white- or blacklisted for a variety of
1330 applications by using the command
1331 .Ic headerpick ,
1332 e.g., to restrict their display to a very restricted set for
1333 .Ic type :
1334 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1335 In order to display all header fields of a message regardless of
1336 currently active ignore or retain lists, use the commands
1337 .Ic Type
1339 .Ic Top ;
1340 .Ic Show
1341 will show the raw message content.
1342 Note that historically the global
1343 .Pa \*(UR
1344 not only adjusts the list of displayed headers, but also sets
1345 .Va crt .
1348 Dependent upon the configuration a line editor (see the section
1349 .Sx "On terminal control and line editor" )
1350 aims at making the user experience with the many
1351 .Sx COMMANDS
1352 a bit nicer.
1353 When reading the system
1354 .Va inbox ,
1355 or when
1356 .Fl f
1358 .Ic file )
1359 specified a mailbox explicitly prefixed with the special
1360 .Ql %:
1361 modifier (to propagate it to a
1362 .Mx -sx
1363 .Sx "primary system mailbox" ) ,
1364 then messages which have been read
1365 .Pf (see\0 Sx "Message states" )
1366 will be automatically moved to a
1367 .Mx -sx
1368 .Sx "secondary mailbox" ,
1369 the user's
1370 .Ev MBOX
1371 file, when the mailbox is left, either by changing the active mailbox or
1372 by quitting \*(UA \(en this automatic moving from a system- or primary-
1373 to the secondary mailbox is not performed when the variable
1374 .Va hold
1375 is set.
1376 Messages can also be explicitly
1377 .Ic move Ns
1378 d to other mailboxes, whereas
1379 .Ic copy
1380 keeps the original message.
1381 .Ic write
1382 can be used to write out data content of specific parts of messages.
1385 After examining a message the user can
1386 .Ic reply Ql r
1387 to the sender and all recipients (which will also be placed in
1388 .Ql To:
1389 unless
1390 .Va recipients-in-cc
1391 is set), or
1392 .Ic Reply Ql R
1393 exclusively to the sender(s).
1394 The command
1395 .Ic Lreply
1396 knows how to apply a special addressee massage, see
1397 .Sx "Mailing lists" .
1398 .Ic forward Ns
1399 ing a message will allow editing the new message: the original message
1400 will be contained in the message body, adjusted according to
1401 .Ic headerpick .
1402 It is possible to
1403 .Ic resend
1405 .Ic Resend
1406 messages: the former will add a series of
1407 .Ql Resent-
1408 headers, whereas the latter will not; different to newly created
1409 messages editing is not possible and no copy will be saved even with
1410 .Va record
1411 unless the additional variable
1412 .Va record-resent
1413 is set.
1414 When sending, replying or forwarding messages comments and full names
1415 will be stripped from recipient addresses unless the internal variable
1416 .Va fullnames
1417 is set.
1420 Of course messages can be
1421 .Ic delete Ql d ,
1422 and they can spring into existence again via
1423 .Ic undelete ,
1424 or when the \*(UA session is ended via the
1425 .Ic exit
1427 .Ic xit
1428 commands to perform a quick program termation.
1429 To end a mail processing session regulary and perform a full program
1430 exit one may issue the command
1431 .Ic quit .
1432 It will, among others, move read messages to the
1433 .Mx -sx
1434 .Sx "secondary mailbox"
1435 .Ev MBOX
1436 as necessary, discard deleted messages in the current mailbox,
1437 and update the \*(OPal (see
1438 .Va features )
1439 line editor
1440 .Va history-file .
1441 .\" }}}
1443 .\" .Ss "HTML mail and MIME attachments" {{{
1444 .Ss "HTML mail and MIME attachments"
1446 Messages which are HTML-only become more and more common, and of course
1447 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1448 Mail Extensions) parts.
1449 To get a notion of MIME types \*(UA has a default set of types built-in,
1450 onto which the content of
1451 .Sx "The mime.types files"
1452 will be added (as configured and allowed by
1453 .Va mimetypes-load-control ) .
1454 Types can also become registered with the command
1455 .Ic mimetype .
1456 To improve interaction with faulty MIME part declarations which are
1457 often seen in real-life messages, setting
1458 .Va mime-counter-evidence
1459 will allow verification of the given assertion, and possible provision
1460 of an alternative, better MIME type.
1463 Whereas \*(UA \*(OPally supports a simple HTML-to-text filter for
1464 displaying HTML messages, it cannot handle MIME types other than plain
1465 text itself.
1466 Instead programs need to become registered to deal with specific MIME
1467 types or file extensions.
1468 These programs may either prepare plain text versions of their input in
1469 order to enable \*(UA to integrate their output neatlessly in its own
1470 message visualization (a mode which is called
1471 .Cd copiousoutput ) ,
1472 or display the content themselves, for example in an external graphical
1473 window: such handlers will only be considered by and for the command
1474 .Ic mimeview .
1477 To install a handler program for a specific MIME type an according
1478 .Va pipe-TYPE/SUBTYPE
1479 variable needs to be set; to instead define a handler for a specific
1480 file extension the respective
1481 .Va pipe-EXTENSION
1482 variable can be used \(en these handlers take precedence.
1483 \*(OPally \*(UA supports mail user agent configuration as defined in
1484 RFC 1524; this mechanism (see
1485 .Sx "The Mailcap files" )
1486 will be queried for display or quote handlers if none of the former two
1487 .\" TODO v15-compat "will be" -> "is"
1488 did; it will be the sole source for handlers of other purpose.
1489 A last source for handlers is the MIME type definition itself, if
1490 a type-marker has been registered with the command
1491 .Ic mimetype ,
1492 which many of the built-in MIME types do.
1495 For example, to display a HTML message inline (converted to a more fancy
1496 plain text representation than the built-in filter is capable to produce)
1497 with either of the text-mode browsers
1498 .Xr lynx 1
1500 .Xr elinks 1 ,
1501 teach \*(UA about MathML documents and make it display them as plain
1502 text, and to open PDF attachments in an external PDF viewer,
1503 asynchronously and with some other magic attached:
1505 .Bd -literal -offset indent
1506 ? if [ "$features" !% +filter-html-tagsoup ]
1507 ?   #set pipe-text/html='@* elinks -force-html -dump 1'
1508 ?   set pipe-text/html='@* lynx -stdin -dump -force_html'
1509 ?   # Display HTML as plain text instead
1510 ?   #set pipe-text/html=@
1511 ? endif
1512 ? mimetype @ application/mathml+xml mathml
1513 ? wysh set pipe-application/pdf='@&=@ \e
1514     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1515     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1516     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1518 .\" }}}
1520 .\" .Ss "Mailing lists" {{{
1521 .Ss "Mailing lists"
1523 \*(UA offers some support to ease handling of mailing lists.
1524 The command
1525 .Ic mlist
1526 promotes all given arguments to known mailing lists, and
1527 .Ic mlsubscribe
1528 sets their subscription attribute, creating them first as necessary.
1529 (On the other hand
1530 .Ic unmlsubscribe
1531 does not
1532 .Ic unmlist
1533 automatically, but only resets the subscription attribute.)
1534 Using the commands without arguments will show (a subset of) all
1535 currently defined mailing lists.
1537 .Va headline
1538 format
1539 .Ql \&%T
1540 can be used to mark out messages with configured list addresses
1541 in the display of
1542 .Ic headers .
1545 If the \*(OPal regular expression support is available a mailing list
1546 specification that contains any of the
1547 .Dq magical
1548 regular expression characters
1549 .Ql ^[]*+?|$
1550 (see
1551 .Xr re_format 7 )
1552 will be interpreted as one, which allows matching of many addresses with
1553 a single expression.
1554 However, all fully qualified list addresses are matched via a fast
1555 dictionary, whereas expressions are placed in (a) list(s) which is
1556 (are) matched sequentially.
1558 .Bd -literal -offset indent
1559 ? set followup-to followup-to-honour=ask-yes \e
1560     reply-to-honour=ask-yes
1561 ? wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1562 ? mlsubscribe a4@b4.c4 exact@lists.c3
1566 The variable
1567 .Va followup-to-honour
1568 will ensure that a
1569 .Ql Mail-\:Followup-\:To:
1570 header is honoured when the message is being replied to (via
1571 .Ic reply
1573 .Ic Lreply )
1575 .Va followup-to
1576 controls whether this header is created when sending mails; it will be
1577 created automatically for a couple of reasons, too, like when the
1578 special
1579 .Dq mailing list specific
1580 respond command
1581 .Ic Lreply
1582 is used, when
1583 .Ic reply
1584 is used to respond to a message with its
1585 .Ql Mail-Followup-To:
1586 being honoured etc.
1589 A difference in between the handling of known and subscribed lists is
1590 that the address of the user is usually not part of a generated
1591 .Ql Mail-Followup-To:
1592 when addressing the latter, whereas it is for the former kind of lists.
1593 Usually because there are exceptions: say, if multiple lists are
1594 addressed and not all of them are subscribed lists.
1596 For convenience \*(UA will, temporarily, automatically add a list
1597 address that is presented in the
1598 .Ql List-Post:
1599 header of a message that is being responded to to the list of known
1600 mailing lists.
1601 Shall that header have existed \*(UA will instead, dependent on the
1602 variable
1603 .Va reply-to-honour ,
1604 use an also set
1605 .Ql Reply-To:
1606 for this purpose (if it provides a single address which resides on the
1607   same domain as what is stated in
1608 .Ql List-Post: )
1609 in order to accept a list administrator's wish that is supposed to have
1610 been manifested like that.
1611 .\" }}}
1613 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1614 .Ss "Signed and encrypted messages with S/MIME"
1616 \*(OP S/MIME provides two central mechanisms:
1617 message signing and message encryption.
1618 A signed message contains some data in addition to the regular text.
1619 The data can be used to verify that the message has been sent using
1620 a valid certificate, that the sender address matches that in the
1621 certificate, and that the message text has not been altered.
1622 Signing a message does not change its regular text;
1623 it can be read regardless of whether the recipients software is able to
1624 handle S/MIME.
1625 It is thus usually possible to sign all outgoing messages if so desired.
1628 Encryption, in contrast, makes the message text invisible for all people
1629 except those who have access to the secret decryption key.
1630 To encrypt a message, the specific recipients public encryption key
1631 must be known.
1632 It is therefore not possible to send encrypted mail to people unless their
1633 key has been retrieved from either previous communication or public key
1634 directories.
1635 A message should always be signed before it is encrypted.
1638 A central concept to S/MIME is that of the certification authority (CA).
1639 A CA is a trusted institution that issues certificates.
1640 For each of these certificates it can be verified that it really
1641 originates from the CA, provided that the CA's own certificate is
1642 previously known.
1643 A set of CA certificates is usually delivered and installed together
1644 with the cryptographical library that is used on the local system.
1645 Therefore reasonable security for S/MIME on the Internet is provided if
1646 the source that provides that library installation is trusted.
1647 It is also possible to use a specific pool of trusted certificates.
1648 If this is desired,
1649 .Va smime-ca-no-defaults
1650 should be set to avoid using the default certificate pool, and
1651 .Va smime-ca-file
1652 and/or
1653 .Va smime-ca-dir
1654 should be pointed to a trusted pool of certificates.
1655 A certificate cannot be more secure than the method its CA certificate
1656 has been retrieved with.
1659 This trusted pool of certificates is used by the command
1660 .Ic verify
1661 to ensure that the given S/MIME messages can be trusted.
1662 If so, verified sender certificates that were embedded in signed
1663 messages can be saved locally with the command
1664 .Ic certsave ,
1665 and used by \*(UA to encrypt further communication with these senders:
1667 .Bd -literal -offset indent
1668 ? certsave FILENAME
1669 ? set smime-encrypt-USER@HOST=FILENAME \e
1670     smime-cipher-USER@HOST=AES256
1674 To sign outgoing messages in order to allow receivers to verify the
1675 origin of these messages a personal S/MIME certificate is required.
1676 \*(UA supports password-protected personal certificates (and keys),
1677 for more on this, and its automatization, please see the section
1678 .Sx "On URL syntax and credential lookup" .
1679 The section
1680 .Sx "S/MIME step by step"
1681 shows examplarily how such a private certificate can be obtained.
1682 In general, if such a private key plus certificate
1683 .Dq pair
1684 is available, all that needs to be done is to set some variables:
1686 .Bd -literal -offset indent
1687 ? set smime-sign-cert=ME@exam.ple.paired \e
1688     smime-sign-message-digest=SHA512 \e
1689     smime-sign
1693 Variables of interest for S/MIME in general are
1694 .Va smime-ca-dir ,
1695 .Va smime-ca-file ,
1696 .Va smime-ca-flags ,
1697 .Va smime-ca-no-defaults ,
1698 .Va smime-crl-dir ,
1699 .Va smime-crl-file .
1700 For S/MIME signing of interest are
1701 .Va smime-sign ,
1702 .Va smime-sign-cert ,
1703 .Va smime-sign-include-certs
1705 .Va smime-sign-message-digest .
1706 Additional variables of interest for S/MIME en- and decryption:
1707 .Va smime-cipher
1709 .Va smime-encrypt-USER@HOST .
1712 \*(ID Note that neither S/MIME signing nor encryption applies to
1713 message subjects or other header fields yet.
1714 Thus they may not contain sensitive information for encrypted messages,
1715 and cannot be trusted even if the message content has been verified.
1716 When sending signed messages,
1717 it is recommended to repeat any important header information in the
1718 message text.
1719 .\" }}}
1721 .\" .Ss "On URL syntax and credential lookup" {{{
1722 .Ss "On URL syntax and credential lookup"
1724 \*(IN For accessing protocol-specific resources usage of Uniform
1725 Resource Locators (URL, RFC 1738) has become omnipresent.
1726 \*(UA expects and understands URLs in the following form;
1727 parts in brackets
1728 .Ql []
1729 denote optional parts, optional either because there also exist other
1730 ways to define the information in question or because support of the
1731 part is protocol-specific, e.g.,
1732 .Ql /path
1733 is used by the local maildir and the IMAP protocol, but not by POP3;
1734 If any of
1735 .Ql USER
1737 .Ql PASSWORD
1738 are specified they must be given in URL percent encoded form (RFC 3986;
1739 the command
1740 .Ic urlcodec
1741 may be helpful):
1744 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1747 Note that these \*(UA URLs most often do not conform to any real
1748 standard, but instead represent a normalized variant of RFC 1738 \(en
1749 they are not used in data exchange but only meant as a compact,
1750 easy-to-use way of defining and representing information in
1751 a well-known notation.
1754 Many internal variables of \*(UA exist in multiple versions, called
1755 variable chains for the rest of this document: the plain
1756 .Ql variable
1757 as well as
1758 .Ql variable-HOST
1760 .Ql variable-USER@HOST .
1761 Here
1762 .Ql HOST
1763 indeed means
1764 .Ql server:port
1765 if a
1766 .Ql port
1767 had been specified in the respective URL, otherwise it refers to the plain
1768 .Ql server .
1769 Also,
1770 .Ql USER
1771 is not truly the
1772 .Ql USER
1773 that had been found when doing the user chain lookup as is described
1774 below, i.e., this
1775 .Ql USER
1776 will never be in URL percent encoded form, whether it came from an URL
1777 or not; i.e., variable chain name extensions of
1778 .Sx "INTERNAL VARIABLES"
1779 must not be URL percent encoded.
1782 For example, whether an hypothetical URL
1783 .Ql smtp://hey%3Ayou@our.house
1784 had been given that includes a user, or whether the URL was
1785 .Ql smtp://our.house
1786 and the user had been found differently, to lookup the variable chain
1787 .Va smtp-use-starttls
1788 \*(UA first looks for whether
1789 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
1790 is defined, then whether
1791 .Ql smtp-\:use-\:starttls-\:our.house
1792 exists before finally ending up looking at the plain variable itself.
1795 \*(UA obeys the following logic scheme when dealing with the
1796 necessary credential information of an account:
1798 .Bl -bullet
1800 If no
1801 .Ql USER
1802 has been given in the URL the variables
1803 .Va user-HOST
1805 .Va user
1806 are looked up.
1807 If no such variable(s) can be found then \*(UA will,
1808 when enforced by the \*(OPal variables
1809 .Va netrc-lookup-HOST
1811 .Va netrc-lookup ,
1812 search
1813 .Sx "The .netrc file"
1814 of the user for a
1815 .Ql HOST
1816 specific entry which provides a
1817 .Ql login
1818 name: this lookup will only succeed if unambiguous (one possible matching
1819 entry for
1820 .Ql HOST ) .
1822 If there is still no
1823 .Ql USER
1824 then \*(UA will fall back to the user who is supposed to run \*(UA,
1825 the identity of which has been fixated during \*(UA startup and is
1826 known to be a valid user on the current host.
1829 Authentication: unless otherwise noted this will lookup the
1830 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1831 variable chain, falling back to a protocol-specific default should this
1832 have no success.
1835 If no
1836 .Ql PASSWORD
1837 has been given in the URL, then if the
1838 .Ql USER
1839 has been found through the \*(OPal
1840 .Va netrc-lookup
1841 that may have already provided the password, too.
1842 Otherwise the variable chain
1843 .Va password-USER@HOST , password-HOST , password
1844 is looked up and used if existent.
1846 Afterwards the complete \*(OPal variable chain
1847 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1848 is looked up.
1849 If set, the
1850 .Ic netrc
1851 cache is searched for a password only (multiple user accounts for
1852 a single machine may exist as well as a fallback entry without user
1853 but with a password).
1855 If at that point there is still no password available, but the
1856 (protocols') chosen authentication type requires a password, then in
1857 interactive mode the user will be prompted on the terminal.
1861 .Sy Note:
1862 S/MIME verification works relative to the values found in the
1863 .Ql From:
1865 .Ql Sender: )
1866 header field(s), which means that the values of
1867 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1869 .Va smime-sign-message-digest
1870 will not be looked up using the
1871 .Ql USER
1873 .Ql HOST
1874 chains from above but instead use the corresponding values from the
1875 message that is being worked on.
1876 In unusual cases multiple and different
1877 .Ql USER
1879 .Ql HOST
1880 combinations may therefore be involved \(en on the other hand those
1881 unusual cases become possible.
1882 The usual case is as short as:
1884 .Bd -literal -offset indent
1885 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1886     smime-sign smime-sign-cert=+smime.pair
1890 The section
1891 .Sx EXAMPLES
1892 contains complete example configurations.
1893 .\" }}}
1895 .\" .Ss "Encrypted network communication" {{{
1896 .Ss "Encrypted network communication"
1898 SSL (Secure Sockets Layer) a.k.a. its successor TLS (Transport Layer
1899 Security) are protocols which aid in securing communication by providing
1900 a safely initiated and encrypted network connection.
1901 A central concept of SSL/TLS is that of certificates: as part of each
1902 network connection setup a (set of) certificates will be exchanged, and
1903 by using those the identity of the network peer can be cryptographically
1904 verified.
1905 SSL/TLS works by using a locally installed pool of trusted certificates,
1906 and verifying the connection peer succeeds if that provides
1907 a certificate which has been issued or is trusted by any certificate in
1908 the trusted local pool.
1911 The local pool of trusted so-called CA (Certification Authority)
1912 certificates is usually delivered with the used SSL/TLS library, and
1913 will be selected automatically.
1914 It is also possible to use a specific pool of trusted certificates.
1915 If this is desired,
1916 .Va ssl-ca-no-defaults
1917 should be set to avoid using the default certificate pool, and
1918 .Va ssl-ca-file
1919 and/or
1920 .Va ssl-ca-dir
1921 should be pointed to a trusted pool of certificates.
1922 A certificate cannot be more secure than the method its CA certificate
1923 has been retrieved with.
1926 It depends on the used protocol whether encrypted communication is
1927 possible, and which configuration steps have to be taken to enable it.
1928 Some protocols, e.g., POP3S, are implicitly encrypted, others, like
1929 POP3, can upgrade a plain text connection if so requested.
1930 For example, to use the
1931 .Ql STLS
1932 that POP3 offers (a member of) the variable (chain)
1933 .Va pop3-use-starttls
1934 needs to be set:
1936 .Bd -literal -offset indent
1937 shortcut encpop1 pop3s://pop1.exam.ple
1939 shortcut encpop2 pop3://pop2.exam.ple
1940 set pop3-use-starttls-pop2.exam.ple
1942 set mta=smtps://smtp.exam.ple:465
1943 set mta=smtp://smtp.exam.ple smtp-use-starttls
1947 Normally that is all there is to do, given that SSL/TLS libraries try to
1948 provide safe defaults, plenty of knobs however exist to adjust settings.
1949 For example certificate verification settings can be fine-tuned via
1950 .Va ssl-ca-flags ,
1951 and the SSL/TLS configuration basics are accessible via
1952 .Va ssl-config-pairs ,
1953 for example to specify the allowed protocols or cipher lists that
1954 a communication channel may use.
1955 In the past hints on how to restrict the set of protocols to highly
1956 secure ones were indicated, but as of the time of this writing the list
1957 of protocols or ciphers may need to become relaxed in order to be able
1958 to connect to some servers; the following example allows connecting to a
1959 .Dq Lion
1960 that uses OpenSSL 0.9.8za from June 2014 (refer to
1961 .Sx "INTERNAL VARIABLES"
1962 for more on variable chains):
1964 .Bd -literal -offset indent
1965 wysh set ssl-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e
1966     CipherString=TLSv1.2:!aNULL:!eNULL:\e
1967       ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
1968       DHE-RSA-AES256-SHA:@STRENGTH'
1972 The OpenSSL program
1973 .Xr ciphers 1
1974 can be used and should be referred to when creating a custom cipher list.
1975 Variables of interest for SSL/TLS in general are
1976 .Va ssl-ca-dir ,
1977 .Va ssl-ca-file ,
1978 .Va ssl-ca-flags ,
1979 .Va ssl-ca-no-defaults ,
1980 .Va ssl-config-file ,
1981 .Va ssl-config-module ,
1982 .Va ssl-config-pairs ,
1983 .Va ssl-crl-dir ,
1984 .Va ssl-crl-file ,
1985 .Va ssl-rand-file
1986 as well as
1987 .Va ssl-verify .
1988 .\" }}}
1990 .\" .Ss "Character sets" {{{
1991 .Ss "Character sets"
1993 \*(OP \*(UA detects the character set of the terminal by using
1994 mechanisms that are controlled by the
1995 .Ev LC_CTYPE
1996 environment variable
1997 (in fact
1998 .Ev LC_ALL ,
1999 .Ev \&\&LC_CTYPE ,
2000 .Ev LANG ,
2001 in that order, see there).
2002 The internal variable
2003 .Va ttycharset
2004 will be set to the detected terminal character set accordingly,
2005 and will thus show up in the output of commands like, e.g.,
2006 .Ic set
2008 .Ic varshow .
2011 However, the user may give
2012 .Va ttycharset
2013 a value during startup, making it possible to send mail in a completely
2014 .Dq faked
2015 locale environment, an option which can be used to generate and send,
2016 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
2017 .Ql LC_ALL=C
2018 environment (an example of this can be found in the section
2019 .Sx "On sending mail, and non-interactive mode" ) .
2020 Changing the value does not mean much beside that, because several
2021 aspects of the real character set are implied by the locale environment
2022 of the system, which stays unaffected by
2023 .Va ttycharset .
2026 Messages and attachments which consist of 7-bit clean data will be
2027 classified as consisting of
2028 .Va charset-7bit
2029 character data.
2030 This is a problem if the
2031 .Va ttycharset
2032 character set is a multibyte character set that is also 7-bit clean.
2033 For example, the Japanese character set ISO-2022-JP is 7-bit clean but
2034 capable to encode the rich set of Japanese Kanji, Hiragana and Katakana
2035 characters: in order to notify receivers of this character set the mail
2036 message must be MIME encoded so that the character set ISO-2022-JP can
2037 be advertised!
2038 To achieve this, the variable
2039 .Va charset-7bit
2040 must be set to ISO-2022-JP.
2041 (Today a better approach regarding email is the usage of UTF-8, which
2042 uses 8-bit bytes for non-US-ASCII data.)
2045 If the \*(OPal character set conversion capabilities are not available
2046 .Pf ( Va features
2047 does not include the term
2048 .Ql +iconv ) ,
2049 then
2050 .Va ttycharset
2051 will be the only supported character set,
2052 it is simply assumed that it can be used to exchange 8-bit messages
2053 (over the wire an intermediate, configurable
2054 .Va mime-encoding
2055 may be applied),
2056 and the rest of this section does not apply;
2057 it may however still be necessary to explicitly set it if automatic
2058 detection fails, since in that case it defaults to
2059 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
2060 LATIN1 a.k.a. ISO-8859-1 unless the operating system environment is
2061 known to always and exclusively support UTF-8 locales.
2064 \*(OP When reading messages, their text is converted into
2065 .Va ttycharset
2066 as necessary in order to display them on the user's terminal.
2067 Unprintable characters and invalid byte sequences are detected
2068 and replaced by proper substitution characters.
2069 Character set mappings for source character sets can be established with
2070 the command
2071 .Ic charsetalias ,
2072 which may be handy to work around faulty character set catalogues (e.g.,
2073 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
2074 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
2075 Also see
2076 .Va charset-unknown-8bit
2077 to deal with another hairy aspect of message interpretation.
2080 When sending messages their parts and attachments are classified.
2081 Whereas no character set conversion is performed on those parts which
2082 appear to be binary data,
2083 the character set being used must be declared within the MIME header of
2084 an outgoing text part if it contains characters that do not conform to
2085 the set of characters that are allowed by the email standards.
2086 Permissible values for character sets used in outgoing messages can be
2087 declared using the
2088 .Va sendcharsets
2089 variable, and
2090 .Va charset-8bit ,
2091 which defines a catch-all last-resort fallback character set that is
2092 implicitly appended to the list of character sets in
2093 .Va sendcharsets .
2096 When replying to a message and the variable
2097 .Va reply-in-same-charset
2098 is set, then the character set of the message being replied to
2099 is tried first (still being a subject of
2100 .Ic charsetalias ) .
2101 And it is also possible to make \*(UA work even more closely related to
2102 the current locale setting automatically by using the variable
2103 .Va sendcharsets-else-ttycharset ,
2104 please see there for more information.
2107 All the specified character sets are tried in order unless the
2108 conversion of the part or attachment succeeds.
2109 If none of the tried (8-bit) character sets is capable to represent the
2110 content of the part or attachment,
2111 then the message will not be send and its text will optionally be
2112 .Va save Ns d
2114 .Ev DEAD .
2115 In general, if a message saying
2116 .Dq cannot convert from a to b
2117 appears, either some characters are not appropriate for the currently
2118 selected (terminal) character set,
2119 or the needed conversion is not supported by the system.
2120 In the first case, it is necessary to set an appropriate
2121 .Ev LC_CTYPE
2122 locale and/or the variable
2123 .Va ttycharset .
2126 The best results are usually achieved when \*(UA is run in a UTF-8
2127 locale on an UTF-8 capable terminal, in which case the full Unicode
2128 spectrum of characters is available.
2129 In this setup characters from various countries can be displayed,
2130 while it is still possible to use more simple character sets for sending
2131 to retain maximum compatibility with older mail clients.
2134 On the other hand the POSIX standard defines a locale-independent 7-bit
2135 .Dq portable character set
2136 that should be used when overall portability is an issue, the even more
2137 restricted subset named
2138 .Dq portable filename character set
2139 consists of A-Z, a-z, 0-9, period
2140 .Ql \&. ,
2141 underscore
2142 .Ql _
2143 and hyphen-minus
2144 .Ql - .
2145 .\" }}}
2147 .\" .Ss "Message states" {{{
2148 .Ss "Message states"
2150 \*(UA differentiates in between several message states; the current
2151 state will be reflected in the summary of
2152 .Ic headers
2153 if the
2154 .Va attrlist
2155 of the configured
2156 .Va headline
2157 allows, and
2158 .Sx "Specifying messages"
2159 dependent on their state is possible.
2160 When operating on the system
2161 .Va inbox ,
2162 or in any other
2163 .Mx -sx
2164 .Sx "primary system mailbox" ,
2165 special actions, like the automatic moving of messages to the
2166 .Mx -sx
2167 .Sx "secondary mailbox"
2168 .Ev MBOX ,
2169 may be applied when the mailbox is left (also implicitly by program
2170 termination, unless the command
2171 .Ic exit
2172 was used) \(en however, because this may be irritating to users which
2173 are used to
2174 .Dq more modern
2175 mail-user-agents, the provided global
2176 .Pa \*(UR
2177 template sets the internal
2178 .Va hold
2180 .Va keepsave
2181 variables in order to suppress this behaviour.
2183 .Bl -hang -width ".It Ql new"
2184 .It Ql new
2185 Message has neither been viewed nor moved to any other state.
2186 Such messages are retained even in the
2187 .Mx -sx
2188 .Sx "primary system mailbox" .
2190 .It Ql unread
2191 Message has neither been viewed nor moved to any other state, but the
2192 message was present already when the mailbox has been opened last:
2193 Such messages are retained even in the
2194 .Mx -sx
2195 .Sx "primary system mailbox" .
2197 .It Ql read
2198 The message has been processed by one of the following commands:
2199 .Ic ~f ,
2200 .Ic ~m ,
2201 .Ic ~F ,
2202 .Ic ~M ,
2203 .Ic copy ,
2204 .Ic mbox ,
2205 .Ic next ,
2206 .Ic pipe  ,
2207 .Ic Print ,
2208 .Ic print ,
2209 .Ic top ,
2210 .Ic Type ,
2211 .Ic type ,
2212 .Ic undelete .
2213 The commands
2214 .Ic dp
2216 .Ic dt
2217 will always try to automatically
2218 .Dq step
2220 .Ic type
2222 .Dq next
2223 logical message, and may thus mark multiple messages as read, the
2224 .Ic delete
2225 command will do so if the internal variable
2226 .Va autoprint
2227 is set.
2229 Except when the
2230 .Ic exit
2231 command is used, messages that are in a
2232 .Mx -sx
2233 .Sx "primary system mailbox"
2234 and are in
2235 .Ql read
2236 state when the mailbox is left will be saved in the
2237 .Mx -sx
2238 .Sx "secondary mailbox"
2239 .Ev MBOX
2240 unless the internal variable
2241 .Va hold
2242 it set.
2244 .It Ql deleted
2245 The message has been processed by one of the following commands:
2246 .Ic delete ,
2247 .Ic dp ,
2248 .Ic dt .
2249 Only
2250 .Ic undelete
2251 can be used to access such messages.
2253 .It Ql preserved
2254 The message has been processed by a
2255 .Ic preserve
2256 command and it will be retained in its current location.
2258 .It Ql saved
2259 The message has been processed by one of the following commands:
2260 .Ic save
2262 .Ic write .
2263 Unless when the
2264 .Ic exit
2265 command is used, messages that are in a
2266 .Mx -sx
2267 .Sx "primary system mailbox"
2268 and are in
2269 .Ql saved
2270 state when the mailbox is left will be deleted; they will be saved in the
2271 .Mx -sx
2272 .Sx "secondary mailbox"
2273 .Ev MBOX
2274 when the internal variable
2275 .Va keepsave
2276 is set.
2280 In addition to these message states, flags which otherwise have no
2281 technical meaning in the mail system except allowing special ways of
2282 addressing them when
2283 .Sx "Specifying messages"
2284 can be set on messages.
2285 These flags are saved with messages and are thus persistent, and are
2286 portable between a set of widely used MUAs.
2288 .Bl -hang -width ".It Ic answered"
2289 .It Ic answered
2290 Mark messages as having been answered.
2291 .It Ic draft
2292 Mark messages as being a draft.
2293 .It Ic flag
2294 Mark messages which need special attention.
2296 .\" }}}
2298 .\" .Ss "Specifying messages" {{{
2299 .Ss "Specifying messages"
2301 Commands which take
2302 .Sx "Message list arguments" ,
2303 such as
2304 .Ic from
2305 a.k.a.\&
2306 .Ic search ,
2307 .Ic type
2309 .Ic delete ,
2310 can be given a list of message numbers as arguments to apply to a number
2311 of messages at once.
2312 Thus
2313 .Ql delete 1 2
2314 deletes messages 1 and 2,
2315 whereas
2316 .Ql delete 1-5
2317 will delete the messages 1 through 5.
2318 In sorted or threaded mode (see the
2319 .Ic sort
2320 command),
2321 .Ql delete 1-5
2322 will delete the messages that are located between (and including)
2323 messages 1 through 5 in the sorted/threaded order, as shown in the
2324 .Ic headers
2325 summary.
2326 The following special message names exist:
2329 .Bl -tag -width ".It Ar BaNg"
2330 .It Ar \&.
2331 The current message, the so-called
2332 .Dq dot .
2334 .It Ar \&;
2335 The message that was previously the current message.
2337 .It Ar \&,
2338 The parent message of the current message,
2339 that is the message with the Message-ID given in the
2340 .Ql In-Reply-To:
2341 field or the last entry of the
2342 .Ql References:
2343 field of the current message.
2345 .It Ar -
2346 The previous undeleted message, or the previous deleted message for the
2347 .Ic undelete
2348 command; In
2349 .Ic sort Ns
2350 ed or
2351 .Ql thread Ns
2352 ed mode, the previous such message in the according order.
2354 .It Ar +
2355 The next undeleted message, or the next deleted message for the
2356 .Ic undelete
2357 command; In
2358 .Ic sort Ns
2359 ed or
2360 .Ql thread Ns
2361 ed mode, the next such message in the according order.
2363 .It Ar ^
2364 The first undeleted message,
2365 or the first deleted message for the
2366 .Ic undelete
2367 command; In
2368 .Ic sort Ns
2369 ed or
2370 .Ql thread Ns
2371 ed mode, the first such message in the according order.
2373 .It Ar $
2374 The last message; In
2375 .Ic sort Ns
2376 ed or
2377 .Ql thread Ns
2378 ed mode, the last such message in the according order.
2380 .It Ar & Ns Ar x
2382 .Ql thread Ns
2384 .Ic sort
2385 mode, selects the message addressed with
2386 .Ar x ,
2387 where
2388 .Ar x
2389 is any other message specification,
2390 and all messages from the thread that begins at it.
2391 Otherwise it is identical to
2392 .Ar x .
2394 .Ar x
2395 is omitted,
2396 the thread beginning with the current message is selected.
2398 .It Ar *
2399 All messages.
2400 .It Ar `
2401 All messages that were included in the
2402 .Sx "Message list arguments"
2403 of the previous command.
2405 .It Ar x-y
2406 An inclusive range of message numbers.
2407 Selectors that may also be used as endpoints include any of
2408 .Ar .;-+^$ .
2410 .It Ar address
2411 A case-insensitive
2412 .Dq any substring matches
2413 search against the
2414 .Ql From:
2415 header, which will match addresses (too) even if
2416 .Va showname
2417 is set (and POSIX says
2418 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2419 However, if the
2420 .Va allnet
2421 variable is set, only the local part of the address is evaluated
2422 for the comparison, not ignoring case, and the setting of
2423 .Va showname
2424 is completely ignored.
2425 For finer control and match boundaries use the
2426 .Ql @
2427 search expression.
2429 .It Ar / Ns Ar string
2430 All messages that contain
2431 .Ar string
2432 in the subject field (case ignored according to locale).
2433 See also the
2434 .Va searchheaders
2435 variable.
2437 .Ar string
2438 is empty,
2439 the string from the previous specification of that type is used again.
2442 .It Xo Op Ar @ Ns Ar name-list Ns
2443 .Ar @ Ns Ar expr
2445 All messages that contain the given case-insensitive search
2446 .Ar expr Ns
2447 ession;  If the \*(OPal regular expression support is available
2448 .Ar expr
2449 will be interpreted as (an extended) one if any of the
2450 .Dq magical
2451 regular expression characters
2452 .Ql ^[]*+?|$
2453 is seen (see
2454 .Xr re_format 7 ) .
2455 If the optional
2456 .Ar @ Ns Ar name-list
2457 part is missing the search is restricted to the subject field body,
2458 but otherwise
2459 .Ar name-list
2460 specifies a comma-separated list of header fields to search, e.g.,
2463 .Dl '@to,from,cc@Someone i ought to know'
2466 In order to search for a string that includes a
2467 .Ql @
2468 (commercial at) character the
2469 .Ar name-list
2470 is effectively non-optional, but may be given as the empty string.
2471 Also, specifying an empty search
2472 .Ar expr Ns
2473 ession will effectively test for existence of the given header fields.
2474 Some special header fields may be abbreviated:
2475 .Ql f ,
2476 .Ql t ,
2477 .Ql c ,
2478 .Ql b
2480 .Ql s
2481 will match
2482 .Ql From ,
2483 .Ql To ,
2484 .Ql Cc ,
2485 .Ql Bcc
2487 .Ql Subject ,
2488 respectively and case-insensitively.
2489 \*(OPally, and just like
2490 .Ar expr ,
2491 .Ar name-list
2492 will be interpreted as (an extended) regular expression if any of the
2493 .Dq magical
2494 regular expression characters is seen.
2497 The special names
2498 .Ql header
2500 .Ql <
2501 can be used to search in (all of) the header(s) of the message, and the
2502 special names
2503 .Ql body
2505 .Ql >
2507 .Ql text
2509 .Ql =
2510 will perform full text searches \(en whereas the former searches only
2511 the body, the latter also searches the message header (\*(ID this mode
2512 yet brute force searches over the entire decoded content of messages,
2513 including administrativa strings).
2516 This specification performs full text comparison, but even with
2517 regular expression support it is almost impossible to write a search
2518 expression that safely matches only a specific address domain.
2519 To request that the body content of the header is treated as a list of
2520 addresses, and to strip those down to the plain email address which the
2521 search expression is to be matched against, prefix the effective
2522 .Ar name-list
2523 with a tilde
2524 .Ql ~ :
2527 .Dl @~f@@a\e.safe\e.domain\e.match$
2530 .It Ar :c
2531 All messages of state or with matching condition
2532 .Ql c ,
2533 where
2534 .Ql c
2535 is one or multiple of the following colon modifiers:
2537 .Bl -tag -compact -width ".It Ar :M"
2538 .It Ar a
2539 .Ic answered
2540 messages (cf. the variable
2541 .Va markanswered ) .
2542 .It Ar d
2543 .Ql deleted
2544 messages (for the
2545 .Ic undelete
2547 .Ic from
2548 commands only).
2549 .It Ar f
2550 .Ic flag Ns
2551 ged messages.
2552 .It Ar L
2553 Messages with receivers that match
2554 .Ic mlsubscribe Ns
2555 d addresses.
2556 .It Ar l
2557 Messages with receivers that match
2558 .Ic mlist Ns
2559 ed addresses.
2560 .It Ar n
2561 .Ql new
2562 messages.
2563 .It Ar o
2564 Old messages (any not in state
2565 .Ql read
2567 .Ql new ) .
2568 .It Ar r
2569 .Ql read
2570 messages.
2571 .It Ar S
2572 \*(OP Messages with unsure spam classification (see
2573 .Sx "Handling spam" ) .
2574 .It Ar s
2575 \*(OP Messages classified as spam.
2576 .It Ar t
2577 Messages marked as
2578 .Ic draft .
2579 .It Ar u
2580 .Ql unread
2581 messages.
2587 \*(OP IMAP-style SEARCH expressions may also be used.
2588 This addressing mode is available with all types of mailbox
2589 .Ic folder Ns
2590 s; \*(UA will perform the search locally as necessary.
2591 Strings must be enclosed by double quotes
2592 .Ql \&"
2593 in their entirety if they contain whitespace or parentheses;
2594 within the quotes, only reverse solidus
2595 .Ql \e
2596 is recognized as an escape character.
2597 All string searches are case-insensitive.
2598 When the description indicates that the
2599 .Dq envelope
2600 representation of an address field is used,
2601 this means that the search string is checked against both a list
2602 constructed as
2604 .Bd -literal -offset indent
2605 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2609 for each address,
2610 and the addresses without real names from the respective header field.
2611 These search expressions can be nested using parentheses, see below for
2612 examples.
2615 .Bl -tag -compact -width ".It Ar _n_u"
2616 .It Ar ( criterion )
2617 All messages that satisfy the given
2618 .Ar criterion .
2619 .It Ar ( criterion1 criterion2 ... criterionN )
2620 All messages that satisfy all of the given criteria.
2622 .It Ar ( or criterion1 criterion2 )
2623 All messages that satisfy either
2624 .Ar criterion1
2626 .Ar criterion2 ,
2627 or both.
2628 To connect more than two criteria using
2629 .Ql or
2630 specifications have to be nested using additional parentheses,
2631 as with
2632 .Ql (or a (or b c)) ,
2633 since
2634 .Ql (or a b c)
2635 really means
2636 .Ql ((a or b) and c) .
2637 For a simple
2638 .Ql or
2639 operation of independent criteria on the lowest nesting level,
2640 it is possible to achieve similar effects by using three separate
2641 criteria, as with
2642 .Ql (a) (b) (c) .
2644 .It Ar ( not criterion )
2645 All messages that do not satisfy
2646 .Ar criterion .
2647 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2648 All messages that contain
2649 .Ar string
2650 in the envelope representation of the
2651 .Ql Bcc:
2652 field.
2653 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2654 All messages that contain
2655 .Ar string
2656 in the envelope representation of the
2657 .Ql Cc:
2658 field.
2659 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2660 All messages that contain
2661 .Ar string
2662 in the envelope representation of the
2663 .Ql From:
2664 field.
2665 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2666 All messages that contain
2667 .Ar string
2668 in the
2669 .Ql Subject:
2670 field.
2671 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2672 All messages that contain
2673 .Ar string
2674 in the envelope representation of the
2675 .Ql To:
2676 field.
2677 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2678 All messages that contain
2679 .Ar string
2680 in the specified
2681 .Ql Name:
2682 field.
2683 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2684 All messages that contain
2685 .Ar string
2686 in their body.
2687 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2688 All messages that contain
2689 .Ar string
2690 in their header or body.
2691 .It Ar ( larger size )
2692 All messages that are larger than
2693 .Ar size
2694 (in bytes).
2695 .It Ar ( smaller size )
2696 All messages that are smaller than
2697 .Ar size
2698 (in bytes).
2700 .It Ar ( before date )
2701 All messages that were received before
2702 .Ar date ,
2703 which must be in the form
2704 .Ql d[d]-mon-yyyy ,
2705 where
2706 .Ql d
2707 denotes the day of the month as one or two digits,
2708 .Ql mon
2709 is the name of the month \(en one of
2710 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2712 .Ql yyyy
2713 is the year as four digits, e.g.,
2714 .Ql 28-Dec-2012 .
2716 .It Ar ( on date )
2717 All messages that were received on the specified date.
2718 .It Ar ( since date )
2719 All messages that were received since the specified date.
2720 .It Ar ( sentbefore date )
2721 All messages that were sent on the specified date.
2722 .It Ar ( senton date )
2723 All messages that were sent on the specified date.
2724 .It Ar ( sentsince date )
2725 All messages that were sent since the specified date.
2726 .It Ar ()
2727 The same criterion as for the previous search.
2728 This specification cannot be used as part of another criterion.
2729 If the previous command line contained more than one independent
2730 criterion then the last of those criteria is used.
2732 .\" }}}
2734 .\" .Ss "On terminal control and line editor" {{{
2735 .Ss "On terminal control and line editor"
2737 \*(OP Terminal control will be realized through one of the standard
2739 libraries, either the
2740 .Lb libtermcap ,
2741 or, alternatively, the
2742 .Lb libterminfo ,
2743 both of which will be initialized to work with the environment variable
2744 .Ev TERM .
2745 Terminal control will enhance or enable interactive usage aspects, e.g.,
2746 .Sx "Coloured display" ,
2747 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2748 byte-sequences of keys like the cursor- and function-keys.
2751 The internal variable
2752 .Va termcap
2753 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2754 Actual library interaction can be disabled completely by setting
2755 .Va termcap-disable ;
2756 .Va termcap
2757 will be queried regardless, which is true even if the \*(OPal library
2758 support has not been enabled at configuration time as long as some other
2759 \*(OP which (may) query terminal control sequences has been enabled.
2760 \*(UA can be told to enter an alternative exclusive screen, the
2761 so-called ca-mode, by setting
2762 .Va termcap-ca-mode ;
2763 this requires sufficient terminal support, and the used
2764 .Ev PAGER
2765 may also need special configuration, dependent on the value of
2766 .Va crt .
2769 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2770 environments which comply to the ISO C standard
2771 .St -isoC-amd1 ,
2772 and will support wide glyphs if possible (the necessary functionality
2773 had been removed from ISO C, but was included in
2774 .St -xpg4 ) .
2775 Usage of a line editor in interactive mode can be prevented by setting
2776 .Va line-editor-disable .
2777 Especially if the \*(OPal terminal control support is missing setting
2778 entries in the internal variable
2779 .Va termcap
2780 will help shall the MLE misbehave, see there for more.
2781 The MLE can support a little bit of
2782 .Ic colour .
2785 \*(OP If the
2786 .Ic history
2787 feature is available then input from line editor prompts will be saved
2788 in a history list that can be searched in and be expanded from.
2789 Such saving can be prevented by prefixing input with any amount of
2790 whitespace.
2791 Aspects of history, like allowed content and maximum size, as well as
2792 whether history shall be saved persistently, can be configured with the
2793 internal variables
2794 .Va history-file ,
2795 .Va history-gabby ,
2796 .Va history-gabby-persist
2798 .Va history-size .
2801 The MLE supports a set of editing and control commands.
2802 By default (as) many (as possible) of these will be assigned to a set of
2803 single-letter control codes, which should work on any terminal (and can
2804 be generated by holding the
2805 .Dq control
2806 key while pressing the key of desire, e.g.,
2807 .Ql control-D ) .
2808 If the \*(OPal
2809 .Ic bind
2810 command is available then the MLE commands can also be accessed freely
2811 by assigning the command name, which is shown in parenthesis in the list
2812 below, to any desired key-sequence, and the MLE will instead and also use
2813 .Ic bind
2814 to establish its built-in key bindings
2815 (more of them if the \*(OPal terminal control is available),
2816 an action which can then be suppressed completely by setting
2817 .Va line-editor-no-defaults .
2818 .Sx "Shell-style argument quoting"
2819 notation is used in the following;
2820 combinations not mentioned either cause job control signals or do not
2821 generate a (unique) keycode:
2825 .Bl -tag -compact -width ".It Ql \eBa"
2826 .It Ql \ecA
2827 Go to the start of the line
2829 .Pf ( Cd mle-go-home ) .
2831 .It Ql \ecB
2832 Move the cursor backward one character
2834 .Pf ( Cd mle-go-bwd ) .
2836 .It Ql \ecD
2837 Forward delete the character under the cursor;
2838 quits \*(UA if used on the empty line unless the internal variable
2839 .Va ignoreeof
2840 is set
2842 .Pf ( Cd mle-del-fwd ) .
2844 .It Ql \ecE
2845 Go to the end of the line
2847 .Pf ( Cd mle-go-end ) .
2849 .It Ql \ecF
2850 Move the cursor forward one character
2852 .Pf ( Cd mle-go-fwd ) .
2854 .It Ql \ecG
2855 Cancel current operation, full reset.
2856 If there is an active history search or tabulator expansion then this
2857 command will first reset that, reverting to the former line content;
2858 thus a second reset is needed for a full reset in this case
2860 .Pf ( Cd mle-reset ) .
2862 .It Ql \ecH
2863 Backspace: backward delete one character
2865 .Pf ( Cd mle-del-bwd ) .
2867 .It Ql \ecI
2868 \*(NQ
2869 Horizontal tabulator:
2870 try to expand the word before the cursor, supporting the usual
2871 .Sx "Filename transformations"
2873 .Pf ( Cd mle-complete ;
2874 this is affected by
2875 .Cd mle-quote-rndtrip ) .
2877 .It Ql \ecJ
2878 Newline:
2879 commit the current line
2881 .Pf ( Cd mle-commit ) .
2883 .It Ql \ecK
2884 Cut all characters from the cursor to the end of the line
2886 .Pf ( Cd mle-snarf-end ) .
2888 .It Ql \ecL
2889 Repaint the line
2891 .Pf ( Cd mle-repaint ) .
2893 .It Ql \ecN
2894 \*(OP Go to the next history entry
2896 .Pf ( Cd mle-hist-fwd ) .
2898 .It Ql \ecO
2899 (\*(OPally context-dependent) Invokes the command
2900 .Ic dt .
2902 .It Ql \ecP
2903 \*(OP Go to the previous history entry
2905 .Pf ( Cd mle-hist-bwd ) .
2907 .It Ql \ecQ
2908 Toggle roundtrip mode shell quotes, where produced,
2909 on and off
2911 .Pf ( Cd mle-quote-rndtrip ) .
2912 This setting is temporary, and will be forgotten once the command line
2913 is committed; also see
2914 .Ic shcodec .
2916 .It Ql \ecR
2917 \*(OP Complete the current line from (the remaining) older history entries
2919 .Pf ( Cd mle-hist-srch-bwd ) .
2921 .It Ql \ecS
2922 \*(OP Complete the current line from (the remaining) newer history entries
2924 .Pf ( Cd mle-hist-srch-fwd ) .
2926 .It Ql \ecT
2927 Paste the snarf buffer
2929 .Pf ( Cd mle-paste ) .
2931 .It Ql \ecU
2932 The same as
2933 .Ql \ecA
2934 followed by
2935 .Ql \ecK
2937 .Pf ( Cd mle-snarf-line ) .
2939 .It Ql \ecV
2940 Prompts for a Unicode character (hexadecimal number without prefix, see
2941 .Ic vexpr )
2942 to be inserted
2944 .Pf ( Cd mle-prompt-char ) .
2945 Note this command needs to be assigned to a single-letter control code
2946 in order to become recognized and executed during input of
2947 a key-sequence (only three single-letter control codes can be used for
2948 that shortcut purpose); this control code is then special-treated and
2949 thus cannot be part of any other sequence (because it will trigger the
2950 .Cd mle-prompt-char
2951 function immediately).
2953 .It Ql \ecW
2954 Cut the characters from the one preceding the cursor to the preceding
2955 word boundary
2957 .Pf ( Cd mle-snarf-word-bwd ) .
2959 .It Ql \ecX
2960 Move the cursor forward one word boundary
2962 .Pf ( Cd mle-go-word-fwd ) .
2964 .It Ql \ecY
2965 Move the cursor backward one word boundary
2967 .Pf ( Cd mle-go-word-bwd ) .
2969 .It Ql \ec[
2970 Escape: reset a possibly used multibyte character input state machine
2971 and \*(OPally a lingering, incomplete key binding
2973 .Pf ( Cd mle-cancel ) .
2974 This command needs to be assigned to a single-letter control code in
2975 order to become recognized and executed during input of a key-sequence
2976 (only three single-letter control codes can be used for that shortcut
2977 purpose).
2978 This control code may also be part of a multi-byte sequence, but if
2979 a sequence is active and the very control code is currently also an
2980 expected input, then the active sequence takes precedence and will
2981 consume the control code.
2983 .It Ql \ec\e
2984 (\*(OPally context-dependent) Invokes the command
2985 .Ql Ic z Ns + .
2987 .It Ql \ec]
2988 (\*(OPally context-dependent) Invokes the command
2989 .Ql Ic z Ns $ .
2991 .It Ql \ec^
2992 (\*(OPally context-dependent) Invokes the command
2993 .Ql Ic z Ns 0 .
2995 .It Ql \ec_
2996 Cut the characters from the one after the cursor to the succeeding word
2997 boundary
2999 .Pf ( Cd mle-snarf-word-fwd ) .
3001 .It Ql \ec?
3002 Backspace:
3003 .Cd mle-del-bwd .
3005 .It \(en
3007 .Cd mle-fullreset :
3008 different to
3009 .Cd mle-reset
3010 this will immediately reset a possibly active search etc.
3012 .It \(en
3014 .Cd mle-bell :
3015 ring the audible bell.
3017 .\" }}}
3019 .\" .Ss "Coloured display" {{{
3020 .Ss "Coloured display"
3022 \*(OP \*(UA can be configured to support a coloured display and font
3023 attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic
3024 rendition) escape sequences.
3025 Usage of colours and font attributes solely depends upon the
3026 capability of the detected terminal type that is defined by the
3027 environment variable
3028 .Ev TERM
3029 and which can be fine-tuned by the user via the internal variable
3030 .Va termcap .
3033 On top of what \*(UA knows about the terminal the boolean variable
3034 .Va colour-pager
3035 defines whether the actually applicable colour and font attribute
3036 sequences should also be generated when output is going to be paged
3037 through the external program defined by the environment variable
3038 .Ev PAGER
3039 (also see
3040 .Va crt Ns
3042 This is not enabled by default because different pager programs need
3043 different command line switches or other configuration in order to
3044 support those sequences.
3045 \*(UA however knows about some widely used pagers and in a clean
3046 environment it is often enough to simply set
3047 .Va colour-pager ;
3048 please refer to that variable for more on this topic.
3051 Colours and font attributes can be managed with the multiplexer command
3052 .Ic colour ,
3054 .Ic uncolour
3055 can be used to remove mappings of a given colour type.
3056 If the variable
3057 .Va colour-disable
3058 is set then any active usage of colour and font attribute sequences
3059 is suppressed without affecting possibly established
3060 .Ic colour
3061 mappings.
3062 Since colours are only available in interactive mode, it may make
3063 sense to conditionalize the colour setup by encapsulating it with
3064 .Ic if :
3066 .Bd -literal -offset indent
3067 if terminal && [ "$features" =% +colour ]
3068   colour iso view-msginfo ft=bold,fg=green
3069   colour iso view-header ft=bold,fg=red from,subject
3070   colour iso view-header fg=red
3072   uncolour iso view-header from,subject
3073   colour iso view-header ft=bold,fg=magenta,bg=cyan
3074   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
3075   colour mono view-header ft=bold
3076   colour mono view-header ft=bold,ft=reverse subject,from
3077 endif
3079 .\" }}}
3081 .\" .Ss "Handling spam" {{{
3082 .Ss "Handling spam"
3084 \*(OP \*(UA can make use of several spam interfaces for the purpose of
3085 identification of, and, in general, dealing with spam messages.
3086 A precondition of most commands in order to function is that the
3087 .Va spam-interface
3088 variable is set to one of the supported interfaces.
3089 .Sx "Specifying messages"
3090 that have been identified as spam is possible via their (volatile)
3091 .Ql is-spam
3092 state by using the
3093 .Ql Ar :s
3095 .Ql Ar :S
3096 specifications, and their
3097 .Va attrlist
3098 entries will be used when displaying the
3099 .Va headline
3100 in the summary of
3101 .Ic headers .
3103 .Bl -bullet
3105 .Ic spamrate
3106 rates the given messages and sets their
3107 .Ql is-spam
3108 flag accordingly.
3109 If the spam interface offers spam scores these can be shown in
3110 .Va headline
3111 by using the format
3112 .Ql %$ .
3114 .Ic spamham ,
3115 .Ic spamspam
3117 .Ic spamforget
3118 will interact with the Bayesian filter of the chosen interface and learn
3119 the given messages as
3120 .Dq ham
3122 .Dq spam ,
3123 respectively; the last command can be used to cause
3124 .Dq unlearning
3125 of messages; it adheres to their current
3126 .Ql is-spam
3127 state and thus reverts previous teachings.
3129 .Ic spamclear
3131 .Ic spamset
3132 will simply set and clear, respectively, the mentioned volatile
3133 .Ql is-spam
3134 message flag, without any interface interaction.
3139 .Xr spamassassin 1
3140 based
3141 .Va spam-interface
3142 .Ql spamc
3143 requires a running instance of the
3144 .Xr spamd 1
3145 server in order to function, started with the option
3146 .Fl -allow-tell
3147 shall Bayesian filter learning be possible.
3149 .Bd -literal -offset indent
3150 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3151 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3152     --daemonize [--local] [--allow-tell]
3156 Thereafter \*(UA can make use of these interfaces:
3158 .Bd -literal -offset indent
3159 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3160     -Sspamc-command=/usr/local/bin/spamc \e
3161     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3163 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3164     -Sspamc-command=/usr/local/bin/spamc \e
3165     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3169 Using the generic filter approach allows usage of programs like
3170 .Xr bogofilter 1 .
3171 Here is an example, requiring it to be accessible via
3172 .Ev PATH :
3174 .Bd -literal -offset indent
3175 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3176     -Sspamfilter-ham="bogofilter -n" \e
3177     -Sspamfilter-noham="bogofilter -N" \e
3178     -Sspamfilter-nospam="bogofilter -S" \e
3179     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3180     -Sspamfilter-spam="bogofilter -s" \e
3181     -Sspamfilter-rate-scanscore="1;^(.+)$"
3185 Because messages must exist on local storage in order to be scored (or
3186 used for Bayesian filter training), it is possibly a good idea to
3187 perform the local spam check last.
3188 Spam can be checked automatically when opening specific folders by
3189 setting a specialized form of the internal variable
3190 .Va folder-hook .
3192 .Bd -literal -offset indent
3193 define spamdelhook {
3194   # Server side DCC
3195   spamset (header x-dcc-brand-metrics "bulk")
3196   # Server-side spamassassin(1)
3197   spamset (header x-spam-flag "YES")
3198   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3199   move :S +maybe-spam
3200   spamrate :u
3201   del :s
3202   move :S +maybe-spam
3204 set folder-hook-SOMEFOLDER=spamdelhook
3208 See also the documentation for the variables
3209 .Va spam-interface , spam-maxsize ,
3210 .Va spamc-command , spamc-arguments , spamc-user ,
3211 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3212   spamfilter-rate
3214 .Va spamfilter-rate-scanscore .
3215 .\" }}}
3217 .\" }}} (DESCRIPTION)
3220 .\" .Sh COMMANDS {{{
3221 .Sh COMMANDS
3223 \*(UA reads input in lines.
3224 An unquoted reverse solidus
3225 .Ql \e
3226 at the end of a command line
3227 .Dq escapes
3228 the newline character: it is discarded and the next line of input is
3229 used as a follow-up line, with all leading whitespace removed;
3230 once an entire line is completed, the whitespace characters
3231 .Cm space , tabulator , newline
3232 as well as those defined by the variable
3233 .Va ifs
3234 are removed from the beginning and end.
3235 Placing any whitespace characters at the beginning of a line will
3236 prevent a possible addition of the command line to the \*(OPal
3237 .Ic history .
3240 The beginning of such input lines is then scanned for the name of
3241 a known command: command names may be abbreviated, in which case the
3242 first command that matches the given prefix will be used.
3243 .Sx "Command modifiers"
3244 may prefix a command in order to modify its behaviour.
3245 A name may also be a
3246 .Ic commandalias ,
3247 which will become expanded until no more expansion is possible.
3248 Once the command that shall be executed is known, the remains of the
3249 input line will be interpreted according to command-specific rules,
3250 documented in the following.
3253 This behaviour is different to the
3254 .Xr sh 1 Ns
3255 ell, which is a programming language with syntactic elements of clearly
3256 defined semantics, and therefore capable to sequentially expand and
3257 evaluate individual elements of a line.
3258 \*(UA will never be able to handle
3259 .Ql ? set one=value two=$one
3260 in a single statement, because the variable assignment is performed by
3261 the command
3262 .Pf ( Ic set ) ,
3263 not the language.
3266 The command
3267 .Ic list
3268 can be used to show the list of all commands, either alphabetically
3269 sorted or in prefix search order (these do not match, also because the
3270 POSIX standard prescribes a set of abbreviations).
3271 \*(OPally the command
3272 .Ic help
3274 .Ic \&? ) ,
3275 when given an argument, will show a documentation string for the
3276 command matching the expanded argument, as in
3277 .Ql ?t ,
3278 which should be a shorthand of
3279 .Ql ?type ;
3280 with these documentation strings both commands support a more
3281 .Va verbose
3282 listing mode which includes the argument type of the command and other
3283 information which applies; a handy suggestion might thus be:
3285 .Bd -literal -offset indent
3286 ? define __xv {
3287   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3288   localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}
3290 ? commandalias xv '\ecall __xv'
3291 ? xv help set
3294 .\" .Ss "Command modifiers" {{{
3295 .Ss "Command modifiers"
3297 Commands may be prefixed by one or multiple command modifiers.
3298 Some command modifiers can be used with a restricted set of commands
3299 only, the
3300 .Va verbose
3301 version of
3302 .Ic list
3303 will (\*(OPally) show which modifiers apply.
3305 .Bl -bullet
3307 The modifier reverse solidus
3309 .Cm \e ,
3310 to be placed first, prevents
3311 .Ic commandalias
3312 expansions on the remains of the line, e.g.,
3313 .Ql \eecho
3314 will always evaluate the command
3315 .Ic echo ,
3316 even if an (command)alias of the same name exists.
3317 .Ic commandalias
3318 content may itself contain further command modifiers, including
3319 an initial reverse solidus to prevent further expansions.
3322 The modifier
3324 .Cm ignerr
3325 indicates that any error generated by the following command should be
3326 ignored by the state machine and not cause a program exit with enabled
3327 .Va errexit
3328 or for the standardized exit cases in
3329 .Va posix
3330 mode.
3331 .Va \&? ,
3332 one of the
3333 .Sx "INTERNAL VARIABLES" ,
3334 will be set to the real exit status of the command regardless.
3338 .Cm local
3339 will alter the called command to apply changes only temporarily,
3340 local to block-scope, and can thus only be used inside of a
3341 .Ic define Ns
3342 d macro or an
3343 .Ic account
3344 definition.
3345 Specifying it implies the modifier
3346 .Cm wysh .
3347 Block-scope settings will not be inherited by macros deeper in the
3348 .Ic call
3349 chain, and will be garbage collected once the current block is left.
3350 To record and unroll changes in the global scope use the command
3351 .Ic localopts .
3355 .Cm scope
3356 does yet not implement any functionality.
3360 .Cm u
3361 does yet not implement any functionality.
3364 Some commands support the
3366 .Cm vput
3367 modifier: if used, they expect the name of a variable, which can itself
3368 be a variable, i.e., shell expansion is applied, as their first
3369 argument, and will place their computation result in it instead of the
3370 default location (it is usually written to standard output).
3372 The given name will be tested for being a valid
3373 .Xr sh 1
3374 variable name, and may therefore only consist of upper- and lowercase
3375 characters, digits, and the underscore; the hyphen-minus may be used as
3376 a non-portable extension; digits may not be used as first, hyphen-minus
3377 may not be used as last characters.
3378 In addition the name may either not be one of the known
3379 .Sx "INTERNAL VARIABLES" ,
3380 or must otherwise refer to a writable (non-boolean) value variable.
3381 The actual put operation may fail nonetheless, e.g., if the variable
3382 expects a number argument only a number will be accepted.
3383 Any error during these operations causes the command as such to fail,
3384 and the error number
3385 .Va \&!
3386 will be set to
3387 .Va ^ERR Ns -NOTSUP ,
3388 the exit status
3389 .Va \&?
3390 should be set to
3391 .Ql -1 ,
3392 but some commands deviate from the latter, which is documented.
3395 Last, but not least, the modifier
3397 .Cm wysh
3398 can be used for some old and established commands to choose the new
3399 .Sx "Shell-style argument quoting"
3400 rules over the traditional
3401 .Sx "Old-style argument quoting" .
3403 .\" }}}
3405 .\" .Ss "Message list arguments" {{{
3406 .Ss "Message list arguments"
3408 Some commands expect arguments that represent messages (actually
3409 their symbolic message numbers), as has been documented above under
3410 .Sx "Specifying messages"
3411 already.
3412 If no explicit message list has been specified, the next message
3413 forward that satisfies the commands requirements will be used,
3414 and if there are no messages forward of the current message,
3415 the search proceeds backwards;
3416 if there are no good messages at all to be found, an error message is
3417 shown and the command is aborted.
3418 .\" }}}
3420 .\" .Ss "Old-style argument quoting" {{{
3421 .Ss "Old-style argument quoting"
3423 \*(ID This section documents the old, traditional style of quoting
3424 non-message-list arguments to commands which expect this type of
3425 arguments: whereas still used by the majority of such commands, the new
3426 .Sx "Shell-style argument quoting"
3427 may be available even for those via
3428 .Cm wysh ,
3429 one of the
3430 .Sx "Command modifiers" .
3431 Nonetheless care must be taken, because only new commands have been
3432 designed with all the capabilities of the new quoting rules in mind,
3433 which can, e.g., generate control characters.
3436 .Bl -bullet -offset indent
3438 An argument can be enclosed between paired double-quotes
3439 .Ql """argument"""
3441 single-quotes
3442 .Ql 'argument' ;
3443 any whitespace, shell word expansion, or reverse solidus characters
3444 (except as described next) within the quotes are treated literally as
3445 part of the argument.
3446 A double-quote will be treated literally within single-quotes and vice
3447 versa.
3448 Inside such a quoted string the actually used quote character can be
3449 used nonetheless by escaping it with a reverse solidus
3450 .Ql \e ,
3451 as in
3452 .Ql """y\e""ou""" .
3455 An argument that is not enclosed in quotes, as above, can usually still
3456 contain space characters if those spaces are reverse solidus escaped, as in
3457 .Ql you\e are .
3460 A reverse solidus outside of the enclosing quotes is discarded
3461 and the following character is treated literally as part of the argument.
3463 .\" }}}
3465 .\" .Ss "Shell-style argument quoting" {{{
3466 .Ss "Shell-style argument quoting"
3468 Commands which do not expect message-list arguments use
3469 .Xr sh 1 Ns
3470 ell-style, and therefore POSIX standardized, argument parsing and
3471 quoting rules.
3472 \*(ID Most new commands only support these new rules and are flagged
3473 \*(NQ, some elder ones can use them with the command modifier
3474 .Cm wysh ;
3475 in the future only this type of argument quoting will remain.
3478 A command line is parsed from left to right and an input token is
3479 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3480 Metacharacters are vertical bar
3481 .Cm \&| ,
3482 ampersand
3483 .Cm & ,
3484 semicolon
3485 .Cm \&; ,
3486 as well as all characters from the variable
3487 .Va ifs ,
3488 and / or
3489 .Cm space , tabulator , newline .
3490 The additional metacharacters left and right parenthesis
3491 .Cm \&( , \&)
3492 and less-than and greater-than signs
3493 .Cm < , >
3494 that the
3495 .Xr sh 1
3496 supports are not used, and are treated as ordinary characters: for one
3497 these characters are a vivid part of email addresses, and it seems
3498 highly unlikely that their function will become meaningful to \*(UA.
3500 .Bd -filled -offset indent
3501 .Sy Compatibility note:
3502 \*(ID Please note that even many new-style commands do not yet honour
3503 .Va ifs
3504 to parse their arguments: whereas the
3505 .Xr sh 1 Ns
3506 ell is a language with syntactic elements of clearly defined semantics,
3507 \*(UA parses entire input lines and decides on a per-command base what
3508 to do with the rest of the line.
3509 This also means that whenever an unknown command is seen all that \*(UA
3510 can do is cancellation of the processing of the remains of the line.
3512 It also often depends on an actual subcommand of a multiplexer command
3513 how the rest of the line should be treated, and until v15 we are not
3514 capable to perform this deep inspection of arguments.
3515 Nonetheless, at least the following commands which work with positional
3516 parameters fully support
3517 .Va ifs
3518 for an almost shell-compatible field splitting:
3519 .Ic call , call_if , read , vpospar , xcall .
3523 Any unquoted number sign
3524 .Ql #
3525 at the beginning of a new token starts a comment that extends to the end
3526 of the line, and therefore ends argument processing.
3527 An unquoted dollar sign
3528 .Ql $
3529 will cause variable expansion of the given name, which must be a valid
3530 .Xr sh 1 Ns
3531 ell-style variable name (see
3532 .Cm vput ) :
3533 .Sx "INTERNAL VARIABLES"
3534 as well as
3535 .Sx ENVIRONMENT
3536 (shell) variables can be accessed through this mechanism, brace
3537 enclosing the name is supported (i.e., to subdivide a token).
3540 Whereas the metacharacters
3541 .Cm space , tabulator , newline
3542 only complete an input token, vertical bar
3543 .Cm \&| ,
3544 ampersand
3545 .Cm &
3546 and semicolon
3547 .Cm \&;
3548 also act as control operators and perform control functions.
3549 For now supported is semicolon
3550 .Cm \&; ,
3551 which terminates a single command, therefore sequencing the command line
3552 and making the remainder of the line a subject to reevaluation.
3553 With sequencing, multiple command argument types and quoting rules may
3554 therefore apply to a single line, which can become problematic before
3555 v15: e.g., the first of the following will cause surprising results.
3558 .Dl ? echo one; set verbose; echo verbose=$verbose.
3559 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3562 Quoting is a mechanism that will remove the special meaning of
3563 metacharacters and reserved words, and will prevent expansion.
3564 There are four quoting mechanisms: the escape character, single-quotes,
3565 double-quotes and dollar-single-quotes:
3568 .Bl -bullet -offset indent
3570 The literal value of any character can be preserved by preceding it
3571 with the escape character reverse solidus
3572 .Ql \e .
3575 Arguments which are enclosed in
3576 .Ql 'single-\:quotes'
3577 retain their literal value.
3578 A single-quote cannot occur within single-quotes.
3581 The literal value of all characters enclosed in
3582 .Ql \(dqdouble-\:quotes\(dq
3583 is retained, with the exception of dollar sign
3584 .Ql $ ,
3585 which will cause variable expansion, as above, backquote (grave accent)
3586 .Ql ` ,
3587 (which not yet means anything special), reverse solidus
3588 .Ql \e ,
3589 which will escape any of the characters dollar sign
3590 .Ql $
3591 (to prevent variable expansion), backquote (grave accent)
3592 .Ql ` ,
3593 double-quote
3594 .Ql \(dq
3595 (to prevent ending the quote) and reverse solidus
3596 .Ql \e
3597 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3598 but has no special meaning otherwise.
3601 Arguments enclosed in
3602 .Ql $'dollar-\:single-\:quotes'
3603 extend normal single quotes in that reverse solidus escape sequences are
3604 expanded as follows:
3606 .Bl -tag -compact -width ".Ql \eNNN"
3607 .It Ql \ea
3608 bell control character (ASCII and ISO-10646 BEL).
3609 .It Ql \eb
3610 backspace control character (ASCII and ISO-10646 BS).
3611 .It Ql \eE
3612 escape control character (ASCII and ISO-10646 ESC).
3613 .It Ql \ee
3614 the same.
3615 .It Ql \ef
3616 form feed control character (ASCII and ISO-10646 FF).
3617 .It Ql \en
3618 line feed control character (ASCII and ISO-10646 LF).
3619 .It Ql \er
3620 carriage return control character (ASCII and ISO-10646 CR).
3621 .It Ql \et
3622 horizontal tabulator control character (ASCII and ISO-10646 HT).
3623 .It Ql \ev
3624 vertical tabulator control character (ASCII and ISO-10646 VT).
3625 .It Ql \e\e
3626 emits a reverse solidus character.
3627 .It Ql \e'
3628 single quote.
3629 .It Ql \e"
3630 double quote (escaping is optional).
3631 .It Ql \eNNN
3632 eight-bit byte with the octal value
3633 .Ql NNN
3634 (one to three octal digits), optionally prefixed by an additional
3635 .Ql 0 .
3636 A 0 byte will suppress further output for the quoted argument.
3637 .It Ql \exHH
3638 eight-bit byte with the hexadecimal value
3639 .Ql HH
3640 (one or two hexadecimal characters, no prefix, see
3641 .Ic vexpr ) .
3642 A 0 byte will suppress further output for the quoted argument.
3643 .It Ql \eUHHHHHHHH
3644 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3645 .Ql HHHHHHHH
3646 (one to eight hexadecimal characters) \(em note that Unicode defines the
3647 maximum codepoint ever to be supported as
3648 .Ql 0x10FFFF
3649 (in planes of
3650 .Ql 0xFFFF
3651 characters each).
3652 This escape is only supported in locales that support Unicode (see
3653 .Sx "Character sets" ) ,
3654 in other cases the sequence will remain unexpanded unless the given code
3655 point is ASCII compatible or (if the \*(OPal character set conversion is
3656 available) can be represented in the current locale.
3657 The character NUL will suppress further output for the quoted argument.
3658 .It Ql \euHHHH
3659 Identical to
3660 .Ql \eUHHHHHHHH
3661 except it takes only one to four hexadecimal characters.
3662 .It Ql \ecX
3663 Emits the non-printable (ASCII and compatible) C0 control codes
3664 0 (NUL) to 31 (US), and 127 (DEL).
3665 Printable representations of ASCII control codes can be created by
3666 mapping them to a different, visible part of the ASCII character set.
3667 Adding the number 64 achieves this for the codes 0 to 31, e.g., 7 (BEL):
3668 .Ql 7 + 64 = 71 = G .
3669 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3670 .Ic vexpr ) ,
3671 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3672 .Ql ? vexpr ^ 127 64 .
3674 Whereas historically circumflex notation has often been used for
3675 visualization purposes of control codes, e.g.,
3676 .Ql ^G ,
3677 the reverse solidus notation has been standardized:
3678 .Ql \ecG .
3679 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3680 as shown above (e.g.,
3681 .Ql \ea ,
3682 .Ql \en ,
3683 .Ql \et ) :
3684 whenever such an alias exists it will be used for display purposes.
3685 The control code NUL
3686 .Pf ( Ql \ec@ ,
3687 a non-standard extension) will suppress further output for the remains
3688 of the token (which may extend beyond the current quote), or, depending
3689 on the context, the remains of all arguments for the current command.
3690 .It Ql \e$NAME
3691 Non-standard extension: expand the given variable name, as above.
3692 Brace enclosing the name is supported.
3693 .It Ql \e`{command}
3694 Not yet supported, just to raise awareness: Non-standard extension.
3699 Caveats:
3701 .Bd -literal -offset indent
3702 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3703 ? echo Quotes ${HOME} and tokens differ! # comment
3704 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3706 .\" }}}
3708 .\" .Ss "Raw data arguments for codec commands" {{{
3709 .Ss "Raw data arguments for codec commands"
3711 A special set of commands, which all have the string
3712 .Dq codec
3713 in their name, e.g.,
3714 .Ic addrcodec ,
3715 .Ic shcodec ,
3716 .Ic urlcodec ,
3717 take raw string data as input, which means that the content of the
3718 command input line is passed completely unexpanded and otherwise
3719 unchanged: like this the effect of the actual codec is visible without
3720 any noise of possible shell quoting rules etc., i.e., the user can input
3721 one-to-one the desired or questionable data.
3722 To gain a level of expansion, the entire command line can be
3723 .Ic eval Ns
3724 uated first, e.g.,
3726 .Bd -literal -offset indent
3727 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3728 ? echo $res
3729 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3730 ? shcodec d $res
3731 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3732 ? eval shcodec d $res
3733 /usr/Sch\[:o]nes Wetter/heute.txt
3735 .\" }}}
3737 .\" .Ss "Filename transformations" {{{
3738 .Ss "Filename transformations"
3740 Filenames, where expected, and unless documented otherwise, are
3741 subsequently subject to the following filename transformations, in
3742 sequence:
3744 .Bl -bullet -offset indent
3746 If the given name is a registered
3747 .Ic shortcut ,
3748 it will be replaced with the expanded shortcut.
3751 The filename is matched against the following patterns or strings:
3753 .Bl -hang -compact -width ".Ar %user"
3754 .It Ar #
3755 (Number sign) is expanded to the previous file.
3756 .It Ar %
3757 (Percent sign) is replaced by the invoking
3758 .Mx -ix "primary system mailbox"
3759 user's primary system mailbox, which either is the (itself expandable)
3760 .Va inbox
3761 if that is set, the standardized absolute pathname indicated by
3762 .Ev MAIL
3763 if that is set, or a built-in compile-time default otherwise.
3764 .It Ar %user
3765 Expands to the primary system mailbox of
3766 .Ar user
3767 (and never the value of
3768 .Va inbox ,
3769 regardless of its actual setting).
3770 .It Ar &
3771 (Ampersand) is replaced with the invoking user's
3772 .Mx -ix "secondary mailbox"
3773 secondary mailbox, the
3774 .Ev MBOX .
3775 .It Ar +file
3776 Refers to a
3777 .Ar file
3778 in the
3779 .Va folder
3780 directory (if that variable is set).
3781 .It Ar %:filespec
3782 Expands to the same value as
3783 .Ar filespec ,
3784 but has special meaning when used with, e.g., the command
3785 .Ic file :
3786 the file will be treated as a primary system mailbox by, e.g., the
3787 .Ic mbox
3789 .Ic save
3790 commands, meaning that messages that have been read in the current
3791 session will be moved to the
3792 .Ev MBOX
3793 mailbox instead of simply being flagged as read.
3797 Meta expansions may be applied to the resulting filename, as allowed by
3798 the operation and applicable to the resulting access protocol (also see
3799 .Sx "On URL syntax and credential lookup" ) .
3800 For the file-protocol, a leading tilde
3801 .Ql ~
3802 character will be replaced by the expansion of
3803 .Ev HOME ,
3804 except when followed by a valid user name, in which case the home
3805 directory of the given user is used instead.
3807 A shell expansion as if specified in double-quotes (see
3808 .Sx "Shell-style argument quoting" )
3809 may be applied, so that any occurrence of
3810 .Ql $VARIABLE
3812 .Ql ${VARIABLE} )
3813 will be replaced by the expansion of the variable, if possible;
3814 .Sx "INTERNAL VARIABLES"
3815 as well as
3816 .Sx ENVIRONMENT
3817 (shell) variables can be accessed through this mechanism.
3819 Shell pathname wildcard pattern expansions
3820 .Pf ( Xr glob 7 )
3821 may be applied as documented.
3822 If the fully expanded filename results in multiple pathnames and the
3823 command is expecting only one file, an error results.
3825 In interactive context, in order to allow simple value acceptance (via
3826 .Dq ENTER ) ,
3827 arguments will usually be displayed in a properly quoted form, e.g., a file
3828 .Ql diet\e is \ecurd.txt
3829 may be displayed as
3830 .Ql 'diet\e is \ecurd.txt' .
3832 .\" }}}
3834 .\" .Ss "Commands" {{{
3835 .Ss "Commands"
3837 The following commands are available:
3839 .Bl -tag -width ".It Ic BaNg"
3843 .It Ic \&!
3844 Executes the
3845 .Ev SHELL
3846 command which follows, replacing unescaped exclamation marks with the
3847 previously executed command if the internal variable
3848 .Va bang
3849 is set.
3850 This command supports
3851 .Cm vput
3852 as documented in
3853 .Sx "Command modifiers" ,
3854 and manages the error number
3855 .Va \&! .
3856 A 0 or positive exit status
3857 .Va \&?
3858 reflects the exit status of the command, negative ones that
3859 an error happened before the command was executed, or that the program
3860 did not exit cleanly, but, e.g., due to a signal: the error number is
3861 .Va ^ERR Ns -CHILD ,
3862 then.
3865 In conjunction with the
3866 .Cm vput
3867 modifier the following special cases exist:
3868 a negative exit status occurs if the collected data could not be stored
3869 in the given variable, which is a
3870 .Va ^ERR Ns -NOTSUP
3871 error that should otherwise not occur.
3872 .Va ^ERR Ns -CANCELED
3873 indicates that no temporary file could be created to collect the command
3874 output at first glance.
3875 In case of catchable out-of-memory situations
3876 .Va ^ERR Ns -NOMEM
3877 will occur and \*(UA will try to store the empty string, just like with
3878 all other detected error conditions.
3882 .It Ic #
3883 The comment-command causes the entire line to be ignored.
3884 .Sy Note:
3885 this really is a normal command which' purpose is to discard its
3886 arguments, not a
3887 .Dq comment-start
3888 indicating special character, which means that, e.g., trailing comments
3889 on a line are not possible (except for commands which use
3890 .Sx "Shell-style argument quoting" ) .
3893 .It Ic +
3894 Goes to the next message in sequence and types it
3895 (like
3896 .Dq ENTER ) .
3899 .It Ic -
3900 Display the preceding message, or the n'th previous message if given
3901 a numeric argument n.
3904 .It Ic =
3905 Show the current message number (the
3906 .Dq dot ) .
3909 .It Ic \&?
3910 \*(OP Show a brief summary of commands.
3911 \*(OP Given an argument a synopsis for the command in question is
3912 shown instead; commands can be abbreviated in general and this command
3913 can be used to see the full expansion of an abbreviation including the
3914 synopsis, try, e.g.,
3915 .Ql ?h ,
3916 .Ql ?hel
3918 .Ql ?help
3919 and see how the output changes.
3920 This mode also supports a more
3921 .Va verbose
3922 output, which will provide the information documented for
3923 .Ic list .
3926 .It Ic \&|
3927 A synonym for the
3928 .Ic pipe
3929 command.
3933 .It Ic account , unaccount
3934 (ac, una) Creates, selects or lists (an) account(s).
3935 Accounts are special incarnations of
3936 .Ic define Ns d
3937 macros and group commands and variable settings which together usually
3938 arrange the environment for the purpose of creating an email account.
3939 Different to normal macros settings which are covered by
3940 .Ic localopts
3941 \(en here by default enabled! \(en will not be reverted before the
3942 .Ic account
3943 is changed again.
3944 The special account
3945 .Ql null
3946 (case-insensitive) always exists, and all but it can be deleted by the
3947 latter command, and in one operation with the special name
3948 .Ql * .
3949 Also for all but it a possibly set
3950 .Va on-account-cleanup
3951 hook is called once they are left.
3953 Without arguments a listing of all defined accounts is shown.
3954 With one argument the given account is activated: the system
3955 .Va inbox
3956 of that account will be activated (as via
3957 .Ic file ) ,
3958 a possibly installed
3959 .Va folder-hook
3960 will be run, and the internal variable
3961 .Va account
3962 will be updated.
3963 The two argument form is identical to defining a macro as via
3964 .Ic define :
3965 .Bd -literal -offset indent
3966 account myisp {
3967   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3968   set from='(My Name) myname@myisp.example'
3969   set mta=smtp://mylogin@smtp.myisp.example
3975 .It Ic addrcodec
3976 Perform email address codec transformations on raw-data argument, rather
3977 according to email standards (RFC 5322; \*(ID will furtherly improve).
3978 Supports
3979 .Cm vput
3980 (see
3981 .Sx "Command modifiers" ) ,
3982 and manages the error number
3983 .Va \&! .
3984 The first argument must be either
3985 .Ar [+[+[+]]]e[ncode] ,
3986 .Ar d[ecode] ,
3987 .Ar s[kin]
3989 .Ar skinl[ist]
3990 and specifies the operation to perform on the rest of the line.
3993 Decoding will show how a standard-compliant MUA will display the given
3994 argument, which should be an email address.
3995 Please be aware that most MUAs have difficulties with the address
3996 standards, and vary wildly when (comments) in parenthesis,
3997 .Dq double-quoted
3998 strings, or quoted-pairs, as below, become involved.
3999 \*(ID \*(UA currently does not perform decoding when displaying addresses.
4002 Skinning is identical to decoding but only outputs the plain address,
4003 without any string, comment etc. components.
4004 Another difference is that it may fail with the error number
4005 .Va \&!
4006 set to
4007 .Va ^ERR Ns -INVAL
4008 if decoding fails to find a(n) (valid) email address, in which case the
4009 unmodified input will be output again.
4012 .Ar skinlist
4013 first performs a skin operation, and thereafter checks a valid
4014 address for whether it is a registered mailing list (see
4015 .Ic mlist
4017 .Ic mlsubscribe ) ,
4018 eventually reporting that state in the error number
4019 .Va \&!
4021 .Va ^ERR Ns -EXIST .
4022 (This state could later become overwritten by an I/O error, though.)
4025 Encoding supports four different modes, lesser automated versions can be
4026 chosen by prefixing one, two or three plus signs: the standard imposes
4027 a special meaning on some characters, which thus have to be transformed
4028 to so-called quoted-pairs by pairing them with a reverse solidus
4029 .Ql \e
4030 in order to remove the special meaning; this might change interpretation
4031 of the entire argument from what has been desired, however!
4032 Specify one plus sign to remark that parenthesis shall be left alone,
4033 two for not turning double quotation marks into quoted-pairs, and three
4034 for also leaving any user-specified reverse solidus alone.
4035 The result will always be valid, if a successful exit status is reported
4036 (\*(ID the current parser fails this assertion for some constructs).
4037 \*(ID Addresses need to be specified in between angle brackets
4038 .Ql < ,
4039 .Ql >
4040 if the construct becomes more difficult, otherwise the current parser
4041 will fail; it is not smart enough to guess right.
4043 .Bd -literal -offset indent
4044 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
4045 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4046 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4047 "Hey, you", \e out\e there <diet@exam.ple>
4048 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
4049 diet@exam.ple
4055 .It Ic alias , unalias
4056 (a, una) Aliases are a method of creating personal distribution lists
4057 that map a single alias name to none to multiple real receivers;
4058 these aliases become expanded after message composing is completed.
4059 The latter command removes the given list of aliases, the special name
4060 .Ql *
4061 will discard all existing aliases.
4063 The former command shows all currently defined aliases when used without
4064 arguments, and with one argument the expansion of the given alias.
4065 With more than one argument, creates or appends to the alias name given
4066 as the first argument the remaining arguments.
4067 Alias names adhere to the Postfix MTA
4068 .Xr aliases 5
4069 rules and are thus restricted to alphabetic characters, digits, the
4070 underscore, hyphen-minus, the number sign, colon and commercial at,
4071 the last character can also be the dollar sign; the regular expression:
4072 .Ql [[:alnum:]_#:@-]+$? .
4073 .\" ALIASCOLON next sentence
4074 \*(ID Unfortunately the colon is currently not supported, as it
4075 interferes with normal address parsing rules.
4076 As extensions the exclamation mark
4077 .Ql \&! ,
4078 period
4079 .Ql \&.
4080 as well as
4081 .Dq any character that has the high bit set
4082 may be used.
4083 .\" ALIASCOLON next sentence
4084 \*(ID Such high bit characters will likely cause warnings at the moment
4085 for the same reasons why colon is unsupported.
4089 .It Ic alternates , unalternates
4090 \*(NQ (alt) Manage a list of alternate addresses or names of the active
4091 user, members of which will be removed from recipient lists (except one).
4092 The latter command removes the given list of alternates, the special name
4093 .Ql *
4094 will discard all existing alternate names.
4096 The former command manages the error number
4097 .Va \&! .
4098 It shows the current set of alternates when used without arguments; in
4099 this mode only it also supports
4100 .Cm vput
4101 (see
4102 .Sx "Command modifiers" ) .
4103 Otherwise the given arguments (after being checked for validity) are
4104 appended to the list of alternate names; in
4105 .Va posix
4106 mode they replace that list instead.
4107 There is a set of implicit alternates which is formed of the values of
4108 .Ev LOGNAME ,
4109 .Va from ,
4110 .Va sender
4112 .Va reply-to .
4116 .It Ic answered , unanswered
4117 Take a message lists and mark each message as (not) having been answered.
4118 Messages will be marked answered when being
4119 .Ic reply Ns d
4120 to automatically if the
4121 .Va markanswered
4122 variable is set.
4123 See the section
4124 .Sx "Message states" .
4129 .It Ic bind , unbind
4130 \*(OP\*(NQ The bind command extends the MLE (see
4131 .Sx "On terminal control and line editor" )
4132 with freely configurable key bindings.
4133 The latter command removes from the given context the given key binding,
4134 both of which may be specified as a wildcard
4135 .Ql * ,
4136 so that, e.g.,
4137 .Ql unbind * *
4138 will remove all bindings of all contexts.
4139 Due to initialization order unbinding will not work for built-in key
4140 bindings upon program startup, however: please use
4141 .Va line-editor-no-defaults
4142 for this purpose instead.
4145 With one argument the former command shows all key bindings for the
4146 given context, specifying an asterisk
4147 .Ql *
4148 will show the bindings of all contexts; a more verbose listing will be
4149 produced if either of
4150 .Va debug
4152 .Va verbose
4153 are set.
4154 With two or more arguments a binding is (re)established:
4155 the first argument is the context to which the binding shall apply,
4156 the second argument is a comma-separated list of the
4157 .Dq keys
4158 which form the binding, and any remaining arguments form the expansion.
4159 To indicate that a binding shall not be auto-committed, but that the
4160 expansion shall instead be furtherly editable by the user, a commercial at
4161 .Ql @
4162 (that will be removed) can be placed last in the expansion, from which
4163 leading and trailing whitespace will finally be removed.
4164 Reverse solidus cannot be used as the last character of expansion.
4167 Contexts define when a binding applies, i.e., a binding will not be seen
4168 unless the context for which it is defined for is currently active.
4169 This is not true for the shared binding
4170 .Ql base ,
4171 which is the foundation for all other bindings and as such always
4172 applies, its bindings, however, only apply secondarily.
4173 The available contexts are the shared
4174 .Ql base ,
4176 .Ql default
4177 context which is used in all not otherwise documented situations, and
4178 .Ql compose ,
4179 which applies to compose mode only.
4182 .Dq Keys
4183 which form the binding are specified as a comma-separated list of
4184 byte-sequences, where each list entry corresponds to one key(press).
4185 A list entry may, indicated by a leading colon character
4186 .Ql \&: ,
4187 also refer to the name of a terminal capability; several dozen names
4188 will be compiled in and may be specified either by their
4189 .Xr terminfo 5 ,
4190 or, if existing, by their
4191 .Xr termcap 5
4192 name, regardless of the actually used \*(OPal terminal control library.
4193 It is possible to use any capability, as long as the name is resolvable
4194 by the \*(OPal control library or was defined via the internal variable
4195 .Va termcap .
4196 Input sequences are not case-normalized, so that an exact match is
4197 required to update or remove a binding.
4198 Examples:
4200 .Bd -literal -offset indent
4201 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4202 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete
4203 ? bind default $'\ecA',:khome,w 'echo Editable binding@'
4204 ? bind default a,b,c rm -irf / @  # Also editable
4205 ? bind default :kf1 File %
4206 ? bind compose :kf1 ~v
4210 Note that the entire comma-separated list is first parsed (over) as a
4211 shell-token with whitespace as the field separator, before being parsed
4212 and expanded for real with comma as the field separator, therefore
4213 whitespace needs to be properly quoted, see
4214 .Sx "Shell-style argument quoting" .
4215 Using Unicode reverse solidus escape sequences renders a binding
4216 defunctional if the locale does not support Unicode (see
4217 .Sx "Character sets" ) ,
4218 and using terminal capabilities does so if no (corresponding) terminal
4219 control support is (currently) available.
4222 The following terminal capability names are built-in and can be used in
4223 .Xr terminfo 5
4224 or (if available) the two-letter
4225 .Xr termcap 5
4226 notation.
4227 See the respective manual for a list of capabilities.
4228 The program
4229 .Xr infocmp 1
4230 can be used to show all the capabilities of
4231 .Ev TERM
4232 or the given terminal type;
4233 using the
4234 .Fl \&\&x
4235 flag will also show supported (non-standard) extensions.
4238 .Bl -tag -compact -width kcuuf_or_kcuuf
4239 .It Cd kbs Ns \0or Cd kb
4240 Backspace.
4241 .It Cd kdch1 Ns \0or Cd kD
4242 Delete character.
4243 .It Cd kDC Ns \0or Cd *4
4244 \(em shifted variant.
4245 .It Cd kel Ns \0or Cd kE
4246 Clear to end of line.
4247 .It Cd kext Ns \0or Cd @9
4248 Exit.
4249 .It Cd kich1 Ns \0or Cd kI
4250 Insert character.
4251 .It Cd kIC Ns \0or Cd #3
4252 \(em shifted variant.
4253 .It Cd khome Ns \0or Cd kh
4254 Home.
4255 .It Cd kHOM Ns \0or Cd #2
4256 \(em shifted variant.
4257 .It Cd kend Ns \0or Cd @7
4258 End.
4259 .It Cd knp Ns \0or Cd kN
4260 Next page.
4261 .It Cd kpp Ns \0or Cd kP
4262 Previous page.
4263 .It Cd kcub1 Ns \0or Cd kl
4264 Left cursor (with more modifiers: see below).
4265 .It Cd kLFT Ns \0or Cd #4
4266 \(em shifted variant.
4267 .It Cd kcuf1 Ns \0or Cd kr
4268 Right cursor (ditto).
4269 .It Cd kRIT Ns \0or Cd %i
4270 \(em shifted variant.
4271 .It Cd kcud1 Ns \0or Cd kd
4272 Down cursor (ditto).
4273 .It Cd kDN
4274 \(em shifted variant (only terminfo).
4275 .It Cd kcuu1 Ns \0or Cd ku
4276 Up cursor (ditto).
4277 .It Cd kUP
4278 \(em shifted variant (only terminfo).
4279 .It Cd kf0 Ns \0or Cd k0
4280 Function key 0.
4281 Add one for each function key up to
4282 .Cd kf9
4284 .Cd k9 ,
4285 respectively.
4286 .It Cd kf10 Ns \0or Cd k;
4287 Function key 10.
4288 .It Cd kf11 Ns \0or Cd F1
4289 Function key 11.
4290 Add one for each function key up to
4291 .Cd kf19
4293 .Cd F9 ,
4294 respectively.
4298 Some terminals support key-modifier combination extensions, e.g.,
4299 .Ql Alt+Shift+xy .
4300 For example, the delete key,
4301 .Cd kdch1 :
4302 in its shifted variant, the name is mutated to
4303 .Cd  kDC ,
4304 then a number is appended for the states
4305 .Ql Alt
4306 .Pf ( Cd kDC3 ) ,
4307 .Ql Shift+Alt
4308 .Pf ( Cd kDC4 ) ,
4309 .Ql Control
4310 .Pf ( Cd kDC5 ) ,
4311 .Ql Shift+Control
4312 .Pf ( Cd kDC6 ) ,
4313 .Ql Alt+Control
4314 .Pf ( Cd kDC7 ) ,
4315 finally
4316 .Ql Shift+Alt+Control
4317 .Pf ( Cd kDC8 ) .
4318 The same for the left cursor key,
4319 .Cd kcub1 :
4320 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4323 It is advisable to use an initial escape or other control character (e.g.,
4324 .Ql \ecA )
4325 for bindings which describe user key combinations (as opposed to purely
4326 terminal capability based ones), in order to avoid ambiguities whether
4327 input belongs to key sequences or not; it also reduces search time.
4328 Adjusting
4329 .Va bind-timeout
4330 may help shall keys and sequences be falsely recognized.
4334 .It Ic call
4335 \*(NQ Calls the given macro, which must have been created via
4336 .Ic define ,
4337 otherwise an
4338 .Va ^ERR Ns -NOENT
4339 error occurs.
4340 Calling macros recursively will at some time excess the stack size
4341 limit, causing a hard program abortion; if recursively calling a macro
4342 is the last command of the current macro, consider to use the command
4343 .Ic xcall ,
4344 which will first release all resources of the current macro before
4345 replacing the current macro with the called one.
4346 Numeric and string operations can be performed via
4347 .Ic vexpr ,
4349 .Ic eval
4350 may be helpful to recreate argument lists.
4354 .It Ic call_if
4355 Identical to
4356 .Ic call
4357 if the given macro has been created via
4358 .Ic define ,
4359 but does not fail nor warn if the macro does not exist.
4362 .It Ic cd
4363 (ch) Change the working directory to
4364 .Ev HOME
4365 or the given argument.
4366 Synonym for
4367 .Ic chdir .
4370 .It Ic certsave
4371 \*(OP Only applicable to S/MIME signed messages.
4372 Takes a message list and a filename and saves the certificates
4373 contained within the message signatures to the named file in both
4374 human-readable and PEM format.
4375 The certificates can later be used to send encrypted messages to the
4376 respective message senders by setting
4377 .Va smime-encrypt-USER@HOST
4378 variables.
4382 .It Ic charsetalias , uncharsetalias
4383 \*(NQ Manage alias mappings for (conversion of)
4384 .Sx "Character sets" .
4385 Mappings are ineffective if character set conversion is not available
4386 .Pf ( Va features
4387 does not announce
4388 .Ql +iconv ) .
4389 Expansion happens recursively, but expansion is not performed for
4390 .Sx "INTERNAL VARIABLES" ,
4391 e.g.,
4392 .Va charset-8bit .
4394 The latter command deletes all aliases given as arguments,
4395 all aliases can be deleted at once with the special argument
4396 .Ql * .
4397 The former shows the list of all currently defined aliases if used
4398 without arguments, the expansion of the given alias with one argument.
4399 Otherwise all given arguments are treated as pairs of character sets and
4400 their desired target alias name, creating new or changing already
4401 existing aliases, as necessary.
4404 .It Ic chdir
4405 (ch) Change the working directory to
4406 .Ev HOME
4407 or the given argument.
4408 Synonym for
4409 .Ic cd .
4413 .It Ic collapse , uncollapse
4414 Only applicable to
4415 .Ql thread Ns
4417 .Ic sort
4418 mode.
4419 Takes a message list and makes all replies to these messages invisible
4420 in header summaries, except for
4421 .Ql new
4422 messages and the
4423 .Dq dot .
4424 Also when a message with collapsed replies is displayed,
4425 all of these are automatically uncollapsed.
4426 The latter command undoes collapsing.
4429 .\" FIXME review until this point
4432 .It Ic colour , uncolour
4433 \*(OP\*(NQ Manage colour mappings of and for a
4434 .Sx "Coloured display" .
4435 The type of colour is given as the (case-insensitive) first argument,
4436 which must be one of
4437 .Ql 256
4438 for 256-colour terminals,
4439 .Ql 8 ,
4440 .Ql ansi
4442 .Ql iso
4443 for the standard 8-colour ANSI / ISO 6429 colour palette and
4444 .Ql 1
4446 .Ql mono
4447 for monochrome terminals.
4448 Monochrome terminals cannot deal with colours, but only (some) font
4449 attributes.
4452 Without further arguments the list of all currently defined mappings
4453 for the given colour type is shown (as a special case giving
4454 .Ql all
4456 .Ql *
4457 will show the mappings of all types).
4458 Otherwise the second argument defines the mappable slot, and the third
4459 argument a (comma-separated list of) colour and font attribute
4460 specification(s), and the optional fourth argument can be used to
4461 specify a precondition: if conditioned mappings exist they are tested in
4462 (creation) order unless a (case-insensitive) match has been found, and
4463 the default mapping (if any has been established) will only be chosen as
4464 a last resort.
4465 The types of precondition available depend on the mappable slot (see
4466 .Sx "Coloured display"
4467 for some examples), the following of which exist:
4470 Mappings prefixed with
4471 .Ql mle-
4472 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4473 .Sx "On terminal control and line editor" )
4474 and do not support preconditions.
4476 .Bl -tag -compact -width view-partinfo
4477 .It Ar mle-position
4478 This mapping is used for the position indicator that is visible when
4479 a line cannot be fully displayed on the screen.
4480 .It Ar mle-prompt
4481 Used for the
4482 .Va prompt .
4486 Mappings prefixed with
4487 .Ql sum-
4488 are used in header summaries, and they all understand the preconditions
4489 .Ql dot
4490 (the current message) and
4491 .Ql older
4492 for elder messages (only honoured in conjunction with
4493 .Va datefield-markout-older ) .
4495 .Bl -tag -compact -width view-partinfo
4496 .It Ar sum-dotmark
4497 This mapping is used for the
4498 .Dq dotmark
4499 that can be created with the
4500 .Ql %>
4502 .Ql %<
4503 formats of the variable
4504 .Va headline .
4505 .It Ar sum-header
4506 For the complete header summary line except the
4507 .Dq dotmark
4508 and the thread structure.
4509 .It Ar sum-thread
4510 For the thread structure which can be created with the
4511 .Ql %i
4512 format of the variable
4513 .Va headline .
4517 Mappings prefixed with
4518 .Ql view-
4519 are used when displaying messages.
4521 .Bl -tag -compact -width view-partinfo
4522 .It Ar view-from_
4523 This mapping is used for so-called
4524 .Ql From_
4525 lines, which are MBOX file format specific header lines.
4526 .It Ar view-header
4527 For header lines.
4528 A comma-separated list of headers to which the mapping applies may be
4529 given as a precondition; if the \*(OPal regular expression support is
4530 available then if any of the
4531 .Dq magical
4532 (extended) regular expression characters is seen the precondition will
4533 be evaluated as (an extended) one.
4534 .It Ar view-msginfo
4535 For the introductional message info line.
4536 .It Ar view-partinfo
4537 For MIME part info lines.
4541 The following (case-insensitive) colour definitions and font attributes
4542 are understood, multiple of which can be specified in a comma-separated
4543 list:
4545 .Bl -tag -width ft=
4546 .It Ar ft=
4547 a font attribute:
4548 .Ql bold ,
4549 .Ql reverse
4551 .Ql underline .
4552 It is possible (and often applicable) to specify multiple font
4553 attributes for a single mapping.
4555 .It Ar fg=
4556 foreground colour attribute:
4557 .Ql black ,
4558 .Ql blue ,
4559 .Ql green ,
4560 .Ql red ,
4561 .Ql brown ,
4562 .Ql magenta ,
4563 .Ql cyan
4565 .Ql white .
4566 To specify a 256-colour mode a decimal number colour specification in
4567 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4569 .Bl -tag -compact -width "999 - 999"
4570 .It 0 - 7
4571 the standard ISO 6429 colours, as above.
4572 .It 8 - 15
4573 high intensity variants of the standard colours.
4574 .It 16 - 231
4575 216 colours in tuples of 6.
4576 .It 232 - 255
4577 grayscale from black to white in 24 steps.
4579 .Bd -literal -offset indent
4580 #!/bin/sh -
4581 fg() { printf "\e033[38;5;${1}m($1)"; }
4582 bg() { printf "\e033[48;5;${1}m($1)"; }
4584 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4585 printf "\e033[0m\en"
4587 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4588 printf "\e033[0m\en"
4591 .It Ar bg=
4592 background colour attribute (see
4593 .Cd fg=
4594 for possible values).
4598 The command
4599 .Ic \&uncolour
4600 will remove for the given colour type (the special type
4601 .Ql *
4602 selects all) the given mapping; if the optional precondition argument is
4603 given only the exact tuple of mapping and precondition is removed.
4604 The special name
4605 .Ql *
4606 will remove all mappings (no precondition allowed), thus
4607 .Ql uncolour * *
4608 will remove all established mappings.
4613 .It Ic commandalias , uncommandalias
4614 \*(NQ Define or list, and remove, respectively, command aliases.
4615 An (command)alias can be used everywhere a normal command can be used,
4616 but always takes precedence: any arguments that are given to the command
4617 alias are joined onto the alias expansion, and the resulting string
4618 forms the command line that is, in effect, executed.
4619 The latter command removes all given aliases, the special name
4620 .Ql *
4621 will remove all existing aliases.
4622 When used without arguments the former shows a list of all currently
4623 known aliases, with one argument only the expansion of the given one.
4625 With two or more arguments a command alias is defined or updated: the
4626 first argument is the name under which the remaining command line should
4627 be accessible, the content of which can be just about anything.
4628 An alias may itself expand to another alias, but to avoid expansion loops
4629 further expansion will be prevented if an alias refers to itself or if
4630 an expansion depth limit is reached.
4631 Explicit expansion prevention is available via reverse solidus
4632 .Cm \e ,
4633 one of the
4634 .Sx "Command modifiers" .
4635 .Bd -literal -offset indent
4636 ? commandalias xx
4637 \*(uA: `commandalias': no such alias: xx
4638 ? commandalias xx echo hello,
4639 ? commandalias xx
4640 commandalias xx 'echo hello,'
4641 ? xx
4642 hello,
4643 ? xx world
4644 hello, world
4648 .It Ic Copy
4649 (C) Copy messages to files whose names are derived from the author of
4650 the respective message and do not mark them as being saved;
4651 otherwise identical to
4652 .Ic Save .
4655 .It Ic copy
4656 (c) Copy messages to the named file and do not mark them as being saved;
4657 otherwise identical to
4658 .Ic save .
4661 .It Ic cwd
4662 Show the name of the current working directory, as reported by
4663 .Xr getcwd 3 .
4664 Supports
4665 .Cm vput
4666 (see
4667 .Sx "Command modifiers" ) .
4668 The return status is tracked via
4669 .Va \&? .
4672 .It Ic Decrypt
4673 \*(OP For unencrypted messages this command is identical to
4674 .Ic Copy ;
4675 Encrypted messages are first decrypted, if possible, and then copied.
4678 .It Ic decrypt
4679 \*(OP For unencrypted messages this command is identical to
4680 .Ic copy ;
4681 Encrypted messages are first decrypted, if possible, and then copied.
4686 .It Ic define , undefine
4687 The latter command deletes the given macro, the special name
4688 .Ql *
4689 will discard all existing macros.
4690 Deletion of (a) macro(s) can be performed from within running (a)
4691 macro(s), including self-deletion.
4692 Without arguments the former command prints the current list of macros,
4693 including their content, otherwise it it defines a macro, replacing an
4694 existing one of the same name as applicable.
4697 A defined macro can be invoked explicitly by using the
4698 .Ic call ,
4699 .Ic call_if
4701 .Ic xcall
4702 commands, or implicitly if a macro hook is triggered, e.g., a
4703 .Va folder-hook .
4704 Execution of a macro body can be stopped from within by calling
4705 .Ic return .
4708 Temporary macro block-scope variables can be created or deleted with the
4709 .Cm local
4710 command modifier in conjunction with the commands
4711 .Ic set
4713 .Ic unset ,
4714 respectively.
4715 To enforce unrolling of changes made to (global)
4716 .Sx "INTERNAL VARIABLES"
4717 the command
4718 .Ic localopts
4719 can be used instead; its covered scope depends on how (i.e.,
4720 .Dq as what :
4721 normal macro, folder hook, hook,
4722 .Ic account
4723 switch) the macro is invoked.
4726 Inside a
4727 .Ic call Ns
4728 ed macro, the given positional parameters are implicitly local
4729 to the macro's scope, and may be accessed via the variables
4730 .Va * ,
4731 .Va @ ,
4732 .Va #
4734 .Va 1
4735 and any other positive unsigned decimal number less than or equal to
4736 .Va # .
4737 Positional parameters can be
4738 .Ic shift Ns
4739 ed, or become completely replaced, removed etc. via
4740 .Ic vpospar .
4742 .Bd -literal -offset indent
4743 define name {
4744   command1
4745   command2
4746   ...
4747   commandN
4750 # E.g.
4751 define exmac {
4752   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4753   return 1000 0
4755 call exmac Hello macro exmac!
4756 echo ${?}/${!}/${^ERRNAME}
4762 .It Ic delete , undelete
4763 (d, u) Marks the given message list as being or not being
4764 .Ql deleted ,
4765 respectively; if no argument has been specified then the usual search
4766 for a visible message is performed, as documented for
4767 .Sx "Message list arguments" ,
4768 showing only the next input prompt if the search fails.
4769 Deleted messages will neither be saved in the
4770 .Mx -sx
4771 .Sx "secondary mailbox"
4772 .Ev MBOX
4773 nor will they be available for most other commands.
4774 If the
4775 .Va autoprint
4776 variable is set, the new
4777 .Dq dot
4778 or the last message restored, respectively, is automatically
4779 .Ic type Ns
4780 d; also see
4781 .Ic dp ,
4782 .Ic dt .
4785 .It Ic discard
4786 (di) Identical to
4787 .Ic ignore .
4788 Superseded by the multiplexer
4789 .Ic headerpick .
4793 .It Ic dp , dt
4794 Delete the given messages and automatically
4795 .Ic type
4796 the new
4797 .Dq dot
4798 if one exists, regardless of the setting of
4799 .Va autoprint .
4802 .It Ic dotmove
4803 Move the
4804 .Dq dot
4805 up or down by one message when given
4806 .Ql +
4808 .Ql -
4809 argument, respectively.
4813 .It Ic draft , undraft
4814 Take message lists and mark each given message as being draft, or not
4815 being draft, respectively, as documented in the section
4816 .Sx "Message states" .
4819 .It Ic echo
4820 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4821 newline, whereas the otherwise identical
4822 .Ic echon
4823 does not.
4824 .Sx "Shell-style argument quoting"
4825 is used,
4826 .Sx "Filename transformations"
4827 are applied to the expanded arguments.
4828 This command also supports
4829 .Cm vput
4830 as documented in
4831 .Sx "Command modifiers" ,
4832 and manages the error number
4833 .Va \&! :
4834 if data is stored in a variable then the return value reflects the
4835 length of the result string in case of success and is
4836 .Ql -1
4837 on error.
4840 .It Ic echoerr
4841 \*(NQ Identical to
4842 .Ic echo
4843 except that is echoes to standard error.
4844 Also see
4845 .Ic echoerrn .
4846 In interactive sessions the \*(OPal message ring queue for
4847 .Ic errors
4848 will be used instead, if available and
4849 .Cm vput
4850 was not used.
4853 .It Ic echon
4854 \*(NQ Identical to
4855 .Ic echo ,
4856 but does not write or store a trailing newline.
4859 .It Ic echoerrn
4860 \*(NQ Identical to
4861 .Ic echoerr ,
4862 but does not write or store a trailing newline.
4865 .It Ic edit
4866 (e) Point the text
4867 .Ev EDITOR
4868 at each message from the given list in turn.
4869 Modified contents are discarded unless the
4870 .Va writebackedited
4871 variable is set, and are not used unless the mailbox can be written to
4872 and the editor returns a successful exit status.
4873 .Ic visual
4874 can be used instead for a more display oriented editor.
4877 .It Ic elif
4878 Part of the
4879 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4880 conditional \(em if the condition of a preceding
4881 .Ic if
4882 was false, check the following condition and execute the following block
4883 if it evaluates true.
4886 .It Ic else
4887 (el) Part of the
4888 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4889 conditional \(em if none of the conditions of the preceding
4890 .Ic if
4892 .Ic elif
4893 commands was true, the
4894 .Ic else
4895 block is executed.
4898 .It Ic endif
4899 (en) Marks the end of an
4900 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4901 conditional execution block.
4905 .It Ic environ
4906 \*(NQ \*(UA has a strict notion about which variables are
4907 .Sx "INTERNAL VARIABLES"
4908 and which are managed in the program
4909 .Sx ENVIRONMENT .
4910 Since some of the latter are a vivid part of \*(UAs functioning,
4911 however, they are transparently integrated into the normal handling of
4912 internal variables via
4913 .Ic set
4915 .Ic unset .
4916 To integrate other environment variables of choice into this
4917 transparent handling, and also to export internal variables into the
4918 process environment where they normally are not, a
4919 .Ql link
4920 needs to become established with this command, as in, e.g.,
4923 .Dl environ link PERL5LIB TZ
4926 Afterwards changing such variables with
4927 .Ic set
4928 will cause automatic updates of the program environment, and therefore
4929 be inherited by newly created child processes.
4930 Sufficient system support provided (it was in BSD as early as 1987, and
4931 is standardized since Y2K) removing such variables with
4932 .Ic unset
4933 will remove them also from the program environment, but in any way
4934 the knowledge they ever have been
4935 .Ql link Ns
4936 ed will be lost.
4937 Note that this implies that
4938 .Ic localopts
4939 may cause loss of such links.
4942 The command
4943 .Ql unlink
4944 will remove an existing link, but leaves the variables as such intact.
4945 Additionally the subcommands
4946 .Ql set
4948 .Ql unset
4949 are provided, which work exactly the same as the documented commands
4950 .Ic set
4952 .Ic unset ,
4953 but (additionally un)link the variable(s) with the program environment
4954 and thus immediately export them to, or remove them from (if possible),
4955 respectively, the program environment.
4959 .It Ic errors
4960 \*(OP Since \*(UA uses the console as a user interface it can happen
4961 that messages scroll by too fast to become recognized.
4962 An error message ring queue is available which stores duplicates of any
4963 error message and notifies the user in interactive sessions whenever
4964 a new error has occurred.
4965 The queue is finite: if its maximum size is reached any new message
4966 replaces the eldest.
4967 The command
4968 .Ic errors
4969 can be used to manage this message queue: if given
4970 .Ar show
4971 or no argument the queue will be displayed and cleared,
4972 .Ar clear
4973 will only clear all messages from the queue.
4976 .It Ic eval
4977 \*(NQ Construct a command by concatenating the arguments, separated with
4978 a single space character, and then evaluate the result.
4979 This command passes through the exit status
4980 .Va \&?
4981 and error number
4982 .Va \&!
4983 of the evaluated command; also see
4984 .Ic call .
4985 .Bd -literal -offset indent
4986 define xxx {
4987   echo "xxx arg <$1>"
4988   shift
4989   if [ $# -gt 0 ]
4990     \excall xxx "$@"
4991   endif
4993 define yyy {
4994   eval "$@ ' ball"
4996 call yyy '\ecall xxx' "b\e$'\et'u ' "
4997 call xxx arg <b      u>
4998 call xxx arg <  >
4999 call xxx arg <ball>
5003 .It Ic exit
5004 (ex or x) Exit from \*(UA without changing the active mailbox and skip
5005 any saving of messages in the
5006 .Mx -sx
5007 .Sx "secondary mailbox"
5008 .Ev MBOX ,
5009 as well as a possibly tracked line editor
5010 .Va history-file .
5011 The optional status number argument will be passed through to
5012 .Xr exit 3 .
5013 \*(ID For now it can happen that the given status will be overwritten,
5014 later this will only occur if a later error needs to be reported onto an
5015 otherwise success indicating status.
5018 .It Ic File
5019 (Fi) Like
5020 .Ic file ,
5021 but open the mailbox read-only.
5025 .It Ic file
5026 (fi) The file command switches to a new mailbox.
5027 Without arguments it shows status information of the current mailbox.
5028 If an argument is given, it will write out changes (such as deletions)
5029 the user has made, open a new mailbox, update the internal variables
5030 .Va mailbox-resolved
5032 .Va mailbox-display ,
5033 and optionally display a summary of
5034 .Ic headers
5035 if the variable
5036 .Va header
5037 is set.
5040 .Sx "Filename transformations"
5041 will be applied to the
5042 .Ar name
5043 argument, and
5044 .Ql protocol://
5045 prefixes are, i.e., URL syntax is understood, e.g.,
5046 .Ql maildir:///tmp/mdirbox :
5047 if a protocol prefix is used the mailbox type is fixated and neither
5048 the auto-detection (read on) nor the
5049 .Va newfolders
5050 mechanisms apply.
5051 \*(OPally URLs can also be used to access network resources, which may
5052 be accessed securely via
5053 .Sx "Encrypted network communication"
5054 if so supported, and it is possible to proxy all network traffic over
5055 a SOCKS5 server given via
5056 .Va socks-proxy .
5059 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
5060 .Dl \*(OU protocol://[user@]host[:port][/path]
5063 \*(OPally supported network protocols are
5064 .Ar pop3
5065 (POP3) and
5066 .Ar pop3s
5067 (POP3 with SSL/TLS encrypted transport),
5068 .Ar imap
5070 .Ar imaps .
5072 .Ar [/path]
5073 part is valid only for IMAP; there it defaults to
5074 .Ar INBOX .
5075 Network URLs require a special encoding as documented in the section
5076 .Sx "On URL syntax and credential lookup" .
5079 If the resulting file protocol (MBOX database)
5080 .Ar name
5081 is located on a local filesystem then the list of all registered
5082 .Ic filetype Ns
5083 s is traversed in order to see whether a transparent intermediate
5084 conversion step is necessary to handle the given mailbox, in which case
5085 \*(UA will use the found hook to load and save data into and from
5086 a temporary file, respectively.
5087 Changing hooks will not affect already opened mailboxes.
5088 For example, the following creates hooks for the
5089 .Xr gzip 1
5090 compression tool and a combined compressed and encrypted format:
5092 .Bd -literal -offset indent
5093 ? filetype \e
5094     gzip 'gzip -dc' 'gzip -c' \e
5095     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5099 MBOX database files are generally locked during file operations in order
5100 to avoid inconsistencies due to concurrent modifications.
5101 \*(OPal Mailbox files which \*(UA treats as the system
5102 .Va inbox
5103 .Pf ( Ev MAIL ) ,
5105 .Mx -sx
5106 .Sx "primary system mailbox" Ns
5107 es in general will also be protected by so-called dotlock files, the
5108 traditional way of mail spool file locking: for any file
5109 .Ql a
5110 a lock file
5111 .Ql a.lock
5112 will be created for the duration of the synchronization \(em
5113 as necessary a privilege-separated dotlock child process will be used
5114 to accommodate for necessary privilege adjustments in order to create
5115 the dotlock file in the same directory
5116 and with the same user and group identities as the file of interest.
5117 Possible dotlock creation errors can be catched by setting
5118 .Va dotlock-ignore-error .
5121 \*(UA by default uses tolerant POSIX rules when reading MBOX database
5122 files, but it will detect invalid message boundaries in this mode and
5123 complain (even more with
5124 .Va debug )
5125 if any is seen: in this case
5126 .Va mbox-rfc4155
5127 can be used to create a valid MBOX database from the invalid input.
5130 If no protocol has been fixated, and
5131 .Ar name
5132 refers to a directory with the subdirectories
5133 .Ql tmp ,
5134 .Ql new
5136 .Ql cur ,
5137 then it is treated as a folder in
5138 .Dq Maildir
5139 format.
5140 The maildir format stores each message in its own file, and has been
5141 designed so that file locking is not necessary when reading or writing
5142 files.
5145 \*(ID If no protocol has been fixated and no existing file has
5146 been found, the variable
5147 .Va newfolders
5148 controls the format of mailboxes yet to be created.
5153 .It Ic filetype , unfiletype
5154 \*(NQ Define or list, and remove, respectively, file handler hooks,
5155 which provide (shell) commands that enable \*(UA to load and save MBOX
5156 files from and to files with the registered file extensions;
5157 it will use an intermediate temporary file to store the plain data.
5158 The latter command removes the hooks for all given extensions,
5159 .Ql *
5160 will remove all existing handlers.
5162 When used without arguments the former shows a list of all currently
5163 defined file hooks, with one argument the expansion of the given alias.
5164 Otherwise three arguments are expected, the first specifying the file
5165 extension for which the hook is meant, and the second and third defining
5166 the load- and save commands, respectively, to deal with the file type,
5167 both of which must read from standard input and write to standard
5168 output.
5169 Changing hooks will not affect already opened mailboxes (\*(ID except below).
5170 \*(ID For now too much work is done, and files are oftened read in twice
5171 where once would be sufficient: this can cause problems if a filetype is
5172 changed while such a file is opened; this was already so with the
5173 built-in support of .gz etc. in Heirloom, and will vanish in v15.
5174 \*(ID For now all handler strings are passed to the
5175 .Ev SHELL for evaluation purposes; in the future a
5176 .Ql \&!
5177 prefix to load and save commands may mean to bypass this shell instance:
5178 placing a leading space will avoid any possible misinterpretations.
5179 .Bd -literal -offset indent
5180 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
5181     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
5182     zst 'zstd -dc' 'zstd -19 -zc' \e
5183     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5184 ? set record=+sent.zst.pgp
5189 .It Ic flag , unflag
5190 Take message lists and mark the messages as being flagged, or not being
5191 flagged, respectively, for urgent/special attention.
5192 See the section
5193 .Sx "Message states" .
5196 .It Ic folder
5197 (fold) The same as
5198 .Ic file .
5201 .It Ic folders
5202 With no arguments, list the names of the folders in the folder directory.
5203 With an existing folder as an argument,
5204 lists the names of folders below the named folder.
5207 .It Ic Followup
5208 (F) Similar to
5209 .Ic Respond ,
5210 but saves the message in a file named after the local part of the first
5211 recipient's address (instead of in
5212 .Va record Ns ).
5215 .It Ic followup
5216 (fo) Similar to
5217 .Ic respond ,
5218 but saves the message in a file named after the local part of the first
5219 recipient's address (instead of in
5220 .Va record Ns ).
5223 .It Ic followupall
5224 Similar to
5225 .Ic followup ,
5226 but responds to all recipients regardless of the
5227 .Va flipr
5228 variable.
5231 .It Ic followupsender
5232 Similar to
5233 .Ic Followup ,
5234 but responds to the sender only regardless of the
5235 .Va flipr
5236 variable.
5239 .It Ic Forward
5240 Similar to
5241 .Ic forward ,
5242 but saves the message in a file named after the local part of the
5243 recipient's address (instead of in
5244 .Va record Ns ).
5247 .It Ic forward
5248 Takes a message and the address of a recipient
5249 and forwards the message to him.
5250 The text of the original message is included in the new one,
5251 with the value of the
5252 .Va forward-inject-head
5253 variable preceding it.
5254 To filter the included header fields to the desired subset use the
5255 .Ql forward
5256 slot of the white- and blacklisting command
5257 .Ic headerpick .
5258 Only the first part of a multipart message is included unless
5259 .Va forward-as-attachment ,
5260 and recipient addresses will be stripped from comments, names
5261 etc. unless the internal variable
5262 .Va fullnames
5263 is set.
5265 This may generate the errors
5266 .Va ^ERR Ns -DESTADDRREQ
5267 if no receiver has been specified,
5268 .Va ^ERR Ns -PERM
5269 if some addressees where rejected by
5270 .Va expandaddr ,
5271 .Va ^ERR Ns -NODATA
5272 if no applicable messages have been given,
5273 .Va ^ERR Ns -NOTSUP
5274 if multiple messages have been specified,
5275 .Va ^ERR Ns -IO
5276 if an I/O error occurs,
5277 .Va ^ERR Ns -NOTSUP
5278 if a necessary character set conversion fails, and
5279 .Va ^ERR Ns -INVAL
5280 for other errors.
5283 .It Ic from
5284 (f) Takes a list of message specifications and displays a summary of
5285 their message headers, exactly as via
5286 .Ic headers ,
5287 making the first message of the result the new
5288 .Dq dot
5289 (the last message if
5290 .Va showlast
5291 is set).
5292 An alias of this command is
5293 .Ic search .
5294 Also see
5295 .Sx "Specifying messages" .
5297 .It Ic Fwd
5298 \*(OB Alias for
5299 .Ic Forward .
5301 .It Ic fwd
5302 \*(OB Alias for
5303 .Ic forward .
5305 .It Ic fwdignore
5306 \*(OB Superseded by the multiplexer
5307 .Ic headerpick .
5309 .It Ic fwdretain
5310 \*(OB Superseded by the multiplexer
5311 .Ic headerpick .
5313 .It Ic ghost , unghost
5314 \*(OB Replaced by
5315 .Ic commandalias ,
5316 .Ic uncommandalias .
5320 .It Ic headerpick , unheaderpick
5321 \*(NQ Multiplexer command to manage white- and blacklisting
5322 selections of header fields for a variety of applications.
5323 Without arguments the set of contexts that have settings is displayed.
5324 When given arguments, the first argument is the context to which the
5325 command applies, one of (case-insensitive)
5326 .Ql type
5327 for display purposes (via, e.g.,
5328 .Ic type ) ,
5329 .Ql save
5330 for selecting which headers shall be stored persistently when
5331 .Ic save ,
5332 .Ic copy ,
5333 .Ic move
5334 or even
5335 .Ic decrypt Ns
5336 ing messages (note that MIME related etc. header fields should not be
5337 ignored in order to not destroy usability of the message in this case),
5338 .Ql forward
5339 for stripping down messages when
5340 .Ic forward Ns
5341 ing message (has no effect if
5342 .Va forward-as-attachment
5343 is set), and
5344 .Ql top
5345 for defining user-defined set of fields for the command
5346 .Ic top .
5348 The current settings of the given context are displayed if it is the
5349 only argument.
5350 A second argument denotes the type of restriction that is to be chosen,
5351 it may be (a case-insensitive prefix of)
5352 .Ql retain
5354 .Ql ignore
5355 for white- and blacklisting purposes, respectively.
5356 Establishing a whitelist suppresses inspection of the corresponding
5357 blacklist.
5359 If no further argument is given the current settings of the given type
5360 will be displayed, otherwise the remaining arguments specify header
5361 fields, which \*(OPally may be given as regular expressions, to be added
5362 to the given type.
5363 The special wildcard field (asterisk,
5364 .Ql * )
5365 will establish a (fast) shorthand setting which covers all fields.
5367 The latter command always takes three or more arguments and can be used
5368 to remove selections, i.e., from the given context, the given type of
5369 list, all the given headers will be removed, the special argument
5370 .Ql *
5371 will remove all headers.
5374 .It Ic headers
5375 (h) Show the current group of headers, the size of which depends on
5376 the variable
5377 .Va screen ,
5378 and the style of which can be adjusted with the variable
5379 .Va headline .
5380 If a message-specification is given the group of headers containing the
5381 first message therein is shown and the message at the top of the screen
5382 becomes the new
5383 .Dq dot ;
5384 the last message is targeted if
5385 .Va showlast
5386 is set.
5389 .It Ic help
5390 (hel) A synonym for
5391 .Ic \&? .
5394 .It Ic history
5395 \*(OP Without arguments or when given
5396 .Cm show
5397 all history entries are shown (this mode also supports a more
5398 .Va verbose
5399 output).
5400 .Cm load
5401 will replace the list of entries with the content of
5402 .Va history-file ,
5404 .Cm save
5405 will dump the current list to said file, replacing former content.
5406 .Cm clear
5407 will delete all history entries.
5408 The argument can also be a signed decimal
5409 .Ar NUMBER ,
5410 which will select and evaluate the respective history entry, and move it
5411 to the top of the history; a negative number is used as an offset to the
5412 current command, e.g.,
5413 .Ql -1
5414 will select the last command, the history top.
5415 Please see
5416 .Sx "On terminal control and line editor"
5417 for more on this topic.
5420 .It Ic hold
5421 (ho, also
5422 .Ic preserve )
5423 Takes a message list and marks each message therein to be saved in the
5424 user's system
5425 .Va inbox
5426 instead of in the
5427 .Mx -sx
5428 .Sx "secondary mailbox"
5429 .Ev MBOX .
5430 Does not override the
5431 .Ic delete
5432 command.
5433 \*(UA deviates from the POSIX standard with this command, because a
5434 .Ic next
5435 command issued after
5436 .Ic hold
5437 will display the following message, not the current one.
5441 .It Ic if
5442 (i) Part of the nestable
5443 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
5444 conditional execution construct \(em if the given condition is true then
5445 the encapsulated block is executed.
5446 The POSIX standards supports the (case-insensitive) conditions
5447 .Ql r Ns
5448 eceive
5450 .Ql s Ns
5451 end, all remaining conditions are non-portable extensions.
5452 \*(ID These commands do not yet use
5453 .Sx "Shell-style argument quoting"
5454 and therefore do not know about input tokens, so that syntax
5455 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5456 all conditions bracket group wise and consider the tokens, representing
5457 values and operators, therein, which also means that variables will
5458 already have been expanded at that time (just like in the shell).
5460 .Bd -literal -offset indent
5461 if receive
5462   commands ...
5463 else
5464   commands ...
5465 endif
5469 The (case-insensitive) condition
5470 .Ql t Ns
5471 erminal will evaluate to true if the standard input is a terminal, i.e.,
5472 in interactive sessions.
5473 Another condition can be any boolean value (see the section
5474 .Sx "INTERNAL VARIABLES"
5475 for textual boolean representations) to mark an enwrapped block as
5476 .Dq never execute
5478 .Dq always execute .
5479 (It shall be remarked that a faulty condition skips all branches until
5480 .Ic endif . )
5483 (\*(ID In v15
5484 .Sx "Shell-style argument quoting"
5485 will be used, and this command will simply interpret expanded tokens.)
5486 It is possible to check
5487 .Sx "INTERNAL VARIABLES"
5488 as well as
5489 .Sx ENVIRONMENT
5490 variables for existence or compare their expansion against a user given
5491 value or another variable by using the
5492 .Ql $
5493 .Pf ( Dq variable next )
5494 conditional trigger character;
5495 a variable on the right hand side may be signalled using the same
5496 mechanism.
5497 Variable names may be enclosed in a pair of matching braces.
5498 When this mode has been triggered, several operators are available:
5501 Integer operators treat the arguments on the left and right hand side of
5502 the operator as integral numbers and compare them arithmetically.
5503 It is an error if any of the operands is not a valid integer, an empty
5504 argument (which implies it had been quoted) is treated as if it were 0.
5505 Available operators are
5506 .Ql -lt
5507 (less than),
5508 .Ql -le
5509 (less than or equal to),
5510 .Ql -eq
5511 (equal),
5512 .Ql -ne
5513 (not equal),
5514 .Ql -ge
5515 (greater than or equal to), and
5516 .Ql -gt
5517 (greater than).
5520 String data operators compare the left and right hand side according to
5521 their textual content.
5522 Unset variables are treated as the empty string.
5523 The behaviour of string operators can be adjusted by prefixing the
5524 operator with the modifier trigger commercial at
5525 .Ql @ ,
5526 followed by none to multiple modifiers: for now supported is
5527 .Ql i ,
5528 which turns the comparison into a case-insensitive one: this is
5529 implied if no modifier follows the trigger.
5532 Available string operators are
5533 .Ql <
5534 (less than),
5535 .Ql <=
5536 (less than or equal to),
5537 .Ql ==
5538 (equal),
5539 .Ql !=
5540 (not equal),
5541 .Ql >=
5542 (greater than or equal to),
5543 .Ql >
5544 (greater than),
5545 .Ql =%
5546 (is substring of) and
5547 .Ql !%
5548 (is not substring of).
5549 By default these operators work on bytes and (therefore) do not take
5550 into account character set specifics.
5551 If the case-insensitivity modifier has been used, case is ignored
5552 according to the rules of the US-ASCII encoding, i.e., bytes are
5553 still compared.
5556 When the \*(OPal regular expression support is available, the additional
5557 string operators
5558 .Ql =~
5560 .Ql !~
5561 can be used.
5562 They treat the right hand side as an extended regular expression that is
5563 matched according to the active locale (see
5564 .Sx "Character sets" ) ,
5565 i.e., character sets should be honoured correctly.
5568 Conditions can be joined via AND-OR lists (where the AND operator is
5569 .Ql &&
5570 and the OR operator is
5571 .Ql || ) ,
5572 which have equal precedence and will be evaluated with left
5573 associativity, thus using the same syntax that is known for the
5574 .Xr sh 1 .
5575 It is also possible to form groups of conditions and lists by enclosing
5576 them in pairs of brackets
5577 .Ql [\ \&.\&.\&.\ ] ,
5578 which may be interlocked within each other, and also be joined via
5579 AND-OR lists.
5582 The results of individual conditions and entire groups may be modified
5583 via unary operators: the unary operator
5584 .Ql \&!
5585 will reverse the result.
5587 .Bd -literal -offset indent
5588 # (This not in v15, there [ -n "$debug"]!)
5589 if $debug
5590   echo *debug* is set
5591 endif
5592 if [ "$ttycharset" == UTF-8 ] || \e
5593     [ "$ttycharset" @i== UTF8 ]
5594   echo *ttycharset* is UTF-8, the former case-sensitive!
5595 endif
5596 set t1=one t2=one
5597 if [ "${t1}" == "${t2}" ]
5598   echo These two variables are equal
5599 endif
5600 if [ "$features" =% +regex ] && \e
5601     [ "$TERM" @i=~ "^xterm\&.*" ]
5602   echo ..in an X terminal
5603 endif
5604 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5605     [ "$verbose" != '' ] ] ]
5606   echo Noisy, noisy
5607 endif
5608 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5609   echo Left associativity, as is known from the shell
5610 endif
5615 .It Ic ignore
5616 (ig) Identical to
5617 .Ic discard .
5618 Superseded by the multiplexer
5619 .Ic headerpick .
5622 .It Ic list
5623 Shows the names of all available commands, alphabetically sorted.
5624 If given any non-whitespace argument the list will be shown in the order
5625 in which command prefixes are searched.
5626 \*(OP In conjunction with a set variable
5627 .Va verbose
5628 additional information will be provided for each command: the argument
5629 type will be indicated, the documentation string will be shown,
5630 and the set of command flags will show up:
5632 .Bl -tag -compact -width ".It Ql NEEDS_BOX"
5633 .It Ql "`local'"
5634 command supports the command modifier
5635 .Cm local .
5636 .It Ql "`vput'"
5637 command supports the command modifier
5638 .Cm vput .
5639 .It Ql "*!*"
5640 the error number is tracked in
5641 .Va \&! .
5642 .It Ql "needs box"
5643 commands needs an active mailbox, a
5644 .Ic file .
5645 .It Ql "ok: batch/interactive"
5646 command may only be used in interactive or
5647 .Fl #
5648 batch mode.
5649 .It Ql "ok: send mode"
5650 command can be used in send mode.
5651 .It Ql "not ok: compose mode"
5652 command is not available when in compose mode.
5653 .It Ql "not ok: startup"
5654 command cannot be used during program startup, e.g., while loading
5655 .Sx "Resource files" .
5656 .It Ql "ok: subprocess"
5657 command is allowed to be used when running in a subprocess instance,
5658 e.g., from within a macro that is called via
5659 .Va on-compose-splice .
5660 .It Ql "gabby"
5661 The command produces
5662 .Va history-gabby
5663 .Ic history
5664 entries.
5669 .It Ic localopts
5670 This command can be used to localize changes to (linked)
5671 .Sx ENVIRONMENT
5672 as well as (global)
5673 .Sx "INTERNAL VARIABLES" ,
5674 meaning that their state will be reverted to the former one once the
5675 .Dq covered scope
5676 is left.
5677 Just like the command modifier
5678 .Cm local ,
5679 which provides block-scope localization for some commands (instead),
5680 it can only be used inside of macro definition blocks introduced by
5681 .Ic account
5683 .Ic define .
5684 The covered scope of an
5685 .Ic account
5686 is left once a different account is activated, and some macros, notably
5687 .Va folder-hook Ns s ,
5688 use their own specific notion of covered scope, here it will be extended
5689 until the folder is left again.
5692 This setting stacks up: i.e., if
5693 .Ql macro1
5694 enables change localization and calls
5695 .Ql macro2 ,
5696 which explicitly resets localization, then any value changes within
5697 .Ql macro2
5698 will still be reverted when the scope of
5699 .Ql macro1
5700 is left.
5701 (Caveats: if in this example
5702 .Ql macro2
5703 changes to a different
5704 .Ic account
5705 which sets some variables that are already covered by localizations,
5706 their scope will be extended, and in fact leaving the
5707 .Ic account
5708 will (thus) restore settings in (likely) global scope which actually
5709 were defined in a local, macro private context!)
5712 This command takes one or two arguments, the optional first one
5713 specifies an attribute that may be one of
5714 .Cm \&\&scope ,
5715 which refers to the current scope and is thus the default,
5716 .Cm call ,
5717 which causes any macro that is being
5718 .Ic call Ns
5719 ed to be started with localization enabled by default, as well as
5720 .Cm call-fixate ,
5721 which (if enabled) disallows any called macro to turn off localization:
5722 like this it can be ensured that once the current scope regains control,
5723 any changes made in deeper levels have been reverted.
5724 The latter two are mutually exclusive, and neither affects
5725 .Ic xcall .
5726 The (second) argument is interpreted as a boolean (string, see
5727 .Sx "INTERNAL VARIABLES" )
5728 and states whether the given attribute shall be turned on or off.
5730 .Bd -literal -offset indent
5731 define temporary_settings {
5732   set possibly_global_option1
5733   localopts on
5734   set localized_option1
5735   set localized_option2
5736   localopts scope off
5737   set possibly_global_option2
5743 .It Ic Lreply
5744 Reply to messages that come in via known
5745 .Pf ( Ic mlist )
5746 or subscribed
5747 .Pf ( Ic mlsubscribe )
5748 mailing lists, or pretend to do so (see
5749 .Sx "Mailing lists" ) :
5750 on top of the usual
5751 .Ic reply
5752 functionality this will actively resort and even remove message
5753 recipients in order to generate a message that is supposed to be sent to
5754 a mailing list.
5755 For example it will also implicitly generate a
5756 .Ql Mail-Followup-To:
5757 header if that seems useful, regardless of the setting of the variable
5758 .Va followup-to .
5759 For more documentation please refer to
5760 .Sx "On sending mail, and non-interactive mode" .
5762 This may generate the errors
5763 .Va ^ERR Ns -DESTADDRREQ
5764 if no receiver has been specified,
5765 .Va ^ERR Ns -PERM
5766 if some addressees where rejected by
5767 .Va expandaddr ,
5768 .Va ^ERR Ns -NODATA
5769 if no applicable messages have been given,
5770 .Va ^ERR Ns -IO
5771 if an I/O error occurs,
5772 .Va ^ERR Ns -NOTSUP
5773 if a necessary character set conversion fails, and
5774 .Va ^ERR Ns -INVAL
5775 for other errors.
5776 Any error stops processing of further messages.
5779 .It Ic Mail
5780 Similar to
5781 .Ic mail ,
5782 but saves the message in a file named after the local part of the first
5783 recipient's address (instead of in
5784 .Va record Ns ).
5787 .It Ic mail
5788 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5789 or asks on standard input if none were given;
5790 then collects the remaining mail content and sends it out.
5791 Unless the internal variable
5792 .Va fullnames
5793 is set recipient addresses will be stripped from comments, names etc.
5794 For more documentation please refer to
5795 .Sx "On sending mail, and non-interactive mode" .
5797 This may generate the errors
5798 .Va ^ERR Ns -DESTADDRREQ
5799 if no receiver has been specified,
5800 .Va ^ERR Ns -PERM
5801 if some addressees where rejected by
5802 .Va expandaddr ,
5803 .Va ^ERR Ns -NODATA
5804 if no applicable messages have been given,
5805 .Va ^ERR Ns -NOTSUP
5806 if multiple messages have been specified,
5807 .Va ^ERR Ns -IO
5808 if an I/O error occurs,
5809 .Va ^ERR Ns -NOTSUP
5810 if a necessary character set conversion fails, and
5811 .Va ^ERR Ns -INVAL
5812 for other errors.
5815 .It Ic mbox
5816 (mb) The given message list is to be sent to the
5817 .Mx -sx
5818 .Sx "secondary mailbox"
5819 .Ev MBOX
5820 when \*(UA is quit; this is the default action unless the variable
5821 .Va hold
5822 is set.
5823 \*(ID This command can only be used in a
5824 .Mx -sx
5825 .Sx "primary system mailbox" .
5829 .It Ic mimetype , unmimetype
5830 Without arguments the content of the MIME type cache will displayed;
5831 a more verbose listing will be produced if either of
5832 .Va debug
5834 .Va verbose
5835 are set.
5836 When given arguments they will be joined, interpreted as shown in
5837 .Sx "The mime.types files"
5838 (also see
5839 .Sx "HTML mail and MIME attachments" ) ,
5840 and the resulting entry will be added (prepended) to the cache.
5841 In any event MIME type sources are loaded first as necessary \(en
5842 .Va mimetypes-load-control
5843 can be used to fine-tune which sources are actually loaded.
5845 The latter command deletes all specifications of the given MIME type, thus
5846 .Ql ? unmimetype text/plain
5847 will remove all registered specifications for the MIME type
5848 .Ql text/plain .
5849 The special name
5850 .Ql *
5851 will discard all existing MIME types, just as will
5852 .Ql reset ,
5853 but which also reenables cache initialization via
5854 .Va mimetypes-load-control .
5858 .It Ic mlist , unmlist
5859 The latter command removes all given mailing lists, the special name
5860 .Ql *
5861 can be used to remove all registered lists.
5862 The former will list all currently defined mailing lists (and their
5863 attributes, if any) when used without arguments; a more verbose listing
5864 will be produced if either of
5865 .Va debug
5867 .Va verbose
5868 are set.
5869 Otherwise all given arguments will be added and henceforth be recognized
5870 as mailing lists.
5871 If the \*(OPal regular expression support is available then any argument
5872 which contains any of the
5873 .Dq magical
5874 regular expression characters
5875 .Ql ^[]*+?|$
5876 (see
5877 .Xr re_format 7 )
5878 will be interpreted as one, which allows matching of many addresses with
5879 a single expression.
5881 .Ic mlsubscribe
5882 pair of commands manages subscription attributes of mailing lists.
5885 .It Ic mimeview
5886 \*(ID Only available in interactive mode, this command allows one to
5887 display MIME parts which require external MIME handler programs to run
5888 which do not integrate in \*(UAs normal
5889 .Ic type
5890 output (see
5891 .Sx "HTML mail and MIME attachments" ) .
5892 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5893 The user will be asked for each non-text part of the given message in
5894 turn whether the registered handler shall be used to display the part.
5898 .It Ic mlsubscribe , unmlsubscribe
5899 The latter command removes the subscription attribute from all given
5900 mailing lists, the special name
5901 .Ql *
5902 can be used to do so for any registered list.
5903 The former will list all currently defined mailing lists which have
5904 a subscription attribute when used without arguments; a more verbose
5905 listing will be produced if either of
5906 .Va debug
5908 .Va verbose
5909 are set.
5910 Otherwise this attribute will be set for all given mailing lists,
5911 newly creating them as necessary (as via
5912 .Ic mlist ) .
5913 Also see
5914 .Va followup-to .
5917 .It Ic Move
5918 Similar to
5919 .Ic move ,
5920 but moves the messages to a file named after the local part of the
5921 sender address of the first message (instead of in
5922 .Va record Ns ).
5925 .It Ic move
5926 Acts like
5927 .Ic copy
5928 but marks the messages for deletion if they were transferred
5929 successfully.
5932 .It Ic More
5933 Like
5934 .Ic more ,
5935 but also displays header fields which would not pass the
5936 .Ic headerpick
5937 selection, and all MIME parts.
5938 Identical to
5939 .Ic Page .
5942 .It Ic more
5943 Invokes the
5944 .Ev PAGER
5945 on the given messages, even in non-interactive mode and as long as the
5946 standard output is a terminal.
5947 Identical to
5948 .Ic page .
5951 .It Ic netrc
5952 \*(OP When used without arguments or if
5953 .Ar show
5954 has been given the content of the
5955 .Pa \*(VN
5956 cache is shown, loading it first as necessary.
5957 If the argument is
5958 .Ar load
5959 then the cache will only be initialized and
5960 .Ar clear
5961 will remove its contents.
5962 Note that \*(UA will try to load the file only once, use
5963 .Ql Ic \&\&netrc Ns \:\0\:clear
5964 to unlock further attempts.
5966 .Va netrc-lookup ,
5967 .Va netrc-pipe
5968 and the section
5969 .Sx "On URL syntax and credential lookup" ;
5970 the section
5971 .Sx "The .netrc file"
5972 documents the file format in detail.
5975 .It Ic newmail
5976 Checks for new mail in the current folder without committing any changes
5977 before.
5978 If new mail is present, a message is shown.
5979 If the
5980 .Va header
5981 variable is set,
5982 the headers of each new message are also shown.
5983 This command is not available for all mailbox types.
5986 .It Ic next
5987 (n) (like
5988 .Ql +
5990 .Dq ENTER )
5991 Goes to the next message in sequence and types it.
5992 With an argument list, types the next matching message.
5995 .It Ic New
5996 Same as
5997 .Ic Unread .
6000 .It Ic new
6001 Same as
6002 .Ic unread .
6005 .It Ic noop
6006 If the current folder is accessed via a network connection, a
6007 .Dq NOOP
6008 command is sent, otherwise no operation is performed.
6011 .It Ic Page
6012 Like
6013 .Ic page ,
6014 but also displays header fields which would not pass the
6015 .Ic headerpick
6016 selection, and all MIME parts.
6017 Identical to
6018 .Ic More .
6021 .It Ic page
6022 Invokes the
6023 .Ev PAGER
6024 on the given messages, even in non-interactive mode and as long as the
6025 standard output is a terminal.
6026 Identical to
6027 .Ic more .
6030 .It Ic Pipe
6031 Like
6032 .Ic pipe
6033 but also pipes header fields which would not pass the
6034 .Ic headerpick
6035 selection, and all parts of MIME
6036 .Ql multipart/alternative
6037 messages.
6040 .It Ic pipe
6041 (pi) Takes a message list and a shell command
6042 and pipes the messages through the command.
6043 Without an argument the current message is piped through the command
6044 given by the
6045 .Va cmd
6046 variable.
6047 If the
6048 .Va page
6049 variable is set,
6050 every message is followed by a formfeed character.
6053 .It Ic preserve
6054 (pre) A synonym for
6055 .Ic hold .
6058 .It Ic Print
6059 (P) Alias for
6060 .Ic Type .
6063 .It Ic print
6064 (p) Research
6066 equivalent of
6067 .Ic type .
6070 .It Ic quit
6071 (q) Terminates the session, saving all undeleted, unsaved messages in
6072 the current
6073 .Mx -sx
6074 .Sx "secondary mailbox"
6075 .Ev MBOX ,
6076 preserving all messages marked with
6077 .Ic hold
6079 .Ic preserve
6080 or never referenced in the system
6081 .Va inbox ,
6082 and removing all other messages from the
6083 .Mx -sx
6084 .Sx "primary system mailbox" .
6085 If new mail has arrived during the session,
6086 the message
6087 .Dq You have new mail
6088 will be shown.
6089 If given while editing a mailbox file with the command line option
6090 .Fl f ,
6091 then the edit file is rewritten.
6092 A return to the shell is effected,
6093 unless the rewrite of edit file fails,
6094 in which case the user can escape with the exit command.
6095 The optional status number argument will be passed through to
6096 .Xr exit 3 .
6097 \*(ID For now it can happen that the given status will be overwritten,
6098 later this will only occur if a later error needs to be reported onto an
6099 otherwise success indicating status.
6102 .It Ic read
6103 \*(NQ Read a line from standard input, or the channel set active via
6104 .Ic readctl ,
6105 and assign the data, which will be split as indicated by
6106 .Va ifs ,
6107 to the given variables.
6108 The variable names are checked by the same rules as documented for
6109 .Cm vput ,
6110 and the same error codes will be seen in
6111 .Va \&! ;
6112 the exit status
6113 .Va \&?
6114 indicates the number of bytes read, it will be
6115 .Ql -1
6116 with the error number
6117 .Va \&!
6118 set to
6119 .Va ^ERR Ns -BADF
6120 in case of I/O errors, or
6121 .Va ^ERR Ns -NONE
6122 upon End-Of-File.
6123 If there are more fields than variables, assigns successive fields to the
6124 last given variable.
6125 If there are less fields than variables, assigns the empty string to the
6126 remains.
6127 .Bd -literal -offset indent
6128 ? read a b c
6129    H  e  l  l  o
6130 ? echo "<$a> <$b> <$c>"
6131 <H> <e> <l  l  o>
6132 ? wysh set ifs=:; read a b c;unset ifs
6133 hey2.0,:"'you    ",:world!:mars.:
6134 ? echo $?/$^ERRNAME / <$a><$b><$c>
6135 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
6139 .It Ic readall
6140 \*(NQ Read anything from standard input, or the channel set active via
6141 .Ic readctl ,
6142 and assign the data to the given variable.
6143 The variable name is checked by the same rules as documented for
6144 .Cm vput ,
6145 and the same error codes will be seen in
6146 .Va \&! ;
6147 the exit status
6148 .Va \&?
6149 indicates the number of bytes read, it will be
6150 .Ql -1
6151 with the error number
6152 .Va \&!
6153 set to
6154 .Va ^ERR Ns -BADF
6155 in case of I/O errors, or
6156 .Va ^ERR Ns -NONE
6157 upon End-Of-File.
6158 \*(ID The input data length is restricted to 31-bits.
6161 .It Ic readctl
6162 \*(NQ Manages input channels for
6163 .Ic read
6165 .Ic readall ,
6166 to be used to avoid complicated or impracticable code, like calling
6167 .Ic \&\&read
6168 from within a macro in non-interactive mode.
6169 Without arguments, or when the first argument is
6170 .Cm show ,
6171 a listing of all known channels is printed.
6172 Channels can otherwise be
6173 .Cm create Ns
6174 d, and existing channels can be
6175 .Cm set
6176 active and
6177 .Cm remove Ns
6178 d by giving the string used for creation.
6180 The channel name is expected to be a file descriptor number, or,
6181 if parsing the numeric fails, an input file name that undergoes
6182 .Sx "Filename transformations" .
6183 E.g. (this example requires a modern shell):
6184 .Bd -literal -offset indent
6185 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
6186   LC_ALL=C \*(uA -R#
6187 hey, you
6188 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
6189   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
6190 hey, you
6193 .It Ic redirect
6194 \*(OB Same as
6195 .Ic resend .
6197 .It Ic Redirect
6198 \*(OB Same as
6199 .Ic Resend .
6202 .It Ic remove
6203 Removes the named files or directories.
6204 .Sx "Filename transformations"
6205 including shell pathname wildcard pattern expansions
6206 .Pf ( Xr glob 7 )
6207 are performed on the arguments.
6208 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
6209 type specific removal will be performed, deleting the complete mailbox.
6210 The user is asked for confirmation in interactive mode.
6213 .It Ic rename
6214 Takes the name of an existing folder
6215 and the name for the new folder
6216 and renames the first to the second one.
6217 .Sx "Filename transformations"
6218 including shell pathname wildcard pattern expansions
6219 .Pf ( Xr glob 7 )
6220 are performed on both arguments.
6221 Both folders must be of the same type.
6224 .It Ic Reply
6225 (R) Replies to only the sender of each message of the given message
6226 list, by using the first message as the template to quote, for the
6227 .Ql Subject:
6228 etc.
6229 .Va flipr
6230 will exchange this command with
6231 .Ic reply .
6232 Unless the internal variable
6233 .Va fullnames
6234 is set the recipient address will be stripped from comments, names etc.
6235 .Ql Reply-To:
6236 headers will be inspected if
6237 .Va reply-to-honour
6238 is set.
6240 This may generate the errors
6241 .Va ^ERR Ns -DESTADDRREQ
6242 if no receiver has been specified,
6243 .Va ^ERR Ns -PERM
6244 if some addressees where rejected by
6245 .Va expandaddr ,
6246 .Va ^ERR Ns -NODATA
6247 if no applicable messages have been given,
6248 .Va ^ERR Ns -IO
6249 if an I/O error occurs,
6250 .Va ^ERR Ns -NOTSUP
6251 if a necessary character set conversion fails, and
6252 .Va ^ERR Ns -INVAL
6253 for other errors.
6256 .It Ic reply
6257 (r) Take a message and group-responds to it by addressing the sender
6258 and all recipients, subject to
6259 .Ic alternates
6260 processing.
6261 .Va followup-to ,
6262 .Va followup-to-honour ,
6263 .Va reply-to-honour
6264 as well as
6265 .Va recipients-in-cc
6266 influence response behaviour.
6267 Unless the internal variable
6268 .Va fullnames
6269 is set recipient addresses will be stripped from comments, names etc.
6271 .Va flipr
6272 is set the commands
6273 .Ic Reply
6275 .Ic reply
6276 are exchanged.
6277 The command
6278 .Ic Lreply
6279 offers special support for replying to mailing lists.
6280 For more documentation please refer to
6281 .Sx "On sending mail, and non-interactive mode" .
6283 This may generate the errors
6284 .Va ^ERR Ns -DESTADDRREQ
6285 if no receiver has been specified,
6286 .Va ^ERR Ns -PERM
6287 if some addressees where rejected by
6288 .Va expandaddr ,
6289 .Va ^ERR Ns -NODATA
6290 if no applicable messages have been given,
6291 .Va ^ERR Ns -IO
6292 if an I/O error occurs,
6293 .Va ^ERR Ns -NOTSUP
6294 if a necessary character set conversion fails, and
6295 .Va ^ERR Ns -INVAL
6296 for other errors.
6297 Any error stops processing of further messages.
6300 .It Ic replyall
6301 Similar to
6302 .Ic reply ,
6303 but initiates a group-reply regardless of the value of
6304 .Va flipr .
6307 .It Ic replysender
6308 Similar to
6309 .Ic Reply ,
6310 but responds to the sender only regardless of the value of
6311 .Va flipr .
6314 .It Ic Resend
6315 Like
6316 .Ic resend ,
6317 but does not add any header lines.
6318 This is not a way to hide the sender's identity,
6319 but useful for sending a message again to the same recipients.
6322 .It Ic resend
6323 Takes a list of messages and a user name
6324 and sends each message to the named user.
6325 .Ql Resent-From:
6326 and related header fields are prepended to the new copy of the message.
6327 Saving in
6328 .Va record
6329 is only performed if
6330 .Va record-resent
6331 is set.
6333 This may generate the errors
6334 .Va ^ERR Ns -DESTADDRREQ
6335 if no receiver has been specified,
6336 .Va ^ERR Ns -PERM
6337 if some addressees where rejected by
6338 .Va expandaddr ,
6339 .Va ^ERR Ns -NODATA
6340 if no applicable messages have been given,
6341 .Va ^ERR Ns -IO
6342 if an I/O error occurs,
6343 .Va ^ERR Ns -NOTSUP
6344 if a necessary character set conversion fails, and
6345 .Va ^ERR Ns -INVAL
6346 for other errors.
6347 Any error stops processing of further messages.
6350 .It Ic Respond
6351 Same as
6352 .Ic Reply .
6355 .It Ic respond
6356 Same as
6357 .Ic reply .
6360 .It Ic respondall
6361 Same as
6362 .Ic replyall .
6365 .It Ic respondsender
6366 Same as
6367 .Ic replysender .
6370 .It Ic retain
6371 (ret) Superseded by the multiplexer
6372 .Ic headerpick .
6375 .It Ic return
6376 Only available inside the scope of a
6377 .Ic define Ns
6378 d macro or an
6379 .Ic account ,
6380 this will stop evaluation of any further macro content, and return
6381 execution control to the caller.
6382 The two optional parameters must be specified as positive decimal
6383 numbers and default to the value 0:
6384 the first argument specifies the signed 32-bit return value (stored in
6385 .Va \&?
6386 \*(ID and later extended to signed 64-bit),
6387 the second the signed 32-bit error number (stored in
6388 .Va \&! ) .
6389 As documented for
6390 .Va \&?
6391 a non-0 exit status may cause the program to exit.
6394 .It Ic Save
6395 (S) Similar to
6396 .Ic save,
6397 but saves the messages in a file named after the local part of the
6398 sender of the first message instead of (in
6399 .Va record
6400 and) taking a filename argument; the variable
6401 .Va outfolder
6402 is inspected to decide on the actual storage location.
6405 .It Ic save
6406 (s) Takes a message list and a filename and appends each message in turn
6407 to the end of the file.
6408 .Sx "Filename transformations"
6409 including shell pathname wildcard pattern expansions
6410 .Pf ( Xr glob 7 )
6411 is performed on the filename.
6412 If no filename is given, the
6413 .Mx -sx
6414 .Sx "secondary mailbox"
6415 .Ev MBOX
6416 is used.
6417 The filename in quotes, followed by the generated character count
6418 is echoed on the user's terminal.
6419 If editing a
6420 .Mx -sx
6421 .Sx "primary system mailbox"
6422 the messages are marked for deletion.
6423 .Sx "Filename transformations"
6424 will be applied.
6425 To filter the saved header fields to the desired subset use the
6426 .Ql save
6427 slot of the white- and blacklisting command
6428 .Ic headerpick .
6430 .It Ic savediscard
6431 \*(OB Superseded by the multiplexer
6432 .Ic headerpick .
6434 .It Ic saveignore
6435 \*(OB Superseded by the multiplexer
6436 .Ic headerpick .
6438 .It Ic saveretain
6439 \*(OB Superseded by the multiplexer
6440 .Ic headerpick .
6443 .It Ic search
6444 Takes a message specification (list) and displays a header summary of
6445 all matching messages, as via
6446 .Ic headers .
6447 This command is an alias of
6448 .Ic from .
6449 Also see
6450 .Sx "Specifying messages" .
6453 .It Ic seen
6454 Takes a message list and marks all messages as having been read.
6459 .It Ic set , unset
6460 (se, \*(NQ uns) The latter command will delete all given global
6461 variables, or only block-scope local ones if the
6462 .Cm local
6463 command modifier has been used.
6464 The former, when used without arguments, will show all
6465 currently known variables, being more verbose if either of
6466 .Va debug
6468 .Va verbose
6469 is set.
6470 Remarks: this list mode will not automatically link-in known
6471 .Sx ENVIRONMENT
6472 variables, but only explicit addressing will, e.g., via
6473 .Ic varshow ,
6474 using a variable in an
6475 .Ic if
6476 condition or a string passed to
6477 .Ic echo ,
6478 explicit
6479 .Ic \&\&set Ns
6480 ting, as well as some program-internal use cases.
6483 Otherwise the given variables (and arguments) are set or adjusted.
6484 Arguments are of the form
6485 .Ql name=value
6486 (no space before or after
6487 .Ql = ) ,
6488 or plain
6489 .Ql name
6490 if there is no value, i.e., a boolean variable.
6491 If a name begins with
6492 .Ql no ,
6493 as in
6494 .Ql set nosave ,
6495 the effect is the same as invoking the
6496 .Ic \&\&unset
6497 command with the remaining part of the variable
6498 .Pf ( Ql unset save ) .
6499 \*(ID In conjunction with the
6500 .Cm wysh
6501 .Pf (or\0 Cm local )
6502 command prefix(es)
6503 .Sx "Shell-style argument quoting"
6504 can be used to quote arguments as necessary.
6505 \*(ID Otherwise quotation marks may be placed around any part of the
6506 assignment statement to quote blanks or tabs.
6509 When operating in global scope any
6510 .Ql name
6511 that is known to map to an environment variable will automatically cause
6512 updates in the program environment (unsetting a variable in the
6513 environment requires corresponding system support) \(em use the command
6514 .Ic environ
6515 for further environmental control.
6516 If the command modifier
6517 .Cm local
6518 has been used to alter the command to work in block-scope all variables
6519 have values (may they be empty), and creation of names which shadow
6520 .Sx "INTERNAL VARIABLES"
6521 is actively prevented (\*(ID shadowing of linked
6522 .Sx ENVIRONMENT
6523 variables and free-form versions of variable chains is not yet detected).
6524 Also see
6525 .Ic varedit ,
6526 .Ic varshow
6527 and the sections
6528 .Sx "INTERNAL VARIABLES"
6530 .Sx ENVIRONMENT .
6532 .Bd -literal -offset indent
6533 ? wysh set indentprefix=' -> '
6534 ? wysh set atab=$'\t' aspace=' ' zero=0
6539 .It Ic shcodec
6540 Apply shell quoting rules to the given raw-data arguments.
6541 Supports
6542 .Cm vput
6543 (see
6544 .Sx "Command modifiers" ) .
6545 The first argument specifies the operation:
6546 .Ar [+]e[ncode]
6548 .Ar d[ecode]
6549 cause shell quoting to be applied to the remains of the line, and
6550 expanded away thereof, respectively.
6551 If the former is prefixed with a plus-sign, the quoted result will not
6552 be roundtrip enabled, and thus can be decoded only in the very same
6553 environment that was used to perform the encode; also see
6554 .Cd mle-quote-rndtrip .
6555 If the coding operation fails the error number
6556 .Va \&!
6557 is set to
6558 .Va ^ERR Ns -CANCELED ,
6559 and the unmodified input is used as the result; the error number may
6560 change again due to output or result storage errors.
6563 .It Ic shell
6564 \*(NQ (sh) Invokes an interactive version of the shell,
6565 and returns its exit status.
6569 .It Ic shortcut , unshortcut
6570 Without arguments the list of all currently defined shortcuts is
6571 shown, with one argument the expansion of the given shortcut.
6572 Otherwise all given arguments are treated as pairs of shortcuts and
6573 their expansions, creating new or changing already existing shortcuts,
6574 as necessary.
6575 The latter command will remove all given shortcuts, the special name
6576 .Ql *
6577 will remove all registered shortcuts.
6580 .It Ic shift
6581 \*(NQ Shift the positional parameter stack (starting at
6582 .Va 1 )
6583 by the given number (which must be a positive decimal),
6584 or 1 if no argument has been given.
6585 It is an error if the value exceeds the number of positional parameters.
6586 If the given number is 0, no action is performed, successfully.
6587 The stack as such can be managed via
6588 .Ic vpospar .
6589 Note this command will fail in
6590 .Ic account
6591 and hook macros unless the positional parameter stack has been
6592 explicitly created in the current context via
6593 .Ic vpospar .
6596 .It Ic show
6597 Like
6598 .Ic type ,
6599 but performs neither MIME decoding nor decryption, so that the raw
6600 message text is shown.
6603 .It Ic size
6604 (si) Shows the size in characters of each message of the given
6605 message-list.
6608 .It Ic sleep
6609 \*(NQ Sleep for the specified number of seconds (and optionally
6610 milliseconds), by default interruptably.
6611 If a third argument is given the sleep will be uninterruptible,
6612 otherwise the error number
6613 .Va \&!
6614 will be set to
6615 .Va ^ERR Ns -INTR
6616 if the sleep has been interrupted.
6617 The command will fail and the error number will be
6618 .Va ^ERR Ns -OVERFLOW
6619 if the given duration(s) overflow the time datatype, and
6620 .Va ^ERR Ns -INVAL
6621 if the given durations are no valid integers.
6626 .It Ic sort , unsort
6627 The latter command disables sorted or threaded mode, returns to normal
6628 message order and, if the
6629 .Va header
6630 variable is set,
6631 displays a header summary.
6632 The former command shows the current sorting criterion when used without
6633 an argument, but creates a sorted representation of the current folder
6634 otherwise, and changes the
6635 .Ic next
6636 command and the addressing modes such that they refer to messages in
6637 the sorted order.
6638 Message numbers are the same as in regular mode.
6639 If the
6640 .Va header
6641 variable is set,
6642 a header summary in the new order is also displayed.
6643 Automatic folder sorting can be enabled by setting the
6644 .Va autosort
6645 variable, as in, e.g.,
6646 .Ql set autosort=thread .
6647 Possible sorting criterions are:
6650 .Bl -tag -compact -width "subject"
6651 .It Ar date
6652 Sort the messages by their
6653 .Ql Date:
6654 field, that is by the time they were sent.
6655 .It Ar from
6656 Sort messages by the value of their
6657 .Ql From:
6658 field, that is by the address of the sender.
6659 If the
6660 .Va showname
6661 variable is set, the sender's real name (if any) is used.
6662 .It Ar size
6663 Sort the messages by their size.
6664 .It spam
6665 \*(OP Sort the message by their spam score, as has been classified by
6666 .Ic spamrate .
6667 .It Ar status
6668 Sort the messages by their message status.
6669 .It Ar subject
6670 Sort the messages by their subject.
6671 .It Ar thread
6672 Create a threaded display.
6673 .It Ar to
6674 Sort messages by the value of their
6675 .Ql To:
6676 field, that is by the address of the recipient.
6677 If the
6678 .Va showname
6679 variable is set, the recipient's real name (if any) is used.
6684 .It Ic source
6685 \*(NQ (so) The source command reads commands from the given file.
6686 .Sx "Filename transformations"
6687 will be applied.
6688 If the given expanded argument ends with a vertical bar
6689 .Ql |
6690 then the argument will instead be interpreted as a shell command and
6691 \*(UA will read the output generated by it.
6692 Dependent on the settings of
6693 .Va posix
6695 .Va errexit ,
6696 and also dependent on whether the command modifier
6697 .Cm ignerr
6698 had been used, encountering errors will stop sourcing of the given input.
6699 \*(ID Note that
6700 .Ic \&\&source
6701 cannot be used from within macros that execute as
6702 .Va folder-hook Ns s
6704 .Ic account Ns s ,
6705 i.e., it can only be called from macros that were
6706 .Ic call Ns ed .
6709 .It Ic source_if
6710 \*(NQ The difference to
6711 .Ic source
6712 (beside not supporting pipe syntax aka shell command input) is that
6713 this command will not generate an error nor warn if the given file
6714 argument cannot be opened successfully.
6717 .It Ic spamclear
6718 \*(OP Takes a list of messages and clears their
6719 .Ql is-spam
6720 flag.
6723 .It Ic spamforget
6724 \*(OP Takes a list of messages and causes the
6725 .Va spam-interface
6726 to forget it has ever used them to train its Bayesian filter.
6727 Unless otherwise noted the
6728 .Ql is-spam
6729 flag of the message is inspected to chose whether a message shall be
6730 forgotten to be
6731 .Dq ham
6733 .Dq spam .
6736 .It Ic spamham
6737 \*(OP Takes a list of messages and informs the Bayesian filter of the
6738 .Va spam-interface
6739 that they are
6740 .Dq ham .
6741 This also clears the
6742 .Ql is-spam
6743 flag of the messages in question.
6746 .It Ic spamrate
6747 \*(OP Takes a list of messages and rates them using the configured
6748 .Va spam-interface ,
6749 without modifying the messages, but setting their
6750 .Ql is-spam
6751 flag as appropriate; because the spam rating headers are lost the rate
6752 will be forgotten once the mailbox is left.
6753 Refer to the manual section
6754 .Sx "Handling spam"
6755 for the complete picture of spam handling in \*(UA.
6758 .It Ic spamset
6759 \*(OP Takes a list of messages and sets their
6760 .Ql is-spam
6761 flag.
6764 .It Ic spamspam
6765 \*(OP Takes a list of messages and informs the Bayesian filter of the
6766 .Va spam-interface
6767 that they are
6768 .Dq spam .
6769 This also sets the
6770 .Ql is-spam
6771 flag of the messages in question.
6773 .It Ic thread
6774 \*(OB The same as
6775 .Ql sort thread
6776 (consider using a
6777 .Ql commandalias
6778 as necessary).
6781 .It Ic Top
6782 Like
6783 .Ic top
6784 but always uses the
6785 .Ic headerpick
6786 .Ql type
6787 slot for white- and blacklisting header fields.
6790 .It Ic top
6791 (to) Takes a message list and types out the first
6792 .Va toplines
6793 lines of each message on the user's terminal.
6794 Unless a special selection has been established for the
6795 .Ql top
6796 slot of the
6797 .Ic headerpick
6798 command, the only header fields that are displayed are
6799 .Ql From: ,
6800 .Ql To: ,
6801 .Ql CC: ,
6803 .Ql Subject: .
6804 .Ic Top
6805 will always use the
6806 .Ql type
6807 .Ic headerpick
6808 selection instead.
6809 It is possible to apply compression to what is displayed by setting
6810 .Va topsqueeze .
6811 Messages are decrypted and converted to the terminal character set
6812 if necessary.
6815 .It Ic touch
6816 (tou) Takes a message list and marks the messages for saving in the
6817 .Mx -sx
6818 .Sx "secondary mailbox"
6819 .Ev MBOX .
6820 \*(UA deviates from the POSIX standard with this command,
6821 as a following
6822 .Ic next
6823 command will display the following message instead of the current one.
6826 .It Ic Type
6827 (T) Like
6828 .Ic type
6829 but also displays header fields which would not pass the
6830 .Ic headerpick
6831 selection, and all visualizable parts of MIME
6832 .Ql multipart/alternative
6833 messages.
6836 .It Ic type
6837 (t) Takes a message list and types out each message on the user's terminal.
6838 The display of message headers is selectable via
6839 .Ic headerpick .
6840 For MIME multipart messages, all parts with a content type of
6841 .Ql text ,
6842 all parts which have a registered MIME type handler (see
6843 .Sx "HTML mail and MIME attachments" )
6844 which produces plain text output, and all
6845 .Ql message
6846 parts are shown, others are hidden except for their headers.
6847 Messages are decrypted and converted to the terminal character set
6848 if necessary.
6849 The command
6850 .Ic mimeview
6851 can be used to display parts which are not displayable as plain text.
6853 .It Ic unaccount
6855 .Ic account .
6857 .It Ic unalias
6858 (una) See
6859 .Ic alias .
6861 .It Ic unanswered
6863 .Ic answered .
6865 .It Ic unbind
6867 .Ic bind .
6869 .It Ic uncollapse
6871 .Ic collapse .
6873 .It Ic uncolour
6875 .Ic colour .
6877 .It Ic undefine
6879 .Ic define .
6881 .It Ic undelete
6883 .Ic delete .
6885 .It Ic undraft
6887 .Ic draft .
6889 .It Ic unflag
6891 .Ic flag .
6893 .It Ic unfwdignore
6894 \*(OB Superseded by the multiplexer
6895 .Ic headerpick .
6897 .It Ic unfwdretain
6898 \*(OB Superseded by the multiplexer
6899 .Ic headerpick .
6902 .It Ic unignore
6903 Superseded by the multiplexer
6904 .Ic headerpick .
6906 .It Ic unmimetype
6908 .Ic mimetype .
6910 .It Ic unmlist
6912 .Ic mlist .
6914 .It Ic unmlsubscribe
6916 .Ic mlsubscribe .
6919 .It Ic Unread
6920 Same as
6921 .Ic unread .
6924 .It Ic unread
6925 Takes a message list and marks each message as not having been read.
6928 .It Ic unretain
6929 Superseded by the multiplexer
6930 .Ic headerpick .
6932 .It Ic unsaveignore
6933 \*(OB Superseded by the multiplexer
6934 .Ic headerpick .
6936 .It Ic unsaveretain
6937 \*(OB Superseded by the multiplexer
6938 .Ic headerpick .
6940 .It Ic unset
6941 \*(NQ (uns) See
6942 .Ic set .
6944 .It Ic unshortcut
6946 .Ic shortcut .
6948 .It Ic unsort
6950 .Ic short .
6952 .It Ic unthread
6953 \*(OB
6954 Same as
6955 .Ic unsort .
6958 .It Ic urlcodec
6959 Perform URL percent codec operations on the raw-data argument, rather
6960 according to RFC 3986.
6961 Supports
6962 .Cm vput
6963 (see
6964 .Sx "Command modifiers" ) ,
6965 and manages the error number
6966 .Va \&! .
6967 This is a character set agnostic and thus locale dependent operation,
6968 and it may decode bytes which are invalid in the current
6969 .Va ttycharset .
6970 \*(ID This command does not know about URLs beside that.
6972 The first argument specifies the operation:
6973 .Ar e[ncode]
6975 .Ar d[ecode]
6976 perform plain URL percent en- and decoding, respectively.
6977 .Ar p[ath]enc[ode]
6979 .Ar p[ath]dec[ode]
6980 perform a slightly modified operation which should be better for
6981 pathnames: it does not allow a tilde
6982 .Ql ~ ,
6983 and will neither accept hyphen-minus
6984 .Ql -
6985 nor dot
6986 .Ql .
6987 as an initial character.
6988 The remains of the line form the URL data which is to be converted.
6989 If the coding operation fails the error number
6990 .Va \&!
6991 is set to
6992 .Va ^ERR Ns -CANCELED ,
6993 and the unmodified input is used as the result; the error number may
6994 change again due to output or result storage errors.
6997 .It Ic varedit
6998 \*(NQ Edit the values of or create the given variable(s) in the
6999 .Ev EDITOR .
7000 Boolean variables cannot be edited, and variables can also not be
7001 .Ic unset
7002 with this command.
7005 .It Ic varshow
7006 \*(NQ This command produces the same output as the listing mode of
7007 .Ic set ,
7008 including
7009 .Va verbose Ns
7010 ity adjustments, but only for the given variables.
7013 .It Ic verify
7014 \*(OP Takes a message list and verifies each message.
7015 If a message is not a S/MIME signed message,
7016 verification will fail for it.
7017 The verification process checks if the message was signed using a valid
7018 certificate,
7019 if the message sender's email address matches one of those contained
7020 within the certificate,
7021 and if the message content has been altered.
7024 .It Ic version
7025 Shows the
7026 .Va version
7028 .Va features
7029 of \*(UA, as well as the build and running system environment.
7030 Supports
7031 .Cm vput
7032 (see
7033 .Sx "Command modifiers" ) .
7037 .It Ic vexpr
7038 \*(NQ Evaluate arguments according to a given operator.
7039 This is a multiplexer command which can be used to perform signed 64-bit
7040 numeric calculations as well as byte string and string operations.
7041 It uses polish notation, i.e., the operator is the first argument and
7042 defines the number and type, and the meaning of the remaining arguments.
7043 An empty argument is replaced with a 0 if a number is expected.
7044 Supports
7045 .Cm vput
7046 (see
7047 .Sx "Command modifiers" ) .
7050 The result that is shown in case of errors is always
7051 .Ql -1
7052 for usage errors and numeric operations, and the empty string for byte
7053 string and string operations;
7054 if the latter two fail to provide result data for
7055 .Dq soft
7056 errors, e.g., when a search operation failed, they also set the
7057 .Va \&!
7058 error number to
7059 .Va ^ERR Ns -NODATA .
7060 Except when otherwise noted numeric arguments are parsed as signed 64-bit
7061 numbers, and errors will be reported in the error number
7062 .Va \&!
7063 as the numeric error
7064 .Va ^ERR Ns -RANGE .
7067 Numeric operations work on one or two signed 64-bit integers.
7068 Numbers prefixed with
7069 .Ql 0x
7071 .Ql 0X
7072 are interpreted as hexadecimal (base 16) numbers, whereas
7073 .Ql 0
7074 indicates octal (base 8), and
7075 .Ql 0b
7076 as well as
7077 .Ql 0B
7078 denote binary (base 2) numbers.
7079 It is possible to use any base in between 2 and 36, inclusive, with the
7080 .Ql BASE#number
7081 notation, where the base is given as an unsigned decimal number, e.g.,
7082 .Ql 16#AFFE
7083 is a different way of specifying a hexadecimal number.
7084 Unsigned interpretation of a number can be enforced by prefixing a
7085 .Ql u
7086 (case-insensitively), e.g.,
7087 .Ql u-110 ;
7088 this is not necessary for power-of-two bases (2, 4, 8, 16 and 32),
7089 which will be interpreted as unsigned by default, but it still makes
7090 a difference regarding overflow detection and overflow constant.
7091 It is possible to enforce signed interpretation by (instead) prefixing a
7092 .Ql s
7093 (case-insensitively).
7096 One integer is expected by assignment (equals sign
7097 .Ql = ) ,
7098 which does nothing but parsing the argument, thus detecting validity and
7099 possible overflow conditions, and unary not (tilde
7100 .Ql ~ ) ,
7101 which creates the bitwise complement.
7102 Two integers are used by addition (plus sign
7103 .Ql + ) ,
7104 subtraction (hyphen-minus
7105 .Ql - ) ,
7106 multiplication (asterisk
7107 .Ql * ) ,
7108 division (solidus
7109 .Ql / )
7110 and modulo (percent sign
7111 .Ql % ) ,
7112 as well as for the bitwise operators logical or (vertical bar
7113 .Ql | ,
7114 to be quoted) ,
7115 bitwise and (ampersand
7116 .Ql \&& ,
7117 to be quoted) ,
7118 bitwise xor (circumflex
7119 .Ql ^ ) ,
7120 the bitwise signed left- and right shifts
7121 .Pf ( Ql << ,
7122 .Ql >> ) ,
7123 as well as for the unsigned right shift
7124 .Ql >>> .
7127 Another numeric operation is
7128 .Cm pbase ,
7129 which takes a number base in between 2 and 36, inclusive, and will act
7130 on the second number given just the same as what equals sign
7131 .Ql =
7132 does, but the number result will be formatted in the base given.
7135 All numeric operators can be prefixed with a commercial at
7136 .Ql @ ,
7137 e.g.,
7138 .Ql @* :
7139 this will turn the operation into a saturated one, which means that
7140 overflow errors and division and modulo by zero are no longer reported
7141 via the exit status, but the result will linger at the minimum or
7142 maximum possible value, instead of overflowing (or trapping).
7143 This is true also for the argument parse step.
7144 For the bitwise shifts, the saturated maximum is 63.
7145 Any catched overflow will be reported via the error number
7146 .Va \&!
7148 .Va ^ERR Ns -OVERFLOW .
7149 .Bd -literal -offset indent
7150 ? vexpr @- +1 -9223372036854775808
7151 ? echo $?/$!/$^ERRNAME
7155 Character set agnostic string functions have no notion of locale
7156 settings and character sets.
7158 .Bl -hang -width ".It Cm random"
7159 .It Cm file-expand
7160 Performs the usual
7161 .Sx "Filename transformations"
7162 on its argument.
7163 .It Cm random
7164 Generates a random string of the given length, or of
7165 .Dv \&\&PATH_MAX
7166 bytes (a constant from
7167 .Pa /usr/include )
7168 if the value 0 is given; the random string will be base64url encoded
7169 according to RFC 4648, and thus be usable as a (portable) filename.
7173 Byte string operations work on 8-bit bytes and have no notion of locale
7174 settings and character sets, effectively assuming ASCII data.
7177 .Bl -hang -width ".It Cm length"
7178 .It Cm length
7179 Queries the length of the given argument.
7181 .It Cm hash
7182 Calculates the Chris Torek hash of the given argument.
7184 .It Cm find
7185 Byte-searches in the first for the second argument.
7186 Shows the resulting 0-based offset shall it have been found.
7188 .It Cm ifind
7189 Identical to
7190 .Cm find ,
7191 but works case-insensitively according to the rules of the ASCII
7192 character set.
7194 .It Cm substring
7195 Creates a substring of its first argument.
7196 The second argument is the 0-based starting offset, a negative one
7197 counts from the end;
7198 the optional third argument specifies the length of the desired result,
7199 a negative length leaves off the given number of bytes at the end of the
7200 original string, by default the entire string is used;
7201 this operation tries to work around faulty arguments (set
7202 .Va verbose
7203 for error logs), but reports them via the error number
7204 .Va \&!
7206 .Va ^ERR Ns -OVERFLOW .
7208 .It Cm trim
7209 Trim away whitespace characters from both ends of the argument.
7211 .It Cm trim-front
7212 Trim away whitespace characters from the begin of the argument.
7214 .It Cm trim-end
7215 Trim away whitespace characters from the end of the argument.
7220 String operations work, sufficient support provided, according to the
7221 active user's locale encoding and character set (see
7222 .Sx "Character sets" ) .
7225 .Bl -hang -width ".It Cm regex"
7226 .It Cm makeprint
7227 (One-way) Converts the argument to something safely printable on the
7228 terminal.
7230 .It Cm regex
7231 \*(OP A string operation that will try to match the first argument with
7232 the regular expression given as the second argument.
7233 If the optional third argument has been given then instead of showing
7234 the match offset a replacement operation is performed: the third
7235 argument is treated as if specified within dollar-single-quote (see
7236 .Sx "Shell-style argument quoting" ) ,
7237 and any occurrence of a positional parameter, e.g.,
7238 .Va 1 ,
7239 is replaced by the corresponding match group of the regular expression:
7240 .Bd -literal -offset indent
7241 ? vput vexpr res regex bananarama \e
7242     (.*)NanA(.*) '\e${1}au\e$2'
7243 ? echo $?/$!/$^ERRNAME: $res
7246 .It Cm iregex
7247 On otherwise identical case-insensitive equivalent to
7248 .Cm regex :
7249 .Bd -literal -offset indent
7250 ? vput vexpr res ire bananarama \e
7251     (.*)NanA(.*) '\e${1}au\e$2'
7252 ? echo $?/$!/$^ERRNAME: $res
7258 .It Ic vpospar
7259 \*(NQ Manage the positional parameter stack (see
7260 .Va 1 , # , * , @
7261 as well as
7262 .Ic shift ) .
7263 If the first argument is
7264 .Ql clear ,
7265 then the positional parameter stack of the current context, or the
7266 global one, if there is none, is cleared.
7267 If it is
7268 .Ql set ,
7269 then the remaining arguments will be used to (re)create the stack,
7270 if the parameter stack size limit is excessed an
7271 .Va ^ERR Ns -OVERFLOW
7272 error will occur.
7275 If the first argument is
7276 .Ql quote ,
7277 a round-trip capable representation of the stack contents is created,
7278 with each quoted parameter separated from each other with the first
7279 character of
7280 .Va ifs ,
7281 and followed by the first character of
7282 .Va if-ws ,
7283 if that is not empty and not identical to the first.
7284 If that results in no separation at all a
7285 .Cm space
7286 character is used.
7287 This mode supports
7288 .Cm vput
7289 (see
7290 .Sx "Command modifiers" ) .
7291 I.e., the subcommands
7292 .Ql set
7294 .Ql quote
7295 can be used (in conjunction with
7296 .Ic eval )
7297 to (re)create an argument stack from and to a single variable losslessly.
7299 .Bd -literal -offset indent
7300 ? vpospar set hey, "'you    ", world!
7301 ? echo $#: <${1}><${2}><${3}>
7302 ? vput vpospar x quote
7303 ? vpospar clear
7304 ? echo $#: <${1}><${2}><${3}>
7305 ? eval vpospar set ${x}
7306 ? echo $#: <${1}><${2}><${3}>
7311 .It Ic visual
7312 (v) Takes a message list and invokes the
7313 .Ev VISUAL
7314 display editor on each message.
7315 Modified contents are discarded unless the
7316 .Va writebackedited
7317 variable is set, and are not used unless the mailbox can be written to
7318 and the editor returns a successful exit status.
7319 .Ic edit
7320 can be used instead for a less display oriented editor.
7323 .It Ic write
7324 (w) For conventional messages the body without all headers is written.
7325 The original message is never marked for deletion in the originating
7326 mail folder.
7327 The output is decrypted and converted to its native format as necessary.
7328 If the output file exists, the text is appended.
7329 If a message is in MIME multipart format its first part is written to
7330 the specified file as for conventional messages, handling of the remains
7331 depends on the execution mode.
7332 No special handling of compressed files is performed.
7334 In interactive mode the user is consecutively asked for the filenames of
7335 the processed parts.
7336 For convience saving of each part may be skipped by giving an empty
7337 value, the same result as writing it to
7338 .Pa /dev/null .
7339 Shell piping the part content by specifying a leading vertical bar
7340 .Ql |
7341 character for the filename is supported.
7342 Other user input undergoes the usual
7343 .Sx "Filename transformations" ,
7344 including shell pathname wildcard pattern expansions
7345 .Pf ( Xr glob 7 )
7346 and shell variable expansion for the message as such, not the individual
7347 parts, and contents of the destination file are overwritten if the file
7348 previously existed.
7350 \*(ID In non-interactive mode any part which does not specify a filename
7351 is ignored, and suspicious parts of filenames of the remaining parts are
7352 URL percent encoded (as via
7353 .Ic urlcodec )
7354 to prevent injection of malicious character sequences, resulting in
7355 a filename that will be written into the current directory.
7356 Existing files will not be overwritten, instead the part number or
7357 a dot are appended after a number sign
7358 .Ql #
7359 to the name until file creation succeeds (or fails due to other
7360 reasons).
7363 .It Ic xcall
7364 \*(NQ The sole difference to
7365 .Ic call
7366 is that the new macro is executed in place of the current one, which
7367 will not regain control: all resources of the current macro will be
7368 released first.
7369 This implies that any setting covered by
7370 .Ic localopts
7371 will be forgotten and covered variables will become cleaned up.
7372 If this command is not used from within a
7373 .Ic call Ns
7374 ed macro it will silently be (a more expensive variant of)
7375 .Ic call .
7378 .It Ic xit
7379 (x) A synonym for
7380 .Ic exit .
7383 .It Ic z
7384 \*(NQ \*(UA presents message headers in
7385 .Va screen Ns
7386 fuls as described under the
7387 .Ic headers
7388 command.
7389 Without arguments this command scrolls to the next window of messages,
7390 likewise if the argument is
7391 .Ql + .
7392 An argument of
7393 .Ql -
7394 scrolls to the last,
7395 .Ql ^
7396 scrolls to the first, and
7397 .Ql $
7398 to the last
7399 .Va \&\&screen
7400 of messages.
7401 A number argument prefixed by
7402 .Ql +
7404 .Ql \-
7405 indicates that the window is calculated in relation to the current
7406 position, and a number without a prefix specifies an absolute position.
7409 .It Ic Z
7410 \*(NQ Similar to
7411 .Ic z ,
7412 but scrolls to the next or previous window that contains at least one
7413 .Ql new
7415 .Ic flag Ns
7416 ged message.
7418 .\" }}}
7420 .\" }}}
7423 .\" .Sh COMMAND ESCAPES {{{
7424 .Sh "COMMAND ESCAPES"
7426 Here is a summary of the command escapes available in compose mode,
7427 which are used to perform special functions when composing messages.
7428 Command escapes are only recognized at the beginning of lines, and
7429 consist of a trigger (escape) and a command character.
7430 The actual escape character can be set via the internal variable
7431 .Va escape ,
7432 it defaults to the tilde
7433 .Ql ~ .
7434 Otherwise ignored whitespace characters following the escape character
7435 will prevent a possible addition of the command line to the \*(OPal
7436 history.
7439 Unless otherwise noted all compose mode command escapes ensure proper
7440 updates of the variables which represent the error number
7441 .Va \&!
7442 and the exit status
7443 .Va \&? .
7444 If the variable
7445 .Va errexit
7446 is set they will, unless stated otherwise, error out message compose
7447 mode and cause a program exit if an operation fails.
7448 It is however possible to place the character hyphen-minus
7449 .Ql -
7450 after (possible whitespace following) the escape character, which has an
7451 effect equivalent to the command modifier
7452 .Cm ignerr .
7453 If the \*(OPal key bindings are available it is possible to create
7454 .Ic bind Ns
7455 ings specifically for the compose mode.
7458 .Bl -tag -width ".It Ic BaNg"
7460 .It Ic ~~ Ar string
7461 Insert the string of text in the message prefaced by a single
7462 .Ql ~ .
7463 (If the escape character has been changed,
7464 that character must be doubled instead.)
7467 .It Ic ~! Ar command
7468 Execute the indicated shell
7469 .Ar command
7470 which follows, replacing unescaped exclamation marks with the previously
7471 executed command if the internal variable
7472 .Va bang
7473 is set, then return to the message.
7476 .It Ic ~.
7477 End compose mode and send the message.
7478 The hooks
7479 .Va on-compose-splice-shell
7481 .Va on-compose-splice ,
7482 in order, will be called when set, after which
7483 .Va askatend
7484 will be checked, a set
7485 .Va on-compose-leave
7486 hook will be called,
7487 .Va autocc
7489 .Va autobcc
7490 will be joined in if set,
7491 .Va asksend
7492 will be honoured in interactive mode, finally a given
7493 .Va message-inject-tail
7494 will be incorporated, after which the compose mode is left.
7497 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
7498 Execute the given \*(UA command.
7499 Not all commands, however, are allowed.
7502 .It Ic ~< Ar filename
7503 Identical to
7504 .Ic ~r .
7507 .It Ic ~<! Ar command
7508 .Ar command
7509 is executed using the shell.
7510 Its standard output is inserted into the message.
7513 .It Ic ~?
7514 \*(OP Write a summary of command escapes.
7517 .It Ic ~@ Op Ar filename...
7518 Append or edit the list of attachments.
7519 Does not manage the error number
7520 .Va \&!
7521 and the exit status
7522 .Va \&? ,
7523 (please use
7524 .Ic ~^
7525 instead if this is a concern).
7526 A list of
7527 .Ar filename
7528 arguments is expected as shell tokens (see
7529 .Sx "Shell-style argument quoting" ;
7530 token-separating commas are ignored, too), to be
7531 interpreted as documented for the command line option
7532 .Fl a ,
7533 with the message number exception as below.
7535 Without
7536 .Ar filename
7537 arguments the attachment list is edited, entry by entry;
7538 if a filename is left empty, that attachment is deleted from the list;
7539 once the end of the list is reached either new attachments may be
7540 entered or the session can be quit by committing an empty
7541 .Dq new
7542 attachment.
7543 In non-interactive mode or in batch mode
7544 .Pf ( Fl # ) ,
7545 the list of attachments is effectively not edited but instead recreated;
7546 again, an empty input ends list creation.
7548 For all modes, if a given filename solely consists of the number sign
7549 .Ql #
7550 followed by a valid message number of the currently active mailbox, then
7551 the given message is attached as a
7552 .Ql message/rfc822
7553 MIME message part.
7554 The number sign must be quoted to avoid misinterpretation with the shell
7555 comment character.
7558 .It Ic ~| Ar command
7559 Pipe the message through the specified filter command.
7560 If the command gives no output or terminates abnormally,
7561 retain the original text of the message.
7562 E.g., the command
7563 .Xr fmt 1
7564 is often used as a rejustifying filter.
7568 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7569 Low-level command meant for scripted message access, i.e., for
7570 .Va on-compose-splice
7572 .Va on-compose-splice-shell .
7573 The used protocol is likely subject to changes, and therefore the
7574 mentioned hooks receive the used protocol version as an initial line.
7575 In general the first field of a response line represents a status code
7576 which specifies whether a command was successful or not, whether result
7577 data is to be expected, and if, the format of the result data.
7578 Does not manage the error number
7579 .Va \&!
7580 and the exit status
7581 .Va \&? ,
7582 because errors are reported via the protocol
7583 (hard errors like I/O failures cannot be handled).
7584 This command has read-only access to several virtual pseudo headers in
7585 the \*(UA private namespace, which may not exist (except for the first):
7589 .Bl -tag -compact -width ".It Va BaNg"
7590 .It Ql Mailx-Command:
7591 The name of the command that generates the message, one of
7592 .Ql forward ,
7593 .Ql Lreply ,
7594 .Ql mail ,
7595 .Ql Reply ,
7596 .Ql reply ,
7597 .Ql resend .
7599 .It Ql Mailx-Raw-To:
7600 .It Ql Mailx-Raw-Cc:
7601 .It Ql Mailx-Raw-Bcc:
7602 Represent the frozen initial state of these headers before any
7603 transformation (e.g.,
7604 .Ic alias ,
7605 .Ic alternates ,
7606 .Va recipients-in-cc
7607 etc.) took place.
7609 .It Ql Mailx-Orig-From:
7610 .It Ql Mailx-Orig-To:
7611 .It Ql Mailx-Orig-Cc:
7612 .It Ql Mailx-Orig-Bcc:
7613 The values of said headers of the original message which has been
7614 addressed by any of
7615 .Ic reply , forward , resend .
7619 The status codes are:
7623 .Bl -tag -compact -width ".It Ql 210"
7624 .It Ql 210
7625 Status ok; the remains of the line are the result.
7627 .It Ql 211
7628 Status ok; the rest of the line is optionally used for more status.
7629 What follows are lines of result addresses, terminated by an empty line.
7630 The address lines consist of two fields, the first of which is the
7631 plain address, e.g.,
7632 .Ql bob@exam.ple ,
7633 separated by a single ASCII SP space from the second which contains the
7634 unstripped address, even if that is identical to the first field, e.g.,
7635 .Ql (Lovely) Bob <bob@exam.ple> .
7636 All the input, including the empty line, must be consumed before further
7637 commands can be issued.
7639 .It Ql 212
7640 Status ok; the rest of the line is optionally used for more status.
7641 What follows are lines of furtherly unspecified string content,
7642 terminated by an empty line.
7643 All the input, including the empty line, must be consumed before further
7644 commands can be issued.
7646 .It Ql 500
7647 Syntax error; invalid command.
7649 .It Ql 501
7650 Syntax error in parameters or arguments.
7652 .It Ql 505
7653 Error: an argument fails verification.
7654 For example an invalid address has been specified, or an attempt was
7655 made to modify anything in \*(UA's own namespace.
7657 .It Ql 506
7658 Error: an otherwise valid argument is rendered invalid due to context.
7659 For example, a second address is added to a header which may consist of
7660 a single address only.
7665 If a command indicates failure then the message will have remained
7666 unmodified.
7667 Most commands can fail with
7668 .Ql 500
7669 if required arguments are missing (false command usage).
7670 The following (case-insensitive) commands are supported:
7673 .Bl -hang -width ".It Cm header"
7674 .It Cm header
7675 This command allows listing, inspection, and editing of message headers.
7676 Header name case is not normalized, and case-insensitive comparison
7677 should be used when matching names.
7678 The second argument specifies the subcommand to apply, one of:
7680 .Bl -hang -width ".It Cm remove"
7681 .It Cm list
7682 Without a third argument a list of all yet existing headers is given via
7683 .Ql 210 ;
7684 this command is the default command of
7685 .Cm header
7686 if no second argument has been given.
7687 A third argument restricts output to the given header only, which may
7688 fail with
7689 .Ql 501
7690 if no such field is defined.
7692 .It Cm show
7693 Shows the content of the header given as the third argument.
7694 Dependent on the header type this may respond with
7695 .Ql 211
7697 .Ql 212 ;
7698 any failure results in
7699 .Ql 501 .
7701 .It Cm remove
7702 This will remove all instances of the header given as the third
7703 argument, reporting
7704 .Ql 210
7705 upon success,
7706 .Ql 501
7707 if no such header can be found, and
7708 Ql 505
7709 on \*(UA namespace violations.
7711 .It Cm remove-at
7712 This will remove from the header given as the third argument the
7713 instance at the list position (counting from one!) given with the fourth
7714 argument, reporting
7715 .Ql 210
7716 upon success or
7717 .Ql 505
7718 if the list position argument is not a number or on \*(UA namespace
7719 violations, and
7720 .Ql 501
7721 if no such header instance exists.
7723 .It Cm insert
7724 Create a new or an additional instance of the header given in the third
7725 argument, with the header body content as given in the fourth argument
7726 (the remains of the line).
7727 It may return
7728 .Ql 501
7729 if the third argument specifies a free-form header field name that is
7730 invalid, or if body content extraction fails to succeed,
7731 .Ql 505
7732 if any extracted address does not pass syntax and/or security checks or
7733 on \*(UA namespace violations, and
7734 .Ql 506
7735 to indicate prevention of excessing a single-instance header \(em note that
7736 .Ql Subject:
7737 can be appended to (a space separator will be added automatically first).
7739 .Ql 210
7740 is returned upon success, followed by the name of the header and the list
7741 position of the newly inserted instance.
7742 The list position is always 1 for single-instance header fields.
7743 All free-form header fields are managed in a single list.
7747 .It Cm attachment
7748 This command allows listing, removal and addition of message attachments.
7749 The second argument specifies the subcommand to apply, one of:
7751 .Bl -hang -width ".It Cm remove"
7752 .It Cm list
7753 List all attachments via
7754 .Ql 212 ,
7755 or report
7756 .Ql 501
7757 if no attachments exist.
7758 This command is the default command of
7759 .Cm attachment
7760 if no second argument has been given.
7762 .It Cm remove
7763 This will remove the attachment given as the third argument, and report
7764 .Ql 210
7765 upon success or
7766 .Ql 501
7767 if no such attachment can be found.
7768 If there exists any path component in the given argument, then an exact
7769 match of the path which has been used to create the attachment is used
7770 directly, but if only the basename of that path matches then all
7771 attachments are traversed to find an exact match first, and the removal
7772 occurs afterwards; if multiple basenames match, a
7773 .Ql 506
7774 error occurs.
7775 Message attachments are treated as absolute pathnames.
7777 If no path component exists in the given argument, then all attachments
7778 will be searched for
7779 .Ql filename=
7780 parameter matches as well as for matches of the basename of the path
7781 which has been used when the attachment has been created; multiple
7782 matches result in a
7783 .Ql 506 .
7785 .It Cm remove-at
7786 This will interpret the third argument as a number and remove the
7787 attachment at that list position (counting from one!), reporting
7788 .Ql 210
7789 upon success or
7790 .Ql 505
7791 if the argument is not a number or
7792 .Ql 501
7793 if no such attachment exists.
7795 .It Cm insert
7796 Adds the attachment given as the third argument, specified exactly as
7797 documented for the command line option
7798 .Fl a ,
7799 and supporting the message number extension as documented for
7800 .Ic ~@ .
7801 This reports
7802 .Ql 210
7803 upon success, with the index of the new attachment following,
7804 .Ql 505
7805 if the given file cannot be opened,
7806 .Ql 506
7807 if an on-the-fly performed character set conversion fails, otherwise
7808 .Ql 501
7809 is reported; this is also reported if character set conversion is
7810 requested but not available.
7812 .It Cm attribute
7813 This uses the same search mechanism as described for
7814 .Cm remove
7815 and prints any known attributes of the first found attachment via
7816 .Ql 212
7817 upon success or
7818 .Ql 501
7819 if no such attachment can be found.
7820 The attributes are written as lines of keyword and value tuples, the
7821 keyword being separated from the rest of the line with an ASCII SP space
7822 character.
7824 .It Cm attribute-at
7825 This uses the same search mechanism as described for
7826 .Cm remove-at
7827 and is otherwise identical to
7828 .Cm attribute .
7830 .It Cm attribute-set
7831 This uses the same search mechanism as described for
7832 .Cm remove ,
7833 and will assign the attribute given as the fourth argument, which is
7834 expected to be a value tuple of keyword and other data, separated by
7835 a ASCII SP space or TAB tabulator character.
7836 If the value part is empty, then the given attribute is removed, or
7837 reset to a default value if existence of the attribute is crucial.
7839 It returns via
7840 .Ql 210
7841 upon success, with the index of the found attachment following,
7842 .Ql 505
7843 for message attachments or if the given keyword is invalid, and
7844 .Ql 501
7845 if no such attachment can be found.
7846 The following keywords may be used (case-insensitively):
7848 .Bl -hang -compact -width ".It Ql filename"
7849 .It Ql filename
7850 Sets the filename of the MIME part, i.e., the name that is used for
7851 display and when (suggesting a name for) saving (purposes).
7852 .It Ql content-description
7853 Associate some descriptive information to the attachment's content, used
7854 in favour of the plain filename by some MUAs.
7855 .It Ql content-id
7856 May be used for uniquely identifying MIME entities in several contexts;
7857 this expects a special reference address format as defined in RFC 2045
7858 and generates a
7859 .Ql 505
7860 upon address content verification failure.
7861 .It Ql content-type
7862 Defines the media type/subtype of the part, which is managed
7863 automatically, but can be overwritten.
7864 .It Ql content-disposition
7865 Automatically set to the string
7866 .Ql attachment .
7869 .It Cm attribute-set-at
7870 This uses the same search mechanism as described for
7871 .Cm remove-at
7872 and is otherwise identical to
7873 .Cm attribute-set .
7879 .It Ic ~A
7880 The same as
7881 .Ql Ic ~i Ns \| Va Sign .
7884 .It Ic ~a
7885 The same as
7886 .Ql Ic ~i Ns \| Va sign .
7889 .It Ic ~b Ar name ...
7890 Add the given names to the list of blind carbon copy recipients.
7893 .It Ic ~c Ar name ...
7894 Add the given names to the list of carbon copy recipients.
7897 .It Ic ~d
7898 Read the file specified by the
7899 .Ev DEAD
7900 variable into the message.
7903 .It Ic ~e
7904 Invoke the text
7905 .Ev EDITOR
7906 on the message collected so far, then return to compose mode.
7907 .Ic ~v
7908 can be used for a more display oriented editor.
7911 .It Ic ~F Ar messages
7912 Read the named messages into the message being sent, including all
7913 message headers and MIME parts.
7914 If no messages are specified, read in the current message, the
7915 .Dq dot .
7918 .It Ic ~f Ar messages
7919 Read the named messages into the message being sent.
7920 If no messages are specified, read in the current message, the
7921 .Dq dot .
7922 Strips down the list of header fields according to the
7923 .Ql type
7924 white- and blacklist selection of
7925 .Ic headerpick .
7926 For MIME multipart messages,
7927 only the first displayable part is included.
7930 .It Ic ~H
7931 Edit the message header fields
7932 .Ql From: ,
7933 .Ql Reply-To:
7935 .Ql Sender:
7936 by typing each one in turn and allowing the user to edit the field.
7937 The default values for these fields originate from the
7938 .Va from , reply-to
7940 .Va sender
7941 variables.
7944 .It Ic ~h
7945 Edit the message header fields
7946 .Ql To: ,
7947 .Ql Cc: ,
7948 .Ql Bcc:
7950 .Ql Subject:
7951 by typing each one in turn and allowing the user to edit the field.
7954 .It Ic ~I Ar variable
7955 Insert the value of the specified variable into the message.
7956 The message remains unaltered if the variable is unset or empty.
7957 Any embedded character sequences
7958 .Ql \et
7959 horizontal tabulator and
7960 .Ql \en
7961 line feed are expanded in
7962 .Va posix
7963 mode; otherwise the expansion should occur at
7964 .Ic set
7965 time by using the command modifier
7966 .Va wysh .
7969 .It Ic ~i Ar variable
7970 Insert the value of the specified variable followed by a newline
7971 character into the message.
7972 The message remains unaltered if the variable is unset or empty.
7973 Any embedded character sequences
7974 .Ql \et
7975 horizontal tabulator and
7976 .Ql \en
7977 line feed are expanded in
7978 .Va posix
7979 mode; otherwise the expansion should occur at
7980 .Ic set
7981 time by using the command modifier
7982 .Va wysh .
7985 .It Ic ~M Ar messages
7986 Read the named messages into the message being sent,
7987 indented by
7988 .Va indentprefix .
7989 If no messages are specified, read the current message, the
7990 .Dq dot .
7993 .It Ic ~m Ar messages
7994 Read the named messages into the message being sent,
7995 indented by
7996 .Va indentprefix .
7997 If no messages are specified, read the current message, the
7998 .Dq dot .
7999 Strips down the list of header fields according to the
8000 .Ql type
8001 white- and blacklist selection of
8002 .Ic headerpick .
8003 For MIME multipart messages,
8004 only the first displayable part is included.
8007 .It Ic ~p
8008 Display the message collected so far,
8009 prefaced by the message header fields
8010 and followed by the attachment list, if any.
8013 .It Ic ~q
8014 Abort the message being sent,
8015 copying it to the file specified by the
8016 .Ev DEAD
8017 variable if
8018 .Va save
8019 is set.
8022 .It Ic ~R Ar filename
8023 Identical to
8024 .Ic ~r ,
8025 but indent each line that has been read by
8026 .Va indentprefix .
8029 .It Ic ~r Ar filename Op Ar HERE-delimiter
8030 Read the named file, object to the usual
8031 .Sx "Filename transformations" ,
8032 into the message; if (the expanded)
8033 .Ar filename
8034 is the hyphen-minus
8035 .Ql -
8036 then standard input is used, e.g., for pasting purposes.
8037 Only in this latter mode
8038 .Ar HERE-delimiter
8039 may be given: if it is data will be read in until the given
8040 .Ar HERE-delimiter
8041 is seen on a line by itself, and encountering EOF is an error; the
8042 .Ar HERE-delimiter
8043 is a required argument in non-interactive mode; if it is single-quote
8044 quoted then the pasted content will not be expanded, \*(ID otherwise
8045 a future version of \*(UA may perform shell-style expansion on the content.
8048 .It Ic ~s Ar string
8049 Cause the named string to become the current subject field.
8050 Newline (NL) and carriage-return (CR) bytes are invalid and will be
8051 normalized to space (SP) characters.
8054 .It Ic ~t Ar name ...
8055 Add the given name(s) to the direct recipient list.
8058 .It Ic ~U Ar messages
8059 Read in the given / current message(s) excluding all headers, indented by
8060 .Va indentprefix .
8063 .It Ic ~u Ar messages
8064 Read in the given / current message(s), excluding all headers.
8067 .It Ic ~v
8068 Invoke the
8069 .Ev VISUAL
8070 editor on the message collected so far, then return to compose mode.
8071 .Ic ~e
8072 can be used for a less display oriented editor.
8075 .It Ic ~w Ar filename
8076 Write the message onto the named file, which is object to the usual
8077 .Sx "Filename transformations" .
8078 If the file exists,
8079 the message is appended to it.
8082 .It Ic ~x
8083 Same as
8084 .Ic ~q ,
8085 except that the message is not saved at all.
8088 .\" }}}
8091 .\" .Sh INTERNAL VARIABLES {{{
8092 .Sh "INTERNAL VARIABLES"
8094 Internal \*(UA variables are controlled via the
8095 .Ic set
8097 .Ic unset
8098 commands; prefixing a variable name with the string
8099 .Ql no
8100 and calling
8101 .Ic set
8102 has the same effect as using
8103 .Ic unset :
8104 .Ql unset crt
8106 .Ql set nocrt
8107 do the same thing.
8108 Creation or editing of variables can be performed in the
8109 .Ev EDITOR
8110 with the command
8111 .Ic varedit .
8112 .Ic varshow
8113 will give more insight on the given variable(s), and
8114 .Ic set ,
8115 when called without arguments, will show a listing of all variables.
8116 Both commands support a more
8117 .Va verbose
8118 listing mode.
8119 Some well-known variables will also become inherited from the
8120 program
8121 .Sx ENVIRONMENT
8122 implicitly, others can be imported explicitly with the command
8123 .Ic environ
8124 and henceforth share said properties.
8127 Two different kinds of internal variables exist, and both of which can
8128 also form chains.
8129 There are boolean variables, which can only be in one of the two states
8130 .Dq set
8132 .Dq unset ,
8133 and value variables with a(n optional) string value.
8134 For the latter proper quoting is necessary upon assignment time, the
8135 introduction of the section
8136 .Sx COMMANDS
8137 documents the supported quoting rules.
8139 .Bd -literal -offset indent
8140 ? wysh set one=val\e 1 two="val 2" \e
8141     three='val "3"' four=$'val \e'4\e''; \e
8142     varshow one two three four; \e
8143     unset one two three four
8147 Dependent upon the actual option string values may become interpreted as
8148 colour names, command specifications, normal text, etc.
8149 They may be treated as numbers, in which case decimal values are
8150 expected if so documented, but otherwise any numeric format and
8151 base that is valid and understood by the
8152 .Ic vexpr
8153 command may be used, too.
8156 There also exists a special kind of string value, the
8157 .Dq boolean string ,
8158 which must either be a decimal integer (in which case
8159 .Ql 0
8160 is false and
8161 .Ql 1
8162 and any other value is true) or any of the (case-insensitive) strings
8163 .Ql off ,
8164 .Ql no ,
8165 .Ql n
8167 .Ql false
8168 for a false boolean and
8169 .Ql on ,
8170 .Ql yes ,
8171 .Ql y
8173 .Ql true
8174 for a true boolean; a special kind of boolean string is the
8175 .Dq quadoption ,
8176 which is a boolean string that can optionally be prefixed with the
8177 (case-insensitive) term
8178 .Ql ask- ,
8179 as in
8180 .Ql ask-yes ,
8181 which causes prompting of the user in interactive mode, with the given
8182 boolean as the default value.
8185 Variable chains extend a plain
8186 .Ql variable
8187 with
8188 .Ql variable-HOST
8190 .Ql variable-USER@HOST
8191 variants.
8192 Here
8193 .Ql HOST
8194 indeed means
8195 .Ql server:port
8196 if a
8197 .Ql port
8198 had been specified in the contextual Uniform Resource Locator URL, see
8199 .Sx "On URL syntax and credential lookup" .
8200 Even though this mechanism is based on URLs no URL percent encoding may
8201 be applied to neither of
8202 .Ql USER
8204 .Ql HOST ,
8205 variable chains need to be specified using raw data;
8206 the mentioned section contains examples.
8207 Variables which support chains are explicitly documented as such, and
8208 \*(UA treats the base name of any such variable special, meaning that
8209 users should not create custom names like
8210 .Ql variable-xyz
8211 in order to avoid false classifications and treatment of such variables.
8213 .\" .Ss "Initial settings" {{{
8214 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
8215 .Ss "Initial settings"
8217 The standard POSIX 2008/Cor 2-2016 mandates the following initial
8218 variable settings:
8219 .Pf no Va allnet ,
8220 .Pf no Va append ,
8221 .Va asksub ,
8222 .Pf no Va askbcc ,
8223 .Pf no Va autoprint ,
8224 .Pf no Va bang ,
8225 .Pf no Va cmd ,
8226 .Pf no Va crt ,
8227 .Pf no Va debug ,
8228 .Pf no Va dot ,
8229 .Va escape
8230 set to
8231 .Ql ~ ,
8232 .Pf no Va flipr ,
8233 .Pf no Va folder ,
8234 .Va header ,
8235 .Pf no Va hold ,
8236 .Pf no Va ignore ,
8237 .Pf no Va ignoreeof ,
8238 .Pf no Va keep ,
8239 .Pf no Va keepsave ,
8240 .Pf no Va metoo ,
8241 .Pf no Va outfolder ,
8242 .Pf no Va page ,
8243 .Va prompt
8244 set to
8245 .Ql ?\0 ,
8246 .Pf no Va quiet ,
8247 .Pf no Va record ,
8248 .Va save ,
8249 .Pf no Va sendwait ,
8250 .Pf no Va showto ,
8251 .Pf no Va Sign ,
8252 .Pf no Va sign ,
8253 .Va toplines
8254 set to
8255 .Ql 5 .
8258 Notes: \*(UA does not support the
8259 .Pf no Va onehop
8260 variable \(en use command line options or
8261 .Va mta-arguments
8262 to pass options through to a
8263 .Va mta .
8264 And the default global
8265 .Pa \*(UR
8266 file, which is loaded unless the
8267 .Fl \&:
8268 (with according argument) or
8269 .Fl n
8270 command line options have been used, or the
8271 .Ev MAILX_NO_SYSTEM_RC
8272 environment variable is set (see
8273 .Sx "Resource files" )
8274 bends those initial settings a bit, e.g., it sets the variables
8275 .Va hold ,
8276 .Va keepsave
8278 .Va keep ,
8279 to name a few, establishes a default
8280 .Ic headerpick
8281 selection etc., and should thus be taken into account.
8282 .\" }}}
8284 .\" .Ss "Variables" {{{
8285 .Ss "Variables"
8287 .Bl -tag -width ".It Va BaNg"
8290 .It Va \&?
8291 \*(RO The exit status of the last command, or the
8292 .Ic return
8293 value of the macro
8294 .Ic call Ns
8295 ed last.
8296 This status has a meaning in the state machine: in conjunction with
8297 .Va errexit
8298 any non-0 exit status will cause a program exit, and in
8299 .Va posix
8300 mode any error while loading (any of the) resource files will have the
8301 same effect.
8302 .Cm ignerr ,
8303 one of the
8304 .Sx "Command modifiers" ,
8305 can be used to instruct the state machine to ignore errors.
8308 .It Va \&!
8309 \*(RO The current error number
8310 .Pf ( Xr errno 3 ) ,
8311 which is set after an error occurred; it is also available via
8312 .Va ^ERR ,
8313 and the error name and documentation string can be queried via
8314 .Va ^ERRNAME
8316 .Va ^ERRDOC .
8317 \*(ID This machinery is new and the error number is only really usable
8318 if a command explicitly states that it manages the variable
8319 .Va \&! ,
8320 for others errno will be used in case of errors, or
8321 .Va ^ERR Ns -INVAL
8322 if that is 0: it thus may or may not reflect the real error.
8323 The error number may be set with the command
8324 .Ic return .
8328 .It Va ^
8329 \*(RO This is a multiplexer variable which performs dynamic expansion of
8330 the requested state or condition, of which there are:
8333 .Bl -tag -compact -width ".It Va BaNg"
8337 .It Va ^ERR , ^ERRDOC , ^ERRNAME
8338 The number, documentation, and name of the current
8339 .Xr errno 3 ,
8340 respectively, which is usually set after an error occurred.
8341 The documentation is an \*(OP, the name is used if not available.
8342 \*(ID This machinery is new and is usually reliable only if a command
8343 explicitly states that it manages the variable
8344 .Va \&! ,
8345 which is effectively identical to
8346 .Va \&\&^ERR .
8347 Each of those variables can be suffixed with a hyphen minus followed by
8348 a name or number, in which case the expansion refers to the given error.
8349 Note this is a direct mapping of (a subset of) the system error values:
8350 .Bd -literal -offset indent
8351 define work {
8352   eval echo \e$1: \e$^ERR-$1:\e
8353     \e$^ERRNAME-$1: \e$^ERRDOC-$1
8354   vput vexpr i + "$1" 1
8355   if [ $i -lt 16 ]
8356     \excall work $i
8357   end
8359 call work 0
8365 .It Va *
8366 \*(RO Expands all positional parameters (see
8367 .Va 1 ) ,
8368 separated by the first character of the value of
8369 .Va ifs .
8370 \*(ID The special semantics of the equally named special parameter of the
8371 .Xr sh 1
8372 are not yet supported.
8375 .It Va @
8376 \*(RO Expands all positional parameters (see
8377 .Va 1 ) ,
8378 separated by a space character.
8379 If placed in double quotation marks, each positional parameter is
8380 properly quoted to expand to a single parameter again.
8383 .It Va #
8384 \*(RO Expands to the number of positional parameters, i.e., the size of
8385 the positional parameter stack in decimal.
8388 .It Va \&0
8389 \*(RO Inside the scope of a
8390 .Ic define Ns
8391 d and
8392 .Ic call Ns
8393 ed macro this expands to the name of the calling macro, or to the empty
8394 string if the macro is running from top-level.
8395 For the \*(OPal regular expression search and replace operator of
8396 .Ic vexpr
8397 this expands to the entire matching expression.
8398 It represents the program name in global context.
8401 .It Va 1
8402 \*(RO Access of the positional parameter stack.
8403 All further parameters can be accessed with this syntax, too, e.g.,
8404 .Ql 2 ,
8405 .Ql 3
8406 etc.; positional parameters can be shifted off the stack by calling
8407 .Ic shift .
8408 The parameter stack contains, e.g., the arguments of a
8409 .Ic call Ns
8411 .Ic define Ns
8412 d macro, the matching groups of the \*(OPal regular expression search
8413 and replace expression of
8414 .Ic vexpr ,
8415 and can be explicitly created or overwritten with the command
8416 .Ic vpospar .
8419 .It Va account
8420 \*(RO Is set to the active
8421 .Ic account .
8424 .It Va add-file-recipients
8425 \*(BO When file or pipe recipients have been specified,
8426 mention them in the corresponding address fields of the message instead
8427 of silently stripping them from their recipient list.
8428 By default such addressees are not mentioned.
8431 .It Va allnet
8432 \*(BO Causes only the local part to be evaluated
8433 when comparing addresses.
8436 .It Va append
8437 \*(BO Causes messages saved in the
8438 .Mx -sx
8439 .Sx "secondary mailbox"
8440 .Ev MBOX
8441 to be appended to the end rather than prepended.
8442 This should always be set.
8445 .It Va askatend
8446 \*(BO Causes the prompts for
8447 .Ql Cc:
8449 .Ql Bcc:
8450 lists to appear after the message has been edited.
8453 .It Va askattach
8454 \*(BO If set, \*(UA asks for files to attach at the end of each message.
8455 An empty line finalizes the list.
8458 .It Va askcc
8459 \*(BO Causes the user to be prompted for carbon copy recipients
8460 (at the end of each message if
8461 .Va askatend
8463 .Va bsdcompat
8464 are set).
8467 .It Va askbcc
8468 \*(BO Causes the user to be prompted for blind carbon copy
8469 recipients (at the end of each message if
8470 .Va askatend
8472 .Va bsdcompat
8473 are set).
8476 .It Va asksend
8477 \*(BO Causes the user to be prompted for confirmation to send the
8478 message or reenter compose mode after having been shown an envelope
8479 summary.
8480 This is by default enabled.
8483 .It Va asksign
8484 \*(BO\*(OP Causes the user to be prompted if the message is to be
8485 signed at the end of each message.
8487 .Va smime-sign
8488 variable is ignored when this variable is set.
8491 .It Va asksub
8492 .\" The alternative *ask* is not documented on purpose
8493 \*(BO Causes \*(UA to prompt for the subject upon entering compose mode
8494 unless a subject already exists.
8497 .It Va attrlist
8498 A sequence of characters to display in the
8499 .Ql attribute
8500 column of the
8501 .Va headline
8502 as shown in the display of
8503 .Ic headers ;
8504 each for one type of messages (see
8505 .Sx "Message states" ) ,
8506 with the default being
8507 .Ql NUROSPMFAT+\-$~
8509 .Ql NU\ \ *HMFAT+\-$~
8510 if the
8511 .Va bsdflags
8512 variable is set, in the following order:
8514 .Bl -tag -compact -width ".It Ql _"
8515 .It Ql N
8516 new.
8517 .It Ql U
8518 unread but old.
8519 .It Ql R
8520 new but read.
8521 .It Ql O
8522 read and old.
8523 .It Ql S
8524 saved.
8525 .It Ql P
8526 preserved.
8527 .It Ql M
8528 mboxed.
8529 .It Ql F
8530 flagged.
8531 .It Ql A
8532 answered.
8533 .It Ql T
8534 draft.
8535 .It Ql +
8536 start of a collapsed thread.
8537 .It Ql -
8538 an uncollapsed thread (TODO ignored for now).
8539 .It Ql $
8540 classified as spam.
8541 .It Ql ~
8542 classified as possible spam.
8547 .It Va autobcc
8548 Specifies a list of recipients to which a blind carbon copy of each
8549 outgoing message will be sent automatically.
8552 .It Va autocc
8553 Specifies a list of recipients to which a carbon copy of each outgoing
8554 message will be sent automatically.
8557 .It Va autocollapse
8558 \*(BO Causes threads to be collapsed automatically when .Ql thread Ns
8560 .Ic sort
8561 mode is entered (see the
8562 .Ic collapse
8563 command).
8566 .It Va autoprint
8567 \*(BO Enable automatic
8568 .Ic type Ns
8569 ing of a(n existing)
8570 .Dq successive
8571 message after
8572 .Ic delete
8574 .Ic undelete
8575 commands, e.g., the message that becomes the new
8576 .Dq dot
8577 is shown automatically, as via
8578 .Ic dp
8580 .Ic dt .
8583 .It Va autosort
8584 Causes sorted mode (see the
8585 .Ic sort
8586 command) to be entered automatically with the value of this variable as
8587 sorting method when a folder is opened, e.g.,
8588 .Ql set autosort=thread .
8591 .It Va bang
8592 \*(BO Enables the substitution of all not (reverse-solidus) escaped
8593 exclamation mark
8594 .Ql \&!
8595 characters by the contents of the last executed command for the
8596 .Ic \&!
8597 shell escape command and
8598 .Ic ~! ,
8599 one of the compose mode
8600 .Sx "COMMAND ESCAPES" .
8601 If this variable is not set no reverse solidus stripping is performed.
8604 .It Va bind-timeout
8605 \*(OP Terminals generate multi-byte sequences for certain forms of
8606 input, for example for function and other special keys.
8607 Some terminals however do not write these multi-byte sequences as
8608 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
8609 This variable specifies the timeout in milliseconds that the MLE (see
8610 .Sx "On terminal control and line editor" )
8611 waits for more bytes to arrive unless it considers a sequence
8612 .Dq complete .
8613 The default is 200.
8616 .It Va bsdcompat
8617 \*(BO Sets some cosmetical features to traditional BSD style;
8618 has the same affect as setting
8619 .Va askatend
8620 and all other variables prefixed with
8621 .Ql bsd ;
8622 it also changes the behaviour of
8623 .Va emptystart
8624 (which does not exist in BSD).
8627 .It Va bsdflags
8628 \*(BO Changes the letters shown in the first column of a header
8629 summary to traditional BSD style.
8632 .It Va bsdheadline
8633 \*(BO Changes the display of columns in a header summary to traditional
8634 BSD style.
8637 .It Va bsdmsgs
8638 \*(BO Changes some informational messages to traditional BSD style.
8641 .It Va bsdorder
8642 \*(BO Causes the
8643 .Ql Subject:
8644 field to appear immediately after the
8645 .Ql To:
8646 field in message headers and with the
8647 .Ic ~h
8648 .Sx "COMMAND ESCAPES" .
8652 .It Va build-os , build-osenv
8653 \*(RO The operating system \*(UA has been build for, usually taken from
8654 .Xr uname 1
8656 .Ql uname -s
8658 .Ql uname -srm ,
8659 respectively, the former being lowercased.
8662 .It Va charset-7bit
8663 The value that should appear in the
8664 .Ql charset=
8665 parameter of
8666 .Ql Content-Type:
8667 MIME header fields when no character set conversion of the message data
8668 was performed.
8669 This defaults to US-ASCII, and the chosen character set should be
8670 US-ASCII compatible.
8673 .It Va charset-8bit
8674 \*(OP The default 8-bit character set that is used as an implicit last
8675 member of the variable
8676 .Va sendcharsets .
8677 This defaults to UTF-8 if character set conversion capabilities are
8678 available, and to ISO-8859-1 otherwise (unless the operating system
8679 environment is known to always and exclusively support UTF-8 locales),
8680 in which case the only supported character set is
8681 .Va ttycharset
8682 and this variable is effectively ignored.
8683 Refer to the section
8684 .Sx "Character sets"
8685 for the complete picture of character set conversion in \*(UA.
8688 .It Va charset-unknown-8bit
8689 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8690 .Dq upgrade
8691 the content of a mail message by using a character set with the name
8692 .Ql unknown-8bit .
8693 Because of the unclassified nature of this character set \*(UA will not
8694 be capable to convert this character set to any other character set.
8695 If this variable is set any message part which uses the character set
8696 .Ql unknown-8bit
8697 is assumed to really be in the character set given in the value,
8698 otherwise the (final) value of
8699 .Va charset-8bit
8700 is used for this purpose.
8702 This variable will also be taken into account if a MIME type (see
8703 .Sx "The mime.types files" )
8704 of a MIME message part that uses the
8705 .Ql binary
8706 character set is forcefully treated as text.
8709 .It Va cmd
8710 The default value for the
8711 .Ic pipe
8712 command.
8715 .It Va colour-disable
8716 \*(BO\*(OP Forcefully disable usage of colours.
8717 Also see the section
8718 .Sx "Coloured display" .
8721 .It Va colour-pager
8722 \*(BO\*(OP Whether colour shall be used for output that is paged through
8723 .Ev PAGER .
8724 Note that pagers may need special command line options, e.g.,
8725 .Xr less 1
8726 requires the option
8727 .Fl \&\&R
8729 .Xr lv 1
8730 the option
8731 .Fl \&\&c
8732 in order to support colours.
8733 Often doing manual adjustments is unnecessary since \*(UA may perform
8734 adjustments dependent on the value of the environment variable
8735 .Ev PAGER
8736 (see there for more).
8740 .It Va contact-mail , contact-web
8741 \*(RO Addresses for contact per email and web, respectively, e.g., for
8742 bug reports, suggestions, or help regarding \*(UA.
8743 The former can be used directly:
8744 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
8747 .It Va crt
8748 In a(n interactive) terminal session, then if this valued variable is
8749 set it will be used as a threshold to determine how many lines the given
8750 output has to span before it will be displayed via the configured
8751 .Ev PAGER ;
8752 Usage of the
8753 .Ev PAGER
8754 can be forced by setting this to the value
8755 .Ql 0 ,
8756 setting it without a value will deduce the current height of the
8757 terminal screen to compute the threshold (see
8758 .Ev LINES ,
8759 .Va screen
8761 .Xr stty 1 ) .
8762 \*(ID At the moment this uses the count of lines of the message in wire
8763 format, which, dependent on the
8764 .Va mime-encoding
8765 of the message, is unrelated to the number of display lines.
8766 (The software is old and historically the relation was a given thing.)
8769 .It Va customhdr
8770 Define a set of custom headers to be injected into newly composed or
8771 forwarded messages.
8772 A custom header consists of the field name followed by a colon
8773 .Ql \&:
8774 and the field content body.
8775 Standard header field names cannot be overwritten by a custom header.
8776 Different to the command line option
8777 .Fl C
8778 the variable value is interpreted as a comma-separated list of custom
8779 headers: to include commas in header bodies they need to become escaped
8780 with reverse solidus
8781 .Ql \e .
8782 Headers can be managed more freely in compose mode via
8783 .Ic ~^ .
8785 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
8788 .It Va datefield
8789 Controls the appearance of the
8790 .Ql %d
8791 date and time format specification of the
8792 .Va headline
8793 variable, that is used, for example, when viewing the summary of
8794 .Ic headers .
8795 If unset, then the local receiving date is used and displayed
8796 unformatted, otherwise the message sending
8797 .Ql Date: .
8798 It is possible to assign a
8799 .Xr strftime 3
8800 format string and control formatting, but embedding newlines via the
8801 .Ql %n
8802 format is not supported, and will result in display errors.
8803 The default is
8804 .Ql %Y-%m-%d %H:%M ,
8805 and also see
8806 .Va datefield-markout-older .
8809 .It Va datefield-markout-older
8810 Only used in conjunction with
8811 .Va datefield .
8812 Can be used to create a visible distinction of messages dated more than
8813 a day in the future, or older than six months, a concept comparable to the
8814 .Fl \&\&l
8815 option of the POSIX utility
8816 .Xr ls 1 .
8817 If set to the empty string, then the plain month, day and year of the
8818 .Ql Date:
8819 will be displayed, but a
8820 .Xr strftime 3
8821 format string to control formatting can be assigned.
8822 The default is
8823 .Ql %Y-%m-%d .
8826 .It Va debug
8827 \*(BO Enables debug messages and obsoletion warnings, disables the
8828 actual delivery of messages and also implies
8829 .Pf no Va record
8830 as well as
8831 .Pf no Va save .
8834 .It Va disposition-notification-send
8835 \*(BO\*(OP Emit a
8836 .Ql Disposition-Notification-To:
8837 header (RFC 3798) with the message.
8838 This requires the
8839 .Va from
8840 variable to be set.
8841 .\" TODO .It Va disposition-notification-send-HOST
8842 .\"Overrides
8843 .\".Va disposition-notification-send
8844 .\" for SMTP accounts on a specific host.
8845 .\" TODO .It Va disposition-notification-send-USER@HOST
8846 .\"Overrides
8847 .\".Va disposition-notification-send
8848 .\"for a specific account.
8851 .It Va dot
8852 \*(BO When dot is set, a period
8853 .Ql \&.
8854 on a line by itself during message input in (interactive or batch
8855 .Fl # )
8856 compose mode will be treated as end-of-message (in addition to the
8857 normal end-of-file condition).
8858 This behaviour is implied in
8859 .Va posix
8860 mode with a set
8861 .Va ignoreeof .
8864 .It Va dotlock-ignore-error
8865 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
8866 .Mx -sx
8867 .Sx "primary system mailbox" Ns
8868 es (see, e.g., the notes on
8869 .Sx "Filename transformations" ,
8870 as well as the documentation of
8871 .Ic file )
8872 will be protected with so-called dotlock files\(emthe traditional mail
8873 spool file locking method\(emin addition to system file locking.
8874 Because \*(UA ships with a privilege-separated dotlock creation program
8875 that should always be able to create such a dotlock file there is no
8876 good reason to ignore dotlock file creation errors, and thus these are
8877 fatal unless this variable is set.
8880 .It Va editalong
8881 If this variable is set then the editor is started automatically when
8882 a message is composed in interactive mode.
8883 If the value starts with the letter
8884 .Ql v
8885 then this acts as if
8886 .Ic ~v ,
8887 otherwise as if
8888 .Ic ~e
8889 .Pf (see\0 Sx "COMMAND ESCAPES" )
8890 had been specified.
8892 .Va editheaders
8893 variable is implied for this automatically spawned editor session.
8896 .It Va editheaders
8897 \*(BO When a message is edited while being composed,
8898 its header is included in the editable text.
8901 .It Va emptystart
8902 \*(BO When entering interactive mode \*(UA normally writes
8903 .Dq \&No mail for user
8904 and exits immediately if a mailbox is empty or does not exist.
8905 If this variable is set \*(UA starts even with an empty or non-existent
8906 mailbox (the latter behaviour furtherly depends upon
8907 .Va bsdcompat ,
8908 though).
8911 .It Va errexit
8912 \*(BO Let each command with a non-0 exit status, including every
8913 .Ic call Ns
8914 ed macro which
8915 .Ic return Ns
8916 s a non-0 status, cause a program exit unless prefixed by
8917 .Cm ignerr
8918 (see
8919 .Sx "Command modifiers" ) .
8920 This also affects
8921 .Sx "COMMAND ESCAPES" ,
8922 but which use a different modifier for ignoring the error.
8923 Please refer to the variable
8924 .Va \&?
8925 for more on this topic.
8928 .It Va escape
8929 The first character of this value defines the escape character for
8930 .Sx "COMMAND ESCAPES"
8931 in compose mode.
8932 The default value is the character tilde
8933 .Ql ~ .
8934 If set to the empty string, command escapes are disabled.
8937 .It Va expandaddr
8938 If not set then file and command pipeline targets are not allowed,
8939 and any such address will be filtered out, giving a warning message.
8940 If set without a value then all possible recipient address
8941 specifications will be accepted \(en see the section
8942 .Sx "On sending mail, and non-interactive mode"
8943 for more on this.
8944 To accept them, but only in interactive mode, or when tilde commands
8945 were enabled explicitly by using one of the command line options
8946 .Fl ~
8948 .Fl # ,
8949 set this to the (case-insensitive) value
8950 .Ql restrict
8951 (it actually acts like
8952 .Ql restrict,-all,+name,+addr ,
8953 so that care for ordering issues must be taken) .
8955 In fact the value is interpreted as a comma-separated list of values.
8956 If it contains
8957 .Ql fail
8958 then the existence of disallowed specifications is treated as a hard
8959 send error instead of only filtering them out.
8960 The remaining values specify whether a specific type of recipient
8961 address specification is allowed (optionally indicated by a plus sign
8962 .Ql +
8963 prefix) or disallowed (prefixed with a hyphen-minus
8964 .Ql - ) .
8965 The value
8966 .Ql all
8967 addresses all possible address specifications,
8968 .Ql file
8969 file targets,
8970 .Ql pipe
8971 command pipeline targets,
8972 .Ql name
8973 plain user names and (MTA) aliases and
8974 .Ql addr
8975 network addresses.
8976 These kind of values are interpreted in the given order, so that
8977 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8978 will cause hard errors for any non-network address recipient address
8979 unless \*(UA is in interactive mode or has been started with the
8980 .Fl ~
8982 .Fl #
8983 command line option; in the latter case(s) any address may be used, then.
8985 Historically invalid network addressees are silently stripped off.
8986 To change this so that any encountered invalid email address causes
8987 a hard error it must be ensured that
8988 .Ql failinvaddr
8989 is an entry in the above list.
8990 Setting this automatically enables network addressees
8991 (it actually acts like
8992 .Ql failinvaddr,+addr ,
8993 so that care for ordering issues must be taken) .
8996 .It Va expandargv
8997 Unless this variable is set additional
8998 .Va mta
8999 (Mail-Transfer-Agent)
9000 arguments from the command line, as can be given after a
9001 .Fl \&\&-
9002 separator, results in a program termination with failure status.
9003 The same can be accomplished by using the special (case-insensitive) value
9004 .Ql fail .
9005 A lesser strict variant is the otherwise identical
9006 .Ql restrict ,
9007 which does accept such arguments in interactive mode, or if tilde
9008 commands were enabled explicitly by using one of the command line options
9009 .Fl ~
9011 .Fl # .
9012 The empty value will allow unconditional usage.
9015 .It Va features
9016 \*(RO String giving a list of optional features.
9017 Features are preceded with a plus sign
9018 .Ql +
9019 if they are available, with a hyphen-minus
9020 .Ql -
9021 otherwise.
9022 The output of the command
9023 .Ic version
9024 will include this information in a more pleasant output.
9027 .It Va flipr
9028 \*(BO This setting reverses the meanings of a set of reply commands,
9029 turning the lowercase variants, which by default address all recipients
9030 included in the header of a message
9031 .Pf ( Ic reply , respond , followup )
9032 into the uppercase variants, which by default address the sender only
9033 .Pf ( Ic Reply , Respond , Followup )
9034 and vice versa.
9035 The commands
9036 .Ic replysender , respondsender , followupsender
9037 as well as
9038 .Ic replyall , respondall , followupall
9039 are not affected by the current setting of
9040 .Va flipr .
9043 .It Va folder
9044 The default path under which mailboxes are to be saved:
9045 filenames that begin with the plus sign
9046 .Ql +
9047 will have the plus sign replaced with the value of this variable if set,
9048 otherwise the plus sign will remain unchanged when doing
9049 .Sx "Filename transformations" ;
9050 also see
9051 .Ic file
9052 for more on this topic.
9053 The value supports a subset of transformations itself, and if the
9054 non-empty value does not start with a solidus
9055 .Ql / ,
9056 then the value of
9057 .Ev HOME
9058 will be prefixed automatically.
9059 Once the actual value is evaluated first, the internal variable
9060 .Va folder-resolved
9061 will be updated for caching purposes.
9063 .Mx Va folder-hook
9064 .It Va folder-hook-FOLDER , Va folder-hook
9065 Names a
9066 .Ic define Ns d
9067 macro which will be called whenever a
9068 .Ic file
9069 is opened.
9070 The macro will also be invoked when new mail arrives,
9071 but message lists for commands executed from the macro
9072 only include newly arrived messages then.
9073 .Ic localopts
9074 are activated by default in a folder hook, causing the covered settings
9075 to be reverted once the folder is left again.
9077 The specialized form will override the generic one if
9078 .Ql FOLDER
9079 matches the file that is opened.
9080 Unlike other folder specifications, the fully expanded name of a folder,
9081 without metacharacters, is used to avoid ambiguities.
9082 However, if the mailbox resides under
9083 .Va folder
9084 then the usual
9085 .Ql +
9086 specification is tried in addition, e.g., if
9087 .Va \&\&folder
9089 .Dq mail
9090 (and thus relative to the user's home directory) then
9091 .Pa /home/usr1/mail/sent
9092 will be tried as
9093 .Ql folder-hook-/home/usr1/mail/sent
9094 first, but then followed by
9095 .Ql folder-hook-+sent .
9098 .It Va folder-resolved
9099 \*(RO Set to the fully resolved path of
9100 .Va folder
9101 once that evaluation has occurred; rather internal.
9104 .It Va followup-to
9105 \*(BO Controls whether a
9106 .Ql Mail-Followup-To:
9107 header is generated when sending messages to known mailing lists.
9108 Also see
9109 .Va followup-to-honour
9110 and the commands
9111 .Ic mlist , mlsubscribe , reply
9113 .Ic Lreply .
9116 .It Va followup-to-honour
9117 Controls whether a
9118 .Ql Mail-Followup-To:
9119 header is honoured when group-replying to a message via
9120 .Ic reply
9122 .Ic Lreply .
9123 This is a quadoption; if set without a value it defaults to
9124 .Dq yes .
9125 Also see
9126 .Va followup-to
9127 and the commands
9128 .Ic mlist
9130 .Ic mlsubscribe .
9133 .It Va forward-as-attachment
9134 \*(BO Original messages are normally sent as inline text with the
9135 .Ic forward
9136 command,
9137 and only the first part of a multipart message is included.
9138 With this setting enabled messages are sent as unmodified MIME
9139 .Ql message/rfc822
9140 attachments with all of their parts included.
9143 .It Va forward-inject-head
9144 The string to put before the text of a message with the
9145 .Ic forward
9146 command instead of the default
9147 .Dq -------- Original Message -------- .
9148 No heading is put if it is set to the empty string.
9149 This variable is ignored if the
9150 .Va forward-as-attachment
9151 variable is set.
9155 .It Va from
9156 The address (or a list of addresses) to put into the
9157 .Ql From:
9158 field of the message header, quoting RFC 5322:
9159 the author(s) of the message, that is, the mailbox(es) of the person(s)
9160 or system(s) responsible for the writing of the message.
9161 According to that RFC setting the
9162 .Va sender
9163 variable is required if
9164 .Va \&\&from
9165 contains more than one address.
9166 When
9167 .Ic reply Ns
9168 ing to messages these addresses are handled as if they were in the
9169 .Ic alternates
9170 list.
9173 If a file-based MTA is used, then
9174 .Va \&\&from
9175 (or, if that contains multiple addresses,
9176 .Va sender )
9177 can nonetheless be enforced to appear as the envelope sender address at
9178 the MTA protocol level (the RFC 5321 reverse-path), either by using the
9179 .Fl r
9180 command line option (with an empty argument; see there for the complete
9181 picture on this topic), or by setting the internal variable
9182 .Va r-option-implicit .
9185 If the machine's hostname is not valid at the Internet (for example at
9186 a dialup machine) then either this variable or
9187 .Va hostname
9188 (\*(IN a SMTP-based
9189 .Va mta
9190 adds even more fine-tuning capabilities with
9191 .Va smtp-hostname ) ,
9192 have to be set; if so the message and MIME part related unique ID fields
9193 .Ql Message-ID:
9195 .Ql Content-ID:
9196 will be created (except when disallowed by
9197 .Va message-id-disable
9199 .Va stealthmua ) .
9203 .It Va fullnames
9204 \*(BO Due to historical reasons comments and name parts of email
9205 addresses are removed by default when sending mail, replying to or
9206 forwarding a message.
9207 If this variable is set such stripping is not performed.
9209 .It Va fwdheading
9210 \*(OB Predecessor of
9211 .Va forward-inject-head .
9214 .It Va header
9215 \*(BO Causes the header summary to be written at startup and after
9216 commands that affect the number of messages or the order of messages in
9217 the current
9218 .Ic folder .
9219 Unless in
9220 .Va posix
9221 mode a header summary will also be displayed on folder changes.
9222 The command line option
9223 .Fl N
9224 can be used to set
9225 .Pf no Va header .
9229 .It Va headline
9230 A format string to use for the summary of
9231 .Ic headers ,
9232 similar to the ones used for
9233 .Xr printf 3
9234 formats.
9235 Format specifiers in the given string start with a percent sign
9236 .Ql %
9237 and may be followed by an optional decimal number indicating the field
9238 width \(em if that is negative, the field is to be left-aligned.
9239 Valid format specifiers are:
9242 .Bl -tag -compact -width ".It Ql _%%_"
9243 .It Ql %%
9244 A plain percent sign.
9245 .It Ql %>
9246 .Dq Dotmark :
9247 a space character but for the current message
9248 .Pf ( Dq dot ) ,
9249 for which it expands to
9250 .Ql >
9251 (dependent on
9252 .Va headline-plain ) .
9253 .It Ql %<
9254 .Dq Dotmark :
9255 a space character but for the current message
9256 .Pf ( Dq dot ) ,
9257 for which it expands to
9258 .Ql <
9259 (dependent on
9260 .Va headline-plain ) .
9261 .It Ql %$
9262 \*(OP The spam score of the message, as has been classified via the
9263 command
9264 .Ic spamrate .
9265 Shows only a replacement character if there is no spam support.
9266 .It Ql %a
9267 Message attribute character (status flag); the actual content can be
9268 adjusted by setting
9269 .Va attrlist .
9270 .It Ql %d
9271 The date found in the
9272 .Ql From:
9273 header of the message when
9274 .Va datefield
9275 is set (the default), otherwise the date when the message was received.
9276 Formatting can be controlled by assigning a
9277 .Xr strftime 3
9278 format string to
9279 .Va datefield .
9280 .It Ql %e
9281 The indenting level in
9282 .Ql thread Ns
9284 .Ic sort
9285 mode.
9286 .It Ql %f
9287 The address of the message sender.
9288 .It Ql %i
9289 The message thread tree structure.
9290 (Note that this format does not support a field width, and honours
9291 .Va headline-plain . )
9292 .It Ql %l
9293 The number of lines of the message, if available.
9294 .It Ql %m
9295 Message number.
9296 .It Ql %o
9297 The number of octets (bytes) in the message, if available.
9298 .It Ql %s
9299 Message subject (if any).
9300 .It Ql %S
9301 Message subject (if any) in double quotes.
9302 .It Ql \&%T
9303 Message recipient flags: is the addressee of the message a known or
9304 subscribed mailing list \(en see
9305 .Ic mlist
9307 .Ic mlsubscribe .
9308 .It Ql %t
9309 The position in threaded/sorted order.
9310 .It Ql \%U
9311 The value 0 except in an IMAP mailbox,
9312 where it expands to the UID of the message.
9315 The default is
9316 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
9318 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
9320 .Va bsdcompat
9321 is set.
9322 Also see
9323 .Va attrlist ,
9324 .Va headline-plain
9326 .Va headline-bidi .
9330 .It Va headline-bidi
9331 Bidirectional text requires special treatment when displaying headers,
9332 because numbers (in dates or for file sizes etc.) will not affect the
9333 current text direction, in effect resulting in ugly line layouts when
9334 arabic or other right-to-left text is to be displayed.
9335 On the other hand only a minority of terminals is capable to correctly
9336 handle direction changes, so that user interaction is necessary for
9337 acceptable results.
9338 Note that extended host system support is required nonetheless, e.g.,
9339 detection of the terminal character set is one precondition;
9340 and this feature only works in an Unicode (i.e., UTF-8) locale.
9342 In general setting this variable will cause \*(UA to encapsulate text
9343 fields that may occur when displaying
9344 .Va headline
9345 (and some other fields, like dynamic expansions in
9346 .Va prompt )
9347 with special Unicode control sequences;
9348 it is possible to fine-tune the terminal support level by assigning
9349 a value:
9350 no value (or any value other than
9351 .Ql 1 ,
9352 .Ql 2
9354 .Ql 3 )
9355 will make \*(UA assume that the terminal is capable to properly deal
9356 with Unicode version 6.3, in which case text is embedded in a pair of
9357 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
9358 characters.
9359 In addition no space on the line is reserved for these characters.
9361 Weaker support is chosen by using the value
9362 .Ql 1
9363 (Unicode 6.3, but reserve the room of two spaces for writing the control
9364 sequences onto the line).
9365 The values
9366 .Ql 2
9368 .Ql 3
9369 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
9370 again reserves room for two spaces in addition.
9373 .It Va headline-plain
9374 \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are
9375 used by default for certain entries of
9376 .Va headline .
9377 If this variable is set only basic US-ASCII symbols will be used.
9380 .It Va history-file
9381 \*(OP If a line editor is available then this can be set to
9382 name the (expandable) path of the location of a permanent
9383 .Ic history
9384 file; also see
9385 .Va history-size .
9388 .It Va history-gabby
9389 \*(BO\*(OP Add more entries to the
9390 .Ic history
9391 as is normally done.
9394 .It Va history-gabby-persist
9395 \*(BO\*(OP \*(UA's own MLE will not save the additional
9396 .Va history-gabby
9397 entries in persistent storage unless this variable is set.
9398 On the other hand it will not loose the knowledge of whether
9399 a persistent entry was gabby or not.
9400 Also see
9401 .Va history-file .
9404 .It Va history-size
9405 \*(OP Setting this variable imposes a limit on the number of concurrent
9406 .Ic history
9407 entries.
9408 If set to the value 0 then no further history entries will be added,
9409 and loading and incorporation of the
9410 .Va history-file
9411 upon program startup can also be suppressed by doing this.
9412 Runtime changes will not be reflected, but will affect the number of
9413 entries saved to permanent storage.
9416 .It Va hold
9417 \*(BO This setting controls whether messages are held in the system
9418 .Va inbox ,
9419 and it is set by default.
9422 .It Va hostname
9423 Used instead of the value obtained from
9424 .Xr uname 3
9426 .Xr getaddrinfo 3
9427 as the hostname when expanding local addresses, e.g., in
9428 .Ql From:
9429 (also see
9430 .Sx "On sending mail, and non-interactive mode" ,
9431 especially for expansion of network addresses that contain domain-less
9432 valid user names in angle brackets).
9433 If either of
9434 .Va from
9435 or this variable Is set the message and MIME part related unique ID fields
9436 .Ql Message-ID:
9438 .Ql Content-ID:
9439 will be created (except when disallowed by
9440 .Va message-id-disable
9442 .Va stealthmua ) .
9443 If the \*(OPal IDNA support is available (see
9444 .Va idna-disable )
9445 variable assignment is aborted when a necessary conversion fails.
9447 Setting it to the empty string will cause the normal hostname to be
9448 used, but nonetheless enables creation of said ID fields.
9449 \*(IN in conjunction with the built-in SMTP
9450 .Va mta
9451 .Va smtp-hostname
9452 also influences the results:
9453 one should produce some test messages with the desired combination of
9454 .Va \&\&hostname ,
9455 and/or
9456 .Va from ,
9457 .Va sender
9458 etc. first.
9461 .It Va idna-disable
9462 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
9463 names according to the rules of IDNA (internationalized domain names
9464 for applications).
9465 Since the IDNA code assumes that domain names are specified with the
9466 .Va ttycharset
9467 character set, an UTF-8 locale charset is required to represent all
9468 possible international domain names (before conversion, that is).
9471 .It Va ifs
9472 The input field separator that is used (\*(ID by some functions) to
9473 determine where to split input data.
9475 .Bl -tag -compact -width ".It MMM"
9476 .It 1.
9477 Unsetting is treated as assigning the default value,
9478 .Ql \& \et\en .
9479 .It 2.
9480 If set to the empty value, no field splitting will be performed.
9481 .It 3.
9482 If set to a non-empty value, all whitespace characters are extracted
9483 and assigned to the variable
9484 .Va ifs-ws .
9487 .Bl -tag -compact -width ".It MMM"
9488 .It a.
9489 .Va \&\&ifs-ws
9490 will be ignored at the beginning and end of input.
9491 Diverging from POSIX shells default whitespace is removed in addition,
9492 which is owed to the entirely different line content extraction rules.
9493 .It b.
9494 Each occurrence of a character of
9495 .Va \&\&ifs
9496 will cause field-splitting, any adjacent
9497 .Va \&\&ifs-ws
9498 characters will be skipped.
9502 .It Va ifs-ws
9503 \*(RO Automatically deduced from the whitespace characters in
9504 .Va ifs .
9507 .It Va ignore
9508 \*(BO Ignore interrupt signals from the terminal while entering
9509 messages; instead echo them as
9510 .Ql @
9511 characters and discard the current line.
9514 .It Va ignoreeof
9515 \*(BO Ignore end-of-file conditions
9516 .Pf ( Ql control-D )
9517 in compose mode on message input and in interactive command input.
9518 If set an interactive command input session can only be left by
9519 explicitly using one of the commands
9520 .Ic exit
9522 .Ic quit ,
9523 and message input in compose mode can only be terminated by entering
9524 a period
9525 .Ql \&.
9526 on a line by itself or by using the
9527 .Ic ~.
9528 .Sx "COMMAND ESCAPES" ;
9529 Setting this implies the behaviour that
9530 .Va dot
9531 describes in
9532 .Va posix
9533 mode.
9536 .It Va inbox
9537 If this is set to a non-empty string it will specify the user's
9538 .Mx -sx
9539 .Sx "primary system mailbox" ,
9540 overriding
9541 .Ev MAIL
9542 and the system-dependent default, and (thus) be used to replace
9543 .Ql %
9544 when doing
9545 .Sx "Filename transformations" ;
9546 also see
9547 .Ic file
9548 for more on this topic.
9549 The value supports a subset of transformations itself.
9552 .It Va indentprefix
9553 String used by the
9554 .Ic ~m , ~M
9556 .Ic ~R
9557 .Sx "COMMAND ESCAPES"
9558 and by the
9559 .Va quote
9560 option for indenting messages,
9561 in place of the POSIX mandated default tabulator character
9562 .Ql \et .
9563 Also see
9564 .Va quote-chars .
9567 .It Va keep
9568 \*(BO If set, an empty
9569 .Mx -sx
9570 .Sx "primary system mailbox"
9571 file is not removed.
9572 Note that, in conjunction with
9573 .Va posix
9574 mode any empty file will be removed unless this variable is set.
9575 This may improve the interoperability with other mail user agents
9576 when using a common folder directory, and prevents malicious users
9577 from creating fake mailboxes in a world-writable spool directory.
9578 \*(ID Only local regular (MBOX) files are covered, Maildir or other
9579 mailbox types will never be removed, even if empty.
9582 .It Va keep-content-length
9583 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
9584 be told to keep the
9585 .Ql Content-Length:
9587 .Ql Lines:
9588 header fields that some MUAs generate by setting this variable.
9589 Since \*(UA does neither use nor update these non-standardized header
9590 fields (which in itself shows one of their conceptual problems),
9591 stripping them should increase interoperability in between MUAs that
9592 work with with same mailbox files.
9593 Note that, if this is not set but
9594 .Va writebackedited ,
9595 as below, is, a possibly performed automatic stripping of these header
9596 fields already marks the message as being modified.
9597 \*(ID At some future time \*(UA will be capable to rewrite and apply an
9598 .Va mime-encoding
9599 to modified messages, and then those fields will be stripped silently.
9602 .It Va keepsave
9603 \*(BO When a message is saved it is usually discarded from the
9604 originating folder when \*(UA is quit.
9605 This setting causes all saved message to be retained.
9608 .It Va line-editor-disable
9609 \*(BO Turn off any enhanced line editing capabilities (see
9610 .Sx "On terminal control and line editor"
9611 for more).
9614 .It Va line-editor-no-defaults
9615 \*(BO\*(OP Do not establish any default key binding.
9618 .It Va log-prefix
9619 Error log message prefix string
9620 .Pf ( Ql "\*(uA: " ) .
9623 .It Va mailbox-display
9624 \*(RO The name of the current mailbox
9625 .Pf ( Ic file ) ,
9626 possibly abbreviated for display purposes.
9629 .It Va mailbox-resolved
9630 \*(RO The fully resolved path of the current mailbox.
9633 .It Va mailx-extra-rc
9634 An additional startup file that is loaded as the last of the
9635 .Sx "Resource files" .
9636 Use this file for commands that are not understood by other POSIX
9637 .Xr mailx 1
9638 implementations, i.e., mostly anything which is not covered by
9639 .Sx "Initial settings" .
9642 .It Va markanswered
9643 \*(BO When a message is replied to and this variable is set,
9644 it is marked as having been
9645 .Ic answered .
9646 See the section
9647 .Sx "Message states" .
9650 .It Va mbox-rfc4155
9651 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
9652 POSIX rules for detecting message boundaries (so-called
9653 .Ql From_
9654 lines) due to compatibility reasons, instead of the stricter rules that
9655 have been standardized in RFC 4155.
9656 This behaviour can be switched to the stricter RFC 4155 rules by
9657 setting this variable.
9658 (This is never necessary for any message newly generated by \*(UA,
9659 it only applies to messages generated by buggy or malicious MUAs, or may
9660 occur in old MBOX databases: \*(UA itself will choose a proper
9661 .Va mime-encoding
9662 to avoid false interpretation of
9663 .Ql From_
9664 content lines in the MBOX database.)
9666 This may temporarily be handy when \*(UA complains about invalid
9667 .Ql From_
9668 lines when opening a MBOX: in this case setting this variable and
9669 re-opening the mailbox in question may correct the result.
9670 If so, copying the entire mailbox to some other file, as in
9671 .Ql copy * SOME-FILE ,
9672 will perform proper, all-compatible
9673 .Ql From_
9674 quoting for all detected messages, resulting in a valid MBOX mailbox.
9675 Finally the variable can be unset again:
9676 .Bd -literal -offset indent
9677 define mboxfix {
9678   localopts yes; wysh set mbox-rfc4155;\e
9679     wysh File "${1}"; eval copy * "${2}"
9681 call mboxfix /tmp/bad.mbox /tmp/good.mbox
9685 .It Va memdebug
9686 \*(BO Internal development variable.
9689 .It Va message-id-disable
9690 \*(BO By setting this variable the generation of
9691 .Ql Message-ID:
9693 .Ql Content-ID:
9694 message and MIME part headers can be completely suppressed, effectively
9695 leaving this task up to the
9696 .Va mta
9697 (Mail-Transfer-Agent) or the SMTP server.
9698 Note that according to RFC 5321 a SMTP server is not required to add this
9699 field by itself, so it should be ensured that it accepts messages without
9700 .Ql Message-ID .
9703 .It Va message-inject-head
9704 A string to put at the beginning of each new message, followed by a newline.
9705 \*(OB The escape sequences tabulator
9706 .Ql \et
9707 and newline
9708 .Ql \en
9709 are understood (use the
9710 .Cm wysh
9711 prefix when
9712 .Ic set Ns
9713 ting the variable(s) instead).
9716 .It Va message-inject-tail
9717 A string to put at the end of each new message, followed by a newline.
9718 \*(OB The escape sequences tabulator
9719 .Ql \et
9720 and newline
9721 .Ql \en
9722 are understood (use the
9723 .Cm wysh
9724 prefix when
9725 .Ic set Ns
9726 ting the variable(s) instead).
9729 .It Va metoo
9730 \*(BO Usually, when an
9731 .Ic alias
9732 expansion contains the sender, the sender is removed from the expansion.
9733 Setting this option suppresses these removals.
9734 Note that a set
9735 .Va metoo
9736 also causes a
9737 .Ql -m
9738 option to be passed through to the
9739 .Va mta
9740 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
9741 this flag, no MTA is known which does not support it (for historical
9742 compatibility).
9745 .It Va mime-allow-text-controls
9746 \*(BO When sending messages, each part of the message is MIME-inspected
9747 in order to classify the
9748 .Ql Content-Type:
9750 .Ql Content-Transfer-Encoding:
9751 (see
9752 .Va mime-encoding )
9753 that is required to send this part over mail transport, i.e.,
9754 a computation rather similar to what the
9755 .Xr file 1
9756 command produces when used with the
9757 .Ql --mime
9758 option.
9760 This classification however treats text files which are encoded in
9761 UTF-16 (seen for HTML files) and similar character sets as binary
9762 octet-streams, forcefully changing any
9763 .Ql text/plain
9765 .Ql text/html
9766 specification to
9767 .Ql application/octet-stream :
9768 If that actually happens a yet unset charset MIME parameter is set to
9769 .Ql binary ,
9770 effectively making it impossible for the receiving MUA to automatically
9771 interpret the contents of the part.
9773 If this variable is set, and the data was unambiguously identified as
9774 text data at first glance (by a
9775 .Ql .txt
9777 .Ql .html
9778 file extension), then the original
9779 .Ql Content-Type:
9780 will not be overwritten.
9783 .It Va mime-alternative-favour-rich
9784 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
9785 HTML) will be preferred in favour of included plain text versions when
9786 displaying messages, provided that a handler exists which produces
9787 output that can be (re)integrated into \*(UA's normal visual display.
9788 (E.g., at the time of this writing some newsletters ship their full
9789 content only in the rich HTML part, whereas the plain text part only
9790 contains topic subjects.)
9793 .It Va mime-counter-evidence
9794 Normally the
9795 .Ql Content-Type:
9796 field is used to decide how to handle MIME parts.
9797 Some MUAs, however, do not use
9798 .Sx "The mime.types files"
9799 (also see
9800 .Sx "HTML mail and MIME attachments" )
9801 or a similar mechanism to correctly classify content, but specify an
9802 unspecific MIME type
9803 .Pf ( Ql application/octet-stream )
9804 even for plain text attachments.
9805 If this variable is set then \*(UA will try to re-classify such MIME
9806 message parts, if possible, for example via a possibly existing
9807 attachment filename.
9808 A non-empty value may also be given, in which case a number is expected,
9809 actually a carrier of bits, best specified as a binary value, e.g.,
9810 .Ql 0b1111 .
9812 .Bl -bullet -compact
9814 If bit two is set (counting from 1, decimal 2) then the detected
9815 .Ic mimetype
9816 will be carried along with the message and be used for deciding which
9817 MIME handler is to be used, for example;
9818 when displaying such a MIME part the part-info will indicate the
9819 overridden content-type by showing a plus sign
9820 .Ql + .
9822 If bit three is set (decimal 4) then the counter-evidence is always
9823 produced and a positive result will be used as the MIME type, even
9824 forcefully overriding the parts given MIME type.
9826 If bit four is set (decimal 8) as a last resort the actual content of
9827 .Ql application/octet-stream
9828 parts will be inspected, so that data which looks like plain text can be
9829 treated as such.
9830 This mode is even more relaxed when data is to be displayed to the user
9831 or used as a message quote (data consumers which mangle data for display
9832 purposes, which includes masking of control characters, for example).
9836 .It Va mime-encoding
9837 The MIME
9838 .Ql Content-Transfer-Encoding
9839 to use in outgoing text messages and message parts, where applicable.
9840 (7-bit clean text messages are sent as-is, without a transfer encoding.)
9841 Valid values are:
9843 .Bl -tag -compact -width ".It Ql _%%_"
9844 .It Ql 8bit
9845 .Pf (Or\0 Ql 8b . )
9846 8-bit transport effectively causes the raw data be passed through
9847 unchanged, but may cause problems when transferring mail messages over
9848 channels that are not ESMTP (RFC 1869) compliant.
9849 Also, several input data constructs are not allowed by the
9850 specifications and may cause a different transfer-encoding to be used.
9851 .It Ql quoted-printable
9852 .Pf (Or\0 Ql qp . )
9853 Quoted-printable encoding is 7-bit clean and has the property that ASCII
9854 characters are passed through unchanged, so that an english message can
9855 be read as-is; it is also acceptable for other single-byte locales that
9856 share many characters with ASCII, like, e.g., ISO-8859-1.
9857 The encoding will cause a large overhead for messages in other character
9858 sets: e.g., it will require up to twelve (12) bytes to encode a single
9859 UTF-8 character of four (4) bytes.
9860 It is the default encoding.
9861 .It Ql base64
9862 .Pf (Or\0 Ql b64 . )
9863 This encoding is 7-bit clean and will always be used for binary data.
9864 This encoding has a constant input:output ratio of 3:4, regardless of
9865 the character set of the input data it will encode three bytes of input
9866 to four bytes of output.
9867 This transfer-encoding is not human readable without performing
9868 a decoding step.
9872 .It Va mimetypes-load-control
9873 Can be used to control which of
9874 .Sx "The mime.types files"
9875 are loaded: if the letter
9876 .Ql u
9877 is part of the option value, then the user's personal
9878 .Pa \*(vU
9879 file will be loaded (if it exists); likewise the letter
9880 .Ql s
9881 controls loading of the system wide
9882 .Pa \*(vS ;
9883 directives found in the user file take precedence, letter matching is
9884 case-insensitive.
9885 If this variable is not set \*(UA will try to load both files.
9886 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
9887 but they will be matched last (the order can be listed via
9888 .Ic mimetype ) .
9890 More sources can be specified by using a different syntax: if the
9891 value string contains an equals sign
9892 .Ql =
9893 then it is instead parsed as a comma-separated list of the described
9894 letters plus
9895 .Ql f=FILENAME
9896 pairs; the given filenames will be expanded and loaded, and their
9897 content may use the extended syntax that is described in the section
9898 .Sx "The mime.types files" .
9899 Directives found in such files always take precedence (are prepended to
9900 the MIME type cache).
9904 .It Va mta
9905 To choose an alternate Mail-Transfer-Agent, set this option to either
9906 the full pathname of an executable (optionally prefixed with the protocol
9907 .Ql file:// ) ,
9908 or \*(OPally a SMTP a.k.a. SUBMISSION protocol URL, e.g., \*(IN
9910 .Dl smtps?://[user[:password]@]server[:port]
9912 (\*(OU:
9913 .Ql [smtp://]server[:port] . )
9914 The default has been chosen at compile time.
9915 All supported data transfers are executed in child processes, which
9916 run asynchronously and without supervision unless either the
9917 .Va sendwait
9918 or the
9919 .Va verbose
9920 variable is set.
9921 If such a child receives a TERM signal, it will abort and
9922 .Va save
9923 the message to
9924 .Ev DEAD ,
9925 if so configured.
9928 For a file-based MTA it may be necessary to set
9929 .Va mta-argv0
9930 in in order to choose the right target of a modern
9931 .Xr mailwrapper 8
9932 environment.
9933 It will be passed command line arguments from several possible sources:
9934 from the variable
9935 .Va mta-arguments
9936 if set, from the command line if given and the variable
9937 .Va expandargv
9938 allows their use.
9939 Argument processing of the MTA will be terminated with a
9940 .Fl \&\&-
9941 separator.
9944 The otherwise occurring implicit usage of the following MTA command
9945 line arguments can be disabled by setting the boolean variable
9946 .Va mta-no-default-arguments
9947 (which will also disable passing
9948 .Fl \&\&-
9949 to the MTA):
9950 .Fl \&\&i
9951 (for not treating a line with only a dot
9952 .Ql \&.
9953 character as the end of input),
9954 .Fl \&\&m
9955 (shall the variable
9956 .Va metoo
9957 be set) and
9958 .Fl \&\&v
9959 (if the
9960 .Va verbose
9961 variable is set); in conjunction with the
9962 .Fl r
9963 command line option \*(UA will also (not) pass
9964 .Fl \&\&f
9965 as well as possibly
9966 .Fl \&\&F .
9969 \*(OPally \*(UA can send mail over SMTP a.k.a. SUBMISSION network
9970 connections to a single defined smart host by setting this variable to
9971 a SMTP or SUBMISSION URL (see
9972 .Sx "On URL syntax and credential lookup" ) .
9973 An authentication scheme can be specified via the variable chain
9974 .Va smtp-auth .
9975 Encrypted network connections are \*(OPally available, the section
9976 .Sx "Encrypted network communication"
9977 should give an overview and provide links to more information on this.
9978 Note that with some mail providers it may be necessary to set the
9979 .Va smtp-hostname
9980 variable in order to use a specific combination of
9981 .Va from ,
9982 .Va hostname
9984 .Va mta .
9985 \*(UA also supports forwarding of all network traffic over a specified
9986 .Va socks-proxy .
9987 The following SMTP variants may be used:
9989 .Bl -bullet
9991 The plain SMTP protocol (RFC 5321) that normally lives on the
9992 server port 25 and requires setting the
9993 .Va smtp-use-starttls
9994 variable to enter a SSL/TLS encrypted session state.
9995 Assign a value like \*(IN
9996 .Ql smtp://[user[:password]@]server[:port]
9997 (\*(OU
9998 .Ql smtp://server[:port] )
9999 to choose this protocol.
10001 The so-called SMTPS which is supposed to live on server port 465
10002 and is automatically SSL/TLS secured.
10003 Unfortunately it never became a standardized protocol and may thus not
10004 be supported by your hosts network service database
10005 \(en in fact the port number has already been reassigned to other
10006 protocols!
10008 SMTPS is nonetheless a commonly offered protocol and thus can be
10009 chosen by assigning a value like \*(IN
10010 .Ql smtps://[user[:password]@]server[:port]
10011 (\*(OU
10012 .Ql smtps://server[:port] ) ;
10013 due to the mentioned problems it is usually necessary to explicitly
10014 specify the port as
10015 .Ql :465 ,
10016 however.
10018 The SUBMISSION protocol (RFC 6409) lives on server port 587 and
10019 is identically to the SMTP protocol from \*(UA's point of view;
10020 it requires setting
10021 .Va smtp-use-starttls
10022 to enter a SSL/TLS secured session state; e.g., \*(IN
10023 .Ql submission://[user[:password]@]server[:port] .
10025 The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is
10026 SSL/TLS secured by default.
10027 It can be chosen by assigning a value like \*(IN
10028 .Ql submissions://[user[:password]@]server[:port] .
10029 Due to the problems mentioned for SMTPS above and the fact that
10030 SUBMISSIONS is new and a successor that lives on the same port as the
10031 historical engineering mismanagement named SMTPS, it is usually
10032 necessary to explicitly specify the port as
10033 .Ql :465 .
10038 .It Va mta-arguments
10039 Arguments to pass through to a file-based
10040 .Va mta
10041 can be given via this variable, which is parsed according to
10042 .Sx "Shell-style argument quoting"
10043 into an array of arguments, and which will be joined onto MTA options
10044 from other sources, and then passed individually to the MTA:
10045 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
10048 .It Va mta-no-default-arguments
10049 \*(BO Unless this variable is set \*(UA will pass some well known
10050 standard command line options to a file-based
10051 .Va mta
10052 (Mail-Transfer-Agent), see there for more.
10055 .It Va mta-no-receiver-arguments
10056 \*(BO By default a file-based
10057 .Va mta
10058 will be passed all receiver addresses on the command line.
10059 This variable can be set to suppress any such argument.
10062 .It Va mta-argv0
10063 Many systems use a so-called
10064 .Xr mailwrapper 8
10065 environment to ensure compatibility with
10066 .Xr sendmail 1 .
10067 This works by inspecting the name that was used to invoke the mail
10068 delivery system.
10069 If this variable is set then the mailwrapper (the program that is
10070 actually executed when calling the file-based
10071 .Va mta )
10072 will treat its contents as that name.
10074 .Mx Va netrc-lookup
10075 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
10076 \*(BO\*(IN\*(OP Used to control usage of the user's
10077 .Pa \*(VN
10078 file for lookup of account credentials, as documented in the section
10079 .Sx "On URL syntax and credential lookup"
10080 and for the command
10081 .Ic netrc ;
10082 the section
10083 .Sx "The .netrc file"
10084 documents the file format.
10085 Also see
10086 .Va netrc-pipe .
10089 .It Va netrc-pipe
10090 \*(IN\*(OP When
10091 .Pa \*(VN
10092 is loaded (see
10093 .Ic netrc
10095 .Va netrc-lookup )
10096 then \*(UA will read the output of a shell pipe instead of the user's
10097 .Pa \*(VN
10098 file if this variable is set (to the desired shell command).
10099 This can be used to, e.g., store
10100 .Pa \*(VN
10101 in encrypted form:
10102 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
10105 .It Va newfolders
10106 If this variable has the value
10107 .Ql maildir ,
10108 newly created local folders will be in Maildir instead of MBOX format.
10111 .It Va newmail
10112 Checks for new mail in the current folder each time the prompt is shown.
10113 A Maildir folder must be re-scanned to determine if new mail has arrived.
10114 If this variable is set to the special value
10115 .Ql nopoll
10116 then a Maildir folder will not be rescanned completely, but only
10117 timestamp changes are detected.
10120 .It Va outfolder
10121 \*(BO Causes the filename given in the
10122 .Va record
10123 variable
10124 and the sender-based filenames for the
10125 .Ic Copy
10127 .Ic Save
10128 commands to be interpreted relative to the directory given in the
10129 .Va folder
10130 variable rather than to the current directory,
10131 unless it is set to an absolute pathname.
10133 .Mx Va on-account-cleanup
10134 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
10135 Macro hook which will be called once an
10136 .Ic account
10137 is left, as the very last step before unrolling per-account
10138 .Ic localopts .
10139 This hook is run even in case of fatal errors, and it is advisable to
10140 perform only absolutely necessary actions, like cleaning up
10141 .Ic alternates ,
10142 for example.
10143 The specialized form is used in favour of the generic one if found.
10146 .It Va on-compose-cleanup
10147 Macro hook which will be called after the message has been sent (or not,
10148 in case of failures), as the very last step before unrolling compose mode
10149 .Ic localopts .
10150 This hook is run even in case of fatal errors, and it is advisable to
10151 perform only absolutely necessary actions, like cleaning up
10152 .Ic alternates ,
10153 for example.
10155 For compose mode hooks that may affect the message content please see
10156 .Va on-compose-enter , on-compose-leave , on-compose-splice .
10157 \*(ID This hook exists because
10158 .Ic alias , alternates , commandalias , shortcut ,
10159 to name a few, are not covered by
10160 .Ic localopts :
10161 changes applied in compose mode will continue to be in effect thereafter.
10166 .It Va on-compose-enter , on-compose-leave
10167 Macro hooks which will be called once compose mode is entered,
10168 and after composing has been finished, but before a set
10169 .Va message-inject-tail
10170 has been injected etc., respectively.
10171 .Ic localopts
10172 are enabled for these hooks, and changes on variables will be forgotten
10173 after the message has been sent.
10174 .Va on-compose-cleanup
10175 can be used to perform other necessary cleanup steps.
10177 The following (read-only) variables will be set temporarily during
10178 execution of the macros to represent respective message headers, to
10179 the empty string otherwise; most of them correspond to according virtual
10180 message headers that can be accessed via
10181 .Ic ~^ ,
10182 one of the
10183 .Sx "COMMAND ESCAPES"
10184 (also from within
10185 .Va on-compose-splice
10186 hooks):
10189 .Bl -tag -compact -width ".It Va mailx_subject"
10190 .It Va mailx-command
10191 The command that generates the message.
10192 .It Va mailx-subject
10193 The subject.
10194 .It Va mailx-from
10195 .Va from .
10196 .It Va mailx-sender
10197 .Va sender .
10198 .It Va mailx-to , mailx-cc , mailx-bcc
10199 The list of receiver addresses as a space-separated list.
10200 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
10201 The list of receiver addresses before any mangling (due to, e.g.,
10202 .Ic alternates ,
10203 .Ic alias
10204 .Va recipients-in-cc )
10205 as a space-separated list.
10206 .It Va mailx-orig-from
10207 When replying, forwarding or resending, this will be set to the
10208 .Ql From:
10209 of the given message.
10210 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
10211 When replying, forwarding or resending, this will be set to the
10212 receivers of the given message.
10216 Here is am example that injects a signature via
10217 .Va message-inject-tail ;
10218 instead using
10219 .Va on-compose-splice
10220 to simply inject the file of desire via
10221 .Ic ~<
10223 .Ic ~<!
10224 may be a better approach.
10226 .Bd -literal -offset indent
10227 define t_ocl {
10228   vput ! i cat ~/.mysig
10229   if [ $? -eq 0 ]
10230      vput vexpr message-inject-tail trim-end $i
10231   end
10233   # Alternatively
10234   readctl create ~/.mysig
10235   if [ $? -eq 0 ]
10236     readall i
10237     if [ $? -eq 0 ]
10238       vput vexpr message-inject-tail trim-end $i
10239     end
10240     readctl remove ~/.mysig
10241   end
10243 set on-compose-leave=t_ocl
10249 .It Va on-compose-splice , on-compose-splice-shell
10250 These hooks run once the normal compose mode is finished, but before the
10251 .Va on-compose-leave
10252 macro hook is called, the
10253 .Va message-inject-tail
10254 is injected etc.
10255 Both hooks will be executed in a subprocess, with their input and output
10256 connected to \*(UA such that they can act as if they would be an
10257 interactive user.
10258 The difference in between them is that the latter is a
10259 .Ev SHELL
10260 command, whereas the former is a normal \*(UA macro, but which is
10261 restricted to a small set of commands (the
10262 .Va verbose
10263 output of, e.g.,
10264 .Ic list
10265 will indicate said capability).
10266 .Ic localopts
10267 are enabled for these hooks (in the parent process), causing any setting
10268 to be forgotten after the message has been sent;
10269 .Va on-compose-cleanup
10270 can be used to perform other cleanup as necessary.
10273 During execution of these hooks \*(UA will temporarily forget whether it
10274 has been started in interactive mode, (a restricted set of)
10275 .Sx "COMMAND ESCAPES"
10276 will always be available, and for guaranteed reproducibilities sake
10277 .Va escape
10279 .Va ifs
10280 will be set to their defaults.
10281 The compose mode command
10282 .Ic ~^
10283 has been especially designed for scriptability (via these hooks).
10284 The first line the hook will read on its standard input is the protocol
10285 version of said command escape, currently
10286 .Dq 0 0 1 :
10287 backward incompatible protocol changes have to be expected.
10290 Care must be taken to avoid deadlocks and other false control flow:
10291 if both involved processes wait for more input to happen at the
10292 same time, or one does not expect more input but the other is stuck
10293 waiting for consumption of its output, etc.
10294 There is no automatic synchronization of the hook: it will not be
10295 stopped automatically just because it, e.g., emits
10296 .Ql ~x .
10297 The hooks will however receive a termination signal if the parent enters
10298 an error condition.
10299 \*(ID Protection against and interaction with signals is not yet given;
10300 it is likely that in the future these scripts will be placed in an
10301 isolated session, which is signalled in its entirety as necessary.
10303 .Bd -literal -offset indent
10304 define ocs_signature {
10305   read version
10306   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
10308 set on-compose-splice=ocs_signature
10310 wysh set on-compose-splice-shell=$'\e
10311   read version;\e
10312   printf "hello $version!  Headers: ";\e
10313   echo \e'~^header list\e';\e
10314   read status result;\e
10315   echo "status=$status result=$result";\e
10316   '
10318 define ocsm {
10319   read version
10320   echo Splice protocol version is $version
10321   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
10322   if [ "$es" != 2 ]
10323     echoerr 'Cannot read header list'; echo '~x'; xit
10324   endif
10325   if [ "$hl" @i!% ' cc' ]
10326     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
10327       vput vexpr es substring "${es}" 0 1
10328     if [ "$es" != 2 ]
10329       echoerr 'Cannot insert Cc: header'; echo '~x'
10330       # (no xit, macro finishs anyway)
10331     endif
10332   endif
10334 set on-compose-splice=ocsm
10339 .It Va on-resend-cleanup
10340 \*(ID Identical to
10341 .Va on-compose-cleanup ,
10342 but is only triggered by
10343 .Ic resend .
10346 .It Va on-resend-enter
10347 \*(ID Identical to
10348 .Va on-compose-enter ,
10349 but is only triggered by
10350 .Ic resend .
10353 .It Va page
10354 \*(BO If set, each message feed through the command given for
10355 .Ic pipe
10356 is followed by a formfeed character
10357 .Ql \ef .
10359 .Mx Va password
10360 .It Va password-USER@HOST , password-HOST , password
10361 \*(IN Variable chain that sets a password, which is used in case none has
10362 been given in the protocol and account-specific URL;
10363 as a last resort \*(UA will ask for a password on the user's terminal if
10364 the authentication method requires a password.
10365 Specifying passwords in a startup file is generally a security risk;
10366 the file should be readable by the invoking user only.
10368 .It Va password-USER@HOST
10369 \*(OU (see the chain above for \*(IN)
10370 Set the password for
10371 .Ql USER
10372 when connecting to
10373 .Ql HOST .
10374 If no such variable is defined for a host,
10375 the user will be asked for a password on standard input.
10376 Specifying passwords in a startup file is generally a security risk;
10377 the file should be readable by the invoking user only.
10380 .It Va piperaw
10381 \*(BO Send messages to the
10382 .Ic pipe
10383 command without performing MIME and character set conversions.
10387 .It Va pipe-TYPE/SUBTYPE
10388 When a MIME message part of type
10389 .Ql TYPE/SUBTYPE
10390 (case-insensitive) is displayed or quoted,
10391 its text is filtered through the value of this variable interpreted as
10392 a shell command.
10393 Note that only parts which can be displayed inline as plain text (see
10394 .Cd copiousoutput )
10395 are displayed unless otherwise noted, other MIME parts will only be
10396 considered by and for the command
10397 .Ic mimeview .
10400 The special value commercial at
10401 .Ql @
10402 forces interpretation of the message part as plain text, e.g.,
10403 .Ql set pipe-application/xml=@
10404 will henceforth display XML
10405 .Dq as is .
10406 (The same could also be achieved by adding a MIME type marker with the
10407 .Ic mimetype
10408 command.
10409 And \*(OPally MIME type handlers may be defined via
10410 .Sx "The Mailcap files"
10411 \(em these directives,
10412 .Cd copiousoutput
10413 has already been used, should be referred to for further documentation.
10416 The commercial at
10417 .Ql @
10418 can in fact be used as a trigger character to adjust usage and behaviour
10419 of a following shell command specification more thoroughly by appending
10420 more special characters which refer to further mailcap directives, e.g.,
10421 the following hypothetical command specification could be used:
10423 .Bd -literal -offset indent
10424 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
10428 .Bl -tag -compact -width ".It Ql __"
10429 .It Ql *
10430 The command produces plain text to be integrated in \*(UAs output:
10431 .Cd copiousoutput .
10433 .It Ql #
10434 If set the handler will not be invoked when a message is to be quoted,
10435 but only when it will be displayed:
10436 .Cd x-mailx-noquote .
10438 .It Ql &
10439 Run the command asynchronously, i.e., without blocking \*(UA:
10440 .Cd x-mailx-async .
10442 .It Ql \&!
10443 The command must be run on an interactive terminal, \*(UA will
10444 temporarily release the terminal to it:
10445 .Cd needsterminal .
10447 .It Ql +
10448 Request creation of a zero-sized temporary file, the absolute pathname
10449 of which will be made accessible via the environment variable
10450 .Ev MAILX_FILENAME_TEMPORARY :
10451 .Cd x-mailx-tmpfile .
10452 If given twice then the file will be unlinked automatically by \*(UA
10453 when the command loop is entered again at latest:
10454 .Cd x-mailx-tmpfile-unlink .
10456 .It Ql =
10457 Normally the MIME part content is passed to the handler via standard
10458 input; if this flag is set then the data will instead be written into
10459 .Ev MAILX_FILENAME_TEMPORARY
10460 .Pf ( Cd x-mailx-tmpfile-fill ) ,
10461 the creation of which is implied; note however that in order to cause
10462 deletion of the temporary file you still have to use two plus signs
10463 .Ql ++
10464 explicitly!
10466 .It Ql @
10467 To avoid ambiguities with normal shell command content you can use
10468 another commercial at to forcefully terminate interpretation of
10469 remaining characters.
10470 (Any character not in this list will have the same effect.)
10474 Some information about the MIME part to be displayed is embedded into
10475 the environment of the shell command:
10478 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
10480 .It Ev MAILX_CONTENT
10481 The MIME content-type of the part, if known, the empty string otherwise.
10484 .It Ev MAILX_CONTENT_EVIDENCE
10486 .Va mime-counter-evidence
10487 includes the carry-around-bit (2), then this will be set to the detected
10488 MIME content-type; not only then identical to
10489 .Ev \&\&MAILX_CONTENT
10490 otherwise.
10493 .It Ev MAILX_EXTERNAL_BODY_URL
10494 MIME parts of type
10495 .Ql message/external-body access-type=url
10496 will store the access URL in this variable, it is empty otherwise.
10499 .It Ev MAILX_FILENAME
10500 The filename, if any is set, the empty string otherwise.
10503 .It Ev MAILX_FILENAME_GENERATED
10504 A random string.
10507 .It Ev MAILX_FILENAME_TEMPORARY
10508 If temporary file creation has been requested through the command prefix
10509 this variable will be set and contain the absolute pathname of the
10510 temporary file.
10515 .It Va pipe-EXTENSION
10516 This is identical to
10517 .Va pipe-TYPE/SUBTYPE
10518 except that
10519 .Ql EXTENSION
10520 (normalized to lowercase using character mappings of the ASCII charset)
10521 names a file extension, e.g.,
10522 .Ql xhtml .
10523 Handlers registered using this method take precedence.
10525 .Mx Va pop3-auth
10526 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
10527 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
10528 The only possible value as of now is
10529 .Ql plain ,
10530 which is thus the default.
10532 .Mx Va pop3-bulk-load
10533 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
10534 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
10535 the messages, and only requests the message bodies on user request.
10536 For the POP3 protocol this means that the message headers will be
10537 downloaded twice.
10538 If this variable is set then \*(UA will download only complete messages
10539 from the given POP3 server(s) instead.
10541 .Mx Va pop3-keepalive
10542 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
10543 \*(OP POP3 servers close the connection after a period of inactivity;
10544 the standard requires this to be at least 10 minutes,
10545 but practical experience may vary.
10546 Setting this variable to a numeric value greater than
10547 .Ql 0
10548 causes a
10549 .Ql NOOP
10550 command to be sent each value seconds if no other operation is performed.
10552 .Mx Va pop3-no-apop
10553 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
10554 \*(BO\*(OP Unless this variable is set the
10555 .Ql APOP
10556 authentication method will be used when connecting to a POP3 server that
10557 advertises support.
10558 The advantage of
10559 .Ql APOP
10560 is that the password is not sent in clear text over the wire and that
10561 only a single packet is sent for the user/password tuple.
10562 Note that
10563 .Va pop3-no-apop-HOST
10564 requires \*(IN.
10566 .Mx Va pop3-use-starttls
10567 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
10568 \*(BO\*(OP Causes \*(UA to issue a
10569 .Ql STLS
10570 command to make an unencrypted POP3 session SSL/TLS encrypted.
10571 This functionality is not supported by all servers,
10572 and is not used if the session is already encrypted by the POP3S method.
10573 Note that
10574 .Va pop3-use-starttls-HOST
10575 requires \*(IN.
10579 .It Va posix
10580 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
10581 where that deviates from standardized behaviour.
10582 It will be set implicitly before the
10583 .Sx "Resource files"
10584 are loaded if the environment variable
10585 .Ev POSIXLY_CORRECT
10586 is set, and adjusting any of those two will be reflected by the other
10587 one implicitly.
10588 The following behaviour is covered and enforced by this mechanism:
10591 .Bl -bullet -compact
10593 In non-interactive mode, any error encountered while loading resource
10594 files during program startup will cause a program exit, whereas in
10595 interactive mode such errors will stop loading of the currently loaded
10596 (stack of) file(s, i.e., recursively).
10597 These exits can be circumvented on a per-command base by using
10598 .Cm ignerr ,
10599 one of the
10600 .Sx "Command modifiers" ,
10601 for each command which shall be allowed to fail.
10604 .Ic alternates
10605 will replace the list of alternate addresses instead of appending to it.
10608 The variable inserting
10609 .Sx "COMMAND ESCAPES"
10610 .Ic ~A ,
10611 .Ic ~a ,
10612 .Ic ~I
10614 .Ic ~i
10615 will expand embedded character sequences
10616 .Ql \et
10617 horizontal tabulator and
10618 .Ql \en
10619 line feed.
10620 \*(ID For compatibility reasons this step will always be performed.
10623 Upon changing the active
10624 .Ic file
10625 no summary of
10626 .Ic headers
10627 will be displayed even if
10628 .Va header
10629 is set.
10632 Setting
10633 .Va ignoreeof
10634 implies the behaviour described by
10635 .Va dot .
10638 The variable
10639 .Va keep
10640 is extended to cover any empty mailbox, not only empty
10641 .Mx -sx
10642 .Sx "primary system mailbox" Ns
10643 es: they will be removed when they are left in empty state otherwise.
10648 .It Va print-alternatives
10649 \*(BO When a MIME message part of type
10650 .Ql multipart/alternative
10651 is displayed and it contains a subpart of type
10652 .Ql text/plain ,
10653 other parts are normally discarded.
10654 Setting this variable causes all subparts to be displayed,
10655 just as if the surrounding part was of type
10656 .Ql multipart/mixed .
10659 .It Va prompt
10660 The string used as a prompt in interactive mode.
10661 Whenever the variable is evaluated the value is treated as if specified
10662 within dollar-single-quotes (see
10663 .Sx "Shell-style argument quoting" ) .
10664 This (post-assignment, i.e., second) expansion can be used to embed
10665 status information, for example
10666 .Va \&? ,
10667 .Va \&! ,
10668 .Va account
10670 .Va mailbox-display .
10672 In order to embed characters which should not be counted when
10673 calculating the visual width of the resulting string, enclose the
10674 characters of interest in a pair of reverse solidus escaped brackets:
10675 .Ql \e[\eE[0m\e] ;
10676 a slot for coloured prompts is also available with the \*(OPal command
10677 .Ic colour .
10678 Prompting may be prevented by setting this to the null string
10679 (a.k.a.\|
10680 .Ql set noprompt ) .
10683 .It Va prompt2
10684 This string is used for secondary prompts, but is otherwise identical to
10685 .Va prompt .
10686 The default is
10687 .Ql ..\0 .
10690 .It Va quiet
10691 \*(BO Suppresses the printing of the version when first invoked.
10694 .It Va quote
10695 If set, \*(UA starts a replying message with the original message
10696 prefixed by the value of the variable
10697 .Va indentprefix .
10698 Normally, a heading consisting of
10699 .Dq Fromheaderfield wrote:
10700 is put before the quotation.
10701 If the string
10702 .Ql noheading
10703 is assigned to the
10704 .Va \&\&quote
10705 variable, this heading is omitted.
10706 If the string
10707 .Ql headers
10708 is assigned, only the headers selected by the
10709 .Ql type
10710 .Ic headerpick
10711 selection are put above the message body,
10712 thus
10713 .Va \&\&quote
10714 acts like an automatic
10715 .Pf ` Ic ~m Ns '
10716 .Sx "COMMAND ESCAPES"
10717 command, then.
10718 If the string
10719 .Ql allheaders
10720 is assigned, all headers are put above the message body and all MIME
10721 parts are included, making
10722 .Va \&\&quote
10723 act like an automatic
10724 .Pf ` Ic ~M Ns '
10725 command; also see
10726 .Va quote-as-attachment .
10729 .It Va quote-as-attachment
10730 \*(BO Add the original message in its entirety as a
10731 .Ql message/rfc822
10732 MIME attachment when replying to a message.
10733 Note this works regardless of the setting of
10734 .Va quote .
10737 .It Va quote-chars
10738 Can be set to a string consisting of non-whitespace ASCII characters
10739 which shall be treated as quotation leaders, the default being
10740 .Ql >|}: .
10743 .It Va quote-fold
10744 \*(OP Can be set in addition to
10745 .Va indentprefix .
10746 Setting this turns on a more fancy quotation algorithm in that leading
10747 quotation characters
10748 .Pf ( Va quote-chars )
10749 are compressed and overlong lines are folded.
10750 .Va \&\&quote-fold
10751 can be set to either one or two (space separated) numeric values,
10752 which are interpreted as the maximum (goal) and the minimum line length,
10753 respectively, in a spirit rather equal to the
10754 .Xr fmt 1
10755 program, but line-, not paragraph-based.
10756 If not set explicitly the minimum will reflect the goal algorithmically.
10757 The goal cannot be smaller than the length of
10758 .Va indentprefix
10759 plus some additional pad.
10760 Necessary adjustments take place silently.
10763 .It Va r-option-implicit
10764 \*(BO Setting this option evaluates the contents of
10765 .Va from
10766 (or, if that contains multiple addresses,
10767 .Va sender )
10768 and passes the results onto the used (file-based) MTA as described for the
10769 .Fl r
10770 option (empty argument case).
10773 .It Va recipients-in-cc
10774 \*(BO When doing a
10775 .Ic reply ,
10776 the original
10777 .Ql From:
10779 .Ql To:
10780 are by default merged into the new
10781 .Ql To: .
10782 If this variable is set, only the original
10783 .Ql From:
10784 ends in the new
10785 .Ql To: ,
10786 the rest is merged into
10787 .Ql Cc: .
10790 .It Va record
10791 Unless this variable is defined, no copies of outgoing mail will be saved.
10792 If defined it gives the pathname, subject to the usual
10793 .Sx "Filename transformations" ,
10794 of a folder where all new, replied-to or forwarded messages are saved:
10795 when saving to this folder fails the message is not sent, but instead
10796 .Va save Ns
10797 d to
10798 .Ev DEAD .
10799 The standard defines that relative (fully expanded) paths are to be
10800 interpreted relative to the current directory
10801 .Pf ( Ic cwd ) ,
10802 to force interpretation relative to
10803 .Va folder
10804 .Va outfolder
10805 needs to be set in addition.
10808 .It Va record-files
10809 \*(BO If this variable is set the meaning of
10810 .Va record
10811 will be extended to cover messages which target only file and pipe
10812 recipients (see
10813 .Va expandaddr ) .
10814 These address types will not appear in recipient lists unless
10815 .Va add-file-recipients
10816 is also set.
10819 .It Va record-resent
10820 \*(BO If this variable is set the meaning of
10821 .Va record
10822 will be extended to also cover the
10823 .Ic resend
10825 .Ic Resend
10826 commands.
10829 .It Va reply-in-same-charset
10830 \*(BO If this variable is set \*(UA first tries to use the same
10831 character set of the original message for replies.
10832 If this fails, the mechanism described in
10833 .Sx "Character sets"
10834 is evaluated as usual.
10837 .It Va reply-strings
10838 Can be set to a comma-separated list of (case-insensitive according to
10839 ASCII rules) strings which shall be recognized in addition to the
10840 built-in strings as
10841 .Ql Subject:
10842 reply message indicators \(en built-in are
10843 .Ql Re: ,
10844 which is mandated by RFC 5322, as well as the german
10845 .Ql Aw: ,
10846 .Ql Antw: ,
10847 and the
10848 .Ql Wg:
10849 which often has been seen in the wild;
10850 I.e., the separating colon has to be specified explicitly.
10853 .It Va reply-to
10854 A list of addresses to put into the
10855 .Ql Reply-To:
10856 field of the message header.
10857 Members of this list are handled as if they were in the
10858 .Ic alternates
10859 list.
10861 .It Va replyto
10862 \*(OB Variant of
10863 .Va reply-to .
10866 .It Va reply-to-honour
10867 Controls whether a
10868 .Ql Reply-To:
10869 header is honoured when replying to a message via
10870 .Ic reply
10872 .Ic Lreply .
10873 This is a quadoption; if set without a value it defaults to
10874 .Dq yes .
10877 .It Va rfc822-body-from_
10878 \*(BO This variable can be used to force displaying a so-called
10879 .Ql From_
10880 line for messages that are embedded into an envelope mail via the
10881 .Ql message/rfc822
10882 MIME mechanism, for more visual convenience.
10885 .It Va save
10886 \*(BO Enable saving of (partial) messages in
10887 .Ev DEAD
10888 upon interrupt or delivery error.
10891 .It Va screen
10892 The number of lines that represents a
10893 .Dq screenful
10894 of lines, used in
10895 .Ic headers
10896 summary display,
10897 .Ic from
10898 .Ic search Ns
10899 ing, message
10900 .Ic top Ns
10901 line display and scrolling via
10902 .Ic z .
10903 If this variable is not set \*(UA falls back to a calculation based upon
10904 the detected terminal window size and the baud rate: the faster the
10905 terminal, the more will be shown.
10906 Overall screen dimensions and pager usage is influenced by the
10907 environment variables
10908 .Ev COLUMNS
10910 .Ev LINES
10911 and the variable
10912 .Va crt .
10915 .It Va searchheaders
10916 \*(BO Expand message-list specifiers in the form
10917 .Ql /x:y
10918 to all messages containing the substring
10919 .Dq y
10920 in the header field
10921 .Ql x .
10922 The string search is case insensitive.
10925 .It Va sendcharsets
10926 \*(OP A comma-separated list of character set names that can be used in
10927 outgoing internet mail.
10928 The value of the variable
10929 .Va charset-8bit
10930 is automatically appended to this list of character sets.
10931 If no character set conversion capabilities are compiled into \*(UA then
10932 the only supported charset is
10933 .Va ttycharset .
10934 Also see
10935 .Va sendcharsets-else-ttycharset
10936 and refer to the section
10937 .Sx "Character sets"
10938 for the complete picture of character set conversion in \*(UA.
10941 .It Va sendcharsets-else-ttycharset
10942 \*(BO\*(OP If this variable is set, but
10943 .Va sendcharsets
10944 is not, then \*(UA acts as if
10945 .Va sendcharsets
10946 had been set to the value of the variable
10947 .Va ttycharset .
10948 In effect this combination passes through the message data in the
10949 character set of the current locale encoding:
10950 therefore mail message text will be (assumed to be) in ISO-8859-1
10951 encoding when send from within a ISO-8859-1 locale, and in UTF-8
10952 encoding when send from within an UTF-8 locale.
10954 The 8-bit fallback
10955 .Va charset-8bit
10956 never comes into play as
10957 .Va ttycharset
10958 is implicitly assumed to be 8-bit and capable to represent all files the
10959 user may specify (as is the case when no character set conversion
10960 support is available in \*(UA and the only supported character set is
10961 .Va ttycharset :
10962 .Sx "Character sets" ) .
10963 This might be a problem for scripts which use the suggested
10964 .Ql LC_ALL=C
10965 setting, since in this case the character set is US-ASCII by definition,
10966 so that it is better to also override
10967 .Va ttycharset ,
10968 then.
10971 .It Va sender
10972 An address that is put into the
10973 .Ql Sender:
10974 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
10975 responsible for the actual transmission of the message.
10976 This field should normally not be used unless the
10977 .Va from
10978 field contains more than one address, on which case it is required.
10980 .Va \&\&sender
10981 address is handled as if it were in the
10982 .Ic alternates
10983 list; also see
10984 .Fl r ,
10985 .Va r-option-implicit .
10987 .It Va sendmail
10988 \*(OB Predecessor of
10989 .Va mta .
10991 .It Va sendmail-arguments
10992 \*(OB Predecessor of
10993 .Va mta-arguments .
10995 .It Va sendmail-no-default-arguments
10996 \*(OB\*(BO Predecessor of
10997 .Va mta-no-default-arguments .
10999 .It Va sendmail-progname
11000 \*(OB Predecessor of
11001 .Va mta-argv0 .
11004 .It Va sendwait
11005 \*(BO When sending a message wait until the
11006 .Va mta
11007 (including the built-in SMTP one) exits before accepting further commands.
11008 .Sy Only
11009 with this variable set errors reported by the MTA will be recognizable!
11010 If the MTA returns a non-zero exit status,
11011 the exit status of \*(UA will also be non-zero.
11014 .It Va showlast
11015 \*(BO This setting causes \*(UA to start at the last message
11016 instead of the first one when opening a mail folder, as well as with
11017 .Ic from
11019 .Ic headers .
11022 .It Va showname
11023 \*(BO Causes \*(UA to use the sender's real name instead of the plain
11024 address in the header field summary and in message specifications.
11027 .It Va showto
11028 \*(BO Causes the recipient of the message to be shown in the header
11029 summary if the message was sent by the user.
11032 .It Va Sign
11033 The value backing
11034 .Ic ~A ,
11035 one of the
11036 .Sx "COMMAND ESCAPES" .
11037 Also see
11038 .Va message-inject-tail ,
11039 .Va on-compose-leave
11041 .Va on-compose-splice .
11044 .It Va sign
11045 The value backing
11046 .Ic ~a ,
11047 one of the
11048 .Sx "COMMAND ESCAPES" .
11049 Also see
11050 .Va message-inject-tail ,
11051 .Va on-compose-leave
11053 .Va on-compose-splice .
11056 .It Va signature
11057 \*(OB Please use
11058 .Va on-compose-splice
11060 .Va on-compose-splice-shell
11062 .Va on-compose-leave
11063 and (if necessary)
11064 .Va message-inject-tail
11065 instead!
11068 .It Va skipemptybody
11069 \*(BO If an outgoing message does not contain any text in its first or
11070 only message part, do not send it but discard it silently (see also the
11071 command line option
11072 .Fl E ) .
11076 .It Va smime-ca-dir , smime-ca-file
11077 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
11078 Enhanced Mail) format as a directory and a file, respectively, for the
11079 purpose of verification of S/MIME signed messages.
11080 It is possible to set both, the file will be loaded immediately, the
11081 directory will be searched whenever no match has yet been found.
11082 The set of CA certificates which are built into the SSL/TLS library can
11083 be explicitly turned off by setting
11084 .Va smime-ca-no-defaults ,
11085 and further fine-tuning is possible via
11086 .Va smime-ca-flags .
11089 .It Va smime-ca-flags
11090 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
11091 storage, and the certificate verification that is used.
11092 The actual values and their meanings are documented for
11093 .Va ssl-ca-flags .
11096 .It Va smime-ca-no-defaults
11097 \*(BO\*(OP Do not load the default CA locations that are built into the
11098 used to SSL/TLS library to verify S/MIME signed messages.
11100 .Mx Va smime-cipher
11101 .It Va smime-cipher-USER@HOST , smime-cipher
11102 \*(OP Specifies the cipher to use when generating S/MIME encrypted
11103 messages (for the specified account).
11104 RFC 5751 mandates a default of
11105 .Ql aes128
11106 (AES-128 CBC).
11107 Possible values are (case-insensitive and) in decreasing cipher strength:
11108 .Ql aes256
11109 (AES-256 CBC),
11110 .Ql aes192
11111 (AES-192 CBC),
11112 .Ql aes128
11113 (AES-128 CBC),
11114 .Ql des3
11115 (DES EDE3 CBC, 168 bits; default if
11116 .Ql aes128
11117 is not available) and
11118 .Ql des
11119 (DES CBC, 56 bits).
11121 The actually available cipher algorithms depend on the cryptographic
11122 library that \*(UA uses.
11123 \*(OP Support for more cipher algorithms may be available through
11124 dynamic loading via, e.g.,
11125 .Xr EVP_get_cipherbyname 3
11126 (OpenSSL) if \*(UA has been compiled to support this.
11129 .It Va smime-crl-dir
11130 \*(OP Specifies a directory that contains files with CRLs in PEM format
11131 to use when verifying S/MIME messages.
11134 .It Va smime-crl-file
11135 \*(OP Specifies a file that contains a CRL in PEM format to use when
11136 verifying S/MIME messages.
11139 .It Va smime-encrypt-USER@HOST
11140 \*(OP If this variable is set, messages send to the given receiver are
11141 encrypted before sending.
11142 The value of the variable must be set to the name of a file that
11143 contains a certificate in PEM format.
11145 If a message is sent to multiple recipients,
11146 each of them for whom a corresponding variable is set will receive an
11147 individually encrypted message;
11148 other recipients will continue to receive the message in plain text
11149 unless the
11150 .Va smime-force-encryption
11151 variable is set.
11152 It is recommended to sign encrypted messages, i.e., to also set the
11153 .Va smime-sign
11154 variable.
11157 .It Va smime-force-encryption
11158 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
11161 .It Va smime-sign
11162 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
11163 and include the user's certificate as a MIME attachment.
11164 Signing a message enables a recipient to verify that the sender used
11165 a valid certificate,
11166 that the email addresses in the certificate match those in the message
11167 header and that the message content has not been altered.
11168 It does not change the message text,
11169 and people will be able to read the message as usual.
11170 Also see
11171 .Va smime-sign-cert , smime-sign-include-certs
11173 .Va smime-sign-message-digest .
11175 .Mx Va smime-sign-cert
11176 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
11177 \*(OP Points to a file in PEM format.
11178 For the purpose of signing and decryption this file needs to contain the
11179 user's private key, followed by his certificate.
11181 For message signing
11182 .Ql USER@HOST
11183 is always derived from the value of
11184 .Va from
11185 (or, if that contains multiple addresses,
11186 .Va sender ) .
11187 For the purpose of encryption the recipient's public encryption key
11188 (certificate) is expected; the command
11189 .Ic certsave
11190 can be used to save certificates of signed messages (the section
11191 .Sx "Signed and encrypted messages with S/MIME"
11192 gives some details).
11193 This mode of operation is usually driven by the specialized form.
11195 When decrypting messages the account is derived from the recipient
11196 fields
11197 .Pf ( Ql To:
11199 .Ql Cc: )
11200 of the message, which are searched for addresses for which such
11201 a variable is set.
11202 \*(UA always uses the first address that matches,
11203 so if the same message is sent to more than one of the user's addresses
11204 using different encryption keys, decryption might fail.
11206 For signing and decryption purposes it is possible to use encrypted
11207 keys, and the pseudo-host(s)
11208 .Ql USER@HOST.smime-cert-key
11209 for the private key
11210 (and
11211 .Ql USER@HOST.smime-cert-cert
11212 for the certificate stored in the same file)
11213 will be used for performing any necessary password lookup,
11214 therefore the lookup can be automated via the mechanisms described in
11215 .Sx "On URL syntax and credential lookup" .
11216 For example, the hypothetical address
11217 .Ql bob@exam.ple
11218 could be driven with a private key / certificate pair path defined in
11219 .Va \&\&smime-sign-cert-bob@exam.ple ,
11220 and needed passwords would then be looked up via the pseudo hosts
11221 .Ql bob@exam.ple.smime-cert-key
11222 (and
11223 .Ql bob@exam.ple.smime-cert-cert ) .
11224 To include intermediate certificates, use
11225 .Va smime-sign-include-certs .
11227 .Mx Va smime-sign-include-certs
11228 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
11229 \*(OP If used, this is supposed to a consist of a comma-separated list
11230 of files, each of which containing a single certificate in PEM format to
11231 be included in the S/MIME message in addition to the
11232 .Va smime-sign-cert
11233 certificate.
11234 This can be used to include intermediate certificates of the certificate
11235 authority, in order to allow the receiver's S/MIME implementation to
11236 perform a verification of the entire certificate chain, starting from
11237 a local root certificate, over the intermediate certificates, down to the
11238 .Va smime-sign-cert .
11239 Even though top level certificates may also be included in the chain,
11240 they won't be used for the verification on the receiver's side.
11242 For the purpose of the mechanisms involved here,
11243 .Ql USER@HOST
11244 refers to the content of the internal variable
11245 .Va from
11246 (or, if that contains multiple addresses,
11247 .Va sender ) .
11248 The pseudo-host
11249 .Ql USER@HOST.smime-include-certs
11250 will be used for performing password lookups for these certificates,
11251 shall they have been given one, therefore the lookup can be automated
11252 via the mechanisms described in
11253 .Sx "On URL syntax and credential lookup" .
11255 .Mx Va smime-sign-message-digest
11256 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
11257 \*(OP Specifies the message digest to use when signing S/MIME messages.
11258 RFC 5751 mandates a default of
11259 .Ql sha1 .
11260 Possible values are (case-insensitive and) in decreasing cipher strength:
11261 .Ql sha512 ,
11262 .Ql sha384 ,
11263 .Ql sha256 ,
11264 .Ql sha224
11266 .Ql md5 .
11268 The actually available message digest algorithms depend on the
11269 cryptographic library that \*(UA uses.
11270 \*(OP Support for more message digest algorithms may be available
11271 through dynamic loading via, e.g.,
11272 .Xr EVP_get_digestbyname 3
11273 (OpenSSL) if \*(UA has been compiled to support this.
11274 Remember that for this
11275 .Ql USER@HOST
11276 refers to the variable
11277 .Va from
11278 (or, if that contains multiple addresses,
11279 .Va sender ) .
11281 .It Va smtp
11282 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
11283 .Va mta .
11284 \*(ID For compatibility reasons a set
11285 .Va smtp
11286 is used in preference of
11287 .Va mta .
11289 .Mx Va smtp-auth
11290 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
11291 \*(OP Variable chain that controls the SMTP
11292 .Va mta
11293 authentication method, possible values are
11294 .Ql none
11295 (\*(OU default),
11296 .Ql plain
11297 (\*(IN default),
11298 .Ql login
11299 as well as the \*(OPal methods
11300 .Ql cram-md5
11302 .Ql gssapi .
11304 .Ql none
11305 method does not need any user credentials,
11306 .Ql gssapi
11307 requires a user name and all other methods require a user name and
11308 a password.
11309 See \*(IN
11310 .Va mta ,
11311 .Va user
11313 .Va password
11314 (\*(OU
11315 .Va smtp-auth-password
11317 .Va smtp-auth-user ) .
11318 Note that
11319 .Va smtp-auth-HOST
11320 is \*(IN.
11321 \*(OU: Note for
11322 .Va smtp-auth-USER@HOST :
11323 may override dependent on sender address in the variable
11324 .Va from .
11326 .It Va smtp-auth-password
11327 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
11328 If the authentication method requires a password, but neither
11329 .Va smtp-auth-password
11330 nor a matching
11331 .Va smtp-auth-password-USER@HOST
11332 can be found,
11333 \*(UA will ask for a password on the user's terminal.
11335 .It Va smtp-auth-password-USER@HOST
11336 \*(OU Overrides
11337 .Va smtp-auth-password
11338 for specific values of sender addresses, dependent upon the variable
11339 .Va from .
11341 .It Va smtp-auth-user
11342 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
11343 If the authentication method requires a user name, but neither
11344 .Va smtp-auth-user
11345 nor a matching
11346 .Va smtp-auth-user-USER@HOST
11347 can be found,
11348 \*(UA will ask for a user name on the user's terminal.
11350 .It Va smtp-auth-user-USER@HOST
11351 \*(OU Overrides
11352 .Va smtp-auth-user
11353 for specific values of sender addresses, dependent upon the variable
11354 .Va from .
11357 .It Va smtp-hostname
11358 \*(OP\*(IN Normally \*(UA uses the variable
11359 .Va from
11360 to derive the necessary
11361 .Ql USER@HOST
11362 information in order to issue a
11363 .Ql MAIL FROM:<>
11364 SMTP
11365 .Va mta
11366 command.
11367 Setting
11368 .Va smtp-hostname
11369 can be used to use the
11370 .Ql USER
11371 from the SMTP account
11372 .Pf ( Va mta
11373 or the
11374 .Va user
11375 variable chain)
11376 and the
11377 .Ql HOST
11378 from the content of this variable (or, if that is the empty string,
11379 .Va hostname
11380 or the local hostname as a last resort).
11381 This often allows using an address that is itself valid but hosted by
11382 a provider other than which (in
11383 .Va from )
11384 is about to send the message.
11385 Setting this variable also influences generated
11386 .Ql Message-ID:
11388 .Ql Content-ID:
11389 header fields.
11390 If the \*(OPal IDNA support is available (see
11391 .Va idna-disable )
11392 variable assignment is aborted when a necessary conversion fails.
11394 .Mx Va smtp-use-starttls
11395 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
11396 \*(BO\*(OP Causes \*(UA to issue a
11397 .Ql STARTTLS
11398 command to make an SMTP
11399 .Va mta
11400 session SSL/TLS encrypted, i.e., to enable transport layer security.
11402 .Mx Va socks-proxy
11403 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
11404 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
11405 \*(UA will proxy all of its network activities through it.
11406 This can be used to proxy SMTP, POP3 etc. network traffic through the
11407 Tor anonymizer, for example.
11408 The following would create a local SOCKS proxy on port 10000 that
11409 forwards to the machine
11410 .Ql HOST ,
11411 and from which the network traffic is actually instantiated:
11412 .Bd -literal -offset indent
11413 # Create local proxy server in terminal 1 forwarding to HOST
11414 $ ssh -D 10000 USER@HOST
11415 # Then, start a client that uses it in terminal 2
11416 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
11420 .It Va spam-interface
11421 \*(OP In order to use any of the spam-related commands (like, e.g.,
11422 .Ic spamrate )
11423 the desired spam interface must be defined by setting this variable.
11424 Please refer to the manual section
11425 .Sx "Handling spam"
11426 for the complete picture of spam handling in \*(UA.
11427 All or none of the following interfaces may be available:
11429 .Bl -tag -width ".It Ql _ilte_"
11430 .It Ql spamc
11431 Interaction with
11432 .Xr spamc 1
11433 from the
11434 .Xr spamassassin 1
11435 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
11436 suite.
11437 Different to the generic filter interface \*(UA will automatically add
11438 the correct arguments for a given command and has the necessary
11439 knowledge to parse the program's output.
11440 A default value for
11441 .Va spamc-command
11442 will have been compiled into the \*(UA binary if
11443 .Xr spamc 1
11444 has been found in
11445 .Ev PATH
11446 during compilation.
11447 Shall it be necessary to define a specific connection type (rather than
11448 using a configuration file for that), the variable
11449 .Va spamc-arguments
11450 can be used as in, e.g.,
11451 .Ql -d server.example.com -p 783 .
11452 It is also possible to specify a per-user configuration via
11453 .Va spamc-user .
11454 Note that this interface does not inspect the
11455 .Ql is-spam
11456 flag of a message for the command
11457 .Ic spamforget .
11459 .It Ql filter
11460 generic spam filter support via freely configurable hooks.
11461 This interface is meant for programs like
11462 .Xr bogofilter 1
11463 and requires according behaviour in respect to the hooks' exit
11464 status for at least the command
11465 .Ic spamrate
11466 .Pf ( Ql 0
11467 meaning a message is spam,
11468 .Ql 1
11469 for non-spam,
11470 .Ql 2
11471 for unsure and any other return value indicating a hard error);
11472 since the hooks can include shell code snippets diverting behaviour
11473 can be intercepted as necessary.
11474 The hooks are
11475 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
11476   spamfilter-rate
11478 .Va spamfilter-spam ;
11479 the manual section
11480 .Sx "Handling spam"
11481 contains examples for some programs.
11482 The process environment of the hooks will have the variable
11483 .Ev MAILX_FILENAME_GENERATED
11484 set.
11485 Note that spam score support for
11486 .Ic spamrate
11487 is not supported unless the \*(OPtional regular expression support is
11488 available and the
11489 .Va spamfilter-rate-scanscore
11490 variable is set.
11495 .It Va spam-maxsize
11496 \*(OP Messages that exceed this size will not be passed through to the
11497 configured
11498 .Va spam-interface .
11499 If unset or 0, the default of 420000 bytes is used.
11502 .It Va spamc-command
11503 \*(OP The path to the
11504 .Xr spamc 1
11505 program for the
11506 .Ql spamc
11507 .Va spam-interface .
11508 Note that the path is not expanded, but used
11509 .Dq as is .
11510 A fallback path will have been compiled into the \*(UA binary if the
11511 executable had been found during compilation.
11514 .It Va spamc-arguments
11515 \*(OP Even though \*(UA deals with most arguments for the
11516 .Ql spamc
11517 .Va spam-interface
11518 automatically, it may at least sometimes be desirable to specify
11519 connection-related ones via this variable, e.g.,
11520 .Ql -d server.example.com -p 783 .
11523 .It Va spamc-user
11524 \*(OP Specify a username for per-user configuration files for the
11525 .Ql spamc
11526 .Va spam-interface .
11527 If this is set to the empty string then \*(UA will use the name of the
11528 current
11529 .Va user .
11536 .It Va spamfilter-ham , spamfilter-noham , \
11537   spamfilter-nospam , spamfilter-rate , spamfilter-spam
11538 \*(OP Command and argument hooks for the
11539 .Ql filter
11540 .Va spam-interface .
11541 The manual section
11542 .Sx "Handling spam"
11543 contains examples for some programs.
11546 .It Va spamfilter-rate-scanscore
11547 \*(OP Because of the generic nature of the
11548 .Ql filter
11549 .Va spam-interface
11550 spam scores are not supported for it by default, but if the \*(OPnal
11551 regular expression support is available then setting this variable can
11552 be used to overcome this restriction.
11553 It is interpreted as follows: first a number (digits) is parsed that
11554 must be followed by a semicolon
11555 .Ql \&;
11556 and an extended regular expression.
11557 Then the latter is used to parse the first output line of the
11558 .Va spamfilter-rate
11559 hook, and, in case the evaluation is successful, the group that has been
11560 specified via the number is interpreted as a floating point scan score.
11562 .Mx Va ssl-ca-dir
11563 .Mx Va ssl-ca-file
11564 .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\
11565   ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file
11566 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
11567 Enhanced Mail) format as a directory and a file, respectively, for the
11568 purpose of verification of SSL/TLS server certificates.
11569 It is possible to set both, the file will be loaded immediately, the
11570 directory will be searched whenever no match has yet been found.
11571 The set of CA certificates which are built into the SSL/TLS library can
11572 be explicitly turned off by setting
11573 .Va ssl-ca-no-defaults ,
11574 and further fine-tuning is possible via
11575 .Va ssl-ca-flags ;
11576 also see
11577 .Xr SSL_CTX_load_verify_locations 3
11578 for more information.
11579 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
11580 establishing TLS connections to servers identified with hostnames.
11583 .Mx Va ssl-ca-flags
11584 .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags
11585 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
11586 storage, and the certificate verification that is used (also see
11587 .Va ssl-verify ) .
11588 The value is expected to consist of a comma-separated list of
11589 configuration directives, with any intervening whitespace being ignored.
11590 The directives directly map to flags that can be passed to
11591 .Xr X509_STORE_set_flags 3 ,
11592 which are usually defined in a file
11593 .Pa openssl/x509_vfy.h ,
11594 and the availability of which depends on the used SSL/TLS library
11595 version: a directive without mapping is ignored (error log subject to
11596 .Va debug ) .
11597 Directives currently understood (case-insensitively) include:
11600 .Bl -tag -compact -width ".It Cd BaNg"
11601 .It Cd no-alt-chains
11602 If the initial chain is not trusted, do not attempt to build an
11603 alternative chain.
11604 Setting this flag will make OpenSSL certificate verification match that
11605 of older OpenSSL versions, before automatic building and checking of
11606 alternative chains has been implemented; also see
11607 .Cd trusted-first .
11608 .It Cd no-check-time
11609 Do not check certificate/CRL validity against current time.
11610 .It Cd partial-chain
11611 By default partial, incomplete chains which cannot be verified up to the
11612 chain top, a self-signed root certificate, will not verify.
11613 With this flag set, a chain succeeds to verify if at least one signing
11614 certificate of the chain is in any of the configured trusted stores of
11615 CA certificates.
11616 The OpenSSL manual page
11617 .Xr SSL_CTX_load_verify_locations 3
11618 gives some advise how to manage your own trusted store of CA certificates.
11619 .It Cd strict
11620 Disable workarounds for broken certificates.
11621 .It Cd trusted-first
11622 Try building a chain using issuers in the trusted store first to avoid
11623 problems with server-sent legacy intermediate certificates.
11624 Newer versions of OpenSSL support alternative chain checking and enable
11625 it by default, resulting in the same behaviour; also see
11626 .Cd no-alt-chains .
11630 .Mx Va ssl-ca-no-defaults
11631 .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\
11632   ssl-ca-no-defaults
11633 \*(BO\*(OP Do not load the default CA locations that are built into the
11634 used to SSL/TLS library to verify SSL/TLS server certificates.
11636 .Mx Va ssl-cert
11637 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
11638 \*(OB\*(OP Please use the
11639 .Cd Certificate
11640 slot of
11641 .Va ssl-config-pairs .
11643 .Mx Va ssl-cipher-list
11644 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
11645 \*(OB\*(OP Please use the
11646 .Cd CipherString
11647 slot of
11648 .Va ssl-config-pairs .
11651 .It Va ssl-config-file
11652 \*(OP If this variable is set
11653 .Xr CONF_modules_load_file 3
11654 (if announced via
11655 .Ql +modules-load-file
11657 .Va ssl-features )
11658 is used to allow resource file based configuration of the SSL/TLS library.
11659 This happens once the library is used first, which may also be early
11660 during startup (logged with
11661 .Va verbose ) !
11662 If a non-empty value is given then the given file, after performing
11663 .Sx "Filename transformations" ,
11664 will be used instead of the global OpenSSL default, and it is an error
11665 if the file cannot be loaded.
11666 The application name will always be passed as
11667 .Ql \*(uA .
11668 Some SSL/TLS libraries support application-specific configuration via
11669 resource files loaded like this, please see
11670 .Va ssl-config-module .
11672 .Mx Va ssl-config-module
11673 .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\
11674   ssl-config-module
11675 \*(OP If file based application-specific configuration via
11676 .Va ssl-config-file
11677 is available, announced as
11678 .Ql +ctx-config
11680 .Va ssl-features ,
11681 indicating availability of
11682 .Xr SSL_CTX_config 3 ,
11683 then, it becomes possible to use a central SSL/TLS configuration file
11684 for all programs, including \*(uA, e.g.:
11685 .Bd -literal -offset indent
11686 # Register a configuration section for \*(uA
11687 \*(uA = mailx_master
11688 # The top configuration section creates a relation
11689 # in between dynamic SSL configuration and an actual
11690 # program specific configuration section
11691 [mailx_master]
11692 ssl_conf = mailx_ssl_config
11693 # Well that actual program specific configuration section
11694 # now can map individual ssl-config-module names to sections,
11695 # e.g., ssl-config-module=account_xy
11696 [mailx_ssl_config]
11697 account_xy = mailx_account_xy
11698 account_yz = mailx_account_yz
11699 [mailx_account_xy]
11700 MinProtocol = TLSv1.2
11701 Curves=P-521
11702 [mailx_account_yz]
11703 CipherString = TLSv1.2:!aNULL:!eNULL:
11704 MinProtocol = TLSv1.1
11705 Options = Bugs
11709 .Mx Va ssl-config-pairs
11710 .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs
11711 \*(OP The value of this variable chain will be interpreted as
11712 a comma-separated list of directive/value pairs.
11713 Different to when placing these pairs in a
11714 .Va ssl-config-module
11715 section of a
11716 .Va ssl-config-file ,
11717 commas
11718 .Ql \&,
11719 need to be escaped with a reverse solidus
11720 .Ql \e
11721 when included in pairs.
11722 Just likewise directives and values need to be separated by equals signs
11723 .Ql = ,
11724 any whitespace surrounding pair members is removed.
11725 Keys are (usually) case-insensitive.
11726 Unless proper support is announced by
11727 .Va ssl-features
11728 .Pf ( Ql +conf-ctx )
11729 only the keys below are supported, otherwise the pairs will be used
11730 directly as arguments to the function
11731 .Xr SSL_CONF_cmd 3 .
11732 Said equals sign
11733 .Ql =
11734 may be preceded with an asterisk
11735 .Ql *
11736 to indicate that
11737 .Sx "Filename transformations"
11738 shall be performed on the value; it is an error if these fail.
11741 .Bl -tag -compact -width ".It Cd C_rtificate"
11742 .It Cd Certificate
11743 Filename of a SSL/TLS client certificate (chain) required by some servers.
11744 Fallback support via
11745 .Xr SSL_CTX_use_certificate_chain_file 3 .
11746 .Sx "Filename transformations"
11747 are performed.
11748 .\" v15compat: remove the next sentence
11749 .Sy Note:
11750 if you use this you need to specify the private key via
11751 .Cd PrivateKey ,
11752 .Va ssl-key
11753 will not be used!
11755 .It Cd CipherString
11756 A list of ciphers for SSL/TLS connections, see
11757 .Xr ciphers 1 .
11758 By default no list of ciphers is set, resulting in a
11759 .Cd Protocol Ns - Ns
11760 specific list of ciphers (the protocol standards define lists of
11761 acceptable ciphers; possibly cramped by the used SSL/TLS library).
11762 Fallback support via
11763 .Xr SSL_CTX_set_cipher_list 3 .
11765 .It Cd Curves
11766 A list of supported elliptic curves, if applicable.
11767 By default no curves are set.
11768 Fallback support via
11769 .Xr SSL_CTX_set1_curves_list 3 ,
11770 if available.
11772 .It Cd MaxProtocol , MinProtocol
11773 The maximum and minimum supported SSL/TLS versions, respectively.
11774 Optional fallback support via
11775 .Xr SSL_CTX_set_max_proto_version 3
11777 .Xr SSL_CTX_set_min_proto_version 3
11779 .Va ssl-features
11780 announces
11781 .Ql +ctx-set-maxmin-proto ,
11782 otherwise this directive results in an error.
11783 The fallback uses an internal parser which understands the strings
11784 .Ql SSLv3 ,
11785 .Ql TLSv1 ,
11786 .Ql TLSv1.1 ,
11787 .Ql TLSv1.2 ,
11788 and the special value
11789 .Ql None ,
11790 which disables the given limit.
11792 .It Cd Options
11793 Various flags to set.
11794 Fallback via
11795 .Xr SSL_CTX_set_options 3 ,
11796 in which case any other value but (exactly)
11797 .Ql Bugs
11798 results in an error.
11800 .It Cd PrivateKey
11801 Filename of the private key in PEM format of a SSL/TLS client certificate.
11802 If unset, the name of the certificate file is used.
11803 .Sx "Filename transformations"
11804 are performed.
11805 Fallback via
11806 .Xr SSL_CTX_use_PrivateKey_file 3 .
11807 .\" v15compat: remove the next sentence
11808 .Sy Note:
11809 if you use this you need to specify the certificate (chain) via
11810 .Cd Certificate ,
11811 .Va ssl-cert
11812 will not be used!
11814 .It Cd Protocol
11815 The used SSL/TLS protocol.
11817 .Va ssl-features
11818 announces
11819 .Ql +conf-ctx
11821 .Ql ctx-set-maxmin-proto
11822 then using
11823 .Cd MaxProtocol
11825 .Cd MinProtocol
11826 is preferable.
11827 Fallback is
11828 .Xr SSL_CTX_set_options 3 ,
11829 driven via an internal parser which understands the strings
11830 .Ql SSLv3 ,
11831 .Ql TLSv1 ,
11832 .Ql TLSv1.1 ,
11833 .Ql TLSv1.2 ,
11834 and the special value
11835 .Ql ALL .
11836 Multiple protocols may be given as a comma-separated list, any
11837 whitespace is ignored, an optional plus sign
11838 .Ql +
11839 prefix enables, a hyphen-minus
11840 .Ql -
11841 prefix disables a protocol, so that
11842 .Ql -ALL, TLSv1.2
11843 enables only the TLSv1.2 protocol.
11849 .It Va ssl-crl-dir , ssl-crl-file
11850 \*(OP Specify a directory / a file, respectively that contains a CRL in
11851 PEM format to use when verifying SSL/TLS server certificates.
11853 .Mx Va ssl-curves
11854 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
11855 \*(OB\*(OP Please use the
11856 .Cd Curves
11857 slot of
11858 .Va ssl-config-pairs .
11861 .It Va ssl-features
11862 \*(OP\*(RO This expands to a comma separated list of the TLS/SSL library
11863 identity and optional TLS/SSL library features.
11864 Currently supported identities are
11865 .Ql libressl
11866 (LibreSSL) ,
11867 .Ql libssl-0x10100
11868 (OpenSSL v1.1.x series)
11870 .Ql libssl-0x10000
11871 (elder OpenSSL series, other clones).
11872 Optional features are preceded with a plus sign
11873 .Ql +
11874 when available, and with a hyphen-minus
11875 .Ql -
11876 otherwise:
11877 .Ql modules-load-file
11878 .Pf ( Va ssl-config-file ) ,
11879 .Ql conf-ctx
11880 .Pf ( Va ssl-config-pairs ) ,
11881 .Ql ctx-config
11882 .Pf ( Va ssl-config-module ) ,
11883 .Ql ctx-set-maxmin-proto
11884 .Pf ( Va ssl-config-pairs )
11886 .Ql rand-egd
11887 .Pf ( Va ssl-rand-egd ) .
11889 .Mx Va ssl-key
11890 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
11891 \*(OB\*(OP Please use the
11892 .Cd PrivateKey
11893 slot of
11894 .Va ssl-config-pairs .
11896 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
11897 \*(OB\*(OP Please use the
11898 .Cd Protocol
11899 slot of
11900 .Va ssl-config-pairs .
11902 .Mx Va ssl-protocol
11903 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
11904 \*(OB\*(OP Please use the
11905 .Cd Protocol
11906 slot of
11907 .Va ssl-config-pairs .
11910 .It Va ssl-rand-egd
11911 \*(OP Gives the pathname to an entropy daemon socket, see
11912 .Xr RAND_egd 3 .
11913 Not all SSL/TLS libraries support this,
11914 .Va ssl-features
11915 announces availability with
11916 .Ql +rand-egd .
11919 .It Va ssl-rand-file
11920 \*(OP Gives the filename to a file with random entropy data, see
11921 .Xr RAND_load_file 3 .
11922 If this variable is not set, or set to the empty string, or if the
11923 .Sx "Filename transformations"
11924 fail, then
11925 .Xr RAND_file_name 3
11926 will be used to create the filename.
11927 If the SSL PRNG was seeded successfully
11928 The file will be updated
11929 .Pf ( Xr RAND_write_file 3 )
11930 if and only if seeding and buffer stirring succeeds.
11931 This variable is only used if
11932 .Va ssl-rand-egd
11933 is not set (or not supported by the SSL/TLS library).
11935 .Mx Va ssl-verify
11936 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
11937 \*(OP Variable chain that sets the action to be performed if an error
11938 occurs during SSL/TLS server certificate validation against the
11939 specified or default trust stores
11940 .Va ssl-ca-dir ,
11941 .Va ssl-ca-file ,
11942 or the SSL/TLS library built-in defaults (unless usage disallowed via
11943 .Va ssl-ca-no-defaults ) ,
11944 and as fine-tuned via
11945 .Va ssl-ca-flags .
11946 Valid (case-insensitive) values are
11947 .Ql strict
11948 (fail and close connection immediately),
11949 .Ql ask
11950 (ask whether to continue on standard input),
11951 .Ql warn
11952 (show a warning and continue),
11953 .Ql ignore
11954 (do not perform validation).
11955 The default is
11956 .Ql ask .
11959 .It Va stealthmua
11960 If only set without an assigned value, then this setting inhibits the
11961 generation of the
11962 .Ql Message-ID: ,
11963 .Ql Content-ID:
11965 .Ql User-Agent:
11966 header fields that include obvious references to \*(UA.
11967 There are two pitfalls associated with this:
11968 First, the message id of outgoing messages is not known anymore.
11969 Second, an expert may still use the remaining information in the header
11970 to track down the originating mail user agent.
11971 If set to the value
11972 .Ql noagent ,
11973 then the mentioned
11974 .Ql Message-ID:
11976 .Ql Content-ID:
11977 suppression does not occur.
11980 .It Va system-mailrc
11981 \*(RO The compiled in path of the system wide initialization file
11982 one of the
11983 .Sx "Resource files" :
11984 .Pa \*(UR .
11988 .It Va termcap
11989 (\*(OP) This specifies a comma-separated list of
11990 .Lb libterminfo
11991 and/or
11992 .Lb libtermcap
11993 capabilities (see
11994 .Sx "On terminal control and line editor" ,
11995 escape commas with reverse solidus) to be used to overwrite or define
11996 entries.
11997 .Sy Note
11998 this variable will only be queried once at program startup and can
11999 thus only be specified in resource files or on the command line.
12002 String capabilities form
12003 .Ql cap=value
12004 pairs and are expected unless noted otherwise.
12005 Numerics have to be notated as
12006 .Ql cap#number
12007 where the number is expected in normal decimal notation.
12008 Finally, booleans do not have any value but indicate a true or false
12009 state simply by being defined or not; this indeed means that \*(UA
12010 does not support undefining an existing boolean.
12011 String capability values will undergo some expansions before use:
12012 for one notations like
12013 .Ql ^LETTER
12014 stand for
12015 .Ql control-LETTER ,
12016 and for clarification purposes
12017 .Ql \eE
12018 can be used to specify
12019 .Ql escape
12020 (the control notation
12021 .Ql ^[
12022 could lead to misreadings when a left bracket follows, which it does for
12023 the standard CSI sequence);
12024 finally three letter octal sequences, as in
12025 .Ql \e061 ,
12026 are supported.
12027 To specify that a terminal supports 256-colours, and to define sequences
12028 that home the cursor and produce an audible bell, one might write:
12030 .Bd -literal -offset indent
12031 ? set termcap='Co#256,home=\eE[H,bel=^G'
12035 The following terminal capabilities are or may be meaningful for the
12036 operation of the built-in line editor or \*(UA in general:
12039 .Bl -tag -compact -width ".It Cd yay"
12040 .\" HAVE_COLOUR
12041 .It Cd colors Ns \0or Cd Co
12042 .Cd max_colors :
12043 numeric capability specifying the maximum number of colours.
12044 Note that \*(UA does not actually care about the terminal beside that,
12045 but always emits ANSI / ISO 6429 escape sequences.
12047 .\" HAVE_TERMCAP
12048 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
12049 .Cd exit_ca_mode
12051 .Cd enter_ca_mode ,
12052 respectively: exit and enter the alternative screen ca-mode,
12053 effectively turning \*(UA into a fullscreen application.
12054 This must be enabled explicitly by setting
12055 .Va termcap-ca-mode .
12057 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
12058 .Cd keypad_xmit
12060 .Cd keypad_local ,
12061 respectively: enable and disable the keypad.
12062 This is always enabled if available, because it seems even keyboards
12063 without keypads generate other key codes for, e.g., cursor keys in that
12064 case, and only if enabled we see the codes that we are interested in.
12066 .It Cd ed Ns \0or Cd cd
12067 .Cd clr_eos :
12068 clear the screen.
12070 .It Cd clear Ns \0or Cd cl
12071 .Cd clear_screen :
12072 clear the screen and home cursor.
12073 (Will be simulated via
12074 .Cd ho
12075 plus
12076 .Cd cd . )
12078 .It Cd home Ns \0or Cd ho
12079 .Cd cursor_home :
12080 home cursor.
12082 .\" HAVE_MLE
12083 .It Cd el Ns \0or Cd ce
12084 .Cd clr_eol :
12085 clear to the end of line.
12086 (Will be simulated via
12087 .Cd ch
12088 plus repetitions of space characters.)
12090 .It Cd hpa Ns \0or Cd ch
12091 .Cd column_address :
12092 move the cursor (to the given column parameter) in the current row.
12093 (Will be simulated via
12094 .Cd cr
12095 plus
12096 .Cd nd . )
12098 .It Cd cr
12099 .Cd carriage_return :
12100 move to the first column in the current row.
12101 The default built-in fallback is
12102 .Ql \er .
12104 .It Cd cub1 Ns \0or Cd le
12105 .Cd cursor_left :
12106 move the cursor left one space (non-destructively).
12107 The default built-in fallback is
12108 .Ql \eb .
12110 .It Cd cuf1 Ns \0or Cd nd
12111 .Cd cursor_right :
12112 move the cursor right one space (non-destructively).
12113 The default built-in fallback is
12114 .Ql \eE[C ,
12115 which is used by most terminals.
12116 Less often occur
12117 .Ql \eEC
12119 .Ql \eEOC .
12123 Many more capabilities which describe key-sequences are documented for
12124 .Ic bind .
12128 .It Va termcap-ca-mode
12129 \*(OP Allow usage of the
12130 .Cd exit_ca_mode
12132 .Cd enter_ca_mode
12133 terminal capabilities, see
12134 .Va termcap .
12135 .Sy Note
12136 this variable will only be queried once at program startup and can
12137 thus only be specified in resource files or on the command line.
12140 .It Va termcap-disable
12141 \*(OP Disable any interaction with a terminal control library.
12142 If set only some generic fallback built-ins and possibly the content of
12143 .Va termcap
12144 describe the terminal to \*(UA.
12145 .Sy Note
12146 this variable will only be queried once at program startup and can
12147 thus only be specified in resource files or on the command line.
12150 .It Va toplines
12151 If defined, gives the number of lines of a message to be displayed
12152 with the command
12153 .Ic top ;
12154 if unset, the first five lines are printed, if set to 0 the variable
12155 .Va screen
12156 is inspected.
12157 If the value is negative then its absolute value will be used for
12158 unsigned right shifting (see
12159 .Ic vexpr )
12161 .Va screen
12162 height.
12165 .It Va topsqueeze
12166 \*(BO If set then the
12167 .Ic top
12168 command series will strip adjacent empty lines and quotations.
12171 .It Va ttycharset
12172 The character set of the terminal \*(UA operates on,
12173 and the one and only supported character set that \*(UA can use if no
12174 character set conversion capabilities have been compiled into it,
12175 in which case it defaults to ISO-8859-1.
12176 Otherwise it defaults to UTF-8.
12177 Sufficient locale support provided the default will be preferably
12178 deduced from the locale environment if that is set (e.g.,
12179 .Ev LC_CTYPE ,
12180 see there for more); runtime locale changes will be reflected by
12181 .Va \&\&ttycharset
12182 except during the program startup phase and if
12183 .Fl S
12184 had been used to freeze the given value.
12185 Refer to the section
12186 .Sx "Character sets"
12187 for the complete picture about character sets.
12190 .It Va typescript-mode
12191 \*(BO A special multiplex variable that disables all variables and
12192 settings which result in behaviour that interferes with running \*(UA in
12193 .Xr script 1 ,
12194 e.g., it sets
12195 .Va colour-disable ,
12196 .Va line-editor-disable
12197 and (before startup completed only)
12198 .Va termcap-disable .
12199 Unsetting it does not restore the former state of the covered settings.
12202 .It Va umask
12203 For a safe-by-default policy the process file mode creation mask
12204 .Xr umask 2
12205 will be set to
12206 .Ql 0077
12207 on program startup by default.
12208 Child processes inherit the file mode creation mask of their parent, and
12209 by setting this variable to an empty value no change will be applied,
12210 and the inherited value will be used.
12211 Otherwise the given value will be made the new file mode creation mask.
12213 .Mx Va user
12214 .It Va user-HOST , user
12215 \*(IN Variable chain that sets a global fallback user name, which is
12216 used in case none has been given in the protocol and account-specific
12217 URL.
12218 This variable defaults to the name of the user who runs \*(UA.
12221 .It Va v15-compat
12222 \*(BO Setting this enables upward compatibility with \*(UA
12223 version 15.0 in respect to which configuration options are available and
12224 how they are handled.
12225 This manual uses \*(IN and \*(OU to refer to the new and the old way of
12226 doing things, respectively.
12229 .It Va verbose
12230 \*(BO This setting, also controllable via the command line option
12231 .Fl v ,
12232 causes \*(UA to be more verbose, e.g., it will display obsoletion
12233 warnings and SSL/TLS certificate chains.
12234 Even though marked \*(BO this option may be set twice in order to
12235 increase the level of verbosity even more, in which case even details of
12236 the actual message delivery and protocol conversations are shown.
12237 A single
12238 .Pf no Va verbose
12239 is sufficient to disable verbosity as such.
12246 .It Va version , version-date , \
12247   version-hexnum , version-major , version-minor , version-update
12248 \*(RO \*(UA version information: the first variable is a string with
12249 the complete version identification, the second the release date in ISO
12250 8601 notation without time.
12251 The third is a 32-bit hexadecimal number with the upper 8 bits storing
12252 the major, followed by the minor and update version numbers which occupy
12253 12 bits each.
12254 The latter three variables contain only decimal digits: the major, minor
12255 and update version numbers.
12256 The output of the command
12257 .Ic version
12258 will include this information.
12261 .It Va writebackedited
12262 If this variable is set messages modified using the
12263 .Ic edit
12265 .Ic visual
12266 commands are written back to the current folder when it is quit;
12267 it is only honoured for writable folders in MBOX format, though.
12268 Note that the editor will be pointed to the raw message content in that
12269 case, i.e., neither MIME decoding nor decryption will have been
12270 performed, and proper RFC 4155
12271 .Ql From_
12272 quoting of newly added or edited content is also left as an exercise to
12273 the user.
12275 .\" }}} (Variables)
12277 .\" }}} (INTERNAL VARIABLES)
12280 .\" .Sh ENVIRONMENT {{{
12281 .Sh ENVIRONMENT
12283 The term
12284 .Dq environment variable
12285 should be considered an indication that these variables are either
12286 standardized as vivid parts of process environments, or that they are
12287 commonly found in there.
12288 The process environment is inherited from the
12289 .Xr sh 1
12290 once \*(UA is started, and unless otherwise explicitly noted handling of
12291 the following variables transparently integrates into that of the
12292 .Sx "INTERNAL VARIABLES"
12293 from \*(UA's point of view.
12294 This means that, e.g., they can be managed via
12295 .Ic set
12297 .Ic unset ,
12298 causing automatic program environment updates (to be inherited by
12299 newly created child processes).
12302 In order to transparently integrate other environment variables equally
12303 they need to be imported (linked) with the command
12304 .Ic environ .
12305 This command can also be used to set and unset non-integrated
12306 environment variables from scratch, sufficient system support provided.
12307 The following example, applicable to a POSIX shell, sets the
12308 .Ev COLUMNS
12309 environment variable for \*(UA only, and beforehand exports the
12310 .Ev EDITOR
12311 in order to affect any further processing in the running shell:
12313 .Bd -literal -offset indent
12314 $ EDITOR="vim -u ${HOME}/.vimrc"
12315 $ export EDITOR
12316 $ COLUMNS=80 \*(uA -R
12319 .Bl -tag -width ".It Ev BaNg"
12321 .It Ev COLUMNS
12322 The user's preferred width in column positions for the terminal screen
12323 or window.
12324 Queried and used once on program startup, actively managed for child
12325 processes and the MLE (see
12326 .Sx "On terminal control and line editor" )
12327 in interactive mode thereafter.
12328 Ignored in non-interactive mode, which always uses 80 columns, unless in
12329 .fl #
12330 batch mode.
12333 .It Ev DEAD
12334 The name of the (mailbox)
12335 .Ic file
12336 to use for saving aborted messages if
12337 .Va save
12338 is set; this defaults to
12339 .Pa \*(VD .
12340 If the variable
12341 .Va debug
12342 is set no output will be generated, otherwise the contents of the file
12343 will be replaced.
12346 .It Ev EDITOR
12347 Pathname of the text editor to use for the
12348 .Ic edit
12349 command and
12350 .Ic ~e
12351 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
12352 .Ev VISUAL
12353 is used for a more display oriented editor.
12356 .It Ev HOME
12357 The user's home directory.
12358 This variable is only used when it resides in the process environment.
12359 The calling user's home directory will be used instead if this directory
12360 does not exist, is not accessible or cannot be read;
12361 it will always be used for the root user.
12362 (No test for being writable is performed to allow usage by
12363 non-privileged users within read-only jails, but dependent on the
12364 variable settings this directory is a default write target, e.g. for
12365 .Ev DEAD ,
12366 .Ev MBOX
12367 and more.)
12372 .It Ev LC_ALL , LC_CTYPE , LANG
12373 \*(OP The (names in lookup order of the)
12374 .Xr locale 7
12375 (and / or see
12376 .Xr setlocale 3 )
12377 which indicates the used
12378 .Sx "Character sets" .
12379 Runtime changes trigger automatic updates of the entire locale system,
12380 which includes updating
12381 .Va ttycharset
12382 (except during startup if the variable has been frozen via
12383 .Fl S ) .
12386 .It Ev LINES
12387 The user's preferred number of lines on a page or the vertical screen
12388 or window size in lines.
12389 Queried and used once on program startup, actively managed for child
12390 processes in interactive mode thereafter.
12391 Ignored in non-interactive mode, which always uses 24 lines, unless in
12392 .fl #
12393 batch mode.
12396 .It Ev LISTER
12397 Pathname of the directory lister to use in the
12398 .Ic folders
12399 command when operating on local mailboxes.
12400 Default is
12401 .Xr ls 1
12402 (path search through
12403 .Ev SHELL ) .
12406 .It Ev LOGNAME
12407 Upon startup \*(UA will actively ensure that this variable refers to the
12408 name of the user who runs \*(UA, in order to be able to pass a verified
12409 name to any newly created child process.
12412 .It Ev MAIL
12413 Is used as the user's
12414 .Mx -sx
12415 .Sx "primary system mailbox"
12416 unless
12417 .Va inbox
12418 is set.
12419 This is assumed to be an absolute pathname.
12422 .It Ev MAILCAPS
12423 \*(OP Overrides the default path search for
12424 .Sx "The Mailcap files" ,
12425 which is defined in the standard RFC 1524 as
12426 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
12427 .\" TODO we should have a mailcaps-default virtual RDONLY option!
12428 (\*(UA makes it a configuration option, however.)
12429 Note this is not a search path, but a path search.
12432 .It Ev MAILRC
12433 Is used as a startup file instead of
12434 .Pa \*(ur
12435 if set.
12436 In order to avoid side-effects from configuration files scripts should
12437 either set this variable to
12438 .Pa /dev/null
12439 or the
12440 .Fl \&:
12441 command line option should be used.
12444 .It Ev MAILX_NO_SYSTEM_RC
12445 If this variable is set then reading of
12446 .Pa \*(UR
12447 (a.k.a.\&
12448 .Va system-mailrc )
12449 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
12450 had been started up with the option
12451 .Fl \&:
12452 (and according argument) or
12453 .Fl n .
12454 This variable is only used when it resides in the process environment.
12457 .It Ev MBOX
12458 The name of the user's
12459 .Mx -sx
12460 .Sx "secondary mailbox"
12461 file.
12462 A logical subset of the special
12463 .Sx "Filename transformations"
12464 (also see
12465 .Ic file )
12466 are supported.
12467 The default is
12468 .Pa \*(VM .
12469 Traditionally this MBOX is used as the file to save messages from the
12470 .Mx -sx
12471 .Sx "primary system mailbox"
12472 that have been read.
12473 Also see
12474 .Sx "Message states" .
12477 .It Ev NETRC
12478 \*(IN\*(OP This variable overrides the default location of the user's
12479 .Pa \*(VN
12480 file.
12483 .It Ev PAGER
12484 Pathname of the program to use for backing the command
12485 .Ic more ,
12486 and when the
12487 .Va crt
12488 variable enforces usage of a pager for output.
12489 The default paginator is
12490 .Xr more 1
12491 (path search through
12492 .Ev SHELL ) .
12494 \*(UA inspects the contents of this variable: if its contains the string
12495 .Dq less
12496 then a non-existing environment variable
12497 .Ev LESS
12498 will be set to
12499 .Ql Ri ,
12500 likewise for
12501 .Dq lv
12502 .Ev LV
12503 will optionally be set to
12504 .Ql -c .
12505 Alse see
12506 .Va colour-pager .
12509 .It Ev PATH
12510 A colon-separated list of directories that is searched by the shell when
12511 looking for commands, e.g.,
12512 .Ql /bin:/usr/bin:/usr/local/bin .
12515 .It Ev POSIXLY_CORRECT
12516 This variable is automatically looked for upon startup, see
12517 .Va posix
12518 for more.
12521 .It Ev SHELL
12522 The shell to use for the commands
12523 .Ic \&! ,
12524 .Ic shell ,
12526 .Ic ~!
12527 .Sx "COMMAND ESCAPES"
12528 and when starting subprocesses.
12529 A default shell is used if this environment variable is not defined.
12532 .It Ev SOURCE_DATE_EPOCH
12533 Specifies a time in seconds since the Unix epoch (1970-01-01) to be
12534 used in place of the current time.
12535 This variable is looked up upon program startup, and its existence will
12536 switch \*(UA to a reproducible mode
12537 .Pf ( Lk https://reproducible-builds.org )
12538 which uses deterministic random numbers, a special fixated pseudo
12539 .Ev LOGNAME
12540 and more.
12541 This operation mode is used for development and by software packagers.
12542 \*(ID Currently an invalid setting is only ignored, rather than causing
12543 a program abortion.
12545 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
12548 .It Ev TERM
12549 \*(OP The terminal type for which output is to be prepared.
12550 For extended colour and font control please refer to
12551 .Sx "Coloured display" ,
12552 and for terminal management in general to
12553 .Sx "On terminal control and line editor" .
12556 .It Ev TMPDIR
12557 Except for the root user this variable defines the directory for
12558 temporary files to be used instead of
12559 .Pa \*(VT
12560 (or the given compile-time constant) if set, existent, accessible as
12561 well as read- and writable.
12562 This variable is only used when it resides in the process environment,
12563 but \*(UA will ensure at startup that this environment variable is
12564 updated to contain a usable temporary directory.
12567 .It Ev USER
12568 Identical to
12569 .Ev LOGNAME
12570 (see there), but this variable is not standardized, should therefore not
12571 be used, and is only corrected if already set.
12574 .It Ev VISUAL
12575 Pathname of the text editor to use for the
12576 .Ic visual
12577 command and
12578 .Ic ~v
12579 .Pf (see\0 Sx "COMMAND ESCAPES" ) ;
12580 .Ev EDITOR
12581 is used for a less display oriented editor.
12584 .\" }}}
12587 .\" .Sh FILES {{{
12588 .Sh FILES
12590 .\" file list {{{
12591 .Bl -tag -width ".It Pa BaNg"
12592 .It Pa \*(ur
12593 User-specific file giving initial commands, one of the
12594 .Sx "Resource files" .
12595 The actual value is read from
12596 .Va MAILRC .
12598 .It Pa \*(UR
12599 System wide initialization file, one of the
12600 .Sx "Resource files" .
12601 The actual value is read from
12602 .Va system-mailrc .
12605 .It Pa ~/.mailcap
12606 \*(OP Personal MIME type handler definition file, see
12607 .Sx "The Mailcap files" .
12608 This location is part of the RFC 1524 standard search path, which is
12609 a configuration option and can be overridden via
12610 .Ev MAILCAPS .
12613 .It Pa /etc/mailcap
12614 \*(OP System wide MIME type handler definition file, see
12615 .Sx "The Mailcap files" .
12616 This location is part of the RFC 1524 standard search path, which is
12617 a configuration option and can be overridden via
12620 .It Pa \*(VM
12621 The default value for
12622 .Ev MBOX .
12625 .It Pa \*(vU
12626 Personal MIME types, see
12627 .Sx "The mime.types files" .
12630 .It Pa \*(vS
12631 System wide MIME types, see
12632 .Sx "The mime.types files" .
12635 .It Pa \*(VN
12636 \*(IN\*(OP The default location of the user's
12637 .Pa .netrc
12638 file \(en the section
12639 .Sx "The .netrc file"
12640 documents the file format.
12641 The actually used path can be overridden via
12642 .Ev NETRC .
12645 .It Pa /dev/null
12646 The data sink
12647 .Xr null 4 .
12649 .\" }}}
12651 .\" .Ss "Resource files" {{{
12652 .Ss "Resource files"
12654 Upon startup \*(UA reads in several resource files, in order:
12656 .Bl -tag -width ".It Pa BaNg"
12658 .It Pa \*(UR
12659 System wide initialization file
12660 .Pf ( Va system-mailrc ) .
12661 Reading of this file can be suppressed, either by using the
12662 .Fl \&:
12663 (and according argument) or
12664 .Fl n
12665 command line options, or by setting the
12666 .Sx ENVIRONMENT
12667 variable
12668 .Ev MAILX_NO_SYSTEM_RC .
12671 .It Pa \*(ur
12672 File giving initial commands.
12673 A different file can be chosen by setting the
12674 .Sx ENVIRONMENT
12675 variable
12676 .Ev MAILRC .
12677 Reading of this file can be suppressed with the
12678 .Fl \&:
12679 command line option.
12681 .It Va mailx-extra-rc
12682 Defines a startup file to be read after all other resource files.
12683 It can be used to specify settings that are not understood by other
12684 .Xr mailx 1
12685 implementations, for example.
12686 This variable is only honoured when defined in a resource file, e.g.,
12687 it is one of the
12688 .Sx "INTERNAL VARIABLES" .
12692 The content of these files is interpreted as follows:
12695 .Bl -bullet -compact
12697 The whitespace characters space, tabulator and newline,
12698 as well as those defined by the variable
12699 .Va ifs ,
12700 are removed from the beginning and end of input lines.
12702 Empty lines are ignored.
12704 Any other line is interpreted as a command.
12705 It may be spread over multiple input lines if the newline character is
12706 .Dq escaped
12707 by placing a reverse solidus character
12708 .Ql \e
12709 as the last character of the line; whereas any leading whitespace of
12710 follow lines is ignored, trailing whitespace before a escaped newline
12711 remains in the input.
12713 If the line (content) starts with the number sign
12714 .Ql #
12715 then it is a comment-command and also ignored.
12716 (The comment-command is a real command, which does nothing, and
12717 therefore the usual follow lines mechanism applies!)
12721 Unless \*(UA is about to enter interactive mode syntax errors that occur
12722 while loading these files are treated as errors and cause program exit.
12723 More files with syntactically equal content can be
12724 .Ic source Ns ed .
12725 The following, saved in a file, would be an examplary content:
12727 .Bd -literal -offset indent
12728  # This line is a comment command.  And y\e
12729     es, it is really continued here.
12730 set debug \e
12731     verbose
12732     set editheaders
12734 .\" }}}
12736 .\" .Ss "The mime.types files" {{{
12737 .Ss "The mime.types files"
12739 As stated in
12740 .Sx "HTML mail and MIME attachments"
12741 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
12742 media types in order to classify message and attachment content.
12743 One source for them are
12744 .Pa mime.types
12745 files, the loading of which can be controlled by setting the variable
12746 .Va mimetypes-load-control .
12747 Another is the command
12748 .Ic mimetype ,
12749 which also offers access to \*(UAs MIME type cache.
12750 .Pa mime.types
12751 files have the following syntax:
12753 .Bd -literal -offset indent
12754 type/subtype extension [extension ...]
12755 # E.g., text/html html htm
12759 where
12760 .Ql type/subtype
12761 define the MIME media type, as standardized in RFC 2046:
12762 .Ql type
12763 is used to declare the general type of data, while the
12764 .Ql subtype
12765 specifies a specific format for that type of data.
12766 One or multiple filename
12767 .Ql extension Ns
12768 s, separated by whitespace, can be bound to the media type format.
12769 Comments may be introduced anywhere on a line with a number sign
12770 .Ql # ,
12771 causing the remaining line to be discarded.
12773 \*(UA also supports an extended, non-portable syntax in especially
12774 crafted files, which can be loaded via the alternative value syntax of
12775 .Va mimetypes-load-control ,
12776 and prepends an optional
12777 .Ql type-marker :
12780 .Dl [type-marker ]type/subtype extension [extension ...]
12783 The following type markers are supported:
12786 .Bl -tag -compact -width ".It Ar _n_u"
12787 .It Ar @
12788 Treat message parts with this content as plain text.
12789 .It Ar @t
12790 The same as plain
12791 .Ar @ .
12792 .It Ar @h
12793 Treat message parts with this content as HTML tagsoup.
12794 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
12795 the content as plain text instead.
12796 .It Ar @H
12797 Likewise
12798 .Ar @h ,
12799 but instead of falling back to plain text require an explicit content
12800 handler to be defined.
12801 .It Ar @q
12802 If no handler can be found a text message is displayed which says so.
12803 This can be annoying, for example signatures serve a contextual purpose,
12804 their content is of no use by itself.
12805 This marker will avoid displaying the text message.
12809 Further reading:
12810 for sending messages:
12811 .Ic mimetype ,
12812 .Va mime-allow-text-controls ,
12813 .Va mimetypes-load-control .
12814 For reading etc. messages:
12815 .Sx "HTML mail and MIME attachments" ,
12816 .Sx "The Mailcap files" ,
12817 .Ic mimetype ,
12818 .Va mime-counter-evidence ,
12819 .Va mimetypes-load-control ,
12820 .Va pipe-TYPE/SUBTYPE ,
12821 .Va pipe-EXTENSION .
12822 .\" }}}
12824 .\" .Ss "The Mailcap files" {{{
12825 .Ss "The Mailcap files"
12827 .\" TODO MAILCAP DISABLED
12828 .Sy This feature is not available in v14.9.0, sorry!
12829 RFC 1524 defines a
12830 .Dq User Agent Configuration Mechanism
12831 which \*(UA \*(OPally supports (see
12832 .Sx "HTML mail and MIME attachments" ) .
12833 It defines a file format to be used to inform mail user agent programs
12834 about the locally-installed facilities for handling various data
12835 formats, i.e., about commands and how they can be used to display, edit
12836 et cetera MIME part contents, as well as a default path search that
12837 includes multiple possible locations of
12838 .Dq mailcap
12839 files and the
12840 .Ev MAILCAPS
12841 environment variable that can be used to overwrite that (repeating here
12842 that it is not a search path, but instead a path search specification).
12843 Any existing files will be loaded in sequence, appending any content to
12844 the list of MIME type handler directives.
12847 .Dq Mailcap
12848 files consist of a set of newline separated entries.
12849 Comment lines start with a number sign
12850 .Ql #
12851 (in the first column!) and are ignored.
12852 Empty lines are also ignored.
12853 All other lines form individual entries that must adhere to the syntax
12854 described below.
12855 To extend a single entry (not comment) its line can be continued on
12856 follow lines if newline characters are
12857 .Dq escaped
12858 by preceding them with the reverse solidus character
12859 .Ql \e .
12860 The standard does not specify how leading whitespace of follow lines
12861 is to be treated, therefore \*(UA retains it.
12864 .Dq Mailcap
12865 entries consist of a number of semicolon
12866 .Ql \&;
12867 separated fields, and the reverse solidus
12868 .Ql \e
12869 character can be used to escape any following character including
12870 semicolon and itself.
12871 The first two fields are mandatory and must occur in the specified
12872 order, the remaining fields are optional and may appear in any order.
12873 Leading and trailing whitespace of content is ignored (removed).
12876 The first field defines the MIME
12877 .Ql TYPE/SUBTYPE
12878 the entry is about to handle (case-insensitively, and no reverse solidus
12879 escaping is possible in this field).
12880 If the subtype is specified as an asterisk
12881 .Ql *
12882 the entry is meant to match all subtypes of the named type, e.g.,
12883 .Ql audio/*
12884 would match any audio type.
12885 The second field defines the shell command which shall be used to
12886 .Dq display
12887 MIME parts of the given type; it is implicitly called the
12888 .Cd view
12889 command.
12892 For data
12893 .Dq consuming
12894 shell commands message (MIME part) data is passed via standard input
12895 unless the given shell command includes one or more instances of the
12896 (unquoted) string
12897 .Ql %s ,
12898 in which case these instances will be replaced with a temporary filename
12899 and the data will have been stored in the file that is being pointed to.
12900 Likewise, for data
12901 .Dq producing
12902 shell commands data is assumed to be generated on standard output unless
12903 the given command includes (one ore multiple)
12904 .Ql %s .
12905 In any case any given
12906 .Ql %s
12907 format is replaced with a(n already) properly quoted filename.
12908 Note that when a command makes use of a temporary file via
12909 .Ql %s
12910 then \*(UA will remove it again, as if the
12911 .Cd x-mailx-tmpfile ,
12912 .Cd x-mailx-tmpfile-fill
12914 .Cd x-mailx-tmpfile-unlink
12915 flags had been set; see below for more.
12918 The optional fields either define a shell command or an attribute (flag)
12919 value, the latter being a single word and the former being a keyword
12920 naming the field followed by an equals sign
12921 .Ql =
12922 succeeded by a shell command, and as usual for any
12923 .Dq Mailcap
12924 content any whitespace surrounding the equals sign will be removed, too.
12925 Optional fields include the following:
12928 .Bl -tag -width ".It Cd BaNg"
12929 .It Cd compose
12930 A program that can be used to compose a new body or body part in the
12931 given format.
12932 (Currently unused.)
12934 .It Cd composetyped
12935 Similar to the
12936 .Cd compose
12937 field, but is to be used when the composing program needs to specify the
12938 .Ql Content-type:
12939 header field to be applied to the composed data.
12940 (Currently unused.)
12942 .It Cd edit
12943 A program that can be used to edit a body or body part in the given
12944 format.
12945 (Currently unused.)
12947 .It Cd print
12948 A program that can be used to print a message or body part in the given
12949 format.
12950 (Currently unused.)
12952 .It Cd test
12953 Specifies a program to be run to test some condition, e.g., the machine
12954 architecture, or the window system in use, to determine whether or not
12955 this mailcap entry applies.
12956 If the test fails, a subsequent mailcap entry should be sought; also see
12957 .Cd x-mailx-test-once .
12960 .It Cd needsterminal
12961 This flag field indicates that the given shell command must be run on
12962 an interactive terminal.
12963 \*(UA will temporarily release the terminal to the given command in
12964 interactive mode, in non-interactive mode this entry will be entirely
12965 ignored; this flag implies
12966 .Cd x-mailx-noquote .
12969 .It Cd copiousoutput
12970 A flag field which indicates that the output of the
12971 .Cd view
12972 command will be an extended stream of textual output that can be
12973 (re)integrated into \*(UA's normal visual display.
12974 It is mutually exclusive with
12975 .Cd needsterminal .
12977 .It Cd textualnewlines
12978 A flag field which indicates that this type of data is line-oriented and
12979 that, if encoded in
12980 .Ql base64 ,
12981 all newlines should be converted to canonical form (CRLF) before
12982 encoding, and will be in that form after decoding.
12983 (Currently unused.)
12985 .It Cd nametemplate
12986 This field gives a filename format, in which
12987 .Ql %s
12988 will be replaced by a random string, the joined combination of which
12989 will be used as the filename denoted by
12990 .Ev MAILX_FILENAME_TEMPORARY .
12991 One could specify that a GIF file being passed to an image viewer should
12992 have a name ending in
12993 .Ql .gif
12994 by using
12995 .Ql nametemplate=%s.gif .
12996 Note that \*(UA ignores the name template unless that solely specifies
12997 a filename suffix that consists of (ASCII) alphabetic and numeric
12998 characters, the underscore and dot only.
13000 .It Cd x11-bitmap
13001 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
13002 icon to be used to visually denote the presence of this kind of data.
13003 This field is not used by \*(UA.
13005 .It Cd description
13006 A textual description that describes this type of data.
13009 .It Cd x-mailx-even-if-not-interactive
13010 An extension flag test field \(em by default handlers without
13011 .Cd copiousoutput
13012 are entirely ignored in non-interactive mode, but if this flag is set
13013 then their use will be considered.
13014 It is an error if this flag is set for commands that use the flag
13015 .Cd needsterminal .
13018 .It Cd x-mailx-noquote
13019 An extension flag field that indicates that even a
13020 .Cd copiousoutput
13021 .Cd view
13022 command shall not be used to generate message quotes
13023 (as it would be by default).
13026 .It Cd x-mailx-async
13027 Extension flag field that denotes that the given
13028 .Cd view
13029 command shall be executed asynchronously, without blocking \*(UA.
13030 Cannot be used in conjunction with
13031 .Cd needsterminal .
13034 .It Cd x-mailx-test-once
13035 Extension flag which denotes whether the given
13036 .Cd test
13037 command shall be evaluated once only and the (boolean) result be cached.
13038 This is handy if some global unchanging condition is to be queried, like
13039 .Dq running under the X Window System .
13042 .It Cd x-mailx-tmpfile
13043 Extension flag field that requests creation of a zero-sized temporary
13044 file, the name of which is to be placed in the environment variable
13045 .Ev MAILX_FILENAME_TEMPORARY .
13046 It is an error to use this flag with commands that include a
13047 .Ql %s
13048 format.
13051 .It Cd x-mailx-tmpfile-fill
13052 Normally the MIME part content is passed to the handler via standard
13053 input; if this flag is set then the data will instead be written into
13054 the implied
13055 .Cd x-mailx-tmpfile .
13056 In order to cause deletion of the temporary file you will have to set
13057 .Cd x-mailx-tmpfile-unlink
13058 explicitly!
13059 It is an error to use this flag with commands that include a
13060 .Ql %s
13061 format.
13064 .It Cd x-mailx-tmpfile-unlink
13065 Extension flag field that requests that the temporary file shall be
13066 deleted automatically when the command loop is entered again at latest.
13067 (Do not use this for asynchronous handlers.)
13068 It is an error to use this flag with commands that include a
13069 .Ql %s
13070 format, or in conjunction with
13071 .Cd x-mailx-async ,
13072 or without also setting
13073 .Cd x-mailx-tmpfile
13075 .Cd x-mailx-tmpfile-fill .
13078 .It Cd x-mailx-tmpfile-keep
13079 Using the string
13080 .Ql %s
13081 implies the three tmpfile related flags above, but if you want, e.g.,
13082 .Cd x-mailx-async
13083 and deal with the temporary file yourself, you can add in this flag to
13084 forcefully ignore
13085 .Cd x-mailx-tmpfile-unlink .
13090 The standard includes the possibility to define any number of additional
13091 entry fields, prefixed by
13092 .Ql x- .
13093 Flag fields apply to the entire
13094 .Dq Mailcap
13095 entry \(em in some unusual cases, this may not be desirable, but
13096 differentiation can be accomplished via separate entries, taking
13097 advantage of the fact that subsequent entries are searched if an earlier
13098 one does not provide enough information.
13099 E.g., if a
13100 .Cd view
13101 command needs to specify the
13102 .Cd needsterminal
13103 flag, but the
13104 .Cd compose
13105 command shall not, the following will help out the latter (with enabled
13106 .Va debug
13107 or an increased
13108 .Va verbose
13109 level \*(UA will show information about handler evaluation):
13111 .Bd -literal -offset indent
13112 application/postscript; ps-to-terminal %s; needsterminal
13113 application/postscript; ps-to-terminal %s; compose=idraw %s
13117 In fields any occurrence of the format string
13118 .Ql %t
13119 will be replaced by the
13120 .Ql TYPE/SUBTYPE
13121 specification.
13122 Named parameters from the
13123 .Ql Content-type:
13124 field may be placed in the command execution line using
13125 .Ql %{
13126 followed by the parameter name and a closing
13127 .Ql }
13128 character.
13129 The entire parameter should appear as a single command line argument,
13130 regardless of embedded spaces; thus:
13132 .Bd -literal -offset indent
13133 # Message
13134 Content-type:  multipart/mixed; boundary=42
13136 # Mailcap file
13137 multipart/*; /usr/local/bin/showmulti \e
13138   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
13140 # Executed shell command
13141 /usr/local/bin/showmulti multipart/mixed 42
13145 .\" TODO v15: Mailcap: %n,%F
13146 Note that \*(UA does not support handlers for multipart MIME parts as
13147 shown in this example (as of today).
13148 \*(UA does not support the additional formats
13149 .Ql %n
13151 .Ql %F .
13152 An example file, also showing how to properly deal with the expansion of
13153 .Ql %s ,
13154 which includes any quotes that are necessary to make it a valid shell
13155 argument by itself and thus will cause undesired behaviour when placed
13156 in additional user-provided quotes:
13158 .Bd -literal -offset indent
13159 # Comment line
13160 text/richtext; richtext %s; copiousoutput
13162 text/x-perl; perl -cWT %s
13164 application/pdf; \e
13165   infile=%s\e; \e
13166     trap "rm -f ${infile}" EXIT\e; \e
13167     trap "exit 75" INT QUIT TERM\e; \e
13168     mupdf %s; \e
13169   x-mailx-async; x-mailx-tmpfile-keep
13171 application/*; echo "This is \e"%t\e" but \e
13172     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vet; \e
13173   copiousoutput; x-mailx-noquote
13177 Further reading:
13178 .Sx "HTML mail and MIME attachments" ,
13179 .Sx "The mime.types files" ,
13180 .Ic mimetype ,
13181 .Ev MAILCAPS ,
13182 .Va mime-counter-evidence ,
13183 .Va pipe-TYPE/SUBTYPE ,
13184 .Va pipe-EXTENSION .
13185 .\" }}}
13187 .\" .Ss "The .netrc file" {{{
13188 .Ss "The .netrc file"
13191 .Pa .netrc
13192 file contains user credentials for machine accounts.
13193 The default location
13194 .Pa \*(VN
13195 may be overridden by the
13196 .Ev NETRC
13197 environment variable.
13198 It is possible to load encrypted
13199 .Pa .netrc
13200 files by using an appropriate value in
13201 .Va netrc-pipe .
13204 The file consists of space, tabulator or newline separated tokens.
13205 \*(UA implements a parser that supports a superset of the original BSD
13206 syntax, but users should nonetheless be aware of portability glitches
13207 of that file format, shall their
13208 .Pa .netrc
13209 be usable across multiple programs and platforms:
13212 .Bl -bullet -compact
13214 BSD does not support single, but only double quotation marks, e.g.,
13215 .Ql password="pass with spaces" .
13217 BSD (only?) supports escaping of single characters via a reverse solidus
13218 (e.g., a space can be escaped via
13219 .Ql \e\0 ) ,
13220 in- as well as outside of a quoted string.
13222 BSD does not require a final quotation mark of the last user input token.
13224 The original BSD (Berknet) parser also supported a format which allowed
13225 tokens to be separated with commas \(en whereas at least Hewlett-Packard
13226 still seems to support this syntax, \*(UA does not!
13228 As a non-portable extension some widely-used programs support
13229 shell-style comments: if an input line starts, after any amount of
13230 whitespace, with a number sign
13231 .Ql # ,
13232 then the rest of the line is ignored.
13234 Whereas other programs may require that the
13235 .Pa .netrc
13236 file is accessible by only the user if it contains a
13237 .Cd password
13238 token for any other
13239 .Cd login
13240 than
13241 .Dq anonymous ,
13242 \*(UA will always require these strict permissions.
13246 Of the following list of supported tokens \*(UA only uses (and caches)
13247 .Cd machine ,
13248 .Cd login
13250 .Cd password .
13251 At runtime the command
13252 .Ic netrc
13253 can be used to control \*(UA's
13254 .Pa .netrc
13255 cache.
13257 .Bl -tag -width ".It Cd BaNg"
13258 .It Cd machine Ar name
13259 The hostname of the entries' machine, lowercase-normalized by \*(UA
13260 before use.
13261 Any further file content, until either end-of-file or the occurrence
13262 of another
13263 .Cd machine
13264 or a
13265 .Cd default
13266 first-class token is bound (only related) to the machine
13267 .Ar name .
13269 As an extension that should not be the cause of any worries
13270 \*(UA supports a single wildcard prefix for
13271 .Ar name :
13272 .Bd -literal -offset indent
13273 machine *.example.com login USER password PASS
13274 machine pop3.example.com login USER password PASS
13275 machine smtp.example.com login USER password PASS
13278 which would match
13279 .Ql xy.example.com
13280 as well as
13281 .Ql pop3.example.com ,
13282 but neither
13283 .Ql example.com
13285 .Ql local.smtp.example.com .
13286 Note that in the example neither
13287 .Ql pop3.example.com
13289 .Ql smtp.example.com
13290 will be matched by the wildcard, since the exact matches take
13291 precedence (it is however faster to specify it the other way around).
13293 .It Cd default
13294 This is the same as
13295 .Cd machine
13296 except that it is a fallback entry that is used shall none of the
13297 specified machines match; only one default token may be specified,
13298 and it must be the last first-class token.
13300 .It Cd login Ar name
13301 The user name on the remote machine.
13303 .It Cd password Ar string
13304 The user's password on the remote machine.
13306 .It Cd account Ar string
13307 Supply an additional account password.
13308 This is merely for FTP purposes.
13310 .It Cd macdef Ar name
13311 Define a macro.
13312 A macro is defined with the specified
13313 .Ar name ;
13314 it is formed from all lines beginning with the next line and continuing
13315 until a blank line is (consecutive newline characters are) encountered.
13316 (Note that
13317 .Cd macdef
13318 entries cannot be utilized by multiple machines, too, but must be
13319 defined following the
13320 .Ic machine
13321 they are intended to be used with.)
13322 If a macro named
13323 .Ar init
13324 exists, it is automatically run as the last step of the login process.
13325 This is merely for FTP purposes.
13327 .\" }}}
13329 .\" }}}
13332 .\" .Sh EXAMPLES {{{
13333 .Sh EXAMPLES
13335 .\" .Ss "An example configuration" {{{
13336 .Ss "An example configuration"
13338 .Bd -literal -offset indent
13339 # This example assumes v15.0 compatibility mode
13340 set v15-compat
13342 # Request strict SSL/TLS transport security checks
13343 set ssl-verify=strict
13345 # Where are the up-to-date SSL/TLS certificates?
13346 # (Since we manage up-to-date ones explicitly, do not use any,
13347 # possibly outdated, default certificates shipped with OpenSSL)
13348 #set ssl-ca-dir=/etc/ssl/certs
13349 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
13350 set ssl-ca-no-defaults
13351 #set ssl-ca-flags=partial-chain
13352 wysh set smime-ca-file="${ssl-ca-file}" \e
13353   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
13355 # This could be outsourced to a central configuration file via
13356 # ssl-config-file plus ssl-config-module if the used library allows.
13357 # CipherString: explicitly define the list of ciphers, which may
13358 #   improve security, especially with protocols older than TLS v1.2.
13359 #   See ciphers(1).  Possibly best to only use ssl-cipher-list-HOST
13360 #   (or -USER@HOST), as necessary, again..
13361 # Curves: especially with TLSv1.3 curves selection may be desired.
13362 # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.
13363 #   Change this only when the remote server does not support it:
13364 #   maybe use chain support via ssl-config-pairs-HOST / -USER@HOST
13365 #   to define such explicit exceptions, then, e.g.
13366 #     MinProtocol=TLSv1.1
13367 if [ "$ssl-features" =% +ctx-set-maxmin-proto ]
13368   wysh set ssl-config-pairs='\e
13369       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
13370       Curves=P-521:P-384:P-256,\e
13371       MinProtocol=TLSv1.1'
13372 else
13373   wysh set ssl-config-pairs='\e
13374       CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
13375       Curves=P-521:P-384:P-256,\e
13376       Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2'
13377 endif
13379 # Essential setting: select allowed character sets
13380 set sendcharsets=utf-8,iso-8859-1
13382 # A very kind option: when replying to a message, first try to
13383 # use the same encoding that the original poster used herself!
13384 set reply-in-same-charset
13386 # When replying, do not merge From: and To: of the original message
13387 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
13388 set recipients-in-cc
13390 # When sending messages, wait until the Mail-Transfer-Agent finishs.
13391 # Only like this you will be able to see errors reported through the
13392 # exit status of the MTA (including the built-in SMTP one)!
13393 set sendwait
13395 # Only use built-in MIME types, no mime.types(5) files
13396 set mimetypes-load-control
13398 # Default directory where we act in (relative to $HOME)
13399 set folder=mail
13400 # A leading "+" (often) means: under *folder*
13401 # *record* is used to save copies of sent messages
13402 set MBOX=+mbox.mbox DEAD=+dead.txt \e
13403   record=+sent.mbox record-files record-resent
13405 # Make "file mymbox" and "file myrec" go to..
13406 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
13408 # Not really optional, e.g., for S/MIME
13409 set from='Your Name <address@exam.ple>'
13411 # It may be necessary to set hostname and/or smtp-hostname
13412 # if the "SERVER" of mta and "domain" of from do not match.
13413 # The `urlencode' command can be used to encode USER and PASS
13414 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
13415   smtp-auth=login/plain... \e
13416   smtp-use-starttls
13418 # Never refuse to start into interactive mode, and more
13419 set emptystart \e
13420   colour-pager crt= \e
13421   followup-to followup-to-honour=ask-yes fullnames \e
13422   history-file=+.\*(uAhist history-size=-1 history-gabby \e
13423   mime-counter-evidence=0b1111 \e
13424   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
13425   reply-to-honour=ask-yes \e
13426   umask=
13428 # Only include the selected header fields when typing messages
13429 headerpick type retain from_ date from to cc subject \e
13430   message-id mail-followup-to reply-to
13431 # ...when forwarding messages
13432 headerpick forward retain subject date from to cc
13433 # ...when saving message, etc.
13434 #headerpick save ignore ^Original-.*$ ^X-.*$
13436 # Some mailing lists
13437 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
13438 mlsubscribe '^xfans@xfans\e.xyz$'
13440 # Handle a few file extensions (to store MBOX databases)
13441 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
13442   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
13443   zst 'zstd -dc' 'zstd -19 -zc' \e
13444   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
13446 # A real life example of a very huge free mail provider
13447 # Instead of directly placing content inside `account',
13448 # we `define' a macro: like that we can switch "accounts"
13449 # from within *on-compose-splice*, for example!
13450 define XooglX {
13451   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
13452   set from='Your Name <address@examp.ple>'
13454   set pop3-no-apop-pop.gmXil.com
13455   shortcut pop %:pop3s://pop.gmXil.com
13456   shortcut imap %:imaps://imap.gmXil.com
13457   # Or, entirely IMAP based setup
13458   #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e
13459   #   imap-cache=~/spool/cache
13461   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
13462   # Alternatively:
13463   set mta=smtps://USER:PASS@smtp.gmail.com:465
13465 account XooglX {
13466   \ecall XooglX
13469 # Here is a pretty large one which does not allow sending mails
13470 # if there is a domain name mismatch on the SMTP protocol level,
13471 # which would bite us if the value of from does not match, e.g.,
13472 # for people who have a sXXXXeforge project and want to speak
13473 # with the mailing list under their project account (in from),
13474 # still sending the message through their normal mail provider
13475 define XandeX {
13476   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
13477   set from='Your Name <address@exam.ple>'
13479   shortcut pop %:pop3s://pop.yaXXex.com
13480   shortcut imap %:imaps://imap.yaXXex.com
13482   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
13483     hostname=yaXXex.com smtp-hostname=
13485 account XandeX {
13486   \ecall Xandex
13489 # Create some new commands so that, e.g., `ls /tmp' will..
13490 commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS'
13491 commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS'
13493 set pipe-message/external-body='@* echo $MAILX_EXTERNAL_BODY_URL'
13495 # We do not support gpg(1) directly yet.  But simple --clearsign'd
13496 # message parts can be dealt with as follows:
13497 define V {
13498   localopts yes
13499   wysh set pipe-text/plain=$'@*#++=@\e
13500     < "${MAILX_FILENAME_TEMPORARY}" awk \e
13501         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
13502       BEGIN{done=0}\e
13503       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
13504         if(done++ != 0)\e
13505           next;\e
13506         print "--- GPG --verify ---";\e
13507         system("gpg --verify " TMPFILE " 2>&1");\e
13508         print "--- GPG --verify ---";\e
13509         print "";\e
13510         next;\e
13511       }\e
13512       /^-----BEGIN PGP SIGNATURE-----/,\e
13513           /^-----END PGP SIGNATURE-----/{\e
13514         next;\e
13515       }\e
13516       {print}\e
13517     \e''
13518     print
13520 commandalias V '\e'call V
13524 When storing passwords in
13525 .Pa \*(ur
13526 appropriate permissions should be set on this file with
13527 .Ql $ chmod 0600 \*(ur .
13528 If the \*(OPal
13529 .Va netrc-lookup
13530 is available user credentials can be stored in the central
13531 .Pa \*(VN
13532 file instead; e.g., here is a different version of the example account
13533 that sets up SMTP and POP3:
13535 .Bd -literal -offset indent
13536 define XandeX {
13537   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
13538   set from='Your Name <address@exam.ple>'
13539   set netrc-lookup
13540   # Load an encrypted ~/.netrc by uncommenting the next line
13541   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
13543   set mta=smtps://smtp.yXXXXx.ru:465 \e
13544       smtp-hostname= hostname=yXXXXx.com
13545   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
13546   commandalias xp fi pop3s://pop.yXXXXx.ru
13548 account XandeX {
13549   \ecall XandeX
13554 and, in the
13555 .Pa \*(VN
13556 file:
13558 .Bd -literal -offset indent
13559 machine *.yXXXXx.ru login USER password PASS
13563 This configuration should now work just fine:
13566 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
13567 .\" }}}
13569 .\" .Ss "S/MIME step by step" {{{
13570 .Ss "S/MIME step by step"
13572 \*(OP The first thing you need for participating in S/MIME message
13573 exchange is your personal certificate, including a private key.
13574 The certificate contains public information, in particular your name and
13575 your email address(es), and the public key that is used by others to
13576 encrypt messages for you,
13577 and to verify signed messages they supposedly received from you.
13578 The certificate is included in each signed message you send.
13579 The private key must be kept secret.
13580 It is used to decrypt messages that were previously encrypted with your
13581 public key, and to sign messages.
13584 For personal use it is recommended that you get a S/MIME certificate
13585 from one of the major CAs on the Internet using your WWW browser.
13586 Many CAs offer such certificates for free.
13587 There is also
13588 .Lk https://www.CAcert.org
13589 which issues client and server certificates to members of their
13590 community for free; their root certificate
13591 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
13592 is often not in the default set of trusted CA root certificates, though,
13593 which means you will have to download their root certificate separately
13594 and ensure it is part of our S/MIME certificate validation chain by
13595 including it in
13596 .Va smime-ca-dir
13597 or as a vivid member of the
13598 .Va smime-ca-file .
13599 But let us take a step-by-step tour on how to setup S/MIME with
13600 a certificate from CAcert.org despite this situation!
13603 First of all you will have to become a member of the CAcert.org
13604 community, simply by registrating yourself via the web interface.
13605 Once you are, create and verify all email addresses you want to be able
13606 to create signed and encrypted messages for/with using the corresponding
13607 entries of the web interface.
13608 Now ready to create S/MIME certificates, so let us create a new
13609 .Dq client certificate ,
13610 ensure to include all email addresses that should be covered by the
13611 certificate in the following web form, and also to use your name as the
13612 .Dq common name .
13615 Create a private key and a certificate request on your local computer
13616 (please see the manual pages of the used commands for more in-depth
13617 knowledge on what the used arguments etc. do):
13620 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
13623 Afterwards copy-and-paste the content of
13624 .Dq creq.pem
13625 into the certificate-request (CSR) field of the web form on the
13626 CAcert.org website (you may need to unfold some
13627 .Dq advanced options
13628 to see the corresponding text field).
13629 This last step will ensure that your private key (which never left your
13630 box) and the certificate belong together (through the public key that
13631 will find its way into the certificate via the certificate-request).
13632 You are now ready and can create your CAcert certified certificate.
13633 Download and store or copy-and-paste it as
13634 .Dq pub.crt .
13637 Yay.
13638 In order to use your new S/MIME setup a combined private key/public key
13639 (certificate) file has to be created:
13642 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
13645 This is the file \*(UA will work with.
13646 If you have created your private key with a passphrase then \*(UA will
13647 ask you for it whenever a message is signed or decrypted.
13648 Set the following variables to henceforth use S/MIME (setting
13649 .Va smime-ca-file
13650 is of interest for verification only):
13652 .Bd -literal -offset indent
13653 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
13654     smime-sign-cert=ME@HERE.com.paired \e
13655     smime-sign-message-digest=SHA256 \e
13656     smime-sign
13659 .\" }}}
13661 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
13662 .Ss "Using CRLs with S/MIME or SSL/TLS"
13664 \*(OP Certification authorities (CAs) issue certificate revocation
13665 lists (CRLs) on a regular basis.
13666 These lists contain the serial numbers of certificates that have been
13667 declared invalid after they have been issued.
13668 Such usually happens because the private key for the certificate has
13669 been compromised,
13670 because the owner of the certificate has left the organization that is
13671 mentioned in the certificate, etc.
13672 To seriously use S/MIME or SSL/TLS verification,
13673 an up-to-date CRL is required for each trusted CA.
13674 There is otherwise no method to distinguish between valid and
13675 invalidated certificates.
13676 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
13677 the Internet, so they have to be retrieved by some external mechanism.
13680 \*(UA accepts CRLs in PEM format only;
13681 CRLs in DER format must be converted, like, e.\|g.:
13684 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
13687 To tell \*(UA about the CRLs, a directory that contains all CRL files
13688 (and no other files) must be created.
13690 .Va smime-crl-dir
13692 .Va ssl-crl-dir
13693 variables, respectively, must then be set to point to that directory.
13694 After that, \*(UA requires a CRL to be present for each CA that is used
13695 to verify a certificate.
13696 .\" }}}
13698 .\" }}} (Examples)
13701 .\" .Sh "FAQ" {{{
13702 .Sh "FAQ"
13704 In general it is a good idea to turn on
13705 .Va debug
13706 .Pf ( Fl d )
13707 and / or
13708 .Va verbose
13709 .Pf ( Fl v ,
13710 twice) if something does not work well.
13711 Very often a diagnostic message can be produced that leads to the
13712 problems' solution.
13714 .\" .Ss "\*(UA shortly hangs on startup" {{{
13715 .Ss "\*(UA shortly hangs on startup"
13717 This can have two reasons, one is the necessity to wait for a file lock
13718 and cannot be helped, the other being that \*(UA calls the function
13719 .Xr uname 2
13720 in order to query the nodename of the box (sometimes the real one is
13721 needed instead of the one represented by the internal variable
13722 .Va hostname ) .
13723 One may have varying success by ensuring that the real hostname and
13724 .Ql localhost
13725 have entries in
13726 .Pa /etc/hosts ,
13727 or, more generally, that the name service is properly setup \(en
13728 and does
13729 .Xr hostname 1
13730 return the expected value?
13731 Does this local hostname have a domain suffix?
13732 RFC 6762 standardized the link-local top-level domain
13733 .Ql .local ,
13734 try again after adding an (additional) entry with this extension.
13735 .\" }}}
13737 .\" .Ss "I cannot login to Google mail aka GMail" {{{
13738 .Ss "I cannot login to Google mail aka GMail"
13740 Since 2014 some free service providers classify programs as
13741 .Dq less secure
13742 unless they use a special authentication method (OAuth 2.0) which
13743 was not standardized for non-HTTP protocol authentication token query
13744 until August 2015 (RFC 7628).
13747 Different to Kerberos / GSSAPI, which is developed since the mid of the
13748 1980s, where a user can easily create a local authentication ticket for
13749 her- and himself with the locally installed
13750 .Xr kinit 1
13751 program, that protocol has no such local part but instead requires
13752 a world-wide-web query to create or fetch a token; since there is no
13753 local cache this query would have to be performed whenever \*(UA is
13754 invoked (in interactive sessions situation may differ).
13757 \*(UA does not support OAuth.
13758 Because of this it is necessary to declare \*(UA a
13759 .Dq less secure app
13760 (on the providers account web page) in order to read and send mail.
13761 However, it also seems possible to take the following steps instead:
13764 .Bl -enum -compact
13766 give the provider the number of a mobile phone,
13768 enable
13769 .Dq 2-Step Verification ,
13771 create an application specific password (16 characters), and
13773 use that special password instead of the real Google account password in
13774 \*(UA (for more on that see the section
13775 .Sx "On URL syntax and credential lookup" ) .
13777 .\" }}}
13779 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
13780 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
13782 It can happen that the terminal library (see
13783 .Sx "On terminal control and line editor",
13784 .Ic bind ,
13785 .Va termcap )
13786 reports different codes than the terminal really sends, in which case
13787 \*(UA will tell that a key binding is functional, but will not be able to
13788 recognize it because the received data does not match anything expected.
13789 Especially without the \*(OPal terminal capability library support one
13790 reason for this may be that the (possibly even non-existing) keypad
13791 is not turned on and the resulting layout reports the keypad control
13792 codes for the normal keyboard keys.
13794 .Va verbose
13795 listing of
13796 .Ic bind Ns
13797 ings will show the byte sequences that are expected.
13800 To overcome the situation, use, e.g., the program
13801 .Xr cat 1 ,
13802 in conjunction with the command line option
13803 .Fl \&\&v ,
13804 if available, to see the byte sequences which are actually produced
13805 by keypresses, and use the variable
13806 .Va termcap
13807 to make \*(UA aware of them.
13808 E.g., the terminal this is typed on produces some false sequences, here
13809 an example showing the shifted home key:
13811 .Bd -literal -offset indent
13812 ? set verbose
13813 ? bind*
13814 # 1B 5B=[ 31=1 3B=; 32=2 48=H
13815   bind base :kHOM z0
13816 ? x
13817 $ cat -v
13818 ^[[H
13819 ? \*(uA -v -Stermcap='kHOM=\eE[H'
13820 ? bind*
13821 # 1B 5B=[ 48=H
13822   bind base :kHOM z0
13824 .\" }}}
13826 .\" .Ss "Can \*(UA git-send-email?" {{{
13827 .Ss "Can \*(UA git-send-email?"
13829 Yes.
13830 Put (at least parts of) the following in your
13831 .Pa ~/.gitconfig :
13833 .Bd -literal -offset indent
13834 [sendemail]
13835 smtpserver = /usr/bin/s-mailx
13836 smtpserveroption = -t
13837 #smtpserveroption = -Sexpandaddr
13838 smtpserveroption = -Athe-account-you-need
13840 suppresscc = all
13841 suppressfrom = false
13842 assume8bitEncoding = UTF-8
13843 #to = /tmp/OUT
13844 confirm = always
13845 chainreplyto = true
13846 multiedit = false
13847 thread = true
13848 quiet = true
13849 annotate = true
13851 .\" }}}
13853 .\" }}}
13856 .\" .Sh "IMAP CLIENT" {{{
13857 .Sh "IMAP CLIENT"
13859 \*(OPally there is IMAP client support available.
13860 This part of the program is obsolete and will vanish in v15 with the
13861 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
13862 and makes excessive use of signal based long code jumps.
13863 Support can hopefully be readded later based on a new-style I/O, with
13864 SysV signal handling.
13865 In fact the IMAP support had already been removed from the codebase, but
13866 was reinstantiated on user demand: in effect the IMAP code is at the
13867 level of \*(UA v14.8.16 (with
13868 .Ic imapcodec
13869 being the sole exception), and should be treated with some care.
13872 IMAP uses the
13873 .Ql imap://
13875 .Ql imaps://
13876 protocol prefixes, and an IMAP-based
13877 .Va folder
13878 may be used.
13879 IMAP URLs (paths) undergo inspections and possible transformations
13880 before use (and the command
13881 .Ic imapcodec
13882 can be used to manually apply them to any given argument).
13883 Hierarchy delimiters are normalized, a step which is configurable via the
13884 .Va imap-delim
13885 variable chain, but defaults to the first seen delimiter otherwise.
13886 \*(UA supports internationalised IMAP names, and en- and decodes the
13887 names from and to the
13888 .Va ttycharset
13889 as necessary and possible.
13890 If a mailbox name is expanded (see
13891 .Sx "Filename transformations" )
13892 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
13893 mailboxes below the
13894 .Va folder
13895 target box, while folder names prefixed by `@' refer to folders below
13896 the hierarchy base, e.g., the following lists all folders below the
13897 current one when in an IMAP mailbox:
13898 .Ql folders @ .
13901 Note: some IMAP servers do not accept the creation of mailboxes in
13902 the hierarchy base, but require that they are created as subfolders of
13903 `INBOX' \(en with such servers a folder name of the form
13905 .Dl imaps://mylogin@imap.myisp.example/INBOX.
13907 should be used (the last character is the server's hierarchy
13908 delimiter).
13909 The following IMAP-specific commands exist:
13912 .Bl -tag -width ".It Ic BaNg"
13914 .It Ic cache
13915 Only applicable to cached IMAP mailboxes;
13916 takes a message list and reads the specified messages into the IMAP
13917 cache.
13920 .It Ic connect
13921 If operating in disconnected mode on an IMAP mailbox,
13922 switch to online mode and connect to the mail server while retaining
13923 the mailbox status.
13924 See the description of the
13925 .Va disconnected
13926 variable for more information.
13929 .It Ic disconnect
13930 If operating in online mode on an IMAP mailbox,
13931 switch to disconnected mode while retaining the mailbox status.
13932 See the description of the
13933 .Va disconnected
13934 variable for more.
13935 A list of messages may optionally be given as argument;
13936 the respective messages are then read into the cache before the
13937 connection is closed, thus
13938 .Ql disco *
13939 makes the entire mailbox available for disconnected use.
13942 .It Ic imap
13943 Sends command strings directly to the current IMAP server.
13944 \*(UA operates always in IMAP `selected state' on the current mailbox;
13945 commands that change this will produce undesirable results and should be
13946 avoided.
13947 Useful IMAP commands are:
13948 .Bl -tag -offset indent -width ".Ic getquotearoot"
13949 .It create
13950 Takes the name of an IMAP mailbox as an argument and creates it.
13951 .It getquotaroot
13952 (RFC 2087) Takes the name of an IMAP mailbox as an argument
13953 and prints the quotas that apply to the mailbox.
13954 Not all IMAP servers support this command.
13955 .It namespace
13956 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
13957 the Other User's Namespaces and the Shared Namespaces.
13958 Each namespace type is printed in parentheses;
13959 if there are multiple namespaces of the same type,
13960 inner parentheses separate them.
13961 For each namespace a prefix and a hierarchy separator is listed.
13962 Not all IMAP servers support this command.
13966 .It Ic imapcodec
13967 Perform IMAP path transformations.
13968 Supports
13969 .Cm vput
13970 (see
13971 .Sx "Command modifiers" ) ,
13972 and manages the error number
13973 .Va \&! .
13974 The first argument specifies the operation:
13975 .Ar e[ncode]
13976 normalizes hierarchy delimiters (see
13977 .Va imap-delim )
13978 and converts the strings from the locale
13979 .Va ttycharset
13980 to the internationalized variant used by IMAP,
13981 .Ar d[ecode]
13982 performs the reverse operation.
13987 The following IMAP-specific internal variables exist:
13990 .Bl -tag -width ".It Va BaNg"
13992 .It Va disconnected
13993 \*(BO When an IMAP mailbox is selected and this variable is set,
13994 no connection to the server is initiated.
13995 Instead, data is obtained from the local cache (see
13996 .Va imap-cache Ns
13998 Mailboxes that are not present in the cache
13999 and messages that have not yet entirely been fetched from the server
14000 are not available;
14001 to fetch all messages in a mailbox at once,
14002 the command
14003 .No ` Ns Li copy * /dev/null Ns '
14004 can be used while still in connected mode.
14005 Changes that are made to IMAP mailboxes in disconnected mode are queued
14006 and committed later when a connection to that server is made.
14007 This procedure is not completely reliable since it cannot be guaranteed
14008 that the IMAP unique identifiers (UIDs) on the server still match the
14009 ones in the cache at that time.
14010 Data is saved to
14011 .Ev DEAD
14012 when this problem occurs.
14014 .It Va disconnected-USER@HOST
14015 The specified account is handled as described for the
14016 .Va disconnected
14017 variable above,
14018 but other accounts are not affected.
14020 .Mx Va imap-auth
14021 .It Va imap-auth-USER@HOST , imap-auth
14022 Sets the IMAP authentication method.
14023 Valid values are `login' for the usual password-based authentication
14024 (the default),
14025 `cram-md5', which is a password-based authentication that does not send
14026 the password over the network in clear text,
14027 and `gssapi' for GSS-API based authentication.
14030 .It Va imap-cache
14031 Enables caching of IMAP mailboxes.
14032 The value of this variable must point to a directory that is either
14033 existent or can be created by \*(UA.
14034 All contents of the cache can be deleted by \*(UA at any time;
14035 it is not safe to make assumptions about them.
14037 .Mx Va imap-delim
14038 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
14039 The hierarchy separator used by the IMAP server.
14040 Whenever an IMAP path is specified it will undergo normalization.
14041 One of the normalization steps is the squeezing and adjustment of
14042 hierarchy separators.
14043 If this variable is set, any occurrence of any character of the given
14044 value that exists in the path will be replaced by the first member of
14045 the value; an empty value will cause the default to be used, it is
14046 .Ql /. .
14047 If not set, we will reuse the first hierarchy separator character that
14048 is discovered in a user-given mailbox name.
14050 .Mx Va imap-keepalive
14051 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
14052 IMAP servers may close the connection after a period of
14053 inactivity; the standard requires this to be at least 30 minutes,
14054 but practical experience may vary.
14055 Setting this variable to a numeric `value' greater than 0 causes
14056 a `NOOP' command to be sent each `value' seconds if no other operation
14057 is performed.
14060 .It Va imap-list-depth
14061 When retrieving the list of folders on an IMAP server, the
14062 .Ic folders
14063 command stops after it has reached a certain depth to avoid possible
14064 infinite loops.
14065 The value of this variable sets the maximum depth allowed.
14066 The default is 2.
14067 If the folder separator on the current IMAP server is a slash `/',
14068 this variable has no effect and the
14069 .Ic folders
14070 command does not descend to subfolders.
14072 .Mx Va imap-use-starttls
14073 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
14074 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
14075 IMAP session SSL/TLS encrypted.
14076 This functionality is not supported by all servers,
14077 and is not used if the session is already encrypted by the IMAPS method.
14080 .\" }}}
14083 .\" .Sh "SEE ALSO" {{{
14084 .Sh "SEE ALSO"
14086 .Xr bogofilter 1 ,
14087 .Xr gpg 1 ,
14088 .Xr more 1 ,
14089 .Xr newaliases 1 ,
14090 .Xr openssl 1 ,
14091 .Xr sendmail 1 ,
14092 .Xr sh 1 ,
14093 .Xr spamassassin 1 ,
14094 .Xr iconv 3 ,
14095 .Xr setlocale 3 ,
14096 .Xr aliases 5 ,
14097 .Xr termcap 5 ,
14098 .Xr terminfo 5 ,
14099 .Xr locale 7 ,
14100 .Xr mailaddr 7 ,
14101 .Xr re_format 7 ,
14102 .Xr mailwrapper 8 ,
14103 .Xr sendmail 8
14105 .\" }}}
14108 .\" .Sh HISTORY {{{
14109 .Sh HISTORY
14111 M. Douglas McIlroy writes in his article
14112 .Dq A Research UNIX Reader: Annotated Excerpts \
14113 from the Programmer's Manual, 1971-1986
14114 that a
14115 .Xr mail 1
14116 command already appeared in First Edition
14118 in 1971:
14120 .Bd -ragged -offset indent
14121 Electronic mail was there from the start.
14122 Never satisfied with its exact behavior, everybody touched it at one
14123 time or another: to assure the safety of simultaneous access, to improve
14124 privacy, to survive crashes, to exploit uucp, to screen out foreign
14125 freeloaders, or whatever.
14126 Not until v7 did the interface change (Thompson).
14127 Later, as mail became global in its reach, Dave Presotto took charge and
14128 brought order to communications with a grab-bag of external networks
14129 (v8).
14134 Mail was written in 1978 by Kurt Shoens and developed as part of the
14137 distribution until 1995.
14138 Mail has then seen further development in open source
14140 variants, noticeably by Christos Zoulas in
14141 .Pf Net Bx .
14142 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
14143 Ritter in the years 2000 until 2008.
14144 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
14145 This man page is derived from
14146 .Dq The Mail Reference Manual
14147 that was originally written by Kurt Shoens.
14149 .\" }}}
14152 .Sh AUTHORS
14154 .An -nosplit
14155 .An "Kurt Shoens" ,
14156 .An "Edward Wang" ,
14157 .An "Keith Bostic" ,
14158 .An "Christos Zoulas" ,
14159 .An "Gunnar Ritter" .
14160 \*(UA is developed by
14161 .An "Steffen Nurpmeso" Aq steffen@sdaoden.eu .
14164 .\" .Sh CAVEATS {{{
14165 .Sh CAVEATS
14167 \*(ID Interrupting an operation via
14168 .Dv \&\&SIGINT
14170 .Ql control-C
14171 from anywhere else but a command prompt is very problematic and likely
14172 to leave the program in an undefined state: many library functions
14173 cannot deal with the
14174 .Fn siglongjmp 3
14175 that this software (still) performs; even though efforts have been taken
14176 to address this, no sooner but in v15 it will have been worked out:
14177 interruptions have not been disabled in order to allow forceful breakage
14178 of hanging network connections, for example (all this is unrelated to
14179 .Va ignore ) .
14182 The SMTP and POP3 protocol support of \*(UA is very basic.
14183 Also, if it fails to contact its upstream SMTP server, it will not make
14184 further attempts to transfer the message at a later time (setting
14185 .Va save
14187 .Va sendwait
14188 may be useful).
14189 If this is a concern, it might be better to set up a local SMTP server
14190 that is capable of message queuing.
14192 .\" }}}
14195 .Sh BUGS
14197 After deleting some message of a POP3 mailbox the header summary falsely
14198 claims that there are no messages to display, one needs to perform
14199 a scroll or dot movement to restore proper state.
14202 .Ql thread Ns
14204 .Ic sort
14205 mode a power user may encounter crashes very occasionally (this is may
14206 and very).
14208 The file
14209 .Pa TODO
14210 in the source repository lists future directions.
14213 Please report bugs to the
14214 .Va contact-mail
14215 address, e.g., from within \*(uA:
14216 .\" v15-compat: drop eval as `mail' will expand variable?
14217 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
14218 Including the output of the command
14219 .Ic version
14220 may be helpful, e.g.,
14222 .Bd -literal -offset indent
14223 ? vput version xy; wysh set escape=!; eval mail $contact-mail
14224 Bug subject
14225 !I xy
14230 Information on the web at
14231 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ' -Xx .
14233 .\" s-ts-mode