Extend `localopts' with attributes: [scope], call, call-fixate..
[s-mailx.git] / nail.1
blob262f75ef6e40c11ce7ddf82fdcf3ebe3791cdf90
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(1): v14.9.0 / 2017-07-16
35 .Dd July 16, 2017
36 .ds VV \\%v14.9.0
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 2019).
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 loaded: if the letter
180 .Ql s
181 is (case-insensitively) part of the
182 .Ar spec
183 then the system wide
184 .Pa \*(UR
185 is loaded, likewise the letter
186 .Ql u
187 controls loading of the user's personal
188 .Pa \*(ur
189 file, whereas the letters
190 .Ql -
192 .Ql /
193 explicitly forbid loading of any resource files.
194 This option should be used by scripts: to avoid environmental noise they
195 should
196 .Dq detach
197 from any configuration files and create a script-local environment,
198 explicitly setting any of the desired
199 .Sx "INTERNAL VARIABLES"
201 .Fl S .
202 This option overrides
203 .Fl n .
206 .It Fl A Ar account
207 Executes an
208 .Ic account
209 command for the given user email
210 .Ar account
211 after program startup is complete (all resource files are loaded, any
212 .Fl S
213 setting is being established; only
214 .Fl X
215 commands have not been evaluated yet).
216 Being a special incarnation of
217 .Ic define Ns d
218 macros for the purpose of bundling longer-lived
219 .Ic set Ns
220 tings, activating such an email account also switches to the accounts
221 .Mx -sx
222 .Sx "primary system mailbox"
223 (most likely the
224 .Va inbox ) .
227 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
228 Attach
229 .Ar file
230 to the message (for compose mode opportunities refer to
231 .Ic ~@
233 .Ic ~^ ) .
234 .Sx "Filename transformations"
235 (also see
236 .Ic file )
237 will be performed, but shell word expansion is restricted to the tilde
238 .Ql ~ .
239 Shall
240 .Ar file
241 not be accessible but contain a
242 .Ql =
243 character, then anything before the
244 .Ql =
245 will be used as the filename, anything thereafter as a character set
246 specification.
248 If an input character set is specified,
249 .Mx -ix "character set specification"
250 but no output character set, then the given input character set is fixed
251 as-is, and no conversion will be applied;
252 giving the empty string or the special string hyphen-minus
253 .Ql -
254 will be treated as if
255 .Va ttycharset
256 has been specified (the default).
258 If an output character set has also been given then the conversion will
259 be performed exactly as specified and on-the-fly, not considering the
260 file's type and content.
261 As an exception, if the output character set is specified as the empty
262 string or hyphen-minus
263 .Ql - ,
264 then the default conversion algorithm (see
265 .Sx "Character sets" )
266 is applied (therefore no conversion is performed on-the-fly,
267 .Ar file
268 will be MIME-classified and its contents will be inspected first) \(em
269 without support for character set conversions
270 .Pf ( Va features
271 does not include the term
272 .Ql +iconv )
273 only this argument is supported.
275 .It Fl B
276 (\*(OB: \*(UA will always use line-buffered output, to gain
277 line-buffered input even in batch mode enable batch mode via
278 .Fl # . )
281 .It Fl b Ar addr
282 Send a blind carbon copy to
283 .Ar addr Ns
284 ess, if the
285 .Ic set Ns
286 ting of
287 .Va expandaddr ,
288 one of the
289 .Sx "INTERNAL VARIABLES" ,
290 allows.
291 The option may be used multiple times.
292 Also see the section
293 .Sx "On sending mail, and non-interactive mode" .
296 .It Fl c Ar addr
297 Send carbon copies to the given receiver, if so allowed by
298 .Va expandaddr .
299 May be used multiple times.
302 .It Fl d
303 .Ic set
304 the internal variable
305 .Va debug
306 which enables debug messages and disables message delivery,
307 among others; effectively turns almost any operation into a dry-run.
310 .It Fl E
311 .Ic set
312 .Va skipemptybody
313 and thus discard messages with an empty message part body.
314 This command line option is \*(OB.
317 .It Fl e
318 Just check if mail is present (in the system
319 .Va inbox
320 or the one specified via
321 .Fl f ) :
322 if yes, return an exit status of zero, a non-zero value otherwise.
323 To restrict the set of mails to consider in this evaluation a message
324 specification can be added with the option
325 .Fl L .
328 .It Fl F
329 Save the message to send in a file named after the local part of the
330 first recipient's address (instead of in
331 .Va record Ns ).
334 .It Fl f
335 Read in the contents of the user's
336 .Mx -sx
337 .Sx "secondary mailbox"
338 .Ev MBOX
339 (or the specified file) for processing;
340 when \*(UA is quit, it writes undeleted messages back to this file
341 (but be aware of the
342 .Va hold
343 option).
344 The optional
345 .Ar file
346 argument will undergo some special
347 .Sx "Filename transformations"
348 (also see
349 .Ic file ) .
350 Note that
351 .Ar file
352 is not an argument to the flag
353 .Fl \&\&f ,
354 but is instead taken from the command line after option processing has
355 been completed.
356 In order to use a
357 .Ar file
358 that starts with a hyphen-minus, prefix with a relative path, as in
359 .Ql ./-hyphenbox.mbox .
362 .It Fl H
363 Display a summary of
364 .Ic headers
365 and exit; a configurable summary view is available via the
366 .Fl L
367 option.
370 .It Fl h
371 Show a short usage summary.
374 .It Fl i
375 .Ic set
376 .Va ignore
377 to ignore tty interrupt signals.
380 .It Fl L Ar spec
381 Display a summary of
382 .Ic headers
383 of all messages that match the given
384 .Ar spec ,
385 then exit.
386 See the section
387 .Sx "Specifying messages"
388 for the format of
389 .Ar spec .
390 If the
391 .Fl e
392 option has been given in addition no header summary is produced,
393 but \*(UA will instead indicate via its exit status whether
394 .Ar spec
395 matched any messages
396 .Pf ( Ql 0 )
397 or not
398 .Pf ( Ql 1 ) ;
399 note that any verbose output is suppressed in this mode and must instead
400 be enabled explicitly (e.g., by using the option
401 .Fl v ) .
404 .It Fl M Ar type
405 Special send mode that will flag standard input with the MIME
406 .Ql Content-Type:
407 set to the given
408 .Ar type
409 and use it as the main message body.
410 \*(ID Using this option will bypass processing of
411 .Va message-inject-head ,
412 .Va signature
414 .Va message-inject-tail .
415 Also see
416 .Fl q , m , t .
419 .It Fl m Ar file
420 Special send mode that will MIME classify the specified
421 .Ar file
422 and use it as the main message body.
423 \*(ID Using this option will bypass processing of
424 .Va message-inject-head ,
425 .Va signature
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 the internal
532 .Ar var Ns
533 iable and, in case of a non-boolean variable which has a value, assign
534 .Ar value
535 to it.
536 Even though
537 .Sx "INTERNAL VARIABLES"
538 .Ic \&\&set
540 .Fl \&\&S
541 may be overwritten from within resource files,
542 the command line setting will be reestablished after all resource files
543 have been loaded.
544 (\*(ID In the future such a setting may instead become
545 .Dq frozen
546 until the startup is complete.)
549 .It Fl s Ar subject
550 Specify the subject of the message to be sent.
551 Newline (NL) and carriage-return (CR) bytes are invalid and will be
552 normalized to space (SP) characters.
555 .It Fl t
556 The message given (on standard input) is expected to contain, separated
557 from the message body by an empty line, a message header with
558 .Ql To: ,
559 .Ql Cc: ,
561 .Ql Bcc:
562 fields giving its recipients, which will be added to any recipients
563 specified on the command line.
564 If a message subject is specified via
565 .Ql Subject:
566 then it will be used in favour of one given on the command line.
568 Also understood are
569 .Ql Reply-To:
570 (possibly overriding
571 .Va replyto ) ,
572 .Ql Sender:
573 .Pf ( Va sender ) ,
574 .Ql From:
575 .Pf ( Va from
576 and / or option
577 .Fl r ) .
578 .Ql Message-ID: ,
579 .Ql In-Reply-To: ,
580 .Ql References:
582 .Ql Mail-Followup-To: ,
583 by default created automatically dependent on message context, will
584 be used if specified (a special address massage will however still occur
585 for the latter).
586 Any other custom header field (also see
587 .Va customhdr
589 .Ic ~^ )
590 is passed through entirely
591 unchanged, and in conjunction with the options
592 .Fl ~
594 .Fl #
595 it is possible to embed
596 .Sx "COMMAND ESCAPES" .
597 Also see
598 .Fl M , m , q .
601 .It Fl u Ar user
602 Initially read the
603 .Mx -sx
604 .Sx "primary system mailbox"
606 .Ar user ,
607 appropriate privileges presumed; effectively identical to
608 .Ql Fl \&\&f Ns \0%user .
611 .It Fl V
612 Show \*(UA's
613 .Va version
614 and exit.
615 The command
616 .Ic version
617 will also show the list of
618 .Va features :
619 .Ql $ \*(uA -Xversion -Xx .
622 .It Fl v
623 .Ic set Ns
624 ting the internal variable
625 .Va verbose
626 enables display of some informational context messages.
627 Using it twice increases the level of verbosity.
630 .It Fl X Ar cmd
631 Add the given (or multiple for a multiline argument)
632 .Ar cmd
633 to the list of commands to be executed,
634 as a last step of program startup, before normal operation starts.
635 This is the only possibility to execute commands in non-interactive mode
636 when reading startup files is actively prohibited.
637 The commands will be evaluated as a unit, just as via
638 .Ic source .
639 Correlates with
640 .Fl #
642 .Va errexit .
645 .It Fl ~
646 Enable
647 .Sx "COMMAND ESCAPES"
648 in compose mode even in non-interactive use cases.
649 This can be used to, e.g., automatically format the composed message
650 text before sending the message:
651 .Bd -literal -offset indent
652 $ ( echo 'line    one. Word.     Word2.';\e
653     echo '~| /usr/bin/fmt -tuw66' ) |\e
654   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
658 .It Fl #
659 Enables batch mode: standard input is made line buffered, the complete
660 set of (interactive) commands is available, processing of
661 .Sx "COMMAND ESCAPES"
662 is enabled in compose mode, and diverse
663 .Sx "INTERNAL VARIABLES"
664 are adjusted for batch necessities, exactly as if done via
665 .Fl S :
666 .Va emptystart ,
667 .Pf no Va errexit ,
668 .Pf no Va header ,
669 .Pf no Va posix ,
670 .Va quiet ,
671 .Va sendwait ,
672 .Va typescript-mode
673 as well as
674 .Ev MAIL ,
675 .Ev MBOX
677 .Va inbox
678 (the latter three to
679 .Pa /dev/null ) .
680 The following prepares an email message in a batched dry run:
681 .Bd -literal -offset indent
682 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
683   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
687 .It Fl \&.
688 This flag forces termination of option processing in order to prevent
689 .Dq option injection
690 (attacks).
691 It also forcefully puts \*(UA into send mode, see
692 .Sx "On sending mail, and non-interactive mode" .
696 All given
697 .Ar to-addr
698 arguments and all receivers established via
699 .Fl b
701 .Fl c
702 are subject to the checks established by
703 .Va expandaddr ,
704 one of the
705 .Sx "INTERNAL VARIABLES" .
706 If the setting of
707 .Va expandargv
708 allows their recognition all
709 .Ar mta-option
710 arguments given at the end of the command line after a
711 .Ql --
712 separator will be passed through to a file-based
713 .Va mta
714 (Mail-Transfer-Agent) and persist for the entire session.
715 .Va expandargv
716 constraints do not apply to the content of
717 .Va mta-arguments .
718 .\" }}}
720 .\" .Ss "A starter" {{{
721 .Ss "A starter"
723 \*(UA is a direct descendant of
725 Mail, itself a successor of the Research
727 mail which
728 .Dq was there from the start
729 according to
730 .Sx HISTORY .
731 It thus represents the user side of the
733 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
734 traditionally taken by
735 .Xr sendmail 8 ,
736 and most MTAs provide a binary of this name for compatibility purposes.
737 If the \*(OPal SMTP
738 .Va mta
739 is included in the
740 .Va features
741 of \*(UA then the system side is not a mandatory precondition for mail
742 delivery.
745 Because \*(UA strives for compliance with POSIX
746 .Xr mailx 1
747 it is likely that some configuration settings have to be adjusted before
748 using it is a smooth experience.
749 (Rather complete configuration examples can be found in the section
750 .Sx EXAMPLES . )
751 The default global
752 .Pa \*(UR
753 resource file bends those standard imposed settings of the
754 .Sx "INTERNAL VARIABLES"
755 a bit towards more user friendliness and safety already.
758 For example, it
759 .Ic set Ns s
760 .Va hold
762 .Va keepsave
763 in order to suppress the automatic moving of messages to the
764 .Mx -sx
765 .Sx "secondary mailbox"
766 .Ev MBOX
767 that would otherwise occur (see
768 .Sx "Message states" ) ,
770 .Va keep
771 to not remove empty system MBOX mailbox files in order not to mangle
772 file permissions when files eventually get recreated (all empty (MBOX)
773 mailbox files will be removed unless this variable is set whenever
774 .Ev POSIXLY_CORRECT
775 mode has been enabled).
778 It also enables
779 .Va sendwait
780 in order to synchronize \*(UA with the exit status report of the used
781 .Va mta
782 when sending mails.
784 .Ic set Ns
786 .Va emptystart
787 to enter interactive startup even if the initial mailbox is empty,
788 .Va editheaders
789 to allow editing of headers as well as
790 .Va fullnames
791 to not strip down addresses in compose mode, and
792 .Va quote
793 to include the message that is being responded to when
794 .Ic reply Ns
795 ing.
798 It should be remarked that the file mode creation mask can be
799 explicitly managed via the variable
800 .Va umask .
801 \*(UA will not follow symbolic links when opening files for writing,
802 sufficient system support provided.
803 .\" }}}
805 .\" .Ss "On sending mail, and non-interactive mode" {{{
806 .Ss "On sending mail, and non-interactive mode"
808 To send a message to one or more people, using a local or a built-in
809 .Va mta
810 (Mail-Transfer-Agent) transport to actually deliver the generated mail
811 message, \*(UA can be invoked with arguments which are the names of
812 people to whom the mail will be sent, and the command line options
813 .Fl b
815 .Fl c
816 can be used to add (blind) carbon copy receivers:
818 .Bd -literal -offset indent
819 # Via sendmail(1)
820 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
822 # But... try it in an isolated dry-run mode (-d) first
823 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
824    -b bcc@exam.ple -c cc@exam.ple \e
825    -. '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
827 # With SMTP
828 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
829     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
830     -S from=scriptreply@exam.ple \e
831     -a /etc/mail.rc \e
832     -. eric@exam.ple
836 If standard input is a terminal rather than the message to be sent,
837 the user is expected to type in the message contents.
838 In this compose mode \*(UA treats lines beginning with the character
839 .Ql ~
840 special \(en these are so-called
841 .Sx "COMMAND ESCAPES" ,
842 which can be used to read in files, process shell commands, add and edit
843 attachments and more; e.g., the command escape
844 .Ic ~e
845 will start the text editor to revise the message in its current state,
846 .Ic ~h
847 allows editing of the most important message headers, with
848 .Ic ~^
849 custom headers can be created (more specifically than with
850 .Va customhdr ) .
851 .Ic ~?
852 gives an overview of most other available command escapes.
853 Typing
854 .Ql control-D
855 .Pf ( Ql ^D )
856 at the beginning of an empty line leaves compose mode and causes the
857 message to be sent, whereas typing
858 .Ql control-C
859 .Pf ( Ql ^C )
860 twice will abort the current letter (saving its contents in the file
861 denoted by
862 .Ev DEAD
863 unless
864 .Pf no Va save
865 is set).
868 A number of
869 .Sx ENVIRONMENT
871 .Sx "INTERNAL VARIABLES"
872 can be used to alter default behavior.
873 E.g., messages are sent asynchronously, without supervision, unless the
874 internal variable
875 .Va sendwait
876 is set, therefore send errors will not be recognizable until then.
877 .Ic set Ns
878 ting (also via
879 .Fl S )
880 .Va editalong
881 will automatically startup a text editor when compose mode is entered,
882 .Va editheaders
883 allows editing of headers additionally to plain body content, whereas
884 .Va askcc
886 .Va askbcc
887 will cause the user to be prompted actively for (blind) carbon-copy
888 recipients, respectively, if the given list is empty.
891 Especially when using public mail provider accounts with the SMTP
892 .Va mta
893 it is often necessary to set
894 .Va from
895 and/or
896 .Va hostname
897 (even finer control via
898 .Va smtp-hostname ) ,
899 which (even if empty) also causes creation of
900 .Ql Message-ID:
902 .Ql Content-ID:
903 header fields unless
904 .Va stealthmua
905 is set.
906 Saving a copy of sent messages in a
907 .Va record
908 mailbox may be desirable \(en as for most mailbox
909 .Ic file
910 targets the value will undergo
911 .Sx "Filename transformations" .
912 Defining user email
913 .Ic account Ns s
914 for the purpose of arranging a complete environment of settings that can
915 be switched to with a single command or command line option may be
916 useful.
917 .Pf ( Sx EXAMPLES
918 has example configurations for some of the well-known public mail
919 providers, and also gives a compact overview on how to setup a secure
920 SSL/TLS environment.)
921 Some introductional
922 .Fl d
924 .Va debug
925 sandbox dry-run tests will prove correctness.
928 The section
929 .Sx "On URL syntax and credential lookup"
930 will spread light on the different ways of how to specify user email
931 account credentials, the
932 .Ql USER@HOST
933 variable chains, and accessing protocol-specific resources,
934 the section
935 .Sx "Character sets"
936 goes into the details of character encodings, and how to use them for
937 interpreting the input data given in
938 .Va ttycharset
939 and representing messages and MIME part contents in
940 .Va sendcharsets ,
941 and reading the section
942 .Sx "The mime.types files"
943 should help to understand how the MIME-type of outgoing attachments are
944 classified, and what can be done for fine-tuning.
945 Over the wire a configurable
946 .Va mime-encoding
947 .Pf ( Ql Content-Transfer-Encoding: )
948 may be applied to the message data.
951 Message recipients (as specified on the command line or defined in
952 .Ql To: ,
953 .Ql Cc:
955 .Ql Bcc: )
956 may not only be email addressees but can also be names of mailboxes and
957 even complete shell command pipe specifications.
958 If the variable
959 .Va expandaddr
960 is not set then only network addresses (see
961 .Xr mailaddr 7
962 for a description of mail addresses) and plain user names (including MTA
963 aliases) may be used, other types will be filtered out, giving a warning
964 message.
965 The command
966 .Ic addrcodec
967 can be used to generate standard compliant network addresses.
969 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
970 .\" grep the latter for the complete picture
972 If the variable
973 .Va expandaddr
974 is set then extended recipient addresses will optionally be accepted:
975 Any name which starts with a vertical bar
976 .Ql |
977 character specifies a command pipe \(en the command string following the
978 .Ql |
979 is executed and the message is sent to its standard input;
980 Likewise, any name that starts with the character solidus
981 .Ql /
982 or the character sequence dot solidus
983 .Ql ./
984 is treated as a file, regardless of the remaining content;
985 likewise a name that solely consists of a hyphen-minus
986 .Ql - .
987 Any other name which contains a commercial at
988 .Ql @
989 character is treated as a network address;
990 Any other name which starts with a plus sign
991 .Ql +
992 character specifies a mailbox name;
993 Any other name which contains a solidus
994 .Ql /
995 character but no exclamation mark
996 .Ql \&!
997 or percent sign
998 .Ql %
999 character before also specifies a mailbox name;
1000 What remains is treated as a network address.
1002 .Bd -literal -offset indent
1003 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1004 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1005 $ echo safe | LC_ALL=C \e
1006     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
1007       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1008       -. bob@exam.ple
1012 It is possible to create personal distribution lists via the
1013 .Ic alias
1014 command, so that, for instance, the user can send mail to
1015 .Ql cohorts
1016 and have it go to a group of people.
1017 These aliases have nothing in common with the system wide aliases that
1018 may be used by the MTA, which are subject to the
1019 .Ql name
1020 constraint of
1021 .Va expandaddr
1022 and are often tracked in a file
1023 .Pa /etc/aliases
1024 (and documented in
1025 .Xr aliases 5
1027 .Xr sendmail 1 ) .
1028 Personal aliases will be expanded by \*(UA before the message is sent,
1029 and are thus a convenient alternative to specifying each addressee by
1030 itself; they correlate with the active set of
1031 .Ic alternates
1032 and are subject to
1033 .Va metoo
1034 filtering.
1037 .Dl alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox
1040 .Va on-compose-enter , on-compose-leave
1042 .Va on-compose-cleanup
1043 hook variables may be set to
1044 .Ic define Ns
1045 d macros to automatically adjust some settings dependent
1046 on receiver, sender or subject contexts, and via the
1047 .Va on-compose-splice
1048 as well as
1049 .Va on-compose-splice-shell
1050 variables, the former also to be set to a
1051 .Ic define Ns
1052 d macro, increasingly powerful mechanisms to perform automated message
1053 adjustments are available.
1054 (\*(ID These hooks work for commands which newly create messages, namely
1055 .Ic forward , mail , reply
1056 and variants;
1057 .Ic resend
1059 .Ic Resend
1060 for now provide only the hooks
1061 .Va on-resend-enter
1063 .Va on-resend-cleanup . )
1066 To avoid environmental noise scripts should
1067 .Dq detach
1068 \*(UA from any configuration files and create a script-local
1069 environment, ideally with the command line options
1070 .Fl \&:
1071 to disable any configuration file in conjunction with repetitions of
1072 .Fl S
1073 to specify variables:
1075 .Bd -literal -offset indent
1076 $ env LC_ALL=C \*(uA -:/ \e
1077     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1078     -Sexpandaddr=fail,-all,failinvaddr \e
1079     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1080     -S from=scriptreply@exam.ple \e
1081     -s 'Subject to go' -a attachment_file \e
1082     -. 'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1083     < content_file
1087 As shown, scripts can
1088 .Dq fake
1089 a locale environment, the above specifies the all-compatible 7-bit clean
1090 .Ev LC_ALL
1091 .Dq C ,
1092 but will nonetheless take and send UTF-8 in the message text by using
1093 .Va ttycharset .
1094 In interactive mode, which is introduced in the next section, messages
1095 can be sent by calling the
1096 .Ic mail
1097 command with a list of recipient addresses:
1099 .Bd -literal -offset indent
1100 $ \*(uA -d -Squiet -Semptystart
1101 "/var/spool/mail/user": 0 messages
1102 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1104 ? # Will do the right thing (tm)
1105 ? m rec1@exam.ple rec2@exam.ple
1107 .\" }}}
1109 .\" .Ss "On reading mail, and interactive mode" {{{
1110 .Ss "On reading mail, and interactive mode"
1112 When invoked without addressees \*(UA enters interactive mode in which
1113 mails may be read.
1114 When used like that the user's system
1115 .Va inbox
1116 (for more on mailbox types please see the command
1117 .Ic file )
1118 is read in and a one line header of each message therein is displayed if
1119 the variable
1120 .Va header
1121 is set.
1122 The visual style of this summary of
1123 .Ic headers
1124 can be adjusted through the variable
1125 .Va headline
1126 and the possible sorting criterion via
1127 .Va autosort .
1128 Scrolling through
1129 .Va screen Ns
1130 fuls of
1131 .Ic headers
1132 can be performed with the command
1133 .Ic z .
1134 If the initially opened mailbox is empty \*(UA will instead exit
1135 immediately (after displaying a message) unless the variable
1136 .Va emptystart
1137 is set.
1140 At the
1141 .Va prompt
1142 the command
1143 .Ic list
1144 will give a listing of all available commands and
1145 .Ic help
1146 will give a summary of some common ones.
1147 If the \*(OPal documentation strings are available one can type
1148 .Ql help X
1149 .Pf "(or " Ql ?X )
1150 and see the actual expansion of
1151 .Ql X
1152 and what its purpose is, i.e., commands can be abbreviated
1153 (note that POSIX defines some abbreviations, so that the alphabetical
1154 order of commands does not necessarily relate to the abbreviations; it is
1155 however possible to define overwrites with
1156 .Ic commandalias ) .
1157 These commands can also produce a more
1158 .Va verbose
1159 output.
1162 Messages are given numbers (starting at 1) which uniquely identify
1163 messages; the current message \(en the
1164 .Dq dot
1165 \(en will either be the first new message, or the first unread message,
1166 or the first message of the mailbox; the internal variable
1167 .Va showlast
1168 will instead cause usage of the last message for this purpose.
1169 The command
1170 .Ic headers
1171 will display a
1172 .Va screen Ns
1173 ful of header summaries containing the
1174 .Dq dot ,
1175 whereas
1176 .Ic from
1177 will display only the summaries of the given messages, defaulting to the
1178 .Dq dot .
1181 Message content can be displayed with the command
1182 .Ic type
1183 .Pf ( Ql t ,
1184 alias
1185 .Ic print ) .
1186 Here the variable
1187 .Va crt
1188 controls whether and when \*(UA will use the configured
1189 .Ev PAGER
1190 for display instead of directly writing to the user terminal
1191 .Va screen ,
1192 the sole difference to the command
1193 .Ic more ,
1194 which will always use the
1195 .Ev PAGER .
1196 The command
1197 .Ic top
1198 will instead only show the first
1199 .Va toplines
1200 of a message (maybe even compressed if
1201 .Va topsqueeze
1202 is set).
1203 Message display experience may improve by setting and adjusting
1204 .Va mime-counter-evidence ,
1205 and also see
1206 .Sx "HTML mail and MIME attachments" .
1209 By default the current message
1210 .Pf ( Dq dot )
1211 is displayed, but like with many other commands it is possible to give
1212 a fancy message specification (see
1213 .Sx "Specifying messages" ) ,
1214 e.g.,
1215 .Ql t:u
1216 will display all unread messages,
1217 .Ql t.
1218 will display the
1219 .Dq dot ,
1220 .Ql t 1 5
1221 will type the messages 1 and 5,
1222 .Ql t 1-5
1223 will type the messages 1 through 5, and
1224 .Ql t-
1226 .Ql t+
1227 will display the last and the next message, respectively.
1228 The command
1229 .Ic search
1230 (a more substantial alias for
1231 .Ic from )
1232 will display a header summary of the given message specification list
1233 instead of their content, e.g., the following will search for subjects:
1236 .Dl ? from "'@Some subject to search for'"
1239 In the default setup all header fields of a message will be
1240 .Ic type Ns
1241 d, but fields can be white- or blacklisted for a variety of
1242 applications by using the command
1243 .Ic headerpick ,
1244 e.g., to restrict their display to a very restricted set for
1245 .Ic type :
1246 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1247 In order to display all header fields of a message regardless of
1248 currently active ignore or retain lists, use the commands
1249 .Ic Type
1251 .Ic Top ;
1252 .Ic Show
1253 will show the raw message content.
1254 Note that historically the global
1255 .Pa \*(UR
1256 not only adjusts the list of displayed headers, but also sets
1257 .Va crt .
1260 Dependent upon the configuration a line editor (see the section
1261 .Sx "On terminal control and line editor" )
1262 aims at making the user experience with the many
1263 .Sx COMMANDS
1264 a bit nicer.
1265 When reading the system
1266 .Va inbox
1267 or when
1268 .Fl f
1270 .Ic file )
1271 specified a mailbox explicitly prefixed with the special
1272 .Ql %:
1273 modifier (propagating the mailbox to a
1274 .Mx -sx
1275 .Sx "primary system mailbox" ) ,
1276 then messages which have been read will be automatically moved to a
1277 .Mx -sx
1278 .Sx "secondary mailbox" ,
1279 the users
1280 .Ev MBOX
1281 file, when the mailbox is left, either by changing the
1282 active mailbox or by quitting \*(UA (also see
1283 .Sx "Message states" )
1284 \(en this automatic moving from a system or primary to the secondary
1285 mailbox is not performed when the variable
1286 .Va hold
1287 is set.
1288 Messages can also be explicitly
1289 .Ic move Ns
1290 d to other mailboxes, whereas
1291 .Ic copy
1292 keeps the original message.
1293 .Ic write
1294 can be used to write out data content of specific parts of messages.
1297 After examining a message the user can
1298 .Ic reply Ql r
1299 to the sender and all recipients (which will also be placed in
1300 .Ql To:
1301 unless
1302 .Va recipients-in-cc
1303 is set) or
1304 .Ic Reply Ql R
1305 exclusively to the sender(s).
1306 .Ic forward Ns
1307 ing a message will allow editing the new message: the original message
1308 will be contained in the message body, adjusted according to
1309 .Ic headerpick .
1310 When replying to or forwarding a message recipient addresses will be
1311 stripped from comments and names unless the internal variable
1312 .Va fullnames
1313 is set.
1314 It is possible to
1315 .Ic resend
1317 .Ic Resend
1318 messages: the former will add a series of
1319 .Ql Resent-
1320 headers, whereas the latter will not; different to newly created
1321 messages editing is not possible and no copy will be saved even with
1322 .Va record
1323 unless the additional variable
1324 .Va record-resent
1325 is set.
1326 Of course messages can be
1327 .Ic delete Ql d ,
1328 and they can spring into existence again via
1329 .Ic undelete
1330 or when the \*(UA session is ended via the
1331 .Ic exit Ql x
1332 command.
1335 To end a mail processing session one may either issue
1336 .Ic quit Ql q
1337 to cause a full program exit, which possibly includes
1338 automatic moving of read messages to the
1339 .Mx -sx
1340 .Sx "secondary mailbox"
1341 .Ev MBOX
1342 as well as updating the \*(OPal line editor
1343 .Va history-file ,
1344 or use the command
1345 .Ic exit Ql x
1346 instead in order to prevent any of these actions.
1347 .\" }}}
1349 .\" .Ss "HTML mail and MIME attachments" {{{
1350 .Ss "HTML mail and MIME attachments"
1352 Messages which are HTML-only become more and more common and of course
1353 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1354 Mail Extensions) parts for, e.g., attachments.
1355 To get a notion of MIME types, \*(UA will first read
1356 .Sx "The mime.types files"
1357 (as configured and allowed by
1358 .Va mimetypes-load-control ) ,
1359 and then add onto that types registered directly with
1360 .Ic mimetype .
1361 It (normally) has a default set of types built-in, too.
1362 To improve interaction with faulty MIME part declarations which are
1363 often seen in real-life messages, setting
1364 .Va mime-counter-evidence
1365 will allow \*(UA to verify the given assertion and possibly provide
1366 an alternative MIME type.
1369 Whereas \*(UA \*(OPally supports a simple HTML-to-text converter for
1370 HTML messages, it cannot handle MIME types other than plain text itself.
1371 Instead programs need to become registered to deal with specific MIME
1372 types or file extensions.
1373 These programs may either prepare plain text versions of their input in
1374 order to enable \*(UA to integrate their output neatlessly in its own
1375 message visualization (a mode which is called
1376 .Cd copiousoutput ) ,
1377 or display the content themselves, for example in an external graphical
1378 window: such handlers will only be considered by and for the command
1379 .Ic mimeview .
1382 To install a handler program for a specific MIME type an according
1383 .Va pipe-TYPE/SUBTYPE
1384 variable needs to be set; to instead define a handler for a specific
1385 file extension the respective
1386 .Va pipe-EXTENSION
1387 variable can be used \(en these handlers take precedence.
1388 \*(OPally \*(UA supports mail user agent configuration as defined in
1389 RFC 1524; this mechanism (see
1390 .Sx "The Mailcap files" )
1391 will be queried for display or quote handlers if none of the former two
1392 .\" TODO v15-compat "will be" -> "is"
1393 did; it will be the sole source for handlers of other purpose.
1394 A last source for handlers is the MIME type definition itself, when
1395 a (\*(UA specific) type-marker was registered with the command
1396 .Ic mimetype
1397 (which many built-in MIME types do).
1400 E.g., to display a HTML message inline (that is, converted to a more
1401 fancy plain text representation than the built-in converter is capable to
1402 produce) with either of the text-mode browsers
1403 .Xr lynx 1
1405 .Xr elinks 1 ,
1406 teach \*(UA about MathML documents and make it display them as plain
1407 text, and to open PDF attachments in an external PDF viewer,
1408 asynchronously and with some other magic attached:
1410 .Bd -literal -offset indent
1411 ? if [ "$features" !% +filter-html-tagsoup ]
1412 ?  #set pipe-text/html='@* elinks -force-html -dump 1'
1413 ?  set pipe-text/html='@* lynx -stdin -dump -force_html'
1414 ?  # Display HTML as plain text instead
1415 ?  #set pipe-text/html=@
1416 ? endif
1417 ? mimetype @ application/mathml+xml mathml
1418 ? wysh set pipe-application/pdf='@&=@ \e
1419     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1420     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1421     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1423 .\" }}}
1425 .\" .Ss "Mailing lists" {{{
1426 .Ss "Mailing lists"
1428 \*(UA offers some support to ease handling of mailing lists.
1429 The command
1430 .Ic mlist
1431 promotes all given arguments to known mailing lists, and
1432 .Ic mlsubscribe
1433 sets their subscription attribute, creating them first as necessary.
1434 (On the other hand
1435 .Ic unmlsubscribe
1436 does not
1437 .Ic unmlist
1438 automatically, but only resets the subscription attribute.)
1439 Using the commands without arguments will show (a subset of) all
1440 currently defined mailing lists.
1442 .Va headline
1443 format
1444 .Ql \&%T
1445 can be used to mark out messages with configured list addresses
1446 in the header display.
1449 \*(OPally mailing lists may also be specified as (extended) regular
1450 expressions, which allows matching of many addresses with a single
1451 expression.
1452 However, all fully qualified list addresses are matched via a fast
1453 dictionary, whereas expressions are placed in (a) list(s) which is
1454 (are) matched sequentially.
1456 .Bd -literal -offset indent
1457 ? set followup-to followup-to-honour=ask-yes \e
1458     reply-to-honour=ask-yes
1459 ? wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1460 ? mlsubscribe a4@b4.c4 exact@lists.c3
1464 The variable
1465 .Va followup-to-honour
1466 will ensure that a
1467 .Ql Mail-\:Followup-\:To:
1468 header is honoured when the message is being replied to (via
1469 .Ic reply
1471 .Ic Lreply )
1473 .Va followup-to
1474 controls whether this header is created when sending mails; it will be
1475 created automatically for a couple of reasons, too, like when the
1476 special
1477 .Dq mailing list specific
1478 respond command
1479 .Ic Lreply
1480 is used, when
1481 .Ic reply
1482 is used to respond to a message with its
1483 .Ql Mail-Followup-To:
1484 being honoured etc.
1487 A difference in between the handling of known and subscribed lists is
1488 that the address of the sender is usually not part of a generated
1489 .Ql Mail-Followup-To:
1490 when addressing the latter, whereas it is for the former kind of lists.
1491 Usually because there are exceptions: say, if multiple lists are
1492 addressed and not all of them are subscribed lists.
1494 For convenience \*(UA will, temporarily, automatically add a list
1495 address that is presented in the
1496 .Ql List-Post:
1497 header of a message that is being responded to to the list of known
1498 mailing lists.
1499 Shall that header have existed \*(UA will instead, dependent on the
1500 variable
1501 .Va reply-to-honour ,
1502 use an also set
1503 .Ql Reply-To:
1504 for this purpose in order to accept a list administrators' wish that
1505 is supposed to have been manifested like that (but only if it provides
1506 a single address which resides on the same domain as what is stated in
1507 .Ql List-Post: ) .
1508 .\" }}}
1510 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1511 .Ss "Signed and encrypted messages with S/MIME"
1513 \*(OP S/MIME provides two central mechanisms:
1514 message signing and message encryption.
1515 A signed message contains some data in addition to the regular text.
1516 The data can be used to verify that the message was sent using a valid
1517 certificate, that the sender's address in the message header matches
1518 that in the certificate, and that the message text has not been altered.
1519 Signing a message does not change its regular text;
1520 it can be read regardless of whether the recipient's software is able to
1521 handle S/MIME.
1522 It is thus usually possible to sign all outgoing messages if so desired.
1525 Encryption, in contrast, makes the message text invisible for all people
1526 except those who have access to the secret decryption key.
1527 To encrypt a message, the specific recipient's public encryption key
1528 must be known.
1529 It is therefore not possible to send encrypted mail to people unless their
1530 key has been retrieved from either previous communication or public key
1531 directories.
1532 A message should always be signed before it is encrypted.
1533 Otherwise, it is still possible that the encrypted message text is
1534 altered.
1537 A central concept to S/MIME is that of the certification authority (CA).
1538 A CA is a trusted institution that issues certificates.
1539 For each of these certificates it can be verified that it really
1540 originates from the CA, provided that the CA's own certificate is
1541 previously known.
1542 A set of CA certificates is usually delivered with OpenSSL and installed
1543 on your system.
1544 If you trust the source of your OpenSSL software installation,
1545 this offers reasonable security for S/MIME on the Internet.
1546 Otherwise set
1547 .Va smime-ca-no-defaults
1548 to avoid using the default certificates and point
1549 .Va smime-ca-file
1550 and/or
1551 .Va smime-ca-dir
1552 to a trusted pool of certificates.
1553 In general, a certificate cannot be more secure than the method its CA
1554 certificate has been retrieved with.
1557 This trusted pool of certificates is used by the command
1558 .Ic verify
1559 to ensure that the given S/MIME messages can be trusted.
1560 If so, verified sender certificates that were embedded in signed
1561 messages can be saved locally with the command
1562 .Ic certsave ,
1563 and used by \*(UA to encrypt further communication with these senders:
1565 .Bd -literal -offset indent
1566 ? certsave FILENAME
1567 ? set smime-encrypt-USER@HOST=FILENAME \e
1568     smime-cipher-USER@HOST=AES256
1572 To sign outgoing messages in order to allow receivers to verify the
1573 origin of these messages a personal S/MIME certificate is required.
1574 \*(UA supports password-protected personal certificates (and keys),
1575 for more on this, and its automatization, please see the section
1576 .Sx "On URL syntax and credential lookup" .
1577 The section
1578 .Sx "S/MIME step by step"
1579 shows examplarily how such a private certificate can be obtained.
1580 In general, if such a private key plus certificate
1581 .Dq pair
1582 is available, all that needs to be done is to set some variables:
1584 .Bd -literal -offset indent
1585 ? set smime-sign-cert=ME@HERE.com.paired \e
1586     smime-sign-message-digest=SHA256 \e
1587     smime-sign
1591 Variables of interest for S/MIME in general are
1592 .Va smime-ca-dir ,
1593 .Va smime-ca-file ,
1594 .Va smime-ca-flags ,
1595 .Va smime-ca-no-defaults ,
1596 .Va smime-crl-dir ,
1597 .Va smime-crl-file .
1598 For S/MIME signing of interest are
1599 .Va smime-sign ,
1600 .Va smime-sign-cert ,
1601 .Va smime-sign-include-certs
1603 .Va smime-sign-message-digest .
1604 Additional variables of interest for S/MIME en- and decryption:
1605 .Va smime-cipher
1607 .Va smime-encrypt-USER@HOST .
1610 \*(ID Note that neither S/MIME signing nor encryption applies to
1611 message subjects or other header fields yet.
1612 Thus they may not contain sensitive information for encrypted messages,
1613 and cannot be trusted even if the message content has been verified.
1614 When sending signed messages,
1615 it is recommended to repeat any important header information in the
1616 message text.
1617 .\" }}}
1619 .\" .Ss "On URL syntax and credential lookup" {{{
1620 .Ss "On URL syntax and credential lookup"
1622 \*(IN For accessing protocol-specific resources usage of Uniform
1623 Resource Locators (URL, RFC 1738) has become omnipresent.
1624 \*(UA expects and understands URLs in the following form;
1625 parts in brackets
1626 .Ql []
1627 denote optional parts, optional either because there also exist other
1628 ways to define the information in question or because support of the
1629 part is protocol-specific (e.g.,
1630 .Ql /path
1631 is used by the local maildir and the IMAP protocol, but not by POP3);
1632 If any of
1633 .Ql USER
1635 .Ql PASSWORD
1636 are specified they must be given in URL percent encoded form (RFC 3986;
1637 the command
1638 .Ic urlcodec
1639 may be helpful):
1642 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1645 Note that these \*(UA URLs most often do not conform to any real
1646 standard, but instead represent a normalized variant of RFC 1738 \(en
1647 they are not used in data exchange but only meant as a compact,
1648 easy-to-use way of defining and representing information in
1649 a well-known notation.
1652 Many internal variables of \*(UA exist in multiple versions, called
1653 variable chains for the rest of this document: the plain
1654 .Ql variable
1655 as well as
1656 .Ql variable-HOST
1658 .Ql variable-USER@HOST .
1659 Here
1660 .Ql HOST
1661 indeed means
1662 .Ql server:port
1663 if a
1664 .Ql port
1665 had been specified in the respective URL, otherwise it refers to the plain
1666 .Ql server .
1667 Also,
1668 .Ql USER
1669 is not truly the
1670 .Ql USER
1671 that had been found when doing the user chain lookup as is described
1672 below, i.e., this
1673 .Ql USER
1674 will never be in URL percent encoded form, whether it came from an URL
1675 or not; i.e., variable chain name extensions of
1676 .Sx "INTERNAL VARIABLES"
1677 must not be URL percent encoded.
1680 For example, whether an hypothetical URL
1681 .Ql smtp://hey%3Ayou@our.house
1682 had been given that includes a user, or whether the URL was
1683 .Ql smtp://our.house
1684 and the user had been found differently, to lookup the variable chain
1685 .Va smtp-use-starttls
1686 \*(UA first looks for whether
1687 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
1688 is defined, then whether
1689 .Ql smtp-\:use-\:starttls-\:our.house
1690 exists before finally ending up looking at the plain variable itself.
1693 \*(UA obeys the following logic scheme when dealing with the
1694 necessary credential information of an account:
1696 .Bl -bullet
1698 If no
1699 .Ql USER
1700 has been given in the URL the variables
1701 .Va user-HOST
1703 .Va user
1704 are looked up; if no such variable(s) can be found then \*(UA will,
1705 when enforced by the \*(OPal variables
1706 .Va netrc-lookup-HOST
1708 .Va netrc-lookup ,
1709 search the users
1710 .Pa .netrc
1711 file for a
1712 .Ql HOST
1713 specific entry which provides a
1714 .Ql login
1715 name: this lookup will only succeed if unambiguous (one possible matching
1716 entry for
1717 .Ql HOST ) .
1718 It is possible to load encrypted
1719 .Pa .netrc
1720 files via
1721 .Va netrc-pipe .
1723 If there is still no
1724 .Ql USER
1725 then \*(UA will fall back to the user who is supposed to run \*(UA,
1726 the identity of which has been fixated during \*(UA startup and is
1727 known to be a valid user on the current host.
1730 Authentication: unless otherwise noted this will lookup the
1731 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1732 variable chain, falling back to a protocol-specific default should this
1733 have no success.
1736 If no
1737 .Ql PASSWORD
1738 has been given in the URL, then if the
1739 .Ql USER
1740 has been found through the \*(OPal
1741 .Va netrc-lookup
1742 that may have already provided the password, too.
1743 Otherwise the variable chain
1744 .Va password-USER@HOST , password-HOST , password
1745 is looked up and used if existent.
1747 Afterwards the complete \*(OPal variable chain
1748 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1749 is looked up.
1750 If set, the
1751 .Ic netrc
1752 cache is searched for a password only (multiple user accounts for
1753 a single machine may exist as well as a fallback entry without user
1754 but with a password).
1756 If at that point there is still no password available, but the
1757 (protocols') chosen authentication type requires a password, then in
1758 interactive mode the user will be prompted on the terminal.
1762 .Sy Note:
1763 S/MIME verification works relative to the values found in the
1764 .Ql From:
1766 .Ql Sender: )
1767 header field(s), which means that the values of
1768 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1770 .Va smime-sign-message-digest
1771 will not be looked up using the
1772 .Ql USER
1774 .Ql HOST
1775 chains from above but instead use the corresponding values from the
1776 message that is being worked on.
1777 In unusual cases multiple and different
1778 .Ql USER
1780 .Ql HOST
1781 combinations may therefore be involved \(en on the other hand those
1782 unusual cases become possible.
1783 The usual case is as short as:
1786 .Dl set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1787 .Dl \ \ \ \ smime-sign smime-sign-cert=+smime.pair
1790 The section
1791 .Sx EXAMPLES
1792 contains complete example configurations.
1793 .\" }}}
1795 .\" .Ss "Character sets" {{{
1796 .Ss "Character sets"
1798 \*(OP \*(UA detects the character set of the terminal by using
1799 mechanisms that are controlled by the
1800 .Ev LC_CTYPE
1801 environment variable
1802 (in fact
1803 .Ev LC_ALL ,
1804 .Ev \&\&LC_CTYPE ,
1805 .Ev LANG ,
1806 in that order, see there).
1807 The internal variable
1808 .Va ttycharset
1809 will be set to the detected terminal character set accordingly,
1810 and will thus show up in the output of commands like, e.g.,
1811 .Ic set
1813 .Ic varshow .
1816 However, the user may give a value for
1817 .Va ttycharset
1818 during startup, so that it is possible to send mail in a completely
1819 .Dq faked
1820 locale environment, an option which can be used to generate and send,
1821 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
1822 .Ql LC_ALL=C
1823 environment (an example of this can be found in the section
1824 .Sx "On sending mail, and non-interactive mode" ) .
1825 Changing the value does not mean much beside that, because several
1826 aspects of the real character set are implied by the locale environment
1827 of the system, which stays unaffected by
1828 .Va ttycharset .
1831 If the \*(OPal character set conversion capabilities are not available
1832 .Pf ( Va features
1833 does not include the term
1834 .Ql +iconv ) ,
1835 then
1836 .Va ttycharset
1837 will be the only supported character set,
1838 it is simply assumed that it can be used to exchange 8-bit messages
1839 (over the wire an intermediate, configurable
1840 .Va mime-encoding
1841 may be applied),
1842 and the rest of this section does not apply;
1843 it may however still be necessary to explicitly set it if automatic
1844 detection fails, since in that case it defaults to
1845 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
1846 LATIN1 a.k.a. ISO-8859-1.
1849 \*(OP When reading messages, their text is converted into
1850 .Va ttycharset
1851 as necessary in order to display them on the users terminal.
1852 Unprintable characters and invalid byte sequences are detected
1853 and replaced by proper substitution characters.
1854 Character set mappings for source character sets can be established with
1855 the command
1856 .Ic charsetalias ,
1857 which may be handy to work around faulty character set catalogues (e.g.,
1858 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
1859 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
1860 Also see
1861 .Va charset-unknown-8bit
1862 to deal with another hairy aspect of message interpretation.
1865 When sending messages all their parts and attachments are classified.
1866 Whereas no character set conversion is performed on those parts which
1867 appear to be binary data,
1868 the character set being used must be declared within the MIME header of
1869 an outgoing text part if it contains characters that do not conform to
1870 the set of characters that are allowed by the email standards.
1871 Permissible values for character sets used in outgoing messages can be
1872 declared using the
1873 .Va sendcharsets
1874 variable, and
1875 .Va charset-8bit ,
1876 which defines a catch-all last-resort fallback character set that is
1877 implicitly appended to the list of character sets in
1878 .Va sendcharsets .
1881 When replying to a message and the variable
1882 .Va reply-in-same-charset
1883 is set, then the character set of the message being replied to
1884 is tried first (still being a subject of
1885 .Ic charsetalias ) .
1886 And it is also possible to make \*(UA work even more closely related to
1887 the current locale setting automatically by using the variable
1888 .Va sendcharsets-else-ttycharset ,
1889 please see there for more information.
1892 All the specified character sets are tried in order unless the
1893 conversion of the part or attachment succeeds.
1894 If none of the tried (8-bit) character sets is capable to represent the
1895 content of the part or attachment,
1896 then the message will not be sent and its text will optionally be
1897 .Va save Ns d
1899 .Ev DEAD .
1900 In general, if a message saying
1901 .Dq cannot convert from a to b
1902 appears, either some characters are not appropriate for the currently
1903 selected (terminal) character set,
1904 or the needed conversion is not supported by the system.
1905 In the first case, it is necessary to set an appropriate
1906 .Ev LC_CTYPE
1907 locale and/or the variable
1908 .Va ttycharset .
1911 The best results are usually achieved when \*(UA is run in a UTF-8
1912 locale on an UTF-8 capable terminal, in which case the full Unicode
1913 spectrum of characters is available.
1914 In this setup characters from various countries can be displayed,
1915 while it is still possible to use more simple character sets for sending
1916 to retain maximum compatibility with older mail clients.
1919 On the other hand the POSIX standard defines a locale-independent 7-bit
1920 .Dq portable character set
1921 that should be used when overall portability is an issue, the even more
1922 restricted subset named
1923 .Dq portable filename character set
1924 consists of A-Z, a-z, 0-9, period
1925 .Ql \&. ,
1926 underscore
1927 .Ql _
1928 and hyphen-minus
1929 .Ql - .
1930 .\" }}}
1932 .\" .Ss "Message states" {{{
1933 .Ss "Message states"
1935 \*(UA differentiates in between several different message states;
1936 the current state will be reflected in header summary displays if
1937 .Va headline
1938 is configured to do so (via the internal variable
1939 .Va attrlist ) ,
1940 and messages can also be selected and be acted upon depending on their
1941 state (see
1942 .Sx "Specifying messages" ) .
1943 When operating on the system
1944 .Va inbox ,
1945 or in any other
1946 .Mx -sx
1947 .Sx "primary system mailbox" ,
1948 special actions, like the automatic moving of messages to the
1949 .Mx -sx
1950 .Sx "secondary mailbox"
1951 .Ev MBOX ,
1952 may be applied when the mailbox is left (also implicitly via
1953 a successful exit of \*(UA, but not if the special command
1954 .Ic exit
1955 is used) \(en however, because this may be irritating to users which
1956 are used to
1957 .Dq more modern
1958 mail-user-agents, the default global
1959 .Pa \*(UR
1960 sets the internal
1961 .Va hold
1963 .Va keepsave
1964 variables in order to suppress this behaviour.
1966 .Bl -hang -width ".It Ql new"
1967 .It Ql new
1968 Message has neither been viewed nor moved to any other state.
1969 Such messages are retained even in the
1970 .Mx -sx
1971 .Sx "primary system mailbox" .
1973 .It Ql unread
1974 Message has neither been viewed nor moved to any other state, but the
1975 message was present already when the mailbox has been opened last:
1976 Such messages are retained even in the
1977 .Mx -sx
1978 .Sx "primary system mailbox" .
1980 .It Ql read
1981 The message has been processed by one of the following commands:
1982 .Ic ~f ,
1983 .Ic ~m ,
1984 .Ic ~F ,
1985 .Ic ~M ,
1986 .Ic copy ,
1987 .Ic mbox ,
1988 .Ic next ,
1989 .Ic pipe  ,
1990 .Ic Print ,
1991 .Ic print ,
1992 .Ic top ,
1993 .Ic Type ,
1994 .Ic type ,
1995 .Ic undelete .
1996 The commands
1997 .Ic dp
1999 .Ic dt
2000 will always try to automatically
2001 .Dq step
2003 .Ic type
2005 .Dq next
2006 logical message, and may thus mark multiple messages as read, the
2007 .Ic delete
2008 command will do so if  the internal variable
2009 .Va autoprint
2010 is set.
2011 Except when the
2012 .Ic exit
2013 command is used, messages that are in a
2014 .Mx -sx
2015 .Sx "primary system mailbox"
2016 and are in
2017 .Ql read
2018 state when the mailbox is left will be saved in the
2019 .Mx -sx
2020 .Sx "secondary mailbox"
2021 .Ev MBOX
2022 unless the internal variable
2023 .Va hold
2024 it set.
2026 .It Ql deleted
2027 The message has been processed by one of the following commands:
2028 .Ic delete ,
2029 .Ic dp ,
2030 .Ic dt .
2031 Only
2032 .Ic undelete
2033 can be used to access such messages.
2035 .It Ql preserved
2036 The message has been processed by a
2037 .Ic preserve
2038 command and it will be retained in its current location.
2040 .It Ql saved
2041 The message has been processed by one of the following commands:
2042 .Ic save
2044 .Ic write .
2045 Unless when the
2046 .Ic exit
2047 command is used, messages that are in a
2048 .Mx -sx
2049 .Sx "primary system mailbox"
2050 and are in
2051 .Ql saved
2052 state when the mailbox is left will be deleted; they will be saved in the
2053 .Mx -sx
2054 .Sx "secondary mailbox"
2055 .Ev MBOX
2056 when the internal variable
2057 .Va keepsave
2058 is set.
2062 In addition to these message states, flags which otherwise have no
2063 technical meaning in the mail system except allowing special ways of
2064 addressing them when
2065 .Sx "Specifying messages"
2066 can be set on messages.
2067 These flags are saved with messages and are thus persistent, and are
2068 portable between a set of widely used MUAs.
2070 .Bl -hang -width ".It Ic answered"
2071 .It Ic answered
2072 Mark messages as having been answered.
2073 .It Ic draft
2074 Mark messages as being a draft.
2075 .It Ic flag
2076 Mark messages which need special attention.
2078 .\" }}}
2080 .\" .Ss "Specifying messages" {{{
2081 .Ss "Specifying messages"
2083 Commands such as
2084 .Ic from ,
2085 .Ic type
2087 .Ic delete
2088 can be given a list of message numbers as arguments to apply to a number
2089 of messages at once.
2090 Thus
2091 .Ql delete 1 2
2092 deletes messages 1 and 2,
2093 whereas
2094 .Ql delete 1-5
2095 will delete the messages 1 through 5.
2096 In sorted or threaded mode (see the
2097 .Ic sort
2098 command),
2099 .Ql delete 1-5
2100 will delete the messages that are located between (and including)
2101 messages 1 through 5 in the sorted/threaded order, as shown in the
2102 .Ic headers
2103 summary.
2104 The following special message names exist:
2107 .Bl -tag -width ".It Ar BaNg"
2108 .It Ar \&.
2109 The current message, the so-called
2110 .Dq dot .
2112 .It Ar \&;
2113 The message that was previously the current message.
2115 .It Ar \&,
2116 The parent message of the current message,
2117 that is the message with the Message-ID given in the
2118 .Ql In-Reply-To:
2119 field or the last entry of the
2120 .Ql References:
2121 field of the current message.
2123 .It Ar -
2124 The next previous undeleted message,
2125 or the next previous deleted message for the
2126 .Ic undelete
2127 command.
2128 In sorted/threaded mode,
2129 the next previous such message in the sorted/threaded order.
2131 .It Ar +
2132 The next undeleted message,
2133 or the next deleted message for the
2134 .Ic undelete
2135 command.
2136 In sorted/threaded mode,
2137 the next such message in the sorted/threaded order.
2139 .It Ar ^
2140 The first undeleted message,
2141 or the first deleted message for the
2142 .Ic undelete
2143 command.
2144 In sorted/threaded mode,
2145 the first such message in the sorted/threaded order.
2147 .It Ar $
2148 The last message.
2149 In sorted/threaded mode,
2150 the last message in the sorted/threaded order.
2152 .It Ar & Ns Ar x
2153 In threaded mode,
2154 selects the message addressed with
2155 .Ar x ,
2156 where
2157 .Ar x
2158 is any other message specification,
2159 and all messages from the thread that begins at it.
2160 Otherwise it is identical to
2161 .Ar x .
2163 .Ar x
2164 is omitted,
2165 the thread beginning with the current message is selected.
2167 .It Ar *
2168 All messages.
2169 .It Ar `
2170 All messages that were included in the
2171 .Sx "Message list arguments"
2172 of the previous command.
2174 .It Ar x-y
2175 An inclusive range of message numbers.
2176 Selectors that may also be used as endpoints include any of
2177 .Ar .;-+^$ .
2179 .It Ar address
2180 A case-insensitive
2181 .Dq any substring matches
2182 search against the
2183 .Ql From:
2184 header, which will match addresses (too) even if
2185 .Va showname
2186 is set (and POSIX says
2187 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2188 However, if the
2189 .Va allnet
2190 variable is set, only the local part of the address is evaluated
2191 for the comparison, not ignoring case, and the setting of
2192 .Va showname
2193 is completely ignored.
2194 For finer control and match boundaries use the
2195 .Ql @
2196 search expression.
2198 .It Ar / Ns Ar string
2199 All messages that contain
2200 .Ar string
2201 in the subject field (case ignored).
2202 See also the
2203 .Va searchheaders
2204 variable.
2206 .Ar string
2207 is empty,
2208 the string from the previous specification of that type is used again.
2210 .It Xo Op Ar @ Ns Ar name-list Ns
2211 .Ar @ Ns Ar expr
2213 All messages that contain the given case-insensitive search
2214 .Ar expr Ns
2215 ession; if the \*(OPal regular expression (see
2216 .Xr re_format 7 )
2217 support is available
2218 .Ar expr
2219 will be interpreted as (an extended) one if any of the
2220 .Dq magical
2221 (extended) regular expression characters is seen: in this case this
2222 should match strings correctly which are in the locale
2223 .Ev LC_CTYPE
2224 encoding.
2225 If the optional
2226 .Ar @ Ns Ar name-list
2227 part is missing, the search is restricted to the subject field body,
2228 but otherwise
2229 .Ar name-list
2230 specifies a comma-separated list of header fields to search, as in
2232 .Dl '@to,from,cc@Someone i ought to know'
2234 In order to search for a string that includes a
2235 .Ql @
2236 (commercial at) character the
2237 .Ar name-list
2238 is effectively non-optional, but may be given as the empty string.
2239 Some special header fields may be abbreviated:
2240 .Ql f ,
2241 .Ql t ,
2242 .Ql c ,
2243 .Ql b
2245 .Ql s
2246 will match
2247 .Ql From ,
2248 .Ql To ,
2249 .Ql Cc ,
2250 .Ql Bcc
2252 .Ql Subject ,
2253 respectively and case-insensitively.
2254 The special names
2255 .Ql header
2257 .Ql <
2258 can be used to search in (all of) the header(s) of the message, and the
2259 special names
2260 .Ql body
2262 .Ql >
2264 .Ql text
2266 .Ql =
2267 can be used to perform full text searches \(en whereas the former
2268 searches only the body, the latter also searches the message header.
2270 This message specification performs full text comparison, but even with
2271 regular expression support it is almost impossible to write a search
2272 expression that savely matches only a specific address domain.
2273 To request that the content of the header is treated as a list of
2274 addresses, and to strip those down to the plain email address which the
2275 search expression is to be matched against, prefix the header name
2276 (abbreviation) with a tilde
2277 .Ql ~ :
2279 .Dl @~f@@a\e.safe\e.domain\e.match$
2281 .It Ar :c
2282 All messages of state
2283 .Ql c ,
2284 where
2285 .Ql c
2286 is one or multiple of the following colon modifiers:
2288 .Bl -tag -compact -width ".It Ar :M"
2289 .It Ar n
2290 .Ql new
2291 messages.
2292 .It Ar o
2293 Old messages (any not in state
2294 .Ql read
2296 .Ql new ) .
2297 .It Ar u
2298 .Ql unread
2299 messages.
2300 .It Ar d
2301 .Ql deleted
2302 messages (for the
2303 .Ic undelete
2305 .Ic from
2306 commands only).
2307 .It Ar r
2308 .Ql read
2309 messages.
2310 .It Ar f
2311 .Ic flag Ns
2312 ged messages.
2313 .It Ar a
2314 .Ic answered
2315 messages (cf. the variable
2316 .Va markanswered ) .
2317 .It Ar t
2318 Messages marked as
2319 .Ic draft .
2320 .It Ar s
2321 \*(OP Messages classified as spam (see
2322 .Sx "Handling spam" . )
2323 .It Ar S
2324 \*(OP Messages with unsure spam classification.
2330 \*(OP IMAP-style SEARCH expressions may also be used.
2331 This addressing mode is available with all types of mailbox
2332 .Ic folder Ns
2333 s; \*(UA will perform the search locally as necessary.
2334 Strings must be enclosed by double quotes
2335 .Ql \&"
2336 in their entirety if they contain whitespace or parentheses;
2337 within the quotes, only reverse solidus
2338 .Ql \e
2339 is recognized as an escape character.
2340 All string searches are case-insensitive.
2341 When the description indicates that the
2342 .Dq envelope
2343 representation of an address field is used,
2344 this means that the search string is checked against both a list
2345 constructed as
2347 .Bd -literal -offset indent
2348 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2352 for each address,
2353 and the addresses without real names from the respective header field.
2354 These search expressions can be nested using parentheses, see below for
2355 examples.
2358 .Bl -tag -compact -width ".It Ar _n_u"
2359 .It Ar ( criterion )
2360 All messages that satisfy the given
2361 .Ar criterion .
2362 .It Ar ( criterion1 criterion2 ... criterionN )
2363 All messages that satisfy all of the given criteria.
2365 .It Ar ( or criterion1 criterion2 )
2366 All messages that satisfy either
2367 .Ar criterion1
2369 .Ar criterion2 ,
2370 or both.
2371 To connect more than two criteria using
2372 .Ql or
2373 specifications have to be nested using additional parentheses,
2374 as with
2375 .Ql (or a (or b c)) ,
2376 since
2377 .Ql (or a b c)
2378 really means
2379 .Ql ((a or b) and c) .
2380 For a simple
2381 .Ql or
2382 operation of independent criteria on the lowest nesting level,
2383 it is possible to achieve similar effects by using three separate
2384 criteria, as with
2385 .Ql (a) (b) (c) .
2387 .It Ar ( not criterion )
2388 All messages that do not satisfy
2389 .Ar criterion .
2390 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2391 All messages that contain
2392 .Ar string
2393 in the envelope representation of the
2394 .Ql Bcc:
2395 field.
2396 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2397 All messages that contain
2398 .Ar string
2399 in the envelope representation of the
2400 .Ql Cc:
2401 field.
2402 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2403 All messages that contain
2404 .Ar string
2405 in the envelope representation of the
2406 .Ql From:
2407 field.
2408 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2409 All messages that contain
2410 .Ar string
2411 in the
2412 .Ql Subject:
2413 field.
2414 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2415 All messages that contain
2416 .Ar string
2417 in the envelope representation of the
2418 .Ql To:
2419 field.
2420 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2421 All messages that contain
2422 .Ar string
2423 in the specified
2424 .Ql Name:
2425 field.
2426 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2427 All messages that contain
2428 .Ar string
2429 in their body.
2430 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2431 All messages that contain
2432 .Ar string
2433 in their header or body.
2434 .It Ar ( larger size )
2435 All messages that are larger than
2436 .Ar size
2437 (in bytes).
2438 .It Ar ( smaller size )
2439 All messages that are smaller than
2440 .Ar size
2441 (in bytes).
2443 .It Ar ( before date )
2444 All messages that were received before
2445 .Ar date ,
2446 which must be in the form
2447 .Ql d[d]-mon-yyyy ,
2448 where
2449 .Ql d
2450 denotes the day of the month as one or two digits,
2451 .Ql mon
2452 is the name of the month \(en one of
2453 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2455 .Ql yyyy
2456 is the year as four digits, e.g.,
2457 .Ql 28-Dec-2012 .
2459 .It Ar ( on date )
2460 All messages that were received on the specified date.
2461 .It Ar ( since date )
2462 All messages that were received since the specified date.
2463 .It Ar ( sentbefore date )
2464 All messages that were sent on the specified date.
2465 .It Ar ( senton date )
2466 All messages that were sent on the specified date.
2467 .It Ar ( sentsince date )
2468 All messages that were sent since the specified date.
2469 .It Ar ()
2470 The same criterion as for the previous search.
2471 This specification cannot be used as part of another criterion.
2472 If the previous command line contained more than one independent
2473 criterion then the last of those criteria is used.
2475 .\" }}}
2477 .\" .Ss "On terminal control and line editor" {{{
2478 .Ss "On terminal control and line editor"
2480 \*(OP Terminal control will be realized through one of the standard
2482 libraries, either the
2483 .Lb libtermcap ,
2484 or, alternatively, the
2485 .Lb libterminfo ,
2486 both of which will be initialized to work with the environment variable
2487 .Ev TERM .
2488 Terminal control will enhance or enable interactive usage aspects, e.g.,
2489 .Sx "Coloured display" ,
2490 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2491 byte-sequences of keys like the cursor and function keys.
2494 The internal variable
2495 .Va termcap
2496 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2497 \*(UA may also become a fullscreen application by entering the
2498 so-called ca-mode and switching to an alternative exclusive screen
2499 (content) shall the terminal support it and the internal variable
2500 .Va termcap-ca-mode
2501 has been set explicitly.
2502 Actual interaction with the chosen library can be disabled completely by
2503 setting the internal variable
2504 .Va termcap-disable ;
2505 .Va termcap
2506 will be queried regardless, which is true even if the \*(OPal library
2507 support has not been enabled at configuration time as long as some other
2508 \*(OP which (may) query terminal control sequences has been enabled.
2511 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2512 environments which comply to the ISO C standard
2513 .St -isoC-amd1 ,
2514 and will support wide glyphs if possible (the necessary functionality
2515 had been removed from ISO C, but was included in
2516 .St -xpg4 ) .
2517 Prevent usage of a line editor in interactive mode by setting the
2518 internal variable
2519 .Va line-editor-disable .
2520 Especially if the \*(OPal terminal control support is missing setting
2521 entries in the internal variable
2522 .Va termcap
2523 will help shall the MLE misbehave, see there for more.
2524 The MLE can support a little bit of
2525 .Ic colour .
2528 \*(OP If the
2529 .Ic history
2530 feature is available then input from line editor prompts will be saved
2531 in a history list that can be searched in and be expanded from.
2532 Such saving can be prevented by prefixing input with any amount of
2533 whitespace.
2534 Aspects of history, like allowed content and maximum size, as well as
2535 whether history shall be saved persistently, can be configured with the
2536 internal variables
2537 .Va history-file ,
2538 .Va history-gabby ,
2539 .Va history-gabby-persist
2541 .Va history-size .
2544 The MLE supports a set of editing and control commands.
2545 By default (as) many (as possible) of these will be assigned to a set of
2546 single-letter control codes, which should work on any terminal (and can
2547 be generated by holding the
2548 .Dq control
2549 key while pressing the key of desire, e.g.,
2550 .Ql control-D ) .
2551 If the \*(OPal
2552 .Ic bind
2553 command is available then the MLE commands can also be accessed freely
2554 by assigning the command name, which is shown in parenthesis in the list
2555 below, to any desired key-sequence, and the MLE will instead and also use
2556 .Ic bind
2557 to establish its built-in key bindings
2558 (more of them if the \*(OPal terminal control is available),
2559 an action which can then be suppressed completely by setting
2560 .Va line-editor-no-defaults .
2561 .Sx "Shell-style argument quoting"
2562 notation is used in the following;
2563 combinations not mentioned either cause job control signals or do not
2564 generate a (unique) keycode:
2568 .Bl -tag -compact -width ".It Ql \eBa"
2569 .It Ql \ecA
2570 Go to the start of the line
2572 .Pf ( Cd mle-go-home ) .
2574 .It Ql \ecB
2575 Move the cursor backward one character
2577 .Pf ( Cd mle-go-bwd ) .
2579 .It Ql \ecD
2580 Forward delete the character under the cursor;
2581 quits \*(UA if used on the empty line unless the internal variable
2582 .Va ignoreeof
2583 is set
2585 .Pf ( Cd mle-del-fwd ) .
2587 .It Ql \ecE
2588 Go to the end of the line
2590 .Pf ( Cd mle-go-end ) .
2592 .It Ql \ecF
2593 Move the cursor forward one character
2595 .Pf ( Cd mle-go-fwd ) .
2597 .It Ql \ecG
2598 Cancel current operation, full reset.
2599 If there is an active history search or tabulator expansion then this
2600 command will first reset that, reverting to the former line content;
2601 thus a second reset is needed for a full reset in this case
2603 .Pf ( Cd mle-reset ) .
2605 .It Ql \ecH
2606 Backspace: backward delete one character
2608 .Pf ( Cd mle-del-bwd ) .
2610 .It Ql \ecI
2611 \*(NQ
2612 Horizontal tabulator:
2613 try to expand the word before the cursor, supporting the usual
2614 .Sx "Filename transformations"
2616 .Pf ( Cd mle-complete ) .
2617 This is affected by
2618 .Cd mle-quote-rndtrip .
2620 .It Ql \ecJ
2621 Newline:
2622 commit the current line
2624 .Pf ( Cd mle-commit ) .
2626 .It Ql \ecK
2627 Cut all characters from the cursor to the end of the line
2629 .Pf ( Cd mle-snarf-end ) .
2631 .It Ql \ecL
2632 Repaint the line
2634 .Pf ( Cd mle-repaint ) .
2636 .It Ql \ecN
2637 \*(OP Go to the next history entry
2639 .Pf ( Cd mle-hist-fwd ) .
2641 .It Ql \ecO
2642 (\*(OPally context-dependent) Invokes the command
2643 .Ic dt .
2645 .It Ql \ecP
2646 \*(OP Go to the previous history entry
2648 .Pf ( Cd mle-hist-bwd ) .
2650 .It Ql \ecQ
2651 Toggle roundtrip mode shell quotes, where produced,
2652 on and off
2654 .Pf ( Cd mle-quote-rndtrip ) .
2655 This setting is temporary, and will be forgotten once the command line
2656 is committed; also see
2657 .Ic shcodec .
2659 .It Ql \ecR
2660 \*(OP Complete the current line from (the remaining) older history entries
2662 .Pf ( Cd mle-hist-srch-bwd ) .
2664 .It Ql \ecS
2665 \*(OP Complete the current line from (the remaining) newer history entries
2667 .Pf ( Cd mle-hist-srch-fwd ) .
2669 .It Ql \ecT
2670 Paste the snarf buffer
2672 .Pf ( Cd mle-paste ) .
2674 .It Ql \ecU
2675 The same as
2676 .Ql \ecA
2677 followed by
2678 .Ql \ecK
2680 .Pf ( Cd mle-snarf-line ) .
2682 .It Ql \ecV
2683 Prompts for a Unicode character (its hexadecimal number) to be inserted
2685 .Pf ( Cd mle-prompt-char ) .
2686 Note this command needs to be assigned to a single-letter control code
2687 in order to become recognized and executed during input of
2688 a key-sequence (only three single-letter control codes can be used for
2689 that shortcut purpose); this control code is special-treated and cannot
2690 be part of any other sequence, because any occurrence will perform the
2691 .Cd mle-prompt-char
2692 function immediately.
2694 .It Ql \ecW
2695 Cut the characters from the one preceding the cursor to the preceding
2696 word boundary
2698 .Pf ( Cd mle-snarf-word-bwd ) .
2700 .It Ql \ecX
2701 Move the cursor forward one word boundary
2703 .Pf ( Cd mle-go-word-fwd ) .
2705 .It Ql \ecY
2706 Move the cursor backward one word boundary
2708 .Pf ( Cd mle-go-word-bwd ) .
2710 .It Ql \ec[
2711 Escape: reset a possibly used multibyte character input state machine
2712 and \*(OPally a lingering, incomplete key binding
2714 .Pf ( Cd mle-cancel ) .
2715 This command needs to be assigned to a single-letter control code in
2716 order to become recognized and executed during input of a key-sequence
2717 (only three single-letter control codes can be used for that shortcut
2718 purpose).
2719 This control code may also be part of a multi-byte sequence, but if
2720 a sequence is active and the very control code is currently also an
2721 expected input, then it will first be consumed by the active sequence.
2723 .It Ql \ec\e
2724 (\*(OPally context-dependent) Invokes the command
2725 .Ql Ic z Ns + .
2727 .It Ql \ec]
2728 (\*(OPally context-dependent) Invokes the command
2729 .Ql Ic z Ns $ .
2731 .It Ql \ec^
2732 (\*(OPally context-dependent) Invokes the command
2733 .Ql Ic z Ns 0 .
2735 .It Ql \ec_
2736 Cut the characters from the one after the cursor to the succeeding word
2737 boundary
2739 .Pf ( Cd mle-snarf-word-fwd ) .
2741 .It Ql \ec?
2742 Backspace:
2743 .Cd mle-del-bwd .
2745 .It \(en
2747 .Cd mle-fullreset :
2748 different to
2749 .Cd mle-reset
2750 this will immediately reset a possibly active search etc.
2752 .It \(en
2754 .Cd mle-bell :
2755 ring the audible bell.
2757 .\" }}}
2759 .\" .Ss "Coloured display" {{{
2760 .Ss "Coloured display"
2762 \*(OP \*(UA can be configured to support a coloured display and font
2763 attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic
2764 rendition) escape sequences.
2765 Usage of colours and font attributes solely depends upon the
2766 capability of the detected terminal type that is defined by the
2767 environment variable
2768 .Ev TERM
2769 and which can be fine-tuned by the user via the internal variable
2770 .Va termcap .
2773 On top of what \*(UA knows about the terminal the boolean variable
2774 .Va colour-pager
2775 defines whether the actually applicable colour and font attribute
2776 sequences should also be generated when output is going to be paged
2777 through the external program defined by the environment variable
2778 .Ev PAGER
2779 (also see
2780 .Va crt Ns
2782 This is not enabled by default because different pager programs need
2783 different command line switches or other configuration in order to
2784 support those sequences.
2785 \*(UA however knows about some widely used pagers and in a clean
2786 environment it is often enough to simply set
2787 .Va colour-pager ;
2788 please refer to that variable for more on this topic.
2791 If the variable
2792 .Va colour-disable
2793 is set then any active usage of colour and font attribute sequences
2794 is suppressed, but without affecting possibly established
2795 .Ic colour
2796 mappings.
2799 To define and control colours and font attributes a single multiplexer
2800 command family exists:
2801 .Ic colour
2802 shows or defines colour mappings for the given colour type (e.g.,
2803 monochrome) and
2804 .Ic uncolour
2805 can be used to remove mappings of a given colour type.
2806 Since colours are only available in interactive mode, it may make
2807 sense to conditionalize the colour setup by encapsulating it with
2808 .Ic if :
2810 .Bd -literal -offset indent
2811 if terminal && [ "$features" =% +colour ]
2812   colour iso view-msginfo ft=bold,fg=green
2813   colour iso view-header ft=bold,fg=red from,subject
2814   colour iso view-header fg=red
2816   uncolour iso view-header from,subject
2817   colour iso view-header ft=bold,fg=magenta,bg=cyan
2818   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
2819   colour mono view-header ft=bold
2820   colour mono view-header ft=bold,ft=reverse subject,from
2821 endif
2823 .\" }}}
2825 .\" .Ss "Handling spam" {{{
2826 .Ss "Handling spam"
2828 \*(OP \*(UA can make use of several spam interfaces for the purpose of
2829 identification of, and, in general, dealing with spam messages.
2830 A precondition of most commands in order to function is that the
2831 .Va spam-interface
2832 variable is set to one of the supported interfaces.
2833 Once messages have been identified as spam their (volatile)
2834 .Ql is-spam
2835 state can be prompted: the
2836 .Ql Ar :s
2838 .Ql Ar :S
2839 message specifications will address respective messages and their
2840 .Va attrlist
2841 entries will be used when displaying the
2842 .Va headline
2843 in the header display.
2845 .Bl -bullet
2847 .Ic spamrate
2848 rates the given messages and sets their
2849 .Ql is-spam
2850 flag accordingly.
2851 If the spam interface offers spam scores those can also be displayed in
2852 the header display by including the
2853 .Ql %$
2854 format in the
2855 .Va headline
2856 variable.
2858 .Ic spamham ,
2859 .Ic spamspam
2861 .Ic spamforget
2862 will interact with the Bayesian filter of the chosen interface and learn
2863 the given messages as
2864 .Dq ham
2866 .Dq spam ,
2867 respectively; the last command can be used to cause
2868 .Dq unlearning
2869 of messages; it adheres to their current
2870 .Ql is-spam
2871 state and thus reverts previous teachings.
2873 .Ic spamclear
2875 .Ic spamset
2876 will simply set and clear, respectively, the mentioned volatile
2877 .Ql is-spam
2878 message flag, without any interface interaction.
2883 .Xr spamassassin 1
2884 based
2885 .Va spam-interface
2886 .Ql spamc
2887 requires a running instance of the
2888 .Xr spamd 1
2889 server in order to function, started with the option
2890 .Fl -allow-tell
2891 shall Bayesian filter learning be possible.
2893 .Bd -literal -offset indent
2894 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
2895 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
2896     --daemonize [--local] [--allow-tell]
2900 Thereafter \*(UA can make use of these interfaces:
2902 .Bd -literal -offset indent
2903 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
2904     -Sspamc-command=/usr/local/bin/spamc \e
2905     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
2907 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
2908     -Sspamc-command=/usr/local/bin/spamc \e
2909     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
2913 Using the generic filter approach allows usage of programs like
2914 .Xr bogofilter 1 .
2915 Here is an example, requiring it to be accessible via
2916 .Ev PATH :
2918 .Bd -literal -offset indent
2919 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
2920     -Sspamfilter-ham="bogofilter -n" \e
2921     -Sspamfilter-noham="bogofilter -N" \e
2922     -Sspamfilter-nospam="bogofilter -S" \e
2923     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
2924     -Sspamfilter-spam="bogofilter -s" \e
2925     -Sspamfilter-rate-scanscore="1;^(.+)$"
2929 Because messages must exist on local storage in order to be scored (or
2930 used for Bayesian filter training), it is possibly a good idea to
2931 perform the local spam check last:
2933 .Bd -literal -offset indent
2934 define spamdelhook {
2935   # Server side DCC
2936   spamset (header x-dcc-brand-metrics "bulk")
2937   # Server-side spamassassin(1)
2938   spamset (header x-spam-flag "YES")
2939   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
2940   move :S +maybe-spam
2941   spamrate :u
2942   del :s
2943   move :S +maybe-spam
2945 set folder-hook-FOLDER=spamdelhook
2949 See also the documentation for the variables
2950 .Va spam-interface , spam-maxsize ,
2951 .Va spamc-command , spamc-arguments , spamc-user ,
2952 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
2953   spamfilter-rate
2955 .Va spamfilter-rate-scanscore .
2956 .\" }}}
2958 .\" }}} (DESCRIPTION)
2961 .\" .Sh COMMANDS {{{
2962 .Sh COMMANDS
2964 Each command is typed on a line by itself,
2965 and may take arguments following the command word.
2966 An unquoted reverse solidus
2967 .Ql \e
2968 at the end of a command line
2969 .Dq escapes
2970 the newline character: it is discarded and the next line of input is
2971 used as a follow-up line, with all leading whitespace removed;
2972 once the entire command line is completed, and after removal of the
2973 whitespace characters
2974 .Cm space , tabulator , newline
2975 as well as those defined by the variable
2976 .Va ifs
2977 from the beginning and end of the line, the processing documented in the
2978 following begins.
2979 Placing any whitespace characters at the beginning of a line will
2980 prevent a possible addition of the command line to the \*(OPal
2981 .Ic history .
2984 Apart from this generic cleanup mechanism \*(UA uses command-specific
2985 syntax rules for command line arguments, documented in the following.
2986 This is a completely different approach to the
2987 .Xr sh 1 Ns
2988 ell, which implements a standardized (programming) language, and
2989 performs several successive transformation steps after decomposing the
2990 given command line into tokens adhering standardized syntax guidelines.
2991 This sometimes has side-effects for shell-style arguments, for example
2992 .Ql \(dq$@\(dq
2993 without positional parameters is not collapsed to nothing, as can be
2994 seen in the example shown for the command
2995 .Ic call .
2998 Command names may be abbreviated, in which case the first command that
2999 matches the given prefix will be used.
3000 The command
3001 .Ic list
3002 can be used to show the list of all commands, either alphabetically
3003 sorted or in prefix search order (these do not match, also because the
3004 POSIX standard prescribes a set of abbreviations).
3005 \*(OPally the command
3006 .Ic help
3008 .Ic \&? ) ,
3009 when given an argument, will show a documentation string for the
3010 command matching the expanded argument, as in
3011 .Ql ?t ,
3012 which should be a shorthand of
3013 .Ql ?type ;
3014 with these documentation strings both commands support a more
3015 .Va verbose
3016 listing mode which includes the argument type of the command and other
3017 information which applies; a handy suggestion might thus be:
3019 .Bd -literal -offset indent
3020 ? define __xv {
3021   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3022   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
3024 ? commandalias xv '\ecall __xv'
3025 ? xv help set
3028 .\" .Ss "Command modifiers" {{{
3029 .Ss "Command modifiers"
3031 Commands may be prefixed by one or multiple command modifiers.
3033 .Bl -bullet
3035 The modifier reverse solidus
3037 .Cm \e ,
3038 to be placed first, prevents
3039 .Ic commandalias
3040 expansions on the remains of the line, e.g.,
3041 .Ql \eecho
3042 will always evaluate the command
3043 .Ic echo ,
3044 even if an (command)alias of the same name exists.
3045 .Ic commandalias
3046 content may itself contain further command modifiers, including
3047 an initial reverse solidus to prevent further expansions.
3050 The modifier
3052 .Cm ignerr
3053 indicates that any error generated by the following command should be
3054 ignored by the state machine and not cause a program exit with enabled
3055 .Va errexit
3056 or for the standardized exit cases in
3057 .Ev POSIXLY_CORRECT
3058 mode.
3059 .Va \&? ,
3060 one of the
3061 .Sx "INTERNAL VARIABLES" ,
3062 will be set to the real exit status of the command regardless.
3065 Some commands support the
3067 .Cm vput
3068 modifier: if used, they expect the name of a variable, which can itself
3069 be a variable, i.e., shell expansion is applied, as their first
3070 argument, and will place their computation result in it instead of the
3071 default location (it is usually written to standard output).
3073 The given name will be tested for being a valid
3074 .Xr sh 1
3075 variable name, and may therefore only consist of upper- and lowercase
3076 characters, digits, and the underscore; the hyphen-minus may be used as
3077 a non-portable extension; digits may not be used as first, hyphen-minus
3078 may not be used as last characters.
3079 In addition the name may either not be one of the known
3080 .Sx "INTERNAL VARIABLES" ,
3081 or must otherwise refer to a writable (non-boolean) value variable.
3082 The actual put operation may fail nonetheless, e.g., if the variable
3083 expects a number argument only a number will be accepted.
3084 Any error during these operations causes the command as such to fail,
3085 and the error number
3086 .Va \&!
3087 will be set to
3088 .Va ^ERR Ns -NOTSUP ,
3089 the exit status
3090 .Va \&?
3091 should be set to
3092 .Ql -1 .
3095 Last, but not least, the modifier
3097 .Cm wysh
3098 can be used for some old and established commands to choose the new
3099 .Sx "Shell-style argument quoting"
3100 rules over the traditional
3101 .Sx "Old-style argument quoting" .
3103 .\" }}}
3105 .\" .Ss "Message list arguments" {{{
3106 .Ss "Message list arguments"
3108 Some commands expect arguments that represent messages (actually
3109 their symbolic message numbers), as has been documented above under
3110 .Sx "Specifying messages"
3111 already.
3112 If no explicit message list has been specified, the next message
3113 forward that satisfies the command's requirements will be used,
3114 and if there are no messages forward of the current message,
3115 the search proceeds backwards;
3116 if there are no good messages at all to be found, an error message is
3117 shown and the command is aborted.
3118 .\" }}}
3120 .\" .Ss "Old-style argument quoting" {{{
3121 .Ss "Old-style argument quoting"
3123 \*(ID This section documents the old, traditional style of quoting
3124 non-message-list arguments to commands which expect this type of
3125 arguments: whereas still used by the majority of such commands, the new
3126 .Sx "Shell-style argument quoting"
3127 may be available even for those via
3128 .Cm wysh ,
3129 one of the
3130 .Sx "Command modifiers" .
3131 Nonetheless care must be taken, because only new commands have been
3132 designed with all the capabilities of the new quoting rules in mind,
3133 which can, e.g., generate control characters.
3136 .Bl -bullet -offset indent
3138 An argument can be enclosed between paired double-quotes
3139 .Ql """argument"""
3141 single-quotes
3142 .Ql 'argument' ;
3143 any whitespace, shell word expansion, or reverse solidus characters
3144 (except as described next) within the quotes are treated literally as
3145 part of the argument.
3146 A double-quote will be treated literally within single-quotes and vice
3147 versa.
3148 Inside such a quoted string the actually used quote character can be
3149 used nonetheless by escaping it with a reverse solidus
3150 .Ql \e ,
3151 as in
3152 .Ql """y\e""ou""" .
3155 An argument that is not enclosed in quotes, as above, can usually still
3156 contain space characters if those spaces are reverse solidus escaped, as in
3157 .Ql you\e are .
3160 A reverse solidus outside of the enclosing quotes is discarded
3161 and the following character is treated literally as part of the argument.
3163 .\" }}}
3165 .\" .Ss "Shell-style argument quoting" {{{
3166 .Ss "Shell-style argument quoting"
3168 Commands which don't expect message-list arguments use
3169 .Xr sh 1 Ns
3170 ell-style, and therefore POSIX standardized, argument parsing and
3171 quoting rules.
3172 \*(ID Most new commands only support these new rules and are flagged
3173 \*(NQ, some elder ones can use them with the command modifier
3174 .Cm wysh ;
3175 in the future only this type of argument quoting will remain.
3178 A command line is parsed from left to right and an input token is
3179 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3180 Metacharacters are vertical bar
3181 .Cm \&| ,
3182 ampersand
3183 .Cm & ,
3184 semicolon
3185 .Cm \&; ,
3186 as well as all characters from the variable
3187 .Va ifs ,
3188 and / or
3189 .Cm space , tabulator , newline .
3190 The additional metacharacters left and right parenthesis
3191 .Cm \&( , \&)
3192 and less-than and greater-than signs
3193 .Cm < , >
3194 that the
3195 .Xr sh 1
3196 supports are not used, and are treated as ordinary characters: for one
3197 these characters are a vivid part of email addresses, and it seems
3198 highly unlikely that their function will become meaningful to \*(UA.
3200 .Bd -filled -offset indent
3201 .Sy Compatibility note:
3202 \*(ID Please note that even many new-style commands do not yet honour
3203 .Va ifs
3204 to parse their arguments: whereas the
3205 .Xr sh 1 Ns
3206 ell is a language with syntactic elements of clearly defined semantics,
3207 \*(UA parses entire input lines and decides on a per-command base what
3208 to do with the rest of the line.
3209 This also means that whenever an unknown command is seen all that \*(UA
3210 can do is cancellation of the processing of the remains of the line.
3212 It also often depends on an actual subcommand of a multiplexer command
3213 how the rest of the line should be treated, and until v15 we are not
3214 capable to perform this deep inspection of arguments.
3215 Nonetheless, at least the following commands which work with positional
3216 parameters fully support
3217 .Va ifs
3218 for an almost shell-compatible field splitting:
3219 .Ic call , call_if , read , vpospar , xcall .
3223 Any unquoted number sign
3224 .Ql #
3225 at the beginning of a new token starts a comment that extends to the end
3226 of the line, and therefore ends argument processing.
3227 An unquoted dollar sign
3228 .Ql $
3229 will cause variable expansion of the given name, which must be a valid
3230 .Xr sh 1 Ns
3231 ell-style variable name (see
3232 .Cm vput ) :
3233 .Sx "INTERNAL VARIABLES"
3234 as well as
3235 .Sx ENVIRONMENT
3236 (shell) variables can be accessed through this mechanism, brace
3237 enclosing the name is supported (i.e., to subdivide a token).
3240 Whereas the metacharacters
3241 .Cm space , tabulator , newline
3242 only complete an input token, vertical bar
3243 .Cm \&| ,
3244 ampersand
3245 .Cm &
3246 and semicolon
3247 .Cm \&;
3248 also act as control operators and perform control functions.
3249 For now supported is semicolon
3250 .Cm \&; ,
3251 which terminates a single command, therefore sequencing the command line
3252 and making the remainder of the line a subject to reevaluation.
3253 With sequencing, multiple command argument types and quoting rules may
3254 therefore apply to a single line, which can become problematic before
3255 v15: e.g., the first of the following will cause surprising results.
3258 .Dl ? echo one; set verbose; echo verbose=$verbose.
3259 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3262 Quoting is a mechanism that will remove the special meaning of
3263 metacharacters and reserved words, and will prevent expansion.
3264 There are four quoting mechanisms: the escape character, single-quotes,
3265 double-quotes and dollar-single-quotes:
3268 .Bl -bullet -offset indent
3270 The literal value of any character can be preserved by preceding it
3271 with the escape character reverse solidus
3272 .Ql \e .
3275 Arguments which are enclosed in
3276 .Ql 'single-\:quotes'
3277 retain their literal value.
3278 A single-quote cannot occur within single-quotes.
3281 The literal value of all characters enclosed in
3282 .Ql \(dqdouble-\:quotes\(dq
3283 is retained, with the exception of dollar sign
3284 .Ql $ ,
3285 which will cause variable expansion, as above, backquote (grave accent)
3286 .Ql ` ,
3287 (which not yet means anything special), reverse solidus
3288 .Ql \e ,
3289 which will escape any of the characters dollar sign
3290 .Ql $
3291 (to prevent variable expansion), backquote (grave accent)
3292 .Ql ` ,
3293 double-quote
3294 .Ql \(dq
3295 (to prevent ending the quote) and reverse solidus
3296 .Ql \e
3297 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3298 but has no special meaning otherwise.
3301 Arguments enclosed in
3302 .Ql $'dollar-\:single-\:quotes'
3303 extend normal single quotes in that reverse solidus escape sequences are
3304 expanded as follows:
3306 .Bl -tag -compact -width "Ql \eNNN"
3307 .It Ql \ea
3308 bell control character (ASCII and ISO-10646 BEL).
3309 .It Ql \eb
3310 backspace control characer (ASCII and ISO-10646 BS).
3311 .It Ql \eE
3312 escape control character (ASCII and ISO-10646 ESC).
3313 .It Ql \ee
3314 the same.
3315 .It Ql \ef
3316 form feed control character (ASCII and ISO-10646 FF).
3317 .It Ql \en
3318 line feed control character (ASCII and ISO-10646 LF).
3319 .It Ql \er
3320 carriage return control character (ASCII and ISO-10646 CR).
3321 .It Ql \et
3322 horizontal tabulator control character (ASCII and ISO-10646 HT).
3323 .It Ql \ev
3324 vertical tabulator control character (ASCII and ISO-10646 VT).
3325 .It Ql \e\e
3326 emits a reverse solidus character.
3327 .It Ql \e'
3328 single quote.
3329 .It Ql \e"
3330 double quote (escaping is optional).
3331 .It Ql \eNNN
3332 eight-bit byte with the octal value
3333 .Ql NNN
3334 (one to three octal digits), optionally prefixed by an additional
3335 .Ql 0 .
3336 A 0 byte will suppress further output for the quoted argument.
3337 .It Ql \exHH
3338 eight-bit byte with the hexadecimal value
3339 .Ql HH
3340 (one or two hexadecimal characters).
3341 A 0 byte will suppress further output for the quoted argument.
3342 .It Ql \eUHHHHHHHH
3343 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3344 .Ql HHHHHHHH
3345 (one to eight hexadecimal digits) \(em note that Unicode defines the
3346 maximum codepoint ever to be supported as
3347 .Ql 0x10FFFF
3348 (in planes of
3349 .Ql 0xFFFF
3350 characters each).
3351 This escape is only supported in locales that support Unicode (see
3352 .Sx "Character sets" ) ,
3353 in other cases the sequence will remain unexpanded unless the given code
3354 point is ASCII compatible or (if the \*(OPal character set conversion is
3355 available) can be represented in the current locale.
3356 The character NUL will suppress further output for the quoted argument.
3357 .It Ql \euHHHH
3358 Identical to
3359 .Ql \eUHHHHHHHH
3360 except it takes only one to four hexadecimal digits.
3361 .It Ql \ecX
3362 Emits the non-printable (ASCII and compatible) C0 control codes
3363 0 (NUL) to 31 (US), and 127 (DEL).
3364 Printable representations of ASCII control codes can be created by
3365 mapping them to a different part of the ASCII character set, which is
3366 possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is
3367 .Ql 7 + 64 = 71 = G .
3368 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3369 .Ic vexpr ) ,
3370 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3371 .Ql ? vexpr ^ 127 64 .
3373 Whereas historically circumflex notation has often been used for
3374 visualization purposes of control codes, e.g.,
3375 .Ql ^G ,
3376 the reverse solidus notation has been standardized:
3377 .Ql \ecG .
3378 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3379 as shown above (e.g.,
3380 .Ql \ea ,
3381 .Ql \en ,
3382 .Ql \et ) :
3383 whenever such an alias exists it will be used for display purposes.
3384 The control code NUL
3385 .Pf ( Ql \ec@ ,
3386 a non-standard extension) will suppress further output for the remains
3387 of the token (which may extend beyond the current quote), or, depending
3388 on the context, the remains of all arguments for the current command.
3389 .It Ql \e$NAME
3390 Non-standard extension: expand the given variable name, as above.
3391 Brace enclosing the name is supported.
3392 .It Ql \e`{command}
3393 Not yet supported, just to raise awareness: Non-standard extension.
3398 Caveats:
3400 .Bd -literal -offset indent
3401 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3402 ? echo Quotes ${HOME} and tokens differ! # comment
3403 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3405 .\" }}}
3407 .\" .Ss "Raw data arguments for codec commands" {{{
3408 .Ss "Raw data arguments for codec commands"
3410 A special set of commands, which all have the string
3411 .Dq codec
3412 in their name, e.g.,
3413 .Ic addrcodec ,
3414 .Ic shcodec ,
3415 .Ic urlcodec ,
3416 take raw string data as input, which means that the content of the
3417 command input line is passed completely unexpanded and otherwise
3418 unchanged: like this the effect of the actual codec is visible without
3419 any noise of possible shell quoting rules etc., i.e., the user can input
3420 one-to-one the desired or questionable data.
3421 To gain a level of expansion, the entire command line can be
3422 .Ic eval Ns
3423 uated first, e.g.,
3425 .Bd -literal -offset indent
3426 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3427 ? echo $res
3428 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3429 ? shcodec d $res
3430 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3431 ? eval shcodec d $res
3432 /usr/Sch\[:o]nes Wetter/heute.txt
3434 .\" }}}
3436 .\" .Ss "Filename transformations" {{{
3437 .Ss "Filename transformations"
3439 Filenames, where expected, and unless documented otherwise, are
3440 subsequently subject to the following filename transformations, in
3441 sequence:
3443 .Bl -bullet -offset indent
3445 If the given name is a registered
3446 .Ic shortcut ,
3447 it will be replaced with the expanded shortcut.
3450 The filename is matched against the following patterns or strings:
3452 .Bl -hang -compact -width ".Ar %user"
3453 .It Ar #
3454 (Number sign) is expanded to the previous file.
3455 .It Ar %
3456 (Percent sign) is replaced by the invoking
3457 .Mx -ix "primary system mailbox"
3458 user's primary system mailbox, which either is the (itself expandable)
3459 .Va inbox
3460 if that is set, the standardized absolute pathname indicated by
3461 .Ev MAIL
3462 if that is set, or a built-in compile-time default otherwise.
3463 .It Ar %user
3464 Expands to the primary system mailbox of
3465 .Ar user
3466 (and never the value of
3467 .Va inbox ,
3468 regardless of its actual setting).
3469 .It Ar &
3470 (Ampersand) is replaced with the invoking users
3471 .Mx -ix "secondary mailbox"
3472 secondary mailbox, the
3473 .Ev MBOX .
3474 .It Ar +file
3475 Refers to a
3476 .Ar file
3477 in the
3478 .Va folder
3479 directory (if that variable is set).
3480 .It Ar %:filespec
3481 Expands to the same value as
3482 .Ar filespec ,
3483 but has special meaning when used with, e.g., the command
3484 .Ic file :
3485 the file will be treated as a primary system mailbox by, e.g., the
3486 .Ic mbox
3488 .Ic save
3489 commands, meaning that messages that have been read in the current
3490 session will be moved to the
3491 .Ev MBOX
3492 mailbox instead of simply being flagged as read.
3496 Meta expansions are applied to the resulting filename, as applicable to
3497 the resulting file access protocol (also see
3498 .Sx "On URL syntax and credential lookup" ) .
3499 If the fully expanded filename results in multiple pathnames and the
3500 command is expecting only one file, an error results.
3502 For the file-protocol, a leading tilde
3503 .Ql ~
3504 character will be replaced by the expansion of
3505 .Ev HOME ,
3506 except when followed by a valid user name, in which case the home
3507 directory of the given user is used instead.
3509 In addition a shell expansion as if specified in double-quotes (see
3510 .Sx "Shell-style argument quoting" )
3511 is applied, so that any occurrence of
3512 .Ql $VARIABLE
3514 .Ql ${VARIABLE} )
3515 will be replaced by the expansion of the variable, if possible;
3516 .Sx "INTERNAL VARIABLES"
3517 as well as
3518 .Sx ENVIRONMENT
3519 (shell) variables can be accessed through this mechanism.
3521 In interactive context, in order to allow simple value acceptance (via
3522 .Dq ENTER ) ,
3523 arguments will usually be displayed in a properly quoted form, e.g., a file
3524 .Ql diet\e is \ecurd.txt
3525 may be displayed as
3526 .Ql 'diet\e is \ecurd.txt' .
3528 .\" }}}
3530 .\" .Ss "Commands" {{{
3531 .Ss "Commands"
3533 The following commands are available:
3535 .Bl -tag -width ".It Ic BaNg"
3539 .It Ic \&!
3540 Executes the
3541 .Ev SHELL
3542 command which follows, replacing unescaped exclamation marks with the
3543 previously executed command if the internal variable
3544 .Va bang
3545 is set.
3546 This command supports
3547 .Cm vput
3548 as documented in
3549 .Sx "Command modifiers" ,
3550 and manages the error number
3551 .Va \&! .
3552 A 0 or positive exit status
3553 .Va \&?
3554 reflects the exit status of the command, negative ones that
3555 an error happened before the command was executed, or that the program
3556 did not exit cleanly, but, e.g., due to a signal: the error number is
3557 .Va ^ERR Ns -CHILD ,
3558 then.
3561 In conjunction with the
3562 .Cm vput
3563 modifier the following special cases exist:
3564 a negative exit status occurs if the collected data could not be stored
3565 in the given variable, which is a
3566 .Va ^ERR Ns -NOTSUP
3567 error that should otherwise not occur.
3568 .Va ^ERR Ns -CANCELED
3569 indicates that no temporary file could be created to collect the command
3570 output at first glance.
3571 In case of catchable out-of-memory situations
3572 .Va ^ERR Ns -NOMEM
3573 will occur and \*(UA will try to store the empty string, just like with
3574 all other detected error conditions.
3578 .It Ic #
3579 The comment-command causes the entire line to be ignored.
3580 .Sy Note:
3581 this really is a normal command which' purpose is to discard its
3582 arguments, not a
3583 .Dq comment-start
3584 indicating special character, which means that, e.g., trailing comments
3585 on a line are not possible.
3588 .It Ic +
3589 Goes to the next message in sequence and types it
3590 (like
3591 .Dq ENTER ) .
3594 .It Ic -
3595 Display the preceding message, or the n'th previous message if given
3596 a numeric argument n.
3599 .It Ic =
3600 Show the current message number (the
3601 .Dq dot ) .
3604 .It Ic \&?
3605 Show a brief summary of commands.
3606 \*(OP Given an argument a synopsis for the command in question is
3607 shown instead; commands can be abbreviated in general and this command
3608 can be used to see the full expansion of an abbreviation including the
3609 synopsis, try, e.g.,
3610 .Ql ?h ,
3611 .Ql ?hel
3613 .Ql ?help
3614 and see how the output changes.
3615 This mode also supports a more
3616 .Va verbose
3617 output, which will provide the informations documented for
3618 .Ic list .
3621 .It Ic \&|
3622 A synonym for the
3623 .Ic pipe
3624 command.
3628 .It Ic account , unaccount
3629 (ac, una) Creates, selects or lists (an) account(s).
3630 Accounts are special incarnations of
3631 .Ic define Ns d
3632 macros and group commands and variable settings which together usually
3633 arrange the environment for the purpose of creating an email account.
3634 Different to normal macros settings which are covered by
3635 .Ic localopts
3636 \(en here by default enabled! \(en will not be reverted before the
3637 .Ic account
3638 is changed again.
3639 The special account
3640 .Ql null
3641 (case-insensitive) always exists, and all but it can be deleted by the
3642 latter command, and in one operation with the special name
3643 .Ql * .
3645 Without arguments a listing of all defined accounts is shown.
3646 With one argument the given account is activated: the system
3647 .Va inbox
3648 of that account will be activated (as via
3649 .Ic file ) ,
3650 a possibly installed
3651 .Va folder-hook
3652 will be run, and the internal variable
3653 .Va account
3654 will be updated.
3655 The two argument form is identical to defining a macro as via
3656 .Ic define :
3657 .Bd -literal -offset indent
3658 account myisp {
3659   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3660   set from='(My Name) myname@myisp.example'
3661   set mta=smtp://mylogin@smtp.myisp.example
3667 .It Ic addrcodec
3668 Perform email address codec transformations on raw-data argument, rather
3669 according to email standards (RFC 5322; \*(ID will furtherly improve).
3670 Supports
3671 .Cm vput
3672 (see
3673 .Sx "Command modifiers" ) ,
3674 and manages the error number
3675 .Va \&! .
3676 The first argument must be either
3677 .Ar [+[+[+]]]e[ncode] ,
3678 .Ar d[ecode]
3680 .Ar s[kin] ,
3681 and specifies the operation to perform on the rest of the line.
3684 Decoding will show how a standard-compliant MUA will display the given
3685 argument, which should be an email address.
3686 Please be aware that most MUAs have difficulties with the address
3687 standards, and vary wildly when (comments) in parenthesis,
3688 .Dq double-quoted
3689 strings, or quoted-pairs, as below, become involved.
3690 \*(ID \*(UA currently does not perform decoding when displaying addresses.
3693 Skinning is identical to decoding but only outputs the plain address,
3694 without any string, comment etc. components.
3695 Another difference is that it may fail with the error number
3696 .Va \&!
3697 set to
3698 .Va ^ERR Ns -INVAL
3699 if decoding fails to find a(n) (valid) email address, in which case the
3700 unmodified input will be output again.
3703 Encoding supports four different modes, lesser automated versions can be
3704 chosen by prefixing one, two or three plus signs: the standard imposes
3705 a special meaning on some characters, which thus have to be transformed
3706 to so-called quoted-pairs by pairing them with a reverse solidus
3707 .Ql \e
3708 in order to remove the special meaning; this might change interpretation
3709 of the entire argument from what has been desired, however!
3710 Specify one plus sign to remark that parenthesis shall be left alone,
3711 two for not turning double quotation marks into quoted-pairs, and three
3712 for also leaving any user-specified reverse solidus alone.
3713 The result will always be valid, if a successful exit status is reported.
3714 \*(ID Addresses need to be specified in between angle brackets
3715 .Ql < ,
3716 .Ql >
3717 if the construct becomes more difficult, otherwise the current parser
3718 will fail; it is not smart enough to guess right.
3720 .Bd -literal -offset indent
3721 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
3722 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3723 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3724 "Hey, you", \e out\e there <diet@exam.ple>
3725 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3726 diet@exam.ple
3732 .It Ic alias , unalias
3733 (a, una) Aliases are a method of creating personal distribution lists
3734 that map a single alias name to none to multiple real receivers;
3735 these aliases become expanded after message composing is completed.
3736 The latter command removes the given list of aliases, the special name
3737 .Ql *
3738 will discard all existing aliases.
3739 The former command shows all currently defined aliases when used without
3740 arguments, and with one argument the expansion of the given alias.
3741 With more than one argument, creates or appends to the alias name given
3742 as the first argument the remaining arguments.
3743 Alias names are restricted to alphabetic characters, digits, the
3744 underscore, hyphen-minus, the number sign, colon, commercial at and
3745 period, the last character can also be the dollar sign:
3746 .Ql [[:alnum:]_#:@.-]+$? .
3750 .It Ic alternates , unalternates
3751 \*(NQ (alt) Manage a list of alternate addresses or names of the active user,
3752 members of which will be removed from recipient lists.
3753 The latter command removes the given list of alternates, the special name
3754 .Ql *
3755 will discard all existing aliases.
3756 The former command manages the error number
3757 .Va \&!
3758 and shows the current set of alternates when used without arguments; in
3759 this mode it supports
3760 .Cm vput
3761 (see
3762 .Sx "Command modifiers" ) .
3763 Otherwise the given arguments (after being checked for validity) are
3764 appended to the list of alternate names; in
3765 .Va posix
3766 mode they replace that list instead.
3767 There is a set of implicit alternates which is formed of the values of
3768 .Ev LOGNAME ,
3769 .Va from ,
3770 .Va sender
3772 .Va replyto .
3776 .It Ic answered , unanswered
3777 Take a message lists and mark each message as having been answered,
3778 having not been answered, respectively.
3779 Messages will be marked answered when being
3780 .Ic reply Ns d
3781 to automatically if the
3782 .Va markanswered
3783 variable is set.
3784 See the section
3785 .Sx "Message states" .
3790 .It Ic bind , unbind
3791 \*(OP\*(NQ The bind command extends the MLE (see
3792 .Sx "On terminal control and line editor" )
3793 with freely configurable key bindings.
3794 The latter command removes from the given context the given key binding,
3795 both of which may be specified as a wildcard
3796 .Ql * ,
3797 so that, e.g.,
3798 .Ql unbind * *
3799 will remove all bindings of all contexts.
3800 Due to initialization order unbinding will not work for built-in key
3801 bindings upon program startup, however: please use
3802 .Va line-editor-no-defaults
3803 for this purpose instead.
3806 With one argument the former command shows all key bindings for the
3807 given context, specifying an asterisk
3808 .Ql *
3809 will show the bindings of all contexts; a more verbose listing will be
3810 produced if either of
3811 .Va debug
3813 .Va verbose
3814 are set.
3815 With two or more arguments a binding is (re)established:
3816 the first argument is the context to which the binding shall apply,
3817 the second argument is a comma-separated list of the
3818 .Dq keys
3819 which form the binding, and any remaining arguments form the expansion.
3820 To indicate that a binding shall not be auto-committed, but that the
3821 expansion shall instead be furtherly editable by the user, a commercial at
3822 .Ql @
3823 (that will be removed) can be placed last in the expansion, from which
3824 leading and trailing whitespace will finally be removed.
3825 Reverse solidus cannot be used as the last character of expansion.
3828 Contexts define when a binding applies, i.e., a binding will not be seen
3829 unless the context for which it is defined for is currently active.
3830 This is not true for the shared binding
3831 .Ql base ,
3832 which is the foundation for all other bindings and as such always
3833 applies, its bindings, however, only apply secondarily.
3834 The available contexts are the shared
3835 .Ql base ,
3837 .Ql default
3838 context which is used in all not otherwise documented situations, and
3839 .Ql compose ,
3840 which applies to compose mode only.
3843 .Dq Keys
3844 which form the binding are specified as a comma-separated list of
3845 byte-sequences, where each list entry corresponds to one key(press).
3846 A list entry may, indicated by a leading colon character
3847 .Ql \&: ,
3848 also refer to the name of a terminal capability; several dozen names
3849 will be compiled in and may be specified either by their
3850 .Xr terminfo 5 ,
3851 or, if existing, by their
3852 .Xr termcap 5
3853 name, regardless of the actually used \*(OPal terminal control library.
3854 It is possible to use any capability, as long as the name is resolvable
3855 by the \*(OPal control library or was defined via the internal variable
3856 .Va termcap .
3857 Input sequences are not case-normalized, so that an exact match is
3858 required to update or remove a binding.
3859 Examples:
3861 .Bd -literal -offset indent
3862 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
3863 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
3864 ? bind default $'\ecA',:khome,w 'echo An editable binding@'
3865 ? bind default a,b,c rm -irf / @  # Another editable binding
3866 ? bind default :kf1 File %
3867 ? bind compose :kf1 ~e
3871 Note that the entire comma-separated list is first parsed (over) as a
3872 shell-token with whitespace as the field separator, before being parsed
3873 and expanded for real with comma as the field separator, therefore
3874 whitespace needs to be properly quoted, see
3875 .Sx "Shell-style argument quoting" .
3876 Using Unicode reverse solidus escape sequences renders a binding
3877 defunctional if the locale does not support Unicode (see
3878 .Sx "Character sets" ) ,
3879 and using terminal capabilities does so if no (corresponding) terminal
3880 control support is (currently) available.
3883 The following terminal capability names are built-in and can be used in
3884 .Xr terminfo 5
3885 or (if available) the two-letter
3886 .Xr termcap 5
3887 notation.
3888 See the respective manual for a list of capabilities.
3889 The program
3890 .Xr infocmp 1
3891 can be used to show all the capabilities of
3892 .Ev TERM
3893 or the given terminal type;
3894 using the
3895 .Fl \&\&x
3896 flag will also show supported (non-standard) extensions.
3899 .Bl -tag -compact -width kcuuf_or_kcuuf
3900 .It Cd kbs Ns \0or Cd kb
3901 Backspace.
3902 .It Cd kdch1 Ns \0or Cd kD
3903 Delete character.
3904 .It Cd kDC Ns \0or Cd *4
3905 \(em shifted variant.
3906 .It Cd kel Ns \0or Cd kE
3907 Clear to end of line.
3908 .It Cd kext Ns \0or Cd @9
3909 Exit.
3910 .It Cd kich1 Ns \0or Cd kI
3911 Insert character.
3912 .It Cd kIC Ns \0or Cd #3
3913 \(em shifted variant.
3914 .It Cd khome Ns \0or Cd kh
3915 Home.
3916 .It Cd kHOM Ns \0or Cd #2
3917 \(em shifted variant.
3918 .It Cd kend Ns \0or Cd @7
3919 End.
3920 .It Cd knp Ns \0or Cd kN
3921 Next page.
3922 .It Cd kpp Ns \0or Cd kP
3923 Previous page.
3924 .It Cd kcub1 Ns \0or Cd kl
3925 Left cursor (with more modifiers: see below).
3926 .It Cd kLFT Ns \0or Cd #4
3927 \(em shifted variant.
3928 .It Cd kcuf1 Ns \0or Cd kr
3929 Right cursor (ditto).
3930 .It Cd kRIT Ns \0or Cd %i
3931 \(em shifted variant.
3932 .It Cd kcud1 Ns \0or Cd kd
3933 Down cursor (ditto).
3934 .It Cd kDN
3935 \(em shifted variant (only terminfo).
3936 .It Cd kcuu1 Ns \0or Cd ku
3937 Up cursor (ditto).
3938 .It Cd kUP
3939 \(em shifted variant (only terminfo).
3940 .It Cd kf0 Ns \0or Cd k0
3941 Function key 0.
3942 Add one for each function key up to
3943 .Cd kf9
3945 .Cd k9 ,
3946 respectively.
3947 .It Cd kf10 Ns \0or Cd k;
3948 Function key 10.
3949 .It Cd kf11 Ns \0or Cd F1
3950 Function key 11.
3951 Add one for each function key up to
3952 .Cd kf19
3954 .Cd F9 ,
3955 respectively.
3959 Some terminals support key-modifier combination extensions, e.g.,
3960 .Ql Alt+Shift+xy .
3961 For example, the delete key,
3962 .Cd kdch1 :
3963 in its shifted variant, the name is mutated to
3964 .Cd  kDC ,
3965 then a number is appended for the states
3966 .Ql Alt
3967 .Pf ( Cd kDC3 ) ,
3968 .Ql Shift+Alt
3969 .Pf ( Cd kDC4 ) ,
3970 .Ql Control
3971 .Pf ( Cd kDC5 ) ,
3972 .Ql Shift+Control
3973 .Pf ( Cd kDC6 ) ,
3974 .Ql Alt+Control
3975 .Pf ( Cd kDC7 ) ,
3976 finally
3977 .Ql Shift+Alt+Control
3978 .Pf ( Cd kDC8 ) .
3979 The same for the left cursor key,
3980 .Cd kcub1 :
3981 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
3984 It is advisable to use an initial escape or other control character (e.g.,
3985 .Ql \ecA )
3986 for bindings which describe user key combinations (as opposed to purely
3987 terminal capability based ones), in order to avoid ambiguities whether
3988 input belongs to key sequences or not; it also reduces search time.
3989 Adjusting
3990 .Va bind-timeout
3991 may help shall keys and sequences be falsely recognized.
3995 .It Ic call
3996 \*(NQ Calls the given macro, which must have been created via
3997 .Ic define ,
3998 otherwise a
3999 .Va ^ERR Ns -NOENT
4000 error occurs.
4001 Parameters given to macros are implicitly local to the macro's scope, and
4002 may be accessed via special (positional) parameters, e.g.,
4003 .Va 1 ,
4004 .Va * ,
4005 .Va @ ,
4006 .Va # .
4007 The positional parameters may be removed by
4008 .Ic shift Ns
4009 ing them off the stack (exceeding the supported number of arguments
4010 results in a
4011 .Va ^ERR Ns -OVERFLOW ) ,
4012 and are otherwise controllable via
4013 .Ic vpospar .
4014 Changes to other
4015 .Sx ENVIRONMENT
4016 as well as
4017 .Sx "INTERNAL VARIABLES"
4018 can be reverted before the current level regains control by setting
4019 .Ic localopts
4020 for called macro(s) (or in them, of course).
4021 Macro execution can be terminated at any time by calling
4022 .Ic return .
4025 Calling macros recursively will at some time excess the stack size
4026 limit, causing a hard program abortion; if recursively calling a macro
4027 is the last command of the current macro, consider to use the command
4028 .Ic xcall ,
4029 which will first release all resources of the current macro before
4030 replacing the current macro with the called one.
4031 Numeric and string operations can be performed via
4032 .Ic vexpr ,
4034 .Ic eval
4035 may be helpful to recreate argument lists.
4037 .Bd -literal -offset indent
4038 define exmac {
4039   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4040   return 1000 0
4042 call exmac Hello macro exmac!
4046 Caveats: \*(UA parses  entire input lines and decides on a per-command
4047 base what to do with the rest of the line, different to the
4048 .Xr sh 1 Ns
4049 ell, which implements a standardized (programming) language, and
4050 performs several successive transformation steps after decomposing the
4051 given command line into tokens adhering standardized syntax guidelines.
4052 E.g., in the following code snippets of otherwise identical meaning,
4053 a shell will see zero arguments, whereas \*(UA sees one, unless an
4054 additional expansion (via
4055 .Ic eval )
4056 is explicitly used:
4058 .Bd -literal -offset indent
4059 $ cat > t.sh << '___'; cat > t.rc << '___'
4060 x() { echo $#; }
4061 set --
4062 x "$@"
4064 define x {
4065   echo $#
4067 vpospar set
4068 call x "$@"
4069 eval call x "$@"
4071 $ sh t.sh; \*(uA -X'source t.rc' -Xx
4079 .It Ic call_if
4080 Identical to
4081 .Ic call
4082 if the given macro has been created via
4083 .Ic define ,
4084 but doesn't fail nor warn if the macro doesn't exist.
4087 .It Ic cd
4088 (ch) Change the working directory to
4089 .Ev HOME
4090 or the given argument.
4091 Synonym for
4092 .Ic chdir .
4095 .It Ic certsave
4096 \*(OP Only applicable to S/MIME signed messages.
4097 Takes a message list and a filename and saves the certificates
4098 contained within the message signatures to the named file in both
4099 human-readable and PEM format.
4100 The certificates can later be used to send encrypted messages to the
4101 respective message senders by setting
4102 .Va smime-encrypt-USER@HOST
4103 variables.
4107 .It Ic charsetalias , uncharsetalias
4108 \*(NQ Manage (character set conversion) character set alias mappings,
4109 as documented in the section
4110 .Sx "Character sets" .
4111 Character set aliases are expanded recursively, but no expansion is
4112 performed on values of the user-settable variables, e.g.,
4113 .Va charset-8bit .
4114 These are effectively no-operations if character set conversion
4115 is not available (i.e., no
4116 .Ql +iconv
4118 .Va features ) .
4119 Without arguments the list of all currently defined aliases is shown,
4120 with one argument the expansion of the given alias.
4121 Otherwise all given arguments are treated as pairs of character sets and
4122 their desired target alias name, creating new or changing already
4123 existing aliases, as necessary.
4125 The latter deletes all aliases given as arguments, the special argument
4126 .Ql *
4127 will remove all aliases.
4130 .It Ic chdir
4131 (ch) Change the working directory to
4132 .Ev HOME
4133 or the given argument.
4134 Synonym for
4135 .Ic cd .
4139 .It Ic collapse , uncollapse
4140 Only applicable to threaded mode.
4141 Takes a message list and makes all replies to these messages invisible
4142 in header summaries, except for
4143 .Ql new
4144 messages and the
4145 .Dq dot .
4146 Also when a message with collapsed replies is displayed,
4147 all of these are automatically uncollapsed.
4148 The latter command undoes collapsing.
4153 .It Ic colour , uncolour
4154 \*(OP\*(NQ Manage colour mappings of and for a
4155 .Sx "Coloured display" .
4156 The type of colour is given as the (case-insensitive) first argument,
4157 which must be one of
4158 .Ql 256
4159 for 256-colour terminals,
4160 .Ql 8 ,
4161 .Ql ansi
4163 .Ql iso
4164 for the standard 8-colour ANSI / ISO 6429 color palette and
4165 .Ql 1
4167 .Ql mono
4168 for monochrome terminals.
4169 Monochrome terminals cannot deal with colours, but only (some) font
4170 attributes.
4173 Without further arguments the list of all currently defined mappings
4174 for the given colour type is shown (as a special case giving
4175 .Ql all
4177 .Ql *
4178 will show the mappings of all types).
4179 Otherwise the second argument defines the mappable slot, and the third
4180 argument a (comma-separated list of) colour and font attribute
4181 specification(s), and the optional fourth argument can be used to
4182 specify a precondition: if conditioned mappings exist they are tested in
4183 (creation) order unless a (case-insensitive) match has been found, and
4184 the default mapping (if any has been established) will only be chosen as
4185 a last resort.
4186 The types of precondition available depend on the mappable slot (see
4187 .Sx "Coloured display"
4188 for some examples), the following of which exist:
4191 Mappings prefixed with
4192 .Ql mle-
4193 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4194 .Sx "On terminal control and line editor" )
4195 and do not support preconditions.
4197 .Bl -tag -compact -width view-partinfo
4198 .It Ar mle-position
4199 This mapping is used for the position indicator that is visible when
4200 a line cannot be fully displayed on the screen.
4201 .It Ar mle-prompt
4202 Used for the
4203 .Va prompt .
4207 Mappings prefixed with
4208 .Ql sum-
4209 are used in header summaries, and they all understand the preconditions
4210 .Ql dot
4211 (the current message) and
4212 .Ql older
4213 for elder messages (only honoured in conjunction with
4214 .Va datefield-markout-older ) .
4216 .Bl -tag -compact -width view-partinfo
4217 .It Ar sum-dotmark
4218 This mapping is used for the
4219 .Dq dotmark
4220 that can be created with the
4221 .Ql %>
4223 .Ql %<
4224 formats of the variable
4225 .Va headline .
4226 .It Ar sum-header
4227 For the complete header summary line except the
4228 .Dq dotmark
4229 and the thread structure.
4230 .It Ar sum-thread
4231 For the thread structure which can be created with the
4232 .Ql %i
4233 format of the variable
4234 .Va headline .
4238 Mappings prefixed with
4239 .Ql view-
4240 are used when displaying messages.
4242 .Bl -tag -compact -width view-partinfo
4243 .It Ar view-from_
4244 This mapping is used for so-called
4245 .Ql From_
4246 lines, which are MBOX file format specific header lines.
4247 .It Ar view-header
4248 For header lines.
4249 A comma-separated list of headers to which the mapping applies may be
4250 given as a precondition; if the \*(OPal regular expression support is
4251 available then if any of the
4252 .Dq magical
4253 (extended) regular expression characters is seen the precondition will
4254 be evaluated as (an extended) one.
4255 .It Ar view-msginfo
4256 For the introductional message info line.
4257 .It Ar view-partinfo
4258 For MIME part info lines.
4262 The following (case-insensitive) colour definitions and font attributes
4263 are understood, multiple of which can be specified in a comma-separated
4264 list:
4266 .Bl -tag -width ft=
4267 .It Ar ft=
4268 a font attribute:
4269 .Ql bold ,
4270 .Ql reverse
4272 .Ql underline .
4273 It is possible (and often applicable) to specify multiple font
4274 attributes for a single mapping.
4276 .It Ar fg=
4277 foreground colour attribute:
4278 .Ql black ,
4279 .Ql blue ,
4280 .Ql green ,
4281 .Ql red ,
4282 .Ql brown ,
4283 .Ql magenta ,
4284 .Ql cyan
4286 .Ql white .
4287 To specify a 256-color mode a decimal number colour specification in
4288 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4290 .Bl -tag -compact -width "999 - 999"
4291 .It 0 - 7
4292 the standard ISO 6429 colors, as above.
4293 .It 8 - 15
4294 high intensity variants of the standard colors.
4295 .It 16 - 231
4296 216 colors in tuples of 6.
4297 .It 232 - 255
4298 grayscale from black to white in 24 steps.
4300 .Bd -literal -offset indent
4301 #!/bin/sh -
4302 fg() { printf "\e033[38;5;${1}m($1)"; }
4303 bg() { printf "\e033[48;5;${1}m($1)"; }
4305 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4306 printf "\e033[0m\en"
4308 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4309 printf "\e033[0m\en"
4312 .It Ar bg=
4313 background colour attribute (see
4314 .Cd fg=
4315 for possible values).
4319 The command
4320 .Ic \&uncolour
4321 will remove for the given colour type (the special type
4322 .Ql *
4323 selects all) the given mapping; if the optional precondition argument is
4324 given only the exact tuple of mapping and precondition is removed.
4325 The special name
4326 .Ql *
4327 will remove all mappings (no precondition allowed), thus
4328 .Ql uncolour * *
4329 will remove all established mappings.
4334 .It Ic commandalias , uncommandalias
4335 \*(NQ Define or list, and remove, respectively, command aliases.
4336 An (command)alias can be used everywhere a normal command can be used,
4337 but always takes precedence: any arguments that are given to the command
4338 alias are joined onto the alias expansion, and the resulting string
4339 forms the command line that is, in effect, executed.
4340 The latter command removes all given aliases, the special name
4341 .Ql *
4342 will remove all existing aliases.
4343 When used without arguments the former shows a list of all currently
4344 known aliases, with one argument only the expansion of the given one.
4346 With two or more arguments a command alias is defined or updated: the
4347 first argument is the name under which the remaining command line should
4348 be accessible, the content of which can be just about anything.
4349 An alias may itself expand to another alias, but to avoid expansion loops
4350 further expansion will be prevented if an alias refers to itself or if
4351 an expansion depth limit is reached.
4352 Explicit expansion prevention is available via reverse solidus
4353 .Cm \e ,
4354 one of the
4355 .Sx "Command modifiers" .
4356 .Bd -literal -offset indent
4357 ? commandalias xx
4358 \*(uA: `commandalias': no such alias: xx
4359 ? commandalias xx echo hello,
4360 ? commandalias xx
4361 commandalias xx 'echo hello,'
4362 ? xx
4363 hello,
4364 ? xx world
4365 hello, world
4369 .It Ic Copy
4370 (C) Copy messages to files whose names are derived from the author of
4371 the respective message and do not mark them as being saved;
4372 otherwise identical to
4373 .Ic Save .
4376 .It Ic copy
4377 (c) Copy messages to the named file and do not mark them as being saved;
4378 otherwise identical to
4379 .Ic save .
4382 .It Ic cwd
4383 Show the name of the current working directory, as reported by
4384 .Xr getcwd 3 .
4385 Supports
4386 .Cm vput
4387 (see
4388 .Sx "Command modifiers" ) .
4389 The return status is tracked via
4390 .Va \&! .
4393 .It Ic Decrypt
4394 \*(OP For unencrypted messages this command is identical to
4395 .Ic Copy ;
4396 Encrypted messages are first decrypted, if possible, and then copied.
4399 .It Ic decrypt
4400 \*(OP For unencrypted messages this command is identical to
4401 .Ic copy ;
4402 Encrypted messages are first decrypted, if possible, and then copied.
4406 .It Ic define , undefine
4407 Without arguments the current list of macros, including their content,
4408 is shown, otherwise a macro is defined, replacing an existing macro of
4409 the same name.
4410 A macro definition is a sequence of commands in the following form:
4411 .Bd -literal -offset indent
4412 define name {
4413   command1
4414   command2
4415   ...
4416   commandN
4420 A defined macro can be invoked explicitly by using the
4421 .Ic call ,
4422 .Ic call_if
4424 .Ic xcall
4425 commands, or implicitly if a macro hook is triggered, e.g., a
4426 .Va folder-hook .
4427 It is possible to localize adjustments, like creation, deletion and
4428 modification of
4429 .Sx "INTERNAL VARIABLES" ,
4430 by using the
4431 .Ic localopts
4432 command; the scope which is localized depends on how (i.e.,
4433 .Dq as what :
4434 normal macro, folder hook, hook,
4435 .Ic account
4436 switch) the macro is invoked.
4437 Execution of a macro body can be stopped from within by calling
4438 .Ic return .
4439 Inside a
4440 .Ic call Ns
4441 ed macro, given positional parameters can be
4442 .Ic shift Ns
4443 ed, or become completely replaced, removed etc. via
4444 .Ic vpospar .
4446 The latter command deletes the given macro, the special name
4447 .Ql *
4448 will discard all existing macros.
4449 Creation and deletion of (a) macro(s) can be performed from within
4450 a running macro.
4454 .It Ic delete , undelete
4455 (d, u) Marks the given message list as being or not being
4456 .Ql deleted ,
4457 respectively; if no argument has been specified then the usual search
4458 for a visible message is performed, as documented for
4459 .Sx "Message list arguments" ,
4460 showing only the next input prompt if the search fails.
4461 Deleted messages will neither be saved in the
4462 .Mx -sx
4463 .Sx "secondary mailbox"
4464 .Ev MBOX
4465 nor will they be available for most other commands.
4466 If the
4467 .Va autoprint
4468 variable is set, the new
4469 .Dq dot
4470 or the last message restored, respectively, is automatically
4471 .Ic type Ns
4472 d; also see
4473 .Ic dp ,
4474 .Ic dt .
4477 .It Ic discard
4478 (di) Identical to
4479 .Ic ignore .
4480 Superseded by the multiplexer
4481 .Ic headerpick .
4485 .It Ic dp , dt
4486 Delete the given messages and automatically
4487 .Ic type
4488 the new
4489 .Dq dot
4490 if one exists, regardless of the setting of
4491 .Va autoprint .
4494 .It Ic dotmove
4495 Move the
4496 .Dq dot
4497 up or down by one message when given
4498 .Ql +
4500 .Ql -
4501 argument, respectively.
4505 .It Ic draft , undraft
4506 Take message lists and mark each given message as being draft, or not
4507 being draft, respectively, as documented in the section
4508 .Sx "Message states" .
4511 .It Ic echo
4512 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4513 newline, whereas the otherwise identical
4514 .Ic echon
4515 does not.
4516 .Sx "Shell-style argument quoting"
4517 is used,
4518 .Sx "Filename transformations"
4519 are applied to the expanded arguments.
4522 .It Ic echoerr
4523 \*(NQ Identical to
4524 .Ic echo
4525 except that is echoes to standard error.
4526 Also see
4527 .Ic echoerrn .
4528 In interactive sessions the \*(OPal message ring queue for
4529 .Ic errors
4530 will be used instead, if available.
4533 .It Ic echon
4534 \*(NQ Identical to
4535 .Ic echo ,
4536 but does not write a trailing newline.
4539 .It Ic echoerrn
4540 \*(NQ Identical to
4541 .Ic echoerr ,
4542 but does not write a trailing newline.
4545 .It Ic edit
4546 (e) Point the text editor (as defined in
4547 .Ev EDITOR )
4548 at each message from the given list in turn.
4549 Modified contents are discarded unless the
4550 .Va writebackedited
4551 variable is set, and are not used unless the mailbox can be written to
4552 and the editor returns a successful exit status.
4555 .It Ic elif
4556 Part of the
4557 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4558 conditional \(em if the condition of a preceding
4559 .Ic if
4560 was false, check the following condition and execute the following block
4561 if it evaluates true.
4564 .It Ic else
4565 (el) Part of the
4566 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4567 conditional \(em if none of the conditions of the preceding
4568 .Ic if
4570 .Ic elif
4571 commands was true, the
4572 .Ic else
4573 block is executed.
4576 .It Ic endif
4577 (en) Marks the end of an
4578 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4579 conditional execution block.
4583 .It Ic environ
4584 \*(NQ \*(UA has a strict notion about which variables are
4585 .Sx "INTERNAL VARIABLES"
4586 and which are managed in the program
4587 .Sx ENVIRONMENT .
4588 Since some of the latter are a vivid part of \*(UAs functioning,
4589 however, they are transparently integrated into the normal handling of
4590 internal variables via
4591 .Ic set
4593 .Ic unset .
4594 To integrate other environment variables of choice into this
4595 transparent handling, and also to export internal variables into the
4596 process environment where they normally are not, a
4597 .Ql link
4598 needs to become established with this command, as in, e.g.,
4601 .Dl environ link PERL5LIB TZ
4604 Afterwards changing such variables with
4605 .Ic set
4606 will cause automatic updates of the program environment, and therefore
4607 be inherited by newly created child processes.
4608 Sufficient system support provided (it was in BSD as early as 1987, and
4609 is standardized since Y2K) removing such variables with
4610 .Ic unset
4611 will remove them also from the program environment, but in any way
4612 the knowledge they ever have been
4613 .Ql link Ns
4614 ed will be lost.
4615 Note that this implies that
4616 .Ic localopts
4617 may cause loss of such links.
4620 The command
4621 .Ql unlink
4622 will remove an existing link, but leaves the variables as such intact.
4623 Additionally the subcommands
4624 .Ql set
4626 .Ql unset
4627 are provided, which work exactly the same as the documented commands
4628 .Ic set
4630 .Ic unset ,
4631 but (additionally un)link the variable(s) with the program environment
4632 and thus immediately export them to, or remove them from (if possible),
4633 respectively, the program environment.
4637 .It Ic errors
4638 \*(OP Since \*(UA uses the console as a user interface it can happen
4639 that messages scroll by too fast to become recognized.
4640 An error message ring queue is available which stores duplicates of any
4641 error message and notifies the user in interactive sessions whenever
4642 a new error has occurred.
4643 The queue is finite: if its maximum size is reached any new message
4644 replaces the eldest.
4645 The command
4646 .Ic errors
4647 can be used to manage this message queue: if given
4648 .Ar show
4649 or no argument the queue will be displayed and cleared,
4650 .Ar clear
4651 will only clear all messages from the queue.
4654 .It Ic eval
4655 \*(NQ Construct a command by concatenating the arguments, separated with
4656 a single space character, and then evaluate the result.
4657 This command passes through the exit status
4658 .Va \&?
4659 and error number
4660 .Va \&!
4661 of the evaluated command; also see
4662 .Ic call .
4663 .Bd -literal -offset indent
4664 define xxx {
4665   echo "xxx arg <$1>"
4666   shift
4667   if [ $# -gt 0 ]
4668     \excall xxx "$@"
4669   endif
4671 define yyy {
4672   eval "$@ ' ball"
4674 call yyy '\ecall xxx' "b\e$'\et'u ' "
4675 call xxx arg <b      u>
4676 call xxx arg <  >
4677 call xxx arg <ball>
4681 .It Ic exit
4682 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4683 any saving of messages in the
4684 .Mx -sx
4685 .Sx "secondary mailbox"
4686 .Ev MBOX ,
4687 as well as a possibly tracked line editor
4688 .Va history-file .
4689 The optional status number argument will be passed through to
4690 .Xr exit 3 .
4691 \*(ID For now it can happen that the given status will be overwritten,
4692 later this will only occur if a later error needs to be reported onto an
4693 otherwise success indicating status.
4696 .It Ic File
4697 (Fi) Like
4698 .Ic file ,
4699 but open the mailbox read-only.
4703 .It Ic file
4704 (fi) The file command switches to a new mailbox.
4705 Without arguments it shows status information of the current mailbox.
4706 If an argument is given, it will write out changes (such as deletions)
4707 the user has made, open a new mailbox, update the internal variables
4708 .Va mailbox-resolved
4710 .Va mailbox-display ,
4711 and optionally display a summary of
4712 .Ic headers
4713 if the variable
4714 .Va header
4715 is set.
4718 .Sx "Filename transformations"
4719 will be applied to the
4720 .Ar name
4721 argument, and
4722 .Ql protocol://
4723 prefixes are, i.e., URL syntax is understood, e.g.,
4724 .Ql maildir:///tmp/mdirbox :
4725 if a protocol prefix is used the mailbox type is fixated and neither
4726 the auto-detection (read on) nor the
4727 .Va newfolders
4728 mechanisms apply.
4729 \*(OPally URLs can also be used to access network resources, and it is
4730 possible to proxy all network traffic over a SOCKS5 server given via
4731 .Va socks-proxy .
4734 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4735 .Dl \*(OU protocol://[user@]host[:port][/path]
4738 \*(OPally supported network protocols are
4739 .Ar pop3
4740 (POP3) and
4741 .Ar pop3s
4742 (POP3 with SSL/TLS encrypted transport),
4743 .Ar imap
4745 .Ar imaps .
4747 .Ar [/path]
4748 part is valid only for IMAP; there it defaults to
4749 .Ar INBOX .
4750 Network URLs require a special encoding as documented in the section
4751 .Sx "On URL syntax and credential lookup" .
4754 If the resulting file protocol (MBOX database)
4755 .Ar name
4756 is located on a local filesystem then the list of all registered
4757 .Ic filetype Ns
4758 s is traversed in order to see whether a transparent intermediate
4759 conversion step is necessary to handle the given mailbox, in which case
4760 \*(UA will use the found hook to load and save data into and from
4761 a temporary file, respectively.
4762 Changing hooks will not affect already opened mailboxes.
4763 For example, the following creates hooks for the
4764 .Xr gzip 1
4765 compression tool and a combined compressed and encrypted format:
4767 .Bd -literal -offset indent
4768 ? filetype \e
4769     gzip 'gzip -dc' 'gzip -c' \e
4770     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4774 MBOX database files are generally locked during file operations in order
4775 to avoid inconsistencies due to concurrent modifications.
4776 \*(OPal Mailbox files which \*(UA treats as the system
4777 .Va inbox
4778 .Pf ( Ev MAIL ) ,
4780 .Mx -sx
4781 .Sx "primary system mailbox" Ns
4782 es in general will also be protected by so-called dotlock files, the
4783 traditional way of mail spool file locking: for any file
4784 .Ql a
4785 a lock file
4786 .Ql a.lock
4787 will be created for the duration of the synchronization \(em
4788 as necessary a privilege-separated dotlock child process will be used
4789 to accommodate for necessary privilege adjustments in order to create
4790 the dotlock file in the same directory
4791 and with the same user and group identities as the file of interest.
4794 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4795 files, but it will detect invalid message boundaries in this mode and
4796 complain (even more with
4797 .Va debug )
4798 if any is seen: in this case
4799 .Va mbox-rfc4155
4800 can be used to create a valid MBOX database from the invalid input.
4803 If no protocol has been fixated, and
4804 .Ar name
4805 refers to a directory with the subdirectories
4806 .Ql tmp ,
4807 .Ql new
4809 .Ql cur ,
4810 then it is treated as a folder in
4811 .Dq Maildir
4812 format.
4813 The maildir format stores each message in its own file, and has been
4814 designed so that file locking is not necessary when reading or writing
4815 files.
4818 \*(ID If no protocol has been fixated and no existing file has
4819 been found, the variable
4820 .Va newfolders
4821 controls the format of mailboxes yet to be created.
4826 .It Ic filetype , unfiletype
4827 \*(NQ Define or list, and remove, respectively, file handler hooks,
4828 which provide (shell) commands that enable \*(UA to load and save MBOX
4829 files from and to files with the registered file extensions;
4830 it will use an intermediate temporary file to store the plain data.
4831 The latter command removes the hooks for all given extensions,
4832 .Ql *
4833 will remove all existing handlers.
4835 When used without arguments the former shows a list of all currently
4836 defined file hooks, with one argument the expansion of the given alias.
4837 Otherwise three arguments are expected, the first specifying the file
4838 extension for which the hook is meant, and the second and third defining
4839 the load- and save commands, respectively, to deal with the file type,
4840 both of which must read from standard input and write to standard
4841 output.
4842 Changing hooks will not affect already opened mailboxes (\*(ID except below).
4843 \*(ID For now too much work is done, and files are oftened read in twice
4844 where once would be sufficient: this can cause problems if a filetype is
4845 changed while such a file is opened; this was already so with the
4846 built-in support of .gz etc. in Heirloom, and will vanish in v15.
4847 \*(ID For now all handler strings are passed to the
4848 .Ev SHELL for evaluation purposes; in the future a
4849 .Ql \&!
4850 prefix to load and save commands may mean to bypass this shell instance:
4851 placing a leading space will avoid any possible misinterpretations.
4852 .Bd -literal -offset indent
4853 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
4854     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
4855     zst 'zstd -dc' 'zstd -19 -zc' \e
4856     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4857 ? set record=+sent.zst.pgp
4862 .It Ic flag , unflag
4863 Take message lists and mark the messages as being flagged, or not being
4864 flagged, respectively, for urgent/special attention.
4865 See the section
4866 .Sx "Message states" .
4869 .It Ic folder
4870 (fold) The same as
4871 .Ic file .
4874 .It Ic folders
4875 With no arguments, list the names of the folders in the folder directory.
4876 With an existing folder as an argument,
4877 lists the names of folders below the named folder.
4880 .It Ic Followup
4881 (F) Similar to
4882 .Ic Respond ,
4883 but saves the message in a file named after the local part of the first
4884 recipient's address (instead of in
4885 .Va record Ns ).
4888 .It Ic followup
4889 (fo) Similar to
4890 .Ic respond ,
4891 but saves the message in a file named after the local part of the first
4892 recipient's address (instead of in
4893 .Va record Ns ).
4896 .It Ic followupall
4897 Similar to
4898 .Ic followup ,
4899 but responds to all recipients regardless of the
4900 .Va flipr
4901 variable.
4904 .It Ic followupsender
4905 Similar to
4906 .Ic Followup ,
4907 but responds to the sender only regardless of the
4908 .Va flipr
4909 variable.
4912 .It Ic Forward
4913 Similar to
4914 .Ic forward ,
4915 but saves the message in a file named after the local part of the
4916 recipient's address (instead of in
4917 .Va record Ns ).
4920 .It Ic forward
4921 Takes a message and the address of a recipient
4922 and forwards the message to him.
4923 The text of the original message is included in the new one,
4924 with the value of the
4925 .Va forward-inject-head
4926 variable preceding it.
4927 To filter the included header fields to the desired subset use the
4928 .Ql forward
4929 slot of the white- and blacklisting command
4930 .Ic headerpick .
4931 Only the first part of a multipart message is included unless
4932 .Va forward-as-attachment ,
4933 and recipient addresses will be stripped from comments, names etc.
4934 unless the internal variable
4935 .Va fullnames
4936 is set.
4939 .It Ic from
4940 (f) Takes a list of message specifications and displays a summary of
4941 their message headers, exactly as via
4942 .Ic headers .
4943 An alias of this command is
4944 .Ic search .
4945 Also see
4946 .Sx "Specifying messages" .
4948 .It Ic Fwd
4949 \*(OB Alias for
4950 .Ic Forward .
4952 .It Ic fwd
4953 \*(OB Alias for
4954 .Ic forward .
4956 .It Ic fwdignore
4957 \*(OB Superseded by the multiplexer
4958 .Ic headerpick .
4960 .It Ic fwdretain
4961 \*(OB Superseded by the multiplexer
4962 .Ic headerpick .
4964 .It Ic ghost , unghost
4965 \*(OB Replaced by
4966 .Ic commandalias ,
4967 .Ic uncommandalias .
4971 .It Ic headerpick , unheaderpick
4972 \*(NQ Multiplexer command to manage white- and blacklisting
4973 selections of header fields for a variety of applications.
4974 Without arguments the set of contexts that have settings is displayed.
4975 When given arguments, the first argument is the context to which the
4976 command applies, one of (case-insensitive)
4977 .Ql type
4978 for display purposes (via, e.g.,
4979 .Ic type ) ,
4980 .Ql save
4981 for selecting which headers shall be stored persistently when
4982 .Ic save ,
4983 .Ic copy ,
4984 .Ic move
4985 or even
4986 .Ic decrypt Ns
4987 ing messages (note that MIME related etc. header fields should not be
4988 ignored in order to not destroy usability of the message in this case),
4989 .Ql forward
4990 for stripping down messages when
4991 .Ic forward Ns
4992 ing message (has no effect if
4993 .Va forward-as-attachment
4994 is set), and
4995 .Ql top
4996 for defining user-defined set of fields for the command
4997 .Ic top .
4999 The current settings of the given context are displayed if it is the
5000 only argument.
5001 A second argument denotes the type of restriction that is to be chosen,
5002 it may be (a case-insensitive prefix of)
5003 .Ql retain
5005 .Ql ignore
5006 for white- and blacklisting purposes, respectively.
5007 Establishing a whitelist suppresses inspection of the corresponding
5008 blacklist.
5010 If no further argument is given the current settings of the given type
5011 will be displayed, otherwise the remaining arguments specify header
5012 fields, which \*(OPally may be given as regular expressions, to be added
5013 to the given type.
5014 The special wildcard field (asterisk,
5015 .Ql * )
5016 will establish a (fast) shorthand setting which covers all fields.
5018 The latter command always takes three or more arguments and can be used
5019 to remove selections, i.e., from the given context, the given type of
5020 list, all the given headers will be removed, the special argument
5021 .Ql *
5022 will remove all headers.
5025 .It Ic headers
5026 (h) Show the current group of headers, the size of which depends on
5027 the variable
5028 .Va screen ,
5029 and the style of which can be adjusted with the variable
5030 .Va headline .
5031 If a message-specification is given the group of headers containing the
5032 first message therein is shown and the message at the top of the screen
5033 becomes the new
5034 .Dq dot .
5037 .It Ic help
5038 (hel) A synonym for
5039 .Ic \&? .
5042 .It Ic history
5043 \*(OP Either
5044 .Ar show
5045 (this mode also supports a more
5046 .Va verbose
5047 output) or
5048 .Ar clear
5049 the list of history entries;
5050 a decimal
5051 .Ar NUMBER
5052 argument selects and evaluates the respective history entry,
5053 which will become the new history top; a negative number is used as an
5054 offset to the current command, e.g.,
5055 .Ql -1
5056 will select the last command, the history top.
5057 The default mode if no arguments are given is
5058 .Ar show .
5059 Please see
5060 .Sx "On terminal control and line editor"
5061 for more on this topic.
5064 .It Ic hold
5065 (ho, also
5066 .Ic preserve )
5067 Takes a message list and marks each message therein to be saved in the
5068 user's system
5069 .Va inbox
5070 instead of in the
5071 .Mx -sx
5072 .Sx "secondary mailbox"
5073 .Ev MBOX .
5074 Does not override the
5075 .Ic delete
5076 command.
5077 \*(UA deviates from the POSIX standard with this command, because a
5078 .Ic next
5079 command issued after
5080 .Ic hold
5081 will display the following message, not the current one.
5085 .It Ic if
5086 (i) Part of the nestable
5087 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
5088 conditional execution construct \(em if the given condition is true then
5089 the encapsulated block is executed.
5090 The POSIX standards supports the (case-insensitive) conditions
5091 .Ql r Ns
5092 eceive
5094 .Ql s Ns
5095 end, all remaining conditions are non-portable extensions.
5096 \*(ID These commands do not yet use
5097 .Sx "Shell-style argument quoting"
5098 and therefore do not know about input tokens, so that syntax
5099 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5100 all conditions bracket group wise and consider the tokens, representing
5101 values and operators, therein, which also means that variables will
5102 already have been expanded at that time (just like in the shell).
5104 .Bd -literal -offset indent
5105 if receive
5106   commands ...
5107 else
5108   commands ...
5109 endif
5113 The (case-insensitive) condition
5114 .Ql t Ns
5115 erminal will evaluate to true if the standard input is a terminal, i.e.,
5116 in interactive sessions.
5117 Another condition can be any boolean value (see the section
5118 .Sx "INTERNAL VARIABLES"
5119 for textual boolean representations) to mark an enwrapped block as
5120 .Dq never execute
5122 .Dq always execute .
5123 (It shall be remarked that a faulty condition skips all branches until
5124 .Ic endif . )
5127 (\*(ID In v15
5128 .Sx "Shell-style argument quoting"
5129 will be used, and this command will simply interpret expanded tokens.)
5130 It is possible to check
5131 .Sx "INTERNAL VARIABLES"
5132 as well as
5133 .Sx ENVIRONMENT
5134 variables for existence or compare their expansion against a user given
5135 value or another variable by using the
5136 .Ql $
5137 .Pf ( Dq variable next )
5138 conditional trigger character;
5139 a variable on the right hand side may be signalled using the same
5140 mechanism.
5141 Variable names may be enclosed in a pair of matching braces.
5142 When this mode has been triggered, several operators are available:
5145 Integer operators treat the arguments on the left and right hand side of
5146 the operator as integral numbers and compare them arithmetically.
5147 It is an error if any of the operands is not a valid integer, an empty
5148 argument (which implies it had been quoted) is treated as if it were 0.
5149 Available operators are
5150 .Ql -lt
5151 (less than),
5152 .Ql -le
5153 (less than or equal to),
5154 .Ql -eq
5155 (equal),
5156 .Ql -ne
5157 (not equal),
5158 .Ql -ge
5159 (greater than or equal to), and
5160 .Ql -gt
5161 (greater than).
5164 String data operators compare the left and right hand side according to
5165 their textual content.
5166 Unset variables are treated as the empty string.
5167 The behaviour of string operators can be adjusted by prefixing the
5168 operator with the modifier trigger commercial at
5169 .Ql @ ,
5170 followed by none to multiple modifiers: for now supported is
5171 .Ql i ,
5172 which turns the comparison into a case-insensitive one: this is
5173 implied if no modifier follows the trigger.
5176 Available string operators are
5177 .Ql <
5178 (less than),
5179 .Ql <=
5180 (less than or equal to),
5181 .Ql ==
5182 (equal),
5183 .Ql !=
5184 (not equal),
5185 .Ql >=
5186 (greater than or equal to),
5187 .Ql >
5188 (greater than),
5189 .Ql =%
5190 (is substring of) and
5191 .Ql !%
5192 (is not substring of).
5193 By default these operators work on bytes and (therefore) do not take
5194 into account character set specifics.
5195 If the case-insensitivity modifier has been used, case is ignored
5196 according to the rules of the US-ASCII encoding, i.e., bytes are
5197 still compared.
5200 When the \*(OPal regular expression support is available, the additional
5201 string operators
5202 .Ql =~
5204 .Ql !~
5205 can be used.
5206 They treat the right hand side as an extended regular expression that is
5207 matched according to the active locale (see
5208 .Sx "Character sets" ) ,
5209 i.e., character sets should be honoured correctly.
5212 Conditions can be joined via AND-OR lists (where the AND operator is
5213 .Ql &&
5214 and the OR operator is
5215 .Ql || ) ,
5216 which have equal precedence and will be evaluated with left
5217 associativity, thus using the same syntax that is known for the
5218 .Xr sh 1 .
5219 It is also possible to form groups of conditions and lists by enclosing
5220 them in pairs of brackets
5221 .Ql [\ \&.\&.\&.\ ] ,
5222 which may be interlocked within each other, and also be joined via
5223 AND-OR lists.
5226 The results of individual conditions and entire groups may be modified
5227 via unary operators: the unary operator
5228 .Ql \&!
5229 will reverse the result.
5231 .Bd -literal -offset indent
5232 # (This not in v15, there [ -n "$debug"]!)
5233 if $debug
5234   echo *debug* is set
5235 endif
5236 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
5237   echo *ttycharset* is UTF-8, the former case-sensitive!
5238 endif
5239 set t1=one t2=one
5240 if [ "${t1}" == "${t2}" ]
5241   echo These two variables are equal
5242 endif
5243 if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm\&.*" ]
5244   echo ..in an X terminal
5245 endif
5246 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5247     [ "$verbose" != '' ] ] ]
5248   echo Noisy, noisy
5249 endif
5250 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5251   echo Left associativity, as is known from the shell
5252 endif
5257 .It Ic ignore
5258 (ig) Identical to
5259 .Ic discard .
5260 Superseded by the multiplexer
5261 .Ic headerpick .
5264 .It Ic list
5265 Shows the names of all available commands, alphabetically sorted.
5266 If given any non-whitespace argument the list will be shown in the order
5267 in which command prefixes are searched.
5268 \*(OP In conjunction with a set variable
5269 .Va verbose
5270 additional information will be provided for each command: the argument
5271 type will be indicated, the documentation string will be shown,
5272 and the set of command flags will show up:
5274 .Bl -tag -compact -width ".It Ql BaNg"
5275 .It Ql "vput modifier"
5276 command supports the command modifier
5277 .Cm vput .
5278 .It Ql "errno in *!*"
5279 the error number is tracked in
5280 .Va \&! .
5281 .It Ql "needs box"
5282 commands needs an active mailbox, a
5283 .Ic file .
5284 .It Ql "ok: batch or interactive"
5285 command may only be used in interactive or
5286 .Fl #
5287 batch mode.
5288 .It Ql "ok: send mode"
5289 command can be used in send mode.
5290 .It Ql "not ok: compose mode"
5291 command is not available when in compose mode.
5292 .It Ql "not ok: during startup"
5293 command cannot be used during program startup, e.g., while loading
5294 .Sx "Resource files" .
5295 .It Ql "ok: in subprocess"
5296 command is allowed to be used when running in a subprocess instance,
5297 e.g., from within a macro that is called via
5298 .Va on-compose-splice .
5303 .It Ic localopts
5304 This command can be used to localize changes to (linked)
5305 .Sx ENVIRONMENT
5306 as well as
5307 .Sx "INTERNAL VARIABLES" ,
5308 meaning that their state will be reverted to the former one once the
5309 .Dq covered scope
5310 is left.
5311 It can only be used inside of macro definition blocks introduced by
5312 .Ic account
5314 .Ic define .
5315 The covered scope of an
5316 .Ic account
5317 is left once a different account is activated, and some macros, notably
5318 .Va folder-hook Ns s ,
5319 use their own specific notion of covered scope, here it will be extended
5320 until the folder is left again.
5323 This setting stacks up: i.e., if
5324 .Ql macro1
5325 enables change localization and calls
5326 .Ql macro2 ,
5327 which explicitly resets localization, then any value changes within
5328 .Ql macro2
5329 will still be reverted when the scope of
5330 .Ql macro1
5331 is left.
5332 (Caveats: if in this example
5333 .Ql macro2
5334 changes to a different
5335 .Ic account
5336 which sets some variables that are already covered by localizations,
5337 their scope will be extended, and in fact leaving the
5338 .Ic account
5339 will (thus) restore settings in (likely) global scope which actually
5340 were defined in a local, macro private context!)
5343 This command takes one or two arguments, the optional first one
5344 specifies an attribute that may be one of
5345 .Cm scope ,
5346 which refers to the current scope and is thus the default,
5347 .Cm call ,
5348 which causes any macro that is being
5349 .Ic call Ns
5350 ed to be started with localization enabled by default, as well as
5351 .Cm call-fixate ,
5352 which (if enabled) disallows any called macro to turn off localization:
5353 like this it can be ensured that once the current scope regains control,
5354 any changes made in deeper levels have been reverted.
5355 The latter two are mutually exclusive.
5356 The (second) argument is interpreted as a boolean (string, see
5357 .Sx "INTERNAL VARIABLES" )
5358 and states whether the given attribute shall be turned on or off.
5360 .Bd -literal -offset indent
5361 define temporary_settings {
5362   set possibly_global_option1
5363   localopts on
5364   set local_option1
5365   set local_option2
5366   localopts scope off
5367   set possibly_global_option2
5373 .It Ic Lreply
5374 Reply to messages that come in via known
5375 .Pf ( Ic mlist )
5376 or subscribed
5377 .Pf ( Ic mlsubscribe )
5378 mailing lists, or pretend to do so (see
5379 .Sx "Mailing lists" ) :
5380 on top of the usual
5381 .Ic reply
5382 functionality this will actively resort and even remove message
5383 recipients in order to generate a message that is supposed to be sent to
5384 a mailing list.
5385 For example it will also implicitly generate a
5386 .Ql Mail-Followup-To:
5387 header if that seems useful, regardless of the setting of the variable
5388 .Va followup-to .
5389 For more documentation please refer to
5390 .Sx "On sending mail, and non-interactive mode" .
5393 .It Ic Mail
5394 Similar to
5395 .Ic mail ,
5396 but saves the message in a file named after the local part of the first
5397 recipient's address (instead of in
5398 .Va record Ns ).
5401 .It Ic mail
5402 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5403 or asks on standard input if none were given;
5404 then collects the remaining mail content and sends it out.
5405 For more documentation please refer to
5406 .Sx "On sending mail, and non-interactive mode" .
5409 .It Ic mbox
5410 (mb) The given message list is to be sent to the
5411 .Mx -sx
5412 .Sx "secondary mailbox"
5413 .Ev MBOX
5414 when \*(UA is quit; this is the default action unless the variable
5415 .Va hold
5416 is set.
5417 \*(ID This command can only be used in a
5418 .Mx -sx
5419 .Sx "primary system mailbox" .
5423 .It Ic mimetype , unmimetype
5424 Without arguments the content of the MIME type cache will displayed;
5425 a more verbose listing will be produced if either of
5426 .Va debug
5428 .Va verbose
5429 are set.
5430 When given arguments they will be joined, interpreted as shown in
5431 .Sx "The mime.types files"
5432 (also see
5433 .Sx "HTML mail and MIME attachments" ) ,
5434 and the resulting entry will be added (prepended) to the cache.
5435 In any event MIME type sources are loaded first as necessary \(en
5436 .Va mimetypes-load-control
5437 can be used to fine-tune which sources are actually loaded.
5439 The latter command deletes all specifications of the given MIME type, thus
5440 .Ql ? unmimetype text/plain
5441 will remove all registered specifications for the MIME type
5442 .Ql text/plain .
5443 The special name
5444 .Ql *
5445 will discard all existing MIME types, just as will
5446 .Ql reset ,
5447 but which also reenables cache initialization via
5448 .Va mimetypes-load-control .
5452 .It Ic mlist , unmlist
5453 The latter command removes all given mailing-lists, the special name
5454 .Ql *
5455 can be used to remove all registered lists.
5456 The former will list all currently defined mailing lists (and their
5457 attributes, if any) when used without arguments; a more verbose listing
5458 will be produced if either of
5459 .Va debug
5461 .Va verbose
5462 are set.
5463 Otherwise all given arguments will be added and henceforth be recognized
5464 as mailing lists.
5465 If the \*(OPal regular expression support is available then mailing
5466 lists may also be specified as (extended) regular expressions (see
5467 .Xr re_format 7
5468 for more on those).
5471 .It Ic mimeview
5472 \*(ID Only available in interactive mode, this command allows to display
5473 MIME parts which require external MIME handler programs to run which do
5474 not integrate in \*(UAs normal
5475 .Ic type
5476 output (see
5477 .Sx "HTML mail and MIME attachments" ) .
5478 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5479 The user will be asked for each non-text part of the given message in
5480 turn whether the registered handler shall be used to display the part.
5484 .It Ic mlsubscribe , unmlsubscribe
5485 The latter command removes the subscription attribute from all given
5486 mailing-lists, the special name
5487 .Ql *
5488 can be used to do so for any registered list.
5489 The former will list all currently defined mailing lists which have
5490 a subscription attribute when used without arguments; a more verbose
5491 listing will be produced if either of
5492 .Va debug
5494 .Va verbose
5495 are set.
5496 Otherwise this attribute will be set for all given mailing lists,
5497 newly creating them as necessary (as via
5498 .Ic mlist ) .
5499 Also see
5500 .Va followup-to .
5503 .It Ic Move
5504 Similar to
5505 .Ic move ,
5506 but moves the messages to a file named after the local part of the
5507 sender address of the first message (instead of in
5508 .Va record Ns ).
5511 .It Ic move
5512 Acts like
5513 .Ic copy
5514 but marks the messages for deletion if they were transferred
5515 successfully.
5518 .It Ic More
5519 Like
5520 .Ic more ,
5521 but also displays header fields which would not pass the
5522 .Ic headerpick
5523 selection, and all MIME parts.
5524 Identical to
5525 .Ic Page .
5528 .It Ic more
5529 Invokes the
5530 .Ev PAGER
5531 on the given messages, even in non-interactive mode and as long as the
5532 standard output is a terminal.
5533 Identical to
5534 .Ic page .
5537 .It Ic netrc
5538 \*(OP When used without arguments or if
5539 .Ar show
5540 has been given the content of the
5541 .Pa .netrc
5542 cache is shown, loading it first as necessary.
5543 If the argument is
5544 .Ar load
5545 then the cache will only be initialized and
5546 .Ar clear
5547 will remove its contents.
5548 Note that \*(UA will try to load the file only once, use
5549 .Ql Ic \&\&netrc Ns \:\0\:clear
5550 to unlock further attempts.
5552 .Va netrc-lookup ,
5553 .Va netrc-pipe
5554 and the section
5555 .Sx "On URL syntax and credential lookup" ;
5556 the section
5557 .Sx "The .netrc file"
5558 documents the file format in detail.
5561 .It Ic newmail
5562 Checks for new mail in the current folder without committing any changes
5563 before.
5564 If new mail is present, a message is shown.
5565 If the
5566 .Va header
5567 variable is set,
5568 the headers of each new message are also shown.
5569 This command is not available for all mailbox types.
5572 .It Ic next
5573 (n) (like
5574 .Ql +
5576 .Dq ENTER )
5577 Goes to the next message in sequence and types it.
5578 With an argument list, types the next matching message.
5581 .It Ic New
5582 Same as
5583 .Ic Unread .
5586 .It Ic new
5587 Same as
5588 .Ic unread .
5591 .It Ic noop
5592 If the current folder is accessed via a network connection, a
5593 .Dq NOOP
5594 command is sent, otherwise no operation is performed.
5597 .It Ic Page
5598 Like
5599 .Ic page ,
5600 but also displays header fields which would not pass the
5601 .Ic headerpick
5602 selection, and all MIME parts.
5603 Identical to
5604 .Ic More .
5607 .It Ic page
5608 Invokes the
5609 .Ev PAGER
5610 on the given messages, even in non-interactive mode and as long as the
5611 standard output is a terminal.
5612 Identical to
5613 .Ic more .
5616 .It Ic Pipe
5617 Like
5618 .Ic pipe
5619 but also pipes header fields which would not pass the
5620 .Ic headerpick
5621 selection, and all parts of MIME
5622 .Ql multipart/alternative
5623 messages.
5626 .It Ic pipe
5627 (pi) Takes a message list and a shell command
5628 and pipes the messages through the command.
5629 Without an argument the current message is piped through the command
5630 given by the
5631 .Va cmd
5632 variable.
5633 If the
5634 .Va page
5635 variable is set,
5636 every message is followed by a formfeed character.
5639 .It Ic preserve
5640 (pre) A synonym for
5641 .Ic hold .
5644 .It Ic Print
5645 (P) Alias for
5646 .Ic Type .
5649 .It Ic print
5650 (p) Research
5652 equivalent of
5653 .Ic type .
5656 .It Ic quit
5657 (q) Terminates the session, saving all undeleted, unsaved messages in
5658 the current
5659 .Mx -sx
5660 .Sx "secondary mailbox"
5661 .Ev MBOX ,
5662 preserving all messages marked with
5663 .Ic hold
5665 .Ic preserve
5666 or never referenced in the system
5667 .Va inbox ,
5668 and removing all other messages from the
5669 .Mx -sx
5670 .Sx "primary system mailbox" .
5671 If new mail has arrived during the session,
5672 the message
5673 .Dq You have new mail
5674 will be shown.
5675 If given while editing a mailbox file with the command line option
5676 .Fl f ,
5677 then the edit file is rewritten.
5678 A return to the shell is effected,
5679 unless the rewrite of edit file fails,
5680 in which case the user can escape with the exit command.
5681 The optional status number argument will be passed through to
5682 .Xr exit 3 .
5683 \*(ID For now it can happen that the given status will be overwritten,
5684 later this will only occur if a later error needs to be reported onto an
5685 otherwise success indicating status.
5688 .It Ic read
5689 \*(NQ Read a line from standard input, or the channel set active via
5690 .Ic readctl ,
5691 and assign the data, which will be splitted as indicated by
5692 .Va ifs ,
5693 to the given variables.
5694 The variable names are checked by the same rules as documented for
5695 .Cm vput ,
5696 and the same error codes will be seen in
5697 .Va \&! ;
5698 the exit status
5699 .Va \&?
5700 indicates the number of bytes read, it will be
5701 .Ql -1
5702 with the error number
5703 .Va \&!
5704 set to
5705 .Va ^ERR Ns -BADF
5706 in case of I/O errors, or
5707 .Va ^ERR Ns -NONE
5708 upon End-Of-File.
5709 If there are more fields than variables, assigns successive fields to the
5710 last given variable.
5711 If there are less fields than variables, assigns the empty string to the
5712 remains.
5713 .Bd -literal -offset indent
5714 ? read a b c
5715    H  e  l  l  o
5716 ? echo "<$a> <$b> <$c>"
5717 <H> <e> <l  l  o>
5718 ? wysh set ifs=:; read a b c;unset ifs
5719 hey2.0,:"'you    ",:world!:mars.:
5720 ? echo $?/$^ERRNAME / <$a><$b><$c>
5721 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5725 .It Ic readctl
5726 \*(NQ Manages input channels for
5727 .Ic read ,
5728 to be used to avoid complicated or impracticable code, like calling
5729 .Ic \&\&read
5730 from within a macro in non-interactive mode.
5731 Without arguments, or when the first argument is
5732 .Cm show ,
5733 a listing of all known channels is printed.
5734 Channels can otherwise be
5735 .Cm create Ns
5736 d, and existing channels can be
5737 .Cm set
5738 active and
5739 .Cm remove Ns
5740 d by giving the string used for creation.
5742 The channel name is expected to be a file descriptor number, or,
5743 if parsing the numeric fails, an input file name that undergoes
5744 .Sx "Filename transformations" .
5745 E.g. (this example requires a modern shell):
5746 .Bd -literal -offset indent
5747 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
5748   LC_ALL=C \*(uA -R#
5749 hey, you
5750 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
5751   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
5752 hey, you
5755 .It Ic redirect
5756 \*(OB Same as
5757 .Ic resend .
5759 .It Ic Redirect
5760 \*(OB Same as
5761 .Ic Resend .
5764 .It Ic remove
5765 Removes the named files or directories.
5766 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
5767 type specific removal will be performed, deleting the complete mailbox.
5768 The user is asked for confirmation in interactive mode.
5771 .It Ic rename
5772 Takes the name of an existing folder
5773 and the name for the new folder
5774 and renames the first to the second one.
5775 Both folders must be of the same type.
5778 .It Ic Reply
5779 (R) Replies to only the sender of each message of the given message
5780 list, by using the first message as the template to quote, for the
5781 .Ql Subject:
5782 etc.
5783 .Va flipr
5784 will exchange this command with
5785 .Ic reply .
5786 Unless the internal variable
5787 .Va fullnames
5788 is set the recipient address will be stripped from comments, names etc.
5791 .It Ic reply
5792 (r) Take a message and group-responds to it by addressing the sender
5793 and all recipients, subject to
5794 .Ic alternates
5795 processing.
5796 .Va followup-to ,
5797 .Va followup-to-honour ,
5798 .Va reply-to-honour
5799 as well as
5800 .Va recipients-in-cc
5801 influence response behaviour.
5802 Unless the internal variable
5803 .Va fullnames
5804 is set recipient addresses will be stripped from comments, names etc.
5806 .Va flipr
5807 is set the commands
5808 .Ic Reply
5810 .Ic reply
5811 are exchanged.
5812 The command
5813 .Ic Lreply
5814 offers special support for replying to mailing lists.
5815 For more documentation please refer to
5816 .Sx "On sending mail, and non-interactive mode" .
5819 .It Ic replyall
5820 Similar to
5821 .Ic reply ,
5822 but initiates a group-reply regardless of the value of
5823 .Va flipr .
5826 .It Ic replysender
5827 Similar to
5828 .Ic Reply ,
5829 but responds to the sender only regardless of the value of
5830 .Va flipr .
5833 .It Ic Resend
5834 Like
5835 .Ic resend ,
5836 but does not add any header lines.
5837 This is not a way to hide the sender's identity,
5838 but useful for sending a message again to the same recipients.
5841 .It Ic resend
5842 Takes a list of messages and a user name
5843 and sends each message to the named user.
5844 .Ql Resent-From:
5845 and related header fields are prepended to the new copy of the message.
5846 Saving in
5847 .Va record
5848 is only performed if
5849 .Va record-resent
5850 is set.
5853 .It Ic Respond
5854 Same as
5855 .Ic Reply .
5858 .It Ic respond
5859 Same as
5860 .Ic reply .
5863 .It Ic respondall
5864 Same as
5865 .Ic replyall .
5868 .It Ic respondsender
5869 Same as
5870 .Ic replysender .
5873 .It Ic retain
5874 (ret) Superseded by the multiplexer
5875 .Ic headerpick .
5878 .It Ic return
5879 Only available inside the scope of a
5880 .Ic define Ns
5881 d macro or an
5882 .Ic account ,
5883 this will stop evaluation of any further macro content, and return
5884 execution control to the caller.
5885 The two optional parameters must be specified as positive decimal
5886 numbers and default to the value 0:
5887 the first argument specifies the signed 32-bit return value (stored in
5888 .Va \&?
5889 \*(ID and later extended to signed 64-bit),
5890 the second the signed 32-bit error number (stored in
5891 .Va \&! ) .
5892 As documented for
5893 .Va \&?
5894 a non-0 exit status may cause the program to exit.
5897 .It Ic Save
5898 (S) Similar to
5899 .Ic save,
5900 but saves the messages in a file named after the local part of the
5901 sender of the first message instead of (in
5902 .Va record
5903 and) taking a filename argument; the variable
5904 .Va outfolder
5905 is inspected to decide on the actual storage location.
5908 .It Ic save
5909 (s) Takes a message list and a filename and appends each message in turn
5910 to the end of the file.
5911 If no filename is given, the
5912 .Mx -sx
5913 .Sx "secondary mailbox"
5914 .Ev MBOX
5915 is used.
5916 The filename in quotes, followed by the generated character count
5917 is echoed on the user's terminal.
5918 If editing a
5919 .Mx -sx
5920 .Sx "primary system mailbox"
5921 the messages are marked for deletion.
5922 .Sx "Filename transformations"
5923 will be applied.
5925 .It Ic savediscard
5926 \*(OB Superseded by the multiplexer
5927 .Ic headerpick .
5929 .It Ic saveignore
5930 \*(OB Superseded by the multiplexer
5931 .Ic headerpick .
5933 .It Ic saveretain
5934 \*(OB Superseded by the multiplexer
5935 .Ic headerpick .
5938 .It Ic search
5939 Takes a message specification (list) and displays a header summary of
5940 all matching messages, as via
5941 .Ic headers .
5942 This command is an alias of
5943 .Ic from .
5944 Also see
5945 .Sx "Specifying messages" .
5948 .It Ic seen
5949 Takes a message list and marks all messages as having been read.
5954 .It Ic set , unset
5955 (se, \*(NQ uns) The latter command will delete all given variables,
5956 the former, when used without arguments, will show all variables which
5957 are currently known to \*(UA.
5958 A more verbose listing will be produced if
5959 either of
5960 .Va debug
5962 .Va verbose
5963 are set.
5964 Remarks: the list mode will not automatically link-in known
5965 .Sx ENVIRONMENT
5966 variables, but only explicit addressing will, e.g., via
5967 .Ic varshow ,
5968 using a variable in an
5969 .Ic if
5970 condition or a string passed to
5971 .Ic echo ,
5972 explicit
5973 .Ic set Ns
5974 ting, as well as some program-internal use cases.
5977 Otherwise the given variables (and arguments) are set or adjusted.
5978 Arguments are of the form
5979 .Ql name=value
5980 (no space before or after
5981 .Ql = ) ,
5982 or plain
5983 .Ql name
5984 if there is no value, i.e., a boolean variable.
5985 \*(ID In conjunction with the
5986 .Cm wysh
5987 command prefix
5988 .Sx "Shell-style argument quoting"
5989 can be used to quote arguments as necessary.
5990 \*(ID Otherwise quotation marks may be placed around any part of the
5991 assignment statement to quote blanks or tabs.
5994 .Dl ? wysh set indentprefix=' -> '
5997 If an argument begins with
5998 .Ql no ,
5999 as in
6000 .Ql set nosave ,
6001 the effect is the same as invoking the
6002 .Ic unset
6003 command with the remaining part of the variable
6004 .Pf ( Ql unset save ) .
6008 .Ql name
6009 that is known to map to an environment variable will automatically cause
6010 updates in the program environment (unsetting a variable in the
6011 environment requires corresponding system support) \(em use the command
6012 .Ic environ
6013 for further environmental control.
6014 Also see
6015 .Ic varedit ,
6016 .Ic varshow
6017 and the sections
6018 .Sx "INTERNAL VARIABLES"
6020 .Sx ENVIRONMENT .
6024 .It Ic shcodec
6025 Apply shell quoting rules to the given raw-data arguments.
6026 Supports
6027 .Cm vput
6028 (see
6029 .Sx "Command modifiers" ) .
6030 The first argument specifies the operation:
6031 .Ar [+]e[ncode]
6033 .Ar d[ecode]
6034 cause shell quoting to be applied to the remains of the line, and
6035 expanded away thereof, respectively.
6036 If the former is prefixed with a plus-sign, the quoted result will not
6037 be roundtrip enabled, and thus can be decoded only in the very same
6038 environment that was used to perform the encode; also see
6039 .Cd mle-quote-rndtrip .
6040 If the coding operation fails the error number
6041 .Va \&!
6042 is set to
6043 .Va ^ERR Ns -CANCELED ,
6044 and the unmodified input is used as the result; the error number may
6045 change again due to output or result storage errors.
6048 .It Ic shell
6049 \*(NQ (sh) Invokes an interactive version of the shell,
6050 and returns its exit status.
6054 .It Ic shortcut , unshortcut
6055 Without arguments the list of all currently defined shortcuts is
6056 shown, with one argument the expansion of the given shortcut.
6057 Otherwise all given arguments are treated as pairs of shortcuts and
6058 their expansions, creating new or changing already existing shortcuts,
6059 as necessary.
6060 The latter command will remove all given shortcuts, the special name
6061 .Ql *
6062 will remove all registered shortcuts.
6065 .It Ic shift
6066 \*(NQ Shift the positional parameter stack (starting at
6067 .Va 1 )
6068 by the given number (which must be a positive decimal),
6069 or 1 if no argument has been given.
6070 It is an error if the value exceeds the number of positional parameters.
6071 If the given number is 0, no action is performed, successfully.
6072 The stack as such can be managed via
6073 .Ic vpospar .
6074 Note this command will fail in
6075 .Ic account
6076 and hook macros unless the positional parameter stack has been
6077 explicitly created in the current context via
6078 .Ic vpospar .
6081 .It Ic show
6082 Like
6083 .Ic type ,
6084 but performs neither MIME decoding nor decryption, so that the raw
6085 message text is shown.
6088 .It Ic size
6089 (si) Shows the size in characters of each message of the given
6090 message-list.
6093 .It Ic sleep
6094 \*(NQ Sleep for the specified number of seconds (and optionally
6095 milliseconds), by default interruptably.
6096 If a third argument is given the sleep will be uninterruptible,
6097 otherwise the error number
6098 .Va \&!
6099 will be set to
6100 .Va ^ERR Ns -INTR
6101 if the sleep has been interrupted.
6102 The command will fail and the error number will be
6103 .Va ^ERR Ns -OVERFLOW
6104 if the given duration(s) overflow the time datatype, and
6105 .Va ^ERR Ns -INVAL
6106 if the given durations are no valid integers.
6111 .It Ic sort , unsort
6112 The latter command disables sorted or threaded mode, returns to normal
6113 message order and, if the
6114 .Va header
6115 variable is set,
6116 displays a header summary.
6117 The former command shows the current sorting criterion when used without
6118 an argument, but creates a sorted representation of the current folder
6119 otherwise, and changes the
6120 .Ic next
6121 command and the addressing modes such that they refer to messages in
6122 the sorted order.
6123 Message numbers are the same as in regular mode.
6124 If the
6125 .Va header
6126 variable is set,
6127 a header summary in the new order is also displayed.
6128 Automatic folder sorting can be enabled by setting the
6129 .Va autosort
6130 variable, as in, e.g.,
6131 .Ql set autosort=thread .
6132 Possible sorting criterions are:
6135 .Bl -tag -compact -width "subject"
6136 .It Ar date
6137 Sort the messages by their
6138 .Ql Date:
6139 field, that is by the time they were sent.
6140 .It Ar from
6141 Sort messages by the value of their
6142 .Ql From:
6143 field, that is by the address of the sender.
6144 If the
6145 .Va showname
6146 variable is set, the sender's real name (if any) is used.
6147 .It Ar size
6148 Sort the messages by their size.
6149 .It spam
6150 \*(OP Sort the message by their spam score, as has been classified by
6151 .Ic spamrate .
6152 .It Ar status
6153 Sort the messages by their message status.
6154 .It Ar subject
6155 Sort the messages by their subject.
6156 .It Ar thread
6157 Create a threaded display.
6158 .It Ar to
6159 Sort messages by the value of their
6160 .Ql To:
6161 field, that is by the address of the recipient.
6162 If the
6163 .Va showname
6164 variable is set, the recipient's real name (if any) is used.
6169 .It Ic source
6170 \*(NQ (so) The source command reads commands from the given file.
6171 .Sx "Filename transformations"
6172 will be applied.
6173 If the given expanded argument ends with a vertical bar
6174 .Ql |
6175 then the argument will instead be interpreted as a shell command and
6176 \*(UA will read the output generated by it.
6177 Interpretation of commands read is stopped when an error is encountered.
6178 \*(ID Note that
6179 .Ic \&\&source
6180 cannot be used from within macros that execute as
6181 .Va folder-hook Ns s
6183 .Ic account Ns s ,
6184 i.e., it can only be called from macros that were
6185 .Ic call Ns ed .
6188 .It Ic source_if
6189 \*(NQ The difference to
6190 .Ic source
6191 (beside not supporting pipe syntax aka shell command input) is that
6192 this command will not generate an error nor warn if the given file
6193 argument cannot be opened successfully.
6196 .It Ic spamclear
6197 \*(OP Takes a list of messages and clears their
6198 .Ql is-spam
6199 flag.
6202 .It Ic spamforget
6203 \*(OP Takes a list of messages and causes the
6204 .Va spam-interface
6205 to forget it has ever used them to train its Bayesian filter.
6206 Unless otherwise noted the
6207 .Ql is-spam
6208 flag of the message is inspected to chose whether a message shall be
6209 forgotten to be
6210 .Dq ham
6212 .Dq spam .
6215 .It Ic spamham
6216 \*(OP Takes a list of messages and informs the Bayesian filter of the
6217 .Va spam-interface
6218 that they are
6219 .Dq ham .
6220 This also clears the
6221 .Ql is-spam
6222 flag of the messages in question.
6225 .It Ic spamrate
6226 \*(OP Takes a list of messages and rates them using the configured
6227 .Va spam-interface ,
6228 without modifying the messages, but setting their
6229 .Ql is-spam
6230 flag as appropriate; because the spam rating headers are lost the rate
6231 will be forgotten once the mailbox is left.
6232 Refer to the manual section
6233 .Sx "Handling spam"
6234 for the complete picture of spam handling in \*(UA.
6237 .It Ic spamset
6238 \*(OP Takes a list of messages and sets their
6239 .Ql is-spam
6240 flag.
6243 .It Ic spamspam
6244 \*(OP Takes a list of messages and informs the Bayesian filter of the
6245 .Va spam-interface
6246 that they are
6247 .Dq spam .
6248 This also sets the
6249 .Ql is-spam
6250 flag of the messages in question.
6252 .It Ic thread
6253 \*(OB The same as
6254 .Ql sort thread
6255 (consider using a
6256 .Ql commandalias
6257 as necessary).
6260 .It Ic Top
6261 Like
6262 .Ic top
6263 but always uses the
6264 .Ic headerpick
6265 .Ql type
6266 slot for white- and blacklisting header fields.
6269 .It Ic top
6270 (to) Takes a message list and types out the first
6271 .Va toplines
6272 lines of each message on the users' terminal.
6273 Unless a special selection has been established for the
6274 .Ql top
6275 slot of the
6276 .Ic headerpick
6277 command, the only header fields that are displayed are
6278 .Ql From: ,
6279 .Ql To: ,
6280 .Ql CC: ,
6282 .Ql Subject: .
6283 .Ic Top
6284 will always use the
6285 .Ql type
6286 .Ic headerpick
6287 selection instead.
6288 It is possible to apply compression to what is displayed by setting
6289 .Va topsqueeze .
6290 Messages are decrypted and converted to the terminal character set
6291 if necessary.
6294 .It Ic touch
6295 (tou) Takes a message list and marks the messages for saving in the
6296 .Mx -sx
6297 .Sx "secondary mailbox"
6298 .Ev MBOX .
6299 \*(UA deviates from the POSIX standard with this command,
6300 as a following
6301 .Ic next
6302 command will display the following message instead of the current one.
6305 .It Ic Type
6306 (T) Like
6307 .Ic type
6308 but also displays header fields which would not pass the
6309 .Ic headerpick
6310 selection, and all visualizable parts of MIME
6311 .Ql multipart/alternative
6312 messages.
6315 .It Ic type
6316 (t) Takes a message list and types out each message on the users terminal.
6317 The display of message headers is selectable via
6318 .Ic headerpick .
6319 For MIME multipart messages, all parts with a content type of
6320 .Ql text ,
6321 all parts which have a registered MIME type handler (see
6322 .Sx "HTML mail and MIME attachments" )
6323 which produces plain text output, and all
6324 .Ql message
6325 parts are shown, others are hidden except for their headers.
6326 Messages are decrypted and converted to the terminal character set
6327 if necessary.
6328 The command
6329 .Ic mimeview
6330 can be used to display parts which are not displayable as plain text.
6332 .It Ic unaccount
6334 .Ic account .
6336 .It Ic unalias
6337 (una) See
6338 .Ic alias .
6340 .It Ic unanswered
6342 .Ic answered .
6344 .It Ic unbind
6346 .Ic bind .
6348 .It Ic uncollapse
6350 .Ic collapse .
6352 .It Ic uncolour
6354 .Ic colour .
6356 .It Ic undefine
6358 .Ic define .
6360 .It Ic undelete
6362 .Ic delete .
6364 .It Ic undraft
6366 .Ic draft .
6368 .It Ic unflag
6370 .Ic flag .
6372 .It Ic unfwdignore
6373 \*(OB Superseded by the multiplexer
6374 .Ic headerpick .
6376 .It Ic unfwdretain
6377 \*(OB Superseded by the multiplexer
6378 .Ic headerpick .
6381 .It Ic unignore
6382 Superseded by the multiplexer
6383 .Ic headerpick .
6385 .It Ic unmimetype
6387 .Ic mimetype .
6389 .It Ic unmlist
6391 .Ic mlist .
6393 .It Ic unmlsubscribe
6395 .Ic mlsubscribe .
6398 .It Ic Unread
6399 Same as
6400 .Ic unread .
6403 .It Ic unread
6404 Takes a message list and marks each message as not having been read.
6407 .It Ic unretain
6408 Superseded by the multiplexer
6409 .Ic headerpick .
6411 .It Ic unsaveignore
6412 \*(OB Superseded by the multiplexer
6413 .Ic headerpick .
6415 .It Ic unsaveretain
6416 \*(OB Superseded by the multiplexer
6417 .Ic headerpick .
6419 .It Ic unset
6420 \*(NQ (uns) See
6421 .Ic set .
6423 .It Ic unshortcut
6425 .Ic shortcut .
6427 .It Ic unsort
6429 .Ic short .
6431 .It Ic unthread
6432 \*(OB
6433 Same as
6434 .Ic unsort .
6437 .It Ic urlcodec
6438 Perform URL percent codec operations on the raw-data argument, rather
6439 according to RFC 3986.
6440 Supports
6441 .Cm vput
6442 (see
6443 .Sx "Command modifiers" ) ,
6444 and manages the error number
6445 .Va \&! .
6446 This is a character set agnostic and thus locale dependent operation,
6447 and it may decode bytes which are invalid in the current
6448 .Va ttycharset .
6449 \*(ID This command does not know about URLs beside that.
6451 The first argument specifies the operation:
6452 .Ar e[ncode]
6454 .Ar d[ecode]
6455 perform plain URL percent en- and decoding, respectively.
6456 .Ar p[ath]enc[ode]
6458 .Ar p[ath]dec[ode]
6459 perform a slightly modified operation which should be better for
6460 pathnames: it does not allow a tilde
6461 .Ql ~ ,
6462 and will neither accept hyphen-minus
6463 .Ql -
6464 nor dot
6465 .Ql .
6466 as an initial character.
6467 The remains of the line form the URL data which is to be converted.
6468 If the coding operation fails the error number
6469 .Va \&!
6470 is set to
6471 .Va ^ERR Ns -CANCELED ,
6472 and the unmodified input is used as the result; the error number may
6473 change again due to output or result storage errors.
6476 .It Ic varedit
6477 \*(NQ Edit the values of or create the given variable(s) in the
6478 .Ev EDITOR .
6479 Boolean variables cannot be edited, and variables can also not be
6480 .Ic unset
6481 with this command.
6484 .It Ic varshow
6485 \*(NQ This command produces the same output as the listing mode of
6486 .Ic set ,
6487 including
6488 .Va verbose Ns
6489 ity adjustments, but only for the given variables.
6492 .It Ic verify
6493 \*(OP Takes a message list and verifies each message.
6494 If a message is not a S/MIME signed message,
6495 verification will fail for it.
6496 The verification process checks if the message was signed using a valid
6497 certificate,
6498 if the message sender's email address matches one of those contained
6499 within the certificate,
6500 and if the message content has been altered.
6503 .It Ic version
6504 Shows the
6505 .Va version
6507 .Va features
6508 of \*(UA.
6512 .It Ic vexpr
6513 \*(NQ Evaluate arguments according to a given operator.
6514 This is a multiplexer command which can be used to perform signed 64-bit
6515 numeric calculations as well as byte string and string operations.
6516 It uses polish notation, i.e., the operator is the first argument and
6517 defines the number and type, and the meaning of the remaining arguments.
6518 An empty argument is replaced with a 0 if a number is expected.
6519 Supports
6520 .Cm vput
6521 (see
6522 .Sx "Command modifiers" ) .
6525 The result that is shown in case of errors is always
6526 .Ql -1
6527 for usage errors and numeric operations, and the empty string for byte
6528 string and string operations;
6529 if the latter two fail to provide result data for
6530 .Dq soft
6531 errors, e.g., when a search operation failed, they also set the
6532 .Va \&!
6533 error number to
6534 .Va ^ERR Ns -NODATA .
6535 Except when otherwise noted numeric arguments are parsed as signed 64-bit
6536 numbers, and errors will be reported in the error number
6537 .Va \&!
6538 as the numeric error
6539 .Va ^ERR Ns -RANGE .
6542 Numeric operations work on one or two signed 64-bit integers.
6543 One integer is expected by assignment (equals sign
6544 .Ql = ) ,
6545 which does nothing but parsing the argument, thus detecting validity and
6546 possible overflow conditions, and unary not (tilde
6547 .Ql ~ ) ,
6548 which creates the bitwise complement.
6549 Two integers are used by addition (plus sign
6550 .Ql + ) ,
6551 subtraction (hyphen-minus
6552 .Ql - ) ,
6553 multiplication (asterisk
6554 .Ql * ) ,
6555 division (solidus
6556 .Ql / )
6557 and modulo (percent sign
6558 .Ql % ) ,
6559 as well as for the bitwise operators logical or (vertical bar
6560 .Ql | ,
6561 to be quoted) ,
6562 bitwise and (ampersand
6563 .Ql \&& ,
6564 to be quoted) ,
6565 bitwise xor (circumflex
6566 .Ql ^ ) ,
6567 the bitwise signed left- and right shifts
6568 .Pf ( Ql << ,
6569 .Ql >> ) ,
6570 as well as for the unsigned right shift
6571 .Ql >>> .
6574 All numeric operators can be suffixed with a commercial at
6575 .Ql @ ,
6576 e.g.,
6577 .Ql *@ :
6578 this will turn the operation into a saturated one, which means that
6579 overflow errors and division and modulo by zero are no longer reported
6580 via the exit status, but the result will linger at the minimum or
6581 maximum possible value, instead of overflowing (or trapping).
6582 This is true also for the argument parse step.
6583 For the bitwise shifts, the saturated maximum is 63.
6584 Any catched overflow will be reported via the error number
6585 .Va \&!
6587 .Va ^ERR Ns -OVERFLOW .
6590 Character set agnostic string functions have no notion of locale
6591 settings and character sets.
6592 There is
6593 .Ql file-expand ,
6594 which performs the usual
6595 .Sx "Filename transformations"
6596 on its argument, and
6597 .Ql random ,
6598 which generates a random string of the given length, or of
6599 .Dv \&\&PATH_MAX
6600 bytes (a constant from
6601 .Pa /usr/include )
6602 if the value 0 is given; the random string will be base64url encoded
6603 according to RFC 4648, and thus be usable as a (portable) filename.
6606 Byte string operations work on 8-bit bytes and have no notion of locale
6607 settings and character sets, effectively assuming ASCII data.
6608 Operations that take one argument are
6609 .Ql length ,
6610 which queries the length of the given argument, and
6611 .Ql hash ,
6612 which calculates the Chris Torek hash of the given argument.
6615 Byte string operations with two or more arguments are
6616 .Ql find ,
6617 which byte-searches in the first for the second argument, and shows the
6618 resulting 0-based offset shall it have been found,
6619 .Ql ifind ,
6620 which is identical to
6621 .Ql find ,
6622 but works case-insensitively according to the rules of the ASCII
6623 character set.
6624 .Ql substring
6625 will show a substring of its first argument:
6626 the second argument is the 0-based starting offset, the optional third
6627 argument can be used to specify the length of the desired substring,
6628 by default the entire string is used;
6629 this operation tries to work around faulty arguments (set
6630 .Va verbose
6631 for error logs), but reports them via the error number
6632 .Va \&!
6634 .Va ^ERR Ns -OVERFLOW .
6637 String operations work, sufficient support provided, according to the
6638 active user's locale encoding and character set (see
6639 .Sx "Character sets" ) .
6640 There is the one argument operation
6641 .Ql makeprint ,
6642 which (one-way) converts the argument to something safely printable on
6643 the terminal.
6646 \*(OP
6647 .Ql regex
6648 is a string operation that will try to match the first argument with the
6649 regular expression given as the second argument, as does
6650 .Ql iregex ,
6651 but which is case-insensitive.
6652 If the optional third argument has been given then instead of showing
6653 the match offset a replacement operation is performed:
6654 the third argument is treated as if specified via dollar-single-quote
6655 (see
6656 .Sx "Shell-style argument quoting" ) ,
6657 and any occurrence of a positional parameter, e.g.,
6658 .Va 1 ,
6659 is replaced by the corresponding match group of the regular expression.
6661 .Bd -literal -offset indent
6662 ? vexpr -@ +1 -9223372036854775808
6663 ? vput vexpr res ir bananarama (.*)NanA(.*) '\e${1}au\e$2'
6664 ? echo $0 $res
6669 .It Ic vpospar
6670 \*(NQ Manage the positional parameter stack (see
6671 .Va 1 , # , * , @
6672 as well as
6673 .Ic shift ) .
6674 If the first argument is
6675 .Ql clear ,
6676 then the positional parameter stack of the current context, or the
6677 global one, if there is none, is cleared.
6678 If it is
6679 .Ql set ,
6680 then the remaining arguments will be used to (re)create the stack,
6681 if the parameter stack size limit is excessed an
6682 .Va ^ERR Ns -OVERFLOW
6683 error will occur.
6686 If the first argument is
6687 .Ql quote ,
6688 a round-trip capable representation of the stack contents is created,
6689 with each quoted parameter separated from each other with the first
6690 character of
6691 .Va ifs ,
6692 and followed by the first character of
6693 .Va if-ws ,
6694 if that is not empty and not identical to the first.
6695 If that results in no separation at all a
6696 .Cm space
6697 character is used.
6698 This mode supports
6699 .Cm vput
6700 (see
6701 .Sx "Command modifiers" ) .
6702 I.e., the subcommands
6703 .Ql set
6705 .Ql quote
6706 can be used (in conjunction with
6707 .Ic eval )
6708 to (re)create an argument stack from and to a single variable losslessly.
6710 .Bd -literal -offset indent
6711 ? vpospar set hey, "'you    ", world!
6712 ? echo $#: <${1}><${2}><${3}>
6713 ? vput vpospar x quote
6714 ? vpospar clear
6715 ? echo $#: <${1}><${2}><${3}>
6716 ? eval vpospar set ${x}
6717 ? echo $#: <${1}><${2}><${3}>
6722 .It Ic visual
6723 (v) Takes a message list and invokes the display editor on each message.
6724 Modified contents are discarded unless the
6725 .Va writebackedited
6726 variable is set, and are not used unless the mailbox can be written to
6727 and the editor returns a successful exit status.
6730 .It Ic write
6731 (w) For conventional messages the body without all headers is written.
6732 The original message is never marked for deletion in the originating
6733 mail folder.
6734 The output is decrypted and converted to its native format as necessary.
6735 If the output file exists, the text is appended.
6736 If a message is in MIME multipart format its first part is written to
6737 the specified file as for conventional messages, handling of the remains
6738 depends on the execution mode.
6739 No special handling of compressed files is performed.
6741 In interactive mode the user is consecutively asked for the filenames of
6742 the processed parts.
6743 For convience saving of each part may be skipped by giving an empty
6744 value, the same result as writing it to
6745 .Pa /dev/null .
6746 Shell piping the part content by specifying a leading vertical bar
6747 .Ql |
6748 character for the filename is supported.
6749 Other user input undergoes the usual
6750 .Sx "Filename transformations" ,
6751 and contents of the destination file are overwritten if the file
6752 previously existed.
6754 \*(ID In non-interactive mode any part which does not specify a filename
6755 is ignored, and suspicious parts of filenames of the remaining parts are
6756 URL percent encoded (as via
6757 .Ic urlcodec )
6758 to prevent injection of malicious character sequences, resulting in
6759 a filename that will be written into the current directory.
6760 Existing files will not be overwritten, instead the part number or
6761 a dot are appended after a number sign
6762 .Ql #
6763 to the name until file creation succeeds (or fails due to other
6764 reasons).
6767 .It Ic xcall
6768 \*(NQ The sole difference to
6769 .Ic call
6770 is that the new macro is executed in place of the current one, which
6771 will not regain control: all resources of the current macro will be
6772 released first.
6773 This implies that
6774 .Ic localopts
6775 may become cleaned up if the teared down macro context is the outermost
6776 level of the cleanup stack.
6777 If this command is not used from within a
6778 .Ic call Ns
6779 ed macro it will silently be (a more expensive variant of)
6780 .Ic call .
6783 .It Ic xit
6784 (x) A synonym for
6785 .Ic exit .
6788 .It Ic z
6789 \*(NQ \*(UA presents message headers in
6790 .Va screen Ns
6791 fuls as described under the
6792 .Ic headers
6793 command.
6794 Without arguments this command scrolls to the next window of messages,
6795 likewise if the argument is
6796 .Ql + .
6797 An argument of
6798 .Ql -
6799 scrolls to the last,
6800 .Ql ^
6801 scrolls to the first, and
6802 .Ql $
6803 to the last
6804 .Va \&\&screen
6805 of messages.
6806 A number argument prefixed by
6807 .Ql +
6809 .Ql \-
6810 indicates that the window is calculated in relation to the current
6811 position, and a number without a prefix specifies an absolute position.
6814 .It Ic Z
6815 \*(NQ Similar to
6816 .Ic z ,
6817 but scrolls to the next or previous window that contains at least one
6818 .Ql new
6820 .Ic flag Ns
6821 ged message.
6823 .\" }}}
6825 .\" }}}
6828 .\" .Sh COMMAND ESCAPES {{{
6829 .Sh "COMMAND ESCAPES"
6831 Here is a summary of the command escapes available in compose mode,
6832 which are used to perform special functions when composing messages.
6833 Command escapes are only recognized at the beginning of lines, and
6834 consist of a trigger (escape) and a command character.
6835 The actual escape character can be set via the internal variable
6836 .Va escape ,
6837 it defaults to the tilde
6838 .Ql ~ .
6839 Otherwise ignored whitespace characters following the escape character
6840 will prevent a possible addition of the command line to the \*(OPal
6841 history.
6844 Unless otherwise noted all compose mode command escapes ensure proper
6845 updates of the variables which represent the error number
6846 .Va \&!
6847 and the exit status
6848 .Va \&? .
6849 If the variable
6850 .Va errexit
6851 is set they will, unless stated otherwise, error out message compose
6852 mode if an operation fails.
6853 It is however possible to place the character hyphen-minus
6854 .Ql -
6855 after (possible whitespace following) the escape character, which has an
6856 effect equivalent to the command modifier
6857 .Cm ignerr .
6858 If the \*(OPal key bindings are available it is possible to create
6859 .Ic bind Ns
6860 ings specifically for the compose mode.
6863 .Bl -tag -width ".It Ic BaNg"
6865 .It Ic ~~ Ar string
6866 Insert the string of text in the message prefaced by a single
6867 .Ql ~ .
6868 (If the escape character has been changed,
6869 that character must be doubled instead.)
6872 .It Ic ~! Ar command
6873 Execute the indicated shell
6874 .Ar command
6875 which follows, replacing unescaped exclamation marks with the previously
6876 executed command if the internal variable
6877 .Va bang
6878 is set, then return to the message.
6881 .It Ic ~.
6882 Same effect as typing the end-of-file character.
6885 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
6886 Execute the given \*(UA command.
6887 Not all commands, however, are allowed.
6890 .It Ic ~?
6891 Write a summary of command escapes.
6894 .It Ic ~< Ar filename
6895 Identical to
6896 .Ic ~r .
6899 .It Ic ~<! Ar command
6900 .Ar command
6901 is executed using the shell.
6902 Its standard output is inserted into the message.
6905 .It Ic ~@ Op Ar filename...
6906 Append or edit the list of attachments.
6907 Does not manage the error number
6908 .Va \&!
6909 and the exit status
6910 .Va \&? ,
6911 (please use
6912 .Ic ~^
6913 instead if this is a concern).
6914 A list of
6915 .Ar filename
6916 arguments is expected as shell tokens (see
6917 .Sx "Shell-style argument quoting" ;
6918 token-separating commas are ignored, too), to be
6919 interpreted as documented for the command line option
6920 .Fl a ,
6921 with the message number exception as below.
6923 Without
6924 .Ar filename
6925 arguments the attachment list is edited, entry by entry;
6926 if a filename is left empty, that attachment is deleted from the list;
6927 once the end of the list is reached either new attachments may be
6928 entered or the session can be quit by committing an empty
6929 .Dq new
6930 attachment.
6932 For all mode, if a given filename solely consists of the number sign
6933 .Ql #
6934 followed by a valid message number of the currently active mailbox, then
6935 the given message is attached as a
6936 .Ql message/rfc822
6937 MIME message part.
6938 As the shell comment character the number sign must be quoted.
6941 .It Ic ~A
6942 Inserts the string contained in the
6943 .Va Sign
6944 variable (same as
6945 .Ql Ic ~i Ns \0Sign ) .
6946 \*(OB The escape sequences tabulator
6947 .Ql \et
6948 and newline
6949 .Ql \en
6950 are understood (use the
6951 .Cm wysh
6952 prefix when
6953 .Ic set Ns
6954 ting the variable(s) instead).
6957 .It Ic ~a
6958 Inserts the string contained in the
6959 .Va sign
6960 variable (same as
6961 .Ql Ic ~i Ns \0sign ) .
6962 \*(OB The escape sequences tabulator
6963 .Ql \et
6964 and newline
6965 .Ql \en
6966 are understood (use the
6967 .Cm wysh
6968 prefix when
6969 .Ic set Ns
6970 ting the variable(s) instead).
6973 .It Ic ~b Ar name ...
6974 Add the given names to the list of blind carbon copy recipients.
6977 .It Ic ~c Ar name ...
6978 Add the given names to the list of carbon copy recipients.
6981 .It Ic ~d
6982 Read the file specified by the
6983 .Ev DEAD
6984 variable into the message.
6987 .It Ic ~e
6988 Invoke the text editor on the message collected so far.
6989 After the editing session is finished,
6990 the user may continue appending text to the message.
6993 .It Ic ~F Ar messages
6994 Read the named messages into the message being sent, including all
6995 message headers and MIME parts.
6996 If no messages are specified, read in the current message, the
6997 .Dq dot .
7000 .It Ic ~f Ar messages
7001 Read the named messages into the message being sent.
7002 If no messages are specified, read in the current message, the
7003 .Dq dot .
7004 Strips down the list of header fields according to the
7005 .Ql type
7006 white- and blacklist selection of
7007 .Ic headerpick .
7008 For MIME multipart messages,
7009 only the first displayable part is included.
7012 .It Ic ~H
7013 Edit the message header fields
7014 .Ql From: ,
7015 .Ql Reply-To:
7017 .Ql Sender:
7018 by typing each one in turn and allowing the user to edit the field.
7019 The default values for these fields originate from the
7020 .Va from , replyto
7022 .Va sender
7023 variables.
7026 .It Ic ~h
7027 Edit the message header fields
7028 .Ql To: ,
7029 .Ql Cc: ,
7030 .Ql Bcc:
7032 .Ql Subject:
7033 by typing each one in turn and allowing the user to edit the field.
7036 .It Ic ~I Ar variable
7037 Insert the value of the specified variable into the message.
7038 The message remains unaltered if the variable is unset or empty.
7039 \*(OB The escape sequences tabulator
7040 .Ql \et
7041 and newline
7042 .Ql \en
7043 are understood (use the
7044 .Cm wysh
7045 prefix when
7046 .Ic set Ns
7047 ting the variable(s) instead).
7050 .It Ic ~i Ar variable
7051 Identical to
7052 .Ic ~I ,
7053 but adds a newline character at the end of a successful insertion.
7056 .It Ic ~M Ar messages
7057 Read the named messages into the message being sent,
7058 indented by
7059 .Va indentprefix .
7060 If no messages are specified, read the current message, the
7061 .Dq dot .
7064 .It Ic ~m Ar messages
7065 Read the named messages into the message being sent,
7066 indented by
7067 .Va indentprefix .
7068 If no messages are specified, read the current message, the
7069 .Dq dot .
7070 Strips down the list of header fields according to the
7071 .Ql type
7072 white- and blacklist selection of
7073 .Ic headerpick .
7074 For MIME multipart messages,
7075 only the first displayable part is included.
7078 .It Ic ~p
7079 Display the message collected so far,
7080 prefaced by the message header fields
7081 and followed by the attachment list, if any.
7084 .It Ic ~q
7085 Abort the message being sent,
7086 copying it to the file specified by the
7087 .Ev DEAD
7088 variable if
7089 .Va save
7090 is set.
7093 .It Ic ~R Ar filename
7094 Identical to
7095 .Ic ~r ,
7096 but indent each line that has been read by
7097 .Va indentprefix .
7100 .It Ic ~r Ar filename Op Ar HERE-delimiter
7101 Read the named file, object to the usual
7102 .Sx "Filename transformations" ,
7103 into the message; if (the expanded)
7104 .Ar filename
7105 is the hyphen-minus
7106 .Ql -
7107 then standard input is used, e.g., for pasting purposes.
7108 Only in this latter mode
7109 .Ar HERE-delimiter
7110 may be given: if it is data will be read in until the given
7111 .Ar HERE-delimiter
7112 is seen on a line by itself, and encountering EOF is an error; the
7113 .Ar HERE-delimiter
7114 is a required argument in non-interactive mode; if it is single-quote
7115 quoted then the pasted content will not be expanded, \*(ID otherwise
7116 a future version of \*(UA may perform shell-style expansion on the content.
7119 .It Ic ~s Ar string
7120 Cause the named string to become the current subject field.
7121 Newline (NL) and carriage-return (CR) bytes are invalid and will be
7122 normalized to space (SP) characters.
7125 .It Ic ~t Ar name ...
7126 Add the given name(s) to the direct recipient list.
7129 .It Ic ~U Ar messages
7130 Read in the given / current message(s) excluding all headers, indented by
7131 .Va indentprefix .
7134 .It Ic ~u Ar messages
7135 Read in the given / current message(s), excluding all headers.
7138 .It Ic ~v
7139 Invoke an alternate editor (defined by the
7140 .Ev VISUAL
7141 environment variable) on the message collected so far.
7142 Usually, the alternate editor will be a screen editor.
7143 After the editor is quit,
7144 the user may resume appending text to the end of the message.
7147 .It Ic ~w Ar filename
7148 Write the message onto the named file, which is object to the usual
7149 .Sx "Filename transformations" .
7150 If the file exists,
7151 the message is appended to it.
7154 .It Ic ~x
7155 Same as
7156 .Ic ~q ,
7157 except that the message is not saved at all.
7160 .It Ic ~| Ar command
7161 Pipe the message through the specified filter command.
7162 If the command gives no output or terminates abnormally,
7163 retain the original text of the message.
7164 E.g., the command
7165 .Xr fmt 1
7166 is often used as a rejustifying filter.
7170 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7171 Low-level command meant for scripted message access, i.e., for
7172 .Va on-compose-splice
7174 .Va on-compose-splice-shell .
7175 The used protocol is likely subject to changes, and therefore the
7176 mentioned hooks receive the used protocol version as an initial line.
7177 In general the first field of a response line represents a status code
7178 which specifies whether a command was successful or not, whether result
7179 data is to be expected, and if, the format of the result data.
7180 Does not manage the error number
7181 .Va \&!
7182 and the exit status
7183 .Va \&? ,
7184 because errors are reported via the protocol
7185 (hard errors like I/O failures cannot be handled).
7186 This command has read-only access to several virtual pseudo headers in
7187 the \*(UA private namespace, which may not exist (except for the first):
7191 .Bl -tag -compact -width ".It Va BaNg"
7192 .It Ql Mailx-Command:
7193 The name of the command that generates the message, one of
7194 .Ql mail ,
7195 .Ql reply ,
7196 .Ql forward ,
7197 .Ql resend .
7199 .It Ql Mailx-Raw-To:
7200 .It Ql Mailx-Raw-Cc:
7201 .It Ql Mailx-Raw-Bcc:
7202 Represent the frozen initial state of these headers before any
7203 transformation (e.g.,
7204 .Ic alias ,
7205 .Ic alternates ,
7206 .Va recipients-in-cc
7207 etc.) took place.
7209 .It Ql Mailx-Orig-From:
7210 .It Ql Mailx-Orig-To:
7211 .It Ql Mailx-Orig-Cc:
7212 .It Ql Mailx-Orig-Bcc:
7213 The values of said headers of the original message which has been
7214 addressed by any of
7215 .Ic reply , forward , resend .
7219 The status codes are:
7223 .Bl -tag -compact -width ".It Ql 210"
7224 .It Ql 210
7225 Status ok; the remains of the line are the result.
7227 .It Ql 211
7228 Status ok; the rest of the line is optionally used for more status.
7229 What follows are lines of result addresses, terminated by an empty line.
7230 The address lines consist of two fields, the first of which is the
7231 plain address, e.g.,
7232 .Ql bob@exam.ple ,
7233 separated by a single ASCII SP space from the second which contains the
7234 unstripped address, even if that is identical to the first field, e.g.,
7235 .Ql (Lovely) Bob <bob@exam.ple> .
7236 All the input, including the empty line, must be consumed before further
7237 commands can be issued.
7239 .It Ql 212
7240 Status ok; the rest of the line is optionally used for more status.
7241 What follows are lines of furtherly unspecified string content,
7242 terminated by an empty line.
7243 All the input, including the empty line, must be consumed before further
7244 commands can be issued.
7246 .It Ql 500
7247 Syntax error; invalid command.
7249 .It Ql 501
7250 Syntax error in parameters or arguments.
7252 .It Ql 505
7253 Error: an argument fails verification.
7254 For example an invalid address has been specified, or an attempt was
7255 made to modify anything in \*(UA's own namespace.
7257 .It Ql 506
7258 Error: an otherwise valid argument is rendered invalid due to context.
7259 For example, a second address is added to a header which may consist of
7260 a single address only.
7265 If a command indicates failure then the message will have remained
7266 unmodified.
7267 Most commands can fail with
7268 .Ql 500
7269 if required arguments are missing (false command usage).
7270 The following (case-insensitive) commands are supported:
7273 .Bl -hang -width ".It Cm header"
7274 .It Cm header
7275 This command allows listing, inspection, and editing of message headers.
7276 Header name case is not normalized, and case-insensitive comparison
7277 should be used when matching names.
7278 The second argument specifies the subcommand to apply, one of:
7280 .Bl -hang -width ".It Cm remove"
7281 .It Cm list
7282 Without a third argument a list of all yet existing headers is given via
7283 .Ql 210 ;
7284 this command is the default command of
7285 .Cm header
7286 if no second argument has been given.
7287 A third argument restricts output to the given header only, which may
7288 fail with
7289 .Ql 501
7290 if no such field is defined.
7292 .It Cm show
7293 Shows the content of the header given as the third argument.
7294 Dependent on the header type this may respond with
7295 .Ql 211
7297 .Ql 212 ;
7298 any failure results in
7299 .Ql 501 .
7301 .It Cm remove
7302 This will remove all instances of the header given as the third
7303 argument, reporting
7304 .Ql 210
7305 upon success,
7306 .Ql 501
7307 if no such header can be found, and
7308 Ql 505
7309 on \*(UA namespace violations.
7311 .It Cm remove-at
7312 This will remove from the header given as the third argument the
7313 instance at the list position (counting from one!) given with the fourth
7314 argument, reporting
7315 .Ql 210
7316 upon success or
7317 .Ql 505
7318 if the list position argument is not a number or on \*(UA namespace
7319 violations, and
7320 .Ql 501
7321 if no such header instance exists.
7323 .It Cm insert
7324 Create a new or an additional instance of the header given in the third
7325 argument, with the header body content as given in the fourth argument
7326 (the remains of the line).
7327 It may return
7328 .Ql 501
7329 if the third argument specifies a free-form header field name that is
7330 invalid, or if body content extraction fails to succeed,
7331 .Ql 505
7332 if any extracted address does not pass syntax and/or security checks or
7333 on \*(UA namespace violations, and
7334 .Ql 506
7335 to indicate prevention of excessing a single-instance header \(em note that
7336 .Ql Subject:
7337 can be appended to (a space separator will be added automatically first).
7339 .Ql 210
7340 is returned upon success, followed by the name of the header and the list
7341 position of the newly inserted instance.
7342 The list position is always 1 for single-instance header fields.
7343 All free-form header fields are managed in a single list.
7347 .It Cm attachment
7348 This command allows listing, removal and addition of message attachments.
7349 The second argument specifies the subcommand to apply, one of:
7351 .Bl -hang -width ".It Cm remove"
7352 .It Cm list
7353 List all attachments via
7354 .Ql 212 ,
7355 or report
7356 .Ql 501
7357 if no attachments exist.
7358 This command is the default command of
7359 .Cm attachment
7360 if no second argument has been given.
7362 .It Cm remove
7363 This will remove the attachment given as the third argument, and report
7364 .Ql 210
7365 upon success or
7366 .Ql 501
7367 if no such attachment can be found.
7368 If there exists any path component in the given argument, then an exact
7369 match of the path which has been used to create the attachment is used
7370 directly, but if only the basename of that path matches then all
7371 attachments are traversed to find an exact match first, and the removal
7372 occurs afterwards; if multiple basenames match, a
7373 .Ql 506
7374 error occurs.
7375 Message attachments are treated as absolute pathnames.
7377 If no path component exists in the given argument, then all attachments
7378 will be searched for
7379 .Ql filename=
7380 parameter matches as well as for matches of the basename of the path
7381 which has been used when the attachment has been created; multiple
7382 matches result in a
7383 .Ql 506 .
7385 .It Cm remove-at
7386 This will interpret the third argument as a number and remove the
7387 attachment at that list position (counting from one!), reporting
7388 .Ql 210
7389 upon success or
7390 .Ql 505
7391 if the argument is not a number or
7392 .Ql 501
7393 if no such attachment exists.
7395 .It Cm insert
7396 Adds the attachment given as the third argument, specified exactly as
7397 documented for the command line option
7398 .Fl a ,
7399 and supporting the message number extension as documented for
7400 .Ic ~@ .
7401 This reports
7402 .Ql 210
7403 upon success, with the index of the new attachment following,
7404 .Ql 505
7405 if the given file cannot be opened,
7406 .Ql 506
7407 if an on-the-fly performed character set conversion fails, otherwise
7408 .Ql 501
7409 is reported; this is also reported if character set conversion is
7410 requested but not available.
7412 .It Cm attribute
7413 This uses the same search mechanism as described for
7414 .Cm remove
7415 and prints any known attributes of the first found attachment via
7416 .Ql 212
7417 upon success or
7418 .Ql 501
7419 if no such attachment can be found.
7420 The attributes are written as lines of keyword and value tuples, the
7421 keyword being separated from the rest of the line with an ASCII SP space
7422 character.
7424 .It Cm attribute-at
7425 This uses the same search mechanism as described for
7426 .Cm remove-at
7427 and is otherwise identical to
7428 .Cm attribute .
7430 .It Cm attribute-set
7431 This uses the same search mechanism as described for
7432 .Cm remove ,
7433 and will assign the attribute given as the fourth argument, which is
7434 expected to be a value tuple of keyword and other data, separated by
7435 a ASCII SP space or TAB tabulator character.
7436 If the value part is empty, then the given attribute is removed, or
7437 reset to a default value if existence of the attribute is crucial.
7439 It returns via
7440 .Ql 210
7441 upon success, with the index of the found attachment following,
7442 .Ql 505
7443 for message attachments or if the given keyword is invalid, and
7444 .Ql 501
7445 if no such attachment can be found.
7446 The following keywords may be used (case-insensitively):
7448 .Bl -hang -compact -width ".It Ql filename"
7449 .It Ql filename
7450 Sets the filename of the MIME part, i.e., the name that is used for
7451 display and when (suggesting a name for) saving (purposes).
7452 .It Ql content-description
7453 Associate some descriptive information to the attachment's content, used
7454 in favour of the plain filename by some MUAs.
7455 .It Ql content-id
7456 May be used for uniquely identifying MIME entities in several contexts;
7457 this expects a special reference address format as defined in RFC 2045
7458 and generates a
7459 .Ql 505
7460 upon address content verification failure.
7461 .It Ql content-type
7462 Defines the media type/subtype of the part, which is managed
7463 automatically, but can be overwritten.
7464 .It Ql content-disposition
7465 Automatically set to the string
7466 .Ql attachment .
7469 .It Cm attribute-set-at
7470 This uses the same search mechanism as described for
7471 .Cm remove-at
7472 and is otherwise identical to
7473 .Cm attribute-set .
7480 .\" }}}
7483 .\" .Sh INTERNAL VARIABLES {{{
7484 .Sh "INTERNAL VARIABLES"
7486 Internal \*(UA variables are controlled via the
7487 .Ic set
7489 .Ic unset
7490 commands; prefixing a variable name with the string
7491 .Ql no
7492 and calling
7493 .Ic set
7494 has the same effect as using
7495 .Ic unset :
7496 .Ql unset crt
7498 .Ql set nocrt
7499 do the same thing.
7500 Creation or editing of variables can be performed in the
7501 .Ev EDITOR
7502 with the command
7503 .Ic varedit .
7504 .Ic varshow
7505 will give more insight on the given variable(s), and
7506 .Ic set ,
7507 when called without arguments, will show a listing of all variables.
7508 Both commands support a more
7509 .Va verbose
7510 listing mode.
7511 Some well-known variables will also become inherited from the
7512 program
7513 .Sx ENVIRONMENT
7514 implicitly, others can be imported explicitly with the command
7515 .Ic environ
7516 and henceforth share said properties.
7519 Two different kinds of internal variables exist.
7520 There are boolean variables, which can only be in one of the two states
7521 .Dq set
7523 .Dq unset ,
7524 and value variables with a(n optional) string value.
7525 For the latter proper quoting is necessary upon assignment time, the
7526 introduction of the section
7527 .Sx COMMANDS
7528 documents the supported quoting rules.
7530 .Bd -literal -offset indent
7531 ? wysh set one=val\e 1 two="val 2" \e
7532     three='val "3"' four=$'val \e'4\e''; \e
7533     varshow one two three four; \e
7534     unset one two three four
7538 Dependent upon the actual option the string values will be interpreted
7539 as numbers, colour names, normal text etc., but there also exists
7540 a special kind of string value, the
7541 .Dq boolean string ,
7542 which must either be a decimal integer (in which case
7543 .Ql 0
7544 is false and
7545 .Ql 1
7546 and any other value is true) or any of the (case-insensitive) strings
7547 .Ql off ,
7548 .Ql no ,
7549 .Ql n
7551 .Ql false
7552 for a false boolean and
7553 .Ql on ,
7554 .Ql yes ,
7555 .Ql y
7557 .Ql true
7558 for a true boolean; a special kind of boolean string is the
7559 .Dq quadoption ,
7560 which is a boolean string that can optionally be prefixed with the
7561 (case-insensitive) term
7562 .Ql ask- ,
7563 as in
7564 .Ql ask-yes ,
7565 which causes prompting of the user in interactive mode, with the given
7566 boolean as the default value.
7568 .\" .Ss "Initial settings" {{{
7569 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7570 .Ss "Initial settings"
7572 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7573 variable settings:
7574 .Pf no Va allnet ,
7575 .Pf no Va append ,
7576 .Va asksub ,
7577 .Pf no Va askbcc ,
7578 .Pf no Va autoprint ,
7579 .Pf no Va bang ,
7580 .Pf no Va cmd ,
7581 .Pf no Va crt ,
7582 .Pf no Va debug ,
7583 .Pf no Va dot ,
7584 .Va escape
7585 set to
7586 .Ql ~ ,
7587 .Pf no Va flipr ,
7588 .Pf no Va folder ,
7589 .Va header ,
7590 .Pf no Va hold ,
7591 .Pf no Va ignore ,
7592 .Pf no Va ignoreeof ,
7593 .Pf no Va keep ,
7594 .Pf no Va keepsave ,
7595 .Pf no Va metoo ,
7596 .Pf no Va outfolder ,
7597 .Pf no Va page ,
7598 .Va prompt
7599 set to
7600 .Ql ?\0 ,
7601 .Pf no Va quiet ,
7602 .Pf no Va record ,
7603 .Va save ,
7604 .Pf no Va sendwait ,
7605 .Pf no Va showto ,
7606 .Pf no Va Sign ,
7607 .Pf no Va sign ,
7608 .Va toplines
7609 set to
7610 .Ql 5 .
7613 Notes: \*(UA does not support the
7614 .Pf no Va onehop
7615 variable \(en use command line options or
7616 .Va mta-arguments
7617 to pass options through to a
7618 .Va mta .
7619 And the default global
7620 .Pa \*(UR
7621 file, which is loaded unless the
7622 .Fl \&:
7623 (with according argument) or
7624 .Fl n
7625 command line options have been used, or the
7626 .Ev MAILX_NO_SYSTEM_RC
7627 environment variable is set (see
7628 .Sx "Resource files" )
7629 bends those initial settings a bit, e.g., it sets the variables
7630 .Va hold ,
7631 .Va keepsave
7633 .Va keep ,
7634 to name a few, establishes a default
7635 .Ic headerpick
7636 selection etc., and should thus be taken into account.
7637 .\" }}}
7639 .\" .Ss "Variables" {{{
7640 .Ss "Variables"
7642 .Bl -tag -width ".It Va BaNg"
7645 .It Va \&?
7646 \*(RO The exit status of the last command, or the
7647 .Ic return
7648 value of the macro
7649 .Ic call Ns
7650 ed last.
7651 This status has a meaning in the state machine: in conjunction with
7652 .Va errexit
7653 any non-0 exit status will cause a program exit, and in
7654 .Ev POSIXLY_CORRECT
7655 mode any error while loading (any of the) resource files will have the
7656 same effect.
7657 .Cm ignerr ,
7658 one of the
7659 .Sx "Command modifiers" ,
7660 can be used to instruct the state machine to ignore errors.
7663 .It Va \&!
7664 \*(RO The current error number
7665 .Pf ( Xr errno 3 ) ,
7666 which is set after an error occurred; it is also available via
7667 .Va ^ERR ,
7668 and the error name and documentation string can be queried via
7669 .Va ^ERRNAME
7671 .Va ^ERRDOC .
7672 \*(ID This machinery is new and the error number is only really usable
7673 if a command explicitly states that it manages the variable
7674 .Va \&! ,
7675 for others errno will be used in case of errors, or
7676 .Va ^ERR Ns -INVAL
7677 if that is 0: it thus may or may not reflect the real error.
7678 The error number may be set with the command
7679 .Ic return .
7683 .It Va ^
7684 \*(RO This is a multiplexer variable which performs dynamic expansion of
7685 the requested state or condition, of which there are:
7688 .Bl -tag -compact -width ".It Va BaNg"
7692 .It Va ^ERR , ^ERRDOC , ^ERRNAME
7693 The number, documentation, and name of the current
7694 .Xr errno 3 ,
7695 respectively, which is usually set after an error occurred.
7696 \*(ID This machinery is new and is usually reliable only if a command
7697 explicitly states that it manages the variable
7698 .Va \&! ,
7699 which is effectively identical to
7700 .Va \&\&^ERR .
7701 Each of those variables can be suffixed with a hyphen minus followed by
7702 a name or number, in which case the expansion refers to the given error.
7703 Note this is a direct mapping of (a subset of) the system error values:
7704 .Bd -literal -offset indent
7705 define work {
7706   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
7707   vput vexpr i + "$1" 1
7708   if [ $i -lt 16 ]
7709     \excall work $i
7710   end
7712 call work 0
7718 .It Va *
7719 \*(RO Expands all positional parameters (see
7720 .Va 1 ) ,
7721 separated by a space character.
7722 \*(ID The special semantics of the equally named special parameter of the
7723 .Xr sh 1
7724 are not yet supported.
7727 .It Va @
7728 \*(RO Expands all positional parameters (see
7729 .Va 1 ) ,
7730 separated by a space character.
7731 If placed in double quotation marks, each positional parameter is
7732 properly quoted to expand to a single parameter again.
7735 .It Va #
7736 \*(RO Expands to the number of positional parameters, i.e., the size of
7737 the positional parameter stack in decimal.
7740 .It Va \&0
7741 \*(RO Inside the scope of a
7742 .Ic define Ns
7743 d and
7744 .Ic call Ns
7745 ed macro this expands to the name of the calling macro, or to the empty
7746 string if the macro is running from top-level.
7747 For the \*(OPal regular expression search and replace operator of
7748 .Ic vexpr
7749 this expands to the entire matching expression.
7750 It represents the program name in global context.
7753 .It Va 1
7754 \*(RO Access of the positional parameter stack.
7755 All further parameters can be accessed with this syntax, too, e.g.,
7756 .Ql 2 ,
7757 .Ql 3
7758 etc.; positional parameters can be shifted off the stack by calling
7759 .Ic shift .
7760 The parameter stack contains, e.g., the arguments of a
7761 .Ic call Ns
7763 .Ic define Ns
7764 d macro, the matching groups of the \*(OPal regular expression search
7765 and replace expression of
7766 .Ic vexpr ,
7767 and can be explicitly created or overwritten with the command
7768 .Ic vpospar .
7771 .It Va account
7772 \*(RO Is set to the active
7773 .Ic account .
7776 .It Va add-file-recipients
7777 \*(BO When file or pipe recipients have been specified,
7778 mention them in the corresponding address fields of the message instead
7779 of silently stripping them from their recipient list.
7780 By default such addressees are not mentioned.
7783 .It Va allnet
7784 \*(BO Causes only the local part to be evaluated
7785 when comparing addresses.
7788 .It Va append
7789 \*(BO Causes messages saved in the
7790 .Mx -sx
7791 .Sx "secondary mailbox"
7792 .Ev MBOX
7793 to be appended to the end rather than prepended.
7794 This should always be set.
7797 .It Va ask
7798 \*(BO Causes \*(UA to prompt for the subject of each message sent.
7799 If the user responds with simply a newline,
7800 no subject field will be sent.
7803 .It Va askatend
7804 \*(BO Causes the prompts for
7805 .Ql Cc:
7807 .Ql Bcc:
7808 lists to appear after the message has been edited.
7811 .It Va askattach
7812 \*(BO If set, \*(UA asks for files to attach at the end of each message,
7813 shall the list be found empty at that time.
7814 An empty line finalizes the list.
7817 .It Va askcc
7818 \*(BO Causes the user to be prompted for carbon copy recipients
7819 (at the end of each message if
7820 .Va askatend
7822 .Va bsdcompat
7823 are set) shall the list be found empty (at that time).
7824 An empty line finalizes the list.
7827 .It Va askbcc
7828 \*(BO Causes the user to be prompted for blind carbon copy
7829 recipients (at the end of each message if
7830 .Va askatend
7832 .Va bsdcompat
7833 are set) shall the list be found empty (at that time).
7834 An empty line finalizes the list.
7837 .It Va asksign
7838 \*(BO\*(OP Causes the user to be prompted if the message is to be
7839 signed at the end of each message.
7841 .Va smime-sign
7842 variable is ignored when this variable is set.
7845 .It Va asksub
7846 \*(BO Alternative name for
7847 .Va ask .
7850 .It Va attrlist
7851 A sequence of characters to display in the
7852 .Ql attribute
7853 column of the
7854 .Va headline
7855 as shown in the display of
7856 .Ic headers ;
7857 each for one type of messages (see
7858 .Sx "Message states" ) ,
7859 with the default being
7860 .Ql NUROSPMFAT+\-$~
7862 .Ql NU\ \ *HMFAT+\-$~
7863 if the
7864 .Va bsdflags
7865 variable is set, in the following order:
7867 .Bl -tag -compact -width ".It Ql _"
7868 .It Ql N
7869 new.
7870 .It Ql U
7871 unread but old.
7872 .It Ql R
7873 new but read.
7874 .It Ql O
7875 read and old.
7876 .It Ql S
7877 saved.
7878 .It Ql P
7879 preserved.
7880 .It Ql M
7881 mboxed.
7882 .It Ql F
7883 flagged.
7884 .It Ql A
7885 answered.
7886 .It Ql T
7887 draft.
7888 .It Ql +
7889 start of a collapsed thread.
7890 .It Ql -
7891 an uncollapsed thread (TODO ignored for now).
7892 .It Ql $
7893 classified as spam.
7894 .It Ql ~
7895 classified as possible spam.
7900 .It Va autobcc
7901 Specifies a list of recipients to which a blind carbon copy of each
7902 outgoing message will be sent automatically.
7905 .It Va autocc
7906 Specifies a list of recipients to which a carbon copy of each outgoing
7907 message will be sent automatically.
7910 .It Va autocollapse
7911 \*(BO Causes threads to be collapsed automatically when threaded mode
7912 is entered (see the
7913 .Ic collapse
7914 command).
7917 .It Va autoprint
7918 \*(BO Enable automatic
7919 .Ic type Ns
7920 ing of a(n existing)
7921 .Dq successive
7922 message after
7923 .Ic delete
7925 .Ic undelete
7926 commands, e.g., the message that becomes the new
7927 .Dq dot
7928 is shown automatically, as via
7929 .Ic dp
7931 .Ic dt .
7934 .It Va autosort
7935 Causes sorted mode (see the
7936 .Ic sort
7937 command) to be entered automatically with the value of this variable as
7938 sorting method when a folder is opened, e.g.,
7939 .Ql set autosort=thread .
7942 .It Va bang
7943 \*(BO Enables the substitution of all not (reverse-solidus) escaped
7944 exclamation mark
7945 .Ql \&!
7946 characters by the contents of the last executed command for the
7947 .Ic \&!
7948 shell escape command and
7949 .Ic ~! ,
7950 one of the compose mode
7951 .Sx "COMMAND ESCAPES" .
7952 If this variable is not set no reverse solidus stripping is performed.
7955 .It Va bind-timeout
7956 \*(OP Terminals generate multi-byte sequences for certain forms of
7957 input, for example for function and other special keys.
7958 Some terminals however do not write these multi-byte sequences as
7959 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
7960 This variable specifies the timeout in milliseconds that the MLE (see
7961 .Sx "On terminal control and line editor" )
7962 waits for more bytes to arrive unless it considers a sequence
7963 .Dq complete .
7964 The default is 200.
7967 .It Va bsdcompat
7968 \*(BO Sets some cosmetical features to traditional BSD style;
7969 has the same affect as setting
7970 .Va askatend
7971 and all other variables prefixed with
7972 .Ql bsd ;
7973 it also changes the behaviour of
7974 .Va emptystart
7975 (which does not exist in BSD).
7978 .It Va bsdflags
7979 \*(BO Changes the letters shown in the first column of a header
7980 summary to traditional BSD style.
7983 .It Va bsdheadline
7984 \*(BO Changes the display of columns in a header summary to traditional
7985 BSD style.
7988 .It Va bsdmsgs
7989 \*(BO Changes some informational messages to traditional BSD style.
7992 .It Va bsdorder
7993 \*(BO Causes the
7994 .Ql Subject:
7995 field to appear immediately after the
7996 .Ql To:
7997 field in message headers and with the
7998 .Ic ~h
7999 .Sx "COMMAND ESCAPES" .
8003 .It Va build-os , build-osenv
8004 \*(RO The operating system \*(UA has been build for, usually taken from
8005 .Xr uname 1
8007 .Ql uname -s
8009 .Ql uname -srm ,
8010 respectively, the former being lowercased.
8013 .It Va charset-7bit
8014 The value that should appear in the
8015 .Ql charset=
8016 parameter of
8017 .Ql Content-Type:
8018 MIME header fields when no character set conversion of the message data
8019 was performed.
8020 This defaults to US-ASCII, and the chosen character set should be
8021 US-ASCII compatible.
8024 .It Va charset-8bit
8025 \*(OP The default 8-bit character set that is used as an implicit last
8026 member of the variable
8027 .Va sendcharsets .
8028 This defaults to UTF-8 if character set conversion capabilities are
8029 available, and to ISO-8859-1 otherwise, in which case the only supported
8030 character set is
8031 .Va ttycharset
8032 and this variable is effectively ignored.
8033 Refer to the section
8034 .Sx "Character sets"
8035 for the complete picture of character set conversion in \*(UA.
8038 .It Va charset-unknown-8bit
8039 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8040 .Dq upgrade
8041 the content of a mail message by using a character set with the name
8042 .Ql unknown-8bit .
8043 Because of the unclassified nature of this character set \*(UA will not
8044 be capable to convert this character set to any other character set.
8045 If this variable is set any message part which uses the character set
8046 .Ql unknown-8bit
8047 is assumed to really be in the character set given in the value,
8048 otherwise the (final) value of
8049 .Va charset-8bit
8050 is used for this purpose.
8052 This variable will also be taken into account if a MIME type (see
8053 .Sx "The mime.types files" )
8054 of a MIME message part that uses the
8055 .Ql binary
8056 character set is forcefully treated as text.
8059 .It Va cmd
8060 The default value for the
8061 .Ic pipe
8062 command.
8065 .It Va colour-disable
8066 \*(BO\*(OP Forcefully disable usage of colours.
8067 Also see the section
8068 .Sx "Coloured display" .
8071 .It Va colour-pager
8072 \*(BO\*(OP Whether colour shall be used for output that is paged through
8073 .Ev PAGER .
8074 Note that pagers may need special command line options, e.g.,
8075 .Xr less 1
8076 requires the option
8077 .Fl \&\&R
8079 .Xr lv 1
8080 the option
8081 .Fl \&\&c
8082 in order to support colours.
8083 Often doing manual adjustments is unnecessary since \*(UA may perform
8084 adjustments dependent on the value of the environment variable
8085 .Ev PAGER
8086 (see there for more).
8090 .It Va contact-mail , contact-web
8091 \*(RO Addresses for contact per email and web, respectively, e.g., for
8092 bug reports, suggestions, or help regarding \*(UA.
8093 The former can be used directly:
8094 .Ql ? eval mail $contact-mail .
8097 .It Va crt
8098 In a(n interactive) terminal session, then if this valued variable is
8099 set it will be used as a threshold to determine how many lines the given
8100 output has to span before it will be displayed via the configured
8101 .Ev PAGER ;
8102 Usage of the
8103 .Ev PAGER
8104 can be forced by setting this to the value
8105 .Ql 0 ,
8106 setting it without a value will deduce the current height of the
8107 terminal screen to compute the treshold (see
8108 .Ev LINES ,
8109 .Va screen
8111 .Xr stty 1 ) .
8112 \*(ID At the moment this uses the count of lines of the message in wire
8113 format, which, dependent on the
8114 .Va mime-encoding
8115 of the message, is unrelated to the number of display lines.
8116 (The software is old and historically the relation was a given thing.)
8119 .It Va customhdr
8120 Define a set of custom headers to be injected into newly composed or
8121 forwarded messages; it is also possible to create custom headers in
8122 compose mode with
8123 .Ic ~^ ,
8124 which can be automated by setting one of the hooks
8125 .Va on-compose-splice
8127 .Va on-compose-splice-shell .
8128 The value is interpreted as a comma-separated list of custom headers to
8129 be injected, to include commas in the header bodies escape them with
8130 reverse solidus.
8131 \*(ID Overwriting of automatically managed headers is neither supported
8132 nor prevented.
8134 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
8137 .It Va datefield
8138 Controls the appearance of the
8139 .Ql %d
8140 date and time format specification of the
8141 .Va headline
8142 variable, that is used, for example, when viewing the summary of
8143 .Ic headers .
8144 If unset, then the local receiving date is used and displayed
8145 unformatted, otherwise the message sending
8146 .Ql Date: .
8147 It is possible to assign a
8148 .Xr strftime 3
8149 format string and control formatting, but embedding newlines via the
8150 .Ql %n
8151 format is not supported, and will result in display errors.
8152 The default is
8153 .Ql %Y-%m-%d %H:%M ,
8154 and also see
8155 .Va datefield-markout-older .
8158 .It Va datefield-markout-older
8159 Only used in conjunction with
8160 .Va datefield .
8161 Can be used to create a visible distinction of messages dated more than
8162 a day in the future, or older than six months, a concept comparable to the
8163 .Fl \&\&l
8164 option of the POSIX utility
8165 .Xr ls 1 .
8166 If set to the empty string, then the plain month, day and year of the
8167 .Ql Date:
8168 will be displayed, but a
8169 .Xr strftime 3
8170 format string to control formatting can be assigned.
8171 The default is
8172 .Ql %Y-%m-%d .
8175 .It Va debug
8176 \*(BO Enables debug messages and obsoletion warnings, disables the
8177 actual delivery of messages and also implies
8178 .Pf no Va record
8179 as well as
8180 .Pf no Va save .
8183 .It Va disposition-notification-send
8184 \*(BO\*(OP Emit a
8185 .Ql Disposition-Notification-To:
8186 header (RFC 3798) with the message.
8187 This requires the
8188 .Va from
8189 variable to be set.
8190 .\" TODO .It Va disposition-notification-send-HOST
8191 .\"Overrides
8192 .\".Va disposition-notification-send
8193 .\" for SMTP accounts on a specific host.
8194 .\" TODO .It Va disposition-notification-send-USER@HOST
8195 .\"Overrides
8196 .\".Va disposition-notification-send
8197 .\"for a specific account.
8200 .It Va dot
8201 \*(BO When dot is set, a period
8202 .Ql \&.
8203 on a line by itself during message input in (interactive or batch
8204 .Fl # )
8205 compose mode will be treated as end-of-message (in addition to the
8206 normal end-of-file condition).
8207 This behaviour is implied in
8208 .Va posix
8209 mode with a set
8210 .Va ignoreeof .
8213 .It Va dotlock-ignore-error
8214 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
8215 .Mx -sx
8216 .Sx "primary system mailbox" Ns
8217 es (see, e.g., the notes on
8218 .Sx "Filename transformations" ,
8219 as well as the documentation of
8220 .Ic file )
8221 will be protected with so-called dotlock files\(emthe traditional mail
8222 spool file locking method\(emin addition to system file locking.
8223 Because \*(UA ships with a privilege-separated dotlock creation program
8224 that should always be able to create such a dotlock file there is no
8225 good reason to ignore dotlock file creation errors, and thus these are
8226 fatal unless this variable is set.
8229 .It Va editalong
8230 \*(BO If this variable is set then the editor is started automatically
8231 when a message is composed in interactive mode, as if the
8232 .Ic ~e
8233 .Sx "COMMAND ESCAPES"
8234 had been specified.
8236 .Va editheaders
8237 variable is implied for this automatically spawned editor session.
8240 .It Va editheaders
8241 \*(BO When a message is edited while being composed,
8242 its header is included in the editable text.
8245 .It Va emptystart
8246 \*(BO When entering interactive mode \*(UA normally writes
8247 .Dq \&No mail for user
8248 and exits immediately if a mailbox is empty or does not exist.
8249 If this variable is set \*(UA starts even with an empty or non-existent
8250 mailbox (the latter behaviour furtherly depends upon
8251 .Va bsdcompat ,
8252 though).
8255 .It Va errexit
8256 \*(BO Let each command with a non-0 exit status, including every
8257 .Ic call Ns
8258 ed macro which
8259 .Ic return Ns
8260 s a non-0 status, cause a program exit unless prefixed by
8261 .Cm ignerr
8262 (see
8263 .Sx "Command modifiers" ) .
8264 This also affects
8265 .Sx "COMMAND ESCAPES" ,
8266 but which use a different modifier for ignoring the error.
8267 Please refer to the variable
8268 .Va \&?
8269 for more on this topic.
8272 .It Va escape
8273 The first character of this value defines the escape character for
8274 .Sx "COMMAND ESCAPES"
8275 in compose mode.
8276 The default value is the character tilde
8277 .Ql ~ .
8278 If set to the empty string, command escapes are disabled.
8281 .It Va expandaddr
8282 If not set then file and command pipeline targets are not allowed,
8283 and any such address will be filtered out, giving a warning message.
8284 If set without a value then all possible recipient address
8285 specifications will be accepted \(en see the section
8286 .Sx "On sending mail, and non-interactive mode"
8287 for more on this.
8288 To accept them, but only in interactive mode, or when tilde commands
8289 were enabled explicitly by using one of the command line options
8290 .Fl ~
8292 .Fl # ,
8293 set this to the (case-insensitive) value
8294 .Ql restrict
8295 (it actually acts like
8296 .Ql restrict,-all,+name,+addr ,
8297 so that care for ordering issues must be taken) .
8299 In fact the value is interpreted as a comma-separated list of values.
8300 If it contains
8301 .Ql fail
8302 then the existence of disallowed specifications is treated as a hard
8303 send error instead of only filtering them out.
8304 The remaining values specify whether a specific type of recipient
8305 address specification is allowed (optionally indicated by a plus sign
8306 .Ql +
8307 prefix) or disallowed (prefixed with a hyphen-minus
8308 .Ql - ) .
8309 The value
8310 .Ql all
8311 addresses all possible address specifications,
8312 .Ql file
8313 file targets,
8314 .Ql pipe
8315 command pipeline targets,
8316 .Ql name
8317 plain user names and (MTA) aliases and
8318 .Ql addr
8319 network addresses.
8320 These kind of values are interpreted in the given order, so that
8321 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8322 will cause hard errors for any non-network address recipient address
8323 unless \*(UA is in interactive mode or has been started with the
8324 .Fl ~
8326 .Fl #
8327 command line option; in the latter case(s) any address may be used, then.
8329 Historically invalid network addressees are silently stripped off.
8330 To change this so that any encountered invalid email address causes
8331 a hard error it must be ensured that
8332 .Ql failinvaddr
8333 is an entry in the above list.
8334 Setting this automatically enables network addressees
8335 (it actually acts like
8336 .Ql failinvaddr,+addr ,
8337 so that care for ordering issues must be taken) .
8340 .It Va expandargv
8341 Unless this variable is set additional
8342 .Va mta
8343 (Mail-Transfer-Agent)
8344 arguments from the command line, as can be given after a
8345 .Fl \&\&-
8346 separator, are ignored due to safety reasons.
8347 However, if set to the special (case-insensitive) value
8348 .Ql fail ,
8349 then the presence of additional MTA arguments is treated as a hard
8350 error that causes \*(UA to exit with failure status.
8351 A lesser strict variant is the otherwise identical
8352 .Ql restrict ,
8353 which does accept such arguments in interactive mode, or if tilde
8354 commands were enabled explicitly by using one of the command line options
8355 .Fl ~
8357 .Fl # .
8360 .It Va features
8361 \*(RO String giving a list of features \*(UA, preceded with a plus sign
8362 .Ql +
8363 if the feature is available, and a hyphen-minus
8364 .Ql -
8365 otherwise.
8366 The output of the command
8367 .Ic version
8368 will include this information in a more pleasant output.
8371 .It Va flipr
8372 \*(BO This setting reverses the meanings of a set of reply commands,
8373 turning the lowercase variants, which by default address all recipients
8374 included in the header of a message
8375 .Pf ( Ic reply , respond , followup )
8376 into the uppercase variants, which by default address the sender only
8377 .Pf ( Ic Reply , Respond , Followup )
8378 and vice versa.
8379 The commands
8380 .Ic replysender , respondsender , followupsender
8381 as well as
8382 .Ic replyall , respondall , followupall
8383 are not affected by the current setting of
8384 .Va flipr .
8387 .It Va folder
8388 The default path under which mailboxes are to be saved:
8389 filenames that begin with the plus sign
8390 .Ql +
8391 will have the plus sign replaced with the value of this variable if set,
8392 otherwise the plus sign will remain unchanged when doing
8393 .Sx "Filename transformations" ;
8394 also see
8395 .Ic file
8396 for more on this topic.
8397 The value supports a subset of transformations itself, and if the
8398 non-empty value does not start with a solidus
8399 .Ql / ,
8400 then the value of
8401 .Ev HOME
8402 will be prefixed automatically.
8403 Once the actual value is evaluated first, the internal variable
8404 .Va folder-resolved
8405 will be updated for caching purposes.
8408 .It Va folder-hook
8409 This variable can be set to the name of a
8410 .Ic define Ns d
8411 macro which will be called whenever a
8412 .Ic file
8413 is opened.
8414 The macro will also be invoked when new mail arrives,
8415 but message lists for commands executed from the macro
8416 only include newly arrived messages then.
8417 .Ic localopts
8418 are activated by default in a folder hook, causing the covered settings
8419 to be reverted once the folder is left again.
8422 .It Va folder-hook-FOLDER
8423 Overrides
8424 .Va folder-hook
8425 for a folder named
8426 .Ql FOLDER .
8427 Unlike other folder specifications, the fully expanded name of a folder,
8428 without metacharacters, is used to avoid ambiguities.
8429 However, if the mailbox resides under
8430 .Va folder
8431 then the usual
8432 .Ql +
8433 specification is tried in addition, e.g., if
8434 .Va \&\&folder
8436 .Dq mail
8437 (and thus relative to the user's home directory) then
8438 .Pa /home/usr1/mail/sent
8439 will be tried as
8440 .Ql folder-hook-/home/usr1/mail/sent
8441 first, but then followed by
8442 .Ql folder-hook-+sent .
8445 .It Va folder-resolved
8446 \*(RO Set to the fully resolved path of
8447 .Va folder
8448 once that evaluation has occurred; rather internal.
8451 .It Va followup-to
8452 \*(BO Controls whether a
8453 .Ql Mail-Followup-To:
8454 header is generated when sending messages to known mailing lists.
8455 Also see
8456 .Va followup-to-honour
8457 and the commands
8458 .Ic mlist , mlsubscribe , reply
8460 .Ic Lreply .
8463 .It Va followup-to-honour
8464 Controls whether a
8465 .Ql Mail-Followup-To:
8466 header is honoured when group-replying to a message via
8467 .Ic reply
8469 .Ic Lreply .
8470 This is a quadoption; if set without a value it defaults to
8471 .Dq yes .
8472 Also see
8473 .Va followup-to
8474 and the commands
8475 .Ic mlist
8477 .Ic mlsubscribe .
8480 .It Va forward-as-attachment
8481 \*(BO Original messages are normally sent as inline text with the
8482 .Ic forward
8483 command,
8484 and only the first part of a multipart message is included.
8485 With this setting enabled messages are sent as unmodified MIME
8486 .Ql message/rfc822
8487 attachments with all of their parts included.
8490 .It Va forward-inject-head
8491 The string to put before the text of a message with the
8492 .Ic forward
8493 command instead of the default
8494 .Dq -------- Original Message -------- .
8495 No heading is put if it is set to the empty string.
8496 This variable is ignored if the
8497 .Va forward-as-attachment
8498 variable is set.
8501 .It Va from
8502 The address (or a list of addresses) to put into the
8503 .Ql From:
8504 field of the message header, quoting RFC 5322:
8505 the author(s) of the message, that is, the mailbox(es) of the person(s)
8506 or system(s) responsible for the writing of the message.
8507 When
8508 .Ic reply Ns
8509 ing to messages these addresses are handled as if they were in the
8510 .Ic alternates
8511 list.
8513 If the machine's hostname is not valid at the Internet (for example at
8514 a dialup machine) then either this variable or
8515 .Va hostname
8516 (\*(IN and with a defined SMTP protocol in
8517 .Va mta
8518 .Va smtp-hostname
8519 adds even more fine-tuning capabilities),
8520 have to be set.
8522 .Va \&\&from
8523 contains more than one address,
8524 setting the
8525 .Va sender
8526 variable is required (according to the standard RFC 5322).
8528 If a file-based MTA is used, then
8529 .Va from
8530 (or, if that contains multiple addresses,
8531 .Va sender )
8532 can nonetheless be enforced to appear as the envelope sender address at
8533 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8534 .Fl r
8535 command line option (with an empty argument; see there for the complete
8536 picture on this topic), or by setting the internal variable
8537 .Va r-option-implicit .
8540 .It Va fullnames
8541 \*(BO When replying to or forwarding a message \*(UA normally removes
8542 the comment and name parts of email addresses.
8543 If this variable is set such stripping is not performed,
8544 and comments, names etc. are retained.
8546 .It Va fwdheading
8547 \*(OB Predecessor of
8548 .Va forward-inject-head .
8551 .It Va header
8552 \*(BO Causes the header summary to be written at startup and after
8553 commands that affect the number of messages or the order of messages in
8554 the current
8555 .Ic folder .
8556 Unless in
8557 .Ev POSIXLY_CORRECT
8558 mode a header summary will also be displayed on folder changes.
8559 The command line option
8560 .Fl N
8561 can be used to set
8562 .Pf no Va header .
8566 .It Va headline
8567 A format string to use for the summary of
8568 .Ic headers ,
8569 similar to the ones used for
8570 .Xr printf 3
8571 formats.
8572 Format specifiers in the given string start with a percent sign
8573 .Ql %
8574 and may be followed by an optional decimal number indicating the field
8575 width \(em if that is negative, the field is to be left-aligned.
8576 Valid format specifiers are:
8579 .Bl -tag -compact -width ".It Ql _%%_"
8580 .It Ql %%
8581 A plain percent sign.
8582 .It Ql %>
8583 .Dq Dotmark :
8584 a space character but for the current message
8585 .Pf ( Dq dot ) ,
8586 for which it expands to
8587 .Ql > .
8588 .It Ql %<
8589 .Dq Dotmark :
8590 a space character but for the current message
8591 .Pf ( Dq dot ) ,
8592 for which it expands to
8593 .Ql < .
8594 .It Ql %$
8595 \*(OP The spam score of the message, as has been classified via the
8596 command
8597 .Ic spamrate .
8598 Shows only a replacement character if there is no spam support.
8599 .It Ql %a
8600 Message attribute character (status flag); the actual content can be
8601 adjusted by setting
8602 .Va attrlist .
8603 .It Ql %d
8604 The date found in the
8605 .Ql From:
8606 header of the message when
8607 .Va datefield
8608 is set (the default), otherwise the date when the message was received.
8609 Formatting can be controlled by assigning a
8610 .Xr strftime 3
8611 format string to
8612 .Va datefield .
8613 .It Ql %e
8614 The indenting level in threaded mode.
8615 .It Ql %f
8616 The address of the message sender.
8617 .It Ql %i
8618 The message thread tree structure.
8619 (Note that this format does not support a field width.)
8620 .It Ql %l
8621 The number of lines of the message, if available.
8622 .It Ql %m
8623 Message number.
8624 .It Ql %o
8625 The number of octets (bytes) in the message, if available.
8626 .It Ql %s
8627 Message subject (if any).
8628 .It Ql %S
8629 Message subject (if any) in double quotes.
8630 .It Ql \&%T
8631 Message recipient flags: is the addressee of the message a known or
8632 subscribed mailing list \(en see
8633 .Ic mlist
8635 .Ic mlsubscribe .
8636 .It Ql %t
8637 The position in threaded/sorted order.
8640 The default is
8641 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
8643 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
8645 .Va bsdcompat
8646 is set.
8647 Also see
8648 .Va attrlist
8650 .Va headline-bidi .
8654 .It Va headline-bidi
8655 Bidirectional text requires special treatment when displaying headers,
8656 because numbers (in dates or for file sizes etc.) will not affect the
8657 current text direction, in effect resulting in ugly line layouts when
8658 arabic or other right-to-left text is to be displayed.
8659 On the other hand only a minority of terminals is capable to correctly
8660 handle direction changes, so that user interaction is necessary for
8661 acceptable results.
8662 Note that extended host system support is required nonetheless, e.g.,
8663 detection of the terminal character set is one precondition;
8664 and this feature only works in an Unicode (i.e., UTF-8) locale.
8666 In general setting this variable will cause \*(UA to encapsulate text
8667 fields that may occur when displaying
8668 .Va headline
8669 (and some other fields, like dynamic expansions in
8670 .Va prompt )
8671 with special Unicode control sequences;
8672 it is possible to fine-tune the terminal support level by assigning
8673 a value:
8674 no value (or any value other than
8675 .Ql 1 ,
8676 .Ql 2
8678 .Ql 3 )
8679 will make \*(UA assume that the terminal is capable to properly deal
8680 with Unicode version 6.3, in which case text is embedded in a pair of
8681 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
8682 characters.
8683 In addition no space on the line is reserved for these characters.
8685 Weaker support is chosen by using the value
8686 .Ql 1
8687 (Unicode 6.3, but reserve the room of two spaces for writing the control
8688 sequences onto the line).
8689 The values
8690 .Ql 2
8692 .Ql 3
8693 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
8694 again reserves room for two spaces in addition.
8697 .It Va history-file
8698 \*(OP If a line editor is available then this can be set to
8699 name the (expandable) path of the location of a permanent history file.
8700 Also see
8701 .Va history-size .
8704 .It Va history-gabby
8705 \*(BO\*(OP Add more entries to the history as is normally done.
8708 .It Va history-gabby-persist
8709 \*(BO\*(OP \*(UA's own MLE will not save the additional
8710 .Va history-gabby
8711 entries in persistent storage unless this variable is set.
8712 On the other hand it will not loose the knowledge of whether
8713 a persistent entry was gabby or not.
8714 Also see
8715 .Va history-file .
8718 .It Va history-size
8719 \*(OP Setting this variable imposes a limit on the number of concurrent
8720 history entries.
8721 If set to the value 0 then no further history entries will be added, and
8722 loading and incorporation of the
8723 .Va history-file
8724 upon program startup can also be suppressed by doing this.
8725 Runtime changes will not be reflected, but will affect the number of
8726 entries saved to permanent storage.
8729 .It Va hold
8730 \*(BO This setting controls whether messages are held in the system
8731 .Va inbox ,
8732 and it is set by default.
8735 .It Va hostname
8736 Use this string as hostname when expanding local addresses instead of
8737 the value obtained from
8738 .Xr uname 3
8740 .Xr getaddrinfo 3 .
8741 It is used, e.g., in
8742 .Ql Message-ID:
8744 .Ql From:
8745 fields, as well as when generating
8746 .Ql Content-ID:
8747 MIME part related unique ID fields.
8748 Setting it to the empty string will cause the normal hostname to be
8749 used, but nonetheless enables creation of said ID fields.
8750 \*(IN in conjunction with the built-in SMTP
8751 .Va mta
8752 .Va smtp-hostname
8753 also influences the results:
8754 one should produce some test messages with the desired combination of
8755 .Va \&\&hostname ,
8756 and/or
8757 .Va from ,
8758 .Va sender
8759 etc. first.
8762 .It Va idna-disable
8763 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
8764 names according to the rules of IDNA (internationalized domain names
8765 for applications).
8766 Since the IDNA code assumes that domain names are specified with the
8767 .Va ttycharset
8768 character set, an UTF-8 locale charset is required to represent all
8769 possible international domain names (before conversion, that is).
8772 .It Va ifs
8773 The input field separator that is used (\*(ID by some functions) to
8774 determine where to split input data.
8776 .Bl -tag -compact -width ".It MMM"
8777 .It 1.
8778 Unsetting is treated as assigning the default value,
8779 .Ql \& \et\en .
8780 .It 2.
8781 If set to the empty value, no field splitting will be performed.
8782 .It 3.
8783 If set to a non-empty value, all whitespace characters are extracted
8784 and assigned to the variable
8785 .Va ifs-ws .
8788 .Bl -tag -compact -width ".It MMM"
8789 .It a.
8790 .Va \&\&ifs-ws
8791 will be ignored at the beginning and end of input.
8792 Diverging from POSIX shells default whitespace is removed in addition,
8793 which is owed to the entirely different line content extraction rules.
8794 .It b.
8795 Each occurrence of a character of
8796 .Va \&\&ifs
8797 will cause field-splitting, any adjacent
8798 .Va \&\&ifs-ws
8799 characters will be skipped.
8803 .It Va ifs-ws
8804 \*(RO Automatically deduced from the whitespace characters in
8805 .Va ifs .
8808 .It Va ignore
8809 \*(BO Ignore interrupt signals from the terminal while entering
8810 messages; instead echo them as
8811 .Ql @
8812 characters and discard the current line.
8815 .It Va ignoreeof
8816 \*(BO Ignore end-of-file conditions
8817 .Pf ( Ql control-D )
8818 in compose mode on message input and in interactive command input.
8819 If set an interactive command input session can only be left by
8820 explicitly using one of the commands
8821 .Ic exit
8823 .Ic quit ,
8824 and message input in compose mode can only be terminated by entering
8825 a period
8826 .Ql \&.
8827 on a line by itself or by using the
8828 .Ic ~.
8829 .Sx "COMMAND ESCAPES" ;
8830 Setting this implies the behaviour that
8831 .Va dot
8832 describes in
8833 .Va posix
8834 mode.
8837 .It Va inbox
8838 If this is set to a non-empty string it will specify the users
8839 .Mx -sx
8840 .Sx "primary system mailbox" ,
8841 overriding
8842 .Ev MAIL
8843 and the system-dependent default, and (thus) be used to replace
8844 .Ql %
8845 when doing
8846 .Sx "Filename transformations" ;
8847 also see
8848 .Ic file
8849 for more on this topic.
8850 The value supports a subset of transformations itself.
8853 .It Va indentprefix
8854 String used by the
8855 .Ic ~m , ~M
8857 .Ic ~R
8858 .Sx "COMMAND ESCAPES"
8859 and by the
8860 .Va quote
8861 option for indenting messages,
8862 in place of the normal tabulator character
8863 .Ql ^I ,
8864 which is the default.
8865 Be sure to quote the value if it contains spaces or tabs.
8868 .It Va keep
8869 \*(BO If set, an empty
8870 .Mx -sx
8871 .Sx "primary system mailbox"
8872 file is not removed.
8873 Note that, in conjunction with
8874 .Ev POSIXLY_CORRECT
8875 any empty file will be removed unless this variable is set.
8876 This may improve the interoperability with other mail user agents
8877 when using a common folder directory, and prevents malicious users
8878 from creating fake mailboxes in a world-writable spool directory.
8879 \*(ID Only local regular (MBOX) files are covered, Maildir or other
8880 mailbox types will never be removed, even if empty.
8883 .It Va keep-content-length
8884 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
8885 be told to keep the
8886 .Ql Content-Length:
8888 .Ql Lines:
8889 header fields that some MUAs generate by setting this variable.
8890 Since \*(UA does neither use nor update these non-standardized header
8891 fields (which in itself shows one of their conceptual problems),
8892 stripping them should increase interoperability in between MUAs that
8893 work with with same mailbox files.
8894 Note that, if this is not set but
8895 .Va writebackedited ,
8896 as below, is, a possibly performed automatic stripping of these header
8897 fields already marks the message as being modified.
8898 \*(ID At some future time \*(UA will be capable to rewrite and apply an
8899 .Va mime-encoding
8900 to modified messages, and then those fields will be stripped silently.
8903 .It Va keepsave
8904 \*(BO When a message is saved it is usually discarded from the
8905 originating folder when \*(UA is quit.
8906 This setting causes all saved message to be retained.
8909 .It Va line-editor-disable
8910 \*(BO Turn off any enhanced line editing capabilities (see
8911 .Sx "On terminal control and line editor"
8912 for more).
8915 .It Va line-editor-no-defaults
8916 \*(BO\*(OP Do not establish any default key binding.
8919 .It Va log-prefix
8920 Error log message prefix string
8921 .Pf ( Ql "\*(uA: " ) .
8924 .It Va mailbox-display
8925 \*(RO The name of the current mailbox
8926 .Pf ( Ic file ) ,
8927 possibly abbreviated for display purposes.
8930 .It Va mailbox-resolved
8931 \*(RO The fully resolved path of the current mailbox.
8934 .It Va mailx-extra-rc
8935 An additional startup file that is loaded as the last of the
8936 .Sx "Resource files" .
8937 Use this file for commands that are not understood by other POSIX
8938 .Xr mailx 1
8939 implementations, i.e., mostly anything which is not covered by
8940 .Sx "Initial settings" .
8943 .It Va markanswered
8944 \*(BO When a message is replied to and this variable is set,
8945 it is marked as having been
8946 .Ic answered .
8947 See the section
8948 .Sx "Message states" .
8951 .It Va mbox-rfc4155
8952 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
8953 POSIX rules for detecting message boundaries (so-called
8954 .Ql From_
8955 lines) due to compatibility reasons, instead of the stricter rules that
8956 have been standardized in RFC 4155.
8957 This behaviour can be switched to the stricter RFC 4155 rules by
8958 setting this variable.
8959 (This is never necessary for any message newly generated by \*(UA,
8960 it only applies to messages generated by buggy or malicious MUAs, or may
8961 occur in old MBOX databases: \*(UA itself will choose a proper
8962 .Va mime-encoding
8963 to avoid false interpretation of
8964 .Ql From_
8965 content lines in the MBOX database.)
8967 This may temporarily be handy when \*(UA complains about invalid
8968 .Ql From_
8969 lines when opening a MBOX: in this case setting this variable and
8970 re-opening the mailbox in question may correct the result.
8971 If so, copying the entire mailbox to some other file, as in
8972 .Ql copy * SOME-FILE ,
8973 will perform proper, all-compatible
8974 .Ql From_
8975 quoting for all detected messages, resulting in a valid MBOX mailbox.
8976 Finally the variable can be unset again:
8977 .Bd -literal -offset indent
8978 define mboxfix {
8979   localopts yes; wysh set mbox-rfc4155;\e
8980     wysh File "${1}"; eval copy * "${2}"
8982 call mboxfix /tmp/bad.mbox /tmp/good.mbox
8986 .It Va memdebug
8987 \*(BO Internal development variable.
8990 .It Va message-id-disable
8991 \*(BO By setting this variable the generation of
8992 .Ql Message-ID:
8993 can be completely suppressed, effectively leaving this task up to the
8994 .Va mta
8995 (Mail-Transfer-Agent) or the SMTP server.
8996 (According to RFC 5321 a SMTP server is not required to add this
8997 field by itself, so it should be ensured that it accepts messages without
8998 .Ql Message-ID . )
8999 This variable also affects automatic generation of
9000 .Va Content-ID:
9001 MIME header fields.
9004 .It Va message-inject-head
9005 A string to put at the beginning of each new message.
9006 The escape sequences tabulator
9007 .Ql \et
9008 and newline
9009 .Ql \en
9010 are understood.
9013 .It Va message-inject-tail
9014 A string to put at the end of each new message.
9015 The escape sequences tabulator
9016 .Ql \et
9017 and newline
9018 .Ql \en
9019 are understood.
9022 .It Va metoo
9023 \*(BO Usually, when an
9024 .Ic alias
9025 expansion contains the sender, the sender is removed from the expansion.
9026 Setting this option suppresses these removals.
9027 Note that a set
9028 .Va metoo
9029 also causes a
9030 .Ql -m
9031 option to be passed through to the
9032 .Va mta
9033 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
9034 this flag, no MTA is known which does not support it (for historical
9035 compatibility).
9038 .It Va mime-allow-text-controls
9039 \*(BO When sending messages, each part of the message is MIME-inspected
9040 in order to classify the
9041 .Ql Content-Type:
9043 .Ql Content-Transfer-Encoding:
9044 (see
9045 .Va mime-encoding )
9046 that is required to send this part over mail transport, i.e.,
9047 a computation rather similar to what the
9048 .Xr file 1
9049 command produces when used with the
9050 .Ql --mime
9051 option.
9053 This classification however treats text files which are encoded in
9054 UTF-16 (seen for HTML files) and similar character sets as binary
9055 octet-streams, forcefully changing any
9056 .Ql text/plain
9058 .Ql text/html
9059 specification to
9060 .Ql application/octet-stream :
9061 If that actually happens a yet unset charset MIME parameter is set to
9062 .Ql binary ,
9063 effectively making it impossible for the receiving MUA to automatically
9064 interpret the contents of the part.
9066 If this variable is set, and the data was unambiguously identified as
9067 text data at first glance (by a
9068 .Ql .txt
9070 .Ql .html
9071 file extension), then the original
9072 .Ql Content-Type:
9073 will not be overwritten.
9076 .It Va mime-alternative-favour-rich
9077 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
9078 HTML) will be preferred in favour of included plain text versions when
9079 displaying messages, provided that a handler exists which produces
9080 output that can be (re)integrated into \*(UA's normal visual display.
9081 (E.g., at the time of this writing some newsletters ship their full
9082 content only in the rich HTML part, whereas the plain text part only
9083 contains topic subjects.)
9086 .It Va mime-counter-evidence
9087 Normally the
9088 .Ql Content-Type:
9089 field is used to decide how to handle MIME parts.
9090 Some MUAs, however, do not use
9091 .Sx "The mime.types files"
9092 (also see
9093 .Sx "HTML mail and MIME attachments" )
9094 or a similar mechanism to correctly classify content, but specify an
9095 unspecific MIME type
9096 .Pf ( Ql application/octet-stream )
9097 even for plain text attachments.
9098 If this variable is set then \*(UA will try to re-classify such MIME
9099 message parts, if possible, for example via a possibly existing
9100 attachment filename.
9101 A non-empty value may also be given, in which case a number is expected,
9102 actually a carrier of bits.
9103 Creating the bit-carrying number is a simple addition:
9104 .Bd -literal -offset indent
9105 ? !echo Value should be set to $((2 + 4 + 8))
9106 Value should be set to 14
9109 .Bl -bullet -compact
9111 If bit two is set (2) then the detected
9112 .Ic mimetype
9113 will be carried along with the message and be used for deciding which
9114 MIME handler is to be used, for example;
9115 when displaying such a MIME part the part-info will indicate the
9116 overridden content-type by showing a plus sign
9117 .Ql + .
9119 If bit three is set (4) then the counter-evidence is always produced
9120 and a positive result will be used as the MIME type, even forcefully
9121 overriding the parts given MIME type.
9123 If bit four is set (8) then as a last resort the actual content of
9124 .Ql application/octet-stream
9125 parts will be inspected, so that data which looks like plain text can be
9126 treated as such.
9130 .It Va mime-encoding
9131 The MIME
9132 .Ql Content-Transfer-Encoding
9133 to use in outgoing text messages and message parts, where applicable.
9134 (7-bit clean text messages are sent as-is, without a transfer encoding.)
9135 Valid values are:
9137 .Bl -tag -compact -width ".It Ql _%%_"
9138 .It Ql 8bit
9139 .Pf (Or\0 Ql 8b . )
9140 8-bit transport effectively causes the raw data be passed through
9141 unchanged, but may cause problems when transferring mail messages over
9142 channels that are not ESMTP (RFC 1869) compliant.
9143 Also, several input data constructs are not allowed by the
9144 specifications and may cause a different transfer-encoding to be used.
9145 .It Ql quoted-printable
9146 .Pf (Or\0 Ql qp . )
9147 Quoted-printable encoding is 7-bit clean and has the property that ASCII
9148 characters are passed through unchanged, so that an english message can
9149 be read as-is; it is also acceptible for other single-byte locales that
9150 share many characters with ASCII, like, e.g., ISO-8859-1.
9151 The encoding will cause a large overhead for messages in other character
9152 sets: e.g., it will require up to twelve (12) bytes to encode a single
9153 UTF-8 character of four (4) bytes.
9154 .It Ql base64
9155 .Pf (Or\0 Ql b64 . )
9156 The default encoding, it is 7-bit clean and will always be used for
9157 binary data.
9158 This encoding has a constant input:output ratio of 3:4, regardless of
9159 the character set of the input data it will encode three bytes of input
9160 to four bytes of output.
9161 This transfer-encoding is not human readable without performing
9162 a decoding step.
9166 .It Va mimetypes-load-control
9167 Can be used to control which of
9168 .Sx "The mime.types files"
9169 are loaded: if the letter
9170 .Ql u
9171 is part of the option value, then the user's personal
9172 .Pa ~/.mime.types
9173 file will be loaded (if it exists); likewise the letter
9174 .Ql s
9175 controls loading of the system wide
9176 .Pa /etc/mime.types ;
9177 directives found in the user file take precedence, letter matching is
9178 case-insensitive.
9179 If this variable is not set \*(UA will try to load both files.
9180 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
9181 but they will be matched last (the order can be listed via
9182 .Ic mimetype ) .
9184 More sources can be specified by using a different syntax: if the
9185 value string contains an equals sign
9186 .Ql =
9187 then it is instead parsed as a comma-separated list of the described
9188 letters plus
9189 .Ql f=FILENAME
9190 pairs; the given filenames will be expanded and loaded, and their
9191 content may use the extended syntax that is described in the section
9192 .Sx "The mime.types files" .
9193 Directives found in such files always take precedence (are prepended to
9194 the MIME type cache).
9198 .It Va mta
9199 To choose an alternate Mail-Transfer-Agent, set this option to either
9200 the full pathname of an executable (optionally prefixed with a
9201 .Ql file://
9202 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
9204 .Dl smtps?://[user[:password]@]server[:port]
9206 (\*(OU:
9207 .Ql [smtp://]server[:port] . )
9208 The default has been chosen at compile time.
9209 All supported data transfers are executed in child processes, which
9210 run asynchronously and without supervision unless either the
9211 .Va sendwait
9212 or the
9213 .Va verbose
9214 variable is set.
9215 If such a child receives a TERM signal, it will abort and
9216 .Va save
9217 the message to
9218 .Ev DEAD ,
9219 if so configured.
9222 For a file-based MTA it may be necessary to set
9223 .Va mta-argv0
9224 in in order to choose the right target of a modern
9225 .Xr mailwrapper 8
9226 environment.
9227 It will be passed command line arguments from several possible sources:
9228 from the variable
9229 .Va mta-arguments
9230 if set, from the command line if given and the variable
9231 .Va expandargv
9232 allows their use.
9233 Argument processing of the MTA will be terminated with a
9234 .Fl \&\&-
9235 separator.
9238 The otherwise occurring implicit usage of the following MTA command
9239 line arguments can be disabled by setting the boolean variable
9240 .Va mta-no-default-arguments
9241 (which will also disable passing
9242 .Fl \&\&-
9243 to the MTA):
9244 .Fl \&\&i
9245 (for not treating a line with only a dot
9246 .Ql \&.
9247 character as the end of input),
9248 .Fl \&\&m
9249 (shall the variable
9250 .Va metoo
9251 be set) and
9252 .Fl \&\&v
9253 (if the
9254 .Va verbose
9255 variable is set); in conjunction with the
9256 .Fl r
9257 command line option \*(UA will also (not) pass
9258 .Fl \&\&f
9259 as well as possibly
9260 .Fl \&\&F .
9263 \*(OPally \*(UA can send mail over SMTP network connections to a single
9264 defined SMTP smart host by specifying a SMTP URL as the value (see
9265 .Sx "On URL syntax and credential lookup" ) .
9266 Note that with some mail providers it may be necessary to set the
9267 .Va smtp-hostname
9268 variable in order to use a specific combination of
9269 .Va from ,
9270 .Va hostname
9272 .Va mta .
9273 \*(UA also supports forwarding of all network traffic over a specified
9274 .Va socks-proxy .
9275 The following SMTP variants may be used:
9277 .Bl -bullet
9279 The plain SMTP protocol (RFC 5321) that normally lives on the
9280 server port 25 and requires setting the
9281 .Va smtp-use-starttls
9282 variable to enter a SSL/TLS encrypted session state.
9283 Assign a value like \*(IN
9284 .Ql smtp://[user[:password]@]server[:port]
9285 (\*(OU
9286 .Ql smtp://server[:port] )
9287 to choose this protocol.
9289 The so-called SMTPS which is supposed to live on server port 465
9290 and is automatically SSL/TLS secured.
9291 Unfortunately it never became a standardized protocol and may thus not
9292 be supported by your hosts network service database
9293 \(en in fact the port number has already been reassigned to other
9294 protocols!
9296 SMTPS is nonetheless a commonly offered protocol and thus can be
9297 chosen by assigning a value like \*(IN
9298 .Ql smtps://[user[:password]@]server[:port]
9299 (\*(OU
9300 .Ql smtps://server[:port] ) ;
9301 due to the mentioned problems it is usually necessary to explicitly
9302 specify the port as
9303 .Ql :465 ,
9304 however.
9306 Finally there is the SUBMISSION protocol (RFC 6409), which usually
9307 lives on server port 587 and is practically identically to the SMTP
9308 protocol from \*(UA's point of view beside that; it requires setting the
9309 .Va smtp-use-starttls
9310 variable to enter a SSL/TLS secured session state.
9311 Assign a value like \*(IN
9312 .Ql submission://[user[:password]@]server[:port]
9313 (\*(OU
9314 .Ql submission://server[:port] ) .
9319 .It Va mta-arguments
9320 Arguments to pass through to a file-based
9321 .Va mta
9322 can be given via this variable, which is parsed according to
9323 .Sx "Shell-style argument quoting"
9324 into an array of arguments, and which will be joined onto MTA options
9325 from other sources, and then passed individually to the MTA:
9326 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
9329 .It Va mta-no-default-arguments
9330 \*(BO Unless this variable is set \*(UA will pass some well known
9331 standard command line options to a file-based
9332 .Va mta
9333 (Mail-Transfer-Agent), see there for more.
9336 .It Va mta-argv0
9337 Many systems use a so-called
9338 .Xr mailwrapper 8
9339 environment to ensure compatibility with
9340 .Xr sendmail 1 .
9341 This works by inspecting the name that was used to invoke the mail
9342 delivery system.
9343 If this variable is set then the mailwrapper (the program that is
9344 actually executed when calling the file-based
9345 .Va mta )
9346 will treat its contents as that name.
9348 .Mx Va netrc-lookup
9349 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
9350 \*(BO\*(IN\*(OP Used to control usage of the users
9351 .Pa .netrc
9352 file for lookup of account credentials, as documented in the section
9353 .Sx "On URL syntax and credential lookup"
9354 and for the command
9355 .Ic netrc ;
9356 the section
9357 .Sx "The .netrc file"
9358 documents the file format.
9359 Also see
9360 .Va netrc-pipe .
9363 .It Va netrc-pipe
9364 \*(IN\*(OP When
9365 .Pa .netrc
9366 is loaded (see
9367 .Ic netrc
9369 .Va netrc-lookup )
9370 then \*(UA will read the output of a shell pipe instead of the users
9371 .Pa .netrc
9372 file if this variable is set (to the desired shell command).
9373 This can be used to, e.g., store
9374 .Pa .netrc
9375 in encrypted form:
9376 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
9379 .It Va newfolders
9380 If this variable has the value
9381 .Ql maildir ,
9382 newly created local folders will be in Maildir instead of MBOX format.
9385 .It Va newmail
9386 Checks for new mail in the current folder each time the prompt is shown.
9387 A Maildir folder must be re-scanned to determine if new mail has arrived.
9388 If this variable is set to the special value
9389 .Ql nopoll
9390 then a Maildir folder will not be rescanned completely, but only
9391 timestamp changes are detected.
9394 .It Va outfolder
9395 \*(BO Causes the filename given in the
9396 .Va record
9397 variable
9398 and the sender-based filenames for the
9399 .Ic Copy
9401 .Ic Save
9402 commands to be interpreted relative to the directory given in the
9403 .Va folder
9404 variable rather than to the current directory,
9405 unless it is set to an absolute pathname.
9408 .It Va on-compose-cleanup
9409 Macro hook which will be called after the message has been sent (or not,
9410 in case of failures), as the very last step before unrolling compose mode
9411 .Ic localopts .
9412 This hook is run even in case of fatal errors, and it is advisable to
9413 perform only absolutely necessary actions, like cleaning up
9414 .Ic alternates ,
9415 for example.
9416 For compose mode hooks that may affect the message content please see
9417 .Va on-compose-enter , on-compose-leave , on-compose-splice .
9418 \*(ID This hook exists only because
9419 .Ic alias , alternates , commandalias , shortcut ,
9420 to name a few, are currently not covered by
9421 .Ic localopts
9422 or a similar mechanism: any changes applied in compose mode will
9423 continue to be in effect thereafter.
9427 .It Va on-compose-enter , on-compose-leave
9428 Macro hooks which will be called before compose mode is entered,
9429 and after composing has been finished (but before the
9430 .Va signature
9431 is injected, etc.), respectively.
9432 .Ic localopts
9433 are enabled for these hooks, causing any setting to be forgotten after
9434 the message has been sent;
9435 .Va on-compose-cleanup
9436 can be used to perform any other necessary cleanup.
9437 The following (read-only) variables will be set temporarily during
9438 execution of the macros to represent the according message headers, or
9439 the empty string for non-existent; they correspond to accoding virtual
9440 temporary message headers that can be accessed via
9441 .Ic ~^ ,
9442 one of the
9443 .Sx "COMMAND ESCAPES" :
9445 .Bl -tag -compact -width ".It Va mailx_subject"
9446 .It Va mailx-command
9447 The command that generates the message.
9448 .It Va mailx-subject
9449 The subject.
9450 .It Va mailx-from
9451 .Va from .
9452 .It Va mailx-sender
9453 .Va sender .
9454 .It Va mailx-to , mailx-cc , mailx-bcc
9455 The list of receiver addresses as a space-separated list.
9456 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
9457 The list of receiver addresses before any mangling (due to, e.g.,
9458 .Ic alternates ,
9459 .Ic alias
9460 .Va recipients-in-cc )
9461 as a space-separated list.
9462 .It Va mailx-orig-from
9463 When replying, forwarding or resending, this will be set to the
9464 .Ql From:
9465 of the given message.
9466 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
9467 When replying, forwarding or resending, this will be set to the
9468 receivers of the given message.
9474 .It Va on-compose-splice , on-compose-splice-shell
9475 These hooks run once the normal compose mode is finished, but before the
9476 .Va on-compose-leave
9477 macro hook is called, the
9478 .Va signature
9479 is injected etc.
9480 Both hooks will be executed in a subprocess, with their input and output
9481 connected to \*(UA such that they can act as if they would be an
9482 interactive user.
9483 The difference in between them is that the latter is a
9484 .Ev SHELL
9485 command, whereas the former is a normal \*(UA macro, but which is
9486 restricted to a small set of commands (the
9487 .Va verbose
9488 output of, e.g.,
9489 .Ic list
9490 will indicate said capability).
9491 .Ic localopts
9492 are enabled for these hooks (in the parent process), causing any setting
9493 to be forgotten after the message has been sent;
9494 .Va on-compose-cleanup
9495 can be used to perform other cleanup as necessary.
9498 During execution of these hooks \*(UA will temporarily forget whether it
9499 has been started in interactive mode, (a restricted set of)
9500 .Sx "COMMAND ESCAPES"
9501 will always be available, and for guaranteed reproducibilities sake
9502 .Va escape
9504 .Va ifs
9505 will be set to their defaults.
9506 The compose mode command
9507 .Ic ~^
9508 has been especially designed for scriptability (via these hooks).
9509 The first line the hook will read on its standard input is the protocol
9510 version of said command escape, currently
9511 .Dq 0 0 1 :
9512 backward incompatible protocol changes have to be expected.
9515 Care must be taken to avoid deadlocks and other false control flow:
9516 if both involved processes wait for more input to happen at the
9517 same time, or one does not expect more input but the other is stuck
9518 waiting for consumption of its output, etc.
9519 There is no automatic synchronization of the hook: it will not be
9520 stopped automatically just because it, e.g., emits
9521 .Ql ~x .
9522 The hooks will however receive a termination signal if the parent enters
9523 an error condition.
9524 \*(ID Protection against and interaction with signals is not yet given;
9525 it is likely that in the future these scripts will be placed in an
9526 isolated session, which is signalled in its entirety as necessary.
9528 .Bd -literal -offset indent
9529 wysh set on-compose-splice-shell=$'\e
9530   read version;\e
9531   printf "hello $version!  Headers: ";\e
9532   echo \e'~^header list\e';\e
9533   read status result;\e
9534   echo "status=$status result=$result";\e
9535   '
9537 set on-compose-splice=ocsm
9538 define ocsm {
9539   read ver
9540   echo Splice protocol version is $ver
9541   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
9542   if [ "$es" != 2 ]
9543     echoerr 'Cannot read header list'; echo '~x'; xit
9544   endif
9545   if [ "$hl" @i!% ' cc' ]
9546     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
9547       vput vexpr es substring "${es}" 0 1
9548     if [ "$es" != 2 ]
9549       echoerr 'Cannot insert Cc: header'; echo '~x'
9550     endif
9551   endif
9557 .It Va on-resend-cleanup
9558 \*(ID Identical to
9559 .Va on-compose-cleanup ,
9560 but is only triggered by
9561 .Ic resend .
9564 .It Va on-resend-enter
9565 \*(ID Identical to
9566 .Va on-compose-enter ,
9567 but is only triggered by
9568 .Ic resend .
9571 .It Va page
9572 \*(BO If set, each message feed through the command given for
9573 .Ic pipe
9574 is followed by a formfeed character
9575 .Ql \ef .
9577 .Mx Va password
9578 .It Va password-USER@HOST , password-HOST , password
9579 \*(IN Variable chain that sets a password, which is used in case none has
9580 been given in the protocol and account-specific URL;
9581 as a last resort \*(UA will ask for a password on the user's terminal if
9582 the authentication method requires a password.
9583 Specifying passwords in a startup file is generally a security risk;
9584 the file should be readable by the invoking user only.
9586 .It Va password-USER@HOST
9587 \*(OU (see the chain above for \*(IN)
9588 Set the password for
9589 .Ql USER
9590 when connecting to
9591 .Ql HOST .
9592 If no such variable is defined for a host,
9593 the user will be asked for a password on standard input.
9594 Specifying passwords in a startup file is generally a security risk;
9595 the file should be readable by the invoking user only.
9598 .It Va piperaw
9599 \*(BO Send messages to the
9600 .Ic pipe
9601 command without performing MIME and character set conversions.
9605 .It Va pipe-TYPE/SUBTYPE
9606 When a MIME message part of type
9607 .Ql TYPE/SUBTYPE
9608 (case-insensitive) is displayed or quoted,
9609 its text is filtered through the value of this variable interpreted as
9610 a shell command.
9611 Note that only parts which can be displayed inline as plain text (see
9612 .Cd copiousoutput )
9613 are displayed unless otherwise noted, other MIME parts will only be
9614 considered by and for the command
9615 .Ic mimeview .
9618 The special value commercial at
9619 .Ql @
9620 forces interpretation of the message part as plain text, e.g.,
9621 .Ql set pipe-application/xml=@
9622 will henceforth display XML
9623 .Dq as is .
9624 (The same could also be achieved by adding a MIME type marker with the
9625 .Ic mimetype
9626 command.
9627 And \*(OPally MIME type handlers may be defined via
9628 .Sx "The Mailcap files"
9629 \(em these directives,
9630 .Cd copiousoutput
9631 has already been used, should be referred to for further documentation.
9634 The commercial at
9635 .Ql @
9636 can in fact be used as a trigger character to adjust usage and behaviour
9637 of a following shell command specification more thoroughly by appending
9638 more special characters which refer to further mailcap directives, e.g.,
9639 the following hypothetical command specification could be used:
9641 .Bd -literal -offset indent
9642 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
9646 .Bl -tag -compact -width ".It Ql __"
9647 .It Ql *
9648 The command produces plain text to be integrated in \*(UAs output:
9649 .Cd copiousoutput .
9651 .It Ql #
9652 If set the handler will not be invoked when a message is to be quoted,
9653 but only when it will be displayed:
9654 .Cd x-mailx-noquote .
9656 .It Ql &
9657 Run the command asynchronously, i.e., without blocking \*(UA:
9658 .Cd x-mailx-async .
9660 .It Ql \&!
9661 The command must be run on an interactive terminal, \*(UA will
9662 temporarily release the terminal to it:
9663 .Cd needsterminal .
9665 .It Ql +
9666 Request creation of a zero-sized temporary file, the absolute pathname
9667 of which will be made accessible via the environment variable
9668 .Ev MAILX_FILENAME_TEMPORARY :
9669 .Cd x-mailx-tmpfile .
9670 If given twice then the file will be unlinked automatically by \*(UA
9671 when the command loop is entered again at latest:
9672 .Cd x-mailx-tmpfile-unlink .
9674 .It Ql =
9675 Normally the MIME part content is passed to the handler via standard
9676 input; if this flag is set then the data will instead be written into
9677 .Ev MAILX_FILENAME_TEMPORARY
9678 .Pf ( Cd x-mailx-tmpfile-fill ) ,
9679 the creation of which is implied; note however that in order to cause
9680 deletion of the temporary file you still have to use two plus signs
9681 .Ql ++
9682 explicitly!
9684 .It Ql @
9685 To avoid ambiguities with normal shell command content you can use
9686 another commercial at to forcefully terminate interpretation of
9687 remaining characters.
9688 (Any character not in this list will have the same effect.)
9692 Some information about the MIME part to be displayed is embedded into
9693 the environment of the shell command:
9696 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
9698 .It Ev MAILX_CONTENT
9699 The MIME content-type of the part, if known, the empty string otherwise.
9702 .It Ev MAILX_CONTENT_EVIDENCE
9704 .Va mime-counter-evidence
9705 includes the carry-around-bit (2), then this will be set to the detected
9706 MIME content-type; not only then identical to
9707 .Ev \&\&MAILX_CONTENT
9708 otherwise.
9711 .It Ev MAILX_FILENAME
9712 The filename, if any is set, the empty string otherwise.
9715 .It Ev MAILX_FILENAME_GENERATED
9716 A random string.
9719 .It Ev MAILX_FILENAME_TEMPORARY
9720 If temporary file creation has been requested through the command prefix
9721 this variable will be set and contain the absolute pathname of the
9722 temporary file.
9727 .It Va pipe-EXTENSION
9728 This is identical to
9729 .Va pipe-TYPE/SUBTYPE
9730 except that
9731 .Ql EXTENSION
9732 (normalized to lowercase using character mappings of the ASCII charset)
9733 names a file extension, e.g.,
9734 .Ql xhtml .
9735 Handlers registered using this method take precedence.
9737 .Mx Va pop3-auth
9738 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
9739 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
9740 The only possible value as of now is
9741 .Ql plain ,
9742 which is thus the default.
9745 .Mx Va pop3-bulk-load
9746 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
9747 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
9748 the messages, and only requests the message bodies on user request.
9749 For the POP3 protocol this means that the message headers will be
9750 downloaded twice.
9751 If this variable is set then \*(UA will download only complete messages
9752 from the given POP3 server(s) instead.
9754 .Mx Va pop3-keepalive
9755 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
9756 \*(OP POP3 servers close the connection after a period of inactivity;
9757 the standard requires this to be at least 10 minutes,
9758 but practical experience may vary.
9759 Setting this variable to a numeric value greater than
9760 .Ql 0
9761 causes a
9762 .Ql NOOP
9763 command to be sent each value seconds if no other operation is performed.
9765 .Mx Va pop3-no-apop
9766 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
9767 \*(BO\*(OP Unless this variable is set the
9768 .Ql APOP
9769 authentication method will be used when connecting to a POP3 server that
9770 advertises support.
9771 The advantage of
9772 .Ql APOP
9773 is that the password is not sent in clear text over the wire and that
9774 only a single packet is sent for the user/password tuple.
9775 Note that
9776 .Va pop3-no-apop-HOST
9777 requires \*(IN.
9779 .Mx Va pop3-use-starttls
9780 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
9781 \*(BO\*(OP Causes \*(UA to issue a
9782 .Ql STLS
9783 command to make an unencrypted POP3 session SSL/TLS encrypted.
9784 This functionality is not supported by all servers,
9785 and is not used if the session is already encrypted by the POP3S method.
9786 Note that
9787 .Va pop3-use-starttls-HOST
9788 requires \*(IN.
9792 .It Va posix
9793 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
9794 where that deviates from standardized behaviour.
9795 It will be set implicitly before the
9796 .Sx "Resource files"
9797 are loaded if the environment variable
9798 .Ev POSIXLY_CORRECT
9799 is set, and adjusting any of those two will be reflected by the other
9800 one implicitly.
9801 The following behaviour is covered and enforced by this mechanism:
9804 .Bl -bullet -compact
9806 In non-interactive mode, any error encountered while loading resource
9807 files during program startup will cause a program exit, whereas in
9808 interactive mode such errors will stop loading of the currently loaded
9809 (stack of) file(s, i.e., recursively).
9810 These exits can be circumvented on a per-command base by using
9811 .Cm ignerr ,
9812 one of the
9813 .Sx "Command modifiers" ,
9814 for each command which shall be allowed to fail.
9817 .Ic alternates
9818 will replace the list of alternate addresses instead of appending to it.
9821 Upon changing the active
9822 .Ic file
9823 no summary of
9824 .Ic headers
9825 will be displayed even if
9826 .Va header
9827 is set.
9830 Setting
9831 .Va ignoreeof
9832 implies the behaviour described by
9833 .Va dot .
9836 The variable
9837 .Va keep
9838 is extended to cover any empty mailbox, not only empty
9839 .Mx -sx
9840 .Sx "primary system mailbox" Ns
9841 es: they will be removed when they are left in empty state otherwise.
9846 .It Va print-alternatives
9847 \*(BO When a MIME message part of type
9848 .Ql multipart/alternative
9849 is displayed and it contains a subpart of type
9850 .Ql text/plain ,
9851 other parts are normally discarded.
9852 Setting this variable causes all subparts to be displayed,
9853 just as if the surrounding part was of type
9854 .Ql multipart/mixed .
9857 .It Va prompt
9858 The string used as a prompt in interactive mode.
9859 Whenever the variable is evaluated the value is expanded as via
9860 dollar-single-quote expansion (see
9861 .Sx "Shell-style argument quoting" ) .
9862 This (post-assignment, i.e., second) expansion can be used to embed
9863 status information, for example
9864 .Va \&? ,
9865 .Va \&! ,
9866 .Va account
9868 .Va mailbox-display .
9870 In order to embed characters which should not be counted when
9871 calculating the visual width of the resulting string, enclose the
9872 characters of interest in a pair of reverse solidus escaped brackets:
9873 .Ql \e[\eE[0m\e] ;
9874 a slot for coloured prompts is also available with the \*(OPal command
9875 .Ic colour .
9876 Prompting may be prevented by setting this to the null string
9877 (a.k.a.\|
9878 .Ql set noprompt ) .
9881 .It Va prompt2
9882 This string is used for secondary prompts, but is otherwise identical to
9883 .Va prompt .
9884 The default is
9885 .Ql ..\0 .
9888 .It Va quiet
9889 \*(BO Suppresses the printing of the version when first invoked.
9892 .It Va quote
9893 If set, \*(UA starts a replying message with the original message
9894 prefixed by the value of the variable
9895 .Va indentprefix .
9896 Normally, a heading consisting of
9897 .Dq Fromheaderfield wrote:
9898 is put before the quotation.
9899 If the string
9900 .Ql noheading
9901 is assigned to the
9902 .Va \&\&quote
9903 variable, this heading is omitted.
9904 If the string
9905 .Ql headers
9906 is assigned, only the headers selected by the
9907 .Ql type
9908 .Ic headerpick
9909 selection are put above the message body,
9910 thus
9911 .Va \&\&quote
9912 acts like an automatic
9913 .Pf ` Ic ~m Ns '
9914 .Sx "COMMAND ESCAPES"
9915 command, then.
9916 If the string
9917 .Ql allheaders
9918 is assigned, all headers are put above the message body and all MIME
9919 parts are included, making
9920 .Va \&\&quote
9921 act like an automatic
9922 .Pf ` Ic ~M Ns '
9923 command; also see
9924 .Va quote-as-attachment .
9927 .It Va quote-as-attachment
9928 \*(BO Add the original message in its entirety as a
9929 .Ql message/rfc822
9930 MIME attachment when replying to a message.
9931 Note this works regardless of the setting of
9932 .Va quote .
9935 .It Va quote-fold
9936 \*(OP Can be set in addition to
9937 .Va indentprefix .
9938 Setting this turns on a more fancy quotation algorithm in that leading
9939 quotation characters are compressed and overlong lines are folded.
9940 .Va \&\&quote-fold
9941 can be set to either one or two (space separated) numeric values,
9942 which are interpreted as the maximum (goal) and the minimum line length,
9943 respectively, in a spirit rather equal to the
9944 .Xr fmt 1
9945 program, but line-, not paragraph-based.
9946 If not set explicitly the minimum will reflect the goal algorithmically.
9947 The goal cannot be smaller than the length of
9948 .Va indentprefix
9949 plus some additional pad.
9950 Necessary adjustments take place silently.
9953 .It Va r-option-implicit
9954 \*(BO Setting this option evaluates the contents of
9955 .Va from
9956 (or, if that contains multiple addresses,
9957 .Va sender )
9958 and passes the results onto the used (file-based) MTA as described for the
9959 .Fl r
9960 option (empty argument case).
9963 .It Va recipients-in-cc
9964 \*(BO When doing a
9965 .Ic reply ,
9966 the original
9967 .Ql From:
9969 .Ql To:
9970 are by default merged into the new
9971 .Ql To: .
9972 If this variable is set, only the original
9973 .Ql From:
9974 ends in the new
9975 .Ql To: ,
9976 the rest is merged into
9977 .Ql Cc: .
9980 .It Va record
9981 Unless this variable is defined, no copies of outgoing mail will be saved.
9982 If defined it gives the pathname, subject to the usual
9983 .Sx "Filename transformations" ,
9984 of a folder where all new, replied-to or forwarded messages are saved:
9985 when saving to this folder fails the message is not sent, but instead
9986 .Va save Ns
9987 d to
9988 .Ev DEAD .
9989 The standard defines that relative (fully expanded) paths are to be
9990 interpreted relative to the current directory
9991 .Pf ( Ic cwd ) ,
9992 to force interpretation relative to
9993 .Va folder
9994 .Va outfolder
9995 needs to be set in addition.
9998 .It Va record-files
9999 \*(BO If this variable is set the meaning of
10000 .Va record
10001 will be extended to cover messages which target only file and pipe
10002 recipients (see
10003 .Va expandaddr ) .
10004 These address types will not appear in recipient lists unless
10005 .Va add-file-recipients
10006 is also set.
10009 .It Va record-resent
10010 \*(BO If this variable is set the meaning of
10011 .Va record
10012 will be extended to also cover the
10013 .Ic resend
10015 .Ic Resend
10016 commands.
10019 .It Va reply-in-same-charset
10020 \*(BO If this variable is set \*(UA first tries to use the same
10021 character set of the original message for replies.
10022 If this fails, the mechanism described in
10023 .Sx "Character sets"
10024 is evaluated as usual.
10027 .It Va reply-strings
10028 Can be set to a comma-separated list of (case-insensitive according to
10029 ASCII rules) strings which shall be recognized in addition to the
10030 built-in strings as
10031 .Ql Subject:
10032 reply message indicators \(en built-in are
10033 .Ql Re: ,
10034 which is mandated by RFC 5322, as well as the german
10035 .Ql Aw: ,
10036 .Ql Antw: ,
10037 and the
10038 .Ql Wg:
10039 which often has been seen in the wild;
10040 I.e., the separating colon has to be specified explicitly.
10043 .It Va replyto
10044 A list of addresses to put into the
10045 .Ql Reply-To:
10046 field of the message header.
10047 Members of this list are handled as if they were in the
10048 .Ic alternates
10049 list.
10052 .It Va reply-to-honour
10053 Controls whether a
10054 .Ql Reply-To:
10055 header is honoured when replying to a message via
10056 .Ic reply
10058 .Ic Lreply .
10059 This is a quadoption; if set without a value it defaults to
10060 .Dq yes .
10063 .It Va rfc822-body-from_
10064 \*(BO This variable can be used to force displaying a so-called
10065 .Ql From_
10066 line for messages that are embedded into an envelope mail via the
10067 .Ql message/rfc822
10068 MIME mechanism, for more visual convenience.
10071 .It Va save
10072 \*(BO Enable saving of (partial) messages in
10073 .Ev DEAD
10074 upon interrupt or delivery error.
10077 .It Va screen
10078 The number of lines that represents a
10079 .Dq screenful
10080 of lines, used in
10081 .Ic headers
10082 summary display,
10083 .Ic from
10084 .Ic search Ns
10085 ing, message
10086 .Ic top Ns
10087 line display and scrolling via
10088 .Ic z .
10089 If this variable is not set \*(UA falls back to a calculation based upon
10090 the detected terminal window size and the baud rate: the faster the
10091 terminal, the more will be shown.
10092 Overall screen dimensions and pager usage is influenced by the
10093 environment variables
10094 .Ev COLUMNS
10096 .Ev LINES
10097 and the variable
10098 .Va crt .
10101 .It Va searchheaders
10102 \*(BO Expand message-list specifiers in the form
10103 .Ql /x:y
10104 to all messages containing the substring
10105 .Dq y
10106 in the header field
10107 .Ql x .
10108 The string search is case insensitive.
10111 .It Va sendcharsets
10112 \*(OP A comma-separated list of character set names that can be used in
10113 outgoing internet mail.
10114 The value of the variable
10115 .Va charset-8bit
10116 is automatically appended to this list of character sets.
10117 If no character set conversion capabilities are compiled into \*(UA then
10118 the only supported charset is
10119 .Va ttycharset .
10120 Also see
10121 .Va sendcharsets-else-ttycharset
10122 and refer to the section
10123 .Sx "Character sets"
10124 for the complete picture of character set conversion in \*(UA.
10127 .It Va sendcharsets-else-ttycharset
10128 \*(BO\*(OP If this variable is set, but
10129 .Va sendcharsets
10130 is not, then \*(UA acts as if
10131 .Va sendcharsets
10132 had been set to the value of the variable
10133 .Va ttycharset .
10134 In effect this combination passes through the message data in the
10135 character set of the current locale encoding:
10136 therefore mail message text will be (assumed to be) in ISO-8859-1
10137 encoding when send from within a ISO-8859-1 locale, and in UTF-8
10138 encoding when send from within an UTF-8 locale.
10140 The 8-bit fallback
10141 .Va charset-8bit
10142 never comes into play as
10143 .Va ttycharset
10144 is implicitly assumed to be 8-bit and capable to represent all files the
10145 user may specify (as is the case when no character set conversion
10146 support is available in \*(UA and the only supported character set is
10147 .Va ttycharset :
10148 .Sx "Character sets" ) .
10149 This might be a problem for scripts which use the suggested
10150 .Ql LC_ALL=C
10151 setting, since in this case the character set is US-ASCII by definition,
10152 so that it is better to also override
10153 .Va ttycharset ,
10154 then.
10157 .It Va sender
10158 An address that is put into the
10159 .Ql Sender:
10160 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
10161 responsible for the actual transmission of the message.
10162 This field should normally not be used unless the
10163 .Va from
10164 field contains more than one address, on which case it is required.
10166 .Va \&\&sender
10167 address is handled as if it were in the
10168 .Ic alternates
10169 list; also see
10170 .Fl r ,
10171 .Va r-option-implicit .
10173 .It Va sendmail
10174 \*(OB Predecessor of
10175 .Va mta .
10177 .It Va sendmail-arguments
10178 \*(OB Predecessor of
10179 .Va mta-arguments .
10181 .It Va sendmail-no-default-arguments
10182 \*(OB\*(BO Predecessor of
10183 .Va mta-no-default-arguments .
10185 .It Va sendmail-progname
10186 \*(OB Predecessor of
10187 .Va mta-argv0 .
10190 .It Va sendwait
10191 \*(BO When sending a message wait until the
10192 .Va mta
10193 (including the built-in SMTP one) exits before accepting further commands.
10194 .Sy Only
10195 with this variable set errors reported by the MTA will be recognizable!
10196 If the MTA returns a non-zero exit status,
10197 the exit status of \*(UA will also be non-zero.
10200 .It Va showlast
10201 \*(BO This setting causes \*(UA to start at the last message
10202 instead of the first one when opening a mail folder.
10205 .It Va showname
10206 \*(BO Causes \*(UA to use the sender's real name instead of the plain
10207 address in the header field summary and in message specifications.
10210 .It Va showto
10211 \*(BO Causes the recipient of the message to be shown in the header
10212 summary if the message was sent by the user.
10215 .It Va Sign
10216 The string to expand
10217 .Ic ~A
10218 to (see
10219 .Sx "COMMAND ESCAPES" ) .
10222 .It Va sign
10223 The string to expand
10224 .Ic ~a
10225 to (see
10226 .Sx "COMMAND ESCAPES" ) .
10229 .It Va signature
10230 Must correspond to the name of a readable file if set.
10231 The file's content is then appended to each singlepart message
10232 and to the first part of each multipart message.
10233 Be warned that there is no possibility to edit the signature for an
10234 individual message.
10237 .It Va skipemptybody
10238 \*(BO If an outgoing message does not contain any text in its first or
10239 only message part, do not send it but discard it silently (see also the
10240 command line option
10241 .Fl E ) .
10245 .It Va smime-ca-dir , smime-ca-file
10246 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10247 Enhanced Mail) format as a directory and a file, respectively, for the
10248 purpose of verification of S/MIME signed messages.
10249 It is possible to set both, the file will be loaded immediately, the
10250 directory will be searched whenever no match has yet been found.
10251 The set of CA certificates which are built into the SSL/TLS library can
10252 be explicitly turned off by setting
10253 .Va smime-ca-no-defaults ,
10254 and further fine-tuning is possible via
10255 .Va smime-ca-flags .
10258 .It Va smime-ca-flags
10259 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10260 storage, and the certificate verification that is used.
10261 The actual values and their meanings are documented for
10262 .Va ssl-ca-flags .
10265 .It Va smime-ca-no-defaults
10266 \*(BO\*(OP Do not load the default CA locations that are built into the
10267 used to SSL/TLS library to verify S/MIME signed messages.
10269 .Mx Va smime-cipher
10270 .It Va smime-cipher-USER@HOST , smime-cipher
10271 \*(OP Specifies the cipher to use when generating S/MIME encrypted
10272 messages (for the specified account).
10273 RFC 5751 mandates a default of
10274 .Ql aes128
10275 (AES-128 CBC).
10276 Possible values are (case-insensitive and) in decreasing cipher strength:
10277 .Ql aes256
10278 (AES-256 CBC),
10279 .Ql aes192
10280 (AES-192 CBC),
10281 .Ql aes128
10282 (AES-128 CBC),
10283 .Ql des3
10284 (DES EDE3 CBC, 168 bits; default if
10285 .Ql aes128
10286 is not available) and
10287 .Ql des
10288 (DES CBC, 56 bits).
10290 The actually available cipher algorithms depend on the cryptographic
10291 library that \*(UA uses.
10292 \*(OP Support for more cipher algorithms may be available through
10293 dynamic loading via, e.g.,
10294 .Xr EVP_get_cipherbyname 3
10295 (OpenSSL) if \*(UA has been compiled to support this.
10298 .It Va smime-crl-dir
10299 \*(OP Specifies a directory that contains files with CRLs in PEM format
10300 to use when verifying S/MIME messages.
10303 .It Va smime-crl-file
10304 \*(OP Specifies a file that contains a CRL in PEM format to use when
10305 verifying S/MIME messages.
10308 .It Va smime-encrypt-USER@HOST
10309 \*(OP If this variable is set, messages send to the given receiver are
10310 encrypted before sending.
10311 The value of the variable must be set to the name of a file that
10312 contains a certificate in PEM format.
10314 If a message is sent to multiple recipients,
10315 each of them for whom a corresponding variable is set will receive an
10316 individually encrypted message;
10317 other recipients will continue to receive the message in plain text
10318 unless the
10319 .Va smime-force-encryption
10320 variable is set.
10321 It is recommended to sign encrypted messages, i.e., to also set the
10322 .Va smime-sign
10323 variable.
10326 .It Va smime-force-encryption
10327 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
10330 .It Va smime-sign
10331 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
10332 and include the user's certificate as a MIME attachment.
10333 Signing a message enables a recipient to verify that the sender used
10334 a valid certificate,
10335 that the email addresses in the certificate match those in the message
10336 header and that the message content has not been altered.
10337 It does not change the message text,
10338 and people will be able to read the message as usual.
10339 Also see
10340 .Va smime-sign-cert , smime-sign-include-certs
10342 .Va smime-sign-message-digest .
10344 .Mx Va smime-sign-cert
10345 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
10346 \*(OP Points to a file in PEM format.
10347 For the purpose of signing and decryption this file needs to contain the
10348 user's private key, followed by his certificate.
10350 For message signing
10351 .Ql USER@HOST
10352 is always derived from the value of
10353 .Va from
10354 (or, if that contains multiple addresses,
10355 .Va sender ) .
10356 For the purpose of encryption the recipient's public encryption key
10357 (certificate) is expected; the command
10358 .Ic certsave
10359 can be used to save certificates of signed messages (the section
10360 .Sx "Signed and encrypted messages with S/MIME"
10361 gives some details).
10362 This mode of operation is usually driven by the specialized form.
10364 When decrypting messages the account is derived from the recipient
10365 fields
10366 .Pf ( Ql To:
10368 .Ql Cc: )
10369 of the message, which are searched for addresses for which such
10370 a variable is set.
10371 \*(UA always uses the first address that matches,
10372 so if the same message is sent to more than one of the user's addresses
10373 using different encryption keys, decryption might fail.
10375 For signing and decryption purposes it is possible to use encrypted
10376 keys, and the pseudo-host(s)
10377 .Ql USER@HOST.smime-cert-key
10378 for the private key
10379 (and
10380 .Ql USER@HOST.smime-cert-cert
10381 for the certificate stored in the same file)
10382 will be used for performing any necessary password lookup,
10383 therefore the lookup can be automatized via the mechanisms described in
10384 .Sx "On URL syntax and credential lookup" .
10385 For example, the hypothetical address
10386 .Ql bob@exam.ple
10387 could be driven with a private key / certificate pair path defined in
10388 .Va \&\&smime-sign-cert-bob@exam.ple ,
10389 and needed passwords would then be looked up via the pseudo hosts
10390 .Ql bob@exam.ple.smime-cert-key
10391 (and
10392 .Ql bob@exam.ple.smime-cert-cert ) .
10393 To include intermediate certificates, use
10394 .Va smime-sign-include-certs .
10396 .Mx Va smime-sign-include-certs
10397 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
10398 \*(OP If used, this is supposed to a consist of a comma-separated list
10399 of files, each of which containing a single certificate in PEM format to
10400 be included in the S/MIME message in addition to the
10401 .Va smime-sign-cert
10402 certificate.
10403 This can be used to include intermediate certificates of the certificate
10404 authority, in order to allow the receiver's S/MIME implementation to
10405 perform a verification of the entire certificate chain, starting from
10406 a local root certificate, over the intermediate certificates, down to the
10407 .Va smime-sign-cert .
10408 Even though top level certificates may also be included in the chain,
10409 they won't be used for the verification on the receiver's side.
10411 For the purpose of the mechanisms involved here,
10412 .Ql USER@HOST
10413 refers to the content of the internal variable
10414 .Va from
10415 (or, if that contains multiple addresses,
10416 .Va sender ) .
10417 The pseudo-host
10418 .Ql USER@HOST.smime-include-certs
10419 will be used for performing password lookups for these certificates,
10420 shall they have been given one, therefore the lookup can be automatized
10421 via the mechanisms described in
10422 .Sx "On URL syntax and credential lookup" .
10424 .Mx Va smime-sign-message-digest
10425 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
10426 \*(OP Specifies the message digest to use when signing S/MIME messages.
10427 RFC 5751 mandates a default of
10428 .Ql sha1 .
10429 Possible values are (case-insensitive and) in decreasing cipher strength:
10430 .Ql sha512 ,
10431 .Ql sha384 ,
10432 .Ql sha256 ,
10433 .Ql sha224
10435 .Ql md5 .
10437 The actually available message digest algorithms depend on the
10438 cryptographic library that \*(UA uses.
10439 \*(OP Support for more message digest algorithms may be available
10440 through dynamic loading via, e.g.,
10441 .Xr EVP_get_digestbyname 3
10442 (OpenSSL) if \*(UA has been compiled to support this.
10443 Remember that for this
10444 .Ql USER@HOST
10445 refers to the variable
10446 .Va from
10447 (or, if that contains multiple addresses,
10448 .Va sender ) .
10450 .It Va smtp
10451 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
10452 .Va mta .
10453 \*(ID For compatibility reasons a set
10454 .Va smtp
10455 is used in preference of
10456 .Va mta .
10458 .Mx Va smtp-auth
10459 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
10460 \*(OP Variable chain that controls the SMTP
10461 .Va mta
10462 authentication method, possible values are
10463 .Ql none
10464 (\*(OU default),
10465 .Ql plain
10466 (\*(IN default),
10467 .Ql login
10468 as well as the \*(OPal methods
10469 .Ql cram-md5
10471 .Ql gssapi .
10473 .Ql none
10474 method does not need any user credentials,
10475 .Ql gssapi
10476 requires a user name and all other methods require a user name and
10477 a password.
10478 See \*(IN
10479 .Va mta ,
10480 .Va user
10482 .Va password
10483 (\*(OU
10484 .Va smtp-auth-password
10486 .Va smtp-auth-user ) .
10487 Note that
10488 .Va smtp-auth-HOST
10489 is \*(IN.
10490 \*(OU: Note for
10491 .Va smtp-auth-USER@HOST :
10492 may override dependent on sender address in the variable
10493 .Va from .
10495 .It Va smtp-auth-password
10496 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
10497 If the authentication method requires a password, but neither
10498 .Va smtp-auth-password
10499 nor a matching
10500 .Va smtp-auth-password-USER@HOST
10501 can be found,
10502 \*(UA will ask for a password on the user's terminal.
10504 .It Va smtp-auth-password-USER@HOST
10505 \*(OU Overrides
10506 .Va smtp-auth-password
10507 for specific values of sender addresses, dependent upon the variable
10508 .Va from .
10510 .It Va smtp-auth-user
10511 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
10512 If the authentication method requires a user name, but neither
10513 .Va smtp-auth-user
10514 nor a matching
10515 .Va smtp-auth-user-USER@HOST
10516 can be found,
10517 \*(UA will ask for a user name on the user's terminal.
10519 .It Va smtp-auth-user-USER@HOST
10520 \*(OU Overrides
10521 .Va smtp-auth-user
10522 for specific values of sender addresses, dependent upon the variable
10523 .Va from .
10526 .It Va smtp-hostname
10527 \*(OP\*(IN Normally \*(UA uses the variable
10528 .Va from
10529 to derive the necessary
10530 .Ql USER@HOST
10531 information in order to issue a
10532 .Ql MAIL FROM:<>
10533 SMTP
10534 .Va mta
10535 command.
10536 Setting
10537 .Va smtp-hostname
10538 can be used to use the
10539 .Ql USER
10540 from the SMTP account
10541 .Pf ( Va mta
10542 or the
10543 .Va user
10544 variable chain)
10545 and the
10546 .Ql HOST
10547 from the content of this variable (or, if that is the empty string,
10548 .Va hostname
10549 or the local hostname as a last resort).
10550 This often allows using an address that is itself valid but hosted by
10551 a provider other than which (in
10552 .Va from )
10553 is about to send the message.
10554 Setting this variable also influences generated
10555 .Ql Message-ID:
10557 .Ql Content-ID:
10558 header fields.
10560 .Mx Va smtp-use-starttls
10561 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
10562 \*(BO\*(OP Causes \*(UA to issue a
10563 .Ql STARTTLS
10564 command to make an SMTP
10565 .Va mta
10566 session SSL/TLS encrypted, i.e., to enable transport layer security.
10568 .Mx Va socks-proxy
10569 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
10570 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
10571 \*(UA will proxy all of its network activities through it.
10572 This can be used to proxy SMTP, POP3 etc. network traffic through the
10573 Tor anonymizer, for example.
10574 The following would create a local SOCKS proxy on port 10000 that
10575 forwards to the machine
10576 .Ql HOST ,
10577 and from which the network traffic is actually instantiated:
10578 .Bd -literal -offset indent
10579 # Create local proxy server in terminal 1 forwarding to HOST
10580 $ ssh -D 10000 USER@HOST
10581 # Then, start a client that uses it in terminal 2
10582 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
10586 .It Va spam-interface
10587 \*(OP In order to use any of the spam-related commands (like, e.g.,
10588 .Ic spamrate )
10589 the desired spam interface must be defined by setting this variable.
10590 Please refer to the manual section
10591 .Sx "Handling spam"
10592 for the complete picture of spam handling in \*(UA.
10593 All or none of the following interfaces may be available:
10595 .Bl -tag -width ".It Ql _ilte_"
10596 .It Ql spamc
10597 Interaction with
10598 .Xr spamc 1
10599 from the
10600 .Xr spamassassin 1
10601 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
10602 suite.
10603 Different to the generic filter interface \*(UA will automatically add
10604 the correct arguments for a given command and has the necessary
10605 knowledge to parse the program's output.
10606 A default value for
10607 .Va spamc-command
10608 will have been compiled into the \*(UA binary if
10609 .Xr spamc 1
10610 has been found in
10611 .Ev PATH
10612 during compilation.
10613 Shall it be necessary to define a specific connection type (rather than
10614 using a configuration file for that), the variable
10615 .Va spamc-arguments
10616 can be used as in, e.g.,
10617 .Ql -d server.example.com -p 783 .
10618 It is also possible to specify a per-user configuration via
10619 .Va spamc-user .
10620 Note that this interface does not inspect the
10621 .Ql is-spam
10622 flag of a message for the command
10623 .Ic spamforget .
10625 .It Ql filter
10626 generic spam filter support via freely configurable hooks.
10627 This interface is meant for programs like
10628 .Xr bogofilter 1
10629 and requires according behaviour in respect to the hooks' exit
10630 status for at least the command
10631 .Ic spamrate
10632 .Pf ( Ql 0
10633 meaning a message is spam,
10634 .Ql 1
10635 for non-spam,
10636 .Ql 2
10637 for unsure and any other return value indicating a hard error);
10638 since the hooks can include shell code snippets diverting behaviour
10639 can be intercepted as necessary.
10640 The hooks are
10641 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
10642   spamfilter-rate
10644 .Va spamfilter-spam ;
10645 the manual section
10646 .Sx "Handling spam"
10647 contains examples for some programs.
10648 The process environment of the hooks will have the variable
10649 .Ev MAILX_FILENAME_GENERATED
10650 set.
10651 Note that spam score support for
10652 .Ic spamrate
10653 is not supported unless the \*(OPtional regular expression support is
10654 available and the
10655 .Va spamfilter-rate-scanscore
10656 variable is set.
10661 .It Va spam-maxsize
10662 \*(OP Messages that exceed this size will not be passed through to the
10663 configured
10664 .Va spam-interface .
10665 If unset or 0, the default of 420000 bytes is used.
10668 .It Va spamc-command
10669 \*(OP The path to the
10670 .Xr spamc 1
10671 program for the
10672 .Ql spamc
10673 .Va spam-interface .
10674 Note that the path is not expanded, but used
10675 .Dq as is .
10676 A fallback path will have been compiled into the \*(UA binary if the
10677 executable had been found during compilation.
10680 .It Va spamc-arguments
10681 \*(OP Even though \*(UA deals with most arguments for the
10682 .Ql spamc
10683 .Va spam-interface
10684 automatically, it may at least sometimes be desirable to specify
10685 connection-related ones via this variable, e.g.,
10686 .Ql -d server.example.com -p 783 .
10689 .It Va spamc-user
10690 \*(OP Specify a username for per-user configuration files for the
10691 .Ql spamc
10692 .Va spam-interface .
10693 If this is set to the empty string then \*(UA will use the name of the
10694 current
10695 .Va user .
10702 .It Va spamfilter-ham , spamfilter-noham , \
10703   spamfilter-nospam , spamfilter-rate , spamfilter-spam
10704 \*(OP Command and argument hooks for the
10705 .Ql filter
10706 .Va spam-interface .
10707 The manual section
10708 .Sx "Handling spam"
10709 contains examples for some programs.
10712 .It Va spamfilter-rate-scanscore
10713 \*(OP Because of the generic nature of the
10714 .Ql filter
10715 .Va spam-interface
10716 spam scores are not supported for it by default, but if the \*(OPnal
10717 regular expression support is available then setting this variable can
10718 be used to overcome this restriction.
10719 It is interpreted as follows: first a number (digits) is parsed that
10720 must be followed by a semicolon
10721 .Ql \&;
10722 and an extended regular expression.
10723 Then the latter is used to parse the first output line of the
10724 .Va spamfilter-rate
10725 hook, and, in case the evaluation is successful, the group that has been
10726 specified via the number is interpreted as a floating point scan score.
10730 .It Va ssl-ca-dir , ssl-ca-file
10731 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10732 Enhanced Mail) format as a directory and a file, respectively, for the
10733 purpose of verification of SSL/TLS server certificates.
10734 It is possible to set both, the file will be loaded immediately, the
10735 directory will be searched whenever no match has yet been found.
10736 The set of CA certificates which are built into the SSL/TLS library can
10737 be explicitly turned off by setting
10738 .Va ssl-ca-no-defaults ,
10739 and further fine-tuning is possible via
10740 .Va ssl-ca-flags ;
10741 also see
10742 .Xr SSL_CTX_load_verify_locations 3
10743 for more information.
10744 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
10745 establishing TLS connections to servers identified with hostnames.
10749 .It Va ssl-ca-flags
10750 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10751 storage, and the certificate verification that is used (also see
10752 .Va ssl-verify ) .
10753 The value is expected to consist of a comma-separated list of
10754 configuration directives, with any intervening whitespace being ignored.
10755 The directives directly map to flags that can be passed to
10756 .Xr X509_STORE_set_flags 3 ,
10757 which are usually defined in a file
10758 .Pa openssl/x509_vfy.h ,
10759 and the availability of which depends on the used SSL/TLS library
10760 version: a directive without mapping is ignored (error log subject to
10761 .Va debug ) .
10762 Directives currently understood (case-insensitively) include:
10765 .Bl -tag -compact -width ".It Cd BaNg"
10766 .It Cd no-alt-chains
10767 If the initial chain is not trusted, do not attempt to build an
10768 alternative chain.
10769 Setting this flag will make OpenSSL certificate verification match that
10770 of older OpenSSL versions, before automatic building and checking of
10771 alternative chains has been implemented; also see
10772 .Cd trusted-first .
10773 .It Cd no-check-time
10774 Do not check certificate/CRL validity against current time.
10775 .It Cd partial-chain
10776 By default partial, incomplete chains which cannot be verified up to the
10777 chain top, a self-signed root certificate, will not verify.
10778 With this flag set, a chain succeeds to verify if at least one signing
10779 certificate of the chain is in any of the configured trusted stores of
10780 CA certificates.
10781 The OpenSSL manual page
10782 .Xr SSL_CTX_load_verify_locations 3
10783 gives some advise how to manage your own trusted store of CA certificates.
10784 .It Cd strict
10785 Disable workarounds for broken certificates.
10786 .It Cd trusted-first
10787 Try building a chain using issuers in the trusted store first to avoid
10788 problems with server-sent legacy intermediate certificates.
10789 Newer versions of OpenSSL support alternative chain checking and enable
10790 it by default, resulting in the same behaviour; also see
10791 .Cd no-alt-chains .
10796 .It Va ssl-ca-no-defaults
10797 \*(BO\*(OP Do not load the default CA locations that are built into the
10798 used to SSL/TLS library to verify SSL/TLS server certificates.
10800 .Mx Va ssl-cert
10801 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
10802 \*(OP Variable chain that sets the filename for a SSL/TLS client
10803 certificate required by some servers.
10804 This is a direct interface to the
10805 .Ql Certificate
10806 slot of the
10807 .Xr SSL_CONF_cmd 3
10808 function of the OpenSSL library, if available.
10810 .Mx Va ssl-cipher-list
10811 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
10812 \*(OP Specifies a list of ciphers for SSL/TLS connections.
10813 This is a direct interface to the
10814 .Ql CipherString
10815 slot of the
10816 .Xr SSL_CONF_cmd 3
10817 function of the OpenSSL library, if available; see
10818 .Xr ciphers 1
10820 .Xr SSL_CTX_set_cipher_list 3
10821 for more information.
10822 By default \*(UA does not set a list of ciphers, in effect using a
10823 .Va ssl-protocol
10824 specific cipher (protocol standards ship with a list of acceptable
10825 ciphers), possibly cramped to what the actually used SSL/TLS library
10826 supports \(en the manual section
10827 .Sx "An example configuration"
10828 also contains a SSL/TLS use case.
10831 .It Va ssl-config-file
10832 \*(OP If this variable is set \*(UA will call
10833 .Xr CONF_modules_load_file 3
10834 to allow OpenSSL to be configured according to the host system wide
10835 security settings.
10836 If a non-empty value is given then this will be used to specify the
10837 configuration file to be used instead of the global OpenSSL default;
10838 note that in this case it is an error if the file cannot be loaded.
10839 The application name will always be passed as
10840 .Dq \*(uA .
10842 .Mx Va ssl-curves
10843 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
10844 \*(OP Specifies a list of supported curves for SSL/TLS connections.
10845 This is a direct interface to the
10846 .Ql Curves
10847 slot of the
10848 .Xr SSL_CONF_cmd 3
10849 function of the OpenSSL library, if available; see
10850 .Xr SSL_CTX_set1_curves_list 3
10851 for more information.
10852 By default \*(UA does not set a list of curves.
10856 .It Va ssl-crl-dir , ssl-crl-file
10857 \*(OP Specify a directory / a file, respectively that contains a CRL in
10858 PEM format to use when verifying SSL/TLS server certificates.
10860 .Mx Va ssl-key
10861 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
10862 \*(OP Variable chain that sets the filename for the private key of
10863 a SSL/TLS client certificate.
10864 If unset, the name of the certificate file is used.
10865 The file is expected to be in PEM format.
10866 This is a direct interface to the
10867 .Ql PrivateKey
10868 slot of the
10869 .Xr SSL_CONF_cmd 3
10870 function of the OpenSSL library, if available.
10872 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
10873 \*(OB\*(OP Please use the newer and more flexible
10874 .Va ssl-protocol
10875 instead: if both values are set,
10876 .Va ssl-protocol
10877 will take precedence!
10878 Can be set to the following values, the actually used
10879 .Va ssl-protocol
10880 specification to which it is mapped is shown in parenthesis:
10881 .Ql tls1.2
10882 .Pf ( Ql -ALL, TLSv1.2 ) ,
10883 .Ql tls1.1
10884 .Pf ( Ql -ALL, TLSv1.1 ) ,
10885 .Ql tls1
10886 .Pf ( Ql -ALL, TLSv1 )
10888 .Ql ssl3
10889 .Pf ( Ql -ALL, SSLv3 ) ;
10890 the special value
10891 .Ql auto
10892 is mapped to
10893 .Ql ALL, -SSLv2
10894 and thus includes the SSLv3 protocol.
10895 Note that SSLv2 is no longer supported at all.
10897 .Mx Va ssl-protocol
10898 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
10899 \*(OP Specify the used SSL/TLS protocol.
10900 This is a direct interface to the
10901 .Ql Protocol
10902 slot of the
10903 .Xr SSL_CONF_cmd 3
10904 function of the OpenSSL library, if available;
10905 otherwise an \*(UA internal parser is used which understands the
10906 following subset of (case-insensitive) command strings:
10907 .Ql SSLv3 ,
10908 .Ql TLSv1 ,
10909 .Ql TLSv1.1
10911 .Ql TLSv1.2 ,
10912 as well as the special value
10913 .Ql ALL .
10914 Multiple specifications may be given via a comma-separated list which
10915 ignores any whitespace.
10916 An optional
10917 .Ql +
10918 plus sign prefix will enable a protocol, a
10919 .Ql -
10920 hyphen-minus prefix will disable it, so that
10921 .Ql -ALL, TLSv1.2
10922 will enable only the TLSv1.2 protocol.
10924 It depends upon the used TLS/SSL library which protocols are actually
10925 supported and which protocols are used if
10926 .Va ssl-protocol
10927 is not set, but note that SSLv2 is no longer supported at all and
10928 actively disabled.
10929 Especially for older protocols explicitly securing
10930 .Va ssl-cipher-list
10931 may be worthwile, see
10932 .Sx "An example configuration" .
10935 .It Va ssl-rand-egd
10936 \*(OP Gives the pathname to an entropy daemon socket, see
10937 .Xr RAND_egd 3 .
10938 Not all SSL/TLS libraries support this.
10941 .It Va ssl-rand-file
10942 \*(OP Gives the filename to a file with random entropy data, see
10943 .Xr RAND_load_file 3 .
10944 If this variable is not set, or set to the empty string, or if the
10945 .Sx "Filename transformations"
10946 fail, then
10947 .Xr RAND_file_name 3
10948 will be used to create the filename if, and only if,
10949 .Xr RAND_status 3
10950 documents that the SSL PRNG is not yet sufficiently seeded.
10951 If \*(UA successfully seeded the SSL PRNG then it will update the file
10952 .Pf ( Xr RAND_write_file 3 ) .
10953 This variable is only used if
10954 .Va ssl-rand-egd
10955 is not set (or not supported by the SSL/TLS library).
10957 .Mx Va ssl-verify
10958 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
10959 \*(OP Variable chain that sets the action to be performed if an error
10960 occurs during SSL/TLS server certificate validation against the
10961 specified or default trust stores
10962 .Va ssl-ca-dir ,
10963 .Va ssl-ca-file ,
10964 or the SSL/TLS library built-in defaults (unless usage disallowed via
10965 .Va ssl-ca-no-defaults ) ,
10966 and as fine-tuned via
10967 .Va ssl-ca-flags .
10968 Valid (case-insensitive) values are
10969 .Ql strict
10970 (fail and close connection immediately),
10971 .Ql ask
10972 (ask whether to continue on standard input),
10973 .Ql warn
10974 (show a warning and continue),
10975 .Ql ignore
10976 (do not perform validation).
10977 The default is
10978 .Ql ask .
10981 .It Va stealthmua
10982 If only set without an assigned value, then this setting inhibits the
10983 generation of the
10984 .Ql Message-ID: ,
10985 .Ql Content-ID:
10987 .Ql User-Agent:
10988 header fields that include obvious references to \*(UA.
10989 There are two pitfalls associated with this:
10990 First, the message id of outgoing messages is not known anymore.
10991 Second, an expert may still use the remaining information in the header
10992 to track down the originating mail user agent.
10993 If set to the value
10994 .Ql noagent ,
10995 then the mentioned
10996 .Ql Message-ID:
10998 .Ql Content-ID:
10999 suppression does not occur.
11003 .It Va termcap
11004 (\*(OP) This specifies a comma-separated list of
11005 .Lb libterminfo
11006 and/or
11007 .Lb libtermcap
11008 capabilities (see
11009 .Sx "On terminal control and line editor" ,
11010 escape commas with reverse solidus) to be used to overwrite or define
11011 entries.
11012 .Sy Note
11013 this variable will only be queried once at program startup and can
11014 thus only be specified in resource files or on the command line.
11017 String capabilities form
11018 .Ql cap=value
11019 pairs and are expected unless noted otherwise.
11020 Numerics have to be notated as
11021 .Ql cap#number
11022 where the number is expected in normal decimal notation.
11023 Finally, booleans do not have any value but indicate a true or false
11024 state simply by being defined or not; this indeed means that \*(UA
11025 does not support undefining an existing boolean.
11026 String capability values will undergo some expansions before use:
11027 for one notations like
11028 .Ql ^LETTER
11029 stand for
11030 .Ql control-LETTER ,
11031 and for clarification purposes
11032 .Ql \eE
11033 can be used to specify
11034 .Ql escape
11035 (the control notation
11036 .Ql ^[
11037 could lead to misreadings when a left bracket follows, which it does for
11038 the standard CSI sequence);
11039 finally three letter octal sequences, as in
11040 .Ql \e061 ,
11041 are supported.
11042 To specify that a terminal supports 256-colours, and to define sequences
11043 that home the cursor and produce an audible bell, one might write:
11045 .Bd -literal -offset indent
11046 ? set termcap='Co#256,home=\eE[H,bel=^G'
11050 The following terminal capabilities are or may be meaningful for the
11051 operation of the built-in line editor or \*(UA in general:
11054 .Bl -tag -compact -width ".It Cd yay"
11055 .\" HAVE_COLOUR
11056 .It Cd colors Ns \0or Cd Co
11057 .Cd max_colors :
11058 numeric capability specifying the maximum number of colours.
11059 Note that \*(UA does not actually care about the terminal beside that,
11060 but always emits ANSI / ISO 6429 escape sequences.
11062 .\" HAVE_TERMCAP
11063 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
11064 .Cd exit_ca_mode
11066 .Cd enter_ca_mode ,
11067 respectively: exit and enter the alternative screen ca-mode,
11068 effectively turning \*(UA into a fullscreen application.
11069 This must be enabled explicitly by setting
11070 .Va termcap-ca-mode .
11072 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
11073 .Cd keypad_xmit
11075 .Cd keypad_local ,
11076 respectively: enable and disable the keypad.
11077 This is always enabled if available, because it seems even keyboards
11078 without keypads generate other key codes for, e.g., cursor keys in that
11079 case, and only if enabled we see the codes that we are interested in.
11081 .It Cd ed Ns \0or Cd cd
11082 .Cd clr_eos :
11083 clear the screen.
11085 .It Cd clear Ns \0or Cd cl
11086 .Cd clear_screen :
11087 clear the screen and home cursor.
11088 (Will be simulated via
11089 .Cd ho
11090 plus
11091 .Cd cd . )
11093 .It Cd home Ns \0or Cd ho
11094 .Cd cursor_home :
11095 home cursor.
11097 .\" HAVE_MLE
11098 .It Cd el Ns \0or Cd ce
11099 .Cd clr_eol :
11100 clear to the end of line.
11101 (Will be simulated via
11102 .Cd ch
11103 plus repetitions of space characters.)
11105 .It Cd hpa Ns \0or Cd ch
11106 .Cd column_address :
11107 move the cursor (to the given column parameter) in the current row.
11108 (Will be simulated via
11109 .Cd cr
11110 plus
11111 .Cd nd . )
11113 .It Cd cr
11114 .Cd carriage_return :
11115 move to the first column in the current row.
11116 The default built-in fallback is
11117 .Ql \er .
11119 .It Cd cub1 Ns \0or Cd le
11120 .Cd cursor_left :
11121 move the cursor left one space (non-destructively).
11122 The default built-in fallback is
11123 .Ql \eb .
11125 .It Cd cuf1 Ns \0or Cd nd
11126 .Cd cursor_right :
11127 move the cursor right one space (non-destructively).
11128 The default built-in fallback is
11129 .Ql \eE[C ,
11130 which is used by most terminals.
11131 Less often occur
11132 .Ql \eEC
11134 .Ql \eEOC .
11138 Many more capabilities which describe key-sequences are documented for
11139 .Ic bind .
11143 .It Va termcap-ca-mode
11144 \*(OP Allow usage of the
11145 .Cd exit_ca_mode
11147 .Cd enter_ca_mode
11148 terminal capabilities, effectively turning \*(UA into a fullscreen
11149 application, as documented for
11150 .Va termcap .
11151 .Sy Note
11152 this variable will only be queried once at program startup and can
11153 thus only be specified in resource files or on the command line.
11156 .It Va termcap-disable
11157 \*(OP Disable any interaction with a terminal control library.
11158 If set only some generic fallback built-ins and possibly the content of
11159 .Va termcap
11160 describe the terminal to \*(UA.
11161 .Sy Note
11162 this variable will only be queried once at program startup and can
11163 thus only be specified in resource files or on the command line.
11166 .It Va toplines
11167 If defined, gives the number of lines of a message to be displayed
11168 with the command
11169 .Ic top ;
11170 if unset, the first five lines are printed, if set to 0 the variable
11171 .Va screen
11172 is inspected.
11173 If the value is negative then its absolute value will be used for
11174 unsigned right shifting (see
11175 .Ic vexpr )
11177 .Va screen
11178 height.
11181 .It Va topsqueeze
11182 \*(BO If set then the
11183 .Ic top
11184 command series will strip adjacent empty lines and quotations.
11187 .It Va ttycharset
11188 The character set of the terminal \*(UA operates on,
11189 and the one and only supported character set that \*(UA can use if no
11190 character set conversion capabilities have been compiled into it,
11191 in which case it defaults to ISO-8859-1 unless it can deduce a value
11192 from the locale specified in the
11193 .Ev LC_CTYPE
11194 environment variable (if supported, see there for more).
11195 It defaults to UTF-8 if conversion is available.
11196 Refer to the section
11197 .Sx "Character sets"
11198 for the complete picture about character sets.
11201 .It Va typescript-mode
11202 \*(BO A special multiplex variable that disables all variables and
11203 settings which result in behaviour that interferes with running \*(UA in
11204 .Xr script 1 ,
11205 e.g., it sets
11206 .Va colour-disable ,
11207 .Va line-editor-disable
11208 and (before startup completed only)
11209 .Va termcap-disable .
11210 Unsetting it does not restore the former state of the covered settings.
11213 .It Va umask
11214 For a safety-by-default policy \*(UA sets its process
11215 .Xr umask 2
11217 .Ql 0077 ,
11218 but this variable can be used to override that:
11219 set it to an empty value to do not change the (current) setting (on
11220 startup), otherwise the process file mode creation mask is updated to
11221 the new value.
11222 Child processes inherit the process file mode creation mask.
11224 .Mx Va user
11225 .It Va user-HOST , user
11226 \*(IN Variable chain that sets a global fallback user name, which is
11227 used in case none has been given in the protocol and account-specific
11228 URL.
11229 This variable defaults to the name of the user who runs \*(UA.
11232 .It Va v15-compat
11233 \*(BO Setting this enables upward compatibility with \*(UA
11234 version 15.0 in respect to which configuration options are available and
11235 how they are handled.
11236 This manual uses \*(IN and \*(OU to refer to the new and the old way of
11237 doing things, respectively.
11240 .It Va verbose
11241 \*(BO This setting, also controllable via the command line option
11242 .Fl v ,
11243 causes \*(UA to be more verbose, e.g., it will display obsoletion
11244 warnings and SSL/TLS certificate chains.
11245 Even though marked \*(BO this option may be set twice in order to
11246 increase the level of verbosity even more, in which case even details of
11247 the actual message delivery and protocol conversations are shown.
11248 A single
11249 .Pf no Va verbose
11250 is sufficient to disable verbosity as such.
11257 .It Va version , version-date , version-major , version-minor , version-update
11258 \*(RO \*(UA version information: the first variable contains a string
11259 containing the complete version identification, the latter three contain
11260 only digits: the major, minor and update version numbers.
11261 The date is in ISO 8601 notation.
11262 The output of the command
11263 .Ic version
11264 will include this information.
11267 .It Va writebackedited
11268 If this variable is set messages modified using the
11269 .Ic edit
11271 .Ic visual
11272 commands are written back to the current folder when it is quit;
11273 it is only honoured for writable folders in MBOX format, though.
11274 Note that the editor will be pointed to the raw message content in that
11275 case, i.e., neither MIME decoding nor decryption will have been
11276 performed, and proper RFC 4155
11277 .Ql From_
11278 quoting of newly added or edited content is also left as an excercise to
11279 the user.
11281 .\" }}} (Variables)
11283 .\" }}} (INTERNAL VARIABLES)
11286 .\" .Sh ENVIRONMENT {{{
11287 .Sh ENVIRONMENT
11289 The term
11290 .Dq environment variable
11291 should be considered an indication that these variables are either
11292 standardized as vivid parts of process environments, or that they are
11293 commonly found in there.
11294 The process environment is inherited from the
11295 .Xr sh 1
11296 once \*(UA is started, and unless otherwise explicitly noted handling of
11297 the following variables transparently integrates into that of the
11298 .Sx "INTERNAL VARIABLES"
11299 from \*(UA's point of view.
11300 This means that, e.g., they can be managed via
11301 .Ic set
11303 .Ic unset ,
11304 causing automatic program environment updates (to be inherited by
11305 newly created child processes).
11308 In order to transparently integrate other environment variables equally
11309 they need to be imported (linked) with the command
11310 .Ic environ .
11311 This command can also be used to set and unset non-integrated
11312 environment variables from scratch, sufficient system support provided.
11313 The following example, applicable to a POSIX shell, sets the
11314 .Ev COLUMNS
11315 environment variable for \*(UA only, and beforehand exports the
11316 .Ev EDITOR
11317 in order to affect any further processing in the running shell:
11319 .Bd -literal -offset indent
11320 $ EDITOR="vim -u ${HOME}/.vimrc"
11321 $ export EDITOR
11322 $ COLUMNS=80 \*(uA -R
11325 .Bl -tag -width ".It Ev BaNg"
11327 .It Ev COLUMNS
11328 The user's preferred width in column positions for the terminal screen
11329 or window.
11330 Queried and used once on program startup, actively managed for child
11331 processes and the MLE (see
11332 .Sx "On terminal control and line editor" )
11333 in interactive mode thereafter.
11334 Ignored in non-interactive mode, which always uses 80 columns, unless in
11335 .fl #
11336 batch mode.
11339 .It Ev DEAD
11340 The name of the (mailbox)
11341 .Ic file
11342 to use for saving aborted messages if
11343 .Va save
11344 is set; this defaults to
11345 .Pa dead.letter
11346 in the user's
11347 .Ev HOME
11348 directory.
11349 If the variable
11350 .Va debug
11351 is set no output will be generated, otherwise the contents of the file
11352 will be replaced.
11355 .It Ev EDITOR
11356 Pathname of the text editor to use in the
11357 .Ic edit
11358 command and
11359 .Ic ~e
11360 .Sx "COMMAND ESCAPES" .
11361 A default editor is used if this value is not defined.
11364 .It Ev HOME
11365 The user's home directory.
11366 This variable is only used when it resides in the process environment.
11367 The calling user's home directory will be used instead if this directory
11368 does not exist, is not accessible or cannot be read.
11369 (No test for being writable is performed to allow usage by
11370 non-privileged users within read-only jails, but dependent on the
11371 variable settings this directory is a default write target, e.g. for
11372 .Ev DEAD ,
11373 .Ev MBOX
11374 and more.)
11379 .It Ev LC_ALL , LC_CTYPE , LANG
11380 \*(OP The (names in lookup order of the)
11381 .Xr locale 7
11382 (and / or see
11383 .Xr setlocale 3 )
11384 which indicates the used
11385 .Sx "Character sets" .
11386 Runtime changes trigger automatic updates of the entire locale system,
11387 updating and overwriting also a
11388 .Va ttycharset
11389 set by the user.
11392 .It Ev LINES
11393 The user's preferred number of lines on a page or the vertical screen
11394 or window size in lines.
11395 Queried and used once on program startup, actively managed for child
11396 processes in interactive mode thereafter.
11397 Ignored in non-interactive mode, which always uses 24 lines, unless in
11398 .fl #
11399 batch mode.
11402 .It Ev LISTER
11403 Pathname of the directory lister to use in the
11404 .Ic folders
11405 command when operating on local mailboxes.
11406 Default is
11407 .Xr ls 1
11408 (path search through
11409 .Ev SHELL ) .
11412 .It Ev LOGNAME
11413 Upon startup \*(UA will actively ensure that this variable refers to the
11414 name of the user who runs \*(UA, in order to be able to pass a verified
11415 name to any newly created child process.
11418 .It Ev MAIL
11419 Is used as the users
11420 .Mx -sx
11421 .Sx "primary system mailbox"
11422 unless
11423 .Va inbox
11424 is set.
11425 This is assumed to be an absolute pathname.
11428 .It Ev MAILCAPS
11429 \*(OP Overrides the default path search for
11430 .Sx "The Mailcap files" ,
11431 which is defined in the standard RFC 1524 as
11432 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
11433 .\" TODO we should have a mailcaps-default virtual RDONLY option!
11434 (\*(UA makes it a configuration option, however.)
11435 Note this is not a search path, but a path search.
11438 .It Ev MAILRC
11439 Is used as a startup file instead of
11440 .Pa \*(ur
11441 if set.
11442 When \*(UA scripts are invoked on behalf of other users,
11443 either this variable should be set to
11444 .Pa /dev/null
11445 or the
11446 .Fl \&:
11447 command line option should be used in order to avoid side-effects from
11448 reading their configuration files.
11449 This variable is only used when it resides in the process environment.
11452 .It Ev MAILX_NO_SYSTEM_RC
11453 If this variable is set then reading of
11454 .Pa \*(UR
11455 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
11456 had been started up with the option
11457 .Fl \&:
11458 (and according argument) or
11459 .Fl n .
11460 This variable is only used when it resides in the process environment.
11463 .It Ev MBOX
11464 The name of the users
11465 .Mx -sx
11466 .Sx "secondary mailbox"
11467 file.
11468 A logical subset of the special
11469 .Sx "Filename transformations"
11470 (also see
11471 .Ic file )
11472 are supported.
11473 The default is
11474 .Pa ~/mbox .
11475 Traditionally this MBOX is used as the file to save messages from the
11476 .Mx -sx
11477 .Sx "primary system mailbox"
11478 that have been read.
11479 Also see
11480 .Sx "Message states" .
11483 .It Ev NETRC
11484 \*(IN\*(OP This variable overrides the default location of the user's
11485 .Pa ~/.netrc
11486 file.
11489 .It Ev PAGER
11490 Pathname of the program to use for backing the command
11491 .Ic more ,
11492 and when the
11493 .Va crt
11494 variable enforces usage of a pager for output.
11495 The default paginator is
11496 .Xr more 1
11497 (path search through
11498 .Ev SHELL ) .
11500 \*(UA inspects the contents of this variable: if its contains the string
11501 .Dq less
11502 then a non-existing environment variable
11503 .Va LESS
11504 will be set to
11505 .Ql FRXi ,
11506 .Ql FRi
11508 .Ql Ri ,
11509 dependent on whether terminal control support is available and whether
11510 that supports full (alternative) screen mode or not (also see
11511 .Sx "On terminal control and line editor" ) .
11512 Likewise for
11513 .Dq lv
11514 .Va LV
11515 will optionally be set to
11516 .Dq -c .
11517 Alse see
11518 .Va colour-pager .
11521 .It Ev PATH
11522 A colon-separated list of directories that is searched by the shell when
11523 looking for commands, e.g.,
11524 .Ql /bin:/usr/bin:/usr/local/bin .
11527 .It Ev POSIXLY_CORRECT
11528 This variable is automatically looked for upon startup, see
11529 .Va posix
11530 for more.
11533 .It Ev SHELL
11534 The shell to use for the commands
11535 .Ic \&! ,
11536 .Ic shell ,
11538 .Ic ~!
11539 .Sx "COMMAND ESCAPES"
11540 and when starting subprocesses.
11541 A default shell is used if this environment variable is not defined.
11544 .It Ev SOURCE_DATE_EPOCH
11545 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
11546 used in place of the current time.
11547 This variable is looked up upon program startup, and its existence will
11548 switch \*(UA to a completely reproducible mode which causes
11549 deterministic random numbers, a special fixed (non-existent?)
11550 .Ev LOGNAME
11551 and more to be used and set.
11552 It is to be used during development or by software packagers.
11553 \*(ID Currently an invalid setting is only ignored, rather than causing
11554 a program abortion.
11556 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
11559 .It Ev TERM
11560 \*(OP The terminal type for which output is to be prepared.
11561 For extended colour and font control please refer to
11562 .Sx "Coloured display" ,
11563 and for terminal management in general to
11564 .Sx "On terminal control and line editor" .
11567 .It Ev TMPDIR
11568 Used as directory for temporary files instead of
11569 .Pa /tmp ,
11570 if set, existent, accessible as well as read- and writable.
11571 This variable is only used when it resides in the process environment,
11572 but \*(UA will ensure at startup that this environment variable is
11573 updated to contain a usable temporary directory.
11576 .It Ev USER
11577 Identical to
11578 .Ev LOGNAME
11579 (see there), but this variable is not standardized, should therefore not
11580 be used, and is only corrected if already set.
11583 .It Ev VISUAL
11584 Pathname of the text editor to use in the
11585 .Ic visual
11586 command and
11587 .Ic ~v
11588 .Sx "COMMAND ESCAPES" .
11591 .\" }}}
11594 .\" .Sh FILES {{{
11595 .Sh FILES
11597 .\" file list {{{
11598 .Bl -tag -width ".It Pa BaNg"
11599 .It Pa \*(ur
11600 File giving initial commands, one of the
11601 .Sx "Resource files" .
11603 .It Pa \*(UR
11604 System wide initialization file, one of the
11605 .Sx "Resource files" .
11608 .It Pa ~/.mailcap
11609 \*(OP Personal MIME type handler definition file, see
11610 .Sx "The Mailcap files" .
11611 This location is part of the RFC 1524 standard search path, which is
11612 a configuration option and can be overridden via
11613 .Ev MAILCAPS .
11616 .It Pa /etc/mailcap
11617 \*(OP System wide MIME type handler definition file, see
11618 .Sx "The Mailcap files" .
11619 This location is part of the RFC 1524 standard search path, which is
11620 a configuration option and can be overridden via
11623 .It Pa ~/mbox
11624 The default value for
11625 .Ev MBOX .
11626 The actually used path is a configuration option.
11629 .It Pa ~/.mime.types
11630 Personal MIME types, see
11631 .Sx "The mime.types files" .
11632 The actually used path is a configuration option.
11635 .It Pa /etc/mime.types
11636 System wide MIME types, see
11637 .Sx "The mime.types files" .
11638 The actually used path is a configuration option.
11641 .It Pa ~/.netrc
11642 \*(IN\*(OP The default location of the users
11643 .Pa .netrc
11644 file \(en the section
11645 .Sx "The .netrc file"
11646 documents the file format.
11647 The actually used path is a configuration option and can be overridden via
11648 .Ev NETRC .
11651 .It Pa /dev/null
11652 The data sink
11653 .Xr null 4 .
11654 The actually used path is a compile-time constant.
11656 .\" }}}
11658 .\" .Ss "Resource files" {{{
11659 .Ss "Resource files"
11661 Upon startup \*(UA reads in several resource files:
11663 .Bl -tag -width ".It Pa BaNg"
11665 .It Pa \*(UR
11666 System wide initialization file.
11667 Reading of this file can be suppressed, either by using the
11668 .Fl \&:
11669 (and according argument) or
11670 .Fl n
11671 command line options, or by setting the
11672 .Sx ENVIRONMENT
11673 variable
11674 .Ev MAILX_NO_SYSTEM_RC .
11677 .It Pa \*(ur
11678 File giving initial commands.
11679 A different file can be chosen by setting the
11680 .Sx ENVIRONMENT
11681 variable
11682 .Ev MAILRC .
11683 Reading of this file can be suppressed with the
11684 .Fl \&:
11685 command line option.
11687 .It Va mailx-extra-rc
11688 Defines a startup file to be read after all other resource files.
11689 It can be used to specify settings that are not understood by other
11690 .Xr mailx 1
11691 implementations, for example.
11692 This variable is only honoured when defined in a resource file, e.g.,
11693 it is one of the
11694 .Sx "INTERNAL VARIABLES" .
11698 The content of these files is interpreted as follows:
11701 .Bl -bullet -compact
11703 The whitespace characters space, tabulator and newline,
11704 as well as those defined by the variable
11705 .Va ifs ,
11706 are removed from the beginning and end of input lines.
11708 Empty lines are ignored.
11710 Any other line is interpreted as a command.
11711 It may be spread over multiple input lines if the newline character is
11712 .Dq escaped
11713 by placing a reverse solidus character
11714 .Ql \e
11715 as the last character of the line; whereas any leading whitespace of
11716 follow lines is ignored, trailing whitespace before a escaped newline
11717 remains in the input.
11719 If the line (content) starts with the number sign
11720 .Ql #
11721 then it is a comment-command and also ignored.
11722 (The comment-command is a real command, which does nothing, and
11723 therefore the usual follow lines mechanism applies!)
11727 Unless \*(UA is about to enter interactive mode syntax errors that occur
11728 while loading these files are treated as errors and cause program exit.
11729 More files with syntactically equal content can be
11730 .Ic source Ns ed .
11731 The following, saved in a file, would be an examplary content:
11733 .Bd -literal -offset indent
11734  # This line is a comment command.  And y\e
11735     es, it is really continued here.
11736 set debug \e
11737     verbose
11738     set editheaders
11740 .\" }}}
11742 .\" .Ss "The mime.types files" {{{
11743 .Ss "The mime.types files"
11745 As stated in
11746 .Sx "HTML mail and MIME attachments"
11747 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
11748 media types in order to classify message and attachment content.
11749 One source for them are
11750 .Pa mime.types
11751 files, the loading of which can be controlled by setting the variable
11752 .Va mimetypes-load-control .
11753 Another is the command
11754 .Ic mimetype ,
11755 which also offers access to \*(UAs MIME type cache.
11756 .Pa mime.types
11757 files have the following syntax:
11759 .Bd -literal -offset indent
11760 type/subtype extension [extension ...]
11761 # E.g., text/html html htm
11765 where
11766 .Ql type/subtype
11767 define the MIME media type, as standardized in RFC 2046:
11768 .Ql type
11769 is used to declare the general type of data, while the
11770 .Ql subtype
11771 specifies a specific format for that type of data.
11772 One or multiple filename
11773 .Ql extension Ns
11774 s, separated by whitespace, can be bound to the media type format.
11775 Comments may be introduced anywhere on a line with a number sign
11776 .Ql # ,
11777 causing the remaining line to be discarded.
11779 \*(UA also supports an extended, non-portable syntax in especially
11780 crafted files, which can be loaded via the alternative value syntax of
11781 .Va mimetypes-load-control ,
11782 and prepends an optional
11783 .Ql type-marker :
11786 .Dl [type-marker ]type/subtype extension [extension ...]
11789 The following type markers are supported:
11792 .Bl -tag -compact -width ".It Ar _n_u"
11793 .It Ar @
11794 Treat message parts with this content as plain text.
11795 .It Ar @t
11796 The same as plain
11797 .Ar @ .
11798 .It Ar @h
11799 Treat message parts with this content as HTML tagsoup.
11800 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
11801 the content as plain text instead.
11802 .It Ar @H
11803 Likewise
11804 .Ar @h ,
11805 but instead of falling back to plain text require an explicit content
11806 handler to be defined.
11810 Further reading:
11811 for sending messages:
11812 .Ic mimetype ,
11813 .Va mime-allow-text-controls ,
11814 .Va mimetypes-load-control .
11815 For reading etc. messages:
11816 .Sx "HTML mail and MIME attachments" ,
11817 .Sx "The Mailcap files" ,
11818 .Ic mimetype ,
11819 .Va mime-counter-evidence ,
11820 .Va mimetypes-load-control ,
11821 .Va pipe-TYPE/SUBTYPE ,
11822 .Va pipe-EXTENSION .
11823 .\" }}}
11825 .\" .Ss "The Mailcap files" {{{
11826 .Ss "The Mailcap files"
11828 .\" TODO MAILCAP DISABLED
11829 .Sy This feature is not available in v14.9.0, sorry!
11830 RFC 1524 defines a
11831 .Dq User Agent Configuration Mechanism
11832 which \*(UA \*(OPally supports (see
11833 .Sx "HTML mail and MIME attachments" ) .
11834 It defines a file format to be used to inform mail user agent programs
11835 about the locally-installed facilities for handling various data
11836 formats, i.e., about commands and how they can be used to display, edit
11837 et cetera MIME part contents, as well as a default path search that
11838 includes multiple possible locations of
11839 .Dq mailcap
11840 files and the
11841 .Ev MAILCAPS
11842 environment variable that can be used to overwrite that (repeating here
11843 that it is not a search path, but instead a path search specification).
11844 Any existing files will be loaded in sequence, appending any content to
11845 the list of MIME type handler directives.
11848 .Dq Mailcap
11849 files consist of a set of newline separated entries.
11850 Comment lines start with a number sign
11851 .Ql #
11852 (in the first column!) and are ignored.
11853 Empty lines are also ignored.
11854 All other lines form individual entries that must adhere to the syntax
11855 described below.
11856 To extend a single entry (not comment) its line can be continued on
11857 follow lines if newline characters are
11858 .Dq escaped
11859 by preceding them with the reverse solidus character
11860 .Ql \e .
11861 The standard does not specify how leading whitespace of follow lines
11862 is to be treated, therefore \*(UA retains it.
11865 .Dq Mailcap
11866 entries consist of a number of semicolon
11867 .Ql \&;
11868 separated fields, and the reverse solidus
11869 .Ql \e
11870 character can be used to escape any following character including
11871 semicolon and itself.
11872 The first two fields are mandatory and must occur in the specified
11873 order, the remaining fields are optional and may appear in any order.
11874 Leading and trailing whitespace of content is ignored (removed).
11877 The first field defines the MIME
11878 .Ql TYPE/SUBTYPE
11879 the entry is about to handle (case-insensitively, and no reverse solidus
11880 escaping is possible in this field).
11881 If the subtype is specified as an asterisk
11882 .Ql *
11883 the entry is meant to match all subtypes of the named type, e.g.,
11884 .Ql audio/*
11885 would match any audio type.
11886 The second field defines the shell command which shall be used to
11887 .Dq display
11888 MIME parts of the given type; it is implicitly called the
11889 .Cd view
11890 command.
11893 For data
11894 .Dq consuming
11895 shell commands message (MIME part) data is passed via standard input
11896 unless the given shell command includes one or more instances of the
11897 (unquoted) string
11898 .Ql %s ,
11899 in which case these instances will be replaced with a temporary filename
11900 and the data will have been stored in the file that is being pointed to.
11901 Likewise, for data
11902 .Dq producing
11903 shell commands data is assumed to be generated on standard output unless
11904 the given command includes (one ore multiple)
11905 .Ql %s .
11906 In any case any given
11907 .Ql %s
11908 format is replaced with a(n already) properly quoted filename.
11909 Note that when a command makes use of a temporary file via
11910 .Ql %s
11911 then \*(UA will remove it again, as if the
11912 .Cd x-mailx-tmpfile ,
11913 .Cd x-mailx-tmpfile-fill
11915 .Cd x-mailx-tmpfile-unlink
11916 flags had been set; see below for more.
11919 The optional fields either define a shell command or an attribute (flag)
11920 value, the latter being a single word and the former being a keyword
11921 naming the field followed by an equals sign
11922 .Ql =
11923 succeeded by a shell command, and as usual for any
11924 .Dq Mailcap
11925 content any whitespace surrounding the equals sign will be removed, too.
11926 Optional fields include the following:
11929 .Bl -tag -width ".It Cd BaNg"
11930 .It Cd compose
11931 A program that can be used to compose a new body or body part in the
11932 given format.
11933 (Currently unused.)
11935 .It Cd composetyped
11936 Similar to the
11937 .Cd compose
11938 field, but is to be used when the composing program needs to specify the
11939 .Ql Content-type:
11940 header field to be applied to the composed data.
11941 (Currently unused.)
11943 .It Cd edit
11944 A program that can be used to edit a body or body part in the given
11945 format.
11946 (Currently unused.)
11948 .It Cd print
11949 A program that can be used to print a message or body part in the given
11950 format.
11951 (Currently unused.)
11953 .It Cd test
11954 Specifies a program to be run to test some condition, e.g., the machine
11955 architecture, or the window system in use, to determine whether or not
11956 this mailcap entry applies.
11957 If the test fails, a subsequent mailcap entry should be sought; also see
11958 .Cd x-mailx-test-once .
11961 .It Cd needsterminal
11962 This flag field indicates that the given shell command must be run on
11963 an interactive terminal.
11964 \*(UA will temporarily release the terminal to the given command in
11965 interactive mode, in non-interactive mode this entry will be entirely
11966 ignored; this flag implies
11967 .Cd x-mailx-noquote .
11970 .It Cd copiousoutput
11971 A flag field which indicates that the output of the
11972 .Cd view
11973 command will be an extended stream of textual output that can be
11974 (re)integrated into \*(UA's normal visual display.
11975 It is mutually exclusive with
11976 .Cd needsterminal .
11978 .It Cd textualnewlines
11979 A flag field which indicates that this type of data is line-oriented and
11980 that, if encoded in
11981 .Ql base64 ,
11982 all newlines should be converted to canonical form (CRLF) before
11983 encoding, and will be in that form after decoding.
11984 (Currently unused.)
11986 .It Cd nametemplate
11987 This field gives a filename format, in which
11988 .Ql %s
11989 will be replaced by a random string, the joined combination of which
11990 will be used as the filename denoted by
11991 .Ev MAILX_FILENAME_TEMPORARY .
11992 One could specify that a GIF file being passed to an image viewer should
11993 have a name ending in
11994 .Ql .gif
11995 by using
11996 .Ql nametemplate=%s.gif .
11997 Note that \*(UA ignores the name template unless that solely specifies
11998 a filename suffix that consists of (ASCII) alphabetic and numeric
11999 characters, the underscore and dot only.
12001 .It Cd x11-bitmap
12002 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
12003 icon to be used to visually denote the presence of this kind of data.
12004 This field is not used by \*(UA.
12006 .It Cd description
12007 A textual description that describes this type of data.
12010 .It Cd x-mailx-even-if-not-interactive
12011 An extension flag test field \(em by default handlers without
12012 .Cd copiousoutput
12013 are entirely ignored in non-interactive mode, but if this flag is set
12014 then their use will be considered.
12015 It is an error if this flag is set for commands that use the flag
12016 .Cd needsterminal .
12019 .It Cd x-mailx-noquote
12020 An extension flag field that indicates that even a
12021 .Cd copiousoutput
12022 .Cd view
12023 command shall not be used to generate message quotes
12024 (as it would be by default).
12027 .It Cd x-mailx-async
12028 Extension flag field that denotes that the given
12029 .Cd view
12030 command shall be executed asynchronously, without blocking \*(UA.
12031 Cannot be used in conjunction with
12032 .Cd needsterminal .
12035 .It Cd x-mailx-test-once
12036 Extension flag which denotes whether the given
12037 .Cd test
12038 command shall be evaluated once only and the (boolean) result be cached.
12039 This is handy if some global unchanging condition is to be queried, like
12040 .Dq running under the X Window System .
12043 .It Cd x-mailx-tmpfile
12044 Extension flag field that requests creation of a zero-sized temporary
12045 file, the name of which is to be placed in the environment variable
12046 .Ev MAILX_FILENAME_TEMPORARY .
12047 It is an error to use this flag with commands that include a
12048 .Ql %s
12049 format.
12052 .It Cd x-mailx-tmpfile-fill
12053 Normally the MIME part content is passed to the handler via standard
12054 input; if this flag is set then the data will instead be written into
12055 the implied
12056 .Cd x-mailx-tmpfile .
12057 In order to cause deletion of the temporary file you will have to set
12058 .Cd x-mailx-tmpfile-unlink
12059 explicitly!
12060 It is an error to use this flag with commands that include a
12061 .Ql %s
12062 format.
12065 .It Cd x-mailx-tmpfile-unlink
12066 Extension flag field that requests that the temporary file shall be
12067 deleted automatically when the command loop is entered again at latest.
12068 (Do not use this for asynchronous handlers.)
12069 It is an error to use this flag with commands that include a
12070 .Ql %s
12071 format, or in conjunction with
12072 .Cd x-mailx-async ,
12073 or without also setting
12074 .Cd x-mailx-tmpfile
12076 .Cd x-mailx-tmpfile-fill .
12079 .It Cd x-mailx-tmpfile-keep
12080 Using the string
12081 .Ql %s
12082 implies the three tmpfile related flags above, but if you want, e.g.,
12083 .Cd x-mailx-async
12084 and deal with the temporary file yourself, you can add in this flag to
12085 forcefully ignore
12086 .Cd x-mailx-tmpfile-unlink .
12091 The standard includes the possibility to define any number of additional
12092 entry fields, prefixed by
12093 .Ql x- .
12094 Flag fields apply to the entire
12095 .Dq Mailcap
12096 entry \(em in some unusual cases, this may not be desirable, but
12097 differentiation can be accomplished via separate entries, taking
12098 advantage of the fact that subsequent entries are searched if an earlier
12099 one does not provide enough information.
12100 E.g., if a
12101 .Cd view
12102 command needs to specify the
12103 .Cd needsterminal
12104 flag, but the
12105 .Cd compose
12106 command shall not, the following will help out the latter (with enabled
12107 .Va debug
12108 or an increased
12109 .Va verbose
12110 level \*(UA will show information about handler evaluation):
12112 .Bd -literal -offset indent
12113 application/postscript; ps-to-terminal %s; needsterminal
12114 application/postscript; ps-to-terminal %s; compose=idraw %s
12118 In fields any occurrence of the format string
12119 .Ql %t
12120 will be replaced by the
12121 .Ql TYPE/SUBTYPE
12122 specification.
12123 Named parameters from the
12124 .Ql Content-type:
12125 field may be placed in the command execution line using
12126 .Ql %{
12127 followed by the parameter name and a closing
12128 .Ql }
12129 character.
12130 The entire parameter should appear as a single command line argument,
12131 regardless of embedded spaces; thus:
12133 .Bd -literal -offset indent
12134 # Message
12135 Content-type:  multipart/mixed; boundary=42
12137 # Mailcap file
12138 multipart/*; /usr/local/bin/showmulti \e
12139   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
12141 # Executed shell command
12142 /usr/local/bin/showmulti multipart/mixed 42
12146 .\" TODO v15: Mailcap: %n,%F
12147 Note that \*(UA does not support handlers for multipart MIME parts as
12148 shown in this example (as of today).
12149 \*(UA does not support the additional formats
12150 .Ql %n
12152 .Ql %F .
12153 An example file, also showing how to properly deal with the expansion of
12154 .Ql %s ,
12155 which includes any quotes that are necessary to make it a valid shell
12156 argument by itself and thus will cause undesired behaviour when placed
12157 in additional user-provided quotes:
12159 .Bd -literal -offset indent
12160 # Comment line
12161 text/richtext; richtext %s; copiousoutput
12163 text/x-perl; perl -cWT %s
12165 application/pdf; \e
12166   infile=%s\e; \e
12167     trap "rm -f ${infile}" EXIT\e; \e
12168     trap "exit 75" INT QUIT TERM\e; \e
12169     mupdf %s; \e
12170   x-mailx-async; x-mailx-tmpfile-keep
12172 application/*; echo "This is \e"%t\e" but \e
12173     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
12174   copiousoutput; x-mailx-noquote
12178 Further reading:
12179 .Sx "HTML mail and MIME attachments" ,
12180 .Sx "The mime.types files" ,
12181 .Ic mimetype ,
12182 .Ev MAILCAPS ,
12183 .Va mime-counter-evidence ,
12184 .Va pipe-TYPE/SUBTYPE ,
12185 .Va pipe-EXTENSION .
12186 .\" }}}
12188 .\" .Ss "The .netrc file" {{{
12189 .Ss "The .netrc file"
12192 .Pa .netrc
12193 file contains user credentials for machine accounts.
12194 The default location in the user's
12195 .Ev HOME
12196 directory may be overridden by the
12197 .Ev NETRC
12198 environment variable.
12199 The file consists of space, tabulator or newline separated tokens.
12200 \*(UA implements a parser that supports a superset of the original BSD
12201 syntax, but users should nonetheless be aware of portability glitches
12202 of that file format, shall their
12203 .Pa .netrc
12204 be usable across multiple programs and platforms:
12207 .Bl -bullet -compact
12209 BSD does not support single, but only double quotation marks, e.g.,
12210 .Ql password="pass with spaces" .
12212 BSD (only?) supports escaping of single characters via a reverse solidus
12213 (e.g., a space can be escaped via
12214 .Ql \e\0 ) ,
12215 in- as well as outside of a quoted string.
12217 BSD does not require a final quotation mark of the last user input token.
12219 The original BSD (Berknet) parser also supported a format which allowed
12220 tokens to be separated with commas \(en whereas at least Hewlett-Packard
12221 still seems to support this syntax, \*(UA does not!
12223 As a non-portable extension some widely-used programs support
12224 shell-style comments: if an input line starts, after any amount of
12225 whitespace, with a number sign
12226 .Ql # ,
12227 then the rest of the line is ignored.
12229 Whereas other programs may require that the
12230 .Pa .netrc
12231 file is accessible by only the user if it contains a
12232 .Cd password
12233 token for any other
12234 .Cd login
12235 than
12236 .Dq anonymous ,
12237 \*(UA will always require these strict permissions.
12241 Of the following list of supported tokens \*(UA only uses (and caches)
12242 .Cd machine ,
12243 .Cd login
12245 .Cd password .
12246 At runtime the command
12247 .Ic netrc
12248 can be used to control \*(UA's
12249 .Pa .netrc
12250 cache.
12252 .Bl -tag -width ".It Cd BaNg"
12253 .It Cd machine Ar name
12254 The hostname of the entries' machine, lowercase-normalized by \*(UA
12255 before use.
12256 Any further file content, until either end-of-file or the occurrence
12257 of another
12258 .Cd machine
12259 or a
12260 .Cd default
12261 first-class token is bound (only related) to the machine
12262 .Ar name .
12264 As an extension that should not be the cause of any worries
12265 \*(UA supports a single wildcard prefix for
12266 .Ar name :
12267 .Bd -literal -offset indent
12268 machine *.example.com login USER password PASS
12269 machine pop3.example.com login USER password PASS
12270 machine smtp.example.com login USER password PASS
12273 which would match
12274 .Ql xy.example.com
12275 as well as
12276 .Ql pop3.example.com ,
12277 but neither
12278 .Ql example.com
12280 .Ql local.smtp.example.com .
12281 Note that in the example neither
12282 .Ql pop3.example.com
12284 .Ql smtp.example.com
12285 will be matched by the wildcard, since the exact matches take
12286 precedence (it is however faster to specify it the other way around).
12288 .It Cd default
12289 This is the same as
12290 .Cd machine
12291 except that it is a fallback entry that is used shall none of the
12292 specified machines match; only one default token may be specified,
12293 and it must be the last first-class token.
12295 .It Cd login Ar name
12296 The user name on the remote machine.
12298 .It Cd password Ar string
12299 The user's password on the remote machine.
12301 .It Cd account Ar string
12302 Supply an additional account password.
12303 This is merely for FTP purposes.
12305 .It Cd macdef Ar name
12306 Define a macro.
12307 A macro is defined with the specified
12308 .Ar name ;
12309 it is formed from all lines beginning with the next line and continuing
12310 until a blank line is (consecutive newline characters are) encountered.
12311 (Note that
12312 .Cd macdef
12313 entries cannot be utilized by multiple machines, too, but must be
12314 defined following the
12315 .Ic machine
12316 they are intended to be used with.)
12317 If a macro named
12318 .Ar init
12319 exists, it is automatically run as the last step of the login process.
12320 This is merely for FTP purposes.
12322 .\" }}}
12324 .\" }}}
12327 .\" .Sh EXAMPLES {{{
12328 .Sh EXAMPLES
12330 .\" .Ss "An example configuration" {{{
12331 .Ss "An example configuration"
12333 .Bd -literal -offset indent
12334 # This example assumes v15.0 compatibility mode
12335 set v15-compat
12337 # Request strict transport security checks!
12338 set ssl-verify=strict
12340 # Where are the up-to-date SSL certificates?
12341 # (Since we manage up-to-date ones explicitly, do not use any,
12342 # possibly outdated, default certificates shipped with OpenSSL)
12343 #set ssl-ca-dir=/etc/ssl/certs
12344 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
12345 set ssl-ca-no-defaults
12346 #set ssl-ca-flags=partial-chain
12347 wysh set smime-ca-file="${ssl-ca-file}" \e
12348   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
12350 # Do not use protocols older than TLS v1.2.
12351 # Change this only when the remote server does not support it:
12352 # maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
12353 # such explicit exceptions, then, e.g.
12354 #   set ssl-protocol-exam.ple='-ALL,+TLSv1.1'
12355 set ssl-protocol='-ALL,+TLSv1.2'
12357 # Explicitly define the list of ciphers, which may improve security,
12358 # especially with protocols older than TLS v1.2.  See ciphers(1).
12359 # Including "@STRENGTH" will sort the final list by algorithm strength.
12360 # In reality it is possibly best to only use ssl-cipher-list-HOST
12361 # (or -USER@HOST), as necessary, again..
12362 set ssl-cipher-list=TLSv1.2:!aNULL:!eNULL:@STRENGTH
12364 # - TLSv1.2:!aNULL:!eNULL:\e
12365 #     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
12366 #     DHE-RSA-AES256-SHA:@STRENGTH
12367 # -ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH
12368 # Especially with TLSv1.3 curves selection may be desired:
12369 #set ssl-curves=P-521:P-384:P-256
12371 # Essential setting: select allowed character sets
12372 set sendcharsets=utf-8,iso-8859-1
12374 # A very kind option: when replying to a message, first try to
12375 # use the same encoding that the original poster used herself!
12376 set reply-in-same-charset
12378 # When replying, do not merge From: and To: of the original message
12379 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
12380 set recipients-in-cc
12382 # When sending messages, wait until the Mail-Transfer-Agent finishs.
12383 # Only like this you will be able to see errors reported through the
12384 # exit status of the MTA (including the built-in SMTP one)!
12385 set sendwait
12387 # Only use built-in MIME types, no mime.types(5) files
12388 set mimetypes-load-control
12390 # Default directory where we act in (relative to $HOME)
12391 set folder=mail
12392 # A leading "+" (often) means: under *folder*
12393 # *record* is used to save copies of sent messages
12394 set MBOX=+mbox.mbox DEAD=+dead.txt \e
12395   record=+sent.mbox record-files record-resent
12397 # Make "file mymbox" and "file myrec" go to..
12398 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
12400 # Not really optional, e.g., for S/MIME
12401 set from='Your Name <address@exam.ple>'
12403 # It may be necessary to set hostname and/or smtp-hostname
12404 # if the "SERVER" of mta and "domain" of from do not match.
12405 # The `urlencode' command can be used to encode USER and PASS
12406 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
12407   smtp-auth=login/plain... \e
12408   smtp-use-starttls
12410 # Never refuse to start into interactive mode, and more
12411 set emptystart \e
12412   colour-pager crt= \e
12413   followup-to followup-to-honour=ask-yes \e
12414   history-file=+.\*(uAhist history-size=-1 history-gabby \e
12415   mime-counter-evidence=0xE \e
12416   prompt='?\e?!\e![\e${account}#\e${mailbox-display}]? ' \e
12417   reply-to-honour=ask-yes \e
12418   umask=
12420 # Only include the selected header fields when typing messages
12421 headerpick type retain from_ date from to cc subject \e
12422   message-id mail-followup-to reply-to
12423 # ...when forwarding messages
12424 headerpick forward retain subject date from to cc
12425 # ...when saving message, etc.
12426 #headerpick save ignore ^Original-.*$ ^X-.*$
12428 # Some mailing lists
12429 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
12430 mlsubscribe '^xfans@xfans\e.xyz$'
12432 # Handle a few file extensions (to store MBOX databases)
12433 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
12434   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
12435   zst 'zstd -dc' 'zstd -19 -zc' \e
12436   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
12438 # A real life example of a very huge free mail provider
12439 # Instead of directly placing content inside `account',
12440 # we `define' a macro: like that we can switch "accounts"
12441 # from within *on-compose-splice*, for example!
12442 define XooglX {
12443   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
12444   set from='Your Name <address@examp.ple>'
12445   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
12447 account XooglX {
12448   \ecall XooglX
12451 # Here is a pretty large one which does not allow sending mails
12452 # if there is a domain name mismatch on the SMTP protocol level,
12453 # which would bite us if the value of from does not match, e.g.,
12454 # for people who have a sXXXXeforge project and want to speak
12455 # with the mailing list under their project account (in from),
12456 # still sending the message through their normal mail provider
12457 define XandeX {
12458   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12459   set from='Your Name <address@exam.ple>'
12460   set mta=smtps://USER:PASS@smtp.yaXXex.ru:465 \e
12461     hostname=yaXXex.com smtp-hostname=
12463 account XandeX {
12464   \ecall Xandex
12467 # Create some new commands so that, e.g., `ls /tmp' will..
12468 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
12469 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
12471 # We do not support gpg(1) directly yet.  But simple --clearsign'd
12472 # message parts can be dealt with as follows:
12473 define V {
12474   localopts yes
12475   wysh set pipe-text/plain=$'@*#++=@\e
12476     < "${MAILX_FILENAME_TEMPORARY}" awk \e
12477         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
12478       BEGIN{done=0}\e
12479       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
12480         if(done++ != 0)\e
12481           next;\e
12482         print "--- GPG --verify ---";\e
12483         system("gpg --verify " TMPFILE " 2>&1");\e
12484         print "--- GPG --verify ---";\e
12485         print "";\e
12486         next;\e
12487       }\e
12488       /^-----BEGIN PGP SIGNATURE-----/,\e
12489           /^-----END PGP SIGNATURE-----/{\e
12490         next;\e
12491       }\e
12492       {print}\e
12493     \e''
12494     print
12496 commandalias V '\e'call V
12500 When storing passwords in
12501 .Pa \*(ur
12502 appropriate permissions should be set on this file with
12503 .Ql $ chmod 0600 \*(ur .
12504 If the \*(OPal
12505 .Va netrc-lookup
12506 is available user credentials can be stored in the central
12507 .Pa .netrc
12508 file instead; e.g., here is a different version of the example account
12509 that sets up SMTP and POP3:
12511 .Bd -literal -offset indent
12512 define XandeX {
12513   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12514   set from='Your Name <address@exam.ple>'
12515   set netrc-lookup
12516   # Load an encrypted ~/.netrc by uncommenting the next line
12517   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
12519   set mta=smtps://smtp.yXXXXx.ru:465 \e
12520       smtp-hostname= hostname=yXXXXx.com
12521   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
12522   commandalias xp fi pop3s://pop.yXXXXx.ru
12524 account XandeX {
12525   \ecall XandeX
12530 and, in the
12531 .Pa .netrc
12532 file:
12534 .Bd -literal -offset indent
12535 machine *.yXXXXx.ru login USER password PASS
12539 This configuration should now work just fine:
12542 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
12543 .\" }}}
12545 .\" .Ss "S/MIME step by step" {{{
12546 .Ss "S/MIME step by step"
12548 \*(OP The first thing you need for participating in S/MIME message
12549 exchange is your personal certificate, including a private key.
12550 The certificate contains public information, in particular your name and
12551 your email address(es), and the public key that is used by others to
12552 encrypt messages for you,
12553 and to verify signed messages they supposedly received from you.
12554 The certificate is included in each signed message you send.
12555 The private key must be kept secret.
12556 It is used to decrypt messages that were previously encrypted with your
12557 public key, and to sign messages.
12560 For personal use it is recommended that you get a S/MIME certificate
12561 from one of the major CAs on the Internet using your WWW browser.
12562 Many CAs offer such certificates for free.
12563 There is also
12564 .Lk https://www.CAcert.org
12565 which issues client and server certificates to members of their
12566 community for free; their root certificate
12567 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
12568 is often not in the default set of trusted CA root certificates, though,
12569 which means you will have to download their root certificate separately
12570 and ensure it is part of our S/MIME certificate validation chain by
12571 including it in
12572 .Va smime-ca-dir
12573 or as a vivid member of the
12574 .Va smime-ca-file .
12575 But let us take a step-by-step tour on how to setup S/MIME with
12576 a certificate from CAcert.org despite this situation!
12579 First of all you will have to become a member of the CAcert.org
12580 community, simply by registrating yourself via the web interface.
12581 Once you are, create and verify all email addresses you want to be able
12582 to create signed and encrypted messages for/with using the corresponding
12583 entries of the web interface.
12584 Now ready to create S/MIME certificates, so let us create a new
12585 .Dq client certificate ,
12586 ensure to include all email addresses that should be covered by the
12587 certificate in the following web form, and also to use your name as the
12588 .Dq common name .
12591 Create a private key and a certificate request on your local computer
12592 (please see the manual pages of the used commands for more in-depth
12593 knowledge on what the used arguments etc. do):
12596 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
12599 Afterwards copy-and-paste the content of
12600 .Dq creq.pem
12601 into the certificate-request (CSR) field of the web form on the
12602 CAcert.org website (you may need to unfold some
12603 .Dq advanced options
12604 to see the corresponding text field).
12605 This last step will ensure that your private key (which never left your
12606 box) and the certificate belong together (through the public key that
12607 will find its way into the certificate via the certificate-request).
12608 You are now ready and can create your CAcert certified certificate.
12609 Download and store or copy-and-paste it as
12610 .Dq pub.crt .
12613 Yay.
12614 In order to use your new S/MIME setup a combined private key/public key
12615 (certificate) file has to be created:
12618 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
12621 This is the file \*(UA will work with.
12622 If you have created your private key with a passphrase then \*(UA will
12623 ask you for it whenever a message is signed or decrypted.
12624 Set the following variables to henceforth use S/MIME (setting
12625 .Va smime-ca-file
12626 is of interest for verification only):
12628 .Bd -literal -offset indent
12629 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
12630     smime-sign-cert=ME@HERE.com.paired \e
12631     smime-sign-message-digest=SHA256 \e
12632     smime-sign
12635 .\" }}}
12637 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
12638 .Ss "Using CRLs with S/MIME or SSL/TLS"
12640 \*(OP Certification authorities (CAs) issue certificate revocation
12641 lists (CRLs) on a regular basis.
12642 These lists contain the serial numbers of certificates that have been
12643 declared invalid after they have been issued.
12644 Such usually happens because the private key for the certificate has
12645 been compromised,
12646 because the owner of the certificate has left the organization that is
12647 mentioned in the certificate, etc.
12648 To seriously use S/MIME or SSL/TLS verification,
12649 an up-to-date CRL is required for each trusted CA.
12650 There is otherwise no method to distinguish between valid and
12651 invalidated certificates.
12652 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
12653 the Internet, so they have to be retrieved by some external mechanism.
12656 \*(UA accepts CRLs in PEM format only;
12657 CRLs in DER format must be converted, like, e.\|g.:
12660 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
12663 To tell \*(UA about the CRLs, a directory that contains all CRL files
12664 (and no other files) must be created.
12666 .Va smime-crl-dir
12668 .Va ssl-crl-dir
12669 variables, respectively, must then be set to point to that directory.
12670 After that, \*(UA requires a CRL to be present for each CA that is used
12671 to verify a certificate.
12672 .\" }}}
12674 .\" }}} (Examples)
12677 .\" .Sh "FAQ" {{{
12678 .Sh "FAQ"
12680 In general it is a good idea to turn on
12681 .Va debug
12682 .Pf ( Fl d )
12683 and / or
12684 .Va verbose
12685 .Pf ( Fl v ,
12686 twice) if something does not work well.
12687 Very often a diagnostic message can be produced that leads to the
12688 problems' solution.
12690 .\" .Ss "\*(UA shortly hangs on startup" {{{
12691 .Ss "\*(UA shortly hangs on startup"
12693 This can have two reasons, one is the necessity to wait for a file lock
12694 and cannot be helped, the other being that \*(UA calls the function
12695 .Xr uname 2
12696 in order to query the nodename of the box (sometimes the real one is
12697 needed instead of the one represented by the internal variable
12698 .Va hostname ) .
12699 One may have varying success by ensuring that the real hostname and
12700 .Ql localhost
12701 have entries in
12702 .Pa /etc/hosts ,
12703 or, more generally, that the name service is properly setup \(en
12704 and does
12705 .Xr hostname 1
12706 return the expected value?
12707 Does this local hostname have a domain suffix?
12708 RFC 6762 standardized the link-local top-level domain
12709 .Ql .local ,
12710 try again after adding an (additional) entry with this extension.
12711 .\" }}}
12713 .\" .Ss "I cannot login to Google mail aka GMail" {{{
12714 .Ss "I cannot login to Google mail aka GMail"
12716 Since 2014 some free service providers classify programs as
12717 .Dq less secure
12718 unless they use a special authentification method (OAuth 2.0) which
12719 was not standardized for non-HTTP protocol authentication token query
12720 until August 2015 (RFC 7628).
12723 Different to Kerberos / GSSAPI, which is developed since the mid of the
12724 1980s, where a user can easily create a local authentication ticket for
12725 her- and himself with the locally installed
12726 .Xr kinit 1
12727 program, that protocol has no such local part but instead requires
12728 a world-wide-web query to create or fetch a token; since there is no
12729 local cache this query would have to be performed whenever \*(UA is
12730 invoked (in interactive sessions situation may differ).
12733 \*(UA does not support OAuth.
12734 Because of this it is necessary to declare \*(UA a
12735 .Dq less secure app
12736 (on the providers account web page) in order to read and send mail.
12737 However, it also seems possible to take the following steps instead:
12740 .Bl -enum -compact
12742 give the provider the number of a mobile phone,
12744 enable
12745 .Dq 2-Step Verification ,
12747 create an application specific password (16 characters), and
12749 use that special password instead of the real Google account password in
12750 \*(UA (for more on that see the section
12751 .Sx "On URL syntax and credential lookup" ) .
12753 .\" }}}
12755 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
12756 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
12758 It can happen that the terminal library (see
12759 .Sx "On terminal control and line editor",
12760 .Ic bind ,
12761 .Va termcap )
12762 reports different codes than the terminal really sends, in which case
12763 \*(UA will tell that a key binding is functional, but will not be able to
12764 recognize it because the received data does not match anything expected.
12765 Especially without the \*(OPal terminal capability library support one
12766 reason for this may be that the (possibly even non-existing) keypad
12767 is not turned on and the resulting layout reports the keypad control
12768 codes for the normal keyboard keys.
12770 .Va verbose
12771 listing of
12772 .Ic bind Ns
12773 ings will show the byte sequences that are expected.
12776 To overcome the situation, use, e.g., the program
12777 .Xr cat 1 ,
12778 in conjunction with the command line option
12779 .Fl \&\&v ,
12780 if available, to see the byte sequences which are actually produced
12781 by keypresses, and use the variable
12782 .Va termcap
12783 to make \*(UA aware of them.
12784 E.g., the terminal this is typed on produces some false sequences, here
12785 an example showing the shifted home key:
12787 .Bd -literal -offset indent
12788 ? set verbose
12789 ? bind*
12790 # 1B 5B=[ 31=1 3B=; 32=2 48=H
12791   bind base :kHOM z0
12792 ? x
12793 $ cat -v
12794 ^[[H
12795 ? \*(uA -v -Stermcap='kHOM=\eE[H'
12796 ? bind*
12797 # 1B 5B=[ 48=H
12798   bind base :kHOM z0
12800 .\" }}}
12802 .\" }}}
12805 .\" .Sh "IMAP CLIENT" {{{
12806 .Sh "IMAP CLIENT"
12808 \*(OPally there is IMAP client support available.
12809 This part of the program is obsolete and will vanish in v15 with the
12810 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
12811 and makes excessive use of signal based long code jumps.
12812 Support can hopefully be readded later based on a new-style I/O, with
12813 SysV signal handling.
12814 In fact the IMAP support had already been removed from the codebase, but
12815 was reinstantiated on user demand: in effect the IMAP code is at the
12816 level of \*(UA v14.8.16 (with
12817 .Ic imapcodec
12818 being the sole exception), and should be treated with some care.
12821 IMAP uses the
12822 .Ql imap://
12824 .Ql imaps://
12825 protocol prefixes, and an IMAP-based
12826 .Va folder
12827 may be used.
12828 IMAP URLs (paths) undergo inspections and possible transformations
12829 before use (and the command
12830 .Ic imapcodec
12831 can be used to manually apply them to any given argument).
12832 Hierarchy delimiters are normalized, a step which is configurable via the
12833 .Va imap-delim
12834 variable chain, but defaults to the first seen delimiter otherwise.
12835 \*(UA supports internationalised IMAP names, and en- and decodes the
12836 names from and to the
12837 .Va ttycharset
12838 as necessary and possible.
12839 If a mailbox name is expanded (see
12840 .Sx "Filename transformations" )
12841 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
12842 mailboxes below the
12843 .Va folder
12844 target box, while folder names prefixed by `@' refer to folders below
12845 the hierarchy base.
12848 Note: some IMAP servers do not accept the creation of mailboxes in
12849 the hierarchy base, but require that they are created as subfolders of
12850 `INBOX' \(en with such servers a folder name of the form
12852 .Dl imaps://mylogin@imap.myisp.example/INBOX.
12854 should be used (the last character is the server's hierarchy
12855 delimiter).
12856 The following IMAP-specific commands exist:
12859 .Bl -tag -width ".It Ic BaNg"
12861 .It Ic cache
12862 Only applicable to cached IMAP mailboxes;
12863 takes a message list and reads the specified messages into the IMAP
12864 cache.
12867 .It Ic connect
12868 If operating in disconnected mode on an IMAP mailbox,
12869 switch to online mode and connect to the mail server while retaining
12870 the mailbox status.
12871 See the description of the
12872 .Va disconnected
12873 variable for more information.
12876 .It Ic disconnect
12877 If operating in online mode on an IMAP mailbox,
12878 switch to disconnected mode while retaining the mailbox status.
12879 See the description of the
12880 .Va disconnected
12881 variable for more.
12882 A list of messages may optionally be given as argument;
12883 the respective messages are then read into the cache before the
12884 connection is closed, thus
12885 .Ql disco *
12886 makes the entire mailbox available for disconnected use.
12889 .It Ic imap
12890 Sends command strings directly to the current IMAP server.
12891 \*(UA operates always in IMAP `selected state' on the current mailbox;
12892 commands that change this will produce undesirable results and should be
12893 avoided.
12894 Useful IMAP commands are:
12895 .Bl -tag -offset indent -width ".Ic getquotearoot"
12896 .It create
12897 Takes the name of an IMAP mailbox as an argument and creates it.
12898 .It getquotaroot
12899 (RFC 2087) Takes the name of an IMAP mailbox as an argument
12900 and prints the quotas that apply to the mailbox.
12901 Not all IMAP servers support this command.
12902 .It namespace
12903 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
12904 the Other User's Namespaces and the Shared Namespaces.
12905 Each namespace type is printed in parentheses;
12906 if there are multiple namespaces of the same type,
12907 inner parentheses separate them.
12908 For each namespace a prefix and a hierarchy separator is listed.
12909 Not all IMAP servers support this command.
12913 .It Ic imapcodec
12914 Perform IMAP path transformations.
12915 Supports
12916 .Cm vput
12917 (see
12918 .Sx "Command modifiers" ) ,
12919 and manages the error number
12920 .Va \&! .
12921 The first argument specifies the operation:
12922 .Ar e[ncode]
12923 normalizes hierarchy delimiters (see
12924 .Va imap-delim )
12925 and converts the strings from the locale
12926 .Va ttycharset
12927 to the internationalized variant used by IMAP,
12928 .Ar d[ecode]
12929 performs the reverse operation.
12934 The following IMAP-specific internal variables exist:
12937 .Bl -tag -width ".It Va BaNg"
12939 .It Va disconnected
12940 \*(BO When an IMAP mailbox is selected and this variable is set,
12941 no connection to the server is initiated.
12942 Instead, data is obtained from the local cache (see
12943 .Va imap-cache Ns
12945 Mailboxes that are not present in the cache
12946 and messages that have not yet entirely been fetched from the server
12947 are not available;
12948 to fetch all messages in a mailbox at once,
12949 the command
12950 .No ` Ns Li copy * /dev/null Ns '
12951 can be used while still in connected mode.
12952 Changes that are made to IMAP mailboxes in disconnected mode are queued
12953 and committed later when a connection to that server is made.
12954 This procedure is not completely reliable since it cannot be guaranteed
12955 that the IMAP unique identifiers (UIDs) on the server still match the
12956 ones in the cache at that time.
12957 Data is saved to
12958 .Ev DEAD
12959 when this problem occurs.
12961 .It Va disconnected-USER@HOST
12962 The specified account is handled as described for the
12963 .Va disconnected
12964 variable above,
12965 but other accounts are not affected.
12967 .Mx Va imap-auth
12968 .It Va imap-auth-USER@HOST , imap-auth
12969 Sets the IMAP authentication method.
12970 Valid values are `login' for the usual password-based authentication
12971 (the default),
12972 `cram-md5', which is a password-based authentication that does not send
12973 the password over the network in clear text,
12974 and `gssapi' for GSS-API based authentication.
12977 .It Va imap-cache
12978 Enables caching of IMAP mailboxes.
12979 The value of this variable must point to a directory that is either
12980 existent or can be created by \*(UA.
12981 All contents of the cache can be deleted by \*(UA at any time;
12982 it is not safe to make assumptions about them.
12984 .Mx Va imap-delim
12985 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
12986 The hierarchy separator used by the IMAP server.
12987 Whenever an IMAP path is specified it will undergo normalization.
12988 One of the normalization steps is the squeezing and adjustment of
12989 hierarchy separators.
12990 If this variable is set, any occurrence of any character of the given
12991 value that exists in the path will be replaced by the first member of
12992 the value; an empty value will cause the default to be used, it is
12993 .Ql /. .
12994 If not set, we will reuse the first hierarchy separator character that
12995 is discovered in a user-given mailbox name.
12997 .Mx Va imap-keepalive
12998 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
12999 IMAP servers may close the connection after a period of
13000 inactivity; the standard requires this to be at least 30 minutes,
13001 but practical experience may vary.
13002 Setting this variable to a numeric `value' greater than 0 causes
13003 a `NOOP' command to be sent each `value' seconds if no other operation
13004 is performed.
13007 .It Va imap-list-depth
13008 When retrieving the list of folders on an IMAP server, the
13009 .Ic folders
13010 command stops after it has reached a certain depth to avoid possible
13011 infinite loops.
13012 The value of this variable sets the maximum depth allowed.
13013 The default is 2.
13014 If the folder separator on the current IMAP server is a slash `/',
13015 this variable has no effect and the
13016 .Ic folders
13017 command does not descend to subfolders.
13019 .Mx Va imap-use-starttls
13020 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
13021 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
13022 IMAP session SSL/TLS encrypted.
13023 This functionality is not supported by all servers,
13024 and is not used if the session is already encrypted by the IMAPS method.
13027 .\" }}}
13030 .\" .Sh "SEE ALSO" {{{
13031 .Sh "SEE ALSO"
13033 .Xr bogofilter 1 ,
13034 .Xr gpg 1 ,
13035 .Xr more 1 ,
13036 .Xr newaliases 1 ,
13037 .Xr openssl 1 ,
13038 .Xr sendmail 1 ,
13039 .Xr sh 1 ,
13040 .Xr spamassassin 1 ,
13041 .Xr iconv 3 ,
13042 .Xr setlocale 3 ,
13043 .Xr aliases 5 ,
13044 .Xr termcap 5 ,
13045 .Xr terminfo 5 ,
13046 .Xr locale 7 ,
13047 .Xr mailaddr 7 ,
13048 .Xr re_format 7 ,
13049 .Xr mailwrapper 8 ,
13050 .Xr sendmail 8
13052 .\" }}}
13055 .\" .Sh HISTORY {{{
13056 .Sh HISTORY
13058 M. Douglas McIlroy writes in his article
13059 .Dq A Research UNIX Reader: Annotated Excerpts \
13060 from the Programmer's Manual, 1971-1986
13061 that a
13062 .Xr mail 1
13063 command already appeared in First Edition
13065 in 1971:
13067 .Bd -ragged -offset indent
13068 Electronic mail was there from the start.
13069 Never satisfied with its exact behavior, everybody touched it at one
13070 time or another: to assure the safety of simultaneous access, to improve
13071 privacy, to survive crashes, to exploit uucp, to screen out foreign
13072 freeloaders, or whatever.
13073 Not until v7 did the interface change (Thompson).
13074 Later, as mail became global in its reach, Dave Presotto took charge and
13075 brought order to communications with a grab-bag of external networks
13076 (v8).
13081 Mail was written in 1978 by Kurt Shoens and developed as part of the
13084 distribution until 1995.
13085 Mail has then seen further development in open source
13087 variants, noticeably by Christos Zoulas in
13088 .Pf Net Bx .
13089 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
13090 Ritter in the years 2000 until 2008.
13091 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
13092 This man page is derived from
13093 .Dq The Mail Reference Manual
13094 that was originally written by Kurt Shoens.
13096 .\" }}}
13099 .Sh AUTHORS
13101 .An "Kurt Shoens" ,
13102 .An "Edward Wang" ,
13103 .An "Keith Bostic" ,
13104 .An "Christos Zoulas" ,
13105 .An "Gunnar Ritter" ,
13106 .An "Steffen Nurpmeso" .
13109 The variables
13110 .Va contact-mail
13112 .Va contact-web
13113 provide contact addresses:
13115 .\" v15-compat: drop eval as `mail' will expand variable?
13116 .Dl ? echo $contact-web; eval mail $contact-mail
13119 .\" .Sh CAVEATS {{{
13120 .Sh CAVEATS
13122 \*(ID Interrupting an operation via
13123 .Dv \&\&SIGINT
13125 .Ql control-C
13126 from anywhere else but a command prompt is very problematic and likely
13127 to leave the program in an undefined state: many library functions
13128 cannot deal with the
13129 .Fn siglongjmp 3
13130 that this software (still) performs; even though efforts have been taken
13131 to address this, no sooner but in v15 it will have been worked out:
13132 interruptions have not been disabled in order to allow forceful breakage
13133 of hanging network connections, for example (all this is unrelated to
13134 .Va ignore ) .
13137 The SMTP and POP3 protocol support of \*(UA is very basic.
13138 Also, if it fails to contact its upstream SMTP server, it will not make
13139 further attempts to transfer the message at a later time (setting
13140 .Va save
13142 .Va sendwait
13143 may be useful).
13144 If this is a concern, it might be better to set up a local SMTP server
13145 that is capable of message queuing.
13147 .\" }}}
13150 .Sh BUGS
13152 After deleting some message of a POP3 mailbox the header summary falsely
13153 claims that there are no messages to display, one needs to perform
13154 a scroll or dot movement to restore proper state.
13156 In threaded display a power user may encounter crashes very
13157 occasionally (this is may and very).
13159 The file
13160 .Pa TODO
13161 in the source repository lists future directions.
13163 .\" s-ts-mode