nail.1: review
[s-mailx.git] / nail.1
blob3476894c92360288bc8f00cecf778898c1b99e5a
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-rc1 / 2017-07-01
35 .Dd July 01, 2017
36 .ds VV \\%v14.9.0-rc1
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 a 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-To:
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-To: ) .
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.
1524 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 certificate 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:]_#:@.-]+$? .
3749 .It Ic alternates , unalternates
3750 \*(NQ(alt) Manage a list of alternate addresses or names of the active user,
3751 members of which will be removed from recipient lists.
3752 The latter command removes the given list of alternates, the special name
3753 .Ql *
3754 will discard all existing aliases.
3755 The former command manages the error number
3756 .Va \&!
3757 and shows the current set of alternates when used without arguments; in
3758 this mode it supports
3759 .Cm vput
3760 (see
3761 .Sx "Command modifiers" ) .
3762 Otherwise the given arguments (after being checked for validity) are
3763 appended to the list of alternate names; in
3764 .Va posix
3765 mode they replace that list instead.
3766 There is a set of implicit alternates which is formed of the values of
3767 .Ev LOGNAME ,
3768 .Va from ,
3769 .Va sender
3771 .Va replyto .
3775 .It Ic answered , unanswered
3776 Take a message lists and mark each message as having been answered,
3777 having not been answered, respectively.
3778 Messages will be marked answered when being
3779 .Ic reply Ns d
3780 to automatically if the
3781 .Va markanswered
3782 variable is set.
3783 See the section
3784 .Sx "Message states" .
3789 .It Ic bind , unbind
3790 \*(OP\*(NQ The bind command extends the MLE (see
3791 .Sx "On terminal control and line editor" )
3792 with freely configurable key bindings.
3793 The latter command removes from the given context the given key binding,
3794 both of which may be specified as a wildcard
3795 .Ql * ,
3796 so that, e.g.,
3797 .Ql unbind * *
3798 will remove all bindings of all contexts.
3799 Due to initialization order unbinding will not work for built-in key
3800 bindings upon program startup, however: please use
3801 .Va line-editor-no-defaults
3802 for this purpose instead.
3805 With one argument the former command shows all key bindings for the
3806 given context, specifying an asterisk
3807 .Ql *
3808 will show the bindings of all contexts; a more verbose listing will be
3809 produced if either of
3810 .Va debug
3812 .Va verbose
3813 are set.
3814 With two or more arguments a binding is (re)established:
3815 the first argument is the context to which the binding shall apply,
3816 the second argument is a comma-separated list of the
3817 .Dq keys
3818 which form the binding, and any remaining arguments form the expansion.
3819 To indicate that a binding shall not be auto-committed, but that the
3820 expansion shall instead be furtherly editable by the user, a commercial at
3821 .Ql @
3822 (that will be removed) can be placed last in the expansion, from which
3823 leading and trailing whitespace will finally be removed.
3824 Reverse solidus cannot be used as the last character of expansion.
3827 Contexts define when a binding applies, i.e., a binding will not be seen
3828 unless the context for which it is defined for is currently active.
3829 This is not true for the shared binding
3830 .Ql base ,
3831 which is the foundation for all other bindings and as such always
3832 applies, its bindings, however, only apply secondarily.
3833 The available contexts are the shared
3834 .Ql base ,
3836 .Ql default
3837 context which is used in all not otherwise documented situations, and
3838 .Ql compose ,
3839 which applies to compose mode only.
3842 .Dq Keys
3843 which form the binding are specified as a comma-separated list of
3844 byte-sequences, where each list entry corresponds to one key(press).
3845 A list entry may, indicated by a leading colon character
3846 .Ql \&: ,
3847 also refer to the name of a terminal capability; several dozen names
3848 will be compiled in and may be specified either by their
3849 .Xr terminfo 5 ,
3850 or, if existing, by their
3851 .Xr termcap 5
3852 name, regardless of the actually used \*(OPal terminal control library.
3853 It is possible to use any capability, as long as the name is resolvable
3854 by the \*(OPal control library or was defined via the internal variable
3855 .Va termcap .
3856 Input sequences are not case-normalized, so that an exact match is
3857 required to update or remove a binding.
3858 Examples:
3860 .Bd -literal -offset indent
3861 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
3862 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
3863 ? bind default $'\ecA',:khome,w 'echo An editable binding@'
3864 ? bind default a,b,c rm -irf / @  # Another editable binding
3865 ? bind default :kf1 File %
3866 ? bind compose :kf1 ~e
3870 Note that the entire comma-separated list is first parsed (over) as a
3871 shell-token with whitespace as the field separator, before being parsed
3872 and expanded for real with comma as the field separator, therefore
3873 whitespace needs to be properly quoted, see
3874 .Sx "Shell-style argument quoting" .
3875 Using Unicode reverse solidus escape sequences renders a binding
3876 defunctional if the locale does not support Unicode (see
3877 .Sx "Character sets" ) ,
3878 and using terminal capabilities does so if no (corresponding) terminal
3879 control support is (currently) available.
3882 The following terminal capability names are built-in and can be used in
3883 .Xr terminfo 5
3884 or (if available) the two-letter
3885 .Xr termcap 5
3886 notation.
3887 See the respective manual for a list of capabilities.
3888 The program
3889 .Xr infocmp 1
3890 can be used to show all the capabilities of
3891 .Ev TERM
3892 or the given terminal type;
3893 using the
3894 .Fl \&\&x
3895 flag will also show supported (non-standard) extensions.
3898 .Bl -tag -compact -width kcuuf_or_kcuuf
3899 .It Cd kbs Ns \0or Cd kb
3900 Backspace.
3901 .It Cd kdch1 Ns \0or Cd kD
3902 Delete character.
3903 .It Cd kDC Ns \0or Cd *4
3904 \(em shifted variant.
3905 .It Cd kel Ns \0or Cd kE
3906 Clear to end of line.
3907 .It Cd kext Ns \0or Cd @9
3908 Exit.
3909 .It Cd kich1 Ns \0or Cd kI
3910 Insert character.
3911 .It Cd kIC Ns \0or Cd #3
3912 \(em shifted variant.
3913 .It Cd khome Ns \0or Cd kh
3914 Home.
3915 .It Cd kHOM Ns \0or Cd #2
3916 \(em shifted variant.
3917 .It Cd kend Ns \0or Cd @7
3918 End.
3919 .It Cd knp Ns \0or Cd kN
3920 Next page.
3921 .It Cd kpp Ns \0or Cd kP
3922 Previous page.
3923 .It Cd kcub1 Ns \0or Cd kl
3924 Left cursor (with more modifiers: see below).
3925 .It Cd kLFT Ns \0or Cd #4
3926 \(em shifted variant.
3927 .It Cd kcuf1 Ns \0or Cd kr
3928 Right cursor (ditto).
3929 .It Cd kRIT Ns \0or Cd %i
3930 \(em shifted variant.
3931 .It Cd kcud1 Ns \0or Cd kd
3932 Down cursor (ditto).
3933 .It Cd kDN
3934 \(em shifted variant (only terminfo).
3935 .It Cd kcuu1 Ns \0or Cd ku
3936 Up cursor (ditto).
3937 .It Cd kUP
3938 \(em shifted variant (only terminfo).
3939 .It Cd kf0 Ns \0or Cd k0
3940 Function key 0.
3941 Add one for each function key up to
3942 .Cd kf9
3944 .Cd k9 ,
3945 respectively.
3946 .It Cd kf10 Ns \0or Cd k;
3947 Function key 10.
3948 .It Cd kf11 Ns \0or Cd F1
3949 Function key 11.
3950 Add one for each function key up to
3951 .Cd kf19
3953 .Cd F9 ,
3954 respectively.
3958 Some terminals support key-modifier combination extensions, e.g.,
3959 .Ql Alt+Shift+xy .
3960 For example, the delete key,
3961 .Cd kdch1 :
3962 in its shifted variant, the name is mutated to
3963 .Cd  kDC ,
3964 then a number is appended for the states
3965 .Ql Alt
3966 .Pf ( Cd kDC3 ) ,
3967 .Ql Shift+Alt
3968 .Pf ( Cd kDC4 ) ,
3969 .Ql Control
3970 .Pf ( Cd kDC5 ) ,
3971 .Ql Shift+Control
3972 .Pf ( Cd kDC6 ) ,
3973 .Ql Alt+Control
3974 .Pf ( Cd kDC7 ) ,
3975 finally
3976 .Ql Shift+Alt+Control
3977 .Pf ( Cd kDC8 ) .
3978 The same for the left cursor key,
3979 .Cd kcub1 :
3980 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
3983 It is advisable to use an initial escape or other control character (e.g.,
3984 .Ql \ecA )
3985 for bindings which describe user key combinations (as opposed to purely
3986 terminal capability based ones), in order to avoid ambiguities whether
3987 input belongs to key sequences or not; it also reduces search time.
3988 Adjusting
3989 .Va bind-timeout
3990 may help shall keys and sequences be falsely recognized.
3994 .It Ic call
3995 \*(NQ Calls the given macro, which must have been created via
3996 .Ic define ,
3997 otherwise a
3998 .Va ^ERR Ns -NOENT
3999 error occurs.
4000 Parameters given to macros are implicitly local to the macro's scope, and
4001 may be accessed via special (positional) parameters, e.g.,
4002 .Va 1 ,
4003 .Va * ,
4004 .Va @ ,
4005 .Va # .
4006 The positional parameters may be removed by
4007 .Ic shift Ns
4008 ing them off the stack (exceeding the supported number of arguments
4009 results in a
4010 .Va ^ERR Ns -OVERFLOW ) ,
4011 and are otherwise controllable via
4012 .Ic vpospar .
4013 Macro execution can be terminated at any time by calling
4014 .Ic return .
4017 Calling macros recursively will at some time excess the stack size
4018 limit, causing a hard program abortion; if recursively calling a macro
4019 is the last command of the current macro, consider to use the command
4020 .Ic xcall ,
4021 which will first release all resources of the current macro before
4022 replacing the current macro with the called one.
4023 Numeric and string operations can be performed via
4024 .Ic vexpr ,
4026 .Ic eval
4027 may be helpful to recreate argument lists.
4029 .Bd -literal -offset indent
4030 define exmac {
4031   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4032   return 1000 0
4034 call exmac Hello macro exmac!
4038 Caveats: \*(UA parses  entire input lines and decides on a per-command
4039 base what to do with the rest of the line, different to the
4040 .Xr sh 1 Ns
4041 ell, which implements a standardized (programming) language, and
4042 performs several successive transformation steps after decomposing the
4043 given command line into tokens adhering standardized syntax guidelines.
4044 E.g., in the following code snippets of otherwise identical meaning,
4045 a shell will see zero arguments, whereas \*(UA sees one, unless an
4046 additional expansion (via
4047 .Ic eval )
4048 is explicitly used:
4050 .Bd -literal -offset indent
4051 $ cat > t.sh << '___'; cat > t.rc << '___'
4052 x() { echo $#; }
4053 set --
4054 x "$@"
4056 define x {
4057   echo $#
4059 vpospar set
4060 call x "$@"
4061 eval call x "$@"
4063 $ sh t.sh; \*(uA -X'source t.rc' -Xx
4071 .It Ic call_if
4072 Identical to
4073 .Ic call
4074 if the given macro has been created via
4075 .Ic define ,
4076 but doesn't fail nor warn if the macro doesn't exist.
4079 .It Ic cd
4080 (ch) Change the working directory to
4081 .Ev HOME
4082 or the given argument.
4083 Synonym for
4084 .Ic chdir .
4087 .It Ic certsave
4088 \*(OP Only applicable to S/MIME signed messages.
4089 Takes a message list and a filename and saves the certificates
4090 contained within the message signatures to the named file in both
4091 human-readable and PEM format.
4092 The certificates can later be used to send encrypted messages to the
4093 respective message senders by setting
4094 .Va smime-encrypt-USER@HOST
4095 variables.
4099 .It Ic charsetalias , uncharsetalias
4100 \*(NQ Manage (character set conversion) character set alias mappings,
4101 as documented in the section
4102 .Sx "Character sets" .
4103 Character set aliases are expanded recursively, but no expansion is
4104 performed on values of the user-settable variables, e.g.,
4105 .Va charset-8bit .
4106 These are effectively no-operations if character set conversion
4107 is not available (i.e., no
4108 .Ql +iconv
4110 .Va features ) .
4111 Without arguments the list of all currently defined aliases is shown,
4112 with one argument the expansion of the given alias.
4113 Otherwise all given arguments are treated as pairs of character sets and
4114 their desired target alias name, creating new or changing already
4115 existing aliases, as necessary.
4117 The latter deletes all aliases given as arguments, the special argument
4118 .Ql *
4119 will remove all aliases.
4122 .It Ic chdir
4123 (ch) Change the working directory to
4124 .Ev HOME
4125 or the given argument.
4126 Synonym for
4127 .Ic cd .
4131 .It Ic collapse , uncollapse
4132 Only applicable to threaded mode.
4133 Takes a message list and makes all replies to these messages invisible
4134 in header summaries, except for
4135 .Ql new
4136 messages and the
4137 .Dq dot .
4138 Also when a message with collapsed replies is displayed,
4139 all of these are automatically uncollapsed.
4140 The latter command undoes collapsing.
4145 .It Ic colour , uncolour
4146 \*(OP\*(NQ Manage colour mappings of and for a
4147 .Sx "Coloured display" .
4148 The type of colour is given as the (case-insensitive) first argument,
4149 which must be one of
4150 .Ql 256
4151 for 256-colour terminals,
4152 .Ql 8 ,
4153 .Ql ansi
4155 .Ql iso
4156 for the standard 8-colour ANSI / ISO 6429 color palette and
4157 .Ql 1
4159 .Ql mono
4160 for monochrome terminals.
4161 Monochrome terminals cannot deal with colours, but only (some) font
4162 attributes.
4165 Without further arguments the list of all currently defined mappings
4166 for the given colour type is shown (as a special case giving
4167 .Ql all
4169 .Ql *
4170 will show the mappings of all types).
4171 Otherwise the second argument defines the mappable slot, and the third
4172 argument a (comma-separated list of) colour and font attribute
4173 specification(s), and the optional fourth argument can be used to
4174 specify a precondition: if conditioned mappings exist they are tested in
4175 (creation) order unless a (case-insensitive) match has been found, and
4176 the default mapping (if any has been established) will only be chosen as
4177 a last resort.
4178 The types of precondition available depend on the mappable slot (see
4179 .Sx "Coloured display"
4180 for some examples), the following of which exist:
4183 Mappings prefixed with
4184 .Ql mle-
4185 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4186 .Sx "On terminal control and line editor" )
4187 and do not support preconditions.
4189 .Bl -tag -compact -width view-partinfo
4190 .It Ar mle-position
4191 This mapping is used for the position indicator that is visible when
4192 a line cannot be fully displayed on the screen.
4193 .It Ar mle-prompt
4194 Used for the
4195 .Va prompt .
4199 Mappings prefixed with
4200 .Ql sum-
4201 are used in header summaries, and they all understand the preconditions
4202 .Ql dot
4203 (the current message) and
4204 .Ql older
4205 for elder messages (only honoured in conjunction with
4206 .Va datefield-markout-older ) .
4208 .Bl -tag -compact -width view-partinfo
4209 .It Ar sum-dotmark
4210 This mapping is used for the
4211 .Dq dotmark
4212 that can be created with the
4213 .Ql %>
4215 .Ql %<
4216 formats of the variable
4217 .Va headline .
4218 .It Ar sum-header
4219 For the complete header summary line except the
4220 .Dq dotmark
4221 and the thread structure.
4222 .It Ar sum-thread
4223 For the thread structure which can be created with the
4224 .Ql %i
4225 format of the variable
4226 .Va headline .
4230 Mappings prefixed with
4231 .Ql view-
4232 are used when displaying messages.
4234 .Bl -tag -compact -width view-partinfo
4235 .It Ar view-from_
4236 This mapping is used for so-called
4237 .Ql From_
4238 lines, which are MBOX file format specific header lines.
4239 .It Ar view-header
4240 For header lines.
4241 A comma-separated list of headers to which the mapping applies may be
4242 given as a precondition; if the \*(OPal regular expression support is
4243 available then if any of the
4244 .Dq magical
4245 (extended) regular expression characters is seen the precondition will
4246 be evaluated as (an extended) one.
4247 .It Ar view-msginfo
4248 For the introductional message info line.
4249 .It Ar view-partinfo
4250 For MIME part info lines.
4254 The following (case-insensitive) colour definitions and font attributes
4255 are understood, multiple of which can be specified in a comma-separated
4256 list:
4258 .Bl -tag -width ft=
4259 .It Ar ft=
4260 a font attribute:
4261 .Ql bold ,
4262 .Ql reverse
4264 .Ql underline .
4265 It is possible (and often applicable) to specify multiple font
4266 attributes for a single mapping.
4268 .It Ar fg=
4269 foreground colour attribute:
4270 .Ql black ,
4271 .Ql blue ,
4272 .Ql green ,
4273 .Ql red ,
4274 .Ql brown ,
4275 .Ql magenta ,
4276 .Ql cyan
4278 .Ql white .
4279 To specify a 256-color mode a decimal number colour specification in
4280 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4282 .Bl -tag -compact -width "999 - 999"
4283 .It 0 - 7
4284 the standard ISO 6429 colors, as above.
4285 .It 8 - 15
4286 high intensity variants of the standard colors.
4287 .It 16 - 231
4288 216 colors in tuples of 6.
4289 .It 232 - 255
4290 grayscale from black to white in 24 steps.
4292 .Bd -literal -offset indent
4293 #!/bin/sh -
4294 fg() { printf "\e033[38;5;${1}m($1)"; }
4295 bg() { printf "\e033[48;5;${1}m($1)"; }
4297 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4298 printf "\e033[0m\en"
4300 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4301 printf "\e033[0m\en"
4304 .It Ar bg=
4305 background colour attribute (see
4306 .Cd fg=
4307 for possible values).
4311 The command
4312 .Ic \&uncolour
4313 will remove for the given colour type (the special type
4314 .Ql *
4315 selects all) the given mapping; if the optional precondition argument is
4316 given only the exact tuple of mapping and precondition is removed.
4317 The special name
4318 .Ql *
4319 will remove all mappings (no precondition allowed), thus
4320 .Ql uncolour * *
4321 will remove all established mappings.
4326 .It Ic commandalias , uncommandalias
4327 \*(NQ Define or list, and remove, respectively, command aliases.
4328 An (command)alias can be used everywhere a normal command can be used,
4329 but always takes precedence: any arguments that are given to the command
4330 alias are joined onto the alias expansion, and the resulting string
4331 forms the command line that is, in effect, executed.
4332 The latter command removes all given aliases, the special name
4333 .Ql *
4334 will remove all existing aliases.
4335 When used without arguments the former shows a list of all currently
4336 known aliases, with one argument only the expansion of the given one.
4338 With two or more arguments a command alias is defined or updated: the
4339 first argument is the name under which the remaining command line should
4340 be accessible, the content of which can be just about anything.
4341 An alias may itself expand to another alias, but to avoid expansion loops
4342 further expansion will be prevented if an alias refers to itself or if
4343 an expansion depth limit is reached.
4344 Explicit expansion prevention is available via reverse solidus
4345 .Cm \e ,
4346 one of the
4347 .Sx "Command modifiers" .
4348 .Bd -literal -offset indent
4349 ? commandalias xx
4350 \*(uA: `commandalias': no such alias: xx
4351 ? commandalias xx echo hello,
4352 ? commandalias xx
4353 commandalias xx 'echo hello,'
4354 ? xx
4355 hello,
4356 ? xx world
4357 hello, world
4361 .It Ic Copy
4362 (C) Copy messages to files whose names are derived from the author of
4363 the respective message and do not mark them as being saved;
4364 otherwise identical to
4365 .Ic Save .
4368 .It Ic copy
4369 (c) Copy messages to the named file and do not mark them as being saved;
4370 otherwise identical to
4371 .Ic save .
4374 .It Ic cwd
4375 Show the name of the current working directory, as reported by
4376 .Xr getcwd 3 .
4377 Supports
4378 .Cm vput
4379 (see
4380 .Sx "Command modifiers" ) .
4381 The return status is tracked via
4382 .Va \&! .
4385 .It Ic Decrypt
4386 \*(OP For unencrypted messages this command is identical to
4387 .Ic Copy ;
4388 Encrypted messages are first decrypted, if possible, and then copied.
4391 .It Ic decrypt
4392 \*(OP For unencrypted messages this command is identical to
4393 .Ic copy ;
4394 Encrypted messages are first decrypted, if possible, and then copied.
4398 .It Ic define , undefine
4399 Without arguments the current list of macros, including their content,
4400 is shown, otherwise a macro is defined, replacing an existing macro of
4401 the same name.
4402 A macro definition is a sequence of commands in the following form:
4403 .Bd -literal -offset indent
4404 define name {
4405   command1
4406   command2
4407   ...
4408   commandN
4412 A defined macro can be invoked explicitly by using the
4413 .Ic call ,
4414 .Ic call_if
4416 .Ic xcall
4417 commands, or implicitly if a macro hook is triggered, e.g., a
4418 .Va folder-hook .
4419 It is possible to localize adjustments, like creation, deletion and
4420 modification of
4421 .Sx "INTERNAL VARIABLES" ,
4422 by using the
4423 .Ic localopts
4424 command; the scope which is localized depends on how (i.e.,
4425 .Dq as what :
4426 normal macro, folder hook, hook,
4427 .Ic account
4428 switch) the macro is invoked.
4429 Execution of a macro body can be stopped from within by calling
4430 .Ic return .
4431 Inside a
4432 .Ic call Ns
4433 ed macro, given positional parameters can be
4434 .Ic shift Ns
4435 ed, or become completely replaced, removed etc. via
4436 .Ic vpospar .
4438 The latter command deletes the given macro, the special name
4439 .Ql *
4440 will discard all existing macros.
4441 Creation and deletion of (a) macro(s) can be performed from within
4442 a running macro.
4446 .It Ic delete , undelete
4447 (d, u) Marks the given message list as being or not being
4448 .Ql deleted ,
4449 respectively; if no argument has been specified then the usual search
4450 for a visible message is performed, as documented for
4451 .Sx "Message list arguments" ,
4452 showing only the next input prompt if the search fails.
4453 Deleted messages will neither be saved in the
4454 .Mx -sx
4455 .Sx "secondary mailbox"
4456 .Ev MBOX
4457 nor will they be available for most other commands.
4458 If the
4459 .Va autoprint
4460 variable is set, the new
4461 .Dq dot
4462 or the last message restored, respectively, is automatically
4463 .Ic type Ns
4464 d; also see
4465 .Ic dp ,
4466 .Ic dt .
4469 .It Ic discard
4470 (di) Identical to
4471 .Ic ignore .
4472 Superseded by the multiplexer
4473 .Ic headerpick .
4477 .It Ic dp , dt
4478 Delete the given messages and automatically
4479 .Ic type
4480 the new
4481 .Dq dot
4482 if one exists, regardless of the setting of
4483 .Va autoprint .
4486 .It Ic dotmove
4487 Move the
4488 .Dq dot
4489 up or down by one message when given
4490 .Ql +
4492 .Ql -
4493 argument, respectively.
4497 .It Ic draft , undraft
4498 Take message lists and mark each given message as being draft, or not
4499 being draft, respectively, as documented in the section
4500 .Sx "Message states" .
4503 .It Ic echo
4504 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4505 newline, whereas the otherwise identical
4506 .Ic echon
4507 does not.
4508 .Sx "Shell-style argument quoting"
4509 is used,
4510 .Sx "Filename transformations"
4511 are applied to the expanded arguments.
4514 .It Ic echoerr
4515 \*(NQ Identical to
4516 .Ic echo
4517 except that is echoes to standard error.
4518 Also see
4519 .Ic echoerrn .
4520 In interactive sessions the \*(OPal message ring queue for
4521 .Ic errors
4522 will be used instead, if available.
4525 .It Ic echon
4526 \*(NQ Identical to
4527 .Ic echo ,
4528 but does not write a trailing newline.
4531 .It Ic echoerrn
4532 \*(NQ Identical to
4533 .Ic echoerr ,
4534 but does not write a trailing newline.
4537 .It Ic edit
4538 (e) Point the text editor (as defined in
4539 .Ev EDITOR )
4540 at each message from the given list in turn.
4541 Modified contents are discarded unless the
4542 .Va writebackedited
4543 variable is set, and are not used unless the mailbox can be written to
4544 and the editor returns a successful exit status.
4547 .It Ic elif
4548 Part of the
4549 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4550 conditional \(em if the condition of a preceding
4551 .Ic if
4552 was false, check the following condition and execute the following block
4553 if it evaluates true.
4556 .It Ic else
4557 (el) Part of the
4558 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4559 conditional \(em if none of the conditions of the preceding
4560 .Ic if
4562 .Ic elif
4563 commands was true, the
4564 .Ic else
4565 block is executed.
4568 .It Ic endif
4569 (en) Marks the end of an
4570 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4571 conditional execution block.
4575 .It Ic environ
4576 \*(NQ \*(UA has a strict notion about which variables are
4577 .Sx "INTERNAL VARIABLES"
4578 and which are managed in the program
4579 .Sx ENVIRONMENT .
4580 Since some of the latter are a vivid part of \*(UAs functioning,
4581 however, they are transparently integrated into the normal handling of
4582 internal variables via
4583 .Ic set
4585 .Ic unset .
4586 To integrate other environment variables of choice into this
4587 transparent handling, and also to export internal variables into the
4588 process environment where they normally are not, a
4589 .Ql link
4590 needs to become established with this command, as in, e.g.,
4593 .Dl environ link PERL5LIB TZ
4596 Afterwards changing such variables with
4597 .Ic set
4598 will cause automatic updates of the program environment, and therefore
4599 be inherited by newly created child processes.
4600 Sufficient system support provided (it was in BSD as early as 1987, and
4601 is standardized since Y2K) removing such variables with
4602 .Ic unset
4603 will remove them also from the program environment, but in any way
4604 the knowledge they ever have been
4605 .Ql link Ns
4606 ed will be lost.
4607 Note that this implies that
4608 .Ic localopts
4609 may cause loss of such links.
4612 The command
4613 .Ql unlink
4614 will remove an existing link, but leaves the variables as such intact.
4615 Additionally the subcommands
4616 .Ql set
4618 .Ql unset
4619 are provided, which work exactly the same as the documented commands
4620 .Ic set
4622 .Ic unset ,
4623 but (additionally un)link the variable(s) with the program environment
4624 and thus immediately export them to, or remove them from (if possible),
4625 respectively, the program environment.
4629 .It Ic errors
4630 \*(OP Since \*(UA uses the console as a user interface it can happen
4631 that messages scroll by too fast to become recognized.
4632 An error message ring queue is available which stores duplicates of any
4633 error message and notifies the user in interactive sessions whenever
4634 a new error has occurred.
4635 The queue is finite: if its maximum size is reached any new message
4636 replaces the eldest.
4637 The command
4638 .Ic errors
4639 can be used to manage this message queue: if given
4640 .Ar show
4641 or no argument the queue will be displayed and cleared,
4642 .Ar clear
4643 will only clear all messages from the queue.
4646 .It Ic eval
4647 \*(NQ Construct a command by concatenating the arguments, separated with
4648 a single space character, and then evaluate the result.
4649 This command passes through the exit status
4650 .Va \&?
4651 and error number
4652 .Va \&!
4653 of the evaluated command; also see
4654 .Ic call .
4655 .Bd -literal -offset indent
4656 define xxx {
4657   echo "xxx arg <$1>"
4658   shift
4659   if [ $# -gt 0 ]
4660     \excall xxx "$@"
4661   endif
4663 define yyy {
4664   eval "$@ ' ball"
4666 call yyy '\ecall xxx' "b\e$'\et'u ' "
4667 call xxx arg <b      u>
4668 call xxx arg <  >
4669 call xxx arg <ball>
4673 .It Ic exit
4674 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4675 any saving of messages in the
4676 .Mx -sx
4677 .Sx "secondary mailbox"
4678 .Ev MBOX ,
4679 as well as a possibly tracked line editor
4680 .Va history-file .
4681 The optional status number argument will be passed through to
4682 .Xr exit 3 .
4683 \*(ID For now it can happen that the given status will be overwritten,
4684 later this will only occur if a later error needs to be reported onto an
4685 otherwise success indicating status.
4688 .It Ic File
4689 (Fi) Like
4690 .Ic file ,
4691 but open the mailbox read-only.
4695 .It Ic file
4696 (fi) The file command switches to a new mailbox.
4697 Without arguments it shows status information of the current mailbox.
4698 If an argument is given, it will write out changes (such as deletions)
4699 the user has made, open a new mailbox, update the internal variables
4700 .Va mailbox-resolved
4702 .Va mailbox-display ,
4703 and optionally display a summary of
4704 .Ic headers
4705 if the variable
4706 .Va header
4707 is set.
4710 .Sx "Filename transformations"
4711 will be applied to the
4712 .Ar name
4713 argument, and
4714 .Ql protocol://
4715 prefixes are, i.e., URL syntax is understood, e.g.,
4716 .Ql maildir:///tmp/mdirbox :
4717 if a protocol prefix is used the mailbox type is fixated and neither
4718 the auto-detection (read on) nor the
4719 .Va newfolders
4720 mechanisms apply.
4721 \*(OPally URLs can also be used to access network resources, and it is
4722 possible to proxy all network traffic over a SOCKS5 server given via
4723 .Va socks-proxy .
4726 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4727 .Dl \*(OU protocol://[user@]host[:port][/path]
4730 \*(OPally supported network protocols are
4731 .Ar pop3
4732 (POP3) and
4733 .Ar pop3s
4734 (POP3 with SSL/TLS encrypted transport),
4735 .Ar imap
4737 .Ar imaps .
4739 .Ar [/path]
4740 part is valid only for IMAP; there it defaults to
4741 .Ar INBOX .
4742 Network URLs require a special encoding as documented in the section
4743 .Sx "On URL syntax and credential lookup" .
4746 If the resulting file protocol (MBOX database)
4747 .Ar name
4748 is located on a local filesystem then the list of all registered
4749 .Ic filetype Ns
4750 s is traversed in order to see whether a transparent intermediate
4751 conversion step is necessary to handle the given mailbox, in which case
4752 \*(UA will use the found hook to load and save data into and from
4753 a temporary file, respectively.
4754 Changing hooks will not affect already opened mailboxes.
4755 For example, the following creates hooks for the
4756 .Xr gzip 1
4757 compression tool and a combined compressed and encrypted format:
4759 .Bd -literal -offset indent
4760 ? filetype \e
4761     gzip 'gzip -dc' 'gzip -c' \e
4762     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4766 MBOX database files are generally locked during file operations in order
4767 to avoid inconsistencies due to concurrent modifications.
4768 \*(OPal Mailbox files which \*(UA treats as the system
4769 .Va inbox
4770 .Pf ( Ev MAIL ) ,
4772 .Mx -sx
4773 .Sx "primary system mailbox" Ns
4774 es in general will also be protected by so-called dotlock files, the
4775 traditional way of mail spool file locking: for any file
4776 .Ql a
4777 a lock file
4778 .Ql a.lock
4779 will be created for the duration of the synchronization \(em
4780 as necessary a privilege-separated dotlock child process will be used
4781 to accommodate for necessary privilege adjustments in order to create
4782 the dotlock file in the same directory
4783 and with the same user and group identities as the file of interest.
4786 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4787 files, but it will detect invalid message boundaries in this mode and
4788 complain (even more with
4789 .Va debug )
4790 if any is seen: in this case
4791 .Va mbox-rfc4155
4792 can be used to create a valid MBOX database from the invalid input.
4795 If no protocol has been fixated, and
4796 .Ar name
4797 refers to a directory with the subdirectories
4798 .Ql tmp ,
4799 .Ql new
4801 .Ql cur ,
4802 then it is treated as a folder in
4803 .Dq Maildir
4804 format.
4805 The maildir format stores each message in its own file, and has been
4806 designed so that file locking is not necessary when reading or writing
4807 files.
4810 \*(ID If no protocol has been fixated and no existing file has
4811 been found, the variable
4812 .Va newfolders
4813 controls the format of mailboxes yet to be created.
4818 .It Ic filetype , unfiletype
4819 \*(NQ Define or list, and remove, respectively, file handler hooks,
4820 which provide (shell) commands that enable \*(UA to load and save MBOX
4821 files from and to files with the registered file extensions;
4822 it will use an intermediate temporary file to store the plain data.
4823 The latter command removes the hooks for all given extensions,
4824 .Ql *
4825 will remove all existing handlers.
4827 When used without arguments the former shows a list of all currently
4828 defined file hooks, with one argument the expansion of the given alias.
4829 Otherwise three arguments are expected, the first specifying the file
4830 extension for which the hook is meant, and the second and third defining
4831 the load- and save commands, respectively, to deal with the file type,
4832 both of which must read from standard input and write to standard
4833 output.
4834 Changing hooks will not affect already opened mailboxes (\*(ID except below).
4835 \*(ID For now too much work is done, and files are oftened read in twice
4836 where once would be sufficient: this can cause problems if a filetype is
4837 changed while such a file is opened; this was already so with the
4838 built-in support of .gz etc. in Heirloom, and will vanish in v15.
4839 \*(ID For now all handler strings are passed to the
4840 .Ev SHELL for evaluation purposes; in the future a
4841 .Ql \&!
4842 prefix to load and save commands may mean to bypass this shell instance:
4843 placing a leading space will avoid any possible misinterpretations.
4844 .Bd -literal -offset indent
4845 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
4846     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
4847     zst 'zstd -dc' 'zstd -19 -zc' \e
4848     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4849 ? set record=+sent.zst.pgp
4854 .It Ic flag , unflag
4855 Take message lists and mark the messages as being flagged, or not being
4856 flagged, respectively, for urgent/special attention.
4857 See the section
4858 .Sx "Message states" .
4861 .It Ic folder
4862 (fold) The same as
4863 .Ic file .
4866 .It Ic folders
4867 With no arguments, list the names of the folders in the folder directory.
4868 With an existing folder as an argument,
4869 lists the names of folders below the named folder.
4872 .It Ic Followup
4873 (F) Similar to
4874 .Ic Respond ,
4875 but saves the message in a file named after the local part of the first
4876 recipient's address (instead of in
4877 .Va record Ns ).
4880 .It Ic followup
4881 (fo) 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 followupall
4889 Similar to
4890 .Ic followup ,
4891 but responds to all recipients regardless of the
4892 .Va flipr
4893 variable.
4896 .It Ic followupsender
4897 Similar to
4898 .Ic Followup ,
4899 but responds to the sender only regardless of the
4900 .Va flipr
4901 variable.
4904 .It Ic Forward
4905 Similar to
4906 .Ic forward ,
4907 but saves the message in a file named after the local part of the
4908 recipient's address (instead of in
4909 .Va record Ns ).
4912 .It Ic forward
4913 Takes a message and the address of a recipient
4914 and forwards the message to him.
4915 The text of the original message is included in the new one,
4916 with the value of the
4917 .Va forward-inject-head
4918 variable preceding it.
4919 To filter the included header fields to the desired subset use the
4920 .Ql forward
4921 slot of the white- and blacklisting command
4922 .Ic headerpick .
4923 Only the first part of a multipart message is included unless
4924 .Va forward-as-attachment ,
4925 and recipient addresses will be stripped from comments, names etc.
4926 unless the internal variable
4927 .Va fullnames
4928 is set.
4931 .It Ic from
4932 (f) Takes a list of message specifications and displays a summary of
4933 their message headers, exactly as via
4934 .Ic headers .
4935 An alias of this command is
4936 .Ic search .
4937 Also see
4938 .Sx "Specifying messages" .
4940 .It Ic Fwd
4941 \*(OB Alias for
4942 .Ic Forward .
4944 .It Ic fwd
4945 \*(OB Alias for
4946 .Ic forward .
4948 .It Ic fwdignore
4949 \*(OB Superseded by the multiplexer
4950 .Ic headerpick .
4952 .It Ic fwdretain
4953 \*(OB Superseded by the multiplexer
4954 .Ic headerpick .
4956 .It Ic ghost , unghost
4957 \*(OB Replaced by
4958 .Ic commandalias ,
4959 .Ic uncommandalias .
4963 .It Ic headerpick , unheaderpick
4964 \*(NQ Multiplexer command to manage white- and blacklisting
4965 selections of header fields for a variety of applications.
4966 Without arguments the set of contexts that have settings is displayed.
4967 When given arguments, the first argument is the context to which the
4968 command applies, one of (case-insensitive)
4969 .Ql type
4970 for display purposes (via, e.g.,
4971 .Ic type ) ,
4972 .Ql save
4973 for selecting which headers shall be stored persistently when
4974 .Ic save ,
4975 .Ic copy ,
4976 .Ic move
4977 or even
4978 .Ic decrypt Ns
4979 ing messages (note that MIME related etc. header fields should not be
4980 ignored in order to not destroy usability of the message in this case),
4981 .Ql forward
4982 for stripping down messages when
4983 .Ic forward Ns
4984 ing message (has no effect if
4985 .Va forward-as-attachment
4986 is set), and
4987 .Ql top
4988 for defining user-defined set of fields for the command
4989 .Ic top .
4991 The current settings of the given context are displayed if it is the
4992 only argument.
4993 A second argument denotes the type of restriction that is to be chosen,
4994 it may be (a case-insensitive prefix of)
4995 .Ql retain
4997 .Ql ignore
4998 for white- and blacklisting purposes, respectively.
4999 Establishing a whitelist suppresses inspection of the corresponding
5000 blacklist.
5002 If no further argument is given the current settings of the given type
5003 will be displayed, otherwise the remaining arguments specify header
5004 fields, which \*(OPally may be given as regular expressions, to be added
5005 to the given type.
5006 The special wildcard field (asterisk,
5007 .Ql * )
5008 will establish a (fast) shorthand setting which covers all fields.
5010 The latter command always takes three or more arguments and can be used
5011 to remove selections, i.e., from the given context, the given type of
5012 list, all the given headers will be removed, the special argument
5013 .Ql *
5014 will remove all headers.
5017 .It Ic headers
5018 (h) Show the current group of headers, the size of which depends on
5019 the variable
5020 .Va screen ,
5021 and the style of which can be adjusted with the variable
5022 .Va headline .
5023 If a message-specification is given the group of headers containing the
5024 first message therein is shown and the message at the top of the screen
5025 becomes the new
5026 .Dq dot .
5029 .It Ic help
5030 (hel) A synonym for
5031 .Ic \&? .
5034 .It Ic history
5035 \*(OP Either
5036 .Ar show
5037 (this mode also supports a more
5038 .Va verbose
5039 output) or
5040 .Ar clear
5041 the list of history entries;
5042 a decimal
5043 .Ar NUMBER
5044 argument selects and evaluates the respective history entry,
5045 which will become the new history top; a negative number is used as an
5046 offset to the current command, e.g.,
5047 .Ql -1
5048 will select the last command, the history top.
5049 The default mode if no arguments are given is
5050 .Ar show .
5051 Please see
5052 .Sx "On terminal control and line editor"
5053 for more on this topic.
5056 .It Ic hold
5057 (ho, also
5058 .Ic preserve )
5059 Takes a message list and marks each message therein to be saved in the
5060 user's system
5061 .Va inbox
5062 instead of in the
5063 .Mx -sx
5064 .Sx "secondary mailbox"
5065 .Ev MBOX .
5066 Does not override the
5067 .Ic delete
5068 command.
5069 \*(UA deviates from the POSIX standard with this command, because a
5070 .Ic next
5071 command issued after
5072 .Ic hold
5073 will display the following message, not the current one.
5077 .It Ic if
5078 (i) Part of the nestable
5079 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
5080 conditional execution construct \(em if the given condition is true then
5081 the encapsulated block is executed.
5082 The POSIX standards supports the (case-insensitive) conditions
5083 .Ql r Ns
5084 eceive
5086 .Ql s Ns
5087 end, all remaining conditions are non-portable extensions.
5088 \*(ID These commands do not yet use
5089 .Sx "Shell-style argument quoting"
5090 and therefore do not know about input tokens, so that syntax
5091 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5092 all conditions bracket group wise and consider the tokens, representing
5093 values and operators, therein, which also means that variables will
5094 already have been expanded at that time (just like in the shell).
5096 .Bd -literal -offset indent
5097 if receive
5098   commands ...
5099 else
5100   commands ...
5101 endif
5105 The (case-insensitive) condition
5106 .Ql t Ns
5107 erminal will evaluate to true if the standard input is a terminal, i.e.,
5108 in interactive sessions.
5109 Another condition can be any boolean value (see the section
5110 .Sx "INTERNAL VARIABLES"
5111 for textual boolean representations) to mark an enwrapped block as
5112 .Dq never execute
5114 .Dq always execute .
5115 (It shall be remarked that a faulty condition skips all branches until
5116 .Ic endif . )
5119 (\*(ID In v15
5120 .Sx "Shell-style argument quoting"
5121 will be used, and this command will simply interpret expanded tokens.)
5122 It is possible to check
5123 .Sx "INTERNAL VARIABLES"
5124 as well as
5125 .Sx ENVIRONMENT
5126 variables for existence or compare their expansion against a user given
5127 value or another variable by using the
5128 .Ql $
5129 .Pf ( Dq variable next )
5130 conditional trigger character;
5131 a variable on the right hand side may be signalled using the same
5132 mechanism.
5133 Variable names may be enclosed in a pair of matching braces.
5134 When this mode has been triggered, several operators are available:
5137 Integer operators treat the arguments on the left and right hand side of
5138 the operator as integral numbers and compare them arithmetically.
5139 It is an error if any of the operands is not a valid integer, an empty
5140 argument (which implies it had been quoted) is treated as if it were 0.
5141 Available operators are
5142 .Ql -lt
5143 (less than),
5144 .Ql -le
5145 (less than or equal to),
5146 .Ql -eq
5147 (equal),
5148 .Ql -ne
5149 (not equal),
5150 .Ql -ge
5151 (greater than or equal to), and
5152 .Ql -gt
5153 (greater than).
5156 String data operators compare the left and right hand side according to
5157 their textual content.
5158 Unset variables are treated as the empty string.
5159 The behaviour of string operators can be adjusted by prefixing the
5160 operator with the modifier trigger commercial at
5161 .Ql @ ,
5162 followed by none to multiple modifiers: for now supported is
5163 .Ql i ,
5164 which turns the comparison into a case-insensitive one: this is
5165 implied if no modifier follows the trigger.
5168 Available string operators are
5169 .Ql <
5170 (less than),
5171 .Ql <=
5172 (less than or equal to),
5173 .Ql ==
5174 (equal),
5175 .Ql !=
5176 (not equal),
5177 .Ql >=
5178 (greater than or equal to),
5179 .Ql >
5180 (greater than),
5181 .Ql =%
5182 (is substring of) and
5183 .Ql !%
5184 (is not substring of).
5185 By default these operators work on bytes and (therefore) do not take
5186 into account character set specifics.
5187 If the case-insensitivity modifier has been used, case is ignored
5188 according to the rules of the US-ASCII encoding, i.e., bytes are
5189 still compared.
5192 When the \*(OPal regular expression support is available, the additional
5193 string operators
5194 .Ql =~
5196 .Ql !~
5197 can be used.
5198 They treat the right hand side as an extended regular expression that is
5199 matched according to the active locale (see
5200 .Sx "Character sets" ) ,
5201 i.e., character sets should be honoured correctly.
5204 Conditions can be joined via AND-OR lists (where the AND operator is
5205 .Ql &&
5206 and the OR operator is
5207 .Ql || ) ,
5208 which have equal precedence and will be evaluated with left
5209 associativity, thus using the same syntax that is known for the
5210 .Xr sh 1 .
5211 It is also possible to form groups of conditions and lists by enclosing
5212 them in pairs of brackets
5213 .Ql [\ \&.\&.\&.\ ] ,
5214 which may be interlocked within each other, and also be joined via
5215 AND-OR lists.
5218 The results of individual conditions and entire groups may be modified
5219 via unary operators: the unary operator
5220 .Ql \&!
5221 will reverse the result.
5223 .Bd -literal -offset indent
5224 # (This not in v15, there [ -n "$debug"]!)
5225 if $debug
5226   echo *debug* is set
5227 endif
5228 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
5229   echo *ttycharset* is UTF-8, the former case-sensitive!
5230 endif
5231 set t1=one t2=one
5232 if [ "${t1}" == "${t2}" ]
5233   echo These two variables are equal
5234 endif
5235 if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm\&.*" ]
5236   echo ..in an X terminal
5237 endif
5238 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5239     [ "$verbose" != '' ] ] ]
5240   echo Noisy, noisy
5241 endif
5242 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5243   echo Left associativity, as is known from the shell
5244 endif
5249 .It Ic ignore
5250 (ig) Identical to
5251 .Ic discard .
5252 Superseded by the multiplexer
5253 .Ic headerpick .
5256 .It Ic list
5257 Shows the names of all available commands, alphabetically sorted.
5258 If given any non-whitespace argument the list will be shown in the order
5259 in which command prefixes are searched.
5260 \*(OP In conjunction with a set variable
5261 .Va verbose
5262 additional information will be provided for each command: the argument
5263 type will be indicated, the documentation string will be shown,
5264 and the set of command flags will show up:
5266 .Bl -tag -compact -width ".It Ql BaNg"
5267 .It Ql "vput modifier"
5268 command supports the command modifier
5269 .Cm vput .
5270 .It Ql "errno in *!*"
5271 the error number is tracked in
5272 .Va \&! .
5273 .It Ql "needs box"
5274 commands needs an active mailbox, a
5275 .Ic file .
5276 .It Ql "ok: batch or interactive"
5277 command may only be used in interactive or
5278 .Fl #
5279 batch mode.
5280 .It Ql "ok: send mode"
5281 command can be used in send mode.
5282 .It Ql "not ok: compose mode"
5283 command is not available when in compose mode.
5284 .It Ql "not ok: during startup"
5285 command cannot be used during program startup, e.g., while loading
5286 .Sx "Resource files" .
5287 .It Ql "ok: in subprocess"
5288 command is allowed to be used when running in a subprocess instance,
5289 e.g., from within a macro that is called via
5290 .Va on-compose-splice .
5294 .It Ic localopts
5295 This command can be used to localize changes to variables, meaning that
5296 their state will be reverted to the former one once the covered scope
5297 is left.
5298 It can only be used inside of macro definition blocks introduced by
5299 .Ic account
5301 .Ic define ,
5302 and is interpreted as a boolean (string, see
5303 .Sx "INTERNAL VARIABLES" ) ;
5305 .Dq covered scope
5306 of an account is left once it is switched off again.
5307 .Bd -literal -offset indent
5308 define temporary_settings {
5309   set possibly_global_option1
5310   localopts on
5311   set local_option1
5312   set local_option2
5313   localopts off
5314   set possibly_global_option2
5318 .Sy Note
5319 that this setting
5320 .Dq stacks up :
5321 i.e., if
5322 .Ql macro1
5323 enables change localization and calls
5324 .Ql macro2 ,
5325 which explicitly resets localization, then any value changes within
5326 .Ql macro2
5327 will still be reverted by
5328 .Ql macro1 !
5329 \*(ID Once the outermost level, the one which enabled localization
5330 first, is left, but no earlier, all adjustments will be unrolled.
5331 \*(ID Likewise worth knowing, if in this example
5332 .Ql macro2
5333 changes to a different
5334 .Ic account
5335 which sets some variables that are yet covered by localizations, their
5336 scope will be extended, and in fact leaving the
5337 .Ic account
5338 will (thus) restore settings in (likely) global scope which actually
5339 were defined in a local, private context.
5342 .It Ic Lreply
5343 Reply to messages that come in via known
5344 .Pf ( Ic mlist )
5345 or subscribed
5346 .Pf ( Ic mlsubscribe )
5347 mailing lists, or pretend to do so (see
5348 .Sx "Mailing lists" ) :
5349 on top of the usual
5350 .Ic reply
5351 functionality this will actively resort and even remove message
5352 recipients in order to generate a message that is supposed to be sent to
5353 a mailing list.
5354 For example it will also implicitly generate a
5355 .Ql Mail-Followup-To:
5356 header if that seems useful, regardless of the setting of the variable
5357 .Va followup-to .
5358 For more documentation please refer to
5359 .Sx "On sending mail, and non-interactive mode" .
5362 .It Ic Mail
5363 Similar to
5364 .Ic mail ,
5365 but saves the message in a file named after the local part of the first
5366 recipient's address (instead of in
5367 .Va record Ns ).
5370 .It Ic mail
5371 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5372 or asks on standard input if none were given;
5373 then collects the remaining mail content and sends it out.
5374 For more documentation please refer to
5375 .Sx "On sending mail, and non-interactive mode" .
5378 .It Ic mbox
5379 (mb) The given message list is to be sent to the
5380 .Mx -sx
5381 .Sx "secondary mailbox"
5382 .Ev MBOX
5383 when \*(UA is quit; this is the default action unless the variable
5384 .Va hold
5385 is set.
5386 \*(ID This command can only be used in a
5387 .Mx -sx
5388 .Sx "primary system mailbox" .
5392 .It Ic mimetype , unmimetype
5393 Without arguments the content of the MIME type cache will displayed;
5394 a more verbose listing will be produced if either of
5395 .Va debug
5397 .Va verbose
5398 are set.
5399 When given arguments they will be joined, interpreted as shown in
5400 .Sx "The mime.types files"
5401 (also see
5402 .Sx "HTML mail and MIME attachments" ) ,
5403 and the resulting entry will be added (prepended) to the cache.
5404 In any event MIME type sources are loaded first as necessary \(en
5405 .Va mimetypes-load-control
5406 can be used to fine-tune which sources are actually loaded.
5408 The latter command deletes all specifications of the given MIME type, thus
5409 .Ql ? unmimetype text/plain
5410 will remove all registered specifications for the MIME type
5411 .Ql text/plain .
5412 The special name
5413 .Ql *
5414 will discard all existing MIME types, just as will
5415 .Ql reset ,
5416 but which also reenables cache initialization via
5417 .Va mimetypes-load-control .
5421 .It Ic mlist , unmlist
5422 The latter command removes all given mailing-lists, the special name
5423 .Ql *
5424 can be used to remove all registered lists.
5425 The former will list all currently defined mailing lists (and their
5426 attributes, if any) when used without arguments; a more verbose listing
5427 will be produced if either of
5428 .Va debug
5430 .Va verbose
5431 are set.
5432 Otherwise all given arguments will be added and henceforth be recognized
5433 as mailing lists.
5434 If the \*(OPal regular expression support is available then mailing
5435 lists may also be specified as (extended) regular expressions (see
5436 .Xr re_format 7
5437 for more on those).
5440 .It Ic mimeview
5441 \*(ID Only available in interactive mode, this command allows to display
5442 MIME parts which require external MIME handler programs to run which do
5443 not integrate in \*(UAs normal
5444 .Ic type
5445 output (see
5446 .Sx "HTML mail and MIME attachments" ) .
5447 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5448 The user will be asked for each non-text part of the given message in
5449 turn whether the registered handler shall be used to display the part.
5453 .It Ic mlsubscribe , unmlsubscribe
5454 The latter command removes the subscription attribute from all given
5455 mailing-lists, the special name
5456 .Ql *
5457 can be used to do so for any registered list.
5458 The former will list all currently defined mailing lists which have
5459 a subscription attribute when used without arguments; a more verbose
5460 listing will be produced if either of
5461 .Va debug
5463 .Va verbose
5464 are set.
5465 Otherwise this attribute will be set for all given mailing lists,
5466 newly creating them as necessary (as via
5467 .Ic mlist ) .
5468 Also see
5469 .Va followup-to .
5472 .It Ic Move
5473 Similar to
5474 .Ic move ,
5475 but moves the messages to a file named after the local part of the
5476 sender address of the first message (instead of in
5477 .Va record Ns ).
5480 .It Ic move
5481 Acts like
5482 .Ic copy
5483 but marks the messages for deletion if they were transferred
5484 successfully.
5487 .It Ic More
5488 Like
5489 .Ic more ,
5490 but also displays header fields which would not pass the
5491 .Ic headerpick
5492 selection, and all MIME parts.
5493 Identical to
5494 .Ic Page .
5497 .It Ic more
5498 Invokes the
5499 .Ev PAGER
5500 on the given messages, even in non-interactive mode and as long as the
5501 standard output is a terminal.
5502 Identical to
5503 .Ic page .
5506 .It Ic netrc
5507 \*(OP When used without arguments or if
5508 .Ar show
5509 has been given the content of the
5510 .Pa .netrc
5511 cache is shown, loading it first as necessary.
5512 If the argument is
5513 .Ar load
5514 then the cache will only be initialized and
5515 .Ar clear
5516 will remove its contents.
5517 Note that \*(UA will try to load the file only once, use
5518 .Ql Ic \&\&netrc Ns \:\0\:clear
5519 to unlock further attempts.
5521 .Va netrc-lookup ,
5522 .Va netrc-pipe
5523 and the section
5524 .Sx "On URL syntax and credential lookup" ;
5525 the section
5526 .Sx "The .netrc file"
5527 documents the file format in detail.
5530 .It Ic newmail
5531 Checks for new mail in the current folder without committing any changes
5532 before.
5533 If new mail is present, a message is shown.
5534 If the
5535 .Va header
5536 variable is set,
5537 the headers of each new message are also shown.
5538 This command is not available for all mailbox types.
5541 .It Ic next
5542 (n) (like
5543 .Ql +
5545 .Dq ENTER )
5546 Goes to the next message in sequence and types it.
5547 With an argument list, types the next matching message.
5550 .It Ic New
5551 Same as
5552 .Ic Unread .
5555 .It Ic new
5556 Same as
5557 .Ic unread .
5560 .It Ic noop
5561 If the current folder is accessed via a network connection, a
5562 .Dq NOOP
5563 command is sent, otherwise no operation is performed.
5566 .It Ic Page
5567 Like
5568 .Ic page ,
5569 but also displays header fields which would not pass the
5570 .Ic headerpick
5571 selection, and all MIME parts.
5572 Identical to
5573 .Ic More .
5576 .It Ic page
5577 Invokes the
5578 .Ev PAGER
5579 on the given messages, even in non-interactive mode and as long as the
5580 standard output is a terminal.
5581 Identical to
5582 .Ic more .
5585 .It Ic Pipe
5586 Like
5587 .Ic pipe
5588 but also pipes header fields which would not pass the
5589 .Ic headerpick
5590 selection, and all parts of MIME
5591 .Ql multipart/alternative
5592 messages.
5595 .It Ic pipe
5596 (pi) Takes a message list and a shell command
5597 and pipes the messages through the command.
5598 Without an argument the current message is piped through the command
5599 given by the
5600 .Va cmd
5601 variable.
5602 If the
5603 .Va page
5604 variable is set,
5605 every message is followed by a formfeed character.
5608 .It Ic preserve
5609 (pre) A synonym for
5610 .Ic hold .
5613 .It Ic Print
5614 (P) Alias for
5615 .Ic Type .
5618 .It Ic print
5619 (p) Research
5621 equivalent of
5622 .Ic type .
5625 .It Ic quit
5626 (q) Terminates the session, saving all undeleted, unsaved messages in
5627 the current
5628 .Mx -sx
5629 .Sx "secondary mailbox"
5630 .Ev MBOX ,
5631 preserving all messages marked with
5632 .Ic hold
5634 .Ic preserve
5635 or never referenced in the system
5636 .Va inbox ,
5637 and removing all other messages from the
5638 .Mx -sx
5639 .Sx "primary system mailbox" .
5640 If new mail has arrived during the session,
5641 the message
5642 .Dq You have new mail
5643 will be shown.
5644 If given while editing a mailbox file with the command line option
5645 .Fl f ,
5646 then the edit file is rewritten.
5647 A return to the shell is effected,
5648 unless the rewrite of edit file fails,
5649 in which case the user can escape with the exit command.
5650 The optional status number argument will be passed through to
5651 .Xr exit 3 .
5652 \*(ID For now it can happen that the given status will be overwritten,
5653 later this will only occur if a later error needs to be reported onto an
5654 otherwise success indicating status.
5657 .It Ic read
5658 \*(NQ Read a line from standard input, or the channel set active via
5659 .Ic readctl ,
5660 and assign the data, which will be splitted as indicated by
5661 .Va ifs ,
5662 to the given variables.
5663 The variable names are checked by the same rules as documented for
5664 .Cm vput ,
5665 and the same error codes will be seen in
5666 .Va \&! ;
5667 the exit status
5668 .Va \&?
5669 indicates the number of bytes read, it will be
5670 .Ql -1
5671 with the error number
5672 .Va \&!
5673 set to
5674 .Va ^ERR Ns -BADF
5675 in case of I/O errors, or
5676 .Va ^ERR Ns -NONE
5677 upon End-Of-File.
5678 If there are more fields than variables, assigns successive fields to the
5679 last given variable.
5680 If there are less fields than variables, assigns the empty string to the
5681 remains.
5682 .Bd -literal -offset indent
5683 ? read a b c
5684    H  e  l  l  o
5685 ? echo "<$a> <$b> <$c>"
5686 <H> <e> <l  l  o>
5687 ? wysh set ifs=:; read a b c;unset ifs
5688 hey2.0,:"'you    ",:world!:mars.:
5689 ? echo $?/$^ERRNAME / <$a><$b><$c>
5690 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5694 .It Ic readctl
5695 \*(NQ Manages input channels for
5696 .Ic read ,
5697 to be used to avoid complicated or impracticable code, like calling
5698 .Ic \&\&read
5699 from within a macro in non-interactive mode.
5700 Without arguments, or when the first argument is
5701 .Cm show ,
5702 a listing of all known channels is printed.
5703 Channels can otherwise be
5704 .Cm create Ns
5705 d, and existing channels can be
5706 .Cm set
5707 active and
5708 .Cm remove Ns
5709 d by giving the string used for creation.
5711 The channel name is expected to be a file descriptor number, or,
5712 if parsing the numeric fails, an input file name that undergoes
5713 .Sx "Filename transformations" .
5714 E.g. (this example requires a modern shell):
5715 .Bd -literal -offset indent
5716 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
5717   LC_ALL=C \*(uA -R#
5718 hey, you
5719 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
5720   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
5721 hey, you
5724 .It Ic redirect
5725 \*(OB Same as
5726 .Ic resend .
5728 .It Ic Redirect
5729 \*(OB Same as
5730 .Ic Resend .
5733 .It Ic remove
5734 Removes the named files or directories.
5735 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
5736 type specific removal will be performed, deleting the complete mailbox.
5737 The user is asked for confirmation in interactive mode.
5740 .It Ic rename
5741 Takes the name of an existing folder
5742 and the name for the new folder
5743 and renames the first to the second one.
5744 Both folders must be of the same type.
5747 .It Ic Reply
5748 (R) Replies to only the sender of each message of the given message
5749 list, by using the first message as the template to quote, for the
5750 .Ql Subject:
5751 etc.
5752 .Va flipr
5753 will exchange this command with
5754 .Ic reply .
5755 Unless the internal variable
5756 .Va fullnames
5757 is set the recipient address will be stripped from comments, names etc.
5760 .It Ic reply
5761 (r) Take a message and group-responds to it by addressing the sender
5762 and all recipients, subject to
5763 .Ic alternates
5764 processing.
5765 .Va followup-to ,
5766 .Va followup-to-honour ,
5767 .Va reply-to-honour
5768 as well as
5769 .Va recipients-in-cc
5770 influence response behaviour.
5771 Unless the internal variable
5772 .Va fullnames
5773 is set recipient addresses will be stripped from comments, names etc.
5775 .Va flipr
5776 is set the commands
5777 .Ic Reply
5779 .Ic reply
5780 are exchanged.
5781 The command
5782 .Ic Lreply
5783 offers special support for replying to mailing lists.
5784 For more documentation please refer to
5785 .Sx "On sending mail, and non-interactive mode" .
5788 .It Ic replyall
5789 Similar to
5790 .Ic reply ,
5791 but initiates a group-reply regardless of the value of
5792 .Va flipr .
5795 .It Ic replysender
5796 Similar to
5797 .Ic Reply ,
5798 but responds to the sender only regardless of the value of
5799 .Va flipr .
5802 .It Ic Resend
5803 Like
5804 .Ic resend ,
5805 but does not add any header lines.
5806 This is not a way to hide the sender's identity,
5807 but useful for sending a message again to the same recipients.
5810 .It Ic resend
5811 Takes a list of messages and a user name
5812 and sends each message to the named user.
5813 .Ql Resent-From:
5814 and related header fields are prepended to the new copy of the message.
5815 Saving in
5816 .Va record
5817 is only performed if
5818 .Va record-resent
5819 is set.
5822 .It Ic Respond
5823 Same as
5824 .Ic Reply .
5827 .It Ic respond
5828 Same as
5829 .Ic reply .
5832 .It Ic respondall
5833 Same as
5834 .Ic replyall .
5837 .It Ic respondsender
5838 Same as
5839 .Ic replysender .
5842 .It Ic retain
5843 (ret) Superseded by the multiplexer
5844 .Ic headerpick .
5847 .It Ic return
5848 Only available inside the scope of a
5849 .Ic define Ns
5850 d macro or an
5851 .Ic account ,
5852 this will stop evaluation of any further macro content, and return
5853 execution control to the caller.
5854 The two optional parameters must be specified as positive decimal
5855 numbers and default to the value 0:
5856 the first argument specifies the signed 32-bit return value (stored in
5857 .Va \&?
5858 \*(ID and later extended to signed 64-bit),
5859 the second the signed 32-bit error number (stored in
5860 .Va \&! ) .
5861 As documented for
5862 .Va \&?
5863 a non-0 exit status may cause the program to exit.
5866 .It Ic Save
5867 (S) Similar to
5868 .Ic save,
5869 but saves the messages in a file named after the local part of the
5870 sender of the first message instead of (in
5871 .Va record
5872 and) taking a filename argument; the variable
5873 .Va outfolder
5874 is inspected to decide on the actual storage location.
5877 .It Ic save
5878 (s) Takes a message list and a filename and appends each message in turn
5879 to the end of the file.
5880 If no filename is given, the
5881 .Mx -sx
5882 .Sx "secondary mailbox"
5883 .Ev MBOX
5884 is used.
5885 The filename in quotes, followed by the generated character count
5886 is echoed on the user's terminal.
5887 If editing a
5888 .Mx -sx
5889 .Sx "primary system mailbox"
5890 the messages are marked for deletion.
5891 .Sx "Filename transformations"
5892 will be applied.
5894 .It Ic savediscard
5895 \*(OB Superseded by the multiplexer
5896 .Ic headerpick .
5898 .It Ic saveignore
5899 \*(OB Superseded by the multiplexer
5900 .Ic headerpick .
5902 .It Ic saveretain
5903 \*(OB Superseded by the multiplexer
5904 .Ic headerpick .
5907 .It Ic search
5908 Takes a message specification (list) and displays a header summary of
5909 all matching messages, as via
5910 .Ic headers .
5911 This command is an alias of
5912 .Ic from .
5913 Also see
5914 .Sx "Specifying messages" .
5917 .It Ic seen
5918 Takes a message list and marks all messages as having been read.
5923 .It Ic set , unset
5924 (se, \*(NQ uns) The latter command will delete all given variables,
5925 the former, when used without arguments, will show all variables which
5926 are currently known to \*(UA.
5927 A more verbose listing will be produced if
5928 either of
5929 .Va debug
5931 .Va verbose
5932 are set.
5933 Remarks: the list mode will not automatically link-in known
5934 .Sx ENVIRONMENT
5935 variables, but only explicit addressing will, e.g., via
5936 .Ic varshow ,
5937 using a variable in an
5938 .Ic if
5939 condition or a string passed to
5940 .Ic echo ,
5941 explicit
5942 .Ic set Ns
5943 ting, as well as some program-internal use cases.
5946 Otherwise the given variables (and arguments) are set or adjusted.
5947 Arguments are of the form
5948 .Ql name=value
5949 (no space before or after
5950 .Ql = ) ,
5951 or plain
5952 .Ql name
5953 if there is no value, i.e., a boolean variable.
5954 \*(ID In conjunction with the
5955 .Cm wysh
5956 command prefix
5957 .Sx "Shell-style argument quoting"
5958 can be used to quote arguments as necessary.
5959 \*(ID Otherwise quotation marks may be placed around any part of the
5960 assignment statement to quote blanks or tabs.
5963 .Dl wysh set indentprefix=' -> '
5966 If an argument begins with
5967 .Ql no ,
5968 as in
5969 .Ql set nosave ,
5970 the effect is the same as invoking the
5971 .Ic unset
5972 command with the remaining part of the variable
5973 .Pf ( Ql unset save ) .
5977 .Ql name
5978 that is known to map to an environment variable will automatically cause
5979 updates in the program environment (unsetting a variable in the
5980 environment requires corresponding system support) \(em use the command
5981 .Ic environ
5982 for further environmental control.
5983 Also see
5984 .Ic varedit ,
5985 .Ic varshow
5986 and the sections
5987 .Sx "INTERNAL VARIABLES"
5989 .Sx ENVIRONMENT .
5993 .It Ic shcodec
5994 Apply shell quoting rules to the given raw-data arguments.
5995 Supports
5996 .Cm vput
5997 (see
5998 .Sx "Command modifiers" ) .
5999 The first argument specifies the operation:
6000 .Ar [+]e[ncode]
6002 .Ar d[ecode]
6003 cause shell quoting to be applied to the remains of the line, and
6004 expanded away thereof, respectively.
6005 If the former is prefixed with a plus-sign, the quoted result will not
6006 be roundtrip enabled, and thus can be decoded only in the very same
6007 environment that was used to perform the encode; also see
6008 .Cd mle-quote-rndtrip .
6009 If the coding operation fails the error number
6010 .Va \&!
6011 is set to
6012 .Va ^ERR Ns -CANCELED ,
6013 and the unmodified input is used as the result; the error number may
6014 change again due to output or result storage errors.
6017 .It Ic shell
6018 \*(NQ (sh) Invokes an interactive version of the shell,
6019 and returns its exit status.
6023 .It Ic shortcut , unshortcut
6024 Without arguments the list of all currently defined shortcuts is
6025 shown, with one argument the expansion of the given shortcut.
6026 Otherwise all given arguments are treated as pairs of shortcuts and
6027 their expansions, creating new or changing already existing shortcuts,
6028 as necessary.
6029 The latter command will remove all given shortcuts, the special name
6030 .Ql *
6031 will remove all registered shortcuts.
6034 .It Ic shift
6035 \*(NQ Shift the positional parameter stack (starting at
6036 .Va 1 )
6037 by the given number (which must be a positive decimal),
6038 or 1 if no argument has been given.
6039 It is an error if the value exceeds the number of positional parameters.
6040 If the given number is 0, no action is performed, successfully.
6041 The stack as such can be managed via
6042 .Ic vpospar .
6043 Note this command will fail in
6044 .Ic account
6045 and hook macros unless the positional parameter stack has been
6046 explicitly created in the current context via
6047 .Ic vpospar .
6050 .It Ic show
6051 Like
6052 .Ic type ,
6053 but performs neither MIME decoding nor decryption, so that the raw
6054 message text is shown.
6057 .It Ic size
6058 (si) Shows the size in characters of each message of the given
6059 message-list.
6062 .It Ic sleep
6063 \*(NQ Sleep for the specified number of seconds (and optionally
6064 milliseconds), by default interruptably.
6065 If a third argument is given the sleep will be uninterruptible,
6066 otherwise the error number
6067 .Va \&!
6068 will be set to
6069 .Va ^ERR Ns -INTR
6070 if the sleep has been interrupted.
6071 The command will fail and the error number will be
6072 .Va ^ERR Ns -OVERFLOW
6073 if the given duration(s) overflow the time datatype, and
6074 .Va ^ERR Ns -INVAL
6075 if the given durations are no valid integers.
6080 .It Ic sort , unsort
6081 The latter command disables sorted or threaded mode, returns to normal
6082 message order and, if the
6083 .Va header
6084 variable is set,
6085 displays a header summary.
6086 The former command shows the current sorting criterion when used without
6087 an argument, but creates a sorted representation of the current folder
6088 otherwise, and changes the
6089 .Ic next
6090 command and the addressing modes such that they refer to messages in
6091 the sorted order.
6092 Message numbers are the same as in regular mode.
6093 If the
6094 .Va header
6095 variable is set,
6096 a header summary in the new order is also displayed.
6097 Automatic folder sorting can be enabled by setting the
6098 .Va autosort
6099 variable, as in, e.g.,
6100 .Ql set autosort=thread .
6101 Possible sorting criterions are:
6104 .Bl -tag -compact -width "subject"
6105 .It Ar date
6106 Sort the messages by their
6107 .Ql Date:
6108 field, that is by the time they were sent.
6109 .It Ar from
6110 Sort messages by the value of their
6111 .Ql From:
6112 field, that is by the address of the sender.
6113 If the
6114 .Va showname
6115 variable is set, the sender's real name (if any) is used.
6116 .It Ar size
6117 Sort the messages by their size.
6118 .It spam
6119 \*(OP Sort the message by their spam score, as has been classified by
6120 .Ic spamrate .
6121 .It Ar status
6122 Sort the messages by their message status.
6123 .It Ar subject
6124 Sort the messages by their subject.
6125 .It Ar thread
6126 Create a threaded display.
6127 .It Ar to
6128 Sort messages by the value of their
6129 .Ql To:
6130 field, that is by the address of the recipient.
6131 If the
6132 .Va showname
6133 variable is set, the recipient's real name (if any) is used.
6138 .It Ic source
6139 \*(NQ (so) The source command reads commands from the given file.
6140 .Sx "Filename transformations"
6141 will be applied.
6142 If the given expanded argument ends with a vertical bar
6143 .Ql |
6144 then the argument will instead be interpreted as a shell command and
6145 \*(UA will read the output generated by it.
6146 Interpretation of commands read is stopped when an error is encountered.
6147 \*(ID Note that
6148 .Ic \&\&source
6149 cannot be used from within macros that execute as
6150 .Va folder-hook Ns s
6152 .Ic account Ns s ,
6153 i.e., it can only be called from macros that were
6154 .Ic call Ns ed .
6157 .It Ic source_if
6158 \*(NQ The difference to
6159 .Ic source
6160 (beside not supporting pipe syntax aka shell command input) is that
6161 this command will not generate an error nor warn if the given file
6162 argument cannot be opened successfully.
6165 .It Ic spamclear
6166 \*(OP Takes a list of messages and clears their
6167 .Ql is-spam
6168 flag.
6171 .It Ic spamforget
6172 \*(OP Takes a list of messages and causes the
6173 .Va spam-interface
6174 to forget it has ever used them to train its Bayesian filter.
6175 Unless otherwise noted the
6176 .Ql is-spam
6177 flag of the message is inspected to chose whether a message shall be
6178 forgotten to be
6179 .Dq ham
6181 .Dq spam .
6184 .It Ic spamham
6185 \*(OP Takes a list of messages and informs the Bayesian filter of the
6186 .Va spam-interface
6187 that they are
6188 .Dq ham .
6189 This also clears the
6190 .Ql is-spam
6191 flag of the messages in question.
6194 .It Ic spamrate
6195 \*(OP Takes a list of messages and rates them using the configured
6196 .Va spam-interface ,
6197 without modifying the messages, but setting their
6198 .Ql is-spam
6199 flag as appropriate; because the spam rating headers are lost the rate
6200 will be forgotten once the mailbox is left.
6201 Refer to the manual section
6202 .Sx "Handling spam"
6203 for the complete picture of spam handling in \*(UA.
6206 .It Ic spamset
6207 \*(OP Takes a list of messages and sets their
6208 .Ql is-spam
6209 flag.
6212 .It Ic spamspam
6213 \*(OP Takes a list of messages and informs the Bayesian filter of the
6214 .Va spam-interface
6215 that they are
6216 .Dq spam .
6217 This also sets the
6218 .Ql is-spam
6219 flag of the messages in question.
6221 .It Ic thread
6222 \*(OB The same as
6223 .Ql sort thread
6224 (consider using a
6225 .Ql commandalias
6226 as necessary).
6229 .It Ic Top
6230 Like
6231 .Ic top
6232 but always uses the
6233 .Ic headerpick
6234 .Ql type
6235 slot for white- and blacklisting header fields.
6238 .It Ic top
6239 (to) Takes a message list and types out the first
6240 .Va toplines
6241 lines of each message on the users' terminal.
6242 Unless a special selection has been established for the
6243 .Ql top
6244 slot of the
6245 .Ic headerpick
6246 command, the only header fields that are displayed are
6247 .Ql From: ,
6248 .Ql To: ,
6249 .Ql CC: ,
6251 .Ql Subject: .
6252 .Ic Top
6253 will always use the
6254 .Ql type
6255 .Ic headerpick
6256 selection instead.
6257 It is possible to apply compression to what is displayed by setting
6258 .Va topsqueeze .
6259 Messages are decrypted and converted to the terminal character set
6260 if necessary.
6263 .It Ic touch
6264 (tou) Takes a message list and marks the messages for saving in the
6265 .Mx -sx
6266 .Sx "secondary mailbox"
6267 .Ev MBOX .
6268 \*(UA deviates from the POSIX standard with this command,
6269 as a following
6270 .Ic next
6271 command will display the following message instead of the current one.
6274 .It Ic Type
6275 (T) Like
6276 .Ic type
6277 but also displays header fields which would not pass the
6278 .Ic headerpick
6279 selection, and all visualizable parts of MIME
6280 .Ql multipart/alternative
6281 messages.
6284 .It Ic type
6285 (t) Takes a message list and types out each message on the users terminal.
6286 The display of message headers is selectable via
6287 .Ic headerpick .
6288 For MIME multipart messages, all parts with a content type of
6289 .Ql text ,
6290 all parts which have a registered MIME type handler (see
6291 .Sx "HTML mail and MIME attachments" )
6292 which produces plain text output, and all
6293 .Ql message
6294 parts are shown, others are hidden except for their headers.
6295 Messages are decrypted and converted to the terminal character set
6296 if necessary.
6297 The command
6298 .Ic mimeview
6299 can be used to display parts which are not displayable as plain text.
6301 .It Ic unaccount
6303 .Ic account .
6305 .It Ic unalias
6306 (una) See
6307 .Ic alias .
6309 .It Ic unanswered
6311 .Ic answered .
6313 .It Ic unbind
6315 .Ic bind .
6317 .It Ic uncollapse
6319 .Ic collapse .
6321 .It Ic uncolour
6323 .Ic colour .
6325 .It Ic undefine
6327 .Ic define .
6329 .It Ic undelete
6331 .Ic delete .
6333 .It Ic undraft
6335 .Ic draft .
6337 .It Ic unflag
6339 .Ic flag .
6341 .It Ic unfwdignore
6342 \*(OB Superseded by the multiplexer
6343 .Ic headerpick .
6345 .It Ic unfwdretain
6346 \*(OB Superseded by the multiplexer
6347 .Ic headerpick .
6350 .It Ic unignore
6351 Superseded by the multiplexer
6352 .Ic headerpick .
6354 .It Ic unmimetype
6356 .Ic mimetype .
6358 .It Ic unmlist
6360 .Ic mlist .
6362 .It Ic unmlsubscribe
6364 .Ic mlsubscribe .
6367 .It Ic Unread
6368 Same as
6369 .Ic unread .
6372 .It Ic unread
6373 Takes a message list and marks each message as not having been read.
6376 .It Ic unretain
6377 Superseded by the multiplexer
6378 .Ic headerpick .
6380 .It Ic unsaveignore
6381 \*(OB Superseded by the multiplexer
6382 .Ic headerpick .
6384 .It Ic unsaveretain
6385 \*(OB Superseded by the multiplexer
6386 .Ic headerpick .
6388 .It Ic unset
6389 \*(NQ (uns) See
6390 .Ic set .
6392 .It Ic unshortcut
6394 .Ic shortcut .
6396 .It Ic unsort
6398 .Ic short .
6400 .It Ic unthread
6401 \*(OB
6402 Same as
6403 .Ic unsort .
6406 .It Ic urlcodec
6407 Perform URL percent codec operations on the raw-data argument, rather
6408 according to RFC 3986.
6409 Supports
6410 .Cm vput
6411 (see
6412 .Sx "Command modifiers" ) ,
6413 and manages the error number
6414 .Va \&! .
6415 This is a character set agnostic and thus locale dependent operation,
6416 and it may decode bytes which are invalid in the current
6417 .Va ttycharset .
6418 \*(ID This command does not know about URLs beside that.
6420 The first argument specifies the operation:
6421 .Ar e[ncode]
6423 .Ar d[ecode]
6424 perform plain URL percent en- and decoding, respectively.
6425 .Ar p[ath]enc[ode]
6427 .Ar p[ath]dec[ode]
6428 perform a slightly modified operation which should be better for
6429 pathnames: it does not allow a tilde
6430 .Ql ~ ,
6431 and will neither accept hyphen-minus
6432 .Ql -
6433 nor dot
6434 .Ql .
6435 as an initial character.
6436 The remains of the line form the URL data which is to be converted.
6437 If the coding operation fails the error number
6438 .Va \&!
6439 is set to
6440 .Va ^ERR Ns -CANCELED ,
6441 and the unmodified input is used as the result; the error number may
6442 change again due to output or result storage errors.
6445 .It Ic varedit
6446 \*(NQ Edit the values of or create the given variable(s) in the
6447 .Ev EDITOR .
6448 Boolean variables cannot be edited, and variables can also not be
6449 .Ic unset
6450 with this command.
6453 .It Ic varshow
6454 \*(NQ This command produces the same output as the listing mode of
6455 .Ic set ,
6456 including
6457 .Va verbose Ns
6458 ity adjustments, but only for the given variables.
6461 .It Ic verify
6462 \*(OP Takes a message list and verifies each message.
6463 If a message is not a S/MIME signed message,
6464 verification will fail for it.
6465 The verification process checks if the message was signed using a valid
6466 certificate,
6467 if the message sender's email address matches one of those contained
6468 within the certificate,
6469 and if the message content has been altered.
6472 .It Ic version
6473 Shows the
6474 .Va version
6476 .Va features
6477 of \*(UA.
6481 .It Ic vexpr
6482 \*(NQ Evaluate arguments according to a given operator.
6483 This is a multiplexer command which can be used to perform signed 64-bit
6484 numeric calculations as well as byte string and string operations.
6485 It uses polish notation, i.e., the operator is the first argument and
6486 defines the number and type, and the meaning of the remaining arguments.
6487 An empty argument is replaced with a 0 if a number is expected.
6488 Supports
6489 .Cm vput
6490 (see
6491 .Sx "Command modifiers" ) .
6494 The result that is shown in case of errors is always
6495 .Ql -1
6496 for usage errors and numeric operations, and the empty string for byte
6497 string and string operations;
6498 if the latter two fail to provide result data for
6499 .Dq soft
6500 errors, e.g., when a search operation failed, they also set the
6501 .Va \&!
6502 error number to
6503 .Va ^ERR Ns -NODATA .
6504 Except when otherwise noted numeric arguments are parsed as signed 64-bit
6505 numbers, and errors will be reported in the error number
6506 .Va \&!
6507 as the numeric error
6508 .Va ^ERR Ns -RANGE .
6511 Numeric operations work on one or two signed 64-bit integers.
6512 One integer is expected by assignment (equals sign
6513 .Ql = ) ,
6514 which does nothing but parsing the argument, thus detecting validity and
6515 possible overflow conditions, and unary not (tilde
6516 .Ql ~ ) ,
6517 which creates the bitwise complement.
6518 Two integers are used by addition (plus sign
6519 .Ql + ) ,
6520 subtraction (hyphen-minus
6521 .Ql - ) ,
6522 multiplication (asterisk
6523 .Ql * ) ,
6524 division (solidus
6525 .Ql / )
6526 and modulo (percent sign
6527 .Ql % ) ,
6528 as well as for the bitwise operators logical or (vertical bar
6529 .Ql | ,
6530 to be quoted) ,
6531 bitwise and (ampersand
6532 .Ql \&& ,
6533 to be quoted) ,
6534 bitwise xor (circumflex
6535 .Ql ^ ) ,
6536 the bitwise signed left- and right shifts
6537 .Pf ( Ql << ,
6538 .Ql >> ) ,
6539 as well as for the unsigned right shift
6540 .Ql >>> .
6543 All numeric operators can be suffixed with a commercial at
6544 .Ql @ ,
6545 e.g.,
6546 .Ql *@ :
6547 this will turn the operation into a saturated one, which means that
6548 overflow errors and division and modulo by zero are no longer reported
6549 via the exit status, but the result will linger at the minimum or
6550 maximum possible value, instead of overflowing (or trapping).
6551 This is true also for the argument parse step.
6552 For the bitwise shifts, the saturated maximum is 63.
6553 Any catched overflow will be reported via the error number
6554 .Va \&!
6556 .Va ^ERR Ns -OVERFLOW .
6559 Character set agnostic string functions have no notion of locale
6560 settings and character sets.
6561 There is
6562 .Ql file-expand ,
6563 which performs the usual
6564 .Sx "Filename transformations"
6565 on its argument, and
6566 .Ql random ,
6567 which generates a random string of the given length, or of
6568 .Dv \&\&PATH_MAX
6569 bytes (a constant from
6570 .Pa /usr/include )
6571 if the value 0 is given; the random string will be base64url encoded
6572 according to RFC 4648, and thus be usable as a (portable) filename.
6575 Byte string operations work on 8-bit bytes and have no notion of locale
6576 settings and character sets, effectively assuming ASCII data.
6577 Operations that take one argument are
6578 .Ql length ,
6579 which queries the length of the given argument, and
6580 .Ql hash ,
6581 which calculates the Chris Torek hash of the given argument.
6584 Byte string operations with two or more arguments are
6585 .Ql find ,
6586 which byte-searches in the first for the second argument, and shows the
6587 resulting 0-based offset shall it have been found,
6588 .Ql ifind ,
6589 which is identical to
6590 .Ql find ,
6591 but works case-insensitively according to the rules of the ASCII
6592 character set.
6593 .Ql substring
6594 will show a substring of its first argument:
6595 the second argument is the 0-based starting offset, the optional third
6596 argument can be used to specify the length of the desired substring,
6597 by default the entire string is used;
6598 this operation tries to work around faulty arguments (set
6599 .Va verbose
6600 for error logs), but reports them via the error number
6601 .Va \&!
6603 .Va ^ERR Ns -OVERFLOW .
6606 String operations work, sufficient support provided, according to the
6607 active user's locale encoding and character set (see
6608 .Sx "Character sets" ) .
6609 There is the one argument operation
6610 .Ql makeprint ,
6611 which (one-way) converts the argument to something safely printable on
6612 the terminal.
6615 \*(OP
6616 .Ql regex
6617 is a string operation that will try to match the first argument with the
6618 regular expression given as the second argument, as does
6619 .Ql iregex ,
6620 but which is case-insensitive.
6621 If the optional third argument has been given then instead of showing
6622 the match offset a replacement operation is performed:
6623 the third argument is treated as if specified via dollar-single-quote
6624 (see
6625 .Sx "Shell-style argument quoting" ) ,
6626 and any occurrence of a positional parameter, e.g.,
6627 .Va 1 ,
6628 is replaced by the corresponding match group of the regular expression.
6630 .Bd -literal -offset indent
6631 ? vexpr -@ +1 -9223372036854775808
6632 ? vput vexpr res ir bananarama (.*)NanA(.*) '\e${1}au\e$2'
6633 ? echo $0 $res
6638 .It Ic vpospar
6639 \*(NQ Manage the positional parameter stack (see
6640 .Va 1 , # , * , @
6641 as well as
6642 .Ic shift ) .
6643 If the first argument is
6644 .Ql clear ,
6645 then the positional parameter stack of the current context, or the
6646 global one, if there is none, is cleared.
6647 If it is
6648 .Ql set ,
6649 then the remaining arguments will be used to (re)create the stack,
6650 if the parameter stack size limit is excessed an
6651 .Va ^ERR Ns -OVERFLOW
6652 error will occur.
6655 If the first argument is
6656 .Ql quote ,
6657 a round-trip capable representation of the stack contents is created,
6658 with each quoted parameter separated from each other with the first
6659 character of
6660 .Va ifs ,
6661 and followed by the first character of
6662 .Va if-ws ,
6663 if that is not empty and not identical to the first.
6664 If that results in no separation at all a
6665 .Cm space
6666 character is used.
6667 This mode supports
6668 .Cm vput
6669 (see
6670 .Sx "Command modifiers" ) .
6671 I.e., the subcommands
6672 .Ql set
6674 .Ql quote
6675 can be used (in conjunction with
6676 .Ic eval )
6677 to (re)create an argument stack from and to a single variable losslessly.
6679 .Bd -literal -offset indent
6680 ? vpospar set hey, "'you    ", world!
6681 ? echo $#: <${1}><${2}><${3}>
6682 ? vput vpospar x quote
6683 ? vpospar clear
6684 ? echo $#: <${1}><${2}><${3}>
6685 ? eval vpospar set ${x}
6686 ? echo $#: <${1}><${2}><${3}>
6691 .It Ic visual
6692 (v) Takes a message list and invokes the display editor on each message.
6693 Modified contents are discarded unless the
6694 .Va writebackedited
6695 variable is set, and are not used unless the mailbox can be written to
6696 and the editor returns a successful exit status.
6699 .It Ic write
6700 (w) For conventional messages the body without all headers is written.
6701 The original message is never marked for deletion in the originating
6702 mail folder.
6703 The output is decrypted and converted to its native format as necessary.
6704 If the output file exists, the text is appended.
6705 If a message is in MIME multipart format its first part is written to
6706 the specified file as for conventional messages, handling of the remains
6707 depends on the execution mode.
6708 No special handling of compressed files is performed.
6710 In interactive mode the user is consecutively asked for the filenames of
6711 the processed parts.
6712 For convience saving of each part may be skipped by giving an empty
6713 value, the same result as writing it to
6714 .Pa /dev/null .
6715 Shell piping the part content by specifying a leading vertical bar
6716 .Ql |
6717 character for the filename is supported.
6718 Other user input undergoes the usual
6719 .Sx "Filename transformations" ,
6720 and contents of the destination file are overwritten if the file
6721 previously existed.
6723 \*(ID In non-interactive mode any part which does not specify a filename
6724 is ignored, and suspicious parts of filenames of the remaining parts are
6725 URL percent encoded (as via
6726 .Ic urlcodec )
6727 to prevent injection of malicious character sequences, resulting in
6728 a filename that will be written into the current directory.
6729 Existing files will not be overwritten, instead the part number or
6730 a dot are appended after a number sign
6731 .Ql #
6732 to the name until file creation succeeds (or fails due to other
6733 reasons).
6736 .It Ic xcall
6737 \*(NQ The sole difference to
6738 .Ic call
6739 is that the new macro is executed in place of the current one, which
6740 will not regain control: all resources of the current macro will be
6741 released first.
6742 This implies that
6743 .Ic localopts
6744 may become cleaned up if the teared down macro context is the outermost
6745 level of the cleanup stack.
6746 If this command is not used from within a
6747 .Ic call Ns
6748 ed macro it will silently be (a more expensive variant of)
6749 .Ic call .
6752 .It Ic xit
6753 (x) A synonym for
6754 .Ic exit .
6757 .It Ic z
6758 \*(NQ \*(UA presents message headers in
6759 .Va screen Ns
6760 fuls as described under the
6761 .Ic headers
6762 command.
6763 Without arguments this command scrolls to the next window of messages,
6764 likewise if the argument is
6765 .Ql + .
6766 An argument of
6767 .Ql -
6768 scrolls to the last,
6769 .Ql ^
6770 scrolls to the first, and
6771 .Ql $
6772 to the last
6773 .Va \&\&screen
6774 of messages.
6775 A number argument prefixed by
6776 .Ql +
6778 .Ql \-
6779 indicates that the window is calculated in relation to the current
6780 position, and a number without a prefix specifies an absolute position.
6783 .It Ic Z
6784 \*(NQ Similar to
6785 .Ic z ,
6786 but scrolls to the next or previous window that contains at least one
6787 .Ql new
6789 .Ic flag Ns
6790 ged message.
6792 .\" }}}
6794 .\" }}}
6797 .\" .Sh COMMAND ESCAPES {{{
6798 .Sh "COMMAND ESCAPES"
6800 Here is a summary of the command escapes available in compose mode,
6801 which are used to perform special functions when composing messages.
6802 Command escapes are only recognized at the beginning of lines, and
6803 consist of a trigger (escape) and a command character.
6804 The actual escape character can be set via the internal variable
6805 .Va escape ,
6806 it defaults to the tilde
6807 .Ql ~ .
6808 Otherwise ignored whitespace characters following the escape character
6809 will prevent a possible addition of the command line to the \*(OPal
6810 history.
6813 Unless otherwise noted all compose mode command escapes ensure proper
6814 updates of the variables which represent the error number
6815 .Va \&!
6816 and the exit status
6817 .Va \&? .
6818 If the variable
6819 .Va errexit
6820 is set they will, unless stated otherwise, error out message compose
6821 mode if an operation fails.
6822 It is however possible to place the character hyphen-minus
6823 .Ql -
6824 after (possible whitespace following) the escape character, which has an
6825 effect equivalent to the command modifier
6826 .Cm ignerr .
6827 If the \*(OPal key bindings are available it is possible to create
6828 .Ic bind Ns
6829 ings specifically for the compose mode.
6832 .Bl -tag -width ".It Ic BaNg"
6834 .It Ic ~~ Ar string
6835 Insert the string of text in the message prefaced by a single
6836 .Ql ~ .
6837 (If the escape character has been changed,
6838 that character must be doubled instead.)
6841 .It Ic ~! Ar command
6842 Execute the indicated shell
6843 .Ar command
6844 which follows, replacing unescaped exclamation marks with the previously
6845 executed command if the internal variable
6846 .Va bang
6847 is set, then return to the message.
6850 .It Ic ~.
6851 Same effect as typing the end-of-file character.
6854 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
6855 Execute the given \*(UA command.
6856 Not all commands, however, are allowed.
6859 .It Ic ~?
6860 Write a summary of command escapes.
6863 .It Ic ~< Ar filename
6864 Identical to
6865 .Ic ~r .
6868 .It Ic ~<! Ar command
6869 .Ar command
6870 is executed using the shell.
6871 Its standard output is inserted into the message.
6874 .It Ic ~@ Op Ar filename...
6875 Append or edit the list of attachments.
6876 Does not manage the error number
6877 .Va \&!
6878 and the exit status
6879 .Va \&? ,
6880 (please use
6881 .Ic ~^
6882 instead if this is a concern).
6883 A list of
6884 .Ar filename
6885 arguments is expected as shell tokens (see
6886 .Sx "Shell-style argument quoting" ;
6887 token-separating commas are ignored, too), to be
6888 interpreted as documented for the command line option
6889 .Fl a ,
6890 with the message number exception as below.
6892 Without
6893 .Ar filename
6894 arguments the attachment list is edited, entry by entry;
6895 if a filename is left empty, that attachment is deleted from the list;
6896 once the end of the list is reached either new attachments may be
6897 entered or the session can be quit by committing an empty
6898 .Dq new
6899 attachment.
6901 For all mode, if a given filename solely consists of the number sign
6902 .Ql #
6903 followed by a valid message number of the currently active mailbox, then
6904 the given message is attached as a
6905 .Ql message/rfc822
6906 MIME message part.
6907 As the shell comment character the number sign must be quoted.
6910 .It Ic ~A
6911 Inserts the string contained in the
6912 .Va Sign
6913 variable (same as
6914 .Ql Ic ~i Ns \0Sign ) .
6915 \*(OB The escape sequences tabulator
6916 .Ql \et
6917 and newline
6918 .Ql \en
6919 are understood (use the
6920 .Cm wysh
6921 prefix when
6922 .Ic set Ns
6923 ting the variable(s) instead).
6926 .It Ic ~a
6927 Inserts the string contained in the
6928 .Va sign
6929 variable (same as
6930 .Ql Ic ~i Ns \0sign ) .
6931 \*(OB The escape sequences tabulator
6932 .Ql \et
6933 and newline
6934 .Ql \en
6935 are understood (use the
6936 .Cm wysh
6937 prefix when
6938 .Ic set Ns
6939 ting the variable(s) instead).
6942 .It Ic ~b Ar name ...
6943 Add the given names to the list of blind carbon copy recipients.
6946 .It Ic ~c Ar name ...
6947 Add the given names to the list of carbon copy recipients.
6950 .It Ic ~d
6951 Read the file specified by the
6952 .Ev DEAD
6953 variable into the message.
6956 .It Ic ~e
6957 Invoke the text editor on the message collected so far.
6958 After the editing session is finished,
6959 the user may continue appending text to the message.
6962 .It Ic ~F Ar messages
6963 Read the named messages into the message being sent, including all
6964 message headers and MIME parts.
6965 If no messages are specified, read in the current message, the
6966 .Dq dot .
6969 .It Ic ~f Ar messages
6970 Read the named messages into the message being sent.
6971 If no messages are specified, read in the current message, the
6972 .Dq dot .
6973 Strips down the list of header fields according to the
6974 .Ql type
6975 white- and blacklist selection of
6976 .Ic headerpick .
6977 For MIME multipart messages,
6978 only the first displayable part is included.
6981 .It Ic ~H
6982 Edit the message header fields
6983 .Ql From: ,
6984 .Ql Reply-To:
6986 .Ql Sender:
6987 by typing each one in turn and allowing the user to edit the field.
6988 The default values for these fields originate from the
6989 .Va from , replyto
6991 .Va sender
6992 variables.
6995 .It Ic ~h
6996 Edit the message header fields
6997 .Ql To: ,
6998 .Ql Cc: ,
6999 .Ql Bcc:
7001 .Ql Subject:
7002 by typing each one in turn and allowing the user to edit the field.
7005 .It Ic ~i Ar variable
7006 Insert the value of the specified variable into the message,
7007 adding a newline character at the end.
7008 The message remains unaltered if the variable is unset or empty.
7009 \*(OB The escape sequences tabulator
7010 .Ql \et
7011 and newline
7012 .Ql \en
7013 are understood (use the
7014 .Cm wysh
7015 prefix when
7016 .Ic set Ns
7017 ting the variable(s) instead).
7020 .It Ic ~M Ar messages
7021 Read the named messages into the message being sent,
7022 indented by
7023 .Va indentprefix .
7024 If no messages are specified, read the current message, the
7025 .Dq dot .
7028 .It Ic ~m Ar messages
7029 Read the named messages into the message being sent,
7030 indented by
7031 .Va indentprefix .
7032 If no messages are specified, read the current message, the
7033 .Dq dot .
7034 Strips down the list of header fields according to the
7035 .Ql type
7036 white- and blacklist selection of
7037 .Ic headerpick .
7038 For MIME multipart messages,
7039 only the first displayable part is included.
7042 .It Ic ~p
7043 Display the message collected so far,
7044 prefaced by the message header fields
7045 and followed by the attachment list, if any.
7048 .It Ic ~q
7049 Abort the message being sent,
7050 copying it to the file specified by the
7051 .Ev DEAD
7052 variable if
7053 .Va save
7054 is set.
7057 .It Ic ~R Ar filename
7058 Identical to
7059 .Ic ~r ,
7060 but indent each line that has been read by
7061 .Va indentprefix .
7064 .It Ic ~r Ar filename Op Ar HERE-delimiter
7065 Read the named file, object to the usual
7066 .Sx "Filename transformations" ,
7067 into the message; if (the expanded)
7068 .Ar filename
7069 is the hyphen-minus
7070 .Ql -
7071 then standard input is used, e.g., for pasting purposes.
7072 Only in this latter mode
7073 .Ar HERE-delimiter
7074 may be given: if it is data will be read in until the given
7075 .Ar HERE-delimiter
7076 is seen on a line by itself, and encountering EOF is an error; the
7077 .Ar HERE-delimiter
7078 is a required argument in non-interactive mode; if it is single-quote
7079 quoted then the pasted content will not be expanded, \*(ID otherwise
7080 a future version of \*(UA may perform shell-style expansion on the content.
7083 .It Ic ~s Ar string
7084 Cause the named string to become the current subject field.
7085 Newline (NL) and carriage-return (CR) bytes are invalid and will be
7086 normalized to space (SP) characters.
7089 .It Ic ~t Ar name ...
7090 Add the given name(s) to the direct recipient list.
7093 .It Ic ~U Ar messages
7094 Read in the given / current message(s) excluding all headers, indented by
7095 .Va indentprefix .
7098 .It Ic ~u Ar messages
7099 Read in the given / current message(s), excluding all headers.
7102 .It Ic ~v
7103 Invoke an alternate editor (defined by the
7104 .Ev VISUAL
7105 environment variable) on the message collected so far.
7106 Usually, the alternate editor will be a screen editor.
7107 After the editor is quit,
7108 the user may resume appending text to the end of the message.
7111 .It Ic ~w Ar filename
7112 Write the message onto the named file, which is object to the usual
7113 .Sx "Filename transformations" .
7114 If the file exists,
7115 the message is appended to it.
7118 .It Ic ~x
7119 Same as
7120 .Ic ~q ,
7121 except that the message is not saved at all.
7124 .It Ic ~| Ar command
7125 Pipe the message through the specified filter command.
7126 If the command gives no output or terminates abnormally,
7127 retain the original text of the message.
7128 E.g., the command
7129 .Xr fmt 1
7130 is often used as a rejustifying filter.
7134 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7135 Low-level command meant for scripted message access, i.e., for
7136 .Va on-compose-splice
7138 .Va on-compose-splice-shell .
7139 The used protocol is likely subject to changes, and therefore the
7140 mentioned hooks receive the used protocol version as an initial line.
7141 In general the first field of a response line represents a status code
7142 which specifies whether a command was successful or not, whether result
7143 data is to be expected, and if, the format of the result data.
7144 Does not manage the error number
7145 .Va \&!
7146 and the exit status
7147 .Va \&? ,
7148 because errors are reported via the protocol
7149 (hard errors like I/O failures cannot be handled).
7150 This command has read-only access to several virtual pseudo headers in
7151 the \*(UA private namespace, which may not exist (except for the first):
7155 .Bl -tag -compact -width ".It Va BaNg"
7156 .It Ql Mailx-Command:
7157 The name of the command that generates the message, one of
7158 .Ql mail ,
7159 .Ql reply ,
7160 .Ql forward ,
7161 .Ql resend .
7163 .It Ql Mailx-Raw-To:
7164 .It Ql Mailx-Raw-Cc:
7165 .It Ql Mailx-Raw-Bcc:
7166 Represent the frozen initial state of these headers before any
7167 transformation (e.g.,
7168 .Ic alias ,
7169 .Ic alternates ,
7170 .Va recipients-in-cc
7171 etc.) took place.
7173 .It Ql Mailx-Orig-From:
7174 .It Ql Mailx-Orig-To:
7175 .It Ql Mailx-Orig-Cc:
7176 .It Ql Mailx-Orig-Bcc:
7177 The values of said headers of the original message which has been
7178 addressed by any of
7179 .Ic reply , forward , resend .
7183 The status codes are:
7187 .Bl -tag -compact -width ".It Ql 210"
7188 .It Ql 210
7189 Status ok; the remains of the line are the result.
7191 .It Ql 211
7192 Status ok; the rest of the line is optionally used for more status.
7193 What follows are lines of result addresses, terminated by an empty line.
7194 The address lines consist of two fields, the first of which is the
7195 plain address, e.g.,
7196 .Ql bob@exam.ple ,
7197 separated by a single ASCII SP space from the second which contains the
7198 unstripped address, even if that is identical to the first field, e.g.,
7199 .Ql (Lovely) Bob <bob@exam.ple> .
7200 All the input, including the empty line, must be consumed before further
7201 commands can be issued.
7203 .It Ql 212
7204 Status ok; the rest of the line is optionally used for more status.
7205 What follows are lines of furtherly unspecified string content,
7206 terminated by an empty line.
7207 All the input, including the empty line, must be consumed before further
7208 commands can be issued.
7210 .It Ql 500
7211 Syntax error; invalid command.
7213 .It Ql 501
7214 Syntax error in parameters or arguments.
7216 .It Ql 505
7217 Error: an argument fails verification.
7218 For example an invalid address has been specified, or an attempt was
7219 made to modify anything in \*(UA's own namespace.
7221 .It Ql 506
7222 Error: an otherwise valid argument is rendered invalid due to context.
7223 For example, a second address is added to a header which may consist of
7224 a single address only.
7229 If a command indicates failure then the message will have remained
7230 unmodified.
7231 Most commands can fail with
7232 .Ql 500
7233 if required arguments are missing (false command usage).
7234 The following (case-insensitive) commands are supported:
7237 .Bl -hang -width ".It Cm header"
7238 .It Cm header
7239 This command allows listing, inspection, and editing of message headers.
7240 Header name case is not normalized, and case-insensitive comparison
7241 should be used when matching names.
7242 The second argument specifies the subcommand to apply, one of:
7244 .Bl -hang -width ".It Cm remove"
7245 .It Cm list
7246 Without a third argument a list of all yet existing headers is given via
7247 .Ql 210 ;
7248 this command is the default command of
7249 .Cm header
7250 if no second argument has been given.
7251 A third argument restricts output to the given header only, which may
7252 fail with
7253 .Ql 501
7254 if no such field is defined.
7256 .It Cm show
7257 Shows the content of the header given as the third argument.
7258 Dependent on the header type this may respond with
7259 .Ql 211
7261 .Ql 212 ;
7262 any failure results in
7263 .Ql 501 .
7265 .It Cm remove
7266 This will remove all instances of the header given as the third
7267 argument, reporting
7268 .Ql 210
7269 upon success,
7270 .Ql 501
7271 if no such header can be found, and
7272 Ql 505
7273 on \*(UA namespace violations.
7275 .It Cm remove-at
7276 This will remove from the header given as the third argument the
7277 instance at the list position (counting from one!) given with the fourth
7278 argument, reporting
7279 .Ql 210
7280 upon success or
7281 .Ql 505
7282 if the list position argument is not a number or on \*(UA namespace
7283 violations, and
7284 .Ql 501
7285 if no such header instance exists.
7287 .It Cm insert
7288 Create a new or an additional instance of the header given in the third
7289 argument, with the header body content as given in the fourth argument
7290 (the remains of the line).
7291 It may return
7292 .Ql 501
7293 if the third argument specifies a free-form header field name that is
7294 invalid, or if body content extraction fails to succeed,
7295 .Ql 505
7296 if any extracted address does not pass syntax and/or security checks or
7297 on \*(UA namespace violations, and
7298 .Ql 506
7299 to indicate prevention of excessing a single-instance header \(em note that
7300 .Ql Subject:
7301 can be appended to (a space separator will be added automatically first).
7303 .Ql 210
7304 is returned upon success, followed by the name of the header and the list
7305 position of the newly inserted instance.
7306 The list position is always 1 for single-instance header fields.
7307 All free-form header fields are managed in a single list.
7311 .It Cm attachment
7312 This command allows listing, removal and addition of message attachments.
7313 The second argument specifies the subcommand to apply, one of:
7315 .Bl -hang -width ".It Cm remove"
7316 .It Cm list
7317 List all attachments via
7318 .Ql 212 ,
7319 or report
7320 .Ql 501
7321 if no attachments exist.
7322 This command is the default command of
7323 .Cm attachment
7324 if no second argument has been given.
7326 .It Cm remove
7327 This will remove the attachment given as the third argument, and report
7328 .Ql 210
7329 upon success or
7330 .Ql 501
7331 if no such attachment can be found.
7332 If there exists any path component in the given argument, then an exact
7333 match of the path which has been used to create the attachment is used
7334 directly, but if only the basename of that path matches then all
7335 attachments are traversed to find an exact match first, and the removal
7336 occurs afterwards; if multiple basenames match, a
7337 .Ql 506
7338 error occurs.
7339 Message attachments are treated as absolute pathnames.
7341 If no path component exists in the given argument, then all attachments
7342 will be searched for
7343 .Ql filename=
7344 parameter matches as well as for matches of the basename of the path
7345 which has been used when the attachment has been created; multiple
7346 matches result in a
7347 .Ql 506 .
7349 .It Cm remove-at
7350 This will interpret the third argument as a number and remove the
7351 attachment at that list position (counting from one!), reporting
7352 .Ql 210
7353 upon success or
7354 .Ql 505
7355 if the argument is not a number or
7356 .Ql 501
7357 if no such attachment exists.
7359 .It Cm insert
7360 Adds the attachment given as the third argument, specified exactly as
7361 documented for the command line option
7362 .Fl a ,
7363 and supporting the message number extension as documented for
7364 .Ic ~@ .
7365 This reports
7366 .Ql 210
7367 upon success, with the index of the new attachment following,
7368 .Ql 505
7369 if the given file cannot be opened,
7370 .Ql 506
7371 if an on-the-fly performed character set conversion fails, otherwise
7372 .Ql 501
7373 is reported; this is also reported if character set conversion is
7374 requested but not available.
7376 .It Cm attribute
7377 This uses the same search mechanism as described for
7378 .Cm remove
7379 and prints any known attributes of the first found attachment via
7380 .Ql 212
7381 upon success or
7382 .Ql 501
7383 if no such attachment can be found.
7384 The attributes are written as lines of keyword and value tuples, the
7385 keyword being separated from the rest of the line with an ASCII SP space
7386 character.
7388 .It Cm attribute-at
7389 This uses the same search mechanism as described for
7390 .Cm remove-at
7391 and is otherwise identical to
7392 .Cm attribute .
7394 .It Cm attribute-set
7395 This uses the same search mechanism as described for
7396 .Cm remove ,
7397 and will assign the attribute given as the fourth argument, which is
7398 expected to be a value tuple of keyword and other data, separated by
7399 a ASCII SP space or TAB tabulator character.
7400 If the value part is empty, then the given attribute is removed, or
7401 reset to a default value if existence of the attribute is crucial.
7403 It returns via
7404 .Ql 210
7405 upon success, with the index of the found attachment following,
7406 .Ql 505
7407 for message attachments or if the given keyword is invalid, and
7408 .Ql 501
7409 if no such attachment can be found.
7410 The following keywords may be used (case-insensitively):
7412 .Bl -hang -compact -width ".It Ql filename"
7413 .It Ql filename
7414 Sets the filename of the MIME part, i.e., the name that is used for
7415 display and when (suggesting a name for) saving (purposes).
7416 .It Ql content-description
7417 Associate some descriptive information to the attachment's content, used
7418 in favour of the plain filename by some MUAs.
7419 .It Ql content-id
7420 May be used for uniquely identifying MIME entities in several contexts;
7421 this expects a special reference address format as defined in RFC 2045
7422 and generates a
7423 .Ql 505
7424 upon address content verification failure.
7425 .It Ql content-type
7426 Defines the media type/subtype of the part, which is managed
7427 automatically, but can be overwritten.
7428 .It Ql content-disposition
7429 Automatically set to the string
7430 .Ql attachment .
7433 .It Cm attribute-set-at
7434 This uses the same search mechanism as described for
7435 .Cm remove-at
7436 and is otherwise identical to
7437 .Cm attribute-set .
7444 .\" }}}
7447 .\" .Sh INTERNAL VARIABLES {{{
7448 .Sh "INTERNAL VARIABLES"
7450 Internal \*(UA variables are controlled via the
7451 .Ic set
7453 .Ic unset
7454 commands; prefixing a variable name with the string
7455 .Ql no
7456 and calling
7457 .Ic set
7458 has the same effect as using
7459 .Ic unset :
7460 .Ql unset crt
7462 .Ql set nocrt
7463 do the same thing.
7464 Creation or editing of variables can be performed in the
7465 .Ev EDITOR
7466 with the command
7467 .Ic varedit .
7468 .Ic varshow
7469 will give more insight on the given variable(s), and
7470 .Ic set ,
7471 when called without arguments, will show a listing of all variables.
7472 Both commands support a more
7473 .Va verbose
7474 listing mode.
7475 Some well-known variables will also become inherited from the
7476 program
7477 .Sx ENVIRONMENT
7478 implicitly, others can be imported explicitly with the command
7479 .Ic environ
7480 and henceforth share said properties.
7483 Two different kinds of internal variables exist.
7484 There are boolean variables, which can only be in one of the two states
7485 .Dq set
7487 .Dq unset ,
7488 and value variables with a(n optional) string value.
7489 For the latter proper quoting is necessary upon assignment time, the
7490 introduction of the section
7491 .Sx COMMANDS
7492 documents the supported quoting rules.
7494 .Bd -literal -offset indent
7495 ? wysh set one=val\e 1 two="val 2" \e
7496     three='val "3"' four=$'val \e'4\e''; \e
7497     varshow one two three four; \e
7498     unset one two three four
7502 Dependent upon the actual option the string values will be interpreted
7503 as numbers, colour names, normal text etc., but there also exists
7504 a special kind of string value, the
7505 .Dq boolean string ,
7506 which must either be a decimal integer (in which case
7507 .Ql 0
7508 is false and
7509 .Ql 1
7510 and any other value is true) or any of the (case-insensitive) strings
7511 .Ql off ,
7512 .Ql no ,
7513 .Ql n
7515 .Ql false
7516 for a false boolean and
7517 .Ql on ,
7518 .Ql yes ,
7519 .Ql y
7521 .Ql true
7522 for a true boolean; a special kind of boolean string is the
7523 .Dq quadoption ,
7524 which is a boolean string that can optionally be prefixed with the
7525 (case-insensitive) term
7526 .Ql ask- ,
7527 as in
7528 .Ql ask-yes ,
7529 which causes prompting of the user in interactive mode, with the given
7530 boolean as the default value.
7532 .\" .Ss "Initial settings" {{{
7533 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7534 .Ss "Initial settings"
7536 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7537 variable settings:
7538 .Pf no Va allnet ,
7539 .Pf no Va append ,
7540 .Va asksub ,
7541 .Pf no Va askbcc ,
7542 .Pf no Va autoprint ,
7543 .Pf no Va bang ,
7544 .Pf no Va cmd ,
7545 .Pf no Va crt ,
7546 .Pf no Va debug ,
7547 .Pf no Va dot ,
7548 .Va escape
7549 set to
7550 .Ql ~ ,
7551 .Pf no Va flipr ,
7552 .Pf no Va folder ,
7553 .Va header ,
7554 .Pf no Va hold ,
7555 .Pf no Va ignore ,
7556 .Pf no Va ignoreeof ,
7557 .Pf no Va keep ,
7558 .Pf no Va keepsave ,
7559 .Pf no Va metoo ,
7560 .Pf no Va outfolder ,
7561 .Pf no Va page ,
7562 .Va prompt
7563 set to
7564 .Ql ?\0 ,
7565 .Pf no Va quiet ,
7566 .Pf no Va record ,
7567 .Va save ,
7568 .Pf no Va sendwait ,
7569 .Pf no Va showto ,
7570 .Pf no Va Sign ,
7571 .Pf no Va sign ,
7572 .Va toplines
7573 set to
7574 .Ql 5 .
7577 Notes: \*(UA does not support the
7578 .Pf no Va onehop
7579 variable \(en use command line options or
7580 .Va mta-arguments
7581 to pass options through to a
7582 .Va mta .
7583 And the default global
7584 .Pa \*(UR
7585 file, which is loaded unless the
7586 .Fl \&:
7587 (with according argument) or
7588 .Fl n
7589 command line options have been used, or the
7590 .Ev MAILX_NO_SYSTEM_RC
7591 environment variable is set (see
7592 .Sx "Resource files" )
7593 bends those initial settings a bit, e.g., it sets the variables
7594 .Va hold ,
7595 .Va keepsave
7597 .Va keep ,
7598 to name a few, establishes a default
7599 .Ic headerpick
7600 selection etc., and should thus be taken into account.
7601 .\" }}}
7603 .\" .Ss "Variables" {{{
7604 .Ss "Variables"
7606 .Bl -tag -width ".It Va BaNg"
7609 .It Va \&?
7610 \*(RO The exit status of the last command, or the
7611 .Ic return
7612 value of the macro
7613 .Ic call Ns
7614 ed last.
7615 This status has a meaning in the state machine: in conjunction with
7616 .Va errexit
7617 any non-0 exit status will cause a program exit, and in
7618 .Ev POSIXLY_CORRECT
7619 mode any error while loading (any of the) resource files will have the
7620 same effect.
7621 .Cm ignerr ,
7622 one of the
7623 .Sx "Command modifiers" ,
7624 can be used to instruct the state machine to ignore errors.
7627 .It Va \&!
7628 \*(RO The current error number
7629 .Pf ( Xr errno 3 ) ,
7630 which is set after an error occurred; it is also available via
7631 .Va ^ERR ,
7632 and the error name and documentation string can be queried via
7633 .Va ^ERRNAME
7635 .Va ^ERRDOC .
7636 \*(ID This machinery is new and the error number is only really usable
7637 if a command explicitly states that it manages the variable
7638 .Va \&! ,
7639 for others errno will be used in case of errors, or
7640 .Va ^ERR Ns -INVAL
7641 if that is 0: it thus may or may not reflect the real error.
7642 The error number may be set with the command
7643 .Ic return .
7647 .It Va ^
7648 \*(RO This is a multiplexer variable which performs dynamic expansion of
7649 the requested state or condition, of which there are:
7652 .Bl -tag -compact -width ".It Va BaNg"
7656 .It Va ^ERR , ^ERRDOC , ^ERRNAME
7657 The number, documentation, and name of the current
7658 .Xr errno 3 ,
7659 respectively, which is usually set after an error occurred.
7660 \*(ID This machinery is new and is usually reliable only if a command
7661 explicitly states that it manages the variable
7662 .Va \&! ,
7663 which is effectively identical to
7664 .Va \&\&^ERR .
7665 Each of those variables can be suffixed with a hyphen minus followed by
7666 a name or number, in which case the expansion refers to the given error.
7667 Note this is a direct mapping of (a subset of) the system error values:
7668 .Bd -literal -offset indent
7669 define work {
7670   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
7671   vput vexpr i + "$1" 1
7672   if [ $i -lt 16 ]
7673     \excall work $i
7674   end
7676 call work 0
7682 .It Va *
7683 \*(RO Expands all positional parameters (see
7684 .Va 1 ) ,
7685 separated by a space character.
7686 \*(ID The special semantics of the equally named special parameter of the
7687 .Xr sh 1
7688 are not yet supported.
7691 .It Va @
7692 \*(RO Expands all positional parameters (see
7693 .Va 1 ) ,
7694 separated by a space character.
7695 If placed in double quotation marks, each positional parameter is
7696 properly quoted to expand to a single parameter again.
7699 .It Va #
7700 \*(RO Expands to the number of positional parameters, i.e., the size of
7701 the positional parameter stack in decimal.
7704 .It Va \&0
7705 \*(RO Inside the scope of a
7706 .Ic define Ns
7707 d and
7708 .Ic call Ns
7709 ed macro this expands to the name of the calling macro, or to the empty
7710 string if the macro is running from top-level.
7711 For the \*(OPal regular expression search and replace operator of
7712 .Ic vexpr
7713 this expands to the entire matching expression.
7714 It represents the program name in global context.
7717 .It Va 1
7718 \*(RO Access of the positional parameter stack.
7719 All further parameters can be accessed with this syntax, too, e.g.,
7720 .Ql 2 ,
7721 .Ql 3
7722 etc.; positional parameters can be shifted off the stack by calling
7723 .Ic shift .
7724 The parameter stack contains, e.g., the arguments of a
7725 .Ic call Ns
7727 .Ic define Ns
7728 d macro, the matching groups of the \*(OPal regular expression search
7729 and replace expression of
7730 .Ic vexpr ,
7731 and can be explicitly created or overwritten with the command
7732 .Ic vpospar .
7735 .It Va account
7736 \*(RO Is set to the active
7737 .Ic account .
7740 .It Va add-file-recipients
7741 \*(BO When file or pipe recipients have been specified,
7742 mention them in the corresponding address fields of the message instead
7743 of silently stripping them from their recipient list.
7744 By default such addressees are not mentioned.
7747 .It Va allnet
7748 \*(BO Causes only the local part to be evaluated
7749 when comparing addresses.
7752 .It Va append
7753 \*(BO Causes messages saved in the
7754 .Mx -sx
7755 .Sx "secondary mailbox"
7756 .Ev MBOX
7757 to be appended to the end rather than prepended.
7758 This should always be set.
7761 .It Va ask
7762 \*(BO Causes \*(UA to prompt for the subject of each message sent.
7763 If the user responds with simply a newline,
7764 no subject field will be sent.
7767 .It Va askatend
7768 \*(BO Causes the prompts for
7769 .Ql Cc:
7771 .Ql Bcc:
7772 lists to appear after the message has been edited.
7775 .It Va askattach
7776 \*(BO If set, \*(UA asks for files to attach at the end of each message,
7777 shall the list be found empty at that time.
7778 An empty line finalizes the list.
7781 .It Va askcc
7782 \*(BO Causes the user to be prompted for carbon copy recipients
7783 (at the end of each message if
7784 .Va askatend
7786 .Va bsdcompat
7787 are set) shall the list be found empty (at that time).
7788 An empty line finalizes the list.
7791 .It Va askbcc
7792 \*(BO Causes the user to be prompted for blind carbon copy
7793 recipients (at the end of each message if
7794 .Va askatend
7796 .Va bsdcompat
7797 are set) shall the list be found empty (at that time).
7798 An empty line finalizes the list.
7801 .It Va asksign
7802 \*(BO\*(OP Causes the user to be prompted if the message is to be
7803 signed at the end of each message.
7805 .Va smime-sign
7806 variable is ignored when this variable is set.
7809 .It Va asksub
7810 \*(BO Alternative name for
7811 .Va ask .
7814 .It Va attrlist
7815 A sequence of characters to display in the
7816 .Ql attribute
7817 column of the
7818 .Va headline
7819 as shown in the display of
7820 .Ic headers ;
7821 each for one type of messages (see
7822 .Sx "Message states" ) ,
7823 with the default being
7824 .Ql NUROSPMFAT+\-$~
7826 .Ql NU\ \ *HMFAT+\-$~
7827 if the
7828 .Va bsdflags
7829 variable is set, in the following order:
7831 .Bl -tag -compact -width ".It Ql _"
7832 .It Ql N
7833 new.
7834 .It Ql U
7835 unread but old.
7836 .It Ql R
7837 new but read.
7838 .It Ql O
7839 read and old.
7840 .It Ql S
7841 saved.
7842 .It Ql P
7843 preserved.
7844 .It Ql M
7845 mboxed.
7846 .It Ql F
7847 flagged.
7848 .It Ql A
7849 answered.
7850 .It Ql T
7851 draft.
7852 .It Ql +
7853 start of a collapsed thread.
7854 .It Ql -
7855 an uncollapsed thread (TODO ignored for now).
7856 .It Ql $
7857 classified as spam.
7858 .It Ql ~
7859 classified as possible spam.
7864 .It Va autobcc
7865 Specifies a list of recipients to which a blind carbon copy of each
7866 outgoing message will be sent automatically.
7869 .It Va autocc
7870 Specifies a list of recipients to which a carbon copy of each outgoing
7871 message will be sent automatically.
7874 .It Va autocollapse
7875 \*(BO Causes threads to be collapsed automatically when threaded mode
7876 is entered (see the
7877 .Ic collapse
7878 command).
7881 .It Va autoprint
7882 \*(BO Enable automatic
7883 .Ic type Ns
7884 ing of a(n existing)
7885 .Dq successive
7886 message after
7887 .Ic delete
7889 .Ic undelete
7890 commands, e.g., the message that becomes the new
7891 .Dq dot
7892 is shown automatically, as via
7893 .Ic dp
7895 .Ic dt .
7898 .It Va autosort
7899 Causes sorted mode (see the
7900 .Ic sort
7901 command) to be entered automatically with the value of this variable as
7902 sorting method when a folder is opened, e.g.,
7903 .Ql set autosort=thread .
7906 .It Va bang
7907 \*(BO Enables the substitution of all not (reverse-solidus) escaped
7908 exclamation mark
7909 .Ql \&!
7910 characters by the contents of the last executed command for the
7911 .Ic \&!
7912 shell escape command and
7913 .Ic ~! ,
7914 one of the compose mode
7915 .Sx "COMMAND ESCAPES" .
7916 If this variable is not set no reverse solidus stripping is performed.
7919 .It Va bind-timeout
7920 \*(OP Terminals generate multi-byte sequences for certain forms of
7921 input, for example for function and other special keys.
7922 Some terminals however do not write these multi-byte sequences as
7923 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
7924 This variable specifies the timeout in milliseconds that the MLE (see
7925 .Sx "On terminal control and line editor" )
7926 waits for more bytes to arrive unless it considers a sequence
7927 .Dq complete .
7928 The default is 200.
7931 .It Va bsdcompat
7932 \*(BO Sets some cosmetical features to traditional BSD style;
7933 has the same affect as setting
7934 .Va askatend
7935 and all other variables prefixed with
7936 .Ql bsd ;
7937 it also changes the behaviour of
7938 .Va emptystart
7939 (which does not exist in BSD).
7942 .It Va bsdflags
7943 \*(BO Changes the letters shown in the first column of a header
7944 summary to traditional BSD style.
7947 .It Va bsdheadline
7948 \*(BO Changes the display of columns in a header summary to traditional
7949 BSD style.
7952 .It Va bsdmsgs
7953 \*(BO Changes some informational messages to traditional BSD style.
7956 .It Va bsdorder
7957 \*(BO Causes the
7958 .Ql Subject:
7959 field to appear immediately after the
7960 .Ql To:
7961 field in message headers and with the
7962 .Ic ~h
7963 .Sx "COMMAND ESCAPES" .
7967 .It Va build-os , build-osenv
7968 \*(RO The operating system \*(UA has been build for, usually taken from
7969 .Xr uname 1
7971 .Ql uname -s
7973 .Ql uname -srm ,
7974 respectively, the former being lowercased.
7977 .It Va charset-7bit
7978 The value that should appear in the
7979 .Ql charset=
7980 parameter of
7981 .Ql Content-Type:
7982 MIME header fields when no character set conversion of the message data
7983 was performed.
7984 This defaults to US-ASCII, and the chosen character set should be
7985 US-ASCII compatible.
7988 .It Va charset-8bit
7989 \*(OP The default 8-bit character set that is used as an implicit last
7990 member of the variable
7991 .Va sendcharsets .
7992 This defaults to UTF-8 if character set conversion capabilities are
7993 available, and to ISO-8859-1 otherwise, in which case the only supported
7994 character set is
7995 .Va ttycharset
7996 and this variable is effectively ignored.
7997 Refer to the section
7998 .Sx "Character sets"
7999 for the complete picture of character set conversion in \*(UA.
8002 .It Va charset-unknown-8bit
8003 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8004 .Dq upgrade
8005 the content of a mail message by using a character set with the name
8006 .Ql unknown-8bit .
8007 Because of the unclassified nature of this character set \*(UA will not
8008 be capable to convert this character set to any other character set.
8009 If this variable is set any message part which uses the character set
8010 .Ql unknown-8bit
8011 is assumed to really be in the character set given in the value,
8012 otherwise the (final) value of
8013 .Va charset-8bit
8014 is used for this purpose.
8016 This variable will also be taken into account if a MIME type (see
8017 .Sx "The mime.types files" )
8018 of a MIME message part that uses the
8019 .Ql binary
8020 character set is forcefully treated as text.
8023 .It Va cmd
8024 The default value for the
8025 .Ic pipe
8026 command.
8029 .It Va colour-disable
8030 \*(BO\*(OP Forcefully disable usage of colours.
8031 Also see the section
8032 .Sx "Coloured display" .
8035 .It Va colour-pager
8036 \*(BO\*(OP Whether colour shall be used for output that is paged through
8037 .Ev PAGER .
8038 Note that pagers may need special command line options, e.g.,
8039 .Xr less 1
8040 requires the option
8041 .Fl \&\&R
8043 .Xr lv 1
8044 the option
8045 .Fl \&\&c
8046 in order to support colours.
8047 Often doing manual adjustments is unnecessary since \*(UA may perform
8048 adjustments dependent on the value of the environment variable
8049 .Ev PAGER
8050 (see there for more).
8054 .It Va contact-mail , contact-web
8055 \*(RO Addresses for contact per email and web, respectively, e.g., for
8056 bug reports, suggestions, or help regarding \*(UA.
8057 The former can be used directly:
8058 .Ql ? eval mail $contact-mail .
8061 .It Va crt
8062 In a(n interactive) terminal session, then if this valued variable is
8063 set it will be used as a threshold to determine how many lines the given
8064 output has to span before it will be displayed via the configured
8065 .Ev PAGER ;
8066 Usage of the
8067 .Ev PAGER
8068 can be forced by setting this to the value
8069 .Ql 0 ,
8070 setting it without a value will deduce the current height of the
8071 terminal screen to compute the treshold (see
8072 .Ev LINES ,
8073 .Va screen
8075 .Xr stty 1 ) .
8076 \*(ID At the moment this uses the count of lines of the message in wire
8077 format, which, dependent on the
8078 .Va mime-encoding
8079 of the message, is unrelated to the number of display lines.
8080 (The software is old and historically the relation was a given thing.)
8083 .It Va customhdr
8084 Define a set of custom headers to be injected into newly composed or
8085 forwarded messages; it is also possible to create custom headers in
8086 compose mode with
8087 .Ic ~^ ,
8088 which can be automated by setting one of the hooks
8089 .Va on-compose-splice
8091 .Va on-compose-splice-shell .
8092 The value is interpreted as a comma-separated list of custom headers to
8093 be injected, to include commas in the header bodies escape them with
8094 reverse solidus.
8095 \*(ID Overwriting of automatically managed headers is neither supported
8096 nor prevented.
8098 .Dl set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
8101 .It Va datefield
8102 Controls the appearance of the
8103 .Ql %d
8104 date and time format specification of the
8105 .Va headline
8106 variable, that is used, for example, when viewing the summary of
8107 .Ic headers .
8108 If unset, then the local receiving date is used and displayed
8109 unformatted, otherwise the message sending
8110 .Ql Date: .
8111 It is possible to assign a
8112 .Xr strftime 3
8113 format string and control formatting, but embedding newlines via the
8114 .Ql %n
8115 format is not supported, and will result in display errors.
8116 The default is
8117 .Ql %Y-%m-%d %H:%M ,
8118 and also see
8119 .Va datefield-markout-older .
8122 .It Va datefield-markout-older
8123 Only used in conjunction with
8124 .Va datefield .
8125 Can be used to create a visible distinction of messages dated more than
8126 a day in the future, or older than six months, a concept comparable to the
8127 .Fl \&\&l
8128 option of the POSIX utility
8129 .Xr ls 1 .
8130 If set to the empty string, then the plain month, day and year of the
8131 .Ql Date:
8132 will be displayed, but a
8133 .Xr strftime 3
8134 format string to control formatting can be assigned.
8135 The default is
8136 .Ql %Y-%m-%d .
8139 .It Va debug
8140 \*(BO Enables debug messages and obsoletion warnings, disables the
8141 actual delivery of messages and also implies
8142 .Pf no Va record
8143 as well as
8144 .Pf no Va save .
8147 .It Va disposition-notification-send
8148 \*(BO\*(OP Emit a
8149 .Ql Disposition-Notification-To:
8150 header (RFC 3798) with the message.
8151 This requires the
8152 .Va from
8153 variable to be set.
8154 .\" TODO .It Va disposition-notification-send-HOST
8155 .\"Overrides
8156 .\".Va disposition-notification-send
8157 .\" for SMTP accounts on a specific host.
8158 .\" TODO .It Va disposition-notification-send-USER@HOST
8159 .\"Overrides
8160 .\".Va disposition-notification-send
8161 .\"for a specific account.
8164 .It Va dot
8165 \*(BO When dot is set, a period
8166 .Ql \&.
8167 on a line by itself during message input in (interactive or batch
8168 .Fl # )
8169 compose mode will be treated as end-of-message (in addition to the
8170 normal end-of-file condition).
8171 This behaviour is implied in
8172 .Va posix
8173 mode with a set
8174 .Va ignoreeof .
8177 .It Va dotlock-ignore-error
8178 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
8179 .Mx -sx
8180 .Sx "primary system mailbox" Ns
8181 es (see, e.g., the notes on
8182 .Sx "Filename transformations" ,
8183 as well as the documentation of
8184 .Ic file )
8185 will be protected with so-called dotlock files\(emthe traditional mail
8186 spool file locking method\(emin addition to system file locking.
8187 Because \*(UA ships with a privilege-separated dotlock creation program
8188 that should always be able to create such a dotlock file there is no
8189 good reason to ignore dotlock file creation errors, and thus these are
8190 fatal unless this variable is set.
8193 .It Va editalong
8194 \*(BO If this variable is set then the editor is started automatically
8195 when a message is composed in interactive mode, as if the
8196 .Ic ~e
8197 .Sx "COMMAND ESCAPES"
8198 had been specified.
8200 .Va editheaders
8201 variable is implied for this automatically spawned editor session.
8204 .It Va editheaders
8205 \*(BO When a message is edited while being composed,
8206 its header is included in the editable text.
8209 .It Va emptystart
8210 \*(BO When entering interactive mode \*(UA normally writes
8211 .Dq \&No mail for user
8212 and exits immediately if a mailbox is empty or does not exist.
8213 If this variable is set \*(UA starts even with an empty or non-existent
8214 mailbox (the latter behaviour furtherly depends upon
8215 .Va bsdcompat ,
8216 though).
8219 .It Va errexit
8220 \*(BO Let each command with a non-0 exit status, including every
8221 .Ic call Ns
8222 ed macro which
8223 .Ic return Ns
8224 s a non-0 status, cause a program exit unless prefixed by
8225 .Cm ignerr
8226 (see
8227 .Sx "Command modifiers" ) .
8228 This also affects
8229 .Sx "COMMAND ESCAPES" ,
8230 but which use a different modifier for ignoring the error.
8231 Please refer to the variable
8232 .Va \&?
8233 for more on this topic.
8236 .It Va escape
8237 The first character of this value defines the escape character for
8238 .Sx "COMMAND ESCAPES"
8239 in compose mode.
8240 The default value is the character tilde
8241 .Ql ~ .
8242 If set to the empty string, command escapes are disabled.
8245 .It Va expandaddr
8246 If not set then file and command pipeline targets are not allowed,
8247 and any such address will be filtered out, giving a warning message.
8248 If set without a value then all possible recipient address
8249 specifications will be accepted \(en see the section
8250 .Sx "On sending mail, and non-interactive mode"
8251 for more on this.
8252 To accept them, but only in interactive mode, or when tilde commands
8253 were enabled explicitly by using one of the command line options
8254 .Fl ~
8256 .Fl # ,
8257 set this to the (case-insensitive) value
8258 .Ql restrict
8259 (it actually acts like
8260 .Ql restrict,-all,+name,+addr ,
8261 so that care for ordering issues must be taken) .
8263 In fact the value is interpreted as a comma-separated list of values.
8264 If it contains
8265 .Ql fail
8266 then the existence of disallowed specifications is treated as a hard
8267 send error instead of only filtering them out.
8268 The remaining values specify whether a specific type of recipient
8269 address specification is allowed (optionally indicated by a plus sign
8270 .Ql +
8271 prefix) or disallowed (prefixed with a hyphen-minus
8272 .Ql - ) .
8273 The value
8274 .Ql all
8275 addresses all possible address specifications,
8276 .Ql file
8277 file targets,
8278 .Ql pipe
8279 command pipeline targets,
8280 .Ql name
8281 plain user names and (MTA) aliases and
8282 .Ql addr
8283 network addresses.
8284 These kind of values are interpreted in the given order, so that
8285 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8286 will cause hard errors for any non-network address recipient address
8287 unless \*(UA is in interactive mode or has been started with the
8288 .Fl ~
8290 .Fl #
8291 command line option; in the latter case(s) any address may be used, then.
8293 Historically invalid network addressees are silently stripped off.
8294 To change this so that any encountered invalid email address causes
8295 a hard error it must be ensured that
8296 .Ql failinvaddr
8297 is an entry in the above list.
8298 Setting this automatically enables network addressees
8299 (it actually acts like
8300 .Ql failinvaddr,+addr ,
8301 so that care for ordering issues must be taken) .
8304 .It Va expandargv
8305 Unless this variable is set additional
8306 .Va mta
8307 (Mail-Transfer-Agent)
8308 arguments from the command line, as can be given after a
8309 .Fl \&\&-
8310 separator, are ignored due to safety reasons.
8311 However, if set to the special (case-insensitive) value
8312 .Ql fail ,
8313 then the presence of additional MTA arguments is treated as a hard
8314 error that causes \*(UA to exit with failure status.
8315 A lesser strict variant is the otherwise identical
8316 .Ql restrict ,
8317 which does accept such arguments in interactive mode, or if tilde
8318 commands were enabled explicitly by using one of the command line options
8319 .Fl ~
8321 .Fl # .
8324 .It Va features
8325 \*(RO String giving a list of features \*(UA, preceded with a plus sign
8326 .Ql +
8327 if the feature is available, and a hyphen-minus
8328 .Ql -
8329 otherwise.
8330 The output of the command
8331 .Ic version
8332 will include this information in a more pleasant output.
8335 .It Va flipr
8336 \*(BO This setting reverses the meanings of a set of reply commands,
8337 turning the lowercase variants, which by default address all recipients
8338 included in the header of a message
8339 .Pf ( Ic reply , respond , followup )
8340 into the uppercase variants, which by default address the sender only
8341 .Pf ( Ic Reply , Respond , Followup )
8342 and vice versa.
8343 The commands
8344 .Ic replysender , respondsender , followupsender
8345 as well as
8346 .Ic replyall , respondall , followupall
8347 are not affected by the current setting of
8348 .Va flipr .
8351 .It Va folder
8352 The default path under which mailboxes are to be saved:
8353 filenames that begin with the plus sign
8354 .Ql +
8355 will have the plus sign replaced with the value of this variable if set,
8356 otherwise the plus sign will remain unchanged when doing
8357 .Sx "Filename transformations" ;
8358 also see
8359 .Ic file
8360 for more on this topic.
8361 The value supports a subset of transformations itself, and if the
8362 non-empty value does not start with a solidus
8363 .Ql / ,
8364 then the value of
8365 .Ev HOME
8366 will be prefixed automatically.
8367 Once the actual value is evaluated first, the internal variable
8368 .Va folder-resolved
8369 will be updated for caching purposes.
8372 .It Va folder-hook
8373 This variable can be set to the name of a
8374 .Ic define Ns d
8375 macro which will be called whenever a
8376 .Ic file
8377 is opened.
8378 The macro will also be invoked when new mail arrives,
8379 but message lists for commands executed from the macro
8380 only include newly arrived messages then.
8381 .Ic localopts
8382 are activated by default in a folder hook, causing the covered settings
8383 to be reverted once the folder is left again.
8386 .It Va folder-hook-FOLDER
8387 Overrides
8388 .Va folder-hook
8389 for a folder named
8390 .Ql FOLDER .
8391 Unlike other folder specifications, the fully expanded name of a folder,
8392 without metacharacters, is used to avoid ambiguities.
8393 However, if the mailbox resides under
8394 .Va folder
8395 then the usual
8396 .Ql +
8397 specification is tried in addition, e.g., if
8398 .Va \&\&folder
8400 .Dq mail
8401 (and thus relative to the user's home directory) then
8402 .Pa /home/usr1/mail/sent
8403 will be tried as
8404 .Ql folder-hook-/home/usr1/mail/sent
8405 first, but then followed by
8406 .Ql folder-hook-+sent .
8409 .It Va folder-resolved
8410 \*(RO Set to the fully resolved path of
8411 .Va folder
8412 once that evaluation has occurred; rather internal.
8415 .It Va followup-to
8416 \*(BO Controls whether a
8417 .Ql Mail-Followup-To:
8418 header is generated when sending messages to known mailing lists.
8419 Also see
8420 .Va followup-to-honour
8421 and the commands
8422 .Ic mlist , mlsubscribe , reply
8424 .Ic Lreply .
8427 .It Va followup-to-honour
8428 Controls whether a
8429 .Ql Mail-Followup-To:
8430 header is honoured when group-replying to a message via
8431 .Ic reply
8433 .Ic Lreply .
8434 This is a quadoption; if set without a value it defaults to
8435 .Dq yes .
8436 Also see
8437 .Va followup-to
8438 and the commands
8439 .Ic mlist
8441 .Ic mlsubscribe .
8444 .It Va forward-as-attachment
8445 \*(BO Original messages are normally sent as inline text with the
8446 .Ic forward
8447 command,
8448 and only the first part of a multipart message is included.
8449 With this setting enabled messages are sent as unmodified MIME
8450 .Ql message/rfc822
8451 attachments with all of their parts included.
8454 .It Va forward-inject-head
8455 The string to put before the text of a message with the
8456 .Ic forward
8457 command instead of the default
8458 .Dq -------- Original Message -------- .
8459 No heading is put if it is set to the empty string.
8460 This variable is ignored if the
8461 .Va forward-as-attachment
8462 variable is set.
8465 .It Va from
8466 The address (or a list of addresses) to put into the
8467 .Ql From:
8468 field of the message header, quoting RFC 5322:
8469 the author(s) of the message, that is, the mailbox(es) of the person(s)
8470 or system(s) responsible for the writing of the message.
8471 When
8472 .Ic reply Ns
8473 ing to messages these addresses are handled as if they were in the
8474 .Ic alternates
8475 list.
8477 If the machine's hostname is not valid at the Internet (for example at
8478 a dialup machine) then either this variable or
8479 .Va hostname
8480 (\*(IN and with a defined SMTP protocol in
8481 .Va mta
8482 .Va smtp-hostname
8483 adds even more fine-tuning capabilities),
8484 have to be set.
8486 .Va \&\&from
8487 contains more than one address,
8488 setting the
8489 .Va sender
8490 variable is required (according to the standard RFC 5322).
8492 If a file-based MTA is used, then
8493 .Va from
8494 (or, if that contains multiple addresses,
8495 .Va sender )
8496 can nonetheless be enforced to appear as the envelope sender address at
8497 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8498 .Fl r
8499 command line option (with an empty argument; see there for the complete
8500 picture on this topic), or by setting the internal variable
8501 .Va r-option-implicit .
8504 .It Va fullnames
8505 \*(BO When replying to or forwarding a message \*(UA normally removes
8506 the comment and name parts of email addresses.
8507 If this variable is set such stripping is not performed,
8508 and comments, names etc. are retained.
8510 .It Va fwdheading
8511 \*(OB Predecessor of
8512 .Va forward-inject-head .
8515 .It Va header
8516 \*(BO Causes the header summary to be written at startup and after
8517 commands that affect the number of messages or the order of messages in
8518 the current
8519 .Ic folder .
8520 Unless in
8521 .Ev POSIXLY_CORRECT
8522 mode a header summary will also be displayed on folder changes.
8523 The command line option
8524 .Fl N
8525 can be used to set
8526 .Pf no Va header .
8530 .It Va headline
8531 A format string to use for the summary of
8532 .Ic headers ,
8533 similar to the ones used for
8534 .Xr printf 3
8535 formats.
8536 Format specifiers in the given string start with a percent sign
8537 .Ql %
8538 and may be followed by an optional decimal number indicating the field
8539 width \(em if that is negative, the field is to be left-aligned.
8540 Valid format specifiers are:
8543 .Bl -tag -compact -width ".It Ql _%%_"
8544 .It Ql %%
8545 A plain percent sign.
8546 .It Ql %>
8547 .Dq Dotmark :
8548 a space character but for the current message
8549 .Pf ( Dq dot ) ,
8550 for which it expands to
8551 .Ql > .
8552 .It Ql %<
8553 .Dq Dotmark :
8554 a space character but for the current message
8555 .Pf ( Dq dot ) ,
8556 for which it expands to
8557 .Ql < .
8558 .It Ql %$
8559 \*(OP The spam score of the message, as has been classified via the
8560 command
8561 .Ic spamrate .
8562 Shows only a replacement character if there is no spam support.
8563 .It Ql %a
8564 Message attribute character (status flag); the actual content can be
8565 adjusted by setting
8566 .Va attrlist .
8567 .It Ql %d
8568 The date found in the
8569 .Ql From:
8570 header of the message when
8571 .Va datefield
8572 is set (the default), otherwise the date when the message was received.
8573 Formatting can be controlled by assigning a
8574 .Xr strftime 3
8575 format string to
8576 .Va datefield .
8577 .It Ql %e
8578 The indenting level in threaded mode.
8579 .It Ql %f
8580 The address of the message sender.
8581 .It Ql %i
8582 The message thread tree structure.
8583 (Note that this format does not support a field width.)
8584 .It Ql %l
8585 The number of lines of the message, if available.
8586 .It Ql %m
8587 Message number.
8588 .It Ql %o
8589 The number of octets (bytes) in the message, if available.
8590 .It Ql %s
8591 Message subject (if any).
8592 .It Ql %S
8593 Message subject (if any) in double quotes.
8594 .It Ql \&%T
8595 Message recipient flags: is the addressee of the message a known or
8596 subscribed mailing list \(en see
8597 .Ic mlist
8599 .Ic mlsubscribe .
8600 .It Ql %t
8601 The position in threaded/sorted order.
8604 The default is
8605 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
8607 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
8609 .Va bsdcompat
8610 is set.
8611 Also see
8612 .Va attrlist
8614 .Va headline-bidi .
8618 .It Va headline-bidi
8619 Bidirectional text requires special treatment when displaying headers,
8620 because numbers (in dates or for file sizes etc.) will not affect the
8621 current text direction, in effect resulting in ugly line layouts when
8622 arabic or other right-to-left text is to be displayed.
8623 On the other hand only a minority of terminals is capable to correctly
8624 handle direction changes, so that user interaction is necessary for
8625 acceptable results.
8626 Note that extended host system support is required nonetheless, e.g.,
8627 detection of the terminal character set is one precondition;
8628 and this feature only works in an Unicode (i.e., UTF-8) locale.
8630 In general setting this variable will cause \*(UA to encapsulate text
8631 fields that may occur when displaying
8632 .Va headline
8633 (and some other fields, like dynamic expansions in
8634 .Va prompt )
8635 with special Unicode control sequences;
8636 it is possible to fine-tune the terminal support level by assigning
8637 a value:
8638 no value (or any value other than
8639 .Ql 1 ,
8640 .Ql 2
8642 .Ql 3 )
8643 will make \*(UA assume that the terminal is capable to properly deal
8644 with Unicode version 6.3, in which case text is embedded in a pair of
8645 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
8646 characters.
8647 In addition no space on the line is reserved for these characters.
8649 Weaker support is chosen by using the value
8650 .Ql 1
8651 (Unicode 6.3, but reserve the room of two spaces for writing the control
8652 sequences onto the line).
8653 The values
8654 .Ql 2
8656 .Ql 3
8657 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
8658 again reserves room for two spaces in addition.
8661 .It Va history-file
8662 \*(OP If a line editor is available then this can be set to
8663 name the (expandable) path of the location of a permanent history file.
8664 Also see
8665 .Va history-size .
8668 .It Va history-gabby
8669 \*(BO\*(OP Add more entries to the history as is normally done.
8672 .It Va history-gabby-persist
8673 \*(BO\*(OP \*(UA's own MLE will not save the additional
8674 .Va history-gabby
8675 entries in persistent storage unless this variable is set.
8676 On the other hand it will not loose the knowledge of whether
8677 a persistent entry was gabby or not.
8678 Also see
8679 .Va history-file .
8682 .It Va history-size
8683 \*(OP Setting this variable imposes a limit on the number of concurrent
8684 history entries.
8685 If set to the value 0 then no further history entries will be added, and
8686 loading and incorporation of the
8687 .Va history-file
8688 upon program startup can also be suppressed by doing this.
8689 Runtime changes will not be reflected, but will affect the number of
8690 entries saved to permanent storage.
8693 .It Va hold
8694 \*(BO This setting controls whether messages are held in the system
8695 .Va inbox ,
8696 and it is set by default.
8699 .It Va hostname
8700 Use this string as hostname when expanding local addresses instead of
8701 the value obtained from
8702 .Xr uname 3
8704 .Xr getaddrinfo 3 .
8705 It is used, e.g., in
8706 .Ql Message-ID:
8708 .Ql From:
8709 fields, as well as when generating
8710 .Ql Content-ID:
8711 MIME part related unique ID fields.
8712 Setting it to the empty string will cause the normal hostname to be
8713 used, but nonetheless enables creation of said ID fields.
8714 \*(IN in conjunction with the built-in SMTP
8715 .Va mta
8716 .Va smtp-hostname
8717 also influences the results:
8718 one should produce some test messages with the desired combination of
8719 .Va \&\&hostname ,
8720 and/or
8721 .Va from ,
8722 .Va sender
8723 etc. first.
8726 .It Va idna-disable
8727 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
8728 names according to the rules of IDNA (internationalized domain names
8729 for applications).
8730 Since the IDNA code assumes that domain names are specified with the
8731 .Va ttycharset
8732 character set, an UTF-8 locale charset is required to represent all
8733 possible international domain names (before conversion, that is).
8736 .It Va ifs
8737 The input field separator that is used (\*(ID by some functions) to
8738 determine where to split input data.
8740 .Bl -tag -compact -width ".It MMM"
8741 .It 1.
8742 Unsetting is treated as assigning the default value,
8743 .Ql \& \et\en .
8744 .It 2.
8745 If set to the empty value, no field splitting will be performed.
8746 .It 3.
8747 If set to a non-empty value, all whitespace characters are extracted
8748 and assigned to the variable
8749 .Va ifs-ws .
8752 .Bl -tag -compact -width ".It MMM"
8753 .It a.
8754 .Va \&\&ifs-ws
8755 will be ignored at the beginning and end of input.
8756 Diverging from POSIX shells default whitespace is removed in addition,
8757 which is owed to the entirely different line content extraction rules.
8758 .It b.
8759 Each occurrence of a character of
8760 .Va \&\&ifs
8761 will cause field-splitting, any adjacent
8762 .Va \&\&ifs-ws
8763 characters will be skipped.
8767 .It Va ifs-ws
8768 \*(RO Automatically deduced from the whitespace characters in
8769 .Va ifs .
8772 .It Va ignore
8773 \*(BO Ignore interrupt signals from the terminal while entering
8774 messages; instead echo them as
8775 .Ql @
8776 characters and discard the current line.
8779 .It Va ignoreeof
8780 \*(BO Ignore end-of-file conditions
8781 .Pf ( Ql control-D )
8782 in compose mode on message input and in interactive command input.
8783 If set an interactive command input session can only be left by
8784 explicitly using one of the commands
8785 .Ic exit
8787 .Ic quit ,
8788 and message input in compose mode can only be terminated by entering
8789 a period
8790 .Ql \&.
8791 on a line by itself or by using the
8792 .Ic ~.
8793 .Sx "COMMAND ESCAPES" ;
8794 Setting this implies the behaviour that
8795 .Va dot
8796 describes in
8797 .Va posix
8798 mode.
8801 .It Va inbox
8802 If this is set to a non-empty string it will specify the users
8803 .Mx -sx
8804 .Sx "primary system mailbox" ,
8805 overriding
8806 .Ev MAIL
8807 and the system-dependent default, and (thus) be used to replace
8808 .Ql %
8809 when doing
8810 .Sx "Filename transformations" ;
8811 also see
8812 .Ic file
8813 for more on this topic.
8814 The value supports a subset of transformations itself.
8817 .It Va indentprefix
8818 String used by the
8819 .Ic ~m , ~M
8821 .Ic ~R
8822 .Sx "COMMAND ESCAPES"
8823 and by the
8824 .Va quote
8825 option for indenting messages,
8826 in place of the normal tabulator character
8827 .Ql ^I ,
8828 which is the default.
8829 Be sure to quote the value if it contains spaces or tabs.
8832 .It Va keep
8833 \*(BO If set, an empty
8834 .Mx -sx
8835 .Sx "primary system mailbox"
8836 file is not removed.
8837 Note that, in conjunction with
8838 .Ev POSIXLY_CORRECT
8839 any empty file will be removed unless this variable is set.
8840 This may improve the interoperability with other mail user agents
8841 when using a common folder directory, and prevents malicious users
8842 from creating fake mailboxes in a world-writable spool directory.
8843 \*(ID Only local regular (MBOX) files are covered, Maildir or other
8844 mailbox types will never be removed, even if empty.
8847 .It Va keep-content-length
8848 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
8849 be told to keep the
8850 .Ql Content-Length:
8852 .Ql Lines:
8853 header fields that some MUAs generate by setting this variable.
8854 Since \*(UA does neither use nor update these non-standardized header
8855 fields (which in itself shows one of their conceptual problems),
8856 stripping them should increase interoperability in between MUAs that
8857 work with with same mailbox files.
8858 Note that, if this is not set but
8859 .Va writebackedited ,
8860 as below, is, a possibly performed automatic stripping of these header
8861 fields already marks the message as being modified.
8862 \*(ID At some future time \*(UA will be capable to rewrite and apply an
8863 .Va mime-encoding
8864 to modified messages, and then those fields will be stripped silently.
8867 .It Va keepsave
8868 \*(BO When a message is saved it is usually discarded from the
8869 originating folder when \*(UA is quit.
8870 This setting causes all saved message to be retained.
8873 .It Va line-editor-disable
8874 \*(BO Turn off any enhanced line editing capabilities (see
8875 .Sx "On terminal control and line editor"
8876 for more).
8879 .It Va line-editor-no-defaults
8880 \*(BO\*(OP Do not establish any default key binding.
8883 .It Va log-prefix
8884 Error log message prefix string
8885 .Pf ( Ql "\*(uA: " ) .
8888 .It Va mailbox-display
8889 \*(RO The name of the current mailbox
8890 .Pf ( Ic file ) ,
8891 possibly abbreviated for display purposes.
8894 .It Va mailbox-resolved
8895 \*(RO The fully resolved path of the current mailbox.
8898 .It Va mailx-extra-rc
8899 An additional startup file that is loaded as the last of the
8900 .Sx "Resource files" .
8901 Use this file for commands that are not understood by other POSIX
8902 .Xr mailx 1
8903 implementations, i.e., mostly anything which is not covered by
8904 .Sx "Initial settings" .
8907 .It Va markanswered
8908 \*(BO When a message is replied to and this variable is set,
8909 it is marked as having been
8910 .Ic answered .
8911 See the section
8912 .Sx "Message states" .
8915 .It Va mbox-rfc4155
8916 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
8917 POSIX rules for detecting message boundaries (so-called
8918 .Ql From_
8919 lines) due to compatibility reasons, instead of the stricter rules that
8920 have been standardized in RFC 4155.
8921 This behaviour can be switched to the stricter RFC 4155 rules by
8922 setting this variable.
8923 (This is never necessary for any message newly generated by \*(UA,
8924 it only applies to messages generated by buggy or malicious MUAs, or may
8925 occur in old MBOX databases: \*(UA itself will choose a proper
8926 .Va mime-encoding
8927 to avoid false interpretation of
8928 .Ql From_
8929 content lines in the MBOX database.)
8931 This may temporarily be handy when \*(UA complains about invalid
8932 .Ql From_
8933 lines when opening a MBOX: in this case setting this variable and
8934 re-opening the mailbox in question may correct the result.
8935 If so, copying the entire mailbox to some other file, as in
8936 .Ql copy * SOME-FILE ,
8937 will perform proper, all-compatible
8938 .Ql From_
8939 quoting for all detected messages, resulting in a valid MBOX mailbox.
8940 Finally the variable can be unset again:
8941 .Bd -literal -offset indent
8942 define mboxfix {
8943   localopts yes; wysh set mbox-rfc4155;\e
8944     wysh File "${1}"; eval copy * "${2}"
8946 call mboxfix /tmp/bad.mbox /tmp/good.mbox
8950 .It Va memdebug
8951 \*(BO Internal development variable.
8954 .It Va message-id-disable
8955 \*(BO By setting this variable the generation of
8956 .Ql Message-ID:
8957 can be completely suppressed, effectively leaving this task up to the
8958 .Va mta
8959 (Mail-Transfer-Agent) or the SMTP server.
8960 (According to RFC 5321 a SMTP server is not required to add this
8961 field by itself, so it should be ensured that it accepts messages without
8962 .Ql Message-ID . )
8963 This variable also affects automatic generation of
8964 .Va Content-ID:
8965 MIME header fields.
8968 .It Va message-inject-head
8969 A string to put at the beginning of each new message.
8970 The escape sequences tabulator
8971 .Ql \et
8972 and newline
8973 .Ql \en
8974 are understood.
8977 .It Va message-inject-tail
8978 A string to put at the end of each new message.
8979 The escape sequences tabulator
8980 .Ql \et
8981 and newline
8982 .Ql \en
8983 are understood.
8986 .It Va metoo
8987 \*(BO Usually, when an
8988 .Ic alias
8989 expansion contains the sender, the sender is removed from the expansion.
8990 Setting this option suppresses these removals.
8991 Note that a set
8992 .Va metoo
8993 also causes a
8994 .Ql -m
8995 option to be passed through to the
8996 .Va mta
8997 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
8998 this flag, no MTA is known which does not support it (for historical
8999 compatibility).
9002 .It Va mime-allow-text-controls
9003 \*(BO When sending messages, each part of the message is MIME-inspected
9004 in order to classify the
9005 .Ql Content-Type:
9007 .Ql Content-Transfer-Encoding:
9008 (see
9009 .Va mime-encoding )
9010 that is required to send this part over mail transport, i.e.,
9011 a computation rather similar to what the
9012 .Xr file 1
9013 command produces when used with the
9014 .Ql --mime
9015 option.
9017 This classification however treats text files which are encoded in
9018 UTF-16 (seen for HTML files) and similar character sets as binary
9019 octet-streams, forcefully changing any
9020 .Ql text/plain
9022 .Ql text/html
9023 specification to
9024 .Ql application/octet-stream :
9025 If that actually happens a yet unset charset MIME parameter is set to
9026 .Ql binary ,
9027 effectively making it impossible for the receiving MUA to automatically
9028 interpret the contents of the part.
9030 If this variable is set, and the data was unambiguously identified as
9031 text data at first glance (by a
9032 .Ql .txt
9034 .Ql .html
9035 file extension), then the original
9036 .Ql Content-Type:
9037 will not be overwritten.
9040 .It Va mime-alternative-favour-rich
9041 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
9042 HTML) will be preferred in favour of included plain text versions when
9043 displaying messages, provided that a handler exists which produces
9044 output that can be (re)integrated into \*(UA's normal visual display.
9045 (E.g., at the time of this writing some newsletters ship their full
9046 content only in the rich HTML part, whereas the plain text part only
9047 contains topic subjects.)
9050 .It Va mime-counter-evidence
9051 Normally the
9052 .Ql Content-Type:
9053 field is used to decide how to handle MIME parts.
9054 Some MUAs, however, do not use
9055 .Sx "The mime.types files"
9056 (also see
9057 .Sx "HTML mail and MIME attachments" )
9058 or a similar mechanism to correctly classify content, but specify an
9059 unspecific MIME type
9060 .Pf ( Ql application/octet-stream )
9061 even for plain text attachments.
9062 If this variable is set then \*(UA will try to re-classify such MIME
9063 message parts, if possible, for example via a possibly existing
9064 attachment filename.
9065 A non-empty value may also be given, in which case a number is expected,
9066 actually a carrier of bits.
9067 Creating the bit-carrying number is a simple addition:
9068 .Bd -literal -offset indent
9069 ? !echo Value should be set to $((2 + 4 + 8))
9070 Value should be set to 14
9073 .Bl -bullet -compact
9075 If bit two is set (2) then the detected
9076 .Ic mimetype
9077 will be carried along with the message and be used for deciding which
9078 MIME handler is to be used, for example;
9079 when displaying such a MIME part the part-info will indicate the
9080 overridden content-type by showing a plus sign
9081 .Ql + .
9083 If bit three is set (4) then the counter-evidence is always produced
9084 and a positive result will be used as the MIME type, even forcefully
9085 overriding the parts given MIME type.
9087 If bit four is set (8) then as a last resort the actual content of
9088 .Ql application/octet-stream
9089 parts will be inspected, so that data which looks like plain text can be
9090 treated as such.
9094 .It Va mime-encoding
9095 The MIME
9096 .Ql Content-Transfer-Encoding
9097 to use in outgoing text messages and message parts, where applicable.
9098 (7-bit clean text messages are sent as-is, without a transfer encoding.)
9099 Valid values are:
9101 .Bl -tag -compact -width ".It Ql _%%_"
9102 .It Ql 8bit
9103 .Pf (Or\0 Ql 8b . )
9104 8-bit transport effectively causes the raw data be passed through
9105 unchanged, but may cause problems when transferring mail messages over
9106 channels that are not ESMTP (RFC 1869) compliant.
9107 Also, several input data constructs are not allowed by the
9108 specifications and may cause a different transfer-encoding to be used.
9109 .It Ql quoted-printable
9110 .Pf (Or\0 Ql qp . )
9111 Quoted-printable encoding is 7-bit clean and has the property that ASCII
9112 characters are passed through unchanged, so that an english message can
9113 be read as-is; it is also acceptible for other single-byte locales that
9114 share many characters with ASCII, like, e.g., ISO-8859-1.
9115 The encoding will cause a large overhead for messages in other character
9116 sets: e.g., it will require up to twelve (12) bytes to encode a single
9117 UTF-8 character of four (4) bytes.
9118 .It Ql base64
9119 .Pf (Or\0 Ql b64 . )
9120 The default encoding, it is 7-bit clean and will always be used for
9121 binary data.
9122 This encoding has a constant input:output ratio of 3:4, regardless of
9123 the character set of the input data it will encode three bytes of input
9124 to four bytes of output.
9125 This transfer-encoding is not human readable without performing
9126 a decoding step.
9130 .It Va mimetypes-load-control
9131 Can be used to control which of
9132 .Sx "The mime.types files"
9133 are loaded: if the letter
9134 .Ql u
9135 is part of the option value, then the user's personal
9136 .Pa ~/.mime.types
9137 file will be loaded (if it exists); likewise the letter
9138 .Ql s
9139 controls loading of the system wide
9140 .Pa /etc/mime.types ;
9141 directives found in the user file take precedence, letter matching is
9142 case-insensitive.
9143 If this variable is not set \*(UA will try to load both files.
9144 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
9145 but they will be matched last (the order can be listed via
9146 .Ic mimetype ) .
9148 More sources can be specified by using a different syntax: if the
9149 value string contains an equals sign
9150 .Ql =
9151 then it is instead parsed as a comma-separated list of the described
9152 letters plus
9153 .Ql f=FILENAME
9154 pairs; the given filenames will be expanded and loaded, and their
9155 content may use the extended syntax that is described in the section
9156 .Sx "The mime.types files" .
9157 Directives found in such files always take precedence (are prepended to
9158 the MIME type cache).
9162 .It Va mta
9163 To choose an alternate Mail-Transfer-Agent, set this option to either
9164 the full pathname of an executable (optionally prefixed with a
9165 .Ql file://
9166 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
9168 .Dl smtps?://[user[:password]@]server[:port]
9170 (\*(OU:
9171 .Ql [smtp://]server[:port] . )
9172 The default has been chosen at compile time.
9173 All supported data transfers are executed in child processes, which
9174 run asynchronously and without supervision unless either the
9175 .Va sendwait
9176 or the
9177 .Va verbose
9178 variable is set.
9179 If such a child receives a TERM signal, it will abort and
9180 .Va save
9181 the message to
9182 .Ev DEAD ,
9183 if so configured.
9186 For a file-based MTA it may be necessary to set
9187 .Va mta-argv0
9188 in in order to choose the right target of a modern
9189 .Xr mailwrapper 8
9190 environment.
9191 It will be passed command line arguments from several possible sources:
9192 from the variable
9193 .Va mta-arguments
9194 if set, from the command line if given and the variable
9195 .Va expandargv
9196 allows their use.
9197 Argument processing of the MTA will be terminated with a
9198 .Fl \&\&-
9199 separator.
9202 The otherwise occurring implicit usage of the following MTA command
9203 line arguments can be disabled by setting the boolean variable
9204 .Va mta-no-default-arguments
9205 (which will also disable passing
9206 .Fl \&\&-
9207 to the MTA):
9208 .Fl \&\&i
9209 (for not treating a line with only a dot
9210 .Ql \&.
9211 character as the end of input),
9212 .Fl \&\&m
9213 (shall the variable
9214 .Va metoo
9215 be set) and
9216 .Fl \&\&v
9217 (if the
9218 .Va verbose
9219 variable is set); in conjunction with the
9220 .Fl r
9221 command line option \*(UA will also (not) pass
9222 .Fl \&\&f
9223 as well as possibly
9224 .Fl \&\&F .
9227 \*(OPally \*(UA can send mail over SMTP network connections to a single
9228 defined SMTP smart host by specifying a SMTP URL as the value (see
9229 .Sx "On URL syntax and credential lookup" ) .
9230 Note that with some mail providers it may be necessary to set the
9231 .Va smtp-hostname
9232 variable in order to use a specific combination of
9233 .Va from ,
9234 .Va hostname
9236 .Va mta .
9237 \*(UA also supports forwarding of all network traffic over a specified
9238 .Va socks-proxy .
9239 The following SMTP variants may be used:
9242 .Bl -bullet
9244 The plain SMTP protocol (RFC 5321) that normally lives on the
9245 server port 25 and requires setting the
9246 .Va smtp-use-starttls
9247 variable to enter a SSL/TLS encrypted session state.
9248 Assign a value like \*(IN
9249 .Ql smtp://[user[:password]@]server[:port]
9250 (\*(OU
9251 .Ql smtp://server[:port] )
9252 to choose this protocol.
9254 The so-called SMTPS which is supposed to live on server port 465
9255 and is automatically SSL/TLS secured.
9256 Unfortunately it never became a standardized protocol and may thus not
9257 be supported by your hosts network service database
9258 \(en in fact the port number has already been reassigned to other
9259 protocols!
9261 SMTPS is nonetheless a commonly offered protocol and thus can be
9262 chosen by assigning a value like \*(IN
9263 .Ql smtps://[user[:password]@]server[:port]
9264 (\*(OU
9265 .Ql smtps://server[:port] ) ;
9266 due to the mentioned problems it is usually necessary to explicitly
9267 specify the port as
9268 .Ql :465 ,
9269 however.
9271 Finally there is the SUBMISSION protocol (RFC 6409), which usually
9272 lives on server port 587 and is practically identically to the SMTP
9273 protocol from \*(UA's point of view beside that; it requires setting the
9274 .Va smtp-use-starttls
9275 variable to enter a SSL/TLS secured session state.
9276 Assign a value like \*(IN
9277 .Ql submission://[user[:password]@]server[:port]
9278 (\*(OU
9279 .Ql submission://server[:port] ) .
9284 .It Va mta-arguments
9285 Arguments to pass through to a file-based
9286 .Va mta
9287 can be given via this variable, which is parsed according to
9288 .Sx "Shell-style argument quoting"
9289 into an array of arguments, and which will be joined onto MTA options
9290 from other sources, and then passed individually to the MTA:
9291 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
9294 .It Va mta-no-default-arguments
9295 \*(BO Unless this variable is set \*(UA will pass some well known
9296 standard command line options to a file-based
9297 .Va mta
9298 (Mail-Transfer-Agent), see there for more.
9301 .It Va mta-argv0
9302 Many systems use a so-called
9303 .Xr mailwrapper 8
9304 environment to ensure compatibility with
9305 .Xr sendmail 1 .
9306 This works by inspecting the name that was used to invoke the mail
9307 delivery system.
9308 If this variable is set then the mailwrapper (the program that is
9309 actually executed when calling the file-based
9310 .Va mta )
9311 will treat its contents as that name.
9312 The default is
9313 .Ql sendmail .
9315 .Mx Va netrc-lookup
9316 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
9317 \*(BO\*(IN\*(OP Used to control usage of the users
9318 .Pa .netrc
9319 file for lookup of account credentials, as documented in the section
9320 .Sx "On URL syntax and credential lookup"
9321 and for the command
9322 .Ic netrc ;
9323 the section
9324 .Sx "The .netrc file"
9325 documents the file format.
9326 Also see
9327 .Va netrc-pipe .
9330 .It Va netrc-pipe
9331 \*(IN\*(OP When
9332 .Pa .netrc
9333 is loaded (see
9334 .Ic netrc
9336 .Va netrc-lookup )
9337 then \*(UA will read the output of a shell pipe instead of the users
9338 .Pa .netrc
9339 file if this variable is set (to the desired shell command).
9340 This can be used to, e.g., store
9341 .Pa .netrc
9342 in encrypted form:
9343 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
9346 .It Va newfolders
9347 If this variable has the value
9348 .Ql maildir ,
9349 newly created local folders will be in Maildir instead of MBOX format.
9352 .It Va newmail
9353 Checks for new mail in the current folder each time the prompt is shown.
9354 A Maildir folder must be re-scanned to determine if new mail has arrived.
9355 If this variable is set to the special value
9356 .Ql nopoll
9357 then a Maildir folder will not be rescanned completely, but only
9358 timestamp changes are detected.
9361 .It Va outfolder
9362 \*(BO Causes the filename given in the
9363 .Va record
9364 variable
9365 and the sender-based filenames for the
9366 .Ic Copy
9368 .Ic Save
9369 commands to be interpreted relative to the directory given in the
9370 .Va folder
9371 variable rather than to the current directory,
9372 unless it is set to an absolute pathname.
9375 .It Va on-compose-cleanup
9376 Macro hook which will be called after the message has been sent (or not,
9377 in case of failures), as the very last step before unrolling compose mode
9378 .Ic localopts .
9379 This hook is run even in case of fatal errors, and it is advisable to
9380 perform only absolutely necessary actions, like cleaning up
9381 .Ic alternates ,
9382 for example.
9383 For compose mode hooks that may affect the message content please see
9384 .Va on-compose-enter , on-compose-leave , on-compose-splice .
9385 \*(ID This hook exists only because
9386 .Ic alias , alternates , commandalias , shortcut ,
9387 to name a few, are currently not covered by
9388 .Ic localopts
9389 or a similar mechanism: any changes applied in compose mode will
9390 continue to be in effect thereafter.
9394 .It Va on-compose-enter , on-compose-leave
9395 Macro hooks which will be called before compose mode is entered,
9396 and after composing has been finished (but before the
9397 .Va signature
9398 is injected, etc.), respectively.
9399 .Ic localopts
9400 are enabled for these hooks, causing any setting to be forgotten after
9401 the message has been sent;
9402 .Va on-compose-cleanup
9403 can be used to perform any other necessary cleanup.
9404 The following (read-only) variables will be set temporarily during
9405 execution of the macros to represent the according message headers, or
9406 the empty string for non-existent; they correspond to accoding virtual
9407 temporary message headers that can be accessed via
9408 .Ic ~^ ,
9409 one of the
9410 .Sx "COMMAND ESCAPES" :
9412 .Bl -tag -compact -width ".It Va mailx_subject"
9413 .It Va mailx-command
9414 The command that generates the message.
9415 .It Va mailx-subject
9416 The subject.
9417 .It Va mailx-from
9418 .Va from .
9419 .It Va mailx-sender
9420 .Va sender .
9421 .It Va mailx-to , mailx-cc , mailx-bcc
9422 The list of receiver addresses as a space-separated list.
9423 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
9424 The list of receiver addresses before any mangling (due to, e.g.,
9425 .Ic alternates ,
9426 .Ic alias
9427 .Va recipients-in-cc )
9428 as a space-separated list.
9429 .It Va mailx-orig-from
9430 When replying, forwarding or resending, this will be set to the
9431 .Ql From:
9432 of the given message.
9433 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
9434 When replying, forwarding or resending, this will be set to the
9435 receivers of the given message.
9441 .It Va on-compose-splice , on-compose-splice-shell
9442 These hooks run once the normal compose mode is finished, but before the
9443 .Va on-compose-leave
9444 macro hook is called, the
9445 .Va signature
9446 is injected etc.
9447 Both hooks will be executed in a subprocess, with their input and output
9448 connected to \*(UA such that they can act as if they would be an
9449 interactive user.
9450 The difference in between them is that the latter is a
9451 .Ev SHELL
9452 command, whereas the former is a normal \*(UA macro, but which is
9453 restricted to a small set of commands (the
9454 .Va verbose
9455 output of, e.g.,
9456 .Ic list
9457 will indicate said capability).
9458 .Ic localopts
9459 are enabled for these hooks (in the parent process), causing any setting
9460 to be forgotten after the message has been sent;
9461 .Va on-compose-cleanup
9462 can be used to perform other cleanup as necessary.
9465 During execution of these hooks \*(UA will temporarily forget whether it
9466 has been started in interactive mode, (a restricted set of)
9467 .Sx "COMMAND ESCAPES"
9468 will always be available, and for guaranteed reproducibilities sake
9469 .Va escape
9471 .Va ifs
9472 will be set to their defaults.
9473 The compose mode command
9474 .Ic ~^
9475 has been especially designed for scriptability (via these hooks).
9476 The first line the hook will read on its standard input is the protocol
9477 version of said command escape, currently
9478 .Dq 0 0 1 :
9479 backward incompatible protocol changes have to be expected.
9482 Care must be taken to avoid deadlocks and other false control flow:
9483 if both involved processes wait for more input to happen at the
9484 same time, or one does not expect more input but the other is stuck
9485 waiting for consumption of its output, etc.
9486 There is no automatic synchronization of the hook: it will not be
9487 stopped automatically just because it, e.g., emits
9488 .Ql ~x .
9489 The hooks will however receive a termination signal if the parent enters
9490 an error condition.
9491 \*(ID Protection against and interaction with signals is not yet given;
9492 it is likely that in the future these scripts will be placed in an
9493 isolated session, which is signalled in its entirety as necessary.
9495 .Bd -literal -offset indent
9496 wysh set on-compose-splice-shell=$'\e
9497   read version;\e
9498   printf "hello $version!  Headers: ";\e
9499   echo \e'~^header list\e';\e
9500   read status result;\e
9501   echo "status=$status result=$result";\e
9502   '
9504 set on-compose-splice=ocsm
9505 define ocsm {
9506   read ver
9507   echo Splice protocol version is $ver
9508   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
9509   if [ "$es" != 2 ]
9510     echoerr 'Cannot read header list'; echo '~x'; xit
9511   endif
9512   if [ "$hl" @i!@ ' cc' ]
9513     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
9514       vput vexpr es substring "${es}" 0 1
9515     if [ "$es" != 2 ]
9516       echoerr 'Cannot insert Cc: header'; echo '~x'
9517     endif
9518   endif
9524 .It Va on-resend-cleanup
9525 \*(ID Identical to
9526 .Va on-compose-cleanup ,
9527 but is only triggered by
9528 .Ic resend .
9531 .It Va on-resend-enter
9532 \*(ID Identical to
9533 .Va on-compose-enter ,
9534 but is only triggered by
9535 .Ic resend .
9538 .It Va page
9539 \*(BO If set, each message feed through the command given for
9540 .Ic pipe
9541 is followed by a formfeed character
9542 .Ql \ef .
9544 .Mx Va password
9545 .It Va password-USER@HOST , password-HOST , password
9546 \*(IN Variable chain that sets a password, which is used in case none has
9547 been given in the protocol and account-specific URL;
9548 as a last resort \*(UA will ask for a password on the user's terminal if
9549 the authentication method requires a password.
9550 Specifying passwords in a startup file is generally a security risk;
9551 the file should be readable by the invoking user only.
9553 .It Va password-USER@HOST
9554 \*(OU (see the chain above for \*(IN)
9555 Set the password for
9556 .Ql USER
9557 when connecting to
9558 .Ql HOST .
9559 If no such variable is defined for a host,
9560 the user will be asked for a password on standard input.
9561 Specifying passwords in a startup file is generally a security risk;
9562 the file should be readable by the invoking user only.
9565 .It Va piperaw
9566 \*(BO Send messages to the
9567 .Ic pipe
9568 command without performing MIME and character set conversions.
9572 .It Va pipe-TYPE/SUBTYPE
9573 When a MIME message part of type
9574 .Ql TYPE/SUBTYPE
9575 (case-insensitive) is displayed or quoted,
9576 its text is filtered through the value of this variable interpreted as
9577 a shell command.
9578 Note that only parts which can be displayed inline as plain text (see
9579 .Cd copiousoutput )
9580 are displayed unless otherwise noted, other MIME parts will only be
9581 considered by and for the command
9582 .Ic mimeview .
9585 The special value commercial at
9586 .Ql @
9587 forces interpretation of the message part as plain text, e.g.,
9588 .Ql set pipe-application/xml=@
9589 will henceforth display XML
9590 .Dq as is .
9591 (The same could also be achieved by adding a MIME type marker with the
9592 .Ic mimetype
9593 command.
9594 And \*(OPally MIME type handlers may be defined via
9595 .Sx "The Mailcap files"
9596 \(em these directives,
9597 .Cd copiousoutput
9598 has already been used, should be referred to for further documentation.
9601 The commercial at
9602 .Ql @
9603 can in fact be used as a trigger character to adjust usage and behaviour
9604 of a following shell command specification more thoroughly by appending
9605 more special characters which refer to further mailcap directives, e.g.,
9606 the following hypothetical command specification could be used:
9608 .Bd -literal -offset indent
9609 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
9613 .Bl -tag -compact -width ".It Ql __"
9614 .It Ql *
9615 The command produces plain text to be integrated in \*(UAs output:
9616 .Cd copiousoutput .
9618 .It Ql #
9619 If set the handler will not be invoked when a message is to be quoted,
9620 but only when it will be displayed:
9621 .Cd x-mailx-noquote .
9623 .It Ql &
9624 Run the command asynchronously, i.e., without blocking \*(UA:
9625 .Cd x-mailx-async .
9627 .It Ql \&!
9628 The command must be run on an interactive terminal, \*(UA will
9629 temporarily release the terminal to it:
9630 .Cd needsterminal .
9632 .It Ql +
9633 Request creation of a zero-sized temporary file, the absolute pathname
9634 of which will be made accessible via the environment variable
9635 .Ev MAILX_FILENAME_TEMPORARY :
9636 .Cd x-mailx-tmpfile .
9637 If given twice then the file will be unlinked automatically by \*(UA
9638 when the command loop is entered again at latest:
9639 .Cd x-mailx-tmpfile-unlink .
9641 .It Ql =
9642 Normally the MIME part content is passed to the handler via standard
9643 input; if this flag is set then the data will instead be written into
9644 .Ev MAILX_FILENAME_TEMPORARY
9645 .Pf ( Cd x-mailx-tmpfile-fill ) ,
9646 the creation of which is implied; note however that in order to cause
9647 deletion of the temporary file you still have to use two plus signs
9648 .Ql ++
9649 explicitly!
9651 .It Ql @
9652 To avoid ambiguities with normal shell command content you can use
9653 another commercial at to forcefully terminate interpretation of
9654 remaining characters.
9655 (Any character not in this list will have the same effect.)
9659 Some information about the MIME part to be displayed is embedded into
9660 the environment of the shell command:
9663 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
9665 .It Ev MAILX_CONTENT
9666 The MIME content-type of the part, if known, the empty string otherwise.
9669 .It Ev MAILX_CONTENT_EVIDENCE
9671 .Va mime-counter-evidence
9672 includes the carry-around-bit (2), then this will be set to the detected
9673 MIME content-type; not only then identical to
9674 .Ev \&\&MAILX_CONTENT
9675 otherwise.
9678 .It Ev MAILX_FILENAME
9679 The filename, if any is set, the empty string otherwise.
9682 .It Ev MAILX_FILENAME_GENERATED
9683 A random string.
9686 .It Ev MAILX_FILENAME_TEMPORARY
9687 If temporary file creation has been requested through the command prefix
9688 this variable will be set and contain the absolute pathname of the
9689 temporary file.
9694 .It Va pipe-EXTENSION
9695 This is identical to
9696 .Va pipe-TYPE/SUBTYPE
9697 except that
9698 .Ql EXTENSION
9699 (normalized to lowercase using character mappings of the ASCII charset)
9700 names a file extension, e.g.,
9701 .Ql xhtml .
9702 Handlers registered using this method take precedence.
9704 .Mx Va pop3-auth
9705 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
9706 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
9707 The only possible value as of now is
9708 .Ql plain ,
9709 which is thus the default.
9712 .Mx Va pop3-bulk-load
9713 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
9714 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
9715 the messages, and only requests the message bodies on user request.
9716 For the POP3 protocol this means that the message headers will be
9717 downloaded twice.
9718 If this variable is set then \*(UA will download only complete messages
9719 from the given POP3 server(s) instead.
9721 .Mx Va pop3-keepalive
9722 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
9723 \*(OP POP3 servers close the connection after a period of inactivity;
9724 the standard requires this to be at least 10 minutes,
9725 but practical experience may vary.
9726 Setting this variable to a numeric value greater than
9727 .Ql 0
9728 causes a
9729 .Ql NOOP
9730 command to be sent each value seconds if no other operation is performed.
9732 .Mx Va pop3-no-apop
9733 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
9734 \*(BO\*(OP Unless this variable is set the
9735 .Ql APOP
9736 authentication method will be used when connecting to a POP3 server that
9737 advertises support.
9738 The advantage of
9739 .Ql APOP
9740 is that the password is not sent in clear text over the wire and that
9741 only a single packet is sent for the user/password tuple.
9742 Note that
9743 .Va pop3-no-apop-HOST
9744 requires \*(IN.
9746 .Mx Va pop3-use-starttls
9747 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
9748 \*(BO\*(OP Causes \*(UA to issue a
9749 .Ql STLS
9750 command to make an unencrypted POP3 session SSL/TLS encrypted.
9751 This functionality is not supported by all servers,
9752 and is not used if the session is already encrypted by the POP3S method.
9753 Note that
9754 .Va pop3-use-starttls-HOST
9755 requires \*(IN.
9759 .It Va posix
9760 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
9761 where that deviates from standardized behaviour.
9762 It will be set implicitly before the
9763 .Sx "Resource files"
9764 are loaded if the environment variable
9765 .Ev POSIXLY_CORRECT
9766 is set, and adjusting any of those two will be reflected by the other
9767 one implicitly.
9768 The following behaviour is covered and enforced by this mechanism:
9771 .Bl -bullet -compact
9773 In non-interactive mode, any error encountered while loading resource
9774 files during program startup will cause a program exit, whereas in
9775 interactive mode such errors will stop loading of the currently loaded
9776 (stack of) file(s, i.e., recursively).
9777 These exits can be circumvented on a per-command base by using
9778 .Cm ignerr ,
9779 one of the
9780 .Sx "Command modifiers" ,
9781 for each command which shall be allowed to fail.
9784 .Ic alternates
9785 will replace the list of alternate addresses instead of appending to it.
9788 Upon changing the active
9789 .Ic file
9790 no summary of
9791 .Ic headers
9792 will be displayed even if
9793 .Va header
9794 is set.
9797 Setting
9798 .Va ignoreeof
9799 implies the behaviour described by
9800 .Va dot .
9803 The variable
9804 .Va keep
9805 is extended to cover any empty mailbox, not only empty
9806 .Mx -sx
9807 .Sx "primary system mailbox" Ns
9808 es: they will be removed when they are left in empty state otherwise.
9813 .It Va print-alternatives
9814 \*(BO When a MIME message part of type
9815 .Ql multipart/alternative
9816 is displayed and it contains a subpart of type
9817 .Ql text/plain ,
9818 other parts are normally discarded.
9819 Setting this variable causes all subparts to be displayed,
9820 just as if the surrounding part was of type
9821 .Ql multipart/mixed .
9824 .It Va prompt
9825 The string used as a prompt in interactive mode.
9826 Whenever the variable is evaluated the value is expanded as via
9827 dollar-single-quote expansion (see
9828 .Sx "Shell-style argument quoting" ) .
9829 This (post-assignment, i.e., second) expansion can be used to embed
9830 status information, for example
9831 .Va \&? ,
9832 .Va \&! ,
9833 .Va account
9835 .Va mailbox-display .
9837 In order to embed characters which should not be counted when
9838 calculating the visual width of the resulting string, enclose the
9839 characters of interest in a pair of reverse solidus escaped brackets:
9840 .Ql \e[\eE[0m\e] ;
9841 a slot for coloured prompts is also available with the \*(OPal command
9842 .Ic colour .
9843 Prompting may be prevented by setting this to the null string
9844 (a.k.a.\|
9845 .Ql set noprompt ) .
9848 .It Va prompt2
9849 This string is used for secondary prompts, but is otherwise identical to
9850 .Va prompt .
9851 The default is
9852 .Ql ..\0 .
9855 .It Va quiet
9856 \*(BO Suppresses the printing of the version when first invoked.
9859 .It Va quote
9860 If set, \*(UA starts a replying message with the original message
9861 prefixed by the value of the variable
9862 .Va indentprefix .
9863 Normally, a heading consisting of
9864 .Dq Fromheaderfield wrote:
9865 is put before the quotation.
9866 If the string
9867 .Ql noheading
9868 is assigned to the
9869 .Va \&\&quote
9870 variable, this heading is omitted.
9871 If the string
9872 .Ql headers
9873 is assigned, only the headers selected by the
9874 .Ql type
9875 .Ic headerpick
9876 selection are put above the message body,
9877 thus
9878 .Va \&\&quote
9879 acts like an automatic
9880 .Pf ` Ic ~m Ns '
9881 .Sx "COMMAND ESCAPES"
9882 command, then.
9883 If the string
9884 .Ql allheaders
9885 is assigned, all headers are put above the message body and all MIME
9886 parts are included, making
9887 .Va \&\&quote
9888 act like an automatic
9889 .Pf ` Ic ~M Ns '
9890 command; also see
9891 .Va quote-as-attachment .
9894 .It Va quote-as-attachment
9895 \*(BO Add the original message in its entirety as a
9896 .Ql message/rfc822
9897 MIME attachment when replying to a message.
9898 Note this works regardless of the setting of
9899 .Va quote .
9902 .It Va quote-fold
9903 \*(OP Can be set in addition to
9904 .Va indentprefix .
9905 Setting this turns on a more fancy quotation algorithm in that leading
9906 quotation characters are compressed and overlong lines are folded.
9907 .Va \&\&quote-fold
9908 can be set to either one or two (space separated) numeric values,
9909 which are interpreted as the maximum (goal) and the minimum line length,
9910 respectively, in a spirit rather equal to the
9911 .Xr fmt 1
9912 program, but line-, not paragraph-based.
9913 If not set explicitly the minimum will reflect the goal algorithmically.
9914 The goal cannot be smaller than the length of
9915 .Va indentprefix
9916 plus some additional pad.
9917 Necessary adjustments take place silently.
9920 .It Va r-option-implicit
9921 \*(BO Setting this option evaluates the contents of
9922 .Va from
9923 (or, if that contains multiple addresses,
9924 .Va sender )
9925 and passes the results onto the used (file-based) MTA as described for the
9926 .Fl r
9927 option (empty argument case).
9930 .It Va recipients-in-cc
9931 \*(BO When doing a
9932 .Ic reply ,
9933 the original
9934 .Ql From:
9936 .Ql To:
9937 are by default merged into the new
9938 .Ql To: .
9939 If this variable is set, only the original
9940 .Ql From:
9941 ends in the new
9942 .Ql To: ,
9943 the rest is merged into
9944 .Ql Cc: .
9947 .It Va record
9948 Unless this variable is defined, no copies of outgoing mail will be saved.
9949 If defined it gives the pathname, subject to the usual
9950 .Sx "Filename transformations" ,
9951 of a folder where all new, replied-to or forwarded messages are saved:
9952 when saving to this folder fails the message is not sent, but instead
9953 .Va save Ns
9954 d to
9955 .Ev DEAD .
9956 The standard defines that relative (fully expanded) paths are to be
9957 interpreted relative to the current directory
9958 .Pf ( Ic cwd ) ,
9959 to force interpretation relative to
9960 .Va folder
9961 .Va outfolder
9962 needs to be set in addition.
9965 .It Va record-files
9966 \*(BO If this variable is set the meaning of
9967 .Va record
9968 will be extended to cover messages which target only file and pipe
9969 recipients (see
9970 .Va expandaddr ) .
9971 These address types will not appear in recipient lists unless
9972 .Va add-file-recipients
9973 is also set.
9976 .It Va record-resent
9977 \*(BO If this variable is set the meaning of
9978 .Va record
9979 will be extended to also cover the
9980 .Ic resend
9982 .Ic Resend
9983 commands.
9986 .It Va reply-in-same-charset
9987 \*(BO If this variable is set \*(UA first tries to use the same
9988 character set of the original message for replies.
9989 If this fails, the mechanism described in
9990 .Sx "Character sets"
9991 is evaluated as usual.
9994 .It Va reply-strings
9995 Can be set to a comma-separated list of (case-insensitive according to
9996 ASCII rules) strings which shall be recognized in addition to the
9997 built-in strings as
9998 .Ql Subject:
9999 reply message indicators \(en built-in are
10000 .Ql Re: ,
10001 which is mandated by RFC 5322, as well as the german
10002 .Ql Aw: ,
10003 .Ql Antw: ,
10004 and the
10005 .Ql Wg:
10006 which often has been seen in the wild;
10007 I.e., the separating colon has to be specified explicitly.
10010 .It Va replyto
10011 A list of addresses to put into the
10012 .Ql Reply-To:
10013 field of the message header.
10014 Members of this list are handled as if they were in the
10015 .Ic alternates
10016 list.
10019 .It Va reply-to-honour
10020 Controls whether a
10021 .Ql Reply-To:
10022 header is honoured when replying to a message via
10023 .Ic reply
10025 .Ic Lreply .
10026 This is a quadoption; if set without a value it defaults to
10027 .Dq yes .
10030 .It Va rfc822-body-from_
10031 \*(BO This variable can be used to force displaying a so-called
10032 .Ql From_
10033 line for messages that are embedded into an envelope mail via the
10034 .Ql message/rfc822
10035 MIME mechanism, for more visual convenience.
10038 .It Va save
10039 \*(BO Enable saving of (partial) messages in
10040 .Ev DEAD
10041 upon interrupt or delivery error.
10044 .It Va screen
10045 The number of lines that represents a
10046 .Dq screenful
10047 of lines, used in
10048 .Ic headers
10049 summary display,
10050 .Ic from
10051 .Ic search Ns
10052 ing, message
10053 .Ic top Ns
10054 line display and scrolling via
10055 .Ic z .
10056 If this variable is not set \*(UA falls back to a calculation based upon
10057 the detected terminal window size and the baud rate: the faster the
10058 terminal, the more will be shown.
10059 Overall screen dimensions and pager usage is influenced by the
10060 environment variables
10061 .Ev COLUMNS
10063 .Ev LINES
10064 and the variable
10065 .Va crt .
10068 .It Va searchheaders
10069 \*(BO Expand message-list specifiers in the form
10070 .Ql /x:y
10071 to all messages containing the substring
10072 .Dq y
10073 in the header field
10074 .Ql x .
10075 The string search is case insensitive.
10078 .It Va sendcharsets
10079 \*(OP A comma-separated list of character set names that can be used in
10080 outgoing internet mail.
10081 The value of the variable
10082 .Va charset-8bit
10083 is automatically appended to this list of character sets.
10084 If no character set conversion capabilities are compiled into \*(UA then
10085 the only supported charset is
10086 .Va ttycharset .
10087 Also see
10088 .Va sendcharsets-else-ttycharset
10089 and refer to the section
10090 .Sx "Character sets"
10091 for the complete picture of character set conversion in \*(UA.
10094 .It Va sendcharsets-else-ttycharset
10095 \*(BO\*(OP If this variable is set, but
10096 .Va sendcharsets
10097 is not, then \*(UA acts as if
10098 .Va sendcharsets
10099 had been set to the value of the variable
10100 .Va ttycharset .
10101 In effect this combination passes through the message data in the
10102 character set of the current locale encoding:
10103 therefore mail message text will be (assumed to be) in ISO-8859-1
10104 encoding when send from within a ISO-8859-1 locale, and in UTF-8
10105 encoding when send from within an UTF-8 locale.
10107 The 8-bit fallback
10108 .Va charset-8bit
10109 never comes into play as
10110 .Va ttycharset
10111 is implicitly assumed to be 8-bit and capable to represent all files the
10112 user may specify (as is the case when no character set conversion
10113 support is available in \*(UA and the only supported character set is
10114 .Va ttycharset :
10115 .Sx "Character sets" ) .
10116 This might be a problem for scripts which use the suggested
10117 .Ql LC_ALL=C
10118 setting, since in this case the character set is US-ASCII by definition,
10119 so that it is better to also override
10120 .Va ttycharset ,
10121 then.
10124 .It Va sender
10125 An address that is put into the
10126 .Ql Sender:
10127 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
10128 responsible for the actual transmission of the message.
10129 This field should normally not be used unless the
10130 .Va from
10131 field contains more than one address, on which case it is required.
10133 .Va \&\&sender
10134 address is handled as if it were in the
10135 .Ic alternates
10136 list; also see
10137 .Fl r ,
10138 .Va r-option-implicit .
10140 .It Va sendmail
10141 \*(OB Predecessor of
10142 .Va mta .
10144 .It Va sendmail-arguments
10145 \*(OB Predecessor of
10146 .Va mta-arguments .
10148 .It Va sendmail-no-default-arguments
10149 \*(OB\*(BO Predecessor of
10150 .Va mta-no-default-arguments .
10152 .It Va sendmail-progname
10153 \*(OB Predecessor of
10154 .Va mta-argv0 .
10157 .It Va sendwait
10158 \*(BO When sending a message wait until the
10159 .Va mta
10160 (including the built-in SMTP one) exits before accepting further commands.
10161 .Sy Only
10162 with this variable set errors reported by the MTA will be recognizable!
10163 If the MTA returns a non-zero exit status,
10164 the exit status of \*(UA will also be non-zero.
10167 .It Va showlast
10168 \*(BO This setting causes \*(UA to start at the last message
10169 instead of the first one when opening a mail folder.
10172 .It Va showname
10173 \*(BO Causes \*(UA to use the sender's real name instead of the plain
10174 address in the header field summary and in message specifications.
10177 .It Va showto
10178 \*(BO Causes the recipient of the message to be shown in the header
10179 summary if the message was sent by the user.
10182 .It Va Sign
10183 The string to expand
10184 .Ic ~A
10185 to (see
10186 .Sx "COMMAND ESCAPES" ) .
10189 .It Va sign
10190 The string to expand
10191 .Ic ~a
10192 to (see
10193 .Sx "COMMAND ESCAPES" ) .
10196 .It Va signature
10197 Must correspond to the name of a readable file if set.
10198 The file's content is then appended to each singlepart message
10199 and to the first part of each multipart message.
10200 Be warned that there is no possibility to edit the signature for an
10201 individual message.
10204 .It Va skipemptybody
10205 \*(BO If an outgoing message does not contain any text in its first or
10206 only message part, do not send it but discard it silently (see also the
10207 command line option
10208 .Fl E ) .
10212 .It Va smime-ca-dir , smime-ca-file
10213 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10214 Enhanced Mail) format as a directory and a file, respectively, for the
10215 purpose of verification of S/MIME signed messages.
10216 It is possible to set both, the file will be loaded immediately, the
10217 directory will be searched whenever no match has yet been found.
10218 The set of CA certificates which are built into the SSL/TLS library can
10219 be explicitly turned off by setting
10220 .Va smime-ca-no-defaults ,
10221 and further fine-tuning is possible via
10222 .Va smime-ca-flags .
10225 .It Va smime-ca-flags
10226 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10227 storage, and the certificate verification that is used.
10228 The actual values and their meanings are documented for
10229 .Va ssl-ca-flags .
10232 .It Va smime-ca-no-defaults
10233 \*(BO\*(OP Do not load the default CA locations that are built into the
10234 used to SSL/TLS library to verify S/MIME signed messages.
10236 .Mx Va smime-cipher
10237 .It Va smime-cipher-USER@HOST , smime-cipher
10238 \*(OP Specifies the cipher to use when generating S/MIME encrypted
10239 messages (for the specified account).
10240 RFC 5751 mandates a default of
10241 .Ql aes128
10242 (AES-128 CBC).
10243 Possible values are (case-insensitive and) in decreasing cipher strength:
10244 .Ql aes256
10245 (AES-256 CBC),
10246 .Ql aes192
10247 (AES-192 CBC),
10248 .Ql aes128
10249 (AES-128 CBC),
10250 .Ql des3
10251 (DES EDE3 CBC, 168 bits; default if
10252 .Ql aes128
10253 is not available) and
10254 .Ql des
10255 (DES CBC, 56 bits).
10257 The actually available cipher algorithms depend on the cryptographic
10258 library that \*(UA uses.
10259 \*(OP Support for more cipher algorithms may be available through
10260 dynamic loading via, e.g.,
10261 .Xr EVP_get_cipherbyname 3
10262 (OpenSSL) if \*(UA has been compiled to support this.
10265 .It Va smime-crl-dir
10266 \*(OP Specifies a directory that contains files with CRLs in PEM format
10267 to use when verifying S/MIME messages.
10270 .It Va smime-crl-file
10271 \*(OP Specifies a file that contains a CRL in PEM format to use when
10272 verifying S/MIME messages.
10275 .It Va smime-encrypt-USER@HOST
10276 \*(OP If this variable is set, messages send to the given receiver are
10277 encrypted before sending.
10278 The value of the variable must be set to the name of a file that
10279 contains a certificate in PEM format.
10281 If a message is sent to multiple recipients,
10282 each of them for whom a corresponding variable is set will receive an
10283 individually encrypted message;
10284 other recipients will continue to receive the message in plain text
10285 unless the
10286 .Va smime-force-encryption
10287 variable is set.
10288 It is recommended to sign encrypted messages, i.e., to also set the
10289 .Va smime-sign
10290 variable.
10293 .It Va smime-force-encryption
10294 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
10297 .It Va smime-sign
10298 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
10299 and include the user's certificate as a MIME attachment.
10300 Signing a message enables a recipient to verify that the sender used
10301 a valid certificate,
10302 that the email addresses in the certificate match those in the message
10303 header and that the message content has not been altered.
10304 It does not change the message text,
10305 and people will be able to read the message as usual.
10306 Also see
10307 .Va smime-sign-cert , smime-sign-include-certs
10309 .Va smime-sign-message-digest .
10311 .Mx Va smime-sign-cert
10312 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
10313 \*(OP Points to a file in PEM format.
10314 For the purpose of signing and decryption this file needs to contain the
10315 user's private key, followed by his certificate.
10317 For message signing
10318 .Ql USER@HOST
10319 is always derived from the value of
10320 .Va from
10321 (or, if that contains multiple addresses,
10322 .Va sender ) .
10323 For the purpose of encryption the recipient's public encryption key
10324 (certificate) is expected; the command
10325 .Ic certsave
10326 can be used to save certificates of signed messages (the section
10327 .Sx "Signed and encrypted messages with S/MIME"
10328 gives some details).
10329 This mode of operation is usually driven by the specialized form.
10331 When decrypting messages the account is derived from the recipient
10332 fields
10333 .Pf ( Ql To:
10335 .Ql Cc: )
10336 of the message, which are searched for addresses for which such
10337 a variable is set.
10338 \*(UA always uses the first address that matches,
10339 so if the same message is sent to more than one of the user's addresses
10340 using different encryption keys, decryption might fail.
10342 For signing and decryption purposes it is possible to use encrypted
10343 keys, and the pseudo-host(s)
10344 .Ql USER@HOST.smime-cert-key
10345 for the private key
10346 (and
10347 .Ql USER@HOST.smime-cert-cert
10348 for the certificate stored in the same file)
10349 will be used for performing any necessary password lookup,
10350 therefore the lookup can be automatized via the mechanisms described in
10351 .Sx "On URL syntax and credential lookup" .
10352 For example, the hypothetical address
10353 .Ql bob@exam.ple
10354 could be driven with a private key / certificate pair path defined in
10355 .Va \&\&smime-sign-cert-bob@exam.ple ,
10356 and needed passwords would then be looked up via the pseudo hosts
10357 .Ql bob@exam.ple.smime-cert-key
10358 (and
10359 .Ql bob@exam.ple.smime-cert-cert ) .
10360 To include intermediate certificates, use
10361 .Va smime-sign-include-certs .
10363 .Mx Va smime-sign-include-certs
10364 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
10365 \*(OP If used, this is supposed to a consist of a comma-separated list
10366 of files, each of which containing a single certificate in PEM format to
10367 be included in the S/MIME message in addition to the
10368 .Va smime-sign-cert
10369 certificate.
10370 This can be used to include intermediate certificates of the certificate
10371 authority, in order to allow the receiver's S/MIME implementation to
10372 perform a verification of the entire certificate chain, starting from
10373 a local root certificate, over the intermediate certificates, down to the
10374 .Va smime-sign-cert .
10375 Even though top level certificates may also be included in the chain,
10376 they won't be used for the verification on the receiver's side.
10378 For the purpose of the mechanisms involved here,
10379 .Ql USER@HOST
10380 refers to the content of the internal variable
10381 .Va from
10382 (or, if that contains multiple addresses,
10383 .Va sender ) .
10384 The pseudo-host
10385 .Ql USER@HOST.smime-include-certs
10386 will be used for performing password lookups for these certificates,
10387 shall they have been given one, therefore the lookup can be automatized
10388 via the mechanisms described in
10389 .Sx "On URL syntax and credential lookup" .
10391 .Mx Va smime-sign-message-digest
10392 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
10393 \*(OP Specifies the message digest to use when signing S/MIME messages.
10394 RFC 5751 mandates a default of
10395 .Ql sha1 .
10396 Possible values are (case-insensitive and) in decreasing cipher strength:
10397 .Ql sha512 ,
10398 .Ql sha384 ,
10399 .Ql sha256 ,
10400 .Ql sha224
10402 .Ql md5 .
10404 The actually available message digest algorithms depend on the
10405 cryptographic library that \*(UA uses.
10406 \*(OP Support for more message digest algorithms may be available
10407 through dynamic loading via, e.g.,
10408 .Xr EVP_get_digestbyname 3
10409 (OpenSSL) if \*(UA has been compiled to support this.
10410 Remember that for this
10411 .Ql USER@HOST
10412 refers to the variable
10413 .Va from
10414 (or, if that contains multiple addresses,
10415 .Va sender ) .
10417 .It Va smtp
10418 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
10419 .Va mta .
10420 \*(ID For compatibility reasons a set
10421 .Va smtp
10422 is used in preference of
10423 .Va mta .
10425 .Mx Va smtp-auth
10426 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
10427 \*(OP Variable chain that controls the SMTP
10428 .Va mta
10429 authentication method, possible values are
10430 .Ql none
10431 (\*(OU default),
10432 .Ql plain
10433 (\*(IN default),
10434 .Ql login
10435 as well as the \*(OPal methods
10436 .Ql cram-md5
10438 .Ql gssapi .
10440 .Ql none
10441 method does not need any user credentials,
10442 .Ql gssapi
10443 requires a user name and all other methods require a user name and
10444 a password.
10445 See \*(IN
10446 .Va mta ,
10447 .Va user
10449 .Va password
10450 (\*(OU
10451 .Va smtp-auth-password
10453 .Va smtp-auth-user ) .
10454 Note that
10455 .Va smtp-auth-HOST
10456 is \*(IN.
10457 \*(OU: Note for
10458 .Va smtp-auth-USER@HOST :
10459 may override dependent on sender address in the variable
10460 .Va from .
10462 .It Va smtp-auth-password
10463 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
10464 If the authentication method requires a password, but neither
10465 .Va smtp-auth-password
10466 nor a matching
10467 .Va smtp-auth-password-USER@HOST
10468 can be found,
10469 \*(UA will ask for a password on the user's terminal.
10471 .It Va smtp-auth-password-USER@HOST
10472 \*(OU Overrides
10473 .Va smtp-auth-password
10474 for specific values of sender addresses, dependent upon the variable
10475 .Va from .
10477 .It Va smtp-auth-user
10478 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
10479 If the authentication method requires a user name, but neither
10480 .Va smtp-auth-user
10481 nor a matching
10482 .Va smtp-auth-user-USER@HOST
10483 can be found,
10484 \*(UA will ask for a user name on the user's terminal.
10486 .It Va smtp-auth-user-USER@HOST
10487 \*(OU Overrides
10488 .Va smtp-auth-user
10489 for specific values of sender addresses, dependent upon the variable
10490 .Va from .
10493 .It Va smtp-hostname
10494 \*(OP\*(IN Normally \*(UA uses the variable
10495 .Va from
10496 to derive the necessary
10497 .Ql USER@HOST
10498 information in order to issue a
10499 .Ql MAIL FROM:<>
10500 SMTP
10501 .Va mta
10502 command.
10503 Setting
10504 .Va smtp-hostname
10505 can be used to use the
10506 .Ql USER
10507 from the SMTP account
10508 .Pf ( Va mta
10509 or the
10510 .Va user
10511 variable chain)
10512 and the
10513 .Ql HOST
10514 from the content of this variable (or, if that is the empty string,
10515 .Va hostname
10516 or the local hostname as a last resort).
10517 This often allows using an address that is itself valid but hosted by
10518 a provider other than which (in
10519 .Va from )
10520 is about to send the message.
10521 Setting this variable also influences generated
10522 .Ql Message-ID:
10524 .Ql Content-ID:
10525 header fields.
10527 .Mx Va smtp-use-starttls
10528 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
10529 \*(BO\*(OP Causes \*(UA to issue a
10530 .Ql STARTTLS
10531 command to make an SMTP
10532 .Va mta
10533 session SSL/TLS encrypted, i.e., to enable transport layer security.
10535 .Mx Va socks-proxy
10536 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
10537 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
10538 \*(UA will proxy all of its network activities through it.
10539 This can be used to proxy SMTP, POP3 etc. network traffic through the
10540 Tor anonymizer, for example.
10541 The following would create a local SOCKS proxy on port 10000 that
10542 forwards to the machine
10543 .Ql HOST ,
10544 and from which the network traffic is actually instantiated:
10545 .Bd -literal -offset indent
10546 # Create local proxy server in terminal 1 forwarding to HOST
10547 $ ssh -D 10000 USER@HOST
10548 # Then, start a client that uses it in terminal 2
10549 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
10553 .It Va spam-interface
10554 \*(OP In order to use any of the spam-related commands (like, e.g.,
10555 .Ic spamrate )
10556 the desired spam interface must be defined by setting this variable.
10557 Please refer to the manual section
10558 .Sx "Handling spam"
10559 for the complete picture of spam handling in \*(UA.
10560 All or none of the following interfaces may be available:
10562 .Bl -tag -width ".It Ql _ilte_"
10563 .It Ql spamc
10564 Interaction with
10565 .Xr spamc 1
10566 from the
10567 .Xr spamassassin 1
10568 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
10569 suite.
10570 Different to the generic filter interface \*(UA will automatically add
10571 the correct arguments for a given command and has the necessary
10572 knowledge to parse the program's output.
10573 A default value for
10574 .Va spamc-command
10575 will have been compiled into the \*(UA binary if
10576 .Xr spamc 1
10577 has been found in
10578 .Ev PATH
10579 during compilation.
10580 Shall it be necessary to define a specific connection type (rather than
10581 using a configuration file for that), the variable
10582 .Va spamc-arguments
10583 can be used as in, e.g.,
10584 .Ql -d server.example.com -p 783 .
10585 It is also possible to specify a per-user configuration via
10586 .Va spamc-user .
10587 Note that this interface does not inspect the
10588 .Ql is-spam
10589 flag of a message for the command
10590 .Ic spamforget .
10592 .It Ql filter
10593 generic spam filter support via freely configurable hooks.
10594 This interface is meant for programs like
10595 .Xr bogofilter 1
10596 and requires according behaviour in respect to the hooks' exit
10597 status for at least the command
10598 .Ic spamrate
10599 .Pf ( Ql 0
10600 meaning a message is spam,
10601 .Ql 1
10602 for non-spam,
10603 .Ql 2
10604 for unsure and any other return value indicating a hard error);
10605 since the hooks can include shell code snippets diverting behaviour
10606 can be intercepted as necessary.
10607 The hooks are
10608 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
10609   spamfilter-rate
10611 .Va spamfilter-spam ;
10612 the manual section
10613 .Sx "Handling spam"
10614 contains examples for some programs.
10615 The process environment of the hooks will have the variable
10616 .Ev MAILX_FILENAME_GENERATED
10617 set.
10618 Note that spam score support for
10619 .Ic spamrate
10620 is not supported unless the \*(OPtional regular expression support is
10621 available and the
10622 .Va spamfilter-rate-scanscore
10623 variable is set.
10628 .It Va spam-maxsize
10629 \*(OP Messages that exceed this size will not be passed through to the
10630 configured
10631 .Va spam-interface .
10632 If unset or 0, the default of 420000 bytes is used.
10635 .It Va spamc-command
10636 \*(OP The path to the
10637 .Xr spamc 1
10638 program for the
10639 .Ql spamc
10640 .Va spam-interface .
10641 Note that the path is not expanded, but used
10642 .Dq as is .
10643 A fallback path will have been compiled into the \*(UA binary if the
10644 executable had been found during compilation.
10647 .It Va spamc-arguments
10648 \*(OP Even though \*(UA deals with most arguments for the
10649 .Ql spamc
10650 .Va spam-interface
10651 automatically, it may at least sometimes be desirable to specify
10652 connection-related ones via this variable, e.g.,
10653 .Ql -d server.example.com -p 783 .
10656 .It Va spamc-user
10657 \*(OP Specify a username for per-user configuration files for the
10658 .Ql spamc
10659 .Va spam-interface .
10660 If this is set to the empty string then \*(UA will use the name of the
10661 current
10662 .Va user .
10669 .It Va spamfilter-ham , spamfilter-noham , \
10670   spamfilter-nospam , spamfilter-rate , spamfilter-spam
10671 \*(OP Command and argument hooks for the
10672 .Ql filter
10673 .Va spam-interface .
10674 The manual section
10675 .Sx "Handling spam"
10676 contains examples for some programs.
10679 .It Va spamfilter-rate-scanscore
10680 \*(OP Because of the generic nature of the
10681 .Ql filter
10682 .Va spam-interface
10683 spam scores are not supported for it by default, but if the \*(OPnal
10684 regular expression support is available then setting this variable can
10685 be used to overcome this restriction.
10686 It is interpreted as follows: first a number (digits) is parsed that
10687 must be followed by a semicolon
10688 .Ql \&;
10689 and an extended regular expression.
10690 Then the latter is used to parse the first output line of the
10691 .Va spamfilter-rate
10692 hook, and, in case the evaluation is successful, the group that has been
10693 specified via the number is interpreted as a floating point scan score.
10697 .It Va ssl-ca-dir , ssl-ca-file
10698 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10699 Enhanced Mail) format as a directory and a file, respectively, for the
10700 purpose of verification of SSL/TLS server certificates.
10701 It is possible to set both, the file will be loaded immediately, the
10702 directory will be searched whenever no match has yet been found.
10703 The set of CA certificates which are built into the SSL/TLS library can
10704 be explicitly turned off by setting
10705 .Va ssl-ca-no-defaults ,
10706 and further fine-tuning is possible via
10707 .Va ssl-ca-flags ;
10708 also see
10709 .Xr SSL_CTX_load_verify_locations 3
10710 for more information.
10711 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
10712 establishing TLS connections to servers identified with hostnames.
10716 .It Va ssl-ca-flags
10717 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10718 storage, and the certificate verification that is used (also see
10719 .Va ssl-verify ) .
10720 The value is expected to consist of a comma-separated list of
10721 configuration directives, with any intervening whitespace being ignored.
10722 The directives directly map to flags that can be passed to
10723 .Xr X509_STORE_set_flags 3 ,
10724 which are usually defined in a file
10725 .Pa openssl/x509_vfy.h ,
10726 and the availability of which depends on the used SSL/TLS library
10727 version: a directive without mapping is ignored (error log subject to
10728 .Va debug ) .
10729 Directives currently understood (case-insensitively) include:
10732 .Bl -tag -compact -width ".It Cd BaNg"
10733 .It Cd no-alt-chains
10734 If the initial chain is not trusted, do not attempt to build an
10735 alternative chain.
10736 Setting this flag will make OpenSSL certificate verification match that
10737 of older OpenSSL versions, before automatic building and checking of
10738 alternative chains has been implemented; also see
10739 .Cd trusted-first .
10740 .It Cd no-check-time
10741 Do not check certificate/CRL validity against current time.
10742 .It Cd partial-chain
10743 By default partial, incomplete chains which cannot be verified up to the
10744 chain top, a self-signed root certificate, will not verify.
10745 With this flag set, a chain succeeds to verify if at least one signing
10746 certificate of the chain is in any of the configured trusted stores of
10747 CA certificates.
10748 The OpenSSL manual page
10749 .Xr SSL_CTX_load_verify_locations 3
10750 gives some advise how to manage your own trusted store of CA certificates.
10751 .It Cd strict
10752 Disable workarounds for broken certificates.
10753 .It Cd trusted-first
10754 Try building a chain using issuers in the trusted store first to avoid
10755 problems with server-sent legacy intermediate certificates.
10756 Newer versions of OpenSSL support alternative chain checking and enable
10757 it by default, resulting in the same behaviour; also see
10758 .Cd no-alt-chains .
10763 .It Va ssl-ca-no-defaults
10764 \*(BO\*(OP Do not load the default CA locations that are built into the
10765 used to SSL/TLS library to verify SSL/TLS server certificates.
10767 .Mx Va ssl-cert
10768 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
10769 \*(OP Variable chain that sets the filename for a SSL/TLS client
10770 certificate required by some servers.
10771 This is a direct interface to the
10772 .Ql Certificate
10773 slot of the
10774 .Xr SSL_CONF_cmd 3
10775 function of the OpenSSL library, if available.
10777 .Mx Va ssl-cipher-list
10778 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
10779 \*(OP Specifies a list of ciphers for SSL/TLS connections.
10780 This is a direct interface to the
10781 .Ql CipherString
10782 slot of the
10783 .Xr SSL_CONF_cmd 3
10784 function of the OpenSSL library, if available; see
10785 .Xr ciphers 1
10787 .Xr SSL_CTX_set_cipher_list 3
10788 for more information.
10789 By default \*(UA does not set a list of ciphers, in effect using a
10790 .Va ssl-protocol
10791 specific cipher (protocol standards ship with a list of acceptable
10792 ciphers), possibly cramped to what the actually used SSL/TLS library
10793 supports \(en the manual section
10794 .Sx "An example configuration"
10795 also contains a SSL/TLS use case.
10798 .It Va ssl-config-file
10799 \*(OP If this variable is set \*(UA will call
10800 .Xr CONF_modules_load_file 3
10801 to allow OpenSSL to be configured according to the host system wide
10802 security settings.
10803 If a non-empty value is given then this will be used to specify the
10804 configuration file to be used instead of the global OpenSSL default;
10805 note that in this case it is an error if the file cannot be loaded.
10806 The application name will always be passed as
10807 .Dq \*(uA .
10809 .Mx Va ssl-curves
10810 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
10811 \*(OP Specifies a list of supported curves for SSL/TLS connections.
10812 This is a direct interface to the
10813 .Ql Curves
10814 slot of the
10815 .Xr SSL_CONF_cmd 3
10816 function of the OpenSSL library, if available; see
10817 .Xr SSL_CTX_set1_curves_list 3
10818 for more information.
10819 By default \*(UA does not set a list of curves.
10823 .It Va ssl-crl-dir , ssl-crl-file
10824 \*(OP Specify a directory / a file, respectively that contains a CRL in
10825 PEM format to use when verifying SSL/TLS server certificates.
10827 .Mx Va ssl-key
10828 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
10829 \*(OP Variable chain that sets the filename for the private key of
10830 a SSL/TLS client certificate.
10831 If unset, the name of the certificate file is used.
10832 The file is expected to be in PEM format.
10833 This is a direct interface to the
10834 .Ql PrivateKey
10835 slot of the
10836 .Xr SSL_CONF_cmd 3
10837 function of the OpenSSL library, if available.
10839 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
10840 \*(OB\*(OP Please use the newer and more flexible
10841 .Va ssl-protocol
10842 instead: if both values are set,
10843 .Va ssl-protocol
10844 will take precedence!
10845 Can be set to the following values, the actually used
10846 .Va ssl-protocol
10847 specification to which it is mapped is shown in parenthesis:
10848 .Ql tls1.2
10849 .Pf ( Ql -ALL, TLSv1.2 ) ,
10850 .Ql tls1.1
10851 .Pf ( Ql -ALL, TLSv1.1 ) ,
10852 .Ql tls1
10853 .Pf ( Ql -ALL, TLSv1 )
10855 .Ql ssl3
10856 .Pf ( Ql -ALL, SSLv3 ) ;
10857 the special value
10858 .Ql auto
10859 is mapped to
10860 .Ql ALL, -SSLv2
10861 and thus includes the SSLv3 protocol.
10862 Note that SSLv2 is no longer supported at all.
10864 .Mx Va ssl-protocol
10865 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
10866 \*(OP Specify the used SSL/TLS protocol.
10867 This is a direct interface to the
10868 .Ql Protocol
10869 slot of the
10870 .Xr SSL_CONF_cmd 3
10871 function of the OpenSSL library, if available;
10872 otherwise an \*(UA internal parser is used which understands the
10873 following subset of (case-insensitive) command strings:
10874 .Ql SSLv3 ,
10875 .Ql TLSv1 ,
10876 .Ql TLSv1.1
10878 .Ql TLSv1.2 ,
10879 as well as the special value
10880 .Ql ALL .
10881 Multiple specifications may be given via a comma-separated list which
10882 ignores any whitespace.
10883 An optional
10884 .Ql +
10885 plus sign prefix will enable a protocol, a
10886 .Ql -
10887 hyphen-minus prefix will disable it, so that
10888 .Ql -ALL, TLSv1.2
10889 will enable only the TLSv1.2 protocol.
10891 It depends upon the used TLS/SSL library which protocols are actually
10892 supported and which protocols are used if
10893 .Va ssl-protocol
10894 is not set, but note that SSLv2 is no longer supported at all and
10895 actively disabled.
10896 Especially for older protocols explicitly securing
10897 .Va ssl-cipher-list
10898 may be worthwile, see
10899 .Sx "An example configuration" .
10902 .It Va ssl-rand-egd
10903 \*(OP Gives the pathname to an entropy daemon socket, see
10904 .Xr RAND_egd 3 .
10905 Not all SSL/TLS libraries support this.
10908 .It Va ssl-rand-file
10909 \*(OP Gives the filename to a file with random entropy data, see
10910 .Xr RAND_load_file 3 .
10911 If this variable is not set, or set to the empty string, or if the
10912 .Sx "Filename transformations"
10913 fail, then
10914 .Xr RAND_file_name 3
10915 will be used to create the filename if, and only if,
10916 .Xr RAND_status 3
10917 documents that the SSL PRNG is not yet sufficiently seeded.
10918 If \*(UA successfully seeded the SSL PRNG then it will update the file
10919 .Pf ( Xr RAND_write_file 3 ) .
10920 This variable is only used if
10921 .Va ssl-rand-egd
10922 is not set (or not supported by the SSL/TLS library).
10924 .Mx Va ssl-verify
10925 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
10926 \*(OP Variable chain that sets the action to be performed if an error
10927 occurs during SSL/TLS server certificate validation against the
10928 specified or default trust stores
10929 .Va ssl-ca-dir ,
10930 .Va ssl-ca-file ,
10931 or the SSL/TLS library built-in defaults (unless usage disallowed via
10932 .Va ssl-ca-no-defaults ) ,
10933 and as fine-tuned via
10934 .Va ssl-ca-flags .
10935 Valid (case-insensitive) values are
10936 .Ql strict
10937 (fail and close connection immediately),
10938 .Ql ask
10939 (ask whether to continue on standard input),
10940 .Ql warn
10941 (show a warning and continue),
10942 .Ql ignore
10943 (do not perform validation).
10944 The default is
10945 .Ql ask .
10948 .It Va stealthmua
10949 If only set without an assigned value, then this setting inhibits the
10950 generation of the
10951 .Ql Message-ID: ,
10952 .Ql Content-ID:
10954 .Ql User-Agent:
10955 header fields that include obvious references to \*(UA.
10956 There are two pitfalls associated with this:
10957 First, the message id of outgoing messages is not known anymore.
10958 Second, an expert may still use the remaining information in the header
10959 to track down the originating mail user agent.
10960 If set to the value
10961 .Ql noagent ,
10962 then the mentioned
10963 .Ql Message-ID:
10965 .Ql Content-ID:
10966 suppression does not occur.
10970 .It Va termcap
10971 (\*(OP) This specifies a comma-separated list of
10972 .Lb libterminfo
10973 and/or
10974 .Lb libtermcap
10975 capabilities (see
10976 .Sx "On terminal control and line editor" ,
10977 escape commas with reverse solidus) to be used to overwrite or define
10978 entries.
10979 .Sy Note
10980 this variable will only be queried once at program startup and can
10981 thus only be specified in resource files or on the command line.
10984 String capabilities form
10985 .Ql cap=value
10986 pairs and are expected unless noted otherwise.
10987 Numerics have to be notated as
10988 .Ql cap#number
10989 where the number is expected in normal decimal notation.
10990 Finally, booleans do not have any value but indicate a true or false
10991 state simply by being defined or not; this indeed means that \*(UA
10992 does not support undefining an existing boolean.
10993 String capability values will undergo some expansions before use:
10994 for one notations like
10995 .Ql ^LETTER
10996 stand for
10997 .Ql control-LETTER ,
10998 and for clarification purposes
10999 .Ql \eE
11000 can be used to specify
11001 .Ql escape
11002 (the control notation
11003 .Ql ^[
11004 could lead to misreadings when a left bracket follows, which it does for
11005 the standard CSI sequence);
11006 finally three letter octal sequences, as in
11007 .Ql \e061 ,
11008 are supported.
11009 To specify that a terminal supports 256-colours, and to define sequences
11010 that home the cursor and produce an audible bell, one might write:
11012 .Bd -literal -offset indent
11013 ? set termcap='Co#256,home=\eE[H,bel=^G'
11017 The following terminal capabilities are or may be meaningful for the
11018 operation of the built-in line editor or \*(UA in general:
11021 .Bl -tag -compact -width ".It Cd yay"
11022 .\" HAVE_COLOUR
11023 .It Cd colors Ns \0or Cd Co
11024 .Cd max_colors :
11025 numeric capability specifying the maximum number of colours.
11026 Note that \*(UA does not actually care about the terminal beside that,
11027 but always emits ANSI / ISO 6429 escape sequences.
11029 .\" HAVE_TERMCAP
11030 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
11031 .Cd exit_ca_mode
11033 .Cd enter_ca_mode ,
11034 respectively: exit and enter the alternative screen ca-mode,
11035 effectively turning \*(UA into a fullscreen application.
11036 This must be enabled explicitly by setting
11037 .Va termcap-ca-mode .
11039 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
11040 .Cd keypad_xmit
11042 .Cd keypad_local ,
11043 respectively: enable and disable the keypad.
11044 This is always enabled if available, because it seems even keyboards
11045 without keypads generate other key codes for, e.g., cursor keys in that
11046 case, and only if enabled we see the codes that we are interested in.
11048 .It Cd ed Ns \0or Cd cd
11049 .Cd clr_eos :
11050 clear the screen.
11052 .It Cd clear Ns \0or Cd cl
11053 .Cd clear_screen :
11054 clear the screen and home cursor.
11055 (Will be simulated via
11056 .Cd ho
11057 plus
11058 .Cd cd . )
11060 .It Cd home Ns \0or Cd ho
11061 .Cd cursor_home :
11062 home cursor.
11064 .\" HAVE_MLE
11065 .It Cd el Ns \0or Cd ce
11066 .Cd clr_eol :
11067 clear to the end of line.
11068 (Will be simulated via
11069 .Cd ch
11070 plus repetitions of space characters.)
11072 .It Cd hpa Ns \0or Cd ch
11073 .Cd column_address :
11074 move the cursor (to the given column parameter) in the current row.
11075 (Will be simulated via
11076 .Cd cr
11077 plus
11078 .Cd nd . )
11080 .It Cd cr
11081 .Cd carriage_return :
11082 move to the first column in the current row.
11083 The default built-in fallback is
11084 .Ql \er .
11086 .It Cd cub1 Ns \0or Cd le
11087 .Cd cursor_left :
11088 move the cursor left one space (non-destructively).
11089 The default built-in fallback is
11090 .Ql \eb .
11092 .It Cd cuf1 Ns \0or Cd nd
11093 .Cd cursor_right :
11094 move the cursor right one space (non-destructively).
11095 The default built-in fallback is
11096 .Ql \eE[C ,
11097 which is used by most terminals.
11098 Less often occur
11099 .Ql \eEC
11101 .Ql \eEOC .
11105 Many more capabilities which describe key-sequences are documented for
11106 .Ic bind .
11110 .It Va termcap-ca-mode
11111 \*(OP Allow usage of the
11112 .Cd exit_ca_mode
11114 .Cd enter_ca_mode
11115 terminal capabilities, effectively turning \*(UA into a fullscreen
11116 application, as documented for
11117 .Va termcap .
11118 .Sy Note
11119 this variable will only be queried once at program startup and can
11120 thus only be specified in resource files or on the command line.
11123 .It Va termcap-disable
11124 \*(OP Disable any interaction with a terminal control library.
11125 If set only some generic fallback built-ins and possibly the content of
11126 .Va termcap
11127 describe the terminal to \*(UA.
11128 .Sy Note
11129 this variable will only be queried once at program startup and can
11130 thus only be specified in resource files or on the command line.
11133 .It Va toplines
11134 If defined, gives the number of lines of a message to be displayed
11135 with the command
11136 .Ic top ;
11137 if unset, the first five lines are printed, if set to 0 the variable
11138 .Va screen
11139 is inspected.
11140 If the value is negative then its absolute value will be used for
11141 unsigned right shifting (see
11142 .Ic vexpr )
11144 .Va screen
11145 height.
11148 .It Va topsqueeze
11149 \*(BO If set then the
11150 .Ic top
11151 command series will strip adjacent empty lines and quotations.
11154 .It Va ttycharset
11155 The character set of the terminal \*(UA operates on,
11156 and the one and only supported character set that \*(UA can use if no
11157 character set conversion capabilities have been compiled into it,
11158 in which case it defaults to ISO-8859-1 unless it can deduce a value
11159 from the locale specified in the
11160 .Ev LC_CTYPE
11161 environment variable (if supported, see there for more).
11162 It defaults to UTF-8 if conversion is available.
11163 Refer to the section
11164 .Sx "Character sets"
11165 for the complete picture about character sets.
11168 .It Va typescript-mode
11169 \*(BO A special multiplex variable that disables all variables and
11170 settings which result in behaviour that interferes with running \*(UA in
11171 .Xr script 1 ,
11172 e.g., it sets
11173 .Va colour-disable ,
11174 .Va line-editor-disable
11175 and (before startup completed only)
11176 .Va termcap-disable .
11177 Unsetting it does not restore the former state of the covered settings.
11180 .It Va umask
11181 For a safety-by-default policy \*(UA sets its process
11182 .Xr umask 2
11184 .Ql 0077 ,
11185 but this variable can be used to override that:
11186 set it to an empty value to do not change the (current) setting (on
11187 startup), otherwise the process file mode creation mask is updated to
11188 the new value.
11189 Child processes inherit the process file mode creation mask.
11191 .Mx Va user
11192 .It Va user-HOST , user
11193 \*(IN Variable chain that sets a global fallback user name, which is
11194 used in case none has been given in the protocol and account-specific
11195 URL.
11196 This variable defaults to the name of the user who runs \*(UA.
11199 .It Va v15-compat
11200 \*(BO Setting this enables upward compatibility with \*(UA
11201 version 15.0 in respect to which configuration options are available and
11202 how they are handled.
11203 This manual uses \*(IN and \*(OU to refer to the new and the old way of
11204 doing things, respectively.
11207 .It Va verbose
11208 \*(BO This setting, also controllable via the command line option
11209 .Fl v ,
11210 causes \*(UA to be more verbose, e.g., it will display obsoletion
11211 warnings and SSL/TLS certificate chains.
11212 Even though marked \*(BO this option may be set twice in order to
11213 increase the level of verbosity even more, in which case even details of
11214 the actual message delivery and protocol conversations are shown.
11215 A single
11216 .Pf no Va verbose
11217 is sufficient to disable verbosity as such.
11224 .It Va version , version-date , version-major , version-minor , version-update
11225 \*(RO \*(UA version information: the first variable contains a string
11226 containing the complete version identification, the latter three contain
11227 only digits: the major, minor and update version numbers.
11228 The date is in ISO 8601 notation.
11229 The output of the command
11230 .Ic version
11231 will include this information.
11234 .It Va writebackedited
11235 If this variable is set messages modified using the
11236 .Ic edit
11238 .Ic visual
11239 commands are written back to the current folder when it is quit;
11240 it is only honoured for writable folders in MBOX format, though.
11241 Note that the editor will be pointed to the raw message content in that
11242 case, i.e., neither MIME decoding nor decryption will have been
11243 performed, and proper RFC 4155
11244 .Ql From_
11245 quoting of newly added or edited content is also left as an excercise to
11246 the user.
11248 .\" }}} (Variables)
11250 .\" }}} (INTERNAL VARIABLES)
11253 .\" .Sh ENVIRONMENT {{{
11254 .Sh ENVIRONMENT
11256 The term
11257 .Dq environment variable
11258 should be considered an indication that these variables are either
11259 standardized as vivid parts of process environments, or that they are
11260 commonly found in there.
11261 The process environment is inherited from the
11262 .Xr sh 1
11263 once \*(UA is started, and unless otherwise explicitly noted handling of
11264 the following variables transparently integrates into that of the
11265 .Sx "INTERNAL VARIABLES"
11266 from \*(UA's point of view.
11267 This means that, e.g., they can be managed via
11268 .Ic set
11270 .Ic unset ,
11271 causing automatic program environment updates (to be inherited by
11272 newly created child processes).
11275 In order to transparently integrate other environment variables equally
11276 they need to be imported (linked) with the command
11277 .Ic environ .
11278 This command can also be used to set and unset non-integrated
11279 environment variables from scratch, sufficient system support provided.
11280 The following example, applicable to a POSIX shell, sets the
11281 .Ev COLUMNS
11282 environment variable for \*(UA only, and beforehand exports the
11283 .Ev EDITOR
11284 in order to affect any further processing in the running shell:
11286 .Bd -literal -offset indent
11287 $ EDITOR="vim -u ${HOME}/.vimrc"
11288 $ export EDITOR
11289 $ COLUMNS=80 \*(uA -R
11292 .Bl -tag -width ".It Ev BaNg"
11294 .It Ev COLUMNS
11295 The user's preferred width in column positions for the terminal screen
11296 or window.
11297 Queried and used once on program startup, actively managed for child
11298 processes and the MLE (see
11299 .Sx "On terminal control and line editor" )
11300 in interactive mode thereafter.
11301 Ignored in non-interactive mode, which always uses 80 columns, unless in
11302 .fl #
11303 batch mode.
11306 .It Ev DEAD
11307 The name of the (mailbox)
11308 .Ic file
11309 to use for saving aborted messages if
11310 .Va save
11311 is set; this defaults to
11312 .Pa dead.letter
11313 in the user's
11314 .Ev HOME
11315 directory.
11316 If the variable
11317 .Va debug
11318 is set no output will be generated, otherwise the contents of the file
11319 will be replaced.
11322 .It Ev EDITOR
11323 Pathname of the text editor to use in the
11324 .Ic edit
11325 command and
11326 .Ic ~e
11327 .Sx "COMMAND ESCAPES" .
11328 A default editor is used if this value is not defined.
11331 .It Ev HOME
11332 The user's home directory.
11333 This variable is only used when it resides in the process environment.
11338 .It Ev LC_ALL , LC_CTYPE , LANG
11339 \*(OP The (names in lookup order of the)
11340 .Xr locale 7
11341 (and / or see
11342 .Xr setlocale 3 )
11343 which indicates the used
11344 .Sx "Character sets" .
11345 Runtime changes trigger automatic updates of the entire locale system,
11346 updating and overwriting also a
11347 .Va ttycharset
11348 set by the user.
11351 .It Ev LINES
11352 The user's preferred number of lines on a page or the vertical screen
11353 or window size in lines.
11354 Queried and used once on program startup, actively managed for child
11355 processes in interactive mode thereafter.
11356 Ignored in non-interactive mode, which always uses 24 lines, unless in
11357 .fl #
11358 batch mode.
11361 .It Ev LISTER
11362 Pathname of the directory lister to use in the
11363 .Ic folders
11364 command when operating on local mailboxes.
11365 Default is
11366 .Xr ls 1
11367 (path search through
11368 .Ev SHELL ) .
11371 .It Ev LOGNAME
11372 Upon startup \*(UA will actively ensure that this variable refers to the
11373 name of the user who runs \*(UA, in order to be able to pass a verified
11374 name to any newly created child process.
11377 .It Ev MAIL
11378 Is used as the users
11379 .Mx -sx
11380 .Sx "primary system mailbox"
11381 unless
11382 .Va inbox
11383 is set.
11384 This is assumed to be an absolute pathname.
11387 .It Ev MAILCAPS
11388 \*(OP Overrides the default path search for
11389 .Sx "The Mailcap files" ,
11390 which is defined in the standard RFC 1524 as
11391 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
11392 .\" TODO we should have a mailcaps-default virtual RDONLY option!
11393 (\*(UA makes it a configuration option, however.)
11394 Note this is not a search path, but a path search.
11397 .It Ev MAILRC
11398 Is used as a startup file instead of
11399 .Pa \*(ur
11400 if set.
11401 When \*(UA scripts are invoked on behalf of other users,
11402 either this variable should be set to
11403 .Pa /dev/null
11404 or the
11405 .Fl \&:
11406 command line option should be used in order to avoid side-effects from
11407 reading their configuration files.
11408 This variable is only used when it resides in the process environment.
11411 .It Ev MAILX_NO_SYSTEM_RC
11412 If this variable is set then reading of
11413 .Pa \*(UR
11414 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
11415 had been started up with the option
11416 .Fl \&:
11417 (and according argument) or
11418 .Fl n .
11419 This variable is only used when it resides in the process environment.
11422 .It Ev MBOX
11423 The name of the users
11424 .Mx -sx
11425 .Sx "secondary mailbox"
11426 file.
11427 A logical subset of the special
11428 .Sx "Filename transformations"
11429 (also see
11430 .Ic file )
11431 are supported.
11432 The default is
11433 .Pa ~/mbox .
11434 Traditionally this MBOX is used as the file to save messages from the
11435 .Mx -sx
11436 .Sx "primary system mailbox"
11437 that have been read.
11438 Also see
11439 .Sx "Message states" .
11442 .It Ev NETRC
11443 \*(IN\*(OP This variable overrides the default location of the user's
11444 .Pa ~/.netrc
11445 file.
11448 .It Ev PAGER
11449 Pathname of the program to use for backing the command
11450 .Ic more ,
11451 and when the
11452 .Va crt
11453 variable enforces usage of a pager for output.
11454 The default paginator is
11455 .Xr more 1
11456 (path search through
11457 .Ev SHELL ) .
11459 \*(UA inspects the contents of this variable: if its contains the string
11460 .Dq less
11461 then a non-existing environment variable
11462 .Va LESS
11463 will be set to
11464 .Ql FRXi ,
11465 .Ql FRi
11467 .Ql Ri ,
11468 dependent on whether terminal control support is available and whether
11469 that supports full (alternative) screen mode or not (also see
11470 .Sx "On terminal control and line editor" ) .
11471 Likewise for
11472 .Dq lv
11473 .Va LV
11474 will optionally be set to
11475 .Dq -c .
11476 Alse see
11477 .Va colour-pager .
11480 .It Ev PATH
11481 A colon-separated list of directories that is searched by the shell when
11482 looking for commands, e.g.,
11483 .Ql /bin:/usr/bin:/usr/local/bin .
11486 .It Ev POSIXLY_CORRECT
11487 This variable is automatically looked for upon startup, see
11488 .Va posix
11489 for more.
11492 .It Ev SHELL
11493 The shell to use for the commands
11494 .Ic \&! ,
11495 .Ic shell ,
11497 .Ic ~!
11498 .Sx "COMMAND ESCAPES"
11499 and when starting subprocesses.
11500 A default shell is used if this environment variable is not defined.
11503 .It Ev SOURCE_DATE_EPOCH
11504 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
11505 used in place of the current time.
11506 This variable is looked up upon program startup, and its existence will
11507 switch \*(UA to a completely reproducible mode which causes
11508 deterministic random numbers, a special fixed (non-existent?)
11509 .Ev LOGNAME
11510 and more to be used and set.
11511 It is to be used during development or by software packagers.
11512 \*(ID Currently an invalid setting is only ignored, rather than causing
11513 a program abortion.
11515 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
11518 .It Ev TERM
11519 \*(OP The terminal type for which output is to be prepared.
11520 For extended colour and font control please refer to
11521 .Sx "Coloured display" ,
11522 and for terminal management in general to
11523 .Sx "On terminal control and line editor" .
11526 .It Ev TMPDIR
11527 Used as directory for temporary files instead of
11528 .Pa /tmp ,
11529 if set.
11530 This variable is only used when it resides in the process environment,
11531 but \*(UA will ensure at startup that this environment variable is
11532 updated to contain a usable temporary directory.
11535 .It Ev USER
11536 Identical to
11537 .Ev LOGNAME
11538 (see there), but this variable is not standardized, should therefore not
11539 be used, and is only corrected if already set.
11542 .It Ev VISUAL
11543 Pathname of the text editor to use in the
11544 .Ic visual
11545 command and
11546 .Ic ~v
11547 .Sx "COMMAND ESCAPES" .
11550 .\" }}}
11553 .\" .Sh FILES {{{
11554 .Sh FILES
11556 .\" file list {{{
11557 .Bl -tag -width ".It Pa BaNg"
11558 .It Pa \*(ur
11559 File giving initial commands, one of the
11560 .Sx "Resource files" .
11562 .It Pa \*(UR
11563 System wide initialization file, one of the
11564 .Sx "Resource files" .
11567 .It Pa ~/.mailcap
11568 \*(OP Personal MIME type handler definition file, see
11569 .Sx "The Mailcap files" .
11570 This location is part of the RFC 1524 standard search path, which is
11571 a configuration option and can be overridden via
11572 .Ev MAILCAPS .
11575 .It Pa /etc/mailcap
11576 \*(OP System wide MIME type handler definition file, see
11577 .Sx "The Mailcap files" .
11578 This location is part of the RFC 1524 standard search path, which is
11579 a configuration option and can be overridden via
11582 .It Pa ~/mbox
11583 The default value for
11584 .Ev MBOX .
11585 The actually used path is a configuration option.
11588 .It Pa ~/.mime.types
11589 Personal MIME types, see
11590 .Sx "The mime.types files" .
11591 The actually used path is a configuration option.
11594 .It Pa /etc/mime.types
11595 System wide MIME types, see
11596 .Sx "The mime.types files" .
11597 The actually used path is a configuration option.
11600 .It Pa ~/.netrc
11601 \*(IN\*(OP The default location of the users
11602 .Pa .netrc
11603 file \(en the section
11604 .Sx "The .netrc file"
11605 documents the file format.
11606 The actually used path is a configuration option and can be overridden via
11607 .Ev NETRC .
11610 .It Pa /dev/null
11611 The data sink
11612 .Xr null 4 .
11613 The actually used path is a compile-time constant.
11615 .\" }}}
11617 .\" .Ss "Resource files" {{{
11618 .Ss "Resource files"
11620 Upon startup \*(UA reads in several resource files:
11622 .Bl -tag -width ".It Pa BaNg"
11624 .It Pa \*(UR
11625 System wide initialization file.
11626 Reading of this file can be suppressed, either by using the
11627 .Fl \&:
11628 (and according argument) or
11629 .Fl n
11630 command line options, or by setting the
11631 .Sx ENVIRONMENT
11632 variable
11633 .Ev MAILX_NO_SYSTEM_RC .
11636 .It Pa \*(ur
11637 File giving initial commands.
11638 A different file can be chosen by setting the
11639 .Sx ENVIRONMENT
11640 variable
11641 .Ev MAILRC .
11642 Reading of this file can be suppressed with the
11643 .Fl \&:
11644 command line option.
11646 .It Va mailx-extra-rc
11647 Defines a startup file to be read after all other resource files.
11648 It can be used to specify settings that are not understood by other
11649 .Xr mailx 1
11650 implementations, for example.
11651 This variable is only honoured when defined in a resource file, e.g.,
11652 it is one of the
11653 .Sx "INTERNAL VARIABLES" .
11657 The content of these files is interpreted as follows:
11660 .Bl -bullet -compact
11662 The whitespace characters space, tabulator and newline,
11663 as well as those defined by the variable
11664 .Va ifs ,
11665 are removed from the beginning and end of input lines.
11667 Empty lines are ignored.
11669 Any other line is interpreted as a command.
11670 It may be spread over multiple input lines if the newline character is
11671 .Dq escaped
11672 by placing a reverse solidus character
11673 .Ql \e
11674 as the last character of the line; whereas any leading whitespace of
11675 follow lines is ignored, trailing whitespace before a escaped newline
11676 remains in the input.
11678 If the line (content) starts with the number sign
11679 .Ql #
11680 then it is a comment-command and also ignored.
11681 (The comment-command is a real command, which does nothing, and
11682 therefore the usual follow lines mechanism applies!)
11686 Unless \*(UA is about to enter interactive mode syntax errors that occur
11687 while loading these files are treated as errors and cause program exit.
11688 More files with syntactically equal content can be
11689 .Ic source Ns ed .
11690 The following, saved in a file, would be an examplary content:
11692 .Bd -literal -offset indent
11693  # This line is a comment command.  And y\e
11694     es, it is really continued here.
11695 set debug \e
11696     verbose
11697     set editheaders
11699 .\" }}}
11701 .\" .Ss "The mime.types files" {{{
11702 .Ss "The mime.types files"
11704 As stated in
11705 .Sx "HTML mail and MIME attachments"
11706 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
11707 media types in order to classify message and attachment content.
11708 One source for them are
11709 .Pa mime.types
11710 files, the loading of which can be controlled by setting the variable
11711 .Va mimetypes-load-control .
11712 Another is the command
11713 .Ic mimetype ,
11714 which also offers access to \*(UAs MIME type cache.
11715 .Pa mime.types
11716 files have the following syntax:
11718 .Bd -literal -offset indent
11719 type/subtype extension [extension ...]
11720 # E.g., text/html html htm
11724 where
11725 .Ql type/subtype
11726 define the MIME media type, as standardized in RFC 2046:
11727 .Ql type
11728 is used to declare the general type of data, while the
11729 .Ql subtype
11730 specifies a specific format for that type of data.
11731 One or multiple filename
11732 .Ql extension Ns
11733 s, separated by whitespace, can be bound to the media type format.
11734 Comments may be introduced anywhere on a line with a number sign
11735 .Ql # ,
11736 causing the remaining line to be discarded.
11738 \*(UA also supports an extended, non-portable syntax in especially
11739 crafted files, which can be loaded via the alternative value syntax of
11740 .Va mimetypes-load-control ,
11741 and prepends an optional
11742 .Ql type-marker :
11745 .Dl [type-marker ]type/subtype extension [extension ...]
11748 The following type markers are supported:
11751 .Bl -tag -compact -width ".It Ar _n_u"
11752 .It Ar @
11753 Treat message parts with this content as plain text.
11754 .It Ar @t
11755 The same as plain
11756 .Ar @ .
11757 .It Ar @h
11758 Treat message parts with this content as HTML tagsoup.
11759 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
11760 the content as plain text instead.
11761 .It Ar @H
11762 Likewise
11763 .Ar @h ,
11764 but instead of falling back to plain text require an explicit content
11765 handler to be defined.
11769 Further reading:
11770 for sending messages:
11771 .Ic mimetype ,
11772 .Va mime-allow-text-controls ,
11773 .Va mimetypes-load-control .
11774 For reading etc. messages:
11775 .Sx "HTML mail and MIME attachments" ,
11776 .Sx "The Mailcap files" ,
11777 .Ic mimetype ,
11778 .Va mime-counter-evidence ,
11779 .Va mimetypes-load-control ,
11780 .Va pipe-TYPE/SUBTYPE ,
11781 .Va pipe-EXTENSION .
11782 .\" }}}
11784 .\" .Ss "The Mailcap files" {{{
11785 .Ss "The Mailcap files"
11787 .\" TODO MAILCAP DISABLED
11788 .Sy This feature is not available in v14.9.0, sorry!
11789 RFC 1524 defines a
11790 .Dq User Agent Configuration Mechanism
11791 which \*(UA \*(OPally supports (see
11792 .Sx "HTML mail and MIME attachments" ) .
11793 It defines a file format to be used to inform mail user agent programs
11794 about the locally-installed facilities for handling various data
11795 formats, i.e., about commands and how they can be used to display, edit
11796 et cetera MIME part contents, as well as a default path search that
11797 includes multiple possible locations of
11798 .Dq mailcap
11799 files and the
11800 .Ev MAILCAPS
11801 environment variable that can be used to overwrite that (repeating here
11802 that it is not a search path, but instead a path search specification).
11803 Any existing files will be loaded in sequence, appending any content to
11804 the list of MIME type handler directives.
11807 .Dq Mailcap
11808 files consist of a set of newline separated entries.
11809 Comment lines start with a number sign
11810 .Ql #
11811 (in the first column!) and are ignored.
11812 Empty lines are also ignored.
11813 All other lines form individual entries that must adhere to the syntax
11814 described below.
11815 To extend a single entry (not comment) its line can be continued on
11816 follow lines if newline characters are
11817 .Dq escaped
11818 by preceding them with the reverse solidus character
11819 .Ql \e .
11820 The standard does not specify how leading whitespace of follow lines
11821 is to be treated, therefore \*(UA retains it.
11824 .Dq Mailcap
11825 entries consist of a number of semicolon
11826 .Ql \&;
11827 separated fields, and the reverse solidus
11828 .Ql \e
11829 character can be used to escape any following character including
11830 semicolon and itself.
11831 The first two fields are mandatory and must occur in the specified
11832 order, the remaining fields are optional and may appear in any order.
11833 Leading and trailing whitespace of content is ignored (removed).
11836 The first field defines the MIME
11837 .Ql TYPE/SUBTYPE
11838 the entry is about to handle (case-insensitively, and no reverse solidus
11839 escaping is possible in this field).
11840 If the subtype is specified as an asterisk
11841 .Ql *
11842 the entry is meant to match all subtypes of the named type, e.g.,
11843 .Ql audio/*
11844 would match any audio type.
11845 The second field defines the shell command which shall be used to
11846 .Dq display
11847 MIME parts of the given type; it is implicitly called the
11848 .Cd view
11849 command.
11852 For data
11853 .Dq consuming
11854 shell commands message (MIME part) data is passed via standard input
11855 unless the given shell command includes one or more instances of the
11856 (unquoted) string
11857 .Ql %s ,
11858 in which case these instances will be replaced with a temporary filename
11859 and the data will have been stored in the file that is being pointed to.
11860 Likewise, for data
11861 .Dq producing
11862 shell commands data is assumed to be generated on standard output unless
11863 the given command includes (one ore multiple)
11864 .Ql %s .
11865 In any case any given
11866 .Ql %s
11867 format is replaced with a(n already) properly quoted filename.
11868 Note that when a command makes use of a temporary file via
11869 .Ql %s
11870 then \*(UA will remove it again, as if the
11871 .Cd x-mailx-tmpfile ,
11872 .Cd x-mailx-tmpfile-fill
11874 .Cd x-mailx-tmpfile-unlink
11875 flags had been set; see below for more.
11878 The optional fields either define a shell command or an attribute (flag)
11879 value, the latter being a single word and the former being a keyword
11880 naming the field followed by an equals sign
11881 .Ql =
11882 succeeded by a shell command, and as usual for any
11883 .Dq Mailcap
11884 content any whitespace surrounding the equals sign will be removed, too.
11885 Optional fields include the following:
11888 .Bl -tag -width ".It Cd BaNg"
11889 .It Cd compose
11890 A program that can be used to compose a new body or body part in the
11891 given format.
11892 (Currently unused.)
11894 .It Cd composetyped
11895 Similar to the
11896 .Cd compose
11897 field, but is to be used when the composing program needs to specify the
11898 .Ql Content-type:
11899 header field to be applied to the composed data.
11900 (Currently unused.)
11902 .It Cd edit
11903 A program that can be used to edit a body or body part in the given
11904 format.
11905 (Currently unused.)
11907 .It Cd print
11908 A program that can be used to print a message or body part in the given
11909 format.
11910 (Currently unused.)
11912 .It Cd test
11913 Specifies a program to be run to test some condition, e.g., the machine
11914 architecture, or the window system in use, to determine whether or not
11915 this mailcap entry applies.
11916 If the test fails, a subsequent mailcap entry should be sought; also see
11917 .Cd x-mailx-test-once .
11920 .It Cd needsterminal
11921 This flag field indicates that the given shell command must be run on
11922 an interactive terminal.
11923 \*(UA will temporarily release the terminal to the given command in
11924 interactive mode, in non-interactive mode this entry will be entirely
11925 ignored; this flag implies
11926 .Cd x-mailx-noquote .
11929 .It Cd copiousoutput
11930 A flag field which indicates that the output of the
11931 .Cd view
11932 command will be an extended stream of textual output that can be
11933 (re)integrated into \*(UA's normal visual display.
11934 It is mutually exclusive with
11935 .Cd needsterminal .
11937 .It Cd textualnewlines
11938 A flag field which indicates that this type of data is line-oriented and
11939 that, if encoded in
11940 .Ql base64 ,
11941 all newlines should be converted to canonical form (CRLF) before
11942 encoding, and will be in that form after decoding.
11943 (Currently unused.)
11945 .It Cd nametemplate
11946 This field gives a filename format, in which
11947 .Ql %s
11948 will be replaced by a random string, the joined combination of which
11949 will be used as the filename denoted by
11950 .Ev MAILX_FILENAME_TEMPORARY .
11951 One could specify that a GIF file being passed to an image viewer should
11952 have a name ending in
11953 .Ql .gif
11954 by using
11955 .Ql nametemplate=%s.gif .
11956 Note that \*(UA ignores the name template unless that solely specifies
11957 a filename suffix that consists of (ASCII) alphabetic and numeric
11958 characters, the underscore and dot only.
11960 .It Cd x11-bitmap
11961 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
11962 icon to be used to visually denote the presence of this kind of data.
11963 This field is not used by \*(UA.
11965 .It Cd description
11966 A textual description that describes this type of data.
11969 .It Cd x-mailx-even-if-not-interactive
11970 An extension flag test field \(em by default handlers without
11971 .Cd copiousoutput
11972 are entirely ignored in non-interactive mode, but if this flag is set
11973 then their use will be considered.
11974 It is an error if this flag is set for commands that use the flag
11975 .Cd needsterminal .
11978 .It Cd x-mailx-noquote
11979 An extension flag field that indicates that even a
11980 .Cd copiousoutput
11981 .Cd view
11982 command shall not be used to generate message quotes
11983 (as it would be by default).
11986 .It Cd x-mailx-async
11987 Extension flag field that denotes that the given
11988 .Cd view
11989 command shall be executed asynchronously, without blocking \*(UA.
11990 Cannot be used in conjunction with
11991 .Cd needsterminal .
11994 .It Cd x-mailx-test-once
11995 Extension flag which denotes whether the given
11996 .Cd test
11997 command shall be evaluated once only and the (boolean) result be cached.
11998 This is handy if some global unchanging condition is to be queried, like
11999 .Dq running under the X Window System .
12002 .It Cd x-mailx-tmpfile
12003 Extension flag field that requests creation of a zero-sized temporary
12004 file, the name of which is to be placed in the environment variable
12005 .Ev MAILX_FILENAME_TEMPORARY .
12006 It is an error to use this flag with commands that include a
12007 .Ql %s
12008 format.
12011 .It Cd x-mailx-tmpfile-fill
12012 Normally the MIME part content is passed to the handler via standard
12013 input; if this flag is set then the data will instead be written into
12014 the implied
12015 .Cd x-mailx-tmpfile .
12016 In order to cause deletion of the temporary file you will have to set
12017 .Cd x-mailx-tmpfile-unlink
12018 explicitly!
12019 It is an error to use this flag with commands that include a
12020 .Ql %s
12021 format.
12024 .It Cd x-mailx-tmpfile-unlink
12025 Extension flag field that requests that the temporary file shall be
12026 deleted automatically when the command loop is entered again at latest.
12027 (Do not use this for asynchronous handlers.)
12028 It is an error to use this flag with commands that include a
12029 .Ql %s
12030 format, or in conjunction with
12031 .Cd x-mailx-async ,
12032 or without also setting
12033 .Cd x-mailx-tmpfile
12035 .Cd x-mailx-tmpfile-fill .
12038 .It Cd x-mailx-tmpfile-keep
12039 Using the string
12040 .Ql %s
12041 implies the three tmpfile related flags above, but if you want, e.g.,
12042 .Cd x-mailx-async
12043 and deal with the temporary file yourself, you can add in this flag to
12044 forcefully ignore
12045 .Cd x-mailx-tmpfile-unlink .
12050 The standard includes the possibility to define any number of additional
12051 entry fields, prefixed by
12052 .Ql x- .
12053 Flag fields apply to the entire
12054 .Dq Mailcap
12055 entry \(em in some unusual cases, this may not be desirable, but
12056 differentiation can be accomplished via separate entries, taking
12057 advantage of the fact that subsequent entries are searched if an earlier
12058 one does not provide enough information.
12059 E.g., if a
12060 .Cd view
12061 command needs to specify the
12062 .Cd needsterminal
12063 flag, but the
12064 .Cd compose
12065 command shall not, the following will help out the latter (with enabled
12066 .Va debug
12067 or an increased
12068 .Va verbose
12069 level \*(UA will show information about handler evaluation):
12071 .Bd -literal -offset indent
12072 application/postscript; ps-to-terminal %s; needsterminal
12073 application/postscript; ps-to-terminal %s; compose=idraw %s
12077 In fields any occurrence of the format string
12078 .Ql %t
12079 will be replaced by the
12080 .Ql TYPE/SUBTYPE
12081 specification.
12082 Named parameters from the
12083 .Ql Content-type:
12084 field may be placed in the command execution line using
12085 .Ql %{
12086 followed by the parameter name and a closing
12087 .Ql }
12088 character.
12089 The entire parameter should appear as a single command line argument,
12090 regardless of embedded spaces; thus:
12092 .Bd -literal -offset indent
12093 # Message
12094 Content-type:  multipart/mixed; boundary=42
12096 # Mailcap file
12097 multipart/*; /usr/local/bin/showmulti \e
12098   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
12100 # Executed shell command
12101 /usr/local/bin/showmulti multipart/mixed 42
12105 .\" TODO v15: Mailcap: %n,%F
12106 Note that \*(UA does not support handlers for multipart MIME parts as
12107 shown in this example (as of today).
12108 \*(UA does not support the additional formats
12109 .Ql %n
12111 .Ql %F .
12112 An example file, also showing how to properly deal with the expansion of
12113 .Ql %s ,
12114 which includes any quotes that are necessary to make it a valid shell
12115 argument by itself and thus will cause undesired behaviour when placed
12116 in additional user-provided quotes:
12118 .Bd -literal -offset indent
12119 # Comment line
12120 text/richtext; richtext %s; copiousoutput
12122 text/x-perl; perl -cWT %s
12124 application/pdf; \e
12125   infile=%s\e; \e
12126     trap "rm -f ${infile}" EXIT\e; \e
12127     trap "exit 75" INT QUIT TERM\e; \e
12128     mupdf %s; \e
12129   x-mailx-async; x-mailx-tmpfile-keep
12131 application/*; echo "This is \e"%t\e" but \e
12132     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
12133   copiousoutput; x-mailx-noquote
12137 Further reading:
12138 .Sx "HTML mail and MIME attachments" ,
12139 .Sx "The mime.types files" ,
12140 .Ic mimetype ,
12141 .Ev MAILCAPS ,
12142 .Va mime-counter-evidence ,
12143 .Va pipe-TYPE/SUBTYPE ,
12144 .Va pipe-EXTENSION .
12145 .\" }}}
12147 .\" .Ss "The .netrc file" {{{
12148 .Ss "The .netrc file"
12151 .Pa .netrc
12152 file contains user credentials for machine accounts.
12153 The default location in the user's
12154 .Ev HOME
12155 directory may be overridden by the
12156 .Ev NETRC
12157 environment variable.
12158 The file consists of space, tabulator or newline separated tokens.
12159 \*(UA implements a parser that supports a superset of the original BSD
12160 syntax, but users should nonetheless be aware of portability glitches
12161 of that file format, shall their
12162 .Pa .netrc
12163 be usable across multiple programs and platforms:
12166 .Bl -bullet -compact
12168 BSD does not support single, but only double quotation marks, e.g.,
12169 .Ql password="pass with spaces" .
12171 BSD (only?) supports escaping of single characters via a reverse solidus
12172 (e.g., a space can be escaped via
12173 .Ql \e\0 ) ,
12174 in- as well as outside of a quoted string.
12176 BSD does not require a final quotation mark of the last user input token.
12178 The original BSD (Berknet) parser also supported a format which allowed
12179 tokens to be separated with commas \(en whereas at least Hewlett-Packard
12180 still seems to support this syntax, \*(UA does not!
12182 As a non-portable extension some widely-used programs support
12183 shell-style comments: if an input line starts, after any amount of
12184 whitespace, with a number sign
12185 .Ql # ,
12186 then the rest of the line is ignored.
12188 Whereas other programs may require that the
12189 .Pa .netrc
12190 file is accessible by only the user if it contains a
12191 .Cd password
12192 token for any other
12193 .Cd login
12194 than
12195 .Dq anonymous ,
12196 \*(UA will always require these strict permissions.
12200 Of the following list of supported tokens \*(UA only uses (and caches)
12201 .Cd machine ,
12202 .Cd login
12204 .Cd password .
12205 At runtime the command
12206 .Ic netrc
12207 can be used to control \*(UA's
12208 .Pa .netrc
12209 cache.
12211 .Bl -tag -width ".It Cd BaNg"
12212 .It Cd machine Ar name
12213 The hostname of the entries' machine, lowercase-normalized by \*(UA
12214 before use.
12215 Any further file content, until either end-of-file or the occurrence
12216 of another
12217 .Cd machine
12218 or a
12219 .Cd default
12220 first-class token is bound (only related) to the machine
12221 .Ar name .
12223 As an extension that should not be the cause of any worries
12224 \*(UA supports a single wildcard prefix for
12225 .Ar name :
12226 .Bd -literal -offset indent
12227 machine *.example.com login USER password PASS
12228 machine pop3.example.com login USER password PASS
12229 machine smtp.example.com login USER password PASS
12232 which would match
12233 .Ql xy.example.com
12234 as well as
12235 .Ql pop3.example.com ,
12236 but neither
12237 .Ql example.com
12239 .Ql local.smtp.example.com .
12240 Note that in the example neither
12241 .Ql pop3.example.com
12243 .Ql smtp.example.com
12244 will be matched by the wildcard, since the exact matches take
12245 precedence (it is however faster to specify it the other way around).
12247 .It Cd default
12248 This is the same as
12249 .Cd machine
12250 except that it is a fallback entry that is used shall none of the
12251 specified machines match; only one default token may be specified,
12252 and it must be the last first-class token.
12254 .It Cd login Ar name
12255 The user name on the remote machine.
12257 .It Cd password Ar string
12258 The user's password on the remote machine.
12260 .It Cd account Ar string
12261 Supply an additional account password.
12262 This is merely for FTP purposes.
12264 .It Cd macdef Ar name
12265 Define a macro.
12266 A macro is defined with the specified
12267 .Ar name ;
12268 it is formed from all lines beginning with the next line and continuing
12269 until a blank line is (consecutive newline characters are) encountered.
12270 (Note that
12271 .Cd macdef
12272 entries cannot be utilized by multiple machines, too, but must be
12273 defined following the
12274 .Ic machine
12275 they are intended to be used with.)
12276 If a macro named
12277 .Ar init
12278 exists, it is automatically run as the last step of the login process.
12279 This is merely for FTP purposes.
12281 .\" }}}
12283 .\" }}}
12286 .\" .Sh EXAMPLES {{{
12287 .Sh EXAMPLES
12289 .\" .Ss "An example configuration" {{{
12290 .Ss "An example configuration"
12292 .Bd -literal -offset indent
12293 # This example assumes v15.0 compatibility mode
12294 set v15-compat
12296 # Request strict transport security checks!
12297 set ssl-verify=strict
12299 # Where are the up-to-date SSL certificates?
12300 # (Since we manage up-to-date ones explicitly, do not use any,
12301 # possibly outdated, default certificates shipped with OpenSSL)
12302 #set ssl-ca-dir=/etc/ssl/certs
12303 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
12304 set ssl-ca-no-defaults
12305 #set ssl-ca-flags=partial-chain
12306 wysh set smime-ca-file="${ssl-ca-file}" \e
12307   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
12309 # Do not use protocols older than TLS v1.2.
12310 # Change this only when the remote server does not support it:
12311 # maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
12312 # such explicit exceptions, then, e.g.
12313 #   set ssl-protocol-exam.ple='-ALL,+TLSv1.1'
12314 set ssl-protocol='-ALL,+TLSv1.2'
12316 # Explicitly define the list of ciphers, which may improve security,
12317 # especially with protocols older than TLS v1.2.  See ciphers(1).
12318 # Including "@STRENGTH" will sort the final list by algorithm strength.
12319 # In reality it is possibly best to only use ssl-cipher-list-HOST
12320 # (or -USER@HOST), as necessary, again..
12321 set ssl-cipher-list=TLSv1.2:!aNULL:!eNULL:@STRENGTH
12322 # - TLSv1.2:!aNULL:!eNULL:\e
12323 #     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
12324 #     DHE-RSA-AES256-SHA:@STRENGTH
12325 # -ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH
12326 # Especially with TLSv1.3 curves selection may be desired:
12327 #set ssl-curves=P-521:P-384:P-256
12329 # Essential setting: select allowed character sets
12330 set sendcharsets=utf-8,iso-8859-1
12332 # A very kind option: when replying to a message, first try to
12333 # use the same encoding that the original poster used herself!
12334 set reply-in-same-charset
12336 # When replying, do not merge From: and To: of the original message
12337 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
12338 set recipients-in-cc
12340 # When sending messages, wait until the Mail-Transfer-Agent finishs.
12341 # Only like this you will be able to see errors reported through the
12342 # exit status of the MTA (including the built-in SMTP one)!
12343 set sendwait
12345 # Only use built-in MIME types, no mime.types(5) files
12346 set mimetypes-load-control
12348 # Default directory where we act in (relative to $HOME)
12349 set folder=mail
12350 # A leading "+" (often) means: under *folder*
12351 # *record* is used to save copies of sent messages
12352 set MBOX=+mbox.mbox DEAD=+dead.txt \e
12353   record=+sent.mbox record-files record-resent
12355 # Make "file mymbox" and "file myrec" go to..
12356 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
12358 # Not really optional, e.g., for S/MIME
12359 set from='Your Name <address@exam.ple>'
12361 # It may be necessary to set hostname and/or smtp-hostname
12362 # if the "SERVER" of mta and "domain" of from do not match.
12363 # The `urlencode' command can be used to encode USER and PASS
12364 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
12365   smtp-auth=login/plain... \e
12366   smtp-use-starttls
12368 # Never refuse to start into interactive mode, and more
12369 set emptystart \e
12370   colour-pager crt= \e
12371   followup-to followup-to-honour=ask-yes \e
12372   history-file=+.\*(uAhist history-size=-1 history-gabby \e
12373   mime-counter-evidence=0xE \e
12374   prompt='?\e?!\e![\e${account}#\e${mailbox-display}]? ' \e
12375   reply-to-honour=ask-yes \e
12376   umask=
12378 # Only include the selected header fields when typing messages
12379 headerpick type retain from_ date from to cc subject \e
12380   message-id mail-followup-to reply-to
12381 # ...when forwarding messages
12382 headerpick forward retain subject date from to cc
12383 # ...when saving message, etc.
12384 #headerpick save ignore ^Original-.*$ ^X-.*$
12386 # Some mailing lists
12387 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
12388 mlsubscribe '^xfans@xfans\e.xyz$'
12390 # Handle a few file extensions (to store MBOX databases)
12391 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
12392   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
12393   zst 'zstd -dc' 'zstd -19 -zc' \e
12394   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
12396 # A real life example of a very huge free mail provider
12397 # Instead of directly placing content inside `account',
12398 # we `define' a macro: like that we can switch "accounts"
12399 # from within *on-compose-splice*, for example!
12400 define XooglX {
12401   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
12402   set from='Your Name <address@examp.ple>'
12403   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
12405 account XooglX {
12406   \ecall XooglX
12409 # Here is a pretty large one which does not allow sending mails
12410 # if there is a domain name mismatch on the SMTP protocol level,
12411 # which would bite us if the value of from does not match, e.g.,
12412 # for people who have a sXXXXeforge project and want to speak
12413 # with the mailing list under their project account (in from),
12414 # still sending the message through their normal mail provider
12415 define XandeX {
12416   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12417   set from='Your Name <address@exam.ple>'
12418   set mta=smtps://USER:PASS@smtp.yaXXex.ru:465 \e
12419     hostname=yaXXex.com smtp-hostname=
12421 account XandeX {
12422   \ecall Xandex
12425 # Create some new commands so that, e.g., `ls /tmp' will..
12426 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
12427 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
12429 # We do not support gpg(1) directly yet.  But simple --clearsign'd
12430 # message parts can be dealt with as follows:
12431 define V {
12432   localopts yes
12433   wysh set pipe-text/plain=$'@*#++=@\e
12434     < "${MAILX_FILENAME_TEMPORARY}" awk \e
12435         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
12436       BEGIN{done=0}\e
12437       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
12438         if(done++ != 0)\e
12439           next;\e
12440         print "--- GPG --verify ---";\e
12441         system("gpg --verify " TMPFILE " 2>&1");\e
12442         print "--- GPG --verify ---";\e
12443         print "";\e
12444         next;\e
12445       }\e
12446       /^-----BEGIN PGP SIGNATURE-----/,\e
12447           /^-----END PGP SIGNATURE-----/{\e
12448         next;\e
12449       }\e
12450       {print}\e
12451     \e''
12452     print
12454 commandalias V '\e'call V
12458 When storing passwords in
12459 .Pa \*(ur
12460 appropriate permissions should be set on this file with
12461 .Ql $ chmod 0600 \*(ur .
12462 If the \*(OPal
12463 .Va netrc-lookup
12464 is available user credentials can be stored in the central
12465 .Pa .netrc
12466 file instead; e.g., here is a different version of the example account
12467 that sets up SMTP and POP3:
12469 .Bd -literal -offset indent
12470 define XandeX {
12471   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12472   set from='Your Name <address@exam.ple>'
12473   set netrc-lookup
12474   # Load an encrypted ~/.netrc by uncommenting the next line
12475   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
12477   set mta=smtps://smtp.yXXXXx.ru:465 \e
12478       smtp-hostname= hostname=yXXXXx.com
12479   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
12480   commandalias xp fi pop3s://pop.yXXXXx.ru
12482 account XandeX {
12483   \ecall XandeX
12488 and, in the
12489 .Pa .netrc
12490 file:
12492 .Bd -literal -offset indent
12493 machine *.yXXXXx.ru login USER password PASS
12497 This configuration should now work just fine:
12500 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
12501 .\" }}}
12503 .\" .Ss "S/MIME step by step" {{{
12504 .Ss "S/MIME step by step"
12506 \*(OP The first thing you need for participating in S/MIME message
12507 exchange is your personal certificate, including a private key.
12508 The certificate contains public information, in particular your name and
12509 your email address(es), and the public key that is used by others to
12510 encrypt messages for you,
12511 and to verify signed messages they supposedly received from you.
12512 The certificate is included in each signed message you send.
12513 The private key must be kept secret.
12514 It is used to decrypt messages that were previously encrypted with your
12515 public key, and to sign messages.
12518 For personal use it is recommended that you get a S/MIME certificate
12519 from one of the major CAs on the Internet using your WWW browser.
12520 Many CAs offer such certificates for free.
12521 There is also
12522 .Lk https://www.CAcert.org
12523 which issues client and server certificates to members of their
12524 community for free; their root certificate
12525 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
12526 is often not in the default set of trusted CA root certificates, though,
12527 which means you will have to download their root certificate separately
12528 and ensure it is part of our S/MIME certificate validation chain by
12529 including it in
12530 .Va smime-ca-dir
12531 or as a vivid member of the
12532 .Va smime-ca-file .
12533 But let us take a step-by-step tour on how to setup S/MIME with
12534 a certificate from CAcert.org despite this situation!
12537 First of all you will have to become a member of the CAcert.org
12538 community, simply by registrating yourself via the web interface.
12539 Once you are, create and verify all email addresses you want to be able
12540 to create signed and encrypted messages for/with using the corresponding
12541 entries of the web interface.
12542 Now ready to create S/MIME certificates, so let us create a new
12543 .Dq client certificate ,
12544 ensure to include all email addresses that should be covered by the
12545 certificate in the following web form, and also to use your name as the
12546 .Dq common name .
12549 Create a private key and a certificate request on your local computer
12550 (please see the manual pages of the used commands for more in-depth
12551 knowledge on what the used arguments etc. do):
12554 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
12557 Afterwards copy-and-paste the content of
12558 .Dq creq.pem
12559 into the certificate-request (CSR) field of the web form on the
12560 CAcert.org website (you may need to unfold some
12561 .Dq advanced options
12562 to see the corresponding text field).
12563 This last step will ensure that your private key (which never left your
12564 box) and the certificate belong together (through the public key that
12565 will find its way into the certificate via the certificate-request).
12566 You are now ready and can create your CAcert certified certificate.
12567 Download and store or copy-and-paste it as
12568 .Dq pub.crt .
12571 Yay.
12572 In order to use your new S/MIME setup a combined private key/public key
12573 (certificate) file has to be created:
12576 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
12579 This is the file \*(UA will work with.
12580 If you have created your private key with a passphrase then \*(UA will
12581 ask you for it whenever a message is signed or decrypted.
12582 Set the following variables to henceforth use S/MIME (setting
12583 .Va smime-ca-file
12584 is of interest for verification only):
12586 .Bd -literal -offset indent
12587 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
12588     smime-sign-cert=ME@HERE.com.paired \e
12589     smime-sign-message-digest=SHA256 \e
12590     smime-sign
12593 .\" }}}
12595 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
12596 .Ss "Using CRLs with S/MIME or SSL/TLS"
12598 \*(OP Certification authorities (CAs) issue certificate revocation
12599 lists (CRLs) on a regular basis.
12600 These lists contain the serial numbers of certificates that have been
12601 declared invalid after they have been issued.
12602 Such usually happens because the private key for the certificate has
12603 been compromised,
12604 because the owner of the certificate has left the organization that is
12605 mentioned in the certificate, etc.
12606 To seriously use S/MIME or SSL/TLS verification,
12607 an up-to-date CRL is required for each trusted CA.
12608 There is otherwise no method to distinguish between valid and
12609 invalidated certificates.
12610 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
12611 the Internet, so they have to be retrieved by some external mechanism.
12614 \*(UA accepts CRLs in PEM format only;
12615 CRLs in DER format must be converted, like, e.\|g.:
12618 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
12621 To tell \*(UA about the CRLs, a directory that contains all CRL files
12622 (and no other files) must be created.
12624 .Va smime-crl-dir
12626 .Va ssl-crl-dir
12627 variables, respectively, must then be set to point to that directory.
12628 After that, \*(UA requires a CRL to be present for each CA that is used
12629 to verify a certificate.
12630 .\" }}}
12632 .\" }}} (Examples)
12635 .\" .Sh "FAQ" {{{
12636 .Sh "FAQ"
12638 In general it is a good idea to turn on
12639 .Va debug
12640 .Pf ( Fl d )
12641 and / or
12642 .Va verbose
12643 .Pf ( Fl v ,
12644 twice) if something does not work well.
12645 Very often a diagnostic message can be produced that leads to the
12646 problems' solution.
12648 .\" .Ss "\*(UA shortly hangs on startup" {{{
12649 .Ss "\*(UA shortly hangs on startup"
12651 This can have two reasons, one is the necessity to wait for a file lock
12652 and cannot be helped, the other being that \*(UA calls the function
12653 .Xr uname 2
12654 in order to query the nodename of the box (sometimes the real one is
12655 needed instead of the one represented by the internal variable
12656 .Va hostname ) .
12657 One may have varying success by ensuring that the real hostname and
12658 .Ql localhost
12659 have entries in
12660 .Pa /etc/hosts ,
12661 or, more generally, that the name service is properly setup \(en
12662 and does
12663 .Xr hostname 1
12664 return the expected value?
12665 Does this local hostname have a domain suffix?
12666 RFC 6762 standardized the link-local top-level domain
12667 .Ql .local ,
12668 try again after adding an (additional) entry with this extension.
12669 .\" }}}
12671 .\" .Ss "I cannot login to Google mail aka GMail" {{{
12672 .Ss "I cannot login to Google mail aka GMail"
12674 Since 2014 some free service providers classify programs as
12675 .Dq less secure
12676 unless they use a special authentification method (OAuth 2.0) which
12677 was not standardized for non-HTTP protocol authentication token query
12678 until August 2015 (RFC 7628).
12681 Different to Kerberos / GSSAPI, which is developed since the mid of the
12682 1980s, where a user can easily create a local authentication ticket for
12683 her- and himself with the locally installed
12684 .Xr kinit 1
12685 program, that protocol has no such local part but instead requires
12686 a world-wide-web query to create or fetch a token; since there is no
12687 local cache this query would have to be performed whenever \*(UA is
12688 invoked (in interactive sessions situation may differ).
12691 \*(UA does not support OAuth.
12692 Because of this it is necessary to declare \*(UA a
12693 .Dq less secure app
12694 (on the providers account web page) in order to read and send mail.
12695 However, it also seems possible to take the following steps instead:
12698 .Bl -enum -compact
12700 give the provider the number of a mobile phone,
12702 enable
12703 .Dq 2-Step Verification ,
12705 create an application specific password (16 characters), and
12707 use that special password instead of the real Google account password in
12708 \*(UA (for more on that see the section
12709 .Sx "On URL syntax and credential lookup" ) .
12711 .\" }}}
12713 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
12714 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
12716 It can happen that the terminal library (see
12717 .Sx "On terminal control and line editor",
12718 .Ic bind ,
12719 .Va termcap )
12720 reports different codes than the terminal really sends, in which case
12721 \*(UA will tell that a key binding is functional, but will not be able to
12722 recognize it because the received data does not match anything expected.
12723 Especially without the \*(OPal terminal capability library support one
12724 reason for this may be that the (possibly even non-existing) keypad
12725 is not turned on and the resulting layout reports the keypad control
12726 codes for the normal keyboard keys.
12728 .Va verbose
12729 listing of
12730 .Ic bind Ns
12731 ings will show the byte sequences that are expected.
12734 To overcome the situation, use, e.g., the program
12735 .Xr cat 1 ,
12736 in conjunction with the command line option
12737 .Fl \&\&v ,
12738 if available, to see the byte sequences which are actually produced
12739 by keypresses, and use the variable
12740 .Va termcap
12741 to make \*(UA aware of them.
12742 E.g., the terminal this is typed on produces some false sequences, here
12743 an example showing the shifted home key:
12745 .Bd -literal -offset indent
12746 ? set verbose
12747 ? bind*
12748 # 1B 5B=[ 31=1 3B=; 32=2 48=H
12749   bind base :kHOM z0
12750 ? x
12751 $ cat -v
12752 ^[[H
12753 ? \*(uA -v -Stermcap='kHOM=\eE[H'
12754 ? bind*
12755 # 1B 5B=[ 48=H
12756   bind base :kHOM z0
12758 .\" }}}
12760 .\" }}}
12763 .\" .Sh "IMAP CLIENT" {{{
12764 .Sh "IMAP CLIENT"
12766 \*(OPally there is IMAP client support available.
12767 This part of the program is obsolete and will vanish in v15 with the
12768 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
12769 and makes excessive use of signal based long code jumps.
12770 Support can hopefully be readded later based on a new-style I/O, with
12771 SysV signal handling.
12772 In fact the IMAP support had already been removed from the codebase, but
12773 was reinstantiated on user demand: in effect the IMAP code is at the
12774 level of \*(UA v14.8.16 (with
12775 .Ic imapcodec
12776 being the sole exception), and should be treated with some care.
12779 IMAP uses the
12780 .Ql imap://
12782 .Ql imaps://
12783 protocol prefixes, and an IMAP-based
12784 .Va folder
12785 may be used.
12786 IMAP URLs (paths) undergo inspections and possible transformations
12787 before use (and the command
12788 .Ic imapcodec
12789 can be used to manually apply them to any given argument).
12790 Hierarchy delimiters are normalized, a step which is configurable via the
12791 .Va imap-delim
12792 variable chain, but defaults to the first seen delimiter otherwise.
12793 \*(UA supports internationalised IMAP names, and en- and decodes the
12794 names from and to the
12795 .Va ttycharset
12796 as necessary and possible.
12797 If a mailbox name is expanded (see
12798 .Sx "Filename transformations" )
12799 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
12800 mailboxes below the
12801 .Va folder
12802 target box, while folder names prefixed by `@' refer to folders below
12803 the hierarchy base.
12806 Note: some IMAP servers do not accept the creation of mailboxes in
12807 the hierarchy base, but require that they are created as subfolders of
12808 `INBOX' \(en with such servers a folder name of the form
12810 .Dl imaps://mylogin@imap.myisp.example/INBOX.
12812 should be used (the last character is the server's hierarchy
12813 delimiter).
12814 The following IMAP-specific commands exist:
12817 .Bl -tag -width ".It Ic BaNg"
12819 .It Ic cache
12820 Only applicable to cached IMAP mailboxes;
12821 takes a message list and reads the specified messages into the IMAP
12822 cache.
12825 .It Ic connect
12826 If operating in disconnected mode on an IMAP mailbox,
12827 switch to online mode and connect to the mail server while retaining
12828 the mailbox status.
12829 See the description of the
12830 .Va disconnected
12831 variable for more information.
12834 .It Ic disconnect
12835 If operating in online mode on an IMAP mailbox,
12836 switch to disconnected mode while retaining the mailbox status.
12837 See the description of the
12838 .Va disconnected
12839 variable for more.
12840 A list of messages may optionally be given as argument;
12841 the respective messages are then read into the cache before the
12842 connection is closed, thus
12843 .Ql disco *
12844 makes the entire mailbox available for disconnected use.
12847 .It Ic imap
12848 Sends command strings directly to the current IMAP server.
12849 \*(UA operates always in IMAP `selected state' on the current mailbox;
12850 commands that change this will produce undesirable results and should be
12851 avoided.
12852 Useful IMAP commands are:
12853 .Bl -tag -offset indent -width ".Ic getquotearoot"
12854 .It create
12855 Takes the name of an IMAP mailbox as an argument and creates it.
12856 .It getquotaroot
12857 (RFC 2087) Takes the name of an IMAP mailbox as an argument
12858 and prints the quotas that apply to the mailbox.
12859 Not all IMAP servers support this command.
12860 .It namespace
12861 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
12862 the Other User's Namespaces and the Shared Namespaces.
12863 Each namespace type is printed in parentheses;
12864 if there are multiple namespaces of the same type,
12865 inner parentheses separate them.
12866 For each namespace a prefix and a hierarchy separator is listed.
12867 Not all IMAP servers support this command.
12871 .It Ic imapcodec
12872 Perform IMAP path transformations.
12873 Supports
12874 .Cm vput
12875 (see
12876 .Sx "Command modifiers" ) ,
12877 and manages the error number
12878 .Va \&! .
12879 The first argument specifies the operation:
12880 .Ar e[ncode]
12881 normalizes hierarchy delimiters (see
12882 .Va imap-delim )
12883 and converts the strings from the locale
12884 .Va ttycharset
12885 to the internationalized variant used by IMAP,
12886 .Ar d[ecode]
12887 performs the reverse operation.
12892 The following IMAP-specific internal variables exist:
12895 .Bl -tag -width ".It Va BaNg"
12897 .It Va disconnected
12898 \*(BO When an IMAP mailbox is selected and this variable is set,
12899 no connection to the server is initiated.
12900 Instead, data is obtained from the local cache (see
12901 .Va imap-cache Ns
12903 Mailboxes that are not present in the cache
12904 and messages that have not yet entirely been fetched from the server
12905 are not available;
12906 to fetch all messages in a mailbox at once,
12907 the command
12908 .No ` Ns Li copy * /dev/null Ns '
12909 can be used while still in connected mode.
12910 Changes that are made to IMAP mailboxes in disconnected mode are queued
12911 and committed later when a connection to that server is made.
12912 This procedure is not completely reliable since it cannot be guaranteed
12913 that the IMAP unique identifiers (UIDs) on the server still match the
12914 ones in the cache at that time.
12915 Data is saved to
12916 .Ev DEAD
12917 when this problem occurs.
12919 .It Va disconnected-USER@HOST
12920 The specified account is handled as described for the
12921 .Va disconnected
12922 variable above,
12923 but other accounts are not affected.
12925 .Mx Va imap-auth
12926 .It Va imap-auth-USER@HOST , imap-auth
12927 Sets the IMAP authentication method.
12928 Valid values are `login' for the usual password-based authentication
12929 (the default),
12930 `cram-md5', which is a password-based authentication that does not send
12931 the password over the network in clear text,
12932 and `gssapi' for GSS-API based authentication.
12935 .It Va imap-cache
12936 Enables caching of IMAP mailboxes.
12937 The value of this variable must point to a directory that is either
12938 existent or can be created by \*(UA.
12939 All contents of the cache can be deleted by \*(UA at any time;
12940 it is not safe to make assumptions about them.
12942 .Mx Va imap-delim
12943 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
12944 The hierarchy separator used by the IMAP server.
12945 Whenever an IMAP path is specified it will undergo normalization.
12946 One of the normalization steps is the squeezing and adjustment of
12947 hierarchy separators.
12948 If this variable is set, any occurrence of any character of the given
12949 value that exists in the path will be replaced by the first member of
12950 the value; an empty value will cause the default to be used, it is
12951 .Ql /. .
12952 If not set, we will reuse the first hierarchy separator character that
12953 is discovered in a user-given mailbox name.
12955 .Mx Va imap-keepalive
12956 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
12957 IMAP servers may close the connection after a period of
12958 inactivity; the standard requires this to be at least 30 minutes,
12959 but practical experience may vary.
12960 Setting this variable to a numeric `value' greater than 0 causes
12961 a `NOOP' command to be sent each `value' seconds if no other operation
12962 is performed.
12965 .It Va imap-list-depth
12966 When retrieving the list of folders on an IMAP server, the
12967 .Ic folders
12968 command stops after it has reached a certain depth to avoid possible
12969 infinite loops.
12970 The value of this variable sets the maximum depth allowed.
12971 The default is 2.
12972 If the folder separator on the current IMAP server is a slash `/',
12973 this variable has no effect and the
12974 .Ic folders
12975 command does not descend to subfolders.
12977 .Mx Va imap-use-starttls
12978 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
12979 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
12980 IMAP session SSL/TLS encrypted.
12981 This functionality is not supported by all servers,
12982 and is not used if the session is already encrypted by the IMAPS method.
12985 .\" }}}
12988 .\" .Sh "SEE ALSO" {{{
12989 .Sh "SEE ALSO"
12991 .Xr bogofilter 1 ,
12992 .Xr gpg 1 ,
12993 .Xr more 1 ,
12994 .Xr newaliases 1 ,
12995 .Xr openssl 1 ,
12996 .Xr sendmail 1 ,
12997 .Xr sh 1 ,
12998 .Xr spamassassin 1 ,
12999 .Xr iconv 3 ,
13000 .Xr setlocale 3 ,
13001 .Xr aliases 5 ,
13002 .Xr termcap 5 ,
13003 .Xr terminfo 5 ,
13004 .Xr locale 7 ,
13005 .Xr mailaddr 7 ,
13006 .Xr re_format 7 ,
13007 .Xr mailwrapper 8 ,
13008 .Xr sendmail 8
13010 .\" }}}
13013 .\" .Sh HISTORY {{{
13014 .Sh HISTORY
13016 M. Douglas McIlroy writes in his article
13017 .Dq A Research UNIX Reader: Annotated Excerpts \
13018 from the Programmer's Manual, 1971-1986
13019 that a
13020 .Xr mail 1
13021 command already appeared in First Edition
13023 in 1971:
13025 .Bd -ragged -offset indent
13026 Electronic mail was there from the start.
13027 Never satisfied with its exact behavior, everybody touched it at one
13028 time or another: to assure the safety of simultaneous access, to improve
13029 privacy, to survive crashes, to exploit uucp, to screen out foreign
13030 freeloaders, or whatever.
13031 Not until v7 did the interface change (Thompson).
13032 Later, as mail became global in its reach, Dave Presotto took charge and
13033 brought order to communications with a grab-bag of external networks
13034 (v8).
13039 Mail was written in 1978 by Kurt Shoens and developed as part of the
13042 distribution until 1995.
13043 Mail has then seen further development in open source
13045 variants, noticeably by Christos Zoulas in
13046 .Pf Net Bx .
13047 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
13048 Ritter in the years 2000 until 2008.
13049 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
13050 This man page is derived from
13051 .Dq The Mail Reference Manual
13052 that was originally written by Kurt Shoens.
13054 .\" }}}
13057 .Sh AUTHORS
13059 .An "Kurt Shoens" ,
13060 .An "Edward Wang" ,
13061 .An "Keith Bostic" ,
13062 .An "Christos Zoulas" ,
13063 .An "Gunnar Ritter" ,
13064 .An "Steffen Nurpmeso" .
13067 The variables
13068 .Va contact-mail
13070 .Va contact-web
13071 provide contact addresses:
13073 .\" v15-compat: drop eval as `mail' will expand variable?
13074 .Dl ? echo $contact-web; eval mail $contact-mail
13077 .\" .Sh CAVEATS {{{
13078 .Sh CAVEATS
13080 \*(ID Interrupting an operation via
13081 .Dv \&\&SIGINT
13083 .Ql control-C
13084 from anywhere else but a command prompt is very problematic and likely
13085 to leave the program in an undefined state: many library functions
13086 cannot deal with the
13087 .Fn siglongjmp 3
13088 that this software (still) performs; even though efforts have been taken
13089 to address this, no sooner but in v15 it will have been worked out:
13090 interruptions have not been disabled in order to allow forceful breakage
13091 of hanging network connections, for example (all this is unrelated to
13092 .Va ignore ) .
13095 The SMTP and POP3 protocol support of \*(UA is very basic.
13096 Also, if it fails to contact its upstream SMTP server, it will not make
13097 further attempts to transfer the message at a later time (setting
13098 .Va save
13100 .Va sendwait
13101 may be useful).
13102 If this is a concern, it might be better to set up a local SMTP server
13103 that is capable of message queuing.
13105 .\" }}}
13108 .Sh BUGS
13110 After deleting some message of a POP3 mailbox the header summary falsely
13111 claims that there are no messages to display, one needs to perform
13112 a scroll or dot movement to restore proper state.
13114 In threaded display a power user may encounter crashes very
13115 occasionally (this is may and very).
13117 The file
13118 .Pa TODO
13119 in the source repository lists future directions.
13121 .\" s-ts-mode