THANKS: Solar Designer
[s-mailx.git] / nail.1
blobca1e660f46f73c763ec2e318b6298d647846341c
1 .\"@ nail.1 - S-nail(1) reference manual.
2 .\"
3 .\" Copyright (c) 2000-2008 Gunnar Ritter, Freiburg i. Br., Germany.
4 .\" Copyright (c) 2012 - 2017 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.5 / 2017-10-21
35 .Dd October 21, 2017
36 .ds VV \\%v14.9.5
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 .\"--MKMAN-END--
44 .\" --BEGINSTRIP--
45 .\"
46 .\" If not ~/.mailrc, it breaks POSIX compatibility.  And adjust main.c.
47 .ds ur \\%~/.mailrc
48 .ds OB [Obsolete]
49 .ds OP [Option]
50 .ds IN [v15-compat]
51 .ds OU [no v15-compat]
52 .ds ID [v15 behaviour may differ]
53 .ds NQ [Only new quoting rules]
54 .ds BO (Boolean)
55 .ds RO (Read-only)
57 .Dt "\*(UU" 1
58 .Os
59 .Mx -enable
62 .Sh NAME
63 .Nm \*(UA \%[\*(VV]
64 .Nd send and receive Internet mail
67 .\" .Sh SYNOPSIS {{{
68 .Sh SYNOPSIS
70 .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
71 .Nm \*(uA
72 .Fl h | Fl Fl help
73 .Pp
74 .Nm \*(uA
75 .Bk -words
76 .Op Fl BdEFinv~#
77 .Op Fl \&: Ar spec
78 .Op Fl A Ar account
79 .Op : Ns Fl a Ar attachment Ns \&:
80 .Op : Ns Fl b Ar bcc-addr Ns \&:
81 .Op : Ns Fl c Ar cc-addr Ns \&:
82 .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
83 .Op Fl r Ar from-addr
84 .Oo : Ns
85 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
86 .Pf \&: Oc
87 .Op Fl s Ar subject
88 .Op : Ns Fl X Ar cmd Ns \&:
89 .Op Fl \&.
90 .Pf : Ar to-addr Ns \&:
91 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
92 .Ek
93 .Pp
94 .Nm \*(uA
95 .Bk -words
96 .Op Fl BdEeHiNnRv~#
97 .Op Fl \&: Ar spec
98 .Op Fl A Ar account
99 .Op Fl L Ar spec
100 .Op Fl r Ar from-addr
101 .Oo : Ns
102 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
103 .Pf \&: Oc
104 .Op Fl u Ar user
105 .Op : Ns Fl X Ar cmd Ns \&:
106 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
108 .Nm \*(uA
109 .Bk -words
110 .Op Fl BdEeHiNnRv~#
111 .Op Fl \&: Ar spec
112 .Op Fl A Ar account
113 .Fl f
114 .Op Fl L Ar spec
115 .Op Fl r Ar from-addr
116 .Oo : Ns
117 .Fl S Ar var Ns Op Ns = Ns Ar value Ns
118 .Pf \&: Oc
119 .Op : Ns Fl X Ar cmd Ns \&:
120 .Op Ar file
121 .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
124 .\" }}}
127 .Mx -toc -tree html pdf ps xhtml
130 .\" .Sh DESCRIPTION {{{
131 .Sh DESCRIPTION
133 .Bd -filled -compact -offset indent
134 .Sy Compatibility note:
135 S-nail (\*(UA) will wrap up into \%S-mailx in v15.0 (circa 2020).
136 Backward incompatibility has to be expected \(en
137 .Sx COMMANDS
138 will use
139 .Sx "Shell-style argument quoting"
140 rules, for example, and shell metacharacters will become meaningful.
141 New and old behaviour is flagged \*(IN and \*(OU, and setting
142 .Va v15-compat ,
143 one of the many
144 .Sx "INTERNAL VARIABLES" ,
145 will choose new behaviour when applicable.
146 \*(OB flags what will vanish, and enabling
147 .Fl d
149 .Fl v
150 enables obsoletion warnings.
154 \*(UA provides a simple and friendly environment for sending and
155 receiving mail.
156 It is intended to provide the functionality of the POSIX
157 .Xr mailx 1
158 command, but is MIME capable and optionally offers extensions for
159 line editing, S/MIME, SMTP and POP3, among others.
160 \*(UA divides incoming mail into its constituent messages and allows
161 the user to deal with them in any order.
162 It offers many
163 .Sx COMMANDS
165 .Sx "INTERNAL VARIABLES"
166 for manipulating messages and sending mail.
167 It provides the user simple editing capabilities to ease the composition
168 of outgoing messages, and increasingly powerful and reliable
169 non-interactive scripting capabilities.
171 .\" .Ss "Options" {{{
172 .Ss "Options"
174 .Bl -tag -width ".It Fl BaNg"
176 .It Fl \&: Ar spec
177 Explicitly control which of the
178 .Sx "Resource files"
179 shall be
180 .Ic source Ns
181 d (loaded): if the letter
182 .Ql s
183 is (case-insensitively) part of the
184 .Ar spec
185 then the system wide
186 .Pa \*(UR
187 is sourced, likewise the letter
188 .Ql u
189 controls sourcing of the user's personal
190 .Pa \*(ur
191 file, whereas the letters
192 .Ql -
194 .Ql /
195 explicitly forbid sourcing of any resource files.
196 Scripts should use this option: to avoid environmental noise they should
197 .Dq detach
198 from any configuration and create a script-specific environment, setting
199 any of the desired
200 .Sx "INTERNAL VARIABLES"
202 .Fl S
203 and running configurating commands via
204 .Fl X .
205 This option overrides
206 .Fl n .
209 .It Fl A Ar account
210 Executes an
211 .Ic account
212 command for the given user email
213 .Ar account
214 after program startup is complete (all resource files are loaded, any
215 .Fl S
216 setting is being established; only
217 .Fl X
218 commands have not been evaluated yet).
219 Being a special incarnation of
220 .Ic define Ns d
221 macros for the purpose of bundling longer-lived
222 .Ic set Ns
223 tings, activating such an email account also switches to the accounts
224 .Mx -sx
225 .Sx "primary system mailbox"
226 (most likely the
227 .Va inbox ) .
230 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
231 Attach
232 .Ar file
233 to the message (for compose mode opportunities refer to
234 .Ic ~@
236 .Ic ~^ ) .
237 .Sx "Filename transformations"
238 (also see
239 .Ic file )
240 will be performed, except that shell variables are not expanded.
241 Shall
242 .Ar file
243 not be accessible but contain a
244 .Ql =
245 character, then anything before the
246 .Ql =
247 will be used as the filename, anything thereafter as a character set
248 specification.
250 If an input character set is specified,
251 .Mx -ix "character set specification"
252 but no output character set, then the given input character set is fixed
253 as-is, and no conversion will be applied;
254 giving the empty string or the special string hyphen-minus
255 .Ql -
256 will be treated as if
257 .Va ttycharset
258 has been specified (the default).
260 If an output character set has also been given then the conversion will
261 be performed exactly as specified and on-the-fly, not considering the
262 file's type and content.
263 As an exception, if the output character set is specified as the empty
264 string or hyphen-minus
265 .Ql - ,
266 then the default conversion algorithm (see
267 .Sx "Character sets" )
268 is applied (therefore no conversion is performed on-the-fly,
269 .Ar file
270 will be MIME-classified and its contents will be inspected first) \(em
271 without support for character set conversions
272 .Pf ( Va features
273 does not include the term
274 .Ql +iconv )
275 only this argument is supported.
277 .It Fl B
278 (\*(OB: \*(UA will always use line-buffered output, to gain
279 line-buffered input even in batch mode enable batch mode via
280 .Fl # . )
283 .It Fl b Ar addr
284 Send a blind carbon copy to
285 .Ar addr Ns
286 ess, if the
287 .Ic set Ns
288 ting of
289 .Va expandaddr ,
290 one of the
291 .Sx "INTERNAL VARIABLES" ,
292 allows.
293 The option may be used multiple times.
294 Also see the section
295 .Sx "On sending mail, and non-interactive mode" .
298 .It Fl c Ar addr
299 Send carbon copies to the given receiver, if so allowed by
300 .Va expandaddr .
301 May be used multiple times.
304 .It Fl d
305 .Ic set
306 the internal variable
307 .Va debug
308 which enables debug messages and disables message delivery,
309 among others; effectively turns almost any operation into a dry-run.
312 .It Fl E
313 .Ic set
314 .Va skipemptybody
315 and thus discard messages with an empty message part body.
316 This command line option is \*(OB.
319 .It Fl e
320 Just check if mail is present (in the system
321 .Va inbox
322 or the one specified via
323 .Fl f ) :
324 if yes, return an exit status of zero, a non-zero value otherwise.
325 To restrict the set of mails to consider in this evaluation a message
326 specification can be added with the option
327 .Fl L .
330 .It Fl F
331 Save the message to send in a file named after the local part of the
332 first recipient's address (instead of in
333 .Va record Ns ).
336 .It Fl f
337 Read in the contents of the user's
338 .Mx -sx
339 .Sx "secondary mailbox"
340 .Ev MBOX
341 (or the specified file) for processing;
342 when \*(UA is quit, it writes undeleted messages back to this file
343 (but be aware of the
344 .Va hold
345 option).
346 The optional
347 .Ar file
348 argument will undergo some special
349 .Sx "Filename transformations"
350 (also see
351 .Ic file ) .
352 Note that
353 .Ar file
354 is not an argument to the flag
355 .Fl \&\&f ,
356 but is instead taken from the command line after option processing has
357 been completed.
358 In order to use a
359 .Ar file
360 that starts with a hyphen-minus, prefix with a relative path, as in
361 .Ql ./-hyphenbox.mbox .
364 .It Fl H
365 Display a summary of
366 .Ic headers
367 and exit; a configurable summary view is available via the
368 .Fl L
369 option.
372 .It Fl h
373 Show a short usage summary.
376 .It Fl i
377 .Ic set
378 .Va ignore
379 to ignore tty interrupt signals.
382 .It Fl L Ar spec
383 Display a summary of
384 .Ic headers
385 of all messages that match the given
386 .Ar spec ,
387 then exit.
388 See the section
389 .Sx "Specifying messages"
390 for the format of
391 .Ar spec .
392 If the
393 .Fl e
394 option has been given in addition no header summary is produced,
395 but \*(UA will instead indicate via its exit status whether
396 .Ar spec
397 matched any messages
398 .Pf ( Ql 0 )
399 or not
400 .Pf ( Ql 1 ) ;
401 note that any verbose output is suppressed in this mode and must instead
402 be enabled explicitly (e.g., by using the option
403 .Fl v ) .
406 .It Fl M Ar type
407 Special send mode that will flag standard input with the MIME
408 .Ql Content-Type:
409 set to the given
410 .Ar type
411 and use it as the main message body.
412 \*(ID Using this option will bypass processing of
413 .Va message-inject-head
415 .Va message-inject-tail .
416 Also see
417 .Fl q , m , t .
420 .It Fl m Ar file
421 Special send mode that will MIME classify the specified
422 .Ar file
423 and use it as the main message body.
424 \*(ID Using this option will bypass processing of
425 .Va message-inject-head
427 .Va message-inject-tail .
428 Also see
429 .Fl q , M , t .
432 .It Fl N
433 inhibit the initial display of message headers when reading mail or
434 editing a mailbox
435 .Ic folder
436 by calling
437 .Ic unset
438 for the internal variable
439 .Va header .
442 .It Fl n
443 Standard flag that inhibits reading the system wide
444 .Pa \*(UR
445 upon startup.
446 The option
447 .Fl \&:
448 allows more control over the startup sequence; also see
449 .Sx "Resource files" .
452 .It Fl q Ar file
453 Special send mode that will initialize the message body with the
454 contents of the specified
455 .Ar file ,
456 which may be standard input
457 .Ql -
458 only in non-interactive context.
459 Also see
460 .Fl M , m , t .
463 .It Fl R
464 Any mailbox
465 .Ic folder
466 opened will be in read-only mode.
470 .It Fl r Ar from-addr
471 Whereas the source address that appears in the
472 .Va from
473 header of a message (or in the
474 .Va sender
475 header if the former contains multiple addresses) is honoured by the
476 builtin SMTP transport, it is not used by a file-based
477 .Va mta
478 (Mail-Transfer-Agent) for the RFC 5321 reverse-path used for relaying
479 and delegating a message to its destination(s), for delivery errors
480 etc., but it instead uses the local identity of the initiating user.
483 When this command line option is used the given
484 .Ar from-addr
485 will be assigned to the internal variable
486 .Va from ,
487 but in addition the command line option
488 .Fl \&\&f Ar from-addr
489 will be passed to a file-based
490 .Va mta
491 whenever a message is sent.
492 Shall
493 .Ar from-addr
494 include a user name the address components will be separated and
495 the name part will be passed to a file-based
496 .Va mta
497 individually via
498 .Fl \&\&F Ar name .
501 If an empty string is passed as
502 .Ar from-addr
503 then the content of the variable
504 .Va from
505 (or, if that contains multiple addresses,
506 .Va sender )
507 will be evaluated and used for this purpose whenever the file-based
508 .Va mta
509 is contacted.
510 By default, without
511 .Fl \&\&r
512 that is, neither
513 .Fl \&\&f
515 .Fl \&\&F
516 command line options are used when contacting a file-based MTA, unless
517 this automatic deduction is enforced by
518 .Ic set Ns
519 ing the internal variable
520 .Va r-option-implicit .
523 Remarks: many default installations and sites disallow overriding the
524 local user identity like this unless either the MTA has been configured
525 accordingly or the user is member of a group with special privileges.
529 .It Fl S Ar var Ns Op = Ns value
530 .Ic set
531 (or, with a prefix string
532 .Ql no ,
533 as documented in
534 .Sx "INTERNAL VARIABLES" ,
535 .Ic unset )
536 .Ar var Ns
537 iable and optionally assign
538 .Ar value ,
539 if supported.
540 If the operation fails the program will exit if any of
541 .Va errexit
543 .Va posix
544 are set.
545 Settings established via
546 .Fl \&\&S
547 cannot be changed from within
548 .Sx "Resource files"
549 or an account switch initiated by
550 .Fl A .
551 They will become mutable again before commands registered via
552 .Fl X
553 are executed.
556 .It Fl s Ar subject
557 Specify the subject of the message to be sent.
558 Newline (NL) and carriage-return (CR) bytes are invalid and will be
559 normalized to space (SP) characters.
562 .It Fl t
563 The message given (on standard input) is expected to contain, separated
564 from the message body by an empty line, a message header with
565 .Ql To: ,
566 .Ql Cc: ,
568 .Ql Bcc:
569 fields giving its recipients, which will be added to any recipients
570 specified on the command line.
571 If a message subject is specified via
572 .Ql Subject:
573 then it will be used in favour of one given on the command line.
575 Also understood are
576 .Ql Reply-To:
577 (possibly overriding
578 .Va reply-to ) ,
579 .Ql Sender:
580 .Pf ( Va sender ) ,
581 .Ql From:
582 .Pf ( Va from
583 and / or option
584 .Fl r ) .
585 .Ql Message-ID: ,
586 .Ql In-Reply-To: ,
587 .Ql References:
589 .Ql Mail-Followup-To: ,
590 by default created automatically dependent on message context, will
591 be used if specified (a special address massage will however still occur
592 for the latter).
593 Any other custom header field (also see
594 .Va customhdr
596 .Ic ~^ )
597 is passed through entirely
598 unchanged, and in conjunction with the options
599 .Fl ~
601 .Fl #
602 it is possible to embed
603 .Sx "COMMAND ESCAPES" .
604 Also see
605 .Fl M , m , q .
608 .It Fl u Ar user
609 Initially read the
610 .Mx -sx
611 .Sx "primary system mailbox"
613 .Ar user ,
614 appropriate privileges presumed; effectively identical to
615 .Ql Fl \&\&f Ns \0%user .
618 .It Fl V
619 Show \*(UA's
620 .Va version
621 and exit.
622 The command
623 .Ic version
624 will also show the list of
625 .Va features :
626 .Ql $ \*(uA -Xversion -Xx .
629 .It Fl v
630 .Ic set Ns
631 ting the internal variable
632 .Va verbose
633 enables display of some informational context messages.
634 Using it twice increases the level of verbosity.
637 .It Fl X Ar cmd
638 Add the given (or multiple for a multiline argument)
639 .Ar cmd
640 to the list of commands to be executed,
641 as a last step of program startup, before normal operation starts.
642 This is the only possibility to execute commands in non-interactive mode
643 when reading startup files is actively prohibited.
644 The commands will be evaluated as a unit, just as via
645 .Ic source .
646 Correlates with
647 .Fl #
649 .Va errexit .
652 .It Fl ~
653 Enable
654 .Sx "COMMAND ESCAPES"
655 in compose mode even in non-interactive use cases.
656 This can be used to, e.g., automatically format the composed message
657 text before sending the message:
658 .Bd -literal -offset indent
659 $ ( echo 'line    one. Word.     Word2.';\e
660     echo '~| /usr/bin/fmt -tuw66' ) |\e
661   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
665 .It Fl #
666 Enables batch mode: standard input is made line buffered, the complete
667 set of (interactive) commands is available, processing of
668 .Sx "COMMAND ESCAPES"
669 is enabled in compose mode, and diverse
670 .Sx "INTERNAL VARIABLES"
671 are adjusted for batch necessities, exactly as if done via
672 .Ic set :
673 .Va emptystart ,
674 .Pf no Va errexit ,
675 .Pf no Va header ,
676 .Pf no Va posix ,
677 .Va quiet ,
678 .Va sendwait ,
679 .Va typescript-mode
680 as well as
681 .Ev MAIL ,
682 .Ev MBOX
684 .Va inbox
685 (the latter three to
686 .Pa /dev/null ) .
687 The following prepares an email message in a batched dry run:
688 .Bd -literal -offset indent
689 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
690   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
694 .It Fl \&.
695 This flag forces termination of option processing in order to prevent
696 .Dq option injection
697 (attacks).
698 It also forcefully puts \*(UA into send mode, see
699 .Sx "On sending mail, and non-interactive mode" .
703 All given
704 .Ar to-addr
705 arguments and all receivers established via
706 .Fl b
708 .Fl c
709 are subject to the checks established by
710 .Va expandaddr ,
711 one of the
712 .Sx "INTERNAL VARIABLES" .
713 If the setting of
714 .Va expandargv
715 allows their recognition all
716 .Ar mta-option
717 arguments given at the end of the command line after a
718 .Ql --
719 separator will be passed through to a file-based
720 .Va mta
721 (Mail-Transfer-Agent) and persist for the entire session.
722 .Va expandargv
723 constraints do not apply to the content of
724 .Va mta-arguments .
725 .\" }}}
727 .\" .Ss "A starter" {{{
728 .Ss "A starter"
730 \*(UA is a direct descendant of
732 Mail, itself a successor of the Research
734 mail which
735 .Dq was there from the start
736 according to
737 .Sx HISTORY .
738 It thus represents the user side of the
740 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
741 traditionally taken by
742 .Xr sendmail 8 ,
743 and most MTAs provide a binary of this name for compatibility purposes.
744 If the \*(OPal SMTP
745 .Va mta
746 is included in the
747 .Va features
748 of \*(UA then the system side is not a mandatory precondition for mail
749 delivery.
752 Because \*(UA strives for compliance with POSIX
753 .Xr mailx 1
754 it is likely that some configuration settings have to be adjusted before
755 using it is a smooth experience.
756 (Rather complete configuration examples can be found in the section
757 .Sx EXAMPLES . )
758 The default global
759 .Pa \*(UR ,
760 one of the
761 .Sx "Resource files" ,
762 bends those standard imposed settings of the
763 .Sx "INTERNAL VARIABLES"
764 a bit towards more user friendliness and safety already.
767 For example, it
768 .Ic set Ns s
769 .Va hold
771 .Va keepsave
772 in order to suppress the automatic moving of messages to the
773 .Mx -sx
774 .Sx "secondary mailbox"
775 .Ev MBOX
776 that would otherwise occur (see
777 .Sx "Message states" ) ,
779 .Va keep
780 to not remove empty system MBOX mailbox files in order not to mangle
781 file permissions when files eventually get recreated (all empty (MBOX)
782 mailbox files will be removed unless this variable is set whenever
783 .Va posix
784 .Pf a.k.a.\0 Ev POSIXLY_CORRECT
785 mode has been enabled).
788 It also enables
789 .Va sendwait
790 in order to synchronize \*(UA with the exit status report of the used
791 .Va mta
792 when sending mails.
794 .Ic set Ns
796 .Va emptystart
797 to enter interactive startup even if the initial mailbox is empty,
798 .Va editheaders
799 to allow editing of headers as well as
800 .Va fullnames
801 to not strip down addresses in compose mode, and
802 .Va quote
803 to include the message that is being responded to when
804 .Ic reply Ns
805 ing.
808 Some random remarks.
809 The file mode creation mask can be explicitly managed via the variable
810 .Va umask .
811 Sufficient system support provided symbolic links will not be followed
812 when files are opened for writing.
813 Files and shell pipe output can be
814 .Ic source Ns
815 d for evaluation, also during startup from within the
816 .Sx "Resource files" .
817 .\" }}}
819 .\" .Ss "On sending mail, and non-interactive mode" {{{
820 .Ss "On sending mail, and non-interactive mode"
822 To send a message to one or more people, using a local or built-in
823 .Va mta
824 (Mail-Transfer-Agent) transport to actually deliver the generated mail
825 message, \*(UA can be invoked with arguments which are the names of
826 people to whom the mail will be sent, and the command line options
827 .Fl b
829 .Fl c
830 can be used to add (blind) carbon copy receivers:
832 .Bd -literal -offset indent
833 # Via sendmail(1)
834 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
836 # But... try it in an isolated dry-run mode (-d) first
837 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
838    -b bcc@exam.ple -c cc@exam.ple \e
839    -Sfullnames -. \e
840    '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
842 # With SMTP
843 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
844     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
845     -S from=scriptreply@exam.ple \e
846     -a /etc/mail.rc \e
847     -. eric@exam.ple
851 If standard input is a terminal rather than the message to be sent,
852 the user is expected to type in the message contents.
853 In this compose mode \*(UA treats lines beginning with the character
854 .Ql ~
855 special \(en these are so-called
856 .Sx "COMMAND ESCAPES" ,
857 which can be used to read in files, process shell commands, add and edit
858 attachments and more; e.g., the command escape
859 .Ic ~e
860 will start the text editor to revise the message in its current state,
861 .Ic ~h
862 allows editing of the most important message headers, with
863 .Ic ~^
864 custom headers can be created (more specifically than with
865 .Va customhdr ) .
866 .Ic ~?
867 gives an overview of most other available command escapes.
868 The command escape
869 .Ic ~.
870 will leave compose mode and send the message once it is completed.
871 Alternatively typing
872 .Ql control-D
873 .Pf ( Ql ^D )
874 at the beginning of an empty line has the same effect, whereas typing
875 .Ql control-C
876 .Pf ( Ql ^C )
877 twice will abort the current letter (saving its contents in the file
878 denoted by
879 .Ev DEAD
880 unless
881 .Pf no Va save
882 is set).
885 A number of
886 .Sx ENVIRONMENT
888 .Sx "INTERNAL VARIABLES"
889 can be used to alter default behavior.
890 E.g., messages are sent asynchronously, without supervision, unless the
891 internal variable
892 .Va sendwait
893 is set, therefore send errors will not be recognizable until then.
894 .Ic set Ns
895 ting (also via
896 .Fl S )
897 .Va editalong
898 will automatically startup a text editor when compose mode is entered,
899 .Va editheaders
900 allows editing of headers additionally to plain body content,
901 .Va askcc
903 .Va askbcc
904 will cause the user to be prompted actively for (blind) carbon-copy
905 recipients, respectively, and (the default)
906 .Va asksend
907 will request confirmation whether the message shall be sent.
910 The envelope sender address is defined by
911 .Va from ,
912 explicitly defining an originating
913 .Va hostname
914 may be desirable, especially with the builtin SMTP Mail-Transfer-Agent
915 .Va mta .
916 .Sx "Character sets"
917 for outgoing message and MIME part content are configurable via
918 .Va sendcharsets ,
919 whereas input data is assumed to be in
920 .Va ttycharset .
921 Message data will be passed over the wire in a
922 .Va mime-encoding .
923 MIME parts a.k.a. attachments need to be assigned a
924 .Ic mimetype ,
925 usually taken out of
926 .Sx "The mime.types files" .
927 Saving a copy of sent messages in a
928 .Va record
929 mailbox may be desirable \(en as for most mailbox
930 .Ic file
931 targets the value will undergo
932 .Sx "Filename transformations" .
933 Some introductional
934 .Fl d
936 .Va debug
937 sandbox dry-run tests will prove correctness.
940 Message recipients (as specified on the command line or defined in
941 .Ql To: ,
942 .Ql Cc:
944 .Ql Bcc: )
945 may not only be email addressees but can also be names of mailboxes and
946 even complete shell command pipe specifications.
947 If the variable
948 .Va expandaddr
949 is not set then only network addresses (see
950 .Xr mailaddr 7
951 for a description of mail addresses) and plain user names (including MTA
952 aliases) may be used, other types will be filtered out, giving a warning
953 message.
954 The command
955 .Ic addrcodec
956 can be used to generate standard compliant network addresses.
958 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
959 .\" grep the latter for the complete picture
961 If the variable
962 .Va expandaddr
963 is set then extended recipient addresses will optionally be accepted:
964 Any name which starts with a vertical bar
965 .Ql |
966 character specifies a command pipe \(en the command string following the
967 .Ql |
968 is executed and the message is sent to its standard input;
969 Likewise, any name that starts with the character solidus
970 .Ql /
971 or the character sequence dot solidus
972 .Ql ./
973 is treated as a file, regardless of the remaining content;
974 likewise a name that solely consists of a hyphen-minus
975 .Ql - .
976 Any other name which contains a commercial at
977 .Ql @
978 character is treated as a network address;
979 Any other name which starts with a plus sign
980 .Ql +
981 character specifies a mailbox name;
982 Any other name which contains a solidus
983 .Ql /
984 character but no exclamation mark
985 .Ql \&!
986 or percent sign
987 .Ql %
988 character before also specifies a mailbox name;
989 What remains is treated as a network address.
991 .Bd -literal -offset indent
992 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
993 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
994 $ echo safe | LC_ALL=C \e
995     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
996       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
997       -. bob@exam.ple
1001 It is possible to create personal distribution lists via the
1002 .Ic alias
1003 command, so that, for instance, the user can send mail to
1004 .Ql cohorts
1005 and have it go to a group of people.
1006 These aliases have nothing in common with the system wide aliases that
1007 may be used by the MTA, which are subject to the
1008 .Ql name
1009 constraint of
1010 .Va expandaddr
1011 and are often tracked in a file
1012 .Pa /etc/aliases
1013 (and documented in
1014 .Xr aliases 5
1016 .Xr sendmail 1 ) .
1017 Personal aliases will be expanded by \*(UA before the message is sent,
1018 and are thus a convenient alternative to specifying each addressee by
1019 itself; they correlate with the active set of
1020 .Ic alternates
1021 and are subject to
1022 .Va metoo
1023 filtering.
1026 .Dl alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox
1029 .Va on-compose-enter , on-compose-leave
1031 .Va on-compose-cleanup
1032 hook variables may be set to
1033 .Ic define Ns
1034 d macros to automatically adjust some settings dependent
1035 on receiver, sender or subject contexts, and via the
1036 .Va on-compose-splice
1037 as well as
1038 .Va on-compose-splice-shell
1039 variables, the former also to be set to a
1040 .Ic define Ns
1041 d macro, increasingly powerful mechanisms to perform automated message
1042 adjustments, including signature creation, are available.
1043 (\*(ID These hooks work for commands which newly create messages, namely
1044 .Ic forward , mail , reply
1045 and variants;
1046 .Ic resend
1048 .Ic Resend
1049 for now provide only the hooks
1050 .Va on-resend-enter
1052 .Va on-resend-cleanup . )
1055 For the purpose of arranging a complete environment of settings that can
1056 be switched to with a single command or command line option there are
1057 .Ic account Ns s .
1058 Alternatively it is also possible to use a flat configuration, making use
1059 of so-called variable chains which automatically pick
1060 .Ql USER@HOST
1062 .Ql HOST
1063 context-dependend variable variants: for example addressing
1064 .Ql Ic File Ns \& pop3://yaa@exam.ple
1065 would find
1066 .Va \&\&pop3-no-apop-yaa@exam.ple ,
1067 .Va \&\&pop3-no-apop-exam.ple
1069 .Va pop3-no-apop
1070 in order.
1072 .Sx "On URL syntax and credential lookup"
1074 .Sx "INTERNAL VARIABLES" .
1077 To avoid environmental noise scripts should
1078 .Dq detach
1079 \*(UA from any configuration files and create a script-local
1080 environment, ideally with the command line options
1081 .Fl \&:
1082 to disable any configuration file in conjunction with repetitions of
1083 .Fl S
1084 to specify variables:
1086 .Bd -literal -offset indent
1087 $ env LC_ALL=C \*(uA -:/ \e
1088     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1089     -Sexpandaddr=fail,-all,failinvaddr \e
1090     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1091     -S from=scriptreply@exam.ple \e
1092     -s 'Subject to go' -a attachment_file \e
1093     -Sfullnames -. \e
1094     'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1095     < content_file
1099 As shown, scripts can
1100 .Dq fake
1101 a locale environment, the above specifies the all-compatible 7-bit clean
1102 .Ev LC_ALL
1103 .Dq C ,
1104 but will nonetheless take and send UTF-8 in the message text by using
1105 .Va ttycharset .
1106 In interactive mode, which is introduced in the next section, messages
1107 can be sent by calling the
1108 .Ic mail
1109 command with a list of recipient addresses:
1111 .Bd -literal -offset indent
1112 $ \*(uA -d -Squiet -Semptystart
1113 "/var/spool/mail/user": 0 messages
1114 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1116 ? # Will do the right thing (tm)
1117 ? m rec1@exam.ple rec2@exam.ple
1119 .\" }}}
1121 .\" .Ss "On reading mail, and interactive mode" {{{
1122 .Ss "On reading mail, and interactive mode"
1124 When invoked without addressees \*(UA enters interactive mode in which
1125 mails may be read.
1126 When used like that the user's system
1127 .Va inbox
1128 (for more on mailbox types please see the command
1129 .Ic file )
1130 is read in and a one line header of each message therein is displayed if
1131 the variable
1132 .Va header
1133 is set.
1134 The visual style of this summary of
1135 .Ic headers
1136 can be adjusted through the variable
1137 .Va headline
1138 and the possible sorting criterion via
1139 .Va autosort .
1140 Scrolling through
1141 .Va screen Ns
1142 fuls of
1143 .Ic headers
1144 can be performed with the command
1145 .Ic z .
1146 If the initially opened mailbox is empty \*(UA will instead exit
1147 immediately (after displaying a message) unless the variable
1148 .Va emptystart
1149 is set.
1152 At the
1153 .Va prompt
1154 the command
1155 .Ic list
1156 will give a listing of all available commands and
1157 .Ic help
1158 will give a summary of some common ones.
1159 If the \*(OPal documentation strings are available one can type
1160 .Ql help X
1161 .Pf "(or " Ql ?X )
1162 and see the actual expansion of
1163 .Ql X
1164 and what its purpose is, i.e., commands can be abbreviated
1165 (note that POSIX defines some abbreviations, so that the alphabetical
1166 order of commands does not necessarily relate to the abbreviations; it is
1167 however possible to define overwrites with
1168 .Ic commandalias ) .
1169 These commands can also produce a more
1170 .Va verbose
1171 output.
1174 Messages are given numbers (starting at 1) which uniquely identify
1175 messages; the current message \(en the
1176 .Dq dot
1177 \(en will either be the first new message, or the first unread message,
1178 or the first message of the mailbox; the internal variable
1179 .Va showlast
1180 will instead cause usage of the last message for this purpose.
1181 The command
1182 .Ic headers
1183 will display a
1184 .Va screen Ns
1185 ful of header summaries containing the
1186 .Dq dot ,
1187 whereas
1188 .Ic from
1189 will display only the summaries of the given messages, defaulting to the
1190 .Dq dot .
1193 Message content can be displayed with the command
1194 .Ic type
1195 .Pf ( Ql t ,
1196 alias
1197 .Ic print ) .
1198 Here the variable
1199 .Va crt
1200 controls whether and when \*(UA will use the configured
1201 .Ev PAGER
1202 for display instead of directly writing to the user terminal
1203 .Va screen ,
1204 the sole difference to the command
1205 .Ic more ,
1206 which will always use the
1207 .Ev PAGER .
1208 The command
1209 .Ic top
1210 will instead only show the first
1211 .Va toplines
1212 of a message (maybe even compressed if
1213 .Va topsqueeze
1214 is set).
1215 Message display experience may improve by setting and adjusting
1216 .Va mime-counter-evidence ,
1217 and also see
1218 .Sx "HTML mail and MIME attachments" .
1221 By default the current message
1222 .Pf ( Dq dot )
1223 is displayed, but like with many other commands it is possible to give
1224 a fancy message specification (see
1225 .Sx "Specifying messages" ) ,
1226 e.g.,
1227 .Ql t:u
1228 will display all unread messages,
1229 .Ql t.
1230 will display the
1231 .Dq dot ,
1232 .Ql t 1 5
1233 will type the messages 1 and 5,
1234 .Ql t 1-5
1235 will type the messages 1 through 5, and
1236 .Ql t-
1238 .Ql t+
1239 will display the last and the next message, respectively.
1240 The command
1241 .Ic search
1242 (a more substantial alias for
1243 .Ic from )
1244 will display a header summary of the given message specification list
1245 instead of their content, e.g., the following will search for subjects:
1248 .Dl ? from "'@Some subject to search for'"
1251 In the default setup all header fields of a message will be
1252 .Ic type Ns
1253 d, but fields can be white- or blacklisted for a variety of
1254 applications by using the command
1255 .Ic headerpick ,
1256 e.g., to restrict their display to a very restricted set for
1257 .Ic type :
1258 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1259 In order to display all header fields of a message regardless of
1260 currently active ignore or retain lists, use the commands
1261 .Ic Type
1263 .Ic Top ;
1264 .Ic Show
1265 will show the raw message content.
1266 Note that historically the global
1267 .Pa \*(UR
1268 not only adjusts the list of displayed headers, but also sets
1269 .Va crt .
1272 Dependent upon the configuration a line editor (see the section
1273 .Sx "On terminal control and line editor" )
1274 aims at making the user experience with the many
1275 .Sx COMMANDS
1276 a bit nicer.
1277 When reading the system
1278 .Va inbox
1279 or when
1280 .Fl f
1282 .Ic file )
1283 specified a mailbox explicitly prefixed with the special
1284 .Ql %:
1285 modifier (propagating the mailbox to a
1286 .Mx -sx
1287 .Sx "primary system mailbox" ) ,
1288 then messages which have been read will be automatically moved to a
1289 .Mx -sx
1290 .Sx "secondary mailbox" ,
1291 the users
1292 .Ev MBOX
1293 file, when the mailbox is left, either by changing the
1294 active mailbox or by quitting \*(UA (also see
1295 .Sx "Message states" )
1296 \(en this automatic moving from a system or primary to the secondary
1297 mailbox is not performed when the variable
1298 .Va hold
1299 is set.
1300 Messages can also be explicitly
1301 .Ic move Ns
1302 d to other mailboxes, whereas
1303 .Ic copy
1304 keeps the original message.
1305 .Ic write
1306 can be used to write out data content of specific parts of messages.
1309 After examining a message the user can
1310 .Ic reply Ql r
1311 to the sender and all recipients (which will also be placed in
1312 .Ql To:
1313 unless
1314 .Va recipients-in-cc
1315 is set) or
1316 .Ic Reply Ql R
1317 exclusively to the sender(s).
1318 .Ic forward Ns
1319 ing a message will allow editing the new message: the original message
1320 will be contained in the message body, adjusted according to
1321 .Ic headerpick .
1322 It is possible to
1323 .Ic resend
1325 .Ic Resend
1326 messages: the former will add a series of
1327 .Ql Resent-
1328 headers, whereas the latter will not; different to newly created
1329 messages editing is not possible and no copy will be saved even with
1330 .Va record
1331 unless the additional variable
1332 .Va record-resent
1333 is set.
1334 When sending, replying or forwarding messages comments and full names
1335 will be stripped from recipient addresses unless the internal variable
1336 .Va fullnames
1337 is set.
1338 Of course messages can be
1339 .Ic delete Ql d ,
1340 and they can spring into existence again via
1341 .Ic undelete
1342 or when the \*(UA session is ended via the
1343 .Ic exit Ql x
1344 command.
1347 To end a mail processing session one may either issue
1348 .Ic quit Ql q
1349 to cause a full program exit, which possibly includes
1350 automatic moving of read messages to the
1351 .Mx -sx
1352 .Sx "secondary mailbox"
1353 .Ev MBOX
1354 as well as updating the \*(OPal line editor
1355 .Va history-file ,
1356 or use the command
1357 .Ic exit Ql x
1358 instead in order to prevent any of these actions.
1359 .\" }}}
1361 .\" .Ss "HTML mail and MIME attachments" {{{
1362 .Ss "HTML mail and MIME attachments"
1364 Messages which are HTML-only become more and more common and of course
1365 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1366 Mail Extensions) parts for, e.g., attachments.
1367 To get a notion of MIME types, \*(UA will first read
1368 .Sx "The mime.types files"
1369 (as configured and allowed by
1370 .Va mimetypes-load-control ) ,
1371 and then add onto that types registered directly with
1372 .Ic mimetype .
1373 It (normally) has a default set of types built-in, too.
1374 To improve interaction with faulty MIME part declarations which are
1375 often seen in real-life messages, setting
1376 .Va mime-counter-evidence
1377 will allow \*(UA to verify the given assertion and possibly provide
1378 an alternative MIME type.
1381 Whereas \*(UA \*(OPally supports a simple HTML-to-text converter for
1382 HTML messages, it cannot handle MIME types other than plain text itself.
1383 Instead programs need to become registered to deal with specific MIME
1384 types or file extensions.
1385 These programs may either prepare plain text versions of their input in
1386 order to enable \*(UA to integrate their output neatlessly in its own
1387 message visualization (a mode which is called
1388 .Cd copiousoutput ) ,
1389 or display the content themselves, for example in an external graphical
1390 window: such handlers will only be considered by and for the command
1391 .Ic mimeview .
1394 To install a handler program for a specific MIME type an according
1395 .Va pipe-TYPE/SUBTYPE
1396 variable needs to be set; to instead define a handler for a specific
1397 file extension the respective
1398 .Va pipe-EXTENSION
1399 variable can be used \(en these handlers take precedence.
1400 \*(OPally \*(UA supports mail user agent configuration as defined in
1401 RFC 1524; this mechanism (see
1402 .Sx "The Mailcap files" )
1403 will be queried for display or quote handlers if none of the former two
1404 .\" TODO v15-compat "will be" -> "is"
1405 did; it will be the sole source for handlers of other purpose.
1406 A last source for handlers is the MIME type definition itself, when
1407 a (\*(UA specific) type-marker was registered with the command
1408 .Ic mimetype
1409 (which many built-in MIME types do).
1412 E.g., to display a HTML message inline (that is, converted to a more
1413 fancy plain text representation than the built-in converter is capable to
1414 produce) with either of the text-mode browsers
1415 .Xr lynx 1
1417 .Xr elinks 1 ,
1418 teach \*(UA about MathML documents and make it display them as plain
1419 text, and to open PDF attachments in an external PDF viewer,
1420 asynchronously and with some other magic attached:
1422 .Bd -literal -offset indent
1423 ? if [ "$features" !% +filter-html-tagsoup ]
1424 ?  #set pipe-text/html='@* elinks -force-html -dump 1'
1425 ?  set pipe-text/html='@* lynx -stdin -dump -force_html'
1426 ?  # Display HTML as plain text instead
1427 ?  #set pipe-text/html=@
1428 ? endif
1429 ? mimetype @ application/mathml+xml mathml
1430 ? wysh set pipe-application/pdf='@&=@ \e
1431     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1432     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1433     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1435 .\" }}}
1437 .\" .Ss "Mailing lists" {{{
1438 .Ss "Mailing lists"
1440 \*(UA offers some support to ease handling of mailing lists.
1441 The command
1442 .Ic mlist
1443 promotes all given arguments to known mailing lists, and
1444 .Ic mlsubscribe
1445 sets their subscription attribute, creating them first as necessary.
1446 (On the other hand
1447 .Ic unmlsubscribe
1448 does not
1449 .Ic unmlist
1450 automatically, but only resets the subscription attribute.)
1451 Using the commands without arguments will show (a subset of) all
1452 currently defined mailing lists.
1454 .Va headline
1455 format
1456 .Ql \&%T
1457 can be used to mark out messages with configured list addresses
1458 in the header display.
1461 \*(OPally mailing lists may also be specified as (extended) regular
1462 expressions, which allows matching of many addresses with a single
1463 expression.
1464 However, all fully qualified list addresses are matched via a fast
1465 dictionary, whereas expressions are placed in (a) list(s) which is
1466 (are) matched sequentially.
1468 .Bd -literal -offset indent
1469 ? set followup-to followup-to-honour=ask-yes \e
1470     reply-to-honour=ask-yes
1471 ? wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1472 ? mlsubscribe a4@b4.c4 exact@lists.c3
1476 The variable
1477 .Va followup-to-honour
1478 will ensure that a
1479 .Ql Mail-\:Followup-\:To:
1480 header is honoured when the message is being replied to (via
1481 .Ic reply
1483 .Ic Lreply )
1485 .Va followup-to
1486 controls whether this header is created when sending mails; it will be
1487 created automatically for a couple of reasons, too, like when the
1488 special
1489 .Dq mailing list specific
1490 respond command
1491 .Ic Lreply
1492 is used, when
1493 .Ic reply
1494 is used to respond to a message with its
1495 .Ql Mail-Followup-To:
1496 being honoured etc.
1499 A difference in between the handling of known and subscribed lists is
1500 that the address of the sender is usually not part of a generated
1501 .Ql Mail-Followup-To:
1502 when addressing the latter, whereas it is for the former kind of lists.
1503 Usually because there are exceptions: say, if multiple lists are
1504 addressed and not all of them are subscribed lists.
1506 For convenience \*(UA will, temporarily, automatically add a list
1507 address that is presented in the
1508 .Ql List-Post:
1509 header of a message that is being responded to to the list of known
1510 mailing lists.
1511 Shall that header have existed \*(UA will instead, dependent on the
1512 variable
1513 .Va reply-to-honour ,
1514 use an also set
1515 .Ql Reply-To:
1516 for this purpose in order to accept a list administrators' wish that
1517 is supposed to have been manifested like that (but only if it provides
1518 a single address which resides on the same domain as what is stated in
1519 .Ql List-Post: ) .
1520 .\" }}}
1522 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1523 .Ss "Signed and encrypted messages with S/MIME"
1525 \*(OP S/MIME provides two central mechanisms:
1526 message signing and message encryption.
1527 A signed message contains some data in addition to the regular text.
1528 The data can be used to verify that the message was sent using a valid
1529 certificate, that the sender's address in the message header matches
1530 that in the certificate, and that the message text has not been altered.
1531 Signing a message does not change its regular text;
1532 it can be read regardless of whether the recipient's software is able to
1533 handle S/MIME.
1534 It is thus usually possible to sign all outgoing messages if so desired.
1537 Encryption, in contrast, makes the message text invisible for all people
1538 except those who have access to the secret decryption key.
1539 To encrypt a message, the specific recipient's public encryption key
1540 must be known.
1541 It is therefore not possible to send encrypted mail to people unless their
1542 key has been retrieved from either previous communication or public key
1543 directories.
1544 A message should always be signed before it is encrypted.
1545 Otherwise, it is still possible that the encrypted message text is
1546 altered.
1549 A central concept to S/MIME is that of the certification authority (CA).
1550 A CA is a trusted institution that issues certificates.
1551 For each of these certificates it can be verified that it really
1552 originates from the CA, provided that the CA's own certificate is
1553 previously known.
1554 A set of CA certificates is usually delivered with OpenSSL and installed
1555 on your system.
1556 If you trust the source of your OpenSSL software installation,
1557 this offers reasonable security for S/MIME on the Internet.
1558 Otherwise set
1559 .Va smime-ca-no-defaults
1560 to avoid using the default certificates and point
1561 .Va smime-ca-file
1562 and/or
1563 .Va smime-ca-dir
1564 to a trusted pool of certificates.
1565 In general, a certificate cannot be more secure than the method its CA
1566 certificate has been retrieved with.
1569 This trusted pool of certificates is used by the command
1570 .Ic verify
1571 to ensure that the given S/MIME messages can be trusted.
1572 If so, verified sender certificates that were embedded in signed
1573 messages can be saved locally with the command
1574 .Ic certsave ,
1575 and used by \*(UA to encrypt further communication with these senders:
1577 .Bd -literal -offset indent
1578 ? certsave FILENAME
1579 ? set smime-encrypt-USER@HOST=FILENAME \e
1580     smime-cipher-USER@HOST=AES256
1584 To sign outgoing messages in order to allow receivers to verify the
1585 origin of these messages a personal S/MIME certificate is required.
1586 \*(UA supports password-protected personal certificates (and keys),
1587 for more on this, and its automatization, please see the section
1588 .Sx "On URL syntax and credential lookup" .
1589 The section
1590 .Sx "S/MIME step by step"
1591 shows examplarily how such a private certificate can be obtained.
1592 In general, if such a private key plus certificate
1593 .Dq pair
1594 is available, all that needs to be done is to set some variables:
1596 .Bd -literal -offset indent
1597 ? set smime-sign-cert=ME@HERE.com.paired \e
1598     smime-sign-message-digest=SHA256 \e
1599     smime-sign
1603 Variables of interest for S/MIME in general are
1604 .Va smime-ca-dir ,
1605 .Va smime-ca-file ,
1606 .Va smime-ca-flags ,
1607 .Va smime-ca-no-defaults ,
1608 .Va smime-crl-dir ,
1609 .Va smime-crl-file .
1610 For S/MIME signing of interest are
1611 .Va smime-sign ,
1612 .Va smime-sign-cert ,
1613 .Va smime-sign-include-certs
1615 .Va smime-sign-message-digest .
1616 Additional variables of interest for S/MIME en- and decryption:
1617 .Va smime-cipher
1619 .Va smime-encrypt-USER@HOST .
1622 \*(ID Note that neither S/MIME signing nor encryption applies to
1623 message subjects or other header fields yet.
1624 Thus they may not contain sensitive information for encrypted messages,
1625 and cannot be trusted even if the message content has been verified.
1626 When sending signed messages,
1627 it is recommended to repeat any important header information in the
1628 message text.
1629 .\" }}}
1631 .\" .Ss "On URL syntax and credential lookup" {{{
1632 .Ss "On URL syntax and credential lookup"
1634 \*(IN For accessing protocol-specific resources usage of Uniform
1635 Resource Locators (URL, RFC 1738) has become omnipresent.
1636 \*(UA expects and understands URLs in the following form;
1637 parts in brackets
1638 .Ql []
1639 denote optional parts, optional either because there also exist other
1640 ways to define the information in question or because support of the
1641 part is protocol-specific (e.g.,
1642 .Ql /path
1643 is used by the local maildir and the IMAP protocol, but not by POP3);
1644 If any of
1645 .Ql USER
1647 .Ql PASSWORD
1648 are specified they must be given in URL percent encoded form (RFC 3986;
1649 the command
1650 .Ic urlcodec
1651 may be helpful):
1654 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1657 Note that these \*(UA URLs most often do not conform to any real
1658 standard, but instead represent a normalized variant of RFC 1738 \(en
1659 they are not used in data exchange but only meant as a compact,
1660 easy-to-use way of defining and representing information in
1661 a well-known notation.
1664 Many internal variables of \*(UA exist in multiple versions, called
1665 variable chains for the rest of this document: the plain
1666 .Ql variable
1667 as well as
1668 .Ql variable-HOST
1670 .Ql variable-USER@HOST .
1671 Here
1672 .Ql HOST
1673 indeed means
1674 .Ql server:port
1675 if a
1676 .Ql port
1677 had been specified in the respective URL, otherwise it refers to the plain
1678 .Ql server .
1679 Also,
1680 .Ql USER
1681 is not truly the
1682 .Ql USER
1683 that had been found when doing the user chain lookup as is described
1684 below, i.e., this
1685 .Ql USER
1686 will never be in URL percent encoded form, whether it came from an URL
1687 or not; i.e., variable chain name extensions of
1688 .Sx "INTERNAL VARIABLES"
1689 must not be URL percent encoded.
1692 For example, whether an hypothetical URL
1693 .Ql smtp://hey%3Ayou@our.house
1694 had been given that includes a user, or whether the URL was
1695 .Ql smtp://our.house
1696 and the user had been found differently, to lookup the variable chain
1697 .Va smtp-use-starttls
1698 \*(UA first looks for whether
1699 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
1700 is defined, then whether
1701 .Ql smtp-\:use-\:starttls-\:our.house
1702 exists before finally ending up looking at the plain variable itself.
1705 \*(UA obeys the following logic scheme when dealing with the
1706 necessary credential information of an account:
1708 .Bl -bullet
1710 If no
1711 .Ql USER
1712 has been given in the URL the variables
1713 .Va user-HOST
1715 .Va user
1716 are looked up; if no such variable(s) can be found then \*(UA will,
1717 when enforced by the \*(OPal variables
1718 .Va netrc-lookup-HOST
1720 .Va netrc-lookup ,
1721 search the users
1722 .Pa .netrc
1723 file for a
1724 .Ql HOST
1725 specific entry which provides a
1726 .Ql login
1727 name: this lookup will only succeed if unambiguous (one possible matching
1728 entry for
1729 .Ql HOST ) .
1730 It is possible to load encrypted
1731 .Pa .netrc
1732 files via
1733 .Va netrc-pipe .
1735 If there is still no
1736 .Ql USER
1737 then \*(UA will fall back to the user who is supposed to run \*(UA,
1738 the identity of which has been fixated during \*(UA startup and is
1739 known to be a valid user on the current host.
1742 Authentication: unless otherwise noted this will lookup the
1743 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1744 variable chain, falling back to a protocol-specific default should this
1745 have no success.
1748 If no
1749 .Ql PASSWORD
1750 has been given in the URL, then if the
1751 .Ql USER
1752 has been found through the \*(OPal
1753 .Va netrc-lookup
1754 that may have already provided the password, too.
1755 Otherwise the variable chain
1756 .Va password-USER@HOST , password-HOST , password
1757 is looked up and used if existent.
1759 Afterwards the complete \*(OPal variable chain
1760 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1761 is looked up.
1762 If set, the
1763 .Ic netrc
1764 cache is searched for a password only (multiple user accounts for
1765 a single machine may exist as well as a fallback entry without user
1766 but with a password).
1768 If at that point there is still no password available, but the
1769 (protocols') chosen authentication type requires a password, then in
1770 interactive mode the user will be prompted on the terminal.
1774 .Sy Note:
1775 S/MIME verification works relative to the values found in the
1776 .Ql From:
1778 .Ql Sender: )
1779 header field(s), which means that the values of
1780 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1782 .Va smime-sign-message-digest
1783 will not be looked up using the
1784 .Ql USER
1786 .Ql HOST
1787 chains from above but instead use the corresponding values from the
1788 message that is being worked on.
1789 In unusual cases multiple and different
1790 .Ql USER
1792 .Ql HOST
1793 combinations may therefore be involved \(en on the other hand those
1794 unusual cases become possible.
1795 The usual case is as short as:
1797 .Bd -literal -offset indent
1798 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1799     smime-sign smime-sign-cert=+smime.pair
1803 The section
1804 .Sx EXAMPLES
1805 contains complete example configurations.
1806 .\" }}}
1808 .\" .Ss "Encrypted network communication" {{{
1809 .Ss "Encrypted network communication"
1811 SSL (Secure Sockets Layer) a.k.a. its successor TLS (Transport Layer
1812 Security) are protocols which aid in securing communication by providing
1813 a safely initiated and encrypted network connection.
1814 A central concept of SSL/TLS is that of certificates: as part of each
1815 network connection setup a (set of) certificates will be exchanged, and
1816 by using those the identity of the network peer can be cryptographically
1817 verified.
1818 SSL/TLS works by using a locally installed pool of trusted certificates,
1819 and verifying the connection peer succeeds if that provides
1820 a certificate which has been issued or is trusted by any certificate in
1821 the trusted local pool.
1824 The local pool of trusted so-called CA (Certification Authority)
1825 certificates is usually delivered with the used SSL/TLS library, and
1826 will be selected automatically, but it is also possible to create and
1827 use an own pool of trusted certificates.
1828 If this is desired, set
1829 .Va ssl-ca-no-defaults
1830 to avoid using the default certificate pool, and point
1831 .Va ssl-ca-file
1832 and/or
1833 .Va ssl-ca-dir
1834 to a trusted pool of certificates.
1835 A certificate cannot be more secure than the method its CA certificate
1836 has been retrieved with.
1839 It depends on the used protocol whether encrypted communication is
1840 possible, and which configuration steps have to be taken to enable it.
1841 Some protocols, e.g., POP3S, are implicitly encrypted, others, like
1842 POP3, can upgrade a plain text connection if so requested: POP3 offers
1843 .Ql STLS ,
1844 which will be used if the variable (chain)
1845 .Va pop3-use-starttls
1846 is set:
1848 .Bd -literal -offset indent
1849 shortcut encpop1 pop3s://pop1.exam.ple
1851 shortcut encpop2 pop3://pop2.exam.ple
1852 set pop3-use-starttls-pop2.exam.ple
1854 set mta=smtps://smtp.exam.ple:465
1855 set mta=smtp://smtp.exam.ple smtp-use-starttls
1859 Normally that is all there is to do, given that SSL/TLS libraries try to
1860 provide safe defaults, plenty of knobs however exist to adjust settings.
1861 For example certificate verification settings can be fine-tuned via
1862 .Va ssl-ca-flags ,
1863 and the SSL/TLS configuration basics are accessible via
1864 .Va ssl-config-pairs ,
1865 e.g., to specify the allowed protocols or cipher lists that
1866 a communication channel may use.
1867 In the past hints of how to restrict the set of protocols to highly
1868 secure ones were indicated, as of the time of this writing the allowed
1869 protocols or cipher list may need to become relaxed in order to be able
1870 to connect to some servers; the following example allows connecting to a
1871 .Dq Lion
1872 that uses OpenSSL 0.9.8za from June 2014 (refer to
1873 .Sx "INTERNAL VARIABLES"
1874 for more on variable chains):
1876 .Bd -literal -offset indent
1877 wysh set ssl-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e
1878     CipherList=TLSv1.2:!aNULL:!eNULL:\e
1879       ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
1880       DHE-RSA-AES256-SHA:@STRENGTH'
1884 The OpenSSL program
1885 .Xr ciphers 1
1886 can be used and should be referred to when creating a custom cipher list.
1887 Variables of interest for SSL/TLS in general are
1888 .Va ssl-ca-dir ,
1889 .Va ssl-ca-file ,
1890 .Va ssl-ca-flags ,
1891 .Va ssl-ca-no-defaults ,
1892 .Va ssl-config-file ,
1893 .Va ssl-config-module ,
1894 .Va ssl-config-pairs
1895 .Va ssl-crl-dir ,
1896 .Va ssl-crl-file ,
1897 .Va ssl-rand-file
1898 as well as
1899 .Va ssl-verify .
1900 .\" }}}
1902 .\" .Ss "Character sets" {{{
1903 .Ss "Character sets"
1905 \*(OP \*(UA detects the character set of the terminal by using
1906 mechanisms that are controlled by the
1907 .Ev LC_CTYPE
1908 environment variable
1909 (in fact
1910 .Ev LC_ALL ,
1911 .Ev \&\&LC_CTYPE ,
1912 .Ev LANG ,
1913 in that order, see there).
1914 The internal variable
1915 .Va ttycharset
1916 will be set to the detected terminal character set accordingly,
1917 and will thus show up in the output of commands like, e.g.,
1918 .Ic set
1920 .Ic varshow .
1923 However, the user may give a value for
1924 .Va ttycharset
1925 during startup, so that it is possible to send mail in a completely
1926 .Dq faked
1927 locale environment, an option which can be used to generate and send,
1928 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
1929 .Ql LC_ALL=C
1930 environment (an example of this can be found in the section
1931 .Sx "On sending mail, and non-interactive mode" ) .
1932 Changing the value does not mean much beside that, because several
1933 aspects of the real character set are implied by the locale environment
1934 of the system, which stays unaffected by
1935 .Va ttycharset .
1938 Messages and attachments which consist of 7-bit clean data will be
1939 classified as consisting of
1940 .Va charset-7bit
1941 character data.
1942 This is a problem if the
1943 .Va ttycharset
1944 character set is a multibyte character set that is also 7-bit clean.
1945 For example, the Japanese character set ISO-2022-JP is 7-bit clean but
1946 capable to encode the rich set of Japanese Kanji, Hiragana and Katakana
1947 characters: in order to notify receivers of this character set the mail
1948 message must be MIME encoded so that the character set ISO-2022-JP can
1949 be advertised!
1950 To achieve this, the variable
1951 .Va charset-7bit
1952 must be set to ISO-2022-JP.
1953 (Today a better approach regarding email is the usage of UTF-8, which
1954 uses 8-bit bytes for non-US-ASCII data.)
1957 If the \*(OPal character set conversion capabilities are not available
1958 .Pf ( Va features
1959 does not include the term
1960 .Ql +iconv ) ,
1961 then
1962 .Va ttycharset
1963 will be the only supported character set,
1964 it is simply assumed that it can be used to exchange 8-bit messages
1965 (over the wire an intermediate, configurable
1966 .Va mime-encoding
1967 may be applied),
1968 and the rest of this section does not apply;
1969 it may however still be necessary to explicitly set it if automatic
1970 detection fails, since in that case it defaults to
1971 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
1972 LATIN1 a.k.a. ISO-8859-1.
1975 \*(OP When reading messages, their text is converted into
1976 .Va ttycharset
1977 as necessary in order to display them on the users terminal.
1978 Unprintable characters and invalid byte sequences are detected
1979 and replaced by proper substitution characters.
1980 Character set mappings for source character sets can be established with
1981 the command
1982 .Ic charsetalias ,
1983 which may be handy to work around faulty character set catalogues (e.g.,
1984 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
1985 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
1986 Also see
1987 .Va charset-unknown-8bit
1988 to deal with another hairy aspect of message interpretation.
1991 When sending messages all their parts and attachments are classified.
1992 Whereas no character set conversion is performed on those parts which
1993 appear to be binary data,
1994 the character set being used must be declared within the MIME header of
1995 an outgoing text part if it contains characters that do not conform to
1996 the set of characters that are allowed by the email standards.
1997 Permissible values for character sets used in outgoing messages can be
1998 declared using the
1999 .Va sendcharsets
2000 variable, and
2001 .Va charset-8bit ,
2002 which defines a catch-all last-resort fallback character set that is
2003 implicitly appended to the list of character sets in
2004 .Va sendcharsets .
2007 When replying to a message and the variable
2008 .Va reply-in-same-charset
2009 is set, then the character set of the message being replied to
2010 is tried first (still being a subject of
2011 .Ic charsetalias ) .
2012 And it is also possible to make \*(UA work even more closely related to
2013 the current locale setting automatically by using the variable
2014 .Va sendcharsets-else-ttycharset ,
2015 please see there for more information.
2018 All the specified character sets are tried in order unless the
2019 conversion of the part or attachment succeeds.
2020 If none of the tried (8-bit) character sets is capable to represent the
2021 content of the part or attachment,
2022 then the message will not be sent and its text will optionally be
2023 .Va save Ns d
2025 .Ev DEAD .
2026 In general, if a message saying
2027 .Dq cannot convert from a to b
2028 appears, either some characters are not appropriate for the currently
2029 selected (terminal) character set,
2030 or the needed conversion is not supported by the system.
2031 In the first case, it is necessary to set an appropriate
2032 .Ev LC_CTYPE
2033 locale and/or the variable
2034 .Va ttycharset .
2037 The best results are usually achieved when \*(UA is run in a UTF-8
2038 locale on an UTF-8 capable terminal, in which case the full Unicode
2039 spectrum of characters is available.
2040 In this setup characters from various countries can be displayed,
2041 while it is still possible to use more simple character sets for sending
2042 to retain maximum compatibility with older mail clients.
2045 On the other hand the POSIX standard defines a locale-independent 7-bit
2046 .Dq portable character set
2047 that should be used when overall portability is an issue, the even more
2048 restricted subset named
2049 .Dq portable filename character set
2050 consists of A-Z, a-z, 0-9, period
2051 .Ql \&. ,
2052 underscore
2053 .Ql _
2054 and hyphen-minus
2055 .Ql - .
2056 .\" }}}
2058 .\" .Ss "Message states" {{{
2059 .Ss "Message states"
2061 \*(UA differentiates in between several different message states;
2062 the current state will be reflected in header summary displays if
2063 .Va headline
2064 is configured to do so (via the internal variable
2065 .Va attrlist ) ,
2066 and messages can also be selected and be acted upon depending on their
2067 state (see
2068 .Sx "Specifying messages" ) .
2069 When operating on the system
2070 .Va inbox ,
2071 or in any other
2072 .Mx -sx
2073 .Sx "primary system mailbox" ,
2074 special actions, like the automatic moving of messages to the
2075 .Mx -sx
2076 .Sx "secondary mailbox"
2077 .Ev MBOX ,
2078 may be applied when the mailbox is left (also implicitly via
2079 a successful exit of \*(UA, but not if the special command
2080 .Ic exit
2081 is used) \(en however, because this may be irritating to users which
2082 are used to
2083 .Dq more modern
2084 mail-user-agents, the default global
2085 .Pa \*(UR
2086 sets the internal
2087 .Va hold
2089 .Va keepsave
2090 variables in order to suppress this behaviour.
2092 .Bl -hang -width ".It Ql new"
2093 .It Ql new
2094 Message has neither been viewed nor moved to any other state.
2095 Such messages are retained even in the
2096 .Mx -sx
2097 .Sx "primary system mailbox" .
2099 .It Ql unread
2100 Message has neither been viewed nor moved to any other state, but the
2101 message was present already when the mailbox has been opened last:
2102 Such messages are retained even in the
2103 .Mx -sx
2104 .Sx "primary system mailbox" .
2106 .It Ql read
2107 The message has been processed by one of the following commands:
2108 .Ic ~f ,
2109 .Ic ~m ,
2110 .Ic ~F ,
2111 .Ic ~M ,
2112 .Ic copy ,
2113 .Ic mbox ,
2114 .Ic next ,
2115 .Ic pipe  ,
2116 .Ic Print ,
2117 .Ic print ,
2118 .Ic top ,
2119 .Ic Type ,
2120 .Ic type ,
2121 .Ic undelete .
2122 The commands
2123 .Ic dp
2125 .Ic dt
2126 will always try to automatically
2127 .Dq step
2129 .Ic type
2131 .Dq next
2132 logical message, and may thus mark multiple messages as read, the
2133 .Ic delete
2134 command will do so if  the internal variable
2135 .Va autoprint
2136 is set.
2137 Except when the
2138 .Ic exit
2139 command is used, messages that are in a
2140 .Mx -sx
2141 .Sx "primary system mailbox"
2142 and are in
2143 .Ql read
2144 state when the mailbox is left will be saved in the
2145 .Mx -sx
2146 .Sx "secondary mailbox"
2147 .Ev MBOX
2148 unless the internal variable
2149 .Va hold
2150 it set.
2152 .It Ql deleted
2153 The message has been processed by one of the following commands:
2154 .Ic delete ,
2155 .Ic dp ,
2156 .Ic dt .
2157 Only
2158 .Ic undelete
2159 can be used to access such messages.
2161 .It Ql preserved
2162 The message has been processed by a
2163 .Ic preserve
2164 command and it will be retained in its current location.
2166 .It Ql saved
2167 The message has been processed by one of the following commands:
2168 .Ic save
2170 .Ic write .
2171 Unless when the
2172 .Ic exit
2173 command is used, messages that are in a
2174 .Mx -sx
2175 .Sx "primary system mailbox"
2176 and are in
2177 .Ql saved
2178 state when the mailbox is left will be deleted; they will be saved in the
2179 .Mx -sx
2180 .Sx "secondary mailbox"
2181 .Ev MBOX
2182 when the internal variable
2183 .Va keepsave
2184 is set.
2188 In addition to these message states, flags which otherwise have no
2189 technical meaning in the mail system except allowing special ways of
2190 addressing them when
2191 .Sx "Specifying messages"
2192 can be set on messages.
2193 These flags are saved with messages and are thus persistent, and are
2194 portable between a set of widely used MUAs.
2196 .Bl -hang -width ".It Ic answered"
2197 .It Ic answered
2198 Mark messages as having been answered.
2199 .It Ic draft
2200 Mark messages as being a draft.
2201 .It Ic flag
2202 Mark messages which need special attention.
2204 .\" }}}
2206 .\" .Ss "Specifying messages" {{{
2207 .Ss "Specifying messages"
2209 Commands such as
2210 .Ic from ,
2211 .Ic type
2213 .Ic delete
2214 can be given a list of message numbers as arguments to apply to a number
2215 of messages at once.
2216 Thus
2217 .Ql delete 1 2
2218 deletes messages 1 and 2,
2219 whereas
2220 .Ql delete 1-5
2221 will delete the messages 1 through 5.
2222 In sorted or threaded mode (see the
2223 .Ic sort
2224 command),
2225 .Ql delete 1-5
2226 will delete the messages that are located between (and including)
2227 messages 1 through 5 in the sorted/threaded order, as shown in the
2228 .Ic headers
2229 summary.
2230 The following special message names exist:
2233 .Bl -tag -width ".It Ar BaNg"
2234 .It Ar \&.
2235 The current message, the so-called
2236 .Dq dot .
2238 .It Ar \&;
2239 The message that was previously the current message.
2241 .It Ar \&,
2242 The parent message of the current message,
2243 that is the message with the Message-ID given in the
2244 .Ql In-Reply-To:
2245 field or the last entry of the
2246 .Ql References:
2247 field of the current message.
2249 .It Ar -
2250 The next previous undeleted message,
2251 or the next previous deleted message for the
2252 .Ic undelete
2253 command.
2254 In sorted/threaded mode,
2255 the next previous such message in the sorted/threaded order.
2257 .It Ar +
2258 The next undeleted message,
2259 or the next deleted message for the
2260 .Ic undelete
2261 command.
2262 In sorted/threaded mode,
2263 the next such message in the sorted/threaded order.
2265 .It Ar ^
2266 The first undeleted message,
2267 or the first deleted message for the
2268 .Ic undelete
2269 command.
2270 In sorted/threaded mode,
2271 the first such message in the sorted/threaded order.
2273 .It Ar $
2274 The last message.
2275 In sorted/threaded mode,
2276 the last message in the sorted/threaded order.
2278 .It Ar & Ns Ar x
2279 In threaded mode,
2280 selects the message addressed with
2281 .Ar x ,
2282 where
2283 .Ar x
2284 is any other message specification,
2285 and all messages from the thread that begins at it.
2286 Otherwise it is identical to
2287 .Ar x .
2289 .Ar x
2290 is omitted,
2291 the thread beginning with the current message is selected.
2293 .It Ar *
2294 All messages.
2295 .It Ar `
2296 All messages that were included in the
2297 .Sx "Message list arguments"
2298 of the previous command.
2300 .It Ar x-y
2301 An inclusive range of message numbers.
2302 Selectors that may also be used as endpoints include any of
2303 .Ar .;-+^$ .
2305 .It Ar address
2306 A case-insensitive
2307 .Dq any substring matches
2308 search against the
2309 .Ql From:
2310 header, which will match addresses (too) even if
2311 .Va showname
2312 is set (and POSIX says
2313 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2314 However, if the
2315 .Va allnet
2316 variable is set, only the local part of the address is evaluated
2317 for the comparison, not ignoring case, and the setting of
2318 .Va showname
2319 is completely ignored.
2320 For finer control and match boundaries use the
2321 .Ql @
2322 search expression.
2324 .It Ar / Ns Ar string
2325 All messages that contain
2326 .Ar string
2327 in the subject field (case ignored).
2328 See also the
2329 .Va searchheaders
2330 variable.
2332 .Ar string
2333 is empty,
2334 the string from the previous specification of that type is used again.
2336 .It Xo Op Ar @ Ns Ar name-list Ns
2337 .Ar @ Ns Ar expr
2339 All messages that contain the given case-insensitive search
2340 .Ar expr Ns
2341 ession; if the \*(OPal regular expression (see
2342 .Xr re_format 7 )
2343 support is available
2344 .Ar expr
2345 will be interpreted as (an extended) one if any of the
2346 .Dq magical
2347 (extended) regular expression characters is seen: in this case this
2348 should match strings correctly which are in the locale
2349 .Ev LC_CTYPE
2350 encoding.
2351 If the optional
2352 .Ar @ Ns Ar name-list
2353 part is missing, the search is restricted to the subject field body,
2354 but otherwise
2355 .Ar name-list
2356 specifies a comma-separated list of header fields to search, as in
2358 .Dl '@to,from,cc@Someone i ought to know'
2360 In order to search for a string that includes a
2361 .Ql @
2362 (commercial at) character the
2363 .Ar name-list
2364 is effectively non-optional, but may be given as the empty string.
2365 Some special header fields may be abbreviated:
2366 .Ql f ,
2367 .Ql t ,
2368 .Ql c ,
2369 .Ql b
2371 .Ql s
2372 will match
2373 .Ql From ,
2374 .Ql To ,
2375 .Ql Cc ,
2376 .Ql Bcc
2378 .Ql Subject ,
2379 respectively and case-insensitively.
2380 The special names
2381 .Ql header
2383 .Ql <
2384 can be used to search in (all of) the header(s) of the message, and the
2385 special names
2386 .Ql body
2388 .Ql >
2390 .Ql text
2392 .Ql =
2393 can be used to perform full text searches \(en whereas the former
2394 searches only the body, the latter also searches the message header.
2396 This message specification performs full text comparison, but even with
2397 regular expression support it is almost impossible to write a search
2398 expression that savely matches only a specific address domain.
2399 To request that the content of the header is treated as a list of
2400 addresses, and to strip those down to the plain email address which the
2401 search expression is to be matched against, prefix the header name
2402 (abbreviation) with a tilde
2403 .Ql ~ :
2405 .Dl @~f@@a\e.safe\e.domain\e.match$
2407 .It Ar :c
2408 All messages of state or with matching condition
2409 .Ql c ,
2410 where
2411 .Ql c
2412 is one or multiple of the following colon modifiers:
2414 .Bl -tag -compact -width ".It Ar :M"
2415 .It Ar a
2416 .Ic answered
2417 messages (cf. the variable
2418 .Va markanswered ) .
2419 .It Ar d
2420 .Ql deleted
2421 messages (for the
2422 .Ic undelete
2424 .Ic from
2425 commands only).
2426 .It Ar f
2427 .Ic flag Ns
2428 ged messages.
2429 .It Ar L
2430 Messages with receivers that match
2431 .Ic mlsubscribe Ns
2432 d addresses.
2433 .It Ar l
2434 Messages with receivers that match
2435 .Ic mlist Ns
2436 ed addresses.
2437 .It Ar n
2438 .Ql new
2439 messages.
2440 .It Ar o
2441 Old messages (any not in state
2442 .Ql read
2444 .Ql new ) .
2445 .It Ar r
2446 .Ql read
2447 messages.
2448 .It Ar S
2449 \*(OP Messages with unsure spam classification (see
2450 .Sx "Handling spam" ) .
2451 .It Ar s
2452 \*(OP Messages classified as spam.
2453 .It Ar t
2454 Messages marked as
2455 .Ic draft .
2456 .It Ar u
2457 .Ql unread
2458 messages.
2464 \*(OP IMAP-style SEARCH expressions may also be used.
2465 This addressing mode is available with all types of mailbox
2466 .Ic folder Ns
2467 s; \*(UA will perform the search locally as necessary.
2468 Strings must be enclosed by double quotes
2469 .Ql \&"
2470 in their entirety if they contain whitespace or parentheses;
2471 within the quotes, only reverse solidus
2472 .Ql \e
2473 is recognized as an escape character.
2474 All string searches are case-insensitive.
2475 When the description indicates that the
2476 .Dq envelope
2477 representation of an address field is used,
2478 this means that the search string is checked against both a list
2479 constructed as
2481 .Bd -literal -offset indent
2482 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2486 for each address,
2487 and the addresses without real names from the respective header field.
2488 These search expressions can be nested using parentheses, see below for
2489 examples.
2492 .Bl -tag -compact -width ".It Ar _n_u"
2493 .It Ar ( criterion )
2494 All messages that satisfy the given
2495 .Ar criterion .
2496 .It Ar ( criterion1 criterion2 ... criterionN )
2497 All messages that satisfy all of the given criteria.
2499 .It Ar ( or criterion1 criterion2 )
2500 All messages that satisfy either
2501 .Ar criterion1
2503 .Ar criterion2 ,
2504 or both.
2505 To connect more than two criteria using
2506 .Ql or
2507 specifications have to be nested using additional parentheses,
2508 as with
2509 .Ql (or a (or b c)) ,
2510 since
2511 .Ql (or a b c)
2512 really means
2513 .Ql ((a or b) and c) .
2514 For a simple
2515 .Ql or
2516 operation of independent criteria on the lowest nesting level,
2517 it is possible to achieve similar effects by using three separate
2518 criteria, as with
2519 .Ql (a) (b) (c) .
2521 .It Ar ( not criterion )
2522 All messages that do not satisfy
2523 .Ar criterion .
2524 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2525 All messages that contain
2526 .Ar string
2527 in the envelope representation of the
2528 .Ql Bcc:
2529 field.
2530 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2531 All messages that contain
2532 .Ar string
2533 in the envelope representation of the
2534 .Ql Cc:
2535 field.
2536 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2537 All messages that contain
2538 .Ar string
2539 in the envelope representation of the
2540 .Ql From:
2541 field.
2542 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2543 All messages that contain
2544 .Ar string
2545 in the
2546 .Ql Subject:
2547 field.
2548 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2549 All messages that contain
2550 .Ar string
2551 in the envelope representation of the
2552 .Ql To:
2553 field.
2554 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2555 All messages that contain
2556 .Ar string
2557 in the specified
2558 .Ql Name:
2559 field.
2560 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2561 All messages that contain
2562 .Ar string
2563 in their body.
2564 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2565 All messages that contain
2566 .Ar string
2567 in their header or body.
2568 .It Ar ( larger size )
2569 All messages that are larger than
2570 .Ar size
2571 (in bytes).
2572 .It Ar ( smaller size )
2573 All messages that are smaller than
2574 .Ar size
2575 (in bytes).
2577 .It Ar ( before date )
2578 All messages that were received before
2579 .Ar date ,
2580 which must be in the form
2581 .Ql d[d]-mon-yyyy ,
2582 where
2583 .Ql d
2584 denotes the day of the month as one or two digits,
2585 .Ql mon
2586 is the name of the month \(en one of
2587 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2589 .Ql yyyy
2590 is the year as four digits, e.g.,
2591 .Ql 28-Dec-2012 .
2593 .It Ar ( on date )
2594 All messages that were received on the specified date.
2595 .It Ar ( since date )
2596 All messages that were received since the specified date.
2597 .It Ar ( sentbefore date )
2598 All messages that were sent on the specified date.
2599 .It Ar ( senton date )
2600 All messages that were sent on the specified date.
2601 .It Ar ( sentsince date )
2602 All messages that were sent since the specified date.
2603 .It Ar ()
2604 The same criterion as for the previous search.
2605 This specification cannot be used as part of another criterion.
2606 If the previous command line contained more than one independent
2607 criterion then the last of those criteria is used.
2609 .\" }}}
2611 .\" .Ss "On terminal control and line editor" {{{
2612 .Ss "On terminal control and line editor"
2614 \*(OP Terminal control will be realized through one of the standard
2616 libraries, either the
2617 .Lb libtermcap ,
2618 or, alternatively, the
2619 .Lb libterminfo ,
2620 both of which will be initialized to work with the environment variable
2621 .Ev TERM .
2622 Terminal control will enhance or enable interactive usage aspects, e.g.,
2623 .Sx "Coloured display" ,
2624 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2625 byte-sequences of keys like the cursor and function keys.
2628 The internal variable
2629 .Va termcap
2630 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2631 \*(UA may also become a fullscreen application by entering the
2632 so-called ca-mode and switching to an alternative exclusive screen
2633 (content) shall the terminal support it and the internal variable
2634 .Va termcap-ca-mode
2635 has been set explicitly.
2636 Actual interaction with the chosen library can be disabled completely by
2637 setting the internal variable
2638 .Va termcap-disable ;
2639 .Va termcap
2640 will be queried regardless, which is true even if the \*(OPal library
2641 support has not been enabled at configuration time as long as some other
2642 \*(OP which (may) query terminal control sequences has been enabled.
2645 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2646 environments which comply to the ISO C standard
2647 .St -isoC-amd1 ,
2648 and will support wide glyphs if possible (the necessary functionality
2649 had been removed from ISO C, but was included in
2650 .St -xpg4 ) .
2651 Prevent usage of a line editor in interactive mode by setting the
2652 internal variable
2653 .Va line-editor-disable .
2654 Especially if the \*(OPal terminal control support is missing setting
2655 entries in the internal variable
2656 .Va termcap
2657 will help shall the MLE misbehave, see there for more.
2658 The MLE can support a little bit of
2659 .Ic colour .
2662 \*(OP If the
2663 .Ic history
2664 feature is available then input from line editor prompts will be saved
2665 in a history list that can be searched in and be expanded from.
2666 Such saving can be prevented by prefixing input with any amount of
2667 whitespace.
2668 Aspects of history, like allowed content and maximum size, as well as
2669 whether history shall be saved persistently, can be configured with the
2670 internal variables
2671 .Va history-file ,
2672 .Va history-gabby ,
2673 .Va history-gabby-persist
2675 .Va history-size .
2678 The MLE supports a set of editing and control commands.
2679 By default (as) many (as possible) of these will be assigned to a set of
2680 single-letter control codes, which should work on any terminal (and can
2681 be generated by holding the
2682 .Dq control
2683 key while pressing the key of desire, e.g.,
2684 .Ql control-D ) .
2685 If the \*(OPal
2686 .Ic bind
2687 command is available then the MLE commands can also be accessed freely
2688 by assigning the command name, which is shown in parenthesis in the list
2689 below, to any desired key-sequence, and the MLE will instead and also use
2690 .Ic bind
2691 to establish its built-in key bindings
2692 (more of them if the \*(OPal terminal control is available),
2693 an action which can then be suppressed completely by setting
2694 .Va line-editor-no-defaults .
2695 .Sx "Shell-style argument quoting"
2696 notation is used in the following;
2697 combinations not mentioned either cause job control signals or do not
2698 generate a (unique) keycode:
2702 .Bl -tag -compact -width ".It Ql \eBa"
2703 .It Ql \ecA
2704 Go to the start of the line
2706 .Pf ( Cd mle-go-home ) .
2708 .It Ql \ecB
2709 Move the cursor backward one character
2711 .Pf ( Cd mle-go-bwd ) .
2713 .It Ql \ecD
2714 Forward delete the character under the cursor;
2715 quits \*(UA if used on the empty line unless the internal variable
2716 .Va ignoreeof
2717 is set
2719 .Pf ( Cd mle-del-fwd ) .
2721 .It Ql \ecE
2722 Go to the end of the line
2724 .Pf ( Cd mle-go-end ) .
2726 .It Ql \ecF
2727 Move the cursor forward one character
2729 .Pf ( Cd mle-go-fwd ) .
2731 .It Ql \ecG
2732 Cancel current operation, full reset.
2733 If there is an active history search or tabulator expansion then this
2734 command will first reset that, reverting to the former line content;
2735 thus a second reset is needed for a full reset in this case
2737 .Pf ( Cd mle-reset ) .
2739 .It Ql \ecH
2740 Backspace: backward delete one character
2742 .Pf ( Cd mle-del-bwd ) .
2744 .It Ql \ecI
2745 \*(NQ
2746 Horizontal tabulator:
2747 try to expand the word before the cursor, supporting the usual
2748 .Sx "Filename transformations"
2750 .Pf ( Cd mle-complete ) .
2751 This is affected by
2752 .Cd mle-quote-rndtrip .
2754 .It Ql \ecJ
2755 Newline:
2756 commit the current line
2758 .Pf ( Cd mle-commit ) .
2760 .It Ql \ecK
2761 Cut all characters from the cursor to the end of the line
2763 .Pf ( Cd mle-snarf-end ) .
2765 .It Ql \ecL
2766 Repaint the line
2768 .Pf ( Cd mle-repaint ) .
2770 .It Ql \ecN
2771 \*(OP Go to the next history entry
2773 .Pf ( Cd mle-hist-fwd ) .
2775 .It Ql \ecO
2776 (\*(OPally context-dependent) Invokes the command
2777 .Ic dt .
2779 .It Ql \ecP
2780 \*(OP Go to the previous history entry
2782 .Pf ( Cd mle-hist-bwd ) .
2784 .It Ql \ecQ
2785 Toggle roundtrip mode shell quotes, where produced,
2786 on and off
2788 .Pf ( Cd mle-quote-rndtrip ) .
2789 This setting is temporary, and will be forgotten once the command line
2790 is committed; also see
2791 .Ic shcodec .
2793 .It Ql \ecR
2794 \*(OP Complete the current line from (the remaining) older history entries
2796 .Pf ( Cd mle-hist-srch-bwd ) .
2798 .It Ql \ecS
2799 \*(OP Complete the current line from (the remaining) newer history entries
2801 .Pf ( Cd mle-hist-srch-fwd ) .
2803 .It Ql \ecT
2804 Paste the snarf buffer
2806 .Pf ( Cd mle-paste ) .
2808 .It Ql \ecU
2809 The same as
2810 .Ql \ecA
2811 followed by
2812 .Ql \ecK
2814 .Pf ( Cd mle-snarf-line ) .
2816 .It Ql \ecV
2817 Prompts for a Unicode character (its hexadecimal number) to be inserted
2819 .Pf ( Cd mle-prompt-char ) .
2820 Note this command needs to be assigned to a single-letter control code
2821 in order to become recognized and executed during input of
2822 a key-sequence (only three single-letter control codes can be used for
2823 that shortcut purpose); this control code is special-treated and cannot
2824 be part of any other sequence, because any occurrence will perform the
2825 .Cd mle-prompt-char
2826 function immediately.
2828 .It Ql \ecW
2829 Cut the characters from the one preceding the cursor to the preceding
2830 word boundary
2832 .Pf ( Cd mle-snarf-word-bwd ) .
2834 .It Ql \ecX
2835 Move the cursor forward one word boundary
2837 .Pf ( Cd mle-go-word-fwd ) .
2839 .It Ql \ecY
2840 Move the cursor backward one word boundary
2842 .Pf ( Cd mle-go-word-bwd ) .
2844 .It Ql \ec[
2845 Escape: reset a possibly used multibyte character input state machine
2846 and \*(OPally a lingering, incomplete key binding
2848 .Pf ( Cd mle-cancel ) .
2849 This command needs to be assigned to a single-letter control code in
2850 order to become recognized and executed during input of a key-sequence
2851 (only three single-letter control codes can be used for that shortcut
2852 purpose).
2853 This control code may also be part of a multi-byte sequence, but if
2854 a sequence is active and the very control code is currently also an
2855 expected input, then it will first be consumed by the active sequence.
2857 .It Ql \ec\e
2858 (\*(OPally context-dependent) Invokes the command
2859 .Ql Ic z Ns + .
2861 .It Ql \ec]
2862 (\*(OPally context-dependent) Invokes the command
2863 .Ql Ic z Ns $ .
2865 .It Ql \ec^
2866 (\*(OPally context-dependent) Invokes the command
2867 .Ql Ic z Ns 0 .
2869 .It Ql \ec_
2870 Cut the characters from the one after the cursor to the succeeding word
2871 boundary
2873 .Pf ( Cd mle-snarf-word-fwd ) .
2875 .It Ql \ec?
2876 Backspace:
2877 .Cd mle-del-bwd .
2879 .It \(en
2881 .Cd mle-fullreset :
2882 different to
2883 .Cd mle-reset
2884 this will immediately reset a possibly active search etc.
2886 .It \(en
2888 .Cd mle-bell :
2889 ring the audible bell.
2891 .\" }}}
2893 .\" .Ss "Coloured display" {{{
2894 .Ss "Coloured display"
2896 \*(OP \*(UA can be configured to support a coloured display and font
2897 attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic
2898 rendition) escape sequences.
2899 Usage of colours and font attributes solely depends upon the
2900 capability of the detected terminal type that is defined by the
2901 environment variable
2902 .Ev TERM
2903 and which can be fine-tuned by the user via the internal variable
2904 .Va termcap .
2907 On top of what \*(UA knows about the terminal the boolean variable
2908 .Va colour-pager
2909 defines whether the actually applicable colour and font attribute
2910 sequences should also be generated when output is going to be paged
2911 through the external program defined by the environment variable
2912 .Ev PAGER
2913 (also see
2914 .Va crt Ns
2916 This is not enabled by default because different pager programs need
2917 different command line switches or other configuration in order to
2918 support those sequences.
2919 \*(UA however knows about some widely used pagers and in a clean
2920 environment it is often enough to simply set
2921 .Va colour-pager ;
2922 please refer to that variable for more on this topic.
2925 If the variable
2926 .Va colour-disable
2927 is set then any active usage of colour and font attribute sequences
2928 is suppressed, but without affecting possibly established
2929 .Ic colour
2930 mappings.
2933 To define and control colours and font attributes a single multiplexer
2934 command family exists:
2935 .Ic colour
2936 shows or defines colour mappings for the given colour type (e.g.,
2937 monochrome) and
2938 .Ic uncolour
2939 can be used to remove mappings of a given colour type.
2940 Since colours are only available in interactive mode, it may make
2941 sense to conditionalize the colour setup by encapsulating it with
2942 .Ic if :
2944 .Bd -literal -offset indent
2945 if terminal && [ "$features" =% +colour ]
2946   colour iso view-msginfo ft=bold,fg=green
2947   colour iso view-header ft=bold,fg=red from,subject
2948   colour iso view-header fg=red
2950   uncolour iso view-header from,subject
2951   colour iso view-header ft=bold,fg=magenta,bg=cyan
2952   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
2953   colour mono view-header ft=bold
2954   colour mono view-header ft=bold,ft=reverse subject,from
2955 endif
2957 .\" }}}
2959 .\" .Ss "Handling spam" {{{
2960 .Ss "Handling spam"
2962 \*(OP \*(UA can make use of several spam interfaces for the purpose of
2963 identification of, and, in general, dealing with spam messages.
2964 A precondition of most commands in order to function is that the
2965 .Va spam-interface
2966 variable is set to one of the supported interfaces.
2967 Once messages have been identified as spam their (volatile)
2968 .Ql is-spam
2969 state can be prompted: the
2970 .Ql Ar :s
2972 .Ql Ar :S
2973 message specifications will address respective messages and their
2974 .Va attrlist
2975 entries will be used when displaying the
2976 .Va headline
2977 in the header display.
2979 .Bl -bullet
2981 .Ic spamrate
2982 rates the given messages and sets their
2983 .Ql is-spam
2984 flag accordingly.
2985 If the spam interface offers spam scores those can also be displayed in
2986 the header display by including the
2987 .Ql %$
2988 format in the
2989 .Va headline
2990 variable.
2992 .Ic spamham ,
2993 .Ic spamspam
2995 .Ic spamforget
2996 will interact with the Bayesian filter of the chosen interface and learn
2997 the given messages as
2998 .Dq ham
3000 .Dq spam ,
3001 respectively; the last command can be used to cause
3002 .Dq unlearning
3003 of messages; it adheres to their current
3004 .Ql is-spam
3005 state and thus reverts previous teachings.
3007 .Ic spamclear
3009 .Ic spamset
3010 will simply set and clear, respectively, the mentioned volatile
3011 .Ql is-spam
3012 message flag, without any interface interaction.
3017 .Xr spamassassin 1
3018 based
3019 .Va spam-interface
3020 .Ql spamc
3021 requires a running instance of the
3022 .Xr spamd 1
3023 server in order to function, started with the option
3024 .Fl -allow-tell
3025 shall Bayesian filter learning be possible.
3027 .Bd -literal -offset indent
3028 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3029 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3030     --daemonize [--local] [--allow-tell]
3034 Thereafter \*(UA can make use of these interfaces:
3036 .Bd -literal -offset indent
3037 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3038     -Sspamc-command=/usr/local/bin/spamc \e
3039     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3041 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3042     -Sspamc-command=/usr/local/bin/spamc \e
3043     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3047 Using the generic filter approach allows usage of programs like
3048 .Xr bogofilter 1 .
3049 Here is an example, requiring it to be accessible via
3050 .Ev PATH :
3052 .Bd -literal -offset indent
3053 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3054     -Sspamfilter-ham="bogofilter -n" \e
3055     -Sspamfilter-noham="bogofilter -N" \e
3056     -Sspamfilter-nospam="bogofilter -S" \e
3057     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3058     -Sspamfilter-spam="bogofilter -s" \e
3059     -Sspamfilter-rate-scanscore="1;^(.+)$"
3063 Because messages must exist on local storage in order to be scored (or
3064 used for Bayesian filter training), it is possibly a good idea to
3065 perform the local spam check last.
3066 Spam can be checked automatically when opening specific folders by
3067 setting a specialized form of the internal variable
3068 .Va folder-hook .
3070 .Bd -literal -offset indent
3071 define spamdelhook {
3072   # Server side DCC
3073   spamset (header x-dcc-brand-metrics "bulk")
3074   # Server-side spamassassin(1)
3075   spamset (header x-spam-flag "YES")
3076   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3077   move :S +maybe-spam
3078   spamrate :u
3079   del :s
3080   move :S +maybe-spam
3082 set folder-hook-SOMEFOLDER=spamdelhook
3086 See also the documentation for the variables
3087 .Va spam-interface , spam-maxsize ,
3088 .Va spamc-command , spamc-arguments , spamc-user ,
3089 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3090   spamfilter-rate
3092 .Va spamfilter-rate-scanscore .
3093 .\" }}}
3095 .\" }}} (DESCRIPTION)
3098 .\" .Sh COMMANDS {{{
3099 .Sh COMMANDS
3101 \*(UA reads input in lines.
3102 An unquoted reverse solidus
3103 .Ql \e
3104 at the end of a command line
3105 .Dq escapes
3106 the newline character: it is discarded and the next line of input is
3107 used as a follow-up line, with all leading whitespace removed;
3108 once an entire line is completed, the whitespace characters
3109 .Cm space , tabulator , newline
3110 as well as those defined by the variable
3111 .Va ifs
3112 are removed from the beginning and end.
3113 Placing any whitespace characters at the beginning of a line will
3114 prevent a possible addition of the command line to the \*(OPal
3115 .Ic history .
3118 The beginning of such input lines is then scanned for the name of
3119 a known command: command names may be abbreviated, in which case the
3120 first command that matches the given prefix will be used.
3121 .Sx "Command modifiers"
3122 may prefix a command in order to modify its behaviour.
3123 A name may also be a
3124 .Ic commandalias ,
3125 which will become expanded until no more expansion is possible.
3126 Once the command that shall be executed is known, the remains of the
3127 input line will be interpreted according to command-specific rules,
3128 documented in the following.
3131 This behaviour is different to the
3132 .Xr sh 1 Ns
3133 ell, which is a programming language with syntactic elements of clearly
3134 defined semantics, and therefore capable to sequentially expand and
3135 evaluate individual elements of a line.
3136 \*(UA will never be able to handle
3137 .Ql ? set one=value two=$one
3138 in a single statement, because the variable assignment is performed by
3139 the command
3140 .Pf ( Ic set ) ,
3141 not the language.
3144 The command
3145 .Ic list
3146 can be used to show the list of all commands, either alphabetically
3147 sorted or in prefix search order (these do not match, also because the
3148 POSIX standard prescribes a set of abbreviations).
3149 \*(OPally the command
3150 .Ic help
3152 .Ic \&? ) ,
3153 when given an argument, will show a documentation string for the
3154 command matching the expanded argument, as in
3155 .Ql ?t ,
3156 which should be a shorthand of
3157 .Ql ?type ;
3158 with these documentation strings both commands support a more
3159 .Va verbose
3160 listing mode which includes the argument type of the command and other
3161 information which applies; a handy suggestion might thus be:
3163 .Bd -literal -offset indent
3164 ? define __xv {
3165   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3166   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
3168 ? commandalias xv '\ecall __xv'
3169 ? xv help set
3172 .\" .Ss "Command modifiers" {{{
3173 .Ss "Command modifiers"
3175 Commands may be prefixed by one or multiple command modifiers.
3177 .Bl -bullet
3179 The modifier reverse solidus
3181 .Cm \e ,
3182 to be placed first, prevents
3183 .Ic commandalias
3184 expansions on the remains of the line, e.g.,
3185 .Ql \eecho
3186 will always evaluate the command
3187 .Ic echo ,
3188 even if an (command)alias of the same name exists.
3189 .Ic commandalias
3190 content may itself contain further command modifiers, including
3191 an initial reverse solidus to prevent further expansions.
3194 The modifier
3196 .Cm ignerr
3197 indicates that any error generated by the following command should be
3198 ignored by the state machine and not cause a program exit with enabled
3199 .Va errexit
3200 or for the standardized exit cases in
3201 .Va posix
3202 mode.
3203 .Va \&? ,
3204 one of the
3205 .Sx "INTERNAL VARIABLES" ,
3206 will be set to the real exit status of the command regardless.
3210 .Cm local
3211 does yet not implement any functionality.
3215 .Cm u
3216 does yet not implement any functionality.
3219 Some commands support the
3221 .Cm vput
3222 modifier: if used, they expect the name of a variable, which can itself
3223 be a variable, i.e., shell expansion is applied, as their first
3224 argument, and will place their computation result in it instead of the
3225 default location (it is usually written to standard output).
3227 The given name will be tested for being a valid
3228 .Xr sh 1
3229 variable name, and may therefore only consist of upper- and lowercase
3230 characters, digits, and the underscore; the hyphen-minus may be used as
3231 a non-portable extension; digits may not be used as first, hyphen-minus
3232 may not be used as last characters.
3233 In addition the name may either not be one of the known
3234 .Sx "INTERNAL VARIABLES" ,
3235 or must otherwise refer to a writable (non-boolean) value variable.
3236 The actual put operation may fail nonetheless, e.g., if the variable
3237 expects a number argument only a number will be accepted.
3238 Any error during these operations causes the command as such to fail,
3239 and the error number
3240 .Va \&!
3241 will be set to
3242 .Va ^ERR Ns -NOTSUP ,
3243 the exit status
3244 .Va \&?
3245 should be set to
3246 .Ql -1 ,
3247 but some commands deviate from the latter, which is documented.
3250 Last, but not least, the modifier
3252 .Cm wysh
3253 can be used for some old and established commands to choose the new
3254 .Sx "Shell-style argument quoting"
3255 rules over the traditional
3256 .Sx "Old-style argument quoting" .
3258 .\" }}}
3260 .\" .Ss "Message list arguments" {{{
3261 .Ss "Message list arguments"
3263 Some commands expect arguments that represent messages (actually
3264 their symbolic message numbers), as has been documented above under
3265 .Sx "Specifying messages"
3266 already.
3267 If no explicit message list has been specified, the next message
3268 forward that satisfies the command's requirements will be used,
3269 and if there are no messages forward of the current message,
3270 the search proceeds backwards;
3271 if there are no good messages at all to be found, an error message is
3272 shown and the command is aborted.
3273 .\" }}}
3275 .\" .Ss "Old-style argument quoting" {{{
3276 .Ss "Old-style argument quoting"
3278 \*(ID This section documents the old, traditional style of quoting
3279 non-message-list arguments to commands which expect this type of
3280 arguments: whereas still used by the majority of such commands, the new
3281 .Sx "Shell-style argument quoting"
3282 may be available even for those via
3283 .Cm wysh ,
3284 one of the
3285 .Sx "Command modifiers" .
3286 Nonetheless care must be taken, because only new commands have been
3287 designed with all the capabilities of the new quoting rules in mind,
3288 which can, e.g., generate control characters.
3291 .Bl -bullet -offset indent
3293 An argument can be enclosed between paired double-quotes
3294 .Ql """argument"""
3296 single-quotes
3297 .Ql 'argument' ;
3298 any whitespace, shell word expansion, or reverse solidus characters
3299 (except as described next) within the quotes are treated literally as
3300 part of the argument.
3301 A double-quote will be treated literally within single-quotes and vice
3302 versa.
3303 Inside such a quoted string the actually used quote character can be
3304 used nonetheless by escaping it with a reverse solidus
3305 .Ql \e ,
3306 as in
3307 .Ql """y\e""ou""" .
3310 An argument that is not enclosed in quotes, as above, can usually still
3311 contain space characters if those spaces are reverse solidus escaped, as in
3312 .Ql you\e are .
3315 A reverse solidus outside of the enclosing quotes is discarded
3316 and the following character is treated literally as part of the argument.
3318 .\" }}}
3320 .\" .Ss "Shell-style argument quoting" {{{
3321 .Ss "Shell-style argument quoting"
3323 Commands which don't expect message-list arguments use
3324 .Xr sh 1 Ns
3325 ell-style, and therefore POSIX standardized, argument parsing and
3326 quoting rules.
3327 \*(ID Most new commands only support these new rules and are flagged
3328 \*(NQ, some elder ones can use them with the command modifier
3329 .Cm wysh ;
3330 in the future only this type of argument quoting will remain.
3333 A command line is parsed from left to right and an input token is
3334 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3335 Metacharacters are vertical bar
3336 .Cm \&| ,
3337 ampersand
3338 .Cm & ,
3339 semicolon
3340 .Cm \&; ,
3341 as well as all characters from the variable
3342 .Va ifs ,
3343 and / or
3344 .Cm space , tabulator , newline .
3345 The additional metacharacters left and right parenthesis
3346 .Cm \&( , \&)
3347 and less-than and greater-than signs
3348 .Cm < , >
3349 that the
3350 .Xr sh 1
3351 supports are not used, and are treated as ordinary characters: for one
3352 these characters are a vivid part of email addresses, and it seems
3353 highly unlikely that their function will become meaningful to \*(UA.
3355 .Bd -filled -offset indent
3356 .Sy Compatibility note:
3357 \*(ID Please note that even many new-style commands do not yet honour
3358 .Va ifs
3359 to parse their arguments: whereas the
3360 .Xr sh 1 Ns
3361 ell is a language with syntactic elements of clearly defined semantics,
3362 \*(UA parses entire input lines and decides on a per-command base what
3363 to do with the rest of the line.
3364 This also means that whenever an unknown command is seen all that \*(UA
3365 can do is cancellation of the processing of the remains of the line.
3367 It also often depends on an actual subcommand of a multiplexer command
3368 how the rest of the line should be treated, and until v15 we are not
3369 capable to perform this deep inspection of arguments.
3370 Nonetheless, at least the following commands which work with positional
3371 parameters fully support
3372 .Va ifs
3373 for an almost shell-compatible field splitting:
3374 .Ic call , call_if , read , vpospar , xcall .
3378 Any unquoted number sign
3379 .Ql #
3380 at the beginning of a new token starts a comment that extends to the end
3381 of the line, and therefore ends argument processing.
3382 An unquoted dollar sign
3383 .Ql $
3384 will cause variable expansion of the given name, which must be a valid
3385 .Xr sh 1 Ns
3386 ell-style variable name (see
3387 .Cm vput ) :
3388 .Sx "INTERNAL VARIABLES"
3389 as well as
3390 .Sx ENVIRONMENT
3391 (shell) variables can be accessed through this mechanism, brace
3392 enclosing the name is supported (i.e., to subdivide a token).
3395 Whereas the metacharacters
3396 .Cm space , tabulator , newline
3397 only complete an input token, vertical bar
3398 .Cm \&| ,
3399 ampersand
3400 .Cm &
3401 and semicolon
3402 .Cm \&;
3403 also act as control operators and perform control functions.
3404 For now supported is semicolon
3405 .Cm \&; ,
3406 which terminates a single command, therefore sequencing the command line
3407 and making the remainder of the line a subject to reevaluation.
3408 With sequencing, multiple command argument types and quoting rules may
3409 therefore apply to a single line, which can become problematic before
3410 v15: e.g., the first of the following will cause surprising results.
3413 .Dl ? echo one; set verbose; echo verbose=$verbose.
3414 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3417 Quoting is a mechanism that will remove the special meaning of
3418 metacharacters and reserved words, and will prevent expansion.
3419 There are four quoting mechanisms: the escape character, single-quotes,
3420 double-quotes and dollar-single-quotes:
3423 .Bl -bullet -offset indent
3425 The literal value of any character can be preserved by preceding it
3426 with the escape character reverse solidus
3427 .Ql \e .
3430 Arguments which are enclosed in
3431 .Ql 'single-\:quotes'
3432 retain their literal value.
3433 A single-quote cannot occur within single-quotes.
3436 The literal value of all characters enclosed in
3437 .Ql \(dqdouble-\:quotes\(dq
3438 is retained, with the exception of dollar sign
3439 .Ql $ ,
3440 which will cause variable expansion, as above, backquote (grave accent)
3441 .Ql ` ,
3442 (which not yet means anything special), reverse solidus
3443 .Ql \e ,
3444 which will escape any of the characters dollar sign
3445 .Ql $
3446 (to prevent variable expansion), backquote (grave accent)
3447 .Ql ` ,
3448 double-quote
3449 .Ql \(dq
3450 (to prevent ending the quote) and reverse solidus
3451 .Ql \e
3452 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3453 but has no special meaning otherwise.
3456 Arguments enclosed in
3457 .Ql $'dollar-\:single-\:quotes'
3458 extend normal single quotes in that reverse solidus escape sequences are
3459 expanded as follows:
3461 .Bl -tag -compact -width "Ql \eNNN"
3462 .It Ql \ea
3463 bell control character (ASCII and ISO-10646 BEL).
3464 .It Ql \eb
3465 backspace control characer (ASCII and ISO-10646 BS).
3466 .It Ql \eE
3467 escape control character (ASCII and ISO-10646 ESC).
3468 .It Ql \ee
3469 the same.
3470 .It Ql \ef
3471 form feed control character (ASCII and ISO-10646 FF).
3472 .It Ql \en
3473 line feed control character (ASCII and ISO-10646 LF).
3474 .It Ql \er
3475 carriage return control character (ASCII and ISO-10646 CR).
3476 .It Ql \et
3477 horizontal tabulator control character (ASCII and ISO-10646 HT).
3478 .It Ql \ev
3479 vertical tabulator control character (ASCII and ISO-10646 VT).
3480 .It Ql \e\e
3481 emits a reverse solidus character.
3482 .It Ql \e'
3483 single quote.
3484 .It Ql \e"
3485 double quote (escaping is optional).
3486 .It Ql \eNNN
3487 eight-bit byte with the octal value
3488 .Ql NNN
3489 (one to three octal digits), optionally prefixed by an additional
3490 .Ql 0 .
3491 A 0 byte will suppress further output for the quoted argument.
3492 .It Ql \exHH
3493 eight-bit byte with the hexadecimal value
3494 .Ql HH
3495 (one or two hexadecimal characters).
3496 A 0 byte will suppress further output for the quoted argument.
3497 .It Ql \eUHHHHHHHH
3498 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3499 .Ql HHHHHHHH
3500 (one to eight hexadecimal digits) \(em note that Unicode defines the
3501 maximum codepoint ever to be supported as
3502 .Ql 0x10FFFF
3503 (in planes of
3504 .Ql 0xFFFF
3505 characters each).
3506 This escape is only supported in locales that support Unicode (see
3507 .Sx "Character sets" ) ,
3508 in other cases the sequence will remain unexpanded unless the given code
3509 point is ASCII compatible or (if the \*(OPal character set conversion is
3510 available) can be represented in the current locale.
3511 The character NUL will suppress further output for the quoted argument.
3512 .It Ql \euHHHH
3513 Identical to
3514 .Ql \eUHHHHHHHH
3515 except it takes only one to four hexadecimal digits.
3516 .It Ql \ecX
3517 Emits the non-printable (ASCII and compatible) C0 control codes
3518 0 (NUL) to 31 (US), and 127 (DEL).
3519 Printable representations of ASCII control codes can be created by
3520 mapping them to a different part of the ASCII character set, which is
3521 possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is
3522 .Ql 7 + 64 = 71 = G .
3523 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3524 .Ic vexpr ) ,
3525 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3526 .Ql ? vexpr ^ 127 64 .
3528 Whereas historically circumflex notation has often been used for
3529 visualization purposes of control codes, e.g.,
3530 .Ql ^G ,
3531 the reverse solidus notation has been standardized:
3532 .Ql \ecG .
3533 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3534 as shown above (e.g.,
3535 .Ql \ea ,
3536 .Ql \en ,
3537 .Ql \et ) :
3538 whenever such an alias exists it will be used for display purposes.
3539 The control code NUL
3540 .Pf ( Ql \ec@ ,
3541 a non-standard extension) will suppress further output for the remains
3542 of the token (which may extend beyond the current quote), or, depending
3543 on the context, the remains of all arguments for the current command.
3544 .It Ql \e$NAME
3545 Non-standard extension: expand the given variable name, as above.
3546 Brace enclosing the name is supported.
3547 .It Ql \e`{command}
3548 Not yet supported, just to raise awareness: Non-standard extension.
3553 Caveats:
3555 .Bd -literal -offset indent
3556 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3557 ? echo Quotes ${HOME} and tokens differ! # comment
3558 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3560 .\" }}}
3562 .\" .Ss "Raw data arguments for codec commands" {{{
3563 .Ss "Raw data arguments for codec commands"
3565 A special set of commands, which all have the string
3566 .Dq codec
3567 in their name, e.g.,
3568 .Ic addrcodec ,
3569 .Ic shcodec ,
3570 .Ic urlcodec ,
3571 take raw string data as input, which means that the content of the
3572 command input line is passed completely unexpanded and otherwise
3573 unchanged: like this the effect of the actual codec is visible without
3574 any noise of possible shell quoting rules etc., i.e., the user can input
3575 one-to-one the desired or questionable data.
3576 To gain a level of expansion, the entire command line can be
3577 .Ic eval Ns
3578 uated first, e.g.,
3580 .Bd -literal -offset indent
3581 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3582 ? echo $res
3583 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3584 ? shcodec d $res
3585 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3586 ? eval shcodec d $res
3587 /usr/Sch\[:o]nes Wetter/heute.txt
3589 .\" }}}
3591 .\" .Ss "Filename transformations" {{{
3592 .Ss "Filename transformations"
3594 Filenames, where expected, and unless documented otherwise, are
3595 subsequently subject to the following filename transformations, in
3596 sequence:
3598 .Bl -bullet -offset indent
3600 If the given name is a registered
3601 .Ic shortcut ,
3602 it will be replaced with the expanded shortcut.
3605 The filename is matched against the following patterns or strings:
3607 .Bl -hang -compact -width ".Ar %user"
3608 .It Ar #
3609 (Number sign) is expanded to the previous file.
3610 .It Ar %
3611 (Percent sign) is replaced by the invoking
3612 .Mx -ix "primary system mailbox"
3613 user's primary system mailbox, which either is the (itself expandable)
3614 .Va inbox
3615 if that is set, the standardized absolute pathname indicated by
3616 .Ev MAIL
3617 if that is set, or a built-in compile-time default otherwise.
3618 .It Ar %user
3619 Expands to the primary system mailbox of
3620 .Ar user
3621 (and never the value of
3622 .Va inbox ,
3623 regardless of its actual setting).
3624 .It Ar &
3625 (Ampersand) is replaced with the invoking users
3626 .Mx -ix "secondary mailbox"
3627 secondary mailbox, the
3628 .Ev MBOX .
3629 .It Ar +file
3630 Refers to a
3631 .Ar file
3632 in the
3633 .Va folder
3634 directory (if that variable is set).
3635 .It Ar %:filespec
3636 Expands to the same value as
3637 .Ar filespec ,
3638 but has special meaning when used with, e.g., the command
3639 .Ic file :
3640 the file will be treated as a primary system mailbox by, e.g., the
3641 .Ic mbox
3643 .Ic save
3644 commands, meaning that messages that have been read in the current
3645 session will be moved to the
3646 .Ev MBOX
3647 mailbox instead of simply being flagged as read.
3651 Meta expansions may be applied to the resulting filename, as allowed by
3652 the operation and applicable to the resulting access protocol (also see
3653 .Sx "On URL syntax and credential lookup" ) .
3654 For the file-protocol, a leading tilde
3655 .Ql ~
3656 character will be replaced by the expansion of
3657 .Ev HOME ,
3658 except when followed by a valid user name, in which case the home
3659 directory of the given user is used instead.
3661 A shell expansion as if specified in double-quotes (see
3662 .Sx "Shell-style argument quoting" )
3663 may be applied, so that any occurrence of
3664 .Ql $VARIABLE
3666 .Ql ${VARIABLE} )
3667 will be replaced by the expansion of the variable, if possible;
3668 .Sx "INTERNAL VARIABLES"
3669 as well as
3670 .Sx ENVIRONMENT
3671 (shell) variables can be accessed through this mechanism.
3673 Shell pathname wildcard pattern expansions
3674 .Pf ( Xr glob 7 )
3675 may be applied as documented.
3676 If the fully expanded filename results in multiple pathnames and the
3677 command is expecting only one file, an error results.
3679 In interactive context, in order to allow simple value acceptance (via
3680 .Dq ENTER ) ,
3681 arguments will usually be displayed in a properly quoted form, e.g., a file
3682 .Ql diet\e is \ecurd.txt
3683 may be displayed as
3684 .Ql 'diet\e is \ecurd.txt' .
3686 .\" }}}
3688 .\" .Ss "Commands" {{{
3689 .Ss "Commands"
3691 The following commands are available:
3693 .Bl -tag -width ".It Ic BaNg"
3697 .It Ic \&!
3698 Executes the
3699 .Ev SHELL
3700 command which follows, replacing unescaped exclamation marks with the
3701 previously executed command if the internal variable
3702 .Va bang
3703 is set.
3704 This command supports
3705 .Cm vput
3706 as documented in
3707 .Sx "Command modifiers" ,
3708 and manages the error number
3709 .Va \&! .
3710 A 0 or positive exit status
3711 .Va \&?
3712 reflects the exit status of the command, negative ones that
3713 an error happened before the command was executed, or that the program
3714 did not exit cleanly, but, e.g., due to a signal: the error number is
3715 .Va ^ERR Ns -CHILD ,
3716 then.
3719 In conjunction with the
3720 .Cm vput
3721 modifier the following special cases exist:
3722 a negative exit status occurs if the collected data could not be stored
3723 in the given variable, which is a
3724 .Va ^ERR Ns -NOTSUP
3725 error that should otherwise not occur.
3726 .Va ^ERR Ns -CANCELED
3727 indicates that no temporary file could be created to collect the command
3728 output at first glance.
3729 In case of catchable out-of-memory situations
3730 .Va ^ERR Ns -NOMEM
3731 will occur and \*(UA will try to store the empty string, just like with
3732 all other detected error conditions.
3736 .It Ic #
3737 The comment-command causes the entire line to be ignored.
3738 .Sy Note:
3739 this really is a normal command which' purpose is to discard its
3740 arguments, not a
3741 .Dq comment-start
3742 indicating special character, which means that, e.g., trailing comments
3743 on a line are not possible.
3746 .It Ic +
3747 Goes to the next message in sequence and types it
3748 (like
3749 .Dq ENTER ) .
3752 .It Ic -
3753 Display the preceding message, or the n'th previous message if given
3754 a numeric argument n.
3757 .It Ic =
3758 Show the current message number (the
3759 .Dq dot ) .
3762 .It Ic \&?
3763 Show a brief summary of commands.
3764 \*(OP Given an argument a synopsis for the command in question is
3765 shown instead; commands can be abbreviated in general and this command
3766 can be used to see the full expansion of an abbreviation including the
3767 synopsis, try, e.g.,
3768 .Ql ?h ,
3769 .Ql ?hel
3771 .Ql ?help
3772 and see how the output changes.
3773 This mode also supports a more
3774 .Va verbose
3775 output, which will provide the informations documented for
3776 .Ic list .
3779 .It Ic \&|
3780 A synonym for the
3781 .Ic pipe
3782 command.
3786 .It Ic account , unaccount
3787 (ac, una) Creates, selects or lists (an) account(s).
3788 Accounts are special incarnations of
3789 .Ic define Ns d
3790 macros and group commands and variable settings which together usually
3791 arrange the environment for the purpose of creating an email account.
3792 Different to normal macros settings which are covered by
3793 .Ic localopts
3794 \(en here by default enabled! \(en will not be reverted before the
3795 .Ic account
3796 is changed again.
3797 The special account
3798 .Ql null
3799 (case-insensitive) always exists, and all but it can be deleted by the
3800 latter command, and in one operation with the special name
3801 .Ql * .
3802 Also for all but it a possibly set
3803 .Va on-account-cleanup
3804 hook is called once they are left.
3806 Without arguments a listing of all defined accounts is shown.
3807 With one argument the given account is activated: the system
3808 .Va inbox
3809 of that account will be activated (as via
3810 .Ic file ) ,
3811 a possibly installed
3812 .Va folder-hook
3813 will be run, and the internal variable
3814 .Va account
3815 will be updated.
3816 The two argument form is identical to defining a macro as via
3817 .Ic define :
3818 .Bd -literal -offset indent
3819 account myisp {
3820   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3821   set from='(My Name) myname@myisp.example'
3822   set mta=smtp://mylogin@smtp.myisp.example
3828 .It Ic addrcodec
3829 Perform email address codec transformations on raw-data argument, rather
3830 according to email standards (RFC 5322; \*(ID will furtherly improve).
3831 Supports
3832 .Cm vput
3833 (see
3834 .Sx "Command modifiers" ) ,
3835 and manages the error number
3836 .Va \&! .
3837 The first argument must be either
3838 .Ar [+[+[+]]]e[ncode] ,
3839 .Ar d[ecode] ,
3840 .Ar s[kin]
3842 .Ar skinl[ist]
3843 and specifies the operation to perform on the rest of the line.
3846 Decoding will show how a standard-compliant MUA will display the given
3847 argument, which should be an email address.
3848 Please be aware that most MUAs have difficulties with the address
3849 standards, and vary wildly when (comments) in parenthesis,
3850 .Dq double-quoted
3851 strings, or quoted-pairs, as below, become involved.
3852 \*(ID \*(UA currently does not perform decoding when displaying addresses.
3855 Skinning is identical to decoding but only outputs the plain address,
3856 without any string, comment etc. components.
3857 Another difference is that it may fail with the error number
3858 .Va \&!
3859 set to
3860 .Va ^ERR Ns -INVAL
3861 if decoding fails to find a(n) (valid) email address, in which case the
3862 unmodified input will be output again.
3865 .Ar skinlist
3866 first performs a skin operation, and thereafter checks a valid
3867 address for whether it is a registered mailing-list (see
3868 .Ic mlist
3870 .Ic mlsubscribe ) ,
3871 eventually reporting that state in the error number
3872 .Va \&!
3874 .Va ^ERR Ns -EXIST .
3875 (This state could later become overwritten by an I/O error, though.)
3878 Encoding supports four different modes, lesser automated versions can be
3879 chosen by prefixing one, two or three plus signs: the standard imposes
3880 a special meaning on some characters, which thus have to be transformed
3881 to so-called quoted-pairs by pairing them with a reverse solidus
3882 .Ql \e
3883 in order to remove the special meaning; this might change interpretation
3884 of the entire argument from what has been desired, however!
3885 Specify one plus sign to remark that parenthesis shall be left alone,
3886 two for not turning double quotation marks into quoted-pairs, and three
3887 for also leaving any user-specified reverse solidus alone.
3888 The result will always be valid, if a successful exit status is reported.
3889 \*(ID Addresses need to be specified in between angle brackets
3890 .Ql < ,
3891 .Ql >
3892 if the construct becomes more difficult, otherwise the current parser
3893 will fail; it is not smart enough to guess right.
3895 .Bd -literal -offset indent
3896 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
3897 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3898 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3899 "Hey, you", \e out\e there <diet@exam.ple>
3900 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3901 diet@exam.ple
3907 .It Ic alias , unalias
3908 (a, una) Aliases are a method of creating personal distribution lists
3909 that map a single alias name to none to multiple real receivers;
3910 these aliases become expanded after message composing is completed.
3911 The latter command removes the given list of aliases, the special name
3912 .Ql *
3913 will discard all existing aliases.
3915 The former command shows all currently defined aliases when used without
3916 arguments, and with one argument the expansion of the given alias.
3917 With more than one argument, creates or appends to the alias name given
3918 as the first argument the remaining arguments.
3919 Alias names adhere to the Postfix MTA
3920 .Xr aliases 5
3921 rules and are thus restricted to alphabetic characters, digits, the
3922 underscore, hyphen-minus, the number sign, colon and commercial at,
3923 the last character can also be the dollar sign; the regular expression:
3924 .Ql [[:alnum:]_#:@-]+$? .
3925 As extensions the exclamation mark
3926 .Ql \&! ,
3927 period
3928 .Ql \&.
3929 as well as
3930 .Dq any character that has the high bit set
3931 may be used.
3935 .It Ic alternates , unalternates
3936 \*(NQ (alt) Manage a list of alternate addresses or names of the active user,
3937 members of which will be removed from recipient lists.
3938 The latter command removes the given list of alternates, the special name
3939 .Ql *
3940 will discard all existing aliases.
3941 The former command manages the error number
3942 .Va \&!
3943 and shows the current set of alternates when used without arguments; in
3944 this mode it supports
3945 .Cm vput
3946 (see
3947 .Sx "Command modifiers" ) .
3948 Otherwise the given arguments (after being checked for validity) are
3949 appended to the list of alternate names; in
3950 .Va posix
3951 mode they replace that list instead.
3952 There is a set of implicit alternates which is formed of the values of
3953 .Ev LOGNAME ,
3954 .Va from ,
3955 .Va sender
3957 .Va reply-to .
3961 .It Ic answered , unanswered
3962 Take a message lists and mark each message as having been answered,
3963 having not been answered, respectively.
3964 Messages will be marked answered when being
3965 .Ic reply Ns d
3966 to automatically if the
3967 .Va markanswered
3968 variable is set.
3969 See the section
3970 .Sx "Message states" .
3975 .It Ic bind , unbind
3976 \*(OP\*(NQ The bind command extends the MLE (see
3977 .Sx "On terminal control and line editor" )
3978 with freely configurable key bindings.
3979 The latter command removes from the given context the given key binding,
3980 both of which may be specified as a wildcard
3981 .Ql * ,
3982 so that, e.g.,
3983 .Ql unbind * *
3984 will remove all bindings of all contexts.
3985 Due to initialization order unbinding will not work for built-in key
3986 bindings upon program startup, however: please use
3987 .Va line-editor-no-defaults
3988 for this purpose instead.
3991 With one argument the former command shows all key bindings for the
3992 given context, specifying an asterisk
3993 .Ql *
3994 will show the bindings of all contexts; a more verbose listing will be
3995 produced if either of
3996 .Va debug
3998 .Va verbose
3999 are set.
4000 With two or more arguments a binding is (re)established:
4001 the first argument is the context to which the binding shall apply,
4002 the second argument is a comma-separated list of the
4003 .Dq keys
4004 which form the binding, and any remaining arguments form the expansion.
4005 To indicate that a binding shall not be auto-committed, but that the
4006 expansion shall instead be furtherly editable by the user, a commercial at
4007 .Ql @
4008 (that will be removed) can be placed last in the expansion, from which
4009 leading and trailing whitespace will finally be removed.
4010 Reverse solidus cannot be used as the last character of expansion.
4013 Contexts define when a binding applies, i.e., a binding will not be seen
4014 unless the context for which it is defined for is currently active.
4015 This is not true for the shared binding
4016 .Ql base ,
4017 which is the foundation for all other bindings and as such always
4018 applies, its bindings, however, only apply secondarily.
4019 The available contexts are the shared
4020 .Ql base ,
4022 .Ql default
4023 context which is used in all not otherwise documented situations, and
4024 .Ql compose ,
4025 which applies to compose mode only.
4028 .Dq Keys
4029 which form the binding are specified as a comma-separated list of
4030 byte-sequences, where each list entry corresponds to one key(press).
4031 A list entry may, indicated by a leading colon character
4032 .Ql \&: ,
4033 also refer to the name of a terminal capability; several dozen names
4034 will be compiled in and may be specified either by their
4035 .Xr terminfo 5 ,
4036 or, if existing, by their
4037 .Xr termcap 5
4038 name, regardless of the actually used \*(OPal terminal control library.
4039 It is possible to use any capability, as long as the name is resolvable
4040 by the \*(OPal control library or was defined via the internal variable
4041 .Va termcap .
4042 Input sequences are not case-normalized, so that an exact match is
4043 required to update or remove a binding.
4044 Examples:
4046 .Bd -literal -offset indent
4047 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4048 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
4049 ? bind default $'\ecA',:khome,w 'echo An editable binding@'
4050 ? bind default a,b,c rm -irf / @  # Another editable binding
4051 ? bind default :kf1 File %
4052 ? bind compose :kf1 ~e
4056 Note that the entire comma-separated list is first parsed (over) as a
4057 shell-token with whitespace as the field separator, before being parsed
4058 and expanded for real with comma as the field separator, therefore
4059 whitespace needs to be properly quoted, see
4060 .Sx "Shell-style argument quoting" .
4061 Using Unicode reverse solidus escape sequences renders a binding
4062 defunctional if the locale does not support Unicode (see
4063 .Sx "Character sets" ) ,
4064 and using terminal capabilities does so if no (corresponding) terminal
4065 control support is (currently) available.
4068 The following terminal capability names are built-in and can be used in
4069 .Xr terminfo 5
4070 or (if available) the two-letter
4071 .Xr termcap 5
4072 notation.
4073 See the respective manual for a list of capabilities.
4074 The program
4075 .Xr infocmp 1
4076 can be used to show all the capabilities of
4077 .Ev TERM
4078 or the given terminal type;
4079 using the
4080 .Fl \&\&x
4081 flag will also show supported (non-standard) extensions.
4084 .Bl -tag -compact -width kcuuf_or_kcuuf
4085 .It Cd kbs Ns \0or Cd kb
4086 Backspace.
4087 .It Cd kdch1 Ns \0or Cd kD
4088 Delete character.
4089 .It Cd kDC Ns \0or Cd *4
4090 \(em shifted variant.
4091 .It Cd kel Ns \0or Cd kE
4092 Clear to end of line.
4093 .It Cd kext Ns \0or Cd @9
4094 Exit.
4095 .It Cd kich1 Ns \0or Cd kI
4096 Insert character.
4097 .It Cd kIC Ns \0or Cd #3
4098 \(em shifted variant.
4099 .It Cd khome Ns \0or Cd kh
4100 Home.
4101 .It Cd kHOM Ns \0or Cd #2
4102 \(em shifted variant.
4103 .It Cd kend Ns \0or Cd @7
4104 End.
4105 .It Cd knp Ns \0or Cd kN
4106 Next page.
4107 .It Cd kpp Ns \0or Cd kP
4108 Previous page.
4109 .It Cd kcub1 Ns \0or Cd kl
4110 Left cursor (with more modifiers: see below).
4111 .It Cd kLFT Ns \0or Cd #4
4112 \(em shifted variant.
4113 .It Cd kcuf1 Ns \0or Cd kr
4114 Right cursor (ditto).
4115 .It Cd kRIT Ns \0or Cd %i
4116 \(em shifted variant.
4117 .It Cd kcud1 Ns \0or Cd kd
4118 Down cursor (ditto).
4119 .It Cd kDN
4120 \(em shifted variant (only terminfo).
4121 .It Cd kcuu1 Ns \0or Cd ku
4122 Up cursor (ditto).
4123 .It Cd kUP
4124 \(em shifted variant (only terminfo).
4125 .It Cd kf0 Ns \0or Cd k0
4126 Function key 0.
4127 Add one for each function key up to
4128 .Cd kf9
4130 .Cd k9 ,
4131 respectively.
4132 .It Cd kf10 Ns \0or Cd k;
4133 Function key 10.
4134 .It Cd kf11 Ns \0or Cd F1
4135 Function key 11.
4136 Add one for each function key up to
4137 .Cd kf19
4139 .Cd F9 ,
4140 respectively.
4144 Some terminals support key-modifier combination extensions, e.g.,
4145 .Ql Alt+Shift+xy .
4146 For example, the delete key,
4147 .Cd kdch1 :
4148 in its shifted variant, the name is mutated to
4149 .Cd  kDC ,
4150 then a number is appended for the states
4151 .Ql Alt
4152 .Pf ( Cd kDC3 ) ,
4153 .Ql Shift+Alt
4154 .Pf ( Cd kDC4 ) ,
4155 .Ql Control
4156 .Pf ( Cd kDC5 ) ,
4157 .Ql Shift+Control
4158 .Pf ( Cd kDC6 ) ,
4159 .Ql Alt+Control
4160 .Pf ( Cd kDC7 ) ,
4161 finally
4162 .Ql Shift+Alt+Control
4163 .Pf ( Cd kDC8 ) .
4164 The same for the left cursor key,
4165 .Cd kcub1 :
4166 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4169 It is advisable to use an initial escape or other control character (e.g.,
4170 .Ql \ecA )
4171 for bindings which describe user key combinations (as opposed to purely
4172 terminal capability based ones), in order to avoid ambiguities whether
4173 input belongs to key sequences or not; it also reduces search time.
4174 Adjusting
4175 .Va bind-timeout
4176 may help shall keys and sequences be falsely recognized.
4180 .It Ic call
4181 \*(NQ Calls the given macro, which must have been created via
4182 .Ic define ,
4183 otherwise a
4184 .Va ^ERR Ns -NOENT
4185 error occurs.
4186 Parameters given to macros are implicitly local to the macro's scope, and
4187 may be accessed via special (positional) parameters, e.g.,
4188 .Va 1 ,
4189 .Va * ,
4190 .Va @ ,
4191 .Va # .
4192 The positional parameters may be removed by
4193 .Ic shift Ns
4194 ing them off the stack (exceeding the supported number of arguments
4195 results in a
4196 .Va ^ERR Ns -OVERFLOW ) ,
4197 and are otherwise controllable via
4198 .Ic vpospar .
4199 Changes to other
4200 .Sx ENVIRONMENT
4201 as well as
4202 .Sx "INTERNAL VARIABLES"
4203 can be reverted before the current level regains control by setting
4204 .Ic localopts
4205 for called macro(s) (or in them, of course).
4206 Macro execution can be terminated at any time by calling
4207 .Ic return .
4210 Calling macros recursively will at some time excess the stack size
4211 limit, causing a hard program abortion; if recursively calling a macro
4212 is the last command of the current macro, consider to use the command
4213 .Ic xcall ,
4214 which will first release all resources of the current macro before
4215 replacing the current macro with the called one.
4216 Numeric and string operations can be performed via
4217 .Ic vexpr ,
4219 .Ic eval
4220 may be helpful to recreate argument lists.
4222 .Bd -literal -offset indent
4223 define exmac {
4224   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4225   return 1000 0
4227 call exmac Hello macro exmac!
4232 .It Ic call_if
4233 Identical to
4234 .Ic call
4235 if the given macro has been created via
4236 .Ic define ,
4237 but doesn't fail nor warn if the macro doesn't exist.
4240 .It Ic cd
4241 (ch) Change the working directory to
4242 .Ev HOME
4243 or the given argument.
4244 Synonym for
4245 .Ic chdir .
4248 .It Ic certsave
4249 \*(OP Only applicable to S/MIME signed messages.
4250 Takes a message list and a filename and saves the certificates
4251 contained within the message signatures to the named file in both
4252 human-readable and PEM format.
4253 The certificates can later be used to send encrypted messages to the
4254 respective message senders by setting
4255 .Va smime-encrypt-USER@HOST
4256 variables.
4260 .It Ic charsetalias , uncharsetalias
4261 \*(NQ Manage (character set conversion) character set alias mappings,
4262 as documented in the section
4263 .Sx "Character sets" .
4264 Character set aliases are expanded recursively, but no expansion is
4265 performed on values of the user-settable variables, e.g.,
4266 .Va charset-8bit .
4267 These are effectively no-operations if character set conversion
4268 is not available (i.e., no
4269 .Ql +iconv
4271 .Va features ) .
4272 Without arguments the list of all currently defined aliases is shown,
4273 with one argument the expansion of the given alias.
4274 Otherwise all given arguments are treated as pairs of character sets and
4275 their desired target alias name, creating new or changing already
4276 existing aliases, as necessary.
4278 The latter deletes all aliases given as arguments, the special argument
4279 .Ql *
4280 will remove all aliases.
4283 .It Ic chdir
4284 (ch) Change the working directory to
4285 .Ev HOME
4286 or the given argument.
4287 Synonym for
4288 .Ic cd .
4292 .It Ic collapse , uncollapse
4293 Only applicable to threaded mode.
4294 Takes a message list and makes all replies to these messages invisible
4295 in header summaries, except for
4296 .Ql new
4297 messages and the
4298 .Dq dot .
4299 Also when a message with collapsed replies is displayed,
4300 all of these are automatically uncollapsed.
4301 The latter command undoes collapsing.
4306 .It Ic colour , uncolour
4307 \*(OP\*(NQ Manage colour mappings of and for a
4308 .Sx "Coloured display" .
4309 The type of colour is given as the (case-insensitive) first argument,
4310 which must be one of
4311 .Ql 256
4312 for 256-colour terminals,
4313 .Ql 8 ,
4314 .Ql ansi
4316 .Ql iso
4317 for the standard 8-colour ANSI / ISO 6429 color palette and
4318 .Ql 1
4320 .Ql mono
4321 for monochrome terminals.
4322 Monochrome terminals cannot deal with colours, but only (some) font
4323 attributes.
4326 Without further arguments the list of all currently defined mappings
4327 for the given colour type is shown (as a special case giving
4328 .Ql all
4330 .Ql *
4331 will show the mappings of all types).
4332 Otherwise the second argument defines the mappable slot, and the third
4333 argument a (comma-separated list of) colour and font attribute
4334 specification(s), and the optional fourth argument can be used to
4335 specify a precondition: if conditioned mappings exist they are tested in
4336 (creation) order unless a (case-insensitive) match has been found, and
4337 the default mapping (if any has been established) will only be chosen as
4338 a last resort.
4339 The types of precondition available depend on the mappable slot (see
4340 .Sx "Coloured display"
4341 for some examples), the following of which exist:
4344 Mappings prefixed with
4345 .Ql mle-
4346 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4347 .Sx "On terminal control and line editor" )
4348 and do not support preconditions.
4350 .Bl -tag -compact -width view-partinfo
4351 .It Ar mle-position
4352 This mapping is used for the position indicator that is visible when
4353 a line cannot be fully displayed on the screen.
4354 .It Ar mle-prompt
4355 Used for the
4356 .Va prompt .
4360 Mappings prefixed with
4361 .Ql sum-
4362 are used in header summaries, and they all understand the preconditions
4363 .Ql dot
4364 (the current message) and
4365 .Ql older
4366 for elder messages (only honoured in conjunction with
4367 .Va datefield-markout-older ) .
4369 .Bl -tag -compact -width view-partinfo
4370 .It Ar sum-dotmark
4371 This mapping is used for the
4372 .Dq dotmark
4373 that can be created with the
4374 .Ql %>
4376 .Ql %<
4377 formats of the variable
4378 .Va headline .
4379 .It Ar sum-header
4380 For the complete header summary line except the
4381 .Dq dotmark
4382 and the thread structure.
4383 .It Ar sum-thread
4384 For the thread structure which can be created with the
4385 .Ql %i
4386 format of the variable
4387 .Va headline .
4391 Mappings prefixed with
4392 .Ql view-
4393 are used when displaying messages.
4395 .Bl -tag -compact -width view-partinfo
4396 .It Ar view-from_
4397 This mapping is used for so-called
4398 .Ql From_
4399 lines, which are MBOX file format specific header lines.
4400 .It Ar view-header
4401 For header lines.
4402 A comma-separated list of headers to which the mapping applies may be
4403 given as a precondition; if the \*(OPal regular expression support is
4404 available then if any of the
4405 .Dq magical
4406 (extended) regular expression characters is seen the precondition will
4407 be evaluated as (an extended) one.
4408 .It Ar view-msginfo
4409 For the introductional message info line.
4410 .It Ar view-partinfo
4411 For MIME part info lines.
4415 The following (case-insensitive) colour definitions and font attributes
4416 are understood, multiple of which can be specified in a comma-separated
4417 list:
4419 .Bl -tag -width ft=
4420 .It Ar ft=
4421 a font attribute:
4422 .Ql bold ,
4423 .Ql reverse
4425 .Ql underline .
4426 It is possible (and often applicable) to specify multiple font
4427 attributes for a single mapping.
4429 .It Ar fg=
4430 foreground colour attribute:
4431 .Ql black ,
4432 .Ql blue ,
4433 .Ql green ,
4434 .Ql red ,
4435 .Ql brown ,
4436 .Ql magenta ,
4437 .Ql cyan
4439 .Ql white .
4440 To specify a 256-color mode a decimal number colour specification in
4441 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4443 .Bl -tag -compact -width "999 - 999"
4444 .It 0 - 7
4445 the standard ISO 6429 colors, as above.
4446 .It 8 - 15
4447 high intensity variants of the standard colors.
4448 .It 16 - 231
4449 216 colors in tuples of 6.
4450 .It 232 - 255
4451 grayscale from black to white in 24 steps.
4453 .Bd -literal -offset indent
4454 #!/bin/sh -
4455 fg() { printf "\e033[38;5;${1}m($1)"; }
4456 bg() { printf "\e033[48;5;${1}m($1)"; }
4458 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4459 printf "\e033[0m\en"
4461 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4462 printf "\e033[0m\en"
4465 .It Ar bg=
4466 background colour attribute (see
4467 .Cd fg=
4468 for possible values).
4472 The command
4473 .Ic \&uncolour
4474 will remove for the given colour type (the special type
4475 .Ql *
4476 selects all) the given mapping; if the optional precondition argument is
4477 given only the exact tuple of mapping and precondition is removed.
4478 The special name
4479 .Ql *
4480 will remove all mappings (no precondition allowed), thus
4481 .Ql uncolour * *
4482 will remove all established mappings.
4487 .It Ic commandalias , uncommandalias
4488 \*(NQ Define or list, and remove, respectively, command aliases.
4489 An (command)alias can be used everywhere a normal command can be used,
4490 but always takes precedence: any arguments that are given to the command
4491 alias are joined onto the alias expansion, and the resulting string
4492 forms the command line that is, in effect, executed.
4493 The latter command removes all given aliases, the special name
4494 .Ql *
4495 will remove all existing aliases.
4496 When used without arguments the former shows a list of all currently
4497 known aliases, with one argument only the expansion of the given one.
4499 With two or more arguments a command alias is defined or updated: the
4500 first argument is the name under which the remaining command line should
4501 be accessible, the content of which can be just about anything.
4502 An alias may itself expand to another alias, but to avoid expansion loops
4503 further expansion will be prevented if an alias refers to itself or if
4504 an expansion depth limit is reached.
4505 Explicit expansion prevention is available via reverse solidus
4506 .Cm \e ,
4507 one of the
4508 .Sx "Command modifiers" .
4509 .Bd -literal -offset indent
4510 ? commandalias xx
4511 \*(uA: `commandalias': no such alias: xx
4512 ? commandalias xx echo hello,
4513 ? commandalias xx
4514 commandalias xx 'echo hello,'
4515 ? xx
4516 hello,
4517 ? xx world
4518 hello, world
4522 .It Ic Copy
4523 (C) Copy messages to files whose names are derived from the author of
4524 the respective message and do not mark them as being saved;
4525 otherwise identical to
4526 .Ic Save .
4529 .It Ic copy
4530 (c) Copy messages to the named file and do not mark them as being saved;
4531 otherwise identical to
4532 .Ic save .
4535 .It Ic cwd
4536 Show the name of the current working directory, as reported by
4537 .Xr getcwd 3 .
4538 Supports
4539 .Cm vput
4540 (see
4541 .Sx "Command modifiers" ) .
4542 The return status is tracked via
4543 .Va \&! .
4546 .It Ic Decrypt
4547 \*(OP For unencrypted messages this command is identical to
4548 .Ic Copy ;
4549 Encrypted messages are first decrypted, if possible, and then copied.
4552 .It Ic decrypt
4553 \*(OP For unencrypted messages this command is identical to
4554 .Ic copy ;
4555 Encrypted messages are first decrypted, if possible, and then copied.
4559 .It Ic define , undefine
4560 Without arguments the current list of macros, including their content,
4561 is shown, otherwise a macro is defined, replacing an existing macro of
4562 the same name.
4563 A macro definition is a sequence of commands in the following form:
4564 .Bd -literal -offset indent
4565 define name {
4566   command1
4567   command2
4568   ...
4569   commandN
4573 A defined macro can be invoked explicitly by using the
4574 .Ic call ,
4575 .Ic call_if
4577 .Ic xcall
4578 commands, or implicitly if a macro hook is triggered, e.g., a
4579 .Va folder-hook .
4580 It is possible to localize adjustments, like creation, deletion and
4581 modification of
4582 .Sx "INTERNAL VARIABLES" ,
4583 by using the
4584 .Ic localopts
4585 command; the scope which is localized depends on how (i.e.,
4586 .Dq as what :
4587 normal macro, folder hook, hook,
4588 .Ic account
4589 switch) the macro is invoked.
4590 Execution of a macro body can be stopped from within by calling
4591 .Ic return .
4592 Inside a
4593 .Ic call Ns
4594 ed macro, given positional parameters can be
4595 .Ic shift Ns
4596 ed, or become completely replaced, removed etc. via
4597 .Ic vpospar .
4599 The latter command deletes the given macro, the special name
4600 .Ql *
4601 will discard all existing macros.
4602 Creation and deletion of (a) macro(s) can be performed from within
4603 a running macro.
4607 .It Ic delete , undelete
4608 (d, u) Marks the given message list as being or not being
4609 .Ql deleted ,
4610 respectively; if no argument has been specified then the usual search
4611 for a visible message is performed, as documented for
4612 .Sx "Message list arguments" ,
4613 showing only the next input prompt if the search fails.
4614 Deleted messages will neither be saved in the
4615 .Mx -sx
4616 .Sx "secondary mailbox"
4617 .Ev MBOX
4618 nor will they be available for most other commands.
4619 If the
4620 .Va autoprint
4621 variable is set, the new
4622 .Dq dot
4623 or the last message restored, respectively, is automatically
4624 .Ic type Ns
4625 d; also see
4626 .Ic dp ,
4627 .Ic dt .
4630 .It Ic discard
4631 (di) Identical to
4632 .Ic ignore .
4633 Superseded by the multiplexer
4634 .Ic headerpick .
4638 .It Ic dp , dt
4639 Delete the given messages and automatically
4640 .Ic type
4641 the new
4642 .Dq dot
4643 if one exists, regardless of the setting of
4644 .Va autoprint .
4647 .It Ic dotmove
4648 Move the
4649 .Dq dot
4650 up or down by one message when given
4651 .Ql +
4653 .Ql -
4654 argument, respectively.
4658 .It Ic draft , undraft
4659 Take message lists and mark each given message as being draft, or not
4660 being draft, respectively, as documented in the section
4661 .Sx "Message states" .
4664 .It Ic echo
4665 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4666 newline, whereas the otherwise identical
4667 .Ic echon
4668 does not.
4669 .Sx "Shell-style argument quoting"
4670 is used,
4671 .Sx "Filename transformations"
4672 are applied to the expanded arguments.
4673 This command also supports
4674 .Cm vput
4675 as documented in
4676 .Sx "Command modifiers" ,
4677 and manages the error number
4678 .Va \&! :
4679 if data is stored in a variable then the return value reflects the
4680 length of the result string in case of success and is
4681 .Ql -1
4682 on error.
4685 .It Ic echoerr
4686 \*(NQ Identical to
4687 .Ic echo
4688 except that is echoes to standard error.
4689 Also see
4690 .Ic echoerrn .
4691 In interactive sessions the \*(OPal message ring queue for
4692 .Ic errors
4693 will be used instead, if available and
4694 .Cm vput
4695 was not used.
4698 .It Ic echon
4699 \*(NQ Identical to
4700 .Ic echo ,
4701 but does not write or store a trailing newline.
4704 .It Ic echoerrn
4705 \*(NQ Identical to
4706 .Ic echoerr ,
4707 but does not write or store a trailing newline.
4710 .It Ic edit
4711 (e) Point the text editor (as defined in
4712 .Ev EDITOR )
4713 at each message from the given list in turn.
4714 Modified contents are discarded unless the
4715 .Va writebackedited
4716 variable is set, and are not used unless the mailbox can be written to
4717 and the editor returns a successful exit status.
4720 .It Ic elif
4721 Part of the
4722 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4723 conditional \(em if the condition of a preceding
4724 .Ic if
4725 was false, check the following condition and execute the following block
4726 if it evaluates true.
4729 .It Ic else
4730 (el) Part of the
4731 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4732 conditional \(em if none of the conditions of the preceding
4733 .Ic if
4735 .Ic elif
4736 commands was true, the
4737 .Ic else
4738 block is executed.
4741 .It Ic endif
4742 (en) Marks the end of an
4743 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4744 conditional execution block.
4748 .It Ic environ
4749 \*(NQ \*(UA has a strict notion about which variables are
4750 .Sx "INTERNAL VARIABLES"
4751 and which are managed in the program
4752 .Sx ENVIRONMENT .
4753 Since some of the latter are a vivid part of \*(UAs functioning,
4754 however, they are transparently integrated into the normal handling of
4755 internal variables via
4756 .Ic set
4758 .Ic unset .
4759 To integrate other environment variables of choice into this
4760 transparent handling, and also to export internal variables into the
4761 process environment where they normally are not, a
4762 .Ql link
4763 needs to become established with this command, as in, e.g.,
4766 .Dl environ link PERL5LIB TZ
4769 Afterwards changing such variables with
4770 .Ic set
4771 will cause automatic updates of the program environment, and therefore
4772 be inherited by newly created child processes.
4773 Sufficient system support provided (it was in BSD as early as 1987, and
4774 is standardized since Y2K) removing such variables with
4775 .Ic unset
4776 will remove them also from the program environment, but in any way
4777 the knowledge they ever have been
4778 .Ql link Ns
4779 ed will be lost.
4780 Note that this implies that
4781 .Ic localopts
4782 may cause loss of such links.
4785 The command
4786 .Ql unlink
4787 will remove an existing link, but leaves the variables as such intact.
4788 Additionally the subcommands
4789 .Ql set
4791 .Ql unset
4792 are provided, which work exactly the same as the documented commands
4793 .Ic set
4795 .Ic unset ,
4796 but (additionally un)link the variable(s) with the program environment
4797 and thus immediately export them to, or remove them from (if possible),
4798 respectively, the program environment.
4802 .It Ic errors
4803 \*(OP Since \*(UA uses the console as a user interface it can happen
4804 that messages scroll by too fast to become recognized.
4805 An error message ring queue is available which stores duplicates of any
4806 error message and notifies the user in interactive sessions whenever
4807 a new error has occurred.
4808 The queue is finite: if its maximum size is reached any new message
4809 replaces the eldest.
4810 The command
4811 .Ic errors
4812 can be used to manage this message queue: if given
4813 .Ar show
4814 or no argument the queue will be displayed and cleared,
4815 .Ar clear
4816 will only clear all messages from the queue.
4819 .It Ic eval
4820 \*(NQ Construct a command by concatenating the arguments, separated with
4821 a single space character, and then evaluate the result.
4822 This command passes through the exit status
4823 .Va \&?
4824 and error number
4825 .Va \&!
4826 of the evaluated command; also see
4827 .Ic call .
4828 .Bd -literal -offset indent
4829 define xxx {
4830   echo "xxx arg <$1>"
4831   shift
4832   if [ $# -gt 0 ]
4833     \excall xxx "$@"
4834   endif
4836 define yyy {
4837   eval "$@ ' ball"
4839 call yyy '\ecall xxx' "b\e$'\et'u ' "
4840 call xxx arg <b      u>
4841 call xxx arg <  >
4842 call xxx arg <ball>
4846 .It Ic exit
4847 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4848 any saving of messages in the
4849 .Mx -sx
4850 .Sx "secondary mailbox"
4851 .Ev MBOX ,
4852 as well as a possibly tracked line editor
4853 .Va history-file .
4854 The optional status number argument will be passed through to
4855 .Xr exit 3 .
4856 \*(ID For now it can happen that the given status will be overwritten,
4857 later this will only occur if a later error needs to be reported onto an
4858 otherwise success indicating status.
4861 .It Ic File
4862 (Fi) Like
4863 .Ic file ,
4864 but open the mailbox read-only.
4868 .It Ic file
4869 (fi) The file command switches to a new mailbox.
4870 Without arguments it shows status information of the current mailbox.
4871 If an argument is given, it will write out changes (such as deletions)
4872 the user has made, open a new mailbox, update the internal variables
4873 .Va mailbox-resolved
4875 .Va mailbox-display ,
4876 and optionally display a summary of
4877 .Ic headers
4878 if the variable
4879 .Va header
4880 is set.
4883 .Sx "Filename transformations"
4884 will be applied to the
4885 .Ar name
4886 argument, and
4887 .Ql protocol://
4888 prefixes are, i.e., URL syntax is understood, e.g.,
4889 .Ql maildir:///tmp/mdirbox :
4890 if a protocol prefix is used the mailbox type is fixated and neither
4891 the auto-detection (read on) nor the
4892 .Va newfolders
4893 mechanisms apply.
4894 \*(OPally URLs can also be used to access network resources, which may
4895 be accessed securely via
4896 .Sx "Encrypted network communication"
4897 if so supported, and it is possible to proxy all network traffic over
4898 a SOCKS5 server given via
4899 .Va socks-proxy .
4902 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4903 .Dl \*(OU protocol://[user@]host[:port][/path]
4906 \*(OPally supported network protocols are
4907 .Ar pop3
4908 (POP3) and
4909 .Ar pop3s
4910 (POP3 with SSL/TLS encrypted transport),
4911 .Ar imap
4913 .Ar imaps .
4915 .Ar [/path]
4916 part is valid only for IMAP; there it defaults to
4917 .Ar INBOX .
4918 Network URLs require a special encoding as documented in the section
4919 .Sx "On URL syntax and credential lookup" .
4922 If the resulting file protocol (MBOX database)
4923 .Ar name
4924 is located on a local filesystem then the list of all registered
4925 .Ic filetype Ns
4926 s is traversed in order to see whether a transparent intermediate
4927 conversion step is necessary to handle the given mailbox, in which case
4928 \*(UA will use the found hook to load and save data into and from
4929 a temporary file, respectively.
4930 Changing hooks will not affect already opened mailboxes.
4931 For example, the following creates hooks for the
4932 .Xr gzip 1
4933 compression tool and a combined compressed and encrypted format:
4935 .Bd -literal -offset indent
4936 ? filetype \e
4937     gzip 'gzip -dc' 'gzip -c' \e
4938     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4942 MBOX database files are generally locked during file operations in order
4943 to avoid inconsistencies due to concurrent modifications.
4944 \*(OPal Mailbox files which \*(UA treats as the system
4945 .Va inbox
4946 .Pf ( Ev MAIL ) ,
4948 .Mx -sx
4949 .Sx "primary system mailbox" Ns
4950 es in general will also be protected by so-called dotlock files, the
4951 traditional way of mail spool file locking: for any file
4952 .Ql a
4953 a lock file
4954 .Ql a.lock
4955 will be created for the duration of the synchronization \(em
4956 as necessary a privilege-separated dotlock child process will be used
4957 to accommodate for necessary privilege adjustments in order to create
4958 the dotlock file in the same directory
4959 and with the same user and group identities as the file of interest.
4962 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4963 files, but it will detect invalid message boundaries in this mode and
4964 complain (even more with
4965 .Va debug )
4966 if any is seen: in this case
4967 .Va mbox-rfc4155
4968 can be used to create a valid MBOX database from the invalid input.
4971 If no protocol has been fixated, and
4972 .Ar name
4973 refers to a directory with the subdirectories
4974 .Ql tmp ,
4975 .Ql new
4977 .Ql cur ,
4978 then it is treated as a folder in
4979 .Dq Maildir
4980 format.
4981 The maildir format stores each message in its own file, and has been
4982 designed so that file locking is not necessary when reading or writing
4983 files.
4986 \*(ID If no protocol has been fixated and no existing file has
4987 been found, the variable
4988 .Va newfolders
4989 controls the format of mailboxes yet to be created.
4994 .It Ic filetype , unfiletype
4995 \*(NQ Define or list, and remove, respectively, file handler hooks,
4996 which provide (shell) commands that enable \*(UA to load and save MBOX
4997 files from and to files with the registered file extensions;
4998 it will use an intermediate temporary file to store the plain data.
4999 The latter command removes the hooks for all given extensions,
5000 .Ql *
5001 will remove all existing handlers.
5003 When used without arguments the former shows a list of all currently
5004 defined file hooks, with one argument the expansion of the given alias.
5005 Otherwise three arguments are expected, the first specifying the file
5006 extension for which the hook is meant, and the second and third defining
5007 the load- and save commands, respectively, to deal with the file type,
5008 both of which must read from standard input and write to standard
5009 output.
5010 Changing hooks will not affect already opened mailboxes (\*(ID except below).
5011 \*(ID For now too much work is done, and files are oftened read in twice
5012 where once would be sufficient: this can cause problems if a filetype is
5013 changed while such a file is opened; this was already so with the
5014 built-in support of .gz etc. in Heirloom, and will vanish in v15.
5015 \*(ID For now all handler strings are passed to the
5016 .Ev SHELL for evaluation purposes; in the future a
5017 .Ql \&!
5018 prefix to load and save commands may mean to bypass this shell instance:
5019 placing a leading space will avoid any possible misinterpretations.
5020 .Bd -literal -offset indent
5021 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
5022     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
5023     zst 'zstd -dc' 'zstd -19 -zc' \e
5024     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
5025 ? set record=+sent.zst.pgp
5030 .It Ic flag , unflag
5031 Take message lists and mark the messages as being flagged, or not being
5032 flagged, respectively, for urgent/special attention.
5033 See the section
5034 .Sx "Message states" .
5037 .It Ic folder
5038 (fold) The same as
5039 .Ic file .
5042 .It Ic folders
5043 With no arguments, list the names of the folders in the folder directory.
5044 With an existing folder as an argument,
5045 lists the names of folders below the named folder.
5048 .It Ic Followup
5049 (F) Similar to
5050 .Ic Respond ,
5051 but saves the message in a file named after the local part of the first
5052 recipient's address (instead of in
5053 .Va record Ns ).
5056 .It Ic followup
5057 (fo) Similar to
5058 .Ic respond ,
5059 but saves the message in a file named after the local part of the first
5060 recipient's address (instead of in
5061 .Va record Ns ).
5064 .It Ic followupall
5065 Similar to
5066 .Ic followup ,
5067 but responds to all recipients regardless of the
5068 .Va flipr
5069 variable.
5072 .It Ic followupsender
5073 Similar to
5074 .Ic Followup ,
5075 but responds to the sender only regardless of the
5076 .Va flipr
5077 variable.
5080 .It Ic Forward
5081 Similar to
5082 .Ic forward ,
5083 but saves the message in a file named after the local part of the
5084 recipient's address (instead of in
5085 .Va record Ns ).
5088 .It Ic forward
5089 Takes a message and the address of a recipient
5090 and forwards the message to him.
5091 The text of the original message is included in the new one,
5092 with the value of the
5093 .Va forward-inject-head
5094 variable preceding it.
5095 To filter the included header fields to the desired subset use the
5096 .Ql forward
5097 slot of the white- and blacklisting command
5098 .Ic headerpick .
5099 Only the first part of a multipart message is included unless
5100 .Va forward-as-attachment ,
5101 and recipient addresses will be stripped from comments, names
5102 etc. unless the internal variable
5103 .Va fullnames
5104 is set.
5106 This may generate the errors
5107 .Va ^ERR Ns -DESTADDRREQ
5108 if no receiver has been specified,
5109 .Va ^ERR Ns -PERM
5110 if some addressees where rejected by
5111 .Va expandaddr ,
5112 .Va ^ERR Ns -NODATA
5113 if no applicable messages have been given,
5114 .Va ^ERR Ns -NOTSUP
5115 if multiple messages have been specified,
5116 .Va ^ERR Ns -IO
5117 if an I/O error occurs,
5118 .Va ^ERR Ns -NOTSUP
5119 if a necessary character set conversion fails, and
5120 .Va ^ERR Ns -INVAL
5121 for other errors.
5124 .It Ic from
5125 (f) Takes a list of message specifications and displays a summary of
5126 their message headers, exactly as via
5127 .Ic headers .
5128 An alias of this command is
5129 .Ic search .
5130 Also see
5131 .Sx "Specifying messages" .
5133 .It Ic Fwd
5134 \*(OB Alias for
5135 .Ic Forward .
5137 .It Ic fwd
5138 \*(OB Alias for
5139 .Ic forward .
5141 .It Ic fwdignore
5142 \*(OB Superseded by the multiplexer
5143 .Ic headerpick .
5145 .It Ic fwdretain
5146 \*(OB Superseded by the multiplexer
5147 .Ic headerpick .
5149 .It Ic ghost , unghost
5150 \*(OB Replaced by
5151 .Ic commandalias ,
5152 .Ic uncommandalias .
5156 .It Ic headerpick , unheaderpick
5157 \*(NQ Multiplexer command to manage white- and blacklisting
5158 selections of header fields for a variety of applications.
5159 Without arguments the set of contexts that have settings is displayed.
5160 When given arguments, the first argument is the context to which the
5161 command applies, one of (case-insensitive)
5162 .Ql type
5163 for display purposes (via, e.g.,
5164 .Ic type ) ,
5165 .Ql save
5166 for selecting which headers shall be stored persistently when
5167 .Ic save ,
5168 .Ic copy ,
5169 .Ic move
5170 or even
5171 .Ic decrypt Ns
5172 ing messages (note that MIME related etc. header fields should not be
5173 ignored in order to not destroy usability of the message in this case),
5174 .Ql forward
5175 for stripping down messages when
5176 .Ic forward Ns
5177 ing message (has no effect if
5178 .Va forward-as-attachment
5179 is set), and
5180 .Ql top
5181 for defining user-defined set of fields for the command
5182 .Ic top .
5184 The current settings of the given context are displayed if it is the
5185 only argument.
5186 A second argument denotes the type of restriction that is to be chosen,
5187 it may be (a case-insensitive prefix of)
5188 .Ql retain
5190 .Ql ignore
5191 for white- and blacklisting purposes, respectively.
5192 Establishing a whitelist suppresses inspection of the corresponding
5193 blacklist.
5195 If no further argument is given the current settings of the given type
5196 will be displayed, otherwise the remaining arguments specify header
5197 fields, which \*(OPally may be given as regular expressions, to be added
5198 to the given type.
5199 The special wildcard field (asterisk,
5200 .Ql * )
5201 will establish a (fast) shorthand setting which covers all fields.
5203 The latter command always takes three or more arguments and can be used
5204 to remove selections, i.e., from the given context, the given type of
5205 list, all the given headers will be removed, the special argument
5206 .Ql *
5207 will remove all headers.
5210 .It Ic headers
5211 (h) Show the current group of headers, the size of which depends on
5212 the variable
5213 .Va screen ,
5214 and the style of which can be adjusted with the variable
5215 .Va headline .
5216 If a message-specification is given the group of headers containing the
5217 first message therein is shown and the message at the top of the screen
5218 becomes the new
5219 .Dq dot .
5222 .It Ic help
5223 (hel) A synonym for
5224 .Ic \&? .
5227 .It Ic history
5228 \*(OP Either
5229 .Cm show
5230 (this mode also supports a more
5231 .Va verbose
5232 output) or
5233 .Cm clear
5234 the list of history entries;
5235 a decimal
5236 .Ar NUMBER
5237 argument selects and evaluates the respective history entry,
5238 which will become the new history top; a negative number is used as an
5239 offset to the current command, e.g.,
5240 .Ql -1
5241 will select the last command, the history top.
5242 The default mode if no arguments are given is
5243 .Cm show .
5244 Please see
5245 .Sx "On terminal control and line editor"
5246 for more on this topic.
5249 .It Ic hold
5250 (ho, also
5251 .Ic preserve )
5252 Takes a message list and marks each message therein to be saved in the
5253 user's system
5254 .Va inbox
5255 instead of in the
5256 .Mx -sx
5257 .Sx "secondary mailbox"
5258 .Ev MBOX .
5259 Does not override the
5260 .Ic delete
5261 command.
5262 \*(UA deviates from the POSIX standard with this command, because a
5263 .Ic next
5264 command issued after
5265 .Ic hold
5266 will display the following message, not the current one.
5270 .It Ic if
5271 (i) Part of the nestable
5272 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
5273 conditional execution construct \(em if the given condition is true then
5274 the encapsulated block is executed.
5275 The POSIX standards supports the (case-insensitive) conditions
5276 .Ql r Ns
5277 eceive
5279 .Ql s Ns
5280 end, all remaining conditions are non-portable extensions.
5281 \*(ID These commands do not yet use
5282 .Sx "Shell-style argument quoting"
5283 and therefore do not know about input tokens, so that syntax
5284 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5285 all conditions bracket group wise and consider the tokens, representing
5286 values and operators, therein, which also means that variables will
5287 already have been expanded at that time (just like in the shell).
5289 .Bd -literal -offset indent
5290 if receive
5291   commands ...
5292 else
5293   commands ...
5294 endif
5298 The (case-insensitive) condition
5299 .Ql t Ns
5300 erminal will evaluate to true if the standard input is a terminal, i.e.,
5301 in interactive sessions.
5302 Another condition can be any boolean value (see the section
5303 .Sx "INTERNAL VARIABLES"
5304 for textual boolean representations) to mark an enwrapped block as
5305 .Dq never execute
5307 .Dq always execute .
5308 (It shall be remarked that a faulty condition skips all branches until
5309 .Ic endif . )
5312 (\*(ID In v15
5313 .Sx "Shell-style argument quoting"
5314 will be used, and this command will simply interpret expanded tokens.)
5315 It is possible to check
5316 .Sx "INTERNAL VARIABLES"
5317 as well as
5318 .Sx ENVIRONMENT
5319 variables for existence or compare their expansion against a user given
5320 value or another variable by using the
5321 .Ql $
5322 .Pf ( Dq variable next )
5323 conditional trigger character;
5324 a variable on the right hand side may be signalled using the same
5325 mechanism.
5326 Variable names may be enclosed in a pair of matching braces.
5327 When this mode has been triggered, several operators are available:
5330 Integer operators treat the arguments on the left and right hand side of
5331 the operator as integral numbers and compare them arithmetically.
5332 It is an error if any of the operands is not a valid integer, an empty
5333 argument (which implies it had been quoted) is treated as if it were 0.
5334 Available operators are
5335 .Ql -lt
5336 (less than),
5337 .Ql -le
5338 (less than or equal to),
5339 .Ql -eq
5340 (equal),
5341 .Ql -ne
5342 (not equal),
5343 .Ql -ge
5344 (greater than or equal to), and
5345 .Ql -gt
5346 (greater than).
5349 String data operators compare the left and right hand side according to
5350 their textual content.
5351 Unset variables are treated as the empty string.
5352 The behaviour of string operators can be adjusted by prefixing the
5353 operator with the modifier trigger commercial at
5354 .Ql @ ,
5355 followed by none to multiple modifiers: for now supported is
5356 .Ql i ,
5357 which turns the comparison into a case-insensitive one: this is
5358 implied if no modifier follows the trigger.
5361 Available string operators are
5362 .Ql <
5363 (less than),
5364 .Ql <=
5365 (less than or equal to),
5366 .Ql ==
5367 (equal),
5368 .Ql !=
5369 (not equal),
5370 .Ql >=
5371 (greater than or equal to),
5372 .Ql >
5373 (greater than),
5374 .Ql =%
5375 (is substring of) and
5376 .Ql !%
5377 (is not substring of).
5378 By default these operators work on bytes and (therefore) do not take
5379 into account character set specifics.
5380 If the case-insensitivity modifier has been used, case is ignored
5381 according to the rules of the US-ASCII encoding, i.e., bytes are
5382 still compared.
5385 When the \*(OPal regular expression support is available, the additional
5386 string operators
5387 .Ql =~
5389 .Ql !~
5390 can be used.
5391 They treat the right hand side as an extended regular expression that is
5392 matched according to the active locale (see
5393 .Sx "Character sets" ) ,
5394 i.e., character sets should be honoured correctly.
5397 Conditions can be joined via AND-OR lists (where the AND operator is
5398 .Ql &&
5399 and the OR operator is
5400 .Ql || ) ,
5401 which have equal precedence and will be evaluated with left
5402 associativity, thus using the same syntax that is known for the
5403 .Xr sh 1 .
5404 It is also possible to form groups of conditions and lists by enclosing
5405 them in pairs of brackets
5406 .Ql [\ \&.\&.\&.\ ] ,
5407 which may be interlocked within each other, and also be joined via
5408 AND-OR lists.
5411 The results of individual conditions and entire groups may be modified
5412 via unary operators: the unary operator
5413 .Ql \&!
5414 will reverse the result.
5416 .Bd -literal -offset indent
5417 # (This not in v15, there [ -n "$debug"]!)
5418 if $debug
5419   echo *debug* is set
5420 endif
5421 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
5422   echo *ttycharset* is UTF-8, the former case-sensitive!
5423 endif
5424 set t1=one t2=one
5425 if [ "${t1}" == "${t2}" ]
5426   echo These two variables are equal
5427 endif
5428 if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm\&.*" ]
5429   echo ..in an X terminal
5430 endif
5431 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5432     [ "$verbose" != '' ] ] ]
5433   echo Noisy, noisy
5434 endif
5435 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5436   echo Left associativity, as is known from the shell
5437 endif
5442 .It Ic ignore
5443 (ig) Identical to
5444 .Ic discard .
5445 Superseded by the multiplexer
5446 .Ic headerpick .
5449 .It Ic list
5450 Shows the names of all available commands, alphabetically sorted.
5451 If given any non-whitespace argument the list will be shown in the order
5452 in which command prefixes are searched.
5453 \*(OP In conjunction with a set variable
5454 .Va verbose
5455 additional information will be provided for each command: the argument
5456 type will be indicated, the documentation string will be shown,
5457 and the set of command flags will show up:
5459 .Bl -tag -compact -width ".It Ql BaNg"
5460 .It Ql "vput modifier"
5461 command supports the command modifier
5462 .Cm vput .
5463 .It Ql "errno in *!*"
5464 the error number is tracked in
5465 .Va \&! .
5466 .It Ql "needs box"
5467 commands needs an active mailbox, a
5468 .Ic file .
5469 .It Ql "ok: batch or interactive"
5470 command may only be used in interactive or
5471 .Fl #
5472 batch mode.
5473 .It Ql "ok: send mode"
5474 command can be used in send mode.
5475 .It Ql "not ok: compose mode"
5476 command is not available when in compose mode.
5477 .It Ql "not ok: during startup"
5478 command cannot be used during program startup, e.g., while loading
5479 .Sx "Resource files" .
5480 .It Ql "ok: in subprocess"
5481 command is allowed to be used when running in a subprocess instance,
5482 e.g., from within a macro that is called via
5483 .Va on-compose-splice .
5488 .It Ic localopts
5489 This command can be used to localize changes to (linked)
5490 .Sx ENVIRONMENT
5491 as well as
5492 .Sx "INTERNAL VARIABLES" ,
5493 meaning that their state will be reverted to the former one once the
5494 .Dq covered scope
5495 is left.
5496 \*(ID Note in the future the coverage may be extended to none or any of
5497 .Ic alias ,
5498 .Ic alternates ,
5499 .Ic charsetalias ,
5500 .Ic commandalias ,
5501 .Ic filetype ,
5502 .Ic mlist ,
5503 .Ic mlsubscribe ,
5504 .Ic shortcut ,
5505 to name a few.
5506 It can only be used inside of macro definition blocks introduced by
5507 .Ic account
5509 .Ic define .
5510 The covered scope of an
5511 .Ic account
5512 is left once a different account is activated, and some macros, notably
5513 .Va folder-hook Ns s ,
5514 use their own specific notion of covered scope, here it will be extended
5515 until the folder is left again.
5518 This setting stacks up: i.e., if
5519 .Ql macro1
5520 enables change localization and calls
5521 .Ql macro2 ,
5522 which explicitly resets localization, then any value changes within
5523 .Ql macro2
5524 will still be reverted when the scope of
5525 .Ql macro1
5526 is left.
5527 (Caveats: if in this example
5528 .Ql macro2
5529 changes to a different
5530 .Ic account
5531 which sets some variables that are already covered by localizations,
5532 their scope will be extended, and in fact leaving the
5533 .Ic account
5534 will (thus) restore settings in (likely) global scope which actually
5535 were defined in a local, macro private context!)
5538 This command takes one or two arguments, the optional first one
5539 specifies an attribute that may be one of
5540 .Cm scope ,
5541 which refers to the current scope and is thus the default,
5542 .Cm call ,
5543 which causes any macro that is being
5544 .Ic call Ns
5545 ed to be started with localization enabled by default, as well as
5546 .Cm call-fixate ,
5547 which (if enabled) disallows any called macro to turn off localization:
5548 like this it can be ensured that once the current scope regains control,
5549 any changes made in deeper levels have been reverted.
5550 The latter two are mutually exclusive.
5551 The (second) argument is interpreted as a boolean (string, see
5552 .Sx "INTERNAL VARIABLES" )
5553 and states whether the given attribute shall be turned on or off.
5555 .Bd -literal -offset indent
5556 define temporary_settings {
5557   set possibly_global_option1
5558   localopts on
5559   set local_option1
5560   set local_option2
5561   localopts scope off
5562   set possibly_global_option2
5568 .It Ic Lreply
5569 Reply to messages that come in via known
5570 .Pf ( Ic mlist )
5571 or subscribed
5572 .Pf ( Ic mlsubscribe )
5573 mailing lists, or pretend to do so (see
5574 .Sx "Mailing lists" ) :
5575 on top of the usual
5576 .Ic reply
5577 functionality this will actively resort and even remove message
5578 recipients in order to generate a message that is supposed to be sent to
5579 a mailing list.
5580 For example it will also implicitly generate a
5581 .Ql Mail-Followup-To:
5582 header if that seems useful, regardless of the setting of the variable
5583 .Va followup-to .
5584 For more documentation please refer to
5585 .Sx "On sending mail, and non-interactive mode" .
5587 This may generate the errors
5588 .Va ^ERR Ns -DESTADDRREQ
5589 if no receiver has been specified,
5590 .Va ^ERR Ns -PERM
5591 if some addressees where rejected by
5592 .Va expandaddr ,
5593 .Va ^ERR Ns -NODATA
5594 if no applicable messages have been given,
5595 .Va ^ERR Ns -IO
5596 if an I/O error occurs,
5597 .Va ^ERR Ns -NOTSUP
5598 if a necessary character set conversion fails, and
5599 .Va ^ERR Ns -INVAL
5600 for other errors.
5601 Any error stops processing of further messages.
5604 .It Ic Mail
5605 Similar to
5606 .Ic mail ,
5607 but saves the message in a file named after the local part of the first
5608 recipient's address (instead of in
5609 .Va record Ns ).
5612 .It Ic mail
5613 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5614 or asks on standard input if none were given;
5615 then collects the remaining mail content and sends it out.
5616 Unless the internal variable
5617 .Va fullnames
5618 is set recipient addresses will be stripped from comments, names etc.
5619 For more documentation please refer to
5620 .Sx "On sending mail, and non-interactive mode" .
5622 This may generate the errors
5623 .Va ^ERR Ns -DESTADDRREQ
5624 if no receiver has been specified,
5625 .Va ^ERR Ns -PERM
5626 if some addressees where rejected by
5627 .Va expandaddr ,
5628 .Va ^ERR Ns -NODATA
5629 if no applicable messages have been given,
5630 .Va ^ERR Ns -NOTSUP
5631 if multiple messages have been specified,
5632 .Va ^ERR Ns -IO
5633 if an I/O error occurs,
5634 .Va ^ERR Ns -NOTSUP
5635 if a necessary character set conversion fails, and
5636 .Va ^ERR Ns -INVAL
5637 for other errors.
5640 .It Ic mbox
5641 (mb) The given message list is to be sent to the
5642 .Mx -sx
5643 .Sx "secondary mailbox"
5644 .Ev MBOX
5645 when \*(UA is quit; this is the default action unless the variable
5646 .Va hold
5647 is set.
5648 \*(ID This command can only be used in a
5649 .Mx -sx
5650 .Sx "primary system mailbox" .
5654 .It Ic mimetype , unmimetype
5655 Without arguments the content of the MIME type cache will displayed;
5656 a more verbose listing will be produced if either of
5657 .Va debug
5659 .Va verbose
5660 are set.
5661 When given arguments they will be joined, interpreted as shown in
5662 .Sx "The mime.types files"
5663 (also see
5664 .Sx "HTML mail and MIME attachments" ) ,
5665 and the resulting entry will be added (prepended) to the cache.
5666 In any event MIME type sources are loaded first as necessary \(en
5667 .Va mimetypes-load-control
5668 can be used to fine-tune which sources are actually loaded.
5670 The latter command deletes all specifications of the given MIME type, thus
5671 .Ql ? unmimetype text/plain
5672 will remove all registered specifications for the MIME type
5673 .Ql text/plain .
5674 The special name
5675 .Ql *
5676 will discard all existing MIME types, just as will
5677 .Ql reset ,
5678 but which also reenables cache initialization via
5679 .Va mimetypes-load-control .
5683 .It Ic mlist , unmlist
5684 The latter command removes all given mailing-lists, the special name
5685 .Ql *
5686 can be used to remove all registered lists.
5687 The former will list all currently defined mailing lists (and their
5688 attributes, if any) when used without arguments; a more verbose listing
5689 will be produced if either of
5690 .Va debug
5692 .Va verbose
5693 are set.
5694 Otherwise all given arguments will be added and henceforth be recognized
5695 as mailing lists.
5696 If the \*(OPal regular expression support is available then mailing
5697 lists may also be specified as (extended) regular expressions (see
5698 .Xr re_format 7
5699 for more on those).
5701 .Ic mlsubscribe
5702 pair of commands manages subscription attributes of mailing-lists.
5705 .It Ic mimeview
5706 \*(ID Only available in interactive mode, this command allows to display
5707 MIME parts which require external MIME handler programs to run which do
5708 not integrate in \*(UAs normal
5709 .Ic type
5710 output (see
5711 .Sx "HTML mail and MIME attachments" ) .
5712 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5713 The user will be asked for each non-text part of the given message in
5714 turn whether the registered handler shall be used to display the part.
5718 .It Ic mlsubscribe , unmlsubscribe
5719 The latter command removes the subscription attribute from all given
5720 mailing-lists, the special name
5721 .Ql *
5722 can be used to do so for any registered list.
5723 The former will list all currently defined mailing lists which have
5724 a subscription attribute when used without arguments; a more verbose
5725 listing will be produced if either of
5726 .Va debug
5728 .Va verbose
5729 are set.
5730 Otherwise this attribute will be set for all given mailing lists,
5731 newly creating them as necessary (as via
5732 .Ic mlist ) .
5733 Also see
5734 .Va followup-to .
5737 .It Ic Move
5738 Similar to
5739 .Ic move ,
5740 but moves the messages to a file named after the local part of the
5741 sender address of the first message (instead of in
5742 .Va record Ns ).
5745 .It Ic move
5746 Acts like
5747 .Ic copy
5748 but marks the messages for deletion if they were transferred
5749 successfully.
5752 .It Ic More
5753 Like
5754 .Ic more ,
5755 but also displays header fields which would not pass the
5756 .Ic headerpick
5757 selection, and all MIME parts.
5758 Identical to
5759 .Ic Page .
5762 .It Ic more
5763 Invokes the
5764 .Ev PAGER
5765 on the given messages, even in non-interactive mode and as long as the
5766 standard output is a terminal.
5767 Identical to
5768 .Ic page .
5771 .It Ic netrc
5772 \*(OP When used without arguments or if
5773 .Ar show
5774 has been given the content of the
5775 .Pa .netrc
5776 cache is shown, loading it first as necessary.
5777 If the argument is
5778 .Ar load
5779 then the cache will only be initialized and
5780 .Ar clear
5781 will remove its contents.
5782 Note that \*(UA will try to load the file only once, use
5783 .Ql Ic \&\&netrc Ns \:\0\:clear
5784 to unlock further attempts.
5786 .Va netrc-lookup ,
5787 .Va netrc-pipe
5788 and the section
5789 .Sx "On URL syntax and credential lookup" ;
5790 the section
5791 .Sx "The .netrc file"
5792 documents the file format in detail.
5795 .It Ic newmail
5796 Checks for new mail in the current folder without committing any changes
5797 before.
5798 If new mail is present, a message is shown.
5799 If the
5800 .Va header
5801 variable is set,
5802 the headers of each new message are also shown.
5803 This command is not available for all mailbox types.
5806 .It Ic next
5807 (n) (like
5808 .Ql +
5810 .Dq ENTER )
5811 Goes to the next message in sequence and types it.
5812 With an argument list, types the next matching message.
5815 .It Ic New
5816 Same as
5817 .Ic Unread .
5820 .It Ic new
5821 Same as
5822 .Ic unread .
5825 .It Ic noop
5826 If the current folder is accessed via a network connection, a
5827 .Dq NOOP
5828 command is sent, otherwise no operation is performed.
5831 .It Ic Page
5832 Like
5833 .Ic page ,
5834 but also displays header fields which would not pass the
5835 .Ic headerpick
5836 selection, and all MIME parts.
5837 Identical to
5838 .Ic More .
5841 .It Ic page
5842 Invokes the
5843 .Ev PAGER
5844 on the given messages, even in non-interactive mode and as long as the
5845 standard output is a terminal.
5846 Identical to
5847 .Ic more .
5850 .It Ic Pipe
5851 Like
5852 .Ic pipe
5853 but also pipes header fields which would not pass the
5854 .Ic headerpick
5855 selection, and all parts of MIME
5856 .Ql multipart/alternative
5857 messages.
5860 .It Ic pipe
5861 (pi) Takes a message list and a shell command
5862 and pipes the messages through the command.
5863 Without an argument the current message is piped through the command
5864 given by the
5865 .Va cmd
5866 variable.
5867 If the
5868 .Va page
5869 variable is set,
5870 every message is followed by a formfeed character.
5873 .It Ic preserve
5874 (pre) A synonym for
5875 .Ic hold .
5878 .It Ic Print
5879 (P) Alias for
5880 .Ic Type .
5883 .It Ic print
5884 (p) Research
5886 equivalent of
5887 .Ic type .
5890 .It Ic quit
5891 (q) Terminates the session, saving all undeleted, unsaved messages in
5892 the current
5893 .Mx -sx
5894 .Sx "secondary mailbox"
5895 .Ev MBOX ,
5896 preserving all messages marked with
5897 .Ic hold
5899 .Ic preserve
5900 or never referenced in the system
5901 .Va inbox ,
5902 and removing all other messages from the
5903 .Mx -sx
5904 .Sx "primary system mailbox" .
5905 If new mail has arrived during the session,
5906 the message
5907 .Dq You have new mail
5908 will be shown.
5909 If given while editing a mailbox file with the command line option
5910 .Fl f ,
5911 then the edit file is rewritten.
5912 A return to the shell is effected,
5913 unless the rewrite of edit file fails,
5914 in which case the user can escape with the exit command.
5915 The optional status number argument will be passed through to
5916 .Xr exit 3 .
5917 \*(ID For now it can happen that the given status will be overwritten,
5918 later this will only occur if a later error needs to be reported onto an
5919 otherwise success indicating status.
5922 .It Ic read
5923 \*(NQ Read a line from standard input, or the channel set active via
5924 .Ic readctl ,
5925 and assign the data, which will be splitted as indicated by
5926 .Va ifs ,
5927 to the given variables.
5928 The variable names are checked by the same rules as documented for
5929 .Cm vput ,
5930 and the same error codes will be seen in
5931 .Va \&! ;
5932 the exit status
5933 .Va \&?
5934 indicates the number of bytes read, it will be
5935 .Ql -1
5936 with the error number
5937 .Va \&!
5938 set to
5939 .Va ^ERR Ns -BADF
5940 in case of I/O errors, or
5941 .Va ^ERR Ns -NONE
5942 upon End-Of-File.
5943 If there are more fields than variables, assigns successive fields to the
5944 last given variable.
5945 If there are less fields than variables, assigns the empty string to the
5946 remains.
5947 .Bd -literal -offset indent
5948 ? read a b c
5949    H  e  l  l  o
5950 ? echo "<$a> <$b> <$c>"
5951 <H> <e> <l  l  o>
5952 ? wysh set ifs=:; read a b c;unset ifs
5953 hey2.0,:"'you    ",:world!:mars.:
5954 ? echo $?/$^ERRNAME / <$a><$b><$c>
5955 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5959 .It Ic readall
5960 \*(NQ Read anything from standard input, or the channel set active via
5961 .Ic readctl ,
5962 and assign the data to the given variable.
5963 The variable name is checked by the same rules as documented for
5964 .Cm vput ,
5965 and the same error codes will be seen in
5966 .Va \&! ;
5967 the exit status
5968 .Va \&?
5969 indicates the number of bytes read, it will be
5970 .Ql -1
5971 with the error number
5972 .Va \&!
5973 set to
5974 .Va ^ERR Ns -BADF
5975 in case of I/O errors, or
5976 .Va ^ERR Ns -NONE
5977 upon End-Of-File.
5978 \*(ID The input data length is restricted to 31-bits.
5981 .It Ic readctl
5982 \*(NQ Manages input channels for
5983 .Ic read
5985 .Ic readall ,
5986 to be used to avoid complicated or impracticable code, like calling
5987 .Ic \&\&read
5988 from within a macro in non-interactive mode.
5989 Without arguments, or when the first argument is
5990 .Cm show ,
5991 a listing of all known channels is printed.
5992 Channels can otherwise be
5993 .Cm create Ns
5994 d, and existing channels can be
5995 .Cm set
5996 active and
5997 .Cm remove Ns
5998 d by giving the string used for creation.
6000 The channel name is expected to be a file descriptor number, or,
6001 if parsing the numeric fails, an input file name that undergoes
6002 .Sx "Filename transformations" .
6003 E.g. (this example requires a modern shell):
6004 .Bd -literal -offset indent
6005 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
6006   LC_ALL=C \*(uA -R#
6007 hey, you
6008 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
6009   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
6010 hey, you
6013 .It Ic redirect
6014 \*(OB Same as
6015 .Ic resend .
6017 .It Ic Redirect
6018 \*(OB Same as
6019 .Ic Resend .
6022 .It Ic remove
6023 Removes the named files or directories.
6024 .Sx "Filename transformations"
6025 including shell pathname wildcard pattern expansions
6026 .Pf ( Xr glob 7 )
6027 are performed on the arguments.
6028 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
6029 type specific removal will be performed, deleting the complete mailbox.
6030 The user is asked for confirmation in interactive mode.
6033 .It Ic rename
6034 Takes the name of an existing folder
6035 and the name for the new folder
6036 and renames the first to the second one.
6037 .Sx "Filename transformations"
6038 including shell pathname wildcard pattern expansions
6039 .Pf ( Xr glob 7 )
6040 are performed on both arguments.
6041 Both folders must be of the same type.
6044 .It Ic Reply
6045 (R) Replies to only the sender of each message of the given message
6046 list, by using the first message as the template to quote, for the
6047 .Ql Subject:
6048 etc.
6049 .Va flipr
6050 will exchange this command with
6051 .Ic reply .
6052 Unless the internal variable
6053 .Va fullnames
6054 is set the recipient address will be stripped from comments, names etc.
6055 .Ql Reply-To:
6056 headers will be inspected if
6057 .Va reply-to-honour
6058 is set.
6060 This may generate the errors
6061 .Va ^ERR Ns -DESTADDRREQ
6062 if no receiver has been specified,
6063 .Va ^ERR Ns -PERM
6064 if some addressees where rejected by
6065 .Va expandaddr ,
6066 .Va ^ERR Ns -NODATA
6067 if no applicable messages have been given,
6068 .Va ^ERR Ns -IO
6069 if an I/O error occurs,
6070 .Va ^ERR Ns -NOTSUP
6071 if a necessary character set conversion fails, and
6072 .Va ^ERR Ns -INVAL
6073 for other errors.
6076 .It Ic reply
6077 (r) Take a message and group-responds to it by addressing the sender
6078 and all recipients, subject to
6079 .Ic alternates
6080 processing.
6081 .Va followup-to ,
6082 .Va followup-to-honour ,
6083 .Va reply-to-honour
6084 as well as
6085 .Va recipients-in-cc
6086 influence response behaviour.
6087 Unless the internal variable
6088 .Va fullnames
6089 is set recipient addresses will be stripped from comments, names etc.
6091 .Va flipr
6092 is set the commands
6093 .Ic Reply
6095 .Ic reply
6096 are exchanged.
6097 The command
6098 .Ic Lreply
6099 offers special support for replying to mailing lists.
6100 For more documentation please refer to
6101 .Sx "On sending mail, and non-interactive mode" .
6103 This may generate the errors
6104 .Va ^ERR Ns -DESTADDRREQ
6105 if no receiver has been specified,
6106 .Va ^ERR Ns -PERM
6107 if some addressees where rejected by
6108 .Va expandaddr ,
6109 .Va ^ERR Ns -NODATA
6110 if no applicable messages have been given,
6111 .Va ^ERR Ns -IO
6112 if an I/O error occurs,
6113 .Va ^ERR Ns -NOTSUP
6114 if a necessary character set conversion fails, and
6115 .Va ^ERR Ns -INVAL
6116 for other errors.
6117 Any error stops processing of further messages.
6120 .It Ic replyall
6121 Similar to
6122 .Ic reply ,
6123 but initiates a group-reply regardless of the value of
6124 .Va flipr .
6127 .It Ic replysender
6128 Similar to
6129 .Ic Reply ,
6130 but responds to the sender only regardless of the value of
6131 .Va flipr .
6134 .It Ic Resend
6135 Like
6136 .Ic resend ,
6137 but does not add any header lines.
6138 This is not a way to hide the sender's identity,
6139 but useful for sending a message again to the same recipients.
6142 .It Ic resend
6143 Takes a list of messages and a user name
6144 and sends each message to the named user.
6145 .Ql Resent-From:
6146 and related header fields are prepended to the new copy of the message.
6147 Saving in
6148 .Va record
6149 is only performed if
6150 .Va record-resent
6151 is set.
6153 This may generate the errors
6154 .Va ^ERR Ns -DESTADDRREQ
6155 if no receiver has been specified,
6156 .Va ^ERR Ns -PERM
6157 if some addressees where rejected by
6158 .Va expandaddr ,
6159 .Va ^ERR Ns -NODATA
6160 if no applicable messages have been given,
6161 .Va ^ERR Ns -IO
6162 if an I/O error occurs,
6163 .Va ^ERR Ns -NOTSUP
6164 if a necessary character set conversion fails, and
6165 .Va ^ERR Ns -INVAL
6166 for other errors.
6167 Any error stops processing of further messages.
6170 .It Ic Respond
6171 Same as
6172 .Ic Reply .
6175 .It Ic respond
6176 Same as
6177 .Ic reply .
6180 .It Ic respondall
6181 Same as
6182 .Ic replyall .
6185 .It Ic respondsender
6186 Same as
6187 .Ic replysender .
6190 .It Ic retain
6191 (ret) Superseded by the multiplexer
6192 .Ic headerpick .
6195 .It Ic return
6196 Only available inside the scope of a
6197 .Ic define Ns
6198 d macro or an
6199 .Ic account ,
6200 this will stop evaluation of any further macro content, and return
6201 execution control to the caller.
6202 The two optional parameters must be specified as positive decimal
6203 numbers and default to the value 0:
6204 the first argument specifies the signed 32-bit return value (stored in
6205 .Va \&?
6206 \*(ID and later extended to signed 64-bit),
6207 the second the signed 32-bit error number (stored in
6208 .Va \&! ) .
6209 As documented for
6210 .Va \&?
6211 a non-0 exit status may cause the program to exit.
6214 .It Ic Save
6215 (S) Similar to
6216 .Ic save,
6217 but saves the messages in a file named after the local part of the
6218 sender of the first message instead of (in
6219 .Va record
6220 and) taking a filename argument; the variable
6221 .Va outfolder
6222 is inspected to decide on the actual storage location.
6225 .It Ic save
6226 (s) Takes a message list and a filename and appends each message in turn
6227 to the end of the file.
6228 .Sx "Filename transformations"
6229 including shell pathname wildcard pattern expansions
6230 .Pf ( Xr glob 7 )
6231 is performed on the filename.
6232 If no filename is given, the
6233 .Mx -sx
6234 .Sx "secondary mailbox"
6235 .Ev MBOX
6236 is used.
6237 The filename in quotes, followed by the generated character count
6238 is echoed on the user's terminal.
6239 If editing a
6240 .Mx -sx
6241 .Sx "primary system mailbox"
6242 the messages are marked for deletion.
6243 .Sx "Filename transformations"
6244 will be applied.
6245 To filter the saved header fields to the desired subset use the
6246 .Ql save
6247 slot of the white- and blacklisting command
6248 .Ic headerpick .
6250 .It Ic savediscard
6251 \*(OB Superseded by the multiplexer
6252 .Ic headerpick .
6254 .It Ic saveignore
6255 \*(OB Superseded by the multiplexer
6256 .Ic headerpick .
6258 .It Ic saveretain
6259 \*(OB Superseded by the multiplexer
6260 .Ic headerpick .
6263 .It Ic search
6264 Takes a message specification (list) and displays a header summary of
6265 all matching messages, as via
6266 .Ic headers .
6267 This command is an alias of
6268 .Ic from .
6269 Also see
6270 .Sx "Specifying messages" .
6273 .It Ic seen
6274 Takes a message list and marks all messages as having been read.
6279 .It Ic set , unset
6280 (se, \*(NQ uns) The latter command will delete all given variables,
6281 the former, when used without arguments, will show all variables which
6282 are currently known to \*(UA.
6283 A more verbose listing will be produced if
6284 either of
6285 .Va debug
6287 .Va verbose
6288 are set.
6289 Remarks: the list mode will not automatically link-in known
6290 .Sx ENVIRONMENT
6291 variables, but only explicit addressing will, e.g., via
6292 .Ic varshow ,
6293 using a variable in an
6294 .Ic if
6295 condition or a string passed to
6296 .Ic echo ,
6297 explicit
6298 .Ic set Ns
6299 ting, as well as some program-internal use cases.
6302 Otherwise the given variables (and arguments) are set or adjusted.
6303 Arguments are of the form
6304 .Ql name=value
6305 (no space before or after
6306 .Ql = ) ,
6307 or plain
6308 .Ql name
6309 if there is no value, i.e., a boolean variable.
6310 \*(ID In conjunction with the
6311 .Cm wysh
6312 command prefix
6313 .Sx "Shell-style argument quoting"
6314 can be used to quote arguments as necessary.
6315 \*(ID Otherwise quotation marks may be placed around any part of the
6316 assignment statement to quote blanks or tabs.
6319 .Dl ? wysh set indentprefix=' -> '
6322 If an argument begins with
6323 .Ql no ,
6324 as in
6325 .Ql set nosave ,
6326 the effect is the same as invoking the
6327 .Ic unset
6328 command with the remaining part of the variable
6329 .Pf ( Ql unset save ) .
6333 .Ql name
6334 that is known to map to an environment variable will automatically cause
6335 updates in the program environment (unsetting a variable in the
6336 environment requires corresponding system support) \(em use the command
6337 .Ic environ
6338 for further environmental control.
6339 Also see
6340 .Ic varedit ,
6341 .Ic varshow
6342 and the sections
6343 .Sx "INTERNAL VARIABLES"
6345 .Sx ENVIRONMENT .
6349 .It Ic shcodec
6350 Apply shell quoting rules to the given raw-data arguments.
6351 Supports
6352 .Cm vput
6353 (see
6354 .Sx "Command modifiers" ) .
6355 The first argument specifies the operation:
6356 .Ar [+]e[ncode]
6358 .Ar d[ecode]
6359 cause shell quoting to be applied to the remains of the line, and
6360 expanded away thereof, respectively.
6361 If the former is prefixed with a plus-sign, the quoted result will not
6362 be roundtrip enabled, and thus can be decoded only in the very same
6363 environment that was used to perform the encode; also see
6364 .Cd mle-quote-rndtrip .
6365 If the coding operation fails the error number
6366 .Va \&!
6367 is set to
6368 .Va ^ERR Ns -CANCELED ,
6369 and the unmodified input is used as the result; the error number may
6370 change again due to output or result storage errors.
6373 .It Ic shell
6374 \*(NQ (sh) Invokes an interactive version of the shell,
6375 and returns its exit status.
6379 .It Ic shortcut , unshortcut
6380 Without arguments the list of all currently defined shortcuts is
6381 shown, with one argument the expansion of the given shortcut.
6382 Otherwise all given arguments are treated as pairs of shortcuts and
6383 their expansions, creating new or changing already existing shortcuts,
6384 as necessary.
6385 The latter command will remove all given shortcuts, the special name
6386 .Ql *
6387 will remove all registered shortcuts.
6390 .It Ic shift
6391 \*(NQ Shift the positional parameter stack (starting at
6392 .Va 1 )
6393 by the given number (which must be a positive decimal),
6394 or 1 if no argument has been given.
6395 It is an error if the value exceeds the number of positional parameters.
6396 If the given number is 0, no action is performed, successfully.
6397 The stack as such can be managed via
6398 .Ic vpospar .
6399 Note this command will fail in
6400 .Ic account
6401 and hook macros unless the positional parameter stack has been
6402 explicitly created in the current context via
6403 .Ic vpospar .
6406 .It Ic show
6407 Like
6408 .Ic type ,
6409 but performs neither MIME decoding nor decryption, so that the raw
6410 message text is shown.
6413 .It Ic size
6414 (si) Shows the size in characters of each message of the given
6415 message-list.
6418 .It Ic sleep
6419 \*(NQ Sleep for the specified number of seconds (and optionally
6420 milliseconds), by default interruptably.
6421 If a third argument is given the sleep will be uninterruptible,
6422 otherwise the error number
6423 .Va \&!
6424 will be set to
6425 .Va ^ERR Ns -INTR
6426 if the sleep has been interrupted.
6427 The command will fail and the error number will be
6428 .Va ^ERR Ns -OVERFLOW
6429 if the given duration(s) overflow the time datatype, and
6430 .Va ^ERR Ns -INVAL
6431 if the given durations are no valid integers.
6436 .It Ic sort , unsort
6437 The latter command disables sorted or threaded mode, returns to normal
6438 message order and, if the
6439 .Va header
6440 variable is set,
6441 displays a header summary.
6442 The former command shows the current sorting criterion when used without
6443 an argument, but creates a sorted representation of the current folder
6444 otherwise, and changes the
6445 .Ic next
6446 command and the addressing modes such that they refer to messages in
6447 the sorted order.
6448 Message numbers are the same as in regular mode.
6449 If the
6450 .Va header
6451 variable is set,
6452 a header summary in the new order is also displayed.
6453 Automatic folder sorting can be enabled by setting the
6454 .Va autosort
6455 variable, as in, e.g.,
6456 .Ql set autosort=thread .
6457 Possible sorting criterions are:
6460 .Bl -tag -compact -width "subject"
6461 .It Ar date
6462 Sort the messages by their
6463 .Ql Date:
6464 field, that is by the time they were sent.
6465 .It Ar from
6466 Sort messages by the value of their
6467 .Ql From:
6468 field, that is by the address of the sender.
6469 If the
6470 .Va showname
6471 variable is set, the sender's real name (if any) is used.
6472 .It Ar size
6473 Sort the messages by their size.
6474 .It spam
6475 \*(OP Sort the message by their spam score, as has been classified by
6476 .Ic spamrate .
6477 .It Ar status
6478 Sort the messages by their message status.
6479 .It Ar subject
6480 Sort the messages by their subject.
6481 .It Ar thread
6482 Create a threaded display.
6483 .It Ar to
6484 Sort messages by the value of their
6485 .Ql To:
6486 field, that is by the address of the recipient.
6487 If the
6488 .Va showname
6489 variable is set, the recipient's real name (if any) is used.
6494 .It Ic source
6495 \*(NQ (so) The source command reads commands from the given file.
6496 .Sx "Filename transformations"
6497 will be applied.
6498 If the given expanded argument ends with a vertical bar
6499 .Ql |
6500 then the argument will instead be interpreted as a shell command and
6501 \*(UA will read the output generated by it.
6502 Dependent on the settings of
6503 .Va posix
6505 .Va errexit ,
6506 and also dependent on whether the command modifier
6507 .Cm ignerr
6508 had been used, encountering errors will stop sourcing of the given input.
6509 \*(ID Note that
6510 .Ic \&\&source
6511 cannot be used from within macros that execute as
6512 .Va folder-hook Ns s
6514 .Ic account Ns s ,
6515 i.e., it can only be called from macros that were
6516 .Ic call Ns ed .
6519 .It Ic source_if
6520 \*(NQ The difference to
6521 .Ic source
6522 (beside not supporting pipe syntax aka shell command input) is that
6523 this command will not generate an error nor warn if the given file
6524 argument cannot be opened successfully.
6527 .It Ic spamclear
6528 \*(OP Takes a list of messages and clears their
6529 .Ql is-spam
6530 flag.
6533 .It Ic spamforget
6534 \*(OP Takes a list of messages and causes the
6535 .Va spam-interface
6536 to forget it has ever used them to train its Bayesian filter.
6537 Unless otherwise noted the
6538 .Ql is-spam
6539 flag of the message is inspected to chose whether a message shall be
6540 forgotten to be
6541 .Dq ham
6543 .Dq spam .
6546 .It Ic spamham
6547 \*(OP Takes a list of messages and informs the Bayesian filter of the
6548 .Va spam-interface
6549 that they are
6550 .Dq ham .
6551 This also clears the
6552 .Ql is-spam
6553 flag of the messages in question.
6556 .It Ic spamrate
6557 \*(OP Takes a list of messages and rates them using the configured
6558 .Va spam-interface ,
6559 without modifying the messages, but setting their
6560 .Ql is-spam
6561 flag as appropriate; because the spam rating headers are lost the rate
6562 will be forgotten once the mailbox is left.
6563 Refer to the manual section
6564 .Sx "Handling spam"
6565 for the complete picture of spam handling in \*(UA.
6568 .It Ic spamset
6569 \*(OP Takes a list of messages and sets their
6570 .Ql is-spam
6571 flag.
6574 .It Ic spamspam
6575 \*(OP Takes a list of messages and informs the Bayesian filter of the
6576 .Va spam-interface
6577 that they are
6578 .Dq spam .
6579 This also sets the
6580 .Ql is-spam
6581 flag of the messages in question.
6583 .It Ic thread
6584 \*(OB The same as
6585 .Ql sort thread
6586 (consider using a
6587 .Ql commandalias
6588 as necessary).
6591 .It Ic Top
6592 Like
6593 .Ic top
6594 but always uses the
6595 .Ic headerpick
6596 .Ql type
6597 slot for white- and blacklisting header fields.
6600 .It Ic top
6601 (to) Takes a message list and types out the first
6602 .Va toplines
6603 lines of each message on the users' terminal.
6604 Unless a special selection has been established for the
6605 .Ql top
6606 slot of the
6607 .Ic headerpick
6608 command, the only header fields that are displayed are
6609 .Ql From: ,
6610 .Ql To: ,
6611 .Ql CC: ,
6613 .Ql Subject: .
6614 .Ic Top
6615 will always use the
6616 .Ql type
6617 .Ic headerpick
6618 selection instead.
6619 It is possible to apply compression to what is displayed by setting
6620 .Va topsqueeze .
6621 Messages are decrypted and converted to the terminal character set
6622 if necessary.
6625 .It Ic touch
6626 (tou) Takes a message list and marks the messages for saving in the
6627 .Mx -sx
6628 .Sx "secondary mailbox"
6629 .Ev MBOX .
6630 \*(UA deviates from the POSIX standard with this command,
6631 as a following
6632 .Ic next
6633 command will display the following message instead of the current one.
6636 .It Ic Type
6637 (T) Like
6638 .Ic type
6639 but also displays header fields which would not pass the
6640 .Ic headerpick
6641 selection, and all visualizable parts of MIME
6642 .Ql multipart/alternative
6643 messages.
6646 .It Ic type
6647 (t) Takes a message list and types out each message on the users terminal.
6648 The display of message headers is selectable via
6649 .Ic headerpick .
6650 For MIME multipart messages, all parts with a content type of
6651 .Ql text ,
6652 all parts which have a registered MIME type handler (see
6653 .Sx "HTML mail and MIME attachments" )
6654 which produces plain text output, and all
6655 .Ql message
6656 parts are shown, others are hidden except for their headers.
6657 Messages are decrypted and converted to the terminal character set
6658 if necessary.
6659 The command
6660 .Ic mimeview
6661 can be used to display parts which are not displayable as plain text.
6663 .It Ic unaccount
6665 .Ic account .
6667 .It Ic unalias
6668 (una) See
6669 .Ic alias .
6671 .It Ic unanswered
6673 .Ic answered .
6675 .It Ic unbind
6677 .Ic bind .
6679 .It Ic uncollapse
6681 .Ic collapse .
6683 .It Ic uncolour
6685 .Ic colour .
6687 .It Ic undefine
6689 .Ic define .
6691 .It Ic undelete
6693 .Ic delete .
6695 .It Ic undraft
6697 .Ic draft .
6699 .It Ic unflag
6701 .Ic flag .
6703 .It Ic unfwdignore
6704 \*(OB Superseded by the multiplexer
6705 .Ic headerpick .
6707 .It Ic unfwdretain
6708 \*(OB Superseded by the multiplexer
6709 .Ic headerpick .
6712 .It Ic unignore
6713 Superseded by the multiplexer
6714 .Ic headerpick .
6716 .It Ic unmimetype
6718 .Ic mimetype .
6720 .It Ic unmlist
6722 .Ic mlist .
6724 .It Ic unmlsubscribe
6726 .Ic mlsubscribe .
6729 .It Ic Unread
6730 Same as
6731 .Ic unread .
6734 .It Ic unread
6735 Takes a message list and marks each message as not having been read.
6738 .It Ic unretain
6739 Superseded by the multiplexer
6740 .Ic headerpick .
6742 .It Ic unsaveignore
6743 \*(OB Superseded by the multiplexer
6744 .Ic headerpick .
6746 .It Ic unsaveretain
6747 \*(OB Superseded by the multiplexer
6748 .Ic headerpick .
6750 .It Ic unset
6751 \*(NQ (uns) See
6752 .Ic set .
6754 .It Ic unshortcut
6756 .Ic shortcut .
6758 .It Ic unsort
6760 .Ic short .
6762 .It Ic unthread
6763 \*(OB
6764 Same as
6765 .Ic unsort .
6768 .It Ic urlcodec
6769 Perform URL percent codec operations on the raw-data argument, rather
6770 according to RFC 3986.
6771 Supports
6772 .Cm vput
6773 (see
6774 .Sx "Command modifiers" ) ,
6775 and manages the error number
6776 .Va \&! .
6777 This is a character set agnostic and thus locale dependent operation,
6778 and it may decode bytes which are invalid in the current
6779 .Va ttycharset .
6780 \*(ID This command does not know about URLs beside that.
6782 The first argument specifies the operation:
6783 .Ar e[ncode]
6785 .Ar d[ecode]
6786 perform plain URL percent en- and decoding, respectively.
6787 .Ar p[ath]enc[ode]
6789 .Ar p[ath]dec[ode]
6790 perform a slightly modified operation which should be better for
6791 pathnames: it does not allow a tilde
6792 .Ql ~ ,
6793 and will neither accept hyphen-minus
6794 .Ql -
6795 nor dot
6796 .Ql .
6797 as an initial character.
6798 The remains of the line form the URL data which is to be converted.
6799 If the coding operation fails the error number
6800 .Va \&!
6801 is set to
6802 .Va ^ERR Ns -CANCELED ,
6803 and the unmodified input is used as the result; the error number may
6804 change again due to output or result storage errors.
6807 .It Ic varedit
6808 \*(NQ Edit the values of or create the given variable(s) in the
6809 .Ev EDITOR .
6810 Boolean variables cannot be edited, and variables can also not be
6811 .Ic unset
6812 with this command.
6815 .It Ic varshow
6816 \*(NQ This command produces the same output as the listing mode of
6817 .Ic set ,
6818 including
6819 .Va verbose Ns
6820 ity adjustments, but only for the given variables.
6823 .It Ic verify
6824 \*(OP Takes a message list and verifies each message.
6825 If a message is not a S/MIME signed message,
6826 verification will fail for it.
6827 The verification process checks if the message was signed using a valid
6828 certificate,
6829 if the message sender's email address matches one of those contained
6830 within the certificate,
6831 and if the message content has been altered.
6834 .It Ic version
6835 Shows the
6836 .Va version
6838 .Va features
6839 of \*(UA.
6843 .It Ic vexpr
6844 \*(NQ Evaluate arguments according to a given operator.
6845 This is a multiplexer command which can be used to perform signed 64-bit
6846 numeric calculations as well as byte string and string operations.
6847 It uses polish notation, i.e., the operator is the first argument and
6848 defines the number and type, and the meaning of the remaining arguments.
6849 An empty argument is replaced with a 0 if a number is expected.
6850 Supports
6851 .Cm vput
6852 (see
6853 .Sx "Command modifiers" ) .
6856 The result that is shown in case of errors is always
6857 .Ql -1
6858 for usage errors and numeric operations, and the empty string for byte
6859 string and string operations;
6860 if the latter two fail to provide result data for
6861 .Dq soft
6862 errors, e.g., when a search operation failed, they also set the
6863 .Va \&!
6864 error number to
6865 .Va ^ERR Ns -NODATA .
6866 Except when otherwise noted numeric arguments are parsed as signed 64-bit
6867 numbers, and errors will be reported in the error number
6868 .Va \&!
6869 as the numeric error
6870 .Va ^ERR Ns -RANGE .
6873 Numeric operations work on one or two signed 64-bit integers.
6874 One integer is expected by assignment (equals sign
6875 .Ql = ) ,
6876 which does nothing but parsing the argument, thus detecting validity and
6877 possible overflow conditions, and unary not (tilde
6878 .Ql ~ ) ,
6879 which creates the bitwise complement.
6880 Two integers are used by addition (plus sign
6881 .Ql + ) ,
6882 subtraction (hyphen-minus
6883 .Ql - ) ,
6884 multiplication (asterisk
6885 .Ql * ) ,
6886 division (solidus
6887 .Ql / )
6888 and modulo (percent sign
6889 .Ql % ) ,
6890 as well as for the bitwise operators logical or (vertical bar
6891 .Ql | ,
6892 to be quoted) ,
6893 bitwise and (ampersand
6894 .Ql \&& ,
6895 to be quoted) ,
6896 bitwise xor (circumflex
6897 .Ql ^ ) ,
6898 the bitwise signed left- and right shifts
6899 .Pf ( Ql << ,
6900 .Ql >> ) ,
6901 as well as for the unsigned right shift
6902 .Ql >>> .
6905 All numeric operators can be suffixed with a commercial at
6906 .Ql @ ,
6907 e.g.,
6908 .Ql *@ :
6909 this will turn the operation into a saturated one, which means that
6910 overflow errors and division and modulo by zero are no longer reported
6911 via the exit status, but the result will linger at the minimum or
6912 maximum possible value, instead of overflowing (or trapping).
6913 This is true also for the argument parse step.
6914 For the bitwise shifts, the saturated maximum is 63.
6915 Any catched overflow will be reported via the error number
6916 .Va \&!
6918 .Va ^ERR Ns -OVERFLOW .
6919 .Bd -literal -offset indent
6920 ? vexpr -@ +1 -9223372036854775808
6921 ? echo $?/$!/$^ERRNAME
6925 Character set agnostic string functions have no notion of locale
6926 settings and character sets.
6928 .Bl -hang -width ".It Cm random"
6929 .It Cm file-expand
6930 Performs the usual
6931 .Sx "Filename transformations"
6932 on its argument.
6933 .It Cm random
6934 Generates a random string of the given length, or of
6935 .Dv \&\&PATH_MAX
6936 bytes (a constant from
6937 .Pa /usr/include )
6938 if the value 0 is given; the random string will be base64url encoded
6939 according to RFC 4648, and thus be usable as a (portable) filename.
6943 Byte string operations work on 8-bit bytes and have no notion of locale
6944 settings and character sets, effectively assuming ASCII data.
6947 .Bl -hang -width ".It Cm length"
6948 .It Cm length
6949 Queries the length of the given argument.
6951 .It Cm hash
6952 Calculates the Chris Torek hash of the given argument.
6954 .It Cm find
6955 Byte-searches in the first for the second argument.
6956 Shows the resulting 0-based offset shall it have been found.
6958 .It Cm ifind
6959 Identical to
6960 .Cm find ,
6961 but works case-insensitively according to the rules of the ASCII
6962 character set.
6964 .It Cm substring
6965 Creates a substring of its first argument.
6966 The second argument is the 0-based starting offset, a negative one
6967 counts from the end;
6968 the optional third argument specifies the length of the desired result,
6969 a negative length leaves off the given number of bytes at the end of the
6970 original string, by default the entire string is used;
6971 this operation tries to work around faulty arguments (set
6972 .Va verbose
6973 for error logs), but reports them via the error number
6974 .Va \&!
6976 .Va ^ERR Ns -OVERFLOW .
6978 .It Cm trim
6979 Trim away whitespace characters from both ends of the argument.
6981 .It Cm trim-front
6982 Trim away whitespace characters from the begin of the argument.
6984 .It Cm trim-end
6985 Trim away whitespace characters from the end of the argument.
6990 String operations work, sufficient support provided, according to the
6991 active user's locale encoding and character set (see
6992 .Sx "Character sets" ) .
6995 .Bl -hang -width ".It Cm regex"
6996 .It Cm makeprint
6997 (One-way) Converts the argument to something safely printable on the
6998 terminal.
7000 .It Cm regex
7001 \*(OP A string operation that will try to match the first argument with
7002 the regular expression given as the second argument.
7003 If the optional third argument has been given then instead of showing
7004 the match offset a replacement operation is performed: the third
7005 argument is treated as if specified via dollar-single-quote (see
7006 .Sx "Shell-style argument quoting" ) ,
7007 and any occurrence of a positional parameter, e.g.,
7008 .Va 1 ,
7009 is replaced by the corresponding match group of the regular expression:
7010 .Bd -literal -offset indent
7011 ? vput vexpr res regex bananarama \e
7012     (.*)NanA(.*) '\e${1}au\e$2'
7013 ? echo $?/$!/$^ERRNAME: $res
7016 .It Cm iregex
7017 On otherwise identical case-insensitive equivalent to
7018 .Cm regex :
7019 .Bd -literal -offset indent
7020 ? vput vexpr res ire bananarama \e
7021     (.*)NanA(.*) '\e${1}au\e$2'
7022 ? echo $?/$!/$^ERRNAME: $res
7028 .It Ic vpospar
7029 \*(NQ Manage the positional parameter stack (see
7030 .Va 1 , # , * , @
7031 as well as
7032 .Ic shift ) .
7033 If the first argument is
7034 .Ql clear ,
7035 then the positional parameter stack of the current context, or the
7036 global one, if there is none, is cleared.
7037 If it is
7038 .Ql set ,
7039 then the remaining arguments will be used to (re)create the stack,
7040 if the parameter stack size limit is excessed an
7041 .Va ^ERR Ns -OVERFLOW
7042 error will occur.
7045 If the first argument is
7046 .Ql quote ,
7047 a round-trip capable representation of the stack contents is created,
7048 with each quoted parameter separated from each other with the first
7049 character of
7050 .Va ifs ,
7051 and followed by the first character of
7052 .Va if-ws ,
7053 if that is not empty and not identical to the first.
7054 If that results in no separation at all a
7055 .Cm space
7056 character is used.
7057 This mode supports
7058 .Cm vput
7059 (see
7060 .Sx "Command modifiers" ) .
7061 I.e., the subcommands
7062 .Ql set
7064 .Ql quote
7065 can be used (in conjunction with
7066 .Ic eval )
7067 to (re)create an argument stack from and to a single variable losslessly.
7069 .Bd -literal -offset indent
7070 ? vpospar set hey, "'you    ", world!
7071 ? echo $#: <${1}><${2}><${3}>
7072 ? vput vpospar x quote
7073 ? vpospar clear
7074 ? echo $#: <${1}><${2}><${3}>
7075 ? eval vpospar set ${x}
7076 ? echo $#: <${1}><${2}><${3}>
7081 .It Ic visual
7082 (v) Takes a message list and invokes the display editor on each message.
7083 Modified contents are discarded unless the
7084 .Va writebackedited
7085 variable is set, and are not used unless the mailbox can be written to
7086 and the editor returns a successful exit status.
7089 .It Ic write
7090 (w) For conventional messages the body without all headers is written.
7091 The original message is never marked for deletion in the originating
7092 mail folder.
7093 The output is decrypted and converted to its native format as necessary.
7094 If the output file exists, the text is appended.
7095 If a message is in MIME multipart format its first part is written to
7096 the specified file as for conventional messages, handling of the remains
7097 depends on the execution mode.
7098 No special handling of compressed files is performed.
7100 In interactive mode the user is consecutively asked for the filenames of
7101 the processed parts.
7102 For convience saving of each part may be skipped by giving an empty
7103 value, the same result as writing it to
7104 .Pa /dev/null .
7105 Shell piping the part content by specifying a leading vertical bar
7106 .Ql |
7107 character for the filename is supported.
7108 Other user input undergoes the usual
7109 .Sx "Filename transformations" ,
7110 including shell pathname wildcard pattern expansions
7111 .Pf ( Xr glob 7 )
7112 and shell variable expansion for the message as such, not the individual
7113 parts, and contents of the destination file are overwritten if the file
7114 previously existed.
7116 \*(ID In non-interactive mode any part which does not specify a filename
7117 is ignored, and suspicious parts of filenames of the remaining parts are
7118 URL percent encoded (as via
7119 .Ic urlcodec )
7120 to prevent injection of malicious character sequences, resulting in
7121 a filename that will be written into the current directory.
7122 Existing files will not be overwritten, instead the part number or
7123 a dot are appended after a number sign
7124 .Ql #
7125 to the name until file creation succeeds (or fails due to other
7126 reasons).
7129 .It Ic xcall
7130 \*(NQ The sole difference to
7131 .Ic call
7132 is that the new macro is executed in place of the current one, which
7133 will not regain control: all resources of the current macro will be
7134 released first.
7135 This implies that any setting covered by
7136 .Ic localopts
7137 will be forgotten and covered variables will become cleaned up.
7138 If this command is not used from within a
7139 .Ic call Ns
7140 ed macro it will silently be (a more expensive variant of)
7141 .Ic call .
7144 .It Ic xit
7145 (x) A synonym for
7146 .Ic exit .
7149 .It Ic z
7150 \*(NQ \*(UA presents message headers in
7151 .Va screen Ns
7152 fuls as described under the
7153 .Ic headers
7154 command.
7155 Without arguments this command scrolls to the next window of messages,
7156 likewise if the argument is
7157 .Ql + .
7158 An argument of
7159 .Ql -
7160 scrolls to the last,
7161 .Ql ^
7162 scrolls to the first, and
7163 .Ql $
7164 to the last
7165 .Va \&\&screen
7166 of messages.
7167 A number argument prefixed by
7168 .Ql +
7170 .Ql \-
7171 indicates that the window is calculated in relation to the current
7172 position, and a number without a prefix specifies an absolute position.
7175 .It Ic Z
7176 \*(NQ Similar to
7177 .Ic z ,
7178 but scrolls to the next or previous window that contains at least one
7179 .Ql new
7181 .Ic flag Ns
7182 ged message.
7184 .\" }}}
7186 .\" }}}
7189 .\" .Sh COMMAND ESCAPES {{{
7190 .Sh "COMMAND ESCAPES"
7192 Here is a summary of the command escapes available in compose mode,
7193 which are used to perform special functions when composing messages.
7194 Command escapes are only recognized at the beginning of lines, and
7195 consist of a trigger (escape) and a command character.
7196 The actual escape character can be set via the internal variable
7197 .Va escape ,
7198 it defaults to the tilde
7199 .Ql ~ .
7200 Otherwise ignored whitespace characters following the escape character
7201 will prevent a possible addition of the command line to the \*(OPal
7202 history.
7205 Unless otherwise noted all compose mode command escapes ensure proper
7206 updates of the variables which represent the error number
7207 .Va \&!
7208 and the exit status
7209 .Va \&? .
7210 If the variable
7211 .Va errexit
7212 is set they will, unless stated otherwise, error out message compose
7213 mode and cause a progam exit if an operation fails.
7214 It is however possible to place the character hyphen-minus
7215 .Ql -
7216 after (possible whitespace following) the escape character, which has an
7217 effect equivalent to the command modifier
7218 .Cm ignerr .
7219 If the \*(OPal key bindings are available it is possible to create
7220 .Ic bind Ns
7221 ings specifically for the compose mode.
7224 .Bl -tag -width ".It Ic BaNg"
7226 .It Ic ~~ Ar string
7227 Insert the string of text in the message prefaced by a single
7228 .Ql ~ .
7229 (If the escape character has been changed,
7230 that character must be doubled instead.)
7233 .It Ic ~! Ar command
7234 Execute the indicated shell
7235 .Ar command
7236 which follows, replacing unescaped exclamation marks with the previously
7237 executed command if the internal variable
7238 .Va bang
7239 is set, then return to the message.
7242 .It Ic ~.
7243 Same effect as typing the end-of-file character.
7246 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
7247 Execute the given \*(UA command.
7248 Not all commands, however, are allowed.
7251 .It Ic ~< Ar filename
7252 Identical to
7253 .Ic ~r .
7256 .It Ic ~<! Ar command
7257 .Ar command
7258 is executed using the shell.
7259 Its standard output is inserted into the message.
7262 .It Ic ~?
7263 Write a summary of command escapes.
7266 .It Ic ~@ Op Ar filename...
7267 Append or edit the list of attachments.
7268 Does not manage the error number
7269 .Va \&!
7270 and the exit status
7271 .Va \&? ,
7272 (please use
7273 .Ic ~^
7274 instead if this is a concern).
7275 A list of
7276 .Ar filename
7277 arguments is expected as shell tokens (see
7278 .Sx "Shell-style argument quoting" ;
7279 token-separating commas are ignored, too), to be
7280 interpreted as documented for the command line option
7281 .Fl a ,
7282 with the message number exception as below.
7284 Without
7285 .Ar filename
7286 arguments the attachment list is edited, entry by entry;
7287 if a filename is left empty, that attachment is deleted from the list;
7288 once the end of the list is reached either new attachments may be
7289 entered or the session can be quit by committing an empty
7290 .Dq new
7291 attachment.
7293 For all mode, if a given filename solely consists of the number sign
7294 .Ql #
7295 followed by a valid message number of the currently active mailbox, then
7296 the given message is attached as a
7297 .Ql message/rfc822
7298 MIME message part.
7299 As the shell comment character the number sign must be quoted.
7302 .It Ic ~| Ar command
7303 Pipe the message through the specified filter command.
7304 If the command gives no output or terminates abnormally,
7305 retain the original text of the message.
7306 E.g., the command
7307 .Xr fmt 1
7308 is often used as a rejustifying filter.
7312 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7313 Low-level command meant for scripted message access, i.e., for
7314 .Va on-compose-splice
7316 .Va on-compose-splice-shell .
7317 The used protocol is likely subject to changes, and therefore the
7318 mentioned hooks receive the used protocol version as an initial line.
7319 In general the first field of a response line represents a status code
7320 which specifies whether a command was successful or not, whether result
7321 data is to be expected, and if, the format of the result data.
7322 Does not manage the error number
7323 .Va \&!
7324 and the exit status
7325 .Va \&? ,
7326 because errors are reported via the protocol
7327 (hard errors like I/O failures cannot be handled).
7328 This command has read-only access to several virtual pseudo headers in
7329 the \*(UA private namespace, which may not exist (except for the first):
7333 .Bl -tag -compact -width ".It Va BaNg"
7334 .It Ql Mailx-Command:
7335 The name of the command that generates the message, one of
7336 .Ql forward ,
7337 .Ql Lreply ,
7338 .Ql mail ,
7339 .Ql Reply ,
7340 .Ql reply ,
7341 .Ql resend .
7343 .It Ql Mailx-Raw-To:
7344 .It Ql Mailx-Raw-Cc:
7345 .It Ql Mailx-Raw-Bcc:
7346 Represent the frozen initial state of these headers before any
7347 transformation (e.g.,
7348 .Ic alias ,
7349 .Ic alternates ,
7350 .Va recipients-in-cc
7351 etc.) took place.
7353 .It Ql Mailx-Orig-From:
7354 .It Ql Mailx-Orig-To:
7355 .It Ql Mailx-Orig-Cc:
7356 .It Ql Mailx-Orig-Bcc:
7357 The values of said headers of the original message which has been
7358 addressed by any of
7359 .Ic reply , forward , resend .
7363 The status codes are:
7367 .Bl -tag -compact -width ".It Ql 210"
7368 .It Ql 210
7369 Status ok; the remains of the line are the result.
7371 .It Ql 211
7372 Status ok; the rest of the line is optionally used for more status.
7373 What follows are lines of result addresses, terminated by an empty line.
7374 The address lines consist of two fields, the first of which is the
7375 plain address, e.g.,
7376 .Ql bob@exam.ple ,
7377 separated by a single ASCII SP space from the second which contains the
7378 unstripped address, even if that is identical to the first field, e.g.,
7379 .Ql (Lovely) Bob <bob@exam.ple> .
7380 All the input, including the empty line, must be consumed before further
7381 commands can be issued.
7383 .It Ql 212
7384 Status ok; the rest of the line is optionally used for more status.
7385 What follows are lines of furtherly unspecified string content,
7386 terminated by an empty line.
7387 All the input, including the empty line, must be consumed before further
7388 commands can be issued.
7390 .It Ql 500
7391 Syntax error; invalid command.
7393 .It Ql 501
7394 Syntax error in parameters or arguments.
7396 .It Ql 505
7397 Error: an argument fails verification.
7398 For example an invalid address has been specified, or an attempt was
7399 made to modify anything in \*(UA's own namespace.
7401 .It Ql 506
7402 Error: an otherwise valid argument is rendered invalid due to context.
7403 For example, a second address is added to a header which may consist of
7404 a single address only.
7409 If a command indicates failure then the message will have remained
7410 unmodified.
7411 Most commands can fail with
7412 .Ql 500
7413 if required arguments are missing (false command usage).
7414 The following (case-insensitive) commands are supported:
7417 .Bl -hang -width ".It Cm header"
7418 .It Cm header
7419 This command allows listing, inspection, and editing of message headers.
7420 Header name case is not normalized, and case-insensitive comparison
7421 should be used when matching names.
7422 The second argument specifies the subcommand to apply, one of:
7424 .Bl -hang -width ".It Cm remove"
7425 .It Cm list
7426 Without a third argument a list of all yet existing headers is given via
7427 .Ql 210 ;
7428 this command is the default command of
7429 .Cm header
7430 if no second argument has been given.
7431 A third argument restricts output to the given header only, which may
7432 fail with
7433 .Ql 501
7434 if no such field is defined.
7436 .It Cm show
7437 Shows the content of the header given as the third argument.
7438 Dependent on the header type this may respond with
7439 .Ql 211
7441 .Ql 212 ;
7442 any failure results in
7443 .Ql 501 .
7445 .It Cm remove
7446 This will remove all instances of the header given as the third
7447 argument, reporting
7448 .Ql 210
7449 upon success,
7450 .Ql 501
7451 if no such header can be found, and
7452 Ql 505
7453 on \*(UA namespace violations.
7455 .It Cm remove-at
7456 This will remove from the header given as the third argument the
7457 instance at the list position (counting from one!) given with the fourth
7458 argument, reporting
7459 .Ql 210
7460 upon success or
7461 .Ql 505
7462 if the list position argument is not a number or on \*(UA namespace
7463 violations, and
7464 .Ql 501
7465 if no such header instance exists.
7467 .It Cm insert
7468 Create a new or an additional instance of the header given in the third
7469 argument, with the header body content as given in the fourth argument
7470 (the remains of the line).
7471 It may return
7472 .Ql 501
7473 if the third argument specifies a free-form header field name that is
7474 invalid, or if body content extraction fails to succeed,
7475 .Ql 505
7476 if any extracted address does not pass syntax and/or security checks or
7477 on \*(UA namespace violations, and
7478 .Ql 506
7479 to indicate prevention of excessing a single-instance header \(em note that
7480 .Ql Subject:
7481 can be appended to (a space separator will be added automatically first).
7483 .Ql 210
7484 is returned upon success, followed by the name of the header and the list
7485 position of the newly inserted instance.
7486 The list position is always 1 for single-instance header fields.
7487 All free-form header fields are managed in a single list.
7491 .It Cm attachment
7492 This command allows listing, removal and addition of message attachments.
7493 The second argument specifies the subcommand to apply, one of:
7495 .Bl -hang -width ".It Cm remove"
7496 .It Cm list
7497 List all attachments via
7498 .Ql 212 ,
7499 or report
7500 .Ql 501
7501 if no attachments exist.
7502 This command is the default command of
7503 .Cm attachment
7504 if no second argument has been given.
7506 .It Cm remove
7507 This will remove the attachment given as the third argument, and report
7508 .Ql 210
7509 upon success or
7510 .Ql 501
7511 if no such attachment can be found.
7512 If there exists any path component in the given argument, then an exact
7513 match of the path which has been used to create the attachment is used
7514 directly, but if only the basename of that path matches then all
7515 attachments are traversed to find an exact match first, and the removal
7516 occurs afterwards; if multiple basenames match, a
7517 .Ql 506
7518 error occurs.
7519 Message attachments are treated as absolute pathnames.
7521 If no path component exists in the given argument, then all attachments
7522 will be searched for
7523 .Ql filename=
7524 parameter matches as well as for matches of the basename of the path
7525 which has been used when the attachment has been created; multiple
7526 matches result in a
7527 .Ql 506 .
7529 .It Cm remove-at
7530 This will interpret the third argument as a number and remove the
7531 attachment at that list position (counting from one!), reporting
7532 .Ql 210
7533 upon success or
7534 .Ql 505
7535 if the argument is not a number or
7536 .Ql 501
7537 if no such attachment exists.
7539 .It Cm insert
7540 Adds the attachment given as the third argument, specified exactly as
7541 documented for the command line option
7542 .Fl a ,
7543 and supporting the message number extension as documented for
7544 .Ic ~@ .
7545 This reports
7546 .Ql 210
7547 upon success, with the index of the new attachment following,
7548 .Ql 505
7549 if the given file cannot be opened,
7550 .Ql 506
7551 if an on-the-fly performed character set conversion fails, otherwise
7552 .Ql 501
7553 is reported; this is also reported if character set conversion is
7554 requested but not available.
7556 .It Cm attribute
7557 This uses the same search mechanism as described for
7558 .Cm remove
7559 and prints any known attributes of the first found attachment via
7560 .Ql 212
7561 upon success or
7562 .Ql 501
7563 if no such attachment can be found.
7564 The attributes are written as lines of keyword and value tuples, the
7565 keyword being separated from the rest of the line with an ASCII SP space
7566 character.
7568 .It Cm attribute-at
7569 This uses the same search mechanism as described for
7570 .Cm remove-at
7571 and is otherwise identical to
7572 .Cm attribute .
7574 .It Cm attribute-set
7575 This uses the same search mechanism as described for
7576 .Cm remove ,
7577 and will assign the attribute given as the fourth argument, which is
7578 expected to be a value tuple of keyword and other data, separated by
7579 a ASCII SP space or TAB tabulator character.
7580 If the value part is empty, then the given attribute is removed, or
7581 reset to a default value if existence of the attribute is crucial.
7583 It returns via
7584 .Ql 210
7585 upon success, with the index of the found attachment following,
7586 .Ql 505
7587 for message attachments or if the given keyword is invalid, and
7588 .Ql 501
7589 if no such attachment can be found.
7590 The following keywords may be used (case-insensitively):
7592 .Bl -hang -compact -width ".It Ql filename"
7593 .It Ql filename
7594 Sets the filename of the MIME part, i.e., the name that is used for
7595 display and when (suggesting a name for) saving (purposes).
7596 .It Ql content-description
7597 Associate some descriptive information to the attachment's content, used
7598 in favour of the plain filename by some MUAs.
7599 .It Ql content-id
7600 May be used for uniquely identifying MIME entities in several contexts;
7601 this expects a special reference address format as defined in RFC 2045
7602 and generates a
7603 .Ql 505
7604 upon address content verification failure.
7605 .It Ql content-type
7606 Defines the media type/subtype of the part, which is managed
7607 automatically, but can be overwritten.
7608 .It Ql content-disposition
7609 Automatically set to the string
7610 .Ql attachment .
7613 .It Cm attribute-set-at
7614 This uses the same search mechanism as described for
7615 .Cm remove-at
7616 and is otherwise identical to
7617 .Cm attribute-set .
7623 .It Ic ~A
7624 The same as
7625 .Ql Ic ~i Ns \| Va Sign .
7628 .It Ic ~a
7629 The same as
7630 .Ql Ic ~i Ns \| Va sign .
7633 .It Ic ~b Ar name ...
7634 Add the given names to the list of blind carbon copy recipients.
7637 .It Ic ~c Ar name ...
7638 Add the given names to the list of carbon copy recipients.
7641 .It Ic ~d
7642 Read the file specified by the
7643 .Ev DEAD
7644 variable into the message.
7647 .It Ic ~e
7648 Invoke the text editor on the message collected so far.
7649 After the editing session is finished,
7650 the user may continue appending text to the message.
7653 .It Ic ~F Ar messages
7654 Read the named messages into the message being sent, including all
7655 message headers and MIME parts.
7656 If no messages are specified, read in the current message, the
7657 .Dq dot .
7660 .It Ic ~f Ar messages
7661 Read the named messages into the message being sent.
7662 If no messages are specified, read in the current message, the
7663 .Dq dot .
7664 Strips down the list of header fields according to the
7665 .Ql type
7666 white- and blacklist selection of
7667 .Ic headerpick .
7668 For MIME multipart messages,
7669 only the first displayable part is included.
7672 .It Ic ~H
7673 Edit the message header fields
7674 .Ql From: ,
7675 .Ql Reply-To:
7677 .Ql Sender:
7678 by typing each one in turn and allowing the user to edit the field.
7679 The default values for these fields originate from the
7680 .Va from , reply-to
7682 .Va sender
7683 variables.
7686 .It Ic ~h
7687 Edit the message header fields
7688 .Ql To: ,
7689 .Ql Cc: ,
7690 .Ql Bcc:
7692 .Ql Subject:
7693 by typing each one in turn and allowing the user to edit the field.
7696 .It Ic ~I Ar variable
7697 Insert the value of the specified variable into the message.
7698 The message remains unaltered if the variable is unset or empty.
7699 Any embedded character sequences
7700 .Ql \et
7701 horizontal tabulator and
7702 .Ql \en
7703 line feed are expanded in
7704 .Va posix
7705 mode; otherwise the expansion should occur at
7706 .Ic set
7707 time by using the command modifier
7708 .Va wysh .
7711 .It Ic ~i Ar variable
7712 Insert the value of the specified variable followed by a newline
7713 character into the message.
7714 The message remains unaltered if the variable is unset or empty.
7715 Any embedded character sequences
7716 .Ql \et
7717 horizontal tabulator and
7718 .Ql \en
7719 line feed are expanded in
7720 .Va posix
7721 mode; otherwise the expansion should occur at
7722 .Ic set
7723 time by using the command modifier
7724 .Va wysh .
7727 .It Ic ~M Ar messages
7728 Read the named messages into the message being sent,
7729 indented by
7730 .Va indentprefix .
7731 If no messages are specified, read the current message, the
7732 .Dq dot .
7735 .It Ic ~m Ar messages
7736 Read the named messages into the message being sent,
7737 indented by
7738 .Va indentprefix .
7739 If no messages are specified, read the current message, the
7740 .Dq dot .
7741 Strips down the list of header fields according to the
7742 .Ql type
7743 white- and blacklist selection of
7744 .Ic headerpick .
7745 For MIME multipart messages,
7746 only the first displayable part is included.
7749 .It Ic ~p
7750 Display the message collected so far,
7751 prefaced by the message header fields
7752 and followed by the attachment list, if any.
7755 .It Ic ~q
7756 Abort the message being sent,
7757 copying it to the file specified by the
7758 .Ev DEAD
7759 variable if
7760 .Va save
7761 is set.
7764 .It Ic ~R Ar filename
7765 Identical to
7766 .Ic ~r ,
7767 but indent each line that has been read by
7768 .Va indentprefix .
7771 .It Ic ~r Ar filename Op Ar HERE-delimiter
7772 Read the named file, object to the usual
7773 .Sx "Filename transformations" ,
7774 into the message; if (the expanded)
7775 .Ar filename
7776 is the hyphen-minus
7777 .Ql -
7778 then standard input is used, e.g., for pasting purposes.
7779 Only in this latter mode
7780 .Ar HERE-delimiter
7781 may be given: if it is data will be read in until the given
7782 .Ar HERE-delimiter
7783 is seen on a line by itself, and encountering EOF is an error; the
7784 .Ar HERE-delimiter
7785 is a required argument in non-interactive mode; if it is single-quote
7786 quoted then the pasted content will not be expanded, \*(ID otherwise
7787 a future version of \*(UA may perform shell-style expansion on the content.
7790 .It Ic ~s Ar string
7791 Cause the named string to become the current subject field.
7792 Newline (NL) and carriage-return (CR) bytes are invalid and will be
7793 normalized to space (SP) characters.
7796 .It Ic ~t Ar name ...
7797 Add the given name(s) to the direct recipient list.
7800 .It Ic ~U Ar messages
7801 Read in the given / current message(s) excluding all headers, indented by
7802 .Va indentprefix .
7805 .It Ic ~u Ar messages
7806 Read in the given / current message(s), excluding all headers.
7809 .It Ic ~v
7810 Invoke an alternate editor (defined by the
7811 .Ev VISUAL
7812 environment variable) on the message collected so far.
7813 Usually, the alternate editor will be a screen editor.
7814 After the editor is quit,
7815 the user may resume appending text to the end of the message.
7818 .It Ic ~w Ar filename
7819 Write the message onto the named file, which is object to the usual
7820 .Sx "Filename transformations" .
7821 If the file exists,
7822 the message is appended to it.
7825 .It Ic ~x
7826 Same as
7827 .Ic ~q ,
7828 except that the message is not saved at all.
7831 .\" }}}
7834 .\" .Sh INTERNAL VARIABLES {{{
7835 .Sh "INTERNAL VARIABLES"
7837 Internal \*(UA variables are controlled via the
7838 .Ic set
7840 .Ic unset
7841 commands; prefixing a variable name with the string
7842 .Ql no
7843 and calling
7844 .Ic set
7845 has the same effect as using
7846 .Ic unset :
7847 .Ql unset crt
7849 .Ql set nocrt
7850 do the same thing.
7851 Creation or editing of variables can be performed in the
7852 .Ev EDITOR
7853 with the command
7854 .Ic varedit .
7855 .Ic varshow
7856 will give more insight on the given variable(s), and
7857 .Ic set ,
7858 when called without arguments, will show a listing of all variables.
7859 Both commands support a more
7860 .Va verbose
7861 listing mode.
7862 Some well-known variables will also become inherited from the
7863 program
7864 .Sx ENVIRONMENT
7865 implicitly, others can be imported explicitly with the command
7866 .Ic environ
7867 and henceforth share said properties.
7870 Two different kinds of internal variables exist, and both of which can
7871 also form chains.
7872 There are boolean variables, which can only be in one of the two states
7873 .Dq set
7875 .Dq unset ,
7876 and value variables with a(n optional) string value.
7877 For the latter proper quoting is necessary upon assignment time, the
7878 introduction of the section
7879 .Sx COMMANDS
7880 documents the supported quoting rules.
7882 .Bd -literal -offset indent
7883 ? wysh set one=val\e 1 two="val 2" \e
7884     three='val "3"' four=$'val \e'4\e''; \e
7885     varshow one two three four; \e
7886     unset one two three four
7890 Dependent upon the actual option the string values will be interpreted
7891 as numbers, colour names, normal text etc., but there also exists
7892 a special kind of string value, the
7893 .Dq boolean string ,
7894 which must either be a decimal integer (in which case
7895 .Ql 0
7896 is false and
7897 .Ql 1
7898 and any other value is true) or any of the (case-insensitive) strings
7899 .Ql off ,
7900 .Ql no ,
7901 .Ql n
7903 .Ql false
7904 for a false boolean and
7905 .Ql on ,
7906 .Ql yes ,
7907 .Ql y
7909 .Ql true
7910 for a true boolean; a special kind of boolean string is the
7911 .Dq quadoption ,
7912 which is a boolean string that can optionally be prefixed with the
7913 (case-insensitive) term
7914 .Ql ask- ,
7915 as in
7916 .Ql ask-yes ,
7917 which causes prompting of the user in interactive mode, with the given
7918 boolean as the default value.
7921 Variable chains extend a plain
7922 .Ql variable
7923 with
7924 .Ql variable-HOST
7926 .Ql variable-USER@HOST
7927 variants.
7928 Here
7929 .Ql HOST
7930 indeed means
7931 .Ql server:port
7932 if a
7933 .Ql port
7934 had been specified in the contextual Uniform Resource Locator URL (see
7935 .Sx "On URL syntax and credential lookup" ) .
7936 Even though this mechanism is based on URLs no URL percent encoding may
7937 be applied to neither of
7938 .Ql USER
7940 .Ql HOST ,
7941 variable chains need to be specified using raw data.
7942 Variables which support chains are explicitly documented as such.
7944 .\" .Ss "Initial settings" {{{
7945 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7946 .Ss "Initial settings"
7948 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7949 variable settings:
7950 .Pf no Va allnet ,
7951 .Pf no Va append ,
7952 .Va asksub ,
7953 .Pf no Va askbcc ,
7954 .Pf no Va autoprint ,
7955 .Pf no Va bang ,
7956 .Pf no Va cmd ,
7957 .Pf no Va crt ,
7958 .Pf no Va debug ,
7959 .Pf no Va dot ,
7960 .Va escape
7961 set to
7962 .Ql ~ ,
7963 .Pf no Va flipr ,
7964 .Pf no Va folder ,
7965 .Va header ,
7966 .Pf no Va hold ,
7967 .Pf no Va ignore ,
7968 .Pf no Va ignoreeof ,
7969 .Pf no Va keep ,
7970 .Pf no Va keepsave ,
7971 .Pf no Va metoo ,
7972 .Pf no Va outfolder ,
7973 .Pf no Va page ,
7974 .Va prompt
7975 set to
7976 .Ql ?\0 ,
7977 .Pf no Va quiet ,
7978 .Pf no Va record ,
7979 .Va save ,
7980 .Pf no Va sendwait ,
7981 .Pf no Va showto ,
7982 .Pf no Va Sign ,
7983 .Pf no Va sign ,
7984 .Va toplines
7985 set to
7986 .Ql 5 .
7989 Notes: \*(UA does not support the
7990 .Pf no Va onehop
7991 variable \(en use command line options or
7992 .Va mta-arguments
7993 to pass options through to a
7994 .Va mta .
7995 And the default global
7996 .Pa \*(UR
7997 file, which is loaded unless the
7998 .Fl \&:
7999 (with according argument) or
8000 .Fl n
8001 command line options have been used, or the
8002 .Ev MAILX_NO_SYSTEM_RC
8003 environment variable is set (see
8004 .Sx "Resource files" )
8005 bends those initial settings a bit, e.g., it sets the variables
8006 .Va hold ,
8007 .Va keepsave
8009 .Va keep ,
8010 to name a few, establishes a default
8011 .Ic headerpick
8012 selection etc., and should thus be taken into account.
8013 .\" }}}
8015 .\" .Ss "Variables" {{{
8016 .Ss "Variables"
8018 .Bl -tag -width ".It Va BaNg"
8021 .It Va \&?
8022 \*(RO The exit status of the last command, or the
8023 .Ic return
8024 value of the macro
8025 .Ic call Ns
8026 ed last.
8027 This status has a meaning in the state machine: in conjunction with
8028 .Va errexit
8029 any non-0 exit status will cause a program exit, and in
8030 .Va posix
8031 mode any error while loading (any of the) resource files will have the
8032 same effect.
8033 .Cm ignerr ,
8034 one of the
8035 .Sx "Command modifiers" ,
8036 can be used to instruct the state machine to ignore errors.
8039 .It Va \&!
8040 \*(RO The current error number
8041 .Pf ( Xr errno 3 ) ,
8042 which is set after an error occurred; it is also available via
8043 .Va ^ERR ,
8044 and the error name and documentation string can be queried via
8045 .Va ^ERRNAME
8047 .Va ^ERRDOC .
8048 \*(ID This machinery is new and the error number is only really usable
8049 if a command explicitly states that it manages the variable
8050 .Va \&! ,
8051 for others errno will be used in case of errors, or
8052 .Va ^ERR Ns -INVAL
8053 if that is 0: it thus may or may not reflect the real error.
8054 The error number may be set with the command
8055 .Ic return .
8059 .It Va ^
8060 \*(RO This is a multiplexer variable which performs dynamic expansion of
8061 the requested state or condition, of which there are:
8064 .Bl -tag -compact -width ".It Va BaNg"
8068 .It Va ^ERR , ^ERRDOC , ^ERRNAME
8069 The number, documentation, and name of the current
8070 .Xr errno 3 ,
8071 respectively, which is usually set after an error occurred.
8072 \*(ID This machinery is new and is usually reliable only if a command
8073 explicitly states that it manages the variable
8074 .Va \&! ,
8075 which is effectively identical to
8076 .Va \&\&^ERR .
8077 Each of those variables can be suffixed with a hyphen minus followed by
8078 a name or number, in which case the expansion refers to the given error.
8079 Note this is a direct mapping of (a subset of) the system error values:
8080 .Bd -literal -offset indent
8081 define work {
8082   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
8083   vput vexpr i + "$1" 1
8084   if [ $i -lt 16 ]
8085     \excall work $i
8086   end
8088 call work 0
8094 .It Va *
8095 \*(RO Expands all positional parameters (see
8096 .Va 1 ) ,
8097 separated by a space character.
8098 \*(ID The special semantics of the equally named special parameter of the
8099 .Xr sh 1
8100 are not yet supported.
8103 .It Va @
8104 \*(RO Expands all positional parameters (see
8105 .Va 1 ) ,
8106 separated by a space character.
8107 If placed in double quotation marks, each positional parameter is
8108 properly quoted to expand to a single parameter again.
8111 .It Va #
8112 \*(RO Expands to the number of positional parameters, i.e., the size of
8113 the positional parameter stack in decimal.
8116 .It Va \&0
8117 \*(RO Inside the scope of a
8118 .Ic define Ns
8119 d and
8120 .Ic call Ns
8121 ed macro this expands to the name of the calling macro, or to the empty
8122 string if the macro is running from top-level.
8123 For the \*(OPal regular expression search and replace operator of
8124 .Ic vexpr
8125 this expands to the entire matching expression.
8126 It represents the program name in global context.
8129 .It Va 1
8130 \*(RO Access of the positional parameter stack.
8131 All further parameters can be accessed with this syntax, too, e.g.,
8132 .Ql 2 ,
8133 .Ql 3
8134 etc.; positional parameters can be shifted off the stack by calling
8135 .Ic shift .
8136 The parameter stack contains, e.g., the arguments of a
8137 .Ic call Ns
8139 .Ic define Ns
8140 d macro, the matching groups of the \*(OPal regular expression search
8141 and replace expression of
8142 .Ic vexpr ,
8143 and can be explicitly created or overwritten with the command
8144 .Ic vpospar .
8147 .It Va account
8148 \*(RO Is set to the active
8149 .Ic account .
8152 .It Va add-file-recipients
8153 \*(BO When file or pipe recipients have been specified,
8154 mention them in the corresponding address fields of the message instead
8155 of silently stripping them from their recipient list.
8156 By default such addressees are not mentioned.
8159 .It Va allnet
8160 \*(BO Causes only the local part to be evaluated
8161 when comparing addresses.
8164 .It Va append
8165 \*(BO Causes messages saved in the
8166 .Mx -sx
8167 .Sx "secondary mailbox"
8168 .Ev MBOX
8169 to be appended to the end rather than prepended.
8170 This should always be set.
8173 .It Va askatend
8174 \*(BO Causes the prompts for
8175 .Ql Cc:
8177 .Ql Bcc:
8178 lists to appear after the message has been edited.
8181 .It Va askattach
8182 \*(BO If set, \*(UA asks for files to attach at the end of each message.
8183 An empty line finalizes the list.
8186 .It Va askcc
8187 \*(BO Causes the user to be prompted for carbon copy recipients
8188 (at the end of each message if
8189 .Va askatend
8191 .Va bsdcompat
8192 are set).
8195 .It Va askbcc
8196 \*(BO Causes the user to be prompted for blind carbon copy
8197 recipients (at the end of each message if
8198 .Va askatend
8200 .Va bsdcompat
8201 are set).
8204 .It Va asksend
8205 \*(BO Causes the user to be prompted for confirmation to send the
8206 message or reenter compose mode after having been shown an envelope
8207 summary.
8208 This is by default enabled.
8211 .It Va asksign
8212 \*(BO\*(OP Causes the user to be prompted if the message is to be
8213 signed at the end of each message.
8215 .Va smime-sign
8216 variable is ignored when this variable is set.
8219 .It Va asksub
8220 .\" The alternative *ask* is not documented on purpose
8221 \*(BO Causes \*(UA to prompt for the subject upon entering compose mode
8222 unless a subject already exists.
8225 .It Va attrlist
8226 A sequence of characters to display in the
8227 .Ql attribute
8228 column of the
8229 .Va headline
8230 as shown in the display of
8231 .Ic headers ;
8232 each for one type of messages (see
8233 .Sx "Message states" ) ,
8234 with the default being
8235 .Ql NUROSPMFAT+\-$~
8237 .Ql NU\ \ *HMFAT+\-$~
8238 if the
8239 .Va bsdflags
8240 variable is set, in the following order:
8242 .Bl -tag -compact -width ".It Ql _"
8243 .It Ql N
8244 new.
8245 .It Ql U
8246 unread but old.
8247 .It Ql R
8248 new but read.
8249 .It Ql O
8250 read and old.
8251 .It Ql S
8252 saved.
8253 .It Ql P
8254 preserved.
8255 .It Ql M
8256 mboxed.
8257 .It Ql F
8258 flagged.
8259 .It Ql A
8260 answered.
8261 .It Ql T
8262 draft.
8263 .It Ql +
8264 start of a collapsed thread.
8265 .It Ql -
8266 an uncollapsed thread (TODO ignored for now).
8267 .It Ql $
8268 classified as spam.
8269 .It Ql ~
8270 classified as possible spam.
8275 .It Va autobcc
8276 Specifies a list of recipients to which a blind carbon copy of each
8277 outgoing message will be sent automatically.
8280 .It Va autocc
8281 Specifies a list of recipients to which a carbon copy of each outgoing
8282 message will be sent automatically.
8285 .It Va autocollapse
8286 \*(BO Causes threads to be collapsed automatically when threaded mode
8287 is entered (see the
8288 .Ic collapse
8289 command).
8292 .It Va autoprint
8293 \*(BO Enable automatic
8294 .Ic type Ns
8295 ing of a(n existing)
8296 .Dq successive
8297 message after
8298 .Ic delete
8300 .Ic undelete
8301 commands, e.g., the message that becomes the new
8302 .Dq dot
8303 is shown automatically, as via
8304 .Ic dp
8306 .Ic dt .
8309 .It Va autosort
8310 Causes sorted mode (see the
8311 .Ic sort
8312 command) to be entered automatically with the value of this variable as
8313 sorting method when a folder is opened, e.g.,
8314 .Ql set autosort=thread .
8317 .It Va bang
8318 \*(BO Enables the substitution of all not (reverse-solidus) escaped
8319 exclamation mark
8320 .Ql \&!
8321 characters by the contents of the last executed command for the
8322 .Ic \&!
8323 shell escape command and
8324 .Ic ~! ,
8325 one of the compose mode
8326 .Sx "COMMAND ESCAPES" .
8327 If this variable is not set no reverse solidus stripping is performed.
8330 .It Va bind-timeout
8331 \*(OP Terminals generate multi-byte sequences for certain forms of
8332 input, for example for function and other special keys.
8333 Some terminals however do not write these multi-byte sequences as
8334 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
8335 This variable specifies the timeout in milliseconds that the MLE (see
8336 .Sx "On terminal control and line editor" )
8337 waits for more bytes to arrive unless it considers a sequence
8338 .Dq complete .
8339 The default is 200.
8342 .It Va bsdcompat
8343 \*(BO Sets some cosmetical features to traditional BSD style;
8344 has the same affect as setting
8345 .Va askatend
8346 and all other variables prefixed with
8347 .Ql bsd ;
8348 it also changes the behaviour of
8349 .Va emptystart
8350 (which does not exist in BSD).
8353 .It Va bsdflags
8354 \*(BO Changes the letters shown in the first column of a header
8355 summary to traditional BSD style.
8358 .It Va bsdheadline
8359 \*(BO Changes the display of columns in a header summary to traditional
8360 BSD style.
8363 .It Va bsdmsgs
8364 \*(BO Changes some informational messages to traditional BSD style.
8367 .It Va bsdorder
8368 \*(BO Causes the
8369 .Ql Subject:
8370 field to appear immediately after the
8371 .Ql To:
8372 field in message headers and with the
8373 .Ic ~h
8374 .Sx "COMMAND ESCAPES" .
8378 .It Va build-os , build-osenv
8379 \*(RO The operating system \*(UA has been build for, usually taken from
8380 .Xr uname 1
8382 .Ql uname -s
8384 .Ql uname -srm ,
8385 respectively, the former being lowercased.
8388 .It Va charset-7bit
8389 The value that should appear in the
8390 .Ql charset=
8391 parameter of
8392 .Ql Content-Type:
8393 MIME header fields when no character set conversion of the message data
8394 was performed.
8395 This defaults to US-ASCII, and the chosen character set should be
8396 US-ASCII compatible.
8399 .It Va charset-8bit
8400 \*(OP The default 8-bit character set that is used as an implicit last
8401 member of the variable
8402 .Va sendcharsets .
8403 This defaults to UTF-8 if character set conversion capabilities are
8404 available, and to ISO-8859-1 otherwise, in which case the only supported
8405 character set is
8406 .Va ttycharset
8407 and this variable is effectively ignored.
8408 Refer to the section
8409 .Sx "Character sets"
8410 for the complete picture of character set conversion in \*(UA.
8413 .It Va charset-unknown-8bit
8414 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8415 .Dq upgrade
8416 the content of a mail message by using a character set with the name
8417 .Ql unknown-8bit .
8418 Because of the unclassified nature of this character set \*(UA will not
8419 be capable to convert this character set to any other character set.
8420 If this variable is set any message part which uses the character set
8421 .Ql unknown-8bit
8422 is assumed to really be in the character set given in the value,
8423 otherwise the (final) value of
8424 .Va charset-8bit
8425 is used for this purpose.
8427 This variable will also be taken into account if a MIME type (see
8428 .Sx "The mime.types files" )
8429 of a MIME message part that uses the
8430 .Ql binary
8431 character set is forcefully treated as text.
8434 .It Va cmd
8435 The default value for the
8436 .Ic pipe
8437 command.
8440 .It Va colour-disable
8441 \*(BO\*(OP Forcefully disable usage of colours.
8442 Also see the section
8443 .Sx "Coloured display" .
8446 .It Va colour-pager
8447 \*(BO\*(OP Whether colour shall be used for output that is paged through
8448 .Ev PAGER .
8449 Note that pagers may need special command line options, e.g.,
8450 .Xr less 1
8451 requires the option
8452 .Fl \&\&R
8454 .Xr lv 1
8455 the option
8456 .Fl \&\&c
8457 in order to support colours.
8458 Often doing manual adjustments is unnecessary since \*(UA may perform
8459 adjustments dependent on the value of the environment variable
8460 .Ev PAGER
8461 (see there for more).
8465 .It Va contact-mail , contact-web
8466 \*(RO Addresses for contact per email and web, respectively, e.g., for
8467 bug reports, suggestions, or help regarding \*(UA.
8468 The former can be used directly:
8469 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
8472 .It Va crt
8473 In a(n interactive) terminal session, then if this valued variable is
8474 set it will be used as a threshold to determine how many lines the given
8475 output has to span before it will be displayed via the configured
8476 .Ev PAGER ;
8477 Usage of the
8478 .Ev PAGER
8479 can be forced by setting this to the value
8480 .Ql 0 ,
8481 setting it without a value will deduce the current height of the
8482 terminal screen to compute the treshold (see
8483 .Ev LINES ,
8484 .Va screen
8486 .Xr stty 1 ) .
8487 \*(ID At the moment this uses the count of lines of the message in wire
8488 format, which, dependent on the
8489 .Va mime-encoding
8490 of the message, is unrelated to the number of display lines.
8491 (The software is old and historically the relation was a given thing.)
8494 .It Va customhdr
8495 Define a set of custom headers to be injected into newly composed or
8496 forwarded messages; it is also possible to create custom headers in
8497 compose mode with
8498 .Ic ~^ ,
8499 which can be automated by setting one of the hooks
8500 .Va on-compose-splice
8502 .Va on-compose-splice-shell .
8503 The value is interpreted as a comma-separated list of custom headers to
8504 be injected, to include commas in the header bodies escape them with
8505 reverse solidus.
8506 \*(ID Overwriting of automatically managed headers is neither supported
8507 nor prevented.
8509 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
8512 .It Va datefield
8513 Controls the appearance of the
8514 .Ql %d
8515 date and time format specification of the
8516 .Va headline
8517 variable, that is used, for example, when viewing the summary of
8518 .Ic headers .
8519 If unset, then the local receiving date is used and displayed
8520 unformatted, otherwise the message sending
8521 .Ql Date: .
8522 It is possible to assign a
8523 .Xr strftime 3
8524 format string and control formatting, but embedding newlines via the
8525 .Ql %n
8526 format is not supported, and will result in display errors.
8527 The default is
8528 .Ql %Y-%m-%d %H:%M ,
8529 and also see
8530 .Va datefield-markout-older .
8533 .It Va datefield-markout-older
8534 Only used in conjunction with
8535 .Va datefield .
8536 Can be used to create a visible distinction of messages dated more than
8537 a day in the future, or older than six months, a concept comparable to the
8538 .Fl \&\&l
8539 option of the POSIX utility
8540 .Xr ls 1 .
8541 If set to the empty string, then the plain month, day and year of the
8542 .Ql Date:
8543 will be displayed, but a
8544 .Xr strftime 3
8545 format string to control formatting can be assigned.
8546 The default is
8547 .Ql %Y-%m-%d .
8550 .It Va debug
8551 \*(BO Enables debug messages and obsoletion warnings, disables the
8552 actual delivery of messages and also implies
8553 .Pf no Va record
8554 as well as
8555 .Pf no Va save .
8558 .It Va disposition-notification-send
8559 \*(BO\*(OP Emit a
8560 .Ql Disposition-Notification-To:
8561 header (RFC 3798) with the message.
8562 This requires the
8563 .Va from
8564 variable to be set.
8565 .\" TODO .It Va disposition-notification-send-HOST
8566 .\"Overrides
8567 .\".Va disposition-notification-send
8568 .\" for SMTP accounts on a specific host.
8569 .\" TODO .It Va disposition-notification-send-USER@HOST
8570 .\"Overrides
8571 .\".Va disposition-notification-send
8572 .\"for a specific account.
8575 .It Va dot
8576 \*(BO When dot is set, a period
8577 .Ql \&.
8578 on a line by itself during message input in (interactive or batch
8579 .Fl # )
8580 compose mode will be treated as end-of-message (in addition to the
8581 normal end-of-file condition).
8582 This behaviour is implied in
8583 .Va posix
8584 mode with a set
8585 .Va ignoreeof .
8588 .It Va dotlock-ignore-error
8589 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
8590 .Mx -sx
8591 .Sx "primary system mailbox" Ns
8592 es (see, e.g., the notes on
8593 .Sx "Filename transformations" ,
8594 as well as the documentation of
8595 .Ic file )
8596 will be protected with so-called dotlock files\(emthe traditional mail
8597 spool file locking method\(emin addition to system file locking.
8598 Because \*(UA ships with a privilege-separated dotlock creation program
8599 that should always be able to create such a dotlock file there is no
8600 good reason to ignore dotlock file creation errors, and thus these are
8601 fatal unless this variable is set.
8604 .It Va editalong
8605 \*(BO If this variable is set then the editor is started automatically
8606 when a message is composed in interactive mode, as if the
8607 .Ic ~e
8608 .Sx "COMMAND ESCAPES"
8609 had been specified.
8611 .Va editheaders
8612 variable is implied for this automatically spawned editor session.
8615 .It Va editheaders
8616 \*(BO When a message is edited while being composed,
8617 its header is included in the editable text.
8620 .It Va emptystart
8621 \*(BO When entering interactive mode \*(UA normally writes
8622 .Dq \&No mail for user
8623 and exits immediately if a mailbox is empty or does not exist.
8624 If this variable is set \*(UA starts even with an empty or non-existent
8625 mailbox (the latter behaviour furtherly depends upon
8626 .Va bsdcompat ,
8627 though).
8630 .It Va errexit
8631 \*(BO Let each command with a non-0 exit status, including every
8632 .Ic call Ns
8633 ed macro which
8634 .Ic return Ns
8635 s a non-0 status, cause a program exit unless prefixed by
8636 .Cm ignerr
8637 (see
8638 .Sx "Command modifiers" ) .
8639 This also affects
8640 .Sx "COMMAND ESCAPES" ,
8641 but which use a different modifier for ignoring the error.
8642 Please refer to the variable
8643 .Va \&?
8644 for more on this topic.
8647 .It Va escape
8648 The first character of this value defines the escape character for
8649 .Sx "COMMAND ESCAPES"
8650 in compose mode.
8651 The default value is the character tilde
8652 .Ql ~ .
8653 If set to the empty string, command escapes are disabled.
8656 .It Va expandaddr
8657 If not set then file and command pipeline targets are not allowed,
8658 and any such address will be filtered out, giving a warning message.
8659 If set without a value then all possible recipient address
8660 specifications will be accepted \(en see the section
8661 .Sx "On sending mail, and non-interactive mode"
8662 for more on this.
8663 To accept them, but only in interactive mode, or when tilde commands
8664 were enabled explicitly by using one of the command line options
8665 .Fl ~
8667 .Fl # ,
8668 set this to the (case-insensitive) value
8669 .Ql restrict
8670 (it actually acts like
8671 .Ql restrict,-all,+name,+addr ,
8672 so that care for ordering issues must be taken) .
8674 In fact the value is interpreted as a comma-separated list of values.
8675 If it contains
8676 .Ql fail
8677 then the existence of disallowed specifications is treated as a hard
8678 send error instead of only filtering them out.
8679 The remaining values specify whether a specific type of recipient
8680 address specification is allowed (optionally indicated by a plus sign
8681 .Ql +
8682 prefix) or disallowed (prefixed with a hyphen-minus
8683 .Ql - ) .
8684 The value
8685 .Ql all
8686 addresses all possible address specifications,
8687 .Ql file
8688 file targets,
8689 .Ql pipe
8690 command pipeline targets,
8691 .Ql name
8692 plain user names and (MTA) aliases and
8693 .Ql addr
8694 network addresses.
8695 These kind of values are interpreted in the given order, so that
8696 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8697 will cause hard errors for any non-network address recipient address
8698 unless \*(UA is in interactive mode or has been started with the
8699 .Fl ~
8701 .Fl #
8702 command line option; in the latter case(s) any address may be used, then.
8704 Historically invalid network addressees are silently stripped off.
8705 To change this so that any encountered invalid email address causes
8706 a hard error it must be ensured that
8707 .Ql failinvaddr
8708 is an entry in the above list.
8709 Setting this automatically enables network addressees
8710 (it actually acts like
8711 .Ql failinvaddr,+addr ,
8712 so that care for ordering issues must be taken) .
8715 .It Va expandargv
8716 Unless this variable is set additional
8717 .Va mta
8718 (Mail-Transfer-Agent)
8719 arguments from the command line, as can be given after a
8720 .Fl \&\&-
8721 separator, are ignored due to safety reasons.
8722 However, if set to the special (case-insensitive) value
8723 .Ql fail ,
8724 then the presence of additional MTA arguments is treated as a hard
8725 error that causes \*(UA to exit with failure status.
8726 A lesser strict variant is the otherwise identical
8727 .Ql restrict ,
8728 which does accept such arguments in interactive mode, or if tilde
8729 commands were enabled explicitly by using one of the command line options
8730 .Fl ~
8732 .Fl # .
8735 .It Va features
8736 \*(RO String giving a list of optional features, preceded with a plus sign
8737 .Ql +
8738 if it is available, and a hyphen-minus
8739 .Ql -
8740 otherwise.
8741 The output of the command
8742 .Ic version
8743 will include this information in a more pleasant output.
8746 .It Va flipr
8747 \*(BO This setting reverses the meanings of a set of reply commands,
8748 turning the lowercase variants, which by default address all recipients
8749 included in the header of a message
8750 .Pf ( Ic reply , respond , followup )
8751 into the uppercase variants, which by default address the sender only
8752 .Pf ( Ic Reply , Respond , Followup )
8753 and vice versa.
8754 The commands
8755 .Ic replysender , respondsender , followupsender
8756 as well as
8757 .Ic replyall , respondall , followupall
8758 are not affected by the current setting of
8759 .Va flipr .
8762 .It Va folder
8763 The default path under which mailboxes are to be saved:
8764 filenames that begin with the plus sign
8765 .Ql +
8766 will have the plus sign replaced with the value of this variable if set,
8767 otherwise the plus sign will remain unchanged when doing
8768 .Sx "Filename transformations" ;
8769 also see
8770 .Ic file
8771 for more on this topic.
8772 The value supports a subset of transformations itself, and if the
8773 non-empty value does not start with a solidus
8774 .Ql / ,
8775 then the value of
8776 .Ev HOME
8777 will be prefixed automatically.
8778 Once the actual value is evaluated first, the internal variable
8779 .Va folder-resolved
8780 will be updated for caching purposes.
8782 .Mx Va folder-hook
8783 .It Va folder-hook-FOLDER , Va folder-hook
8784 Names a
8785 .Ic define Ns d
8786 macro which will be called whenever a
8787 .Ic file
8788 is opened.
8789 The macro will also be invoked when new mail arrives,
8790 but message lists for commands executed from the macro
8791 only include newly arrived messages then.
8792 .Ic localopts
8793 are activated by default in a folder hook, causing the covered settings
8794 to be reverted once the folder is left again.
8796 The specialized form will override the generic one if
8797 .Ql FOLDER
8798 matches the file that is opened.
8799 Unlike other folder specifications, the fully expanded name of a folder,
8800 without metacharacters, is used to avoid ambiguities.
8801 However, if the mailbox resides under
8802 .Va folder
8803 then the usual
8804 .Ql +
8805 specification is tried in addition, e.g., if
8806 .Va \&\&folder
8808 .Dq mail
8809 (and thus relative to the user's home directory) then
8810 .Pa /home/usr1/mail/sent
8811 will be tried as
8812 .Ql folder-hook-/home/usr1/mail/sent
8813 first, but then followed by
8814 .Ql folder-hook-+sent .
8817 .It Va folder-resolved
8818 \*(RO Set to the fully resolved path of
8819 .Va folder
8820 once that evaluation has occurred; rather internal.
8823 .It Va followup-to
8824 \*(BO Controls whether a
8825 .Ql Mail-Followup-To:
8826 header is generated when sending messages to known mailing lists.
8827 Also see
8828 .Va followup-to-honour
8829 and the commands
8830 .Ic mlist , mlsubscribe , reply
8832 .Ic Lreply .
8835 .It Va followup-to-honour
8836 Controls whether a
8837 .Ql Mail-Followup-To:
8838 header is honoured when group-replying to a message via
8839 .Ic reply
8841 .Ic Lreply .
8842 This is a quadoption; if set without a value it defaults to
8843 .Dq yes .
8844 Also see
8845 .Va followup-to
8846 and the commands
8847 .Ic mlist
8849 .Ic mlsubscribe .
8852 .It Va forward-as-attachment
8853 \*(BO Original messages are normally sent as inline text with the
8854 .Ic forward
8855 command,
8856 and only the first part of a multipart message is included.
8857 With this setting enabled messages are sent as unmodified MIME
8858 .Ql message/rfc822
8859 attachments with all of their parts included.
8862 .It Va forward-inject-head
8863 The string to put before the text of a message with the
8864 .Ic forward
8865 command instead of the default
8866 .Dq -------- Original Message -------- .
8867 No heading is put if it is set to the empty string.
8868 This variable is ignored if the
8869 .Va forward-as-attachment
8870 variable is set.
8874 .It Va from
8875 The address (or a list of addresses) to put into the
8876 .Ql From:
8877 field of the message header, quoting RFC 5322:
8878 the author(s) of the message, that is, the mailbox(es) of the person(s)
8879 or system(s) responsible for the writing of the message.
8880 According to that RFC setting the
8881 .Va sender
8882 variable is required if
8883 .Va \&\&from
8884 contains more than one address.
8885 When
8886 .Ic reply Ns
8887 ing to messages these addresses are handled as if they were in the
8888 .Ic alternates
8889 list.
8892 If a file-based MTA is used, then
8893 .Va \&\&from
8894 (or, if that contains multiple addresses,
8895 .Va sender )
8896 can nonetheless be enforced to appear as the envelope sender address at
8897 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8898 .Fl r
8899 command line option (with an empty argument; see there for the complete
8900 picture on this topic), or by setting the internal variable
8901 .Va r-option-implicit .
8904 If the machine's hostname is not valid at the Internet (for example at
8905 a dialup machine) then either this variable or
8906 .Va hostname
8907 (\*(IN a SMTP-based
8908 .Va mta
8909 adds even more fine-tuning capabilities with
8910 .Va smtp-hostname ) ,
8911 have to be set; if so the message and MIME part related unique ID fields
8912 .Ql Message-ID:
8914 .Ql Content-ID:
8915 will be created (except when disallowed by
8916 .Va message-id-disable
8918 .Va stealthmua ) .
8922 .It Va fullnames
8923 \*(BO Due to historical reasons comments and name parts of email
8924 addresses are removed by default when sending mail, replying to or
8925 forwarding a message.
8926 If this variable is set such stripping is not performed.
8928 .It Va fwdheading
8929 \*(OB Predecessor of
8930 .Va forward-inject-head .
8933 .It Va header
8934 \*(BO Causes the header summary to be written at startup and after
8935 commands that affect the number of messages or the order of messages in
8936 the current
8937 .Ic folder .
8938 Unless in
8939 .Va posix
8940 mode a header summary will also be displayed on folder changes.
8941 The command line option
8942 .Fl N
8943 can be used to set
8944 .Pf no Va header .
8948 .It Va headline
8949 A format string to use for the summary of
8950 .Ic headers ,
8951 similar to the ones used for
8952 .Xr printf 3
8953 formats.
8954 Format specifiers in the given string start with a percent sign
8955 .Ql %
8956 and may be followed by an optional decimal number indicating the field
8957 width \(em if that is negative, the field is to be left-aligned.
8958 Valid format specifiers are:
8961 .Bl -tag -compact -width ".It Ql _%%_"
8962 .It Ql %%
8963 A plain percent sign.
8964 .It Ql %>
8965 .Dq Dotmark :
8966 a space character but for the current message
8967 .Pf ( Dq dot ) ,
8968 for which it expands to
8969 .Ql > .
8970 .It Ql %<
8971 .Dq Dotmark :
8972 a space character but for the current message
8973 .Pf ( Dq dot ) ,
8974 for which it expands to
8975 .Ql < .
8976 .It Ql %$
8977 \*(OP The spam score of the message, as has been classified via the
8978 command
8979 .Ic spamrate .
8980 Shows only a replacement character if there is no spam support.
8981 .It Ql %a
8982 Message attribute character (status flag); the actual content can be
8983 adjusted by setting
8984 .Va attrlist .
8985 .It Ql %d
8986 The date found in the
8987 .Ql From:
8988 header of the message when
8989 .Va datefield
8990 is set (the default), otherwise the date when the message was received.
8991 Formatting can be controlled by assigning a
8992 .Xr strftime 3
8993 format string to
8994 .Va datefield .
8995 .It Ql %e
8996 The indenting level in threaded mode.
8997 .It Ql %f
8998 The address of the message sender.
8999 .It Ql %i
9000 The message thread tree structure.
9001 (Note that this format does not support a field width.)
9002 .It Ql %l
9003 The number of lines of the message, if available.
9004 .It Ql %m
9005 Message number.
9006 .It Ql %o
9007 The number of octets (bytes) in the message, if available.
9008 .It Ql %s
9009 Message subject (if any).
9010 .It Ql %S
9011 Message subject (if any) in double quotes.
9012 .It Ql \&%T
9013 Message recipient flags: is the addressee of the message a known or
9014 subscribed mailing list \(en see
9015 .Ic mlist
9017 .Ic mlsubscribe .
9018 .It Ql %t
9019 The position in threaded/sorted order.
9022 The default is
9023 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
9025 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
9027 .Va bsdcompat
9028 is set.
9029 Also see
9030 .Va attrlist
9032 .Va headline-bidi .
9036 .It Va headline-bidi
9037 Bidirectional text requires special treatment when displaying headers,
9038 because numbers (in dates or for file sizes etc.) will not affect the
9039 current text direction, in effect resulting in ugly line layouts when
9040 arabic or other right-to-left text is to be displayed.
9041 On the other hand only a minority of terminals is capable to correctly
9042 handle direction changes, so that user interaction is necessary for
9043 acceptable results.
9044 Note that extended host system support is required nonetheless, e.g.,
9045 detection of the terminal character set is one precondition;
9046 and this feature only works in an Unicode (i.e., UTF-8) locale.
9048 In general setting this variable will cause \*(UA to encapsulate text
9049 fields that may occur when displaying
9050 .Va headline
9051 (and some other fields, like dynamic expansions in
9052 .Va prompt )
9053 with special Unicode control sequences;
9054 it is possible to fine-tune the terminal support level by assigning
9055 a value:
9056 no value (or any value other than
9057 .Ql 1 ,
9058 .Ql 2
9060 .Ql 3 )
9061 will make \*(UA assume that the terminal is capable to properly deal
9062 with Unicode version 6.3, in which case text is embedded in a pair of
9063 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
9064 characters.
9065 In addition no space on the line is reserved for these characters.
9067 Weaker support is chosen by using the value
9068 .Ql 1
9069 (Unicode 6.3, but reserve the room of two spaces for writing the control
9070 sequences onto the line).
9071 The values
9072 .Ql 2
9074 .Ql 3
9075 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
9076 again reserves room for two spaces in addition.
9079 .It Va history-file
9080 \*(OP If a line editor is available then this can be set to
9081 name the (expandable) path of the location of a permanent history file.
9082 Also see
9083 .Va history-size .
9086 .It Va history-gabby
9087 \*(BO\*(OP Add more entries to the history as is normally done.
9090 .It Va history-gabby-persist
9091 \*(BO\*(OP \*(UA's own MLE will not save the additional
9092 .Va history-gabby
9093 entries in persistent storage unless this variable is set.
9094 On the other hand it will not loose the knowledge of whether
9095 a persistent entry was gabby or not.
9096 Also see
9097 .Va history-file .
9100 .It Va history-size
9101 \*(OP Setting this variable imposes a limit on the number of concurrent
9102 history entries.
9103 If set to the value 0 then no further history entries will be added, and
9104 loading and incorporation of the
9105 .Va history-file
9106 upon program startup can also be suppressed by doing this.
9107 Runtime changes will not be reflected, but will affect the number of
9108 entries saved to permanent storage.
9111 .It Va hold
9112 \*(BO This setting controls whether messages are held in the system
9113 .Va inbox ,
9114 and it is set by default.
9117 .It Va hostname
9118 Used instead of the value obtained from
9119 .Xr uname 3
9121 .Xr getaddrinfo 3
9122 as the hostname when expanding local addresses, e.g., in
9123 .Ql From: .
9124 If either of
9125 .Va from
9126 or this variable Is set the message and MIME part related unique ID fields
9127 .Ql Message-ID:
9129 .Ql Content-ID:
9130 will be created (except when disallowed by
9131 .Va message-id-disable
9133 .Va stealthmua ) .
9134 Setting it to the empty string will cause the normal hostname to be
9135 used, but nonetheless enables creation of said ID fields.
9136 \*(IN in conjunction with the built-in SMTP
9137 .Va mta
9138 .Va smtp-hostname
9139 also influences the results:
9140 one should produce some test messages with the desired combination of
9141 .Va \&\&hostname ,
9142 and/or
9143 .Va from ,
9144 .Va sender
9145 etc. first.
9148 .It Va idna-disable
9149 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
9150 names according to the rules of IDNA (internationalized domain names
9151 for applications).
9152 Since the IDNA code assumes that domain names are specified with the
9153 .Va ttycharset
9154 character set, an UTF-8 locale charset is required to represent all
9155 possible international domain names (before conversion, that is).
9158 .It Va ifs
9159 The input field separator that is used (\*(ID by some functions) to
9160 determine where to split input data.
9162 .Bl -tag -compact -width ".It MMM"
9163 .It 1.
9164 Unsetting is treated as assigning the default value,
9165 .Ql \& \et\en .
9166 .It 2.
9167 If set to the empty value, no field splitting will be performed.
9168 .It 3.
9169 If set to a non-empty value, all whitespace characters are extracted
9170 and assigned to the variable
9171 .Va ifs-ws .
9174 .Bl -tag -compact -width ".It MMM"
9175 .It a.
9176 .Va \&\&ifs-ws
9177 will be ignored at the beginning and end of input.
9178 Diverging from POSIX shells default whitespace is removed in addition,
9179 which is owed to the entirely different line content extraction rules.
9180 .It b.
9181 Each occurrence of a character of
9182 .Va \&\&ifs
9183 will cause field-splitting, any adjacent
9184 .Va \&\&ifs-ws
9185 characters will be skipped.
9189 .It Va ifs-ws
9190 \*(RO Automatically deduced from the whitespace characters in
9191 .Va ifs .
9194 .It Va ignore
9195 \*(BO Ignore interrupt signals from the terminal while entering
9196 messages; instead echo them as
9197 .Ql @
9198 characters and discard the current line.
9201 .It Va ignoreeof
9202 \*(BO Ignore end-of-file conditions
9203 .Pf ( Ql control-D )
9204 in compose mode on message input and in interactive command input.
9205 If set an interactive command input session can only be left by
9206 explicitly using one of the commands
9207 .Ic exit
9209 .Ic quit ,
9210 and message input in compose mode can only be terminated by entering
9211 a period
9212 .Ql \&.
9213 on a line by itself or by using the
9214 .Ic ~.
9215 .Sx "COMMAND ESCAPES" ;
9216 Setting this implies the behaviour that
9217 .Va dot
9218 describes in
9219 .Va posix
9220 mode.
9223 .It Va inbox
9224 If this is set to a non-empty string it will specify the users
9225 .Mx -sx
9226 .Sx "primary system mailbox" ,
9227 overriding
9228 .Ev MAIL
9229 and the system-dependent default, and (thus) be used to replace
9230 .Ql %
9231 when doing
9232 .Sx "Filename transformations" ;
9233 also see
9234 .Ic file
9235 for more on this topic.
9236 The value supports a subset of transformations itself.
9239 .It Va indentprefix
9240 String used by the
9241 .Ic ~m , ~M
9243 .Ic ~R
9244 .Sx "COMMAND ESCAPES"
9245 and by the
9246 .Va quote
9247 option for indenting messages,
9248 in place of the normal tabulator character
9249 .Ql ^I ,
9250 which is the default.
9251 Be sure to quote the value if it contains spaces or tabs.
9254 .It Va keep
9255 \*(BO If set, an empty
9256 .Mx -sx
9257 .Sx "primary system mailbox"
9258 file is not removed.
9259 Note that, in conjunction with
9260 .Va posix
9261 mode any empty file will be removed unless this variable is set.
9262 This may improve the interoperability with other mail user agents
9263 when using a common folder directory, and prevents malicious users
9264 from creating fake mailboxes in a world-writable spool directory.
9265 \*(ID Only local regular (MBOX) files are covered, Maildir or other
9266 mailbox types will never be removed, even if empty.
9269 .It Va keep-content-length
9270 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
9271 be told to keep the
9272 .Ql Content-Length:
9274 .Ql Lines:
9275 header fields that some MUAs generate by setting this variable.
9276 Since \*(UA does neither use nor update these non-standardized header
9277 fields (which in itself shows one of their conceptual problems),
9278 stripping them should increase interoperability in between MUAs that
9279 work with with same mailbox files.
9280 Note that, if this is not set but
9281 .Va writebackedited ,
9282 as below, is, a possibly performed automatic stripping of these header
9283 fields already marks the message as being modified.
9284 \*(ID At some future time \*(UA will be capable to rewrite and apply an
9285 .Va mime-encoding
9286 to modified messages, and then those fields will be stripped silently.
9289 .It Va keepsave
9290 \*(BO When a message is saved it is usually discarded from the
9291 originating folder when \*(UA is quit.
9292 This setting causes all saved message to be retained.
9295 .It Va line-editor-disable
9296 \*(BO Turn off any enhanced line editing capabilities (see
9297 .Sx "On terminal control and line editor"
9298 for more).
9301 .It Va line-editor-no-defaults
9302 \*(BO\*(OP Do not establish any default key binding.
9305 .It Va log-prefix
9306 Error log message prefix string
9307 .Pf ( Ql "\*(uA: " ) .
9310 .It Va mailbox-display
9311 \*(RO The name of the current mailbox
9312 .Pf ( Ic file ) ,
9313 possibly abbreviated for display purposes.
9316 .It Va mailbox-resolved
9317 \*(RO The fully resolved path of the current mailbox.
9320 .It Va mailx-extra-rc
9321 An additional startup file that is loaded as the last of the
9322 .Sx "Resource files" .
9323 Use this file for commands that are not understood by other POSIX
9324 .Xr mailx 1
9325 implementations, i.e., mostly anything which is not covered by
9326 .Sx "Initial settings" .
9329 .It Va markanswered
9330 \*(BO When a message is replied to and this variable is set,
9331 it is marked as having been
9332 .Ic answered .
9333 See the section
9334 .Sx "Message states" .
9337 .It Va mbox-rfc4155
9338 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
9339 POSIX rules for detecting message boundaries (so-called
9340 .Ql From_
9341 lines) due to compatibility reasons, instead of the stricter rules that
9342 have been standardized in RFC 4155.
9343 This behaviour can be switched to the stricter RFC 4155 rules by
9344 setting this variable.
9345 (This is never necessary for any message newly generated by \*(UA,
9346 it only applies to messages generated by buggy or malicious MUAs, or may
9347 occur in old MBOX databases: \*(UA itself will choose a proper
9348 .Va mime-encoding
9349 to avoid false interpretation of
9350 .Ql From_
9351 content lines in the MBOX database.)
9353 This may temporarily be handy when \*(UA complains about invalid
9354 .Ql From_
9355 lines when opening a MBOX: in this case setting this variable and
9356 re-opening the mailbox in question may correct the result.
9357 If so, copying the entire mailbox to some other file, as in
9358 .Ql copy * SOME-FILE ,
9359 will perform proper, all-compatible
9360 .Ql From_
9361 quoting for all detected messages, resulting in a valid MBOX mailbox.
9362 Finally the variable can be unset again:
9363 .Bd -literal -offset indent
9364 define mboxfix {
9365   localopts yes; wysh set mbox-rfc4155;\e
9366     wysh File "${1}"; eval copy * "${2}"
9368 call mboxfix /tmp/bad.mbox /tmp/good.mbox
9372 .It Va memdebug
9373 \*(BO Internal development variable.
9376 .It Va message-id-disable
9377 \*(BO By setting this variable the generation of
9378 .Ql Message-ID:
9380 .Ql Content-ID:
9381 message and MIME part headers can be completely suppressed, effectively
9382 leaving this task up to the
9383 .Va mta
9384 (Mail-Transfer-Agent) or the SMTP server.
9385 Note that according to RFC 5321 a SMTP server is not required to add this
9386 field by itself, so it should be ensured that it accepts messages without
9387 .Ql Message-ID .
9390 .It Va message-inject-head
9391 A string to put at the beginning of each new message, followed by a newline.
9392 \*(OB The escape sequences tabulator
9393 .Ql \et
9394 and newline
9395 .Ql \en
9396 are understood (use the
9397 .Cm wysh
9398 prefix when
9399 .Ic set Ns
9400 ting the variable(s) instead).
9403 .It Va message-inject-tail
9404 A string to put at the end of each new message, followed by a newline.
9405 \*(OB The escape sequences tabulator
9406 .Ql \et
9407 and newline
9408 .Ql \en
9409 are understood (use the
9410 .Cm wysh
9411 prefix when
9412 .Ic set Ns
9413 ting the variable(s) instead).
9416 .It Va metoo
9417 \*(BO Usually, when an
9418 .Ic alias
9419 expansion contains the sender, the sender is removed from the expansion.
9420 Setting this option suppresses these removals.
9421 Note that a set
9422 .Va metoo
9423 also causes a
9424 .Ql -m
9425 option to be passed through to the
9426 .Va mta
9427 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
9428 this flag, no MTA is known which does not support it (for historical
9429 compatibility).
9432 .It Va mime-allow-text-controls
9433 \*(BO When sending messages, each part of the message is MIME-inspected
9434 in order to classify the
9435 .Ql Content-Type:
9437 .Ql Content-Transfer-Encoding:
9438 (see
9439 .Va mime-encoding )
9440 that is required to send this part over mail transport, i.e.,
9441 a computation rather similar to what the
9442 .Xr file 1
9443 command produces when used with the
9444 .Ql --mime
9445 option.
9447 This classification however treats text files which are encoded in
9448 UTF-16 (seen for HTML files) and similar character sets as binary
9449 octet-streams, forcefully changing any
9450 .Ql text/plain
9452 .Ql text/html
9453 specification to
9454 .Ql application/octet-stream :
9455 If that actually happens a yet unset charset MIME parameter is set to
9456 .Ql binary ,
9457 effectively making it impossible for the receiving MUA to automatically
9458 interpret the contents of the part.
9460 If this variable is set, and the data was unambiguously identified as
9461 text data at first glance (by a
9462 .Ql .txt
9464 .Ql .html
9465 file extension), then the original
9466 .Ql Content-Type:
9467 will not be overwritten.
9470 .It Va mime-alternative-favour-rich
9471 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
9472 HTML) will be preferred in favour of included plain text versions when
9473 displaying messages, provided that a handler exists which produces
9474 output that can be (re)integrated into \*(UA's normal visual display.
9475 (E.g., at the time of this writing some newsletters ship their full
9476 content only in the rich HTML part, whereas the plain text part only
9477 contains topic subjects.)
9480 .It Va mime-counter-evidence
9481 Normally the
9482 .Ql Content-Type:
9483 field is used to decide how to handle MIME parts.
9484 Some MUAs, however, do not use
9485 .Sx "The mime.types files"
9486 (also see
9487 .Sx "HTML mail and MIME attachments" )
9488 or a similar mechanism to correctly classify content, but specify an
9489 unspecific MIME type
9490 .Pf ( Ql application/octet-stream )
9491 even for plain text attachments.
9492 If this variable is set then \*(UA will try to re-classify such MIME
9493 message parts, if possible, for example via a possibly existing
9494 attachment filename.
9495 A non-empty value may also be given, in which case a number is expected,
9496 actually a carrier of bits.
9497 Creating the bit-carrying number is a simple addition:
9498 .Bd -literal -offset indent
9499 ? !echo Value should be set to $((2 + 4 + 8))
9500 Value should be set to 14
9503 .Bl -bullet -compact
9505 If bit two is set (2) then the detected
9506 .Ic mimetype
9507 will be carried along with the message and be used for deciding which
9508 MIME handler is to be used, for example;
9509 when displaying such a MIME part the part-info will indicate the
9510 overridden content-type by showing a plus sign
9511 .Ql + .
9513 If bit three is set (4) then the counter-evidence is always produced
9514 and a positive result will be used as the MIME type, even forcefully
9515 overriding the parts given MIME type.
9517 If bit four is set (8) then as a last resort the actual content of
9518 .Ql application/octet-stream
9519 parts will be inspected, so that data which looks like plain text can be
9520 treated as such.
9524 .It Va mime-encoding
9525 The MIME
9526 .Ql Content-Transfer-Encoding
9527 to use in outgoing text messages and message parts, where applicable.
9528 (7-bit clean text messages are sent as-is, without a transfer encoding.)
9529 Valid values are:
9531 .Bl -tag -compact -width ".It Ql _%%_"
9532 .It Ql 8bit
9533 .Pf (Or\0 Ql 8b . )
9534 8-bit transport effectively causes the raw data be passed through
9535 unchanged, but may cause problems when transferring mail messages over
9536 channels that are not ESMTP (RFC 1869) compliant.
9537 Also, several input data constructs are not allowed by the
9538 specifications and may cause a different transfer-encoding to be used.
9539 It is the default encoding.
9540 .It Ql quoted-printable
9541 .Pf (Or\0 Ql qp . )
9542 Quoted-printable encoding is 7-bit clean and has the property that ASCII
9543 characters are passed through unchanged, so that an english message can
9544 be read as-is; it is also acceptible for other single-byte locales that
9545 share many characters with ASCII, like, e.g., ISO-8859-1.
9546 The encoding will cause a large overhead for messages in other character
9547 sets: e.g., it will require up to twelve (12) bytes to encode a single
9548 UTF-8 character of four (4) bytes.
9549 .It Ql base64
9550 .Pf (Or\0 Ql b64 . )
9551 This encoding is 7-bit clean and will always be used for binary data.
9552 This encoding has a constant input:output ratio of 3:4, regardless of
9553 the character set of the input data it will encode three bytes of input
9554 to four bytes of output.
9555 This transfer-encoding is not human readable without performing
9556 a decoding step.
9560 .It Va mimetypes-load-control
9561 Can be used to control which of
9562 .Sx "The mime.types files"
9563 are loaded: if the letter
9564 .Ql u
9565 is part of the option value, then the user's personal
9566 .Pa ~/.mime.types
9567 file will be loaded (if it exists); likewise the letter
9568 .Ql s
9569 controls loading of the system wide
9570 .Pa /etc/mime.types ;
9571 directives found in the user file take precedence, letter matching is
9572 case-insensitive.
9573 If this variable is not set \*(UA will try to load both files.
9574 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
9575 but they will be matched last (the order can be listed via
9576 .Ic mimetype ) .
9578 More sources can be specified by using a different syntax: if the
9579 value string contains an equals sign
9580 .Ql =
9581 then it is instead parsed as a comma-separated list of the described
9582 letters plus
9583 .Ql f=FILENAME
9584 pairs; the given filenames will be expanded and loaded, and their
9585 content may use the extended syntax that is described in the section
9586 .Sx "The mime.types files" .
9587 Directives found in such files always take precedence (are prepended to
9588 the MIME type cache).
9592 .It Va mta
9593 To choose an alternate Mail-Transfer-Agent, set this option to either
9594 the full pathname of an executable (optionally prefixed with a
9595 .Ql file://
9596 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
9598 .Dl smtps?://[user[:password]@]server[:port]
9600 (\*(OU:
9601 .Ql [smtp://]server[:port] . )
9602 The default has been chosen at compile time.
9603 All supported data transfers are executed in child processes, which
9604 run asynchronously and without supervision unless either the
9605 .Va sendwait
9606 or the
9607 .Va verbose
9608 variable is set.
9609 If such a child receives a TERM signal, it will abort and
9610 .Va save
9611 the message to
9612 .Ev DEAD ,
9613 if so configured.
9616 For a file-based MTA it may be necessary to set
9617 .Va mta-argv0
9618 in in order to choose the right target of a modern
9619 .Xr mailwrapper 8
9620 environment.
9621 It will be passed command line arguments from several possible sources:
9622 from the variable
9623 .Va mta-arguments
9624 if set, from the command line if given and the variable
9625 .Va expandargv
9626 allows their use.
9627 Argument processing of the MTA will be terminated with a
9628 .Fl \&\&-
9629 separator.
9632 The otherwise occurring implicit usage of the following MTA command
9633 line arguments can be disabled by setting the boolean variable
9634 .Va mta-no-default-arguments
9635 (which will also disable passing
9636 .Fl \&\&-
9637 to the MTA):
9638 .Fl \&\&i
9639 (for not treating a line with only a dot
9640 .Ql \&.
9641 character as the end of input),
9642 .Fl \&\&m
9643 (shall the variable
9644 .Va metoo
9645 be set) and
9646 .Fl \&\&v
9647 (if the
9648 .Va verbose
9649 variable is set); in conjunction with the
9650 .Fl r
9651 command line option \*(UA will also (not) pass
9652 .Fl \&\&f
9653 as well as possibly
9654 .Fl \&\&F .
9657 \*(OPally \*(UA can send mail over SMTP network connections to a single
9658 defined SMTP smart host by specifying a SMTP URL as the value (see
9659 .Sx "On URL syntax and credential lookup" ) .
9660 Encrypted network connections are \*(OPally available, the section
9661 .Sx "Encrypted network communication"
9662 should give an overview and provide links to more information on this.
9663 \*(UA also supports forwarding of all network traffic over a specified
9664 .Va socks-proxy .
9665 Note that with some mail providers it may be necessary to set the
9666 .Va smtp-hostname
9667 variable in order to use a specific combination of
9668 .Va from ,
9669 .Va hostname
9671 .Va mta .
9672 The following SMTP variants may be used:
9674 .Bl -bullet
9676 The plain SMTP protocol (RFC 5321) that normally lives on the
9677 server port 25 and requires setting the
9678 .Va smtp-use-starttls
9679 variable to enter a SSL/TLS encrypted session state.
9680 Assign a value like \*(IN
9681 .Ql smtp://[user[:password]@]server[:port]
9682 (\*(OU
9683 .Ql smtp://server[:port] )
9684 to choose this protocol.
9686 The so-called SMTPS which is supposed to live on server port 465
9687 and is automatically SSL/TLS secured.
9688 Unfortunately it never became a standardized protocol and may thus not
9689 be supported by your hosts network service database
9690 \(en in fact the port number has already been reassigned to other
9691 protocols!
9693 SMTPS is nonetheless a commonly offered protocol and thus can be
9694 chosen by assigning a value like \*(IN
9695 .Ql smtps://[user[:password]@]server[:port]
9696 (\*(OU
9697 .Ql smtps://server[:port] ) ;
9698 due to the mentioned problems it is usually necessary to explicitly
9699 specify the port as
9700 .Ql :465 ,
9701 however.
9703 Finally there is the SUBMISSION protocol (RFC 6409), which usually
9704 lives on server port 587 and is practically identically to the SMTP
9705 protocol from \*(UA's point of view beside that; it requires setting the
9706 .Va smtp-use-starttls
9707 variable to enter a SSL/TLS secured session state.
9708 Assign a value like \*(IN
9709 .Ql submission://[user[:password]@]server[:port]
9710 (\*(OU
9711 .Ql submission://server[:port] ) .
9716 .It Va mta-arguments
9717 Arguments to pass through to a file-based
9718 .Va mta
9719 can be given via this variable, which is parsed according to
9720 .Sx "Shell-style argument quoting"
9721 into an array of arguments, and which will be joined onto MTA options
9722 from other sources, and then passed individually to the MTA:
9723 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
9726 .It Va mta-no-default-arguments
9727 \*(BO Unless this variable is set \*(UA will pass some well known
9728 standard command line options to a file-based
9729 .Va mta
9730 (Mail-Transfer-Agent), see there for more.
9733 .It Va mta-no-receiver-arguments
9734 \*(BO By default a file-based
9735 .Va mta
9736 will be passed all receiver addresses on the command line.
9737 This variable can be set to suppress any such argument.
9740 .It Va mta-argv0
9741 Many systems use a so-called
9742 .Xr mailwrapper 8
9743 environment to ensure compatibility with
9744 .Xr sendmail 1 .
9745 This works by inspecting the name that was used to invoke the mail
9746 delivery system.
9747 If this variable is set then the mailwrapper (the program that is
9748 actually executed when calling the file-based
9749 .Va mta )
9750 will treat its contents as that name.
9752 .Mx Va netrc-lookup
9753 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
9754 \*(BO\*(IN\*(OP Used to control usage of the users
9755 .Pa .netrc
9756 file for lookup of account credentials, as documented in the section
9757 .Sx "On URL syntax and credential lookup"
9758 and for the command
9759 .Ic netrc ;
9760 the section
9761 .Sx "The .netrc file"
9762 documents the file format.
9763 Also see
9764 .Va netrc-pipe .
9767 .It Va netrc-pipe
9768 \*(IN\*(OP When
9769 .Pa .netrc
9770 is loaded (see
9771 .Ic netrc
9773 .Va netrc-lookup )
9774 then \*(UA will read the output of a shell pipe instead of the users
9775 .Pa .netrc
9776 file if this variable is set (to the desired shell command).
9777 This can be used to, e.g., store
9778 .Pa .netrc
9779 in encrypted form:
9780 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
9783 .It Va newfolders
9784 If this variable has the value
9785 .Ql maildir ,
9786 newly created local folders will be in Maildir instead of MBOX format.
9789 .It Va newmail
9790 Checks for new mail in the current folder each time the prompt is shown.
9791 A Maildir folder must be re-scanned to determine if new mail has arrived.
9792 If this variable is set to the special value
9793 .Ql nopoll
9794 then a Maildir folder will not be rescanned completely, but only
9795 timestamp changes are detected.
9798 .It Va outfolder
9799 \*(BO Causes the filename given in the
9800 .Va record
9801 variable
9802 and the sender-based filenames for the
9803 .Ic Copy
9805 .Ic Save
9806 commands to be interpreted relative to the directory given in the
9807 .Va folder
9808 variable rather than to the current directory,
9809 unless it is set to an absolute pathname.
9811 .Mx Va on-account-cleanup
9812 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
9813 Macro hook which will be called once an
9814 .Ic account
9815 is left, as the very last step before unrolling per-account
9816 .Ic localopts .
9817 This hook is run even in case of fatal errors, and it is advisable to
9818 perform only absolutely necessary actions, like cleaning up
9819 .Ic alternates ,
9820 for example.
9821 The specialized form is used in favour of the generic one if found.
9824 .It Va on-compose-cleanup
9825 Macro hook which will be called after the message has been sent (or not,
9826 in case of failures), as the very last step before unrolling compose mode
9827 .Ic localopts .
9828 This hook is run even in case of fatal errors, and it is advisable to
9829 perform only absolutely necessary actions, like cleaning up
9830 .Ic alternates ,
9831 for example.
9833 For compose mode hooks that may affect the message content please see
9834 .Va on-compose-enter , on-compose-leave , on-compose-splice .
9835 \*(ID This hook exists because
9836 .Ic alias , alternates , commandalias , shortcut ,
9837 to name a few, are not covered by
9838 .Ic localopts :
9839 changes applied in compose mode will continue to be in effect thereafter.
9844 .It Va on-compose-enter , on-compose-leave
9845 Macro hooks which will be called once compose mode is entered,
9846 and after composing has been finished, but before a set
9847 .Va message-inject-tail
9848 has been injected etc., respectively.
9849 .Ic localopts
9850 are enabled for these hooks, and changes on variables will be forgotten
9851 after the message has been sent.
9852 .Va on-compose-cleanup
9853 can be used to perform other necessary cleanup steps.
9855 The following (read-only) variables will be set temporarily during
9856 execution of the macros to represent respective message headers, to
9857 the empty string otherwise; most of them correspond to according virtual
9858 message headers that can be accessed via
9859 .Ic ~^ ,
9860 one of the
9861 .Sx "COMMAND ESCAPES"
9862 (also from within
9863 .Va on-compose-splice
9864 hooks):
9867 .Bl -tag -compact -width ".It Va mailx_subject"
9868 .It Va mailx-command
9869 The command that generates the message.
9870 .It Va mailx-subject
9871 The subject.
9872 .It Va mailx-from
9873 .Va from .
9874 .It Va mailx-sender
9875 .Va sender .
9876 .It Va mailx-to , mailx-cc , mailx-bcc
9877 The list of receiver addresses as a space-separated list.
9878 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
9879 The list of receiver addresses before any mangling (due to, e.g.,
9880 .Ic alternates ,
9881 .Ic alias
9882 .Va recipients-in-cc )
9883 as a space-separated list.
9884 .It Va mailx-orig-from
9885 When replying, forwarding or resending, this will be set to the
9886 .Ql From:
9887 of the given message.
9888 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
9889 When replying, forwarding or resending, this will be set to the
9890 receivers of the given message.
9894 Here is am example that injects a signature via
9895 .Va message-inject-tail ;
9896 instead using
9897 .Va on-compose-splice
9898 to simply inject the file of desire via
9899 .Ic ~<
9901 .Ic ~<!
9902 may be a better approach.
9904 .Bd -literal -offset indent
9905 define t_ocl {
9906   vput ! i cat ~/.mysig
9907   if [ $? -eq 0 ]
9908      vput vexpr message-inject-tail trim-end $i
9909   end
9911   # Alternatively
9912   readctl create ~/.mysig
9913   if [ $? -eq 0 ]
9914     readall i
9915     if [ $? -eq 0 ]
9916       vput vexpr message-inject-tail trim-end $i
9917     end
9918     readctl remove ~/.mysig
9919   end
9921 set on-compose-leave=t_ocl
9927 .It Va on-compose-splice , on-compose-splice-shell
9928 These hooks run once the normal compose mode is finished, but before the
9929 .Va on-compose-leave
9930 macro hook is called, the
9931 .Va message-inject-tail
9932 is injected etc.
9933 Both hooks will be executed in a subprocess, with their input and output
9934 connected to \*(UA such that they can act as if they would be an
9935 interactive user.
9936 The difference in between them is that the latter is a
9937 .Ev SHELL
9938 command, whereas the former is a normal \*(UA macro, but which is
9939 restricted to a small set of commands (the
9940 .Va verbose
9941 output of, e.g.,
9942 .Ic list
9943 will indicate said capability).
9944 .Ic localopts
9945 are enabled for these hooks (in the parent process), causing any setting
9946 to be forgotten after the message has been sent;
9947 .Va on-compose-cleanup
9948 can be used to perform other cleanup as necessary.
9951 During execution of these hooks \*(UA will temporarily forget whether it
9952 has been started in interactive mode, (a restricted set of)
9953 .Sx "COMMAND ESCAPES"
9954 will always be available, and for guaranteed reproducibilities sake
9955 .Va escape
9957 .Va ifs
9958 will be set to their defaults.
9959 The compose mode command
9960 .Ic ~^
9961 has been especially designed for scriptability (via these hooks).
9962 The first line the hook will read on its standard input is the protocol
9963 version of said command escape, currently
9964 .Dq 0 0 1 :
9965 backward incompatible protocol changes have to be expected.
9968 Care must be taken to avoid deadlocks and other false control flow:
9969 if both involved processes wait for more input to happen at the
9970 same time, or one does not expect more input but the other is stuck
9971 waiting for consumption of its output, etc.
9972 There is no automatic synchronization of the hook: it will not be
9973 stopped automatically just because it, e.g., emits
9974 .Ql ~x .
9975 The hooks will however receive a termination signal if the parent enters
9976 an error condition.
9977 \*(ID Protection against and interaction with signals is not yet given;
9978 it is likely that in the future these scripts will be placed in an
9979 isolated session, which is signalled in its entirety as necessary.
9981 .Bd -literal -offset indent
9982 define ocs_signature {
9983   read version
9984   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
9986 set on-compose-splice=ocs_signature
9988 wysh set on-compose-splice-shell=$'\e
9989   read version;\e
9990   printf "hello $version!  Headers: ";\e
9991   echo \e'~^header list\e';\e
9992   read status result;\e
9993   echo "status=$status result=$result";\e
9994   '
9996 define ocsm {
9997   read version
9998   echo Splice protocol version is $version
9999   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
10000   if [ "$es" != 2 ]
10001     echoerr 'Cannot read header list'; echo '~x'; xit
10002   endif
10003   if [ "$hl" @i!% ' cc' ]
10004     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
10005       vput vexpr es substring "${es}" 0 1
10006     if [ "$es" != 2 ]
10007       echoerr 'Cannot insert Cc: header'; echo '~x'
10008       # (no xit, macro finishs anyway)
10009     endif
10010   endif
10012 set on-compose-splice=ocsm
10017 .It Va on-resend-cleanup
10018 \*(ID Identical to
10019 .Va on-compose-cleanup ,
10020 but is only triggered by
10021 .Ic resend .
10024 .It Va on-resend-enter
10025 \*(ID Identical to
10026 .Va on-compose-enter ,
10027 but is only triggered by
10028 .Ic resend .
10031 .It Va page
10032 \*(BO If set, each message feed through the command given for
10033 .Ic pipe
10034 is followed by a formfeed character
10035 .Ql \ef .
10037 .Mx Va password
10038 .It Va password-USER@HOST , password-HOST , password
10039 \*(IN Variable chain that sets a password, which is used in case none has
10040 been given in the protocol and account-specific URL;
10041 as a last resort \*(UA will ask for a password on the user's terminal if
10042 the authentication method requires a password.
10043 Specifying passwords in a startup file is generally a security risk;
10044 the file should be readable by the invoking user only.
10046 .It Va password-USER@HOST
10047 \*(OU (see the chain above for \*(IN)
10048 Set the password for
10049 .Ql USER
10050 when connecting to
10051 .Ql HOST .
10052 If no such variable is defined for a host,
10053 the user will be asked for a password on standard input.
10054 Specifying passwords in a startup file is generally a security risk;
10055 the file should be readable by the invoking user only.
10058 .It Va piperaw
10059 \*(BO Send messages to the
10060 .Ic pipe
10061 command without performing MIME and character set conversions.
10065 .It Va pipe-TYPE/SUBTYPE
10066 When a MIME message part of type
10067 .Ql TYPE/SUBTYPE
10068 (case-insensitive) is displayed or quoted,
10069 its text is filtered through the value of this variable interpreted as
10070 a shell command.
10071 Note that only parts which can be displayed inline as plain text (see
10072 .Cd copiousoutput )
10073 are displayed unless otherwise noted, other MIME parts will only be
10074 considered by and for the command
10075 .Ic mimeview .
10078 The special value commercial at
10079 .Ql @
10080 forces interpretation of the message part as plain text, e.g.,
10081 .Ql set pipe-application/xml=@
10082 will henceforth display XML
10083 .Dq as is .
10084 (The same could also be achieved by adding a MIME type marker with the
10085 .Ic mimetype
10086 command.
10087 And \*(OPally MIME type handlers may be defined via
10088 .Sx "The Mailcap files"
10089 \(em these directives,
10090 .Cd copiousoutput
10091 has already been used, should be referred to for further documentation.
10094 The commercial at
10095 .Ql @
10096 can in fact be used as a trigger character to adjust usage and behaviour
10097 of a following shell command specification more thoroughly by appending
10098 more special characters which refer to further mailcap directives, e.g.,
10099 the following hypothetical command specification could be used:
10101 .Bd -literal -offset indent
10102 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
10106 .Bl -tag -compact -width ".It Ql __"
10107 .It Ql *
10108 The command produces plain text to be integrated in \*(UAs output:
10109 .Cd copiousoutput .
10111 .It Ql #
10112 If set the handler will not be invoked when a message is to be quoted,
10113 but only when it will be displayed:
10114 .Cd x-mailx-noquote .
10116 .It Ql &
10117 Run the command asynchronously, i.e., without blocking \*(UA:
10118 .Cd x-mailx-async .
10120 .It Ql \&!
10121 The command must be run on an interactive terminal, \*(UA will
10122 temporarily release the terminal to it:
10123 .Cd needsterminal .
10125 .It Ql +
10126 Request creation of a zero-sized temporary file, the absolute pathname
10127 of which will be made accessible via the environment variable
10128 .Ev MAILX_FILENAME_TEMPORARY :
10129 .Cd x-mailx-tmpfile .
10130 If given twice then the file will be unlinked automatically by \*(UA
10131 when the command loop is entered again at latest:
10132 .Cd x-mailx-tmpfile-unlink .
10134 .It Ql =
10135 Normally the MIME part content is passed to the handler via standard
10136 input; if this flag is set then the data will instead be written into
10137 .Ev MAILX_FILENAME_TEMPORARY
10138 .Pf ( Cd x-mailx-tmpfile-fill ) ,
10139 the creation of which is implied; note however that in order to cause
10140 deletion of the temporary file you still have to use two plus signs
10141 .Ql ++
10142 explicitly!
10144 .It Ql @
10145 To avoid ambiguities with normal shell command content you can use
10146 another commercial at to forcefully terminate interpretation of
10147 remaining characters.
10148 (Any character not in this list will have the same effect.)
10152 Some information about the MIME part to be displayed is embedded into
10153 the environment of the shell command:
10156 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
10158 .It Ev MAILX_CONTENT
10159 The MIME content-type of the part, if known, the empty string otherwise.
10162 .It Ev MAILX_CONTENT_EVIDENCE
10164 .Va mime-counter-evidence
10165 includes the carry-around-bit (2), then this will be set to the detected
10166 MIME content-type; not only then identical to
10167 .Ev \&\&MAILX_CONTENT
10168 otherwise.
10171 .It Ev MAILX_EXTERNAL_BODY_URL
10172 MIME parts of type
10173 .Ql message/external-body access-type=url
10174 will store the access URL in this variable, it is empty otherwise.
10177 .It Ev MAILX_FILENAME
10178 The filename, if any is set, the empty string otherwise.
10181 .It Ev MAILX_FILENAME_GENERATED
10182 A random string.
10185 .It Ev MAILX_FILENAME_TEMPORARY
10186 If temporary file creation has been requested through the command prefix
10187 this variable will be set and contain the absolute pathname of the
10188 temporary file.
10193 .It Va pipe-EXTENSION
10194 This is identical to
10195 .Va pipe-TYPE/SUBTYPE
10196 except that
10197 .Ql EXTENSION
10198 (normalized to lowercase using character mappings of the ASCII charset)
10199 names a file extension, e.g.,
10200 .Ql xhtml .
10201 Handlers registered using this method take precedence.
10203 .Mx Va pop3-auth
10204 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
10205 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
10206 The only possible value as of now is
10207 .Ql plain ,
10208 which is thus the default.
10210 .Mx Va pop3-bulk-load
10211 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
10212 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
10213 the messages, and only requests the message bodies on user request.
10214 For the POP3 protocol this means that the message headers will be
10215 downloaded twice.
10216 If this variable is set then \*(UA will download only complete messages
10217 from the given POP3 server(s) instead.
10219 .Mx Va pop3-keepalive
10220 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
10221 \*(OP POP3 servers close the connection after a period of inactivity;
10222 the standard requires this to be at least 10 minutes,
10223 but practical experience may vary.
10224 Setting this variable to a numeric value greater than
10225 .Ql 0
10226 causes a
10227 .Ql NOOP
10228 command to be sent each value seconds if no other operation is performed.
10230 .Mx Va pop3-no-apop
10231 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
10232 \*(BO\*(OP Unless this variable is set the
10233 .Ql APOP
10234 authentication method will be used when connecting to a POP3 server that
10235 advertises support.
10236 The advantage of
10237 .Ql APOP
10238 is that the password is not sent in clear text over the wire and that
10239 only a single packet is sent for the user/password tuple.
10240 Note that
10241 .Va pop3-no-apop-HOST
10242 requires \*(IN.
10244 .Mx Va pop3-use-starttls
10245 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
10246 \*(BO\*(OP Causes \*(UA to issue a
10247 .Ql STLS
10248 command to make an unencrypted POP3 session SSL/TLS encrypted.
10249 This functionality is not supported by all servers,
10250 and is not used if the session is already encrypted by the POP3S method.
10251 Note that
10252 .Va pop3-use-starttls-HOST
10253 requires \*(IN.
10257 .It Va posix
10258 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
10259 where that deviates from standardized behaviour.
10260 It will be set implicitly before the
10261 .Sx "Resource files"
10262 are loaded if the environment variable
10263 .Ev POSIXLY_CORRECT
10264 is set, and adjusting any of those two will be reflected by the other
10265 one implicitly.
10266 The following behaviour is covered and enforced by this mechanism:
10269 .Bl -bullet -compact
10271 In non-interactive mode, any error encountered while loading resource
10272 files during program startup will cause a program exit, whereas in
10273 interactive mode such errors will stop loading of the currently loaded
10274 (stack of) file(s, i.e., recursively).
10275 These exits can be circumvented on a per-command base by using
10276 .Cm ignerr ,
10277 one of the
10278 .Sx "Command modifiers" ,
10279 for each command which shall be allowed to fail.
10282 .Ic alternates
10283 will replace the list of alternate addresses instead of appending to it.
10286 The variable inserting
10287 .Sx "COMMAND ESCAPES"
10288 .Ic ~A ,
10289 .Ic ~a ,
10290 .Ic ~I
10292 .Ic ~i
10293 will expand embedded character sequences
10294 .Ql \et
10295 horizontal tabulator and
10296 .Ql \en
10297 line feed.
10298 \*(ID For compatibility reasons this step will always be performed.
10301 Upon changing the active
10302 .Ic file
10303 no summary of
10304 .Ic headers
10305 will be displayed even if
10306 .Va header
10307 is set.
10310 Setting
10311 .Va ignoreeof
10312 implies the behaviour described by
10313 .Va dot .
10316 The variable
10317 .Va keep
10318 is extended to cover any empty mailbox, not only empty
10319 .Mx -sx
10320 .Sx "primary system mailbox" Ns
10321 es: they will be removed when they are left in empty state otherwise.
10326 .It Va print-alternatives
10327 \*(BO When a MIME message part of type
10328 .Ql multipart/alternative
10329 is displayed and it contains a subpart of type
10330 .Ql text/plain ,
10331 other parts are normally discarded.
10332 Setting this variable causes all subparts to be displayed,
10333 just as if the surrounding part was of type
10334 .Ql multipart/mixed .
10337 .It Va prompt
10338 The string used as a prompt in interactive mode.
10339 Whenever the variable is evaluated the value is expanded as via
10340 dollar-single-quote expansion (see
10341 .Sx "Shell-style argument quoting" ) .
10342 This (post-assignment, i.e., second) expansion can be used to embed
10343 status information, for example
10344 .Va \&? ,
10345 .Va \&! ,
10346 .Va account
10348 .Va mailbox-display .
10350 In order to embed characters which should not be counted when
10351 calculating the visual width of the resulting string, enclose the
10352 characters of interest in a pair of reverse solidus escaped brackets:
10353 .Ql \e[\eE[0m\e] ;
10354 a slot for coloured prompts is also available with the \*(OPal command
10355 .Ic colour .
10356 Prompting may be prevented by setting this to the null string
10357 (a.k.a.\|
10358 .Ql set noprompt ) .
10361 .It Va prompt2
10362 This string is used for secondary prompts, but is otherwise identical to
10363 .Va prompt .
10364 The default is
10365 .Ql ..\0 .
10368 .It Va quiet
10369 \*(BO Suppresses the printing of the version when first invoked.
10372 .It Va quote
10373 If set, \*(UA starts a replying message with the original message
10374 prefixed by the value of the variable
10375 .Va indentprefix .
10376 Normally, a heading consisting of
10377 .Dq Fromheaderfield wrote:
10378 is put before the quotation.
10379 If the string
10380 .Ql noheading
10381 is assigned to the
10382 .Va \&\&quote
10383 variable, this heading is omitted.
10384 If the string
10385 .Ql headers
10386 is assigned, only the headers selected by the
10387 .Ql type
10388 .Ic headerpick
10389 selection are put above the message body,
10390 thus
10391 .Va \&\&quote
10392 acts like an automatic
10393 .Pf ` Ic ~m Ns '
10394 .Sx "COMMAND ESCAPES"
10395 command, then.
10396 If the string
10397 .Ql allheaders
10398 is assigned, all headers are put above the message body and all MIME
10399 parts are included, making
10400 .Va \&\&quote
10401 act like an automatic
10402 .Pf ` Ic ~M Ns '
10403 command; also see
10404 .Va quote-as-attachment .
10407 .It Va quote-as-attachment
10408 \*(BO Add the original message in its entirety as a
10409 .Ql message/rfc822
10410 MIME attachment when replying to a message.
10411 Note this works regardless of the setting of
10412 .Va quote .
10415 .It Va quote-fold
10416 \*(OP Can be set in addition to
10417 .Va indentprefix .
10418 Setting this turns on a more fancy quotation algorithm in that leading
10419 quotation characters are compressed and overlong lines are folded.
10420 .Va \&\&quote-fold
10421 can be set to either one or two (space separated) numeric values,
10422 which are interpreted as the maximum (goal) and the minimum line length,
10423 respectively, in a spirit rather equal to the
10424 .Xr fmt 1
10425 program, but line-, not paragraph-based.
10426 If not set explicitly the minimum will reflect the goal algorithmically.
10427 The goal cannot be smaller than the length of
10428 .Va indentprefix
10429 plus some additional pad.
10430 Necessary adjustments take place silently.
10433 .It Va r-option-implicit
10434 \*(BO Setting this option evaluates the contents of
10435 .Va from
10436 (or, if that contains multiple addresses,
10437 .Va sender )
10438 and passes the results onto the used (file-based) MTA as described for the
10439 .Fl r
10440 option (empty argument case).
10443 .It Va recipients-in-cc
10444 \*(BO When doing a
10445 .Ic reply ,
10446 the original
10447 .Ql From:
10449 .Ql To:
10450 are by default merged into the new
10451 .Ql To: .
10452 If this variable is set, only the original
10453 .Ql From:
10454 ends in the new
10455 .Ql To: ,
10456 the rest is merged into
10457 .Ql Cc: .
10460 .It Va record
10461 Unless this variable is defined, no copies of outgoing mail will be saved.
10462 If defined it gives the pathname, subject to the usual
10463 .Sx "Filename transformations" ,
10464 of a folder where all new, replied-to or forwarded messages are saved:
10465 when saving to this folder fails the message is not sent, but instead
10466 .Va save Ns
10467 d to
10468 .Ev DEAD .
10469 The standard defines that relative (fully expanded) paths are to be
10470 interpreted relative to the current directory
10471 .Pf ( Ic cwd ) ,
10472 to force interpretation relative to
10473 .Va folder
10474 .Va outfolder
10475 needs to be set in addition.
10478 .It Va record-files
10479 \*(BO If this variable is set the meaning of
10480 .Va record
10481 will be extended to cover messages which target only file and pipe
10482 recipients (see
10483 .Va expandaddr ) .
10484 These address types will not appear in recipient lists unless
10485 .Va add-file-recipients
10486 is also set.
10489 .It Va record-resent
10490 \*(BO If this variable is set the meaning of
10491 .Va record
10492 will be extended to also cover the
10493 .Ic resend
10495 .Ic Resend
10496 commands.
10499 .It Va reply-in-same-charset
10500 \*(BO If this variable is set \*(UA first tries to use the same
10501 character set of the original message for replies.
10502 If this fails, the mechanism described in
10503 .Sx "Character sets"
10504 is evaluated as usual.
10507 .It Va reply-strings
10508 Can be set to a comma-separated list of (case-insensitive according to
10509 ASCII rules) strings which shall be recognized in addition to the
10510 built-in strings as
10511 .Ql Subject:
10512 reply message indicators \(en built-in are
10513 .Ql Re: ,
10514 which is mandated by RFC 5322, as well as the german
10515 .Ql Aw: ,
10516 .Ql Antw: ,
10517 and the
10518 .Ql Wg:
10519 which often has been seen in the wild;
10520 I.e., the separating colon has to be specified explicitly.
10523 .It Va reply-to
10524 A list of addresses to put into the
10525 .Ql Reply-To:
10526 field of the message header.
10527 Members of this list are handled as if they were in the
10528 .Ic alternates
10529 list.
10531 .It Va replyto
10532 \*(OB Variant of
10533 .Va reply-to .
10536 .It Va reply-to-honour
10537 Controls whether a
10538 .Ql Reply-To:
10539 header is honoured when replying to a message via
10540 .Ic reply
10542 .Ic Lreply .
10543 This is a quadoption; if set without a value it defaults to
10544 .Dq yes .
10547 .It Va rfc822-body-from_
10548 \*(BO This variable can be used to force displaying a so-called
10549 .Ql From_
10550 line for messages that are embedded into an envelope mail via the
10551 .Ql message/rfc822
10552 MIME mechanism, for more visual convenience.
10555 .It Va save
10556 \*(BO Enable saving of (partial) messages in
10557 .Ev DEAD
10558 upon interrupt or delivery error.
10561 .It Va screen
10562 The number of lines that represents a
10563 .Dq screenful
10564 of lines, used in
10565 .Ic headers
10566 summary display,
10567 .Ic from
10568 .Ic search Ns
10569 ing, message
10570 .Ic top Ns
10571 line display and scrolling via
10572 .Ic z .
10573 If this variable is not set \*(UA falls back to a calculation based upon
10574 the detected terminal window size and the baud rate: the faster the
10575 terminal, the more will be shown.
10576 Overall screen dimensions and pager usage is influenced by the
10577 environment variables
10578 .Ev COLUMNS
10580 .Ev LINES
10581 and the variable
10582 .Va crt .
10585 .It Va searchheaders
10586 \*(BO Expand message-list specifiers in the form
10587 .Ql /x:y
10588 to all messages containing the substring
10589 .Dq y
10590 in the header field
10591 .Ql x .
10592 The string search is case insensitive.
10595 .It Va sendcharsets
10596 \*(OP A comma-separated list of character set names that can be used in
10597 outgoing internet mail.
10598 The value of the variable
10599 .Va charset-8bit
10600 is automatically appended to this list of character sets.
10601 If no character set conversion capabilities are compiled into \*(UA then
10602 the only supported charset is
10603 .Va ttycharset .
10604 Also see
10605 .Va sendcharsets-else-ttycharset
10606 and refer to the section
10607 .Sx "Character sets"
10608 for the complete picture of character set conversion in \*(UA.
10611 .It Va sendcharsets-else-ttycharset
10612 \*(BO\*(OP If this variable is set, but
10613 .Va sendcharsets
10614 is not, then \*(UA acts as if
10615 .Va sendcharsets
10616 had been set to the value of the variable
10617 .Va ttycharset .
10618 In effect this combination passes through the message data in the
10619 character set of the current locale encoding:
10620 therefore mail message text will be (assumed to be) in ISO-8859-1
10621 encoding when send from within a ISO-8859-1 locale, and in UTF-8
10622 encoding when send from within an UTF-8 locale.
10624 The 8-bit fallback
10625 .Va charset-8bit
10626 never comes into play as
10627 .Va ttycharset
10628 is implicitly assumed to be 8-bit and capable to represent all files the
10629 user may specify (as is the case when no character set conversion
10630 support is available in \*(UA and the only supported character set is
10631 .Va ttycharset :
10632 .Sx "Character sets" ) .
10633 This might be a problem for scripts which use the suggested
10634 .Ql LC_ALL=C
10635 setting, since in this case the character set is US-ASCII by definition,
10636 so that it is better to also override
10637 .Va ttycharset ,
10638 then.
10641 .It Va sender
10642 An address that is put into the
10643 .Ql Sender:
10644 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
10645 responsible for the actual transmission of the message.
10646 This field should normally not be used unless the
10647 .Va from
10648 field contains more than one address, on which case it is required.
10650 .Va \&\&sender
10651 address is handled as if it were in the
10652 .Ic alternates
10653 list; also see
10654 .Fl r ,
10655 .Va r-option-implicit .
10657 .It Va sendmail
10658 \*(OB Predecessor of
10659 .Va mta .
10661 .It Va sendmail-arguments
10662 \*(OB Predecessor of
10663 .Va mta-arguments .
10665 .It Va sendmail-no-default-arguments
10666 \*(OB\*(BO Predecessor of
10667 .Va mta-no-default-arguments .
10669 .It Va sendmail-progname
10670 \*(OB Predecessor of
10671 .Va mta-argv0 .
10674 .It Va sendwait
10675 \*(BO When sending a message wait until the
10676 .Va mta
10677 (including the built-in SMTP one) exits before accepting further commands.
10678 .Sy Only
10679 with this variable set errors reported by the MTA will be recognizable!
10680 If the MTA returns a non-zero exit status,
10681 the exit status of \*(UA will also be non-zero.
10684 .It Va showlast
10685 \*(BO This setting causes \*(UA to start at the last message
10686 instead of the first one when opening a mail folder.
10689 .It Va showname
10690 \*(BO Causes \*(UA to use the sender's real name instead of the plain
10691 address in the header field summary and in message specifications.
10694 .It Va showto
10695 \*(BO Causes the recipient of the message to be shown in the header
10696 summary if the message was sent by the user.
10699 .It Va Sign
10700 The value backing
10701 .Ic ~A ,
10702 one of the
10703 .Sx "COMMAND ESCAPES" .
10704 Also see
10705 .Va message-inject-tail ,
10706 .Va on-compose-leave
10708 .Va on-compose-splice .
10711 .It Va sign
10712 The value backing
10713 .Ic ~a ,
10714 one of the
10715 .Sx "COMMAND ESCAPES" .
10716 Also see
10717 .Va message-inject-tail ,
10718 .Va on-compose-leave
10720 .Va on-compose-splice .
10723 .It Va signature
10724 \*(OB Please use
10725 .Va on-compose-splice
10727 .Va on-compose-splice-shell
10729 .Va on-compose-leave
10730 and (if necessary)
10731 .Va message-inject-tail
10732 instead!
10735 .It Va skipemptybody
10736 \*(BO If an outgoing message does not contain any text in its first or
10737 only message part, do not send it but discard it silently (see also the
10738 command line option
10739 .Fl E ) .
10743 .It Va smime-ca-dir , smime-ca-file
10744 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10745 Enhanced Mail) format as a directory and a file, respectively, for the
10746 purpose of verification of S/MIME signed messages.
10747 It is possible to set both, the file will be loaded immediately, the
10748 directory will be searched whenever no match has yet been found.
10749 The set of CA certificates which are built into the SSL/TLS library can
10750 be explicitly turned off by setting
10751 .Va smime-ca-no-defaults ,
10752 and further fine-tuning is possible via
10753 .Va smime-ca-flags .
10756 .It Va smime-ca-flags
10757 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10758 storage, and the certificate verification that is used.
10759 The actual values and their meanings are documented for
10760 .Va ssl-ca-flags .
10763 .It Va smime-ca-no-defaults
10764 \*(BO\*(OP Do not load the default CA locations that are built into the
10765 used to SSL/TLS library to verify S/MIME signed messages.
10767 .Mx Va smime-cipher
10768 .It Va smime-cipher-USER@HOST , smime-cipher
10769 \*(OP Specifies the cipher to use when generating S/MIME encrypted
10770 messages (for the specified account).
10771 RFC 5751 mandates a default of
10772 .Ql aes128
10773 (AES-128 CBC).
10774 Possible values are (case-insensitive and) in decreasing cipher strength:
10775 .Ql aes256
10776 (AES-256 CBC),
10777 .Ql aes192
10778 (AES-192 CBC),
10779 .Ql aes128
10780 (AES-128 CBC),
10781 .Ql des3
10782 (DES EDE3 CBC, 168 bits; default if
10783 .Ql aes128
10784 is not available) and
10785 .Ql des
10786 (DES CBC, 56 bits).
10788 The actually available cipher algorithms depend on the cryptographic
10789 library that \*(UA uses.
10790 \*(OP Support for more cipher algorithms may be available through
10791 dynamic loading via, e.g.,
10792 .Xr EVP_get_cipherbyname 3
10793 (OpenSSL) if \*(UA has been compiled to support this.
10796 .It Va smime-crl-dir
10797 \*(OP Specifies a directory that contains files with CRLs in PEM format
10798 to use when verifying S/MIME messages.
10801 .It Va smime-crl-file
10802 \*(OP Specifies a file that contains a CRL in PEM format to use when
10803 verifying S/MIME messages.
10806 .It Va smime-encrypt-USER@HOST
10807 \*(OP If this variable is set, messages send to the given receiver are
10808 encrypted before sending.
10809 The value of the variable must be set to the name of a file that
10810 contains a certificate in PEM format.
10812 If a message is sent to multiple recipients,
10813 each of them for whom a corresponding variable is set will receive an
10814 individually encrypted message;
10815 other recipients will continue to receive the message in plain text
10816 unless the
10817 .Va smime-force-encryption
10818 variable is set.
10819 It is recommended to sign encrypted messages, i.e., to also set the
10820 .Va smime-sign
10821 variable.
10824 .It Va smime-force-encryption
10825 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
10828 .It Va smime-sign
10829 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
10830 and include the user's certificate as a MIME attachment.
10831 Signing a message enables a recipient to verify that the sender used
10832 a valid certificate,
10833 that the email addresses in the certificate match those in the message
10834 header and that the message content has not been altered.
10835 It does not change the message text,
10836 and people will be able to read the message as usual.
10837 Also see
10838 .Va smime-sign-cert , smime-sign-include-certs
10840 .Va smime-sign-message-digest .
10842 .Mx Va smime-sign-cert
10843 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
10844 \*(OP Points to a file in PEM format.
10845 For the purpose of signing and decryption this file needs to contain the
10846 user's private key, followed by his certificate.
10848 For message signing
10849 .Ql USER@HOST
10850 is always derived from the value of
10851 .Va from
10852 (or, if that contains multiple addresses,
10853 .Va sender ) .
10854 For the purpose of encryption the recipient's public encryption key
10855 (certificate) is expected; the command
10856 .Ic certsave
10857 can be used to save certificates of signed messages (the section
10858 .Sx "Signed and encrypted messages with S/MIME"
10859 gives some details).
10860 This mode of operation is usually driven by the specialized form.
10862 When decrypting messages the account is derived from the recipient
10863 fields
10864 .Pf ( Ql To:
10866 .Ql Cc: )
10867 of the message, which are searched for addresses for which such
10868 a variable is set.
10869 \*(UA always uses the first address that matches,
10870 so if the same message is sent to more than one of the user's addresses
10871 using different encryption keys, decryption might fail.
10873 For signing and decryption purposes it is possible to use encrypted
10874 keys, and the pseudo-host(s)
10875 .Ql USER@HOST.smime-cert-key
10876 for the private key
10877 (and
10878 .Ql USER@HOST.smime-cert-cert
10879 for the certificate stored in the same file)
10880 will be used for performing any necessary password lookup,
10881 therefore the lookup can be automatized via the mechanisms described in
10882 .Sx "On URL syntax and credential lookup" .
10883 For example, the hypothetical address
10884 .Ql bob@exam.ple
10885 could be driven with a private key / certificate pair path defined in
10886 .Va \&\&smime-sign-cert-bob@exam.ple ,
10887 and needed passwords would then be looked up via the pseudo hosts
10888 .Ql bob@exam.ple.smime-cert-key
10889 (and
10890 .Ql bob@exam.ple.smime-cert-cert ) .
10891 To include intermediate certificates, use
10892 .Va smime-sign-include-certs .
10894 .Mx Va smime-sign-include-certs
10895 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
10896 \*(OP If used, this is supposed to a consist of a comma-separated list
10897 of files, each of which containing a single certificate in PEM format to
10898 be included in the S/MIME message in addition to the
10899 .Va smime-sign-cert
10900 certificate.
10901 This can be used to include intermediate certificates of the certificate
10902 authority, in order to allow the receiver's S/MIME implementation to
10903 perform a verification of the entire certificate chain, starting from
10904 a local root certificate, over the intermediate certificates, down to the
10905 .Va smime-sign-cert .
10906 Even though top level certificates may also be included in the chain,
10907 they won't be used for the verification on the receiver's side.
10909 For the purpose of the mechanisms involved here,
10910 .Ql USER@HOST
10911 refers to the content of the internal variable
10912 .Va from
10913 (or, if that contains multiple addresses,
10914 .Va sender ) .
10915 The pseudo-host
10916 .Ql USER@HOST.smime-include-certs
10917 will be used for performing password lookups for these certificates,
10918 shall they have been given one, therefore the lookup can be automatized
10919 via the mechanisms described in
10920 .Sx "On URL syntax and credential lookup" .
10922 .Mx Va smime-sign-message-digest
10923 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
10924 \*(OP Specifies the message digest to use when signing S/MIME messages.
10925 RFC 5751 mandates a default of
10926 .Ql sha1 .
10927 Possible values are (case-insensitive and) in decreasing cipher strength:
10928 .Ql sha512 ,
10929 .Ql sha384 ,
10930 .Ql sha256 ,
10931 .Ql sha224
10933 .Ql md5 .
10935 The actually available message digest algorithms depend on the
10936 cryptographic library that \*(UA uses.
10937 \*(OP Support for more message digest algorithms may be available
10938 through dynamic loading via, e.g.,
10939 .Xr EVP_get_digestbyname 3
10940 (OpenSSL) if \*(UA has been compiled to support this.
10941 Remember that for this
10942 .Ql USER@HOST
10943 refers to the variable
10944 .Va from
10945 (or, if that contains multiple addresses,
10946 .Va sender ) .
10948 .It Va smtp
10949 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
10950 .Va mta .
10951 \*(ID For compatibility reasons a set
10952 .Va smtp
10953 is used in preference of
10954 .Va mta .
10956 .Mx Va smtp-auth
10957 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
10958 \*(OP Variable chain that controls the SMTP
10959 .Va mta
10960 authentication method, possible values are
10961 .Ql none
10962 (\*(OU default),
10963 .Ql plain
10964 (\*(IN default),
10965 .Ql login
10966 as well as the \*(OPal methods
10967 .Ql cram-md5
10969 .Ql gssapi .
10971 .Ql none
10972 method does not need any user credentials,
10973 .Ql gssapi
10974 requires a user name and all other methods require a user name and
10975 a password.
10976 See \*(IN
10977 .Va mta ,
10978 .Va user
10980 .Va password
10981 (\*(OU
10982 .Va smtp-auth-password
10984 .Va smtp-auth-user ) .
10985 Note that
10986 .Va smtp-auth-HOST
10987 is \*(IN.
10988 \*(OU: Note for
10989 .Va smtp-auth-USER@HOST :
10990 may override dependent on sender address in the variable
10991 .Va from .
10993 .It Va smtp-auth-password
10994 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
10995 If the authentication method requires a password, but neither
10996 .Va smtp-auth-password
10997 nor a matching
10998 .Va smtp-auth-password-USER@HOST
10999 can be found,
11000 \*(UA will ask for a password on the user's terminal.
11002 .It Va smtp-auth-password-USER@HOST
11003 \*(OU Overrides
11004 .Va smtp-auth-password
11005 for specific values of sender addresses, dependent upon the variable
11006 .Va from .
11008 .It Va smtp-auth-user
11009 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
11010 If the authentication method requires a user name, but neither
11011 .Va smtp-auth-user
11012 nor a matching
11013 .Va smtp-auth-user-USER@HOST
11014 can be found,
11015 \*(UA will ask for a user name on the user's terminal.
11017 .It Va smtp-auth-user-USER@HOST
11018 \*(OU Overrides
11019 .Va smtp-auth-user
11020 for specific values of sender addresses, dependent upon the variable
11021 .Va from .
11024 .It Va smtp-hostname
11025 \*(OP\*(IN Normally \*(UA uses the variable
11026 .Va from
11027 to derive the necessary
11028 .Ql USER@HOST
11029 information in order to issue a
11030 .Ql MAIL FROM:<>
11031 SMTP
11032 .Va mta
11033 command.
11034 Setting
11035 .Va smtp-hostname
11036 can be used to use the
11037 .Ql USER
11038 from the SMTP account
11039 .Pf ( Va mta
11040 or the
11041 .Va user
11042 variable chain)
11043 and the
11044 .Ql HOST
11045 from the content of this variable (or, if that is the empty string,
11046 .Va hostname
11047 or the local hostname as a last resort).
11048 This often allows using an address that is itself valid but hosted by
11049 a provider other than which (in
11050 .Va from )
11051 is about to send the message.
11052 Setting this variable also influences generated
11053 .Ql Message-ID:
11055 .Ql Content-ID:
11056 header fields.
11058 .Mx Va smtp-use-starttls
11059 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
11060 \*(BO\*(OP Causes \*(UA to issue a
11061 .Ql STARTTLS
11062 command to make an SMTP
11063 .Va mta
11064 session SSL/TLS encrypted, i.e., to enable transport layer security.
11066 .Mx Va socks-proxy
11067 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
11068 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
11069 \*(UA will proxy all of its network activities through it.
11070 This can be used to proxy SMTP, POP3 etc. network traffic through the
11071 Tor anonymizer, for example.
11072 The following would create a local SOCKS proxy on port 10000 that
11073 forwards to the machine
11074 .Ql HOST ,
11075 and from which the network traffic is actually instantiated:
11076 .Bd -literal -offset indent
11077 # Create local proxy server in terminal 1 forwarding to HOST
11078 $ ssh -D 10000 USER@HOST
11079 # Then, start a client that uses it in terminal 2
11080 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
11084 .It Va spam-interface
11085 \*(OP In order to use any of the spam-related commands (like, e.g.,
11086 .Ic spamrate )
11087 the desired spam interface must be defined by setting this variable.
11088 Please refer to the manual section
11089 .Sx "Handling spam"
11090 for the complete picture of spam handling in \*(UA.
11091 All or none of the following interfaces may be available:
11093 .Bl -tag -width ".It Ql _ilte_"
11094 .It Ql spamc
11095 Interaction with
11096 .Xr spamc 1
11097 from the
11098 .Xr spamassassin 1
11099 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
11100 suite.
11101 Different to the generic filter interface \*(UA will automatically add
11102 the correct arguments for a given command and has the necessary
11103 knowledge to parse the program's output.
11104 A default value for
11105 .Va spamc-command
11106 will have been compiled into the \*(UA binary if
11107 .Xr spamc 1
11108 has been found in
11109 .Ev PATH
11110 during compilation.
11111 Shall it be necessary to define a specific connection type (rather than
11112 using a configuration file for that), the variable
11113 .Va spamc-arguments
11114 can be used as in, e.g.,
11115 .Ql -d server.example.com -p 783 .
11116 It is also possible to specify a per-user configuration via
11117 .Va spamc-user .
11118 Note that this interface does not inspect the
11119 .Ql is-spam
11120 flag of a message for the command
11121 .Ic spamforget .
11123 .It Ql filter
11124 generic spam filter support via freely configurable hooks.
11125 This interface is meant for programs like
11126 .Xr bogofilter 1
11127 and requires according behaviour in respect to the hooks' exit
11128 status for at least the command
11129 .Ic spamrate
11130 .Pf ( Ql 0
11131 meaning a message is spam,
11132 .Ql 1
11133 for non-spam,
11134 .Ql 2
11135 for unsure and any other return value indicating a hard error);
11136 since the hooks can include shell code snippets diverting behaviour
11137 can be intercepted as necessary.
11138 The hooks are
11139 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
11140   spamfilter-rate
11142 .Va spamfilter-spam ;
11143 the manual section
11144 .Sx "Handling spam"
11145 contains examples for some programs.
11146 The process environment of the hooks will have the variable
11147 .Ev MAILX_FILENAME_GENERATED
11148 set.
11149 Note that spam score support for
11150 .Ic spamrate
11151 is not supported unless the \*(OPtional regular expression support is
11152 available and the
11153 .Va spamfilter-rate-scanscore
11154 variable is set.
11159 .It Va spam-maxsize
11160 \*(OP Messages that exceed this size will not be passed through to the
11161 configured
11162 .Va spam-interface .
11163 If unset or 0, the default of 420000 bytes is used.
11166 .It Va spamc-command
11167 \*(OP The path to the
11168 .Xr spamc 1
11169 program for the
11170 .Ql spamc
11171 .Va spam-interface .
11172 Note that the path is not expanded, but used
11173 .Dq as is .
11174 A fallback path will have been compiled into the \*(UA binary if the
11175 executable had been found during compilation.
11178 .It Va spamc-arguments
11179 \*(OP Even though \*(UA deals with most arguments for the
11180 .Ql spamc
11181 .Va spam-interface
11182 automatically, it may at least sometimes be desirable to specify
11183 connection-related ones via this variable, e.g.,
11184 .Ql -d server.example.com -p 783 .
11187 .It Va spamc-user
11188 \*(OP Specify a username for per-user configuration files for the
11189 .Ql spamc
11190 .Va spam-interface .
11191 If this is set to the empty string then \*(UA will use the name of the
11192 current
11193 .Va user .
11200 .It Va spamfilter-ham , spamfilter-noham , \
11201   spamfilter-nospam , spamfilter-rate , spamfilter-spam
11202 \*(OP Command and argument hooks for the
11203 .Ql filter
11204 .Va spam-interface .
11205 The manual section
11206 .Sx "Handling spam"
11207 contains examples for some programs.
11210 .It Va spamfilter-rate-scanscore
11211 \*(OP Because of the generic nature of the
11212 .Ql filter
11213 .Va spam-interface
11214 spam scores are not supported for it by default, but if the \*(OPnal
11215 regular expression support is available then setting this variable can
11216 be used to overcome this restriction.
11217 It is interpreted as follows: first a number (digits) is parsed that
11218 must be followed by a semicolon
11219 .Ql \&;
11220 and an extended regular expression.
11221 Then the latter is used to parse the first output line of the
11222 .Va spamfilter-rate
11223 hook, and, in case the evaluation is successful, the group that has been
11224 specified via the number is interpreted as a floating point scan score.
11226 .Mx Va ssl-ca-dir
11227 .Mx Va ssl-ca-file
11228 .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\
11229   ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file
11230 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
11231 Enhanced Mail) format as a directory and a file, respectively, for the
11232 purpose of verification of SSL/TLS server certificates.
11233 It is possible to set both, the file will be loaded immediately, the
11234 directory will be searched whenever no match has yet been found.
11235 The set of CA certificates which are built into the SSL/TLS library can
11236 be explicitly turned off by setting
11237 .Va ssl-ca-no-defaults ,
11238 and further fine-tuning is possible via
11239 .Va ssl-ca-flags ;
11240 also see
11241 .Xr SSL_CTX_load_verify_locations 3
11242 for more information.
11243 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
11244 establishing TLS connections to servers identified with hostnames.
11247 .Mx Va ssl-ca-flags
11248 .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags
11249 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
11250 storage, and the certificate verification that is used (also see
11251 .Va ssl-verify ) .
11252 The value is expected to consist of a comma-separated list of
11253 configuration directives, with any intervening whitespace being ignored.
11254 The directives directly map to flags that can be passed to
11255 .Xr X509_STORE_set_flags 3 ,
11256 which are usually defined in a file
11257 .Pa openssl/x509_vfy.h ,
11258 and the availability of which depends on the used SSL/TLS library
11259 version: a directive without mapping is ignored (error log subject to
11260 .Va debug ) .
11261 Directives currently understood (case-insensitively) include:
11264 .Bl -tag -compact -width ".It Cd BaNg"
11265 .It Cd no-alt-chains
11266 If the initial chain is not trusted, do not attempt to build an
11267 alternative chain.
11268 Setting this flag will make OpenSSL certificate verification match that
11269 of older OpenSSL versions, before automatic building and checking of
11270 alternative chains has been implemented; also see
11271 .Cd trusted-first .
11272 .It Cd no-check-time
11273 Do not check certificate/CRL validity against current time.
11274 .It Cd partial-chain
11275 By default partial, incomplete chains which cannot be verified up to the
11276 chain top, a self-signed root certificate, will not verify.
11277 With this flag set, a chain succeeds to verify if at least one signing
11278 certificate of the chain is in any of the configured trusted stores of
11279 CA certificates.
11280 The OpenSSL manual page
11281 .Xr SSL_CTX_load_verify_locations 3
11282 gives some advise how to manage your own trusted store of CA certificates.
11283 .It Cd strict
11284 Disable workarounds for broken certificates.
11285 .It Cd trusted-first
11286 Try building a chain using issuers in the trusted store first to avoid
11287 problems with server-sent legacy intermediate certificates.
11288 Newer versions of OpenSSL support alternative chain checking and enable
11289 it by default, resulting in the same behaviour; also see
11290 .Cd no-alt-chains .
11294 .Mx Va ssl-ca-no-defaults
11295 .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\
11296   ssl-ca-no-defaults
11297 \*(BO\*(OP Do not load the default CA locations that are built into the
11298 used to SSL/TLS library to verify SSL/TLS server certificates.
11300 .Mx Va ssl-cert
11301 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
11302 \*(OB\*(OP Please use the
11303 .Cd Certificate
11304 slot of
11305 .Va ssl-config-pairs .
11307 .Mx Va ssl-cipher-list
11308 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
11309 \*(OB\*(OP Please use the
11310 .Cd CipherList
11311 slot of
11312 .Va ssl-config-pairs .
11315 .It Va ssl-config-file
11316 \*(OP If this variable is set
11317 .Xr CONF_modules_load_file 3
11318 (if announced via
11319 .Ql +modules-load-file
11321 .Va ssl-features )
11322 is used to allow resource file based configuration of the SSL/TLS library.
11323 This happens once the library is used first, which may also be early
11324 during startup (logged with
11325 .Va verbose ) !
11326 If a non-empty value is given then the given file, after performing
11327 .Sx "Filename transformations" ,
11328 will be used instead of the global OpenSSL default, and it is an error
11329 if the file cannot be loaded.
11330 The application name will always be passed as
11331 .Ql \*(uA .
11332 Some SSL/TLS libraries support application-specific configuration via
11333 resource files loaded like this, please see
11334 .Va ssl-config-module .
11336 .Mx Va ssl-config-module
11337 .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\
11338   ssl-config-module
11339 \*(OP If file based application-specific configuration via
11340 .Va ssl-config-file
11341 is available, announced as
11342 .Ql +ctx-config
11344 .Va ssl-features ,
11345 indicating availability of
11346 .Xr SSL_CTX_config 3 ,
11347 then, it becomes possible to use a central SSL/TLS configuration file
11348 for all programs, including \*(uA, e.g.:
11349 .Bd -literal -offset indent
11350 # Register a configuration section for \*(uA
11351 \*(uA = mailx_master
11352 # The top configuration section creates a relation
11353 # in between dynamic SSL configuration and an actual
11354 # program specific configuration section
11355 [mailx_master]
11356 ssl_conf = mailx_ssl_config
11357 # Well that actual program specific configuration section
11358 # now can map individual ssl-config-module names to sections,
11359 # e.g., ssl-config-module=account_xy
11360 [mailx_ssl_config]
11361 account_xy = mailx_account_xy
11362 account_yz = mailx_account_yz
11363 [mailx_account_xy]
11364 MinProtocol = TLSv1.2
11365 Curves=P-521
11366 [mailx_account_yz]
11367 CipherString = TLSv1.2:!aNULL:!eNULL:
11368 MinProtocol = TLSv1.1
11369 Options = Bugs
11373 .Mx Va ssl-config-pairs
11374 .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs
11375 \*(OP The value of this variable chain will be interpreted as
11376 a comma-separated list of directive/value pairs.
11377 Different to when placing these pairs in a
11378 .Va ssl-config-module
11379 section of a
11380 .Va ssl-config-file
11381 commas
11382 .Ql \&,
11383 need to be escaped with a reverse solidus
11384 .Ql \e
11385 when included in pairs.
11386 Just likewise directives and values need to be separated by equals signs
11387 .Ql = ,
11388 any whitespace surrounding pair members is removed.
11389 Keys are (usually) case-insensitive.
11390 Unless proper support is announced by
11391 .Va ssl-features
11392 .Pf ( Ql +conf-ctx )
11393 only the keys below are supported, otherwise the pairs will be used
11394 directly as arguments to the function
11395 .Xr SSL_CONF_cmd 3 .
11396 Said equals sign
11397 .Ql =
11398 may be preceded with an asterisk
11399 .Ql *
11400 to indicate that
11401 .Sx "Filename transformations"
11402 shall be performed on the value; it is an error if these fail.
11405 .Bl -tag -compact -width ".It Cd C_rtificate"
11406 .It Cd Certificate
11407 Filename of a SSL/TLS client certificate (chain) required by some servers.
11408 Fallback support via
11409 .Xr SSL_CTX_use_certificate_chain_file 3 .
11410 .Sx "Filename transformations"
11411 are performed.
11412 .\" v15compat: remove the next sentence
11413 .Sy Note:
11414 if you use this you need to specify the private key via
11415 .Cd PrivateKey ,
11416 .Va ssl-key
11417 will not be used!
11419 .It Cd CipherList
11420 A list of ciphers for SSL/TLS connections, see
11421 .Xr ciphers 1 .
11422 By default no list of ciphers is set, resulting in a
11423 .Cd Protocol Ns - Ns
11424 specific list of ciphers (the protocol standards define lists of
11425 acceptable ciphers; possibly cramped by the used SSL/TLS library).
11426 Fallback support via
11427 .Xr SSL_CTX_set_cipher_list 3 .
11429 .It Cd Curves
11430 A list of supported elliptic curves, if applicable.
11431 By default no curves are set.
11432 Fallback support via
11433 .Xr SSL_CTX_set1_curves_list 3 ,
11434 if available.
11436 .It Cd MaxProtocol , MinProtocol
11437 The maximum and minimum supported SSL/TLS versions, respectively.
11438 Optional fallback support via
11439 .Xr SSL_CTX_set_max_proto_version 3
11441 .Xr SSL_CTX_set_min_proto_version 3
11443 .Va ssl-features
11444 announces
11445 .Ql +ctx-set-maxmin-proto ,
11446 otherwise this directive results in an error.
11447 The fallback uses an internal parser which understands the strings
11448 .Ql SSLv3 ,
11449 .Ql TLSv1 ,
11450 .Ql TLSv1.1 ,
11451 .Ql TLSv1.2 ,
11452 and the special value
11453 .Ql None ,
11454 which disables the given limit.
11456 .It Cd Options
11457 Various flags to set.
11458 Fallback via
11459 .Xr SSL_CTX_set_options 3 ,
11460 in which case any other value but (exactly)
11461 .Ql Bugs
11462 results in an error.
11464 .It Cd PrivateKey
11465 Filename of the private key in PEM format of a SSL/TLS client certificate.
11466 If unset, the name of the certificate file is used.
11467 .Sx "Filename transformations"
11468 are performed.
11469 Fallback via
11470 .Xr SSL_CTX_use_PrivateKey_file 3 .
11471 .\" v15compat: remove the next sentence
11472 .Sy Note:
11473 if you use this you need to specify the certificate (chain) via
11474 .Cd Certificate ,
11475 .Va ssl-cert
11476 will not be used!
11478 .It Cd Protocol
11479 The used SSL/TLS protocol.
11481 .Va ssl-features
11482 announces
11483 .Ql +conf-ctx
11485 .Ql ctx-set-maxmin-proto
11486 then using
11487 .Cd MaxProtocol
11489 .Cd MinProtocol
11490 is preferable.
11491 Fallback is
11492 .Xr SSL_CTX_set_options 3 ,
11493 driven via an internal parser which understands the strings
11494 .Ql SSLv3 ,
11495 .Ql TLSv1 ,
11496 .Ql TLSv1.1 ,
11497 .Ql TLSv1.2 ,
11498 and the special value
11499 .Ql ALL .
11500 Multiple protocols may be given as a comma-separated list, any
11501 whitespace is ignored, an optional plus sign
11502 .Ql +
11503 prefix enables, a hyphen-minus
11504 .Ql -
11505 prefix disables a protocol, so that
11506 .Ql -ALL, TLSv1.2
11507 enables only the TLSv1.2 protocol.
11513 .It Va ssl-crl-dir , ssl-crl-file
11514 \*(OP Specify a directory / a file, respectively that contains a CRL in
11515 PEM format to use when verifying SSL/TLS server certificates.
11517 .Mx Va ssl-curves
11518 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
11519 \*(OB\*(OP Please use the
11520 .Cd Curves
11521 slot of
11522 .Va ssl-config-pairs .
11525 .It Va ssl-features
11526 \*(OP\*(RO This expands to a comma separated list of the TLS/SSL library
11527 identity and optional TLS/SSL library features.
11528 Currently supported identities are
11529 .Ql libressl
11530 (LibreSSL) ,
11531 .Ql libssl-0x10100
11532 (OpenSSL v1.1.x series)
11534 .Ql libssl-0x10000
11535 (elder OpenSSL series, other clones).
11536 Optional features are preceded with a plus sign
11537 .Ql +
11538 when available, and with a hyphen-minus
11539 .Ql -
11540 otherwise:
11541 .Ql modules-load-file
11542 .Pf ( Va ssl-config-file ) ,
11543 .Ql conf-ctx
11544 .Pf ( Va ssl-config-pairs ) ,
11545 .Ql ctx-config
11546 .Pf ( Va ssl-config-module ) ,
11547 .Ql ctx-set-maxmin-proto
11548 .Pf ( Va ssl-config-pairs )
11550 .Ql rand-egd
11551 .Pf ( Va ssl-rand-egd ) .
11553 .Mx Va ssl-key
11554 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
11555 \*(OB\*(OP Please use the
11556 .Cd PrivateKey
11557 slot of
11558 .Va ssl-config-pairs .
11560 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
11561 \*(OB\*(OP Please use the
11562 .Cd Protocol
11563 slot of
11564 .Va ssl-config-pairs .
11566 .Mx Va ssl-protocol
11567 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
11568 \*(OB\*(OP Please use the
11569 .Cd Protocol
11570 slot of
11571 .Va ssl-config-pairs .
11574 .It Va ssl-rand-egd
11575 \*(OP Gives the pathname to an entropy daemon socket, see
11576 .Xr RAND_egd 3 .
11577 Not all SSL/TLS libraries support this,
11578 .Va ssl-features
11579 announces availability with
11580 .Ql +rand-egd .
11583 .It Va ssl-rand-file
11584 \*(OP Gives the filename to a file with random entropy data, see
11585 .Xr RAND_load_file 3 .
11586 If this variable is not set, or set to the empty string, or if the
11587 .Sx "Filename transformations"
11588 fail, then
11589 .Xr RAND_file_name 3
11590 will be used to create the filename.
11591 If the SSL PRNG was seeded successfully
11592 The file will be updated
11593 .Pf ( Xr RAND_write_file 3 )
11594 if and only if seeding and buffer stirring succeeds.
11595 This variable is only used if
11596 .Va ssl-rand-egd
11597 is not set (or not supported by the SSL/TLS library).
11599 .Mx Va ssl-verify
11600 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
11601 \*(OP Variable chain that sets the action to be performed if an error
11602 occurs during SSL/TLS server certificate validation against the
11603 specified or default trust stores
11604 .Va ssl-ca-dir ,
11605 .Va ssl-ca-file ,
11606 or the SSL/TLS library built-in defaults (unless usage disallowed via
11607 .Va ssl-ca-no-defaults ) ,
11608 and as fine-tuned via
11609 .Va ssl-ca-flags .
11610 Valid (case-insensitive) values are
11611 .Ql strict
11612 (fail and close connection immediately),
11613 .Ql ask
11614 (ask whether to continue on standard input),
11615 .Ql warn
11616 (show a warning and continue),
11617 .Ql ignore
11618 (do not perform validation).
11619 The default is
11620 .Ql ask .
11623 .It Va stealthmua
11624 If only set without an assigned value, then this setting inhibits the
11625 generation of the
11626 .Ql Message-ID: ,
11627 .Ql Content-ID:
11629 .Ql User-Agent:
11630 header fields that include obvious references to \*(UA.
11631 There are two pitfalls associated with this:
11632 First, the message id of outgoing messages is not known anymore.
11633 Second, an expert may still use the remaining information in the header
11634 to track down the originating mail user agent.
11635 If set to the value
11636 .Ql noagent ,
11637 then the mentioned
11638 .Ql Message-ID:
11640 .Ql Content-ID:
11641 suppression does not occur.
11645 .It Va termcap
11646 (\*(OP) This specifies a comma-separated list of
11647 .Lb libterminfo
11648 and/or
11649 .Lb libtermcap
11650 capabilities (see
11651 .Sx "On terminal control and line editor" ,
11652 escape commas with reverse solidus) to be used to overwrite or define
11653 entries.
11654 .Sy Note
11655 this variable will only be queried once at program startup and can
11656 thus only be specified in resource files or on the command line.
11659 String capabilities form
11660 .Ql cap=value
11661 pairs and are expected unless noted otherwise.
11662 Numerics have to be notated as
11663 .Ql cap#number
11664 where the number is expected in normal decimal notation.
11665 Finally, booleans do not have any value but indicate a true or false
11666 state simply by being defined or not; this indeed means that \*(UA
11667 does not support undefining an existing boolean.
11668 String capability values will undergo some expansions before use:
11669 for one notations like
11670 .Ql ^LETTER
11671 stand for
11672 .Ql control-LETTER ,
11673 and for clarification purposes
11674 .Ql \eE
11675 can be used to specify
11676 .Ql escape
11677 (the control notation
11678 .Ql ^[
11679 could lead to misreadings when a left bracket follows, which it does for
11680 the standard CSI sequence);
11681 finally three letter octal sequences, as in
11682 .Ql \e061 ,
11683 are supported.
11684 To specify that a terminal supports 256-colours, and to define sequences
11685 that home the cursor and produce an audible bell, one might write:
11687 .Bd -literal -offset indent
11688 ? set termcap='Co#256,home=\eE[H,bel=^G'
11692 The following terminal capabilities are or may be meaningful for the
11693 operation of the built-in line editor or \*(UA in general:
11696 .Bl -tag -compact -width ".It Cd yay"
11697 .\" HAVE_COLOUR
11698 .It Cd colors Ns \0or Cd Co
11699 .Cd max_colors :
11700 numeric capability specifying the maximum number of colours.
11701 Note that \*(UA does not actually care about the terminal beside that,
11702 but always emits ANSI / ISO 6429 escape sequences.
11704 .\" HAVE_TERMCAP
11705 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
11706 .Cd exit_ca_mode
11708 .Cd enter_ca_mode ,
11709 respectively: exit and enter the alternative screen ca-mode,
11710 effectively turning \*(UA into a fullscreen application.
11711 This must be enabled explicitly by setting
11712 .Va termcap-ca-mode .
11714 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
11715 .Cd keypad_xmit
11717 .Cd keypad_local ,
11718 respectively: enable and disable the keypad.
11719 This is always enabled if available, because it seems even keyboards
11720 without keypads generate other key codes for, e.g., cursor keys in that
11721 case, and only if enabled we see the codes that we are interested in.
11723 .It Cd ed Ns \0or Cd cd
11724 .Cd clr_eos :
11725 clear the screen.
11727 .It Cd clear Ns \0or Cd cl
11728 .Cd clear_screen :
11729 clear the screen and home cursor.
11730 (Will be simulated via
11731 .Cd ho
11732 plus
11733 .Cd cd . )
11735 .It Cd home Ns \0or Cd ho
11736 .Cd cursor_home :
11737 home cursor.
11739 .\" HAVE_MLE
11740 .It Cd el Ns \0or Cd ce
11741 .Cd clr_eol :
11742 clear to the end of line.
11743 (Will be simulated via
11744 .Cd ch
11745 plus repetitions of space characters.)
11747 .It Cd hpa Ns \0or Cd ch
11748 .Cd column_address :
11749 move the cursor (to the given column parameter) in the current row.
11750 (Will be simulated via
11751 .Cd cr
11752 plus
11753 .Cd nd . )
11755 .It Cd cr
11756 .Cd carriage_return :
11757 move to the first column in the current row.
11758 The default built-in fallback is
11759 .Ql \er .
11761 .It Cd cub1 Ns \0or Cd le
11762 .Cd cursor_left :
11763 move the cursor left one space (non-destructively).
11764 The default built-in fallback is
11765 .Ql \eb .
11767 .It Cd cuf1 Ns \0or Cd nd
11768 .Cd cursor_right :
11769 move the cursor right one space (non-destructively).
11770 The default built-in fallback is
11771 .Ql \eE[C ,
11772 which is used by most terminals.
11773 Less often occur
11774 .Ql \eEC
11776 .Ql \eEOC .
11780 Many more capabilities which describe key-sequences are documented for
11781 .Ic bind .
11785 .It Va termcap-ca-mode
11786 \*(OP Allow usage of the
11787 .Cd exit_ca_mode
11789 .Cd enter_ca_mode
11790 terminal capabilities, effectively turning \*(UA into a fullscreen
11791 application, as documented for
11792 .Va termcap .
11793 .Sy Note
11794 this variable will only be queried once at program startup and can
11795 thus only be specified in resource files or on the command line.
11798 .It Va termcap-disable
11799 \*(OP Disable any interaction with a terminal control library.
11800 If set only some generic fallback built-ins and possibly the content of
11801 .Va termcap
11802 describe the terminal to \*(UA.
11803 .Sy Note
11804 this variable will only be queried once at program startup and can
11805 thus only be specified in resource files or on the command line.
11808 .It Va toplines
11809 If defined, gives the number of lines of a message to be displayed
11810 with the command
11811 .Ic top ;
11812 if unset, the first five lines are printed, if set to 0 the variable
11813 .Va screen
11814 is inspected.
11815 If the value is negative then its absolute value will be used for
11816 unsigned right shifting (see
11817 .Ic vexpr )
11819 .Va screen
11820 height.
11823 .It Va topsqueeze
11824 \*(BO If set then the
11825 .Ic top
11826 command series will strip adjacent empty lines and quotations.
11829 .It Va ttycharset
11830 The character set of the terminal \*(UA operates on,
11831 and the one and only supported character set that \*(UA can use if no
11832 character set conversion capabilities have been compiled into it,
11833 in which case it defaults to ISO-8859-1 unless it can deduce a value
11834 from the locale specified in the
11835 .Ev LC_CTYPE
11836 environment variable (if supported, see there for more).
11837 It defaults to UTF-8 if conversion is available.
11838 Refer to the section
11839 .Sx "Character sets"
11840 for the complete picture about character sets.
11843 .It Va typescript-mode
11844 \*(BO A special multiplex variable that disables all variables and
11845 settings which result in behaviour that interferes with running \*(UA in
11846 .Xr script 1 ,
11847 e.g., it sets
11848 .Va colour-disable ,
11849 .Va line-editor-disable
11850 and (before startup completed only)
11851 .Va termcap-disable .
11852 Unsetting it does not restore the former state of the covered settings.
11855 .It Va umask
11856 For a safety-by-default policy \*(UA sets its process
11857 .Xr umask 2
11859 .Ql 0077 ,
11860 but this variable can be used to override that:
11861 set it to an empty value to do not change the (current) setting (on
11862 startup), otherwise the process file mode creation mask is updated to
11863 the new value.
11864 Child processes inherit the process file mode creation mask.
11866 .Mx Va user
11867 .It Va user-HOST , user
11868 \*(IN Variable chain that sets a global fallback user name, which is
11869 used in case none has been given in the protocol and account-specific
11870 URL.
11871 This variable defaults to the name of the user who runs \*(UA.
11874 .It Va v15-compat
11875 \*(BO Setting this enables upward compatibility with \*(UA
11876 version 15.0 in respect to which configuration options are available and
11877 how they are handled.
11878 This manual uses \*(IN and \*(OU to refer to the new and the old way of
11879 doing things, respectively.
11882 .It Va verbose
11883 \*(BO This setting, also controllable via the command line option
11884 .Fl v ,
11885 causes \*(UA to be more verbose, e.g., it will display obsoletion
11886 warnings and SSL/TLS certificate chains.
11887 Even though marked \*(BO this option may be set twice in order to
11888 increase the level of verbosity even more, in which case even details of
11889 the actual message delivery and protocol conversations are shown.
11890 A single
11891 .Pf no Va verbose
11892 is sufficient to disable verbosity as such.
11899 .It Va version , version-date , version-major , version-minor , version-update
11900 \*(RO \*(UA version information: the first variable contains a string
11901 containing the complete version identification, the latter three contain
11902 only digits: the major, minor and update version numbers.
11903 The date is in ISO 8601 notation.
11904 The output of the command
11905 .Ic version
11906 will include this information.
11909 .It Va writebackedited
11910 If this variable is set messages modified using the
11911 .Ic edit
11913 .Ic visual
11914 commands are written back to the current folder when it is quit;
11915 it is only honoured for writable folders in MBOX format, though.
11916 Note that the editor will be pointed to the raw message content in that
11917 case, i.e., neither MIME decoding nor decryption will have been
11918 performed, and proper RFC 4155
11919 .Ql From_
11920 quoting of newly added or edited content is also left as an excercise to
11921 the user.
11923 .\" }}} (Variables)
11925 .\" }}} (INTERNAL VARIABLES)
11928 .\" .Sh ENVIRONMENT {{{
11929 .Sh ENVIRONMENT
11931 The term
11932 .Dq environment variable
11933 should be considered an indication that these variables are either
11934 standardized as vivid parts of process environments, or that they are
11935 commonly found in there.
11936 The process environment is inherited from the
11937 .Xr sh 1
11938 once \*(UA is started, and unless otherwise explicitly noted handling of
11939 the following variables transparently integrates into that of the
11940 .Sx "INTERNAL VARIABLES"
11941 from \*(UA's point of view.
11942 This means that, e.g., they can be managed via
11943 .Ic set
11945 .Ic unset ,
11946 causing automatic program environment updates (to be inherited by
11947 newly created child processes).
11950 In order to transparently integrate other environment variables equally
11951 they need to be imported (linked) with the command
11952 .Ic environ .
11953 This command can also be used to set and unset non-integrated
11954 environment variables from scratch, sufficient system support provided.
11955 The following example, applicable to a POSIX shell, sets the
11956 .Ev COLUMNS
11957 environment variable for \*(UA only, and beforehand exports the
11958 .Ev EDITOR
11959 in order to affect any further processing in the running shell:
11961 .Bd -literal -offset indent
11962 $ EDITOR="vim -u ${HOME}/.vimrc"
11963 $ export EDITOR
11964 $ COLUMNS=80 \*(uA -R
11967 .Bl -tag -width ".It Ev BaNg"
11969 .It Ev COLUMNS
11970 The user's preferred width in column positions for the terminal screen
11971 or window.
11972 Queried and used once on program startup, actively managed for child
11973 processes and the MLE (see
11974 .Sx "On terminal control and line editor" )
11975 in interactive mode thereafter.
11976 Ignored in non-interactive mode, which always uses 80 columns, unless in
11977 .fl #
11978 batch mode.
11981 .It Ev DEAD
11982 The name of the (mailbox)
11983 .Ic file
11984 to use for saving aborted messages if
11985 .Va save
11986 is set; this defaults to
11987 .Pa dead.letter
11988 in the user's
11989 .Ev HOME
11990 directory.
11991 If the variable
11992 .Va debug
11993 is set no output will be generated, otherwise the contents of the file
11994 will be replaced.
11997 .It Ev EDITOR
11998 Pathname of the text editor to use in the
11999 .Ic edit
12000 command and
12001 .Ic ~e
12002 .Sx "COMMAND ESCAPES" .
12003 A default editor is used if this value is not defined.
12006 .It Ev HOME
12007 The user's home directory.
12008 This variable is only used when it resides in the process environment.
12009 The calling user's home directory will be used instead if this directory
12010 does not exist, is not accessible or cannot be read.
12011 (No test for being writable is performed to allow usage by
12012 non-privileged users within read-only jails, but dependent on the
12013 variable settings this directory is a default write target, e.g. for
12014 .Ev DEAD ,
12015 .Ev MBOX
12016 and more.)
12021 .It Ev LC_ALL , LC_CTYPE , LANG
12022 \*(OP The (names in lookup order of the)
12023 .Xr locale 7
12024 (and / or see
12025 .Xr setlocale 3 )
12026 which indicates the used
12027 .Sx "Character sets" .
12028 Runtime changes trigger automatic updates of the entire locale system,
12029 updating and overwriting also a
12030 .Va ttycharset
12031 set by the user.
12034 .It Ev LINES
12035 The user's preferred number of lines on a page or the vertical screen
12036 or window size in lines.
12037 Queried and used once on program startup, actively managed for child
12038 processes in interactive mode thereafter.
12039 Ignored in non-interactive mode, which always uses 24 lines, unless in
12040 .fl #
12041 batch mode.
12044 .It Ev LISTER
12045 Pathname of the directory lister to use in the
12046 .Ic folders
12047 command when operating on local mailboxes.
12048 Default is
12049 .Xr ls 1
12050 (path search through
12051 .Ev SHELL ) .
12054 .It Ev LOGNAME
12055 Upon startup \*(UA will actively ensure that this variable refers to the
12056 name of the user who runs \*(UA, in order to be able to pass a verified
12057 name to any newly created child process.
12060 .It Ev MAIL
12061 Is used as the users
12062 .Mx -sx
12063 .Sx "primary system mailbox"
12064 unless
12065 .Va inbox
12066 is set.
12067 This is assumed to be an absolute pathname.
12070 .It Ev MAILCAPS
12071 \*(OP Overrides the default path search for
12072 .Sx "The Mailcap files" ,
12073 which is defined in the standard RFC 1524 as
12074 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
12075 .\" TODO we should have a mailcaps-default virtual RDONLY option!
12076 (\*(UA makes it a configuration option, however.)
12077 Note this is not a search path, but a path search.
12080 .It Ev MAILRC
12081 Is used as a startup file instead of
12082 .Pa \*(ur
12083 if set.
12084 In order to avoid side-effects from configuration files scripts should
12085 either set this variable to
12086 .Pa /dev/null
12087 or the
12088 .Fl \&:
12089 command line option should be used.
12092 .It Ev MAILX_NO_SYSTEM_RC
12093 If this variable is set then reading of
12094 .Pa \*(UR
12095 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
12096 had been started up with the option
12097 .Fl \&:
12098 (and according argument) or
12099 .Fl n .
12100 This variable is only used when it resides in the process environment.
12103 .It Ev MBOX
12104 The name of the users
12105 .Mx -sx
12106 .Sx "secondary mailbox"
12107 file.
12108 A logical subset of the special
12109 .Sx "Filename transformations"
12110 (also see
12111 .Ic file )
12112 are supported.
12113 The default is
12114 .Pa ~/mbox .
12115 Traditionally this MBOX is used as the file to save messages from the
12116 .Mx -sx
12117 .Sx "primary system mailbox"
12118 that have been read.
12119 Also see
12120 .Sx "Message states" .
12123 .It Ev NETRC
12124 \*(IN\*(OP This variable overrides the default location of the user's
12125 .Pa ~/.netrc
12126 file.
12129 .It Ev PAGER
12130 Pathname of the program to use for backing the command
12131 .Ic more ,
12132 and when the
12133 .Va crt
12134 variable enforces usage of a pager for output.
12135 The default paginator is
12136 .Xr more 1
12137 (path search through
12138 .Ev SHELL ) .
12140 \*(UA inspects the contents of this variable: if its contains the string
12141 .Dq less
12142 then a non-existing environment variable
12143 .Ev LESS
12144 will be set to
12145 .Ql Ri ,
12146 likewise for
12147 .Dq lv
12148 .Ev LV
12149 will optionally be set to
12150 .Ql -c .
12151 Alse see
12152 .Va colour-pager .
12155 .It Ev PATH
12156 A colon-separated list of directories that is searched by the shell when
12157 looking for commands, e.g.,
12158 .Ql /bin:/usr/bin:/usr/local/bin .
12161 .It Ev POSIXLY_CORRECT
12162 This variable is automatically looked for upon startup, see
12163 .Va posix
12164 for more.
12167 .It Ev SHELL
12168 The shell to use for the commands
12169 .Ic \&! ,
12170 .Ic shell ,
12172 .Ic ~!
12173 .Sx "COMMAND ESCAPES"
12174 and when starting subprocesses.
12175 A default shell is used if this environment variable is not defined.
12178 .It Ev SOURCE_DATE_EPOCH
12179 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
12180 used in place of the current time.
12181 This variable is looked up upon program startup, and its existence will
12182 switch \*(UA to a completely reproducible mode which causes
12183 deterministic random numbers, a special fixed (non-existent?)
12184 .Ev LOGNAME
12185 and more to be used and set.
12186 It is to be used during development or by software packagers.
12187 \*(ID Currently an invalid setting is only ignored, rather than causing
12188 a program abortion.
12190 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
12193 .It Ev TERM
12194 \*(OP The terminal type for which output is to be prepared.
12195 For extended colour and font control please refer to
12196 .Sx "Coloured display" ,
12197 and for terminal management in general to
12198 .Sx "On terminal control and line editor" .
12201 .It Ev TMPDIR
12202 Used as directory for temporary files instead of
12203 .Pa /tmp ,
12204 if set, existent, accessible as well as read- and writable.
12205 This variable is only used when it resides in the process environment,
12206 but \*(UA will ensure at startup that this environment variable is
12207 updated to contain a usable temporary directory.
12210 .It Ev USER
12211 Identical to
12212 .Ev LOGNAME
12213 (see there), but this variable is not standardized, should therefore not
12214 be used, and is only corrected if already set.
12217 .It Ev VISUAL
12218 Pathname of the text editor to use in the
12219 .Ic visual
12220 command and
12221 .Ic ~v
12222 .Sx "COMMAND ESCAPES" .
12225 .\" }}}
12228 .\" .Sh FILES {{{
12229 .Sh FILES
12231 .\" file list {{{
12232 .Bl -tag -width ".It Pa BaNg"
12233 .It Pa \*(ur
12234 File giving initial commands, one of the
12235 .Sx "Resource files" .
12237 .It Pa \*(UR
12238 System wide initialization file, one of the
12239 .Sx "Resource files" .
12242 .It Pa ~/.mailcap
12243 \*(OP Personal MIME type handler definition file, see
12244 .Sx "The Mailcap files" .
12245 This location is part of the RFC 1524 standard search path, which is
12246 a configuration option and can be overridden via
12247 .Ev MAILCAPS .
12250 .It Pa /etc/mailcap
12251 \*(OP System wide MIME type handler definition file, see
12252 .Sx "The Mailcap files" .
12253 This location is part of the RFC 1524 standard search path, which is
12254 a configuration option and can be overridden via
12257 .It Pa ~/mbox
12258 The default value for
12259 .Ev MBOX .
12260 The actually used path is a configuration option.
12263 .It Pa ~/.mime.types
12264 Personal MIME types, see
12265 .Sx "The mime.types files" .
12266 The actually used path is a configuration option.
12269 .It Pa /etc/mime.types
12270 System wide MIME types, see
12271 .Sx "The mime.types files" .
12272 The actually used path is a configuration option.
12275 .It Pa ~/.netrc
12276 \*(IN\*(OP The default location of the users
12277 .Pa .netrc
12278 file \(en the section
12279 .Sx "The .netrc file"
12280 documents the file format.
12281 The actually used path is a configuration option and can be overridden via
12282 .Ev NETRC .
12285 .It Pa /dev/null
12286 The data sink
12287 .Xr null 4 .
12288 The actually used path is a compile-time constant.
12290 .\" }}}
12292 .\" .Ss "Resource files" {{{
12293 .Ss "Resource files"
12295 Upon startup \*(UA reads in several resource files:
12297 .Bl -tag -width ".It Pa BaNg"
12299 .It Pa \*(UR
12300 System wide initialization file.
12301 Reading of this file can be suppressed, either by using the
12302 .Fl \&:
12303 (and according argument) or
12304 .Fl n
12305 command line options, or by setting the
12306 .Sx ENVIRONMENT
12307 variable
12308 .Ev MAILX_NO_SYSTEM_RC .
12311 .It Pa \*(ur
12312 File giving initial commands.
12313 A different file can be chosen by setting the
12314 .Sx ENVIRONMENT
12315 variable
12316 .Ev MAILRC .
12317 Reading of this file can be suppressed with the
12318 .Fl \&:
12319 command line option.
12321 .It Va mailx-extra-rc
12322 Defines a startup file to be read after all other resource files.
12323 It can be used to specify settings that are not understood by other
12324 .Xr mailx 1
12325 implementations, for example.
12326 This variable is only honoured when defined in a resource file, e.g.,
12327 it is one of the
12328 .Sx "INTERNAL VARIABLES" .
12332 The content of these files is interpreted as follows:
12335 .Bl -bullet -compact
12337 The whitespace characters space, tabulator and newline,
12338 as well as those defined by the variable
12339 .Va ifs ,
12340 are removed from the beginning and end of input lines.
12342 Empty lines are ignored.
12344 Any other line is interpreted as a command.
12345 It may be spread over multiple input lines if the newline character is
12346 .Dq escaped
12347 by placing a reverse solidus character
12348 .Ql \e
12349 as the last character of the line; whereas any leading whitespace of
12350 follow lines is ignored, trailing whitespace before a escaped newline
12351 remains in the input.
12353 If the line (content) starts with the number sign
12354 .Ql #
12355 then it is a comment-command and also ignored.
12356 (The comment-command is a real command, which does nothing, and
12357 therefore the usual follow lines mechanism applies!)
12361 Unless \*(UA is about to enter interactive mode syntax errors that occur
12362 while loading these files are treated as errors and cause program exit.
12363 More files with syntactically equal content can be
12364 .Ic source Ns ed .
12365 The following, saved in a file, would be an examplary content:
12367 .Bd -literal -offset indent
12368  # This line is a comment command.  And y\e
12369     es, it is really continued here.
12370 set debug \e
12371     verbose
12372     set editheaders
12374 .\" }}}
12376 .\" .Ss "The mime.types files" {{{
12377 .Ss "The mime.types files"
12379 As stated in
12380 .Sx "HTML mail and MIME attachments"
12381 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
12382 media types in order to classify message and attachment content.
12383 One source for them are
12384 .Pa mime.types
12385 files, the loading of which can be controlled by setting the variable
12386 .Va mimetypes-load-control .
12387 Another is the command
12388 .Ic mimetype ,
12389 which also offers access to \*(UAs MIME type cache.
12390 .Pa mime.types
12391 files have the following syntax:
12393 .Bd -literal -offset indent
12394 type/subtype extension [extension ...]
12395 # E.g., text/html html htm
12399 where
12400 .Ql type/subtype
12401 define the MIME media type, as standardized in RFC 2046:
12402 .Ql type
12403 is used to declare the general type of data, while the
12404 .Ql subtype
12405 specifies a specific format for that type of data.
12406 One or multiple filename
12407 .Ql extension Ns
12408 s, separated by whitespace, can be bound to the media type format.
12409 Comments may be introduced anywhere on a line with a number sign
12410 .Ql # ,
12411 causing the remaining line to be discarded.
12413 \*(UA also supports an extended, non-portable syntax in especially
12414 crafted files, which can be loaded via the alternative value syntax of
12415 .Va mimetypes-load-control ,
12416 and prepends an optional
12417 .Ql type-marker :
12420 .Dl [type-marker ]type/subtype extension [extension ...]
12423 The following type markers are supported:
12426 .Bl -tag -compact -width ".It Ar _n_u"
12427 .It Ar @
12428 Treat message parts with this content as plain text.
12429 .It Ar @t
12430 The same as plain
12431 .Ar @ .
12432 .It Ar @h
12433 Treat message parts with this content as HTML tagsoup.
12434 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
12435 the content as plain text instead.
12436 .It Ar @H
12437 Likewise
12438 .Ar @h ,
12439 but instead of falling back to plain text require an explicit content
12440 handler to be defined.
12441 .It Ar @q
12442 If no handler can be found a text message is displayed which says so.
12443 This can be annoying, for example signatures serve a contextual purpose,
12444 their content is of no use by itself.
12445 This marker will avoid displaying the text message.
12449 Further reading:
12450 for sending messages:
12451 .Ic mimetype ,
12452 .Va mime-allow-text-controls ,
12453 .Va mimetypes-load-control .
12454 For reading etc. messages:
12455 .Sx "HTML mail and MIME attachments" ,
12456 .Sx "The Mailcap files" ,
12457 .Ic mimetype ,
12458 .Va mime-counter-evidence ,
12459 .Va mimetypes-load-control ,
12460 .Va pipe-TYPE/SUBTYPE ,
12461 .Va pipe-EXTENSION .
12462 .\" }}}
12464 .\" .Ss "The Mailcap files" {{{
12465 .Ss "The Mailcap files"
12467 .\" TODO MAILCAP DISABLED
12468 .Sy This feature is not available in v14.9.0, sorry!
12469 RFC 1524 defines a
12470 .Dq User Agent Configuration Mechanism
12471 which \*(UA \*(OPally supports (see
12472 .Sx "HTML mail and MIME attachments" ) .
12473 It defines a file format to be used to inform mail user agent programs
12474 about the locally-installed facilities for handling various data
12475 formats, i.e., about commands and how they can be used to display, edit
12476 et cetera MIME part contents, as well as a default path search that
12477 includes multiple possible locations of
12478 .Dq mailcap
12479 files and the
12480 .Ev MAILCAPS
12481 environment variable that can be used to overwrite that (repeating here
12482 that it is not a search path, but instead a path search specification).
12483 Any existing files will be loaded in sequence, appending any content to
12484 the list of MIME type handler directives.
12487 .Dq Mailcap
12488 files consist of a set of newline separated entries.
12489 Comment lines start with a number sign
12490 .Ql #
12491 (in the first column!) and are ignored.
12492 Empty lines are also ignored.
12493 All other lines form individual entries that must adhere to the syntax
12494 described below.
12495 To extend a single entry (not comment) its line can be continued on
12496 follow lines if newline characters are
12497 .Dq escaped
12498 by preceding them with the reverse solidus character
12499 .Ql \e .
12500 The standard does not specify how leading whitespace of follow lines
12501 is to be treated, therefore \*(UA retains it.
12504 .Dq Mailcap
12505 entries consist of a number of semicolon
12506 .Ql \&;
12507 separated fields, and the reverse solidus
12508 .Ql \e
12509 character can be used to escape any following character including
12510 semicolon and itself.
12511 The first two fields are mandatory and must occur in the specified
12512 order, the remaining fields are optional and may appear in any order.
12513 Leading and trailing whitespace of content is ignored (removed).
12516 The first field defines the MIME
12517 .Ql TYPE/SUBTYPE
12518 the entry is about to handle (case-insensitively, and no reverse solidus
12519 escaping is possible in this field).
12520 If the subtype is specified as an asterisk
12521 .Ql *
12522 the entry is meant to match all subtypes of the named type, e.g.,
12523 .Ql audio/*
12524 would match any audio type.
12525 The second field defines the shell command which shall be used to
12526 .Dq display
12527 MIME parts of the given type; it is implicitly called the
12528 .Cd view
12529 command.
12532 For data
12533 .Dq consuming
12534 shell commands message (MIME part) data is passed via standard input
12535 unless the given shell command includes one or more instances of the
12536 (unquoted) string
12537 .Ql %s ,
12538 in which case these instances will be replaced with a temporary filename
12539 and the data will have been stored in the file that is being pointed to.
12540 Likewise, for data
12541 .Dq producing
12542 shell commands data is assumed to be generated on standard output unless
12543 the given command includes (one ore multiple)
12544 .Ql %s .
12545 In any case any given
12546 .Ql %s
12547 format is replaced with a(n already) properly quoted filename.
12548 Note that when a command makes use of a temporary file via
12549 .Ql %s
12550 then \*(UA will remove it again, as if the
12551 .Cd x-mailx-tmpfile ,
12552 .Cd x-mailx-tmpfile-fill
12554 .Cd x-mailx-tmpfile-unlink
12555 flags had been set; see below for more.
12558 The optional fields either define a shell command or an attribute (flag)
12559 value, the latter being a single word and the former being a keyword
12560 naming the field followed by an equals sign
12561 .Ql =
12562 succeeded by a shell command, and as usual for any
12563 .Dq Mailcap
12564 content any whitespace surrounding the equals sign will be removed, too.
12565 Optional fields include the following:
12568 .Bl -tag -width ".It Cd BaNg"
12569 .It Cd compose
12570 A program that can be used to compose a new body or body part in the
12571 given format.
12572 (Currently unused.)
12574 .It Cd composetyped
12575 Similar to the
12576 .Cd compose
12577 field, but is to be used when the composing program needs to specify the
12578 .Ql Content-type:
12579 header field to be applied to the composed data.
12580 (Currently unused.)
12582 .It Cd edit
12583 A program that can be used to edit a body or body part in the given
12584 format.
12585 (Currently unused.)
12587 .It Cd print
12588 A program that can be used to print a message or body part in the given
12589 format.
12590 (Currently unused.)
12592 .It Cd test
12593 Specifies a program to be run to test some condition, e.g., the machine
12594 architecture, or the window system in use, to determine whether or not
12595 this mailcap entry applies.
12596 If the test fails, a subsequent mailcap entry should be sought; also see
12597 .Cd x-mailx-test-once .
12600 .It Cd needsterminal
12601 This flag field indicates that the given shell command must be run on
12602 an interactive terminal.
12603 \*(UA will temporarily release the terminal to the given command in
12604 interactive mode, in non-interactive mode this entry will be entirely
12605 ignored; this flag implies
12606 .Cd x-mailx-noquote .
12609 .It Cd copiousoutput
12610 A flag field which indicates that the output of the
12611 .Cd view
12612 command will be an extended stream of textual output that can be
12613 (re)integrated into \*(UA's normal visual display.
12614 It is mutually exclusive with
12615 .Cd needsterminal .
12617 .It Cd textualnewlines
12618 A flag field which indicates that this type of data is line-oriented and
12619 that, if encoded in
12620 .Ql base64 ,
12621 all newlines should be converted to canonical form (CRLF) before
12622 encoding, and will be in that form after decoding.
12623 (Currently unused.)
12625 .It Cd nametemplate
12626 This field gives a filename format, in which
12627 .Ql %s
12628 will be replaced by a random string, the joined combination of which
12629 will be used as the filename denoted by
12630 .Ev MAILX_FILENAME_TEMPORARY .
12631 One could specify that a GIF file being passed to an image viewer should
12632 have a name ending in
12633 .Ql .gif
12634 by using
12635 .Ql nametemplate=%s.gif .
12636 Note that \*(UA ignores the name template unless that solely specifies
12637 a filename suffix that consists of (ASCII) alphabetic and numeric
12638 characters, the underscore and dot only.
12640 .It Cd x11-bitmap
12641 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
12642 icon to be used to visually denote the presence of this kind of data.
12643 This field is not used by \*(UA.
12645 .It Cd description
12646 A textual description that describes this type of data.
12649 .It Cd x-mailx-even-if-not-interactive
12650 An extension flag test field \(em by default handlers without
12651 .Cd copiousoutput
12652 are entirely ignored in non-interactive mode, but if this flag is set
12653 then their use will be considered.
12654 It is an error if this flag is set for commands that use the flag
12655 .Cd needsterminal .
12658 .It Cd x-mailx-noquote
12659 An extension flag field that indicates that even a
12660 .Cd copiousoutput
12661 .Cd view
12662 command shall not be used to generate message quotes
12663 (as it would be by default).
12666 .It Cd x-mailx-async
12667 Extension flag field that denotes that the given
12668 .Cd view
12669 command shall be executed asynchronously, without blocking \*(UA.
12670 Cannot be used in conjunction with
12671 .Cd needsterminal .
12674 .It Cd x-mailx-test-once
12675 Extension flag which denotes whether the given
12676 .Cd test
12677 command shall be evaluated once only and the (boolean) result be cached.
12678 This is handy if some global unchanging condition is to be queried, like
12679 .Dq running under the X Window System .
12682 .It Cd x-mailx-tmpfile
12683 Extension flag field that requests creation of a zero-sized temporary
12684 file, the name of which is to be placed in the environment variable
12685 .Ev MAILX_FILENAME_TEMPORARY .
12686 It is an error to use this flag with commands that include a
12687 .Ql %s
12688 format.
12691 .It Cd x-mailx-tmpfile-fill
12692 Normally the MIME part content is passed to the handler via standard
12693 input; if this flag is set then the data will instead be written into
12694 the implied
12695 .Cd x-mailx-tmpfile .
12696 In order to cause deletion of the temporary file you will have to set
12697 .Cd x-mailx-tmpfile-unlink
12698 explicitly!
12699 It is an error to use this flag with commands that include a
12700 .Ql %s
12701 format.
12704 .It Cd x-mailx-tmpfile-unlink
12705 Extension flag field that requests that the temporary file shall be
12706 deleted automatically when the command loop is entered again at latest.
12707 (Do not use this for asynchronous handlers.)
12708 It is an error to use this flag with commands that include a
12709 .Ql %s
12710 format, or in conjunction with
12711 .Cd x-mailx-async ,
12712 or without also setting
12713 .Cd x-mailx-tmpfile
12715 .Cd x-mailx-tmpfile-fill .
12718 .It Cd x-mailx-tmpfile-keep
12719 Using the string
12720 .Ql %s
12721 implies the three tmpfile related flags above, but if you want, e.g.,
12722 .Cd x-mailx-async
12723 and deal with the temporary file yourself, you can add in this flag to
12724 forcefully ignore
12725 .Cd x-mailx-tmpfile-unlink .
12730 The standard includes the possibility to define any number of additional
12731 entry fields, prefixed by
12732 .Ql x- .
12733 Flag fields apply to the entire
12734 .Dq Mailcap
12735 entry \(em in some unusual cases, this may not be desirable, but
12736 differentiation can be accomplished via separate entries, taking
12737 advantage of the fact that subsequent entries are searched if an earlier
12738 one does not provide enough information.
12739 E.g., if a
12740 .Cd view
12741 command needs to specify the
12742 .Cd needsterminal
12743 flag, but the
12744 .Cd compose
12745 command shall not, the following will help out the latter (with enabled
12746 .Va debug
12747 or an increased
12748 .Va verbose
12749 level \*(UA will show information about handler evaluation):
12751 .Bd -literal -offset indent
12752 application/postscript; ps-to-terminal %s; needsterminal
12753 application/postscript; ps-to-terminal %s; compose=idraw %s
12757 In fields any occurrence of the format string
12758 .Ql %t
12759 will be replaced by the
12760 .Ql TYPE/SUBTYPE
12761 specification.
12762 Named parameters from the
12763 .Ql Content-type:
12764 field may be placed in the command execution line using
12765 .Ql %{
12766 followed by the parameter name and a closing
12767 .Ql }
12768 character.
12769 The entire parameter should appear as a single command line argument,
12770 regardless of embedded spaces; thus:
12772 .Bd -literal -offset indent
12773 # Message
12774 Content-type:  multipart/mixed; boundary=42
12776 # Mailcap file
12777 multipart/*; /usr/local/bin/showmulti \e
12778   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
12780 # Executed shell command
12781 /usr/local/bin/showmulti multipart/mixed 42
12785 .\" TODO v15: Mailcap: %n,%F
12786 Note that \*(UA does not support handlers for multipart MIME parts as
12787 shown in this example (as of today).
12788 \*(UA does not support the additional formats
12789 .Ql %n
12791 .Ql %F .
12792 An example file, also showing how to properly deal with the expansion of
12793 .Ql %s ,
12794 which includes any quotes that are necessary to make it a valid shell
12795 argument by itself and thus will cause undesired behaviour when placed
12796 in additional user-provided quotes:
12798 .Bd -literal -offset indent
12799 # Comment line
12800 text/richtext; richtext %s; copiousoutput
12802 text/x-perl; perl -cWT %s
12804 application/pdf; \e
12805   infile=%s\e; \e
12806     trap "rm -f ${infile}" EXIT\e; \e
12807     trap "exit 75" INT QUIT TERM\e; \e
12808     mupdf %s; \e
12809   x-mailx-async; x-mailx-tmpfile-keep
12811 application/*; echo "This is \e"%t\e" but \e
12812     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
12813   copiousoutput; x-mailx-noquote
12817 Further reading:
12818 .Sx "HTML mail and MIME attachments" ,
12819 .Sx "The mime.types files" ,
12820 .Ic mimetype ,
12821 .Ev MAILCAPS ,
12822 .Va mime-counter-evidence ,
12823 .Va pipe-TYPE/SUBTYPE ,
12824 .Va pipe-EXTENSION .
12825 .\" }}}
12827 .\" .Ss "The .netrc file" {{{
12828 .Ss "The .netrc file"
12831 .Pa .netrc
12832 file contains user credentials for machine accounts.
12833 The default location in the user's
12834 .Ev HOME
12835 directory may be overridden by the
12836 .Ev NETRC
12837 environment variable.
12838 The file consists of space, tabulator or newline separated tokens.
12839 \*(UA implements a parser that supports a superset of the original BSD
12840 syntax, but users should nonetheless be aware of portability glitches
12841 of that file format, shall their
12842 .Pa .netrc
12843 be usable across multiple programs and platforms:
12846 .Bl -bullet -compact
12848 BSD does not support single, but only double quotation marks, e.g.,
12849 .Ql password="pass with spaces" .
12851 BSD (only?) supports escaping of single characters via a reverse solidus
12852 (e.g., a space can be escaped via
12853 .Ql \e\0 ) ,
12854 in- as well as outside of a quoted string.
12856 BSD does not require a final quotation mark of the last user input token.
12858 The original BSD (Berknet) parser also supported a format which allowed
12859 tokens to be separated with commas \(en whereas at least Hewlett-Packard
12860 still seems to support this syntax, \*(UA does not!
12862 As a non-portable extension some widely-used programs support
12863 shell-style comments: if an input line starts, after any amount of
12864 whitespace, with a number sign
12865 .Ql # ,
12866 then the rest of the line is ignored.
12868 Whereas other programs may require that the
12869 .Pa .netrc
12870 file is accessible by only the user if it contains a
12871 .Cd password
12872 token for any other
12873 .Cd login
12874 than
12875 .Dq anonymous ,
12876 \*(UA will always require these strict permissions.
12880 Of the following list of supported tokens \*(UA only uses (and caches)
12881 .Cd machine ,
12882 .Cd login
12884 .Cd password .
12885 At runtime the command
12886 .Ic netrc
12887 can be used to control \*(UA's
12888 .Pa .netrc
12889 cache.
12891 .Bl -tag -width ".It Cd BaNg"
12892 .It Cd machine Ar name
12893 The hostname of the entries' machine, lowercase-normalized by \*(UA
12894 before use.
12895 Any further file content, until either end-of-file or the occurrence
12896 of another
12897 .Cd machine
12898 or a
12899 .Cd default
12900 first-class token is bound (only related) to the machine
12901 .Ar name .
12903 As an extension that should not be the cause of any worries
12904 \*(UA supports a single wildcard prefix for
12905 .Ar name :
12906 .Bd -literal -offset indent
12907 machine *.example.com login USER password PASS
12908 machine pop3.example.com login USER password PASS
12909 machine smtp.example.com login USER password PASS
12912 which would match
12913 .Ql xy.example.com
12914 as well as
12915 .Ql pop3.example.com ,
12916 but neither
12917 .Ql example.com
12919 .Ql local.smtp.example.com .
12920 Note that in the example neither
12921 .Ql pop3.example.com
12923 .Ql smtp.example.com
12924 will be matched by the wildcard, since the exact matches take
12925 precedence (it is however faster to specify it the other way around).
12927 .It Cd default
12928 This is the same as
12929 .Cd machine
12930 except that it is a fallback entry that is used shall none of the
12931 specified machines match; only one default token may be specified,
12932 and it must be the last first-class token.
12934 .It Cd login Ar name
12935 The user name on the remote machine.
12937 .It Cd password Ar string
12938 The user's password on the remote machine.
12940 .It Cd account Ar string
12941 Supply an additional account password.
12942 This is merely for FTP purposes.
12944 .It Cd macdef Ar name
12945 Define a macro.
12946 A macro is defined with the specified
12947 .Ar name ;
12948 it is formed from all lines beginning with the next line and continuing
12949 until a blank line is (consecutive newline characters are) encountered.
12950 (Note that
12951 .Cd macdef
12952 entries cannot be utilized by multiple machines, too, but must be
12953 defined following the
12954 .Ic machine
12955 they are intended to be used with.)
12956 If a macro named
12957 .Ar init
12958 exists, it is automatically run as the last step of the login process.
12959 This is merely for FTP purposes.
12961 .\" }}}
12963 .\" }}}
12966 .\" .Sh EXAMPLES {{{
12967 .Sh EXAMPLES
12969 .\" .Ss "An example configuration" {{{
12970 .Ss "An example configuration"
12972 .Bd -literal -offset indent
12973 # This example assumes v15.0 compatibility mode
12974 set v15-compat
12976 # Request strict SSL/TLS transport security checks
12977 set ssl-verify=strict
12979 # Where are the up-to-date SSL/TLS certificates?
12980 # (Since we manage up-to-date ones explicitly, do not use any,
12981 # possibly outdated, default certificates shipped with OpenSSL)
12982 #set ssl-ca-dir=/etc/ssl/certs
12983 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
12984 set ssl-ca-no-defaults
12985 #set ssl-ca-flags=partial-chain
12986 wysh set smime-ca-file="${ssl-ca-file}" \e
12987   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
12989 # This could be outsourced to a central configuration file via
12990 # ssl-config-file plus ssl-config-module if the used library allows.
12991 # CipherList: explicitly define the list of ciphers, which may
12992 #   improve security, especially with protocols older than TLS v1.2.
12993 #   See ciphers(1).  Possibly best to only use ssl-cipher-list-HOST
12994 #   (or -USER@HOST), as necessary, again..
12995 # Curves: especially with TLSv1.3 curves selection may be desired.
12996 # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.
12997 #   Change this only when the remote server does not support it:
12998 #   maybe use chain support via ssl-config-pairs-HOST / -USER@HOST
12999 #   to define such explicit exceptions, then, e.g.
13000 #     MinProtocol=TLSv1.1
13001 if [ "$ssl-features" =% +ctx-set-maxmin-proto ]
13002   wysh set ssl-config-pairs='\e
13003       CipherList=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
13004       Curves=P-521:P-384:P-256,\e
13005       MinProtocol=TLSv1.1'
13006 else
13007   wysh set ssl-config-pairs='\e
13008       CipherList=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e
13009       Curves=P-521:P-384:P-256,\e
13010       Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2'
13011 endif
13013 # Essential setting: select allowed character sets
13014 set sendcharsets=utf-8,iso-8859-1
13016 # A very kind option: when replying to a message, first try to
13017 # use the same encoding that the original poster used herself!
13018 set reply-in-same-charset
13020 # When replying, do not merge From: and To: of the original message
13021 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
13022 set recipients-in-cc
13024 # When sending messages, wait until the Mail-Transfer-Agent finishs.
13025 # Only like this you will be able to see errors reported through the
13026 # exit status of the MTA (including the built-in SMTP one)!
13027 set sendwait
13029 # Only use built-in MIME types, no mime.types(5) files
13030 set mimetypes-load-control
13032 # Default directory where we act in (relative to $HOME)
13033 set folder=mail
13034 # A leading "+" (often) means: under *folder*
13035 # *record* is used to save copies of sent messages
13036 set MBOX=+mbox.mbox DEAD=+dead.txt \e
13037   record=+sent.mbox record-files record-resent
13039 # Make "file mymbox" and "file myrec" go to..
13040 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
13042 # Not really optional, e.g., for S/MIME
13043 set from='Your Name <address@exam.ple>'
13045 # It may be necessary to set hostname and/or smtp-hostname
13046 # if the "SERVER" of mta and "domain" of from do not match.
13047 # The `urlencode' command can be used to encode USER and PASS
13048 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
13049   smtp-auth=login/plain... \e
13050   smtp-use-starttls
13052 # Never refuse to start into interactive mode, and more
13053 set emptystart \e
13054   colour-pager crt= \e
13055   followup-to followup-to-honour=ask-yes fullnames \e
13056   history-file=+.\*(uAhist history-size=-1 history-gabby \e
13057   mime-counter-evidence=0xE \e
13058   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
13059   reply-to-honour=ask-yes \e
13060   umask=
13062 # Only include the selected header fields when typing messages
13063 headerpick type retain from_ date from to cc subject \e
13064   message-id mail-followup-to reply-to
13065 # ...when forwarding messages
13066 headerpick forward retain subject date from to cc
13067 # ...when saving message, etc.
13068 #headerpick save ignore ^Original-.*$ ^X-.*$
13070 # Some mailing lists
13071 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
13072 mlsubscribe '^xfans@xfans\e.xyz$'
13074 # Handle a few file extensions (to store MBOX databases)
13075 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
13076   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
13077   zst 'zstd -dc' 'zstd -19 -zc' \e
13078   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
13080 # A real life example of a very huge free mail provider
13081 # Instead of directly placing content inside `account',
13082 # we `define' a macro: like that we can switch "accounts"
13083 # from within *on-compose-splice*, for example!
13084 define XooglX {
13085   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
13086   set from='Your Name <address@examp.ple>'
13088   set pop3-no-apop-pop.gmXil.com
13089   shortcut pop %:pop3s://pop.gmXil.com
13090   shortcut imap %:imaps://imap.gmXil.com
13091   #set record="+[Gmail]/Sent Mail"
13092   # Select: File imaps://imap.gmXil.com/[Gmail]/Sent\e Mail
13094   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
13095   # Alternatively:
13096   set mta=smtps://USER:PASS@smtp.gmail.com:465
13098 account XooglX {
13099   \ecall XooglX
13102 # Here is a pretty large one which does not allow sending mails
13103 # if there is a domain name mismatch on the SMTP protocol level,
13104 # which would bite us if the value of from does not match, e.g.,
13105 # for people who have a sXXXXeforge project and want to speak
13106 # with the mailing list under their project account (in from),
13107 # still sending the message through their normal mail provider
13108 define XandeX {
13109   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
13110   set from='Your Name <address@exam.ple>'
13112   shortcut pop %:pop3s://pop.yaXXex.com
13113   shortcut imap %:imaps://imap.yaXXex.com
13115   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
13116     hostname=yaXXex.com smtp-hostname=
13118 account XandeX {
13119   \ecall Xandex
13122 # Create some new commands so that, e.g., `ls /tmp' will..
13123 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
13124 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
13126 wysh set pipe-message/external-body='@* echo $MAILX_EXTERNAL_BODY_URL'
13128 # We do not support gpg(1) directly yet.  But simple --clearsign'd
13129 # message parts can be dealt with as follows:
13130 define V {
13131   localopts yes
13132   wysh set pipe-text/plain=$'@*#++=@\e
13133     < "${MAILX_FILENAME_TEMPORARY}" awk \e
13134         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
13135       BEGIN{done=0}\e
13136       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
13137         if(done++ != 0)\e
13138           next;\e
13139         print "--- GPG --verify ---";\e
13140         system("gpg --verify " TMPFILE " 2>&1");\e
13141         print "--- GPG --verify ---";\e
13142         print "";\e
13143         next;\e
13144       }\e
13145       /^-----BEGIN PGP SIGNATURE-----/,\e
13146           /^-----END PGP SIGNATURE-----/{\e
13147         next;\e
13148       }\e
13149       {print}\e
13150     \e''
13151     print
13153 commandalias V '\e'call V
13157 When storing passwords in
13158 .Pa \*(ur
13159 appropriate permissions should be set on this file with
13160 .Ql $ chmod 0600 \*(ur .
13161 If the \*(OPal
13162 .Va netrc-lookup
13163 is available user credentials can be stored in the central
13164 .Pa .netrc
13165 file instead; e.g., here is a different version of the example account
13166 that sets up SMTP and POP3:
13168 .Bd -literal -offset indent
13169 define XandeX {
13170   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
13171   set from='Your Name <address@exam.ple>'
13172   set netrc-lookup
13173   # Load an encrypted ~/.netrc by uncommenting the next line
13174   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
13176   set mta=smtps://smtp.yXXXXx.ru:465 \e
13177       smtp-hostname= hostname=yXXXXx.com
13178   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
13179   commandalias xp fi pop3s://pop.yXXXXx.ru
13181 account XandeX {
13182   \ecall XandeX
13187 and, in the
13188 .Pa .netrc
13189 file:
13191 .Bd -literal -offset indent
13192 machine *.yXXXXx.ru login USER password PASS
13196 This configuration should now work just fine:
13199 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
13200 .\" }}}
13202 .\" .Ss "S/MIME step by step" {{{
13203 .Ss "S/MIME step by step"
13205 \*(OP The first thing you need for participating in S/MIME message
13206 exchange is your personal certificate, including a private key.
13207 The certificate contains public information, in particular your name and
13208 your email address(es), and the public key that is used by others to
13209 encrypt messages for you,
13210 and to verify signed messages they supposedly received from you.
13211 The certificate is included in each signed message you send.
13212 The private key must be kept secret.
13213 It is used to decrypt messages that were previously encrypted with your
13214 public key, and to sign messages.
13217 For personal use it is recommended that you get a S/MIME certificate
13218 from one of the major CAs on the Internet using your WWW browser.
13219 Many CAs offer such certificates for free.
13220 There is also
13221 .Lk https://www.CAcert.org
13222 which issues client and server certificates to members of their
13223 community for free; their root certificate
13224 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
13225 is often not in the default set of trusted CA root certificates, though,
13226 which means you will have to download their root certificate separately
13227 and ensure it is part of our S/MIME certificate validation chain by
13228 including it in
13229 .Va smime-ca-dir
13230 or as a vivid member of the
13231 .Va smime-ca-file .
13232 But let us take a step-by-step tour on how to setup S/MIME with
13233 a certificate from CAcert.org despite this situation!
13236 First of all you will have to become a member of the CAcert.org
13237 community, simply by registrating yourself via the web interface.
13238 Once you are, create and verify all email addresses you want to be able
13239 to create signed and encrypted messages for/with using the corresponding
13240 entries of the web interface.
13241 Now ready to create S/MIME certificates, so let us create a new
13242 .Dq client certificate ,
13243 ensure to include all email addresses that should be covered by the
13244 certificate in the following web form, and also to use your name as the
13245 .Dq common name .
13248 Create a private key and a certificate request on your local computer
13249 (please see the manual pages of the used commands for more in-depth
13250 knowledge on what the used arguments etc. do):
13253 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
13256 Afterwards copy-and-paste the content of
13257 .Dq creq.pem
13258 into the certificate-request (CSR) field of the web form on the
13259 CAcert.org website (you may need to unfold some
13260 .Dq advanced options
13261 to see the corresponding text field).
13262 This last step will ensure that your private key (which never left your
13263 box) and the certificate belong together (through the public key that
13264 will find its way into the certificate via the certificate-request).
13265 You are now ready and can create your CAcert certified certificate.
13266 Download and store or copy-and-paste it as
13267 .Dq pub.crt .
13270 Yay.
13271 In order to use your new S/MIME setup a combined private key/public key
13272 (certificate) file has to be created:
13275 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
13278 This is the file \*(UA will work with.
13279 If you have created your private key with a passphrase then \*(UA will
13280 ask you for it whenever a message is signed or decrypted.
13281 Set the following variables to henceforth use S/MIME (setting
13282 .Va smime-ca-file
13283 is of interest for verification only):
13285 .Bd -literal -offset indent
13286 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
13287     smime-sign-cert=ME@HERE.com.paired \e
13288     smime-sign-message-digest=SHA256 \e
13289     smime-sign
13292 .\" }}}
13294 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
13295 .Ss "Using CRLs with S/MIME or SSL/TLS"
13297 \*(OP Certification authorities (CAs) issue certificate revocation
13298 lists (CRLs) on a regular basis.
13299 These lists contain the serial numbers of certificates that have been
13300 declared invalid after they have been issued.
13301 Such usually happens because the private key for the certificate has
13302 been compromised,
13303 because the owner of the certificate has left the organization that is
13304 mentioned in the certificate, etc.
13305 To seriously use S/MIME or SSL/TLS verification,
13306 an up-to-date CRL is required for each trusted CA.
13307 There is otherwise no method to distinguish between valid and
13308 invalidated certificates.
13309 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
13310 the Internet, so they have to be retrieved by some external mechanism.
13313 \*(UA accepts CRLs in PEM format only;
13314 CRLs in DER format must be converted, like, e.\|g.:
13317 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
13320 To tell \*(UA about the CRLs, a directory that contains all CRL files
13321 (and no other files) must be created.
13323 .Va smime-crl-dir
13325 .Va ssl-crl-dir
13326 variables, respectively, must then be set to point to that directory.
13327 After that, \*(UA requires a CRL to be present for each CA that is used
13328 to verify a certificate.
13329 .\" }}}
13331 .\" }}} (Examples)
13334 .\" .Sh "FAQ" {{{
13335 .Sh "FAQ"
13337 In general it is a good idea to turn on
13338 .Va debug
13339 .Pf ( Fl d )
13340 and / or
13341 .Va verbose
13342 .Pf ( Fl v ,
13343 twice) if something does not work well.
13344 Very often a diagnostic message can be produced that leads to the
13345 problems' solution.
13347 .\" .Ss "\*(UA shortly hangs on startup" {{{
13348 .Ss "\*(UA shortly hangs on startup"
13350 This can have two reasons, one is the necessity to wait for a file lock
13351 and cannot be helped, the other being that \*(UA calls the function
13352 .Xr uname 2
13353 in order to query the nodename of the box (sometimes the real one is
13354 needed instead of the one represented by the internal variable
13355 .Va hostname ) .
13356 One may have varying success by ensuring that the real hostname and
13357 .Ql localhost
13358 have entries in
13359 .Pa /etc/hosts ,
13360 or, more generally, that the name service is properly setup \(en
13361 and does
13362 .Xr hostname 1
13363 return the expected value?
13364 Does this local hostname have a domain suffix?
13365 RFC 6762 standardized the link-local top-level domain
13366 .Ql .local ,
13367 try again after adding an (additional) entry with this extension.
13368 .\" }}}
13370 .\" .Ss "I cannot login to Google mail aka GMail" {{{
13371 .Ss "I cannot login to Google mail aka GMail"
13373 Since 2014 some free service providers classify programs as
13374 .Dq less secure
13375 unless they use a special authentification method (OAuth 2.0) which
13376 was not standardized for non-HTTP protocol authentication token query
13377 until August 2015 (RFC 7628).
13380 Different to Kerberos / GSSAPI, which is developed since the mid of the
13381 1980s, where a user can easily create a local authentication ticket for
13382 her- and himself with the locally installed
13383 .Xr kinit 1
13384 program, that protocol has no such local part but instead requires
13385 a world-wide-web query to create or fetch a token; since there is no
13386 local cache this query would have to be performed whenever \*(UA is
13387 invoked (in interactive sessions situation may differ).
13390 \*(UA does not support OAuth.
13391 Because of this it is necessary to declare \*(UA a
13392 .Dq less secure app
13393 (on the providers account web page) in order to read and send mail.
13394 However, it also seems possible to take the following steps instead:
13397 .Bl -enum -compact
13399 give the provider the number of a mobile phone,
13401 enable
13402 .Dq 2-Step Verification ,
13404 create an application specific password (16 characters), and
13406 use that special password instead of the real Google account password in
13407 \*(UA (for more on that see the section
13408 .Sx "On URL syntax and credential lookup" ) .
13410 .\" }}}
13412 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
13413 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
13415 It can happen that the terminal library (see
13416 .Sx "On terminal control and line editor",
13417 .Ic bind ,
13418 .Va termcap )
13419 reports different codes than the terminal really sends, in which case
13420 \*(UA will tell that a key binding is functional, but will not be able to
13421 recognize it because the received data does not match anything expected.
13422 Especially without the \*(OPal terminal capability library support one
13423 reason for this may be that the (possibly even non-existing) keypad
13424 is not turned on and the resulting layout reports the keypad control
13425 codes for the normal keyboard keys.
13427 .Va verbose
13428 listing of
13429 .Ic bind Ns
13430 ings will show the byte sequences that are expected.
13433 To overcome the situation, use, e.g., the program
13434 .Xr cat 1 ,
13435 in conjunction with the command line option
13436 .Fl \&\&v ,
13437 if available, to see the byte sequences which are actually produced
13438 by keypresses, and use the variable
13439 .Va termcap
13440 to make \*(UA aware of them.
13441 E.g., the terminal this is typed on produces some false sequences, here
13442 an example showing the shifted home key:
13444 .Bd -literal -offset indent
13445 ? set verbose
13446 ? bind*
13447 # 1B 5B=[ 31=1 3B=; 32=2 48=H
13448   bind base :kHOM z0
13449 ? x
13450 $ cat -v
13451 ^[[H
13452 ? \*(uA -v -Stermcap='kHOM=\eE[H'
13453 ? bind*
13454 # 1B 5B=[ 48=H
13455   bind base :kHOM z0
13457 .\" }}}
13459 .\" }}}
13462 .\" .Sh "IMAP CLIENT" {{{
13463 .Sh "IMAP CLIENT"
13465 \*(OPally there is IMAP client support available.
13466 This part of the program is obsolete and will vanish in v15 with the
13467 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
13468 and makes excessive use of signal based long code jumps.
13469 Support can hopefully be readded later based on a new-style I/O, with
13470 SysV signal handling.
13471 In fact the IMAP support had already been removed from the codebase, but
13472 was reinstantiated on user demand: in effect the IMAP code is at the
13473 level of \*(UA v14.8.16 (with
13474 .Ic imapcodec
13475 being the sole exception), and should be treated with some care.
13478 IMAP uses the
13479 .Ql imap://
13481 .Ql imaps://
13482 protocol prefixes, and an IMAP-based
13483 .Va folder
13484 may be used.
13485 IMAP URLs (paths) undergo inspections and possible transformations
13486 before use (and the command
13487 .Ic imapcodec
13488 can be used to manually apply them to any given argument).
13489 Hierarchy delimiters are normalized, a step which is configurable via the
13490 .Va imap-delim
13491 variable chain, but defaults to the first seen delimiter otherwise.
13492 \*(UA supports internationalised IMAP names, and en- and decodes the
13493 names from and to the
13494 .Va ttycharset
13495 as necessary and possible.
13496 If a mailbox name is expanded (see
13497 .Sx "Filename transformations" )
13498 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
13499 mailboxes below the
13500 .Va folder
13501 target box, while folder names prefixed by `@' refer to folders below
13502 the hierarchy base, e.g., the following lists all folders below the
13503 current one when in an IMAP mailbox:
13504 .Ql folders @ .
13507 Note: some IMAP servers do not accept the creation of mailboxes in
13508 the hierarchy base, but require that they are created as subfolders of
13509 `INBOX' \(en with such servers a folder name of the form
13511 .Dl imaps://mylogin@imap.myisp.example/INBOX.
13513 should be used (the last character is the server's hierarchy
13514 delimiter).
13515 The following IMAP-specific commands exist:
13518 .Bl -tag -width ".It Ic BaNg"
13520 .It Ic cache
13521 Only applicable to cached IMAP mailboxes;
13522 takes a message list and reads the specified messages into the IMAP
13523 cache.
13526 .It Ic connect
13527 If operating in disconnected mode on an IMAP mailbox,
13528 switch to online mode and connect to the mail server while retaining
13529 the mailbox status.
13530 See the description of the
13531 .Va disconnected
13532 variable for more information.
13535 .It Ic disconnect
13536 If operating in online mode on an IMAP mailbox,
13537 switch to disconnected mode while retaining the mailbox status.
13538 See the description of the
13539 .Va disconnected
13540 variable for more.
13541 A list of messages may optionally be given as argument;
13542 the respective messages are then read into the cache before the
13543 connection is closed, thus
13544 .Ql disco *
13545 makes the entire mailbox available for disconnected use.
13548 .It Ic imap
13549 Sends command strings directly to the current IMAP server.
13550 \*(UA operates always in IMAP `selected state' on the current mailbox;
13551 commands that change this will produce undesirable results and should be
13552 avoided.
13553 Useful IMAP commands are:
13554 .Bl -tag -offset indent -width ".Ic getquotearoot"
13555 .It create
13556 Takes the name of an IMAP mailbox as an argument and creates it.
13557 .It getquotaroot
13558 (RFC 2087) Takes the name of an IMAP mailbox as an argument
13559 and prints the quotas that apply to the mailbox.
13560 Not all IMAP servers support this command.
13561 .It namespace
13562 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
13563 the Other User's Namespaces and the Shared Namespaces.
13564 Each namespace type is printed in parentheses;
13565 if there are multiple namespaces of the same type,
13566 inner parentheses separate them.
13567 For each namespace a prefix and a hierarchy separator is listed.
13568 Not all IMAP servers support this command.
13572 .It Ic imapcodec
13573 Perform IMAP path transformations.
13574 Supports
13575 .Cm vput
13576 (see
13577 .Sx "Command modifiers" ) ,
13578 and manages the error number
13579 .Va \&! .
13580 The first argument specifies the operation:
13581 .Ar e[ncode]
13582 normalizes hierarchy delimiters (see
13583 .Va imap-delim )
13584 and converts the strings from the locale
13585 .Va ttycharset
13586 to the internationalized variant used by IMAP,
13587 .Ar d[ecode]
13588 performs the reverse operation.
13593 The following IMAP-specific internal variables exist:
13596 .Bl -tag -width ".It Va BaNg"
13598 .It Va disconnected
13599 \*(BO When an IMAP mailbox is selected and this variable is set,
13600 no connection to the server is initiated.
13601 Instead, data is obtained from the local cache (see
13602 .Va imap-cache Ns
13604 Mailboxes that are not present in the cache
13605 and messages that have not yet entirely been fetched from the server
13606 are not available;
13607 to fetch all messages in a mailbox at once,
13608 the command
13609 .No ` Ns Li copy * /dev/null Ns '
13610 can be used while still in connected mode.
13611 Changes that are made to IMAP mailboxes in disconnected mode are queued
13612 and committed later when a connection to that server is made.
13613 This procedure is not completely reliable since it cannot be guaranteed
13614 that the IMAP unique identifiers (UIDs) on the server still match the
13615 ones in the cache at that time.
13616 Data is saved to
13617 .Ev DEAD
13618 when this problem occurs.
13620 .It Va disconnected-USER@HOST
13621 The specified account is handled as described for the
13622 .Va disconnected
13623 variable above,
13624 but other accounts are not affected.
13626 .Mx Va imap-auth
13627 .It Va imap-auth-USER@HOST , imap-auth
13628 Sets the IMAP authentication method.
13629 Valid values are `login' for the usual password-based authentication
13630 (the default),
13631 `cram-md5', which is a password-based authentication that does not send
13632 the password over the network in clear text,
13633 and `gssapi' for GSS-API based authentication.
13636 .It Va imap-cache
13637 Enables caching of IMAP mailboxes.
13638 The value of this variable must point to a directory that is either
13639 existent or can be created by \*(UA.
13640 All contents of the cache can be deleted by \*(UA at any time;
13641 it is not safe to make assumptions about them.
13643 .Mx Va imap-delim
13644 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
13645 The hierarchy separator used by the IMAP server.
13646 Whenever an IMAP path is specified it will undergo normalization.
13647 One of the normalization steps is the squeezing and adjustment of
13648 hierarchy separators.
13649 If this variable is set, any occurrence of any character of the given
13650 value that exists in the path will be replaced by the first member of
13651 the value; an empty value will cause the default to be used, it is
13652 .Ql /. .
13653 If not set, we will reuse the first hierarchy separator character that
13654 is discovered in a user-given mailbox name.
13656 .Mx Va imap-keepalive
13657 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
13658 IMAP servers may close the connection after a period of
13659 inactivity; the standard requires this to be at least 30 minutes,
13660 but practical experience may vary.
13661 Setting this variable to a numeric `value' greater than 0 causes
13662 a `NOOP' command to be sent each `value' seconds if no other operation
13663 is performed.
13666 .It Va imap-list-depth
13667 When retrieving the list of folders on an IMAP server, the
13668 .Ic folders
13669 command stops after it has reached a certain depth to avoid possible
13670 infinite loops.
13671 The value of this variable sets the maximum depth allowed.
13672 The default is 2.
13673 If the folder separator on the current IMAP server is a slash `/',
13674 this variable has no effect and the
13675 .Ic folders
13676 command does not descend to subfolders.
13678 .Mx Va imap-use-starttls
13679 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
13680 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
13681 IMAP session SSL/TLS encrypted.
13682 This functionality is not supported by all servers,
13683 and is not used if the session is already encrypted by the IMAPS method.
13686 .\" }}}
13689 .\" .Sh "SEE ALSO" {{{
13690 .Sh "SEE ALSO"
13692 .Xr bogofilter 1 ,
13693 .Xr gpg 1 ,
13694 .Xr more 1 ,
13695 .Xr newaliases 1 ,
13696 .Xr openssl 1 ,
13697 .Xr sendmail 1 ,
13698 .Xr sh 1 ,
13699 .Xr spamassassin 1 ,
13700 .Xr iconv 3 ,
13701 .Xr setlocale 3 ,
13702 .Xr aliases 5 ,
13703 .Xr termcap 5 ,
13704 .Xr terminfo 5 ,
13705 .Xr locale 7 ,
13706 .Xr mailaddr 7 ,
13707 .Xr re_format 7 ,
13708 .Xr mailwrapper 8 ,
13709 .Xr sendmail 8
13711 .\" }}}
13714 .\" .Sh HISTORY {{{
13715 .Sh HISTORY
13717 M. Douglas McIlroy writes in his article
13718 .Dq A Research UNIX Reader: Annotated Excerpts \
13719 from the Programmer's Manual, 1971-1986
13720 that a
13721 .Xr mail 1
13722 command already appeared in First Edition
13724 in 1971:
13726 .Bd -ragged -offset indent
13727 Electronic mail was there from the start.
13728 Never satisfied with its exact behavior, everybody touched it at one
13729 time or another: to assure the safety of simultaneous access, to improve
13730 privacy, to survive crashes, to exploit uucp, to screen out foreign
13731 freeloaders, or whatever.
13732 Not until v7 did the interface change (Thompson).
13733 Later, as mail became global in its reach, Dave Presotto took charge and
13734 brought order to communications with a grab-bag of external networks
13735 (v8).
13740 Mail was written in 1978 by Kurt Shoens and developed as part of the
13743 distribution until 1995.
13744 Mail has then seen further development in open source
13746 variants, noticeably by Christos Zoulas in
13747 .Pf Net Bx .
13748 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
13749 Ritter in the years 2000 until 2008.
13750 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
13751 This man page is derived from
13752 .Dq The Mail Reference Manual
13753 that was originally written by Kurt Shoens.
13755 .\" }}}
13758 .Sh AUTHORS
13760 .An -nosplit
13761 .An "Kurt Shoens" ,
13762 .An "Edward Wang" ,
13763 .An "Keith Bostic" ,
13764 .An "Christos Zoulas" ,
13765 .An "Gunnar Ritter" .
13766 \*(UA is developed by
13767 .An "Steffen Nurpmeso" Aq steffen@sdaoden.eu .
13770 .\" .Sh CAVEATS {{{
13771 .Sh CAVEATS
13773 \*(ID Interrupting an operation via
13774 .Dv \&\&SIGINT
13776 .Ql control-C
13777 from anywhere else but a command prompt is very problematic and likely
13778 to leave the program in an undefined state: many library functions
13779 cannot deal with the
13780 .Fn siglongjmp 3
13781 that this software (still) performs; even though efforts have been taken
13782 to address this, no sooner but in v15 it will have been worked out:
13783 interruptions have not been disabled in order to allow forceful breakage
13784 of hanging network connections, for example (all this is unrelated to
13785 .Va ignore ) .
13788 The SMTP and POP3 protocol support of \*(UA is very basic.
13789 Also, if it fails to contact its upstream SMTP server, it will not make
13790 further attempts to transfer the message at a later time (setting
13791 .Va save
13793 .Va sendwait
13794 may be useful).
13795 If this is a concern, it might be better to set up a local SMTP server
13796 that is capable of message queuing.
13798 .\" }}}
13801 .Sh BUGS
13803 After deleting some message of a POP3 mailbox the header summary falsely
13804 claims that there are no messages to display, one needs to perform
13805 a scroll or dot movement to restore proper state.
13807 In threaded display a power user may encounter crashes very
13808 occasionally (this is may and very).
13810 The file
13811 .Pa TODO
13812 in the source repository lists future directions.
13815 Please report bugs to the
13816 .Va contact-mail
13817 address, e.g., from within \*(uA:
13818 .\" v15-compat: drop eval as `mail' will expand variable?
13819 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
13820 More information is available on the web:
13821 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ' -Xx .
13823 .\" s-ts-mode