Turn a_head_customhdr__sep() to n_strsep_esc()
[s-mailx.git] / nail.1
blob7619bcf45b3257869e3ae58d838a7f6182dd322a
1 .\"@ nail.1 - S-nail(1) reference manual.
2 .\"
3 .\" Copyright (c) 2000-2008 Gunnar Ritter, Freiburg i. Br., Germany.
4 .\" Copyright (c) 2012 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
5 .\"
6 .\" Copyright (c) 1980, 1990, 1993
7 .\"      The Regents of the University of California.  All rights reserved.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"--MKREL-START--
34 .\"@ S-nail v14.9.3 / 2017-08-03
35 .Dd August 03, 2017
36 .ds VV \\%v14.9.3
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
180 .Ic source Ns
181 d (loaded): if the letter
182 .Ql s
183 is (case-insensitively) part of the
184 .Ar spec
185 then the system wide
186 .Pa \*(UR
187 is sourced, likewise the letter
188 .Ql u
189 controls sourcing of the user's personal
190 .Pa \*(ur
191 file, whereas the letters
192 .Ql -
194 .Ql /
195 explicitly forbid sourcing of any resource files.
196 Scripts should use this option: to avoid environmental noise they should
197 .Dq detach
198 from any configuration and create a script-specific environment, setting
199 any of the desired
200 .Sx "INTERNAL VARIABLES"
202 .Fl S
203 and running configurating commands via
204 .Fl X .
205 This option overrides
206 .Fl n .
209 .It Fl A Ar account
210 Executes an
211 .Ic account
212 command for the given user email
213 .Ar account
214 after program startup is complete (all resource files are loaded, any
215 .Fl S
216 setting is being established; only
217 .Fl X
218 commands have not been evaluated yet).
219 Being a special incarnation of
220 .Ic define Ns d
221 macros for the purpose of bundling longer-lived
222 .Ic set Ns
223 tings, activating such an email account also switches to the accounts
224 .Mx -sx
225 .Sx "primary system mailbox"
226 (most likely the
227 .Va inbox ) .
230 .It Fl a Ar file Ns Op Ar =input-charset Ns Op Ar #output-charset
231 Attach
232 .Ar file
233 to the message (for compose mode opportunities refer to
234 .Ic ~@
236 .Ic ~^ ) .
237 .Sx "Filename transformations"
238 (also see
239 .Ic file )
240 will be performed, but shell word expansion is restricted to the tilde
241 .Ql ~ .
242 Shall
243 .Ar file
244 not be accessible but contain a
245 .Ql =
246 character, then anything before the
247 .Ql =
248 will be used as the filename, anything thereafter as a character set
249 specification.
251 If an input character set is specified,
252 .Mx -ix "character set specification"
253 but no output character set, then the given input character set is fixed
254 as-is, and no conversion will be applied;
255 giving the empty string or the special string hyphen-minus
256 .Ql -
257 will be treated as if
258 .Va ttycharset
259 has been specified (the default).
261 If an output character set has also been given then the conversion will
262 be performed exactly as specified and on-the-fly, not considering the
263 file's type and content.
264 As an exception, if the output character set is specified as the empty
265 string or hyphen-minus
266 .Ql - ,
267 then the default conversion algorithm (see
268 .Sx "Character sets" )
269 is applied (therefore no conversion is performed on-the-fly,
270 .Ar file
271 will be MIME-classified and its contents will be inspected first) \(em
272 without support for character set conversions
273 .Pf ( Va features
274 does not include the term
275 .Ql +iconv )
276 only this argument is supported.
278 .It Fl B
279 (\*(OB: \*(UA will always use line-buffered output, to gain
280 line-buffered input even in batch mode enable batch mode via
281 .Fl # . )
284 .It Fl b Ar addr
285 Send a blind carbon copy to
286 .Ar addr Ns
287 ess, if the
288 .Ic set Ns
289 ting of
290 .Va expandaddr ,
291 one of the
292 .Sx "INTERNAL VARIABLES" ,
293 allows.
294 The option may be used multiple times.
295 Also see the section
296 .Sx "On sending mail, and non-interactive mode" .
299 .It Fl c Ar addr
300 Send carbon copies to the given receiver, if so allowed by
301 .Va expandaddr .
302 May be used multiple times.
305 .It Fl d
306 .Ic set
307 the internal variable
308 .Va debug
309 which enables debug messages and disables message delivery,
310 among others; effectively turns almost any operation into a dry-run.
313 .It Fl E
314 .Ic set
315 .Va skipemptybody
316 and thus discard messages with an empty message part body.
317 This command line option is \*(OB.
320 .It Fl e
321 Just check if mail is present (in the system
322 .Va inbox
323 or the one specified via
324 .Fl f ) :
325 if yes, return an exit status of zero, a non-zero value otherwise.
326 To restrict the set of mails to consider in this evaluation a message
327 specification can be added with the option
328 .Fl L .
331 .It Fl F
332 Save the message to send in a file named after the local part of the
333 first recipient's address (instead of in
334 .Va record Ns ).
337 .It Fl f
338 Read in the contents of the user's
339 .Mx -sx
340 .Sx "secondary mailbox"
341 .Ev MBOX
342 (or the specified file) for processing;
343 when \*(UA is quit, it writes undeleted messages back to this file
344 (but be aware of the
345 .Va hold
346 option).
347 The optional
348 .Ar file
349 argument will undergo some special
350 .Sx "Filename transformations"
351 (also see
352 .Ic file ) .
353 Note that
354 .Ar file
355 is not an argument to the flag
356 .Fl \&\&f ,
357 but is instead taken from the command line after option processing has
358 been completed.
359 In order to use a
360 .Ar file
361 that starts with a hyphen-minus, prefix with a relative path, as in
362 .Ql ./-hyphenbox.mbox .
365 .It Fl H
366 Display a summary of
367 .Ic headers
368 and exit; a configurable summary view is available via the
369 .Fl L
370 option.
373 .It Fl h
374 Show a short usage summary.
377 .It Fl i
378 .Ic set
379 .Va ignore
380 to ignore tty interrupt signals.
383 .It Fl L Ar spec
384 Display a summary of
385 .Ic headers
386 of all messages that match the given
387 .Ar spec ,
388 then exit.
389 See the section
390 .Sx "Specifying messages"
391 for the format of
392 .Ar spec .
393 If the
394 .Fl e
395 option has been given in addition no header summary is produced,
396 but \*(UA will instead indicate via its exit status whether
397 .Ar spec
398 matched any messages
399 .Pf ( Ql 0 )
400 or not
401 .Pf ( Ql 1 ) ;
402 note that any verbose output is suppressed in this mode and must instead
403 be enabled explicitly (e.g., by using the option
404 .Fl v ) .
407 .It Fl M Ar type
408 Special send mode that will flag standard input with the MIME
409 .Ql Content-Type:
410 set to the given
411 .Ar type
412 and use it as the main message body.
413 \*(ID Using this option will bypass processing of
414 .Va message-inject-head
416 .Va message-inject-tail .
417 Also see
418 .Fl q , m , t .
421 .It Fl m Ar file
422 Special send mode that will MIME classify the specified
423 .Ar file
424 and use it as the main message body.
425 \*(ID Using this option will bypass processing of
426 .Va message-inject-head
428 .Va message-inject-tail .
429 Also see
430 .Fl q , M , t .
433 .It Fl N
434 inhibit the initial display of message headers when reading mail or
435 editing a mailbox
436 .Ic folder
437 by calling
438 .Ic unset
439 for the internal variable
440 .Va header .
443 .It Fl n
444 Standard flag that inhibits reading the system wide
445 .Pa \*(UR
446 upon startup.
447 The option
448 .Fl \&:
449 allows more control over the startup sequence; also see
450 .Sx "Resource files" .
453 .It Fl q Ar file
454 Special send mode that will initialize the message body with the
455 contents of the specified
456 .Ar file ,
457 which may be standard input
458 .Ql -
459 only in non-interactive context.
460 Also see
461 .Fl M , m , t .
464 .It Fl R
465 Any mailbox
466 .Ic folder
467 opened will be in read-only mode.
471 .It Fl r Ar from-addr
472 Whereas the source address that appears in the
473 .Va from
474 header of a message (or in the
475 .Va sender
476 header if the former contains multiple addresses) is honoured by the
477 builtin SMTP transport, it is not used by a file-based
478 .Va mta
479 (Mail-Transfer-Agent) for the RFC 5321 reverse-path used for relaying
480 and delegating a message to its destination(s), for delivery errors
481 etc., but it instead uses the local identity of the initiating user.
484 When this command line option is used the given
485 .Ar from-addr
486 will be assigned to the internal variable
487 .Va from ,
488 but in addition the command line option
489 .Fl \&\&f Ar from-addr
490 will be passed to a file-based
491 .Va mta
492 whenever a message is sent.
493 Shall
494 .Ar from-addr
495 include a user name the address components will be separated and
496 the name part will be passed to a file-based
497 .Va mta
498 individually via
499 .Fl \&\&F Ar name .
502 If an empty string is passed as
503 .Ar from-addr
504 then the content of the variable
505 .Va from
506 (or, if that contains multiple addresses,
507 .Va sender )
508 will be evaluated and used for this purpose whenever the file-based
509 .Va mta
510 is contacted.
511 By default, without
512 .Fl \&\&r
513 that is, neither
514 .Fl \&\&f
516 .Fl \&\&F
517 command line options are used when contacting a file-based MTA, unless
518 this automatic deduction is enforced by
519 .Ic set Ns
520 ing the internal variable
521 .Va r-option-implicit .
524 Remarks: many default installations and sites disallow overriding the
525 local user identity like this unless either the MTA has been configured
526 accordingly or the user is member of a group with special privileges.
530 .It Fl S Ar var Ns Op = Ns value
531 .Ic set
532 the internal
533 .Ar var Ns
534 iable and, in case of a non-boolean variable which has a value, assign
535 .Ar value
536 to it; in case the operation fails the program will exit if the variables
537 .Va errexit
539 .Va posix
540 are set.
541 Even though
542 .Sx "INTERNAL VARIABLES"
543 .Ic \&\&set
545 .Fl \&\&S
546 may be overwritten from within resource files,
547 the command line setting will be reestablished after all resource files
548 have been loaded.
549 \*(ID In the future such a setting may instead become
550 .Dq frozen
551 until the startup is complete, silently ignoring any tries to set or
552 unset the variable.
555 .It Fl s Ar subject
556 Specify the subject of the message to be sent.
557 Newline (NL) and carriage-return (CR) bytes are invalid and will be
558 normalized to space (SP) characters.
561 .It Fl t
562 The message given (on standard input) is expected to contain, separated
563 from the message body by an empty line, a message header with
564 .Ql To: ,
565 .Ql Cc: ,
567 .Ql Bcc:
568 fields giving its recipients, which will be added to any recipients
569 specified on the command line.
570 If a message subject is specified via
571 .Ql Subject:
572 then it will be used in favour of one given on the command line.
574 Also understood are
575 .Ql Reply-To:
576 (possibly overriding
577 .Va reply-to ) ,
578 .Ql Sender:
579 .Pf ( Va sender ) ,
580 .Ql From:
581 .Pf ( Va from
582 and / or option
583 .Fl r ) .
584 .Ql Message-ID: ,
585 .Ql In-Reply-To: ,
586 .Ql References:
588 .Ql Mail-Followup-To: ,
589 by default created automatically dependent on message context, will
590 be used if specified (a special address massage will however still occur
591 for the latter).
592 Any other custom header field (also see
593 .Va customhdr
595 .Ic ~^ )
596 is passed through entirely
597 unchanged, and in conjunction with the options
598 .Fl ~
600 .Fl #
601 it is possible to embed
602 .Sx "COMMAND ESCAPES" .
603 Also see
604 .Fl M , m , q .
607 .It Fl u Ar user
608 Initially read the
609 .Mx -sx
610 .Sx "primary system mailbox"
612 .Ar user ,
613 appropriate privileges presumed; effectively identical to
614 .Ql Fl \&\&f Ns \0%user .
617 .It Fl V
618 Show \*(UA's
619 .Va version
620 and exit.
621 The command
622 .Ic version
623 will also show the list of
624 .Va features :
625 .Ql $ \*(uA -Xversion -Xx .
628 .It Fl v
629 .Ic set Ns
630 ting the internal variable
631 .Va verbose
632 enables display of some informational context messages.
633 Using it twice increases the level of verbosity.
636 .It Fl X Ar cmd
637 Add the given (or multiple for a multiline argument)
638 .Ar cmd
639 to the list of commands to be executed,
640 as a last step of program startup, before normal operation starts.
641 This is the only possibility to execute commands in non-interactive mode
642 when reading startup files is actively prohibited.
643 The commands will be evaluated as a unit, just as via
644 .Ic source .
645 Correlates with
646 .Fl #
648 .Va errexit .
651 .It Fl ~
652 Enable
653 .Sx "COMMAND ESCAPES"
654 in compose mode even in non-interactive use cases.
655 This can be used to, e.g., automatically format the composed message
656 text before sending the message:
657 .Bd -literal -offset indent
658 $ ( echo 'line    one. Word.     Word2.';\e
659     echo '~| /usr/bin/fmt -tuw66' ) |\e
660   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
664 .It Fl #
665 Enables batch mode: standard input is made line buffered, the complete
666 set of (interactive) commands is available, processing of
667 .Sx "COMMAND ESCAPES"
668 is enabled in compose mode, and diverse
669 .Sx "INTERNAL VARIABLES"
670 are adjusted for batch necessities, exactly as if done via
671 .Fl S :
672 .Va emptystart ,
673 .Pf no Va errexit ,
674 .Pf no Va header ,
675 .Pf no Va posix ,
676 .Va quiet ,
677 .Va sendwait ,
678 .Va typescript-mode
679 as well as
680 .Ev MAIL ,
681 .Ev MBOX
683 .Va inbox
684 (the latter three to
685 .Pa /dev/null ) .
686 The following prepares an email message in a batched dry run:
687 .Bd -literal -offset indent
688 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
689   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
693 .It Fl \&.
694 This flag forces termination of option processing in order to prevent
695 .Dq option injection
696 (attacks).
697 It also forcefully puts \*(UA into send mode, see
698 .Sx "On sending mail, and non-interactive mode" .
702 All given
703 .Ar to-addr
704 arguments and all receivers established via
705 .Fl b
707 .Fl c
708 are subject to the checks established by
709 .Va expandaddr ,
710 one of the
711 .Sx "INTERNAL VARIABLES" .
712 If the setting of
713 .Va expandargv
714 allows their recognition all
715 .Ar mta-option
716 arguments given at the end of the command line after a
717 .Ql --
718 separator will be passed through to a file-based
719 .Va mta
720 (Mail-Transfer-Agent) and persist for the entire session.
721 .Va expandargv
722 constraints do not apply to the content of
723 .Va mta-arguments .
724 .\" }}}
726 .\" .Ss "A starter" {{{
727 .Ss "A starter"
729 \*(UA is a direct descendant of
731 Mail, itself a successor of the Research
733 mail which
734 .Dq was there from the start
735 according to
736 .Sx HISTORY .
737 It thus represents the user side of the
739 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
740 traditionally taken by
741 .Xr sendmail 8 ,
742 and most MTAs provide a binary of this name for compatibility purposes.
743 If the \*(OPal SMTP
744 .Va mta
745 is included in the
746 .Va features
747 of \*(UA then the system side is not a mandatory precondition for mail
748 delivery.
751 Because \*(UA strives for compliance with POSIX
752 .Xr mailx 1
753 it is likely that some configuration settings have to be adjusted before
754 using it is a smooth experience.
755 (Rather complete configuration examples can be found in the section
756 .Sx EXAMPLES . )
757 The default global
758 .Pa \*(UR
759 resource file bends those standard imposed settings of the
760 .Sx "INTERNAL VARIABLES"
761 a bit towards more user friendliness and safety already.
764 For example, it
765 .Ic set Ns s
766 .Va hold
768 .Va keepsave
769 in order to suppress the automatic moving of messages to the
770 .Mx -sx
771 .Sx "secondary mailbox"
772 .Ev MBOX
773 that would otherwise occur (see
774 .Sx "Message states" ) ,
776 .Va keep
777 to not remove empty system MBOX mailbox files in order not to mangle
778 file permissions when files eventually get recreated (all empty (MBOX)
779 mailbox files will be removed unless this variable is set whenever
780 .Va posix
781 .Pf a.k.a.\0 Ev POSIXLY_CORRECT
782 mode has been enabled).
785 It also enables
786 .Va sendwait
787 in order to synchronize \*(UA with the exit status report of the used
788 .Va mta
789 when sending mails.
791 .Ic set Ns
793 .Va emptystart
794 to enter interactive startup even if the initial mailbox is empty,
795 .Va editheaders
796 to allow editing of headers as well as
797 .Va fullnames
798 to not strip down addresses in compose mode, and
799 .Va quote
800 to include the message that is being responded to when
801 .Ic reply Ns
802 ing.
805 Some random remarks.
806 The file mode creation mask can be explicitly managed via the variable
807 .Va umask .
808 Sufficient system support provided symbolic links will not be followed
809 when files are opened for writing.
810 Files and shell pipe output can be
811 .Ic source Ns
812 d for evaluation, also during startup from within the
813 .Sx "Resource files" .
814 .\" }}}
816 .\" .Ss "On sending mail, and non-interactive mode" {{{
817 .Ss "On sending mail, and non-interactive mode"
819 To send a message to one or more people, using a local or a built-in
820 .Va mta
821 (Mail-Transfer-Agent) transport to actually deliver the generated mail
822 message, \*(UA can be invoked with arguments which are the names of
823 people to whom the mail will be sent, and the command line options
824 .Fl b
826 .Fl c
827 can be used to add (blind) carbon copy receivers:
829 .Bd -literal -offset indent
830 # Via sendmail(1)
831 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
833 # But... try it in an isolated dry-run mode (-d) first
834 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
835    -b bcc@exam.ple -c cc@exam.ple \e
836    -Sfullnames -. \e
837    '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
839 # With SMTP
840 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
841     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
842     -S from=scriptreply@exam.ple \e
843     -a /etc/mail.rc \e
844     -. eric@exam.ple
848 If standard input is a terminal rather than the message to be sent,
849 the user is expected to type in the message contents.
850 In this compose mode \*(UA treats lines beginning with the character
851 .Ql ~
852 special \(en these are so-called
853 .Sx "COMMAND ESCAPES" ,
854 which can be used to read in files, process shell commands, add and edit
855 attachments and more; e.g., the command escape
856 .Ic ~e
857 will start the text editor to revise the message in its current state,
858 .Ic ~h
859 allows editing of the most important message headers, with
860 .Ic ~^
861 custom headers can be created (more specifically than with
862 .Va customhdr ) .
863 .Ic ~?
864 gives an overview of most other available command escapes.
865 The command escape
866 .Ic ~.
867 will leave compose mode and send the message once it is completed.
868 Alternatively typing
869 .Ql control-D
870 .Pf ( Ql ^D )
871 at the beginning of an empty line has the same effect, whereas typing
872 .Ql control-C
873 .Pf ( Ql ^C )
874 twice will abort the current letter (saving its contents in the file
875 denoted by
876 .Ev DEAD
877 unless
878 .Pf no Va save
879 is set).
882 A number of
883 .Sx ENVIRONMENT
885 .Sx "INTERNAL VARIABLES"
886 can be used to alter default behavior.
887 E.g., messages are sent asynchronously, without supervision, unless the
888 internal variable
889 .Va sendwait
890 is set, therefore send errors will not be recognizable until then.
891 .Ic set Ns
892 ting (also via
893 .Fl S )
894 .Va editalong
895 will automatically startup a text editor when compose mode is entered,
896 .Va editheaders
897 allows editing of headers additionally to plain body content, whereas
898 .Va askcc
900 .Va askbcc
901 will cause the user to be prompted actively for (blind) carbon-copy
902 recipients, respectively, whereas (the default)
903 .Va asksend
904 will request confirmation whether the message shall be send.
907 Especially when using public mail provider accounts with the SMTP
908 .Va mta
909 it is often necessary to set
910 .Va from
911 and/or
912 .Va hostname
913 (even finer control via
914 .Va smtp-hostname ) ,
915 which (even if empty) also causes creation of
916 .Ql Message-ID:
918 .Ql Content-ID:
919 header fields unless
920 .Va stealthmua
921 is set.
922 Saving a copy of sent messages in a
923 .Va record
924 mailbox may be desirable \(en as for most mailbox
925 .Ic file
926 targets the value will undergo
927 .Sx "Filename transformations" .
928 Defining user email
929 .Ic account Ns s
930 for the purpose of arranging a complete environment of settings that can
931 be switched to with a single command or command line option may be
932 useful.
933 .Pf ( Sx EXAMPLES
934 has example configurations for some of the well-known public mail
935 providers, and also gives a compact overview on how to setup a secure
936 SSL/TLS environment.)
937 Some introductional
938 .Fl d
940 .Va debug
941 sandbox dry-run tests will prove correctness.
944 The section
945 .Sx "On URL syntax and credential lookup"
946 will spread light on the different ways of how to specify user email
947 account credentials, the
948 .Ql USER@HOST
949 variable chains, and accessing protocol-specific resources,
950 the section
951 .Sx "Character sets"
952 goes into the details of character encodings, and how to use them for
953 interpreting the input data given in
954 .Va ttycharset
955 and representing messages and MIME part contents in
956 .Va sendcharsets ,
957 and reading the section
958 .Sx "The mime.types files"
959 should help to understand how the MIME-type of outgoing attachments are
960 classified, and what can be done for fine-tuning.
961 Over the wire a configurable
962 .Va mime-encoding
963 .Pf ( Ql Content-Transfer-Encoding: )
964 may be applied to the message data.
967 Message recipients (as specified on the command line or defined in
968 .Ql To: ,
969 .Ql Cc:
971 .Ql Bcc: )
972 may not only be email addressees but can also be names of mailboxes and
973 even complete shell command pipe specifications.
974 If the variable
975 .Va expandaddr
976 is not set then only network addresses (see
977 .Xr mailaddr 7
978 for a description of mail addresses) and plain user names (including MTA
979 aliases) may be used, other types will be filtered out, giving a warning
980 message.
981 The command
982 .Ic addrcodec
983 can be used to generate standard compliant network addresses.
985 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
986 .\" grep the latter for the complete picture
988 If the variable
989 .Va expandaddr
990 is set then extended recipient addresses will optionally be accepted:
991 Any name which starts with a vertical bar
992 .Ql |
993 character specifies a command pipe \(en the command string following the
994 .Ql |
995 is executed and the message is sent to its standard input;
996 Likewise, any name that starts with the character solidus
997 .Ql /
998 or the character sequence dot solidus
999 .Ql ./
1000 is treated as a file, regardless of the remaining content;
1001 likewise a name that solely consists of a hyphen-minus
1002 .Ql - .
1003 Any other name which contains a commercial at
1004 .Ql @
1005 character is treated as a network address;
1006 Any other name which starts with a plus sign
1007 .Ql +
1008 character specifies a mailbox name;
1009 Any other name which contains a solidus
1010 .Ql /
1011 character but no exclamation mark
1012 .Ql \&!
1013 or percent sign
1014 .Ql %
1015 character before also specifies a mailbox name;
1016 What remains is treated as a network address.
1018 .Bd -literal -offset indent
1019 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1020 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1021 $ echo safe | LC_ALL=C \e
1022     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
1023       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1024       -. bob@exam.ple
1028 It is possible to create personal distribution lists via the
1029 .Ic alias
1030 command, so that, for instance, the user can send mail to
1031 .Ql cohorts
1032 and have it go to a group of people.
1033 These aliases have nothing in common with the system wide aliases that
1034 may be used by the MTA, which are subject to the
1035 .Ql name
1036 constraint of
1037 .Va expandaddr
1038 and are often tracked in a file
1039 .Pa /etc/aliases
1040 (and documented in
1041 .Xr aliases 5
1043 .Xr sendmail 1 ) .
1044 Personal aliases will be expanded by \*(UA before the message is sent,
1045 and are thus a convenient alternative to specifying each addressee by
1046 itself; they correlate with the active set of
1047 .Ic alternates
1048 and are subject to
1049 .Va metoo
1050 filtering.
1053 .Dl alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox
1056 .Va on-compose-enter , on-compose-leave
1058 .Va on-compose-cleanup
1059 hook variables may be set to
1060 .Ic define Ns
1061 d macros to automatically adjust some settings dependent
1062 on receiver, sender or subject contexts, and via the
1063 .Va on-compose-splice
1064 as well as
1065 .Va on-compose-splice-shell
1066 variables, the former also to be set to a
1067 .Ic define Ns
1068 d macro, increasingly powerful mechanisms to perform automated message
1069 adjustments, including signature creation, are available.
1070 (\*(ID These hooks work for commands which newly create messages, namely
1071 .Ic forward , mail , reply
1072 and variants;
1073 .Ic resend
1075 .Ic Resend
1076 for now provide only the hooks
1077 .Va on-resend-enter
1079 .Va on-resend-cleanup . )
1082 To avoid environmental noise scripts should
1083 .Dq detach
1084 \*(UA from any configuration files and create a script-local
1085 environment, ideally with the command line options
1086 .Fl \&:
1087 to disable any configuration file in conjunction with repetitions of
1088 .Fl S
1089 to specify variables:
1091 .Bd -literal -offset indent
1092 $ env LC_ALL=C \*(uA -:/ \e
1093     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1094     -Sexpandaddr=fail,-all,failinvaddr \e
1095     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1096     -S from=scriptreply@exam.ple \e
1097     -s 'Subject to go' -a attachment_file \e
1098     -Sfullnames -. \e
1099     'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1100     < content_file
1104 As shown, scripts can
1105 .Dq fake
1106 a locale environment, the above specifies the all-compatible 7-bit clean
1107 .Ev LC_ALL
1108 .Dq C ,
1109 but will nonetheless take and send UTF-8 in the message text by using
1110 .Va ttycharset .
1111 In interactive mode, which is introduced in the next section, messages
1112 can be sent by calling the
1113 .Ic mail
1114 command with a list of recipient addresses:
1116 .Bd -literal -offset indent
1117 $ \*(uA -d -Squiet -Semptystart
1118 "/var/spool/mail/user": 0 messages
1119 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1121 ? # Will do the right thing (tm)
1122 ? m rec1@exam.ple rec2@exam.ple
1124 .\" }}}
1126 .\" .Ss "On reading mail, and interactive mode" {{{
1127 .Ss "On reading mail, and interactive mode"
1129 When invoked without addressees \*(UA enters interactive mode in which
1130 mails may be read.
1131 When used like that the user's system
1132 .Va inbox
1133 (for more on mailbox types please see the command
1134 .Ic file )
1135 is read in and a one line header of each message therein is displayed if
1136 the variable
1137 .Va header
1138 is set.
1139 The visual style of this summary of
1140 .Ic headers
1141 can be adjusted through the variable
1142 .Va headline
1143 and the possible sorting criterion via
1144 .Va autosort .
1145 Scrolling through
1146 .Va screen Ns
1147 fuls of
1148 .Ic headers
1149 can be performed with the command
1150 .Ic z .
1151 If the initially opened mailbox is empty \*(UA will instead exit
1152 immediately (after displaying a message) unless the variable
1153 .Va emptystart
1154 is set.
1157 At the
1158 .Va prompt
1159 the command
1160 .Ic list
1161 will give a listing of all available commands and
1162 .Ic help
1163 will give a summary of some common ones.
1164 If the \*(OPal documentation strings are available one can type
1165 .Ql help X
1166 .Pf "(or " Ql ?X )
1167 and see the actual expansion of
1168 .Ql X
1169 and what its purpose is, i.e., commands can be abbreviated
1170 (note that POSIX defines some abbreviations, so that the alphabetical
1171 order of commands does not necessarily relate to the abbreviations; it is
1172 however possible to define overwrites with
1173 .Ic commandalias ) .
1174 These commands can also produce a more
1175 .Va verbose
1176 output.
1179 Messages are given numbers (starting at 1) which uniquely identify
1180 messages; the current message \(en the
1181 .Dq dot
1182 \(en will either be the first new message, or the first unread message,
1183 or the first message of the mailbox; the internal variable
1184 .Va showlast
1185 will instead cause usage of the last message for this purpose.
1186 The command
1187 .Ic headers
1188 will display a
1189 .Va screen Ns
1190 ful of header summaries containing the
1191 .Dq dot ,
1192 whereas
1193 .Ic from
1194 will display only the summaries of the given messages, defaulting to the
1195 .Dq dot .
1198 Message content can be displayed with the command
1199 .Ic type
1200 .Pf ( Ql t ,
1201 alias
1202 .Ic print ) .
1203 Here the variable
1204 .Va crt
1205 controls whether and when \*(UA will use the configured
1206 .Ev PAGER
1207 for display instead of directly writing to the user terminal
1208 .Va screen ,
1209 the sole difference to the command
1210 .Ic more ,
1211 which will always use the
1212 .Ev PAGER .
1213 The command
1214 .Ic top
1215 will instead only show the first
1216 .Va toplines
1217 of a message (maybe even compressed if
1218 .Va topsqueeze
1219 is set).
1220 Message display experience may improve by setting and adjusting
1221 .Va mime-counter-evidence ,
1222 and also see
1223 .Sx "HTML mail and MIME attachments" .
1226 By default the current message
1227 .Pf ( Dq dot )
1228 is displayed, but like with many other commands it is possible to give
1229 a fancy message specification (see
1230 .Sx "Specifying messages" ) ,
1231 e.g.,
1232 .Ql t:u
1233 will display all unread messages,
1234 .Ql t.
1235 will display the
1236 .Dq dot ,
1237 .Ql t 1 5
1238 will type the messages 1 and 5,
1239 .Ql t 1-5
1240 will type the messages 1 through 5, and
1241 .Ql t-
1243 .Ql t+
1244 will display the last and the next message, respectively.
1245 The command
1246 .Ic search
1247 (a more substantial alias for
1248 .Ic from )
1249 will display a header summary of the given message specification list
1250 instead of their content, e.g., the following will search for subjects:
1253 .Dl ? from "'@Some subject to search for'"
1256 In the default setup all header fields of a message will be
1257 .Ic type Ns
1258 d, but fields can be white- or blacklisted for a variety of
1259 applications by using the command
1260 .Ic headerpick ,
1261 e.g., to restrict their display to a very restricted set for
1262 .Ic type :
1263 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1264 In order to display all header fields of a message regardless of
1265 currently active ignore or retain lists, use the commands
1266 .Ic Type
1268 .Ic Top ;
1269 .Ic Show
1270 will show the raw message content.
1271 Note that historically the global
1272 .Pa \*(UR
1273 not only adjusts the list of displayed headers, but also sets
1274 .Va crt .
1277 Dependent upon the configuration a line editor (see the section
1278 .Sx "On terminal control and line editor" )
1279 aims at making the user experience with the many
1280 .Sx COMMANDS
1281 a bit nicer.
1282 When reading the system
1283 .Va inbox
1284 or when
1285 .Fl f
1287 .Ic file )
1288 specified a mailbox explicitly prefixed with the special
1289 .Ql %:
1290 modifier (propagating the mailbox to a
1291 .Mx -sx
1292 .Sx "primary system mailbox" ) ,
1293 then messages which have been read will be automatically moved to a
1294 .Mx -sx
1295 .Sx "secondary mailbox" ,
1296 the users
1297 .Ev MBOX
1298 file, when the mailbox is left, either by changing the
1299 active mailbox or by quitting \*(UA (also see
1300 .Sx "Message states" )
1301 \(en this automatic moving from a system or primary to the secondary
1302 mailbox is not performed when the variable
1303 .Va hold
1304 is set.
1305 Messages can also be explicitly
1306 .Ic move Ns
1307 d to other mailboxes, whereas
1308 .Ic copy
1309 keeps the original message.
1310 .Ic write
1311 can be used to write out data content of specific parts of messages.
1314 After examining a message the user can
1315 .Ic reply Ql r
1316 to the sender and all recipients (which will also be placed in
1317 .Ql To:
1318 unless
1319 .Va recipients-in-cc
1320 is set) or
1321 .Ic Reply Ql R
1322 exclusively to the sender(s).
1323 .Ic forward Ns
1324 ing a message will allow editing the new message: the original message
1325 will be contained in the message body, adjusted according to
1326 .Ic headerpick .
1327 It is possible to
1328 .Ic resend
1330 .Ic Resend
1331 messages: the former will add a series of
1332 .Ql Resent-
1333 headers, whereas the latter will not; different to newly created
1334 messages editing is not possible and no copy will be saved even with
1335 .Va record
1336 unless the additional variable
1337 .Va record-resent
1338 is set.
1339 When sending, replying or forwarding messages comments and full names
1340 will be stripped from recipient addresses unless the internal variable
1341 .Va fullnames
1342 is set.
1343 Of course messages can be
1344 .Ic delete Ql d ,
1345 and they can spring into existence again via
1346 .Ic undelete
1347 or when the \*(UA session is ended via the
1348 .Ic exit Ql x
1349 command.
1352 To end a mail processing session one may either issue
1353 .Ic quit Ql q
1354 to cause a full program exit, which possibly includes
1355 automatic moving of read messages to the
1356 .Mx -sx
1357 .Sx "secondary mailbox"
1358 .Ev MBOX
1359 as well as updating the \*(OPal line editor
1360 .Va history-file ,
1361 or use the command
1362 .Ic exit Ql x
1363 instead in order to prevent any of these actions.
1364 .\" }}}
1366 .\" .Ss "HTML mail and MIME attachments" {{{
1367 .Ss "HTML mail and MIME attachments"
1369 Messages which are HTML-only become more and more common and of course
1370 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1371 Mail Extensions) parts for, e.g., attachments.
1372 To get a notion of MIME types, \*(UA will first read
1373 .Sx "The mime.types files"
1374 (as configured and allowed by
1375 .Va mimetypes-load-control ) ,
1376 and then add onto that types registered directly with
1377 .Ic mimetype .
1378 It (normally) has a default set of types built-in, too.
1379 To improve interaction with faulty MIME part declarations which are
1380 often seen in real-life messages, setting
1381 .Va mime-counter-evidence
1382 will allow \*(UA to verify the given assertion and possibly provide
1383 an alternative MIME type.
1386 Whereas \*(UA \*(OPally supports a simple HTML-to-text converter for
1387 HTML messages, it cannot handle MIME types other than plain text itself.
1388 Instead programs need to become registered to deal with specific MIME
1389 types or file extensions.
1390 These programs may either prepare plain text versions of their input in
1391 order to enable \*(UA to integrate their output neatlessly in its own
1392 message visualization (a mode which is called
1393 .Cd copiousoutput ) ,
1394 or display the content themselves, for example in an external graphical
1395 window: such handlers will only be considered by and for the command
1396 .Ic mimeview .
1399 To install a handler program for a specific MIME type an according
1400 .Va pipe-TYPE/SUBTYPE
1401 variable needs to be set; to instead define a handler for a specific
1402 file extension the respective
1403 .Va pipe-EXTENSION
1404 variable can be used \(en these handlers take precedence.
1405 \*(OPally \*(UA supports mail user agent configuration as defined in
1406 RFC 1524; this mechanism (see
1407 .Sx "The Mailcap files" )
1408 will be queried for display or quote handlers if none of the former two
1409 .\" TODO v15-compat "will be" -> "is"
1410 did; it will be the sole source for handlers of other purpose.
1411 A last source for handlers is the MIME type definition itself, when
1412 a (\*(UA specific) type-marker was registered with the command
1413 .Ic mimetype
1414 (which many built-in MIME types do).
1417 E.g., to display a HTML message inline (that is, converted to a more
1418 fancy plain text representation than the built-in converter is capable to
1419 produce) with either of the text-mode browsers
1420 .Xr lynx 1
1422 .Xr elinks 1 ,
1423 teach \*(UA about MathML documents and make it display them as plain
1424 text, and to open PDF attachments in an external PDF viewer,
1425 asynchronously and with some other magic attached:
1427 .Bd -literal -offset indent
1428 ? if [ "$features" !% +filter-html-tagsoup ]
1429 ?  #set pipe-text/html='@* elinks -force-html -dump 1'
1430 ?  set pipe-text/html='@* lynx -stdin -dump -force_html'
1431 ?  # Display HTML as plain text instead
1432 ?  #set pipe-text/html=@
1433 ? endif
1434 ? mimetype @ application/mathml+xml mathml
1435 ? wysh set pipe-application/pdf='@&=@ \e
1436     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1437     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1438     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1440 .\" }}}
1442 .\" .Ss "Mailing lists" {{{
1443 .Ss "Mailing lists"
1445 \*(UA offers some support to ease handling of mailing lists.
1446 The command
1447 .Ic mlist
1448 promotes all given arguments to known mailing lists, and
1449 .Ic mlsubscribe
1450 sets their subscription attribute, creating them first as necessary.
1451 (On the other hand
1452 .Ic unmlsubscribe
1453 does not
1454 .Ic unmlist
1455 automatically, but only resets the subscription attribute.)
1456 Using the commands without arguments will show (a subset of) all
1457 currently defined mailing lists.
1459 .Va headline
1460 format
1461 .Ql \&%T
1462 can be used to mark out messages with configured list addresses
1463 in the header display.
1466 \*(OPally mailing lists may also be specified as (extended) regular
1467 expressions, which allows matching of many addresses with a single
1468 expression.
1469 However, all fully qualified list addresses are matched via a fast
1470 dictionary, whereas expressions are placed in (a) list(s) which is
1471 (are) matched sequentially.
1473 .Bd -literal -offset indent
1474 ? set followup-to followup-to-honour=ask-yes \e
1475     reply-to-honour=ask-yes
1476 ? wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1477 ? mlsubscribe a4@b4.c4 exact@lists.c3
1481 The variable
1482 .Va followup-to-honour
1483 will ensure that a
1484 .Ql Mail-\:Followup-\:To:
1485 header is honoured when the message is being replied to (via
1486 .Ic reply
1488 .Ic Lreply )
1490 .Va followup-to
1491 controls whether this header is created when sending mails; it will be
1492 created automatically for a couple of reasons, too, like when the
1493 special
1494 .Dq mailing list specific
1495 respond command
1496 .Ic Lreply
1497 is used, when
1498 .Ic reply
1499 is used to respond to a message with its
1500 .Ql Mail-Followup-To:
1501 being honoured etc.
1504 A difference in between the handling of known and subscribed lists is
1505 that the address of the sender is usually not part of a generated
1506 .Ql Mail-Followup-To:
1507 when addressing the latter, whereas it is for the former kind of lists.
1508 Usually because there are exceptions: say, if multiple lists are
1509 addressed and not all of them are subscribed lists.
1511 For convenience \*(UA will, temporarily, automatically add a list
1512 address that is presented in the
1513 .Ql List-Post:
1514 header of a message that is being responded to to the list of known
1515 mailing lists.
1516 Shall that header have existed \*(UA will instead, dependent on the
1517 variable
1518 .Va reply-to-honour ,
1519 use an also set
1520 .Ql Reply-To:
1521 for this purpose in order to accept a list administrators' wish that
1522 is supposed to have been manifested like that (but only if it provides
1523 a single address which resides on the same domain as what is stated in
1524 .Ql List-Post: ) .
1525 .\" }}}
1527 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1528 .Ss "Signed and encrypted messages with S/MIME"
1530 \*(OP S/MIME provides two central mechanisms:
1531 message signing and message encryption.
1532 A signed message contains some data in addition to the regular text.
1533 The data can be used to verify that the message was sent using a valid
1534 certificate, that the sender's address in the message header matches
1535 that in the certificate, and that the message text has not been altered.
1536 Signing a message does not change its regular text;
1537 it can be read regardless of whether the recipient's software is able to
1538 handle S/MIME.
1539 It is thus usually possible to sign all outgoing messages if so desired.
1542 Encryption, in contrast, makes the message text invisible for all people
1543 except those who have access to the secret decryption key.
1544 To encrypt a message, the specific recipient's public encryption key
1545 must be known.
1546 It is therefore not possible to send encrypted mail to people unless their
1547 key has been retrieved from either previous communication or public key
1548 directories.
1549 A message should always be signed before it is encrypted.
1550 Otherwise, it is still possible that the encrypted message text is
1551 altered.
1554 A central concept to S/MIME is that of the certification authority (CA).
1555 A CA is a trusted institution that issues certificates.
1556 For each of these certificates it can be verified that it really
1557 originates from the CA, provided that the CA's own certificate is
1558 previously known.
1559 A set of CA certificates is usually delivered with OpenSSL and installed
1560 on your system.
1561 If you trust the source of your OpenSSL software installation,
1562 this offers reasonable security for S/MIME on the Internet.
1563 Otherwise set
1564 .Va smime-ca-no-defaults
1565 to avoid using the default certificates and point
1566 .Va smime-ca-file
1567 and/or
1568 .Va smime-ca-dir
1569 to a trusted pool of certificates.
1570 In general, a certificate cannot be more secure than the method its CA
1571 certificate has been retrieved with.
1574 This trusted pool of certificates is used by the command
1575 .Ic verify
1576 to ensure that the given S/MIME messages can be trusted.
1577 If so, verified sender certificates that were embedded in signed
1578 messages can be saved locally with the command
1579 .Ic certsave ,
1580 and used by \*(UA to encrypt further communication with these senders:
1582 .Bd -literal -offset indent
1583 ? certsave FILENAME
1584 ? set smime-encrypt-USER@HOST=FILENAME \e
1585     smime-cipher-USER@HOST=AES256
1589 To sign outgoing messages in order to allow receivers to verify the
1590 origin of these messages a personal S/MIME certificate is required.
1591 \*(UA supports password-protected personal certificates (and keys),
1592 for more on this, and its automatization, please see the section
1593 .Sx "On URL syntax and credential lookup" .
1594 The section
1595 .Sx "S/MIME step by step"
1596 shows examplarily how such a private certificate can be obtained.
1597 In general, if such a private key plus certificate
1598 .Dq pair
1599 is available, all that needs to be done is to set some variables:
1601 .Bd -literal -offset indent
1602 ? set smime-sign-cert=ME@HERE.com.paired \e
1603     smime-sign-message-digest=SHA256 \e
1604     smime-sign
1608 Variables of interest for S/MIME in general are
1609 .Va smime-ca-dir ,
1610 .Va smime-ca-file ,
1611 .Va smime-ca-flags ,
1612 .Va smime-ca-no-defaults ,
1613 .Va smime-crl-dir ,
1614 .Va smime-crl-file .
1615 For S/MIME signing of interest are
1616 .Va smime-sign ,
1617 .Va smime-sign-cert ,
1618 .Va smime-sign-include-certs
1620 .Va smime-sign-message-digest .
1621 Additional variables of interest for S/MIME en- and decryption:
1622 .Va smime-cipher
1624 .Va smime-encrypt-USER@HOST .
1627 \*(ID Note that neither S/MIME signing nor encryption applies to
1628 message subjects or other header fields yet.
1629 Thus they may not contain sensitive information for encrypted messages,
1630 and cannot be trusted even if the message content has been verified.
1631 When sending signed messages,
1632 it is recommended to repeat any important header information in the
1633 message text.
1634 .\" }}}
1636 .\" .Ss "On URL syntax and credential lookup" {{{
1637 .Ss "On URL syntax and credential lookup"
1639 \*(IN For accessing protocol-specific resources usage of Uniform
1640 Resource Locators (URL, RFC 1738) has become omnipresent.
1641 \*(UA expects and understands URLs in the following form;
1642 parts in brackets
1643 .Ql []
1644 denote optional parts, optional either because there also exist other
1645 ways to define the information in question or because support of the
1646 part is protocol-specific (e.g.,
1647 .Ql /path
1648 is used by the local maildir and the IMAP protocol, but not by POP3);
1649 If any of
1650 .Ql USER
1652 .Ql PASSWORD
1653 are specified they must be given in URL percent encoded form (RFC 3986;
1654 the command
1655 .Ic urlcodec
1656 may be helpful):
1659 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1662 Note that these \*(UA URLs most often do not conform to any real
1663 standard, but instead represent a normalized variant of RFC 1738 \(en
1664 they are not used in data exchange but only meant as a compact,
1665 easy-to-use way of defining and representing information in
1666 a well-known notation.
1669 Many internal variables of \*(UA exist in multiple versions, called
1670 variable chains for the rest of this document: the plain
1671 .Ql variable
1672 as well as
1673 .Ql variable-HOST
1675 .Ql variable-USER@HOST .
1676 Here
1677 .Ql HOST
1678 indeed means
1679 .Ql server:port
1680 if a
1681 .Ql port
1682 had been specified in the respective URL, otherwise it refers to the plain
1683 .Ql server .
1684 Also,
1685 .Ql USER
1686 is not truly the
1687 .Ql USER
1688 that had been found when doing the user chain lookup as is described
1689 below, i.e., this
1690 .Ql USER
1691 will never be in URL percent encoded form, whether it came from an URL
1692 or not; i.e., variable chain name extensions of
1693 .Sx "INTERNAL VARIABLES"
1694 must not be URL percent encoded.
1697 For example, whether an hypothetical URL
1698 .Ql smtp://hey%3Ayou@our.house
1699 had been given that includes a user, or whether the URL was
1700 .Ql smtp://our.house
1701 and the user had been found differently, to lookup the variable chain
1702 .Va smtp-use-starttls
1703 \*(UA first looks for whether
1704 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
1705 is defined, then whether
1706 .Ql smtp-\:use-\:starttls-\:our.house
1707 exists before finally ending up looking at the plain variable itself.
1710 \*(UA obeys the following logic scheme when dealing with the
1711 necessary credential information of an account:
1713 .Bl -bullet
1715 If no
1716 .Ql USER
1717 has been given in the URL the variables
1718 .Va user-HOST
1720 .Va user
1721 are looked up; if no such variable(s) can be found then \*(UA will,
1722 when enforced by the \*(OPal variables
1723 .Va netrc-lookup-HOST
1725 .Va netrc-lookup ,
1726 search the users
1727 .Pa .netrc
1728 file for a
1729 .Ql HOST
1730 specific entry which provides a
1731 .Ql login
1732 name: this lookup will only succeed if unambiguous (one possible matching
1733 entry for
1734 .Ql HOST ) .
1735 It is possible to load encrypted
1736 .Pa .netrc
1737 files via
1738 .Va netrc-pipe .
1740 If there is still no
1741 .Ql USER
1742 then \*(UA will fall back to the user who is supposed to run \*(UA,
1743 the identity of which has been fixated during \*(UA startup and is
1744 known to be a valid user on the current host.
1747 Authentication: unless otherwise noted this will lookup the
1748 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1749 variable chain, falling back to a protocol-specific default should this
1750 have no success.
1753 If no
1754 .Ql PASSWORD
1755 has been given in the URL, then if the
1756 .Ql USER
1757 has been found through the \*(OPal
1758 .Va netrc-lookup
1759 that may have already provided the password, too.
1760 Otherwise the variable chain
1761 .Va password-USER@HOST , password-HOST , password
1762 is looked up and used if existent.
1764 Afterwards the complete \*(OPal variable chain
1765 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1766 is looked up.
1767 If set, the
1768 .Ic netrc
1769 cache is searched for a password only (multiple user accounts for
1770 a single machine may exist as well as a fallback entry without user
1771 but with a password).
1773 If at that point there is still no password available, but the
1774 (protocols') chosen authentication type requires a password, then in
1775 interactive mode the user will be prompted on the terminal.
1779 .Sy Note:
1780 S/MIME verification works relative to the values found in the
1781 .Ql From:
1783 .Ql Sender: )
1784 header field(s), which means that the values of
1785 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1787 .Va smime-sign-message-digest
1788 will not be looked up using the
1789 .Ql USER
1791 .Ql HOST
1792 chains from above but instead use the corresponding values from the
1793 message that is being worked on.
1794 In unusual cases multiple and different
1795 .Ql USER
1797 .Ql HOST
1798 combinations may therefore be involved \(en on the other hand those
1799 unusual cases become possible.
1800 The usual case is as short as:
1802 .Bd -literal -offset indent
1803 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1804     smime-sign smime-sign-cert=+smime.pair
1808 The section
1809 .Sx EXAMPLES
1810 contains complete example configurations.
1811 .\" }}}
1813 .\" .Ss "Encrypted network communication" {{{
1814 .Ss "Encrypted network communication"
1816 SSL (Secure Sockets Layer) a.k.a. its successor TLS (Transport Layer
1817 Security) are protocols which aid in securing communication by providing
1818 a safely initiated and encrypted network connection.
1819 A central concept to SSL/TLS is that of certificates: as part of each
1820 network connection setup a (set of) certificates will be exchanged, and
1821 by using those the identity of the network peer can be cryptographically
1822 verified.
1823 SSL/TLS works by using a locally installed pool of trusted certificates,
1824 and verifying the connection peer succeeds if that provides
1825 a certificate which has been issued or is trusted by any certificate in
1826 the trusted local pool.
1829 The local pool of trusted so-called CA (Certification Authority)
1830 certificates is usually delivered with the used SSL/TLS library (e.g.,
1831 OpenSSL), and will be selected automatically.
1832 It is also possible to create and use an own pool of trusted certificates.
1833 If this is desired, set
1834 .Va ssl-ca-no-defaults
1835 to avoid using the default certificate pool, and point
1836 .Va ssl-ca-file
1837 and/or
1838 .Va ssl-ca-dir
1839 to a trusted pool of certificates.
1840 A certificate cannot be more secure than the method its CA certificate
1841 has been retrieved with.
1844 It depends on the used protocol whether encrypted communication is
1845 possible, and which configuration steps have to be taken to enable it.
1846 Some protocols, e.g., POP3S, are implicitly encrypted, others, like
1847 POP3, can upgrade a plain text connection if so requested: POP3 offers
1848 .Ql STLS ,
1849 which will be used if the variable
1850 .Va pop3-use-starttls
1851 (which is a variable chain, as documented in
1852 .Sx "On URL syntax and credential lookup")
1853 is set:
1855 .Bd -literal -offset indent
1856 shortcut encpop1 pop3s://pop1.exam.ple
1858 shortcut encpop2 pop3://pop2.exam.ple
1859 set pop3-use-starttls-pop2.exam.ple
1861 set mta=smtps://smtp.exam.ple:465
1862 set mta=smtp://smtp.exam.ple smtp-use-starttls
1866 Normally that is all there is to do, however plenty of knobs exist to
1867 adjust settings shall the necessity or desire arise.
1868 E.g., it is possible to fine-tune certificate verification via
1869 .Va ssl-ca-flags .
1870 Also interesting may be the possibility to configure the allowed
1871 .Va ssl-protocol Ns
1872 s that a communication channel may use: whereas in the past hints of
1873 how to restrict the set of protocols to highly secure ones were
1874 indicated, as of the time of this writing the allowed protocols, or at
1875 least the allowed
1876 .Va ssl-cipher-list ,
1877 may need to become relaxed in order to be able to connect to some
1878 servers.
1879 E.g., the following example settings allows connection of a
1880 .Dq Lion
1881 which uses OpenSSL 0.9.8za from June 2014:
1883 .Bd -literal -offset indent
1884 set ssl-protocol-LION=ALL,-SSLv3,-TLSv1
1885 set ssl-cipher-list-LION=TLSv1.2:!aNULL:!eNULL:\e
1886     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
1887     DHE-RSA-AES256-SHA:@STRENGTH
1891 The OpenSSL program
1892 .Xr ciphers 1
1893 can be used and should be referred to when creating a custom cipher list.
1894 Variables of interest for SSL/TLS in general are
1895 .Va ssl-ca-dir ,
1896 .Va ssl-ca-file ,
1897 .Va ssl-ca-flags ,
1898 .Va ssl-ca-no-defaults ,
1899 .Va ssl-cert ,
1900 .Va ssl-cipher-list ,
1901 .Va ssl-config-file ,
1902 .Va ssl-curves ,
1903 .Va ssl-crl-dir ,
1904 .Va ssl-crl-file ,
1905 .Va ssl-key ,
1906 .Va ssl-protocol ,
1907 .Va ssl-rand-file
1908 as well as
1909 .Va ssl-verify .
1910 .\" }}}
1912 .\" .Ss "Character sets" {{{
1913 .Ss "Character sets"
1915 \*(OP \*(UA detects the character set of the terminal by using
1916 mechanisms that are controlled by the
1917 .Ev LC_CTYPE
1918 environment variable
1919 (in fact
1920 .Ev LC_ALL ,
1921 .Ev \&\&LC_CTYPE ,
1922 .Ev LANG ,
1923 in that order, see there).
1924 The internal variable
1925 .Va ttycharset
1926 will be set to the detected terminal character set accordingly,
1927 and will thus show up in the output of commands like, e.g.,
1928 .Ic set
1930 .Ic varshow .
1933 However, the user may give a value for
1934 .Va ttycharset
1935 during startup, so that it is possible to send mail in a completely
1936 .Dq faked
1937 locale environment, an option which can be used to generate and send,
1938 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
1939 .Ql LC_ALL=C
1940 environment (an example of this can be found in the section
1941 .Sx "On sending mail, and non-interactive mode" ) .
1942 Changing the value does not mean much beside that, because several
1943 aspects of the real character set are implied by the locale environment
1944 of the system, which stays unaffected by
1945 .Va ttycharset .
1948 Messages and attachments which consist of 7-bit clean data will be
1949 classified as consisting of
1950 .Va charset-7bit
1951 character data.
1952 This is a problem if the
1953 .Va ttycharset
1954 character set is a multibyte character set that is also 7-bit clean.
1955 For example, the Japanese character set ISO-2022-JP is 7-bit clean but
1956 capable to encode the rich set of Japanese Kanji, Hiragana and Katakana
1957 characters: in order to notify receivers of this character set the mail
1958 message must be MIME encoded so that the character set ISO-2022-JP can
1959 be advertised!
1960 To achieve this, the variable
1961 .Va charset-7bit
1962 must be set to ISO-2022-JP.
1963 (Today a better approach regarding email is the usage of UTF-8, which
1964 uses 8-bit bytes for non-US-ASCII data.)
1967 If the \*(OPal character set conversion capabilities are not available
1968 .Pf ( Va features
1969 does not include the term
1970 .Ql +iconv ) ,
1971 then
1972 .Va ttycharset
1973 will be the only supported character set,
1974 it is simply assumed that it can be used to exchange 8-bit messages
1975 (over the wire an intermediate, configurable
1976 .Va mime-encoding
1977 may be applied),
1978 and the rest of this section does not apply;
1979 it may however still be necessary to explicitly set it if automatic
1980 detection fails, since in that case it defaults to
1981 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
1982 LATIN1 a.k.a. ISO-8859-1.
1985 \*(OP When reading messages, their text is converted into
1986 .Va ttycharset
1987 as necessary in order to display them on the users terminal.
1988 Unprintable characters and invalid byte sequences are detected
1989 and replaced by proper substitution characters.
1990 Character set mappings for source character sets can be established with
1991 the command
1992 .Ic charsetalias ,
1993 which may be handy to work around faulty character set catalogues (e.g.,
1994 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
1995 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
1996 Also see
1997 .Va charset-unknown-8bit
1998 to deal with another hairy aspect of message interpretation.
2001 When sending messages all their parts and attachments are classified.
2002 Whereas no character set conversion is performed on those parts which
2003 appear to be binary data,
2004 the character set being used must be declared within the MIME header of
2005 an outgoing text part if it contains characters that do not conform to
2006 the set of characters that are allowed by the email standards.
2007 Permissible values for character sets used in outgoing messages can be
2008 declared using the
2009 .Va sendcharsets
2010 variable, and
2011 .Va charset-8bit ,
2012 which defines a catch-all last-resort fallback character set that is
2013 implicitly appended to the list of character sets in
2014 .Va sendcharsets .
2017 When replying to a message and the variable
2018 .Va reply-in-same-charset
2019 is set, then the character set of the message being replied to
2020 is tried first (still being a subject of
2021 .Ic charsetalias ) .
2022 And it is also possible to make \*(UA work even more closely related to
2023 the current locale setting automatically by using the variable
2024 .Va sendcharsets-else-ttycharset ,
2025 please see there for more information.
2028 All the specified character sets are tried in order unless the
2029 conversion of the part or attachment succeeds.
2030 If none of the tried (8-bit) character sets is capable to represent the
2031 content of the part or attachment,
2032 then the message will not be sent and its text will optionally be
2033 .Va save Ns d
2035 .Ev DEAD .
2036 In general, if a message saying
2037 .Dq cannot convert from a to b
2038 appears, either some characters are not appropriate for the currently
2039 selected (terminal) character set,
2040 or the needed conversion is not supported by the system.
2041 In the first case, it is necessary to set an appropriate
2042 .Ev LC_CTYPE
2043 locale and/or the variable
2044 .Va ttycharset .
2047 The best results are usually achieved when \*(UA is run in a UTF-8
2048 locale on an UTF-8 capable terminal, in which case the full Unicode
2049 spectrum of characters is available.
2050 In this setup characters from various countries can be displayed,
2051 while it is still possible to use more simple character sets for sending
2052 to retain maximum compatibility with older mail clients.
2055 On the other hand the POSIX standard defines a locale-independent 7-bit
2056 .Dq portable character set
2057 that should be used when overall portability is an issue, the even more
2058 restricted subset named
2059 .Dq portable filename character set
2060 consists of A-Z, a-z, 0-9, period
2061 .Ql \&. ,
2062 underscore
2063 .Ql _
2064 and hyphen-minus
2065 .Ql - .
2066 .\" }}}
2068 .\" .Ss "Message states" {{{
2069 .Ss "Message states"
2071 \*(UA differentiates in between several different message states;
2072 the current state will be reflected in header summary displays if
2073 .Va headline
2074 is configured to do so (via the internal variable
2075 .Va attrlist ) ,
2076 and messages can also be selected and be acted upon depending on their
2077 state (see
2078 .Sx "Specifying messages" ) .
2079 When operating on the system
2080 .Va inbox ,
2081 or in any other
2082 .Mx -sx
2083 .Sx "primary system mailbox" ,
2084 special actions, like the automatic moving of messages to the
2085 .Mx -sx
2086 .Sx "secondary mailbox"
2087 .Ev MBOX ,
2088 may be applied when the mailbox is left (also implicitly via
2089 a successful exit of \*(UA, but not if the special command
2090 .Ic exit
2091 is used) \(en however, because this may be irritating to users which
2092 are used to
2093 .Dq more modern
2094 mail-user-agents, the default global
2095 .Pa \*(UR
2096 sets the internal
2097 .Va hold
2099 .Va keepsave
2100 variables in order to suppress this behaviour.
2102 .Bl -hang -width ".It Ql new"
2103 .It Ql new
2104 Message has neither been viewed nor moved to any other state.
2105 Such messages are retained even in the
2106 .Mx -sx
2107 .Sx "primary system mailbox" .
2109 .It Ql unread
2110 Message has neither been viewed nor moved to any other state, but the
2111 message was present already when the mailbox has been opened last:
2112 Such messages are retained even in the
2113 .Mx -sx
2114 .Sx "primary system mailbox" .
2116 .It Ql read
2117 The message has been processed by one of the following commands:
2118 .Ic ~f ,
2119 .Ic ~m ,
2120 .Ic ~F ,
2121 .Ic ~M ,
2122 .Ic copy ,
2123 .Ic mbox ,
2124 .Ic next ,
2125 .Ic pipe  ,
2126 .Ic Print ,
2127 .Ic print ,
2128 .Ic top ,
2129 .Ic Type ,
2130 .Ic type ,
2131 .Ic undelete .
2132 The commands
2133 .Ic dp
2135 .Ic dt
2136 will always try to automatically
2137 .Dq step
2139 .Ic type
2141 .Dq next
2142 logical message, and may thus mark multiple messages as read, the
2143 .Ic delete
2144 command will do so if  the internal variable
2145 .Va autoprint
2146 is set.
2147 Except when the
2148 .Ic exit
2149 command is used, messages that are in a
2150 .Mx -sx
2151 .Sx "primary system mailbox"
2152 and are in
2153 .Ql read
2154 state when the mailbox is left will be saved in the
2155 .Mx -sx
2156 .Sx "secondary mailbox"
2157 .Ev MBOX
2158 unless the internal variable
2159 .Va hold
2160 it set.
2162 .It Ql deleted
2163 The message has been processed by one of the following commands:
2164 .Ic delete ,
2165 .Ic dp ,
2166 .Ic dt .
2167 Only
2168 .Ic undelete
2169 can be used to access such messages.
2171 .It Ql preserved
2172 The message has been processed by a
2173 .Ic preserve
2174 command and it will be retained in its current location.
2176 .It Ql saved
2177 The message has been processed by one of the following commands:
2178 .Ic save
2180 .Ic write .
2181 Unless when the
2182 .Ic exit
2183 command is used, messages that are in a
2184 .Mx -sx
2185 .Sx "primary system mailbox"
2186 and are in
2187 .Ql saved
2188 state when the mailbox is left will be deleted; they will be saved in the
2189 .Mx -sx
2190 .Sx "secondary mailbox"
2191 .Ev MBOX
2192 when the internal variable
2193 .Va keepsave
2194 is set.
2198 In addition to these message states, flags which otherwise have no
2199 technical meaning in the mail system except allowing special ways of
2200 addressing them when
2201 .Sx "Specifying messages"
2202 can be set on messages.
2203 These flags are saved with messages and are thus persistent, and are
2204 portable between a set of widely used MUAs.
2206 .Bl -hang -width ".It Ic answered"
2207 .It Ic answered
2208 Mark messages as having been answered.
2209 .It Ic draft
2210 Mark messages as being a draft.
2211 .It Ic flag
2212 Mark messages which need special attention.
2214 .\" }}}
2216 .\" .Ss "Specifying messages" {{{
2217 .Ss "Specifying messages"
2219 Commands such as
2220 .Ic from ,
2221 .Ic type
2223 .Ic delete
2224 can be given a list of message numbers as arguments to apply to a number
2225 of messages at once.
2226 Thus
2227 .Ql delete 1 2
2228 deletes messages 1 and 2,
2229 whereas
2230 .Ql delete 1-5
2231 will delete the messages 1 through 5.
2232 In sorted or threaded mode (see the
2233 .Ic sort
2234 command),
2235 .Ql delete 1-5
2236 will delete the messages that are located between (and including)
2237 messages 1 through 5 in the sorted/threaded order, as shown in the
2238 .Ic headers
2239 summary.
2240 The following special message names exist:
2243 .Bl -tag -width ".It Ar BaNg"
2244 .It Ar \&.
2245 The current message, the so-called
2246 .Dq dot .
2248 .It Ar \&;
2249 The message that was previously the current message.
2251 .It Ar \&,
2252 The parent message of the current message,
2253 that is the message with the Message-ID given in the
2254 .Ql In-Reply-To:
2255 field or the last entry of the
2256 .Ql References:
2257 field of the current message.
2259 .It Ar -
2260 The next previous undeleted message,
2261 or the next previous deleted message for the
2262 .Ic undelete
2263 command.
2264 In sorted/threaded mode,
2265 the next previous such message in the sorted/threaded order.
2267 .It Ar +
2268 The next undeleted message,
2269 or the next deleted message for the
2270 .Ic undelete
2271 command.
2272 In sorted/threaded mode,
2273 the next such message in the sorted/threaded order.
2275 .It Ar ^
2276 The first undeleted message,
2277 or the first deleted message for the
2278 .Ic undelete
2279 command.
2280 In sorted/threaded mode,
2281 the first such message in the sorted/threaded order.
2283 .It Ar $
2284 The last message.
2285 In sorted/threaded mode,
2286 the last message in the sorted/threaded order.
2288 .It Ar & Ns Ar x
2289 In threaded mode,
2290 selects the message addressed with
2291 .Ar x ,
2292 where
2293 .Ar x
2294 is any other message specification,
2295 and all messages from the thread that begins at it.
2296 Otherwise it is identical to
2297 .Ar x .
2299 .Ar x
2300 is omitted,
2301 the thread beginning with the current message is selected.
2303 .It Ar *
2304 All messages.
2305 .It Ar `
2306 All messages that were included in the
2307 .Sx "Message list arguments"
2308 of the previous command.
2310 .It Ar x-y
2311 An inclusive range of message numbers.
2312 Selectors that may also be used as endpoints include any of
2313 .Ar .;-+^$ .
2315 .It Ar address
2316 A case-insensitive
2317 .Dq any substring matches
2318 search against the
2319 .Ql From:
2320 header, which will match addresses (too) even if
2321 .Va showname
2322 is set (and POSIX says
2323 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2324 However, if the
2325 .Va allnet
2326 variable is set, only the local part of the address is evaluated
2327 for the comparison, not ignoring case, and the setting of
2328 .Va showname
2329 is completely ignored.
2330 For finer control and match boundaries use the
2331 .Ql @
2332 search expression.
2334 .It Ar / Ns Ar string
2335 All messages that contain
2336 .Ar string
2337 in the subject field (case ignored).
2338 See also the
2339 .Va searchheaders
2340 variable.
2342 .Ar string
2343 is empty,
2344 the string from the previous specification of that type is used again.
2346 .It Xo Op Ar @ Ns Ar name-list Ns
2347 .Ar @ Ns Ar expr
2349 All messages that contain the given case-insensitive search
2350 .Ar expr Ns
2351 ession; if the \*(OPal regular expression (see
2352 .Xr re_format 7 )
2353 support is available
2354 .Ar expr
2355 will be interpreted as (an extended) one if any of the
2356 .Dq magical
2357 (extended) regular expression characters is seen: in this case this
2358 should match strings correctly which are in the locale
2359 .Ev LC_CTYPE
2360 encoding.
2361 If the optional
2362 .Ar @ Ns Ar name-list
2363 part is missing, the search is restricted to the subject field body,
2364 but otherwise
2365 .Ar name-list
2366 specifies a comma-separated list of header fields to search, as in
2368 .Dl '@to,from,cc@Someone i ought to know'
2370 In order to search for a string that includes a
2371 .Ql @
2372 (commercial at) character the
2373 .Ar name-list
2374 is effectively non-optional, but may be given as the empty string.
2375 Some special header fields may be abbreviated:
2376 .Ql f ,
2377 .Ql t ,
2378 .Ql c ,
2379 .Ql b
2381 .Ql s
2382 will match
2383 .Ql From ,
2384 .Ql To ,
2385 .Ql Cc ,
2386 .Ql Bcc
2388 .Ql Subject ,
2389 respectively and case-insensitively.
2390 The special names
2391 .Ql header
2393 .Ql <
2394 can be used to search in (all of) the header(s) of the message, and the
2395 special names
2396 .Ql body
2398 .Ql >
2400 .Ql text
2402 .Ql =
2403 can be used to perform full text searches \(en whereas the former
2404 searches only the body, the latter also searches the message header.
2406 This message specification performs full text comparison, but even with
2407 regular expression support it is almost impossible to write a search
2408 expression that savely matches only a specific address domain.
2409 To request that the content of the header is treated as a list of
2410 addresses, and to strip those down to the plain email address which the
2411 search expression is to be matched against, prefix the header name
2412 (abbreviation) with a tilde
2413 .Ql ~ :
2415 .Dl @~f@@a\e.safe\e.domain\e.match$
2417 .It Ar :c
2418 All messages of state
2419 .Ql c ,
2420 where
2421 .Ql c
2422 is one or multiple of the following colon modifiers:
2424 .Bl -tag -compact -width ".It Ar :M"
2425 .It Ar n
2426 .Ql new
2427 messages.
2428 .It Ar o
2429 Old messages (any not in state
2430 .Ql read
2432 .Ql new ) .
2433 .It Ar u
2434 .Ql unread
2435 messages.
2436 .It Ar d
2437 .Ql deleted
2438 messages (for the
2439 .Ic undelete
2441 .Ic from
2442 commands only).
2443 .It Ar r
2444 .Ql read
2445 messages.
2446 .It Ar f
2447 .Ic flag Ns
2448 ged messages.
2449 .It Ar a
2450 .Ic answered
2451 messages (cf. the variable
2452 .Va markanswered ) .
2453 .It Ar t
2454 Messages marked as
2455 .Ic draft .
2456 .It Ar s
2457 \*(OP Messages classified as spam (see
2458 .Sx "Handling spam" . )
2459 .It Ar S
2460 \*(OP Messages with unsure spam classification.
2466 \*(OP IMAP-style SEARCH expressions may also be used.
2467 This addressing mode is available with all types of mailbox
2468 .Ic folder Ns
2469 s; \*(UA will perform the search locally as necessary.
2470 Strings must be enclosed by double quotes
2471 .Ql \&"
2472 in their entirety if they contain whitespace or parentheses;
2473 within the quotes, only reverse solidus
2474 .Ql \e
2475 is recognized as an escape character.
2476 All string searches are case-insensitive.
2477 When the description indicates that the
2478 .Dq envelope
2479 representation of an address field is used,
2480 this means that the search string is checked against both a list
2481 constructed as
2483 .Bd -literal -offset indent
2484 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2488 for each address,
2489 and the addresses without real names from the respective header field.
2490 These search expressions can be nested using parentheses, see below for
2491 examples.
2494 .Bl -tag -compact -width ".It Ar _n_u"
2495 .It Ar ( criterion )
2496 All messages that satisfy the given
2497 .Ar criterion .
2498 .It Ar ( criterion1 criterion2 ... criterionN )
2499 All messages that satisfy all of the given criteria.
2501 .It Ar ( or criterion1 criterion2 )
2502 All messages that satisfy either
2503 .Ar criterion1
2505 .Ar criterion2 ,
2506 or both.
2507 To connect more than two criteria using
2508 .Ql or
2509 specifications have to be nested using additional parentheses,
2510 as with
2511 .Ql (or a (or b c)) ,
2512 since
2513 .Ql (or a b c)
2514 really means
2515 .Ql ((a or b) and c) .
2516 For a simple
2517 .Ql or
2518 operation of independent criteria on the lowest nesting level,
2519 it is possible to achieve similar effects by using three separate
2520 criteria, as with
2521 .Ql (a) (b) (c) .
2523 .It Ar ( not criterion )
2524 All messages that do not satisfy
2525 .Ar criterion .
2526 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2527 All messages that contain
2528 .Ar string
2529 in the envelope representation of the
2530 .Ql Bcc:
2531 field.
2532 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2533 All messages that contain
2534 .Ar string
2535 in the envelope representation of the
2536 .Ql Cc:
2537 field.
2538 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2539 All messages that contain
2540 .Ar string
2541 in the envelope representation of the
2542 .Ql From:
2543 field.
2544 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2545 All messages that contain
2546 .Ar string
2547 in the
2548 .Ql Subject:
2549 field.
2550 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2551 All messages that contain
2552 .Ar string
2553 in the envelope representation of the
2554 .Ql To:
2555 field.
2556 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2557 All messages that contain
2558 .Ar string
2559 in the specified
2560 .Ql Name:
2561 field.
2562 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2563 All messages that contain
2564 .Ar string
2565 in their body.
2566 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2567 All messages that contain
2568 .Ar string
2569 in their header or body.
2570 .It Ar ( larger size )
2571 All messages that are larger than
2572 .Ar size
2573 (in bytes).
2574 .It Ar ( smaller size )
2575 All messages that are smaller than
2576 .Ar size
2577 (in bytes).
2579 .It Ar ( before date )
2580 All messages that were received before
2581 .Ar date ,
2582 which must be in the form
2583 .Ql d[d]-mon-yyyy ,
2584 where
2585 .Ql d
2586 denotes the day of the month as one or two digits,
2587 .Ql mon
2588 is the name of the month \(en one of
2589 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2591 .Ql yyyy
2592 is the year as four digits, e.g.,
2593 .Ql 28-Dec-2012 .
2595 .It Ar ( on date )
2596 All messages that were received on the specified date.
2597 .It Ar ( since date )
2598 All messages that were received since the specified date.
2599 .It Ar ( sentbefore date )
2600 All messages that were sent on the specified date.
2601 .It Ar ( senton date )
2602 All messages that were sent on the specified date.
2603 .It Ar ( sentsince date )
2604 All messages that were sent since the specified date.
2605 .It Ar ()
2606 The same criterion as for the previous search.
2607 This specification cannot be used as part of another criterion.
2608 If the previous command line contained more than one independent
2609 criterion then the last of those criteria is used.
2611 .\" }}}
2613 .\" .Ss "On terminal control and line editor" {{{
2614 .Ss "On terminal control and line editor"
2616 \*(OP Terminal control will be realized through one of the standard
2618 libraries, either the
2619 .Lb libtermcap ,
2620 or, alternatively, the
2621 .Lb libterminfo ,
2622 both of which will be initialized to work with the environment variable
2623 .Ev TERM .
2624 Terminal control will enhance or enable interactive usage aspects, e.g.,
2625 .Sx "Coloured display" ,
2626 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2627 byte-sequences of keys like the cursor and function keys.
2630 The internal variable
2631 .Va termcap
2632 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2633 \*(UA may also become a fullscreen application by entering the
2634 so-called ca-mode and switching to an alternative exclusive screen
2635 (content) shall the terminal support it and the internal variable
2636 .Va termcap-ca-mode
2637 has been set explicitly.
2638 Actual interaction with the chosen library can be disabled completely by
2639 setting the internal variable
2640 .Va termcap-disable ;
2641 .Va termcap
2642 will be queried regardless, which is true even if the \*(OPal library
2643 support has not been enabled at configuration time as long as some other
2644 \*(OP which (may) query terminal control sequences has been enabled.
2647 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2648 environments which comply to the ISO C standard
2649 .St -isoC-amd1 ,
2650 and will support wide glyphs if possible (the necessary functionality
2651 had been removed from ISO C, but was included in
2652 .St -xpg4 ) .
2653 Prevent usage of a line editor in interactive mode by setting the
2654 internal variable
2655 .Va line-editor-disable .
2656 Especially if the \*(OPal terminal control support is missing setting
2657 entries in the internal variable
2658 .Va termcap
2659 will help shall the MLE misbehave, see there for more.
2660 The MLE can support a little bit of
2661 .Ic colour .
2664 \*(OP If the
2665 .Ic history
2666 feature is available then input from line editor prompts will be saved
2667 in a history list that can be searched in and be expanded from.
2668 Such saving can be prevented by prefixing input with any amount of
2669 whitespace.
2670 Aspects of history, like allowed content and maximum size, as well as
2671 whether history shall be saved persistently, can be configured with the
2672 internal variables
2673 .Va history-file ,
2674 .Va history-gabby ,
2675 .Va history-gabby-persist
2677 .Va history-size .
2680 The MLE supports a set of editing and control commands.
2681 By default (as) many (as possible) of these will be assigned to a set of
2682 single-letter control codes, which should work on any terminal (and can
2683 be generated by holding the
2684 .Dq control
2685 key while pressing the key of desire, e.g.,
2686 .Ql control-D ) .
2687 If the \*(OPal
2688 .Ic bind
2689 command is available then the MLE commands can also be accessed freely
2690 by assigning the command name, which is shown in parenthesis in the list
2691 below, to any desired key-sequence, and the MLE will instead and also use
2692 .Ic bind
2693 to establish its built-in key bindings
2694 (more of them if the \*(OPal terminal control is available),
2695 an action which can then be suppressed completely by setting
2696 .Va line-editor-no-defaults .
2697 .Sx "Shell-style argument quoting"
2698 notation is used in the following;
2699 combinations not mentioned either cause job control signals or do not
2700 generate a (unique) keycode:
2704 .Bl -tag -compact -width ".It Ql \eBa"
2705 .It Ql \ecA
2706 Go to the start of the line
2708 .Pf ( Cd mle-go-home ) .
2710 .It Ql \ecB
2711 Move the cursor backward one character
2713 .Pf ( Cd mle-go-bwd ) .
2715 .It Ql \ecD
2716 Forward delete the character under the cursor;
2717 quits \*(UA if used on the empty line unless the internal variable
2718 .Va ignoreeof
2719 is set
2721 .Pf ( Cd mle-del-fwd ) .
2723 .It Ql \ecE
2724 Go to the end of the line
2726 .Pf ( Cd mle-go-end ) .
2728 .It Ql \ecF
2729 Move the cursor forward one character
2731 .Pf ( Cd mle-go-fwd ) .
2733 .It Ql \ecG
2734 Cancel current operation, full reset.
2735 If there is an active history search or tabulator expansion then this
2736 command will first reset that, reverting to the former line content;
2737 thus a second reset is needed for a full reset in this case
2739 .Pf ( Cd mle-reset ) .
2741 .It Ql \ecH
2742 Backspace: backward delete one character
2744 .Pf ( Cd mle-del-bwd ) .
2746 .It Ql \ecI
2747 \*(NQ
2748 Horizontal tabulator:
2749 try to expand the word before the cursor, supporting the usual
2750 .Sx "Filename transformations"
2752 .Pf ( Cd mle-complete ) .
2753 This is affected by
2754 .Cd mle-quote-rndtrip .
2756 .It Ql \ecJ
2757 Newline:
2758 commit the current line
2760 .Pf ( Cd mle-commit ) .
2762 .It Ql \ecK
2763 Cut all characters from the cursor to the end of the line
2765 .Pf ( Cd mle-snarf-end ) .
2767 .It Ql \ecL
2768 Repaint the line
2770 .Pf ( Cd mle-repaint ) .
2772 .It Ql \ecN
2773 \*(OP Go to the next history entry
2775 .Pf ( Cd mle-hist-fwd ) .
2777 .It Ql \ecO
2778 (\*(OPally context-dependent) Invokes the command
2779 .Ic dt .
2781 .It Ql \ecP
2782 \*(OP Go to the previous history entry
2784 .Pf ( Cd mle-hist-bwd ) .
2786 .It Ql \ecQ
2787 Toggle roundtrip mode shell quotes, where produced,
2788 on and off
2790 .Pf ( Cd mle-quote-rndtrip ) .
2791 This setting is temporary, and will be forgotten once the command line
2792 is committed; also see
2793 .Ic shcodec .
2795 .It Ql \ecR
2796 \*(OP Complete the current line from (the remaining) older history entries
2798 .Pf ( Cd mle-hist-srch-bwd ) .
2800 .It Ql \ecS
2801 \*(OP Complete the current line from (the remaining) newer history entries
2803 .Pf ( Cd mle-hist-srch-fwd ) .
2805 .It Ql \ecT
2806 Paste the snarf buffer
2808 .Pf ( Cd mle-paste ) .
2810 .It Ql \ecU
2811 The same as
2812 .Ql \ecA
2813 followed by
2814 .Ql \ecK
2816 .Pf ( Cd mle-snarf-line ) .
2818 .It Ql \ecV
2819 Prompts for a Unicode character (its hexadecimal number) to be inserted
2821 .Pf ( Cd mle-prompt-char ) .
2822 Note this command needs to be assigned to a single-letter control code
2823 in order to become recognized and executed during input of
2824 a key-sequence (only three single-letter control codes can be used for
2825 that shortcut purpose); this control code is special-treated and cannot
2826 be part of any other sequence, because any occurrence will perform the
2827 .Cd mle-prompt-char
2828 function immediately.
2830 .It Ql \ecW
2831 Cut the characters from the one preceding the cursor to the preceding
2832 word boundary
2834 .Pf ( Cd mle-snarf-word-bwd ) .
2836 .It Ql \ecX
2837 Move the cursor forward one word boundary
2839 .Pf ( Cd mle-go-word-fwd ) .
2841 .It Ql \ecY
2842 Move the cursor backward one word boundary
2844 .Pf ( Cd mle-go-word-bwd ) .
2846 .It Ql \ec[
2847 Escape: reset a possibly used multibyte character input state machine
2848 and \*(OPally a lingering, incomplete key binding
2850 .Pf ( Cd mle-cancel ) .
2851 This command needs to be assigned to a single-letter control code in
2852 order to become recognized and executed during input of a key-sequence
2853 (only three single-letter control codes can be used for that shortcut
2854 purpose).
2855 This control code may also be part of a multi-byte sequence, but if
2856 a sequence is active and the very control code is currently also an
2857 expected input, then it will first be consumed by the active sequence.
2859 .It Ql \ec\e
2860 (\*(OPally context-dependent) Invokes the command
2861 .Ql Ic z Ns + .
2863 .It Ql \ec]
2864 (\*(OPally context-dependent) Invokes the command
2865 .Ql Ic z Ns $ .
2867 .It Ql \ec^
2868 (\*(OPally context-dependent) Invokes the command
2869 .Ql Ic z Ns 0 .
2871 .It Ql \ec_
2872 Cut the characters from the one after the cursor to the succeeding word
2873 boundary
2875 .Pf ( Cd mle-snarf-word-fwd ) .
2877 .It Ql \ec?
2878 Backspace:
2879 .Cd mle-del-bwd .
2881 .It \(en
2883 .Cd mle-fullreset :
2884 different to
2885 .Cd mle-reset
2886 this will immediately reset a possibly active search etc.
2888 .It \(en
2890 .Cd mle-bell :
2891 ring the audible bell.
2893 .\" }}}
2895 .\" .Ss "Coloured display" {{{
2896 .Ss "Coloured display"
2898 \*(OP \*(UA can be configured to support a coloured display and font
2899 attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic
2900 rendition) escape sequences.
2901 Usage of colours and font attributes solely depends upon the
2902 capability of the detected terminal type that is defined by the
2903 environment variable
2904 .Ev TERM
2905 and which can be fine-tuned by the user via the internal variable
2906 .Va termcap .
2909 On top of what \*(UA knows about the terminal the boolean variable
2910 .Va colour-pager
2911 defines whether the actually applicable colour and font attribute
2912 sequences should also be generated when output is going to be paged
2913 through the external program defined by the environment variable
2914 .Ev PAGER
2915 (also see
2916 .Va crt Ns
2918 This is not enabled by default because different pager programs need
2919 different command line switches or other configuration in order to
2920 support those sequences.
2921 \*(UA however knows about some widely used pagers and in a clean
2922 environment it is often enough to simply set
2923 .Va colour-pager ;
2924 please refer to that variable for more on this topic.
2927 If the variable
2928 .Va colour-disable
2929 is set then any active usage of colour and font attribute sequences
2930 is suppressed, but without affecting possibly established
2931 .Ic colour
2932 mappings.
2935 To define and control colours and font attributes a single multiplexer
2936 command family exists:
2937 .Ic colour
2938 shows or defines colour mappings for the given colour type (e.g.,
2939 monochrome) and
2940 .Ic uncolour
2941 can be used to remove mappings of a given colour type.
2942 Since colours are only available in interactive mode, it may make
2943 sense to conditionalize the colour setup by encapsulating it with
2944 .Ic if :
2946 .Bd -literal -offset indent
2947 if terminal && [ "$features" =% +colour ]
2948   colour iso view-msginfo ft=bold,fg=green
2949   colour iso view-header ft=bold,fg=red from,subject
2950   colour iso view-header fg=red
2952   uncolour iso view-header from,subject
2953   colour iso view-header ft=bold,fg=magenta,bg=cyan
2954   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
2955   colour mono view-header ft=bold
2956   colour mono view-header ft=bold,ft=reverse subject,from
2957 endif
2959 .\" }}}
2961 .\" .Ss "Handling spam" {{{
2962 .Ss "Handling spam"
2964 \*(OP \*(UA can make use of several spam interfaces for the purpose of
2965 identification of, and, in general, dealing with spam messages.
2966 A precondition of most commands in order to function is that the
2967 .Va spam-interface
2968 variable is set to one of the supported interfaces.
2969 Once messages have been identified as spam their (volatile)
2970 .Ql is-spam
2971 state can be prompted: the
2972 .Ql Ar :s
2974 .Ql Ar :S
2975 message specifications will address respective messages and their
2976 .Va attrlist
2977 entries will be used when displaying the
2978 .Va headline
2979 in the header display.
2981 .Bl -bullet
2983 .Ic spamrate
2984 rates the given messages and sets their
2985 .Ql is-spam
2986 flag accordingly.
2987 If the spam interface offers spam scores those can also be displayed in
2988 the header display by including the
2989 .Ql %$
2990 format in the
2991 .Va headline
2992 variable.
2994 .Ic spamham ,
2995 .Ic spamspam
2997 .Ic spamforget
2998 will interact with the Bayesian filter of the chosen interface and learn
2999 the given messages as
3000 .Dq ham
3002 .Dq spam ,
3003 respectively; the last command can be used to cause
3004 .Dq unlearning
3005 of messages; it adheres to their current
3006 .Ql is-spam
3007 state and thus reverts previous teachings.
3009 .Ic spamclear
3011 .Ic spamset
3012 will simply set and clear, respectively, the mentioned volatile
3013 .Ql is-spam
3014 message flag, without any interface interaction.
3019 .Xr spamassassin 1
3020 based
3021 .Va spam-interface
3022 .Ql spamc
3023 requires a running instance of the
3024 .Xr spamd 1
3025 server in order to function, started with the option
3026 .Fl -allow-tell
3027 shall Bayesian filter learning be possible.
3029 .Bd -literal -offset indent
3030 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3031 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3032     --daemonize [--local] [--allow-tell]
3036 Thereafter \*(UA can make use of these interfaces:
3038 .Bd -literal -offset indent
3039 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3040     -Sspamc-command=/usr/local/bin/spamc \e
3041     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3043 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3044     -Sspamc-command=/usr/local/bin/spamc \e
3045     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3049 Using the generic filter approach allows usage of programs like
3050 .Xr bogofilter 1 .
3051 Here is an example, requiring it to be accessible via
3052 .Ev PATH :
3054 .Bd -literal -offset indent
3055 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3056     -Sspamfilter-ham="bogofilter -n" \e
3057     -Sspamfilter-noham="bogofilter -N" \e
3058     -Sspamfilter-nospam="bogofilter -S" \e
3059     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3060     -Sspamfilter-spam="bogofilter -s" \e
3061     -Sspamfilter-rate-scanscore="1;^(.+)$"
3065 Because messages must exist on local storage in order to be scored (or
3066 used for Bayesian filter training), it is possibly a good idea to
3067 perform the local spam check last.
3068 Spam can be checked automatically when opening specific folders by
3069 setting a specialized form of the internal variable
3070 .Va folder-hook .
3072 .Bd -literal -offset indent
3073 define spamdelhook {
3074   # Server side DCC
3075   spamset (header x-dcc-brand-metrics "bulk")
3076   # Server-side spamassassin(1)
3077   spamset (header x-spam-flag "YES")
3078   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3079   move :S +maybe-spam
3080   spamrate :u
3081   del :s
3082   move :S +maybe-spam
3084 set folder-hook-SOMEFOLDER=spamdelhook
3088 See also the documentation for the variables
3089 .Va spam-interface , spam-maxsize ,
3090 .Va spamc-command , spamc-arguments , spamc-user ,
3091 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3092   spamfilter-rate
3094 .Va spamfilter-rate-scanscore .
3095 .\" }}}
3097 .\" }}} (DESCRIPTION)
3100 .\" .Sh COMMANDS {{{
3101 .Sh COMMANDS
3103 \*(UA reads input in lines.
3104 An unquoted reverse solidus
3105 .Ql \e
3106 at the end of a command line
3107 .Dq escapes
3108 the newline character: it is discarded and the next line of input is
3109 used as a follow-up line, with all leading whitespace removed;
3110 once an entire line is completed, the whitespace characters
3111 .Cm space , tabulator , newline
3112 as well as those defined by the variable
3113 .Va ifs
3114 are removed from the beginning and end.
3115 Placing any whitespace characters at the beginning of a line will
3116 prevent a possible addition of the command line to the \*(OPal
3117 .Ic history .
3120 The beginning of such input lines is then scanned for the name of
3121 a known command: command names may be abbreviated, in which case the
3122 first command that matches the given prefix will be used.
3123 .Sx "Command modifiers"
3124 may prefix a command in order to modify its behaviour.
3125 A name may also be a
3126 .Ic commandalias ,
3127 which will become expanded until no more expansion is possible.
3128 Once the command that shall be executed is known, the remains of the
3129 input line will be interpreted according to command-specific rules,
3130 documented in the following.
3133 This behaviour is different to the
3134 .Xr sh 1 Ns
3135 ell, which is a programming language with syntactic elements of clearly
3136 defined semantics, and therefore capable to sequentially expand and
3137 evaluate individual elements of a line.
3138 \*(UA will never be able to handle
3139 .Ql ? set one=value two=$one
3140 in a single statement, because the variable assignment is performed by
3141 the command
3142 .Pf ( Ic set ) ,
3143 not the language.
3146 The command
3147 .Ic list
3148 can be used to show the list of all commands, either alphabetically
3149 sorted or in prefix search order (these do not match, also because the
3150 POSIX standard prescribes a set of abbreviations).
3151 \*(OPally the command
3152 .Ic help
3154 .Ic \&? ) ,
3155 when given an argument, will show a documentation string for the
3156 command matching the expanded argument, as in
3157 .Ql ?t ,
3158 which should be a shorthand of
3159 .Ql ?type ;
3160 with these documentation strings both commands support a more
3161 .Va verbose
3162 listing mode which includes the argument type of the command and other
3163 information which applies; a handy suggestion might thus be:
3165 .Bd -literal -offset indent
3166 ? define __xv {
3167   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3168   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
3170 ? commandalias xv '\ecall __xv'
3171 ? xv help set
3174 .\" .Ss "Command modifiers" {{{
3175 .Ss "Command modifiers"
3177 Commands may be prefixed by one or multiple command modifiers.
3179 .Bl -bullet
3181 The modifier reverse solidus
3183 .Cm \e ,
3184 to be placed first, prevents
3185 .Ic commandalias
3186 expansions on the remains of the line, e.g.,
3187 .Ql \eecho
3188 will always evaluate the command
3189 .Ic echo ,
3190 even if an (command)alias of the same name exists.
3191 .Ic commandalias
3192 content may itself contain further command modifiers, including
3193 an initial reverse solidus to prevent further expansions.
3196 The modifier
3198 .Cm ignerr
3199 indicates that any error generated by the following command should be
3200 ignored by the state machine and not cause a program exit with enabled
3201 .Va errexit
3202 or for the standardized exit cases in
3203 .Va posix
3204 mode.
3205 .Va \&? ,
3206 one of the
3207 .Sx "INTERNAL VARIABLES" ,
3208 will be set to the real exit status of the command regardless.
3212 .Cm local
3213 does yet not implement any functionality.
3217 .Cm u
3218 does yet not implement any functionality.
3221 Some commands support the
3223 .Cm vput
3224 modifier: if used, they expect the name of a variable, which can itself
3225 be a variable, i.e., shell expansion is applied, as their first
3226 argument, and will place their computation result in it instead of the
3227 default location (it is usually written to standard output).
3229 The given name will be tested for being a valid
3230 .Xr sh 1
3231 variable name, and may therefore only consist of upper- and lowercase
3232 characters, digits, and the underscore; the hyphen-minus may be used as
3233 a non-portable extension; digits may not be used as first, hyphen-minus
3234 may not be used as last characters.
3235 In addition the name may either not be one of the known
3236 .Sx "INTERNAL VARIABLES" ,
3237 or must otherwise refer to a writable (non-boolean) value variable.
3238 The actual put operation may fail nonetheless, e.g., if the variable
3239 expects a number argument only a number will be accepted.
3240 Any error during these operations causes the command as such to fail,
3241 and the error number
3242 .Va \&!
3243 will be set to
3244 .Va ^ERR Ns -NOTSUP ,
3245 the exit status
3246 .Va \&?
3247 should be set to
3248 .Ql -1 .
3251 Last, but not least, the modifier
3253 .Cm wysh
3254 can be used for some old and established commands to choose the new
3255 .Sx "Shell-style argument quoting"
3256 rules over the traditional
3257 .Sx "Old-style argument quoting" .
3259 .\" }}}
3261 .\" .Ss "Message list arguments" {{{
3262 .Ss "Message list arguments"
3264 Some commands expect arguments that represent messages (actually
3265 their symbolic message numbers), as has been documented above under
3266 .Sx "Specifying messages"
3267 already.
3268 If no explicit message list has been specified, the next message
3269 forward that satisfies the command's requirements will be used,
3270 and if there are no messages forward of the current message,
3271 the search proceeds backwards;
3272 if there are no good messages at all to be found, an error message is
3273 shown and the command is aborted.
3274 .\" }}}
3276 .\" .Ss "Old-style argument quoting" {{{
3277 .Ss "Old-style argument quoting"
3279 \*(ID This section documents the old, traditional style of quoting
3280 non-message-list arguments to commands which expect this type of
3281 arguments: whereas still used by the majority of such commands, the new
3282 .Sx "Shell-style argument quoting"
3283 may be available even for those via
3284 .Cm wysh ,
3285 one of the
3286 .Sx "Command modifiers" .
3287 Nonetheless care must be taken, because only new commands have been
3288 designed with all the capabilities of the new quoting rules in mind,
3289 which can, e.g., generate control characters.
3292 .Bl -bullet -offset indent
3294 An argument can be enclosed between paired double-quotes
3295 .Ql """argument"""
3297 single-quotes
3298 .Ql 'argument' ;
3299 any whitespace, shell word expansion, or reverse solidus characters
3300 (except as described next) within the quotes are treated literally as
3301 part of the argument.
3302 A double-quote will be treated literally within single-quotes and vice
3303 versa.
3304 Inside such a quoted string the actually used quote character can be
3305 used nonetheless by escaping it with a reverse solidus
3306 .Ql \e ,
3307 as in
3308 .Ql """y\e""ou""" .
3311 An argument that is not enclosed in quotes, as above, can usually still
3312 contain space characters if those spaces are reverse solidus escaped, as in
3313 .Ql you\e are .
3316 A reverse solidus outside of the enclosing quotes is discarded
3317 and the following character is treated literally as part of the argument.
3319 .\" }}}
3321 .\" .Ss "Shell-style argument quoting" {{{
3322 .Ss "Shell-style argument quoting"
3324 Commands which don't expect message-list arguments use
3325 .Xr sh 1 Ns
3326 ell-style, and therefore POSIX standardized, argument parsing and
3327 quoting rules.
3328 \*(ID Most new commands only support these new rules and are flagged
3329 \*(NQ, some elder ones can use them with the command modifier
3330 .Cm wysh ;
3331 in the future only this type of argument quoting will remain.
3334 A command line is parsed from left to right and an input token is
3335 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3336 Metacharacters are vertical bar
3337 .Cm \&| ,
3338 ampersand
3339 .Cm & ,
3340 semicolon
3341 .Cm \&; ,
3342 as well as all characters from the variable
3343 .Va ifs ,
3344 and / or
3345 .Cm space , tabulator , newline .
3346 The additional metacharacters left and right parenthesis
3347 .Cm \&( , \&)
3348 and less-than and greater-than signs
3349 .Cm < , >
3350 that the
3351 .Xr sh 1
3352 supports are not used, and are treated as ordinary characters: for one
3353 these characters are a vivid part of email addresses, and it seems
3354 highly unlikely that their function will become meaningful to \*(UA.
3356 .Bd -filled -offset indent
3357 .Sy Compatibility note:
3358 \*(ID Please note that even many new-style commands do not yet honour
3359 .Va ifs
3360 to parse their arguments: whereas the
3361 .Xr sh 1 Ns
3362 ell is a language with syntactic elements of clearly defined semantics,
3363 \*(UA parses entire input lines and decides on a per-command base what
3364 to do with the rest of the line.
3365 This also means that whenever an unknown command is seen all that \*(UA
3366 can do is cancellation of the processing of the remains of the line.
3368 It also often depends on an actual subcommand of a multiplexer command
3369 how the rest of the line should be treated, and until v15 we are not
3370 capable to perform this deep inspection of arguments.
3371 Nonetheless, at least the following commands which work with positional
3372 parameters fully support
3373 .Va ifs
3374 for an almost shell-compatible field splitting:
3375 .Ic call , call_if , read , vpospar , xcall .
3379 Any unquoted number sign
3380 .Ql #
3381 at the beginning of a new token starts a comment that extends to the end
3382 of the line, and therefore ends argument processing.
3383 An unquoted dollar sign
3384 .Ql $
3385 will cause variable expansion of the given name, which must be a valid
3386 .Xr sh 1 Ns
3387 ell-style variable name (see
3388 .Cm vput ) :
3389 .Sx "INTERNAL VARIABLES"
3390 as well as
3391 .Sx ENVIRONMENT
3392 (shell) variables can be accessed through this mechanism, brace
3393 enclosing the name is supported (i.e., to subdivide a token).
3396 Whereas the metacharacters
3397 .Cm space , tabulator , newline
3398 only complete an input token, vertical bar
3399 .Cm \&| ,
3400 ampersand
3401 .Cm &
3402 and semicolon
3403 .Cm \&;
3404 also act as control operators and perform control functions.
3405 For now supported is semicolon
3406 .Cm \&; ,
3407 which terminates a single command, therefore sequencing the command line
3408 and making the remainder of the line a subject to reevaluation.
3409 With sequencing, multiple command argument types and quoting rules may
3410 therefore apply to a single line, which can become problematic before
3411 v15: e.g., the first of the following will cause surprising results.
3414 .Dl ? echo one; set verbose; echo verbose=$verbose.
3415 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3418 Quoting is a mechanism that will remove the special meaning of
3419 metacharacters and reserved words, and will prevent expansion.
3420 There are four quoting mechanisms: the escape character, single-quotes,
3421 double-quotes and dollar-single-quotes:
3424 .Bl -bullet -offset indent
3426 The literal value of any character can be preserved by preceding it
3427 with the escape character reverse solidus
3428 .Ql \e .
3431 Arguments which are enclosed in
3432 .Ql 'single-\:quotes'
3433 retain their literal value.
3434 A single-quote cannot occur within single-quotes.
3437 The literal value of all characters enclosed in
3438 .Ql \(dqdouble-\:quotes\(dq
3439 is retained, with the exception of dollar sign
3440 .Ql $ ,
3441 which will cause variable expansion, as above, backquote (grave accent)
3442 .Ql ` ,
3443 (which not yet means anything special), reverse solidus
3444 .Ql \e ,
3445 which will escape any of the characters dollar sign
3446 .Ql $
3447 (to prevent variable expansion), backquote (grave accent)
3448 .Ql ` ,
3449 double-quote
3450 .Ql \(dq
3451 (to prevent ending the quote) and reverse solidus
3452 .Ql \e
3453 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3454 but has no special meaning otherwise.
3457 Arguments enclosed in
3458 .Ql $'dollar-\:single-\:quotes'
3459 extend normal single quotes in that reverse solidus escape sequences are
3460 expanded as follows:
3462 .Bl -tag -compact -width "Ql \eNNN"
3463 .It Ql \ea
3464 bell control character (ASCII and ISO-10646 BEL).
3465 .It Ql \eb
3466 backspace control characer (ASCII and ISO-10646 BS).
3467 .It Ql \eE
3468 escape control character (ASCII and ISO-10646 ESC).
3469 .It Ql \ee
3470 the same.
3471 .It Ql \ef
3472 form feed control character (ASCII and ISO-10646 FF).
3473 .It Ql \en
3474 line feed control character (ASCII and ISO-10646 LF).
3475 .It Ql \er
3476 carriage return control character (ASCII and ISO-10646 CR).
3477 .It Ql \et
3478 horizontal tabulator control character (ASCII and ISO-10646 HT).
3479 .It Ql \ev
3480 vertical tabulator control character (ASCII and ISO-10646 VT).
3481 .It Ql \e\e
3482 emits a reverse solidus character.
3483 .It Ql \e'
3484 single quote.
3485 .It Ql \e"
3486 double quote (escaping is optional).
3487 .It Ql \eNNN
3488 eight-bit byte with the octal value
3489 .Ql NNN
3490 (one to three octal digits), optionally prefixed by an additional
3491 .Ql 0 .
3492 A 0 byte will suppress further output for the quoted argument.
3493 .It Ql \exHH
3494 eight-bit byte with the hexadecimal value
3495 .Ql HH
3496 (one or two hexadecimal characters).
3497 A 0 byte will suppress further output for the quoted argument.
3498 .It Ql \eUHHHHHHHH
3499 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3500 .Ql HHHHHHHH
3501 (one to eight hexadecimal digits) \(em note that Unicode defines the
3502 maximum codepoint ever to be supported as
3503 .Ql 0x10FFFF
3504 (in planes of
3505 .Ql 0xFFFF
3506 characters each).
3507 This escape is only supported in locales that support Unicode (see
3508 .Sx "Character sets" ) ,
3509 in other cases the sequence will remain unexpanded unless the given code
3510 point is ASCII compatible or (if the \*(OPal character set conversion is
3511 available) can be represented in the current locale.
3512 The character NUL will suppress further output for the quoted argument.
3513 .It Ql \euHHHH
3514 Identical to
3515 .Ql \eUHHHHHHHH
3516 except it takes only one to four hexadecimal digits.
3517 .It Ql \ecX
3518 Emits the non-printable (ASCII and compatible) C0 control codes
3519 0 (NUL) to 31 (US), and 127 (DEL).
3520 Printable representations of ASCII control codes can be created by
3521 mapping them to a different part of the ASCII character set, which is
3522 possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is
3523 .Ql 7 + 64 = 71 = G .
3524 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3525 .Ic vexpr ) ,
3526 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3527 .Ql ? vexpr ^ 127 64 .
3529 Whereas historically circumflex notation has often been used for
3530 visualization purposes of control codes, e.g.,
3531 .Ql ^G ,
3532 the reverse solidus notation has been standardized:
3533 .Ql \ecG .
3534 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3535 as shown above (e.g.,
3536 .Ql \ea ,
3537 .Ql \en ,
3538 .Ql \et ) :
3539 whenever such an alias exists it will be used for display purposes.
3540 The control code NUL
3541 .Pf ( Ql \ec@ ,
3542 a non-standard extension) will suppress further output for the remains
3543 of the token (which may extend beyond the current quote), or, depending
3544 on the context, the remains of all arguments for the current command.
3545 .It Ql \e$NAME
3546 Non-standard extension: expand the given variable name, as above.
3547 Brace enclosing the name is supported.
3548 .It Ql \e`{command}
3549 Not yet supported, just to raise awareness: Non-standard extension.
3554 Caveats:
3556 .Bd -literal -offset indent
3557 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3558 ? echo Quotes ${HOME} and tokens differ! # comment
3559 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3561 .\" }}}
3563 .\" .Ss "Raw data arguments for codec commands" {{{
3564 .Ss "Raw data arguments for codec commands"
3566 A special set of commands, which all have the string
3567 .Dq codec
3568 in their name, e.g.,
3569 .Ic addrcodec ,
3570 .Ic shcodec ,
3571 .Ic urlcodec ,
3572 take raw string data as input, which means that the content of the
3573 command input line is passed completely unexpanded and otherwise
3574 unchanged: like this the effect of the actual codec is visible without
3575 any noise of possible shell quoting rules etc., i.e., the user can input
3576 one-to-one the desired or questionable data.
3577 To gain a level of expansion, the entire command line can be
3578 .Ic eval Ns
3579 uated first, e.g.,
3581 .Bd -literal -offset indent
3582 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3583 ? echo $res
3584 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3585 ? shcodec d $res
3586 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3587 ? eval shcodec d $res
3588 /usr/Sch\[:o]nes Wetter/heute.txt
3590 .\" }}}
3592 .\" .Ss "Filename transformations" {{{
3593 .Ss "Filename transformations"
3595 Filenames, where expected, and unless documented otherwise, are
3596 subsequently subject to the following filename transformations, in
3597 sequence:
3599 .Bl -bullet -offset indent
3601 If the given name is a registered
3602 .Ic shortcut ,
3603 it will be replaced with the expanded shortcut.
3606 The filename is matched against the following patterns or strings:
3608 .Bl -hang -compact -width ".Ar %user"
3609 .It Ar #
3610 (Number sign) is expanded to the previous file.
3611 .It Ar %
3612 (Percent sign) is replaced by the invoking
3613 .Mx -ix "primary system mailbox"
3614 user's primary system mailbox, which either is the (itself expandable)
3615 .Va inbox
3616 if that is set, the standardized absolute pathname indicated by
3617 .Ev MAIL
3618 if that is set, or a built-in compile-time default otherwise.
3619 .It Ar %user
3620 Expands to the primary system mailbox of
3621 .Ar user
3622 (and never the value of
3623 .Va inbox ,
3624 regardless of its actual setting).
3625 .It Ar &
3626 (Ampersand) is replaced with the invoking users
3627 .Mx -ix "secondary mailbox"
3628 secondary mailbox, the
3629 .Ev MBOX .
3630 .It Ar +file
3631 Refers to a
3632 .Ar file
3633 in the
3634 .Va folder
3635 directory (if that variable is set).
3636 .It Ar %:filespec
3637 Expands to the same value as
3638 .Ar filespec ,
3639 but has special meaning when used with, e.g., the command
3640 .Ic file :
3641 the file will be treated as a primary system mailbox by, e.g., the
3642 .Ic mbox
3644 .Ic save
3645 commands, meaning that messages that have been read in the current
3646 session will be moved to the
3647 .Ev MBOX
3648 mailbox instead of simply being flagged as read.
3652 Meta expansions are applied to the resulting filename, as applicable to
3653 the resulting file access protocol (also see
3654 .Sx "On URL syntax and credential lookup" ) .
3655 If the fully expanded filename results in multiple pathnames and the
3656 command is expecting only one file, an error results.
3658 For the file-protocol, a leading tilde
3659 .Ql ~
3660 character will be replaced by the expansion of
3661 .Ev HOME ,
3662 except when followed by a valid user name, in which case the home
3663 directory of the given user is used instead.
3665 In addition a shell expansion as if specified in double-quotes (see
3666 .Sx "Shell-style argument quoting" )
3667 is applied, so that any occurrence of
3668 .Ql $VARIABLE
3670 .Ql ${VARIABLE} )
3671 will be replaced by the expansion of the variable, if possible;
3672 .Sx "INTERNAL VARIABLES"
3673 as well as
3674 .Sx ENVIRONMENT
3675 (shell) variables can be accessed through this mechanism.
3677 In interactive context, in order to allow simple value acceptance (via
3678 .Dq ENTER ) ,
3679 arguments will usually be displayed in a properly quoted form, e.g., a file
3680 .Ql diet\e is \ecurd.txt
3681 may be displayed as
3682 .Ql 'diet\e is \ecurd.txt' .
3684 .\" }}}
3686 .\" .Ss "Commands" {{{
3687 .Ss "Commands"
3689 The following commands are available:
3691 .Bl -tag -width ".It Ic BaNg"
3695 .It Ic \&!
3696 Executes the
3697 .Ev SHELL
3698 command which follows, replacing unescaped exclamation marks with the
3699 previously executed command if the internal variable
3700 .Va bang
3701 is set.
3702 This command supports
3703 .Cm vput
3704 as documented in
3705 .Sx "Command modifiers" ,
3706 and manages the error number
3707 .Va \&! .
3708 A 0 or positive exit status
3709 .Va \&?
3710 reflects the exit status of the command, negative ones that
3711 an error happened before the command was executed, or that the program
3712 did not exit cleanly, but, e.g., due to a signal: the error number is
3713 .Va ^ERR Ns -CHILD ,
3714 then.
3717 In conjunction with the
3718 .Cm vput
3719 modifier the following special cases exist:
3720 a negative exit status occurs if the collected data could not be stored
3721 in the given variable, which is a
3722 .Va ^ERR Ns -NOTSUP
3723 error that should otherwise not occur.
3724 .Va ^ERR Ns -CANCELED
3725 indicates that no temporary file could be created to collect the command
3726 output at first glance.
3727 In case of catchable out-of-memory situations
3728 .Va ^ERR Ns -NOMEM
3729 will occur and \*(UA will try to store the empty string, just like with
3730 all other detected error conditions.
3734 .It Ic #
3735 The comment-command causes the entire line to be ignored.
3736 .Sy Note:
3737 this really is a normal command which' purpose is to discard its
3738 arguments, not a
3739 .Dq comment-start
3740 indicating special character, which means that, e.g., trailing comments
3741 on a line are not possible.
3744 .It Ic +
3745 Goes to the next message in sequence and types it
3746 (like
3747 .Dq ENTER ) .
3750 .It Ic -
3751 Display the preceding message, or the n'th previous message if given
3752 a numeric argument n.
3755 .It Ic =
3756 Show the current message number (the
3757 .Dq dot ) .
3760 .It Ic \&?
3761 Show a brief summary of commands.
3762 \*(OP Given an argument a synopsis for the command in question is
3763 shown instead; commands can be abbreviated in general and this command
3764 can be used to see the full expansion of an abbreviation including the
3765 synopsis, try, e.g.,
3766 .Ql ?h ,
3767 .Ql ?hel
3769 .Ql ?help
3770 and see how the output changes.
3771 This mode also supports a more
3772 .Va verbose
3773 output, which will provide the informations documented for
3774 .Ic list .
3777 .It Ic \&|
3778 A synonym for the
3779 .Ic pipe
3780 command.
3784 .It Ic account , unaccount
3785 (ac, una) Creates, selects or lists (an) account(s).
3786 Accounts are special incarnations of
3787 .Ic define Ns d
3788 macros and group commands and variable settings which together usually
3789 arrange the environment for the purpose of creating an email account.
3790 Different to normal macros settings which are covered by
3791 .Ic localopts
3792 \(en here by default enabled! \(en will not be reverted before the
3793 .Ic account
3794 is changed again.
3795 The special account
3796 .Ql null
3797 (case-insensitive) always exists, and all but it can be deleted by the
3798 latter command, and in one operation with the special name
3799 .Ql * .
3800 Also for all but it a possibly set
3801 .Va on-account-cleanup
3802 hook is called once they are left.
3804 Without arguments a listing of all defined accounts is shown.
3805 With one argument the given account is activated: the system
3806 .Va inbox
3807 of that account will be activated (as via
3808 .Ic file ) ,
3809 a possibly installed
3810 .Va folder-hook
3811 will be run, and the internal variable
3812 .Va account
3813 will be updated.
3814 The two argument form is identical to defining a macro as via
3815 .Ic define :
3816 .Bd -literal -offset indent
3817 account myisp {
3818   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3819   set from='(My Name) myname@myisp.example'
3820   set mta=smtp://mylogin@smtp.myisp.example
3826 .It Ic addrcodec
3827 Perform email address codec transformations on raw-data argument, rather
3828 according to email standards (RFC 5322; \*(ID will furtherly improve).
3829 Supports
3830 .Cm vput
3831 (see
3832 .Sx "Command modifiers" ) ,
3833 and manages the error number
3834 .Va \&! .
3835 The first argument must be either
3836 .Ar [+[+[+]]]e[ncode] ,
3837 .Ar d[ecode]
3839 .Ar s[kin] ,
3840 and specifies the operation to perform on the rest of the line.
3843 Decoding will show how a standard-compliant MUA will display the given
3844 argument, which should be an email address.
3845 Please be aware that most MUAs have difficulties with the address
3846 standards, and vary wildly when (comments) in parenthesis,
3847 .Dq double-quoted
3848 strings, or quoted-pairs, as below, become involved.
3849 \*(ID \*(UA currently does not perform decoding when displaying addresses.
3852 Skinning is identical to decoding but only outputs the plain address,
3853 without any string, comment etc. components.
3854 Another difference is that it may fail with the error number
3855 .Va \&!
3856 set to
3857 .Va ^ERR Ns -INVAL
3858 if decoding fails to find a(n) (valid) email address, in which case the
3859 unmodified input will be output again.
3862 Encoding supports four different modes, lesser automated versions can be
3863 chosen by prefixing one, two or three plus signs: the standard imposes
3864 a special meaning on some characters, which thus have to be transformed
3865 to so-called quoted-pairs by pairing them with a reverse solidus
3866 .Ql \e
3867 in order to remove the special meaning; this might change interpretation
3868 of the entire argument from what has been desired, however!
3869 Specify one plus sign to remark that parenthesis shall be left alone,
3870 two for not turning double quotation marks into quoted-pairs, and three
3871 for also leaving any user-specified reverse solidus alone.
3872 The result will always be valid, if a successful exit status is reported.
3873 \*(ID Addresses need to be specified in between angle brackets
3874 .Ql < ,
3875 .Ql >
3876 if the construct becomes more difficult, otherwise the current parser
3877 will fail; it is not smart enough to guess right.
3879 .Bd -literal -offset indent
3880 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
3881 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3882 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3883 "Hey, you", \e out\e there <diet@exam.ple>
3884 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3885 diet@exam.ple
3891 .It Ic alias , unalias
3892 (a, una) Aliases are a method of creating personal distribution lists
3893 that map a single alias name to none to multiple real receivers;
3894 these aliases become expanded after message composing is completed.
3895 The latter command removes the given list of aliases, the special name
3896 .Ql *
3897 will discard all existing aliases.
3899 The former command shows all currently defined aliases when used without
3900 arguments, and with one argument the expansion of the given alias.
3901 With more than one argument, creates or appends to the alias name given
3902 as the first argument the remaining arguments.
3903 Alias names adhere to the Postfix MTA
3904 .Xr aliases 5
3905 rules and are thus restricted to alphabetic characters, digits, the
3906 underscore, hyphen-minus, the number sign, colon and commercial at,
3907 the last character can also be the dollar sign; the regular expression:
3908 .Ql [[:alnum:]_#:@-]+$? .
3909 As extensions the exclamation mark
3910 .Ql \&! ,
3911 period
3912 .Ql \&.
3913 as well as
3914 .Dq any character that has the high bit set
3915 may be used.
3919 .It Ic alternates , unalternates
3920 \*(NQ (alt) Manage a list of alternate addresses or names of the active user,
3921 members of which will be removed from recipient lists.
3922 The latter command removes the given list of alternates, the special name
3923 .Ql *
3924 will discard all existing aliases.
3925 The former command manages the error number
3926 .Va \&!
3927 and shows the current set of alternates when used without arguments; in
3928 this mode it supports
3929 .Cm vput
3930 (see
3931 .Sx "Command modifiers" ) .
3932 Otherwise the given arguments (after being checked for validity) are
3933 appended to the list of alternate names; in
3934 .Va posix
3935 mode they replace that list instead.
3936 There is a set of implicit alternates which is formed of the values of
3937 .Ev LOGNAME ,
3938 .Va from ,
3939 .Va sender
3941 .Va reply-to .
3945 .It Ic answered , unanswered
3946 Take a message lists and mark each message as having been answered,
3947 having not been answered, respectively.
3948 Messages will be marked answered when being
3949 .Ic reply Ns d
3950 to automatically if the
3951 .Va markanswered
3952 variable is set.
3953 See the section
3954 .Sx "Message states" .
3959 .It Ic bind , unbind
3960 \*(OP\*(NQ The bind command extends the MLE (see
3961 .Sx "On terminal control and line editor" )
3962 with freely configurable key bindings.
3963 The latter command removes from the given context the given key binding,
3964 both of which may be specified as a wildcard
3965 .Ql * ,
3966 so that, e.g.,
3967 .Ql unbind * *
3968 will remove all bindings of all contexts.
3969 Due to initialization order unbinding will not work for built-in key
3970 bindings upon program startup, however: please use
3971 .Va line-editor-no-defaults
3972 for this purpose instead.
3975 With one argument the former command shows all key bindings for the
3976 given context, specifying an asterisk
3977 .Ql *
3978 will show the bindings of all contexts; a more verbose listing will be
3979 produced if either of
3980 .Va debug
3982 .Va verbose
3983 are set.
3984 With two or more arguments a binding is (re)established:
3985 the first argument is the context to which the binding shall apply,
3986 the second argument is a comma-separated list of the
3987 .Dq keys
3988 which form the binding, and any remaining arguments form the expansion.
3989 To indicate that a binding shall not be auto-committed, but that the
3990 expansion shall instead be furtherly editable by the user, a commercial at
3991 .Ql @
3992 (that will be removed) can be placed last in the expansion, from which
3993 leading and trailing whitespace will finally be removed.
3994 Reverse solidus cannot be used as the last character of expansion.
3997 Contexts define when a binding applies, i.e., a binding will not be seen
3998 unless the context for which it is defined for is currently active.
3999 This is not true for the shared binding
4000 .Ql base ,
4001 which is the foundation for all other bindings and as such always
4002 applies, its bindings, however, only apply secondarily.
4003 The available contexts are the shared
4004 .Ql base ,
4006 .Ql default
4007 context which is used in all not otherwise documented situations, and
4008 .Ql compose ,
4009 which applies to compose mode only.
4012 .Dq Keys
4013 which form the binding are specified as a comma-separated list of
4014 byte-sequences, where each list entry corresponds to one key(press).
4015 A list entry may, indicated by a leading colon character
4016 .Ql \&: ,
4017 also refer to the name of a terminal capability; several dozen names
4018 will be compiled in and may be specified either by their
4019 .Xr terminfo 5 ,
4020 or, if existing, by their
4021 .Xr termcap 5
4022 name, regardless of the actually used \*(OPal terminal control library.
4023 It is possible to use any capability, as long as the name is resolvable
4024 by the \*(OPal control library or was defined via the internal variable
4025 .Va termcap .
4026 Input sequences are not case-normalized, so that an exact match is
4027 required to update or remove a binding.
4028 Examples:
4030 .Bd -literal -offset indent
4031 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4032 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
4033 ? bind default $'\ecA',:khome,w 'echo An editable binding@'
4034 ? bind default a,b,c rm -irf / @  # Another editable binding
4035 ? bind default :kf1 File %
4036 ? bind compose :kf1 ~e
4040 Note that the entire comma-separated list is first parsed (over) as a
4041 shell-token with whitespace as the field separator, before being parsed
4042 and expanded for real with comma as the field separator, therefore
4043 whitespace needs to be properly quoted, see
4044 .Sx "Shell-style argument quoting" .
4045 Using Unicode reverse solidus escape sequences renders a binding
4046 defunctional if the locale does not support Unicode (see
4047 .Sx "Character sets" ) ,
4048 and using terminal capabilities does so if no (corresponding) terminal
4049 control support is (currently) available.
4052 The following terminal capability names are built-in and can be used in
4053 .Xr terminfo 5
4054 or (if available) the two-letter
4055 .Xr termcap 5
4056 notation.
4057 See the respective manual for a list of capabilities.
4058 The program
4059 .Xr infocmp 1
4060 can be used to show all the capabilities of
4061 .Ev TERM
4062 or the given terminal type;
4063 using the
4064 .Fl \&\&x
4065 flag will also show supported (non-standard) extensions.
4068 .Bl -tag -compact -width kcuuf_or_kcuuf
4069 .It Cd kbs Ns \0or Cd kb
4070 Backspace.
4071 .It Cd kdch1 Ns \0or Cd kD
4072 Delete character.
4073 .It Cd kDC Ns \0or Cd *4
4074 \(em shifted variant.
4075 .It Cd kel Ns \0or Cd kE
4076 Clear to end of line.
4077 .It Cd kext Ns \0or Cd @9
4078 Exit.
4079 .It Cd kich1 Ns \0or Cd kI
4080 Insert character.
4081 .It Cd kIC Ns \0or Cd #3
4082 \(em shifted variant.
4083 .It Cd khome Ns \0or Cd kh
4084 Home.
4085 .It Cd kHOM Ns \0or Cd #2
4086 \(em shifted variant.
4087 .It Cd kend Ns \0or Cd @7
4088 End.
4089 .It Cd knp Ns \0or Cd kN
4090 Next page.
4091 .It Cd kpp Ns \0or Cd kP
4092 Previous page.
4093 .It Cd kcub1 Ns \0or Cd kl
4094 Left cursor (with more modifiers: see below).
4095 .It Cd kLFT Ns \0or Cd #4
4096 \(em shifted variant.
4097 .It Cd kcuf1 Ns \0or Cd kr
4098 Right cursor (ditto).
4099 .It Cd kRIT Ns \0or Cd %i
4100 \(em shifted variant.
4101 .It Cd kcud1 Ns \0or Cd kd
4102 Down cursor (ditto).
4103 .It Cd kDN
4104 \(em shifted variant (only terminfo).
4105 .It Cd kcuu1 Ns \0or Cd ku
4106 Up cursor (ditto).
4107 .It Cd kUP
4108 \(em shifted variant (only terminfo).
4109 .It Cd kf0 Ns \0or Cd k0
4110 Function key 0.
4111 Add one for each function key up to
4112 .Cd kf9
4114 .Cd k9 ,
4115 respectively.
4116 .It Cd kf10 Ns \0or Cd k;
4117 Function key 10.
4118 .It Cd kf11 Ns \0or Cd F1
4119 Function key 11.
4120 Add one for each function key up to
4121 .Cd kf19
4123 .Cd F9 ,
4124 respectively.
4128 Some terminals support key-modifier combination extensions, e.g.,
4129 .Ql Alt+Shift+xy .
4130 For example, the delete key,
4131 .Cd kdch1 :
4132 in its shifted variant, the name is mutated to
4133 .Cd  kDC ,
4134 then a number is appended for the states
4135 .Ql Alt
4136 .Pf ( Cd kDC3 ) ,
4137 .Ql Shift+Alt
4138 .Pf ( Cd kDC4 ) ,
4139 .Ql Control
4140 .Pf ( Cd kDC5 ) ,
4141 .Ql Shift+Control
4142 .Pf ( Cd kDC6 ) ,
4143 .Ql Alt+Control
4144 .Pf ( Cd kDC7 ) ,
4145 finally
4146 .Ql Shift+Alt+Control
4147 .Pf ( Cd kDC8 ) .
4148 The same for the left cursor key,
4149 .Cd kcub1 :
4150 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4153 It is advisable to use an initial escape or other control character (e.g.,
4154 .Ql \ecA )
4155 for bindings which describe user key combinations (as opposed to purely
4156 terminal capability based ones), in order to avoid ambiguities whether
4157 input belongs to key sequences or not; it also reduces search time.
4158 Adjusting
4159 .Va bind-timeout
4160 may help shall keys and sequences be falsely recognized.
4164 .It Ic call
4165 \*(NQ Calls the given macro, which must have been created via
4166 .Ic define ,
4167 otherwise a
4168 .Va ^ERR Ns -NOENT
4169 error occurs.
4170 Parameters given to macros are implicitly local to the macro's scope, and
4171 may be accessed via special (positional) parameters, e.g.,
4172 .Va 1 ,
4173 .Va * ,
4174 .Va @ ,
4175 .Va # .
4176 The positional parameters may be removed by
4177 .Ic shift Ns
4178 ing them off the stack (exceeding the supported number of arguments
4179 results in a
4180 .Va ^ERR Ns -OVERFLOW ) ,
4181 and are otherwise controllable via
4182 .Ic vpospar .
4183 Changes to other
4184 .Sx ENVIRONMENT
4185 as well as
4186 .Sx "INTERNAL VARIABLES"
4187 can be reverted before the current level regains control by setting
4188 .Ic localopts
4189 for called macro(s) (or in them, of course).
4190 Macro execution can be terminated at any time by calling
4191 .Ic return .
4194 Calling macros recursively will at some time excess the stack size
4195 limit, causing a hard program abortion; if recursively calling a macro
4196 is the last command of the current macro, consider to use the command
4197 .Ic xcall ,
4198 which will first release all resources of the current macro before
4199 replacing the current macro with the called one.
4200 Numeric and string operations can be performed via
4201 .Ic vexpr ,
4203 .Ic eval
4204 may be helpful to recreate argument lists.
4206 .Bd -literal -offset indent
4207 define exmac {
4208   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4209   return 1000 0
4211 call exmac Hello macro exmac!
4216 .It Ic call_if
4217 Identical to
4218 .Ic call
4219 if the given macro has been created via
4220 .Ic define ,
4221 but doesn't fail nor warn if the macro doesn't exist.
4224 .It Ic cd
4225 (ch) Change the working directory to
4226 .Ev HOME
4227 or the given argument.
4228 Synonym for
4229 .Ic chdir .
4232 .It Ic certsave
4233 \*(OP Only applicable to S/MIME signed messages.
4234 Takes a message list and a filename and saves the certificates
4235 contained within the message signatures to the named file in both
4236 human-readable and PEM format.
4237 The certificates can later be used to send encrypted messages to the
4238 respective message senders by setting
4239 .Va smime-encrypt-USER@HOST
4240 variables.
4244 .It Ic charsetalias , uncharsetalias
4245 \*(NQ Manage (character set conversion) character set alias mappings,
4246 as documented in the section
4247 .Sx "Character sets" .
4248 Character set aliases are expanded recursively, but no expansion is
4249 performed on values of the user-settable variables, e.g.,
4250 .Va charset-8bit .
4251 These are effectively no-operations if character set conversion
4252 is not available (i.e., no
4253 .Ql +iconv
4255 .Va features ) .
4256 Without arguments the list of all currently defined aliases is shown,
4257 with one argument the expansion of the given alias.
4258 Otherwise all given arguments are treated as pairs of character sets and
4259 their desired target alias name, creating new or changing already
4260 existing aliases, as necessary.
4262 The latter deletes all aliases given as arguments, the special argument
4263 .Ql *
4264 will remove all aliases.
4267 .It Ic chdir
4268 (ch) Change the working directory to
4269 .Ev HOME
4270 or the given argument.
4271 Synonym for
4272 .Ic cd .
4276 .It Ic collapse , uncollapse
4277 Only applicable to threaded mode.
4278 Takes a message list and makes all replies to these messages invisible
4279 in header summaries, except for
4280 .Ql new
4281 messages and the
4282 .Dq dot .
4283 Also when a message with collapsed replies is displayed,
4284 all of these are automatically uncollapsed.
4285 The latter command undoes collapsing.
4290 .It Ic colour , uncolour
4291 \*(OP\*(NQ Manage colour mappings of and for a
4292 .Sx "Coloured display" .
4293 The type of colour is given as the (case-insensitive) first argument,
4294 which must be one of
4295 .Ql 256
4296 for 256-colour terminals,
4297 .Ql 8 ,
4298 .Ql ansi
4300 .Ql iso
4301 for the standard 8-colour ANSI / ISO 6429 color palette and
4302 .Ql 1
4304 .Ql mono
4305 for monochrome terminals.
4306 Monochrome terminals cannot deal with colours, but only (some) font
4307 attributes.
4310 Without further arguments the list of all currently defined mappings
4311 for the given colour type is shown (as a special case giving
4312 .Ql all
4314 .Ql *
4315 will show the mappings of all types).
4316 Otherwise the second argument defines the mappable slot, and the third
4317 argument a (comma-separated list of) colour and font attribute
4318 specification(s), and the optional fourth argument can be used to
4319 specify a precondition: if conditioned mappings exist they are tested in
4320 (creation) order unless a (case-insensitive) match has been found, and
4321 the default mapping (if any has been established) will only be chosen as
4322 a last resort.
4323 The types of precondition available depend on the mappable slot (see
4324 .Sx "Coloured display"
4325 for some examples), the following of which exist:
4328 Mappings prefixed with
4329 .Ql mle-
4330 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4331 .Sx "On terminal control and line editor" )
4332 and do not support preconditions.
4334 .Bl -tag -compact -width view-partinfo
4335 .It Ar mle-position
4336 This mapping is used for the position indicator that is visible when
4337 a line cannot be fully displayed on the screen.
4338 .It Ar mle-prompt
4339 Used for the
4340 .Va prompt .
4344 Mappings prefixed with
4345 .Ql sum-
4346 are used in header summaries, and they all understand the preconditions
4347 .Ql dot
4348 (the current message) and
4349 .Ql older
4350 for elder messages (only honoured in conjunction with
4351 .Va datefield-markout-older ) .
4353 .Bl -tag -compact -width view-partinfo
4354 .It Ar sum-dotmark
4355 This mapping is used for the
4356 .Dq dotmark
4357 that can be created with the
4358 .Ql %>
4360 .Ql %<
4361 formats of the variable
4362 .Va headline .
4363 .It Ar sum-header
4364 For the complete header summary line except the
4365 .Dq dotmark
4366 and the thread structure.
4367 .It Ar sum-thread
4368 For the thread structure which can be created with the
4369 .Ql %i
4370 format of the variable
4371 .Va headline .
4375 Mappings prefixed with
4376 .Ql view-
4377 are used when displaying messages.
4379 .Bl -tag -compact -width view-partinfo
4380 .It Ar view-from_
4381 This mapping is used for so-called
4382 .Ql From_
4383 lines, which are MBOX file format specific header lines.
4384 .It Ar view-header
4385 For header lines.
4386 A comma-separated list of headers to which the mapping applies may be
4387 given as a precondition; if the \*(OPal regular expression support is
4388 available then if any of the
4389 .Dq magical
4390 (extended) regular expression characters is seen the precondition will
4391 be evaluated as (an extended) one.
4392 .It Ar view-msginfo
4393 For the introductional message info line.
4394 .It Ar view-partinfo
4395 For MIME part info lines.
4399 The following (case-insensitive) colour definitions and font attributes
4400 are understood, multiple of which can be specified in a comma-separated
4401 list:
4403 .Bl -tag -width ft=
4404 .It Ar ft=
4405 a font attribute:
4406 .Ql bold ,
4407 .Ql reverse
4409 .Ql underline .
4410 It is possible (and often applicable) to specify multiple font
4411 attributes for a single mapping.
4413 .It Ar fg=
4414 foreground colour attribute:
4415 .Ql black ,
4416 .Ql blue ,
4417 .Ql green ,
4418 .Ql red ,
4419 .Ql brown ,
4420 .Ql magenta ,
4421 .Ql cyan
4423 .Ql white .
4424 To specify a 256-color mode a decimal number colour specification in
4425 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4427 .Bl -tag -compact -width "999 - 999"
4428 .It 0 - 7
4429 the standard ISO 6429 colors, as above.
4430 .It 8 - 15
4431 high intensity variants of the standard colors.
4432 .It 16 - 231
4433 216 colors in tuples of 6.
4434 .It 232 - 255
4435 grayscale from black to white in 24 steps.
4437 .Bd -literal -offset indent
4438 #!/bin/sh -
4439 fg() { printf "\e033[38;5;${1}m($1)"; }
4440 bg() { printf "\e033[48;5;${1}m($1)"; }
4442 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4443 printf "\e033[0m\en"
4445 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4446 printf "\e033[0m\en"
4449 .It Ar bg=
4450 background colour attribute (see
4451 .Cd fg=
4452 for possible values).
4456 The command
4457 .Ic \&uncolour
4458 will remove for the given colour type (the special type
4459 .Ql *
4460 selects all) the given mapping; if the optional precondition argument is
4461 given only the exact tuple of mapping and precondition is removed.
4462 The special name
4463 .Ql *
4464 will remove all mappings (no precondition allowed), thus
4465 .Ql uncolour * *
4466 will remove all established mappings.
4471 .It Ic commandalias , uncommandalias
4472 \*(NQ Define or list, and remove, respectively, command aliases.
4473 An (command)alias can be used everywhere a normal command can be used,
4474 but always takes precedence: any arguments that are given to the command
4475 alias are joined onto the alias expansion, and the resulting string
4476 forms the command line that is, in effect, executed.
4477 The latter command removes all given aliases, the special name
4478 .Ql *
4479 will remove all existing aliases.
4480 When used without arguments the former shows a list of all currently
4481 known aliases, with one argument only the expansion of the given one.
4483 With two or more arguments a command alias is defined or updated: the
4484 first argument is the name under which the remaining command line should
4485 be accessible, the content of which can be just about anything.
4486 An alias may itself expand to another alias, but to avoid expansion loops
4487 further expansion will be prevented if an alias refers to itself or if
4488 an expansion depth limit is reached.
4489 Explicit expansion prevention is available via reverse solidus
4490 .Cm \e ,
4491 one of the
4492 .Sx "Command modifiers" .
4493 .Bd -literal -offset indent
4494 ? commandalias xx
4495 \*(uA: `commandalias': no such alias: xx
4496 ? commandalias xx echo hello,
4497 ? commandalias xx
4498 commandalias xx 'echo hello,'
4499 ? xx
4500 hello,
4501 ? xx world
4502 hello, world
4506 .It Ic Copy
4507 (C) Copy messages to files whose names are derived from the author of
4508 the respective message and do not mark them as being saved;
4509 otherwise identical to
4510 .Ic Save .
4513 .It Ic copy
4514 (c) Copy messages to the named file and do not mark them as being saved;
4515 otherwise identical to
4516 .Ic save .
4519 .It Ic cwd
4520 Show the name of the current working directory, as reported by
4521 .Xr getcwd 3 .
4522 Supports
4523 .Cm vput
4524 (see
4525 .Sx "Command modifiers" ) .
4526 The return status is tracked via
4527 .Va \&! .
4530 .It Ic Decrypt
4531 \*(OP For unencrypted messages this command is identical to
4532 .Ic Copy ;
4533 Encrypted messages are first decrypted, if possible, and then copied.
4536 .It Ic decrypt
4537 \*(OP For unencrypted messages this command is identical to
4538 .Ic copy ;
4539 Encrypted messages are first decrypted, if possible, and then copied.
4543 .It Ic define , undefine
4544 Without arguments the current list of macros, including their content,
4545 is shown, otherwise a macro is defined, replacing an existing macro of
4546 the same name.
4547 A macro definition is a sequence of commands in the following form:
4548 .Bd -literal -offset indent
4549 define name {
4550   command1
4551   command2
4552   ...
4553   commandN
4557 A defined macro can be invoked explicitly by using the
4558 .Ic call ,
4559 .Ic call_if
4561 .Ic xcall
4562 commands, or implicitly if a macro hook is triggered, e.g., a
4563 .Va folder-hook .
4564 It is possible to localize adjustments, like creation, deletion and
4565 modification of
4566 .Sx "INTERNAL VARIABLES" ,
4567 by using the
4568 .Ic localopts
4569 command; the scope which is localized depends on how (i.e.,
4570 .Dq as what :
4571 normal macro, folder hook, hook,
4572 .Ic account
4573 switch) the macro is invoked.
4574 Execution of a macro body can be stopped from within by calling
4575 .Ic return .
4576 Inside a
4577 .Ic call Ns
4578 ed macro, given positional parameters can be
4579 .Ic shift Ns
4580 ed, or become completely replaced, removed etc. via
4581 .Ic vpospar .
4583 The latter command deletes the given macro, the special name
4584 .Ql *
4585 will discard all existing macros.
4586 Creation and deletion of (a) macro(s) can be performed from within
4587 a running macro.
4591 .It Ic delete , undelete
4592 (d, u) Marks the given message list as being or not being
4593 .Ql deleted ,
4594 respectively; if no argument has been specified then the usual search
4595 for a visible message is performed, as documented for
4596 .Sx "Message list arguments" ,
4597 showing only the next input prompt if the search fails.
4598 Deleted messages will neither be saved in the
4599 .Mx -sx
4600 .Sx "secondary mailbox"
4601 .Ev MBOX
4602 nor will they be available for most other commands.
4603 If the
4604 .Va autoprint
4605 variable is set, the new
4606 .Dq dot
4607 or the last message restored, respectively, is automatically
4608 .Ic type Ns
4609 d; also see
4610 .Ic dp ,
4611 .Ic dt .
4614 .It Ic discard
4615 (di) Identical to
4616 .Ic ignore .
4617 Superseded by the multiplexer
4618 .Ic headerpick .
4622 .It Ic dp , dt
4623 Delete the given messages and automatically
4624 .Ic type
4625 the new
4626 .Dq dot
4627 if one exists, regardless of the setting of
4628 .Va autoprint .
4631 .It Ic dotmove
4632 Move the
4633 .Dq dot
4634 up or down by one message when given
4635 .Ql +
4637 .Ql -
4638 argument, respectively.
4642 .It Ic draft , undraft
4643 Take message lists and mark each given message as being draft, or not
4644 being draft, respectively, as documented in the section
4645 .Sx "Message states" .
4648 .It Ic echo
4649 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4650 newline, whereas the otherwise identical
4651 .Ic echon
4652 does not.
4653 .Sx "Shell-style argument quoting"
4654 is used,
4655 .Sx "Filename transformations"
4656 are applied to the expanded arguments.
4659 .It Ic echoerr
4660 \*(NQ Identical to
4661 .Ic echo
4662 except that is echoes to standard error.
4663 Also see
4664 .Ic echoerrn .
4665 In interactive sessions the \*(OPal message ring queue for
4666 .Ic errors
4667 will be used instead, if available.
4670 .It Ic echon
4671 \*(NQ Identical to
4672 .Ic echo ,
4673 but does not write a trailing newline.
4676 .It Ic echoerrn
4677 \*(NQ Identical to
4678 .Ic echoerr ,
4679 but does not write a trailing newline.
4682 .It Ic edit
4683 (e) Point the text editor (as defined in
4684 .Ev EDITOR )
4685 at each message from the given list in turn.
4686 Modified contents are discarded unless the
4687 .Va writebackedited
4688 variable is set, and are not used unless the mailbox can be written to
4689 and the editor returns a successful exit status.
4692 .It Ic elif
4693 Part of the
4694 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4695 conditional \(em if the condition of a preceding
4696 .Ic if
4697 was false, check the following condition and execute the following block
4698 if it evaluates true.
4701 .It Ic else
4702 (el) Part of the
4703 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4704 conditional \(em if none of the conditions of the preceding
4705 .Ic if
4707 .Ic elif
4708 commands was true, the
4709 .Ic else
4710 block is executed.
4713 .It Ic endif
4714 (en) Marks the end of an
4715 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4716 conditional execution block.
4720 .It Ic environ
4721 \*(NQ \*(UA has a strict notion about which variables are
4722 .Sx "INTERNAL VARIABLES"
4723 and which are managed in the program
4724 .Sx ENVIRONMENT .
4725 Since some of the latter are a vivid part of \*(UAs functioning,
4726 however, they are transparently integrated into the normal handling of
4727 internal variables via
4728 .Ic set
4730 .Ic unset .
4731 To integrate other environment variables of choice into this
4732 transparent handling, and also to export internal variables into the
4733 process environment where they normally are not, a
4734 .Ql link
4735 needs to become established with this command, as in, e.g.,
4738 .Dl environ link PERL5LIB TZ
4741 Afterwards changing such variables with
4742 .Ic set
4743 will cause automatic updates of the program environment, and therefore
4744 be inherited by newly created child processes.
4745 Sufficient system support provided (it was in BSD as early as 1987, and
4746 is standardized since Y2K) removing such variables with
4747 .Ic unset
4748 will remove them also from the program environment, but in any way
4749 the knowledge they ever have been
4750 .Ql link Ns
4751 ed will be lost.
4752 Note that this implies that
4753 .Ic localopts
4754 may cause loss of such links.
4757 The command
4758 .Ql unlink
4759 will remove an existing link, but leaves the variables as such intact.
4760 Additionally the subcommands
4761 .Ql set
4763 .Ql unset
4764 are provided, which work exactly the same as the documented commands
4765 .Ic set
4767 .Ic unset ,
4768 but (additionally un)link the variable(s) with the program environment
4769 and thus immediately export them to, or remove them from (if possible),
4770 respectively, the program environment.
4774 .It Ic errors
4775 \*(OP Since \*(UA uses the console as a user interface it can happen
4776 that messages scroll by too fast to become recognized.
4777 An error message ring queue is available which stores duplicates of any
4778 error message and notifies the user in interactive sessions whenever
4779 a new error has occurred.
4780 The queue is finite: if its maximum size is reached any new message
4781 replaces the eldest.
4782 The command
4783 .Ic errors
4784 can be used to manage this message queue: if given
4785 .Ar show
4786 or no argument the queue will be displayed and cleared,
4787 .Ar clear
4788 will only clear all messages from the queue.
4791 .It Ic eval
4792 \*(NQ Construct a command by concatenating the arguments, separated with
4793 a single space character, and then evaluate the result.
4794 This command passes through the exit status
4795 .Va \&?
4796 and error number
4797 .Va \&!
4798 of the evaluated command; also see
4799 .Ic call .
4800 .Bd -literal -offset indent
4801 define xxx {
4802   echo "xxx arg <$1>"
4803   shift
4804   if [ $# -gt 0 ]
4805     \excall xxx "$@"
4806   endif
4808 define yyy {
4809   eval "$@ ' ball"
4811 call yyy '\ecall xxx' "b\e$'\et'u ' "
4812 call xxx arg <b      u>
4813 call xxx arg <  >
4814 call xxx arg <ball>
4818 .It Ic exit
4819 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4820 any saving of messages in the
4821 .Mx -sx
4822 .Sx "secondary mailbox"
4823 .Ev MBOX ,
4824 as well as a possibly tracked line editor
4825 .Va history-file .
4826 The optional status number argument will be passed through to
4827 .Xr exit 3 .
4828 \*(ID For now it can happen that the given status will be overwritten,
4829 later this will only occur if a later error needs to be reported onto an
4830 otherwise success indicating status.
4833 .It Ic File
4834 (Fi) Like
4835 .Ic file ,
4836 but open the mailbox read-only.
4840 .It Ic file
4841 (fi) The file command switches to a new mailbox.
4842 Without arguments it shows status information of the current mailbox.
4843 If an argument is given, it will write out changes (such as deletions)
4844 the user has made, open a new mailbox, update the internal variables
4845 .Va mailbox-resolved
4847 .Va mailbox-display ,
4848 and optionally display a summary of
4849 .Ic headers
4850 if the variable
4851 .Va header
4852 is set.
4855 .Sx "Filename transformations"
4856 will be applied to the
4857 .Ar name
4858 argument, and
4859 .Ql protocol://
4860 prefixes are, i.e., URL syntax is understood, e.g.,
4861 .Ql maildir:///tmp/mdirbox :
4862 if a protocol prefix is used the mailbox type is fixated and neither
4863 the auto-detection (read on) nor the
4864 .Va newfolders
4865 mechanisms apply.
4866 \*(OPally URLs can also be used to access network resources, which may
4867 be accessed securely via
4868 .Sx "Encrypted network communication"
4869 if so supported, and it is possible to proxy all network traffic over
4870 a SOCKS5 server given via
4871 .Va socks-proxy .
4874 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4875 .Dl \*(OU protocol://[user@]host[:port][/path]
4878 \*(OPally supported network protocols are
4879 .Ar pop3
4880 (POP3) and
4881 .Ar pop3s
4882 (POP3 with SSL/TLS encrypted transport),
4883 .Ar imap
4885 .Ar imaps .
4887 .Ar [/path]
4888 part is valid only for IMAP; there it defaults to
4889 .Ar INBOX .
4890 Network URLs require a special encoding as documented in the section
4891 .Sx "On URL syntax and credential lookup" .
4894 If the resulting file protocol (MBOX database)
4895 .Ar name
4896 is located on a local filesystem then the list of all registered
4897 .Ic filetype Ns
4898 s is traversed in order to see whether a transparent intermediate
4899 conversion step is necessary to handle the given mailbox, in which case
4900 \*(UA will use the found hook to load and save data into and from
4901 a temporary file, respectively.
4902 Changing hooks will not affect already opened mailboxes.
4903 For example, the following creates hooks for the
4904 .Xr gzip 1
4905 compression tool and a combined compressed and encrypted format:
4907 .Bd -literal -offset indent
4908 ? filetype \e
4909     gzip 'gzip -dc' 'gzip -c' \e
4910     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4914 MBOX database files are generally locked during file operations in order
4915 to avoid inconsistencies due to concurrent modifications.
4916 \*(OPal Mailbox files which \*(UA treats as the system
4917 .Va inbox
4918 .Pf ( Ev MAIL ) ,
4920 .Mx -sx
4921 .Sx "primary system mailbox" Ns
4922 es in general will also be protected by so-called dotlock files, the
4923 traditional way of mail spool file locking: for any file
4924 .Ql a
4925 a lock file
4926 .Ql a.lock
4927 will be created for the duration of the synchronization \(em
4928 as necessary a privilege-separated dotlock child process will be used
4929 to accommodate for necessary privilege adjustments in order to create
4930 the dotlock file in the same directory
4931 and with the same user and group identities as the file of interest.
4934 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4935 files, but it will detect invalid message boundaries in this mode and
4936 complain (even more with
4937 .Va debug )
4938 if any is seen: in this case
4939 .Va mbox-rfc4155
4940 can be used to create a valid MBOX database from the invalid input.
4943 If no protocol has been fixated, and
4944 .Ar name
4945 refers to a directory with the subdirectories
4946 .Ql tmp ,
4947 .Ql new
4949 .Ql cur ,
4950 then it is treated as a folder in
4951 .Dq Maildir
4952 format.
4953 The maildir format stores each message in its own file, and has been
4954 designed so that file locking is not necessary when reading or writing
4955 files.
4958 \*(ID If no protocol has been fixated and no existing file has
4959 been found, the variable
4960 .Va newfolders
4961 controls the format of mailboxes yet to be created.
4966 .It Ic filetype , unfiletype
4967 \*(NQ Define or list, and remove, respectively, file handler hooks,
4968 which provide (shell) commands that enable \*(UA to load and save MBOX
4969 files from and to files with the registered file extensions;
4970 it will use an intermediate temporary file to store the plain data.
4971 The latter command removes the hooks for all given extensions,
4972 .Ql *
4973 will remove all existing handlers.
4975 When used without arguments the former shows a list of all currently
4976 defined file hooks, with one argument the expansion of the given alias.
4977 Otherwise three arguments are expected, the first specifying the file
4978 extension for which the hook is meant, and the second and third defining
4979 the load- and save commands, respectively, to deal with the file type,
4980 both of which must read from standard input and write to standard
4981 output.
4982 Changing hooks will not affect already opened mailboxes (\*(ID except below).
4983 \*(ID For now too much work is done, and files are oftened read in twice
4984 where once would be sufficient: this can cause problems if a filetype is
4985 changed while such a file is opened; this was already so with the
4986 built-in support of .gz etc. in Heirloom, and will vanish in v15.
4987 \*(ID For now all handler strings are passed to the
4988 .Ev SHELL for evaluation purposes; in the future a
4989 .Ql \&!
4990 prefix to load and save commands may mean to bypass this shell instance:
4991 placing a leading space will avoid any possible misinterpretations.
4992 .Bd -literal -offset indent
4993 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
4994     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
4995     zst 'zstd -dc' 'zstd -19 -zc' \e
4996     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4997 ? set record=+sent.zst.pgp
5002 .It Ic flag , unflag
5003 Take message lists and mark the messages as being flagged, or not being
5004 flagged, respectively, for urgent/special attention.
5005 See the section
5006 .Sx "Message states" .
5009 .It Ic folder
5010 (fold) The same as
5011 .Ic file .
5014 .It Ic folders
5015 With no arguments, list the names of the folders in the folder directory.
5016 With an existing folder as an argument,
5017 lists the names of folders below the named folder.
5020 .It Ic Followup
5021 (F) Similar to
5022 .Ic Respond ,
5023 but saves the message in a file named after the local part of the first
5024 recipient's address (instead of in
5025 .Va record Ns ).
5028 .It Ic followup
5029 (fo) Similar to
5030 .Ic respond ,
5031 but saves the message in a file named after the local part of the first
5032 recipient's address (instead of in
5033 .Va record Ns ).
5036 .It Ic followupall
5037 Similar to
5038 .Ic followup ,
5039 but responds to all recipients regardless of the
5040 .Va flipr
5041 variable.
5044 .It Ic followupsender
5045 Similar to
5046 .Ic Followup ,
5047 but responds to the sender only regardless of the
5048 .Va flipr
5049 variable.
5052 .It Ic Forward
5053 Similar to
5054 .Ic forward ,
5055 but saves the message in a file named after the local part of the
5056 recipient's address (instead of in
5057 .Va record Ns ).
5060 .It Ic forward
5061 Takes a message and the address of a recipient
5062 and forwards the message to him.
5063 The text of the original message is included in the new one,
5064 with the value of the
5065 .Va forward-inject-head
5066 variable preceding it.
5067 To filter the included header fields to the desired subset use the
5068 .Ql forward
5069 slot of the white- and blacklisting command
5070 .Ic headerpick .
5071 Only the first part of a multipart message is included unless
5072 .Va forward-as-attachment ,
5073 and recipient addresses will be stripped from comments, names
5074 etc. unless the internal variable
5075 .Va fullnames
5076 is set.
5078 This may generate the errors
5079 .Va ^ERR Ns -DESTADDRREQ
5080 if no receiver has been specified,
5081 .Va ^ERR Ns -PERM
5082 if some addressees where rejected by
5083 .Va expandaddr ,
5084 .Va ^ERR Ns -NODATA
5085 if no applicable messages have been given,
5086 .Va ^ERR Ns -NOTSUP
5087 if multiple messages have been specified,
5088 .Va ^ERR Ns -IO
5089 if an I/O error occurs,
5090 .Va ^ERR Ns -NOTSUP
5091 if a necessary character set conversion fails, and
5092 .Va ^ERR Ns -INVAL
5093 for other errors.
5096 .It Ic from
5097 (f) Takes a list of message specifications and displays a summary of
5098 their message headers, exactly as via
5099 .Ic headers .
5100 An alias of this command is
5101 .Ic search .
5102 Also see
5103 .Sx "Specifying messages" .
5105 .It Ic Fwd
5106 \*(OB Alias for
5107 .Ic Forward .
5109 .It Ic fwd
5110 \*(OB Alias for
5111 .Ic forward .
5113 .It Ic fwdignore
5114 \*(OB Superseded by the multiplexer
5115 .Ic headerpick .
5117 .It Ic fwdretain
5118 \*(OB Superseded by the multiplexer
5119 .Ic headerpick .
5121 .It Ic ghost , unghost
5122 \*(OB Replaced by
5123 .Ic commandalias ,
5124 .Ic uncommandalias .
5128 .It Ic headerpick , unheaderpick
5129 \*(NQ Multiplexer command to manage white- and blacklisting
5130 selections of header fields for a variety of applications.
5131 Without arguments the set of contexts that have settings is displayed.
5132 When given arguments, the first argument is the context to which the
5133 command applies, one of (case-insensitive)
5134 .Ql type
5135 for display purposes (via, e.g.,
5136 .Ic type ) ,
5137 .Ql save
5138 for selecting which headers shall be stored persistently when
5139 .Ic save ,
5140 .Ic copy ,
5141 .Ic move
5142 or even
5143 .Ic decrypt Ns
5144 ing messages (note that MIME related etc. header fields should not be
5145 ignored in order to not destroy usability of the message in this case),
5146 .Ql forward
5147 for stripping down messages when
5148 .Ic forward Ns
5149 ing message (has no effect if
5150 .Va forward-as-attachment
5151 is set), and
5152 .Ql top
5153 for defining user-defined set of fields for the command
5154 .Ic top .
5156 The current settings of the given context are displayed if it is the
5157 only argument.
5158 A second argument denotes the type of restriction that is to be chosen,
5159 it may be (a case-insensitive prefix of)
5160 .Ql retain
5162 .Ql ignore
5163 for white- and blacklisting purposes, respectively.
5164 Establishing a whitelist suppresses inspection of the corresponding
5165 blacklist.
5167 If no further argument is given the current settings of the given type
5168 will be displayed, otherwise the remaining arguments specify header
5169 fields, which \*(OPally may be given as regular expressions, to be added
5170 to the given type.
5171 The special wildcard field (asterisk,
5172 .Ql * )
5173 will establish a (fast) shorthand setting which covers all fields.
5175 The latter command always takes three or more arguments and can be used
5176 to remove selections, i.e., from the given context, the given type of
5177 list, all the given headers will be removed, the special argument
5178 .Ql *
5179 will remove all headers.
5182 .It Ic headers
5183 (h) Show the current group of headers, the size of which depends on
5184 the variable
5185 .Va screen ,
5186 and the style of which can be adjusted with the variable
5187 .Va headline .
5188 If a message-specification is given the group of headers containing the
5189 first message therein is shown and the message at the top of the screen
5190 becomes the new
5191 .Dq dot .
5194 .It Ic help
5195 (hel) A synonym for
5196 .Ic \&? .
5199 .It Ic history
5200 \*(OP Either
5201 .Ar show
5202 (this mode also supports a more
5203 .Va verbose
5204 output) or
5205 .Ar clear
5206 the list of history entries;
5207 a decimal
5208 .Ar NUMBER
5209 argument selects and evaluates the respective history entry,
5210 which will become the new history top; a negative number is used as an
5211 offset to the current command, e.g.,
5212 .Ql -1
5213 will select the last command, the history top.
5214 The default mode if no arguments are given is
5215 .Ar show .
5216 Please see
5217 .Sx "On terminal control and line editor"
5218 for more on this topic.
5221 .It Ic hold
5222 (ho, also
5223 .Ic preserve )
5224 Takes a message list and marks each message therein to be saved in the
5225 user's system
5226 .Va inbox
5227 instead of in the
5228 .Mx -sx
5229 .Sx "secondary mailbox"
5230 .Ev MBOX .
5231 Does not override the
5232 .Ic delete
5233 command.
5234 \*(UA deviates from the POSIX standard with this command, because a
5235 .Ic next
5236 command issued after
5237 .Ic hold
5238 will display the following message, not the current one.
5242 .It Ic if
5243 (i) Part of the nestable
5244 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
5245 conditional execution construct \(em if the given condition is true then
5246 the encapsulated block is executed.
5247 The POSIX standards supports the (case-insensitive) conditions
5248 .Ql r Ns
5249 eceive
5251 .Ql s Ns
5252 end, all remaining conditions are non-portable extensions.
5253 \*(ID These commands do not yet use
5254 .Sx "Shell-style argument quoting"
5255 and therefore do not know about input tokens, so that syntax
5256 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5257 all conditions bracket group wise and consider the tokens, representing
5258 values and operators, therein, which also means that variables will
5259 already have been expanded at that time (just like in the shell).
5261 .Bd -literal -offset indent
5262 if receive
5263   commands ...
5264 else
5265   commands ...
5266 endif
5270 The (case-insensitive) condition
5271 .Ql t Ns
5272 erminal will evaluate to true if the standard input is a terminal, i.e.,
5273 in interactive sessions.
5274 Another condition can be any boolean value (see the section
5275 .Sx "INTERNAL VARIABLES"
5276 for textual boolean representations) to mark an enwrapped block as
5277 .Dq never execute
5279 .Dq always execute .
5280 (It shall be remarked that a faulty condition skips all branches until
5281 .Ic endif . )
5284 (\*(ID In v15
5285 .Sx "Shell-style argument quoting"
5286 will be used, and this command will simply interpret expanded tokens.)
5287 It is possible to check
5288 .Sx "INTERNAL VARIABLES"
5289 as well as
5290 .Sx ENVIRONMENT
5291 variables for existence or compare their expansion against a user given
5292 value or another variable by using the
5293 .Ql $
5294 .Pf ( Dq variable next )
5295 conditional trigger character;
5296 a variable on the right hand side may be signalled using the same
5297 mechanism.
5298 Variable names may be enclosed in a pair of matching braces.
5299 When this mode has been triggered, several operators are available:
5302 Integer operators treat the arguments on the left and right hand side of
5303 the operator as integral numbers and compare them arithmetically.
5304 It is an error if any of the operands is not a valid integer, an empty
5305 argument (which implies it had been quoted) is treated as if it were 0.
5306 Available operators are
5307 .Ql -lt
5308 (less than),
5309 .Ql -le
5310 (less than or equal to),
5311 .Ql -eq
5312 (equal),
5313 .Ql -ne
5314 (not equal),
5315 .Ql -ge
5316 (greater than or equal to), and
5317 .Ql -gt
5318 (greater than).
5321 String data operators compare the left and right hand side according to
5322 their textual content.
5323 Unset variables are treated as the empty string.
5324 The behaviour of string operators can be adjusted by prefixing the
5325 operator with the modifier trigger commercial at
5326 .Ql @ ,
5327 followed by none to multiple modifiers: for now supported is
5328 .Ql i ,
5329 which turns the comparison into a case-insensitive one: this is
5330 implied if no modifier follows the trigger.
5333 Available string operators are
5334 .Ql <
5335 (less than),
5336 .Ql <=
5337 (less than or equal to),
5338 .Ql ==
5339 (equal),
5340 .Ql !=
5341 (not equal),
5342 .Ql >=
5343 (greater than or equal to),
5344 .Ql >
5345 (greater than),
5346 .Ql =%
5347 (is substring of) and
5348 .Ql !%
5349 (is not substring of).
5350 By default these operators work on bytes and (therefore) do not take
5351 into account character set specifics.
5352 If the case-insensitivity modifier has been used, case is ignored
5353 according to the rules of the US-ASCII encoding, i.e., bytes are
5354 still compared.
5357 When the \*(OPal regular expression support is available, the additional
5358 string operators
5359 .Ql =~
5361 .Ql !~
5362 can be used.
5363 They treat the right hand side as an extended regular expression that is
5364 matched according to the active locale (see
5365 .Sx "Character sets" ) ,
5366 i.e., character sets should be honoured correctly.
5369 Conditions can be joined via AND-OR lists (where the AND operator is
5370 .Ql &&
5371 and the OR operator is
5372 .Ql || ) ,
5373 which have equal precedence and will be evaluated with left
5374 associativity, thus using the same syntax that is known for the
5375 .Xr sh 1 .
5376 It is also possible to form groups of conditions and lists by enclosing
5377 them in pairs of brackets
5378 .Ql [\ \&.\&.\&.\ ] ,
5379 which may be interlocked within each other, and also be joined via
5380 AND-OR lists.
5383 The results of individual conditions and entire groups may be modified
5384 via unary operators: the unary operator
5385 .Ql \&!
5386 will reverse the result.
5388 .Bd -literal -offset indent
5389 # (This not in v15, there [ -n "$debug"]!)
5390 if $debug
5391   echo *debug* is set
5392 endif
5393 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
5394   echo *ttycharset* is UTF-8, the former case-sensitive!
5395 endif
5396 set t1=one t2=one
5397 if [ "${t1}" == "${t2}" ]
5398   echo These two variables are equal
5399 endif
5400 if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm\&.*" ]
5401   echo ..in an X terminal
5402 endif
5403 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5404     [ "$verbose" != '' ] ] ]
5405   echo Noisy, noisy
5406 endif
5407 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5408   echo Left associativity, as is known from the shell
5409 endif
5414 .It Ic ignore
5415 (ig) Identical to
5416 .Ic discard .
5417 Superseded by the multiplexer
5418 .Ic headerpick .
5421 .It Ic list
5422 Shows the names of all available commands, alphabetically sorted.
5423 If given any non-whitespace argument the list will be shown in the order
5424 in which command prefixes are searched.
5425 \*(OP In conjunction with a set variable
5426 .Va verbose
5427 additional information will be provided for each command: the argument
5428 type will be indicated, the documentation string will be shown,
5429 and the set of command flags will show up:
5431 .Bl -tag -compact -width ".It Ql BaNg"
5432 .It Ql "vput modifier"
5433 command supports the command modifier
5434 .Cm vput .
5435 .It Ql "errno in *!*"
5436 the error number is tracked in
5437 .Va \&! .
5438 .It Ql "needs box"
5439 commands needs an active mailbox, a
5440 .Ic file .
5441 .It Ql "ok: batch or interactive"
5442 command may only be used in interactive or
5443 .Fl #
5444 batch mode.
5445 .It Ql "ok: send mode"
5446 command can be used in send mode.
5447 .It Ql "not ok: compose mode"
5448 command is not available when in compose mode.
5449 .It Ql "not ok: during startup"
5450 command cannot be used during program startup, e.g., while loading
5451 .Sx "Resource files" .
5452 .It Ql "ok: in subprocess"
5453 command is allowed to be used when running in a subprocess instance,
5454 e.g., from within a macro that is called via
5455 .Va on-compose-splice .
5460 .It Ic localopts
5461 This command can be used to localize changes to (linked)
5462 .Sx ENVIRONMENT
5463 as well as
5464 .Sx "INTERNAL VARIABLES" ,
5465 meaning that their state will be reverted to the former one once the
5466 .Dq covered scope
5467 is left.
5468 \*(ID Note in the future the coverage may be extended to none or any of
5469 .Ic alias ,
5470 .Ic alternates ,
5471 .Ic charsetalias ,
5472 .Ic commandalias ,
5473 .Ic filetype ,
5474 .Ic mlist ,
5475 .Ic mlsubscribe ,
5476 .Ic shortcut ,
5477 to name a few.
5478 It can only be used inside of macro definition blocks introduced by
5479 .Ic account
5481 .Ic define .
5482 The covered scope of an
5483 .Ic account
5484 is left once a different account is activated, and some macros, notably
5485 .Va folder-hook Ns s ,
5486 use their own specific notion of covered scope, here it will be extended
5487 until the folder is left again.
5490 This setting stacks up: i.e., if
5491 .Ql macro1
5492 enables change localization and calls
5493 .Ql macro2 ,
5494 which explicitly resets localization, then any value changes within
5495 .Ql macro2
5496 will still be reverted when the scope of
5497 .Ql macro1
5498 is left.
5499 (Caveats: if in this example
5500 .Ql macro2
5501 changes to a different
5502 .Ic account
5503 which sets some variables that are already covered by localizations,
5504 their scope will be extended, and in fact leaving the
5505 .Ic account
5506 will (thus) restore settings in (likely) global scope which actually
5507 were defined in a local, macro private context!)
5510 This command takes one or two arguments, the optional first one
5511 specifies an attribute that may be one of
5512 .Cm scope ,
5513 which refers to the current scope and is thus the default,
5514 .Cm call ,
5515 which causes any macro that is being
5516 .Ic call Ns
5517 ed to be started with localization enabled by default, as well as
5518 .Cm call-fixate ,
5519 which (if enabled) disallows any called macro to turn off localization:
5520 like this it can be ensured that once the current scope regains control,
5521 any changes made in deeper levels have been reverted.
5522 The latter two are mutually exclusive.
5523 The (second) argument is interpreted as a boolean (string, see
5524 .Sx "INTERNAL VARIABLES" )
5525 and states whether the given attribute shall be turned on or off.
5527 .Bd -literal -offset indent
5528 define temporary_settings {
5529   set possibly_global_option1
5530   localopts on
5531   set local_option1
5532   set local_option2
5533   localopts scope off
5534   set possibly_global_option2
5540 .It Ic Lreply
5541 Reply to messages that come in via known
5542 .Pf ( Ic mlist )
5543 or subscribed
5544 .Pf ( Ic mlsubscribe )
5545 mailing lists, or pretend to do so (see
5546 .Sx "Mailing lists" ) :
5547 on top of the usual
5548 .Ic reply
5549 functionality this will actively resort and even remove message
5550 recipients in order to generate a message that is supposed to be sent to
5551 a mailing list.
5552 For example it will also implicitly generate a
5553 .Ql Mail-Followup-To:
5554 header if that seems useful, regardless of the setting of the variable
5555 .Va followup-to .
5556 For more documentation please refer to
5557 .Sx "On sending mail, and non-interactive mode" .
5559 This may generate the errors
5560 .Va ^ERR Ns -DESTADDRREQ
5561 if no receiver has been specified,
5562 .Va ^ERR Ns -PERM
5563 if some addressees where rejected by
5564 .Va expandaddr ,
5565 .Va ^ERR Ns -NODATA
5566 if no applicable messages have been given,
5567 .Va ^ERR Ns -IO
5568 if an I/O error occurs,
5569 .Va ^ERR Ns -NOTSUP
5570 if a necessary character set conversion fails, and
5571 .Va ^ERR Ns -INVAL
5572 for other errors.
5573 Any error stops processing of further messages.
5576 .It Ic Mail
5577 Similar to
5578 .Ic mail ,
5579 but saves the message in a file named after the local part of the first
5580 recipient's address (instead of in
5581 .Va record Ns ).
5584 .It Ic mail
5585 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5586 or asks on standard input if none were given;
5587 then collects the remaining mail content and sends it out.
5588 Unless the internal variable
5589 .Va fullnames
5590 is set recipient addresses will be stripped from comments, names etc.
5591 For more documentation please refer to
5592 .Sx "On sending mail, and non-interactive mode" .
5594 This may generate the errors
5595 .Va ^ERR Ns -DESTADDRREQ
5596 if no receiver has been specified,
5597 .Va ^ERR Ns -PERM
5598 if some addressees where rejected by
5599 .Va expandaddr ,
5600 .Va ^ERR Ns -NODATA
5601 if no applicable messages have been given,
5602 .Va ^ERR Ns -NOTSUP
5603 if multiple messages have been specified,
5604 .Va ^ERR Ns -IO
5605 if an I/O error occurs,
5606 .Va ^ERR Ns -NOTSUP
5607 if a necessary character set conversion fails, and
5608 .Va ^ERR Ns -INVAL
5609 for other errors.
5612 .It Ic mbox
5613 (mb) The given message list is to be sent to the
5614 .Mx -sx
5615 .Sx "secondary mailbox"
5616 .Ev MBOX
5617 when \*(UA is quit; this is the default action unless the variable
5618 .Va hold
5619 is set.
5620 \*(ID This command can only be used in a
5621 .Mx -sx
5622 .Sx "primary system mailbox" .
5626 .It Ic mimetype , unmimetype
5627 Without arguments the content of the MIME type cache will displayed;
5628 a more verbose listing will be produced if either of
5629 .Va debug
5631 .Va verbose
5632 are set.
5633 When given arguments they will be joined, interpreted as shown in
5634 .Sx "The mime.types files"
5635 (also see
5636 .Sx "HTML mail and MIME attachments" ) ,
5637 and the resulting entry will be added (prepended) to the cache.
5638 In any event MIME type sources are loaded first as necessary \(en
5639 .Va mimetypes-load-control
5640 can be used to fine-tune which sources are actually loaded.
5642 The latter command deletes all specifications of the given MIME type, thus
5643 .Ql ? unmimetype text/plain
5644 will remove all registered specifications for the MIME type
5645 .Ql text/plain .
5646 The special name
5647 .Ql *
5648 will discard all existing MIME types, just as will
5649 .Ql reset ,
5650 but which also reenables cache initialization via
5651 .Va mimetypes-load-control .
5655 .It Ic mlist , unmlist
5656 The latter command removes all given mailing-lists, the special name
5657 .Ql *
5658 can be used to remove all registered lists.
5659 The former will list all currently defined mailing lists (and their
5660 attributes, if any) when used without arguments; a more verbose listing
5661 will be produced if either of
5662 .Va debug
5664 .Va verbose
5665 are set.
5666 Otherwise all given arguments will be added and henceforth be recognized
5667 as mailing lists.
5668 If the \*(OPal regular expression support is available then mailing
5669 lists may also be specified as (extended) regular expressions (see
5670 .Xr re_format 7
5671 for more on those).
5674 .It Ic mimeview
5675 \*(ID Only available in interactive mode, this command allows to display
5676 MIME parts which require external MIME handler programs to run which do
5677 not integrate in \*(UAs normal
5678 .Ic type
5679 output (see
5680 .Sx "HTML mail and MIME attachments" ) .
5681 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5682 The user will be asked for each non-text part of the given message in
5683 turn whether the registered handler shall be used to display the part.
5687 .It Ic mlsubscribe , unmlsubscribe
5688 The latter command removes the subscription attribute from all given
5689 mailing-lists, the special name
5690 .Ql *
5691 can be used to do so for any registered list.
5692 The former will list all currently defined mailing lists which have
5693 a subscription attribute when used without arguments; a more verbose
5694 listing will be produced if either of
5695 .Va debug
5697 .Va verbose
5698 are set.
5699 Otherwise this attribute will be set for all given mailing lists,
5700 newly creating them as necessary (as via
5701 .Ic mlist ) .
5702 Also see
5703 .Va followup-to .
5706 .It Ic Move
5707 Similar to
5708 .Ic move ,
5709 but moves the messages to a file named after the local part of the
5710 sender address of the first message (instead of in
5711 .Va record Ns ).
5714 .It Ic move
5715 Acts like
5716 .Ic copy
5717 but marks the messages for deletion if they were transferred
5718 successfully.
5721 .It Ic More
5722 Like
5723 .Ic more ,
5724 but also displays header fields which would not pass the
5725 .Ic headerpick
5726 selection, and all MIME parts.
5727 Identical to
5728 .Ic Page .
5731 .It Ic more
5732 Invokes the
5733 .Ev PAGER
5734 on the given messages, even in non-interactive mode and as long as the
5735 standard output is a terminal.
5736 Identical to
5737 .Ic page .
5740 .It Ic netrc
5741 \*(OP When used without arguments or if
5742 .Ar show
5743 has been given the content of the
5744 .Pa .netrc
5745 cache is shown, loading it first as necessary.
5746 If the argument is
5747 .Ar load
5748 then the cache will only be initialized and
5749 .Ar clear
5750 will remove its contents.
5751 Note that \*(UA will try to load the file only once, use
5752 .Ql Ic \&\&netrc Ns \:\0\:clear
5753 to unlock further attempts.
5755 .Va netrc-lookup ,
5756 .Va netrc-pipe
5757 and the section
5758 .Sx "On URL syntax and credential lookup" ;
5759 the section
5760 .Sx "The .netrc file"
5761 documents the file format in detail.
5764 .It Ic newmail
5765 Checks for new mail in the current folder without committing any changes
5766 before.
5767 If new mail is present, a message is shown.
5768 If the
5769 .Va header
5770 variable is set,
5771 the headers of each new message are also shown.
5772 This command is not available for all mailbox types.
5775 .It Ic next
5776 (n) (like
5777 .Ql +
5779 .Dq ENTER )
5780 Goes to the next message in sequence and types it.
5781 With an argument list, types the next matching message.
5784 .It Ic New
5785 Same as
5786 .Ic Unread .
5789 .It Ic new
5790 Same as
5791 .Ic unread .
5794 .It Ic noop
5795 If the current folder is accessed via a network connection, a
5796 .Dq NOOP
5797 command is sent, otherwise no operation is performed.
5800 .It Ic Page
5801 Like
5802 .Ic page ,
5803 but also displays header fields which would not pass the
5804 .Ic headerpick
5805 selection, and all MIME parts.
5806 Identical to
5807 .Ic More .
5810 .It Ic page
5811 Invokes the
5812 .Ev PAGER
5813 on the given messages, even in non-interactive mode and as long as the
5814 standard output is a terminal.
5815 Identical to
5816 .Ic more .
5819 .It Ic Pipe
5820 Like
5821 .Ic pipe
5822 but also pipes header fields which would not pass the
5823 .Ic headerpick
5824 selection, and all parts of MIME
5825 .Ql multipart/alternative
5826 messages.
5829 .It Ic pipe
5830 (pi) Takes a message list and a shell command
5831 and pipes the messages through the command.
5832 Without an argument the current message is piped through the command
5833 given by the
5834 .Va cmd
5835 variable.
5836 If the
5837 .Va page
5838 variable is set,
5839 every message is followed by a formfeed character.
5842 .It Ic preserve
5843 (pre) A synonym for
5844 .Ic hold .
5847 .It Ic Print
5848 (P) Alias for
5849 .Ic Type .
5852 .It Ic print
5853 (p) Research
5855 equivalent of
5856 .Ic type .
5859 .It Ic quit
5860 (q) Terminates the session, saving all undeleted, unsaved messages in
5861 the current
5862 .Mx -sx
5863 .Sx "secondary mailbox"
5864 .Ev MBOX ,
5865 preserving all messages marked with
5866 .Ic hold
5868 .Ic preserve
5869 or never referenced in the system
5870 .Va inbox ,
5871 and removing all other messages from the
5872 .Mx -sx
5873 .Sx "primary system mailbox" .
5874 If new mail has arrived during the session,
5875 the message
5876 .Dq You have new mail
5877 will be shown.
5878 If given while editing a mailbox file with the command line option
5879 .Fl f ,
5880 then the edit file is rewritten.
5881 A return to the shell is effected,
5882 unless the rewrite of edit file fails,
5883 in which case the user can escape with the exit command.
5884 The optional status number argument will be passed through to
5885 .Xr exit 3 .
5886 \*(ID For now it can happen that the given status will be overwritten,
5887 later this will only occur if a later error needs to be reported onto an
5888 otherwise success indicating status.
5891 .It Ic read
5892 \*(NQ Read a line from standard input, or the channel set active via
5893 .Ic readctl ,
5894 and assign the data, which will be splitted as indicated by
5895 .Va ifs ,
5896 to the given variables.
5897 The variable names are checked by the same rules as documented for
5898 .Cm vput ,
5899 and the same error codes will be seen in
5900 .Va \&! ;
5901 the exit status
5902 .Va \&?
5903 indicates the number of bytes read, it will be
5904 .Ql -1
5905 with the error number
5906 .Va \&!
5907 set to
5908 .Va ^ERR Ns -BADF
5909 in case of I/O errors, or
5910 .Va ^ERR Ns -NONE
5911 upon End-Of-File.
5912 If there are more fields than variables, assigns successive fields to the
5913 last given variable.
5914 If there are less fields than variables, assigns the empty string to the
5915 remains.
5916 .Bd -literal -offset indent
5917 ? read a b c
5918    H  e  l  l  o
5919 ? echo "<$a> <$b> <$c>"
5920 <H> <e> <l  l  o>
5921 ? wysh set ifs=:; read a b c;unset ifs
5922 hey2.0,:"'you    ",:world!:mars.:
5923 ? echo $?/$^ERRNAME / <$a><$b><$c>
5924 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5928 .It Ic readall
5929 \*(NQ Read anything from standard input, or the channel set active via
5930 .Ic readctl ,
5931 and assign the data to the given variable.
5932 The variable name is checked by the same rules as documented for
5933 .Cm vput ,
5934 and the same error codes will be seen in
5935 .Va \&! ;
5936 the exit status
5937 .Va \&?
5938 indicates the number of bytes read, it will be
5939 .Ql -1
5940 with the error number
5941 .Va \&!
5942 set to
5943 .Va ^ERR Ns -BADF
5944 in case of I/O errors, or
5945 .Va ^ERR Ns -NONE
5946 upon End-Of-File.
5947 \*(ID The input data length is restricted to 31-bits.
5950 .It Ic readctl
5951 \*(NQ Manages input channels for
5952 .Ic read
5954 .Ic readall ,
5955 to be used to avoid complicated or impracticable code, like calling
5956 .Ic \&\&read
5957 from within a macro in non-interactive mode.
5958 Without arguments, or when the first argument is
5959 .Cm show ,
5960 a listing of all known channels is printed.
5961 Channels can otherwise be
5962 .Cm create Ns
5963 d, and existing channels can be
5964 .Cm set
5965 active and
5966 .Cm remove Ns
5967 d by giving the string used for creation.
5969 The channel name is expected to be a file descriptor number, or,
5970 if parsing the numeric fails, an input file name that undergoes
5971 .Sx "Filename transformations" .
5972 E.g. (this example requires a modern shell):
5973 .Bd -literal -offset indent
5974 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
5975   LC_ALL=C \*(uA -R#
5976 hey, you
5977 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
5978   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
5979 hey, you
5982 .It Ic redirect
5983 \*(OB Same as
5984 .Ic resend .
5986 .It Ic Redirect
5987 \*(OB Same as
5988 .Ic Resend .
5991 .It Ic remove
5992 Removes the named files or directories.
5993 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
5994 type specific removal will be performed, deleting the complete mailbox.
5995 The user is asked for confirmation in interactive mode.
5998 .It Ic rename
5999 Takes the name of an existing folder
6000 and the name for the new folder
6001 and renames the first to the second one.
6002 Both folders must be of the same type.
6005 .It Ic Reply
6006 (R) Replies to only the sender of each message of the given message
6007 list, by using the first message as the template to quote, for the
6008 .Ql Subject:
6009 etc.
6010 .Va flipr
6011 will exchange this command with
6012 .Ic reply .
6013 Unless the internal variable
6014 .Va fullnames
6015 is set the recipient address will be stripped from comments, names etc.
6016 .Ql Reply-To:
6017 headers will be inspected if
6018 .Va reply-to-honour
6019 is set.
6021 This may generate the errors
6022 .Va ^ERR Ns -DESTADDRREQ
6023 if no receiver has been specified,
6024 .Va ^ERR Ns -PERM
6025 if some addressees where rejected by
6026 .Va expandaddr ,
6027 .Va ^ERR Ns -NODATA
6028 if no applicable messages have been given,
6029 .Va ^ERR Ns -IO
6030 if an I/O error occurs,
6031 .Va ^ERR Ns -NOTSUP
6032 if a necessary character set conversion fails, and
6033 .Va ^ERR Ns -INVAL
6034 for other errors.
6037 .It Ic reply
6038 (r) Take a message and group-responds to it by addressing the sender
6039 and all recipients, subject to
6040 .Ic alternates
6041 processing.
6042 .Va followup-to ,
6043 .Va followup-to-honour ,
6044 .Va reply-to-honour
6045 as well as
6046 .Va recipients-in-cc
6047 influence response behaviour.
6048 Unless the internal variable
6049 .Va fullnames
6050 is set recipient addresses will be stripped from comments, names etc.
6052 .Va flipr
6053 is set the commands
6054 .Ic Reply
6056 .Ic reply
6057 are exchanged.
6058 The command
6059 .Ic Lreply
6060 offers special support for replying to mailing lists.
6061 For more documentation please refer to
6062 .Sx "On sending mail, and non-interactive mode" .
6064 This may generate the errors
6065 .Va ^ERR Ns -DESTADDRREQ
6066 if no receiver has been specified,
6067 .Va ^ERR Ns -PERM
6068 if some addressees where rejected by
6069 .Va expandaddr ,
6070 .Va ^ERR Ns -NODATA
6071 if no applicable messages have been given,
6072 .Va ^ERR Ns -IO
6073 if an I/O error occurs,
6074 .Va ^ERR Ns -NOTSUP
6075 if a necessary character set conversion fails, and
6076 .Va ^ERR Ns -INVAL
6077 for other errors.
6078 Any error stops processing of further messages.
6081 .It Ic replyall
6082 Similar to
6083 .Ic reply ,
6084 but initiates a group-reply regardless of the value of
6085 .Va flipr .
6088 .It Ic replysender
6089 Similar to
6090 .Ic Reply ,
6091 but responds to the sender only regardless of the value of
6092 .Va flipr .
6095 .It Ic Resend
6096 Like
6097 .Ic resend ,
6098 but does not add any header lines.
6099 This is not a way to hide the sender's identity,
6100 but useful for sending a message again to the same recipients.
6103 .It Ic resend
6104 Takes a list of messages and a user name
6105 and sends each message to the named user.
6106 .Ql Resent-From:
6107 and related header fields are prepended to the new copy of the message.
6108 Saving in
6109 .Va record
6110 is only performed if
6111 .Va record-resent
6112 is set.
6114 This may generate the errors
6115 .Va ^ERR Ns -DESTADDRREQ
6116 if no receiver has been specified,
6117 .Va ^ERR Ns -PERM
6118 if some addressees where rejected by
6119 .Va expandaddr ,
6120 .Va ^ERR Ns -NODATA
6121 if no applicable messages have been given,
6122 .Va ^ERR Ns -IO
6123 if an I/O error occurs,
6124 .Va ^ERR Ns -NOTSUP
6125 if a necessary character set conversion fails, and
6126 .Va ^ERR Ns -INVAL
6127 for other errors.
6128 Any error stops processing of further messages.
6131 .It Ic Respond
6132 Same as
6133 .Ic Reply .
6136 .It Ic respond
6137 Same as
6138 .Ic reply .
6141 .It Ic respondall
6142 Same as
6143 .Ic replyall .
6146 .It Ic respondsender
6147 Same as
6148 .Ic replysender .
6151 .It Ic retain
6152 (ret) Superseded by the multiplexer
6153 .Ic headerpick .
6156 .It Ic return
6157 Only available inside the scope of a
6158 .Ic define Ns
6159 d macro or an
6160 .Ic account ,
6161 this will stop evaluation of any further macro content, and return
6162 execution control to the caller.
6163 The two optional parameters must be specified as positive decimal
6164 numbers and default to the value 0:
6165 the first argument specifies the signed 32-bit return value (stored in
6166 .Va \&?
6167 \*(ID and later extended to signed 64-bit),
6168 the second the signed 32-bit error number (stored in
6169 .Va \&! ) .
6170 As documented for
6171 .Va \&?
6172 a non-0 exit status may cause the program to exit.
6175 .It Ic Save
6176 (S) Similar to
6177 .Ic save,
6178 but saves the messages in a file named after the local part of the
6179 sender of the first message instead of (in
6180 .Va record
6181 and) taking a filename argument; the variable
6182 .Va outfolder
6183 is inspected to decide on the actual storage location.
6186 .It Ic save
6187 (s) Takes a message list and a filename and appends each message in turn
6188 to the end of the file.
6189 If no filename is given, the
6190 .Mx -sx
6191 .Sx "secondary mailbox"
6192 .Ev MBOX
6193 is used.
6194 The filename in quotes, followed by the generated character count
6195 is echoed on the user's terminal.
6196 If editing a
6197 .Mx -sx
6198 .Sx "primary system mailbox"
6199 the messages are marked for deletion.
6200 .Sx "Filename transformations"
6201 will be applied.
6202 To filter the saved header fields to the desired subset use the
6203 .Ql save
6204 slot of the white- and blacklisting command
6205 .Ic headerpick .
6207 .It Ic savediscard
6208 \*(OB Superseded by the multiplexer
6209 .Ic headerpick .
6211 .It Ic saveignore
6212 \*(OB Superseded by the multiplexer
6213 .Ic headerpick .
6215 .It Ic saveretain
6216 \*(OB Superseded by the multiplexer
6217 .Ic headerpick .
6220 .It Ic search
6221 Takes a message specification (list) and displays a header summary of
6222 all matching messages, as via
6223 .Ic headers .
6224 This command is an alias of
6225 .Ic from .
6226 Also see
6227 .Sx "Specifying messages" .
6230 .It Ic seen
6231 Takes a message list and marks all messages as having been read.
6236 .It Ic set , unset
6237 (se, \*(NQ uns) The latter command will delete all given variables,
6238 the former, when used without arguments, will show all variables which
6239 are currently known to \*(UA.
6240 A more verbose listing will be produced if
6241 either of
6242 .Va debug
6244 .Va verbose
6245 are set.
6246 Remarks: the list mode will not automatically link-in known
6247 .Sx ENVIRONMENT
6248 variables, but only explicit addressing will, e.g., via
6249 .Ic varshow ,
6250 using a variable in an
6251 .Ic if
6252 condition or a string passed to
6253 .Ic echo ,
6254 explicit
6255 .Ic set Ns
6256 ting, as well as some program-internal use cases.
6259 Otherwise the given variables (and arguments) are set or adjusted.
6260 Arguments are of the form
6261 .Ql name=value
6262 (no space before or after
6263 .Ql = ) ,
6264 or plain
6265 .Ql name
6266 if there is no value, i.e., a boolean variable.
6267 \*(ID In conjunction with the
6268 .Cm wysh
6269 command prefix
6270 .Sx "Shell-style argument quoting"
6271 can be used to quote arguments as necessary.
6272 \*(ID Otherwise quotation marks may be placed around any part of the
6273 assignment statement to quote blanks or tabs.
6276 .Dl ? wysh set indentprefix=' -> '
6279 If an argument begins with
6280 .Ql no ,
6281 as in
6282 .Ql set nosave ,
6283 the effect is the same as invoking the
6284 .Ic unset
6285 command with the remaining part of the variable
6286 .Pf ( Ql unset save ) .
6290 .Ql name
6291 that is known to map to an environment variable will automatically cause
6292 updates in the program environment (unsetting a variable in the
6293 environment requires corresponding system support) \(em use the command
6294 .Ic environ
6295 for further environmental control.
6296 Also see
6297 .Ic varedit ,
6298 .Ic varshow
6299 and the sections
6300 .Sx "INTERNAL VARIABLES"
6302 .Sx ENVIRONMENT .
6306 .It Ic shcodec
6307 Apply shell quoting rules to the given raw-data arguments.
6308 Supports
6309 .Cm vput
6310 (see
6311 .Sx "Command modifiers" ) .
6312 The first argument specifies the operation:
6313 .Ar [+]e[ncode]
6315 .Ar d[ecode]
6316 cause shell quoting to be applied to the remains of the line, and
6317 expanded away thereof, respectively.
6318 If the former is prefixed with a plus-sign, the quoted result will not
6319 be roundtrip enabled, and thus can be decoded only in the very same
6320 environment that was used to perform the encode; also see
6321 .Cd mle-quote-rndtrip .
6322 If the coding operation fails the error number
6323 .Va \&!
6324 is set to
6325 .Va ^ERR Ns -CANCELED ,
6326 and the unmodified input is used as the result; the error number may
6327 change again due to output or result storage errors.
6330 .It Ic shell
6331 \*(NQ (sh) Invokes an interactive version of the shell,
6332 and returns its exit status.
6336 .It Ic shortcut , unshortcut
6337 Without arguments the list of all currently defined shortcuts is
6338 shown, with one argument the expansion of the given shortcut.
6339 Otherwise all given arguments are treated as pairs of shortcuts and
6340 their expansions, creating new or changing already existing shortcuts,
6341 as necessary.
6342 The latter command will remove all given shortcuts, the special name
6343 .Ql *
6344 will remove all registered shortcuts.
6347 .It Ic shift
6348 \*(NQ Shift the positional parameter stack (starting at
6349 .Va 1 )
6350 by the given number (which must be a positive decimal),
6351 or 1 if no argument has been given.
6352 It is an error if the value exceeds the number of positional parameters.
6353 If the given number is 0, no action is performed, successfully.
6354 The stack as such can be managed via
6355 .Ic vpospar .
6356 Note this command will fail in
6357 .Ic account
6358 and hook macros unless the positional parameter stack has been
6359 explicitly created in the current context via
6360 .Ic vpospar .
6363 .It Ic show
6364 Like
6365 .Ic type ,
6366 but performs neither MIME decoding nor decryption, so that the raw
6367 message text is shown.
6370 .It Ic size
6371 (si) Shows the size in characters of each message of the given
6372 message-list.
6375 .It Ic sleep
6376 \*(NQ Sleep for the specified number of seconds (and optionally
6377 milliseconds), by default interruptably.
6378 If a third argument is given the sleep will be uninterruptible,
6379 otherwise the error number
6380 .Va \&!
6381 will be set to
6382 .Va ^ERR Ns -INTR
6383 if the sleep has been interrupted.
6384 The command will fail and the error number will be
6385 .Va ^ERR Ns -OVERFLOW
6386 if the given duration(s) overflow the time datatype, and
6387 .Va ^ERR Ns -INVAL
6388 if the given durations are no valid integers.
6393 .It Ic sort , unsort
6394 The latter command disables sorted or threaded mode, returns to normal
6395 message order and, if the
6396 .Va header
6397 variable is set,
6398 displays a header summary.
6399 The former command shows the current sorting criterion when used without
6400 an argument, but creates a sorted representation of the current folder
6401 otherwise, and changes the
6402 .Ic next
6403 command and the addressing modes such that they refer to messages in
6404 the sorted order.
6405 Message numbers are the same as in regular mode.
6406 If the
6407 .Va header
6408 variable is set,
6409 a header summary in the new order is also displayed.
6410 Automatic folder sorting can be enabled by setting the
6411 .Va autosort
6412 variable, as in, e.g.,
6413 .Ql set autosort=thread .
6414 Possible sorting criterions are:
6417 .Bl -tag -compact -width "subject"
6418 .It Ar date
6419 Sort the messages by their
6420 .Ql Date:
6421 field, that is by the time they were sent.
6422 .It Ar from
6423 Sort messages by the value of their
6424 .Ql From:
6425 field, that is by the address of the sender.
6426 If the
6427 .Va showname
6428 variable is set, the sender's real name (if any) is used.
6429 .It Ar size
6430 Sort the messages by their size.
6431 .It spam
6432 \*(OP Sort the message by their spam score, as has been classified by
6433 .Ic spamrate .
6434 .It Ar status
6435 Sort the messages by their message status.
6436 .It Ar subject
6437 Sort the messages by their subject.
6438 .It Ar thread
6439 Create a threaded display.
6440 .It Ar to
6441 Sort messages by the value of their
6442 .Ql To:
6443 field, that is by the address of the recipient.
6444 If the
6445 .Va showname
6446 variable is set, the recipient's real name (if any) is used.
6451 .It Ic source
6452 \*(NQ (so) The source command reads commands from the given file.
6453 .Sx "Filename transformations"
6454 will be applied.
6455 If the given expanded argument ends with a vertical bar
6456 .Ql |
6457 then the argument will instead be interpreted as a shell command and
6458 \*(UA will read the output generated by it.
6459 Dependent on the settings of
6460 .Va posix
6462 .Va errexit ,
6463 and also dependent on whether the command modifier
6464 .Cm ignerr
6465 had been used, encountering errors will stop sourcing of the given input.
6466 \*(ID Note that
6467 .Ic \&\&source
6468 cannot be used from within macros that execute as
6469 .Va folder-hook Ns s
6471 .Ic account Ns s ,
6472 i.e., it can only be called from macros that were
6473 .Ic call Ns ed .
6476 .It Ic source_if
6477 \*(NQ The difference to
6478 .Ic source
6479 (beside not supporting pipe syntax aka shell command input) is that
6480 this command will not generate an error nor warn if the given file
6481 argument cannot be opened successfully.
6484 .It Ic spamclear
6485 \*(OP Takes a list of messages and clears their
6486 .Ql is-spam
6487 flag.
6490 .It Ic spamforget
6491 \*(OP Takes a list of messages and causes the
6492 .Va spam-interface
6493 to forget it has ever used them to train its Bayesian filter.
6494 Unless otherwise noted the
6495 .Ql is-spam
6496 flag of the message is inspected to chose whether a message shall be
6497 forgotten to be
6498 .Dq ham
6500 .Dq spam .
6503 .It Ic spamham
6504 \*(OP Takes a list of messages and informs the Bayesian filter of the
6505 .Va spam-interface
6506 that they are
6507 .Dq ham .
6508 This also clears the
6509 .Ql is-spam
6510 flag of the messages in question.
6513 .It Ic spamrate
6514 \*(OP Takes a list of messages and rates them using the configured
6515 .Va spam-interface ,
6516 without modifying the messages, but setting their
6517 .Ql is-spam
6518 flag as appropriate; because the spam rating headers are lost the rate
6519 will be forgotten once the mailbox is left.
6520 Refer to the manual section
6521 .Sx "Handling spam"
6522 for the complete picture of spam handling in \*(UA.
6525 .It Ic spamset
6526 \*(OP Takes a list of messages and sets their
6527 .Ql is-spam
6528 flag.
6531 .It Ic spamspam
6532 \*(OP Takes a list of messages and informs the Bayesian filter of the
6533 .Va spam-interface
6534 that they are
6535 .Dq spam .
6536 This also sets the
6537 .Ql is-spam
6538 flag of the messages in question.
6540 .It Ic thread
6541 \*(OB The same as
6542 .Ql sort thread
6543 (consider using a
6544 .Ql commandalias
6545 as necessary).
6548 .It Ic Top
6549 Like
6550 .Ic top
6551 but always uses the
6552 .Ic headerpick
6553 .Ql type
6554 slot for white- and blacklisting header fields.
6557 .It Ic top
6558 (to) Takes a message list and types out the first
6559 .Va toplines
6560 lines of each message on the users' terminal.
6561 Unless a special selection has been established for the
6562 .Ql top
6563 slot of the
6564 .Ic headerpick
6565 command, the only header fields that are displayed are
6566 .Ql From: ,
6567 .Ql To: ,
6568 .Ql CC: ,
6570 .Ql Subject: .
6571 .Ic Top
6572 will always use the
6573 .Ql type
6574 .Ic headerpick
6575 selection instead.
6576 It is possible to apply compression to what is displayed by setting
6577 .Va topsqueeze .
6578 Messages are decrypted and converted to the terminal character set
6579 if necessary.
6582 .It Ic touch
6583 (tou) Takes a message list and marks the messages for saving in the
6584 .Mx -sx
6585 .Sx "secondary mailbox"
6586 .Ev MBOX .
6587 \*(UA deviates from the POSIX standard with this command,
6588 as a following
6589 .Ic next
6590 command will display the following message instead of the current one.
6593 .It Ic Type
6594 (T) Like
6595 .Ic type
6596 but also displays header fields which would not pass the
6597 .Ic headerpick
6598 selection, and all visualizable parts of MIME
6599 .Ql multipart/alternative
6600 messages.
6603 .It Ic type
6604 (t) Takes a message list and types out each message on the users terminal.
6605 The display of message headers is selectable via
6606 .Ic headerpick .
6607 For MIME multipart messages, all parts with a content type of
6608 .Ql text ,
6609 all parts which have a registered MIME type handler (see
6610 .Sx "HTML mail and MIME attachments" )
6611 which produces plain text output, and all
6612 .Ql message
6613 parts are shown, others are hidden except for their headers.
6614 Messages are decrypted and converted to the terminal character set
6615 if necessary.
6616 The command
6617 .Ic mimeview
6618 can be used to display parts which are not displayable as plain text.
6620 .It Ic unaccount
6622 .Ic account .
6624 .It Ic unalias
6625 (una) See
6626 .Ic alias .
6628 .It Ic unanswered
6630 .Ic answered .
6632 .It Ic unbind
6634 .Ic bind .
6636 .It Ic uncollapse
6638 .Ic collapse .
6640 .It Ic uncolour
6642 .Ic colour .
6644 .It Ic undefine
6646 .Ic define .
6648 .It Ic undelete
6650 .Ic delete .
6652 .It Ic undraft
6654 .Ic draft .
6656 .It Ic unflag
6658 .Ic flag .
6660 .It Ic unfwdignore
6661 \*(OB Superseded by the multiplexer
6662 .Ic headerpick .
6664 .It Ic unfwdretain
6665 \*(OB Superseded by the multiplexer
6666 .Ic headerpick .
6669 .It Ic unignore
6670 Superseded by the multiplexer
6671 .Ic headerpick .
6673 .It Ic unmimetype
6675 .Ic mimetype .
6677 .It Ic unmlist
6679 .Ic mlist .
6681 .It Ic unmlsubscribe
6683 .Ic mlsubscribe .
6686 .It Ic Unread
6687 Same as
6688 .Ic unread .
6691 .It Ic unread
6692 Takes a message list and marks each message as not having been read.
6695 .It Ic unretain
6696 Superseded by the multiplexer
6697 .Ic headerpick .
6699 .It Ic unsaveignore
6700 \*(OB Superseded by the multiplexer
6701 .Ic headerpick .
6703 .It Ic unsaveretain
6704 \*(OB Superseded by the multiplexer
6705 .Ic headerpick .
6707 .It Ic unset
6708 \*(NQ (uns) See
6709 .Ic set .
6711 .It Ic unshortcut
6713 .Ic shortcut .
6715 .It Ic unsort
6717 .Ic short .
6719 .It Ic unthread
6720 \*(OB
6721 Same as
6722 .Ic unsort .
6725 .It Ic urlcodec
6726 Perform URL percent codec operations on the raw-data argument, rather
6727 according to RFC 3986.
6728 Supports
6729 .Cm vput
6730 (see
6731 .Sx "Command modifiers" ) ,
6732 and manages the error number
6733 .Va \&! .
6734 This is a character set agnostic and thus locale dependent operation,
6735 and it may decode bytes which are invalid in the current
6736 .Va ttycharset .
6737 \*(ID This command does not know about URLs beside that.
6739 The first argument specifies the operation:
6740 .Ar e[ncode]
6742 .Ar d[ecode]
6743 perform plain URL percent en- and decoding, respectively.
6744 .Ar p[ath]enc[ode]
6746 .Ar p[ath]dec[ode]
6747 perform a slightly modified operation which should be better for
6748 pathnames: it does not allow a tilde
6749 .Ql ~ ,
6750 and will neither accept hyphen-minus
6751 .Ql -
6752 nor dot
6753 .Ql .
6754 as an initial character.
6755 The remains of the line form the URL data which is to be converted.
6756 If the coding operation fails the error number
6757 .Va \&!
6758 is set to
6759 .Va ^ERR Ns -CANCELED ,
6760 and the unmodified input is used as the result; the error number may
6761 change again due to output or result storage errors.
6764 .It Ic varedit
6765 \*(NQ Edit the values of or create the given variable(s) in the
6766 .Ev EDITOR .
6767 Boolean variables cannot be edited, and variables can also not be
6768 .Ic unset
6769 with this command.
6772 .It Ic varshow
6773 \*(NQ This command produces the same output as the listing mode of
6774 .Ic set ,
6775 including
6776 .Va verbose Ns
6777 ity adjustments, but only for the given variables.
6780 .It Ic verify
6781 \*(OP Takes a message list and verifies each message.
6782 If a message is not a S/MIME signed message,
6783 verification will fail for it.
6784 The verification process checks if the message was signed using a valid
6785 certificate,
6786 if the message sender's email address matches one of those contained
6787 within the certificate,
6788 and if the message content has been altered.
6791 .It Ic version
6792 Shows the
6793 .Va version
6795 .Va features
6796 of \*(UA.
6800 .It Ic vexpr
6801 \*(NQ Evaluate arguments according to a given operator.
6802 This is a multiplexer command which can be used to perform signed 64-bit
6803 numeric calculations as well as byte string and string operations.
6804 It uses polish notation, i.e., the operator is the first argument and
6805 defines the number and type, and the meaning of the remaining arguments.
6806 An empty argument is replaced with a 0 if a number is expected.
6807 Supports
6808 .Cm vput
6809 (see
6810 .Sx "Command modifiers" ) .
6813 The result that is shown in case of errors is always
6814 .Ql -1
6815 for usage errors and numeric operations, and the empty string for byte
6816 string and string operations;
6817 if the latter two fail to provide result data for
6818 .Dq soft
6819 errors, e.g., when a search operation failed, they also set the
6820 .Va \&!
6821 error number to
6822 .Va ^ERR Ns -NODATA .
6823 Except when otherwise noted numeric arguments are parsed as signed 64-bit
6824 numbers, and errors will be reported in the error number
6825 .Va \&!
6826 as the numeric error
6827 .Va ^ERR Ns -RANGE .
6830 Numeric operations work on one or two signed 64-bit integers.
6831 One integer is expected by assignment (equals sign
6832 .Ql = ) ,
6833 which does nothing but parsing the argument, thus detecting validity and
6834 possible overflow conditions, and unary not (tilde
6835 .Ql ~ ) ,
6836 which creates the bitwise complement.
6837 Two integers are used by addition (plus sign
6838 .Ql + ) ,
6839 subtraction (hyphen-minus
6840 .Ql - ) ,
6841 multiplication (asterisk
6842 .Ql * ) ,
6843 division (solidus
6844 .Ql / )
6845 and modulo (percent sign
6846 .Ql % ) ,
6847 as well as for the bitwise operators logical or (vertical bar
6848 .Ql | ,
6849 to be quoted) ,
6850 bitwise and (ampersand
6851 .Ql \&& ,
6852 to be quoted) ,
6853 bitwise xor (circumflex
6854 .Ql ^ ) ,
6855 the bitwise signed left- and right shifts
6856 .Pf ( Ql << ,
6857 .Ql >> ) ,
6858 as well as for the unsigned right shift
6859 .Ql >>> .
6862 All numeric operators can be suffixed with a commercial at
6863 .Ql @ ,
6864 e.g.,
6865 .Ql *@ :
6866 this will turn the operation into a saturated one, which means that
6867 overflow errors and division and modulo by zero are no longer reported
6868 via the exit status, but the result will linger at the minimum or
6869 maximum possible value, instead of overflowing (or trapping).
6870 This is true also for the argument parse step.
6871 For the bitwise shifts, the saturated maximum is 63.
6872 Any catched overflow will be reported via the error number
6873 .Va \&!
6875 .Va ^ERR Ns -OVERFLOW .
6878 Character set agnostic string functions have no notion of locale
6879 settings and character sets.
6881 .Bl -hang -width ".It Cm random"
6882 .It Cm file-expand
6883 Performs the usual
6884 .Sx "Filename transformations"
6885 on its argument.
6886 .It Cm random
6887 Generates a random string of the given length, or of
6888 .Dv \&\&PATH_MAX
6889 bytes (a constant from
6890 .Pa /usr/include )
6891 if the value 0 is given; the random string will be base64url encoded
6892 according to RFC 4648, and thus be usable as a (portable) filename.
6896 Byte string operations work on 8-bit bytes and have no notion of locale
6897 settings and character sets, effectively assuming ASCII data.
6900 .Bl -hang -width ".It Cm length"
6901 .It Cm length
6902 Queries the length of the given argument.
6904 .It Cm hash
6905 Calculates the Chris Torek hash of the given argument.
6907 .It Cm find
6908 Byte-searches in the first for the second argument.
6909 Shows the resulting 0-based offset shall it have been found.
6911 .It Cm ifind
6912 Identical to
6913 .Cm find ,
6914 but works case-insensitively according to the rules of the ASCII
6915 character set.
6917 .It Cm substring
6918 Creates a substring of its first argument.
6919 The second argument is the 0-based starting offset, a negative one
6920 counts from the end;
6921 the optional third argument specifies the length of the desired result,
6922 a negative length leaves off the given number of bytes at the end of the
6923 original string, by default the entire string is used;
6924 this operation tries to work around faulty arguments (set
6925 .Va verbose
6926 for error logs), but reports them via the error number
6927 .Va \&!
6929 .Va ^ERR Ns -OVERFLOW .
6931 .It Cm trim
6932 Trim away whitespace characters from both ends of the argument.
6934 .It Cm trim-front
6935 Trim away whitespace characters from the begin of the argument.
6937 .It Cm trim-end
6938 Trim away whitespace characters from the end of the argument.
6943 String operations work, sufficient support provided, according to the
6944 active user's locale encoding and character set (see
6945 .Sx "Character sets" ) .
6948 .Bl -hang -width ".It Cm regex"
6949 .It Cm makeprint
6950 (One-way) Converts the argument to something safely printable on the
6951 terminal.
6953 .It Cm regex
6954 \*(OP A string operation that will try to match the first argument with
6955 the regular expression given as the second argument.
6956 If the optional third argument has been given then instead of showing
6957 the match offset a replacement operation is performed: the third
6958 argument is treated as if specified via dollar-single-quote (see
6959 .Sx "Shell-style argument quoting" ) ,
6960 and any occurrence of a positional parameter, e.g.,
6961 .Va 1 ,
6962 is replaced by the corresponding match group of the regular expression:
6963 .Bd -literal -offset indent
6964 ? vexpr -@ +1 -9223372036854775808
6965 ? vput vexpr res ir bananarama \e
6966     (.*)NanA(.*) '\e${1}au\e$2'
6967 ? echo $0 $res
6970 .It Cm iregex
6971 On otherwise identical case-insensitive equivalent to
6972 .Cm regex .
6977 .It Ic vpospar
6978 \*(NQ Manage the positional parameter stack (see
6979 .Va 1 , # , * , @
6980 as well as
6981 .Ic shift ) .
6982 If the first argument is
6983 .Ql clear ,
6984 then the positional parameter stack of the current context, or the
6985 global one, if there is none, is cleared.
6986 If it is
6987 .Ql set ,
6988 then the remaining arguments will be used to (re)create the stack,
6989 if the parameter stack size limit is excessed an
6990 .Va ^ERR Ns -OVERFLOW
6991 error will occur.
6994 If the first argument is
6995 .Ql quote ,
6996 a round-trip capable representation of the stack contents is created,
6997 with each quoted parameter separated from each other with the first
6998 character of
6999 .Va ifs ,
7000 and followed by the first character of
7001 .Va if-ws ,
7002 if that is not empty and not identical to the first.
7003 If that results in no separation at all a
7004 .Cm space
7005 character is used.
7006 This mode supports
7007 .Cm vput
7008 (see
7009 .Sx "Command modifiers" ) .
7010 I.e., the subcommands
7011 .Ql set
7013 .Ql quote
7014 can be used (in conjunction with
7015 .Ic eval )
7016 to (re)create an argument stack from and to a single variable losslessly.
7018 .Bd -literal -offset indent
7019 ? vpospar set hey, "'you    ", world!
7020 ? echo $#: <${1}><${2}><${3}>
7021 ? vput vpospar x quote
7022 ? vpospar clear
7023 ? echo $#: <${1}><${2}><${3}>
7024 ? eval vpospar set ${x}
7025 ? echo $#: <${1}><${2}><${3}>
7030 .It Ic visual
7031 (v) Takes a message list and invokes the display editor on each message.
7032 Modified contents are discarded unless the
7033 .Va writebackedited
7034 variable is set, and are not used unless the mailbox can be written to
7035 and the editor returns a successful exit status.
7038 .It Ic write
7039 (w) For conventional messages the body without all headers is written.
7040 The original message is never marked for deletion in the originating
7041 mail folder.
7042 The output is decrypted and converted to its native format as necessary.
7043 If the output file exists, the text is appended.
7044 If a message is in MIME multipart format its first part is written to
7045 the specified file as for conventional messages, handling of the remains
7046 depends on the execution mode.
7047 No special handling of compressed files is performed.
7049 In interactive mode the user is consecutively asked for the filenames of
7050 the processed parts.
7051 For convience saving of each part may be skipped by giving an empty
7052 value, the same result as writing it to
7053 .Pa /dev/null .
7054 Shell piping the part content by specifying a leading vertical bar
7055 .Ql |
7056 character for the filename is supported.
7057 Other user input undergoes the usual
7058 .Sx "Filename transformations" ,
7059 and contents of the destination file are overwritten if the file
7060 previously existed.
7062 \*(ID In non-interactive mode any part which does not specify a filename
7063 is ignored, and suspicious parts of filenames of the remaining parts are
7064 URL percent encoded (as via
7065 .Ic urlcodec )
7066 to prevent injection of malicious character sequences, resulting in
7067 a filename that will be written into the current directory.
7068 Existing files will not be overwritten, instead the part number or
7069 a dot are appended after a number sign
7070 .Ql #
7071 to the name until file creation succeeds (or fails due to other
7072 reasons).
7075 .It Ic xcall
7076 \*(NQ The sole difference to
7077 .Ic call
7078 is that the new macro is executed in place of the current one, which
7079 will not regain control: all resources of the current macro will be
7080 released first.
7081 This implies that any setting covered by
7082 .Ic localopts
7083 will be forgotten and covered variables will become cleaned up.
7084 If this command is not used from within a
7085 .Ic call Ns
7086 ed macro it will silently be (a more expensive variant of)
7087 .Ic call .
7090 .It Ic xit
7091 (x) A synonym for
7092 .Ic exit .
7095 .It Ic z
7096 \*(NQ \*(UA presents message headers in
7097 .Va screen Ns
7098 fuls as described under the
7099 .Ic headers
7100 command.
7101 Without arguments this command scrolls to the next window of messages,
7102 likewise if the argument is
7103 .Ql + .
7104 An argument of
7105 .Ql -
7106 scrolls to the last,
7107 .Ql ^
7108 scrolls to the first, and
7109 .Ql $
7110 to the last
7111 .Va \&\&screen
7112 of messages.
7113 A number argument prefixed by
7114 .Ql +
7116 .Ql \-
7117 indicates that the window is calculated in relation to the current
7118 position, and a number without a prefix specifies an absolute position.
7121 .It Ic Z
7122 \*(NQ Similar to
7123 .Ic z ,
7124 but scrolls to the next or previous window that contains at least one
7125 .Ql new
7127 .Ic flag Ns
7128 ged message.
7130 .\" }}}
7132 .\" }}}
7135 .\" .Sh COMMAND ESCAPES {{{
7136 .Sh "COMMAND ESCAPES"
7138 Here is a summary of the command escapes available in compose mode,
7139 which are used to perform special functions when composing messages.
7140 Command escapes are only recognized at the beginning of lines, and
7141 consist of a trigger (escape) and a command character.
7142 The actual escape character can be set via the internal variable
7143 .Va escape ,
7144 it defaults to the tilde
7145 .Ql ~ .
7146 Otherwise ignored whitespace characters following the escape character
7147 will prevent a possible addition of the command line to the \*(OPal
7148 history.
7151 Unless otherwise noted all compose mode command escapes ensure proper
7152 updates of the variables which represent the error number
7153 .Va \&!
7154 and the exit status
7155 .Va \&? .
7156 If the variable
7157 .Va errexit
7158 is set they will, unless stated otherwise, error out message compose
7159 mode and cause a progam exit if an operation fails.
7160 It is however possible to place the character hyphen-minus
7161 .Ql -
7162 after (possible whitespace following) the escape character, which has an
7163 effect equivalent to the command modifier
7164 .Cm ignerr .
7165 If the \*(OPal key bindings are available it is possible to create
7166 .Ic bind Ns
7167 ings specifically for the compose mode.
7170 .Bl -tag -width ".It Ic BaNg"
7172 .It Ic ~~ Ar string
7173 Insert the string of text in the message prefaced by a single
7174 .Ql ~ .
7175 (If the escape character has been changed,
7176 that character must be doubled instead.)
7179 .It Ic ~! Ar command
7180 Execute the indicated shell
7181 .Ar command
7182 which follows, replacing unescaped exclamation marks with the previously
7183 executed command if the internal variable
7184 .Va bang
7185 is set, then return to the message.
7188 .It Ic ~.
7189 Same effect as typing the end-of-file character.
7192 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
7193 Execute the given \*(UA command.
7194 Not all commands, however, are allowed.
7197 .It Ic ~< Ar filename
7198 Identical to
7199 .Ic ~r .
7202 .It Ic ~<! Ar command
7203 .Ar command
7204 is executed using the shell.
7205 Its standard output is inserted into the message.
7208 .It Ic ~?
7209 Write a summary of command escapes.
7212 .It Ic ~@ Op Ar filename...
7213 Append or edit the list of attachments.
7214 Does not manage the error number
7215 .Va \&!
7216 and the exit status
7217 .Va \&? ,
7218 (please use
7219 .Ic ~^
7220 instead if this is a concern).
7221 A list of
7222 .Ar filename
7223 arguments is expected as shell tokens (see
7224 .Sx "Shell-style argument quoting" ;
7225 token-separating commas are ignored, too), to be
7226 interpreted as documented for the command line option
7227 .Fl a ,
7228 with the message number exception as below.
7230 Without
7231 .Ar filename
7232 arguments the attachment list is edited, entry by entry;
7233 if a filename is left empty, that attachment is deleted from the list;
7234 once the end of the list is reached either new attachments may be
7235 entered or the session can be quit by committing an empty
7236 .Dq new
7237 attachment.
7239 For all mode, if a given filename solely consists of the number sign
7240 .Ql #
7241 followed by a valid message number of the currently active mailbox, then
7242 the given message is attached as a
7243 .Ql message/rfc822
7244 MIME message part.
7245 As the shell comment character the number sign must be quoted.
7248 .It Ic ~| Ar command
7249 Pipe the message through the specified filter command.
7250 If the command gives no output or terminates abnormally,
7251 retain the original text of the message.
7252 E.g., the command
7253 .Xr fmt 1
7254 is often used as a rejustifying filter.
7258 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7259 Low-level command meant for scripted message access, i.e., for
7260 .Va on-compose-splice
7262 .Va on-compose-splice-shell .
7263 The used protocol is likely subject to changes, and therefore the
7264 mentioned hooks receive the used protocol version as an initial line.
7265 In general the first field of a response line represents a status code
7266 which specifies whether a command was successful or not, whether result
7267 data is to be expected, and if, the format of the result data.
7268 Does not manage the error number
7269 .Va \&!
7270 and the exit status
7271 .Va \&? ,
7272 because errors are reported via the protocol
7273 (hard errors like I/O failures cannot be handled).
7274 This command has read-only access to several virtual pseudo headers in
7275 the \*(UA private namespace, which may not exist (except for the first):
7279 .Bl -tag -compact -width ".It Va BaNg"
7280 .It Ql Mailx-Command:
7281 The name of the command that generates the message, one of
7282 .Ql forward ,
7283 .Ql Lreply ,
7284 .Ql mail ,
7285 .Ql Reply ,
7286 .Ql reply ,
7287 .Ql resend .
7289 .It Ql Mailx-Raw-To:
7290 .It Ql Mailx-Raw-Cc:
7291 .It Ql Mailx-Raw-Bcc:
7292 Represent the frozen initial state of these headers before any
7293 transformation (e.g.,
7294 .Ic alias ,
7295 .Ic alternates ,
7296 .Va recipients-in-cc
7297 etc.) took place.
7299 .It Ql Mailx-Orig-From:
7300 .It Ql Mailx-Orig-To:
7301 .It Ql Mailx-Orig-Cc:
7302 .It Ql Mailx-Orig-Bcc:
7303 The values of said headers of the original message which has been
7304 addressed by any of
7305 .Ic reply , forward , resend .
7309 The status codes are:
7313 .Bl -tag -compact -width ".It Ql 210"
7314 .It Ql 210
7315 Status ok; the remains of the line are the result.
7317 .It Ql 211
7318 Status ok; the rest of the line is optionally used for more status.
7319 What follows are lines of result addresses, terminated by an empty line.
7320 The address lines consist of two fields, the first of which is the
7321 plain address, e.g.,
7322 .Ql bob@exam.ple ,
7323 separated by a single ASCII SP space from the second which contains the
7324 unstripped address, even if that is identical to the first field, e.g.,
7325 .Ql (Lovely) Bob <bob@exam.ple> .
7326 All the input, including the empty line, must be consumed before further
7327 commands can be issued.
7329 .It Ql 212
7330 Status ok; the rest of the line is optionally used for more status.
7331 What follows are lines of furtherly unspecified string content,
7332 terminated by an empty line.
7333 All the input, including the empty line, must be consumed before further
7334 commands can be issued.
7336 .It Ql 500
7337 Syntax error; invalid command.
7339 .It Ql 501
7340 Syntax error in parameters or arguments.
7342 .It Ql 505
7343 Error: an argument fails verification.
7344 For example an invalid address has been specified, or an attempt was
7345 made to modify anything in \*(UA's own namespace.
7347 .It Ql 506
7348 Error: an otherwise valid argument is rendered invalid due to context.
7349 For example, a second address is added to a header which may consist of
7350 a single address only.
7355 If a command indicates failure then the message will have remained
7356 unmodified.
7357 Most commands can fail with
7358 .Ql 500
7359 if required arguments are missing (false command usage).
7360 The following (case-insensitive) commands are supported:
7363 .Bl -hang -width ".It Cm header"
7364 .It Cm header
7365 This command allows listing, inspection, and editing of message headers.
7366 Header name case is not normalized, and case-insensitive comparison
7367 should be used when matching names.
7368 The second argument specifies the subcommand to apply, one of:
7370 .Bl -hang -width ".It Cm remove"
7371 .It Cm list
7372 Without a third argument a list of all yet existing headers is given via
7373 .Ql 210 ;
7374 this command is the default command of
7375 .Cm header
7376 if no second argument has been given.
7377 A third argument restricts output to the given header only, which may
7378 fail with
7379 .Ql 501
7380 if no such field is defined.
7382 .It Cm show
7383 Shows the content of the header given as the third argument.
7384 Dependent on the header type this may respond with
7385 .Ql 211
7387 .Ql 212 ;
7388 any failure results in
7389 .Ql 501 .
7391 .It Cm remove
7392 This will remove all instances of the header given as the third
7393 argument, reporting
7394 .Ql 210
7395 upon success,
7396 .Ql 501
7397 if no such header can be found, and
7398 Ql 505
7399 on \*(UA namespace violations.
7401 .It Cm remove-at
7402 This will remove from the header given as the third argument the
7403 instance at the list position (counting from one!) given with the fourth
7404 argument, reporting
7405 .Ql 210
7406 upon success or
7407 .Ql 505
7408 if the list position argument is not a number or on \*(UA namespace
7409 violations, and
7410 .Ql 501
7411 if no such header instance exists.
7413 .It Cm insert
7414 Create a new or an additional instance of the header given in the third
7415 argument, with the header body content as given in the fourth argument
7416 (the remains of the line).
7417 It may return
7418 .Ql 501
7419 if the third argument specifies a free-form header field name that is
7420 invalid, or if body content extraction fails to succeed,
7421 .Ql 505
7422 if any extracted address does not pass syntax and/or security checks or
7423 on \*(UA namespace violations, and
7424 .Ql 506
7425 to indicate prevention of excessing a single-instance header \(em note that
7426 .Ql Subject:
7427 can be appended to (a space separator will be added automatically first).
7429 .Ql 210
7430 is returned upon success, followed by the name of the header and the list
7431 position of the newly inserted instance.
7432 The list position is always 1 for single-instance header fields.
7433 All free-form header fields are managed in a single list.
7437 .It Cm attachment
7438 This command allows listing, removal and addition of message attachments.
7439 The second argument specifies the subcommand to apply, one of:
7441 .Bl -hang -width ".It Cm remove"
7442 .It Cm list
7443 List all attachments via
7444 .Ql 212 ,
7445 or report
7446 .Ql 501
7447 if no attachments exist.
7448 This command is the default command of
7449 .Cm attachment
7450 if no second argument has been given.
7452 .It Cm remove
7453 This will remove the attachment given as the third argument, and report
7454 .Ql 210
7455 upon success or
7456 .Ql 501
7457 if no such attachment can be found.
7458 If there exists any path component in the given argument, then an exact
7459 match of the path which has been used to create the attachment is used
7460 directly, but if only the basename of that path matches then all
7461 attachments are traversed to find an exact match first, and the removal
7462 occurs afterwards; if multiple basenames match, a
7463 .Ql 506
7464 error occurs.
7465 Message attachments are treated as absolute pathnames.
7467 If no path component exists in the given argument, then all attachments
7468 will be searched for
7469 .Ql filename=
7470 parameter matches as well as for matches of the basename of the path
7471 which has been used when the attachment has been created; multiple
7472 matches result in a
7473 .Ql 506 .
7475 .It Cm remove-at
7476 This will interpret the third argument as a number and remove the
7477 attachment at that list position (counting from one!), reporting
7478 .Ql 210
7479 upon success or
7480 .Ql 505
7481 if the argument is not a number or
7482 .Ql 501
7483 if no such attachment exists.
7485 .It Cm insert
7486 Adds the attachment given as the third argument, specified exactly as
7487 documented for the command line option
7488 .Fl a ,
7489 and supporting the message number extension as documented for
7490 .Ic ~@ .
7491 This reports
7492 .Ql 210
7493 upon success, with the index of the new attachment following,
7494 .Ql 505
7495 if the given file cannot be opened,
7496 .Ql 506
7497 if an on-the-fly performed character set conversion fails, otherwise
7498 .Ql 501
7499 is reported; this is also reported if character set conversion is
7500 requested but not available.
7502 .It Cm attribute
7503 This uses the same search mechanism as described for
7504 .Cm remove
7505 and prints any known attributes of the first found attachment via
7506 .Ql 212
7507 upon success or
7508 .Ql 501
7509 if no such attachment can be found.
7510 The attributes are written as lines of keyword and value tuples, the
7511 keyword being separated from the rest of the line with an ASCII SP space
7512 character.
7514 .It Cm attribute-at
7515 This uses the same search mechanism as described for
7516 .Cm remove-at
7517 and is otherwise identical to
7518 .Cm attribute .
7520 .It Cm attribute-set
7521 This uses the same search mechanism as described for
7522 .Cm remove ,
7523 and will assign the attribute given as the fourth argument, which is
7524 expected to be a value tuple of keyword and other data, separated by
7525 a ASCII SP space or TAB tabulator character.
7526 If the value part is empty, then the given attribute is removed, or
7527 reset to a default value if existence of the attribute is crucial.
7529 It returns via
7530 .Ql 210
7531 upon success, with the index of the found attachment following,
7532 .Ql 505
7533 for message attachments or if the given keyword is invalid, and
7534 .Ql 501
7535 if no such attachment can be found.
7536 The following keywords may be used (case-insensitively):
7538 .Bl -hang -compact -width ".It Ql filename"
7539 .It Ql filename
7540 Sets the filename of the MIME part, i.e., the name that is used for
7541 display and when (suggesting a name for) saving (purposes).
7542 .It Ql content-description
7543 Associate some descriptive information to the attachment's content, used
7544 in favour of the plain filename by some MUAs.
7545 .It Ql content-id
7546 May be used for uniquely identifying MIME entities in several contexts;
7547 this expects a special reference address format as defined in RFC 2045
7548 and generates a
7549 .Ql 505
7550 upon address content verification failure.
7551 .It Ql content-type
7552 Defines the media type/subtype of the part, which is managed
7553 automatically, but can be overwritten.
7554 .It Ql content-disposition
7555 Automatically set to the string
7556 .Ql attachment .
7559 .It Cm attribute-set-at
7560 This uses the same search mechanism as described for
7561 .Cm remove-at
7562 and is otherwise identical to
7563 .Cm attribute-set .
7569 .It Ic ~A
7570 The same as
7571 .Ql Ic ~i Ns \| Va Sign .
7574 .It Ic ~a
7575 The same as
7576 .Ql Ic ~i Ns \| Va sign .
7579 .It Ic ~b Ar name ...
7580 Add the given names to the list of blind carbon copy recipients.
7583 .It Ic ~c Ar name ...
7584 Add the given names to the list of carbon copy recipients.
7587 .It Ic ~d
7588 Read the file specified by the
7589 .Ev DEAD
7590 variable into the message.
7593 .It Ic ~e
7594 Invoke the text editor on the message collected so far.
7595 After the editing session is finished,
7596 the user may continue appending text to the message.
7599 .It Ic ~F Ar messages
7600 Read the named messages into the message being sent, including all
7601 message headers and MIME parts.
7602 If no messages are specified, read in the current message, the
7603 .Dq dot .
7606 .It Ic ~f Ar messages
7607 Read the named messages into the message being sent.
7608 If no messages are specified, read in the current message, the
7609 .Dq dot .
7610 Strips down the list of header fields according to the
7611 .Ql type
7612 white- and blacklist selection of
7613 .Ic headerpick .
7614 For MIME multipart messages,
7615 only the first displayable part is included.
7618 .It Ic ~H
7619 Edit the message header fields
7620 .Ql From: ,
7621 .Ql Reply-To:
7623 .Ql Sender:
7624 by typing each one in turn and allowing the user to edit the field.
7625 The default values for these fields originate from the
7626 .Va from , reply-to
7628 .Va sender
7629 variables.
7632 .It Ic ~h
7633 Edit the message header fields
7634 .Ql To: ,
7635 .Ql Cc: ,
7636 .Ql Bcc:
7638 .Ql Subject:
7639 by typing each one in turn and allowing the user to edit the field.
7642 .It Ic ~I Ar variable
7643 Insert the value of the specified variable into the message.
7644 The message remains unaltered if the variable is unset or empty.
7645 Any embedded character sequences
7646 .Ql \et
7647 horizontal tabulator and
7648 .Ql \en
7649 line feed are expanded in
7650 .Va posix
7651 mode; otherwise the expansion should occur at
7652 .Ic set
7653 time by using the command modifier
7654 .Va wysh .
7657 .It Ic ~i Ar variable
7658 Insert the value of the specified variable followed by a newline
7659 character into the message.
7660 The message remains unaltered if the variable is unset or empty.
7661 Any embedded character sequences
7662 .Ql \et
7663 horizontal tabulator and
7664 .Ql \en
7665 line feed are expanded in
7666 .Va posix
7667 mode; otherwise the expansion should occur at
7668 .Ic set
7669 time by using the command modifier
7670 .Va wysh .
7673 .It Ic ~M Ar messages
7674 Read the named messages into the message being sent,
7675 indented by
7676 .Va indentprefix .
7677 If no messages are specified, read the current message, the
7678 .Dq dot .
7681 .It Ic ~m Ar messages
7682 Read the named messages into the message being sent,
7683 indented by
7684 .Va indentprefix .
7685 If no messages are specified, read the current message, the
7686 .Dq dot .
7687 Strips down the list of header fields according to the
7688 .Ql type
7689 white- and blacklist selection of
7690 .Ic headerpick .
7691 For MIME multipart messages,
7692 only the first displayable part is included.
7695 .It Ic ~p
7696 Display the message collected so far,
7697 prefaced by the message header fields
7698 and followed by the attachment list, if any.
7701 .It Ic ~q
7702 Abort the message being sent,
7703 copying it to the file specified by the
7704 .Ev DEAD
7705 variable if
7706 .Va save
7707 is set.
7710 .It Ic ~R Ar filename
7711 Identical to
7712 .Ic ~r ,
7713 but indent each line that has been read by
7714 .Va indentprefix .
7717 .It Ic ~r Ar filename Op Ar HERE-delimiter
7718 Read the named file, object to the usual
7719 .Sx "Filename transformations" ,
7720 into the message; if (the expanded)
7721 .Ar filename
7722 is the hyphen-minus
7723 .Ql -
7724 then standard input is used, e.g., for pasting purposes.
7725 Only in this latter mode
7726 .Ar HERE-delimiter
7727 may be given: if it is data will be read in until the given
7728 .Ar HERE-delimiter
7729 is seen on a line by itself, and encountering EOF is an error; the
7730 .Ar HERE-delimiter
7731 is a required argument in non-interactive mode; if it is single-quote
7732 quoted then the pasted content will not be expanded, \*(ID otherwise
7733 a future version of \*(UA may perform shell-style expansion on the content.
7736 .It Ic ~s Ar string
7737 Cause the named string to become the current subject field.
7738 Newline (NL) and carriage-return (CR) bytes are invalid and will be
7739 normalized to space (SP) characters.
7742 .It Ic ~t Ar name ...
7743 Add the given name(s) to the direct recipient list.
7746 .It Ic ~U Ar messages
7747 Read in the given / current message(s) excluding all headers, indented by
7748 .Va indentprefix .
7751 .It Ic ~u Ar messages
7752 Read in the given / current message(s), excluding all headers.
7755 .It Ic ~v
7756 Invoke an alternate editor (defined by the
7757 .Ev VISUAL
7758 environment variable) on the message collected so far.
7759 Usually, the alternate editor will be a screen editor.
7760 After the editor is quit,
7761 the user may resume appending text to the end of the message.
7764 .It Ic ~w Ar filename
7765 Write the message onto the named file, which is object to the usual
7766 .Sx "Filename transformations" .
7767 If the file exists,
7768 the message is appended to it.
7771 .It Ic ~x
7772 Same as
7773 .Ic ~q ,
7774 except that the message is not saved at all.
7777 .\" }}}
7780 .\" .Sh INTERNAL VARIABLES {{{
7781 .Sh "INTERNAL VARIABLES"
7783 Internal \*(UA variables are controlled via the
7784 .Ic set
7786 .Ic unset
7787 commands; prefixing a variable name with the string
7788 .Ql no
7789 and calling
7790 .Ic set
7791 has the same effect as using
7792 .Ic unset :
7793 .Ql unset crt
7795 .Ql set nocrt
7796 do the same thing.
7797 Creation or editing of variables can be performed in the
7798 .Ev EDITOR
7799 with the command
7800 .Ic varedit .
7801 .Ic varshow
7802 will give more insight on the given variable(s), and
7803 .Ic set ,
7804 when called without arguments, will show a listing of all variables.
7805 Both commands support a more
7806 .Va verbose
7807 listing mode.
7808 Some well-known variables will also become inherited from the
7809 program
7810 .Sx ENVIRONMENT
7811 implicitly, others can be imported explicitly with the command
7812 .Ic environ
7813 and henceforth share said properties.
7816 Two different kinds of internal variables exist.
7817 There are boolean variables, which can only be in one of the two states
7818 .Dq set
7820 .Dq unset ,
7821 and value variables with a(n optional) string value.
7822 For the latter proper quoting is necessary upon assignment time, the
7823 introduction of the section
7824 .Sx COMMANDS
7825 documents the supported quoting rules.
7827 .Bd -literal -offset indent
7828 ? wysh set one=val\e 1 two="val 2" \e
7829     three='val "3"' four=$'val \e'4\e''; \e
7830     varshow one two three four; \e
7831     unset one two three four
7835 Dependent upon the actual option the string values will be interpreted
7836 as numbers, colour names, normal text etc., but there also exists
7837 a special kind of string value, the
7838 .Dq boolean string ,
7839 which must either be a decimal integer (in which case
7840 .Ql 0
7841 is false and
7842 .Ql 1
7843 and any other value is true) or any of the (case-insensitive) strings
7844 .Ql off ,
7845 .Ql no ,
7846 .Ql n
7848 .Ql false
7849 for a false boolean and
7850 .Ql on ,
7851 .Ql yes ,
7852 .Ql y
7854 .Ql true
7855 for a true boolean; a special kind of boolean string is the
7856 .Dq quadoption ,
7857 which is a boolean string that can optionally be prefixed with the
7858 (case-insensitive) term
7859 .Ql ask- ,
7860 as in
7861 .Ql ask-yes ,
7862 which causes prompting of the user in interactive mode, with the given
7863 boolean as the default value.
7865 .\" .Ss "Initial settings" {{{
7866 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7867 .Ss "Initial settings"
7869 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7870 variable settings:
7871 .Pf no Va allnet ,
7872 .Pf no Va append ,
7873 .Va asksub ,
7874 .Pf no Va askbcc ,
7875 .Pf no Va autoprint ,
7876 .Pf no Va bang ,
7877 .Pf no Va cmd ,
7878 .Pf no Va crt ,
7879 .Pf no Va debug ,
7880 .Pf no Va dot ,
7881 .Va escape
7882 set to
7883 .Ql ~ ,
7884 .Pf no Va flipr ,
7885 .Pf no Va folder ,
7886 .Va header ,
7887 .Pf no Va hold ,
7888 .Pf no Va ignore ,
7889 .Pf no Va ignoreeof ,
7890 .Pf no Va keep ,
7891 .Pf no Va keepsave ,
7892 .Pf no Va metoo ,
7893 .Pf no Va outfolder ,
7894 .Pf no Va page ,
7895 .Va prompt
7896 set to
7897 .Ql ?\0 ,
7898 .Pf no Va quiet ,
7899 .Pf no Va record ,
7900 .Va save ,
7901 .Pf no Va sendwait ,
7902 .Pf no Va showto ,
7903 .Pf no Va Sign ,
7904 .Pf no Va sign ,
7905 .Va toplines
7906 set to
7907 .Ql 5 .
7910 Notes: \*(UA does not support the
7911 .Pf no Va onehop
7912 variable \(en use command line options or
7913 .Va mta-arguments
7914 to pass options through to a
7915 .Va mta .
7916 And the default global
7917 .Pa \*(UR
7918 file, which is loaded unless the
7919 .Fl \&:
7920 (with according argument) or
7921 .Fl n
7922 command line options have been used, or the
7923 .Ev MAILX_NO_SYSTEM_RC
7924 environment variable is set (see
7925 .Sx "Resource files" )
7926 bends those initial settings a bit, e.g., it sets the variables
7927 .Va hold ,
7928 .Va keepsave
7930 .Va keep ,
7931 to name a few, establishes a default
7932 .Ic headerpick
7933 selection etc., and should thus be taken into account.
7934 .\" }}}
7936 .\" .Ss "Variables" {{{
7937 .Ss "Variables"
7939 .Bl -tag -width ".It Va BaNg"
7942 .It Va \&?
7943 \*(RO The exit status of the last command, or the
7944 .Ic return
7945 value of the macro
7946 .Ic call Ns
7947 ed last.
7948 This status has a meaning in the state machine: in conjunction with
7949 .Va errexit
7950 any non-0 exit status will cause a program exit, and in
7951 .Va posix
7952 mode any error while loading (any of the) resource files will have the
7953 same effect.
7954 .Cm ignerr ,
7955 one of the
7956 .Sx "Command modifiers" ,
7957 can be used to instruct the state machine to ignore errors.
7960 .It Va \&!
7961 \*(RO The current error number
7962 .Pf ( Xr errno 3 ) ,
7963 which is set after an error occurred; it is also available via
7964 .Va ^ERR ,
7965 and the error name and documentation string can be queried via
7966 .Va ^ERRNAME
7968 .Va ^ERRDOC .
7969 \*(ID This machinery is new and the error number is only really usable
7970 if a command explicitly states that it manages the variable
7971 .Va \&! ,
7972 for others errno will be used in case of errors, or
7973 .Va ^ERR Ns -INVAL
7974 if that is 0: it thus may or may not reflect the real error.
7975 The error number may be set with the command
7976 .Ic return .
7980 .It Va ^
7981 \*(RO This is a multiplexer variable which performs dynamic expansion of
7982 the requested state or condition, of which there are:
7985 .Bl -tag -compact -width ".It Va BaNg"
7989 .It Va ^ERR , ^ERRDOC , ^ERRNAME
7990 The number, documentation, and name of the current
7991 .Xr errno 3 ,
7992 respectively, which is usually set after an error occurred.
7993 \*(ID This machinery is new and is usually reliable only if a command
7994 explicitly states that it manages the variable
7995 .Va \&! ,
7996 which is effectively identical to
7997 .Va \&\&^ERR .
7998 Each of those variables can be suffixed with a hyphen minus followed by
7999 a name or number, in which case the expansion refers to the given error.
8000 Note this is a direct mapping of (a subset of) the system error values:
8001 .Bd -literal -offset indent
8002 define work {
8003   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
8004   vput vexpr i + "$1" 1
8005   if [ $i -lt 16 ]
8006     \excall work $i
8007   end
8009 call work 0
8015 .It Va *
8016 \*(RO Expands all positional parameters (see
8017 .Va 1 ) ,
8018 separated by a space character.
8019 \*(ID The special semantics of the equally named special parameter of the
8020 .Xr sh 1
8021 are not yet supported.
8024 .It Va @
8025 \*(RO Expands all positional parameters (see
8026 .Va 1 ) ,
8027 separated by a space character.
8028 If placed in double quotation marks, each positional parameter is
8029 properly quoted to expand to a single parameter again.
8032 .It Va #
8033 \*(RO Expands to the number of positional parameters, i.e., the size of
8034 the positional parameter stack in decimal.
8037 .It Va \&0
8038 \*(RO Inside the scope of a
8039 .Ic define Ns
8040 d and
8041 .Ic call Ns
8042 ed macro this expands to the name of the calling macro, or to the empty
8043 string if the macro is running from top-level.
8044 For the \*(OPal regular expression search and replace operator of
8045 .Ic vexpr
8046 this expands to the entire matching expression.
8047 It represents the program name in global context.
8050 .It Va 1
8051 \*(RO Access of the positional parameter stack.
8052 All further parameters can be accessed with this syntax, too, e.g.,
8053 .Ql 2 ,
8054 .Ql 3
8055 etc.; positional parameters can be shifted off the stack by calling
8056 .Ic shift .
8057 The parameter stack contains, e.g., the arguments of a
8058 .Ic call Ns
8060 .Ic define Ns
8061 d macro, the matching groups of the \*(OPal regular expression search
8062 and replace expression of
8063 .Ic vexpr ,
8064 and can be explicitly created or overwritten with the command
8065 .Ic vpospar .
8068 .It Va account
8069 \*(RO Is set to the active
8070 .Ic account .
8073 .It Va add-file-recipients
8074 \*(BO When file or pipe recipients have been specified,
8075 mention them in the corresponding address fields of the message instead
8076 of silently stripping them from their recipient list.
8077 By default such addressees are not mentioned.
8080 .It Va allnet
8081 \*(BO Causes only the local part to be evaluated
8082 when comparing addresses.
8085 .It Va append
8086 \*(BO Causes messages saved in the
8087 .Mx -sx
8088 .Sx "secondary mailbox"
8089 .Ev MBOX
8090 to be appended to the end rather than prepended.
8091 This should always be set.
8094 .It Va askatend
8095 \*(BO Causes the prompts for
8096 .Ql Cc:
8098 .Ql Bcc:
8099 lists to appear after the message has been edited.
8102 .It Va askattach
8103 \*(BO If set, \*(UA asks for files to attach at the end of each message.
8104 An empty line finalizes the list.
8107 .It Va askcc
8108 \*(BO Causes the user to be prompted for carbon copy recipients
8109 (at the end of each message if
8110 .Va askatend
8112 .Va bsdcompat
8113 are set).
8116 .It Va askbcc
8117 \*(BO Causes the user to be prompted for blind carbon copy
8118 recipients (at the end of each message if
8119 .Va askatend
8121 .Va bsdcompat
8122 are set).
8125 .It Va asksend
8126 \*(BO Causes the user to be prompted for confirmation to send the
8127 message or reenter compose mode after having been shown an envelope
8128 summary.
8129 This is by default enabled.
8132 .It Va asksign
8133 \*(BO\*(OP Causes the user to be prompted if the message is to be
8134 signed at the end of each message.
8136 .Va smime-sign
8137 variable is ignored when this variable is set.
8140 .It Va asksub
8141 .\" The alternative *ask* is not documented on purpose
8142 \*(BO Causes \*(UA to prompt for the subject upon entering compose mode
8143 unless a subject already exists.
8146 .It Va attrlist
8147 A sequence of characters to display in the
8148 .Ql attribute
8149 column of the
8150 .Va headline
8151 as shown in the display of
8152 .Ic headers ;
8153 each for one type of messages (see
8154 .Sx "Message states" ) ,
8155 with the default being
8156 .Ql NUROSPMFAT+\-$~
8158 .Ql NU\ \ *HMFAT+\-$~
8159 if the
8160 .Va bsdflags
8161 variable is set, in the following order:
8163 .Bl -tag -compact -width ".It Ql _"
8164 .It Ql N
8165 new.
8166 .It Ql U
8167 unread but old.
8168 .It Ql R
8169 new but read.
8170 .It Ql O
8171 read and old.
8172 .It Ql S
8173 saved.
8174 .It Ql P
8175 preserved.
8176 .It Ql M
8177 mboxed.
8178 .It Ql F
8179 flagged.
8180 .It Ql A
8181 answered.
8182 .It Ql T
8183 draft.
8184 .It Ql +
8185 start of a collapsed thread.
8186 .It Ql -
8187 an uncollapsed thread (TODO ignored for now).
8188 .It Ql $
8189 classified as spam.
8190 .It Ql ~
8191 classified as possible spam.
8196 .It Va autobcc
8197 Specifies a list of recipients to which a blind carbon copy of each
8198 outgoing message will be sent automatically.
8201 .It Va autocc
8202 Specifies a list of recipients to which a carbon copy of each outgoing
8203 message will be sent automatically.
8206 .It Va autocollapse
8207 \*(BO Causes threads to be collapsed automatically when threaded mode
8208 is entered (see the
8209 .Ic collapse
8210 command).
8213 .It Va autoprint
8214 \*(BO Enable automatic
8215 .Ic type Ns
8216 ing of a(n existing)
8217 .Dq successive
8218 message after
8219 .Ic delete
8221 .Ic undelete
8222 commands, e.g., the message that becomes the new
8223 .Dq dot
8224 is shown automatically, as via
8225 .Ic dp
8227 .Ic dt .
8230 .It Va autosort
8231 Causes sorted mode (see the
8232 .Ic sort
8233 command) to be entered automatically with the value of this variable as
8234 sorting method when a folder is opened, e.g.,
8235 .Ql set autosort=thread .
8238 .It Va bang
8239 \*(BO Enables the substitution of all not (reverse-solidus) escaped
8240 exclamation mark
8241 .Ql \&!
8242 characters by the contents of the last executed command for the
8243 .Ic \&!
8244 shell escape command and
8245 .Ic ~! ,
8246 one of the compose mode
8247 .Sx "COMMAND ESCAPES" .
8248 If this variable is not set no reverse solidus stripping is performed.
8251 .It Va bind-timeout
8252 \*(OP Terminals generate multi-byte sequences for certain forms of
8253 input, for example for function and other special keys.
8254 Some terminals however do not write these multi-byte sequences as
8255 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
8256 This variable specifies the timeout in milliseconds that the MLE (see
8257 .Sx "On terminal control and line editor" )
8258 waits for more bytes to arrive unless it considers a sequence
8259 .Dq complete .
8260 The default is 200.
8263 .It Va bsdcompat
8264 \*(BO Sets some cosmetical features to traditional BSD style;
8265 has the same affect as setting
8266 .Va askatend
8267 and all other variables prefixed with
8268 .Ql bsd ;
8269 it also changes the behaviour of
8270 .Va emptystart
8271 (which does not exist in BSD).
8274 .It Va bsdflags
8275 \*(BO Changes the letters shown in the first column of a header
8276 summary to traditional BSD style.
8279 .It Va bsdheadline
8280 \*(BO Changes the display of columns in a header summary to traditional
8281 BSD style.
8284 .It Va bsdmsgs
8285 \*(BO Changes some informational messages to traditional BSD style.
8288 .It Va bsdorder
8289 \*(BO Causes the
8290 .Ql Subject:
8291 field to appear immediately after the
8292 .Ql To:
8293 field in message headers and with the
8294 .Ic ~h
8295 .Sx "COMMAND ESCAPES" .
8299 .It Va build-os , build-osenv
8300 \*(RO The operating system \*(UA has been build for, usually taken from
8301 .Xr uname 1
8303 .Ql uname -s
8305 .Ql uname -srm ,
8306 respectively, the former being lowercased.
8309 .It Va charset-7bit
8310 The value that should appear in the
8311 .Ql charset=
8312 parameter of
8313 .Ql Content-Type:
8314 MIME header fields when no character set conversion of the message data
8315 was performed.
8316 This defaults to US-ASCII, and the chosen character set should be
8317 US-ASCII compatible.
8320 .It Va charset-8bit
8321 \*(OP The default 8-bit character set that is used as an implicit last
8322 member of the variable
8323 .Va sendcharsets .
8324 This defaults to UTF-8 if character set conversion capabilities are
8325 available, and to ISO-8859-1 otherwise, in which case the only supported
8326 character set is
8327 .Va ttycharset
8328 and this variable is effectively ignored.
8329 Refer to the section
8330 .Sx "Character sets"
8331 for the complete picture of character set conversion in \*(UA.
8334 .It Va charset-unknown-8bit
8335 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8336 .Dq upgrade
8337 the content of a mail message by using a character set with the name
8338 .Ql unknown-8bit .
8339 Because of the unclassified nature of this character set \*(UA will not
8340 be capable to convert this character set to any other character set.
8341 If this variable is set any message part which uses the character set
8342 .Ql unknown-8bit
8343 is assumed to really be in the character set given in the value,
8344 otherwise the (final) value of
8345 .Va charset-8bit
8346 is used for this purpose.
8348 This variable will also be taken into account if a MIME type (see
8349 .Sx "The mime.types files" )
8350 of a MIME message part that uses the
8351 .Ql binary
8352 character set is forcefully treated as text.
8355 .It Va cmd
8356 The default value for the
8357 .Ic pipe
8358 command.
8361 .It Va colour-disable
8362 \*(BO\*(OP Forcefully disable usage of colours.
8363 Also see the section
8364 .Sx "Coloured display" .
8367 .It Va colour-pager
8368 \*(BO\*(OP Whether colour shall be used for output that is paged through
8369 .Ev PAGER .
8370 Note that pagers may need special command line options, e.g.,
8371 .Xr less 1
8372 requires the option
8373 .Fl \&\&R
8375 .Xr lv 1
8376 the option
8377 .Fl \&\&c
8378 in order to support colours.
8379 Often doing manual adjustments is unnecessary since \*(UA may perform
8380 adjustments dependent on the value of the environment variable
8381 .Ev PAGER
8382 (see there for more).
8386 .It Va contact-mail , contact-web
8387 \*(RO Addresses for contact per email and web, respectively, e.g., for
8388 bug reports, suggestions, or help regarding \*(UA.
8389 The former can be used directly:
8390 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
8393 .It Va crt
8394 In a(n interactive) terminal session, then if this valued variable is
8395 set it will be used as a threshold to determine how many lines the given
8396 output has to span before it will be displayed via the configured
8397 .Ev PAGER ;
8398 Usage of the
8399 .Ev PAGER
8400 can be forced by setting this to the value
8401 .Ql 0 ,
8402 setting it without a value will deduce the current height of the
8403 terminal screen to compute the treshold (see
8404 .Ev LINES ,
8405 .Va screen
8407 .Xr stty 1 ) .
8408 \*(ID At the moment this uses the count of lines of the message in wire
8409 format, which, dependent on the
8410 .Va mime-encoding
8411 of the message, is unrelated to the number of display lines.
8412 (The software is old and historically the relation was a given thing.)
8415 .It Va customhdr
8416 Define a set of custom headers to be injected into newly composed or
8417 forwarded messages; it is also possible to create custom headers in
8418 compose mode with
8419 .Ic ~^ ,
8420 which can be automated by setting one of the hooks
8421 .Va on-compose-splice
8423 .Va on-compose-splice-shell .
8424 The value is interpreted as a comma-separated list of custom headers to
8425 be injected, to include commas in the header bodies escape them with
8426 reverse solidus.
8427 \*(ID Overwriting of automatically managed headers is neither supported
8428 nor prevented.
8430 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
8433 .It Va datefield
8434 Controls the appearance of the
8435 .Ql %d
8436 date and time format specification of the
8437 .Va headline
8438 variable, that is used, for example, when viewing the summary of
8439 .Ic headers .
8440 If unset, then the local receiving date is used and displayed
8441 unformatted, otherwise the message sending
8442 .Ql Date: .
8443 It is possible to assign a
8444 .Xr strftime 3
8445 format string and control formatting, but embedding newlines via the
8446 .Ql %n
8447 format is not supported, and will result in display errors.
8448 The default is
8449 .Ql %Y-%m-%d %H:%M ,
8450 and also see
8451 .Va datefield-markout-older .
8454 .It Va datefield-markout-older
8455 Only used in conjunction with
8456 .Va datefield .
8457 Can be used to create a visible distinction of messages dated more than
8458 a day in the future, or older than six months, a concept comparable to the
8459 .Fl \&\&l
8460 option of the POSIX utility
8461 .Xr ls 1 .
8462 If set to the empty string, then the plain month, day and year of the
8463 .Ql Date:
8464 will be displayed, but a
8465 .Xr strftime 3
8466 format string to control formatting can be assigned.
8467 The default is
8468 .Ql %Y-%m-%d .
8471 .It Va debug
8472 \*(BO Enables debug messages and obsoletion warnings, disables the
8473 actual delivery of messages and also implies
8474 .Pf no Va record
8475 as well as
8476 .Pf no Va save .
8479 .It Va disposition-notification-send
8480 \*(BO\*(OP Emit a
8481 .Ql Disposition-Notification-To:
8482 header (RFC 3798) with the message.
8483 This requires the
8484 .Va from
8485 variable to be set.
8486 .\" TODO .It Va disposition-notification-send-HOST
8487 .\"Overrides
8488 .\".Va disposition-notification-send
8489 .\" for SMTP accounts on a specific host.
8490 .\" TODO .It Va disposition-notification-send-USER@HOST
8491 .\"Overrides
8492 .\".Va disposition-notification-send
8493 .\"for a specific account.
8496 .It Va dot
8497 \*(BO When dot is set, a period
8498 .Ql \&.
8499 on a line by itself during message input in (interactive or batch
8500 .Fl # )
8501 compose mode will be treated as end-of-message (in addition to the
8502 normal end-of-file condition).
8503 This behaviour is implied in
8504 .Va posix
8505 mode with a set
8506 .Va ignoreeof .
8509 .It Va dotlock-ignore-error
8510 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
8511 .Mx -sx
8512 .Sx "primary system mailbox" Ns
8513 es (see, e.g., the notes on
8514 .Sx "Filename transformations" ,
8515 as well as the documentation of
8516 .Ic file )
8517 will be protected with so-called dotlock files\(emthe traditional mail
8518 spool file locking method\(emin addition to system file locking.
8519 Because \*(UA ships with a privilege-separated dotlock creation program
8520 that should always be able to create such a dotlock file there is no
8521 good reason to ignore dotlock file creation errors, and thus these are
8522 fatal unless this variable is set.
8525 .It Va editalong
8526 \*(BO If this variable is set then the editor is started automatically
8527 when a message is composed in interactive mode, as if the
8528 .Ic ~e
8529 .Sx "COMMAND ESCAPES"
8530 had been specified.
8532 .Va editheaders
8533 variable is implied for this automatically spawned editor session.
8536 .It Va editheaders
8537 \*(BO When a message is edited while being composed,
8538 its header is included in the editable text.
8541 .It Va emptystart
8542 \*(BO When entering interactive mode \*(UA normally writes
8543 .Dq \&No mail for user
8544 and exits immediately if a mailbox is empty or does not exist.
8545 If this variable is set \*(UA starts even with an empty or non-existent
8546 mailbox (the latter behaviour furtherly depends upon
8547 .Va bsdcompat ,
8548 though).
8551 .It Va errexit
8552 \*(BO Let each command with a non-0 exit status, including every
8553 .Ic call Ns
8554 ed macro which
8555 .Ic return Ns
8556 s a non-0 status, cause a program exit unless prefixed by
8557 .Cm ignerr
8558 (see
8559 .Sx "Command modifiers" ) .
8560 This also affects
8561 .Sx "COMMAND ESCAPES" ,
8562 but which use a different modifier for ignoring the error.
8563 Please refer to the variable
8564 .Va \&?
8565 for more on this topic.
8568 .It Va escape
8569 The first character of this value defines the escape character for
8570 .Sx "COMMAND ESCAPES"
8571 in compose mode.
8572 The default value is the character tilde
8573 .Ql ~ .
8574 If set to the empty string, command escapes are disabled.
8577 .It Va expandaddr
8578 If not set then file and command pipeline targets are not allowed,
8579 and any such address will be filtered out, giving a warning message.
8580 If set without a value then all possible recipient address
8581 specifications will be accepted \(en see the section
8582 .Sx "On sending mail, and non-interactive mode"
8583 for more on this.
8584 To accept them, but only in interactive mode, or when tilde commands
8585 were enabled explicitly by using one of the command line options
8586 .Fl ~
8588 .Fl # ,
8589 set this to the (case-insensitive) value
8590 .Ql restrict
8591 (it actually acts like
8592 .Ql restrict,-all,+name,+addr ,
8593 so that care for ordering issues must be taken) .
8595 In fact the value is interpreted as a comma-separated list of values.
8596 If it contains
8597 .Ql fail
8598 then the existence of disallowed specifications is treated as a hard
8599 send error instead of only filtering them out.
8600 The remaining values specify whether a specific type of recipient
8601 address specification is allowed (optionally indicated by a plus sign
8602 .Ql +
8603 prefix) or disallowed (prefixed with a hyphen-minus
8604 .Ql - ) .
8605 The value
8606 .Ql all
8607 addresses all possible address specifications,
8608 .Ql file
8609 file targets,
8610 .Ql pipe
8611 command pipeline targets,
8612 .Ql name
8613 plain user names and (MTA) aliases and
8614 .Ql addr
8615 network addresses.
8616 These kind of values are interpreted in the given order, so that
8617 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8618 will cause hard errors for any non-network address recipient address
8619 unless \*(UA is in interactive mode or has been started with the
8620 .Fl ~
8622 .Fl #
8623 command line option; in the latter case(s) any address may be used, then.
8625 Historically invalid network addressees are silently stripped off.
8626 To change this so that any encountered invalid email address causes
8627 a hard error it must be ensured that
8628 .Ql failinvaddr
8629 is an entry in the above list.
8630 Setting this automatically enables network addressees
8631 (it actually acts like
8632 .Ql failinvaddr,+addr ,
8633 so that care for ordering issues must be taken) .
8636 .It Va expandargv
8637 Unless this variable is set additional
8638 .Va mta
8639 (Mail-Transfer-Agent)
8640 arguments from the command line, as can be given after a
8641 .Fl \&\&-
8642 separator, are ignored due to safety reasons.
8643 However, if set to the special (case-insensitive) value
8644 .Ql fail ,
8645 then the presence of additional MTA arguments is treated as a hard
8646 error that causes \*(UA to exit with failure status.
8647 A lesser strict variant is the otherwise identical
8648 .Ql restrict ,
8649 which does accept such arguments in interactive mode, or if tilde
8650 commands were enabled explicitly by using one of the command line options
8651 .Fl ~
8653 .Fl # .
8656 .It Va features
8657 \*(RO String giving a list of features \*(UA, preceded with a plus sign
8658 .Ql +
8659 if the feature is available, and a hyphen-minus
8660 .Ql -
8661 otherwise.
8662 The output of the command
8663 .Ic version
8664 will include this information in a more pleasant output.
8667 .It Va flipr
8668 \*(BO This setting reverses the meanings of a set of reply commands,
8669 turning the lowercase variants, which by default address all recipients
8670 included in the header of a message
8671 .Pf ( Ic reply , respond , followup )
8672 into the uppercase variants, which by default address the sender only
8673 .Pf ( Ic Reply , Respond , Followup )
8674 and vice versa.
8675 The commands
8676 .Ic replysender , respondsender , followupsender
8677 as well as
8678 .Ic replyall , respondall , followupall
8679 are not affected by the current setting of
8680 .Va flipr .
8683 .It Va folder
8684 The default path under which mailboxes are to be saved:
8685 filenames that begin with the plus sign
8686 .Ql +
8687 will have the plus sign replaced with the value of this variable if set,
8688 otherwise the plus sign will remain unchanged when doing
8689 .Sx "Filename transformations" ;
8690 also see
8691 .Ic file
8692 for more on this topic.
8693 The value supports a subset of transformations itself, and if the
8694 non-empty value does not start with a solidus
8695 .Ql / ,
8696 then the value of
8697 .Ev HOME
8698 will be prefixed automatically.
8699 Once the actual value is evaluated first, the internal variable
8700 .Va folder-resolved
8701 will be updated for caching purposes.
8703 .Mx Va folder-hook
8704 .It Va folder-hook-FOLDER , Va folder-hook
8705 Names a
8706 .Ic define Ns d
8707 macro which will be called whenever a
8708 .Ic file
8709 is opened.
8710 The macro will also be invoked when new mail arrives,
8711 but message lists for commands executed from the macro
8712 only include newly arrived messages then.
8713 .Ic localopts
8714 are activated by default in a folder hook, causing the covered settings
8715 to be reverted once the folder is left again.
8717 The specialized form will override the generic one if
8718 .Ql FOLDER
8719 matches the file that is opened.
8720 Unlike other folder specifications, the fully expanded name of a folder,
8721 without metacharacters, is used to avoid ambiguities.
8722 However, if the mailbox resides under
8723 .Va folder
8724 then the usual
8725 .Ql +
8726 specification is tried in addition, e.g., if
8727 .Va \&\&folder
8729 .Dq mail
8730 (and thus relative to the user's home directory) then
8731 .Pa /home/usr1/mail/sent
8732 will be tried as
8733 .Ql folder-hook-/home/usr1/mail/sent
8734 first, but then followed by
8735 .Ql folder-hook-+sent .
8738 .It Va folder-resolved
8739 \*(RO Set to the fully resolved path of
8740 .Va folder
8741 once that evaluation has occurred; rather internal.
8744 .It Va followup-to
8745 \*(BO Controls whether a
8746 .Ql Mail-Followup-To:
8747 header is generated when sending messages to known mailing lists.
8748 Also see
8749 .Va followup-to-honour
8750 and the commands
8751 .Ic mlist , mlsubscribe , reply
8753 .Ic Lreply .
8756 .It Va followup-to-honour
8757 Controls whether a
8758 .Ql Mail-Followup-To:
8759 header is honoured when group-replying to a message via
8760 .Ic reply
8762 .Ic Lreply .
8763 This is a quadoption; if set without a value it defaults to
8764 .Dq yes .
8765 Also see
8766 .Va followup-to
8767 and the commands
8768 .Ic mlist
8770 .Ic mlsubscribe .
8773 .It Va forward-as-attachment
8774 \*(BO Original messages are normally sent as inline text with the
8775 .Ic forward
8776 command,
8777 and only the first part of a multipart message is included.
8778 With this setting enabled messages are sent as unmodified MIME
8779 .Ql message/rfc822
8780 attachments with all of their parts included.
8783 .It Va forward-inject-head
8784 The string to put before the text of a message with the
8785 .Ic forward
8786 command instead of the default
8787 .Dq -------- Original Message -------- .
8788 No heading is put if it is set to the empty string.
8789 This variable is ignored if the
8790 .Va forward-as-attachment
8791 variable is set.
8794 .It Va from
8795 The address (or a list of addresses) to put into the
8796 .Ql From:
8797 field of the message header, quoting RFC 5322:
8798 the author(s) of the message, that is, the mailbox(es) of the person(s)
8799 or system(s) responsible for the writing of the message.
8800 When
8801 .Ic reply Ns
8802 ing to messages these addresses are handled as if they were in the
8803 .Ic alternates
8804 list.
8806 If the machine's hostname is not valid at the Internet (for example at
8807 a dialup machine) then either this variable or
8808 .Va hostname
8809 (\*(IN and with a defined SMTP protocol in
8810 .Va mta
8811 .Va smtp-hostname
8812 adds even more fine-tuning capabilities),
8813 have to be set.
8815 .Va \&\&from
8816 contains more than one address,
8817 setting the
8818 .Va sender
8819 variable is required (according to the standard RFC 5322).
8821 If a file-based MTA is used, then
8822 .Va from
8823 (or, if that contains multiple addresses,
8824 .Va sender )
8825 can nonetheless be enforced to appear as the envelope sender address at
8826 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8827 .Fl r
8828 command line option (with an empty argument; see there for the complete
8829 picture on this topic), or by setting the internal variable
8830 .Va r-option-implicit .
8833 .It Va fullnames
8834 \*(BO Due to historical reasons comments and name parts of email
8835 addresses are removed by default when sending mail, replying to or
8836 forwarding a message.
8837 If this variable is set such stripping is not performed.
8839 .It Va fwdheading
8840 \*(OB Predecessor of
8841 .Va forward-inject-head .
8844 .It Va header
8845 \*(BO Causes the header summary to be written at startup and after
8846 commands that affect the number of messages or the order of messages in
8847 the current
8848 .Ic folder .
8849 Unless in
8850 .Va posix
8851 mode a header summary will also be displayed on folder changes.
8852 The command line option
8853 .Fl N
8854 can be used to set
8855 .Pf no Va header .
8859 .It Va headline
8860 A format string to use for the summary of
8861 .Ic headers ,
8862 similar to the ones used for
8863 .Xr printf 3
8864 formats.
8865 Format specifiers in the given string start with a percent sign
8866 .Ql %
8867 and may be followed by an optional decimal number indicating the field
8868 width \(em if that is negative, the field is to be left-aligned.
8869 Valid format specifiers are:
8872 .Bl -tag -compact -width ".It Ql _%%_"
8873 .It Ql %%
8874 A plain percent sign.
8875 .It Ql %>
8876 .Dq Dotmark :
8877 a space character but for the current message
8878 .Pf ( Dq dot ) ,
8879 for which it expands to
8880 .Ql > .
8881 .It Ql %<
8882 .Dq Dotmark :
8883 a space character but for the current message
8884 .Pf ( Dq dot ) ,
8885 for which it expands to
8886 .Ql < .
8887 .It Ql %$
8888 \*(OP The spam score of the message, as has been classified via the
8889 command
8890 .Ic spamrate .
8891 Shows only a replacement character if there is no spam support.
8892 .It Ql %a
8893 Message attribute character (status flag); the actual content can be
8894 adjusted by setting
8895 .Va attrlist .
8896 .It Ql %d
8897 The date found in the
8898 .Ql From:
8899 header of the message when
8900 .Va datefield
8901 is set (the default), otherwise the date when the message was received.
8902 Formatting can be controlled by assigning a
8903 .Xr strftime 3
8904 format string to
8905 .Va datefield .
8906 .It Ql %e
8907 The indenting level in threaded mode.
8908 .It Ql %f
8909 The address of the message sender.
8910 .It Ql %i
8911 The message thread tree structure.
8912 (Note that this format does not support a field width.)
8913 .It Ql %l
8914 The number of lines of the message, if available.
8915 .It Ql %m
8916 Message number.
8917 .It Ql %o
8918 The number of octets (bytes) in the message, if available.
8919 .It Ql %s
8920 Message subject (if any).
8921 .It Ql %S
8922 Message subject (if any) in double quotes.
8923 .It Ql \&%T
8924 Message recipient flags: is the addressee of the message a known or
8925 subscribed mailing list \(en see
8926 .Ic mlist
8928 .Ic mlsubscribe .
8929 .It Ql %t
8930 The position in threaded/sorted order.
8933 The default is
8934 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
8936 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
8938 .Va bsdcompat
8939 is set.
8940 Also see
8941 .Va attrlist
8943 .Va headline-bidi .
8947 .It Va headline-bidi
8948 Bidirectional text requires special treatment when displaying headers,
8949 because numbers (in dates or for file sizes etc.) will not affect the
8950 current text direction, in effect resulting in ugly line layouts when
8951 arabic or other right-to-left text is to be displayed.
8952 On the other hand only a minority of terminals is capable to correctly
8953 handle direction changes, so that user interaction is necessary for
8954 acceptable results.
8955 Note that extended host system support is required nonetheless, e.g.,
8956 detection of the terminal character set is one precondition;
8957 and this feature only works in an Unicode (i.e., UTF-8) locale.
8959 In general setting this variable will cause \*(UA to encapsulate text
8960 fields that may occur when displaying
8961 .Va headline
8962 (and some other fields, like dynamic expansions in
8963 .Va prompt )
8964 with special Unicode control sequences;
8965 it is possible to fine-tune the terminal support level by assigning
8966 a value:
8967 no value (or any value other than
8968 .Ql 1 ,
8969 .Ql 2
8971 .Ql 3 )
8972 will make \*(UA assume that the terminal is capable to properly deal
8973 with Unicode version 6.3, in which case text is embedded in a pair of
8974 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
8975 characters.
8976 In addition no space on the line is reserved for these characters.
8978 Weaker support is chosen by using the value
8979 .Ql 1
8980 (Unicode 6.3, but reserve the room of two spaces for writing the control
8981 sequences onto the line).
8982 The values
8983 .Ql 2
8985 .Ql 3
8986 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
8987 again reserves room for two spaces in addition.
8990 .It Va history-file
8991 \*(OP If a line editor is available then this can be set to
8992 name the (expandable) path of the location of a permanent history file.
8993 Also see
8994 .Va history-size .
8997 .It Va history-gabby
8998 \*(BO\*(OP Add more entries to the history as is normally done.
9001 .It Va history-gabby-persist
9002 \*(BO\*(OP \*(UA's own MLE will not save the additional
9003 .Va history-gabby
9004 entries in persistent storage unless this variable is set.
9005 On the other hand it will not loose the knowledge of whether
9006 a persistent entry was gabby or not.
9007 Also see
9008 .Va history-file .
9011 .It Va history-size
9012 \*(OP Setting this variable imposes a limit on the number of concurrent
9013 history entries.
9014 If set to the value 0 then no further history entries will be added, and
9015 loading and incorporation of the
9016 .Va history-file
9017 upon program startup can also be suppressed by doing this.
9018 Runtime changes will not be reflected, but will affect the number of
9019 entries saved to permanent storage.
9022 .It Va hold
9023 \*(BO This setting controls whether messages are held in the system
9024 .Va inbox ,
9025 and it is set by default.
9028 .It Va hostname
9029 Use this string as hostname when expanding local addresses instead of
9030 the value obtained from
9031 .Xr uname 3
9033 .Xr getaddrinfo 3 .
9034 It is used, e.g., in
9035 .Ql Message-ID:
9037 .Ql From:
9038 fields, as well as when generating
9039 .Ql Content-ID:
9040 MIME part related unique ID fields.
9041 Setting it to the empty string will cause the normal hostname to be
9042 used, but nonetheless enables creation of said ID fields.
9043 \*(IN in conjunction with the built-in SMTP
9044 .Va mta
9045 .Va smtp-hostname
9046 also influences the results:
9047 one should produce some test messages with the desired combination of
9048 .Va \&\&hostname ,
9049 and/or
9050 .Va from ,
9051 .Va sender
9052 etc. first.
9055 .It Va idna-disable
9056 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
9057 names according to the rules of IDNA (internationalized domain names
9058 for applications).
9059 Since the IDNA code assumes that domain names are specified with the
9060 .Va ttycharset
9061 character set, an UTF-8 locale charset is required to represent all
9062 possible international domain names (before conversion, that is).
9065 .It Va ifs
9066 The input field separator that is used (\*(ID by some functions) to
9067 determine where to split input data.
9069 .Bl -tag -compact -width ".It MMM"
9070 .It 1.
9071 Unsetting is treated as assigning the default value,
9072 .Ql \& \et\en .
9073 .It 2.
9074 If set to the empty value, no field splitting will be performed.
9075 .It 3.
9076 If set to a non-empty value, all whitespace characters are extracted
9077 and assigned to the variable
9078 .Va ifs-ws .
9081 .Bl -tag -compact -width ".It MMM"
9082 .It a.
9083 .Va \&\&ifs-ws
9084 will be ignored at the beginning and end of input.
9085 Diverging from POSIX shells default whitespace is removed in addition,
9086 which is owed to the entirely different line content extraction rules.
9087 .It b.
9088 Each occurrence of a character of
9089 .Va \&\&ifs
9090 will cause field-splitting, any adjacent
9091 .Va \&\&ifs-ws
9092 characters will be skipped.
9096 .It Va ifs-ws
9097 \*(RO Automatically deduced from the whitespace characters in
9098 .Va ifs .
9101 .It Va ignore
9102 \*(BO Ignore interrupt signals from the terminal while entering
9103 messages; instead echo them as
9104 .Ql @
9105 characters and discard the current line.
9108 .It Va ignoreeof
9109 \*(BO Ignore end-of-file conditions
9110 .Pf ( Ql control-D )
9111 in compose mode on message input and in interactive command input.
9112 If set an interactive command input session can only be left by
9113 explicitly using one of the commands
9114 .Ic exit
9116 .Ic quit ,
9117 and message input in compose mode can only be terminated by entering
9118 a period
9119 .Ql \&.
9120 on a line by itself or by using the
9121 .Ic ~.
9122 .Sx "COMMAND ESCAPES" ;
9123 Setting this implies the behaviour that
9124 .Va dot
9125 describes in
9126 .Va posix
9127 mode.
9130 .It Va inbox
9131 If this is set to a non-empty string it will specify the users
9132 .Mx -sx
9133 .Sx "primary system mailbox" ,
9134 overriding
9135 .Ev MAIL
9136 and the system-dependent default, and (thus) be used to replace
9137 .Ql %
9138 when doing
9139 .Sx "Filename transformations" ;
9140 also see
9141 .Ic file
9142 for more on this topic.
9143 The value supports a subset of transformations itself.
9146 .It Va indentprefix
9147 String used by the
9148 .Ic ~m , ~M
9150 .Ic ~R
9151 .Sx "COMMAND ESCAPES"
9152 and by the
9153 .Va quote
9154 option for indenting messages,
9155 in place of the normal tabulator character
9156 .Ql ^I ,
9157 which is the default.
9158 Be sure to quote the value if it contains spaces or tabs.
9161 .It Va keep
9162 \*(BO If set, an empty
9163 .Mx -sx
9164 .Sx "primary system mailbox"
9165 file is not removed.
9166 Note that, in conjunction with
9167 .Va posix
9168 mode any empty file will be removed unless this variable is set.
9169 This may improve the interoperability with other mail user agents
9170 when using a common folder directory, and prevents malicious users
9171 from creating fake mailboxes in a world-writable spool directory.
9172 \*(ID Only local regular (MBOX) files are covered, Maildir or other
9173 mailbox types will never be removed, even if empty.
9176 .It Va keep-content-length
9177 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
9178 be told to keep the
9179 .Ql Content-Length:
9181 .Ql Lines:
9182 header fields that some MUAs generate by setting this variable.
9183 Since \*(UA does neither use nor update these non-standardized header
9184 fields (which in itself shows one of their conceptual problems),
9185 stripping them should increase interoperability in between MUAs that
9186 work with with same mailbox files.
9187 Note that, if this is not set but
9188 .Va writebackedited ,
9189 as below, is, a possibly performed automatic stripping of these header
9190 fields already marks the message as being modified.
9191 \*(ID At some future time \*(UA will be capable to rewrite and apply an
9192 .Va mime-encoding
9193 to modified messages, and then those fields will be stripped silently.
9196 .It Va keepsave
9197 \*(BO When a message is saved it is usually discarded from the
9198 originating folder when \*(UA is quit.
9199 This setting causes all saved message to be retained.
9202 .It Va line-editor-disable
9203 \*(BO Turn off any enhanced line editing capabilities (see
9204 .Sx "On terminal control and line editor"
9205 for more).
9208 .It Va line-editor-no-defaults
9209 \*(BO\*(OP Do not establish any default key binding.
9212 .It Va log-prefix
9213 Error log message prefix string
9214 .Pf ( Ql "\*(uA: " ) .
9217 .It Va mailbox-display
9218 \*(RO The name of the current mailbox
9219 .Pf ( Ic file ) ,
9220 possibly abbreviated for display purposes.
9223 .It Va mailbox-resolved
9224 \*(RO The fully resolved path of the current mailbox.
9227 .It Va mailx-extra-rc
9228 An additional startup file that is loaded as the last of the
9229 .Sx "Resource files" .
9230 Use this file for commands that are not understood by other POSIX
9231 .Xr mailx 1
9232 implementations, i.e., mostly anything which is not covered by
9233 .Sx "Initial settings" .
9236 .It Va markanswered
9237 \*(BO When a message is replied to and this variable is set,
9238 it is marked as having been
9239 .Ic answered .
9240 See the section
9241 .Sx "Message states" .
9244 .It Va mbox-rfc4155
9245 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
9246 POSIX rules for detecting message boundaries (so-called
9247 .Ql From_
9248 lines) due to compatibility reasons, instead of the stricter rules that
9249 have been standardized in RFC 4155.
9250 This behaviour can be switched to the stricter RFC 4155 rules by
9251 setting this variable.
9252 (This is never necessary for any message newly generated by \*(UA,
9253 it only applies to messages generated by buggy or malicious MUAs, or may
9254 occur in old MBOX databases: \*(UA itself will choose a proper
9255 .Va mime-encoding
9256 to avoid false interpretation of
9257 .Ql From_
9258 content lines in the MBOX database.)
9260 This may temporarily be handy when \*(UA complains about invalid
9261 .Ql From_
9262 lines when opening a MBOX: in this case setting this variable and
9263 re-opening the mailbox in question may correct the result.
9264 If so, copying the entire mailbox to some other file, as in
9265 .Ql copy * SOME-FILE ,
9266 will perform proper, all-compatible
9267 .Ql From_
9268 quoting for all detected messages, resulting in a valid MBOX mailbox.
9269 Finally the variable can be unset again:
9270 .Bd -literal -offset indent
9271 define mboxfix {
9272   localopts yes; wysh set mbox-rfc4155;\e
9273     wysh File "${1}"; eval copy * "${2}"
9275 call mboxfix /tmp/bad.mbox /tmp/good.mbox
9279 .It Va memdebug
9280 \*(BO Internal development variable.
9283 .It Va message-id-disable
9284 \*(BO By setting this variable the generation of
9285 .Ql Message-ID:
9286 can be completely suppressed, effectively leaving this task up to the
9287 .Va mta
9288 (Mail-Transfer-Agent) or the SMTP server.
9289 (According to RFC 5321 a SMTP server is not required to add this
9290 field by itself, so it should be ensured that it accepts messages without
9291 .Ql Message-ID . )
9292 This variable also affects automatic generation of
9293 .Va Content-ID:
9294 MIME header fields.
9297 .It Va message-inject-head
9298 A string to put at the beginning of each new message, followed by a newline.
9299 \*(OB The escape sequences tabulator
9300 .Ql \et
9301 and newline
9302 .Ql \en
9303 are understood (use the
9304 .Cm wysh
9305 prefix when
9306 .Ic set Ns
9307 ting the variable(s) instead).
9310 .It Va message-inject-tail
9311 A string to put at the end of each new message, followed by a newline.
9312 \*(OB The escape sequences tabulator
9313 .Ql \et
9314 and newline
9315 .Ql \en
9316 are understood (use the
9317 .Cm wysh
9318 prefix when
9319 .Ic set Ns
9320 ting the variable(s) instead).
9323 .It Va metoo
9324 \*(BO Usually, when an
9325 .Ic alias
9326 expansion contains the sender, the sender is removed from the expansion.
9327 Setting this option suppresses these removals.
9328 Note that a set
9329 .Va metoo
9330 also causes a
9331 .Ql -m
9332 option to be passed through to the
9333 .Va mta
9334 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
9335 this flag, no MTA is known which does not support it (for historical
9336 compatibility).
9339 .It Va mime-allow-text-controls
9340 \*(BO When sending messages, each part of the message is MIME-inspected
9341 in order to classify the
9342 .Ql Content-Type:
9344 .Ql Content-Transfer-Encoding:
9345 (see
9346 .Va mime-encoding )
9347 that is required to send this part over mail transport, i.e.,
9348 a computation rather similar to what the
9349 .Xr file 1
9350 command produces when used with the
9351 .Ql --mime
9352 option.
9354 This classification however treats text files which are encoded in
9355 UTF-16 (seen for HTML files) and similar character sets as binary
9356 octet-streams, forcefully changing any
9357 .Ql text/plain
9359 .Ql text/html
9360 specification to
9361 .Ql application/octet-stream :
9362 If that actually happens a yet unset charset MIME parameter is set to
9363 .Ql binary ,
9364 effectively making it impossible for the receiving MUA to automatically
9365 interpret the contents of the part.
9367 If this variable is set, and the data was unambiguously identified as
9368 text data at first glance (by a
9369 .Ql .txt
9371 .Ql .html
9372 file extension), then the original
9373 .Ql Content-Type:
9374 will not be overwritten.
9377 .It Va mime-alternative-favour-rich
9378 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
9379 HTML) will be preferred in favour of included plain text versions when
9380 displaying messages, provided that a handler exists which produces
9381 output that can be (re)integrated into \*(UA's normal visual display.
9382 (E.g., at the time of this writing some newsletters ship their full
9383 content only in the rich HTML part, whereas the plain text part only
9384 contains topic subjects.)
9387 .It Va mime-counter-evidence
9388 Normally the
9389 .Ql Content-Type:
9390 field is used to decide how to handle MIME parts.
9391 Some MUAs, however, do not use
9392 .Sx "The mime.types files"
9393 (also see
9394 .Sx "HTML mail and MIME attachments" )
9395 or a similar mechanism to correctly classify content, but specify an
9396 unspecific MIME type
9397 .Pf ( Ql application/octet-stream )
9398 even for plain text attachments.
9399 If this variable is set then \*(UA will try to re-classify such MIME
9400 message parts, if possible, for example via a possibly existing
9401 attachment filename.
9402 A non-empty value may also be given, in which case a number is expected,
9403 actually a carrier of bits.
9404 Creating the bit-carrying number is a simple addition:
9405 .Bd -literal -offset indent
9406 ? !echo Value should be set to $((2 + 4 + 8))
9407 Value should be set to 14
9410 .Bl -bullet -compact
9412 If bit two is set (2) then the detected
9413 .Ic mimetype
9414 will be carried along with the message and be used for deciding which
9415 MIME handler is to be used, for example;
9416 when displaying such a MIME part the part-info will indicate the
9417 overridden content-type by showing a plus sign
9418 .Ql + .
9420 If bit three is set (4) then the counter-evidence is always produced
9421 and a positive result will be used as the MIME type, even forcefully
9422 overriding the parts given MIME type.
9424 If bit four is set (8) then as a last resort the actual content of
9425 .Ql application/octet-stream
9426 parts will be inspected, so that data which looks like plain text can be
9427 treated as such.
9431 .It Va mime-encoding
9432 The MIME
9433 .Ql Content-Transfer-Encoding
9434 to use in outgoing text messages and message parts, where applicable.
9435 (7-bit clean text messages are sent as-is, without a transfer encoding.)
9436 Valid values are:
9438 .Bl -tag -compact -width ".It Ql _%%_"
9439 .It Ql 8bit
9440 .Pf (Or\0 Ql 8b . )
9441 8-bit transport effectively causes the raw data be passed through
9442 unchanged, but may cause problems when transferring mail messages over
9443 channels that are not ESMTP (RFC 1869) compliant.
9444 Also, several input data constructs are not allowed by the
9445 specifications and may cause a different transfer-encoding to be used.
9446 .It Ql quoted-printable
9447 .Pf (Or\0 Ql qp . )
9448 Quoted-printable encoding is 7-bit clean and has the property that ASCII
9449 characters are passed through unchanged, so that an english message can
9450 be read as-is; it is also acceptible for other single-byte locales that
9451 share many characters with ASCII, like, e.g., ISO-8859-1.
9452 The encoding will cause a large overhead for messages in other character
9453 sets: e.g., it will require up to twelve (12) bytes to encode a single
9454 UTF-8 character of four (4) bytes.
9455 .It Ql base64
9456 .Pf (Or\0 Ql b64 . )
9457 The default encoding, it is 7-bit clean and will always be used for
9458 binary data.
9459 This encoding has a constant input:output ratio of 3:4, regardless of
9460 the character set of the input data it will encode three bytes of input
9461 to four bytes of output.
9462 This transfer-encoding is not human readable without performing
9463 a decoding step.
9467 .It Va mimetypes-load-control
9468 Can be used to control which of
9469 .Sx "The mime.types files"
9470 are loaded: if the letter
9471 .Ql u
9472 is part of the option value, then the user's personal
9473 .Pa ~/.mime.types
9474 file will be loaded (if it exists); likewise the letter
9475 .Ql s
9476 controls loading of the system wide
9477 .Pa /etc/mime.types ;
9478 directives found in the user file take precedence, letter matching is
9479 case-insensitive.
9480 If this variable is not set \*(UA will try to load both files.
9481 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
9482 but they will be matched last (the order can be listed via
9483 .Ic mimetype ) .
9485 More sources can be specified by using a different syntax: if the
9486 value string contains an equals sign
9487 .Ql =
9488 then it is instead parsed as a comma-separated list of the described
9489 letters plus
9490 .Ql f=FILENAME
9491 pairs; the given filenames will be expanded and loaded, and their
9492 content may use the extended syntax that is described in the section
9493 .Sx "The mime.types files" .
9494 Directives found in such files always take precedence (are prepended to
9495 the MIME type cache).
9499 .It Va mta
9500 To choose an alternate Mail-Transfer-Agent, set this option to either
9501 the full pathname of an executable (optionally prefixed with a
9502 .Ql file://
9503 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
9505 .Dl smtps?://[user[:password]@]server[:port]
9507 (\*(OU:
9508 .Ql [smtp://]server[:port] . )
9509 The default has been chosen at compile time.
9510 All supported data transfers are executed in child processes, which
9511 run asynchronously and without supervision unless either the
9512 .Va sendwait
9513 or the
9514 .Va verbose
9515 variable is set.
9516 If such a child receives a TERM signal, it will abort and
9517 .Va save
9518 the message to
9519 .Ev DEAD ,
9520 if so configured.
9523 For a file-based MTA it may be necessary to set
9524 .Va mta-argv0
9525 in in order to choose the right target of a modern
9526 .Xr mailwrapper 8
9527 environment.
9528 It will be passed command line arguments from several possible sources:
9529 from the variable
9530 .Va mta-arguments
9531 if set, from the command line if given and the variable
9532 .Va expandargv
9533 allows their use.
9534 Argument processing of the MTA will be terminated with a
9535 .Fl \&\&-
9536 separator.
9539 The otherwise occurring implicit usage of the following MTA command
9540 line arguments can be disabled by setting the boolean variable
9541 .Va mta-no-default-arguments
9542 (which will also disable passing
9543 .Fl \&\&-
9544 to the MTA):
9545 .Fl \&\&i
9546 (for not treating a line with only a dot
9547 .Ql \&.
9548 character as the end of input),
9549 .Fl \&\&m
9550 (shall the variable
9551 .Va metoo
9552 be set) and
9553 .Fl \&\&v
9554 (if the
9555 .Va verbose
9556 variable is set); in conjunction with the
9557 .Fl r
9558 command line option \*(UA will also (not) pass
9559 .Fl \&\&f
9560 as well as possibly
9561 .Fl \&\&F .
9564 \*(OPally \*(UA can send mail over SMTP network connections to a single
9565 defined SMTP smart host by specifying a SMTP URL as the value (see
9566 .Sx "On URL syntax and credential lookup" ) .
9567 Encrypted network connections are \*(OPally available, the section
9568 .Sx "Encrypted network communication"
9569 should give an overview and provide links to more information on this.
9570 \*(UA also supports forwarding of all network traffic over a specified
9571 .Va socks-proxy .
9572 Note that with some mail providers it may be necessary to set the
9573 .Va smtp-hostname
9574 variable in order to use a specific combination of
9575 .Va from ,
9576 .Va hostname
9578 .Va mta .
9579 The following SMTP variants may be used:
9581 .Bl -bullet
9583 The plain SMTP protocol (RFC 5321) that normally lives on the
9584 server port 25 and requires setting the
9585 .Va smtp-use-starttls
9586 variable to enter a SSL/TLS encrypted session state.
9587 Assign a value like \*(IN
9588 .Ql smtp://[user[:password]@]server[:port]
9589 (\*(OU
9590 .Ql smtp://server[:port] )
9591 to choose this protocol.
9593 The so-called SMTPS which is supposed to live on server port 465
9594 and is automatically SSL/TLS secured.
9595 Unfortunately it never became a standardized protocol and may thus not
9596 be supported by your hosts network service database
9597 \(en in fact the port number has already been reassigned to other
9598 protocols!
9600 SMTPS is nonetheless a commonly offered protocol and thus can be
9601 chosen by assigning a value like \*(IN
9602 .Ql smtps://[user[:password]@]server[:port]
9603 (\*(OU
9604 .Ql smtps://server[:port] ) ;
9605 due to the mentioned problems it is usually necessary to explicitly
9606 specify the port as
9607 .Ql :465 ,
9608 however.
9610 Finally there is the SUBMISSION protocol (RFC 6409), which usually
9611 lives on server port 587 and is practically identically to the SMTP
9612 protocol from \*(UA's point of view beside that; it requires setting the
9613 .Va smtp-use-starttls
9614 variable to enter a SSL/TLS secured session state.
9615 Assign a value like \*(IN
9616 .Ql submission://[user[:password]@]server[:port]
9617 (\*(OU
9618 .Ql submission://server[:port] ) .
9623 .It Va mta-arguments
9624 Arguments to pass through to a file-based
9625 .Va mta
9626 can be given via this variable, which is parsed according to
9627 .Sx "Shell-style argument quoting"
9628 into an array of arguments, and which will be joined onto MTA options
9629 from other sources, and then passed individually to the MTA:
9630 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
9633 .It Va mta-no-default-arguments
9634 \*(BO Unless this variable is set \*(UA will pass some well known
9635 standard command line options to a file-based
9636 .Va mta
9637 (Mail-Transfer-Agent), see there for more.
9640 .It Va mta-argv0
9641 Many systems use a so-called
9642 .Xr mailwrapper 8
9643 environment to ensure compatibility with
9644 .Xr sendmail 1 .
9645 This works by inspecting the name that was used to invoke the mail
9646 delivery system.
9647 If this variable is set then the mailwrapper (the program that is
9648 actually executed when calling the file-based
9649 .Va mta )
9650 will treat its contents as that name.
9652 .Mx Va netrc-lookup
9653 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
9654 \*(BO\*(IN\*(OP Used to control usage of the users
9655 .Pa .netrc
9656 file for lookup of account credentials, as documented in the section
9657 .Sx "On URL syntax and credential lookup"
9658 and for the command
9659 .Ic netrc ;
9660 the section
9661 .Sx "The .netrc file"
9662 documents the file format.
9663 Also see
9664 .Va netrc-pipe .
9667 .It Va netrc-pipe
9668 \*(IN\*(OP When
9669 .Pa .netrc
9670 is loaded (see
9671 .Ic netrc
9673 .Va netrc-lookup )
9674 then \*(UA will read the output of a shell pipe instead of the users
9675 .Pa .netrc
9676 file if this variable is set (to the desired shell command).
9677 This can be used to, e.g., store
9678 .Pa .netrc
9679 in encrypted form:
9680 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
9683 .It Va newfolders
9684 If this variable has the value
9685 .Ql maildir ,
9686 newly created local folders will be in Maildir instead of MBOX format.
9689 .It Va newmail
9690 Checks for new mail in the current folder each time the prompt is shown.
9691 A Maildir folder must be re-scanned to determine if new mail has arrived.
9692 If this variable is set to the special value
9693 .Ql nopoll
9694 then a Maildir folder will not be rescanned completely, but only
9695 timestamp changes are detected.
9698 .It Va outfolder
9699 \*(BO Causes the filename given in the
9700 .Va record
9701 variable
9702 and the sender-based filenames for the
9703 .Ic Copy
9705 .Ic Save
9706 commands to be interpreted relative to the directory given in the
9707 .Va folder
9708 variable rather than to the current directory,
9709 unless it is set to an absolute pathname.
9711 .Mx Va on-account-cleanup
9712 .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup
9713 Macro hook which will be called once an
9714 .Ic account
9715 is left, as the very last step before unrolling per-account
9716 .Ic localopts .
9717 This hook is run even in case of fatal errors, and it is advisable to
9718 perform only absolutely necessary actions, like cleaning up
9719 .Ic alternates ,
9720 for example.
9721 The specialized form is used in favour of the generic one if found.
9724 .It Va on-compose-cleanup
9725 Macro hook which will be called after the message has been sent (or not,
9726 in case of failures), as the very last step before unrolling compose mode
9727 .Ic localopts .
9728 This hook is run even in case of fatal errors, and it is advisable to
9729 perform only absolutely necessary actions, like cleaning up
9730 .Ic alternates ,
9731 for example.
9733 For compose mode hooks that may affect the message content please see
9734 .Va on-compose-enter , on-compose-leave , on-compose-splice .
9735 \*(ID This hook exists because
9736 .Ic alias , alternates , commandalias , shortcut ,
9737 to name a few, are not covered by
9738 .Ic localopts :
9739 changes applied in compose mode will continue to be in effect thereafter.
9744 .It Va on-compose-enter , on-compose-leave
9745 Macro hooks which will be called once compose mode is entered,
9746 and after composing has been finished, but before a set
9747 .Va message-inject-tail
9748 has been injected etc., respectively.
9749 .Ic localopts
9750 are enabled for these hooks, and changes on variables will be forgotten
9751 after the message has been sent.
9752 .Va on-compose-cleanup
9753 can be used to perform other necessary cleanup steps.
9755 The following (read-only) variables will be set temporarily during
9756 execution of the macros to represent the according message headers, or
9757 the empty string for non-existent; they correspond to accoding virtual
9758 temporary message headers that can be accessed (also from within
9759 .Va on-compose-splice
9760 hooks) via
9761 .Ic ~^ ,
9762 one of the
9763 .Sx "COMMAND ESCAPES" :
9766 .Bl -tag -compact -width ".It Va mailx_subject"
9767 .It Va mailx-command
9768 The command that generates the message.
9769 .It Va mailx-subject
9770 The subject.
9771 .It Va mailx-from
9772 .Va from .
9773 .It Va mailx-sender
9774 .Va sender .
9775 .It Va mailx-to , mailx-cc , mailx-bcc
9776 The list of receiver addresses as a space-separated list.
9777 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
9778 The list of receiver addresses before any mangling (due to, e.g.,
9779 .Ic alternates ,
9780 .Ic alias
9781 .Va recipients-in-cc )
9782 as a space-separated list.
9783 .It Va mailx-orig-from
9784 When replying, forwarding or resending, this will be set to the
9785 .Ql From:
9786 of the given message.
9787 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
9788 When replying, forwarding or resending, this will be set to the
9789 receivers of the given message.
9793 Here is am example that injects a signature via
9794 .Va message-inject-tail ;
9795 instead using
9796 .Va on-compose-splice
9797 to simply inject the file of desire via
9798 .Ic ~<
9800 .Ic ~<!
9801 may be a better approach.
9803 .Bd -literal -offset indent
9804 define t_ocl {
9805   vput ! i cat ~/.mysig
9806   if [ $? -eq 0 ]
9807      vput vexpr message-inject-tail trim-end $i
9808   end
9809   return
9810   # Alternatively
9811   readctl create ~/.mysig
9812   if [ $? -eq 0 ]
9813     readall i
9814     if [ $? -eq 0 ]
9815       vput vexpr message-inject-tail trim-end $i
9816     end
9817     readctl remove ~/.mysig
9818   end
9820 set on-compose-leave=t_ocl
9826 .It Va on-compose-splice , on-compose-splice-shell
9827 These hooks run once the normal compose mode is finished, but before the
9828 .Va on-compose-leave
9829 macro hook is called, the
9830 .Va message-inject-tail
9831 is injected etc.
9832 Both hooks will be executed in a subprocess, with their input and output
9833 connected to \*(UA such that they can act as if they would be an
9834 interactive user.
9835 The difference in between them is that the latter is a
9836 .Ev SHELL
9837 command, whereas the former is a normal \*(UA macro, but which is
9838 restricted to a small set of commands (the
9839 .Va verbose
9840 output of, e.g.,
9841 .Ic list
9842 will indicate said capability).
9843 .Ic localopts
9844 are enabled for these hooks (in the parent process), causing any setting
9845 to be forgotten after the message has been sent;
9846 .Va on-compose-cleanup
9847 can be used to perform other cleanup as necessary.
9850 During execution of these hooks \*(UA will temporarily forget whether it
9851 has been started in interactive mode, (a restricted set of)
9852 .Sx "COMMAND ESCAPES"
9853 will always be available, and for guaranteed reproducibilities sake
9854 .Va escape
9856 .Va ifs
9857 will be set to their defaults.
9858 The compose mode command
9859 .Ic ~^
9860 has been especially designed for scriptability (via these hooks).
9861 The first line the hook will read on its standard input is the protocol
9862 version of said command escape, currently
9863 .Dq 0 0 1 :
9864 backward incompatible protocol changes have to be expected.
9867 Care must be taken to avoid deadlocks and other false control flow:
9868 if both involved processes wait for more input to happen at the
9869 same time, or one does not expect more input but the other is stuck
9870 waiting for consumption of its output, etc.
9871 There is no automatic synchronization of the hook: it will not be
9872 stopped automatically just because it, e.g., emits
9873 .Ql ~x .
9874 The hooks will however receive a termination signal if the parent enters
9875 an error condition.
9876 \*(ID Protection against and interaction with signals is not yet given;
9877 it is likely that in the future these scripts will be placed in an
9878 isolated session, which is signalled in its entirety as necessary.
9880 .Bd -literal -offset indent
9881 define ocs_signature {
9882   read version
9883   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
9885 set on-compose-splice=ocs_signature
9887 wysh set on-compose-splice-shell=$'\e
9888   read version;\e
9889   printf "hello $version!  Headers: ";\e
9890   echo \e'~^header list\e';\e
9891   read status result;\e
9892   echo "status=$status result=$result";\e
9893   '
9895 define ocsm {
9896   read version
9897   echo Splice protocol version is $version
9898   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
9899   if [ "$es" != 2 ]
9900     echoerr 'Cannot read header list'; echo '~x'; xit
9901   endif
9902   if [ "$hl" @i!% ' cc' ]
9903     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
9904       vput vexpr es substring "${es}" 0 1
9905     if [ "$es" != 2 ]
9906       echoerr 'Cannot insert Cc: header'; echo '~x'
9907       # (no xit, macro finishs anyway)
9908     endif
9909   endif
9911 set on-compose-splice=ocsm
9916 .It Va on-resend-cleanup
9917 \*(ID Identical to
9918 .Va on-compose-cleanup ,
9919 but is only triggered by
9920 .Ic resend .
9923 .It Va on-resend-enter
9924 \*(ID Identical to
9925 .Va on-compose-enter ,
9926 but is only triggered by
9927 .Ic resend .
9930 .It Va page
9931 \*(BO If set, each message feed through the command given for
9932 .Ic pipe
9933 is followed by a formfeed character
9934 .Ql \ef .
9936 .Mx Va password
9937 .It Va password-USER@HOST , password-HOST , password
9938 \*(IN Variable chain that sets a password, which is used in case none has
9939 been given in the protocol and account-specific URL;
9940 as a last resort \*(UA will ask for a password on the user's terminal if
9941 the authentication method requires a password.
9942 Specifying passwords in a startup file is generally a security risk;
9943 the file should be readable by the invoking user only.
9945 .It Va password-USER@HOST
9946 \*(OU (see the chain above for \*(IN)
9947 Set the password for
9948 .Ql USER
9949 when connecting to
9950 .Ql HOST .
9951 If no such variable is defined for a host,
9952 the user will be asked for a password on standard input.
9953 Specifying passwords in a startup file is generally a security risk;
9954 the file should be readable by the invoking user only.
9957 .It Va piperaw
9958 \*(BO Send messages to the
9959 .Ic pipe
9960 command without performing MIME and character set conversions.
9964 .It Va pipe-TYPE/SUBTYPE
9965 When a MIME message part of type
9966 .Ql TYPE/SUBTYPE
9967 (case-insensitive) is displayed or quoted,
9968 its text is filtered through the value of this variable interpreted as
9969 a shell command.
9970 Note that only parts which can be displayed inline as plain text (see
9971 .Cd copiousoutput )
9972 are displayed unless otherwise noted, other MIME parts will only be
9973 considered by and for the command
9974 .Ic mimeview .
9977 The special value commercial at
9978 .Ql @
9979 forces interpretation of the message part as plain text, e.g.,
9980 .Ql set pipe-application/xml=@
9981 will henceforth display XML
9982 .Dq as is .
9983 (The same could also be achieved by adding a MIME type marker with the
9984 .Ic mimetype
9985 command.
9986 And \*(OPally MIME type handlers may be defined via
9987 .Sx "The Mailcap files"
9988 \(em these directives,
9989 .Cd copiousoutput
9990 has already been used, should be referred to for further documentation.
9993 The commercial at
9994 .Ql @
9995 can in fact be used as a trigger character to adjust usage and behaviour
9996 of a following shell command specification more thoroughly by appending
9997 more special characters which refer to further mailcap directives, e.g.,
9998 the following hypothetical command specification could be used:
10000 .Bd -literal -offset indent
10001 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
10005 .Bl -tag -compact -width ".It Ql __"
10006 .It Ql *
10007 The command produces plain text to be integrated in \*(UAs output:
10008 .Cd copiousoutput .
10010 .It Ql #
10011 If set the handler will not be invoked when a message is to be quoted,
10012 but only when it will be displayed:
10013 .Cd x-mailx-noquote .
10015 .It Ql &
10016 Run the command asynchronously, i.e., without blocking \*(UA:
10017 .Cd x-mailx-async .
10019 .It Ql \&!
10020 The command must be run on an interactive terminal, \*(UA will
10021 temporarily release the terminal to it:
10022 .Cd needsterminal .
10024 .It Ql +
10025 Request creation of a zero-sized temporary file, the absolute pathname
10026 of which will be made accessible via the environment variable
10027 .Ev MAILX_FILENAME_TEMPORARY :
10028 .Cd x-mailx-tmpfile .
10029 If given twice then the file will be unlinked automatically by \*(UA
10030 when the command loop is entered again at latest:
10031 .Cd x-mailx-tmpfile-unlink .
10033 .It Ql =
10034 Normally the MIME part content is passed to the handler via standard
10035 input; if this flag is set then the data will instead be written into
10036 .Ev MAILX_FILENAME_TEMPORARY
10037 .Pf ( Cd x-mailx-tmpfile-fill ) ,
10038 the creation of which is implied; note however that in order to cause
10039 deletion of the temporary file you still have to use two plus signs
10040 .Ql ++
10041 explicitly!
10043 .It Ql @
10044 To avoid ambiguities with normal shell command content you can use
10045 another commercial at to forcefully terminate interpretation of
10046 remaining characters.
10047 (Any character not in this list will have the same effect.)
10051 Some information about the MIME part to be displayed is embedded into
10052 the environment of the shell command:
10055 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
10057 .It Ev MAILX_CONTENT
10058 The MIME content-type of the part, if known, the empty string otherwise.
10061 .It Ev MAILX_CONTENT_EVIDENCE
10063 .Va mime-counter-evidence
10064 includes the carry-around-bit (2), then this will be set to the detected
10065 MIME content-type; not only then identical to
10066 .Ev \&\&MAILX_CONTENT
10067 otherwise.
10070 .It Ev MAILX_FILENAME
10071 The filename, if any is set, the empty string otherwise.
10074 .It Ev MAILX_FILENAME_GENERATED
10075 A random string.
10078 .It Ev MAILX_FILENAME_TEMPORARY
10079 If temporary file creation has been requested through the command prefix
10080 this variable will be set and contain the absolute pathname of the
10081 temporary file.
10086 .It Va pipe-EXTENSION
10087 This is identical to
10088 .Va pipe-TYPE/SUBTYPE
10089 except that
10090 .Ql EXTENSION
10091 (normalized to lowercase using character mappings of the ASCII charset)
10092 names a file extension, e.g.,
10093 .Ql xhtml .
10094 Handlers registered using this method take precedence.
10096 .Mx Va pop3-auth
10097 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
10098 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
10099 The only possible value as of now is
10100 .Ql plain ,
10101 which is thus the default.
10103 .Mx Va pop3-bulk-load
10104 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
10105 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
10106 the messages, and only requests the message bodies on user request.
10107 For the POP3 protocol this means that the message headers will be
10108 downloaded twice.
10109 If this variable is set then \*(UA will download only complete messages
10110 from the given POP3 server(s) instead.
10112 .Mx Va pop3-keepalive
10113 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
10114 \*(OP POP3 servers close the connection after a period of inactivity;
10115 the standard requires this to be at least 10 minutes,
10116 but practical experience may vary.
10117 Setting this variable to a numeric value greater than
10118 .Ql 0
10119 causes a
10120 .Ql NOOP
10121 command to be sent each value seconds if no other operation is performed.
10123 .Mx Va pop3-no-apop
10124 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
10125 \*(BO\*(OP Unless this variable is set the
10126 .Ql APOP
10127 authentication method will be used when connecting to a POP3 server that
10128 advertises support.
10129 The advantage of
10130 .Ql APOP
10131 is that the password is not sent in clear text over the wire and that
10132 only a single packet is sent for the user/password tuple.
10133 Note that
10134 .Va pop3-no-apop-HOST
10135 requires \*(IN.
10137 .Mx Va pop3-use-starttls
10138 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
10139 \*(BO\*(OP Causes \*(UA to issue a
10140 .Ql STLS
10141 command to make an unencrypted POP3 session SSL/TLS encrypted.
10142 This functionality is not supported by all servers,
10143 and is not used if the session is already encrypted by the POP3S method.
10144 Note that
10145 .Va pop3-use-starttls-HOST
10146 requires \*(IN.
10150 .It Va posix
10151 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
10152 where that deviates from standardized behaviour.
10153 It will be set implicitly before the
10154 .Sx "Resource files"
10155 are loaded if the environment variable
10156 .Ev POSIXLY_CORRECT
10157 is set, and adjusting any of those two will be reflected by the other
10158 one implicitly.
10159 The following behaviour is covered and enforced by this mechanism:
10162 .Bl -bullet -compact
10164 In non-interactive mode, any error encountered while loading resource
10165 files during program startup will cause a program exit, whereas in
10166 interactive mode such errors will stop loading of the currently loaded
10167 (stack of) file(s, i.e., recursively).
10168 These exits can be circumvented on a per-command base by using
10169 .Cm ignerr ,
10170 one of the
10171 .Sx "Command modifiers" ,
10172 for each command which shall be allowed to fail.
10175 .Ic alternates
10176 will replace the list of alternate addresses instead of appending to it.
10179 The variable inserting
10180 .Sx "COMMAND ESCAPES"
10181 .Ic ~A ,
10182 .Ic ~a ,
10183 .Ic ~I
10185 .Ic ~i
10186 will expand embedded character sequences
10187 .Ql \et
10188 horizontal tabulator and
10189 .Ql \en
10190 line feed.
10191 \*(ID For compatibility reasons this step will always be performed.
10194 Upon changing the active
10195 .Ic file
10196 no summary of
10197 .Ic headers
10198 will be displayed even if
10199 .Va header
10200 is set.
10203 Setting
10204 .Va ignoreeof
10205 implies the behaviour described by
10206 .Va dot .
10209 The variable
10210 .Va keep
10211 is extended to cover any empty mailbox, not only empty
10212 .Mx -sx
10213 .Sx "primary system mailbox" Ns
10214 es: they will be removed when they are left in empty state otherwise.
10219 .It Va print-alternatives
10220 \*(BO When a MIME message part of type
10221 .Ql multipart/alternative
10222 is displayed and it contains a subpart of type
10223 .Ql text/plain ,
10224 other parts are normally discarded.
10225 Setting this variable causes all subparts to be displayed,
10226 just as if the surrounding part was of type
10227 .Ql multipart/mixed .
10230 .It Va prompt
10231 The string used as a prompt in interactive mode.
10232 Whenever the variable is evaluated the value is expanded as via
10233 dollar-single-quote expansion (see
10234 .Sx "Shell-style argument quoting" ) .
10235 This (post-assignment, i.e., second) expansion can be used to embed
10236 status information, for example
10237 .Va \&? ,
10238 .Va \&! ,
10239 .Va account
10241 .Va mailbox-display .
10243 In order to embed characters which should not be counted when
10244 calculating the visual width of the resulting string, enclose the
10245 characters of interest in a pair of reverse solidus escaped brackets:
10246 .Ql \e[\eE[0m\e] ;
10247 a slot for coloured prompts is also available with the \*(OPal command
10248 .Ic colour .
10249 Prompting may be prevented by setting this to the null string
10250 (a.k.a.\|
10251 .Ql set noprompt ) .
10254 .It Va prompt2
10255 This string is used for secondary prompts, but is otherwise identical to
10256 .Va prompt .
10257 The default is
10258 .Ql ..\0 .
10261 .It Va quiet
10262 \*(BO Suppresses the printing of the version when first invoked.
10265 .It Va quote
10266 If set, \*(UA starts a replying message with the original message
10267 prefixed by the value of the variable
10268 .Va indentprefix .
10269 Normally, a heading consisting of
10270 .Dq Fromheaderfield wrote:
10271 is put before the quotation.
10272 If the string
10273 .Ql noheading
10274 is assigned to the
10275 .Va \&\&quote
10276 variable, this heading is omitted.
10277 If the string
10278 .Ql headers
10279 is assigned, only the headers selected by the
10280 .Ql type
10281 .Ic headerpick
10282 selection are put above the message body,
10283 thus
10284 .Va \&\&quote
10285 acts like an automatic
10286 .Pf ` Ic ~m Ns '
10287 .Sx "COMMAND ESCAPES"
10288 command, then.
10289 If the string
10290 .Ql allheaders
10291 is assigned, all headers are put above the message body and all MIME
10292 parts are included, making
10293 .Va \&\&quote
10294 act like an automatic
10295 .Pf ` Ic ~M Ns '
10296 command; also see
10297 .Va quote-as-attachment .
10300 .It Va quote-as-attachment
10301 \*(BO Add the original message in its entirety as a
10302 .Ql message/rfc822
10303 MIME attachment when replying to a message.
10304 Note this works regardless of the setting of
10305 .Va quote .
10308 .It Va quote-fold
10309 \*(OP Can be set in addition to
10310 .Va indentprefix .
10311 Setting this turns on a more fancy quotation algorithm in that leading
10312 quotation characters are compressed and overlong lines are folded.
10313 .Va \&\&quote-fold
10314 can be set to either one or two (space separated) numeric values,
10315 which are interpreted as the maximum (goal) and the minimum line length,
10316 respectively, in a spirit rather equal to the
10317 .Xr fmt 1
10318 program, but line-, not paragraph-based.
10319 If not set explicitly the minimum will reflect the goal algorithmically.
10320 The goal cannot be smaller than the length of
10321 .Va indentprefix
10322 plus some additional pad.
10323 Necessary adjustments take place silently.
10326 .It Va r-option-implicit
10327 \*(BO Setting this option evaluates the contents of
10328 .Va from
10329 (or, if that contains multiple addresses,
10330 .Va sender )
10331 and passes the results onto the used (file-based) MTA as described for the
10332 .Fl r
10333 option (empty argument case).
10336 .It Va recipients-in-cc
10337 \*(BO When doing a
10338 .Ic reply ,
10339 the original
10340 .Ql From:
10342 .Ql To:
10343 are by default merged into the new
10344 .Ql To: .
10345 If this variable is set, only the original
10346 .Ql From:
10347 ends in the new
10348 .Ql To: ,
10349 the rest is merged into
10350 .Ql Cc: .
10353 .It Va record
10354 Unless this variable is defined, no copies of outgoing mail will be saved.
10355 If defined it gives the pathname, subject to the usual
10356 .Sx "Filename transformations" ,
10357 of a folder where all new, replied-to or forwarded messages are saved:
10358 when saving to this folder fails the message is not sent, but instead
10359 .Va save Ns
10360 d to
10361 .Ev DEAD .
10362 The standard defines that relative (fully expanded) paths are to be
10363 interpreted relative to the current directory
10364 .Pf ( Ic cwd ) ,
10365 to force interpretation relative to
10366 .Va folder
10367 .Va outfolder
10368 needs to be set in addition.
10371 .It Va record-files
10372 \*(BO If this variable is set the meaning of
10373 .Va record
10374 will be extended to cover messages which target only file and pipe
10375 recipients (see
10376 .Va expandaddr ) .
10377 These address types will not appear in recipient lists unless
10378 .Va add-file-recipients
10379 is also set.
10382 .It Va record-resent
10383 \*(BO If this variable is set the meaning of
10384 .Va record
10385 will be extended to also cover the
10386 .Ic resend
10388 .Ic Resend
10389 commands.
10392 .It Va reply-in-same-charset
10393 \*(BO If this variable is set \*(UA first tries to use the same
10394 character set of the original message for replies.
10395 If this fails, the mechanism described in
10396 .Sx "Character sets"
10397 is evaluated as usual.
10400 .It Va reply-strings
10401 Can be set to a comma-separated list of (case-insensitive according to
10402 ASCII rules) strings which shall be recognized in addition to the
10403 built-in strings as
10404 .Ql Subject:
10405 reply message indicators \(en built-in are
10406 .Ql Re: ,
10407 which is mandated by RFC 5322, as well as the german
10408 .Ql Aw: ,
10409 .Ql Antw: ,
10410 and the
10411 .Ql Wg:
10412 which often has been seen in the wild;
10413 I.e., the separating colon has to be specified explicitly.
10416 .It Va reply-to
10417 A list of addresses to put into the
10418 .Ql Reply-To:
10419 field of the message header.
10420 Members of this list are handled as if they were in the
10421 .Ic alternates
10422 list.
10424 .It Va replyto
10425 \*(OB Variant of
10426 .Va reply-to .
10429 .It Va reply-to-honour
10430 Controls whether a
10431 .Ql Reply-To:
10432 header is honoured when replying to a message via
10433 .Ic reply
10435 .Ic Lreply .
10436 This is a quadoption; if set without a value it defaults to
10437 .Dq yes .
10440 .It Va rfc822-body-from_
10441 \*(BO This variable can be used to force displaying a so-called
10442 .Ql From_
10443 line for messages that are embedded into an envelope mail via the
10444 .Ql message/rfc822
10445 MIME mechanism, for more visual convenience.
10448 .It Va save
10449 \*(BO Enable saving of (partial) messages in
10450 .Ev DEAD
10451 upon interrupt or delivery error.
10454 .It Va screen
10455 The number of lines that represents a
10456 .Dq screenful
10457 of lines, used in
10458 .Ic headers
10459 summary display,
10460 .Ic from
10461 .Ic search Ns
10462 ing, message
10463 .Ic top Ns
10464 line display and scrolling via
10465 .Ic z .
10466 If this variable is not set \*(UA falls back to a calculation based upon
10467 the detected terminal window size and the baud rate: the faster the
10468 terminal, the more will be shown.
10469 Overall screen dimensions and pager usage is influenced by the
10470 environment variables
10471 .Ev COLUMNS
10473 .Ev LINES
10474 and the variable
10475 .Va crt .
10478 .It Va searchheaders
10479 \*(BO Expand message-list specifiers in the form
10480 .Ql /x:y
10481 to all messages containing the substring
10482 .Dq y
10483 in the header field
10484 .Ql x .
10485 The string search is case insensitive.
10488 .It Va sendcharsets
10489 \*(OP A comma-separated list of character set names that can be used in
10490 outgoing internet mail.
10491 The value of the variable
10492 .Va charset-8bit
10493 is automatically appended to this list of character sets.
10494 If no character set conversion capabilities are compiled into \*(UA then
10495 the only supported charset is
10496 .Va ttycharset .
10497 Also see
10498 .Va sendcharsets-else-ttycharset
10499 and refer to the section
10500 .Sx "Character sets"
10501 for the complete picture of character set conversion in \*(UA.
10504 .It Va sendcharsets-else-ttycharset
10505 \*(BO\*(OP If this variable is set, but
10506 .Va sendcharsets
10507 is not, then \*(UA acts as if
10508 .Va sendcharsets
10509 had been set to the value of the variable
10510 .Va ttycharset .
10511 In effect this combination passes through the message data in the
10512 character set of the current locale encoding:
10513 therefore mail message text will be (assumed to be) in ISO-8859-1
10514 encoding when send from within a ISO-8859-1 locale, and in UTF-8
10515 encoding when send from within an UTF-8 locale.
10517 The 8-bit fallback
10518 .Va charset-8bit
10519 never comes into play as
10520 .Va ttycharset
10521 is implicitly assumed to be 8-bit and capable to represent all files the
10522 user may specify (as is the case when no character set conversion
10523 support is available in \*(UA and the only supported character set is
10524 .Va ttycharset :
10525 .Sx "Character sets" ) .
10526 This might be a problem for scripts which use the suggested
10527 .Ql LC_ALL=C
10528 setting, since in this case the character set is US-ASCII by definition,
10529 so that it is better to also override
10530 .Va ttycharset ,
10531 then.
10534 .It Va sender
10535 An address that is put into the
10536 .Ql Sender:
10537 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
10538 responsible for the actual transmission of the message.
10539 This field should normally not be used unless the
10540 .Va from
10541 field contains more than one address, on which case it is required.
10543 .Va \&\&sender
10544 address is handled as if it were in the
10545 .Ic alternates
10546 list; also see
10547 .Fl r ,
10548 .Va r-option-implicit .
10550 .It Va sendmail
10551 \*(OB Predecessor of
10552 .Va mta .
10554 .It Va sendmail-arguments
10555 \*(OB Predecessor of
10556 .Va mta-arguments .
10558 .It Va sendmail-no-default-arguments
10559 \*(OB\*(BO Predecessor of
10560 .Va mta-no-default-arguments .
10562 .It Va sendmail-progname
10563 \*(OB Predecessor of
10564 .Va mta-argv0 .
10567 .It Va sendwait
10568 \*(BO When sending a message wait until the
10569 .Va mta
10570 (including the built-in SMTP one) exits before accepting further commands.
10571 .Sy Only
10572 with this variable set errors reported by the MTA will be recognizable!
10573 If the MTA returns a non-zero exit status,
10574 the exit status of \*(UA will also be non-zero.
10577 .It Va showlast
10578 \*(BO This setting causes \*(UA to start at the last message
10579 instead of the first one when opening a mail folder.
10582 .It Va showname
10583 \*(BO Causes \*(UA to use the sender's real name instead of the plain
10584 address in the header field summary and in message specifications.
10587 .It Va showto
10588 \*(BO Causes the recipient of the message to be shown in the header
10589 summary if the message was sent by the user.
10592 .It Va Sign
10593 The value backing
10594 .Ic ~A ,
10595 one of the
10596 .Sx "COMMAND ESCAPES" .
10597 Also see
10598 .Va message-inject-tail ,
10599 .Va on-compose-leave
10601 .Va on-compose-splice .
10604 .It Va sign
10605 The value backing
10606 .Ic ~a ,
10607 one of the
10608 .Sx "COMMAND ESCAPES" .
10609 Also see
10610 .Va message-inject-tail ,
10611 .Va on-compose-leave
10613 .Va on-compose-splice .
10616 .It Va signature
10617 \*(OB Please use
10618 .Va on-compose-splice
10620 .Va on-compose-splice-shell
10622 .Va on-compose-leave
10623 and (if necessary)
10624 .Va message-inject-tail
10625 instead!
10628 .It Va skipemptybody
10629 \*(BO If an outgoing message does not contain any text in its first or
10630 only message part, do not send it but discard it silently (see also the
10631 command line option
10632 .Fl E ) .
10636 .It Va smime-ca-dir , smime-ca-file
10637 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10638 Enhanced Mail) format as a directory and a file, respectively, for the
10639 purpose of verification of S/MIME signed messages.
10640 It is possible to set both, the file will be loaded immediately, the
10641 directory will be searched whenever no match has yet been found.
10642 The set of CA certificates which are built into the SSL/TLS library can
10643 be explicitly turned off by setting
10644 .Va smime-ca-no-defaults ,
10645 and further fine-tuning is possible via
10646 .Va smime-ca-flags .
10649 .It Va smime-ca-flags
10650 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10651 storage, and the certificate verification that is used.
10652 The actual values and their meanings are documented for
10653 .Va ssl-ca-flags .
10656 .It Va smime-ca-no-defaults
10657 \*(BO\*(OP Do not load the default CA locations that are built into the
10658 used to SSL/TLS library to verify S/MIME signed messages.
10660 .Mx Va smime-cipher
10661 .It Va smime-cipher-USER@HOST , smime-cipher
10662 \*(OP Specifies the cipher to use when generating S/MIME encrypted
10663 messages (for the specified account).
10664 RFC 5751 mandates a default of
10665 .Ql aes128
10666 (AES-128 CBC).
10667 Possible values are (case-insensitive and) in decreasing cipher strength:
10668 .Ql aes256
10669 (AES-256 CBC),
10670 .Ql aes192
10671 (AES-192 CBC),
10672 .Ql aes128
10673 (AES-128 CBC),
10674 .Ql des3
10675 (DES EDE3 CBC, 168 bits; default if
10676 .Ql aes128
10677 is not available) and
10678 .Ql des
10679 (DES CBC, 56 bits).
10681 The actually available cipher algorithms depend on the cryptographic
10682 library that \*(UA uses.
10683 \*(OP Support for more cipher algorithms may be available through
10684 dynamic loading via, e.g.,
10685 .Xr EVP_get_cipherbyname 3
10686 (OpenSSL) if \*(UA has been compiled to support this.
10689 .It Va smime-crl-dir
10690 \*(OP Specifies a directory that contains files with CRLs in PEM format
10691 to use when verifying S/MIME messages.
10694 .It Va smime-crl-file
10695 \*(OP Specifies a file that contains a CRL in PEM format to use when
10696 verifying S/MIME messages.
10699 .It Va smime-encrypt-USER@HOST
10700 \*(OP If this variable is set, messages send to the given receiver are
10701 encrypted before sending.
10702 The value of the variable must be set to the name of a file that
10703 contains a certificate in PEM format.
10705 If a message is sent to multiple recipients,
10706 each of them for whom a corresponding variable is set will receive an
10707 individually encrypted message;
10708 other recipients will continue to receive the message in plain text
10709 unless the
10710 .Va smime-force-encryption
10711 variable is set.
10712 It is recommended to sign encrypted messages, i.e., to also set the
10713 .Va smime-sign
10714 variable.
10717 .It Va smime-force-encryption
10718 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
10721 .It Va smime-sign
10722 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
10723 and include the user's certificate as a MIME attachment.
10724 Signing a message enables a recipient to verify that the sender used
10725 a valid certificate,
10726 that the email addresses in the certificate match those in the message
10727 header and that the message content has not been altered.
10728 It does not change the message text,
10729 and people will be able to read the message as usual.
10730 Also see
10731 .Va smime-sign-cert , smime-sign-include-certs
10733 .Va smime-sign-message-digest .
10735 .Mx Va smime-sign-cert
10736 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
10737 \*(OP Points to a file in PEM format.
10738 For the purpose of signing and decryption this file needs to contain the
10739 user's private key, followed by his certificate.
10741 For message signing
10742 .Ql USER@HOST
10743 is always derived from the value of
10744 .Va from
10745 (or, if that contains multiple addresses,
10746 .Va sender ) .
10747 For the purpose of encryption the recipient's public encryption key
10748 (certificate) is expected; the command
10749 .Ic certsave
10750 can be used to save certificates of signed messages (the section
10751 .Sx "Signed and encrypted messages with S/MIME"
10752 gives some details).
10753 This mode of operation is usually driven by the specialized form.
10755 When decrypting messages the account is derived from the recipient
10756 fields
10757 .Pf ( Ql To:
10759 .Ql Cc: )
10760 of the message, which are searched for addresses for which such
10761 a variable is set.
10762 \*(UA always uses the first address that matches,
10763 so if the same message is sent to more than one of the user's addresses
10764 using different encryption keys, decryption might fail.
10766 For signing and decryption purposes it is possible to use encrypted
10767 keys, and the pseudo-host(s)
10768 .Ql USER@HOST.smime-cert-key
10769 for the private key
10770 (and
10771 .Ql USER@HOST.smime-cert-cert
10772 for the certificate stored in the same file)
10773 will be used for performing any necessary password lookup,
10774 therefore the lookup can be automatized via the mechanisms described in
10775 .Sx "On URL syntax and credential lookup" .
10776 For example, the hypothetical address
10777 .Ql bob@exam.ple
10778 could be driven with a private key / certificate pair path defined in
10779 .Va \&\&smime-sign-cert-bob@exam.ple ,
10780 and needed passwords would then be looked up via the pseudo hosts
10781 .Ql bob@exam.ple.smime-cert-key
10782 (and
10783 .Ql bob@exam.ple.smime-cert-cert ) .
10784 To include intermediate certificates, use
10785 .Va smime-sign-include-certs .
10787 .Mx Va smime-sign-include-certs
10788 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
10789 \*(OP If used, this is supposed to a consist of a comma-separated list
10790 of files, each of which containing a single certificate in PEM format to
10791 be included in the S/MIME message in addition to the
10792 .Va smime-sign-cert
10793 certificate.
10794 This can be used to include intermediate certificates of the certificate
10795 authority, in order to allow the receiver's S/MIME implementation to
10796 perform a verification of the entire certificate chain, starting from
10797 a local root certificate, over the intermediate certificates, down to the
10798 .Va smime-sign-cert .
10799 Even though top level certificates may also be included in the chain,
10800 they won't be used for the verification on the receiver's side.
10802 For the purpose of the mechanisms involved here,
10803 .Ql USER@HOST
10804 refers to the content of the internal variable
10805 .Va from
10806 (or, if that contains multiple addresses,
10807 .Va sender ) .
10808 The pseudo-host
10809 .Ql USER@HOST.smime-include-certs
10810 will be used for performing password lookups for these certificates,
10811 shall they have been given one, therefore the lookup can be automatized
10812 via the mechanisms described in
10813 .Sx "On URL syntax and credential lookup" .
10815 .Mx Va smime-sign-message-digest
10816 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
10817 \*(OP Specifies the message digest to use when signing S/MIME messages.
10818 RFC 5751 mandates a default of
10819 .Ql sha1 .
10820 Possible values are (case-insensitive and) in decreasing cipher strength:
10821 .Ql sha512 ,
10822 .Ql sha384 ,
10823 .Ql sha256 ,
10824 .Ql sha224
10826 .Ql md5 .
10828 The actually available message digest algorithms depend on the
10829 cryptographic library that \*(UA uses.
10830 \*(OP Support for more message digest algorithms may be available
10831 through dynamic loading via, e.g.,
10832 .Xr EVP_get_digestbyname 3
10833 (OpenSSL) if \*(UA has been compiled to support this.
10834 Remember that for this
10835 .Ql USER@HOST
10836 refers to the variable
10837 .Va from
10838 (or, if that contains multiple addresses,
10839 .Va sender ) .
10841 .It Va smtp
10842 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
10843 .Va mta .
10844 \*(ID For compatibility reasons a set
10845 .Va smtp
10846 is used in preference of
10847 .Va mta .
10849 .Mx Va smtp-auth
10850 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
10851 \*(OP Variable chain that controls the SMTP
10852 .Va mta
10853 authentication method, possible values are
10854 .Ql none
10855 (\*(OU default),
10856 .Ql plain
10857 (\*(IN default),
10858 .Ql login
10859 as well as the \*(OPal methods
10860 .Ql cram-md5
10862 .Ql gssapi .
10864 .Ql none
10865 method does not need any user credentials,
10866 .Ql gssapi
10867 requires a user name and all other methods require a user name and
10868 a password.
10869 See \*(IN
10870 .Va mta ,
10871 .Va user
10873 .Va password
10874 (\*(OU
10875 .Va smtp-auth-password
10877 .Va smtp-auth-user ) .
10878 Note that
10879 .Va smtp-auth-HOST
10880 is \*(IN.
10881 \*(OU: Note for
10882 .Va smtp-auth-USER@HOST :
10883 may override dependent on sender address in the variable
10884 .Va from .
10886 .It Va smtp-auth-password
10887 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
10888 If the authentication method requires a password, but neither
10889 .Va smtp-auth-password
10890 nor a matching
10891 .Va smtp-auth-password-USER@HOST
10892 can be found,
10893 \*(UA will ask for a password on the user's terminal.
10895 .It Va smtp-auth-password-USER@HOST
10896 \*(OU Overrides
10897 .Va smtp-auth-password
10898 for specific values of sender addresses, dependent upon the variable
10899 .Va from .
10901 .It Va smtp-auth-user
10902 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
10903 If the authentication method requires a user name, but neither
10904 .Va smtp-auth-user
10905 nor a matching
10906 .Va smtp-auth-user-USER@HOST
10907 can be found,
10908 \*(UA will ask for a user name on the user's terminal.
10910 .It Va smtp-auth-user-USER@HOST
10911 \*(OU Overrides
10912 .Va smtp-auth-user
10913 for specific values of sender addresses, dependent upon the variable
10914 .Va from .
10917 .It Va smtp-hostname
10918 \*(OP\*(IN Normally \*(UA uses the variable
10919 .Va from
10920 to derive the necessary
10921 .Ql USER@HOST
10922 information in order to issue a
10923 .Ql MAIL FROM:<>
10924 SMTP
10925 .Va mta
10926 command.
10927 Setting
10928 .Va smtp-hostname
10929 can be used to use the
10930 .Ql USER
10931 from the SMTP account
10932 .Pf ( Va mta
10933 or the
10934 .Va user
10935 variable chain)
10936 and the
10937 .Ql HOST
10938 from the content of this variable (or, if that is the empty string,
10939 .Va hostname
10940 or the local hostname as a last resort).
10941 This often allows using an address that is itself valid but hosted by
10942 a provider other than which (in
10943 .Va from )
10944 is about to send the message.
10945 Setting this variable also influences generated
10946 .Ql Message-ID:
10948 .Ql Content-ID:
10949 header fields.
10951 .Mx Va smtp-use-starttls
10952 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
10953 \*(BO\*(OP Causes \*(UA to issue a
10954 .Ql STARTTLS
10955 command to make an SMTP
10956 .Va mta
10957 session SSL/TLS encrypted, i.e., to enable transport layer security.
10959 .Mx Va socks-proxy
10960 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
10961 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
10962 \*(UA will proxy all of its network activities through it.
10963 This can be used to proxy SMTP, POP3 etc. network traffic through the
10964 Tor anonymizer, for example.
10965 The following would create a local SOCKS proxy on port 10000 that
10966 forwards to the machine
10967 .Ql HOST ,
10968 and from which the network traffic is actually instantiated:
10969 .Bd -literal -offset indent
10970 # Create local proxy server in terminal 1 forwarding to HOST
10971 $ ssh -D 10000 USER@HOST
10972 # Then, start a client that uses it in terminal 2
10973 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
10977 .It Va spam-interface
10978 \*(OP In order to use any of the spam-related commands (like, e.g.,
10979 .Ic spamrate )
10980 the desired spam interface must be defined by setting this variable.
10981 Please refer to the manual section
10982 .Sx "Handling spam"
10983 for the complete picture of spam handling in \*(UA.
10984 All or none of the following interfaces may be available:
10986 .Bl -tag -width ".It Ql _ilte_"
10987 .It Ql spamc
10988 Interaction with
10989 .Xr spamc 1
10990 from the
10991 .Xr spamassassin 1
10992 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
10993 suite.
10994 Different to the generic filter interface \*(UA will automatically add
10995 the correct arguments for a given command and has the necessary
10996 knowledge to parse the program's output.
10997 A default value for
10998 .Va spamc-command
10999 will have been compiled into the \*(UA binary if
11000 .Xr spamc 1
11001 has been found in
11002 .Ev PATH
11003 during compilation.
11004 Shall it be necessary to define a specific connection type (rather than
11005 using a configuration file for that), the variable
11006 .Va spamc-arguments
11007 can be used as in, e.g.,
11008 .Ql -d server.example.com -p 783 .
11009 It is also possible to specify a per-user configuration via
11010 .Va spamc-user .
11011 Note that this interface does not inspect the
11012 .Ql is-spam
11013 flag of a message for the command
11014 .Ic spamforget .
11016 .It Ql filter
11017 generic spam filter support via freely configurable hooks.
11018 This interface is meant for programs like
11019 .Xr bogofilter 1
11020 and requires according behaviour in respect to the hooks' exit
11021 status for at least the command
11022 .Ic spamrate
11023 .Pf ( Ql 0
11024 meaning a message is spam,
11025 .Ql 1
11026 for non-spam,
11027 .Ql 2
11028 for unsure and any other return value indicating a hard error);
11029 since the hooks can include shell code snippets diverting behaviour
11030 can be intercepted as necessary.
11031 The hooks are
11032 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
11033   spamfilter-rate
11035 .Va spamfilter-spam ;
11036 the manual section
11037 .Sx "Handling spam"
11038 contains examples for some programs.
11039 The process environment of the hooks will have the variable
11040 .Ev MAILX_FILENAME_GENERATED
11041 set.
11042 Note that spam score support for
11043 .Ic spamrate
11044 is not supported unless the \*(OPtional regular expression support is
11045 available and the
11046 .Va spamfilter-rate-scanscore
11047 variable is set.
11052 .It Va spam-maxsize
11053 \*(OP Messages that exceed this size will not be passed through to the
11054 configured
11055 .Va spam-interface .
11056 If unset or 0, the default of 420000 bytes is used.
11059 .It Va spamc-command
11060 \*(OP The path to the
11061 .Xr spamc 1
11062 program for the
11063 .Ql spamc
11064 .Va spam-interface .
11065 Note that the path is not expanded, but used
11066 .Dq as is .
11067 A fallback path will have been compiled into the \*(UA binary if the
11068 executable had been found during compilation.
11071 .It Va spamc-arguments
11072 \*(OP Even though \*(UA deals with most arguments for the
11073 .Ql spamc
11074 .Va spam-interface
11075 automatically, it may at least sometimes be desirable to specify
11076 connection-related ones via this variable, e.g.,
11077 .Ql -d server.example.com -p 783 .
11080 .It Va spamc-user
11081 \*(OP Specify a username for per-user configuration files for the
11082 .Ql spamc
11083 .Va spam-interface .
11084 If this is set to the empty string then \*(UA will use the name of the
11085 current
11086 .Va user .
11093 .It Va spamfilter-ham , spamfilter-noham , \
11094   spamfilter-nospam , spamfilter-rate , spamfilter-spam
11095 \*(OP Command and argument hooks for the
11096 .Ql filter
11097 .Va spam-interface .
11098 The manual section
11099 .Sx "Handling spam"
11100 contains examples for some programs.
11103 .It Va spamfilter-rate-scanscore
11104 \*(OP Because of the generic nature of the
11105 .Ql filter
11106 .Va spam-interface
11107 spam scores are not supported for it by default, but if the \*(OPnal
11108 regular expression support is available then setting this variable can
11109 be used to overcome this restriction.
11110 It is interpreted as follows: first a number (digits) is parsed that
11111 must be followed by a semicolon
11112 .Ql \&;
11113 and an extended regular expression.
11114 Then the latter is used to parse the first output line of the
11115 .Va spamfilter-rate
11116 hook, and, in case the evaluation is successful, the group that has been
11117 specified via the number is interpreted as a floating point scan score.
11121 .It Va ssl-ca-dir , ssl-ca-file
11122 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
11123 Enhanced Mail) format as a directory and a file, respectively, for the
11124 purpose of verification of SSL/TLS server certificates.
11125 It is possible to set both, the file will be loaded immediately, the
11126 directory will be searched whenever no match has yet been found.
11127 The set of CA certificates which are built into the SSL/TLS library can
11128 be explicitly turned off by setting
11129 .Va ssl-ca-no-defaults ,
11130 and further fine-tuning is possible via
11131 .Va ssl-ca-flags ;
11132 also see
11133 .Xr SSL_CTX_load_verify_locations 3
11134 for more information.
11135 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
11136 establishing TLS connections to servers identified with hostnames.
11140 .It Va ssl-ca-flags
11141 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
11142 storage, and the certificate verification that is used (also see
11143 .Va ssl-verify ) .
11144 The value is expected to consist of a comma-separated list of
11145 configuration directives, with any intervening whitespace being ignored.
11146 The directives directly map to flags that can be passed to
11147 .Xr X509_STORE_set_flags 3 ,
11148 which are usually defined in a file
11149 .Pa openssl/x509_vfy.h ,
11150 and the availability of which depends on the used SSL/TLS library
11151 version: a directive without mapping is ignored (error log subject to
11152 .Va debug ) .
11153 Directives currently understood (case-insensitively) include:
11156 .Bl -tag -compact -width ".It Cd BaNg"
11157 .It Cd no-alt-chains
11158 If the initial chain is not trusted, do not attempt to build an
11159 alternative chain.
11160 Setting this flag will make OpenSSL certificate verification match that
11161 of older OpenSSL versions, before automatic building and checking of
11162 alternative chains has been implemented; also see
11163 .Cd trusted-first .
11164 .It Cd no-check-time
11165 Do not check certificate/CRL validity against current time.
11166 .It Cd partial-chain
11167 By default partial, incomplete chains which cannot be verified up to the
11168 chain top, a self-signed root certificate, will not verify.
11169 With this flag set, a chain succeeds to verify if at least one signing
11170 certificate of the chain is in any of the configured trusted stores of
11171 CA certificates.
11172 The OpenSSL manual page
11173 .Xr SSL_CTX_load_verify_locations 3
11174 gives some advise how to manage your own trusted store of CA certificates.
11175 .It Cd strict
11176 Disable workarounds for broken certificates.
11177 .It Cd trusted-first
11178 Try building a chain using issuers in the trusted store first to avoid
11179 problems with server-sent legacy intermediate certificates.
11180 Newer versions of OpenSSL support alternative chain checking and enable
11181 it by default, resulting in the same behaviour; also see
11182 .Cd no-alt-chains .
11187 .It Va ssl-ca-no-defaults
11188 \*(BO\*(OP Do not load the default CA locations that are built into the
11189 used to SSL/TLS library to verify SSL/TLS server certificates.
11191 .Mx Va ssl-cert
11192 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
11193 \*(OP Variable chain that sets the filename for a SSL/TLS client
11194 certificate required by some servers.
11195 This is a direct interface to the
11196 .Ql Certificate
11197 slot of the
11198 .Xr SSL_CONF_cmd 3
11199 function of the OpenSSL library, if available.
11201 .Mx Va ssl-cipher-list
11202 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
11203 \*(OP Specifies a list of ciphers for SSL/TLS connections.
11204 This is a direct interface to the
11205 .Ql CipherString
11206 slot of the
11207 .Xr SSL_CONF_cmd 3
11208 function of the OpenSSL library, if available; see
11209 .Xr ciphers 1
11211 .Xr SSL_CTX_set_cipher_list 3
11212 for more information.
11213 By default \*(UA does not set a list of ciphers, in effect using a
11214 .Va ssl-protocol
11215 specific cipher (protocol standards ship with a list of acceptable
11216 ciphers), possibly cramped to what the actually used SSL/TLS library
11217 supports \(en the manual section
11218 .Sx "An example configuration"
11219 also contains a SSL/TLS use case.
11222 .It Va ssl-config-file
11223 \*(OP If this variable is set \*(UA will call
11224 .Xr CONF_modules_load_file 3
11225 to allow OpenSSL to be configured according to the host system wide
11226 security settings.
11227 If a non-empty value is given then this will be used to specify the
11228 configuration file to be used instead of the global OpenSSL default;
11229 note that in this case it is an error if the file cannot be loaded.
11230 The application name will always be passed as
11231 .Dq \*(uA .
11233 .Mx Va ssl-curves
11234 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
11235 \*(OP Specifies a list of supported curves for SSL/TLS connections.
11236 This is a direct interface to the
11237 .Ql Curves
11238 slot of the
11239 .Xr SSL_CONF_cmd 3
11240 function of the OpenSSL library, if available; see
11241 .Xr SSL_CTX_set1_curves_list 3
11242 for more information.
11243 By default \*(UA does not set a list of curves.
11247 .It Va ssl-crl-dir , ssl-crl-file
11248 \*(OP Specify a directory / a file, respectively that contains a CRL in
11249 PEM format to use when verifying SSL/TLS server certificates.
11251 .Mx Va ssl-key
11252 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
11253 \*(OP Variable chain that sets the filename for the private key of
11254 a SSL/TLS client certificate.
11255 If unset, the name of the certificate file is used.
11256 The file is expected to be in PEM format.
11257 This is a direct interface to the
11258 .Ql PrivateKey
11259 slot of the
11260 .Xr SSL_CONF_cmd 3
11261 function of the OpenSSL library, if available.
11263 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
11264 \*(OB\*(OP Please use the newer and more flexible
11265 .Va ssl-protocol
11266 instead: if both values are set,
11267 .Va ssl-protocol
11268 will take precedence!
11269 Can be set to the following values, the actually used
11270 .Va ssl-protocol
11271 specification to which it is mapped is shown in parenthesis:
11272 .Ql tls1.2
11273 .Pf ( Ql -ALL, TLSv1.2 ) ,
11274 .Ql tls1.1
11275 .Pf ( Ql -ALL, TLSv1.1 ) ,
11276 .Ql tls1
11277 .Pf ( Ql -ALL, TLSv1 )
11279 .Ql ssl3
11280 .Pf ( Ql -ALL, SSLv3 ) ;
11281 the special value
11282 .Ql auto
11283 is mapped to
11284 .Ql ALL, -SSLv2
11285 and thus includes the SSLv3 protocol.
11286 Note that SSLv2 is no longer supported at all.
11288 .Mx Va ssl-protocol
11289 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
11290 \*(OP Specify the used SSL/TLS protocol.
11291 This is a direct interface to the
11292 .Ql Protocol
11293 slot of the
11294 .Xr SSL_CONF_cmd 3
11295 function of the OpenSSL library, if available;
11296 otherwise an \*(UA internal parser is used which understands the
11297 following subset of (case-insensitive) command strings:
11298 .Ql SSLv3 ,
11299 .Ql TLSv1 ,
11300 .Ql TLSv1.1
11302 .Ql TLSv1.2 ,
11303 as well as the special value
11304 .Ql ALL .
11305 Multiple specifications may be given via a comma-separated list which
11306 ignores any whitespace.
11307 An optional
11308 .Ql +
11309 plus sign prefix will enable a protocol, a
11310 .Ql -
11311 hyphen-minus prefix will disable it, so that
11312 .Ql -ALL, TLSv1.2
11313 will enable only the TLSv1.2 protocol.
11315 It depends upon the used TLS/SSL library which protocols are actually
11316 supported and which protocols are used if
11317 .Va ssl-protocol
11318 is not set, but note that SSLv2 is no longer supported at all and
11319 actively disabled.
11320 Especially for older protocols explicitly securing
11321 .Va ssl-cipher-list
11322 may be worthwile, see
11323 .Sx "An example configuration" .
11326 .It Va ssl-rand-egd
11327 \*(OP Gives the pathname to an entropy daemon socket, see
11328 .Xr RAND_egd 3 .
11329 Not all SSL/TLS libraries support this.
11332 .It Va ssl-rand-file
11333 \*(OP Gives the filename to a file with random entropy data, see
11334 .Xr RAND_load_file 3 .
11335 If this variable is not set, or set to the empty string, or if the
11336 .Sx "Filename transformations"
11337 fail, then
11338 .Xr RAND_file_name 3
11339 will be used to create the filename if, and only if,
11340 .Xr RAND_status 3
11341 documents that the SSL PRNG is not yet sufficiently seeded.
11342 If \*(UA successfully seeded the SSL PRNG then it will update the file
11343 .Pf ( Xr RAND_write_file 3 ) .
11344 This variable is only used if
11345 .Va ssl-rand-egd
11346 is not set (or not supported by the SSL/TLS library).
11348 .Mx Va ssl-verify
11349 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
11350 \*(OP Variable chain that sets the action to be performed if an error
11351 occurs during SSL/TLS server certificate validation against the
11352 specified or default trust stores
11353 .Va ssl-ca-dir ,
11354 .Va ssl-ca-file ,
11355 or the SSL/TLS library built-in defaults (unless usage disallowed via
11356 .Va ssl-ca-no-defaults ) ,
11357 and as fine-tuned via
11358 .Va ssl-ca-flags .
11359 Valid (case-insensitive) values are
11360 .Ql strict
11361 (fail and close connection immediately),
11362 .Ql ask
11363 (ask whether to continue on standard input),
11364 .Ql warn
11365 (show a warning and continue),
11366 .Ql ignore
11367 (do not perform validation).
11368 The default is
11369 .Ql ask .
11372 .It Va stealthmua
11373 If only set without an assigned value, then this setting inhibits the
11374 generation of the
11375 .Ql Message-ID: ,
11376 .Ql Content-ID:
11378 .Ql User-Agent:
11379 header fields that include obvious references to \*(UA.
11380 There are two pitfalls associated with this:
11381 First, the message id of outgoing messages is not known anymore.
11382 Second, an expert may still use the remaining information in the header
11383 to track down the originating mail user agent.
11384 If set to the value
11385 .Ql noagent ,
11386 then the mentioned
11387 .Ql Message-ID:
11389 .Ql Content-ID:
11390 suppression does not occur.
11394 .It Va termcap
11395 (\*(OP) This specifies a comma-separated list of
11396 .Lb libterminfo
11397 and/or
11398 .Lb libtermcap
11399 capabilities (see
11400 .Sx "On terminal control and line editor" ,
11401 escape commas with reverse solidus) to be used to overwrite or define
11402 entries.
11403 .Sy Note
11404 this variable will only be queried once at program startup and can
11405 thus only be specified in resource files or on the command line.
11408 String capabilities form
11409 .Ql cap=value
11410 pairs and are expected unless noted otherwise.
11411 Numerics have to be notated as
11412 .Ql cap#number
11413 where the number is expected in normal decimal notation.
11414 Finally, booleans do not have any value but indicate a true or false
11415 state simply by being defined or not; this indeed means that \*(UA
11416 does not support undefining an existing boolean.
11417 String capability values will undergo some expansions before use:
11418 for one notations like
11419 .Ql ^LETTER
11420 stand for
11421 .Ql control-LETTER ,
11422 and for clarification purposes
11423 .Ql \eE
11424 can be used to specify
11425 .Ql escape
11426 (the control notation
11427 .Ql ^[
11428 could lead to misreadings when a left bracket follows, which it does for
11429 the standard CSI sequence);
11430 finally three letter octal sequences, as in
11431 .Ql \e061 ,
11432 are supported.
11433 To specify that a terminal supports 256-colours, and to define sequences
11434 that home the cursor and produce an audible bell, one might write:
11436 .Bd -literal -offset indent
11437 ? set termcap='Co#256,home=\eE[H,bel=^G'
11441 The following terminal capabilities are or may be meaningful for the
11442 operation of the built-in line editor or \*(UA in general:
11445 .Bl -tag -compact -width ".It Cd yay"
11446 .\" HAVE_COLOUR
11447 .It Cd colors Ns \0or Cd Co
11448 .Cd max_colors :
11449 numeric capability specifying the maximum number of colours.
11450 Note that \*(UA does not actually care about the terminal beside that,
11451 but always emits ANSI / ISO 6429 escape sequences.
11453 .\" HAVE_TERMCAP
11454 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
11455 .Cd exit_ca_mode
11457 .Cd enter_ca_mode ,
11458 respectively: exit and enter the alternative screen ca-mode,
11459 effectively turning \*(UA into a fullscreen application.
11460 This must be enabled explicitly by setting
11461 .Va termcap-ca-mode .
11463 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
11464 .Cd keypad_xmit
11466 .Cd keypad_local ,
11467 respectively: enable and disable the keypad.
11468 This is always enabled if available, because it seems even keyboards
11469 without keypads generate other key codes for, e.g., cursor keys in that
11470 case, and only if enabled we see the codes that we are interested in.
11472 .It Cd ed Ns \0or Cd cd
11473 .Cd clr_eos :
11474 clear the screen.
11476 .It Cd clear Ns \0or Cd cl
11477 .Cd clear_screen :
11478 clear the screen and home cursor.
11479 (Will be simulated via
11480 .Cd ho
11481 plus
11482 .Cd cd . )
11484 .It Cd home Ns \0or Cd ho
11485 .Cd cursor_home :
11486 home cursor.
11488 .\" HAVE_MLE
11489 .It Cd el Ns \0or Cd ce
11490 .Cd clr_eol :
11491 clear to the end of line.
11492 (Will be simulated via
11493 .Cd ch
11494 plus repetitions of space characters.)
11496 .It Cd hpa Ns \0or Cd ch
11497 .Cd column_address :
11498 move the cursor (to the given column parameter) in the current row.
11499 (Will be simulated via
11500 .Cd cr
11501 plus
11502 .Cd nd . )
11504 .It Cd cr
11505 .Cd carriage_return :
11506 move to the first column in the current row.
11507 The default built-in fallback is
11508 .Ql \er .
11510 .It Cd cub1 Ns \0or Cd le
11511 .Cd cursor_left :
11512 move the cursor left one space (non-destructively).
11513 The default built-in fallback is
11514 .Ql \eb .
11516 .It Cd cuf1 Ns \0or Cd nd
11517 .Cd cursor_right :
11518 move the cursor right one space (non-destructively).
11519 The default built-in fallback is
11520 .Ql \eE[C ,
11521 which is used by most terminals.
11522 Less often occur
11523 .Ql \eEC
11525 .Ql \eEOC .
11529 Many more capabilities which describe key-sequences are documented for
11530 .Ic bind .
11534 .It Va termcap-ca-mode
11535 \*(OP Allow usage of the
11536 .Cd exit_ca_mode
11538 .Cd enter_ca_mode
11539 terminal capabilities, effectively turning \*(UA into a fullscreen
11540 application, as documented for
11541 .Va termcap .
11542 .Sy Note
11543 this variable will only be queried once at program startup and can
11544 thus only be specified in resource files or on the command line.
11547 .It Va termcap-disable
11548 \*(OP Disable any interaction with a terminal control library.
11549 If set only some generic fallback built-ins and possibly the content of
11550 .Va termcap
11551 describe the terminal to \*(UA.
11552 .Sy Note
11553 this variable will only be queried once at program startup and can
11554 thus only be specified in resource files or on the command line.
11557 .It Va toplines
11558 If defined, gives the number of lines of a message to be displayed
11559 with the command
11560 .Ic top ;
11561 if unset, the first five lines are printed, if set to 0 the variable
11562 .Va screen
11563 is inspected.
11564 If the value is negative then its absolute value will be used for
11565 unsigned right shifting (see
11566 .Ic vexpr )
11568 .Va screen
11569 height.
11572 .It Va topsqueeze
11573 \*(BO If set then the
11574 .Ic top
11575 command series will strip adjacent empty lines and quotations.
11578 .It Va ttycharset
11579 The character set of the terminal \*(UA operates on,
11580 and the one and only supported character set that \*(UA can use if no
11581 character set conversion capabilities have been compiled into it,
11582 in which case it defaults to ISO-8859-1 unless it can deduce a value
11583 from the locale specified in the
11584 .Ev LC_CTYPE
11585 environment variable (if supported, see there for more).
11586 It defaults to UTF-8 if conversion is available.
11587 Refer to the section
11588 .Sx "Character sets"
11589 for the complete picture about character sets.
11592 .It Va typescript-mode
11593 \*(BO A special multiplex variable that disables all variables and
11594 settings which result in behaviour that interferes with running \*(UA in
11595 .Xr script 1 ,
11596 e.g., it sets
11597 .Va colour-disable ,
11598 .Va line-editor-disable
11599 and (before startup completed only)
11600 .Va termcap-disable .
11601 Unsetting it does not restore the former state of the covered settings.
11604 .It Va umask
11605 For a safety-by-default policy \*(UA sets its process
11606 .Xr umask 2
11608 .Ql 0077 ,
11609 but this variable can be used to override that:
11610 set it to an empty value to do not change the (current) setting (on
11611 startup), otherwise the process file mode creation mask is updated to
11612 the new value.
11613 Child processes inherit the process file mode creation mask.
11615 .Mx Va user
11616 .It Va user-HOST , user
11617 \*(IN Variable chain that sets a global fallback user name, which is
11618 used in case none has been given in the protocol and account-specific
11619 URL.
11620 This variable defaults to the name of the user who runs \*(UA.
11623 .It Va v15-compat
11624 \*(BO Setting this enables upward compatibility with \*(UA
11625 version 15.0 in respect to which configuration options are available and
11626 how they are handled.
11627 This manual uses \*(IN and \*(OU to refer to the new and the old way of
11628 doing things, respectively.
11631 .It Va verbose
11632 \*(BO This setting, also controllable via the command line option
11633 .Fl v ,
11634 causes \*(UA to be more verbose, e.g., it will display obsoletion
11635 warnings and SSL/TLS certificate chains.
11636 Even though marked \*(BO this option may be set twice in order to
11637 increase the level of verbosity even more, in which case even details of
11638 the actual message delivery and protocol conversations are shown.
11639 A single
11640 .Pf no Va verbose
11641 is sufficient to disable verbosity as such.
11648 .It Va version , version-date , version-major , version-minor , version-update
11649 \*(RO \*(UA version information: the first variable contains a string
11650 containing the complete version identification, the latter three contain
11651 only digits: the major, minor and update version numbers.
11652 The date is in ISO 8601 notation.
11653 The output of the command
11654 .Ic version
11655 will include this information.
11658 .It Va writebackedited
11659 If this variable is set messages modified using the
11660 .Ic edit
11662 .Ic visual
11663 commands are written back to the current folder when it is quit;
11664 it is only honoured for writable folders in MBOX format, though.
11665 Note that the editor will be pointed to the raw message content in that
11666 case, i.e., neither MIME decoding nor decryption will have been
11667 performed, and proper RFC 4155
11668 .Ql From_
11669 quoting of newly added or edited content is also left as an excercise to
11670 the user.
11672 .\" }}} (Variables)
11674 .\" }}} (INTERNAL VARIABLES)
11677 .\" .Sh ENVIRONMENT {{{
11678 .Sh ENVIRONMENT
11680 The term
11681 .Dq environment variable
11682 should be considered an indication that these variables are either
11683 standardized as vivid parts of process environments, or that they are
11684 commonly found in there.
11685 The process environment is inherited from the
11686 .Xr sh 1
11687 once \*(UA is started, and unless otherwise explicitly noted handling of
11688 the following variables transparently integrates into that of the
11689 .Sx "INTERNAL VARIABLES"
11690 from \*(UA's point of view.
11691 This means that, e.g., they can be managed via
11692 .Ic set
11694 .Ic unset ,
11695 causing automatic program environment updates (to be inherited by
11696 newly created child processes).
11699 In order to transparently integrate other environment variables equally
11700 they need to be imported (linked) with the command
11701 .Ic environ .
11702 This command can also be used to set and unset non-integrated
11703 environment variables from scratch, sufficient system support provided.
11704 The following example, applicable to a POSIX shell, sets the
11705 .Ev COLUMNS
11706 environment variable for \*(UA only, and beforehand exports the
11707 .Ev EDITOR
11708 in order to affect any further processing in the running shell:
11710 .Bd -literal -offset indent
11711 $ EDITOR="vim -u ${HOME}/.vimrc"
11712 $ export EDITOR
11713 $ COLUMNS=80 \*(uA -R
11716 .Bl -tag -width ".It Ev BaNg"
11718 .It Ev COLUMNS
11719 The user's preferred width in column positions for the terminal screen
11720 or window.
11721 Queried and used once on program startup, actively managed for child
11722 processes and the MLE (see
11723 .Sx "On terminal control and line editor" )
11724 in interactive mode thereafter.
11725 Ignored in non-interactive mode, which always uses 80 columns, unless in
11726 .fl #
11727 batch mode.
11730 .It Ev DEAD
11731 The name of the (mailbox)
11732 .Ic file
11733 to use for saving aborted messages if
11734 .Va save
11735 is set; this defaults to
11736 .Pa dead.letter
11737 in the user's
11738 .Ev HOME
11739 directory.
11740 If the variable
11741 .Va debug
11742 is set no output will be generated, otherwise the contents of the file
11743 will be replaced.
11746 .It Ev EDITOR
11747 Pathname of the text editor to use in the
11748 .Ic edit
11749 command and
11750 .Ic ~e
11751 .Sx "COMMAND ESCAPES" .
11752 A default editor is used if this value is not defined.
11755 .It Ev HOME
11756 The user's home directory.
11757 This variable is only used when it resides in the process environment.
11758 The calling user's home directory will be used instead if this directory
11759 does not exist, is not accessible or cannot be read.
11760 (No test for being writable is performed to allow usage by
11761 non-privileged users within read-only jails, but dependent on the
11762 variable settings this directory is a default write target, e.g. for
11763 .Ev DEAD ,
11764 .Ev MBOX
11765 and more.)
11770 .It Ev LC_ALL , LC_CTYPE , LANG
11771 \*(OP The (names in lookup order of the)
11772 .Xr locale 7
11773 (and / or see
11774 .Xr setlocale 3 )
11775 which indicates the used
11776 .Sx "Character sets" .
11777 Runtime changes trigger automatic updates of the entire locale system,
11778 updating and overwriting also a
11779 .Va ttycharset
11780 set by the user.
11783 .It Ev LINES
11784 The user's preferred number of lines on a page or the vertical screen
11785 or window size in lines.
11786 Queried and used once on program startup, actively managed for child
11787 processes in interactive mode thereafter.
11788 Ignored in non-interactive mode, which always uses 24 lines, unless in
11789 .fl #
11790 batch mode.
11793 .It Ev LISTER
11794 Pathname of the directory lister to use in the
11795 .Ic folders
11796 command when operating on local mailboxes.
11797 Default is
11798 .Xr ls 1
11799 (path search through
11800 .Ev SHELL ) .
11803 .It Ev LOGNAME
11804 Upon startup \*(UA will actively ensure that this variable refers to the
11805 name of the user who runs \*(UA, in order to be able to pass a verified
11806 name to any newly created child process.
11809 .It Ev MAIL
11810 Is used as the users
11811 .Mx -sx
11812 .Sx "primary system mailbox"
11813 unless
11814 .Va inbox
11815 is set.
11816 This is assumed to be an absolute pathname.
11819 .It Ev MAILCAPS
11820 \*(OP Overrides the default path search for
11821 .Sx "The Mailcap files" ,
11822 which is defined in the standard RFC 1524 as
11823 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
11824 .\" TODO we should have a mailcaps-default virtual RDONLY option!
11825 (\*(UA makes it a configuration option, however.)
11826 Note this is not a search path, but a path search.
11829 .It Ev MAILRC
11830 Is used as a startup file instead of
11831 .Pa \*(ur
11832 if set.
11833 When \*(UA scripts are invoked on behalf of other users,
11834 either this variable should be set to
11835 .Pa /dev/null
11836 or the
11837 .Fl \&:
11838 command line option should be used in order to avoid side-effects from
11839 reading their configuration files.
11840 This variable is only used when it resides in the process environment.
11843 .It Ev MAILX_NO_SYSTEM_RC
11844 If this variable is set then reading of
11845 .Pa \*(UR
11846 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
11847 had been started up with the option
11848 .Fl \&:
11849 (and according argument) or
11850 .Fl n .
11851 This variable is only used when it resides in the process environment.
11854 .It Ev MBOX
11855 The name of the users
11856 .Mx -sx
11857 .Sx "secondary mailbox"
11858 file.
11859 A logical subset of the special
11860 .Sx "Filename transformations"
11861 (also see
11862 .Ic file )
11863 are supported.
11864 The default is
11865 .Pa ~/mbox .
11866 Traditionally this MBOX is used as the file to save messages from the
11867 .Mx -sx
11868 .Sx "primary system mailbox"
11869 that have been read.
11870 Also see
11871 .Sx "Message states" .
11874 .It Ev NETRC
11875 \*(IN\*(OP This variable overrides the default location of the user's
11876 .Pa ~/.netrc
11877 file.
11880 .It Ev PAGER
11881 Pathname of the program to use for backing the command
11882 .Ic more ,
11883 and when the
11884 .Va crt
11885 variable enforces usage of a pager for output.
11886 The default paginator is
11887 .Xr more 1
11888 (path search through
11889 .Ev SHELL ) .
11891 \*(UA inspects the contents of this variable: if its contains the string
11892 .Dq less
11893 then a non-existing environment variable
11894 .Ev LESS
11895 will be set to
11896 .Ql Ri ,
11897 likewise for
11898 .Dq lv
11899 .Ev LV
11900 will optionally be set to
11901 .Ql -c .
11902 Alse see
11903 .Va colour-pager .
11906 .It Ev PATH
11907 A colon-separated list of directories that is searched by the shell when
11908 looking for commands, e.g.,
11909 .Ql /bin:/usr/bin:/usr/local/bin .
11912 .It Ev POSIXLY_CORRECT
11913 This variable is automatically looked for upon startup, see
11914 .Va posix
11915 for more.
11918 .It Ev SHELL
11919 The shell to use for the commands
11920 .Ic \&! ,
11921 .Ic shell ,
11923 .Ic ~!
11924 .Sx "COMMAND ESCAPES"
11925 and when starting subprocesses.
11926 A default shell is used if this environment variable is not defined.
11929 .It Ev SOURCE_DATE_EPOCH
11930 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
11931 used in place of the current time.
11932 This variable is looked up upon program startup, and its existence will
11933 switch \*(UA to a completely reproducible mode which causes
11934 deterministic random numbers, a special fixed (non-existent?)
11935 .Ev LOGNAME
11936 and more to be used and set.
11937 It is to be used during development or by software packagers.
11938 \*(ID Currently an invalid setting is only ignored, rather than causing
11939 a program abortion.
11941 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
11944 .It Ev TERM
11945 \*(OP The terminal type for which output is to be prepared.
11946 For extended colour and font control please refer to
11947 .Sx "Coloured display" ,
11948 and for terminal management in general to
11949 .Sx "On terminal control and line editor" .
11952 .It Ev TMPDIR
11953 Used as directory for temporary files instead of
11954 .Pa /tmp ,
11955 if set, existent, accessible as well as read- and writable.
11956 This variable is only used when it resides in the process environment,
11957 but \*(UA will ensure at startup that this environment variable is
11958 updated to contain a usable temporary directory.
11961 .It Ev USER
11962 Identical to
11963 .Ev LOGNAME
11964 (see there), but this variable is not standardized, should therefore not
11965 be used, and is only corrected if already set.
11968 .It Ev VISUAL
11969 Pathname of the text editor to use in the
11970 .Ic visual
11971 command and
11972 .Ic ~v
11973 .Sx "COMMAND ESCAPES" .
11976 .\" }}}
11979 .\" .Sh FILES {{{
11980 .Sh FILES
11982 .\" file list {{{
11983 .Bl -tag -width ".It Pa BaNg"
11984 .It Pa \*(ur
11985 File giving initial commands, one of the
11986 .Sx "Resource files" .
11988 .It Pa \*(UR
11989 System wide initialization file, one of the
11990 .Sx "Resource files" .
11993 .It Pa ~/.mailcap
11994 \*(OP Personal MIME type handler definition file, see
11995 .Sx "The Mailcap files" .
11996 This location is part of the RFC 1524 standard search path, which is
11997 a configuration option and can be overridden via
11998 .Ev MAILCAPS .
12001 .It Pa /etc/mailcap
12002 \*(OP System wide MIME type handler definition file, see
12003 .Sx "The Mailcap files" .
12004 This location is part of the RFC 1524 standard search path, which is
12005 a configuration option and can be overridden via
12008 .It Pa ~/mbox
12009 The default value for
12010 .Ev MBOX .
12011 The actually used path is a configuration option.
12014 .It Pa ~/.mime.types
12015 Personal MIME types, see
12016 .Sx "The mime.types files" .
12017 The actually used path is a configuration option.
12020 .It Pa /etc/mime.types
12021 System wide MIME types, see
12022 .Sx "The mime.types files" .
12023 The actually used path is a configuration option.
12026 .It Pa ~/.netrc
12027 \*(IN\*(OP The default location of the users
12028 .Pa .netrc
12029 file \(en the section
12030 .Sx "The .netrc file"
12031 documents the file format.
12032 The actually used path is a configuration option and can be overridden via
12033 .Ev NETRC .
12036 .It Pa /dev/null
12037 The data sink
12038 .Xr null 4 .
12039 The actually used path is a compile-time constant.
12041 .\" }}}
12043 .\" .Ss "Resource files" {{{
12044 .Ss "Resource files"
12046 Upon startup \*(UA reads in several resource files:
12048 .Bl -tag -width ".It Pa BaNg"
12050 .It Pa \*(UR
12051 System wide initialization file.
12052 Reading of this file can be suppressed, either by using the
12053 .Fl \&:
12054 (and according argument) or
12055 .Fl n
12056 command line options, or by setting the
12057 .Sx ENVIRONMENT
12058 variable
12059 .Ev MAILX_NO_SYSTEM_RC .
12062 .It Pa \*(ur
12063 File giving initial commands.
12064 A different file can be chosen by setting the
12065 .Sx ENVIRONMENT
12066 variable
12067 .Ev MAILRC .
12068 Reading of this file can be suppressed with the
12069 .Fl \&:
12070 command line option.
12072 .It Va mailx-extra-rc
12073 Defines a startup file to be read after all other resource files.
12074 It can be used to specify settings that are not understood by other
12075 .Xr mailx 1
12076 implementations, for example.
12077 This variable is only honoured when defined in a resource file, e.g.,
12078 it is one of the
12079 .Sx "INTERNAL VARIABLES" .
12083 The content of these files is interpreted as follows:
12086 .Bl -bullet -compact
12088 The whitespace characters space, tabulator and newline,
12089 as well as those defined by the variable
12090 .Va ifs ,
12091 are removed from the beginning and end of input lines.
12093 Empty lines are ignored.
12095 Any other line is interpreted as a command.
12096 It may be spread over multiple input lines if the newline character is
12097 .Dq escaped
12098 by placing a reverse solidus character
12099 .Ql \e
12100 as the last character of the line; whereas any leading whitespace of
12101 follow lines is ignored, trailing whitespace before a escaped newline
12102 remains in the input.
12104 If the line (content) starts with the number sign
12105 .Ql #
12106 then it is a comment-command and also ignored.
12107 (The comment-command is a real command, which does nothing, and
12108 therefore the usual follow lines mechanism applies!)
12112 Unless \*(UA is about to enter interactive mode syntax errors that occur
12113 while loading these files are treated as errors and cause program exit.
12114 More files with syntactically equal content can be
12115 .Ic source Ns ed .
12116 The following, saved in a file, would be an examplary content:
12118 .Bd -literal -offset indent
12119  # This line is a comment command.  And y\e
12120     es, it is really continued here.
12121 set debug \e
12122     verbose
12123     set editheaders
12125 .\" }}}
12127 .\" .Ss "The mime.types files" {{{
12128 .Ss "The mime.types files"
12130 As stated in
12131 .Sx "HTML mail and MIME attachments"
12132 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
12133 media types in order to classify message and attachment content.
12134 One source for them are
12135 .Pa mime.types
12136 files, the loading of which can be controlled by setting the variable
12137 .Va mimetypes-load-control .
12138 Another is the command
12139 .Ic mimetype ,
12140 which also offers access to \*(UAs MIME type cache.
12141 .Pa mime.types
12142 files have the following syntax:
12144 .Bd -literal -offset indent
12145 type/subtype extension [extension ...]
12146 # E.g., text/html html htm
12150 where
12151 .Ql type/subtype
12152 define the MIME media type, as standardized in RFC 2046:
12153 .Ql type
12154 is used to declare the general type of data, while the
12155 .Ql subtype
12156 specifies a specific format for that type of data.
12157 One or multiple filename
12158 .Ql extension Ns
12159 s, separated by whitespace, can be bound to the media type format.
12160 Comments may be introduced anywhere on a line with a number sign
12161 .Ql # ,
12162 causing the remaining line to be discarded.
12164 \*(UA also supports an extended, non-portable syntax in especially
12165 crafted files, which can be loaded via the alternative value syntax of
12166 .Va mimetypes-load-control ,
12167 and prepends an optional
12168 .Ql type-marker :
12171 .Dl [type-marker ]type/subtype extension [extension ...]
12174 The following type markers are supported:
12177 .Bl -tag -compact -width ".It Ar _n_u"
12178 .It Ar @
12179 Treat message parts with this content as plain text.
12180 .It Ar @t
12181 The same as plain
12182 .Ar @ .
12183 .It Ar @h
12184 Treat message parts with this content as HTML tagsoup.
12185 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
12186 the content as plain text instead.
12187 .It Ar @H
12188 Likewise
12189 .Ar @h ,
12190 but instead of falling back to plain text require an explicit content
12191 handler to be defined.
12192 .It Ar @q
12193 If no handler can be found a text message is displayed which says so.
12194 This can be annoying, for example signatures serve a contextual purpose,
12195 their content is of no use by itself.
12196 This marker will avoid displaying the text message.
12200 Further reading:
12201 for sending messages:
12202 .Ic mimetype ,
12203 .Va mime-allow-text-controls ,
12204 .Va mimetypes-load-control .
12205 For reading etc. messages:
12206 .Sx "HTML mail and MIME attachments" ,
12207 .Sx "The Mailcap files" ,
12208 .Ic mimetype ,
12209 .Va mime-counter-evidence ,
12210 .Va mimetypes-load-control ,
12211 .Va pipe-TYPE/SUBTYPE ,
12212 .Va pipe-EXTENSION .
12213 .\" }}}
12215 .\" .Ss "The Mailcap files" {{{
12216 .Ss "The Mailcap files"
12218 .\" TODO MAILCAP DISABLED
12219 .Sy This feature is not available in v14.9.0, sorry!
12220 RFC 1524 defines a
12221 .Dq User Agent Configuration Mechanism
12222 which \*(UA \*(OPally supports (see
12223 .Sx "HTML mail and MIME attachments" ) .
12224 It defines a file format to be used to inform mail user agent programs
12225 about the locally-installed facilities for handling various data
12226 formats, i.e., about commands and how they can be used to display, edit
12227 et cetera MIME part contents, as well as a default path search that
12228 includes multiple possible locations of
12229 .Dq mailcap
12230 files and the
12231 .Ev MAILCAPS
12232 environment variable that can be used to overwrite that (repeating here
12233 that it is not a search path, but instead a path search specification).
12234 Any existing files will be loaded in sequence, appending any content to
12235 the list of MIME type handler directives.
12238 .Dq Mailcap
12239 files consist of a set of newline separated entries.
12240 Comment lines start with a number sign
12241 .Ql #
12242 (in the first column!) and are ignored.
12243 Empty lines are also ignored.
12244 All other lines form individual entries that must adhere to the syntax
12245 described below.
12246 To extend a single entry (not comment) its line can be continued on
12247 follow lines if newline characters are
12248 .Dq escaped
12249 by preceding them with the reverse solidus character
12250 .Ql \e .
12251 The standard does not specify how leading whitespace of follow lines
12252 is to be treated, therefore \*(UA retains it.
12255 .Dq Mailcap
12256 entries consist of a number of semicolon
12257 .Ql \&;
12258 separated fields, and the reverse solidus
12259 .Ql \e
12260 character can be used to escape any following character including
12261 semicolon and itself.
12262 The first two fields are mandatory and must occur in the specified
12263 order, the remaining fields are optional and may appear in any order.
12264 Leading and trailing whitespace of content is ignored (removed).
12267 The first field defines the MIME
12268 .Ql TYPE/SUBTYPE
12269 the entry is about to handle (case-insensitively, and no reverse solidus
12270 escaping is possible in this field).
12271 If the subtype is specified as an asterisk
12272 .Ql *
12273 the entry is meant to match all subtypes of the named type, e.g.,
12274 .Ql audio/*
12275 would match any audio type.
12276 The second field defines the shell command which shall be used to
12277 .Dq display
12278 MIME parts of the given type; it is implicitly called the
12279 .Cd view
12280 command.
12283 For data
12284 .Dq consuming
12285 shell commands message (MIME part) data is passed via standard input
12286 unless the given shell command includes one or more instances of the
12287 (unquoted) string
12288 .Ql %s ,
12289 in which case these instances will be replaced with a temporary filename
12290 and the data will have been stored in the file that is being pointed to.
12291 Likewise, for data
12292 .Dq producing
12293 shell commands data is assumed to be generated on standard output unless
12294 the given command includes (one ore multiple)
12295 .Ql %s .
12296 In any case any given
12297 .Ql %s
12298 format is replaced with a(n already) properly quoted filename.
12299 Note that when a command makes use of a temporary file via
12300 .Ql %s
12301 then \*(UA will remove it again, as if the
12302 .Cd x-mailx-tmpfile ,
12303 .Cd x-mailx-tmpfile-fill
12305 .Cd x-mailx-tmpfile-unlink
12306 flags had been set; see below for more.
12309 The optional fields either define a shell command or an attribute (flag)
12310 value, the latter being a single word and the former being a keyword
12311 naming the field followed by an equals sign
12312 .Ql =
12313 succeeded by a shell command, and as usual for any
12314 .Dq Mailcap
12315 content any whitespace surrounding the equals sign will be removed, too.
12316 Optional fields include the following:
12319 .Bl -tag -width ".It Cd BaNg"
12320 .It Cd compose
12321 A program that can be used to compose a new body or body part in the
12322 given format.
12323 (Currently unused.)
12325 .It Cd composetyped
12326 Similar to the
12327 .Cd compose
12328 field, but is to be used when the composing program needs to specify the
12329 .Ql Content-type:
12330 header field to be applied to the composed data.
12331 (Currently unused.)
12333 .It Cd edit
12334 A program that can be used to edit a body or body part in the given
12335 format.
12336 (Currently unused.)
12338 .It Cd print
12339 A program that can be used to print a message or body part in the given
12340 format.
12341 (Currently unused.)
12343 .It Cd test
12344 Specifies a program to be run to test some condition, e.g., the machine
12345 architecture, or the window system in use, to determine whether or not
12346 this mailcap entry applies.
12347 If the test fails, a subsequent mailcap entry should be sought; also see
12348 .Cd x-mailx-test-once .
12351 .It Cd needsterminal
12352 This flag field indicates that the given shell command must be run on
12353 an interactive terminal.
12354 \*(UA will temporarily release the terminal to the given command in
12355 interactive mode, in non-interactive mode this entry will be entirely
12356 ignored; this flag implies
12357 .Cd x-mailx-noquote .
12360 .It Cd copiousoutput
12361 A flag field which indicates that the output of the
12362 .Cd view
12363 command will be an extended stream of textual output that can be
12364 (re)integrated into \*(UA's normal visual display.
12365 It is mutually exclusive with
12366 .Cd needsterminal .
12368 .It Cd textualnewlines
12369 A flag field which indicates that this type of data is line-oriented and
12370 that, if encoded in
12371 .Ql base64 ,
12372 all newlines should be converted to canonical form (CRLF) before
12373 encoding, and will be in that form after decoding.
12374 (Currently unused.)
12376 .It Cd nametemplate
12377 This field gives a filename format, in which
12378 .Ql %s
12379 will be replaced by a random string, the joined combination of which
12380 will be used as the filename denoted by
12381 .Ev MAILX_FILENAME_TEMPORARY .
12382 One could specify that a GIF file being passed to an image viewer should
12383 have a name ending in
12384 .Ql .gif
12385 by using
12386 .Ql nametemplate=%s.gif .
12387 Note that \*(UA ignores the name template unless that solely specifies
12388 a filename suffix that consists of (ASCII) alphabetic and numeric
12389 characters, the underscore and dot only.
12391 .It Cd x11-bitmap
12392 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
12393 icon to be used to visually denote the presence of this kind of data.
12394 This field is not used by \*(UA.
12396 .It Cd description
12397 A textual description that describes this type of data.
12400 .It Cd x-mailx-even-if-not-interactive
12401 An extension flag test field \(em by default handlers without
12402 .Cd copiousoutput
12403 are entirely ignored in non-interactive mode, but if this flag is set
12404 then their use will be considered.
12405 It is an error if this flag is set for commands that use the flag
12406 .Cd needsterminal .
12409 .It Cd x-mailx-noquote
12410 An extension flag field that indicates that even a
12411 .Cd copiousoutput
12412 .Cd view
12413 command shall not be used to generate message quotes
12414 (as it would be by default).
12417 .It Cd x-mailx-async
12418 Extension flag field that denotes that the given
12419 .Cd view
12420 command shall be executed asynchronously, without blocking \*(UA.
12421 Cannot be used in conjunction with
12422 .Cd needsterminal .
12425 .It Cd x-mailx-test-once
12426 Extension flag which denotes whether the given
12427 .Cd test
12428 command shall be evaluated once only and the (boolean) result be cached.
12429 This is handy if some global unchanging condition is to be queried, like
12430 .Dq running under the X Window System .
12433 .It Cd x-mailx-tmpfile
12434 Extension flag field that requests creation of a zero-sized temporary
12435 file, the name of which is to be placed in the environment variable
12436 .Ev MAILX_FILENAME_TEMPORARY .
12437 It is an error to use this flag with commands that include a
12438 .Ql %s
12439 format.
12442 .It Cd x-mailx-tmpfile-fill
12443 Normally the MIME part content is passed to the handler via standard
12444 input; if this flag is set then the data will instead be written into
12445 the implied
12446 .Cd x-mailx-tmpfile .
12447 In order to cause deletion of the temporary file you will have to set
12448 .Cd x-mailx-tmpfile-unlink
12449 explicitly!
12450 It is an error to use this flag with commands that include a
12451 .Ql %s
12452 format.
12455 .It Cd x-mailx-tmpfile-unlink
12456 Extension flag field that requests that the temporary file shall be
12457 deleted automatically when the command loop is entered again at latest.
12458 (Do not use this for asynchronous handlers.)
12459 It is an error to use this flag with commands that include a
12460 .Ql %s
12461 format, or in conjunction with
12462 .Cd x-mailx-async ,
12463 or without also setting
12464 .Cd x-mailx-tmpfile
12466 .Cd x-mailx-tmpfile-fill .
12469 .It Cd x-mailx-tmpfile-keep
12470 Using the string
12471 .Ql %s
12472 implies the three tmpfile related flags above, but if you want, e.g.,
12473 .Cd x-mailx-async
12474 and deal with the temporary file yourself, you can add in this flag to
12475 forcefully ignore
12476 .Cd x-mailx-tmpfile-unlink .
12481 The standard includes the possibility to define any number of additional
12482 entry fields, prefixed by
12483 .Ql x- .
12484 Flag fields apply to the entire
12485 .Dq Mailcap
12486 entry \(em in some unusual cases, this may not be desirable, but
12487 differentiation can be accomplished via separate entries, taking
12488 advantage of the fact that subsequent entries are searched if an earlier
12489 one does not provide enough information.
12490 E.g., if a
12491 .Cd view
12492 command needs to specify the
12493 .Cd needsterminal
12494 flag, but the
12495 .Cd compose
12496 command shall not, the following will help out the latter (with enabled
12497 .Va debug
12498 or an increased
12499 .Va verbose
12500 level \*(UA will show information about handler evaluation):
12502 .Bd -literal -offset indent
12503 application/postscript; ps-to-terminal %s; needsterminal
12504 application/postscript; ps-to-terminal %s; compose=idraw %s
12508 In fields any occurrence of the format string
12509 .Ql %t
12510 will be replaced by the
12511 .Ql TYPE/SUBTYPE
12512 specification.
12513 Named parameters from the
12514 .Ql Content-type:
12515 field may be placed in the command execution line using
12516 .Ql %{
12517 followed by the parameter name and a closing
12518 .Ql }
12519 character.
12520 The entire parameter should appear as a single command line argument,
12521 regardless of embedded spaces; thus:
12523 .Bd -literal -offset indent
12524 # Message
12525 Content-type:  multipart/mixed; boundary=42
12527 # Mailcap file
12528 multipart/*; /usr/local/bin/showmulti \e
12529   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
12531 # Executed shell command
12532 /usr/local/bin/showmulti multipart/mixed 42
12536 .\" TODO v15: Mailcap: %n,%F
12537 Note that \*(UA does not support handlers for multipart MIME parts as
12538 shown in this example (as of today).
12539 \*(UA does not support the additional formats
12540 .Ql %n
12542 .Ql %F .
12543 An example file, also showing how to properly deal with the expansion of
12544 .Ql %s ,
12545 which includes any quotes that are necessary to make it a valid shell
12546 argument by itself and thus will cause undesired behaviour when placed
12547 in additional user-provided quotes:
12549 .Bd -literal -offset indent
12550 # Comment line
12551 text/richtext; richtext %s; copiousoutput
12553 text/x-perl; perl -cWT %s
12555 application/pdf; \e
12556   infile=%s\e; \e
12557     trap "rm -f ${infile}" EXIT\e; \e
12558     trap "exit 75" INT QUIT TERM\e; \e
12559     mupdf %s; \e
12560   x-mailx-async; x-mailx-tmpfile-keep
12562 application/*; echo "This is \e"%t\e" but \e
12563     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
12564   copiousoutput; x-mailx-noquote
12568 Further reading:
12569 .Sx "HTML mail and MIME attachments" ,
12570 .Sx "The mime.types files" ,
12571 .Ic mimetype ,
12572 .Ev MAILCAPS ,
12573 .Va mime-counter-evidence ,
12574 .Va pipe-TYPE/SUBTYPE ,
12575 .Va pipe-EXTENSION .
12576 .\" }}}
12578 .\" .Ss "The .netrc file" {{{
12579 .Ss "The .netrc file"
12582 .Pa .netrc
12583 file contains user credentials for machine accounts.
12584 The default location in the user's
12585 .Ev HOME
12586 directory may be overridden by the
12587 .Ev NETRC
12588 environment variable.
12589 The file consists of space, tabulator or newline separated tokens.
12590 \*(UA implements a parser that supports a superset of the original BSD
12591 syntax, but users should nonetheless be aware of portability glitches
12592 of that file format, shall their
12593 .Pa .netrc
12594 be usable across multiple programs and platforms:
12597 .Bl -bullet -compact
12599 BSD does not support single, but only double quotation marks, e.g.,
12600 .Ql password="pass with spaces" .
12602 BSD (only?) supports escaping of single characters via a reverse solidus
12603 (e.g., a space can be escaped via
12604 .Ql \e\0 ) ,
12605 in- as well as outside of a quoted string.
12607 BSD does not require a final quotation mark of the last user input token.
12609 The original BSD (Berknet) parser also supported a format which allowed
12610 tokens to be separated with commas \(en whereas at least Hewlett-Packard
12611 still seems to support this syntax, \*(UA does not!
12613 As a non-portable extension some widely-used programs support
12614 shell-style comments: if an input line starts, after any amount of
12615 whitespace, with a number sign
12616 .Ql # ,
12617 then the rest of the line is ignored.
12619 Whereas other programs may require that the
12620 .Pa .netrc
12621 file is accessible by only the user if it contains a
12622 .Cd password
12623 token for any other
12624 .Cd login
12625 than
12626 .Dq anonymous ,
12627 \*(UA will always require these strict permissions.
12631 Of the following list of supported tokens \*(UA only uses (and caches)
12632 .Cd machine ,
12633 .Cd login
12635 .Cd password .
12636 At runtime the command
12637 .Ic netrc
12638 can be used to control \*(UA's
12639 .Pa .netrc
12640 cache.
12642 .Bl -tag -width ".It Cd BaNg"
12643 .It Cd machine Ar name
12644 The hostname of the entries' machine, lowercase-normalized by \*(UA
12645 before use.
12646 Any further file content, until either end-of-file or the occurrence
12647 of another
12648 .Cd machine
12649 or a
12650 .Cd default
12651 first-class token is bound (only related) to the machine
12652 .Ar name .
12654 As an extension that should not be the cause of any worries
12655 \*(UA supports a single wildcard prefix for
12656 .Ar name :
12657 .Bd -literal -offset indent
12658 machine *.example.com login USER password PASS
12659 machine pop3.example.com login USER password PASS
12660 machine smtp.example.com login USER password PASS
12663 which would match
12664 .Ql xy.example.com
12665 as well as
12666 .Ql pop3.example.com ,
12667 but neither
12668 .Ql example.com
12670 .Ql local.smtp.example.com .
12671 Note that in the example neither
12672 .Ql pop3.example.com
12674 .Ql smtp.example.com
12675 will be matched by the wildcard, since the exact matches take
12676 precedence (it is however faster to specify it the other way around).
12678 .It Cd default
12679 This is the same as
12680 .Cd machine
12681 except that it is a fallback entry that is used shall none of the
12682 specified machines match; only one default token may be specified,
12683 and it must be the last first-class token.
12685 .It Cd login Ar name
12686 The user name on the remote machine.
12688 .It Cd password Ar string
12689 The user's password on the remote machine.
12691 .It Cd account Ar string
12692 Supply an additional account password.
12693 This is merely for FTP purposes.
12695 .It Cd macdef Ar name
12696 Define a macro.
12697 A macro is defined with the specified
12698 .Ar name ;
12699 it is formed from all lines beginning with the next line and continuing
12700 until a blank line is (consecutive newline characters are) encountered.
12701 (Note that
12702 .Cd macdef
12703 entries cannot be utilized by multiple machines, too, but must be
12704 defined following the
12705 .Ic machine
12706 they are intended to be used with.)
12707 If a macro named
12708 .Ar init
12709 exists, it is automatically run as the last step of the login process.
12710 This is merely for FTP purposes.
12712 .\" }}}
12714 .\" }}}
12717 .\" .Sh EXAMPLES {{{
12718 .Sh EXAMPLES
12720 .\" .Ss "An example configuration" {{{
12721 .Ss "An example configuration"
12723 .Bd -literal -offset indent
12724 # This example assumes v15.0 compatibility mode
12725 set v15-compat
12727 # Request strict transport security checks!
12728 set ssl-verify=strict
12730 # Where are the up-to-date SSL certificates?
12731 # (Since we manage up-to-date ones explicitly, do not use any,
12732 # possibly outdated, default certificates shipped with OpenSSL)
12733 #set ssl-ca-dir=/etc/ssl/certs
12734 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
12735 set ssl-ca-no-defaults
12736 #set ssl-ca-flags=partial-chain
12737 wysh set smime-ca-file="${ssl-ca-file}" \e
12738   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
12740 # Do not use protocols older than TLS v1.2.
12741 # Change this only when the remote server does not support it:
12742 # maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
12743 # such explicit exceptions, then, e.g.
12744 #   set ssl-protocol-exam.ple='-ALL,+TLSv1.1'
12745 set ssl-protocol='-ALL,+TLSv1.2'
12747 # Explicitly define the list of ciphers, which may improve security,
12748 # especially with protocols older than TLS v1.2.  See ciphers(1).
12749 # Including "@STRENGTH" will sort the final list by algorithm strength.
12750 # In reality it is possibly best to only use ssl-cipher-list-HOST
12751 # (or -USER@HOST), as necessary, again..
12752 set ssl-cipher-list=TLSv1.2:!aNULL:!eNULL:@STRENGTH
12754 # - TLSv1.2:!aNULL:!eNULL:\e
12755 #     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
12756 #     DHE-RSA-AES256-SHA:@STRENGTH
12757 # -ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH
12758 # Especially with TLSv1.3 curves selection may be desired:
12759 #set ssl-curves=P-521:P-384:P-256
12761 # Essential setting: select allowed character sets
12762 set sendcharsets=utf-8,iso-8859-1
12764 # A very kind option: when replying to a message, first try to
12765 # use the same encoding that the original poster used herself!
12766 set reply-in-same-charset
12768 # When replying, do not merge From: and To: of the original message
12769 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
12770 set recipients-in-cc
12772 # When sending messages, wait until the Mail-Transfer-Agent finishs.
12773 # Only like this you will be able to see errors reported through the
12774 # exit status of the MTA (including the built-in SMTP one)!
12775 set sendwait
12777 # Only use built-in MIME types, no mime.types(5) files
12778 set mimetypes-load-control
12780 # Default directory where we act in (relative to $HOME)
12781 set folder=mail
12782 # A leading "+" (often) means: under *folder*
12783 # *record* is used to save copies of sent messages
12784 set MBOX=+mbox.mbox DEAD=+dead.txt \e
12785   record=+sent.mbox record-files record-resent
12787 # Make "file mymbox" and "file myrec" go to..
12788 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
12790 # Not really optional, e.g., for S/MIME
12791 set from='Your Name <address@exam.ple>'
12793 # It may be necessary to set hostname and/or smtp-hostname
12794 # if the "SERVER" of mta and "domain" of from do not match.
12795 # The `urlencode' command can be used to encode USER and PASS
12796 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
12797   smtp-auth=login/plain... \e
12798   smtp-use-starttls
12800 # Never refuse to start into interactive mode, and more
12801 set emptystart \e
12802   colour-pager crt= \e
12803   followup-to followup-to-honour=ask-yes fullnames \e
12804   history-file=+.\*(uAhist history-size=-1 history-gabby \e
12805   mime-counter-evidence=0xE \e
12806   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
12807   reply-to-honour=ask-yes \e
12808   umask=
12810 # Only include the selected header fields when typing messages
12811 headerpick type retain from_ date from to cc subject \e
12812   message-id mail-followup-to reply-to
12813 # ...when forwarding messages
12814 headerpick forward retain subject date from to cc
12815 # ...when saving message, etc.
12816 #headerpick save ignore ^Original-.*$ ^X-.*$
12818 # Some mailing lists
12819 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
12820 mlsubscribe '^xfans@xfans\e.xyz$'
12822 # Handle a few file extensions (to store MBOX databases)
12823 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
12824   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
12825   zst 'zstd -dc' 'zstd -19 -zc' \e
12826   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
12828 # A real life example of a very huge free mail provider
12829 # Instead of directly placing content inside `account',
12830 # we `define' a macro: like that we can switch "accounts"
12831 # from within *on-compose-splice*, for example!
12832 define XooglX {
12833   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
12834   set from='Your Name <address@examp.ple>'
12836   set pop3-no-apop-pop.gmXil.com
12837   shortcut pop %:pop3s://pop.gmXil.com
12838   shortcut imap %:imaps://imap.gmXil.com
12840   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
12841   # Alternatively:
12842   set mta=smtps://USER:PASS@smtp.gmail.com:465
12844 account XooglX {
12845   \ecall XooglX
12848 # Here is a pretty large one which does not allow sending mails
12849 # if there is a domain name mismatch on the SMTP protocol level,
12850 # which would bite us if the value of from does not match, e.g.,
12851 # for people who have a sXXXXeforge project and want to speak
12852 # with the mailing list under their project account (in from),
12853 # still sending the message through their normal mail provider
12854 define XandeX {
12855   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12856   set from='Your Name <address@exam.ple>'
12858   shortcut pop %:pop3s://pop.yaXXex.com
12859   shortcut imap %:imaps://imap.yaXXex.com
12861   set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e
12862     hostname=yaXXex.com smtp-hostname=
12864 account XandeX {
12865   \ecall Xandex
12868 # Create some new commands so that, e.g., `ls /tmp' will..
12869 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
12870 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
12872 # We do not support gpg(1) directly yet.  But simple --clearsign'd
12873 # message parts can be dealt with as follows:
12874 define V {
12875   localopts yes
12876   wysh set pipe-text/plain=$'@*#++=@\e
12877     < "${MAILX_FILENAME_TEMPORARY}" awk \e
12878         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
12879       BEGIN{done=0}\e
12880       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
12881         if(done++ != 0)\e
12882           next;\e
12883         print "--- GPG --verify ---";\e
12884         system("gpg --verify " TMPFILE " 2>&1");\e
12885         print "--- GPG --verify ---";\e
12886         print "";\e
12887         next;\e
12888       }\e
12889       /^-----BEGIN PGP SIGNATURE-----/,\e
12890           /^-----END PGP SIGNATURE-----/{\e
12891         next;\e
12892       }\e
12893       {print}\e
12894     \e''
12895     print
12897 commandalias V '\e'call V
12901 When storing passwords in
12902 .Pa \*(ur
12903 appropriate permissions should be set on this file with
12904 .Ql $ chmod 0600 \*(ur .
12905 If the \*(OPal
12906 .Va netrc-lookup
12907 is available user credentials can be stored in the central
12908 .Pa .netrc
12909 file instead; e.g., here is a different version of the example account
12910 that sets up SMTP and POP3:
12912 .Bd -literal -offset indent
12913 define XandeX {
12914   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12915   set from='Your Name <address@exam.ple>'
12916   set netrc-lookup
12917   # Load an encrypted ~/.netrc by uncommenting the next line
12918   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
12920   set mta=smtps://smtp.yXXXXx.ru:465 \e
12921       smtp-hostname= hostname=yXXXXx.com
12922   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
12923   commandalias xp fi pop3s://pop.yXXXXx.ru
12925 account XandeX {
12926   \ecall XandeX
12931 and, in the
12932 .Pa .netrc
12933 file:
12935 .Bd -literal -offset indent
12936 machine *.yXXXXx.ru login USER password PASS
12940 This configuration should now work just fine:
12943 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
12944 .\" }}}
12946 .\" .Ss "S/MIME step by step" {{{
12947 .Ss "S/MIME step by step"
12949 \*(OP The first thing you need for participating in S/MIME message
12950 exchange is your personal certificate, including a private key.
12951 The certificate contains public information, in particular your name and
12952 your email address(es), and the public key that is used by others to
12953 encrypt messages for you,
12954 and to verify signed messages they supposedly received from you.
12955 The certificate is included in each signed message you send.
12956 The private key must be kept secret.
12957 It is used to decrypt messages that were previously encrypted with your
12958 public key, and to sign messages.
12961 For personal use it is recommended that you get a S/MIME certificate
12962 from one of the major CAs on the Internet using your WWW browser.
12963 Many CAs offer such certificates for free.
12964 There is also
12965 .Lk https://www.CAcert.org
12966 which issues client and server certificates to members of their
12967 community for free; their root certificate
12968 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
12969 is often not in the default set of trusted CA root certificates, though,
12970 which means you will have to download their root certificate separately
12971 and ensure it is part of our S/MIME certificate validation chain by
12972 including it in
12973 .Va smime-ca-dir
12974 or as a vivid member of the
12975 .Va smime-ca-file .
12976 But let us take a step-by-step tour on how to setup S/MIME with
12977 a certificate from CAcert.org despite this situation!
12980 First of all you will have to become a member of the CAcert.org
12981 community, simply by registrating yourself via the web interface.
12982 Once you are, create and verify all email addresses you want to be able
12983 to create signed and encrypted messages for/with using the corresponding
12984 entries of the web interface.
12985 Now ready to create S/MIME certificates, so let us create a new
12986 .Dq client certificate ,
12987 ensure to include all email addresses that should be covered by the
12988 certificate in the following web form, and also to use your name as the
12989 .Dq common name .
12992 Create a private key and a certificate request on your local computer
12993 (please see the manual pages of the used commands for more in-depth
12994 knowledge on what the used arguments etc. do):
12997 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
13000 Afterwards copy-and-paste the content of
13001 .Dq creq.pem
13002 into the certificate-request (CSR) field of the web form on the
13003 CAcert.org website (you may need to unfold some
13004 .Dq advanced options
13005 to see the corresponding text field).
13006 This last step will ensure that your private key (which never left your
13007 box) and the certificate belong together (through the public key that
13008 will find its way into the certificate via the certificate-request).
13009 You are now ready and can create your CAcert certified certificate.
13010 Download and store or copy-and-paste it as
13011 .Dq pub.crt .
13014 Yay.
13015 In order to use your new S/MIME setup a combined private key/public key
13016 (certificate) file has to be created:
13019 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
13022 This is the file \*(UA will work with.
13023 If you have created your private key with a passphrase then \*(UA will
13024 ask you for it whenever a message is signed or decrypted.
13025 Set the following variables to henceforth use S/MIME (setting
13026 .Va smime-ca-file
13027 is of interest for verification only):
13029 .Bd -literal -offset indent
13030 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
13031     smime-sign-cert=ME@HERE.com.paired \e
13032     smime-sign-message-digest=SHA256 \e
13033     smime-sign
13036 .\" }}}
13038 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
13039 .Ss "Using CRLs with S/MIME or SSL/TLS"
13041 \*(OP Certification authorities (CAs) issue certificate revocation
13042 lists (CRLs) on a regular basis.
13043 These lists contain the serial numbers of certificates that have been
13044 declared invalid after they have been issued.
13045 Such usually happens because the private key for the certificate has
13046 been compromised,
13047 because the owner of the certificate has left the organization that is
13048 mentioned in the certificate, etc.
13049 To seriously use S/MIME or SSL/TLS verification,
13050 an up-to-date CRL is required for each trusted CA.
13051 There is otherwise no method to distinguish between valid and
13052 invalidated certificates.
13053 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
13054 the Internet, so they have to be retrieved by some external mechanism.
13057 \*(UA accepts CRLs in PEM format only;
13058 CRLs in DER format must be converted, like, e.\|g.:
13061 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
13064 To tell \*(UA about the CRLs, a directory that contains all CRL files
13065 (and no other files) must be created.
13067 .Va smime-crl-dir
13069 .Va ssl-crl-dir
13070 variables, respectively, must then be set to point to that directory.
13071 After that, \*(UA requires a CRL to be present for each CA that is used
13072 to verify a certificate.
13073 .\" }}}
13075 .\" }}} (Examples)
13078 .\" .Sh "FAQ" {{{
13079 .Sh "FAQ"
13081 In general it is a good idea to turn on
13082 .Va debug
13083 .Pf ( Fl d )
13084 and / or
13085 .Va verbose
13086 .Pf ( Fl v ,
13087 twice) if something does not work well.
13088 Very often a diagnostic message can be produced that leads to the
13089 problems' solution.
13091 .\" .Ss "\*(UA shortly hangs on startup" {{{
13092 .Ss "\*(UA shortly hangs on startup"
13094 This can have two reasons, one is the necessity to wait for a file lock
13095 and cannot be helped, the other being that \*(UA calls the function
13096 .Xr uname 2
13097 in order to query the nodename of the box (sometimes the real one is
13098 needed instead of the one represented by the internal variable
13099 .Va hostname ) .
13100 One may have varying success by ensuring that the real hostname and
13101 .Ql localhost
13102 have entries in
13103 .Pa /etc/hosts ,
13104 or, more generally, that the name service is properly setup \(en
13105 and does
13106 .Xr hostname 1
13107 return the expected value?
13108 Does this local hostname have a domain suffix?
13109 RFC 6762 standardized the link-local top-level domain
13110 .Ql .local ,
13111 try again after adding an (additional) entry with this extension.
13112 .\" }}}
13114 .\" .Ss "I cannot login to Google mail aka GMail" {{{
13115 .Ss "I cannot login to Google mail aka GMail"
13117 Since 2014 some free service providers classify programs as
13118 .Dq less secure
13119 unless they use a special authentification method (OAuth 2.0) which
13120 was not standardized for non-HTTP protocol authentication token query
13121 until August 2015 (RFC 7628).
13124 Different to Kerberos / GSSAPI, which is developed since the mid of the
13125 1980s, where a user can easily create a local authentication ticket for
13126 her- and himself with the locally installed
13127 .Xr kinit 1
13128 program, that protocol has no such local part but instead requires
13129 a world-wide-web query to create or fetch a token; since there is no
13130 local cache this query would have to be performed whenever \*(UA is
13131 invoked (in interactive sessions situation may differ).
13134 \*(UA does not support OAuth.
13135 Because of this it is necessary to declare \*(UA a
13136 .Dq less secure app
13137 (on the providers account web page) in order to read and send mail.
13138 However, it also seems possible to take the following steps instead:
13141 .Bl -enum -compact
13143 give the provider the number of a mobile phone,
13145 enable
13146 .Dq 2-Step Verification ,
13148 create an application specific password (16 characters), and
13150 use that special password instead of the real Google account password in
13151 \*(UA (for more on that see the section
13152 .Sx "On URL syntax and credential lookup" ) .
13154 .\" }}}
13156 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
13157 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
13159 It can happen that the terminal library (see
13160 .Sx "On terminal control and line editor",
13161 .Ic bind ,
13162 .Va termcap )
13163 reports different codes than the terminal really sends, in which case
13164 \*(UA will tell that a key binding is functional, but will not be able to
13165 recognize it because the received data does not match anything expected.
13166 Especially without the \*(OPal terminal capability library support one
13167 reason for this may be that the (possibly even non-existing) keypad
13168 is not turned on and the resulting layout reports the keypad control
13169 codes for the normal keyboard keys.
13171 .Va verbose
13172 listing of
13173 .Ic bind Ns
13174 ings will show the byte sequences that are expected.
13177 To overcome the situation, use, e.g., the program
13178 .Xr cat 1 ,
13179 in conjunction with the command line option
13180 .Fl \&\&v ,
13181 if available, to see the byte sequences which are actually produced
13182 by keypresses, and use the variable
13183 .Va termcap
13184 to make \*(UA aware of them.
13185 E.g., the terminal this is typed on produces some false sequences, here
13186 an example showing the shifted home key:
13188 .Bd -literal -offset indent
13189 ? set verbose
13190 ? bind*
13191 # 1B 5B=[ 31=1 3B=; 32=2 48=H
13192   bind base :kHOM z0
13193 ? x
13194 $ cat -v
13195 ^[[H
13196 ? \*(uA -v -Stermcap='kHOM=\eE[H'
13197 ? bind*
13198 # 1B 5B=[ 48=H
13199   bind base :kHOM z0
13201 .\" }}}
13203 .\" }}}
13206 .\" .Sh "IMAP CLIENT" {{{
13207 .Sh "IMAP CLIENT"
13209 \*(OPally there is IMAP client support available.
13210 This part of the program is obsolete and will vanish in v15 with the
13211 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
13212 and makes excessive use of signal based long code jumps.
13213 Support can hopefully be readded later based on a new-style I/O, with
13214 SysV signal handling.
13215 In fact the IMAP support had already been removed from the codebase, but
13216 was reinstantiated on user demand: in effect the IMAP code is at the
13217 level of \*(UA v14.8.16 (with
13218 .Ic imapcodec
13219 being the sole exception), and should be treated with some care.
13222 IMAP uses the
13223 .Ql imap://
13225 .Ql imaps://
13226 protocol prefixes, and an IMAP-based
13227 .Va folder
13228 may be used.
13229 IMAP URLs (paths) undergo inspections and possible transformations
13230 before use (and the command
13231 .Ic imapcodec
13232 can be used to manually apply them to any given argument).
13233 Hierarchy delimiters are normalized, a step which is configurable via the
13234 .Va imap-delim
13235 variable chain, but defaults to the first seen delimiter otherwise.
13236 \*(UA supports internationalised IMAP names, and en- and decodes the
13237 names from and to the
13238 .Va ttycharset
13239 as necessary and possible.
13240 If a mailbox name is expanded (see
13241 .Sx "Filename transformations" )
13242 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
13243 mailboxes below the
13244 .Va folder
13245 target box, while folder names prefixed by `@' refer to folders below
13246 the hierarchy base.
13249 Note: some IMAP servers do not accept the creation of mailboxes in
13250 the hierarchy base, but require that they are created as subfolders of
13251 `INBOX' \(en with such servers a folder name of the form
13253 .Dl imaps://mylogin@imap.myisp.example/INBOX.
13255 should be used (the last character is the server's hierarchy
13256 delimiter).
13257 The following IMAP-specific commands exist:
13260 .Bl -tag -width ".It Ic BaNg"
13262 .It Ic cache
13263 Only applicable to cached IMAP mailboxes;
13264 takes a message list and reads the specified messages into the IMAP
13265 cache.
13268 .It Ic connect
13269 If operating in disconnected mode on an IMAP mailbox,
13270 switch to online mode and connect to the mail server while retaining
13271 the mailbox status.
13272 See the description of the
13273 .Va disconnected
13274 variable for more information.
13277 .It Ic disconnect
13278 If operating in online mode on an IMAP mailbox,
13279 switch to disconnected mode while retaining the mailbox status.
13280 See the description of the
13281 .Va disconnected
13282 variable for more.
13283 A list of messages may optionally be given as argument;
13284 the respective messages are then read into the cache before the
13285 connection is closed, thus
13286 .Ql disco *
13287 makes the entire mailbox available for disconnected use.
13290 .It Ic imap
13291 Sends command strings directly to the current IMAP server.
13292 \*(UA operates always in IMAP `selected state' on the current mailbox;
13293 commands that change this will produce undesirable results and should be
13294 avoided.
13295 Useful IMAP commands are:
13296 .Bl -tag -offset indent -width ".Ic getquotearoot"
13297 .It create
13298 Takes the name of an IMAP mailbox as an argument and creates it.
13299 .It getquotaroot
13300 (RFC 2087) Takes the name of an IMAP mailbox as an argument
13301 and prints the quotas that apply to the mailbox.
13302 Not all IMAP servers support this command.
13303 .It namespace
13304 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
13305 the Other User's Namespaces and the Shared Namespaces.
13306 Each namespace type is printed in parentheses;
13307 if there are multiple namespaces of the same type,
13308 inner parentheses separate them.
13309 For each namespace a prefix and a hierarchy separator is listed.
13310 Not all IMAP servers support this command.
13314 .It Ic imapcodec
13315 Perform IMAP path transformations.
13316 Supports
13317 .Cm vput
13318 (see
13319 .Sx "Command modifiers" ) ,
13320 and manages the error number
13321 .Va \&! .
13322 The first argument specifies the operation:
13323 .Ar e[ncode]
13324 normalizes hierarchy delimiters (see
13325 .Va imap-delim )
13326 and converts the strings from the locale
13327 .Va ttycharset
13328 to the internationalized variant used by IMAP,
13329 .Ar d[ecode]
13330 performs the reverse operation.
13335 The following IMAP-specific internal variables exist:
13338 .Bl -tag -width ".It Va BaNg"
13340 .It Va disconnected
13341 \*(BO When an IMAP mailbox is selected and this variable is set,
13342 no connection to the server is initiated.
13343 Instead, data is obtained from the local cache (see
13344 .Va imap-cache Ns
13346 Mailboxes that are not present in the cache
13347 and messages that have not yet entirely been fetched from the server
13348 are not available;
13349 to fetch all messages in a mailbox at once,
13350 the command
13351 .No ` Ns Li copy * /dev/null Ns '
13352 can be used while still in connected mode.
13353 Changes that are made to IMAP mailboxes in disconnected mode are queued
13354 and committed later when a connection to that server is made.
13355 This procedure is not completely reliable since it cannot be guaranteed
13356 that the IMAP unique identifiers (UIDs) on the server still match the
13357 ones in the cache at that time.
13358 Data is saved to
13359 .Ev DEAD
13360 when this problem occurs.
13362 .It Va disconnected-USER@HOST
13363 The specified account is handled as described for the
13364 .Va disconnected
13365 variable above,
13366 but other accounts are not affected.
13368 .Mx Va imap-auth
13369 .It Va imap-auth-USER@HOST , imap-auth
13370 Sets the IMAP authentication method.
13371 Valid values are `login' for the usual password-based authentication
13372 (the default),
13373 `cram-md5', which is a password-based authentication that does not send
13374 the password over the network in clear text,
13375 and `gssapi' for GSS-API based authentication.
13378 .It Va imap-cache
13379 Enables caching of IMAP mailboxes.
13380 The value of this variable must point to a directory that is either
13381 existent or can be created by \*(UA.
13382 All contents of the cache can be deleted by \*(UA at any time;
13383 it is not safe to make assumptions about them.
13385 .Mx Va imap-delim
13386 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
13387 The hierarchy separator used by the IMAP server.
13388 Whenever an IMAP path is specified it will undergo normalization.
13389 One of the normalization steps is the squeezing and adjustment of
13390 hierarchy separators.
13391 If this variable is set, any occurrence of any character of the given
13392 value that exists in the path will be replaced by the first member of
13393 the value; an empty value will cause the default to be used, it is
13394 .Ql /. .
13395 If not set, we will reuse the first hierarchy separator character that
13396 is discovered in a user-given mailbox name.
13398 .Mx Va imap-keepalive
13399 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
13400 IMAP servers may close the connection after a period of
13401 inactivity; the standard requires this to be at least 30 minutes,
13402 but practical experience may vary.
13403 Setting this variable to a numeric `value' greater than 0 causes
13404 a `NOOP' command to be sent each `value' seconds if no other operation
13405 is performed.
13408 .It Va imap-list-depth
13409 When retrieving the list of folders on an IMAP server, the
13410 .Ic folders
13411 command stops after it has reached a certain depth to avoid possible
13412 infinite loops.
13413 The value of this variable sets the maximum depth allowed.
13414 The default is 2.
13415 If the folder separator on the current IMAP server is a slash `/',
13416 this variable has no effect and the
13417 .Ic folders
13418 command does not descend to subfolders.
13420 .Mx Va imap-use-starttls
13421 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
13422 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
13423 IMAP session SSL/TLS encrypted.
13424 This functionality is not supported by all servers,
13425 and is not used if the session is already encrypted by the IMAPS method.
13428 .\" }}}
13431 .\" .Sh "SEE ALSO" {{{
13432 .Sh "SEE ALSO"
13434 .Xr bogofilter 1 ,
13435 .Xr gpg 1 ,
13436 .Xr more 1 ,
13437 .Xr newaliases 1 ,
13438 .Xr openssl 1 ,
13439 .Xr sendmail 1 ,
13440 .Xr sh 1 ,
13441 .Xr spamassassin 1 ,
13442 .Xr iconv 3 ,
13443 .Xr setlocale 3 ,
13444 .Xr aliases 5 ,
13445 .Xr termcap 5 ,
13446 .Xr terminfo 5 ,
13447 .Xr locale 7 ,
13448 .Xr mailaddr 7 ,
13449 .Xr re_format 7 ,
13450 .Xr mailwrapper 8 ,
13451 .Xr sendmail 8
13453 .\" }}}
13456 .\" .Sh HISTORY {{{
13457 .Sh HISTORY
13459 M. Douglas McIlroy writes in his article
13460 .Dq A Research UNIX Reader: Annotated Excerpts \
13461 from the Programmer's Manual, 1971-1986
13462 that a
13463 .Xr mail 1
13464 command already appeared in First Edition
13466 in 1971:
13468 .Bd -ragged -offset indent
13469 Electronic mail was there from the start.
13470 Never satisfied with its exact behavior, everybody touched it at one
13471 time or another: to assure the safety of simultaneous access, to improve
13472 privacy, to survive crashes, to exploit uucp, to screen out foreign
13473 freeloaders, or whatever.
13474 Not until v7 did the interface change (Thompson).
13475 Later, as mail became global in its reach, Dave Presotto took charge and
13476 brought order to communications with a grab-bag of external networks
13477 (v8).
13482 Mail was written in 1978 by Kurt Shoens and developed as part of the
13485 distribution until 1995.
13486 Mail has then seen further development in open source
13488 variants, noticeably by Christos Zoulas in
13489 .Pf Net Bx .
13490 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
13491 Ritter in the years 2000 until 2008.
13492 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
13493 This man page is derived from
13494 .Dq The Mail Reference Manual
13495 that was originally written by Kurt Shoens.
13497 .\" }}}
13500 .Sh AUTHORS
13502 .An -nosplit
13503 .An "Kurt Shoens" ,
13504 .An "Edward Wang" ,
13505 .An "Keith Bostic" ,
13506 .An "Christos Zoulas" ,
13507 .An "Gunnar Ritter" .
13508 \*(UA is developed by
13509 .An "Steffen Nurpmeso" Aq steffen@sdaoden.eu .
13512 .\" .Sh CAVEATS {{{
13513 .Sh CAVEATS
13515 \*(ID Interrupting an operation via
13516 .Dv \&\&SIGINT
13518 .Ql control-C
13519 from anywhere else but a command prompt is very problematic and likely
13520 to leave the program in an undefined state: many library functions
13521 cannot deal with the
13522 .Fn siglongjmp 3
13523 that this software (still) performs; even though efforts have been taken
13524 to address this, no sooner but in v15 it will have been worked out:
13525 interruptions have not been disabled in order to allow forceful breakage
13526 of hanging network connections, for example (all this is unrelated to
13527 .Va ignore ) .
13530 The SMTP and POP3 protocol support of \*(UA is very basic.
13531 Also, if it fails to contact its upstream SMTP server, it will not make
13532 further attempts to transfer the message at a later time (setting
13533 .Va save
13535 .Va sendwait
13536 may be useful).
13537 If this is a concern, it might be better to set up a local SMTP server
13538 that is capable of message queuing.
13540 .\" }}}
13543 .Sh BUGS
13545 After deleting some message of a POP3 mailbox the header summary falsely
13546 claims that there are no messages to display, one needs to perform
13547 a scroll or dot movement to restore proper state.
13549 In threaded display a power user may encounter crashes very
13550 occasionally (this is may and very).
13552 The file
13553 .Pa TODO
13554 in the source repository lists future directions.
13557 Please report bugs to the
13558 .Va contact-mail
13559 address, e.g., from within \*(uA:
13560 .\" v15-compat: drop eval as `mail' will expand variable?
13561 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
13562 More information is available on the web:
13563 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ' -Xx .
13565 .\" s-ts-mode