Glue ~A,~a,~I,~i \t and \n expansion to *posix*; while here: resort
[s-mailx.git] / nail.1
blobefd9c47597df00da1f3a02a7d8aa1c7066a9367f
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.
537 Even though
538 .Sx "INTERNAL VARIABLES"
539 .Ic \&\&set
541 .Fl \&\&S
542 may be overwritten from within resource files,
543 the command line setting will be reestablished after all resource files
544 have been loaded.
545 (\*(ID In the future such a setting may instead become
546 .Dq frozen
547 until the startup is complete.)
550 .It Fl s Ar subject
551 Specify the subject of the message to be sent.
552 Newline (NL) and carriage-return (CR) bytes are invalid and will be
553 normalized to space (SP) characters.
556 .It Fl t
557 The message given (on standard input) is expected to contain, separated
558 from the message body by an empty line, a message header with
559 .Ql To: ,
560 .Ql Cc: ,
562 .Ql Bcc:
563 fields giving its recipients, which will be added to any recipients
564 specified on the command line.
565 If a message subject is specified via
566 .Ql Subject:
567 then it will be used in favour of one given on the command line.
569 Also understood are
570 .Ql Reply-To:
571 (possibly overriding
572 .Va reply-to ) ,
573 .Ql Sender:
574 .Pf ( Va sender ) ,
575 .Ql From:
576 .Pf ( Va from
577 and / or option
578 .Fl r ) .
579 .Ql Message-ID: ,
580 .Ql In-Reply-To: ,
581 .Ql References:
583 .Ql Mail-Followup-To: ,
584 by default created automatically dependent on message context, will
585 be used if specified (a special address massage will however still occur
586 for the latter).
587 Any other custom header field (also see
588 .Va customhdr
590 .Ic ~^ )
591 is passed through entirely
592 unchanged, and in conjunction with the options
593 .Fl ~
595 .Fl #
596 it is possible to embed
597 .Sx "COMMAND ESCAPES" .
598 Also see
599 .Fl M , m , q .
602 .It Fl u Ar user
603 Initially read the
604 .Mx -sx
605 .Sx "primary system mailbox"
607 .Ar user ,
608 appropriate privileges presumed; effectively identical to
609 .Ql Fl \&\&f Ns \0%user .
612 .It Fl V
613 Show \*(UA's
614 .Va version
615 and exit.
616 The command
617 .Ic version
618 will also show the list of
619 .Va features :
620 .Ql $ \*(uA -Xversion -Xx .
623 .It Fl v
624 .Ic set Ns
625 ting the internal variable
626 .Va verbose
627 enables display of some informational context messages.
628 Using it twice increases the level of verbosity.
631 .It Fl X Ar cmd
632 Add the given (or multiple for a multiline argument)
633 .Ar cmd
634 to the list of commands to be executed,
635 as a last step of program startup, before normal operation starts.
636 This is the only possibility to execute commands in non-interactive mode
637 when reading startup files is actively prohibited.
638 The commands will be evaluated as a unit, just as via
639 .Ic source .
640 Correlates with
641 .Fl #
643 .Va errexit .
646 .It Fl ~
647 Enable
648 .Sx "COMMAND ESCAPES"
649 in compose mode even in non-interactive use cases.
650 This can be used to, e.g., automatically format the composed message
651 text before sending the message:
652 .Bd -literal -offset indent
653 $ ( echo 'line    one. Word.     Word2.';\e
654     echo '~| /usr/bin/fmt -tuw66' ) |\e
655   LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple
659 .It Fl #
660 Enables batch mode: standard input is made line buffered, the complete
661 set of (interactive) commands is available, processing of
662 .Sx "COMMAND ESCAPES"
663 is enabled in compose mode, and diverse
664 .Sx "INTERNAL VARIABLES"
665 are adjusted for batch necessities, exactly as if done via
666 .Fl S :
667 .Va emptystart ,
668 .Pf no Va errexit ,
669 .Pf no Va header ,
670 .Pf no Va posix ,
671 .Va quiet ,
672 .Va sendwait ,
673 .Va typescript-mode
674 as well as
675 .Ev MAIL ,
676 .Ev MBOX
678 .Va inbox
679 (the latter three to
680 .Pa /dev/null ) .
681 The following prepares an email message in a batched dry run:
682 .Bd -literal -offset indent
683 $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e
684   LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple'
688 .It Fl \&.
689 This flag forces termination of option processing in order to prevent
690 .Dq option injection
691 (attacks).
692 It also forcefully puts \*(UA into send mode, see
693 .Sx "On sending mail, and non-interactive mode" .
697 All given
698 .Ar to-addr
699 arguments and all receivers established via
700 .Fl b
702 .Fl c
703 are subject to the checks established by
704 .Va expandaddr ,
705 one of the
706 .Sx "INTERNAL VARIABLES" .
707 If the setting of
708 .Va expandargv
709 allows their recognition all
710 .Ar mta-option
711 arguments given at the end of the command line after a
712 .Ql --
713 separator will be passed through to a file-based
714 .Va mta
715 (Mail-Transfer-Agent) and persist for the entire session.
716 .Va expandargv
717 constraints do not apply to the content of
718 .Va mta-arguments .
719 .\" }}}
721 .\" .Ss "A starter" {{{
722 .Ss "A starter"
724 \*(UA is a direct descendant of
726 Mail, itself a successor of the Research
728 mail which
729 .Dq was there from the start
730 according to
731 .Sx HISTORY .
732 It thus represents the user side of the
734 mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
735 traditionally taken by
736 .Xr sendmail 8 ,
737 and most MTAs provide a binary of this name for compatibility purposes.
738 If the \*(OPal SMTP
739 .Va mta
740 is included in the
741 .Va features
742 of \*(UA then the system side is not a mandatory precondition for mail
743 delivery.
746 Because \*(UA strives for compliance with POSIX
747 .Xr mailx 1
748 it is likely that some configuration settings have to be adjusted before
749 using it is a smooth experience.
750 (Rather complete configuration examples can be found in the section
751 .Sx EXAMPLES . )
752 The default global
753 .Pa \*(UR
754 resource file bends those standard imposed settings of the
755 .Sx "INTERNAL VARIABLES"
756 a bit towards more user friendliness and safety already.
759 For example, it
760 .Ic set Ns s
761 .Va hold
763 .Va keepsave
764 in order to suppress the automatic moving of messages to the
765 .Mx -sx
766 .Sx "secondary mailbox"
767 .Ev MBOX
768 that would otherwise occur (see
769 .Sx "Message states" ) ,
771 .Va keep
772 to not remove empty system MBOX mailbox files in order not to mangle
773 file permissions when files eventually get recreated (all empty (MBOX)
774 mailbox files will be removed unless this variable is set whenever
775 .Ev POSIXLY_CORRECT
776 .Pf a.k.a.\0 Va posix
777 mode has been enabled).
780 It also enables
781 .Va sendwait
782 in order to synchronize \*(UA with the exit status report of the used
783 .Va mta
784 when sending mails.
786 .Ic set Ns
788 .Va emptystart
789 to enter interactive startup even if the initial mailbox is empty,
790 .Va editheaders
791 to allow editing of headers as well as
792 .Va fullnames
793 to not strip down addresses in compose mode, and
794 .Va quote
795 to include the message that is being responded to when
796 .Ic reply Ns
797 ing.
800 Some random remarks.
801 The file mode creation mask can be explicitly managed via the variable
802 .Va umask .
803 Sufficient system support provided symbolic links will not be followed
804 when files are opened for writing.
805 Files and shell pipe output can be
806 .Ic source Ns
807 d for evaluation, also during startup from within the
808 .Sx "Resource files" .
809 .\" }}}
811 .\" .Ss "On sending mail, and non-interactive mode" {{{
812 .Ss "On sending mail, and non-interactive mode"
814 To send a message to one or more people, using a local or a built-in
815 .Va mta
816 (Mail-Transfer-Agent) transport to actually deliver the generated mail
817 message, \*(UA can be invoked with arguments which are the names of
818 people to whom the mail will be sent, and the command line options
819 .Fl b
821 .Fl c
822 can be used to add (blind) carbon copy receivers:
824 .Bd -literal -offset indent
825 # Via sendmail(1)
826 $ \*(uA -s ubject -a ttach.txt bill@exam.ple
828 # But... try it in an isolated dry-run mode (-d) first
829 $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e
830    -b bcc@exam.ple -c cc@exam.ple \e
831    -. '(Lovely) Bob <bob@exam.ple>' eric@exam.ple
833 # With SMTP
834 $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
835     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e
836     -S from=scriptreply@exam.ple \e
837     -a /etc/mail.rc \e
838     -. eric@exam.ple
842 If standard input is a terminal rather than the message to be sent,
843 the user is expected to type in the message contents.
844 In this compose mode \*(UA treats lines beginning with the character
845 .Ql ~
846 special \(en these are so-called
847 .Sx "COMMAND ESCAPES" ,
848 which can be used to read in files, process shell commands, add and edit
849 attachments and more; e.g., the command escape
850 .Ic ~e
851 will start the text editor to revise the message in its current state,
852 .Ic ~h
853 allows editing of the most important message headers, with
854 .Ic ~^
855 custom headers can be created (more specifically than with
856 .Va customhdr ) .
857 .Ic ~?
858 gives an overview of most other available command escapes.
859 The command escape
860 .Ic ~.
861 will leave compose mode and send the message once it is completed.
862 Alternatively typing
863 .Ql control-D
864 .Pf ( Ql ^D )
865 at the beginning of an empty line has the same effect, whereas typing
866 .Ql control-C
867 .Pf ( Ql ^C )
868 twice will abort the current letter (saving its contents in the file
869 denoted by
870 .Ev DEAD
871 unless
872 .Pf no Va save
873 is set).
876 A number of
877 .Sx ENVIRONMENT
879 .Sx "INTERNAL VARIABLES"
880 can be used to alter default behavior.
881 E.g., messages are sent asynchronously, without supervision, unless the
882 internal variable
883 .Va sendwait
884 is set, therefore send errors will not be recognizable until then.
885 .Ic set Ns
886 ting (also via
887 .Fl S )
888 .Va editalong
889 will automatically startup a text editor when compose mode is entered,
890 .Va editheaders
891 allows editing of headers additionally to plain body content, whereas
892 .Va askcc
894 .Va askbcc
895 will cause the user to be prompted actively for (blind) carbon-copy
896 recipients, respectively.
899 Especially when using public mail provider accounts with the SMTP
900 .Va mta
901 it is often necessary to set
902 .Va from
903 and/or
904 .Va hostname
905 (even finer control via
906 .Va smtp-hostname ) ,
907 which (even if empty) also causes creation of
908 .Ql Message-ID:
910 .Ql Content-ID:
911 header fields unless
912 .Va stealthmua
913 is set.
914 Saving a copy of sent messages in a
915 .Va record
916 mailbox may be desirable \(en as for most mailbox
917 .Ic file
918 targets the value will undergo
919 .Sx "Filename transformations" .
920 Defining user email
921 .Ic account Ns s
922 for the purpose of arranging a complete environment of settings that can
923 be switched to with a single command or command line option may be
924 useful.
925 .Pf ( Sx EXAMPLES
926 has example configurations for some of the well-known public mail
927 providers, and also gives a compact overview on how to setup a secure
928 SSL/TLS environment.)
929 Some introductional
930 .Fl d
932 .Va debug
933 sandbox dry-run tests will prove correctness.
936 The section
937 .Sx "On URL syntax and credential lookup"
938 will spread light on the different ways of how to specify user email
939 account credentials, the
940 .Ql USER@HOST
941 variable chains, and accessing protocol-specific resources,
942 the section
943 .Sx "Character sets"
944 goes into the details of character encodings, and how to use them for
945 interpreting the input data given in
946 .Va ttycharset
947 and representing messages and MIME part contents in
948 .Va sendcharsets ,
949 and reading the section
950 .Sx "The mime.types files"
951 should help to understand how the MIME-type of outgoing attachments are
952 classified, and what can be done for fine-tuning.
953 Over the wire a configurable
954 .Va mime-encoding
955 .Pf ( Ql Content-Transfer-Encoding: )
956 may be applied to the message data.
959 Message recipients (as specified on the command line or defined in
960 .Ql To: ,
961 .Ql Cc:
963 .Ql Bcc: )
964 may not only be email addressees but can also be names of mailboxes and
965 even complete shell command pipe specifications.
966 If the variable
967 .Va expandaddr
968 is not set then only network addresses (see
969 .Xr mailaddr 7
970 for a description of mail addresses) and plain user names (including MTA
971 aliases) may be used, other types will be filtered out, giving a warning
972 message.
973 The command
974 .Ic addrcodec
975 can be used to generate standard compliant network addresses.
977 .\" When changing any of the following adjust any RECIPIENTADDRSPEC;
978 .\" grep the latter for the complete picture
980 If the variable
981 .Va expandaddr
982 is set then extended recipient addresses will optionally be accepted:
983 Any name which starts with a vertical bar
984 .Ql |
985 character specifies a command pipe \(en the command string following the
986 .Ql |
987 is executed and the message is sent to its standard input;
988 Likewise, any name that starts with the character solidus
989 .Ql /
990 or the character sequence dot solidus
991 .Ql ./
992 is treated as a file, regardless of the remaining content;
993 likewise a name that solely consists of a hyphen-minus
994 .Ql - .
995 Any other name which contains a commercial at
996 .Ql @
997 character is treated as a network address;
998 Any other name which starts with a plus sign
999 .Ql +
1000 character specifies a mailbox name;
1001 Any other name which contains a solidus
1002 .Ql /
1003 character but no exclamation mark
1004 .Ql \&!
1005 or percent sign
1006 .Ql %
1007 character before also specifies a mailbox name;
1008 What remains is treated as a network address.
1010 .Bd -literal -offset indent
1011 $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox
1012 $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox'
1013 $ echo safe | LC_ALL=C \e
1014     \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e
1015       -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e
1016       -. bob@exam.ple
1020 It is possible to create personal distribution lists via the
1021 .Ic alias
1022 command, so that, for instance, the user can send mail to
1023 .Ql cohorts
1024 and have it go to a group of people.
1025 These aliases have nothing in common with the system wide aliases that
1026 may be used by the MTA, which are subject to the
1027 .Ql name
1028 constraint of
1029 .Va expandaddr
1030 and are often tracked in a file
1031 .Pa /etc/aliases
1032 (and documented in
1033 .Xr aliases 5
1035 .Xr sendmail 1 ) .
1036 Personal aliases will be expanded by \*(UA before the message is sent,
1037 and are thus a convenient alternative to specifying each addressee by
1038 itself; they correlate with the active set of
1039 .Ic alternates
1040 and are subject to
1041 .Va metoo
1042 filtering.
1045 .Dl alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox
1048 .Va on-compose-enter , on-compose-leave
1050 .Va on-compose-cleanup
1051 hook variables may be set to
1052 .Ic define Ns
1053 d macros to automatically adjust some settings dependent
1054 on receiver, sender or subject contexts, and via the
1055 .Va on-compose-splice
1056 as well as
1057 .Va on-compose-splice-shell
1058 variables, the former also to be set to a
1059 .Ic define Ns
1060 d macro, increasingly powerful mechanisms to perform automated message
1061 adjustments, including signature creation, are available.
1062 (\*(ID These hooks work for commands which newly create messages, namely
1063 .Ic forward , mail , reply
1064 and variants;
1065 .Ic resend
1067 .Ic Resend
1068 for now provide only the hooks
1069 .Va on-resend-enter
1071 .Va on-resend-cleanup . )
1074 To avoid environmental noise scripts should
1075 .Dq detach
1076 \*(UA from any configuration files and create a script-local
1077 environment, ideally with the command line options
1078 .Fl \&:
1079 to disable any configuration file in conjunction with repetitions of
1080 .Fl S
1081 to specify variables:
1083 .Bd -literal -offset indent
1084 $ env LC_ALL=C \*(uA -:/ \e
1085     -Sv15-compat -Ssendwait -Sttycharset=utf-8 \e
1086     -Sexpandaddr=fail,-all,failinvaddr \e
1087     -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e
1088     -S from=scriptreply@exam.ple \e
1089     -s 'Subject to go' -a attachment_file \e
1090     -. 'Recipient 1 <rec1@exam.ple>' rec2@exam.ple \e
1091     < content_file
1095 As shown, scripts can
1096 .Dq fake
1097 a locale environment, the above specifies the all-compatible 7-bit clean
1098 .Ev LC_ALL
1099 .Dq C ,
1100 but will nonetheless take and send UTF-8 in the message text by using
1101 .Va ttycharset .
1102 In interactive mode, which is introduced in the next section, messages
1103 can be sent by calling the
1104 .Ic mail
1105 command with a list of recipient addresses:
1107 .Bd -literal -offset indent
1108 $ \*(uA -d -Squiet -Semptystart
1109 "/var/spool/mail/user": 0 messages
1110 ? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
1112 ? # Will do the right thing (tm)
1113 ? m rec1@exam.ple rec2@exam.ple
1115 .\" }}}
1117 .\" .Ss "On reading mail, and interactive mode" {{{
1118 .Ss "On reading mail, and interactive mode"
1120 When invoked without addressees \*(UA enters interactive mode in which
1121 mails may be read.
1122 When used like that the user's system
1123 .Va inbox
1124 (for more on mailbox types please see the command
1125 .Ic file )
1126 is read in and a one line header of each message therein is displayed if
1127 the variable
1128 .Va header
1129 is set.
1130 The visual style of this summary of
1131 .Ic headers
1132 can be adjusted through the variable
1133 .Va headline
1134 and the possible sorting criterion via
1135 .Va autosort .
1136 Scrolling through
1137 .Va screen Ns
1138 fuls of
1139 .Ic headers
1140 can be performed with the command
1141 .Ic z .
1142 If the initially opened mailbox is empty \*(UA will instead exit
1143 immediately (after displaying a message) unless the variable
1144 .Va emptystart
1145 is set.
1148 At the
1149 .Va prompt
1150 the command
1151 .Ic list
1152 will give a listing of all available commands and
1153 .Ic help
1154 will give a summary of some common ones.
1155 If the \*(OPal documentation strings are available one can type
1156 .Ql help X
1157 .Pf "(or " Ql ?X )
1158 and see the actual expansion of
1159 .Ql X
1160 and what its purpose is, i.e., commands can be abbreviated
1161 (note that POSIX defines some abbreviations, so that the alphabetical
1162 order of commands does not necessarily relate to the abbreviations; it is
1163 however possible to define overwrites with
1164 .Ic commandalias ) .
1165 These commands can also produce a more
1166 .Va verbose
1167 output.
1170 Messages are given numbers (starting at 1) which uniquely identify
1171 messages; the current message \(en the
1172 .Dq dot
1173 \(en will either be the first new message, or the first unread message,
1174 or the first message of the mailbox; the internal variable
1175 .Va showlast
1176 will instead cause usage of the last message for this purpose.
1177 The command
1178 .Ic headers
1179 will display a
1180 .Va screen Ns
1181 ful of header summaries containing the
1182 .Dq dot ,
1183 whereas
1184 .Ic from
1185 will display only the summaries of the given messages, defaulting to the
1186 .Dq dot .
1189 Message content can be displayed with the command
1190 .Ic type
1191 .Pf ( Ql t ,
1192 alias
1193 .Ic print ) .
1194 Here the variable
1195 .Va crt
1196 controls whether and when \*(UA will use the configured
1197 .Ev PAGER
1198 for display instead of directly writing to the user terminal
1199 .Va screen ,
1200 the sole difference to the command
1201 .Ic more ,
1202 which will always use the
1203 .Ev PAGER .
1204 The command
1205 .Ic top
1206 will instead only show the first
1207 .Va toplines
1208 of a message (maybe even compressed if
1209 .Va topsqueeze
1210 is set).
1211 Message display experience may improve by setting and adjusting
1212 .Va mime-counter-evidence ,
1213 and also see
1214 .Sx "HTML mail and MIME attachments" .
1217 By default the current message
1218 .Pf ( Dq dot )
1219 is displayed, but like with many other commands it is possible to give
1220 a fancy message specification (see
1221 .Sx "Specifying messages" ) ,
1222 e.g.,
1223 .Ql t:u
1224 will display all unread messages,
1225 .Ql t.
1226 will display the
1227 .Dq dot ,
1228 .Ql t 1 5
1229 will type the messages 1 and 5,
1230 .Ql t 1-5
1231 will type the messages 1 through 5, and
1232 .Ql t-
1234 .Ql t+
1235 will display the last and the next message, respectively.
1236 The command
1237 .Ic search
1238 (a more substantial alias for
1239 .Ic from )
1240 will display a header summary of the given message specification list
1241 instead of their content, e.g., the following will search for subjects:
1244 .Dl ? from "'@Some subject to search for'"
1247 In the default setup all header fields of a message will be
1248 .Ic type Ns
1249 d, but fields can be white- or blacklisted for a variety of
1250 applications by using the command
1251 .Ic headerpick ,
1252 e.g., to restrict their display to a very restricted set for
1253 .Ic type :
1254 .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject .
1255 In order to display all header fields of a message regardless of
1256 currently active ignore or retain lists, use the commands
1257 .Ic Type
1259 .Ic Top ;
1260 .Ic Show
1261 will show the raw message content.
1262 Note that historically the global
1263 .Pa \*(UR
1264 not only adjusts the list of displayed headers, but also sets
1265 .Va crt .
1268 Dependent upon the configuration a line editor (see the section
1269 .Sx "On terminal control and line editor" )
1270 aims at making the user experience with the many
1271 .Sx COMMANDS
1272 a bit nicer.
1273 When reading the system
1274 .Va inbox
1275 or when
1276 .Fl f
1278 .Ic file )
1279 specified a mailbox explicitly prefixed with the special
1280 .Ql %:
1281 modifier (propagating the mailbox to a
1282 .Mx -sx
1283 .Sx "primary system mailbox" ) ,
1284 then messages which have been read will be automatically moved to a
1285 .Mx -sx
1286 .Sx "secondary mailbox" ,
1287 the users
1288 .Ev MBOX
1289 file, when the mailbox is left, either by changing the
1290 active mailbox or by quitting \*(UA (also see
1291 .Sx "Message states" )
1292 \(en this automatic moving from a system or primary to the secondary
1293 mailbox is not performed when the variable
1294 .Va hold
1295 is set.
1296 Messages can also be explicitly
1297 .Ic move Ns
1298 d to other mailboxes, whereas
1299 .Ic copy
1300 keeps the original message.
1301 .Ic write
1302 can be used to write out data content of specific parts of messages.
1305 After examining a message the user can
1306 .Ic reply Ql r
1307 to the sender and all recipients (which will also be placed in
1308 .Ql To:
1309 unless
1310 .Va recipients-in-cc
1311 is set) or
1312 .Ic Reply Ql R
1313 exclusively to the sender(s).
1314 .Ic forward Ns
1315 ing a message will allow editing the new message: the original message
1316 will be contained in the message body, adjusted according to
1317 .Ic headerpick .
1318 When replying to or forwarding a message recipient addresses will be
1319 stripped from comments and names unless the internal variable
1320 .Va fullnames
1321 is set.
1322 It is possible to
1323 .Ic resend
1325 .Ic Resend
1326 messages: the former will add a series of
1327 .Ql Resent-
1328 headers, whereas the latter will not; different to newly created
1329 messages editing is not possible and no copy will be saved even with
1330 .Va record
1331 unless the additional variable
1332 .Va record-resent
1333 is set.
1334 Of course messages can be
1335 .Ic delete Ql d ,
1336 and they can spring into existence again via
1337 .Ic undelete
1338 or when the \*(UA session is ended via the
1339 .Ic exit Ql x
1340 command.
1343 To end a mail processing session one may either issue
1344 .Ic quit Ql q
1345 to cause a full program exit, which possibly includes
1346 automatic moving of read messages to the
1347 .Mx -sx
1348 .Sx "secondary mailbox"
1349 .Ev MBOX
1350 as well as updating the \*(OPal line editor
1351 .Va history-file ,
1352 or use the command
1353 .Ic exit Ql x
1354 instead in order to prevent any of these actions.
1355 .\" }}}
1357 .\" .Ss "HTML mail and MIME attachments" {{{
1358 .Ss "HTML mail and MIME attachments"
1360 Messages which are HTML-only become more and more common and of course
1361 many messages come bundled with a bouquet of MIME (Multipurpose Internet
1362 Mail Extensions) parts for, e.g., attachments.
1363 To get a notion of MIME types, \*(UA will first read
1364 .Sx "The mime.types files"
1365 (as configured and allowed by
1366 .Va mimetypes-load-control ) ,
1367 and then add onto that types registered directly with
1368 .Ic mimetype .
1369 It (normally) has a default set of types built-in, too.
1370 To improve interaction with faulty MIME part declarations which are
1371 often seen in real-life messages, setting
1372 .Va mime-counter-evidence
1373 will allow \*(UA to verify the given assertion and possibly provide
1374 an alternative MIME type.
1377 Whereas \*(UA \*(OPally supports a simple HTML-to-text converter for
1378 HTML messages, it cannot handle MIME types other than plain text itself.
1379 Instead programs need to become registered to deal with specific MIME
1380 types or file extensions.
1381 These programs may either prepare plain text versions of their input in
1382 order to enable \*(UA to integrate their output neatlessly in its own
1383 message visualization (a mode which is called
1384 .Cd copiousoutput ) ,
1385 or display the content themselves, for example in an external graphical
1386 window: such handlers will only be considered by and for the command
1387 .Ic mimeview .
1390 To install a handler program for a specific MIME type an according
1391 .Va pipe-TYPE/SUBTYPE
1392 variable needs to be set; to instead define a handler for a specific
1393 file extension the respective
1394 .Va pipe-EXTENSION
1395 variable can be used \(en these handlers take precedence.
1396 \*(OPally \*(UA supports mail user agent configuration as defined in
1397 RFC 1524; this mechanism (see
1398 .Sx "The Mailcap files" )
1399 will be queried for display or quote handlers if none of the former two
1400 .\" TODO v15-compat "will be" -> "is"
1401 did; it will be the sole source for handlers of other purpose.
1402 A last source for handlers is the MIME type definition itself, when
1403 a (\*(UA specific) type-marker was registered with the command
1404 .Ic mimetype
1405 (which many built-in MIME types do).
1408 E.g., to display a HTML message inline (that is, converted to a more
1409 fancy plain text representation than the built-in converter is capable to
1410 produce) with either of the text-mode browsers
1411 .Xr lynx 1
1413 .Xr elinks 1 ,
1414 teach \*(UA about MathML documents and make it display them as plain
1415 text, and to open PDF attachments in an external PDF viewer,
1416 asynchronously and with some other magic attached:
1418 .Bd -literal -offset indent
1419 ? if [ "$features" !% +filter-html-tagsoup ]
1420 ?  #set pipe-text/html='@* elinks -force-html -dump 1'
1421 ?  set pipe-text/html='@* lynx -stdin -dump -force_html'
1422 ?  # Display HTML as plain text instead
1423 ?  #set pipe-text/html=@
1424 ? endif
1425 ? mimetype @ application/mathml+xml mathml
1426 ? wysh set pipe-application/pdf='@&=@ \e
1427     trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e
1428     trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e
1429     mupdf "${MAILX_FILENAME_TEMPORARY}"'
1431 .\" }}}
1433 .\" .Ss "Mailing lists" {{{
1434 .Ss "Mailing lists"
1436 \*(UA offers some support to ease handling of mailing lists.
1437 The command
1438 .Ic mlist
1439 promotes all given arguments to known mailing lists, and
1440 .Ic mlsubscribe
1441 sets their subscription attribute, creating them first as necessary.
1442 (On the other hand
1443 .Ic unmlsubscribe
1444 does not
1445 .Ic unmlist
1446 automatically, but only resets the subscription attribute.)
1447 Using the commands without arguments will show (a subset of) all
1448 currently defined mailing lists.
1450 .Va headline
1451 format
1452 .Ql \&%T
1453 can be used to mark out messages with configured list addresses
1454 in the header display.
1457 \*(OPally mailing lists may also be specified as (extended) regular
1458 expressions, which allows matching of many addresses with a single
1459 expression.
1460 However, all fully qualified list addresses are matched via a fast
1461 dictionary, whereas expressions are placed in (a) list(s) which is
1462 (are) matched sequentially.
1464 .Bd -literal -offset indent
1465 ? set followup-to followup-to-honour=ask-yes \e
1466     reply-to-honour=ask-yes
1467 ? wysh mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$'
1468 ? mlsubscribe a4@b4.c4 exact@lists.c3
1472 The variable
1473 .Va followup-to-honour
1474 will ensure that a
1475 .Ql Mail-\:Followup-\:To:
1476 header is honoured when the message is being replied to (via
1477 .Ic reply
1479 .Ic Lreply )
1481 .Va followup-to
1482 controls whether this header is created when sending mails; it will be
1483 created automatically for a couple of reasons, too, like when the
1484 special
1485 .Dq mailing list specific
1486 respond command
1487 .Ic Lreply
1488 is used, when
1489 .Ic reply
1490 is used to respond to a message with its
1491 .Ql Mail-Followup-To:
1492 being honoured etc.
1495 A difference in between the handling of known and subscribed lists is
1496 that the address of the sender is usually not part of a generated
1497 .Ql Mail-Followup-To:
1498 when addressing the latter, whereas it is for the former kind of lists.
1499 Usually because there are exceptions: say, if multiple lists are
1500 addressed and not all of them are subscribed lists.
1502 For convenience \*(UA will, temporarily, automatically add a list
1503 address that is presented in the
1504 .Ql List-Post:
1505 header of a message that is being responded to to the list of known
1506 mailing lists.
1507 Shall that header have existed \*(UA will instead, dependent on the
1508 variable
1509 .Va reply-to-honour ,
1510 use an also set
1511 .Ql Reply-To:
1512 for this purpose in order to accept a list administrators' wish that
1513 is supposed to have been manifested like that (but only if it provides
1514 a single address which resides on the same domain as what is stated in
1515 .Ql List-Post: ) .
1516 .\" }}}
1518 .\" .Ss "Signed and encrypted messages with S/MIME" {{{
1519 .Ss "Signed and encrypted messages with S/MIME"
1521 \*(OP S/MIME provides two central mechanisms:
1522 message signing and message encryption.
1523 A signed message contains some data in addition to the regular text.
1524 The data can be used to verify that the message was sent using a valid
1525 certificate, that the sender's address in the message header matches
1526 that in the certificate, and that the message text has not been altered.
1527 Signing a message does not change its regular text;
1528 it can be read regardless of whether the recipient's software is able to
1529 handle S/MIME.
1530 It is thus usually possible to sign all outgoing messages if so desired.
1533 Encryption, in contrast, makes the message text invisible for all people
1534 except those who have access to the secret decryption key.
1535 To encrypt a message, the specific recipient's public encryption key
1536 must be known.
1537 It is therefore not possible to send encrypted mail to people unless their
1538 key has been retrieved from either previous communication or public key
1539 directories.
1540 A message should always be signed before it is encrypted.
1541 Otherwise, it is still possible that the encrypted message text is
1542 altered.
1545 A central concept to S/MIME is that of the certification authority (CA).
1546 A CA is a trusted institution that issues certificates.
1547 For each of these certificates it can be verified that it really
1548 originates from the CA, provided that the CA's own certificate is
1549 previously known.
1550 A set of CA certificates is usually delivered with OpenSSL and installed
1551 on your system.
1552 If you trust the source of your OpenSSL software installation,
1553 this offers reasonable security for S/MIME on the Internet.
1554 Otherwise set
1555 .Va smime-ca-no-defaults
1556 to avoid using the default certificates and point
1557 .Va smime-ca-file
1558 and/or
1559 .Va smime-ca-dir
1560 to a trusted pool of certificates.
1561 In general, a certificate cannot be more secure than the method its CA
1562 certificate has been retrieved with.
1565 This trusted pool of certificates is used by the command
1566 .Ic verify
1567 to ensure that the given S/MIME messages can be trusted.
1568 If so, verified sender certificates that were embedded in signed
1569 messages can be saved locally with the command
1570 .Ic certsave ,
1571 and used by \*(UA to encrypt further communication with these senders:
1573 .Bd -literal -offset indent
1574 ? certsave FILENAME
1575 ? set smime-encrypt-USER@HOST=FILENAME \e
1576     smime-cipher-USER@HOST=AES256
1580 To sign outgoing messages in order to allow receivers to verify the
1581 origin of these messages a personal S/MIME certificate is required.
1582 \*(UA supports password-protected personal certificates (and keys),
1583 for more on this, and its automatization, please see the section
1584 .Sx "On URL syntax and credential lookup" .
1585 The section
1586 .Sx "S/MIME step by step"
1587 shows examplarily how such a private certificate can be obtained.
1588 In general, if such a private key plus certificate
1589 .Dq pair
1590 is available, all that needs to be done is to set some variables:
1592 .Bd -literal -offset indent
1593 ? set smime-sign-cert=ME@HERE.com.paired \e
1594     smime-sign-message-digest=SHA256 \e
1595     smime-sign
1599 Variables of interest for S/MIME in general are
1600 .Va smime-ca-dir ,
1601 .Va smime-ca-file ,
1602 .Va smime-ca-flags ,
1603 .Va smime-ca-no-defaults ,
1604 .Va smime-crl-dir ,
1605 .Va smime-crl-file .
1606 For S/MIME signing of interest are
1607 .Va smime-sign ,
1608 .Va smime-sign-cert ,
1609 .Va smime-sign-include-certs
1611 .Va smime-sign-message-digest .
1612 Additional variables of interest for S/MIME en- and decryption:
1613 .Va smime-cipher
1615 .Va smime-encrypt-USER@HOST .
1618 \*(ID Note that neither S/MIME signing nor encryption applies to
1619 message subjects or other header fields yet.
1620 Thus they may not contain sensitive information for encrypted messages,
1621 and cannot be trusted even if the message content has been verified.
1622 When sending signed messages,
1623 it is recommended to repeat any important header information in the
1624 message text.
1625 .\" }}}
1627 .\" .Ss "On URL syntax and credential lookup" {{{
1628 .Ss "On URL syntax and credential lookup"
1630 \*(IN For accessing protocol-specific resources usage of Uniform
1631 Resource Locators (URL, RFC 1738) has become omnipresent.
1632 \*(UA expects and understands URLs in the following form;
1633 parts in brackets
1634 .Ql []
1635 denote optional parts, optional either because there also exist other
1636 ways to define the information in question or because support of the
1637 part is protocol-specific (e.g.,
1638 .Ql /path
1639 is used by the local maildir and the IMAP protocol, but not by POP3);
1640 If any of
1641 .Ql USER
1643 .Ql PASSWORD
1644 are specified they must be given in URL percent encoded form (RFC 3986;
1645 the command
1646 .Ic urlcodec
1647 may be helpful):
1650 .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]
1653 Note that these \*(UA URLs most often do not conform to any real
1654 standard, but instead represent a normalized variant of RFC 1738 \(en
1655 they are not used in data exchange but only meant as a compact,
1656 easy-to-use way of defining and representing information in
1657 a well-known notation.
1660 Many internal variables of \*(UA exist in multiple versions, called
1661 variable chains for the rest of this document: the plain
1662 .Ql variable
1663 as well as
1664 .Ql variable-HOST
1666 .Ql variable-USER@HOST .
1667 Here
1668 .Ql HOST
1669 indeed means
1670 .Ql server:port
1671 if a
1672 .Ql port
1673 had been specified in the respective URL, otherwise it refers to the plain
1674 .Ql server .
1675 Also,
1676 .Ql USER
1677 is not truly the
1678 .Ql USER
1679 that had been found when doing the user chain lookup as is described
1680 below, i.e., this
1681 .Ql USER
1682 will never be in URL percent encoded form, whether it came from an URL
1683 or not; i.e., variable chain name extensions of
1684 .Sx "INTERNAL VARIABLES"
1685 must not be URL percent encoded.
1688 For example, whether an hypothetical URL
1689 .Ql smtp://hey%3Ayou@our.house
1690 had been given that includes a user, or whether the URL was
1691 .Ql smtp://our.house
1692 and the user had been found differently, to lookup the variable chain
1693 .Va smtp-use-starttls
1694 \*(UA first looks for whether
1695 .Ql smtp-\:use-\:starttls-\:hey:you@our.house
1696 is defined, then whether
1697 .Ql smtp-\:use-\:starttls-\:our.house
1698 exists before finally ending up looking at the plain variable itself.
1701 \*(UA obeys the following logic scheme when dealing with the
1702 necessary credential information of an account:
1704 .Bl -bullet
1706 If no
1707 .Ql USER
1708 has been given in the URL the variables
1709 .Va user-HOST
1711 .Va user
1712 are looked up; if no such variable(s) can be found then \*(UA will,
1713 when enforced by the \*(OPal variables
1714 .Va netrc-lookup-HOST
1716 .Va netrc-lookup ,
1717 search the users
1718 .Pa .netrc
1719 file for a
1720 .Ql HOST
1721 specific entry which provides a
1722 .Ql login
1723 name: this lookup will only succeed if unambiguous (one possible matching
1724 entry for
1725 .Ql HOST ) .
1726 It is possible to load encrypted
1727 .Pa .netrc
1728 files via
1729 .Va netrc-pipe .
1731 If there is still no
1732 .Ql USER
1733 then \*(UA will fall back to the user who is supposed to run \*(UA,
1734 the identity of which has been fixated during \*(UA startup and is
1735 known to be a valid user on the current host.
1738 Authentication: unless otherwise noted this will lookup the
1739 .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth
1740 variable chain, falling back to a protocol-specific default should this
1741 have no success.
1744 If no
1745 .Ql PASSWORD
1746 has been given in the URL, then if the
1747 .Ql USER
1748 has been found through the \*(OPal
1749 .Va netrc-lookup
1750 that may have already provided the password, too.
1751 Otherwise the variable chain
1752 .Va password-USER@HOST , password-HOST , password
1753 is looked up and used if existent.
1755 Afterwards the complete \*(OPal variable chain
1756 .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
1757 is looked up.
1758 If set, the
1759 .Ic netrc
1760 cache is searched for a password only (multiple user accounts for
1761 a single machine may exist as well as a fallback entry without user
1762 but with a password).
1764 If at that point there is still no password available, but the
1765 (protocols') chosen authentication type requires a password, then in
1766 interactive mode the user will be prompted on the terminal.
1770 .Sy Note:
1771 S/MIME verification works relative to the values found in the
1772 .Ql From:
1774 .Ql Sender: )
1775 header field(s), which means that the values of
1776 .Va smime-sign , smime-sign-cert , smime-sign-include-certs
1778 .Va smime-sign-message-digest
1779 will not be looked up using the
1780 .Ql USER
1782 .Ql HOST
1783 chains from above but instead use the corresponding values from the
1784 message that is being worked on.
1785 In unusual cases multiple and different
1786 .Ql USER
1788 .Ql HOST
1789 combinations may therefore be involved \(en on the other hand those
1790 unusual cases become possible.
1791 The usual case is as short as:
1793 .Bd -literal -offset indent
1794 set mta=smtp://USER:PASS@HOST smtp-use-starttls \e
1795     smime-sign smime-sign-cert=+smime.pair
1799 The section
1800 .Sx EXAMPLES
1801 contains complete example configurations.
1802 .\" }}}
1804 .\" .Ss "Encrypted network communication" {{{
1805 .Ss "Encrypted network communication"
1807 SSL (Secure Sockets Layer) a.k.a. its successor TLS (Transport Layer
1808 Security) are protocols which aid in securing communication by providing
1809 a safely initiated and encrypted network connection.
1810 A central concept to SSL/TLS is that of certificates: as part of each
1811 network connection setup a (set of) certificates will be exchanged, and
1812 by using those the identity of the network peer can be cryptographically
1813 verified.
1814 SSL/TLS works by using a locally installed pool of trusted certificates,
1815 and verifying the connection peer succeeds if that provides
1816 a certificate which has been issued or is trusted by any certificate in
1817 the trusted local pool.
1820 The local pool of trusted so-called CA (Certification Authority)
1821 certificates is usually delivered with the used SSL/TLS library (e.g.,
1822 OpenSSL), and will be selected automatically.
1823 It is also possible to create and use an own pool of trusted certificates.
1824 If this is desired, set
1825 .Va ssl-ca-no-defaults
1826 to avoid using the default certificate pool, and point
1827 .Va ssl-ca-file
1828 and/or
1829 .Va ssl-ca-dir
1830 to a trusted pool of certificates.
1831 A certificate cannot be more secure than the method its CA certificate
1832 has been retrieved with.
1835 It depends on the used protocol whether encrypted communication is
1836 possible, and which configuration steps have to be taken to enable it.
1837 Some protocols, e.g., POP3S, are implicitly encrypted, others, like
1838 POP3, can upgrade a plain text connection if so requested: POP3 offers
1839 .Ql STLS ,
1840 which will be used if the variable
1841 .Va pop3-use-starttls
1842 (which is a variable chain, as documented in
1843 .Sx "On URL syntax and credential lookup")
1844 is set:
1846 .Bd -literal -offset indent
1847 shortcut encpop1 pop3s://pop1.exam.ple
1849 shortcut encpop2 pop3://pop2.exam.ple
1850 set pop3-use-starttls-pop2.exam.ple
1852 set mta=smtps://smtp.exam.ple:465
1853 set mta=smtp://smtp.exam.ple smtp-use-starttls
1857 Normally that is all there is to do, however plenty of knobs exist to
1858 adjust settings shall the necessity or desire arise.
1859 E.g., it is possible to fine-tune certificate verification via
1860 .Va ssl-ca-flags .
1861 Also interesting may be the possibility to configure the allowed
1862 .Va ssl-protocol Ns
1863 s that a communication channel may use: whereas in the past hints of
1864 how to restrict the set of protocols to highly secure ones were
1865 indicated, as of the time of this writing the allowed protocols, or at
1866 least the allowed
1867 .Va ssl-cipher-list ,
1868 may need to become relaxed in order to be able to connect to some
1869 servers.
1870 E.g., the following example settings allows connection of a
1871 .Dq Lion
1872 which uses OpenSSL 0.9.8za from June 2014:
1874 .Bd -literal -offset indent
1875 set ssl-protocol-LION=ALL,-SSLv3,-TLSv1
1876 set ssl-cipher-list-LION=TLSv1.2:!aNULL:!eNULL:\e
1877     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
1878     DHE-RSA-AES256-SHA:@STRENGTH
1882 The OpenSSL program
1883 .Xr ciphers 1
1884 can be used and should be referred to when creating a custom cipher list.
1885 Variables of interest for SSL/TLS in general are
1886 .Va ssl-ca-dir ,
1887 .Va ssl-ca-file ,
1888 .Va ssl-ca-flags ,
1889 .Va ssl-ca-no-defaults ,
1890 .Va ssl-cert ,
1891 .Va ssl-cipher-list ,
1892 .Va ssl-config-file ,
1893 .Va ssl-curves ,
1894 .Va ssl-crl-dir ,
1895 .Va ssl-crl-file ,
1896 .Va ssl-key ,
1897 .Va ssl-protocol ,
1898 .Va ssl-rand-file
1899 as well as
1900 .Va ssl-verify .
1901 .\" }}}
1903 .\" .Ss "Character sets" {{{
1904 .Ss "Character sets"
1906 \*(OP \*(UA detects the character set of the terminal by using
1907 mechanisms that are controlled by the
1908 .Ev LC_CTYPE
1909 environment variable
1910 (in fact
1911 .Ev LC_ALL ,
1912 .Ev \&\&LC_CTYPE ,
1913 .Ev LANG ,
1914 in that order, see there).
1915 The internal variable
1916 .Va ttycharset
1917 will be set to the detected terminal character set accordingly,
1918 and will thus show up in the output of commands like, e.g.,
1919 .Ic set
1921 .Ic varshow .
1924 However, the user may give a value for
1925 .Va ttycharset
1926 during startup, so that it is possible to send mail in a completely
1927 .Dq faked
1928 locale environment, an option which can be used to generate and send,
1929 e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII
1930 .Ql LC_ALL=C
1931 environment (an example of this can be found in the section
1932 .Sx "On sending mail, and non-interactive mode" ) .
1933 Changing the value does not mean much beside that, because several
1934 aspects of the real character set are implied by the locale environment
1935 of the system, which stays unaffected by
1936 .Va ttycharset .
1939 Messages and attachments which consist of 7-bit clean data will be
1940 classified as consisting of
1941 .Va charset-7bit
1942 character data.
1943 This is a problem if the
1944 .Va ttycharset
1945 character set is a multibyte character set that is also 7-bit clean.
1946 For example, the Japanese character set ISO-2022-JP is 7-bit clean but
1947 capable to encode the rich set of Japanese Kanji, Hiragana and Katakana
1948 characters: in order to notify receivers of this character set the mail
1949 message must be MIME encoded so that the character set ISO-2022-JP can
1950 be advertised!
1951 To achieve this, the variable
1952 .Va charset-7bit
1953 must be set to ISO-2022-JP.
1954 (Today a better approach regarding email is the usage of UTF-8, which
1955 uses 8-bit bytes for non-US-ASCII data.)
1958 If the \*(OPal character set conversion capabilities are not available
1959 .Pf ( Va features
1960 does not include the term
1961 .Ql +iconv ) ,
1962 then
1963 .Va ttycharset
1964 will be the only supported character set,
1965 it is simply assumed that it can be used to exchange 8-bit messages
1966 (over the wire an intermediate, configurable
1967 .Va mime-encoding
1968 may be applied),
1969 and the rest of this section does not apply;
1970 it may however still be necessary to explicitly set it if automatic
1971 detection fails, since in that case it defaults to
1972 .\" (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!)
1973 LATIN1 a.k.a. ISO-8859-1.
1976 \*(OP When reading messages, their text is converted into
1977 .Va ttycharset
1978 as necessary in order to display them on the users terminal.
1979 Unprintable characters and invalid byte sequences are detected
1980 and replaced by proper substitution characters.
1981 Character set mappings for source character sets can be established with
1982 the command
1983 .Ic charsetalias ,
1984 which may be handy to work around faulty character set catalogues (e.g.,
1985 to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment
1986 of one character set as another one (e.g., to interpret LATIN1 as CP1252).
1987 Also see
1988 .Va charset-unknown-8bit
1989 to deal with another hairy aspect of message interpretation.
1992 When sending messages all their parts and attachments are classified.
1993 Whereas no character set conversion is performed on those parts which
1994 appear to be binary data,
1995 the character set being used must be declared within the MIME header of
1996 an outgoing text part if it contains characters that do not conform to
1997 the set of characters that are allowed by the email standards.
1998 Permissible values for character sets used in outgoing messages can be
1999 declared using the
2000 .Va sendcharsets
2001 variable, and
2002 .Va charset-8bit ,
2003 which defines a catch-all last-resort fallback character set that is
2004 implicitly appended to the list of character sets in
2005 .Va sendcharsets .
2008 When replying to a message and the variable
2009 .Va reply-in-same-charset
2010 is set, then the character set of the message being replied to
2011 is tried first (still being a subject of
2012 .Ic charsetalias ) .
2013 And it is also possible to make \*(UA work even more closely related to
2014 the current locale setting automatically by using the variable
2015 .Va sendcharsets-else-ttycharset ,
2016 please see there for more information.
2019 All the specified character sets are tried in order unless the
2020 conversion of the part or attachment succeeds.
2021 If none of the tried (8-bit) character sets is capable to represent the
2022 content of the part or attachment,
2023 then the message will not be sent and its text will optionally be
2024 .Va save Ns d
2026 .Ev DEAD .
2027 In general, if a message saying
2028 .Dq cannot convert from a to b
2029 appears, either some characters are not appropriate for the currently
2030 selected (terminal) character set,
2031 or the needed conversion is not supported by the system.
2032 In the first case, it is necessary to set an appropriate
2033 .Ev LC_CTYPE
2034 locale and/or the variable
2035 .Va ttycharset .
2038 The best results are usually achieved when \*(UA is run in a UTF-8
2039 locale on an UTF-8 capable terminal, in which case the full Unicode
2040 spectrum of characters is available.
2041 In this setup characters from various countries can be displayed,
2042 while it is still possible to use more simple character sets for sending
2043 to retain maximum compatibility with older mail clients.
2046 On the other hand the POSIX standard defines a locale-independent 7-bit
2047 .Dq portable character set
2048 that should be used when overall portability is an issue, the even more
2049 restricted subset named
2050 .Dq portable filename character set
2051 consists of A-Z, a-z, 0-9, period
2052 .Ql \&. ,
2053 underscore
2054 .Ql _
2055 and hyphen-minus
2056 .Ql - .
2057 .\" }}}
2059 .\" .Ss "Message states" {{{
2060 .Ss "Message states"
2062 \*(UA differentiates in between several different message states;
2063 the current state will be reflected in header summary displays if
2064 .Va headline
2065 is configured to do so (via the internal variable
2066 .Va attrlist ) ,
2067 and messages can also be selected and be acted upon depending on their
2068 state (see
2069 .Sx "Specifying messages" ) .
2070 When operating on the system
2071 .Va inbox ,
2072 or in any other
2073 .Mx -sx
2074 .Sx "primary system mailbox" ,
2075 special actions, like the automatic moving of messages to the
2076 .Mx -sx
2077 .Sx "secondary mailbox"
2078 .Ev MBOX ,
2079 may be applied when the mailbox is left (also implicitly via
2080 a successful exit of \*(UA, but not if the special command
2081 .Ic exit
2082 is used) \(en however, because this may be irritating to users which
2083 are used to
2084 .Dq more modern
2085 mail-user-agents, the default global
2086 .Pa \*(UR
2087 sets the internal
2088 .Va hold
2090 .Va keepsave
2091 variables in order to suppress this behaviour.
2093 .Bl -hang -width ".It Ql new"
2094 .It Ql new
2095 Message has neither been viewed nor moved to any other state.
2096 Such messages are retained even in the
2097 .Mx -sx
2098 .Sx "primary system mailbox" .
2100 .It Ql unread
2101 Message has neither been viewed nor moved to any other state, but the
2102 message was present already when the mailbox has been opened last:
2103 Such messages are retained even in the
2104 .Mx -sx
2105 .Sx "primary system mailbox" .
2107 .It Ql read
2108 The message has been processed by one of the following commands:
2109 .Ic ~f ,
2110 .Ic ~m ,
2111 .Ic ~F ,
2112 .Ic ~M ,
2113 .Ic copy ,
2114 .Ic mbox ,
2115 .Ic next ,
2116 .Ic pipe  ,
2117 .Ic Print ,
2118 .Ic print ,
2119 .Ic top ,
2120 .Ic Type ,
2121 .Ic type ,
2122 .Ic undelete .
2123 The commands
2124 .Ic dp
2126 .Ic dt
2127 will always try to automatically
2128 .Dq step
2130 .Ic type
2132 .Dq next
2133 logical message, and may thus mark multiple messages as read, the
2134 .Ic delete
2135 command will do so if  the internal variable
2136 .Va autoprint
2137 is set.
2138 Except when the
2139 .Ic exit
2140 command is used, messages that are in a
2141 .Mx -sx
2142 .Sx "primary system mailbox"
2143 and are in
2144 .Ql read
2145 state when the mailbox is left will be saved in the
2146 .Mx -sx
2147 .Sx "secondary mailbox"
2148 .Ev MBOX
2149 unless the internal variable
2150 .Va hold
2151 it set.
2153 .It Ql deleted
2154 The message has been processed by one of the following commands:
2155 .Ic delete ,
2156 .Ic dp ,
2157 .Ic dt .
2158 Only
2159 .Ic undelete
2160 can be used to access such messages.
2162 .It Ql preserved
2163 The message has been processed by a
2164 .Ic preserve
2165 command and it will be retained in its current location.
2167 .It Ql saved
2168 The message has been processed by one of the following commands:
2169 .Ic save
2171 .Ic write .
2172 Unless when the
2173 .Ic exit
2174 command is used, messages that are in a
2175 .Mx -sx
2176 .Sx "primary system mailbox"
2177 and are in
2178 .Ql saved
2179 state when the mailbox is left will be deleted; they will be saved in the
2180 .Mx -sx
2181 .Sx "secondary mailbox"
2182 .Ev MBOX
2183 when the internal variable
2184 .Va keepsave
2185 is set.
2189 In addition to these message states, flags which otherwise have no
2190 technical meaning in the mail system except allowing special ways of
2191 addressing them when
2192 .Sx "Specifying messages"
2193 can be set on messages.
2194 These flags are saved with messages and are thus persistent, and are
2195 portable between a set of widely used MUAs.
2197 .Bl -hang -width ".It Ic answered"
2198 .It Ic answered
2199 Mark messages as having been answered.
2200 .It Ic draft
2201 Mark messages as being a draft.
2202 .It Ic flag
2203 Mark messages which need special attention.
2205 .\" }}}
2207 .\" .Ss "Specifying messages" {{{
2208 .Ss "Specifying messages"
2210 Commands such as
2211 .Ic from ,
2212 .Ic type
2214 .Ic delete
2215 can be given a list of message numbers as arguments to apply to a number
2216 of messages at once.
2217 Thus
2218 .Ql delete 1 2
2219 deletes messages 1 and 2,
2220 whereas
2221 .Ql delete 1-5
2222 will delete the messages 1 through 5.
2223 In sorted or threaded mode (see the
2224 .Ic sort
2225 command),
2226 .Ql delete 1-5
2227 will delete the messages that are located between (and including)
2228 messages 1 through 5 in the sorted/threaded order, as shown in the
2229 .Ic headers
2230 summary.
2231 The following special message names exist:
2234 .Bl -tag -width ".It Ar BaNg"
2235 .It Ar \&.
2236 The current message, the so-called
2237 .Dq dot .
2239 .It Ar \&;
2240 The message that was previously the current message.
2242 .It Ar \&,
2243 The parent message of the current message,
2244 that is the message with the Message-ID given in the
2245 .Ql In-Reply-To:
2246 field or the last entry of the
2247 .Ql References:
2248 field of the current message.
2250 .It Ar -
2251 The next previous undeleted message,
2252 or the next previous deleted message for the
2253 .Ic undelete
2254 command.
2255 In sorted/threaded mode,
2256 the next previous such message in the sorted/threaded order.
2258 .It Ar +
2259 The next undeleted message,
2260 or the next deleted message for the
2261 .Ic undelete
2262 command.
2263 In sorted/threaded mode,
2264 the next such message in the sorted/threaded order.
2266 .It Ar ^
2267 The first undeleted message,
2268 or the first deleted message for the
2269 .Ic undelete
2270 command.
2271 In sorted/threaded mode,
2272 the first such message in the sorted/threaded order.
2274 .It Ar $
2275 The last message.
2276 In sorted/threaded mode,
2277 the last message in the sorted/threaded order.
2279 .It Ar & Ns Ar x
2280 In threaded mode,
2281 selects the message addressed with
2282 .Ar x ,
2283 where
2284 .Ar x
2285 is any other message specification,
2286 and all messages from the thread that begins at it.
2287 Otherwise it is identical to
2288 .Ar x .
2290 .Ar x
2291 is omitted,
2292 the thread beginning with the current message is selected.
2294 .It Ar *
2295 All messages.
2296 .It Ar `
2297 All messages that were included in the
2298 .Sx "Message list arguments"
2299 of the previous command.
2301 .It Ar x-y
2302 An inclusive range of message numbers.
2303 Selectors that may also be used as endpoints include any of
2304 .Ar .;-+^$ .
2306 .It Ar address
2307 A case-insensitive
2308 .Dq any substring matches
2309 search against the
2310 .Ql From:
2311 header, which will match addresses (too) even if
2312 .Va showname
2313 is set (and POSIX says
2314 .Dq any address as shown in a header summary shall be matchable in this form ) ;
2315 However, if the
2316 .Va allnet
2317 variable is set, only the local part of the address is evaluated
2318 for the comparison, not ignoring case, and the setting of
2319 .Va showname
2320 is completely ignored.
2321 For finer control and match boundaries use the
2322 .Ql @
2323 search expression.
2325 .It Ar / Ns Ar string
2326 All messages that contain
2327 .Ar string
2328 in the subject field (case ignored).
2329 See also the
2330 .Va searchheaders
2331 variable.
2333 .Ar string
2334 is empty,
2335 the string from the previous specification of that type is used again.
2337 .It Xo Op Ar @ Ns Ar name-list Ns
2338 .Ar @ Ns Ar expr
2340 All messages that contain the given case-insensitive search
2341 .Ar expr Ns
2342 ession; if the \*(OPal regular expression (see
2343 .Xr re_format 7 )
2344 support is available
2345 .Ar expr
2346 will be interpreted as (an extended) one if any of the
2347 .Dq magical
2348 (extended) regular expression characters is seen: in this case this
2349 should match strings correctly which are in the locale
2350 .Ev LC_CTYPE
2351 encoding.
2352 If the optional
2353 .Ar @ Ns Ar name-list
2354 part is missing, the search is restricted to the subject field body,
2355 but otherwise
2356 .Ar name-list
2357 specifies a comma-separated list of header fields to search, as in
2359 .Dl '@to,from,cc@Someone i ought to know'
2361 In order to search for a string that includes a
2362 .Ql @
2363 (commercial at) character the
2364 .Ar name-list
2365 is effectively non-optional, but may be given as the empty string.
2366 Some special header fields may be abbreviated:
2367 .Ql f ,
2368 .Ql t ,
2369 .Ql c ,
2370 .Ql b
2372 .Ql s
2373 will match
2374 .Ql From ,
2375 .Ql To ,
2376 .Ql Cc ,
2377 .Ql Bcc
2379 .Ql Subject ,
2380 respectively and case-insensitively.
2381 The special names
2382 .Ql header
2384 .Ql <
2385 can be used to search in (all of) the header(s) of the message, and the
2386 special names
2387 .Ql body
2389 .Ql >
2391 .Ql text
2393 .Ql =
2394 can be used to perform full text searches \(en whereas the former
2395 searches only the body, the latter also searches the message header.
2397 This message specification performs full text comparison, but even with
2398 regular expression support it is almost impossible to write a search
2399 expression that savely matches only a specific address domain.
2400 To request that the content of the header is treated as a list of
2401 addresses, and to strip those down to the plain email address which the
2402 search expression is to be matched against, prefix the header name
2403 (abbreviation) with a tilde
2404 .Ql ~ :
2406 .Dl @~f@@a\e.safe\e.domain\e.match$
2408 .It Ar :c
2409 All messages of state
2410 .Ql c ,
2411 where
2412 .Ql c
2413 is one or multiple of the following colon modifiers:
2415 .Bl -tag -compact -width ".It Ar :M"
2416 .It Ar n
2417 .Ql new
2418 messages.
2419 .It Ar o
2420 Old messages (any not in state
2421 .Ql read
2423 .Ql new ) .
2424 .It Ar u
2425 .Ql unread
2426 messages.
2427 .It Ar d
2428 .Ql deleted
2429 messages (for the
2430 .Ic undelete
2432 .Ic from
2433 commands only).
2434 .It Ar r
2435 .Ql read
2436 messages.
2437 .It Ar f
2438 .Ic flag Ns
2439 ged messages.
2440 .It Ar a
2441 .Ic answered
2442 messages (cf. the variable
2443 .Va markanswered ) .
2444 .It Ar t
2445 Messages marked as
2446 .Ic draft .
2447 .It Ar s
2448 \*(OP Messages classified as spam (see
2449 .Sx "Handling spam" . )
2450 .It Ar S
2451 \*(OP Messages with unsure spam classification.
2457 \*(OP IMAP-style SEARCH expressions may also be used.
2458 This addressing mode is available with all types of mailbox
2459 .Ic folder Ns
2460 s; \*(UA will perform the search locally as necessary.
2461 Strings must be enclosed by double quotes
2462 .Ql \&"
2463 in their entirety if they contain whitespace or parentheses;
2464 within the quotes, only reverse solidus
2465 .Ql \e
2466 is recognized as an escape character.
2467 All string searches are case-insensitive.
2468 When the description indicates that the
2469 .Dq envelope
2470 representation of an address field is used,
2471 this means that the search string is checked against both a list
2472 constructed as
2474 .Bd -literal -offset indent
2475 (\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)
2479 for each address,
2480 and the addresses without real names from the respective header field.
2481 These search expressions can be nested using parentheses, see below for
2482 examples.
2485 .Bl -tag -compact -width ".It Ar _n_u"
2486 .It Ar ( criterion )
2487 All messages that satisfy the given
2488 .Ar criterion .
2489 .It Ar ( criterion1 criterion2 ... criterionN )
2490 All messages that satisfy all of the given criteria.
2492 .It Ar ( or criterion1 criterion2 )
2493 All messages that satisfy either
2494 .Ar criterion1
2496 .Ar criterion2 ,
2497 or both.
2498 To connect more than two criteria using
2499 .Ql or
2500 specifications have to be nested using additional parentheses,
2501 as with
2502 .Ql (or a (or b c)) ,
2503 since
2504 .Ql (or a b c)
2505 really means
2506 .Ql ((a or b) and c) .
2507 For a simple
2508 .Ql or
2509 operation of independent criteria on the lowest nesting level,
2510 it is possible to achieve similar effects by using three separate
2511 criteria, as with
2512 .Ql (a) (b) (c) .
2514 .It Ar ( not criterion )
2515 All messages that do not satisfy
2516 .Ar criterion .
2517 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
2518 All messages that contain
2519 .Ar string
2520 in the envelope representation of the
2521 .Ql Bcc:
2522 field.
2523 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
2524 All messages that contain
2525 .Ar string
2526 in the envelope representation of the
2527 .Ql Cc:
2528 field.
2529 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
2530 All messages that contain
2531 .Ar string
2532 in the envelope representation of the
2533 .Ql From:
2534 field.
2535 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
2536 All messages that contain
2537 .Ar string
2538 in the
2539 .Ql Subject:
2540 field.
2541 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
2542 All messages that contain
2543 .Ar string
2544 in the envelope representation of the
2545 .Ql To:
2546 field.
2547 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
2548 All messages that contain
2549 .Ar string
2550 in the specified
2551 .Ql Name:
2552 field.
2553 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
2554 All messages that contain
2555 .Ar string
2556 in their body.
2557 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
2558 All messages that contain
2559 .Ar string
2560 in their header or body.
2561 .It Ar ( larger size )
2562 All messages that are larger than
2563 .Ar size
2564 (in bytes).
2565 .It Ar ( smaller size )
2566 All messages that are smaller than
2567 .Ar size
2568 (in bytes).
2570 .It Ar ( before date )
2571 All messages that were received before
2572 .Ar date ,
2573 which must be in the form
2574 .Ql d[d]-mon-yyyy ,
2575 where
2576 .Ql d
2577 denotes the day of the month as one or two digits,
2578 .Ql mon
2579 is the name of the month \(en one of
2580 .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ,
2582 .Ql yyyy
2583 is the year as four digits, e.g.,
2584 .Ql 28-Dec-2012 .
2586 .It Ar ( on date )
2587 All messages that were received on the specified date.
2588 .It Ar ( since date )
2589 All messages that were received since the specified date.
2590 .It Ar ( sentbefore date )
2591 All messages that were sent on the specified date.
2592 .It Ar ( senton date )
2593 All messages that were sent on the specified date.
2594 .It Ar ( sentsince date )
2595 All messages that were sent since the specified date.
2596 .It Ar ()
2597 The same criterion as for the previous search.
2598 This specification cannot be used as part of another criterion.
2599 If the previous command line contained more than one independent
2600 criterion then the last of those criteria is used.
2602 .\" }}}
2604 .\" .Ss "On terminal control and line editor" {{{
2605 .Ss "On terminal control and line editor"
2607 \*(OP Terminal control will be realized through one of the standard
2609 libraries, either the
2610 .Lb libtermcap ,
2611 or, alternatively, the
2612 .Lb libterminfo ,
2613 both of which will be initialized to work with the environment variable
2614 .Ev TERM .
2615 Terminal control will enhance or enable interactive usage aspects, e.g.,
2616 .Sx "Coloured display" ,
2617 and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the
2618 byte-sequences of keys like the cursor and function keys.
2621 The internal variable
2622 .Va termcap
2623 can be used to overwrite settings or to learn (correct(ed)) keycodes.
2624 \*(UA may also become a fullscreen application by entering the
2625 so-called ca-mode and switching to an alternative exclusive screen
2626 (content) shall the terminal support it and the internal variable
2627 .Va termcap-ca-mode
2628 has been set explicitly.
2629 Actual interaction with the chosen library can be disabled completely by
2630 setting the internal variable
2631 .Va termcap-disable ;
2632 .Va termcap
2633 will be queried regardless, which is true even if the \*(OPal library
2634 support has not been enabled at configuration time as long as some other
2635 \*(OP which (may) query terminal control sequences has been enabled.
2638 \*(OP The built-in Mailx-Line-Editor (MLE) should work in all
2639 environments which comply to the ISO C standard
2640 .St -isoC-amd1 ,
2641 and will support wide glyphs if possible (the necessary functionality
2642 had been removed from ISO C, but was included in
2643 .St -xpg4 ) .
2644 Prevent usage of a line editor in interactive mode by setting the
2645 internal variable
2646 .Va line-editor-disable .
2647 Especially if the \*(OPal terminal control support is missing setting
2648 entries in the internal variable
2649 .Va termcap
2650 will help shall the MLE misbehave, see there for more.
2651 The MLE can support a little bit of
2652 .Ic colour .
2655 \*(OP If the
2656 .Ic history
2657 feature is available then input from line editor prompts will be saved
2658 in a history list that can be searched in and be expanded from.
2659 Such saving can be prevented by prefixing input with any amount of
2660 whitespace.
2661 Aspects of history, like allowed content and maximum size, as well as
2662 whether history shall be saved persistently, can be configured with the
2663 internal variables
2664 .Va history-file ,
2665 .Va history-gabby ,
2666 .Va history-gabby-persist
2668 .Va history-size .
2671 The MLE supports a set of editing and control commands.
2672 By default (as) many (as possible) of these will be assigned to a set of
2673 single-letter control codes, which should work on any terminal (and can
2674 be generated by holding the
2675 .Dq control
2676 key while pressing the key of desire, e.g.,
2677 .Ql control-D ) .
2678 If the \*(OPal
2679 .Ic bind
2680 command is available then the MLE commands can also be accessed freely
2681 by assigning the command name, which is shown in parenthesis in the list
2682 below, to any desired key-sequence, and the MLE will instead and also use
2683 .Ic bind
2684 to establish its built-in key bindings
2685 (more of them if the \*(OPal terminal control is available),
2686 an action which can then be suppressed completely by setting
2687 .Va line-editor-no-defaults .
2688 .Sx "Shell-style argument quoting"
2689 notation is used in the following;
2690 combinations not mentioned either cause job control signals or do not
2691 generate a (unique) keycode:
2695 .Bl -tag -compact -width ".It Ql \eBa"
2696 .It Ql \ecA
2697 Go to the start of the line
2699 .Pf ( Cd mle-go-home ) .
2701 .It Ql \ecB
2702 Move the cursor backward one character
2704 .Pf ( Cd mle-go-bwd ) .
2706 .It Ql \ecD
2707 Forward delete the character under the cursor;
2708 quits \*(UA if used on the empty line unless the internal variable
2709 .Va ignoreeof
2710 is set
2712 .Pf ( Cd mle-del-fwd ) .
2714 .It Ql \ecE
2715 Go to the end of the line
2717 .Pf ( Cd mle-go-end ) .
2719 .It Ql \ecF
2720 Move the cursor forward one character
2722 .Pf ( Cd mle-go-fwd ) .
2724 .It Ql \ecG
2725 Cancel current operation, full reset.
2726 If there is an active history search or tabulator expansion then this
2727 command will first reset that, reverting to the former line content;
2728 thus a second reset is needed for a full reset in this case
2730 .Pf ( Cd mle-reset ) .
2732 .It Ql \ecH
2733 Backspace: backward delete one character
2735 .Pf ( Cd mle-del-bwd ) .
2737 .It Ql \ecI
2738 \*(NQ
2739 Horizontal tabulator:
2740 try to expand the word before the cursor, supporting the usual
2741 .Sx "Filename transformations"
2743 .Pf ( Cd mle-complete ) .
2744 This is affected by
2745 .Cd mle-quote-rndtrip .
2747 .It Ql \ecJ
2748 Newline:
2749 commit the current line
2751 .Pf ( Cd mle-commit ) .
2753 .It Ql \ecK
2754 Cut all characters from the cursor to the end of the line
2756 .Pf ( Cd mle-snarf-end ) .
2758 .It Ql \ecL
2759 Repaint the line
2761 .Pf ( Cd mle-repaint ) .
2763 .It Ql \ecN
2764 \*(OP Go to the next history entry
2766 .Pf ( Cd mle-hist-fwd ) .
2768 .It Ql \ecO
2769 (\*(OPally context-dependent) Invokes the command
2770 .Ic dt .
2772 .It Ql \ecP
2773 \*(OP Go to the previous history entry
2775 .Pf ( Cd mle-hist-bwd ) .
2777 .It Ql \ecQ
2778 Toggle roundtrip mode shell quotes, where produced,
2779 on and off
2781 .Pf ( Cd mle-quote-rndtrip ) .
2782 This setting is temporary, and will be forgotten once the command line
2783 is committed; also see
2784 .Ic shcodec .
2786 .It Ql \ecR
2787 \*(OP Complete the current line from (the remaining) older history entries
2789 .Pf ( Cd mle-hist-srch-bwd ) .
2791 .It Ql \ecS
2792 \*(OP Complete the current line from (the remaining) newer history entries
2794 .Pf ( Cd mle-hist-srch-fwd ) .
2796 .It Ql \ecT
2797 Paste the snarf buffer
2799 .Pf ( Cd mle-paste ) .
2801 .It Ql \ecU
2802 The same as
2803 .Ql \ecA
2804 followed by
2805 .Ql \ecK
2807 .Pf ( Cd mle-snarf-line ) .
2809 .It Ql \ecV
2810 Prompts for a Unicode character (its hexadecimal number) to be inserted
2812 .Pf ( Cd mle-prompt-char ) .
2813 Note this command needs to be assigned to a single-letter control code
2814 in order to become recognized and executed during input of
2815 a key-sequence (only three single-letter control codes can be used for
2816 that shortcut purpose); this control code is special-treated and cannot
2817 be part of any other sequence, because any occurrence will perform the
2818 .Cd mle-prompt-char
2819 function immediately.
2821 .It Ql \ecW
2822 Cut the characters from the one preceding the cursor to the preceding
2823 word boundary
2825 .Pf ( Cd mle-snarf-word-bwd ) .
2827 .It Ql \ecX
2828 Move the cursor forward one word boundary
2830 .Pf ( Cd mle-go-word-fwd ) .
2832 .It Ql \ecY
2833 Move the cursor backward one word boundary
2835 .Pf ( Cd mle-go-word-bwd ) .
2837 .It Ql \ec[
2838 Escape: reset a possibly used multibyte character input state machine
2839 and \*(OPally a lingering, incomplete key binding
2841 .Pf ( Cd mle-cancel ) .
2842 This command needs to be assigned to a single-letter control code in
2843 order to become recognized and executed during input of a key-sequence
2844 (only three single-letter control codes can be used for that shortcut
2845 purpose).
2846 This control code may also be part of a multi-byte sequence, but if
2847 a sequence is active and the very control code is currently also an
2848 expected input, then it will first be consumed by the active sequence.
2850 .It Ql \ec\e
2851 (\*(OPally context-dependent) Invokes the command
2852 .Ql Ic z Ns + .
2854 .It Ql \ec]
2855 (\*(OPally context-dependent) Invokes the command
2856 .Ql Ic z Ns $ .
2858 .It Ql \ec^
2859 (\*(OPally context-dependent) Invokes the command
2860 .Ql Ic z Ns 0 .
2862 .It Ql \ec_
2863 Cut the characters from the one after the cursor to the succeeding word
2864 boundary
2866 .Pf ( Cd mle-snarf-word-fwd ) .
2868 .It Ql \ec?
2869 Backspace:
2870 .Cd mle-del-bwd .
2872 .It \(en
2874 .Cd mle-fullreset :
2875 different to
2876 .Cd mle-reset
2877 this will immediately reset a possibly active search etc.
2879 .It \(en
2881 .Cd mle-bell :
2882 ring the audible bell.
2884 .\" }}}
2886 .\" .Ss "Coloured display" {{{
2887 .Ss "Coloured display"
2889 \*(OP \*(UA can be configured to support a coloured display and font
2890 attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic
2891 rendition) escape sequences.
2892 Usage of colours and font attributes solely depends upon the
2893 capability of the detected terminal type that is defined by the
2894 environment variable
2895 .Ev TERM
2896 and which can be fine-tuned by the user via the internal variable
2897 .Va termcap .
2900 On top of what \*(UA knows about the terminal the boolean variable
2901 .Va colour-pager
2902 defines whether the actually applicable colour and font attribute
2903 sequences should also be generated when output is going to be paged
2904 through the external program defined by the environment variable
2905 .Ev PAGER
2906 (also see
2907 .Va crt Ns
2909 This is not enabled by default because different pager programs need
2910 different command line switches or other configuration in order to
2911 support those sequences.
2912 \*(UA however knows about some widely used pagers and in a clean
2913 environment it is often enough to simply set
2914 .Va colour-pager ;
2915 please refer to that variable for more on this topic.
2918 If the variable
2919 .Va colour-disable
2920 is set then any active usage of colour and font attribute sequences
2921 is suppressed, but without affecting possibly established
2922 .Ic colour
2923 mappings.
2926 To define and control colours and font attributes a single multiplexer
2927 command family exists:
2928 .Ic colour
2929 shows or defines colour mappings for the given colour type (e.g.,
2930 monochrome) and
2931 .Ic uncolour
2932 can be used to remove mappings of a given colour type.
2933 Since colours are only available in interactive mode, it may make
2934 sense to conditionalize the colour setup by encapsulating it with
2935 .Ic if :
2937 .Bd -literal -offset indent
2938 if terminal && [ "$features" =% +colour ]
2939   colour iso view-msginfo ft=bold,fg=green
2940   colour iso view-header ft=bold,fg=red from,subject
2941   colour iso view-header fg=red
2943   uncolour iso view-header from,subject
2944   colour iso view-header ft=bold,fg=magenta,bg=cyan
2945   colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
2946   colour mono view-header ft=bold
2947   colour mono view-header ft=bold,ft=reverse subject,from
2948 endif
2950 .\" }}}
2952 .\" .Ss "Handling spam" {{{
2953 .Ss "Handling spam"
2955 \*(OP \*(UA can make use of several spam interfaces for the purpose of
2956 identification of, and, in general, dealing with spam messages.
2957 A precondition of most commands in order to function is that the
2958 .Va spam-interface
2959 variable is set to one of the supported interfaces.
2960 Once messages have been identified as spam their (volatile)
2961 .Ql is-spam
2962 state can be prompted: the
2963 .Ql Ar :s
2965 .Ql Ar :S
2966 message specifications will address respective messages and their
2967 .Va attrlist
2968 entries will be used when displaying the
2969 .Va headline
2970 in the header display.
2972 .Bl -bullet
2974 .Ic spamrate
2975 rates the given messages and sets their
2976 .Ql is-spam
2977 flag accordingly.
2978 If the spam interface offers spam scores those can also be displayed in
2979 the header display by including the
2980 .Ql %$
2981 format in the
2982 .Va headline
2983 variable.
2985 .Ic spamham ,
2986 .Ic spamspam
2988 .Ic spamforget
2989 will interact with the Bayesian filter of the chosen interface and learn
2990 the given messages as
2991 .Dq ham
2993 .Dq spam ,
2994 respectively; the last command can be used to cause
2995 .Dq unlearning
2996 of messages; it adheres to their current
2997 .Ql is-spam
2998 state and thus reverts previous teachings.
3000 .Ic spamclear
3002 .Ic spamset
3003 will simply set and clear, respectively, the mentioned volatile
3004 .Ql is-spam
3005 message flag, without any interface interaction.
3010 .Xr spamassassin 1
3011 based
3012 .Va spam-interface
3013 .Ql spamc
3014 requires a running instance of the
3015 .Xr spamd 1
3016 server in order to function, started with the option
3017 .Fl -allow-tell
3018 shall Bayesian filter learning be possible.
3020 .Bd -literal -offset indent
3021 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
3022 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e
3023     --daemonize [--local] [--allow-tell]
3027 Thereafter \*(UA can make use of these interfaces:
3029 .Bd -literal -offset indent
3030 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3031     -Sspamc-command=/usr/local/bin/spamc \e
3032     -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
3034 $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e
3035     -Sspamc-command=/usr/local/bin/spamc \e
3036     -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=
3040 Using the generic filter approach allows usage of programs like
3041 .Xr bogofilter 1 .
3042 Here is an example, requiring it to be accessible via
3043 .Ev PATH :
3045 .Bd -literal -offset indent
3046 $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e
3047     -Sspamfilter-ham="bogofilter -n" \e
3048     -Sspamfilter-noham="bogofilter -N" \e
3049     -Sspamfilter-nospam="bogofilter -S" \e
3050     -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e
3051     -Sspamfilter-spam="bogofilter -s" \e
3052     -Sspamfilter-rate-scanscore="1;^(.+)$"
3056 Because messages must exist on local storage in order to be scored (or
3057 used for Bayesian filter training), it is possibly a good idea to
3058 perform the local spam check last:
3060 .Bd -literal -offset indent
3061 define spamdelhook {
3062   # Server side DCC
3063   spamset (header x-dcc-brand-metrics "bulk")
3064   # Server-side spamassassin(1)
3065   spamset (header x-spam-flag "YES")
3066   del :s # TODO we HAVE to be able to do `spamrate :u ! :sS'
3067   move :S +maybe-spam
3068   spamrate :u
3069   del :s
3070   move :S +maybe-spam
3072 set folder-hook-FOLDER=spamdelhook
3076 See also the documentation for the variables
3077 .Va spam-interface , spam-maxsize ,
3078 .Va spamc-command , spamc-arguments , spamc-user ,
3079 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
3080   spamfilter-rate
3082 .Va spamfilter-rate-scanscore .
3083 .\" }}}
3085 .\" }}} (DESCRIPTION)
3088 .\" .Sh COMMANDS {{{
3089 .Sh COMMANDS
3091 \*(UA reads input in lines.
3092 An unquoted reverse solidus
3093 .Ql \e
3094 at the end of a command line
3095 .Dq escapes
3096 the newline character: it is discarded and the next line of input is
3097 used as a follow-up line, with all leading whitespace removed;
3098 once an entire line is completed, the whitespace characters
3099 .Cm space , tabulator , newline
3100 as well as those defined by the variable
3101 .Va ifs
3102 are removed from the beginning and end.
3103 Placing any whitespace characters at the beginning of a line will
3104 prevent a possible addition of the command line to the \*(OPal
3105 .Ic history .
3108 The beginning of such input lines is then scanned for the name of
3109 a known command: command names may be abbreviated, in which case the
3110 first command that matches the given prefix will be used.
3111 .Sx "Command modifiers"
3112 may prefix a command in order to modify its behaviour.
3113 A name may also be a
3114 .Ic commandalias ,
3115 which will become expanded until no more expansion is possible.
3116 Once the command that shall be executed is known, the remains of the
3117 input line will be interpreted according to command-specific rules,
3118 documented in the following.
3121 This behaviour is different to the
3122 .Xr sh 1 Ns
3123 ell, which is a programming language with syntactic elements of clearly
3124 defined semantics, and therefore capable to sequentially expand and
3125 evaluate individual elements of a line.
3126 \*(UA will never be able to handle
3127 .Ql ? set one=value two=$one
3128 in a single statement, because the variable assignment is performed by
3129 the command
3130 .Pf ( Ic set ) ,
3131 not the language.
3134 The command
3135 .Ic list
3136 can be used to show the list of all commands, either alphabetically
3137 sorted or in prefix search order (these do not match, also because the
3138 POSIX standard prescribes a set of abbreviations).
3139 \*(OPally the command
3140 .Ic help
3142 .Ic \&? ) ,
3143 when given an argument, will show a documentation string for the
3144 command matching the expanded argument, as in
3145 .Ql ?t ,
3146 which should be a shorthand of
3147 .Ql ?type ;
3148 with these documentation strings both commands support a more
3149 .Va verbose
3150 listing mode which includes the argument type of the command and other
3151 information which applies; a handy suggestion might thus be:
3153 .Bd -literal -offset indent
3154 ? define __xv {
3155   # Before v15: need to enable sh(1)ell-style on _entire_ line!
3156   localopts 1;wysh set verbose;ignerr eval "${@}";return ${?}
3158 ? commandalias xv '\ecall __xv'
3159 ? xv help set
3162 .\" .Ss "Command modifiers" {{{
3163 .Ss "Command modifiers"
3165 Commands may be prefixed by one or multiple command modifiers.
3167 .Bl -bullet
3169 The modifier reverse solidus
3171 .Cm \e ,
3172 to be placed first, prevents
3173 .Ic commandalias
3174 expansions on the remains of the line, e.g.,
3175 .Ql \eecho
3176 will always evaluate the command
3177 .Ic echo ,
3178 even if an (command)alias of the same name exists.
3179 .Ic commandalias
3180 content may itself contain further command modifiers, including
3181 an initial reverse solidus to prevent further expansions.
3184 The modifier
3186 .Cm ignerr
3187 indicates that any error generated by the following command should be
3188 ignored by the state machine and not cause a program exit with enabled
3189 .Va errexit
3190 or for the standardized exit cases in
3191 .Ev POSIXLY_CORRECT
3192 mode.
3193 .Va \&? ,
3194 one of the
3195 .Sx "INTERNAL VARIABLES" ,
3196 will be set to the real exit status of the command regardless.
3199 Some commands support the
3201 .Cm vput
3202 modifier: if used, they expect the name of a variable, which can itself
3203 be a variable, i.e., shell expansion is applied, as their first
3204 argument, and will place their computation result in it instead of the
3205 default location (it is usually written to standard output).
3207 The given name will be tested for being a valid
3208 .Xr sh 1
3209 variable name, and may therefore only consist of upper- and lowercase
3210 characters, digits, and the underscore; the hyphen-minus may be used as
3211 a non-portable extension; digits may not be used as first, hyphen-minus
3212 may not be used as last characters.
3213 In addition the name may either not be one of the known
3214 .Sx "INTERNAL VARIABLES" ,
3215 or must otherwise refer to a writable (non-boolean) value variable.
3216 The actual put operation may fail nonetheless, e.g., if the variable
3217 expects a number argument only a number will be accepted.
3218 Any error during these operations causes the command as such to fail,
3219 and the error number
3220 .Va \&!
3221 will be set to
3222 .Va ^ERR Ns -NOTSUP ,
3223 the exit status
3224 .Va \&?
3225 should be set to
3226 .Ql -1 .
3229 Last, but not least, the modifier
3231 .Cm wysh
3232 can be used for some old and established commands to choose the new
3233 .Sx "Shell-style argument quoting"
3234 rules over the traditional
3235 .Sx "Old-style argument quoting" .
3237 .\" }}}
3239 .\" .Ss "Message list arguments" {{{
3240 .Ss "Message list arguments"
3242 Some commands expect arguments that represent messages (actually
3243 their symbolic message numbers), as has been documented above under
3244 .Sx "Specifying messages"
3245 already.
3246 If no explicit message list has been specified, the next message
3247 forward that satisfies the command's requirements will be used,
3248 and if there are no messages forward of the current message,
3249 the search proceeds backwards;
3250 if there are no good messages at all to be found, an error message is
3251 shown and the command is aborted.
3252 .\" }}}
3254 .\" .Ss "Old-style argument quoting" {{{
3255 .Ss "Old-style argument quoting"
3257 \*(ID This section documents the old, traditional style of quoting
3258 non-message-list arguments to commands which expect this type of
3259 arguments: whereas still used by the majority of such commands, the new
3260 .Sx "Shell-style argument quoting"
3261 may be available even for those via
3262 .Cm wysh ,
3263 one of the
3264 .Sx "Command modifiers" .
3265 Nonetheless care must be taken, because only new commands have been
3266 designed with all the capabilities of the new quoting rules in mind,
3267 which can, e.g., generate control characters.
3270 .Bl -bullet -offset indent
3272 An argument can be enclosed between paired double-quotes
3273 .Ql """argument"""
3275 single-quotes
3276 .Ql 'argument' ;
3277 any whitespace, shell word expansion, or reverse solidus characters
3278 (except as described next) within the quotes are treated literally as
3279 part of the argument.
3280 A double-quote will be treated literally within single-quotes and vice
3281 versa.
3282 Inside such a quoted string the actually used quote character can be
3283 used nonetheless by escaping it with a reverse solidus
3284 .Ql \e ,
3285 as in
3286 .Ql """y\e""ou""" .
3289 An argument that is not enclosed in quotes, as above, can usually still
3290 contain space characters if those spaces are reverse solidus escaped, as in
3291 .Ql you\e are .
3294 A reverse solidus outside of the enclosing quotes is discarded
3295 and the following character is treated literally as part of the argument.
3297 .\" }}}
3299 .\" .Ss "Shell-style argument quoting" {{{
3300 .Ss "Shell-style argument quoting"
3302 Commands which don't expect message-list arguments use
3303 .Xr sh 1 Ns
3304 ell-style, and therefore POSIX standardized, argument parsing and
3305 quoting rules.
3306 \*(ID Most new commands only support these new rules and are flagged
3307 \*(NQ, some elder ones can use them with the command modifier
3308 .Cm wysh ;
3309 in the future only this type of argument quoting will remain.
3312 A command line is parsed from left to right and an input token is
3313 completed whenever an unquoted, otherwise ignored, metacharacter is seen.
3314 Metacharacters are vertical bar
3315 .Cm \&| ,
3316 ampersand
3317 .Cm & ,
3318 semicolon
3319 .Cm \&; ,
3320 as well as all characters from the variable
3321 .Va ifs ,
3322 and / or
3323 .Cm space , tabulator , newline .
3324 The additional metacharacters left and right parenthesis
3325 .Cm \&( , \&)
3326 and less-than and greater-than signs
3327 .Cm < , >
3328 that the
3329 .Xr sh 1
3330 supports are not used, and are treated as ordinary characters: for one
3331 these characters are a vivid part of email addresses, and it seems
3332 highly unlikely that their function will become meaningful to \*(UA.
3334 .Bd -filled -offset indent
3335 .Sy Compatibility note:
3336 \*(ID Please note that even many new-style commands do not yet honour
3337 .Va ifs
3338 to parse their arguments: whereas the
3339 .Xr sh 1 Ns
3340 ell is a language with syntactic elements of clearly defined semantics,
3341 \*(UA parses entire input lines and decides on a per-command base what
3342 to do with the rest of the line.
3343 This also means that whenever an unknown command is seen all that \*(UA
3344 can do is cancellation of the processing of the remains of the line.
3346 It also often depends on an actual subcommand of a multiplexer command
3347 how the rest of the line should be treated, and until v15 we are not
3348 capable to perform this deep inspection of arguments.
3349 Nonetheless, at least the following commands which work with positional
3350 parameters fully support
3351 .Va ifs
3352 for an almost shell-compatible field splitting:
3353 .Ic call , call_if , read , vpospar , xcall .
3357 Any unquoted number sign
3358 .Ql #
3359 at the beginning of a new token starts a comment that extends to the end
3360 of the line, and therefore ends argument processing.
3361 An unquoted dollar sign
3362 .Ql $
3363 will cause variable expansion of the given name, which must be a valid
3364 .Xr sh 1 Ns
3365 ell-style variable name (see
3366 .Cm vput ) :
3367 .Sx "INTERNAL VARIABLES"
3368 as well as
3369 .Sx ENVIRONMENT
3370 (shell) variables can be accessed through this mechanism, brace
3371 enclosing the name is supported (i.e., to subdivide a token).
3374 Whereas the metacharacters
3375 .Cm space , tabulator , newline
3376 only complete an input token, vertical bar
3377 .Cm \&| ,
3378 ampersand
3379 .Cm &
3380 and semicolon
3381 .Cm \&;
3382 also act as control operators and perform control functions.
3383 For now supported is semicolon
3384 .Cm \&; ,
3385 which terminates a single command, therefore sequencing the command line
3386 and making the remainder of the line a subject to reevaluation.
3387 With sequencing, multiple command argument types and quoting rules may
3388 therefore apply to a single line, which can become problematic before
3389 v15: e.g., the first of the following will cause surprising results.
3392 .Dl ? echo one; set verbose; echo verbose=$verbose.
3393 .Dl ? echo one; wysh set verbose; echo verbose=$verbose.
3396 Quoting is a mechanism that will remove the special meaning of
3397 metacharacters and reserved words, and will prevent expansion.
3398 There are four quoting mechanisms: the escape character, single-quotes,
3399 double-quotes and dollar-single-quotes:
3402 .Bl -bullet -offset indent
3404 The literal value of any character can be preserved by preceding it
3405 with the escape character reverse solidus
3406 .Ql \e .
3409 Arguments which are enclosed in
3410 .Ql 'single-\:quotes'
3411 retain their literal value.
3412 A single-quote cannot occur within single-quotes.
3415 The literal value of all characters enclosed in
3416 .Ql \(dqdouble-\:quotes\(dq
3417 is retained, with the exception of dollar sign
3418 .Ql $ ,
3419 which will cause variable expansion, as above, backquote (grave accent)
3420 .Ql ` ,
3421 (which not yet means anything special), reverse solidus
3422 .Ql \e ,
3423 which will escape any of the characters dollar sign
3424 .Ql $
3425 (to prevent variable expansion), backquote (grave accent)
3426 .Ql ` ,
3427 double-quote
3428 .Ql \(dq
3429 (to prevent ending the quote) and reverse solidus
3430 .Ql \e
3431 (to prevent escaping, i.e., to embed a reverse solidus character as-is),
3432 but has no special meaning otherwise.
3435 Arguments enclosed in
3436 .Ql $'dollar-\:single-\:quotes'
3437 extend normal single quotes in that reverse solidus escape sequences are
3438 expanded as follows:
3440 .Bl -tag -compact -width "Ql \eNNN"
3441 .It Ql \ea
3442 bell control character (ASCII and ISO-10646 BEL).
3443 .It Ql \eb
3444 backspace control characer (ASCII and ISO-10646 BS).
3445 .It Ql \eE
3446 escape control character (ASCII and ISO-10646 ESC).
3447 .It Ql \ee
3448 the same.
3449 .It Ql \ef
3450 form feed control character (ASCII and ISO-10646 FF).
3451 .It Ql \en
3452 line feed control character (ASCII and ISO-10646 LF).
3453 .It Ql \er
3454 carriage return control character (ASCII and ISO-10646 CR).
3455 .It Ql \et
3456 horizontal tabulator control character (ASCII and ISO-10646 HT).
3457 .It Ql \ev
3458 vertical tabulator control character (ASCII and ISO-10646 VT).
3459 .It Ql \e\e
3460 emits a reverse solidus character.
3461 .It Ql \e'
3462 single quote.
3463 .It Ql \e"
3464 double quote (escaping is optional).
3465 .It Ql \eNNN
3466 eight-bit byte with the octal value
3467 .Ql NNN
3468 (one to three octal digits), optionally prefixed by an additional
3469 .Ql 0 .
3470 A 0 byte will suppress further output for the quoted argument.
3471 .It Ql \exHH
3472 eight-bit byte with the hexadecimal value
3473 .Ql HH
3474 (one or two hexadecimal characters).
3475 A 0 byte will suppress further output for the quoted argument.
3476 .It Ql \eUHHHHHHHH
3477 the Unicode / ISO-10646 character with the hexadecimal codepoint value
3478 .Ql HHHHHHHH
3479 (one to eight hexadecimal digits) \(em note that Unicode defines the
3480 maximum codepoint ever to be supported as
3481 .Ql 0x10FFFF
3482 (in planes of
3483 .Ql 0xFFFF
3484 characters each).
3485 This escape is only supported in locales that support Unicode (see
3486 .Sx "Character sets" ) ,
3487 in other cases the sequence will remain unexpanded unless the given code
3488 point is ASCII compatible or (if the \*(OPal character set conversion is
3489 available) can be represented in the current locale.
3490 The character NUL will suppress further output for the quoted argument.
3491 .It Ql \euHHHH
3492 Identical to
3493 .Ql \eUHHHHHHHH
3494 except it takes only one to four hexadecimal digits.
3495 .It Ql \ecX
3496 Emits the non-printable (ASCII and compatible) C0 control codes
3497 0 (NUL) to 31 (US), and 127 (DEL).
3498 Printable representations of ASCII control codes can be created by
3499 mapping them to a different part of the ASCII character set, which is
3500 possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is
3501 .Ql 7 + 64 = 71 = G .
3502 The real operation is a bitwise logical XOR with 64 (bit 7 set, see
3503 .Ic vexpr ) ,
3504 thus also covering code 127 (DEL), which is mapped to 63 (question mark):
3505 .Ql ? vexpr ^ 127 64 .
3507 Whereas historically circumflex notation has often been used for
3508 visualization purposes of control codes, e.g.,
3509 .Ql ^G ,
3510 the reverse solidus notation has been standardized:
3511 .Ql \ecG .
3512 Some control codes also have standardized (ISO-10646, ISO C) aliases,
3513 as shown above (e.g.,
3514 .Ql \ea ,
3515 .Ql \en ,
3516 .Ql \et ) :
3517 whenever such an alias exists it will be used for display purposes.
3518 The control code NUL
3519 .Pf ( Ql \ec@ ,
3520 a non-standard extension) will suppress further output for the remains
3521 of the token (which may extend beyond the current quote), or, depending
3522 on the context, the remains of all arguments for the current command.
3523 .It Ql \e$NAME
3524 Non-standard extension: expand the given variable name, as above.
3525 Brace enclosing the name is supported.
3526 .It Ql \e`{command}
3527 Not yet supported, just to raise awareness: Non-standard extension.
3532 Caveats:
3534 .Bd -literal -offset indent
3535 ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
3536 ? echo Quotes ${HOME} and tokens differ! # comment
3537 ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A'
3539 .\" }}}
3541 .\" .Ss "Raw data arguments for codec commands" {{{
3542 .Ss "Raw data arguments for codec commands"
3544 A special set of commands, which all have the string
3545 .Dq codec
3546 in their name, e.g.,
3547 .Ic addrcodec ,
3548 .Ic shcodec ,
3549 .Ic urlcodec ,
3550 take raw string data as input, which means that the content of the
3551 command input line is passed completely unexpanded and otherwise
3552 unchanged: like this the effect of the actual codec is visible without
3553 any noise of possible shell quoting rules etc., i.e., the user can input
3554 one-to-one the desired or questionable data.
3555 To gain a level of expansion, the entire command line can be
3556 .Ic eval Ns
3557 uated first, e.g.,
3559 .Bd -literal -offset indent
3560 ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt
3561 ? echo $res
3562 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3563 ? shcodec d $res
3564 $'/usr/Sch\eu00F6nes Wetter/heute.txt'
3565 ? eval shcodec d $res
3566 /usr/Sch\[:o]nes Wetter/heute.txt
3568 .\" }}}
3570 .\" .Ss "Filename transformations" {{{
3571 .Ss "Filename transformations"
3573 Filenames, where expected, and unless documented otherwise, are
3574 subsequently subject to the following filename transformations, in
3575 sequence:
3577 .Bl -bullet -offset indent
3579 If the given name is a registered
3580 .Ic shortcut ,
3581 it will be replaced with the expanded shortcut.
3584 The filename is matched against the following patterns or strings:
3586 .Bl -hang -compact -width ".Ar %user"
3587 .It Ar #
3588 (Number sign) is expanded to the previous file.
3589 .It Ar %
3590 (Percent sign) is replaced by the invoking
3591 .Mx -ix "primary system mailbox"
3592 user's primary system mailbox, which either is the (itself expandable)
3593 .Va inbox
3594 if that is set, the standardized absolute pathname indicated by
3595 .Ev MAIL
3596 if that is set, or a built-in compile-time default otherwise.
3597 .It Ar %user
3598 Expands to the primary system mailbox of
3599 .Ar user
3600 (and never the value of
3601 .Va inbox ,
3602 regardless of its actual setting).
3603 .It Ar &
3604 (Ampersand) is replaced with the invoking users
3605 .Mx -ix "secondary mailbox"
3606 secondary mailbox, the
3607 .Ev MBOX .
3608 .It Ar +file
3609 Refers to a
3610 .Ar file
3611 in the
3612 .Va folder
3613 directory (if that variable is set).
3614 .It Ar %:filespec
3615 Expands to the same value as
3616 .Ar filespec ,
3617 but has special meaning when used with, e.g., the command
3618 .Ic file :
3619 the file will be treated as a primary system mailbox by, e.g., the
3620 .Ic mbox
3622 .Ic save
3623 commands, meaning that messages that have been read in the current
3624 session will be moved to the
3625 .Ev MBOX
3626 mailbox instead of simply being flagged as read.
3630 Meta expansions are applied to the resulting filename, as applicable to
3631 the resulting file access protocol (also see
3632 .Sx "On URL syntax and credential lookup" ) .
3633 If the fully expanded filename results in multiple pathnames and the
3634 command is expecting only one file, an error results.
3636 For the file-protocol, a leading tilde
3637 .Ql ~
3638 character will be replaced by the expansion of
3639 .Ev HOME ,
3640 except when followed by a valid user name, in which case the home
3641 directory of the given user is used instead.
3643 In addition a shell expansion as if specified in double-quotes (see
3644 .Sx "Shell-style argument quoting" )
3645 is applied, so that any occurrence of
3646 .Ql $VARIABLE
3648 .Ql ${VARIABLE} )
3649 will be replaced by the expansion of the variable, if possible;
3650 .Sx "INTERNAL VARIABLES"
3651 as well as
3652 .Sx ENVIRONMENT
3653 (shell) variables can be accessed through this mechanism.
3655 In interactive context, in order to allow simple value acceptance (via
3656 .Dq ENTER ) ,
3657 arguments will usually be displayed in a properly quoted form, e.g., a file
3658 .Ql diet\e is \ecurd.txt
3659 may be displayed as
3660 .Ql 'diet\e is \ecurd.txt' .
3662 .\" }}}
3664 .\" .Ss "Commands" {{{
3665 .Ss "Commands"
3667 The following commands are available:
3669 .Bl -tag -width ".It Ic BaNg"
3673 .It Ic \&!
3674 Executes the
3675 .Ev SHELL
3676 command which follows, replacing unescaped exclamation marks with the
3677 previously executed command if the internal variable
3678 .Va bang
3679 is set.
3680 This command supports
3681 .Cm vput
3682 as documented in
3683 .Sx "Command modifiers" ,
3684 and manages the error number
3685 .Va \&! .
3686 A 0 or positive exit status
3687 .Va \&?
3688 reflects the exit status of the command, negative ones that
3689 an error happened before the command was executed, or that the program
3690 did not exit cleanly, but, e.g., due to a signal: the error number is
3691 .Va ^ERR Ns -CHILD ,
3692 then.
3695 In conjunction with the
3696 .Cm vput
3697 modifier the following special cases exist:
3698 a negative exit status occurs if the collected data could not be stored
3699 in the given variable, which is a
3700 .Va ^ERR Ns -NOTSUP
3701 error that should otherwise not occur.
3702 .Va ^ERR Ns -CANCELED
3703 indicates that no temporary file could be created to collect the command
3704 output at first glance.
3705 In case of catchable out-of-memory situations
3706 .Va ^ERR Ns -NOMEM
3707 will occur and \*(UA will try to store the empty string, just like with
3708 all other detected error conditions.
3712 .It Ic #
3713 The comment-command causes the entire line to be ignored.
3714 .Sy Note:
3715 this really is a normal command which' purpose is to discard its
3716 arguments, not a
3717 .Dq comment-start
3718 indicating special character, which means that, e.g., trailing comments
3719 on a line are not possible.
3722 .It Ic +
3723 Goes to the next message in sequence and types it
3724 (like
3725 .Dq ENTER ) .
3728 .It Ic -
3729 Display the preceding message, or the n'th previous message if given
3730 a numeric argument n.
3733 .It Ic =
3734 Show the current message number (the
3735 .Dq dot ) .
3738 .It Ic \&?
3739 Show a brief summary of commands.
3740 \*(OP Given an argument a synopsis for the command in question is
3741 shown instead; commands can be abbreviated in general and this command
3742 can be used to see the full expansion of an abbreviation including the
3743 synopsis, try, e.g.,
3744 .Ql ?h ,
3745 .Ql ?hel
3747 .Ql ?help
3748 and see how the output changes.
3749 This mode also supports a more
3750 .Va verbose
3751 output, which will provide the informations documented for
3752 .Ic list .
3755 .It Ic \&|
3756 A synonym for the
3757 .Ic pipe
3758 command.
3762 .It Ic account , unaccount
3763 (ac, una) Creates, selects or lists (an) account(s).
3764 Accounts are special incarnations of
3765 .Ic define Ns d
3766 macros and group commands and variable settings which together usually
3767 arrange the environment for the purpose of creating an email account.
3768 Different to normal macros settings which are covered by
3769 .Ic localopts
3770 \(en here by default enabled! \(en will not be reverted before the
3771 .Ic account
3772 is changed again.
3773 The special account
3774 .Ql null
3775 (case-insensitive) always exists, and all but it can be deleted by the
3776 latter command, and in one operation with the special name
3777 .Ql * .
3779 Without arguments a listing of all defined accounts is shown.
3780 With one argument the given account is activated: the system
3781 .Va inbox
3782 of that account will be activated (as via
3783 .Ic file ) ,
3784 a possibly installed
3785 .Va folder-hook
3786 will be run, and the internal variable
3787 .Va account
3788 will be updated.
3789 The two argument form is identical to defining a macro as via
3790 .Ic define :
3791 .Bd -literal -offset indent
3792 account myisp {
3793   set folder=~/mail inbox=+syste.mbox record=+sent.mbox
3794   set from='(My Name) myname@myisp.example'
3795   set mta=smtp://mylogin@smtp.myisp.example
3801 .It Ic addrcodec
3802 Perform email address codec transformations on raw-data argument, rather
3803 according to email standards (RFC 5322; \*(ID will furtherly improve).
3804 Supports
3805 .Cm vput
3806 (see
3807 .Sx "Command modifiers" ) ,
3808 and manages the error number
3809 .Va \&! .
3810 The first argument must be either
3811 .Ar [+[+[+]]]e[ncode] ,
3812 .Ar d[ecode]
3814 .Ar s[kin] ,
3815 and specifies the operation to perform on the rest of the line.
3818 Decoding will show how a standard-compliant MUA will display the given
3819 argument, which should be an email address.
3820 Please be aware that most MUAs have difficulties with the address
3821 standards, and vary wildly when (comments) in parenthesis,
3822 .Dq double-quoted
3823 strings, or quoted-pairs, as below, become involved.
3824 \*(ID \*(UA currently does not perform decoding when displaying addresses.
3827 Skinning is identical to decoding but only outputs the plain address,
3828 without any string, comment etc. components.
3829 Another difference is that it may fail with the error number
3830 .Va \&!
3831 set to
3832 .Va ^ERR Ns -INVAL
3833 if decoding fails to find a(n) (valid) email address, in which case the
3834 unmodified input will be output again.
3837 Encoding supports four different modes, lesser automated versions can be
3838 chosen by prefixing one, two or three plus signs: the standard imposes
3839 a special meaning on some characters, which thus have to be transformed
3840 to so-called quoted-pairs by pairing them with a reverse solidus
3841 .Ql \e
3842 in order to remove the special meaning; this might change interpretation
3843 of the entire argument from what has been desired, however!
3844 Specify one plus sign to remark that parenthesis shall be left alone,
3845 two for not turning double quotation marks into quoted-pairs, and three
3846 for also leaving any user-specified reverse solidus alone.
3847 The result will always be valid, if a successful exit status is reported.
3848 \*(ID Addresses need to be specified in between angle brackets
3849 .Ql < ,
3850 .Ql >
3851 if the construct becomes more difficult, otherwise the current parser
3852 will fail; it is not smart enough to guess right.
3854 .Bd -literal -offset indent
3855 ? addrc enc "Hey, you",<diet@exam.ple>\e out\e there
3856 "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3857 ? addrc d "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3858 "Hey, you", \e out\e there <diet@exam.ple>
3859 ? addrc s "\e"Hey, you\e", \e\e out\e\e there" <diet@exam.ple>
3860 diet@exam.ple
3866 .It Ic alias , unalias
3867 (a, una) Aliases are a method of creating personal distribution lists
3868 that map a single alias name to none to multiple real receivers;
3869 these aliases become expanded after message composing is completed.
3870 The latter command removes the given list of aliases, the special name
3871 .Ql *
3872 will discard all existing aliases.
3874 The former command shows all currently defined aliases when used without
3875 arguments, and with one argument the expansion of the given alias.
3876 With more than one argument, creates or appends to the alias name given
3877 as the first argument the remaining arguments.
3878 Alias names adhere to the Postfix MTA
3879 .Xr aliases 5
3880 rules and are thus restricted to alphabetic characters, digits, the
3881 underscore, hyphen-minus, the number sign, colon and commercial at,
3882 the last character can also be the dollar sign; the regular expression:
3883 .Ql [[:alnum:]_#:@-]+$? .
3884 As extensions the exclamation mark
3885 .Ql \&! ,
3886 period
3887 .Ql \&.
3888 as well as
3889 .Dq any character that has the high bit set
3890 may be used.
3894 .It Ic alternates , unalternates
3895 \*(NQ (alt) Manage a list of alternate addresses or names of the active user,
3896 members of which will be removed from recipient lists.
3897 The latter command removes the given list of alternates, the special name
3898 .Ql *
3899 will discard all existing aliases.
3900 The former command manages the error number
3901 .Va \&!
3902 and shows the current set of alternates when used without arguments; in
3903 this mode it supports
3904 .Cm vput
3905 (see
3906 .Sx "Command modifiers" ) .
3907 Otherwise the given arguments (after being checked for validity) are
3908 appended to the list of alternate names; in
3909 .Va posix
3910 mode they replace that list instead.
3911 There is a set of implicit alternates which is formed of the values of
3912 .Ev LOGNAME ,
3913 .Va from ,
3914 .Va sender
3916 .Va reply-to .
3920 .It Ic answered , unanswered
3921 Take a message lists and mark each message as having been answered,
3922 having not been answered, respectively.
3923 Messages will be marked answered when being
3924 .Ic reply Ns d
3925 to automatically if the
3926 .Va markanswered
3927 variable is set.
3928 See the section
3929 .Sx "Message states" .
3934 .It Ic bind , unbind
3935 \*(OP\*(NQ The bind command extends the MLE (see
3936 .Sx "On terminal control and line editor" )
3937 with freely configurable key bindings.
3938 The latter command removes from the given context the given key binding,
3939 both of which may be specified as a wildcard
3940 .Ql * ,
3941 so that, e.g.,
3942 .Ql unbind * *
3943 will remove all bindings of all contexts.
3944 Due to initialization order unbinding will not work for built-in key
3945 bindings upon program startup, however: please use
3946 .Va line-editor-no-defaults
3947 for this purpose instead.
3950 With one argument the former command shows all key bindings for the
3951 given context, specifying an asterisk
3952 .Ql *
3953 will show the bindings of all contexts; a more verbose listing will be
3954 produced if either of
3955 .Va debug
3957 .Va verbose
3958 are set.
3959 With two or more arguments a binding is (re)established:
3960 the first argument is the context to which the binding shall apply,
3961 the second argument is a comma-separated list of the
3962 .Dq keys
3963 which form the binding, and any remaining arguments form the expansion.
3964 To indicate that a binding shall not be auto-committed, but that the
3965 expansion shall instead be furtherly editable by the user, a commercial at
3966 .Ql @
3967 (that will be removed) can be placed last in the expansion, from which
3968 leading and trailing whitespace will finally be removed.
3969 Reverse solidus cannot be used as the last character of expansion.
3972 Contexts define when a binding applies, i.e., a binding will not be seen
3973 unless the context for which it is defined for is currently active.
3974 This is not true for the shared binding
3975 .Ql base ,
3976 which is the foundation for all other bindings and as such always
3977 applies, its bindings, however, only apply secondarily.
3978 The available contexts are the shared
3979 .Ql base ,
3981 .Ql default
3982 context which is used in all not otherwise documented situations, and
3983 .Ql compose ,
3984 which applies to compose mode only.
3987 .Dq Keys
3988 which form the binding are specified as a comma-separated list of
3989 byte-sequences, where each list entry corresponds to one key(press).
3990 A list entry may, indicated by a leading colon character
3991 .Ql \&: ,
3992 also refer to the name of a terminal capability; several dozen names
3993 will be compiled in and may be specified either by their
3994 .Xr terminfo 5 ,
3995 or, if existing, by their
3996 .Xr termcap 5
3997 name, regardless of the actually used \*(OPal terminal control library.
3998 It is possible to use any capability, as long as the name is resolvable
3999 by the \*(OPal control library or was defined via the internal variable
4000 .Va termcap .
4001 Input sequences are not case-normalized, so that an exact match is
4002 required to update or remove a binding.
4003 Examples:
4005 .Bd -literal -offset indent
4006 ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape)
4007 ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc, Delete
4008 ? bind default $'\ecA',:khome,w 'echo An editable binding@'
4009 ? bind default a,b,c rm -irf / @  # Another editable binding
4010 ? bind default :kf1 File %
4011 ? bind compose :kf1 ~e
4015 Note that the entire comma-separated list is first parsed (over) as a
4016 shell-token with whitespace as the field separator, before being parsed
4017 and expanded for real with comma as the field separator, therefore
4018 whitespace needs to be properly quoted, see
4019 .Sx "Shell-style argument quoting" .
4020 Using Unicode reverse solidus escape sequences renders a binding
4021 defunctional if the locale does not support Unicode (see
4022 .Sx "Character sets" ) ,
4023 and using terminal capabilities does so if no (corresponding) terminal
4024 control support is (currently) available.
4027 The following terminal capability names are built-in and can be used in
4028 .Xr terminfo 5
4029 or (if available) the two-letter
4030 .Xr termcap 5
4031 notation.
4032 See the respective manual for a list of capabilities.
4033 The program
4034 .Xr infocmp 1
4035 can be used to show all the capabilities of
4036 .Ev TERM
4037 or the given terminal type;
4038 using the
4039 .Fl \&\&x
4040 flag will also show supported (non-standard) extensions.
4043 .Bl -tag -compact -width kcuuf_or_kcuuf
4044 .It Cd kbs Ns \0or Cd kb
4045 Backspace.
4046 .It Cd kdch1 Ns \0or Cd kD
4047 Delete character.
4048 .It Cd kDC Ns \0or Cd *4
4049 \(em shifted variant.
4050 .It Cd kel Ns \0or Cd kE
4051 Clear to end of line.
4052 .It Cd kext Ns \0or Cd @9
4053 Exit.
4054 .It Cd kich1 Ns \0or Cd kI
4055 Insert character.
4056 .It Cd kIC Ns \0or Cd #3
4057 \(em shifted variant.
4058 .It Cd khome Ns \0or Cd kh
4059 Home.
4060 .It Cd kHOM Ns \0or Cd #2
4061 \(em shifted variant.
4062 .It Cd kend Ns \0or Cd @7
4063 End.
4064 .It Cd knp Ns \0or Cd kN
4065 Next page.
4066 .It Cd kpp Ns \0or Cd kP
4067 Previous page.
4068 .It Cd kcub1 Ns \0or Cd kl
4069 Left cursor (with more modifiers: see below).
4070 .It Cd kLFT Ns \0or Cd #4
4071 \(em shifted variant.
4072 .It Cd kcuf1 Ns \0or Cd kr
4073 Right cursor (ditto).
4074 .It Cd kRIT Ns \0or Cd %i
4075 \(em shifted variant.
4076 .It Cd kcud1 Ns \0or Cd kd
4077 Down cursor (ditto).
4078 .It Cd kDN
4079 \(em shifted variant (only terminfo).
4080 .It Cd kcuu1 Ns \0or Cd ku
4081 Up cursor (ditto).
4082 .It Cd kUP
4083 \(em shifted variant (only terminfo).
4084 .It Cd kf0 Ns \0or Cd k0
4085 Function key 0.
4086 Add one for each function key up to
4087 .Cd kf9
4089 .Cd k9 ,
4090 respectively.
4091 .It Cd kf10 Ns \0or Cd k;
4092 Function key 10.
4093 .It Cd kf11 Ns \0or Cd F1
4094 Function key 11.
4095 Add one for each function key up to
4096 .Cd kf19
4098 .Cd F9 ,
4099 respectively.
4103 Some terminals support key-modifier combination extensions, e.g.,
4104 .Ql Alt+Shift+xy .
4105 For example, the delete key,
4106 .Cd kdch1 :
4107 in its shifted variant, the name is mutated to
4108 .Cd  kDC ,
4109 then a number is appended for the states
4110 .Ql Alt
4111 .Pf ( Cd kDC3 ) ,
4112 .Ql Shift+Alt
4113 .Pf ( Cd kDC4 ) ,
4114 .Ql Control
4115 .Pf ( Cd kDC5 ) ,
4116 .Ql Shift+Control
4117 .Pf ( Cd kDC6 ) ,
4118 .Ql Alt+Control
4119 .Pf ( Cd kDC7 ) ,
4120 finally
4121 .Ql Shift+Alt+Control
4122 .Pf ( Cd kDC8 ) .
4123 The same for the left cursor key,
4124 .Cd kcub1 :
4125 .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 .
4128 It is advisable to use an initial escape or other control character (e.g.,
4129 .Ql \ecA )
4130 for bindings which describe user key combinations (as opposed to purely
4131 terminal capability based ones), in order to avoid ambiguities whether
4132 input belongs to key sequences or not; it also reduces search time.
4133 Adjusting
4134 .Va bind-timeout
4135 may help shall keys and sequences be falsely recognized.
4139 .It Ic call
4140 \*(NQ Calls the given macro, which must have been created via
4141 .Ic define ,
4142 otherwise a
4143 .Va ^ERR Ns -NOENT
4144 error occurs.
4145 Parameters given to macros are implicitly local to the macro's scope, and
4146 may be accessed via special (positional) parameters, e.g.,
4147 .Va 1 ,
4148 .Va * ,
4149 .Va @ ,
4150 .Va # .
4151 The positional parameters may be removed by
4152 .Ic shift Ns
4153 ing them off the stack (exceeding the supported number of arguments
4154 results in a
4155 .Va ^ERR Ns -OVERFLOW ) ,
4156 and are otherwise controllable via
4157 .Ic vpospar .
4158 Changes to other
4159 .Sx ENVIRONMENT
4160 as well as
4161 .Sx "INTERNAL VARIABLES"
4162 can be reverted before the current level regains control by setting
4163 .Ic localopts
4164 for called macro(s) (or in them, of course).
4165 Macro execution can be terminated at any time by calling
4166 .Ic return .
4169 Calling macros recursively will at some time excess the stack size
4170 limit, causing a hard program abortion; if recursively calling a macro
4171 is the last command of the current macro, consider to use the command
4172 .Ic xcall ,
4173 which will first release all resources of the current macro before
4174 replacing the current macro with the called one.
4175 Numeric and string operations can be performed via
4176 .Ic vexpr ,
4178 .Ic eval
4179 may be helpful to recreate argument lists.
4181 .Bd -literal -offset indent
4182 define exmac {
4183   echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
4184   return 1000 0
4186 call exmac Hello macro exmac!
4191 .It Ic call_if
4192 Identical to
4193 .Ic call
4194 if the given macro has been created via
4195 .Ic define ,
4196 but doesn't fail nor warn if the macro doesn't exist.
4199 .It Ic cd
4200 (ch) Change the working directory to
4201 .Ev HOME
4202 or the given argument.
4203 Synonym for
4204 .Ic chdir .
4207 .It Ic certsave
4208 \*(OP Only applicable to S/MIME signed messages.
4209 Takes a message list and a filename and saves the certificates
4210 contained within the message signatures to the named file in both
4211 human-readable and PEM format.
4212 The certificates can later be used to send encrypted messages to the
4213 respective message senders by setting
4214 .Va smime-encrypt-USER@HOST
4215 variables.
4219 .It Ic charsetalias , uncharsetalias
4220 \*(NQ Manage (character set conversion) character set alias mappings,
4221 as documented in the section
4222 .Sx "Character sets" .
4223 Character set aliases are expanded recursively, but no expansion is
4224 performed on values of the user-settable variables, e.g.,
4225 .Va charset-8bit .
4226 These are effectively no-operations if character set conversion
4227 is not available (i.e., no
4228 .Ql +iconv
4230 .Va features ) .
4231 Without arguments the list of all currently defined aliases is shown,
4232 with one argument the expansion of the given alias.
4233 Otherwise all given arguments are treated as pairs of character sets and
4234 their desired target alias name, creating new or changing already
4235 existing aliases, as necessary.
4237 The latter deletes all aliases given as arguments, the special argument
4238 .Ql *
4239 will remove all aliases.
4242 .It Ic chdir
4243 (ch) Change the working directory to
4244 .Ev HOME
4245 or the given argument.
4246 Synonym for
4247 .Ic cd .
4251 .It Ic collapse , uncollapse
4252 Only applicable to threaded mode.
4253 Takes a message list and makes all replies to these messages invisible
4254 in header summaries, except for
4255 .Ql new
4256 messages and the
4257 .Dq dot .
4258 Also when a message with collapsed replies is displayed,
4259 all of these are automatically uncollapsed.
4260 The latter command undoes collapsing.
4265 .It Ic colour , uncolour
4266 \*(OP\*(NQ Manage colour mappings of and for a
4267 .Sx "Coloured display" .
4268 The type of colour is given as the (case-insensitive) first argument,
4269 which must be one of
4270 .Ql 256
4271 for 256-colour terminals,
4272 .Ql 8 ,
4273 .Ql ansi
4275 .Ql iso
4276 for the standard 8-colour ANSI / ISO 6429 color palette and
4277 .Ql 1
4279 .Ql mono
4280 for monochrome terminals.
4281 Monochrome terminals cannot deal with colours, but only (some) font
4282 attributes.
4285 Without further arguments the list of all currently defined mappings
4286 for the given colour type is shown (as a special case giving
4287 .Ql all
4289 .Ql *
4290 will show the mappings of all types).
4291 Otherwise the second argument defines the mappable slot, and the third
4292 argument a (comma-separated list of) colour and font attribute
4293 specification(s), and the optional fourth argument can be used to
4294 specify a precondition: if conditioned mappings exist they are tested in
4295 (creation) order unless a (case-insensitive) match has been found, and
4296 the default mapping (if any has been established) will only be chosen as
4297 a last resort.
4298 The types of precondition available depend on the mappable slot (see
4299 .Sx "Coloured display"
4300 for some examples), the following of which exist:
4303 Mappings prefixed with
4304 .Ql mle-
4305 are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see
4306 .Sx "On terminal control and line editor" )
4307 and do not support preconditions.
4309 .Bl -tag -compact -width view-partinfo
4310 .It Ar mle-position
4311 This mapping is used for the position indicator that is visible when
4312 a line cannot be fully displayed on the screen.
4313 .It Ar mle-prompt
4314 Used for the
4315 .Va prompt .
4319 Mappings prefixed with
4320 .Ql sum-
4321 are used in header summaries, and they all understand the preconditions
4322 .Ql dot
4323 (the current message) and
4324 .Ql older
4325 for elder messages (only honoured in conjunction with
4326 .Va datefield-markout-older ) .
4328 .Bl -tag -compact -width view-partinfo
4329 .It Ar sum-dotmark
4330 This mapping is used for the
4331 .Dq dotmark
4332 that can be created with the
4333 .Ql %>
4335 .Ql %<
4336 formats of the variable
4337 .Va headline .
4338 .It Ar sum-header
4339 For the complete header summary line except the
4340 .Dq dotmark
4341 and the thread structure.
4342 .It Ar sum-thread
4343 For the thread structure which can be created with the
4344 .Ql %i
4345 format of the variable
4346 .Va headline .
4350 Mappings prefixed with
4351 .Ql view-
4352 are used when displaying messages.
4354 .Bl -tag -compact -width view-partinfo
4355 .It Ar view-from_
4356 This mapping is used for so-called
4357 .Ql From_
4358 lines, which are MBOX file format specific header lines.
4359 .It Ar view-header
4360 For header lines.
4361 A comma-separated list of headers to which the mapping applies may be
4362 given as a precondition; if the \*(OPal regular expression support is
4363 available then if any of the
4364 .Dq magical
4365 (extended) regular expression characters is seen the precondition will
4366 be evaluated as (an extended) one.
4367 .It Ar view-msginfo
4368 For the introductional message info line.
4369 .It Ar view-partinfo
4370 For MIME part info lines.
4374 The following (case-insensitive) colour definitions and font attributes
4375 are understood, multiple of which can be specified in a comma-separated
4376 list:
4378 .Bl -tag -width ft=
4379 .It Ar ft=
4380 a font attribute:
4381 .Ql bold ,
4382 .Ql reverse
4384 .Ql underline .
4385 It is possible (and often applicable) to specify multiple font
4386 attributes for a single mapping.
4388 .It Ar fg=
4389 foreground colour attribute:
4390 .Ql black ,
4391 .Ql blue ,
4392 .Ql green ,
4393 .Ql red ,
4394 .Ql brown ,
4395 .Ql magenta ,
4396 .Ql cyan
4398 .Ql white .
4399 To specify a 256-color mode a decimal number colour specification in
4400 the range 0 to 255, inclusive, is supported, and interpreted as follows:
4402 .Bl -tag -compact -width "999 - 999"
4403 .It 0 - 7
4404 the standard ISO 6429 colors, as above.
4405 .It 8 - 15
4406 high intensity variants of the standard colors.
4407 .It 16 - 231
4408 216 colors in tuples of 6.
4409 .It 232 - 255
4410 grayscale from black to white in 24 steps.
4412 .Bd -literal -offset indent
4413 #!/bin/sh -
4414 fg() { printf "\e033[38;5;${1}m($1)"; }
4415 bg() { printf "\e033[48;5;${1}m($1)"; }
4417 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
4418 printf "\e033[0m\en"
4420 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
4421 printf "\e033[0m\en"
4424 .It Ar bg=
4425 background colour attribute (see
4426 .Cd fg=
4427 for possible values).
4431 The command
4432 .Ic \&uncolour
4433 will remove for the given colour type (the special type
4434 .Ql *
4435 selects all) the given mapping; if the optional precondition argument is
4436 given only the exact tuple of mapping and precondition is removed.
4437 The special name
4438 .Ql *
4439 will remove all mappings (no precondition allowed), thus
4440 .Ql uncolour * *
4441 will remove all established mappings.
4446 .It Ic commandalias , uncommandalias
4447 \*(NQ Define or list, and remove, respectively, command aliases.
4448 An (command)alias can be used everywhere a normal command can be used,
4449 but always takes precedence: any arguments that are given to the command
4450 alias are joined onto the alias expansion, and the resulting string
4451 forms the command line that is, in effect, executed.
4452 The latter command removes all given aliases, the special name
4453 .Ql *
4454 will remove all existing aliases.
4455 When used without arguments the former shows a list of all currently
4456 known aliases, with one argument only the expansion of the given one.
4458 With two or more arguments a command alias is defined or updated: the
4459 first argument is the name under which the remaining command line should
4460 be accessible, the content of which can be just about anything.
4461 An alias may itself expand to another alias, but to avoid expansion loops
4462 further expansion will be prevented if an alias refers to itself or if
4463 an expansion depth limit is reached.
4464 Explicit expansion prevention is available via reverse solidus
4465 .Cm \e ,
4466 one of the
4467 .Sx "Command modifiers" .
4468 .Bd -literal -offset indent
4469 ? commandalias xx
4470 \*(uA: `commandalias': no such alias: xx
4471 ? commandalias xx echo hello,
4472 ? commandalias xx
4473 commandalias xx 'echo hello,'
4474 ? xx
4475 hello,
4476 ? xx world
4477 hello, world
4481 .It Ic Copy
4482 (C) Copy messages to files whose names are derived from the author of
4483 the respective message and do not mark them as being saved;
4484 otherwise identical to
4485 .Ic Save .
4488 .It Ic copy
4489 (c) Copy messages to the named file and do not mark them as being saved;
4490 otherwise identical to
4491 .Ic save .
4494 .It Ic cwd
4495 Show the name of the current working directory, as reported by
4496 .Xr getcwd 3 .
4497 Supports
4498 .Cm vput
4499 (see
4500 .Sx "Command modifiers" ) .
4501 The return status is tracked via
4502 .Va \&! .
4505 .It Ic Decrypt
4506 \*(OP For unencrypted messages this command is identical to
4507 .Ic Copy ;
4508 Encrypted messages are first decrypted, if possible, and then copied.
4511 .It Ic decrypt
4512 \*(OP For unencrypted messages this command is identical to
4513 .Ic copy ;
4514 Encrypted messages are first decrypted, if possible, and then copied.
4518 .It Ic define , undefine
4519 Without arguments the current list of macros, including their content,
4520 is shown, otherwise a macro is defined, replacing an existing macro of
4521 the same name.
4522 A macro definition is a sequence of commands in the following form:
4523 .Bd -literal -offset indent
4524 define name {
4525   command1
4526   command2
4527   ...
4528   commandN
4532 A defined macro can be invoked explicitly by using the
4533 .Ic call ,
4534 .Ic call_if
4536 .Ic xcall
4537 commands, or implicitly if a macro hook is triggered, e.g., a
4538 .Va folder-hook .
4539 It is possible to localize adjustments, like creation, deletion and
4540 modification of
4541 .Sx "INTERNAL VARIABLES" ,
4542 by using the
4543 .Ic localopts
4544 command; the scope which is localized depends on how (i.e.,
4545 .Dq as what :
4546 normal macro, folder hook, hook,
4547 .Ic account
4548 switch) the macro is invoked.
4549 Execution of a macro body can be stopped from within by calling
4550 .Ic return .
4551 Inside a
4552 .Ic call Ns
4553 ed macro, given positional parameters can be
4554 .Ic shift Ns
4555 ed, or become completely replaced, removed etc. via
4556 .Ic vpospar .
4558 The latter command deletes the given macro, the special name
4559 .Ql *
4560 will discard all existing macros.
4561 Creation and deletion of (a) macro(s) can be performed from within
4562 a running macro.
4566 .It Ic delete , undelete
4567 (d, u) Marks the given message list as being or not being
4568 .Ql deleted ,
4569 respectively; if no argument has been specified then the usual search
4570 for a visible message is performed, as documented for
4571 .Sx "Message list arguments" ,
4572 showing only the next input prompt if the search fails.
4573 Deleted messages will neither be saved in the
4574 .Mx -sx
4575 .Sx "secondary mailbox"
4576 .Ev MBOX
4577 nor will they be available for most other commands.
4578 If the
4579 .Va autoprint
4580 variable is set, the new
4581 .Dq dot
4582 or the last message restored, respectively, is automatically
4583 .Ic type Ns
4584 d; also see
4585 .Ic dp ,
4586 .Ic dt .
4589 .It Ic discard
4590 (di) Identical to
4591 .Ic ignore .
4592 Superseded by the multiplexer
4593 .Ic headerpick .
4597 .It Ic dp , dt
4598 Delete the given messages and automatically
4599 .Ic type
4600 the new
4601 .Dq dot
4602 if one exists, regardless of the setting of
4603 .Va autoprint .
4606 .It Ic dotmove
4607 Move the
4608 .Dq dot
4609 up or down by one message when given
4610 .Ql +
4612 .Ql -
4613 argument, respectively.
4617 .It Ic draft , undraft
4618 Take message lists and mark each given message as being draft, or not
4619 being draft, respectively, as documented in the section
4620 .Sx "Message states" .
4623 .It Ic echo
4624 \*(NQ (ec) Echoes arguments to standard output and writes a trailing
4625 newline, whereas the otherwise identical
4626 .Ic echon
4627 does not.
4628 .Sx "Shell-style argument quoting"
4629 is used,
4630 .Sx "Filename transformations"
4631 are applied to the expanded arguments.
4634 .It Ic echoerr
4635 \*(NQ Identical to
4636 .Ic echo
4637 except that is echoes to standard error.
4638 Also see
4639 .Ic echoerrn .
4640 In interactive sessions the \*(OPal message ring queue for
4641 .Ic errors
4642 will be used instead, if available.
4645 .It Ic echon
4646 \*(NQ Identical to
4647 .Ic echo ,
4648 but does not write a trailing newline.
4651 .It Ic echoerrn
4652 \*(NQ Identical to
4653 .Ic echoerr ,
4654 but does not write a trailing newline.
4657 .It Ic edit
4658 (e) Point the text editor (as defined in
4659 .Ev EDITOR )
4660 at each message from the given list in turn.
4661 Modified contents are discarded unless the
4662 .Va writebackedited
4663 variable is set, and are not used unless the mailbox can be written to
4664 and the editor returns a successful exit status.
4667 .It Ic elif
4668 Part of the
4669 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4670 conditional \(em if the condition of a preceding
4671 .Ic if
4672 was false, check the following condition and execute the following block
4673 if it evaluates true.
4676 .It Ic else
4677 (el) Part of the
4678 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4679 conditional \(em if none of the conditions of the preceding
4680 .Ic if
4682 .Ic elif
4683 commands was true, the
4684 .Ic else
4685 block is executed.
4688 .It Ic endif
4689 (en) Marks the end of an
4690 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
4691 conditional execution block.
4695 .It Ic environ
4696 \*(NQ \*(UA has a strict notion about which variables are
4697 .Sx "INTERNAL VARIABLES"
4698 and which are managed in the program
4699 .Sx ENVIRONMENT .
4700 Since some of the latter are a vivid part of \*(UAs functioning,
4701 however, they are transparently integrated into the normal handling of
4702 internal variables via
4703 .Ic set
4705 .Ic unset .
4706 To integrate other environment variables of choice into this
4707 transparent handling, and also to export internal variables into the
4708 process environment where they normally are not, a
4709 .Ql link
4710 needs to become established with this command, as in, e.g.,
4713 .Dl environ link PERL5LIB TZ
4716 Afterwards changing such variables with
4717 .Ic set
4718 will cause automatic updates of the program environment, and therefore
4719 be inherited by newly created child processes.
4720 Sufficient system support provided (it was in BSD as early as 1987, and
4721 is standardized since Y2K) removing such variables with
4722 .Ic unset
4723 will remove them also from the program environment, but in any way
4724 the knowledge they ever have been
4725 .Ql link Ns
4726 ed will be lost.
4727 Note that this implies that
4728 .Ic localopts
4729 may cause loss of such links.
4732 The command
4733 .Ql unlink
4734 will remove an existing link, but leaves the variables as such intact.
4735 Additionally the subcommands
4736 .Ql set
4738 .Ql unset
4739 are provided, which work exactly the same as the documented commands
4740 .Ic set
4742 .Ic unset ,
4743 but (additionally un)link the variable(s) with the program environment
4744 and thus immediately export them to, or remove them from (if possible),
4745 respectively, the program environment.
4749 .It Ic errors
4750 \*(OP Since \*(UA uses the console as a user interface it can happen
4751 that messages scroll by too fast to become recognized.
4752 An error message ring queue is available which stores duplicates of any
4753 error message and notifies the user in interactive sessions whenever
4754 a new error has occurred.
4755 The queue is finite: if its maximum size is reached any new message
4756 replaces the eldest.
4757 The command
4758 .Ic errors
4759 can be used to manage this message queue: if given
4760 .Ar show
4761 or no argument the queue will be displayed and cleared,
4762 .Ar clear
4763 will only clear all messages from the queue.
4766 .It Ic eval
4767 \*(NQ Construct a command by concatenating the arguments, separated with
4768 a single space character, and then evaluate the result.
4769 This command passes through the exit status
4770 .Va \&?
4771 and error number
4772 .Va \&!
4773 of the evaluated command; also see
4774 .Ic call .
4775 .Bd -literal -offset indent
4776 define xxx {
4777   echo "xxx arg <$1>"
4778   shift
4779   if [ $# -gt 0 ]
4780     \excall xxx "$@"
4781   endif
4783 define yyy {
4784   eval "$@ ' ball"
4786 call yyy '\ecall xxx' "b\e$'\et'u ' "
4787 call xxx arg <b      u>
4788 call xxx arg <  >
4789 call xxx arg <ball>
4793 .It Ic exit
4794 (ex or x) Exit from \*(UA without changing the active mailbox and skip
4795 any saving of messages in the
4796 .Mx -sx
4797 .Sx "secondary mailbox"
4798 .Ev MBOX ,
4799 as well as a possibly tracked line editor
4800 .Va history-file .
4801 The optional status number argument will be passed through to
4802 .Xr exit 3 .
4803 \*(ID For now it can happen that the given status will be overwritten,
4804 later this will only occur if a later error needs to be reported onto an
4805 otherwise success indicating status.
4808 .It Ic File
4809 (Fi) Like
4810 .Ic file ,
4811 but open the mailbox read-only.
4815 .It Ic file
4816 (fi) The file command switches to a new mailbox.
4817 Without arguments it shows status information of the current mailbox.
4818 If an argument is given, it will write out changes (such as deletions)
4819 the user has made, open a new mailbox, update the internal variables
4820 .Va mailbox-resolved
4822 .Va mailbox-display ,
4823 and optionally display a summary of
4824 .Ic headers
4825 if the variable
4826 .Va header
4827 is set.
4830 .Sx "Filename transformations"
4831 will be applied to the
4832 .Ar name
4833 argument, and
4834 .Ql protocol://
4835 prefixes are, i.e., URL syntax is understood, e.g.,
4836 .Ql maildir:///tmp/mdirbox :
4837 if a protocol prefix is used the mailbox type is fixated and neither
4838 the auto-detection (read on) nor the
4839 .Va newfolders
4840 mechanisms apply.
4841 \*(OPally URLs can also be used to access network resources, which may
4842 be accessed securely via
4843 .Sx "Encrypted network communication"
4844 if so supported, and it is possible to proxy all network traffic over
4845 a SOCKS5 server given via
4846 .Va socks-proxy .
4849 .Dl \*(IN protocol://[user[:password]@]host[:port][/path]
4850 .Dl \*(OU protocol://[user@]host[:port][/path]
4853 \*(OPally supported network protocols are
4854 .Ar pop3
4855 (POP3) and
4856 .Ar pop3s
4857 (POP3 with SSL/TLS encrypted transport),
4858 .Ar imap
4860 .Ar imaps .
4862 .Ar [/path]
4863 part is valid only for IMAP; there it defaults to
4864 .Ar INBOX .
4865 Network URLs require a special encoding as documented in the section
4866 .Sx "On URL syntax and credential lookup" .
4869 If the resulting file protocol (MBOX database)
4870 .Ar name
4871 is located on a local filesystem then the list of all registered
4872 .Ic filetype Ns
4873 s is traversed in order to see whether a transparent intermediate
4874 conversion step is necessary to handle the given mailbox, in which case
4875 \*(UA will use the found hook to load and save data into and from
4876 a temporary file, respectively.
4877 Changing hooks will not affect already opened mailboxes.
4878 For example, the following creates hooks for the
4879 .Xr gzip 1
4880 compression tool and a combined compressed and encrypted format:
4882 .Bd -literal -offset indent
4883 ? filetype \e
4884     gzip 'gzip -dc' 'gzip -c' \e
4885     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4889 MBOX database files are generally locked during file operations in order
4890 to avoid inconsistencies due to concurrent modifications.
4891 \*(OPal Mailbox files which \*(UA treats as the system
4892 .Va inbox
4893 .Pf ( Ev MAIL ) ,
4895 .Mx -sx
4896 .Sx "primary system mailbox" Ns
4897 es in general will also be protected by so-called dotlock files, the
4898 traditional way of mail spool file locking: for any file
4899 .Ql a
4900 a lock file
4901 .Ql a.lock
4902 will be created for the duration of the synchronization \(em
4903 as necessary a privilege-separated dotlock child process will be used
4904 to accommodate for necessary privilege adjustments in order to create
4905 the dotlock file in the same directory
4906 and with the same user and group identities as the file of interest.
4909 \*(UA by default uses tolerant POSIX rules when reading MBOX database
4910 files, but it will detect invalid message boundaries in this mode and
4911 complain (even more with
4912 .Va debug )
4913 if any is seen: in this case
4914 .Va mbox-rfc4155
4915 can be used to create a valid MBOX database from the invalid input.
4918 If no protocol has been fixated, and
4919 .Ar name
4920 refers to a directory with the subdirectories
4921 .Ql tmp ,
4922 .Ql new
4924 .Ql cur ,
4925 then it is treated as a folder in
4926 .Dq Maildir
4927 format.
4928 The maildir format stores each message in its own file, and has been
4929 designed so that file locking is not necessary when reading or writing
4930 files.
4933 \*(ID If no protocol has been fixated and no existing file has
4934 been found, the variable
4935 .Va newfolders
4936 controls the format of mailboxes yet to be created.
4941 .It Ic filetype , unfiletype
4942 \*(NQ Define or list, and remove, respectively, file handler hooks,
4943 which provide (shell) commands that enable \*(UA to load and save MBOX
4944 files from and to files with the registered file extensions;
4945 it will use an intermediate temporary file to store the plain data.
4946 The latter command removes the hooks for all given extensions,
4947 .Ql *
4948 will remove all existing handlers.
4950 When used without arguments the former shows a list of all currently
4951 defined file hooks, with one argument the expansion of the given alias.
4952 Otherwise three arguments are expected, the first specifying the file
4953 extension for which the hook is meant, and the second and third defining
4954 the load- and save commands, respectively, to deal with the file type,
4955 both of which must read from standard input and write to standard
4956 output.
4957 Changing hooks will not affect already opened mailboxes (\*(ID except below).
4958 \*(ID For now too much work is done, and files are oftened read in twice
4959 where once would be sufficient: this can cause problems if a filetype is
4960 changed while such a file is opened; this was already so with the
4961 built-in support of .gz etc. in Heirloom, and will vanish in v15.
4962 \*(ID For now all handler strings are passed to the
4963 .Ev SHELL for evaluation purposes; in the future a
4964 .Ql \&!
4965 prefix to load and save commands may mean to bypass this shell instance:
4966 placing a leading space will avoid any possible misinterpretations.
4967 .Bd -literal -offset indent
4968 ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
4969     gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
4970     zst 'zstd -dc' 'zstd -19 -zc' \e
4971     zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
4972 ? set record=+sent.zst.pgp
4977 .It Ic flag , unflag
4978 Take message lists and mark the messages as being flagged, or not being
4979 flagged, respectively, for urgent/special attention.
4980 See the section
4981 .Sx "Message states" .
4984 .It Ic folder
4985 (fold) The same as
4986 .Ic file .
4989 .It Ic folders
4990 With no arguments, list the names of the folders in the folder directory.
4991 With an existing folder as an argument,
4992 lists the names of folders below the named folder.
4995 .It Ic Followup
4996 (F) Similar to
4997 .Ic Respond ,
4998 but saves the message in a file named after the local part of the first
4999 recipient's address (instead of in
5000 .Va record Ns ).
5003 .It Ic followup
5004 (fo) Similar to
5005 .Ic respond ,
5006 but saves the message in a file named after the local part of the first
5007 recipient's address (instead of in
5008 .Va record Ns ).
5011 .It Ic followupall
5012 Similar to
5013 .Ic followup ,
5014 but responds to all recipients regardless of the
5015 .Va flipr
5016 variable.
5019 .It Ic followupsender
5020 Similar to
5021 .Ic Followup ,
5022 but responds to the sender only regardless of the
5023 .Va flipr
5024 variable.
5027 .It Ic Forward
5028 Similar to
5029 .Ic forward ,
5030 but saves the message in a file named after the local part of the
5031 recipient's address (instead of in
5032 .Va record Ns ).
5035 .It Ic forward
5036 Takes a message and the address of a recipient
5037 and forwards the message to him.
5038 The text of the original message is included in the new one,
5039 with the value of the
5040 .Va forward-inject-head
5041 variable preceding it.
5042 To filter the included header fields to the desired subset use the
5043 .Ql forward
5044 slot of the white- and blacklisting command
5045 .Ic headerpick .
5046 Only the first part of a multipart message is included unless
5047 .Va forward-as-attachment ,
5048 and recipient addresses will be stripped from comments, names
5049 etc. unless the internal variable
5050 .Va fullnames
5051 is set.
5053 This may generate the errors
5054 .Va ^ERR Ns -DESTADDRREQ
5055 if no receiver has been specified,
5056 .Va ^ERR Ns -PERM
5057 if some addressees where rejected by
5058 .Va expandaddr ,
5059 .Va ^ERR Ns -NODATA
5060 if no applicable messages have been given,
5061 .Va ^ERR Ns -NOTSUP
5062 if multiple messages have been specified,
5063 .Va ^ERR Ns -IO
5064 if an I/O error occurs,
5065 .Va ^ERR Ns -NOTSUP
5066 if a necessary character set conversion fails, and
5067 .Va ^ERR Ns -INVAL
5068 for other errors.
5071 .It Ic from
5072 (f) Takes a list of message specifications and displays a summary of
5073 their message headers, exactly as via
5074 .Ic headers .
5075 An alias of this command is
5076 .Ic search .
5077 Also see
5078 .Sx "Specifying messages" .
5080 .It Ic Fwd
5081 \*(OB Alias for
5082 .Ic Forward .
5084 .It Ic fwd
5085 \*(OB Alias for
5086 .Ic forward .
5088 .It Ic fwdignore
5089 \*(OB Superseded by the multiplexer
5090 .Ic headerpick .
5092 .It Ic fwdretain
5093 \*(OB Superseded by the multiplexer
5094 .Ic headerpick .
5096 .It Ic ghost , unghost
5097 \*(OB Replaced by
5098 .Ic commandalias ,
5099 .Ic uncommandalias .
5103 .It Ic headerpick , unheaderpick
5104 \*(NQ Multiplexer command to manage white- and blacklisting
5105 selections of header fields for a variety of applications.
5106 Without arguments the set of contexts that have settings is displayed.
5107 When given arguments, the first argument is the context to which the
5108 command applies, one of (case-insensitive)
5109 .Ql type
5110 for display purposes (via, e.g.,
5111 .Ic type ) ,
5112 .Ql save
5113 for selecting which headers shall be stored persistently when
5114 .Ic save ,
5115 .Ic copy ,
5116 .Ic move
5117 or even
5118 .Ic decrypt Ns
5119 ing messages (note that MIME related etc. header fields should not be
5120 ignored in order to not destroy usability of the message in this case),
5121 .Ql forward
5122 for stripping down messages when
5123 .Ic forward Ns
5124 ing message (has no effect if
5125 .Va forward-as-attachment
5126 is set), and
5127 .Ql top
5128 for defining user-defined set of fields for the command
5129 .Ic top .
5131 The current settings of the given context are displayed if it is the
5132 only argument.
5133 A second argument denotes the type of restriction that is to be chosen,
5134 it may be (a case-insensitive prefix of)
5135 .Ql retain
5137 .Ql ignore
5138 for white- and blacklisting purposes, respectively.
5139 Establishing a whitelist suppresses inspection of the corresponding
5140 blacklist.
5142 If no further argument is given the current settings of the given type
5143 will be displayed, otherwise the remaining arguments specify header
5144 fields, which \*(OPally may be given as regular expressions, to be added
5145 to the given type.
5146 The special wildcard field (asterisk,
5147 .Ql * )
5148 will establish a (fast) shorthand setting which covers all fields.
5150 The latter command always takes three or more arguments and can be used
5151 to remove selections, i.e., from the given context, the given type of
5152 list, all the given headers will be removed, the special argument
5153 .Ql *
5154 will remove all headers.
5157 .It Ic headers
5158 (h) Show the current group of headers, the size of which depends on
5159 the variable
5160 .Va screen ,
5161 and the style of which can be adjusted with the variable
5162 .Va headline .
5163 If a message-specification is given the group of headers containing the
5164 first message therein is shown and the message at the top of the screen
5165 becomes the new
5166 .Dq dot .
5169 .It Ic help
5170 (hel) A synonym for
5171 .Ic \&? .
5174 .It Ic history
5175 \*(OP Either
5176 .Ar show
5177 (this mode also supports a more
5178 .Va verbose
5179 output) or
5180 .Ar clear
5181 the list of history entries;
5182 a decimal
5183 .Ar NUMBER
5184 argument selects and evaluates the respective history entry,
5185 which will become the new history top; a negative number is used as an
5186 offset to the current command, e.g.,
5187 .Ql -1
5188 will select the last command, the history top.
5189 The default mode if no arguments are given is
5190 .Ar show .
5191 Please see
5192 .Sx "On terminal control and line editor"
5193 for more on this topic.
5196 .It Ic hold
5197 (ho, also
5198 .Ic preserve )
5199 Takes a message list and marks each message therein to be saved in the
5200 user's system
5201 .Va inbox
5202 instead of in the
5203 .Mx -sx
5204 .Sx "secondary mailbox"
5205 .Ev MBOX .
5206 Does not override the
5207 .Ic delete
5208 command.
5209 \*(UA deviates from the POSIX standard with this command, because a
5210 .Ic next
5211 command issued after
5212 .Ic hold
5213 will display the following message, not the current one.
5217 .It Ic if
5218 (i) Part of the nestable
5219 .Ic if Ns \0/\: Ic elif Ns \0/\: Ic else Ns \0/\: Ic endif
5220 conditional execution construct \(em if the given condition is true then
5221 the encapsulated block is executed.
5222 The POSIX standards supports the (case-insensitive) conditions
5223 .Ql r Ns
5224 eceive
5226 .Ql s Ns
5227 end, all remaining conditions are non-portable extensions.
5228 \*(ID These commands do not yet use
5229 .Sx "Shell-style argument quoting"
5230 and therefore do not know about input tokens, so that syntax
5231 elements have to be surrounded by whitespace; in v15 \*(UA will inspect
5232 all conditions bracket group wise and consider the tokens, representing
5233 values and operators, therein, which also means that variables will
5234 already have been expanded at that time (just like in the shell).
5236 .Bd -literal -offset indent
5237 if receive
5238   commands ...
5239 else
5240   commands ...
5241 endif
5245 The (case-insensitive) condition
5246 .Ql t Ns
5247 erminal will evaluate to true if the standard input is a terminal, i.e.,
5248 in interactive sessions.
5249 Another condition can be any boolean value (see the section
5250 .Sx "INTERNAL VARIABLES"
5251 for textual boolean representations) to mark an enwrapped block as
5252 .Dq never execute
5254 .Dq always execute .
5255 (It shall be remarked that a faulty condition skips all branches until
5256 .Ic endif . )
5259 (\*(ID In v15
5260 .Sx "Shell-style argument quoting"
5261 will be used, and this command will simply interpret expanded tokens.)
5262 It is possible to check
5263 .Sx "INTERNAL VARIABLES"
5264 as well as
5265 .Sx ENVIRONMENT
5266 variables for existence or compare their expansion against a user given
5267 value or another variable by using the
5268 .Ql $
5269 .Pf ( Dq variable next )
5270 conditional trigger character;
5271 a variable on the right hand side may be signalled using the same
5272 mechanism.
5273 Variable names may be enclosed in a pair of matching braces.
5274 When this mode has been triggered, several operators are available:
5277 Integer operators treat the arguments on the left and right hand side of
5278 the operator as integral numbers and compare them arithmetically.
5279 It is an error if any of the operands is not a valid integer, an empty
5280 argument (which implies it had been quoted) is treated as if it were 0.
5281 Available operators are
5282 .Ql -lt
5283 (less than),
5284 .Ql -le
5285 (less than or equal to),
5286 .Ql -eq
5287 (equal),
5288 .Ql -ne
5289 (not equal),
5290 .Ql -ge
5291 (greater than or equal to), and
5292 .Ql -gt
5293 (greater than).
5296 String data operators compare the left and right hand side according to
5297 their textual content.
5298 Unset variables are treated as the empty string.
5299 The behaviour of string operators can be adjusted by prefixing the
5300 operator with the modifier trigger commercial at
5301 .Ql @ ,
5302 followed by none to multiple modifiers: for now supported is
5303 .Ql i ,
5304 which turns the comparison into a case-insensitive one: this is
5305 implied if no modifier follows the trigger.
5308 Available string operators are
5309 .Ql <
5310 (less than),
5311 .Ql <=
5312 (less than or equal to),
5313 .Ql ==
5314 (equal),
5315 .Ql !=
5316 (not equal),
5317 .Ql >=
5318 (greater than or equal to),
5319 .Ql >
5320 (greater than),
5321 .Ql =%
5322 (is substring of) and
5323 .Ql !%
5324 (is not substring of).
5325 By default these operators work on bytes and (therefore) do not take
5326 into account character set specifics.
5327 If the case-insensitivity modifier has been used, case is ignored
5328 according to the rules of the US-ASCII encoding, i.e., bytes are
5329 still compared.
5332 When the \*(OPal regular expression support is available, the additional
5333 string operators
5334 .Ql =~
5336 .Ql !~
5337 can be used.
5338 They treat the right hand side as an extended regular expression that is
5339 matched according to the active locale (see
5340 .Sx "Character sets" ) ,
5341 i.e., character sets should be honoured correctly.
5344 Conditions can be joined via AND-OR lists (where the AND operator is
5345 .Ql &&
5346 and the OR operator is
5347 .Ql || ) ,
5348 which have equal precedence and will be evaluated with left
5349 associativity, thus using the same syntax that is known for the
5350 .Xr sh 1 .
5351 It is also possible to form groups of conditions and lists by enclosing
5352 them in pairs of brackets
5353 .Ql [\ \&.\&.\&.\ ] ,
5354 which may be interlocked within each other, and also be joined via
5355 AND-OR lists.
5358 The results of individual conditions and entire groups may be modified
5359 via unary operators: the unary operator
5360 .Ql \&!
5361 will reverse the result.
5363 .Bd -literal -offset indent
5364 # (This not in v15, there [ -n "$debug"]!)
5365 if $debug
5366   echo *debug* is set
5367 endif
5368 if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
5369   echo *ttycharset* is UTF-8, the former case-sensitive!
5370 endif
5371 set t1=one t2=one
5372 if [ "${t1}" == "${t2}" ]
5373   echo These two variables are equal
5374 endif
5375 if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm\&.*" ]
5376   echo ..in an X terminal
5377 endif
5378 if [ [ true ] && [ [ "${debug}" != '' ] || \e
5379     [ "$verbose" != '' ] ] ]
5380   echo Noisy, noisy
5381 endif
5382 if true && [ "$debug" != '' ] || [ "${verbose}" != '' ]
5383   echo Left associativity, as is known from the shell
5384 endif
5389 .It Ic ignore
5390 (ig) Identical to
5391 .Ic discard .
5392 Superseded by the multiplexer
5393 .Ic headerpick .
5396 .It Ic list
5397 Shows the names of all available commands, alphabetically sorted.
5398 If given any non-whitespace argument the list will be shown in the order
5399 in which command prefixes are searched.
5400 \*(OP In conjunction with a set variable
5401 .Va verbose
5402 additional information will be provided for each command: the argument
5403 type will be indicated, the documentation string will be shown,
5404 and the set of command flags will show up:
5406 .Bl -tag -compact -width ".It Ql BaNg"
5407 .It Ql "vput modifier"
5408 command supports the command modifier
5409 .Cm vput .
5410 .It Ql "errno in *!*"
5411 the error number is tracked in
5412 .Va \&! .
5413 .It Ql "needs box"
5414 commands needs an active mailbox, a
5415 .Ic file .
5416 .It Ql "ok: batch or interactive"
5417 command may only be used in interactive or
5418 .Fl #
5419 batch mode.
5420 .It Ql "ok: send mode"
5421 command can be used in send mode.
5422 .It Ql "not ok: compose mode"
5423 command is not available when in compose mode.
5424 .It Ql "not ok: during startup"
5425 command cannot be used during program startup, e.g., while loading
5426 .Sx "Resource files" .
5427 .It Ql "ok: in subprocess"
5428 command is allowed to be used when running in a subprocess instance,
5429 e.g., from within a macro that is called via
5430 .Va on-compose-splice .
5435 .It Ic localopts
5436 This command can be used to localize changes to (linked)
5437 .Sx ENVIRONMENT
5438 as well as
5439 .Sx "INTERNAL VARIABLES" ,
5440 meaning that their state will be reverted to the former one once the
5441 .Dq covered scope
5442 is left.
5443 It can only be used inside of macro definition blocks introduced by
5444 .Ic account
5446 .Ic define .
5447 The covered scope of an
5448 .Ic account
5449 is left once a different account is activated, and some macros, notably
5450 .Va folder-hook Ns s ,
5451 use their own specific notion of covered scope, here it will be extended
5452 until the folder is left again.
5455 This setting stacks up: i.e., if
5456 .Ql macro1
5457 enables change localization and calls
5458 .Ql macro2 ,
5459 which explicitly resets localization, then any value changes within
5460 .Ql macro2
5461 will still be reverted when the scope of
5462 .Ql macro1
5463 is left.
5464 (Caveats: if in this example
5465 .Ql macro2
5466 changes to a different
5467 .Ic account
5468 which sets some variables that are already covered by localizations,
5469 their scope will be extended, and in fact leaving the
5470 .Ic account
5471 will (thus) restore settings in (likely) global scope which actually
5472 were defined in a local, macro private context!)
5475 This command takes one or two arguments, the optional first one
5476 specifies an attribute that may be one of
5477 .Cm scope ,
5478 which refers to the current scope and is thus the default,
5479 .Cm call ,
5480 which causes any macro that is being
5481 .Ic call Ns
5482 ed to be started with localization enabled by default, as well as
5483 .Cm call-fixate ,
5484 which (if enabled) disallows any called macro to turn off localization:
5485 like this it can be ensured that once the current scope regains control,
5486 any changes made in deeper levels have been reverted.
5487 The latter two are mutually exclusive.
5488 The (second) argument is interpreted as a boolean (string, see
5489 .Sx "INTERNAL VARIABLES" )
5490 and states whether the given attribute shall be turned on or off.
5492 .Bd -literal -offset indent
5493 define temporary_settings {
5494   set possibly_global_option1
5495   localopts on
5496   set local_option1
5497   set local_option2
5498   localopts scope off
5499   set possibly_global_option2
5505 .It Ic Lreply
5506 Reply to messages that come in via known
5507 .Pf ( Ic mlist )
5508 or subscribed
5509 .Pf ( Ic mlsubscribe )
5510 mailing lists, or pretend to do so (see
5511 .Sx "Mailing lists" ) :
5512 on top of the usual
5513 .Ic reply
5514 functionality this will actively resort and even remove message
5515 recipients in order to generate a message that is supposed to be sent to
5516 a mailing list.
5517 For example it will also implicitly generate a
5518 .Ql Mail-Followup-To:
5519 header if that seems useful, regardless of the setting of the variable
5520 .Va followup-to .
5521 For more documentation please refer to
5522 .Sx "On sending mail, and non-interactive mode" .
5524 This may generate the errors
5525 .Va ^ERR Ns -DESTADDRREQ
5526 if no receiver has been specified,
5527 .Va ^ERR Ns -PERM
5528 if some addressees where rejected by
5529 .Va expandaddr ,
5530 .Va ^ERR Ns -NODATA
5531 if no applicable messages have been given,
5532 .Va ^ERR Ns -IO
5533 if an I/O error occurs,
5534 .Va ^ERR Ns -NOTSUP
5535 if a necessary character set conversion fails, and
5536 .Va ^ERR Ns -INVAL
5537 for other errors.
5538 Any error stops processing of further messages.
5541 .It Ic Mail
5542 Similar to
5543 .Ic mail ,
5544 but saves the message in a file named after the local part of the first
5545 recipient's address (instead of in
5546 .Va record Ns ).
5549 .It Ic mail
5550 (m) Takes a (list of) recipient address(es) as (an) argument(s),
5551 or asks on standard input if none were given;
5552 then collects the remaining mail content and sends it out.
5553 For more documentation please refer to
5554 .Sx "On sending mail, and non-interactive mode" .
5556 This may generate the errors
5557 .Va ^ERR Ns -DESTADDRREQ
5558 if no receiver has been specified,
5559 .Va ^ERR Ns -PERM
5560 if some addressees where rejected by
5561 .Va expandaddr ,
5562 .Va ^ERR Ns -NODATA
5563 if no applicable messages have been given,
5564 .Va ^ERR Ns -NOTSUP
5565 if multiple messages have been specified,
5566 .Va ^ERR Ns -IO
5567 if an I/O error occurs,
5568 .Va ^ERR Ns -NOTSUP
5569 if a necessary character set conversion fails, and
5570 .Va ^ERR Ns -INVAL
5571 for other errors.
5574 .It Ic mbox
5575 (mb) The given message list is to be sent to the
5576 .Mx -sx
5577 .Sx "secondary mailbox"
5578 .Ev MBOX
5579 when \*(UA is quit; this is the default action unless the variable
5580 .Va hold
5581 is set.
5582 \*(ID This command can only be used in a
5583 .Mx -sx
5584 .Sx "primary system mailbox" .
5588 .It Ic mimetype , unmimetype
5589 Without arguments the content of the MIME type cache will displayed;
5590 a more verbose listing will be produced if either of
5591 .Va debug
5593 .Va verbose
5594 are set.
5595 When given arguments they will be joined, interpreted as shown in
5596 .Sx "The mime.types files"
5597 (also see
5598 .Sx "HTML mail and MIME attachments" ) ,
5599 and the resulting entry will be added (prepended) to the cache.
5600 In any event MIME type sources are loaded first as necessary \(en
5601 .Va mimetypes-load-control
5602 can be used to fine-tune which sources are actually loaded.
5604 The latter command deletes all specifications of the given MIME type, thus
5605 .Ql ? unmimetype text/plain
5606 will remove all registered specifications for the MIME type
5607 .Ql text/plain .
5608 The special name
5609 .Ql *
5610 will discard all existing MIME types, just as will
5611 .Ql reset ,
5612 but which also reenables cache initialization via
5613 .Va mimetypes-load-control .
5617 .It Ic mlist , unmlist
5618 The latter command removes all given mailing-lists, the special name
5619 .Ql *
5620 can be used to remove all registered lists.
5621 The former will list all currently defined mailing lists (and their
5622 attributes, if any) when used without arguments; a more verbose listing
5623 will be produced if either of
5624 .Va debug
5626 .Va verbose
5627 are set.
5628 Otherwise all given arguments will be added and henceforth be recognized
5629 as mailing lists.
5630 If the \*(OPal regular expression support is available then mailing
5631 lists may also be specified as (extended) regular expressions (see
5632 .Xr re_format 7
5633 for more on those).
5636 .It Ic mimeview
5637 \*(ID Only available in interactive mode, this command allows to display
5638 MIME parts which require external MIME handler programs to run which do
5639 not integrate in \*(UAs normal
5640 .Ic type
5641 output (see
5642 .Sx "HTML mail and MIME attachments" ) .
5643 (\*(ID No syntax to directly address parts, this restriction may vanish.)
5644 The user will be asked for each non-text part of the given message in
5645 turn whether the registered handler shall be used to display the part.
5649 .It Ic mlsubscribe , unmlsubscribe
5650 The latter command removes the subscription attribute from all given
5651 mailing-lists, the special name
5652 .Ql *
5653 can be used to do so for any registered list.
5654 The former will list all currently defined mailing lists which have
5655 a subscription attribute when used without arguments; a more verbose
5656 listing will be produced if either of
5657 .Va debug
5659 .Va verbose
5660 are set.
5661 Otherwise this attribute will be set for all given mailing lists,
5662 newly creating them as necessary (as via
5663 .Ic mlist ) .
5664 Also see
5665 .Va followup-to .
5668 .It Ic Move
5669 Similar to
5670 .Ic move ,
5671 but moves the messages to a file named after the local part of the
5672 sender address of the first message (instead of in
5673 .Va record Ns ).
5676 .It Ic move
5677 Acts like
5678 .Ic copy
5679 but marks the messages for deletion if they were transferred
5680 successfully.
5683 .It Ic More
5684 Like
5685 .Ic more ,
5686 but also displays header fields which would not pass the
5687 .Ic headerpick
5688 selection, and all MIME parts.
5689 Identical to
5690 .Ic Page .
5693 .It Ic more
5694 Invokes the
5695 .Ev PAGER
5696 on the given messages, even in non-interactive mode and as long as the
5697 standard output is a terminal.
5698 Identical to
5699 .Ic page .
5702 .It Ic netrc
5703 \*(OP When used without arguments or if
5704 .Ar show
5705 has been given the content of the
5706 .Pa .netrc
5707 cache is shown, loading it first as necessary.
5708 If the argument is
5709 .Ar load
5710 then the cache will only be initialized and
5711 .Ar clear
5712 will remove its contents.
5713 Note that \*(UA will try to load the file only once, use
5714 .Ql Ic \&\&netrc Ns \:\0\:clear
5715 to unlock further attempts.
5717 .Va netrc-lookup ,
5718 .Va netrc-pipe
5719 and the section
5720 .Sx "On URL syntax and credential lookup" ;
5721 the section
5722 .Sx "The .netrc file"
5723 documents the file format in detail.
5726 .It Ic newmail
5727 Checks for new mail in the current folder without committing any changes
5728 before.
5729 If new mail is present, a message is shown.
5730 If the
5731 .Va header
5732 variable is set,
5733 the headers of each new message are also shown.
5734 This command is not available for all mailbox types.
5737 .It Ic next
5738 (n) (like
5739 .Ql +
5741 .Dq ENTER )
5742 Goes to the next message in sequence and types it.
5743 With an argument list, types the next matching message.
5746 .It Ic New
5747 Same as
5748 .Ic Unread .
5751 .It Ic new
5752 Same as
5753 .Ic unread .
5756 .It Ic noop
5757 If the current folder is accessed via a network connection, a
5758 .Dq NOOP
5759 command is sent, otherwise no operation is performed.
5762 .It Ic Page
5763 Like
5764 .Ic page ,
5765 but also displays header fields which would not pass the
5766 .Ic headerpick
5767 selection, and all MIME parts.
5768 Identical to
5769 .Ic More .
5772 .It Ic page
5773 Invokes the
5774 .Ev PAGER
5775 on the given messages, even in non-interactive mode and as long as the
5776 standard output is a terminal.
5777 Identical to
5778 .Ic more .
5781 .It Ic Pipe
5782 Like
5783 .Ic pipe
5784 but also pipes header fields which would not pass the
5785 .Ic headerpick
5786 selection, and all parts of MIME
5787 .Ql multipart/alternative
5788 messages.
5791 .It Ic pipe
5792 (pi) Takes a message list and a shell command
5793 and pipes the messages through the command.
5794 Without an argument the current message is piped through the command
5795 given by the
5796 .Va cmd
5797 variable.
5798 If the
5799 .Va page
5800 variable is set,
5801 every message is followed by a formfeed character.
5804 .It Ic preserve
5805 (pre) A synonym for
5806 .Ic hold .
5809 .It Ic Print
5810 (P) Alias for
5811 .Ic Type .
5814 .It Ic print
5815 (p) Research
5817 equivalent of
5818 .Ic type .
5821 .It Ic quit
5822 (q) Terminates the session, saving all undeleted, unsaved messages in
5823 the current
5824 .Mx -sx
5825 .Sx "secondary mailbox"
5826 .Ev MBOX ,
5827 preserving all messages marked with
5828 .Ic hold
5830 .Ic preserve
5831 or never referenced in the system
5832 .Va inbox ,
5833 and removing all other messages from the
5834 .Mx -sx
5835 .Sx "primary system mailbox" .
5836 If new mail has arrived during the session,
5837 the message
5838 .Dq You have new mail
5839 will be shown.
5840 If given while editing a mailbox file with the command line option
5841 .Fl f ,
5842 then the edit file is rewritten.
5843 A return to the shell is effected,
5844 unless the rewrite of edit file fails,
5845 in which case the user can escape with the exit command.
5846 The optional status number argument will be passed through to
5847 .Xr exit 3 .
5848 \*(ID For now it can happen that the given status will be overwritten,
5849 later this will only occur if a later error needs to be reported onto an
5850 otherwise success indicating status.
5853 .It Ic read
5854 \*(NQ Read a line from standard input, or the channel set active via
5855 .Ic readctl ,
5856 and assign the data, which will be splitted as indicated by
5857 .Va ifs ,
5858 to the given variables.
5859 The variable names are checked by the same rules as documented for
5860 .Cm vput ,
5861 and the same error codes will be seen in
5862 .Va \&! ;
5863 the exit status
5864 .Va \&?
5865 indicates the number of bytes read, it will be
5866 .Ql -1
5867 with the error number
5868 .Va \&!
5869 set to
5870 .Va ^ERR Ns -BADF
5871 in case of I/O errors, or
5872 .Va ^ERR Ns -NONE
5873 upon End-Of-File.
5874 If there are more fields than variables, assigns successive fields to the
5875 last given variable.
5876 If there are less fields than variables, assigns the empty string to the
5877 remains.
5878 .Bd -literal -offset indent
5879 ? read a b c
5880    H  e  l  l  o
5881 ? echo "<$a> <$b> <$c>"
5882 <H> <e> <l  l  o>
5883 ? wysh set ifs=:; read a b c;unset ifs
5884 hey2.0,:"'you    ",:world!:mars.:
5885 ? echo $?/$^ERRNAME / <$a><$b><$c>
5886 0/NONE / <hey2.0,><"'you    ",><world!:mars.:><><>
5890 .It Ic readall
5891 \*(NQ Read anything from standard input, or the channel set active via
5892 .Ic readctl ,
5893 and assign the data to the given variable.
5894 The variable name is checked by the same rules as documented for
5895 .Cm vput ,
5896 and the same error codes will be seen in
5897 .Va \&! ;
5898 the exit status
5899 .Va \&?
5900 indicates the number of bytes read, it will be
5901 .Ql -1
5902 with the error number
5903 .Va \&!
5904 set to
5905 .Va ^ERR Ns -BADF
5906 in case of I/O errors, or
5907 .Va ^ERR Ns -NONE
5908 upon End-Of-File.
5909 \*(ID The input data length is restricted to 31-bits.
5912 .It Ic readctl
5913 \*(NQ Manages input channels for
5914 .Ic read
5916 .Ic readall ,
5917 to be used to avoid complicated or impracticable code, like calling
5918 .Ic \&\&read
5919 from within a macro in non-interactive mode.
5920 Without arguments, or when the first argument is
5921 .Cm show ,
5922 a listing of all known channels is printed.
5923 Channels can otherwise be
5924 .Cm create Ns
5925 d, and existing channels can be
5926 .Cm set
5927 active and
5928 .Cm remove Ns
5929 d by giving the string used for creation.
5931 The channel name is expected to be a file descriptor number, or,
5932 if parsing the numeric fails, an input file name that undergoes
5933 .Sx "Filename transformations" .
5934 E.g. (this example requires a modern shell):
5935 .Bd -literal -offset indent
5936 $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e
5937   LC_ALL=C \*(uA -R#
5938 hey, you
5939 $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e
5940   LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6'
5941 hey, you
5944 .It Ic redirect
5945 \*(OB Same as
5946 .Ic resend .
5948 .It Ic Redirect
5949 \*(OB Same as
5950 .Ic Resend .
5953 .It Ic remove
5954 Removes the named files or directories.
5955 If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox
5956 type specific removal will be performed, deleting the complete mailbox.
5957 The user is asked for confirmation in interactive mode.
5960 .It Ic rename
5961 Takes the name of an existing folder
5962 and the name for the new folder
5963 and renames the first to the second one.
5964 Both folders must be of the same type.
5967 .It Ic Reply
5968 (R) Replies to only the sender of each message of the given message
5969 list, by using the first message as the template to quote, for the
5970 .Ql Subject:
5971 etc.
5972 .Va flipr
5973 will exchange this command with
5974 .Ic reply .
5975 Unless the internal variable
5976 .Va fullnames
5977 is set the recipient address will be stripped from comments, names etc.
5978 .Ql Reply-To:
5979 headers will be inspected if
5980 .Va reply-to-honour
5981 is set.
5983 This may generate the errors
5984 .Va ^ERR Ns -DESTADDRREQ
5985 if no receiver has been specified,
5986 .Va ^ERR Ns -PERM
5987 if some addressees where rejected by
5988 .Va expandaddr ,
5989 .Va ^ERR Ns -NODATA
5990 if no applicable messages have been given,
5991 .Va ^ERR Ns -IO
5992 if an I/O error occurs,
5993 .Va ^ERR Ns -NOTSUP
5994 if a necessary character set conversion fails, and
5995 .Va ^ERR Ns -INVAL
5996 for other errors.
5999 .It Ic reply
6000 (r) Take a message and group-responds to it by addressing the sender
6001 and all recipients, subject to
6002 .Ic alternates
6003 processing.
6004 .Va followup-to ,
6005 .Va followup-to-honour ,
6006 .Va reply-to-honour
6007 as well as
6008 .Va recipients-in-cc
6009 influence response behaviour.
6010 Unless the internal variable
6011 .Va fullnames
6012 is set recipient addresses will be stripped from comments, names etc.
6014 .Va flipr
6015 is set the commands
6016 .Ic Reply
6018 .Ic reply
6019 are exchanged.
6020 The command
6021 .Ic Lreply
6022 offers special support for replying to mailing lists.
6023 For more documentation please refer to
6024 .Sx "On sending mail, and non-interactive mode" .
6026 This may generate the errors
6027 .Va ^ERR Ns -DESTADDRREQ
6028 if no receiver has been specified,
6029 .Va ^ERR Ns -PERM
6030 if some addressees where rejected by
6031 .Va expandaddr ,
6032 .Va ^ERR Ns -NODATA
6033 if no applicable messages have been given,
6034 .Va ^ERR Ns -IO
6035 if an I/O error occurs,
6036 .Va ^ERR Ns -NOTSUP
6037 if a necessary character set conversion fails, and
6038 .Va ^ERR Ns -INVAL
6039 for other errors.
6040 Any error stops processing of further messages.
6043 .It Ic replyall
6044 Similar to
6045 .Ic reply ,
6046 but initiates a group-reply regardless of the value of
6047 .Va flipr .
6050 .It Ic replysender
6051 Similar to
6052 .Ic Reply ,
6053 but responds to the sender only regardless of the value of
6054 .Va flipr .
6057 .It Ic Resend
6058 Like
6059 .Ic resend ,
6060 but does not add any header lines.
6061 This is not a way to hide the sender's identity,
6062 but useful for sending a message again to the same recipients.
6065 .It Ic resend
6066 Takes a list of messages and a user name
6067 and sends each message to the named user.
6068 .Ql Resent-From:
6069 and related header fields are prepended to the new copy of the message.
6070 Saving in
6071 .Va record
6072 is only performed if
6073 .Va record-resent
6074 is set.
6076 This may generate the errors
6077 .Va ^ERR Ns -DESTADDRREQ
6078 if no receiver has been specified,
6079 .Va ^ERR Ns -PERM
6080 if some addressees where rejected by
6081 .Va expandaddr ,
6082 .Va ^ERR Ns -NODATA
6083 if no applicable messages have been given,
6084 .Va ^ERR Ns -IO
6085 if an I/O error occurs,
6086 .Va ^ERR Ns -NOTSUP
6087 if a necessary character set conversion fails, and
6088 .Va ^ERR Ns -INVAL
6089 for other errors.
6090 Any error stops processing of further messages.
6093 .It Ic Respond
6094 Same as
6095 .Ic Reply .
6098 .It Ic respond
6099 Same as
6100 .Ic reply .
6103 .It Ic respondall
6104 Same as
6105 .Ic replyall .
6108 .It Ic respondsender
6109 Same as
6110 .Ic replysender .
6113 .It Ic retain
6114 (ret) Superseded by the multiplexer
6115 .Ic headerpick .
6118 .It Ic return
6119 Only available inside the scope of a
6120 .Ic define Ns
6121 d macro or an
6122 .Ic account ,
6123 this will stop evaluation of any further macro content, and return
6124 execution control to the caller.
6125 The two optional parameters must be specified as positive decimal
6126 numbers and default to the value 0:
6127 the first argument specifies the signed 32-bit return value (stored in
6128 .Va \&?
6129 \*(ID and later extended to signed 64-bit),
6130 the second the signed 32-bit error number (stored in
6131 .Va \&! ) .
6132 As documented for
6133 .Va \&?
6134 a non-0 exit status may cause the program to exit.
6137 .It Ic Save
6138 (S) Similar to
6139 .Ic save,
6140 but saves the messages in a file named after the local part of the
6141 sender of the first message instead of (in
6142 .Va record
6143 and) taking a filename argument; the variable
6144 .Va outfolder
6145 is inspected to decide on the actual storage location.
6148 .It Ic save
6149 (s) Takes a message list and a filename and appends each message in turn
6150 to the end of the file.
6151 If no filename is given, the
6152 .Mx -sx
6153 .Sx "secondary mailbox"
6154 .Ev MBOX
6155 is used.
6156 The filename in quotes, followed by the generated character count
6157 is echoed on the user's terminal.
6158 If editing a
6159 .Mx -sx
6160 .Sx "primary system mailbox"
6161 the messages are marked for deletion.
6162 .Sx "Filename transformations"
6163 will be applied.
6164 To filter the saved header fields to the desired subset use the
6165 .Ql save
6166 slot of the white- and blacklisting command
6167 .Ic headerpick .
6169 .It Ic savediscard
6170 \*(OB Superseded by the multiplexer
6171 .Ic headerpick .
6173 .It Ic saveignore
6174 \*(OB Superseded by the multiplexer
6175 .Ic headerpick .
6177 .It Ic saveretain
6178 \*(OB Superseded by the multiplexer
6179 .Ic headerpick .
6182 .It Ic search
6183 Takes a message specification (list) and displays a header summary of
6184 all matching messages, as via
6185 .Ic headers .
6186 This command is an alias of
6187 .Ic from .
6188 Also see
6189 .Sx "Specifying messages" .
6192 .It Ic seen
6193 Takes a message list and marks all messages as having been read.
6198 .It Ic set , unset
6199 (se, \*(NQ uns) The latter command will delete all given variables,
6200 the former, when used without arguments, will show all variables which
6201 are currently known to \*(UA.
6202 A more verbose listing will be produced if
6203 either of
6204 .Va debug
6206 .Va verbose
6207 are set.
6208 Remarks: the list mode will not automatically link-in known
6209 .Sx ENVIRONMENT
6210 variables, but only explicit addressing will, e.g., via
6211 .Ic varshow ,
6212 using a variable in an
6213 .Ic if
6214 condition or a string passed to
6215 .Ic echo ,
6216 explicit
6217 .Ic set Ns
6218 ting, as well as some program-internal use cases.
6221 Otherwise the given variables (and arguments) are set or adjusted.
6222 Arguments are of the form
6223 .Ql name=value
6224 (no space before or after
6225 .Ql = ) ,
6226 or plain
6227 .Ql name
6228 if there is no value, i.e., a boolean variable.
6229 \*(ID In conjunction with the
6230 .Cm wysh
6231 command prefix
6232 .Sx "Shell-style argument quoting"
6233 can be used to quote arguments as necessary.
6234 \*(ID Otherwise quotation marks may be placed around any part of the
6235 assignment statement to quote blanks or tabs.
6238 .Dl ? wysh set indentprefix=' -> '
6241 If an argument begins with
6242 .Ql no ,
6243 as in
6244 .Ql set nosave ,
6245 the effect is the same as invoking the
6246 .Ic unset
6247 command with the remaining part of the variable
6248 .Pf ( Ql unset save ) .
6252 .Ql name
6253 that is known to map to an environment variable will automatically cause
6254 updates in the program environment (unsetting a variable in the
6255 environment requires corresponding system support) \(em use the command
6256 .Ic environ
6257 for further environmental control.
6258 Also see
6259 .Ic varedit ,
6260 .Ic varshow
6261 and the sections
6262 .Sx "INTERNAL VARIABLES"
6264 .Sx ENVIRONMENT .
6268 .It Ic shcodec
6269 Apply shell quoting rules to the given raw-data arguments.
6270 Supports
6271 .Cm vput
6272 (see
6273 .Sx "Command modifiers" ) .
6274 The first argument specifies the operation:
6275 .Ar [+]e[ncode]
6277 .Ar d[ecode]
6278 cause shell quoting to be applied to the remains of the line, and
6279 expanded away thereof, respectively.
6280 If the former is prefixed with a plus-sign, the quoted result will not
6281 be roundtrip enabled, and thus can be decoded only in the very same
6282 environment that was used to perform the encode; also see
6283 .Cd mle-quote-rndtrip .
6284 If the coding operation fails the error number
6285 .Va \&!
6286 is set to
6287 .Va ^ERR Ns -CANCELED ,
6288 and the unmodified input is used as the result; the error number may
6289 change again due to output or result storage errors.
6292 .It Ic shell
6293 \*(NQ (sh) Invokes an interactive version of the shell,
6294 and returns its exit status.
6298 .It Ic shortcut , unshortcut
6299 Without arguments the list of all currently defined shortcuts is
6300 shown, with one argument the expansion of the given shortcut.
6301 Otherwise all given arguments are treated as pairs of shortcuts and
6302 their expansions, creating new or changing already existing shortcuts,
6303 as necessary.
6304 The latter command will remove all given shortcuts, the special name
6305 .Ql *
6306 will remove all registered shortcuts.
6309 .It Ic shift
6310 \*(NQ Shift the positional parameter stack (starting at
6311 .Va 1 )
6312 by the given number (which must be a positive decimal),
6313 or 1 if no argument has been given.
6314 It is an error if the value exceeds the number of positional parameters.
6315 If the given number is 0, no action is performed, successfully.
6316 The stack as such can be managed via
6317 .Ic vpospar .
6318 Note this command will fail in
6319 .Ic account
6320 and hook macros unless the positional parameter stack has been
6321 explicitly created in the current context via
6322 .Ic vpospar .
6325 .It Ic show
6326 Like
6327 .Ic type ,
6328 but performs neither MIME decoding nor decryption, so that the raw
6329 message text is shown.
6332 .It Ic size
6333 (si) Shows the size in characters of each message of the given
6334 message-list.
6337 .It Ic sleep
6338 \*(NQ Sleep for the specified number of seconds (and optionally
6339 milliseconds), by default interruptably.
6340 If a third argument is given the sleep will be uninterruptible,
6341 otherwise the error number
6342 .Va \&!
6343 will be set to
6344 .Va ^ERR Ns -INTR
6345 if the sleep has been interrupted.
6346 The command will fail and the error number will be
6347 .Va ^ERR Ns -OVERFLOW
6348 if the given duration(s) overflow the time datatype, and
6349 .Va ^ERR Ns -INVAL
6350 if the given durations are no valid integers.
6355 .It Ic sort , unsort
6356 The latter command disables sorted or threaded mode, returns to normal
6357 message order and, if the
6358 .Va header
6359 variable is set,
6360 displays a header summary.
6361 The former command shows the current sorting criterion when used without
6362 an argument, but creates a sorted representation of the current folder
6363 otherwise, and changes the
6364 .Ic next
6365 command and the addressing modes such that they refer to messages in
6366 the sorted order.
6367 Message numbers are the same as in regular mode.
6368 If the
6369 .Va header
6370 variable is set,
6371 a header summary in the new order is also displayed.
6372 Automatic folder sorting can be enabled by setting the
6373 .Va autosort
6374 variable, as in, e.g.,
6375 .Ql set autosort=thread .
6376 Possible sorting criterions are:
6379 .Bl -tag -compact -width "subject"
6380 .It Ar date
6381 Sort the messages by their
6382 .Ql Date:
6383 field, that is by the time they were sent.
6384 .It Ar from
6385 Sort messages by the value of their
6386 .Ql From:
6387 field, that is by the address of the sender.
6388 If the
6389 .Va showname
6390 variable is set, the sender's real name (if any) is used.
6391 .It Ar size
6392 Sort the messages by their size.
6393 .It spam
6394 \*(OP Sort the message by their spam score, as has been classified by
6395 .Ic spamrate .
6396 .It Ar status
6397 Sort the messages by their message status.
6398 .It Ar subject
6399 Sort the messages by their subject.
6400 .It Ar thread
6401 Create a threaded display.
6402 .It Ar to
6403 Sort messages by the value of their
6404 .Ql To:
6405 field, that is by the address of the recipient.
6406 If the
6407 .Va showname
6408 variable is set, the recipient's real name (if any) is used.
6413 .It Ic source
6414 \*(NQ (so) The source command reads commands from the given file.
6415 .Sx "Filename transformations"
6416 will be applied.
6417 If the given expanded argument ends with a vertical bar
6418 .Ql |
6419 then the argument will instead be interpreted as a shell command and
6420 \*(UA will read the output generated by it.
6421 Dependent on the settings of
6422 .Va posix
6424 .Va errexit ,
6425 and also dependent on whether the command modifier
6426 .Cm ignerr
6427 had been used, encountering errors will stop sourcing of the given input.
6428 \*(ID Note that
6429 .Ic \&\&source
6430 cannot be used from within macros that execute as
6431 .Va folder-hook Ns s
6433 .Ic account Ns s ,
6434 i.e., it can only be called from macros that were
6435 .Ic call Ns ed .
6438 .It Ic source_if
6439 \*(NQ The difference to
6440 .Ic source
6441 (beside not supporting pipe syntax aka shell command input) is that
6442 this command will not generate an error nor warn if the given file
6443 argument cannot be opened successfully.
6446 .It Ic spamclear
6447 \*(OP Takes a list of messages and clears their
6448 .Ql is-spam
6449 flag.
6452 .It Ic spamforget
6453 \*(OP Takes a list of messages and causes the
6454 .Va spam-interface
6455 to forget it has ever used them to train its Bayesian filter.
6456 Unless otherwise noted the
6457 .Ql is-spam
6458 flag of the message is inspected to chose whether a message shall be
6459 forgotten to be
6460 .Dq ham
6462 .Dq spam .
6465 .It Ic spamham
6466 \*(OP Takes a list of messages and informs the Bayesian filter of the
6467 .Va spam-interface
6468 that they are
6469 .Dq ham .
6470 This also clears the
6471 .Ql is-spam
6472 flag of the messages in question.
6475 .It Ic spamrate
6476 \*(OP Takes a list of messages and rates them using the configured
6477 .Va spam-interface ,
6478 without modifying the messages, but setting their
6479 .Ql is-spam
6480 flag as appropriate; because the spam rating headers are lost the rate
6481 will be forgotten once the mailbox is left.
6482 Refer to the manual section
6483 .Sx "Handling spam"
6484 for the complete picture of spam handling in \*(UA.
6487 .It Ic spamset
6488 \*(OP Takes a list of messages and sets their
6489 .Ql is-spam
6490 flag.
6493 .It Ic spamspam
6494 \*(OP Takes a list of messages and informs the Bayesian filter of the
6495 .Va spam-interface
6496 that they are
6497 .Dq spam .
6498 This also sets the
6499 .Ql is-spam
6500 flag of the messages in question.
6502 .It Ic thread
6503 \*(OB The same as
6504 .Ql sort thread
6505 (consider using a
6506 .Ql commandalias
6507 as necessary).
6510 .It Ic Top
6511 Like
6512 .Ic top
6513 but always uses the
6514 .Ic headerpick
6515 .Ql type
6516 slot for white- and blacklisting header fields.
6519 .It Ic top
6520 (to) Takes a message list and types out the first
6521 .Va toplines
6522 lines of each message on the users' terminal.
6523 Unless a special selection has been established for the
6524 .Ql top
6525 slot of the
6526 .Ic headerpick
6527 command, the only header fields that are displayed are
6528 .Ql From: ,
6529 .Ql To: ,
6530 .Ql CC: ,
6532 .Ql Subject: .
6533 .Ic Top
6534 will always use the
6535 .Ql type
6536 .Ic headerpick
6537 selection instead.
6538 It is possible to apply compression to what is displayed by setting
6539 .Va topsqueeze .
6540 Messages are decrypted and converted to the terminal character set
6541 if necessary.
6544 .It Ic touch
6545 (tou) Takes a message list and marks the messages for saving in the
6546 .Mx -sx
6547 .Sx "secondary mailbox"
6548 .Ev MBOX .
6549 \*(UA deviates from the POSIX standard with this command,
6550 as a following
6551 .Ic next
6552 command will display the following message instead of the current one.
6555 .It Ic Type
6556 (T) Like
6557 .Ic type
6558 but also displays header fields which would not pass the
6559 .Ic headerpick
6560 selection, and all visualizable parts of MIME
6561 .Ql multipart/alternative
6562 messages.
6565 .It Ic type
6566 (t) Takes a message list and types out each message on the users terminal.
6567 The display of message headers is selectable via
6568 .Ic headerpick .
6569 For MIME multipart messages, all parts with a content type of
6570 .Ql text ,
6571 all parts which have a registered MIME type handler (see
6572 .Sx "HTML mail and MIME attachments" )
6573 which produces plain text output, and all
6574 .Ql message
6575 parts are shown, others are hidden except for their headers.
6576 Messages are decrypted and converted to the terminal character set
6577 if necessary.
6578 The command
6579 .Ic mimeview
6580 can be used to display parts which are not displayable as plain text.
6582 .It Ic unaccount
6584 .Ic account .
6586 .It Ic unalias
6587 (una) See
6588 .Ic alias .
6590 .It Ic unanswered
6592 .Ic answered .
6594 .It Ic unbind
6596 .Ic bind .
6598 .It Ic uncollapse
6600 .Ic collapse .
6602 .It Ic uncolour
6604 .Ic colour .
6606 .It Ic undefine
6608 .Ic define .
6610 .It Ic undelete
6612 .Ic delete .
6614 .It Ic undraft
6616 .Ic draft .
6618 .It Ic unflag
6620 .Ic flag .
6622 .It Ic unfwdignore
6623 \*(OB Superseded by the multiplexer
6624 .Ic headerpick .
6626 .It Ic unfwdretain
6627 \*(OB Superseded by the multiplexer
6628 .Ic headerpick .
6631 .It Ic unignore
6632 Superseded by the multiplexer
6633 .Ic headerpick .
6635 .It Ic unmimetype
6637 .Ic mimetype .
6639 .It Ic unmlist
6641 .Ic mlist .
6643 .It Ic unmlsubscribe
6645 .Ic mlsubscribe .
6648 .It Ic Unread
6649 Same as
6650 .Ic unread .
6653 .It Ic unread
6654 Takes a message list and marks each message as not having been read.
6657 .It Ic unretain
6658 Superseded by the multiplexer
6659 .Ic headerpick .
6661 .It Ic unsaveignore
6662 \*(OB Superseded by the multiplexer
6663 .Ic headerpick .
6665 .It Ic unsaveretain
6666 \*(OB Superseded by the multiplexer
6667 .Ic headerpick .
6669 .It Ic unset
6670 \*(NQ (uns) See
6671 .Ic set .
6673 .It Ic unshortcut
6675 .Ic shortcut .
6677 .It Ic unsort
6679 .Ic short .
6681 .It Ic unthread
6682 \*(OB
6683 Same as
6684 .Ic unsort .
6687 .It Ic urlcodec
6688 Perform URL percent codec operations on the raw-data argument, rather
6689 according to RFC 3986.
6690 Supports
6691 .Cm vput
6692 (see
6693 .Sx "Command modifiers" ) ,
6694 and manages the error number
6695 .Va \&! .
6696 This is a character set agnostic and thus locale dependent operation,
6697 and it may decode bytes which are invalid in the current
6698 .Va ttycharset .
6699 \*(ID This command does not know about URLs beside that.
6701 The first argument specifies the operation:
6702 .Ar e[ncode]
6704 .Ar d[ecode]
6705 perform plain URL percent en- and decoding, respectively.
6706 .Ar p[ath]enc[ode]
6708 .Ar p[ath]dec[ode]
6709 perform a slightly modified operation which should be better for
6710 pathnames: it does not allow a tilde
6711 .Ql ~ ,
6712 and will neither accept hyphen-minus
6713 .Ql -
6714 nor dot
6715 .Ql .
6716 as an initial character.
6717 The remains of the line form the URL data which is to be converted.
6718 If the coding operation fails the error number
6719 .Va \&!
6720 is set to
6721 .Va ^ERR Ns -CANCELED ,
6722 and the unmodified input is used as the result; the error number may
6723 change again due to output or result storage errors.
6726 .It Ic varedit
6727 \*(NQ Edit the values of or create the given variable(s) in the
6728 .Ev EDITOR .
6729 Boolean variables cannot be edited, and variables can also not be
6730 .Ic unset
6731 with this command.
6734 .It Ic varshow
6735 \*(NQ This command produces the same output as the listing mode of
6736 .Ic set ,
6737 including
6738 .Va verbose Ns
6739 ity adjustments, but only for the given variables.
6742 .It Ic verify
6743 \*(OP Takes a message list and verifies each message.
6744 If a message is not a S/MIME signed message,
6745 verification will fail for it.
6746 The verification process checks if the message was signed using a valid
6747 certificate,
6748 if the message sender's email address matches one of those contained
6749 within the certificate,
6750 and if the message content has been altered.
6753 .It Ic version
6754 Shows the
6755 .Va version
6757 .Va features
6758 of \*(UA.
6762 .It Ic vexpr
6763 \*(NQ Evaluate arguments according to a given operator.
6764 This is a multiplexer command which can be used to perform signed 64-bit
6765 numeric calculations as well as byte string and string operations.
6766 It uses polish notation, i.e., the operator is the first argument and
6767 defines the number and type, and the meaning of the remaining arguments.
6768 An empty argument is replaced with a 0 if a number is expected.
6769 Supports
6770 .Cm vput
6771 (see
6772 .Sx "Command modifiers" ) .
6775 The result that is shown in case of errors is always
6776 .Ql -1
6777 for usage errors and numeric operations, and the empty string for byte
6778 string and string operations;
6779 if the latter two fail to provide result data for
6780 .Dq soft
6781 errors, e.g., when a search operation failed, they also set the
6782 .Va \&!
6783 error number to
6784 .Va ^ERR Ns -NODATA .
6785 Except when otherwise noted numeric arguments are parsed as signed 64-bit
6786 numbers, and errors will be reported in the error number
6787 .Va \&!
6788 as the numeric error
6789 .Va ^ERR Ns -RANGE .
6792 Numeric operations work on one or two signed 64-bit integers.
6793 One integer is expected by assignment (equals sign
6794 .Ql = ) ,
6795 which does nothing but parsing the argument, thus detecting validity and
6796 possible overflow conditions, and unary not (tilde
6797 .Ql ~ ) ,
6798 which creates the bitwise complement.
6799 Two integers are used by addition (plus sign
6800 .Ql + ) ,
6801 subtraction (hyphen-minus
6802 .Ql - ) ,
6803 multiplication (asterisk
6804 .Ql * ) ,
6805 division (solidus
6806 .Ql / )
6807 and modulo (percent sign
6808 .Ql % ) ,
6809 as well as for the bitwise operators logical or (vertical bar
6810 .Ql | ,
6811 to be quoted) ,
6812 bitwise and (ampersand
6813 .Ql \&& ,
6814 to be quoted) ,
6815 bitwise xor (circumflex
6816 .Ql ^ ) ,
6817 the bitwise signed left- and right shifts
6818 .Pf ( Ql << ,
6819 .Ql >> ) ,
6820 as well as for the unsigned right shift
6821 .Ql >>> .
6824 All numeric operators can be suffixed with a commercial at
6825 .Ql @ ,
6826 e.g.,
6827 .Ql *@ :
6828 this will turn the operation into a saturated one, which means that
6829 overflow errors and division and modulo by zero are no longer reported
6830 via the exit status, but the result will linger at the minimum or
6831 maximum possible value, instead of overflowing (or trapping).
6832 This is true also for the argument parse step.
6833 For the bitwise shifts, the saturated maximum is 63.
6834 Any catched overflow will be reported via the error number
6835 .Va \&!
6837 .Va ^ERR Ns -OVERFLOW .
6840 Character set agnostic string functions have no notion of locale
6841 settings and character sets.
6843 .Bl -hang -width ".It Cm random"
6844 .It Cm file-expand
6845 Performs the usual
6846 .Sx "Filename transformations"
6847 on its argument.
6848 .It Cm random
6849 Generates a random string of the given length, or of
6850 .Dv \&\&PATH_MAX
6851 bytes (a constant from
6852 .Pa /usr/include )
6853 if the value 0 is given; the random string will be base64url encoded
6854 according to RFC 4648, and thus be usable as a (portable) filename.
6858 Byte string operations work on 8-bit bytes and have no notion of locale
6859 settings and character sets, effectively assuming ASCII data.
6862 .Bl -hang -width ".It Cm length"
6863 .It Cm length
6864 Queries the length of the given argument.
6866 .It Cm hash
6867 Calculates the Chris Torek hash of the given argument.
6869 .It Cm find
6870 Byte-searches in the first for the second argument.
6871 Shows the resulting 0-based offset shall it have been found.
6873 .It Cm ifind
6874 Identical to
6875 .Cm find ,
6876 but works case-insensitively according to the rules of the ASCII
6877 character set.
6879 .It Cm substring
6880 Creates a substring of its first argument.
6881 The second argument is the 0-based starting offset, a negative one
6882 counts from the end;
6883 the optional third argument specifies the length of the desired result,
6884 a negative length leaves off the given number of bytes at the end of the
6885 original string, by default the entire string is used;
6886 this operation tries to work around faulty arguments (set
6887 .Va verbose
6888 for error logs), but reports them via the error number
6889 .Va \&!
6891 .Va ^ERR Ns -OVERFLOW .
6893 .It Cm trim
6894 Trim away whitespace characters from both ends of the argument.
6896 .It Cm trim-front
6897 Trim away whitespace characters from the begin of the argument.
6899 .It Cm trim-end
6900 Trim away whitespace characters from the end of the argument.
6905 String operations work, sufficient support provided, according to the
6906 active user's locale encoding and character set (see
6907 .Sx "Character sets" ) .
6910 .Bl -hang -width ".It Cm regex"
6911 .It Cm makeprint
6912 (One-way) Converts the argument to something safely printable on the
6913 terminal.
6915 .It Cm regex
6916 \*(OP A string operation that will try to match the first argument with
6917 the regular expression given as the second argument.
6918 If the optional third argument has been given then instead of showing
6919 the match offset a replacement operation is performed: the third
6920 argument is treated as if specified via dollar-single-quote (see
6921 .Sx "Shell-style argument quoting" ) ,
6922 and any occurrence of a positional parameter, e.g.,
6923 .Va 1 ,
6924 is replaced by the corresponding match group of the regular expression:
6925 .Bd -literal -offset indent
6926 ? vexpr -@ +1 -9223372036854775808
6927 ? vput vexpr res ir bananarama \e
6928     (.*)NanA(.*) '\e${1}au\e$2'
6929 ? echo $0 $res
6932 .It Cm iregex
6933 On otherwise identical case-insensitive equivalent to
6934 .Cm regex .
6939 .It Ic vpospar
6940 \*(NQ Manage the positional parameter stack (see
6941 .Va 1 , # , * , @
6942 as well as
6943 .Ic shift ) .
6944 If the first argument is
6945 .Ql clear ,
6946 then the positional parameter stack of the current context, or the
6947 global one, if there is none, is cleared.
6948 If it is
6949 .Ql set ,
6950 then the remaining arguments will be used to (re)create the stack,
6951 if the parameter stack size limit is excessed an
6952 .Va ^ERR Ns -OVERFLOW
6953 error will occur.
6956 If the first argument is
6957 .Ql quote ,
6958 a round-trip capable representation of the stack contents is created,
6959 with each quoted parameter separated from each other with the first
6960 character of
6961 .Va ifs ,
6962 and followed by the first character of
6963 .Va if-ws ,
6964 if that is not empty and not identical to the first.
6965 If that results in no separation at all a
6966 .Cm space
6967 character is used.
6968 This mode supports
6969 .Cm vput
6970 (see
6971 .Sx "Command modifiers" ) .
6972 I.e., the subcommands
6973 .Ql set
6975 .Ql quote
6976 can be used (in conjunction with
6977 .Ic eval )
6978 to (re)create an argument stack from and to a single variable losslessly.
6980 .Bd -literal -offset indent
6981 ? vpospar set hey, "'you    ", world!
6982 ? echo $#: <${1}><${2}><${3}>
6983 ? vput vpospar x quote
6984 ? vpospar clear
6985 ? echo $#: <${1}><${2}><${3}>
6986 ? eval vpospar set ${x}
6987 ? echo $#: <${1}><${2}><${3}>
6992 .It Ic visual
6993 (v) Takes a message list and invokes the display editor on each message.
6994 Modified contents are discarded unless the
6995 .Va writebackedited
6996 variable is set, and are not used unless the mailbox can be written to
6997 and the editor returns a successful exit status.
7000 .It Ic write
7001 (w) For conventional messages the body without all headers is written.
7002 The original message is never marked for deletion in the originating
7003 mail folder.
7004 The output is decrypted and converted to its native format as necessary.
7005 If the output file exists, the text is appended.
7006 If a message is in MIME multipart format its first part is written to
7007 the specified file as for conventional messages, handling of the remains
7008 depends on the execution mode.
7009 No special handling of compressed files is performed.
7011 In interactive mode the user is consecutively asked for the filenames of
7012 the processed parts.
7013 For convience saving of each part may be skipped by giving an empty
7014 value, the same result as writing it to
7015 .Pa /dev/null .
7016 Shell piping the part content by specifying a leading vertical bar
7017 .Ql |
7018 character for the filename is supported.
7019 Other user input undergoes the usual
7020 .Sx "Filename transformations" ,
7021 and contents of the destination file are overwritten if the file
7022 previously existed.
7024 \*(ID In non-interactive mode any part which does not specify a filename
7025 is ignored, and suspicious parts of filenames of the remaining parts are
7026 URL percent encoded (as via
7027 .Ic urlcodec )
7028 to prevent injection of malicious character sequences, resulting in
7029 a filename that will be written into the current directory.
7030 Existing files will not be overwritten, instead the part number or
7031 a dot are appended after a number sign
7032 .Ql #
7033 to the name until file creation succeeds (or fails due to other
7034 reasons).
7037 .It Ic xcall
7038 \*(NQ The sole difference to
7039 .Ic call
7040 is that the new macro is executed in place of the current one, which
7041 will not regain control: all resources of the current macro will be
7042 released first.
7043 This implies that any setting covered by
7044 .Ic localopts
7045 will be forgotten and covered variables will become cleaned up.
7046 If this command is not used from within a
7047 .Ic call Ns
7048 ed macro it will silently be (a more expensive variant of)
7049 .Ic call .
7052 .It Ic xit
7053 (x) A synonym for
7054 .Ic exit .
7057 .It Ic z
7058 \*(NQ \*(UA presents message headers in
7059 .Va screen Ns
7060 fuls as described under the
7061 .Ic headers
7062 command.
7063 Without arguments this command scrolls to the next window of messages,
7064 likewise if the argument is
7065 .Ql + .
7066 An argument of
7067 .Ql -
7068 scrolls to the last,
7069 .Ql ^
7070 scrolls to the first, and
7071 .Ql $
7072 to the last
7073 .Va \&\&screen
7074 of messages.
7075 A number argument prefixed by
7076 .Ql +
7078 .Ql \-
7079 indicates that the window is calculated in relation to the current
7080 position, and a number without a prefix specifies an absolute position.
7083 .It Ic Z
7084 \*(NQ Similar to
7085 .Ic z ,
7086 but scrolls to the next or previous window that contains at least one
7087 .Ql new
7089 .Ic flag Ns
7090 ged message.
7092 .\" }}}
7094 .\" }}}
7097 .\" .Sh COMMAND ESCAPES {{{
7098 .Sh "COMMAND ESCAPES"
7100 Here is a summary of the command escapes available in compose mode,
7101 which are used to perform special functions when composing messages.
7102 Command escapes are only recognized at the beginning of lines, and
7103 consist of a trigger (escape) and a command character.
7104 The actual escape character can be set via the internal variable
7105 .Va escape ,
7106 it defaults to the tilde
7107 .Ql ~ .
7108 Otherwise ignored whitespace characters following the escape character
7109 will prevent a possible addition of the command line to the \*(OPal
7110 history.
7113 Unless otherwise noted all compose mode command escapes ensure proper
7114 updates of the variables which represent the error number
7115 .Va \&!
7116 and the exit status
7117 .Va \&? .
7118 If the variable
7119 .Va errexit
7120 is set they will, unless stated otherwise, error out message compose
7121 mode and cause a progam exit if an operation fails.
7122 It is however possible to place the character hyphen-minus
7123 .Ql -
7124 after (possible whitespace following) the escape character, which has an
7125 effect equivalent to the command modifier
7126 .Cm ignerr .
7127 If the \*(OPal key bindings are available it is possible to create
7128 .Ic bind Ns
7129 ings specifically for the compose mode.
7132 .Bl -tag -width ".It Ic BaNg"
7134 .It Ic ~~ Ar string
7135 Insert the string of text in the message prefaced by a single
7136 .Ql ~ .
7137 (If the escape character has been changed,
7138 that character must be doubled instead.)
7141 .It Ic ~! Ar command
7142 Execute the indicated shell
7143 .Ar command
7144 which follows, replacing unescaped exclamation marks with the previously
7145 executed command if the internal variable
7146 .Va bang
7147 is set, then return to the message.
7150 .It Ic ~.
7151 Same effect as typing the end-of-file character.
7154 .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command
7155 Execute the given \*(UA command.
7156 Not all commands, however, are allowed.
7159 .It Ic ~< Ar filename
7160 Identical to
7161 .Ic ~r .
7164 .It Ic ~<! Ar command
7165 .Ar command
7166 is executed using the shell.
7167 Its standard output is inserted into the message.
7170 .It Ic ~?
7171 Write a summary of command escapes.
7174 .It Ic ~@ Op Ar filename...
7175 Append or edit the list of attachments.
7176 Does not manage the error number
7177 .Va \&!
7178 and the exit status
7179 .Va \&? ,
7180 (please use
7181 .Ic ~^
7182 instead if this is a concern).
7183 A list of
7184 .Ar filename
7185 arguments is expected as shell tokens (see
7186 .Sx "Shell-style argument quoting" ;
7187 token-separating commas are ignored, too), to be
7188 interpreted as documented for the command line option
7189 .Fl a ,
7190 with the message number exception as below.
7192 Without
7193 .Ar filename
7194 arguments the attachment list is edited, entry by entry;
7195 if a filename is left empty, that attachment is deleted from the list;
7196 once the end of the list is reached either new attachments may be
7197 entered or the session can be quit by committing an empty
7198 .Dq new
7199 attachment.
7201 For all mode, if a given filename solely consists of the number sign
7202 .Ql #
7203 followed by a valid message number of the currently active mailbox, then
7204 the given message is attached as a
7205 .Ql message/rfc822
7206 MIME message part.
7207 As the shell comment character the number sign must be quoted.
7210 .It Ic ~| Ar command
7211 Pipe the message through the specified filter command.
7212 If the command gives no output or terminates abnormally,
7213 retain the original text of the message.
7214 E.g., the command
7215 .Xr fmt 1
7216 is often used as a rejustifying filter.
7220 .It Ic ~^ Ar cmd Op Ar subcmd Op Ar arg3 Op Ar arg4
7221 Low-level command meant for scripted message access, i.e., for
7222 .Va on-compose-splice
7224 .Va on-compose-splice-shell .
7225 The used protocol is likely subject to changes, and therefore the
7226 mentioned hooks receive the used protocol version as an initial line.
7227 In general the first field of a response line represents a status code
7228 which specifies whether a command was successful or not, whether result
7229 data is to be expected, and if, the format of the result data.
7230 Does not manage the error number
7231 .Va \&!
7232 and the exit status
7233 .Va \&? ,
7234 because errors are reported via the protocol
7235 (hard errors like I/O failures cannot be handled).
7236 This command has read-only access to several virtual pseudo headers in
7237 the \*(UA private namespace, which may not exist (except for the first):
7241 .Bl -tag -compact -width ".It Va BaNg"
7242 .It Ql Mailx-Command:
7243 The name of the command that generates the message, one of
7244 .Ql forward ,
7245 .Ql Lreply ,
7246 .Ql mail ,
7247 .Ql Reply ,
7248 .Ql reply ,
7249 .Ql resend .
7251 .It Ql Mailx-Raw-To:
7252 .It Ql Mailx-Raw-Cc:
7253 .It Ql Mailx-Raw-Bcc:
7254 Represent the frozen initial state of these headers before any
7255 transformation (e.g.,
7256 .Ic alias ,
7257 .Ic alternates ,
7258 .Va recipients-in-cc
7259 etc.) took place.
7261 .It Ql Mailx-Orig-From:
7262 .It Ql Mailx-Orig-To:
7263 .It Ql Mailx-Orig-Cc:
7264 .It Ql Mailx-Orig-Bcc:
7265 The values of said headers of the original message which has been
7266 addressed by any of
7267 .Ic reply , forward , resend .
7271 The status codes are:
7275 .Bl -tag -compact -width ".It Ql 210"
7276 .It Ql 210
7277 Status ok; the remains of the line are the result.
7279 .It Ql 211
7280 Status ok; the rest of the line is optionally used for more status.
7281 What follows are lines of result addresses, terminated by an empty line.
7282 The address lines consist of two fields, the first of which is the
7283 plain address, e.g.,
7284 .Ql bob@exam.ple ,
7285 separated by a single ASCII SP space from the second which contains the
7286 unstripped address, even if that is identical to the first field, e.g.,
7287 .Ql (Lovely) Bob <bob@exam.ple> .
7288 All the input, including the empty line, must be consumed before further
7289 commands can be issued.
7291 .It Ql 212
7292 Status ok; the rest of the line is optionally used for more status.
7293 What follows are lines of furtherly unspecified string content,
7294 terminated by an empty line.
7295 All the input, including the empty line, must be consumed before further
7296 commands can be issued.
7298 .It Ql 500
7299 Syntax error; invalid command.
7301 .It Ql 501
7302 Syntax error in parameters or arguments.
7304 .It Ql 505
7305 Error: an argument fails verification.
7306 For example an invalid address has been specified, or an attempt was
7307 made to modify anything in \*(UA's own namespace.
7309 .It Ql 506
7310 Error: an otherwise valid argument is rendered invalid due to context.
7311 For example, a second address is added to a header which may consist of
7312 a single address only.
7317 If a command indicates failure then the message will have remained
7318 unmodified.
7319 Most commands can fail with
7320 .Ql 500
7321 if required arguments are missing (false command usage).
7322 The following (case-insensitive) commands are supported:
7325 .Bl -hang -width ".It Cm header"
7326 .It Cm header
7327 This command allows listing, inspection, and editing of message headers.
7328 Header name case is not normalized, and case-insensitive comparison
7329 should be used when matching names.
7330 The second argument specifies the subcommand to apply, one of:
7332 .Bl -hang -width ".It Cm remove"
7333 .It Cm list
7334 Without a third argument a list of all yet existing headers is given via
7335 .Ql 210 ;
7336 this command is the default command of
7337 .Cm header
7338 if no second argument has been given.
7339 A third argument restricts output to the given header only, which may
7340 fail with
7341 .Ql 501
7342 if no such field is defined.
7344 .It Cm show
7345 Shows the content of the header given as the third argument.
7346 Dependent on the header type this may respond with
7347 .Ql 211
7349 .Ql 212 ;
7350 any failure results in
7351 .Ql 501 .
7353 .It Cm remove
7354 This will remove all instances of the header given as the third
7355 argument, reporting
7356 .Ql 210
7357 upon success,
7358 .Ql 501
7359 if no such header can be found, and
7360 Ql 505
7361 on \*(UA namespace violations.
7363 .It Cm remove-at
7364 This will remove from the header given as the third argument the
7365 instance at the list position (counting from one!) given with the fourth
7366 argument, reporting
7367 .Ql 210
7368 upon success or
7369 .Ql 505
7370 if the list position argument is not a number or on \*(UA namespace
7371 violations, and
7372 .Ql 501
7373 if no such header instance exists.
7375 .It Cm insert
7376 Create a new or an additional instance of the header given in the third
7377 argument, with the header body content as given in the fourth argument
7378 (the remains of the line).
7379 It may return
7380 .Ql 501
7381 if the third argument specifies a free-form header field name that is
7382 invalid, or if body content extraction fails to succeed,
7383 .Ql 505
7384 if any extracted address does not pass syntax and/or security checks or
7385 on \*(UA namespace violations, and
7386 .Ql 506
7387 to indicate prevention of excessing a single-instance header \(em note that
7388 .Ql Subject:
7389 can be appended to (a space separator will be added automatically first).
7391 .Ql 210
7392 is returned upon success, followed by the name of the header and the list
7393 position of the newly inserted instance.
7394 The list position is always 1 for single-instance header fields.
7395 All free-form header fields are managed in a single list.
7399 .It Cm attachment
7400 This command allows listing, removal and addition of message attachments.
7401 The second argument specifies the subcommand to apply, one of:
7403 .Bl -hang -width ".It Cm remove"
7404 .It Cm list
7405 List all attachments via
7406 .Ql 212 ,
7407 or report
7408 .Ql 501
7409 if no attachments exist.
7410 This command is the default command of
7411 .Cm attachment
7412 if no second argument has been given.
7414 .It Cm remove
7415 This will remove the attachment given as the third argument, and report
7416 .Ql 210
7417 upon success or
7418 .Ql 501
7419 if no such attachment can be found.
7420 If there exists any path component in the given argument, then an exact
7421 match of the path which has been used to create the attachment is used
7422 directly, but if only the basename of that path matches then all
7423 attachments are traversed to find an exact match first, and the removal
7424 occurs afterwards; if multiple basenames match, a
7425 .Ql 506
7426 error occurs.
7427 Message attachments are treated as absolute pathnames.
7429 If no path component exists in the given argument, then all attachments
7430 will be searched for
7431 .Ql filename=
7432 parameter matches as well as for matches of the basename of the path
7433 which has been used when the attachment has been created; multiple
7434 matches result in a
7435 .Ql 506 .
7437 .It Cm remove-at
7438 This will interpret the third argument as a number and remove the
7439 attachment at that list position (counting from one!), reporting
7440 .Ql 210
7441 upon success or
7442 .Ql 505
7443 if the argument is not a number or
7444 .Ql 501
7445 if no such attachment exists.
7447 .It Cm insert
7448 Adds the attachment given as the third argument, specified exactly as
7449 documented for the command line option
7450 .Fl a ,
7451 and supporting the message number extension as documented for
7452 .Ic ~@ .
7453 This reports
7454 .Ql 210
7455 upon success, with the index of the new attachment following,
7456 .Ql 505
7457 if the given file cannot be opened,
7458 .Ql 506
7459 if an on-the-fly performed character set conversion fails, otherwise
7460 .Ql 501
7461 is reported; this is also reported if character set conversion is
7462 requested but not available.
7464 .It Cm attribute
7465 This uses the same search mechanism as described for
7466 .Cm remove
7467 and prints any known attributes of the first found attachment via
7468 .Ql 212
7469 upon success or
7470 .Ql 501
7471 if no such attachment can be found.
7472 The attributes are written as lines of keyword and value tuples, the
7473 keyword being separated from the rest of the line with an ASCII SP space
7474 character.
7476 .It Cm attribute-at
7477 This uses the same search mechanism as described for
7478 .Cm remove-at
7479 and is otherwise identical to
7480 .Cm attribute .
7482 .It Cm attribute-set
7483 This uses the same search mechanism as described for
7484 .Cm remove ,
7485 and will assign the attribute given as the fourth argument, which is
7486 expected to be a value tuple of keyword and other data, separated by
7487 a ASCII SP space or TAB tabulator character.
7488 If the value part is empty, then the given attribute is removed, or
7489 reset to a default value if existence of the attribute is crucial.
7491 It returns via
7492 .Ql 210
7493 upon success, with the index of the found attachment following,
7494 .Ql 505
7495 for message attachments or if the given keyword is invalid, and
7496 .Ql 501
7497 if no such attachment can be found.
7498 The following keywords may be used (case-insensitively):
7500 .Bl -hang -compact -width ".It Ql filename"
7501 .It Ql filename
7502 Sets the filename of the MIME part, i.e., the name that is used for
7503 display and when (suggesting a name for) saving (purposes).
7504 .It Ql content-description
7505 Associate some descriptive information to the attachment's content, used
7506 in favour of the plain filename by some MUAs.
7507 .It Ql content-id
7508 May be used for uniquely identifying MIME entities in several contexts;
7509 this expects a special reference address format as defined in RFC 2045
7510 and generates a
7511 .Ql 505
7512 upon address content verification failure.
7513 .It Ql content-type
7514 Defines the media type/subtype of the part, which is managed
7515 automatically, but can be overwritten.
7516 .It Ql content-disposition
7517 Automatically set to the string
7518 .Ql attachment .
7521 .It Cm attribute-set-at
7522 This uses the same search mechanism as described for
7523 .Cm remove-at
7524 and is otherwise identical to
7525 .Cm attribute-set .
7531 .It Ic ~A
7532 The same as
7533 .Ql Ic ~i Ns \| Va Sign .
7536 .It Ic ~a
7537 The same as
7538 .Ql Ic ~i Ns \| Va sign .
7541 .It Ic ~b Ar name ...
7542 Add the given names to the list of blind carbon copy recipients.
7545 .It Ic ~c Ar name ...
7546 Add the given names to the list of carbon copy recipients.
7549 .It Ic ~d
7550 Read the file specified by the
7551 .Ev DEAD
7552 variable into the message.
7555 .It Ic ~e
7556 Invoke the text editor on the message collected so far.
7557 After the editing session is finished,
7558 the user may continue appending text to the message.
7561 .It Ic ~F Ar messages
7562 Read the named messages into the message being sent, including all
7563 message headers and MIME parts.
7564 If no messages are specified, read in the current message, the
7565 .Dq dot .
7568 .It Ic ~f Ar messages
7569 Read the named messages into the message being sent.
7570 If no messages are specified, read in the current message, the
7571 .Dq dot .
7572 Strips down the list of header fields according to the
7573 .Ql type
7574 white- and blacklist selection of
7575 .Ic headerpick .
7576 For MIME multipart messages,
7577 only the first displayable part is included.
7580 .It Ic ~H
7581 Edit the message header fields
7582 .Ql From: ,
7583 .Ql Reply-To:
7585 .Ql Sender:
7586 by typing each one in turn and allowing the user to edit the field.
7587 The default values for these fields originate from the
7588 .Va from , reply-to
7590 .Va sender
7591 variables.
7594 .It Ic ~h
7595 Edit the message header fields
7596 .Ql To: ,
7597 .Ql Cc: ,
7598 .Ql Bcc:
7600 .Ql Subject:
7601 by typing each one in turn and allowing the user to edit the field.
7604 .It Ic ~I Ar variable
7605 Insert the value of the specified variable into the message.
7606 The message remains unaltered if the variable is unset or empty.
7607 Any embedded character sequences
7608 .Ql \et
7609 horizontal tabulator and
7610 .Ql \en
7611 line feed are expanded in
7612 .Va posix
7613 mode; otherwise the expansion should occur at
7614 .Ic set
7615 time by using the command modifier
7616 .Va wysh .
7619 .It Ic ~i Ar variable
7620 Insert the value of the specified variable followed by a newline
7621 character into the message.
7622 The message remains unaltered if the variable is unset or empty.
7623 Any embedded character sequences
7624 .Ql \et
7625 horizontal tabulator and
7626 .Ql \en
7627 line feed are expanded in
7628 .Va posix
7629 mode; otherwise the expansion should occur at
7630 .Ic set
7631 time by using the command modifier
7632 .Va wysh .
7635 .It Ic ~M Ar messages
7636 Read the named messages into the message being sent,
7637 indented by
7638 .Va indentprefix .
7639 If no messages are specified, read the current message, the
7640 .Dq dot .
7643 .It Ic ~m Ar messages
7644 Read the named messages into the message being sent,
7645 indented by
7646 .Va indentprefix .
7647 If no messages are specified, read the current message, the
7648 .Dq dot .
7649 Strips down the list of header fields according to the
7650 .Ql type
7651 white- and blacklist selection of
7652 .Ic headerpick .
7653 For MIME multipart messages,
7654 only the first displayable part is included.
7657 .It Ic ~p
7658 Display the message collected so far,
7659 prefaced by the message header fields
7660 and followed by the attachment list, if any.
7663 .It Ic ~q
7664 Abort the message being sent,
7665 copying it to the file specified by the
7666 .Ev DEAD
7667 variable if
7668 .Va save
7669 is set.
7672 .It Ic ~R Ar filename
7673 Identical to
7674 .Ic ~r ,
7675 but indent each line that has been read by
7676 .Va indentprefix .
7679 .It Ic ~r Ar filename Op Ar HERE-delimiter
7680 Read the named file, object to the usual
7681 .Sx "Filename transformations" ,
7682 into the message; if (the expanded)
7683 .Ar filename
7684 is the hyphen-minus
7685 .Ql -
7686 then standard input is used, e.g., for pasting purposes.
7687 Only in this latter mode
7688 .Ar HERE-delimiter
7689 may be given: if it is data will be read in until the given
7690 .Ar HERE-delimiter
7691 is seen on a line by itself, and encountering EOF is an error; the
7692 .Ar HERE-delimiter
7693 is a required argument in non-interactive mode; if it is single-quote
7694 quoted then the pasted content will not be expanded, \*(ID otherwise
7695 a future version of \*(UA may perform shell-style expansion on the content.
7698 .It Ic ~s Ar string
7699 Cause the named string to become the current subject field.
7700 Newline (NL) and carriage-return (CR) bytes are invalid and will be
7701 normalized to space (SP) characters.
7704 .It Ic ~t Ar name ...
7705 Add the given name(s) to the direct recipient list.
7708 .It Ic ~U Ar messages
7709 Read in the given / current message(s) excluding all headers, indented by
7710 .Va indentprefix .
7713 .It Ic ~u Ar messages
7714 Read in the given / current message(s), excluding all headers.
7717 .It Ic ~v
7718 Invoke an alternate editor (defined by the
7719 .Ev VISUAL
7720 environment variable) on the message collected so far.
7721 Usually, the alternate editor will be a screen editor.
7722 After the editor is quit,
7723 the user may resume appending text to the end of the message.
7726 .It Ic ~w Ar filename
7727 Write the message onto the named file, which is object to the usual
7728 .Sx "Filename transformations" .
7729 If the file exists,
7730 the message is appended to it.
7733 .It Ic ~x
7734 Same as
7735 .Ic ~q ,
7736 except that the message is not saved at all.
7739 .\" }}}
7742 .\" .Sh INTERNAL VARIABLES {{{
7743 .Sh "INTERNAL VARIABLES"
7745 Internal \*(UA variables are controlled via the
7746 .Ic set
7748 .Ic unset
7749 commands; prefixing a variable name with the string
7750 .Ql no
7751 and calling
7752 .Ic set
7753 has the same effect as using
7754 .Ic unset :
7755 .Ql unset crt
7757 .Ql set nocrt
7758 do the same thing.
7759 Creation or editing of variables can be performed in the
7760 .Ev EDITOR
7761 with the command
7762 .Ic varedit .
7763 .Ic varshow
7764 will give more insight on the given variable(s), and
7765 .Ic set ,
7766 when called without arguments, will show a listing of all variables.
7767 Both commands support a more
7768 .Va verbose
7769 listing mode.
7770 Some well-known variables will also become inherited from the
7771 program
7772 .Sx ENVIRONMENT
7773 implicitly, others can be imported explicitly with the command
7774 .Ic environ
7775 and henceforth share said properties.
7778 Two different kinds of internal variables exist.
7779 There are boolean variables, which can only be in one of the two states
7780 .Dq set
7782 .Dq unset ,
7783 and value variables with a(n optional) string value.
7784 For the latter proper quoting is necessary upon assignment time, the
7785 introduction of the section
7786 .Sx COMMANDS
7787 documents the supported quoting rules.
7789 .Bd -literal -offset indent
7790 ? wysh set one=val\e 1 two="val 2" \e
7791     three='val "3"' four=$'val \e'4\e''; \e
7792     varshow one two three four; \e
7793     unset one two three four
7797 Dependent upon the actual option the string values will be interpreted
7798 as numbers, colour names, normal text etc., but there also exists
7799 a special kind of string value, the
7800 .Dq boolean string ,
7801 which must either be a decimal integer (in which case
7802 .Ql 0
7803 is false and
7804 .Ql 1
7805 and any other value is true) or any of the (case-insensitive) strings
7806 .Ql off ,
7807 .Ql no ,
7808 .Ql n
7810 .Ql false
7811 for a false boolean and
7812 .Ql on ,
7813 .Ql yes ,
7814 .Ql y
7816 .Ql true
7817 for a true boolean; a special kind of boolean string is the
7818 .Dq quadoption ,
7819 which is a boolean string that can optionally be prefixed with the
7820 (case-insensitive) term
7821 .Ql ask- ,
7822 as in
7823 .Ql ask-yes ,
7824 which causes prompting of the user in interactive mode, with the given
7825 boolean as the default value.
7827 .\" .Ss "Initial settings" {{{
7828 .\" (Keep in SYNC: ./nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings")
7829 .Ss "Initial settings"
7831 The standard POSIX 2008/Cor 2-2016 mandates the following initial
7832 variable settings:
7833 .Pf no Va allnet ,
7834 .Pf no Va append ,
7835 .Va asksub ,
7836 .Pf no Va askbcc ,
7837 .Pf no Va autoprint ,
7838 .Pf no Va bang ,
7839 .Pf no Va cmd ,
7840 .Pf no Va crt ,
7841 .Pf no Va debug ,
7842 .Pf no Va dot ,
7843 .Va escape
7844 set to
7845 .Ql ~ ,
7846 .Pf no Va flipr ,
7847 .Pf no Va folder ,
7848 .Va header ,
7849 .Pf no Va hold ,
7850 .Pf no Va ignore ,
7851 .Pf no Va ignoreeof ,
7852 .Pf no Va keep ,
7853 .Pf no Va keepsave ,
7854 .Pf no Va metoo ,
7855 .Pf no Va outfolder ,
7856 .Pf no Va page ,
7857 .Va prompt
7858 set to
7859 .Ql ?\0 ,
7860 .Pf no Va quiet ,
7861 .Pf no Va record ,
7862 .Va save ,
7863 .Pf no Va sendwait ,
7864 .Pf no Va showto ,
7865 .Pf no Va Sign ,
7866 .Pf no Va sign ,
7867 .Va toplines
7868 set to
7869 .Ql 5 .
7872 Notes: \*(UA does not support the
7873 .Pf no Va onehop
7874 variable \(en use command line options or
7875 .Va mta-arguments
7876 to pass options through to a
7877 .Va mta .
7878 And the default global
7879 .Pa \*(UR
7880 file, which is loaded unless the
7881 .Fl \&:
7882 (with according argument) or
7883 .Fl n
7884 command line options have been used, or the
7885 .Ev MAILX_NO_SYSTEM_RC
7886 environment variable is set (see
7887 .Sx "Resource files" )
7888 bends those initial settings a bit, e.g., it sets the variables
7889 .Va hold ,
7890 .Va keepsave
7892 .Va keep ,
7893 to name a few, establishes a default
7894 .Ic headerpick
7895 selection etc., and should thus be taken into account.
7896 .\" }}}
7898 .\" .Ss "Variables" {{{
7899 .Ss "Variables"
7901 .Bl -tag -width ".It Va BaNg"
7904 .It Va \&?
7905 \*(RO The exit status of the last command, or the
7906 .Ic return
7907 value of the macro
7908 .Ic call Ns
7909 ed last.
7910 This status has a meaning in the state machine: in conjunction with
7911 .Va errexit
7912 any non-0 exit status will cause a program exit, and in
7913 .Ev POSIXLY_CORRECT
7914 mode any error while loading (any of the) resource files will have the
7915 same effect.
7916 .Cm ignerr ,
7917 one of the
7918 .Sx "Command modifiers" ,
7919 can be used to instruct the state machine to ignore errors.
7922 .It Va \&!
7923 \*(RO The current error number
7924 .Pf ( Xr errno 3 ) ,
7925 which is set after an error occurred; it is also available via
7926 .Va ^ERR ,
7927 and the error name and documentation string can be queried via
7928 .Va ^ERRNAME
7930 .Va ^ERRDOC .
7931 \*(ID This machinery is new and the error number is only really usable
7932 if a command explicitly states that it manages the variable
7933 .Va \&! ,
7934 for others errno will be used in case of errors, or
7935 .Va ^ERR Ns -INVAL
7936 if that is 0: it thus may or may not reflect the real error.
7937 The error number may be set with the command
7938 .Ic return .
7942 .It Va ^
7943 \*(RO This is a multiplexer variable which performs dynamic expansion of
7944 the requested state or condition, of which there are:
7947 .Bl -tag -compact -width ".It Va BaNg"
7951 .It Va ^ERR , ^ERRDOC , ^ERRNAME
7952 The number, documentation, and name of the current
7953 .Xr errno 3 ,
7954 respectively, which is usually set after an error occurred.
7955 \*(ID This machinery is new and is usually reliable only if a command
7956 explicitly states that it manages the variable
7957 .Va \&! ,
7958 which is effectively identical to
7959 .Va \&\&^ERR .
7960 Each of those variables can be suffixed with a hyphen minus followed by
7961 a name or number, in which case the expansion refers to the given error.
7962 Note this is a direct mapping of (a subset of) the system error values:
7963 .Bd -literal -offset indent
7964 define work {
7965   eval echo \e$1: \e$^ERR-$1: \e$^ERRNAME-$1: \e$^ERRDOC-$1
7966   vput vexpr i + "$1" 1
7967   if [ $i -lt 16 ]
7968     \excall work $i
7969   end
7971 call work 0
7977 .It Va *
7978 \*(RO Expands all positional parameters (see
7979 .Va 1 ) ,
7980 separated by a space character.
7981 \*(ID The special semantics of the equally named special parameter of the
7982 .Xr sh 1
7983 are not yet supported.
7986 .It Va @
7987 \*(RO Expands all positional parameters (see
7988 .Va 1 ) ,
7989 separated by a space character.
7990 If placed in double quotation marks, each positional parameter is
7991 properly quoted to expand to a single parameter again.
7994 .It Va #
7995 \*(RO Expands to the number of positional parameters, i.e., the size of
7996 the positional parameter stack in decimal.
7999 .It Va \&0
8000 \*(RO Inside the scope of a
8001 .Ic define Ns
8002 d and
8003 .Ic call Ns
8004 ed macro this expands to the name of the calling macro, or to the empty
8005 string if the macro is running from top-level.
8006 For the \*(OPal regular expression search and replace operator of
8007 .Ic vexpr
8008 this expands to the entire matching expression.
8009 It represents the program name in global context.
8012 .It Va 1
8013 \*(RO Access of the positional parameter stack.
8014 All further parameters can be accessed with this syntax, too, e.g.,
8015 .Ql 2 ,
8016 .Ql 3
8017 etc.; positional parameters can be shifted off the stack by calling
8018 .Ic shift .
8019 The parameter stack contains, e.g., the arguments of a
8020 .Ic call Ns
8022 .Ic define Ns
8023 d macro, the matching groups of the \*(OPal regular expression search
8024 and replace expression of
8025 .Ic vexpr ,
8026 and can be explicitly created or overwritten with the command
8027 .Ic vpospar .
8030 .It Va account
8031 \*(RO Is set to the active
8032 .Ic account .
8035 .It Va add-file-recipients
8036 \*(BO When file or pipe recipients have been specified,
8037 mention them in the corresponding address fields of the message instead
8038 of silently stripping them from their recipient list.
8039 By default such addressees are not mentioned.
8042 .It Va allnet
8043 \*(BO Causes only the local part to be evaluated
8044 when comparing addresses.
8047 .It Va append
8048 \*(BO Causes messages saved in the
8049 .Mx -sx
8050 .Sx "secondary mailbox"
8051 .Ev MBOX
8052 to be appended to the end rather than prepended.
8053 This should always be set.
8056 .It Va ask
8057 \*(BO Causes \*(UA to prompt for the subject upon entering compose mode
8058 unless a subject already exists.
8061 .It Va askatend
8062 \*(BO Causes the prompts for
8063 .Ql Cc:
8065 .Ql Bcc:
8066 lists to appear after the message has been edited.
8069 .It Va askattach
8070 \*(BO If set, \*(UA asks for files to attach at the end of each message.
8071 An empty line finalizes the list.
8074 .It Va askcc
8075 \*(BO Causes the user to be prompted for carbon copy recipients
8076 (at the end of each message if
8077 .Va askatend
8079 .Va bsdcompat
8080 are set).
8083 .It Va askbcc
8084 \*(BO Causes the user to be prompted for blind carbon copy
8085 recipients (at the end of each message if
8086 .Va askatend
8088 .Va bsdcompat
8089 are set).
8092 .It Va asksign
8093 \*(BO\*(OP Causes the user to be prompted if the message is to be
8094 signed at the end of each message.
8096 .Va smime-sign
8097 variable is ignored when this variable is set.
8100 .It Va asksub
8101 \*(BO Alternative name for
8102 .Va ask .
8105 .It Va attrlist
8106 A sequence of characters to display in the
8107 .Ql attribute
8108 column of the
8109 .Va headline
8110 as shown in the display of
8111 .Ic headers ;
8112 each for one type of messages (see
8113 .Sx "Message states" ) ,
8114 with the default being
8115 .Ql NUROSPMFAT+\-$~
8117 .Ql NU\ \ *HMFAT+\-$~
8118 if the
8119 .Va bsdflags
8120 variable is set, in the following order:
8122 .Bl -tag -compact -width ".It Ql _"
8123 .It Ql N
8124 new.
8125 .It Ql U
8126 unread but old.
8127 .It Ql R
8128 new but read.
8129 .It Ql O
8130 read and old.
8131 .It Ql S
8132 saved.
8133 .It Ql P
8134 preserved.
8135 .It Ql M
8136 mboxed.
8137 .It Ql F
8138 flagged.
8139 .It Ql A
8140 answered.
8141 .It Ql T
8142 draft.
8143 .It Ql +
8144 start of a collapsed thread.
8145 .It Ql -
8146 an uncollapsed thread (TODO ignored for now).
8147 .It Ql $
8148 classified as spam.
8149 .It Ql ~
8150 classified as possible spam.
8155 .It Va autobcc
8156 Specifies a list of recipients to which a blind carbon copy of each
8157 outgoing message will be sent automatically.
8160 .It Va autocc
8161 Specifies a list of recipients to which a carbon copy of each outgoing
8162 message will be sent automatically.
8165 .It Va autocollapse
8166 \*(BO Causes threads to be collapsed automatically when threaded mode
8167 is entered (see the
8168 .Ic collapse
8169 command).
8172 .It Va autoprint
8173 \*(BO Enable automatic
8174 .Ic type Ns
8175 ing of a(n existing)
8176 .Dq successive
8177 message after
8178 .Ic delete
8180 .Ic undelete
8181 commands, e.g., the message that becomes the new
8182 .Dq dot
8183 is shown automatically, as via
8184 .Ic dp
8186 .Ic dt .
8189 .It Va autosort
8190 Causes sorted mode (see the
8191 .Ic sort
8192 command) to be entered automatically with the value of this variable as
8193 sorting method when a folder is opened, e.g.,
8194 .Ql set autosort=thread .
8197 .It Va bang
8198 \*(BO Enables the substitution of all not (reverse-solidus) escaped
8199 exclamation mark
8200 .Ql \&!
8201 characters by the contents of the last executed command for the
8202 .Ic \&!
8203 shell escape command and
8204 .Ic ~! ,
8205 one of the compose mode
8206 .Sx "COMMAND ESCAPES" .
8207 If this variable is not set no reverse solidus stripping is performed.
8210 .It Va bind-timeout
8211 \*(OP Terminals generate multi-byte sequences for certain forms of
8212 input, for example for function and other special keys.
8213 Some terminals however do not write these multi-byte sequences as
8214 a whole, but byte-by-byte, and the latter is what \*(UA actually reads.
8215 This variable specifies the timeout in milliseconds that the MLE (see
8216 .Sx "On terminal control and line editor" )
8217 waits for more bytes to arrive unless it considers a sequence
8218 .Dq complete .
8219 The default is 200.
8222 .It Va bsdcompat
8223 \*(BO Sets some cosmetical features to traditional BSD style;
8224 has the same affect as setting
8225 .Va askatend
8226 and all other variables prefixed with
8227 .Ql bsd ;
8228 it also changes the behaviour of
8229 .Va emptystart
8230 (which does not exist in BSD).
8233 .It Va bsdflags
8234 \*(BO Changes the letters shown in the first column of a header
8235 summary to traditional BSD style.
8238 .It Va bsdheadline
8239 \*(BO Changes the display of columns in a header summary to traditional
8240 BSD style.
8243 .It Va bsdmsgs
8244 \*(BO Changes some informational messages to traditional BSD style.
8247 .It Va bsdorder
8248 \*(BO Causes the
8249 .Ql Subject:
8250 field to appear immediately after the
8251 .Ql To:
8252 field in message headers and with the
8253 .Ic ~h
8254 .Sx "COMMAND ESCAPES" .
8258 .It Va build-os , build-osenv
8259 \*(RO The operating system \*(UA has been build for, usually taken from
8260 .Xr uname 1
8262 .Ql uname -s
8264 .Ql uname -srm ,
8265 respectively, the former being lowercased.
8268 .It Va charset-7bit
8269 The value that should appear in the
8270 .Ql charset=
8271 parameter of
8272 .Ql Content-Type:
8273 MIME header fields when no character set conversion of the message data
8274 was performed.
8275 This defaults to US-ASCII, and the chosen character set should be
8276 US-ASCII compatible.
8279 .It Va charset-8bit
8280 \*(OP The default 8-bit character set that is used as an implicit last
8281 member of the variable
8282 .Va sendcharsets .
8283 This defaults to UTF-8 if character set conversion capabilities are
8284 available, and to ISO-8859-1 otherwise, in which case the only supported
8285 character set is
8286 .Va ttycharset
8287 and this variable is effectively ignored.
8288 Refer to the section
8289 .Sx "Character sets"
8290 for the complete picture of character set conversion in \*(UA.
8293 .It Va charset-unknown-8bit
8294 \*(OP RFC 1428 specifies conditions when internet mail gateways shall
8295 .Dq upgrade
8296 the content of a mail message by using a character set with the name
8297 .Ql unknown-8bit .
8298 Because of the unclassified nature of this character set \*(UA will not
8299 be capable to convert this character set to any other character set.
8300 If this variable is set any message part which uses the character set
8301 .Ql unknown-8bit
8302 is assumed to really be in the character set given in the value,
8303 otherwise the (final) value of
8304 .Va charset-8bit
8305 is used for this purpose.
8307 This variable will also be taken into account if a MIME type (see
8308 .Sx "The mime.types files" )
8309 of a MIME message part that uses the
8310 .Ql binary
8311 character set is forcefully treated as text.
8314 .It Va cmd
8315 The default value for the
8316 .Ic pipe
8317 command.
8320 .It Va colour-disable
8321 \*(BO\*(OP Forcefully disable usage of colours.
8322 Also see the section
8323 .Sx "Coloured display" .
8326 .It Va colour-pager
8327 \*(BO\*(OP Whether colour shall be used for output that is paged through
8328 .Ev PAGER .
8329 Note that pagers may need special command line options, e.g.,
8330 .Xr less 1
8331 requires the option
8332 .Fl \&\&R
8334 .Xr lv 1
8335 the option
8336 .Fl \&\&c
8337 in order to support colours.
8338 Often doing manual adjustments is unnecessary since \*(UA may perform
8339 adjustments dependent on the value of the environment variable
8340 .Ev PAGER
8341 (see there for more).
8345 .It Va contact-mail , contact-web
8346 \*(RO Addresses for contact per email and web, respectively, e.g., for
8347 bug reports, suggestions, or help regarding \*(UA.
8348 The former can be used directly:
8349 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
8352 .It Va crt
8353 In a(n interactive) terminal session, then if this valued variable is
8354 set it will be used as a threshold to determine how many lines the given
8355 output has to span before it will be displayed via the configured
8356 .Ev PAGER ;
8357 Usage of the
8358 .Ev PAGER
8359 can be forced by setting this to the value
8360 .Ql 0 ,
8361 setting it without a value will deduce the current height of the
8362 terminal screen to compute the treshold (see
8363 .Ev LINES ,
8364 .Va screen
8366 .Xr stty 1 ) .
8367 \*(ID At the moment this uses the count of lines of the message in wire
8368 format, which, dependent on the
8369 .Va mime-encoding
8370 of the message, is unrelated to the number of display lines.
8371 (The software is old and historically the relation was a given thing.)
8374 .It Va customhdr
8375 Define a set of custom headers to be injected into newly composed or
8376 forwarded messages; it is also possible to create custom headers in
8377 compose mode with
8378 .Ic ~^ ,
8379 which can be automated by setting one of the hooks
8380 .Va on-compose-splice
8382 .Va on-compose-splice-shell .
8383 The value is interpreted as a comma-separated list of custom headers to
8384 be injected, to include commas in the header bodies escape them with
8385 reverse solidus.
8386 \*(ID Overwriting of automatically managed headers is neither supported
8387 nor prevented.
8389 .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2,  Hdr2: Body2'
8392 .It Va datefield
8393 Controls the appearance of the
8394 .Ql %d
8395 date and time format specification of the
8396 .Va headline
8397 variable, that is used, for example, when viewing the summary of
8398 .Ic headers .
8399 If unset, then the local receiving date is used and displayed
8400 unformatted, otherwise the message sending
8401 .Ql Date: .
8402 It is possible to assign a
8403 .Xr strftime 3
8404 format string and control formatting, but embedding newlines via the
8405 .Ql %n
8406 format is not supported, and will result in display errors.
8407 The default is
8408 .Ql %Y-%m-%d %H:%M ,
8409 and also see
8410 .Va datefield-markout-older .
8413 .It Va datefield-markout-older
8414 Only used in conjunction with
8415 .Va datefield .
8416 Can be used to create a visible distinction of messages dated more than
8417 a day in the future, or older than six months, a concept comparable to the
8418 .Fl \&\&l
8419 option of the POSIX utility
8420 .Xr ls 1 .
8421 If set to the empty string, then the plain month, day and year of the
8422 .Ql Date:
8423 will be displayed, but a
8424 .Xr strftime 3
8425 format string to control formatting can be assigned.
8426 The default is
8427 .Ql %Y-%m-%d .
8430 .It Va debug
8431 \*(BO Enables debug messages and obsoletion warnings, disables the
8432 actual delivery of messages and also implies
8433 .Pf no Va record
8434 as well as
8435 .Pf no Va save .
8438 .It Va disposition-notification-send
8439 \*(BO\*(OP Emit a
8440 .Ql Disposition-Notification-To:
8441 header (RFC 3798) with the message.
8442 This requires the
8443 .Va from
8444 variable to be set.
8445 .\" TODO .It Va disposition-notification-send-HOST
8446 .\"Overrides
8447 .\".Va disposition-notification-send
8448 .\" for SMTP accounts on a specific host.
8449 .\" TODO .It Va disposition-notification-send-USER@HOST
8450 .\"Overrides
8451 .\".Va disposition-notification-send
8452 .\"for a specific account.
8455 .It Va dot
8456 \*(BO When dot is set, a period
8457 .Ql \&.
8458 on a line by itself during message input in (interactive or batch
8459 .Fl # )
8460 compose mode will be treated as end-of-message (in addition to the
8461 normal end-of-file condition).
8462 This behaviour is implied in
8463 .Va posix
8464 mode with a set
8465 .Va ignoreeof .
8468 .It Va dotlock-ignore-error
8469 \*(BO\*(OP Synchronization of mailboxes which \*(UA treats as
8470 .Mx -sx
8471 .Sx "primary system mailbox" Ns
8472 es (see, e.g., the notes on
8473 .Sx "Filename transformations" ,
8474 as well as the documentation of
8475 .Ic file )
8476 will be protected with so-called dotlock files\(emthe traditional mail
8477 spool file locking method\(emin addition to system file locking.
8478 Because \*(UA ships with a privilege-separated dotlock creation program
8479 that should always be able to create such a dotlock file there is no
8480 good reason to ignore dotlock file creation errors, and thus these are
8481 fatal unless this variable is set.
8484 .It Va editalong
8485 \*(BO If this variable is set then the editor is started automatically
8486 when a message is composed in interactive mode, as if the
8487 .Ic ~e
8488 .Sx "COMMAND ESCAPES"
8489 had been specified.
8491 .Va editheaders
8492 variable is implied for this automatically spawned editor session.
8495 .It Va editheaders
8496 \*(BO When a message is edited while being composed,
8497 its header is included in the editable text.
8500 .It Va emptystart
8501 \*(BO When entering interactive mode \*(UA normally writes
8502 .Dq \&No mail for user
8503 and exits immediately if a mailbox is empty or does not exist.
8504 If this variable is set \*(UA starts even with an empty or non-existent
8505 mailbox (the latter behaviour furtherly depends upon
8506 .Va bsdcompat ,
8507 though).
8510 .It Va errexit
8511 \*(BO Let each command with a non-0 exit status, including every
8512 .Ic call Ns
8513 ed macro which
8514 .Ic return Ns
8515 s a non-0 status, cause a program exit unless prefixed by
8516 .Cm ignerr
8517 (see
8518 .Sx "Command modifiers" ) .
8519 This also affects
8520 .Sx "COMMAND ESCAPES" ,
8521 but which use a different modifier for ignoring the error.
8522 Please refer to the variable
8523 .Va \&?
8524 for more on this topic.
8527 .It Va escape
8528 The first character of this value defines the escape character for
8529 .Sx "COMMAND ESCAPES"
8530 in compose mode.
8531 The default value is the character tilde
8532 .Ql ~ .
8533 If set to the empty string, command escapes are disabled.
8536 .It Va expandaddr
8537 If not set then file and command pipeline targets are not allowed,
8538 and any such address will be filtered out, giving a warning message.
8539 If set without a value then all possible recipient address
8540 specifications will be accepted \(en see the section
8541 .Sx "On sending mail, and non-interactive mode"
8542 for more on this.
8543 To accept them, but only in interactive mode, or when tilde commands
8544 were enabled explicitly by using one of the command line options
8545 .Fl ~
8547 .Fl # ,
8548 set this to the (case-insensitive) value
8549 .Ql restrict
8550 (it actually acts like
8551 .Ql restrict,-all,+name,+addr ,
8552 so that care for ordering issues must be taken) .
8554 In fact the value is interpreted as a comma-separated list of values.
8555 If it contains
8556 .Ql fail
8557 then the existence of disallowed specifications is treated as a hard
8558 send error instead of only filtering them out.
8559 The remaining values specify whether a specific type of recipient
8560 address specification is allowed (optionally indicated by a plus sign
8561 .Ql +
8562 prefix) or disallowed (prefixed with a hyphen-minus
8563 .Ql - ) .
8564 The value
8565 .Ql all
8566 addresses all possible address specifications,
8567 .Ql file
8568 file targets,
8569 .Ql pipe
8570 command pipeline targets,
8571 .Ql name
8572 plain user names and (MTA) aliases and
8573 .Ql addr
8574 network addresses.
8575 These kind of values are interpreted in the given order, so that
8576 .Ql restrict,\:fail,\:+file,\:-all,\:+addr
8577 will cause hard errors for any non-network address recipient address
8578 unless \*(UA is in interactive mode or has been started with the
8579 .Fl ~
8581 .Fl #
8582 command line option; in the latter case(s) any address may be used, then.
8584 Historically invalid network addressees are silently stripped off.
8585 To change this so that any encountered invalid email address causes
8586 a hard error it must be ensured that
8587 .Ql failinvaddr
8588 is an entry in the above list.
8589 Setting this automatically enables network addressees
8590 (it actually acts like
8591 .Ql failinvaddr,+addr ,
8592 so that care for ordering issues must be taken) .
8595 .It Va expandargv
8596 Unless this variable is set additional
8597 .Va mta
8598 (Mail-Transfer-Agent)
8599 arguments from the command line, as can be given after a
8600 .Fl \&\&-
8601 separator, are ignored due to safety reasons.
8602 However, if set to the special (case-insensitive) value
8603 .Ql fail ,
8604 then the presence of additional MTA arguments is treated as a hard
8605 error that causes \*(UA to exit with failure status.
8606 A lesser strict variant is the otherwise identical
8607 .Ql restrict ,
8608 which does accept such arguments in interactive mode, or if tilde
8609 commands were enabled explicitly by using one of the command line options
8610 .Fl ~
8612 .Fl # .
8615 .It Va features
8616 \*(RO String giving a list of features \*(UA, preceded with a plus sign
8617 .Ql +
8618 if the feature is available, and a hyphen-minus
8619 .Ql -
8620 otherwise.
8621 The output of the command
8622 .Ic version
8623 will include this information in a more pleasant output.
8626 .It Va flipr
8627 \*(BO This setting reverses the meanings of a set of reply commands,
8628 turning the lowercase variants, which by default address all recipients
8629 included in the header of a message
8630 .Pf ( Ic reply , respond , followup )
8631 into the uppercase variants, which by default address the sender only
8632 .Pf ( Ic Reply , Respond , Followup )
8633 and vice versa.
8634 The commands
8635 .Ic replysender , respondsender , followupsender
8636 as well as
8637 .Ic replyall , respondall , followupall
8638 are not affected by the current setting of
8639 .Va flipr .
8642 .It Va folder
8643 The default path under which mailboxes are to be saved:
8644 filenames that begin with the plus sign
8645 .Ql +
8646 will have the plus sign replaced with the value of this variable if set,
8647 otherwise the plus sign will remain unchanged when doing
8648 .Sx "Filename transformations" ;
8649 also see
8650 .Ic file
8651 for more on this topic.
8652 The value supports a subset of transformations itself, and if the
8653 non-empty value does not start with a solidus
8654 .Ql / ,
8655 then the value of
8656 .Ev HOME
8657 will be prefixed automatically.
8658 Once the actual value is evaluated first, the internal variable
8659 .Va folder-resolved
8660 will be updated for caching purposes.
8663 .It Va folder-hook
8664 This variable can be set to the name of a
8665 .Ic define Ns d
8666 macro which will be called whenever a
8667 .Ic file
8668 is opened.
8669 The macro will also be invoked when new mail arrives,
8670 but message lists for commands executed from the macro
8671 only include newly arrived messages then.
8672 .Ic localopts
8673 are activated by default in a folder hook, causing the covered settings
8674 to be reverted once the folder is left again.
8677 .It Va folder-hook-FOLDER
8678 Overrides
8679 .Va folder-hook
8680 for a folder named
8681 .Ql FOLDER .
8682 Unlike other folder specifications, the fully expanded name of a folder,
8683 without metacharacters, is used to avoid ambiguities.
8684 However, if the mailbox resides under
8685 .Va folder
8686 then the usual
8687 .Ql +
8688 specification is tried in addition, e.g., if
8689 .Va \&\&folder
8691 .Dq mail
8692 (and thus relative to the user's home directory) then
8693 .Pa /home/usr1/mail/sent
8694 will be tried as
8695 .Ql folder-hook-/home/usr1/mail/sent
8696 first, but then followed by
8697 .Ql folder-hook-+sent .
8700 .It Va folder-resolved
8701 \*(RO Set to the fully resolved path of
8702 .Va folder
8703 once that evaluation has occurred; rather internal.
8706 .It Va followup-to
8707 \*(BO Controls whether a
8708 .Ql Mail-Followup-To:
8709 header is generated when sending messages to known mailing lists.
8710 Also see
8711 .Va followup-to-honour
8712 and the commands
8713 .Ic mlist , mlsubscribe , reply
8715 .Ic Lreply .
8718 .It Va followup-to-honour
8719 Controls whether a
8720 .Ql Mail-Followup-To:
8721 header is honoured when group-replying to a message via
8722 .Ic reply
8724 .Ic Lreply .
8725 This is a quadoption; if set without a value it defaults to
8726 .Dq yes .
8727 Also see
8728 .Va followup-to
8729 and the commands
8730 .Ic mlist
8732 .Ic mlsubscribe .
8735 .It Va forward-as-attachment
8736 \*(BO Original messages are normally sent as inline text with the
8737 .Ic forward
8738 command,
8739 and only the first part of a multipart message is included.
8740 With this setting enabled messages are sent as unmodified MIME
8741 .Ql message/rfc822
8742 attachments with all of their parts included.
8745 .It Va forward-inject-head
8746 The string to put before the text of a message with the
8747 .Ic forward
8748 command instead of the default
8749 .Dq -------- Original Message -------- .
8750 No heading is put if it is set to the empty string.
8751 This variable is ignored if the
8752 .Va forward-as-attachment
8753 variable is set.
8756 .It Va from
8757 The address (or a list of addresses) to put into the
8758 .Ql From:
8759 field of the message header, quoting RFC 5322:
8760 the author(s) of the message, that is, the mailbox(es) of the person(s)
8761 or system(s) responsible for the writing of the message.
8762 When
8763 .Ic reply Ns
8764 ing to messages these addresses are handled as if they were in the
8765 .Ic alternates
8766 list.
8768 If the machine's hostname is not valid at the Internet (for example at
8769 a dialup machine) then either this variable or
8770 .Va hostname
8771 (\*(IN and with a defined SMTP protocol in
8772 .Va mta
8773 .Va smtp-hostname
8774 adds even more fine-tuning capabilities),
8775 have to be set.
8777 .Va \&\&from
8778 contains more than one address,
8779 setting the
8780 .Va sender
8781 variable is required (according to the standard RFC 5322).
8783 If a file-based MTA is used, then
8784 .Va from
8785 (or, if that contains multiple addresses,
8786 .Va sender )
8787 can nonetheless be enforced to appear as the envelope sender address at
8788 the MTA protocol level (the RFC 5321 reverse-path), either by using the
8789 .Fl r
8790 command line option (with an empty argument; see there for the complete
8791 picture on this topic), or by setting the internal variable
8792 .Va r-option-implicit .
8795 .It Va fullnames
8796 \*(BO When replying to or forwarding a message \*(UA normally removes
8797 the comment and name parts of email addresses.
8798 If this variable is set such stripping is not performed,
8799 and comments, names etc. are retained.
8801 .It Va fwdheading
8802 \*(OB Predecessor of
8803 .Va forward-inject-head .
8806 .It Va header
8807 \*(BO Causes the header summary to be written at startup and after
8808 commands that affect the number of messages or the order of messages in
8809 the current
8810 .Ic folder .
8811 Unless in
8812 .Ev POSIXLY_CORRECT
8813 mode a header summary will also be displayed on folder changes.
8814 The command line option
8815 .Fl N
8816 can be used to set
8817 .Pf no Va header .
8821 .It Va headline
8822 A format string to use for the summary of
8823 .Ic headers ,
8824 similar to the ones used for
8825 .Xr printf 3
8826 formats.
8827 Format specifiers in the given string start with a percent sign
8828 .Ql %
8829 and may be followed by an optional decimal number indicating the field
8830 width \(em if that is negative, the field is to be left-aligned.
8831 Valid format specifiers are:
8834 .Bl -tag -compact -width ".It Ql _%%_"
8835 .It Ql %%
8836 A plain percent sign.
8837 .It Ql %>
8838 .Dq Dotmark :
8839 a space character but for the current message
8840 .Pf ( Dq dot ) ,
8841 for which it expands to
8842 .Ql > .
8843 .It Ql %<
8844 .Dq Dotmark :
8845 a space character but for the current message
8846 .Pf ( Dq dot ) ,
8847 for which it expands to
8848 .Ql < .
8849 .It Ql %$
8850 \*(OP The spam score of the message, as has been classified via the
8851 command
8852 .Ic spamrate .
8853 Shows only a replacement character if there is no spam support.
8854 .It Ql %a
8855 Message attribute character (status flag); the actual content can be
8856 adjusted by setting
8857 .Va attrlist .
8858 .It Ql %d
8859 The date found in the
8860 .Ql From:
8861 header of the message when
8862 .Va datefield
8863 is set (the default), otherwise the date when the message was received.
8864 Formatting can be controlled by assigning a
8865 .Xr strftime 3
8866 format string to
8867 .Va datefield .
8868 .It Ql %e
8869 The indenting level in threaded mode.
8870 .It Ql %f
8871 The address of the message sender.
8872 .It Ql %i
8873 The message thread tree structure.
8874 (Note that this format does not support a field width.)
8875 .It Ql %l
8876 The number of lines of the message, if available.
8877 .It Ql %m
8878 Message number.
8879 .It Ql %o
8880 The number of octets (bytes) in the message, if available.
8881 .It Ql %s
8882 Message subject (if any).
8883 .It Ql %S
8884 Message subject (if any) in double quotes.
8885 .It Ql \&%T
8886 Message recipient flags: is the addressee of the message a known or
8887 subscribed mailing list \(en see
8888 .Ic mlist
8890 .Ic mlsubscribe .
8891 .It Ql %t
8892 The position in threaded/sorted order.
8895 The default is
8896 .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s ,
8898 .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S
8900 .Va bsdcompat
8901 is set.
8902 Also see
8903 .Va attrlist
8905 .Va headline-bidi .
8909 .It Va headline-bidi
8910 Bidirectional text requires special treatment when displaying headers,
8911 because numbers (in dates or for file sizes etc.) will not affect the
8912 current text direction, in effect resulting in ugly line layouts when
8913 arabic or other right-to-left text is to be displayed.
8914 On the other hand only a minority of terminals is capable to correctly
8915 handle direction changes, so that user interaction is necessary for
8916 acceptable results.
8917 Note that extended host system support is required nonetheless, e.g.,
8918 detection of the terminal character set is one precondition;
8919 and this feature only works in an Unicode (i.e., UTF-8) locale.
8921 In general setting this variable will cause \*(UA to encapsulate text
8922 fields that may occur when displaying
8923 .Va headline
8924 (and some other fields, like dynamic expansions in
8925 .Va prompt )
8926 with special Unicode control sequences;
8927 it is possible to fine-tune the terminal support level by assigning
8928 a value:
8929 no value (or any value other than
8930 .Ql 1 ,
8931 .Ql 2
8933 .Ql 3 )
8934 will make \*(UA assume that the terminal is capable to properly deal
8935 with Unicode version 6.3, in which case text is embedded in a pair of
8936 U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE)
8937 characters.
8938 In addition no space on the line is reserved for these characters.
8940 Weaker support is chosen by using the value
8941 .Ql 1
8942 (Unicode 6.3, but reserve the room of two spaces for writing the control
8943 sequences onto the line).
8944 The values
8945 .Ql 2
8947 .Ql 3
8948 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter
8949 again reserves room for two spaces in addition.
8952 .It Va history-file
8953 \*(OP If a line editor is available then this can be set to
8954 name the (expandable) path of the location of a permanent history file.
8955 Also see
8956 .Va history-size .
8959 .It Va history-gabby
8960 \*(BO\*(OP Add more entries to the history as is normally done.
8963 .It Va history-gabby-persist
8964 \*(BO\*(OP \*(UA's own MLE will not save the additional
8965 .Va history-gabby
8966 entries in persistent storage unless this variable is set.
8967 On the other hand it will not loose the knowledge of whether
8968 a persistent entry was gabby or not.
8969 Also see
8970 .Va history-file .
8973 .It Va history-size
8974 \*(OP Setting this variable imposes a limit on the number of concurrent
8975 history entries.
8976 If set to the value 0 then no further history entries will be added, and
8977 loading and incorporation of the
8978 .Va history-file
8979 upon program startup can also be suppressed by doing this.
8980 Runtime changes will not be reflected, but will affect the number of
8981 entries saved to permanent storage.
8984 .It Va hold
8985 \*(BO This setting controls whether messages are held in the system
8986 .Va inbox ,
8987 and it is set by default.
8990 .It Va hostname
8991 Use this string as hostname when expanding local addresses instead of
8992 the value obtained from
8993 .Xr uname 3
8995 .Xr getaddrinfo 3 .
8996 It is used, e.g., in
8997 .Ql Message-ID:
8999 .Ql From:
9000 fields, as well as when generating
9001 .Ql Content-ID:
9002 MIME part related unique ID fields.
9003 Setting it to the empty string will cause the normal hostname to be
9004 used, but nonetheless enables creation of said ID fields.
9005 \*(IN in conjunction with the built-in SMTP
9006 .Va mta
9007 .Va smtp-hostname
9008 also influences the results:
9009 one should produce some test messages with the desired combination of
9010 .Va \&\&hostname ,
9011 and/or
9012 .Va from ,
9013 .Va sender
9014 etc. first.
9017 .It Va idna-disable
9018 \*(BO\*(OP Can be used to turn off the automatic conversion of domain
9019 names according to the rules of IDNA (internationalized domain names
9020 for applications).
9021 Since the IDNA code assumes that domain names are specified with the
9022 .Va ttycharset
9023 character set, an UTF-8 locale charset is required to represent all
9024 possible international domain names (before conversion, that is).
9027 .It Va ifs
9028 The input field separator that is used (\*(ID by some functions) to
9029 determine where to split input data.
9031 .Bl -tag -compact -width ".It MMM"
9032 .It 1.
9033 Unsetting is treated as assigning the default value,
9034 .Ql \& \et\en .
9035 .It 2.
9036 If set to the empty value, no field splitting will be performed.
9037 .It 3.
9038 If set to a non-empty value, all whitespace characters are extracted
9039 and assigned to the variable
9040 .Va ifs-ws .
9043 .Bl -tag -compact -width ".It MMM"
9044 .It a.
9045 .Va \&\&ifs-ws
9046 will be ignored at the beginning and end of input.
9047 Diverging from POSIX shells default whitespace is removed in addition,
9048 which is owed to the entirely different line content extraction rules.
9049 .It b.
9050 Each occurrence of a character of
9051 .Va \&\&ifs
9052 will cause field-splitting, any adjacent
9053 .Va \&\&ifs-ws
9054 characters will be skipped.
9058 .It Va ifs-ws
9059 \*(RO Automatically deduced from the whitespace characters in
9060 .Va ifs .
9063 .It Va ignore
9064 \*(BO Ignore interrupt signals from the terminal while entering
9065 messages; instead echo them as
9066 .Ql @
9067 characters and discard the current line.
9070 .It Va ignoreeof
9071 \*(BO Ignore end-of-file conditions
9072 .Pf ( Ql control-D )
9073 in compose mode on message input and in interactive command input.
9074 If set an interactive command input session can only be left by
9075 explicitly using one of the commands
9076 .Ic exit
9078 .Ic quit ,
9079 and message input in compose mode can only be terminated by entering
9080 a period
9081 .Ql \&.
9082 on a line by itself or by using the
9083 .Ic ~.
9084 .Sx "COMMAND ESCAPES" ;
9085 Setting this implies the behaviour that
9086 .Va dot
9087 describes in
9088 .Va posix
9089 mode.
9092 .It Va inbox
9093 If this is set to a non-empty string it will specify the users
9094 .Mx -sx
9095 .Sx "primary system mailbox" ,
9096 overriding
9097 .Ev MAIL
9098 and the system-dependent default, and (thus) be used to replace
9099 .Ql %
9100 when doing
9101 .Sx "Filename transformations" ;
9102 also see
9103 .Ic file
9104 for more on this topic.
9105 The value supports a subset of transformations itself.
9108 .It Va indentprefix
9109 String used by the
9110 .Ic ~m , ~M
9112 .Ic ~R
9113 .Sx "COMMAND ESCAPES"
9114 and by the
9115 .Va quote
9116 option for indenting messages,
9117 in place of the normal tabulator character
9118 .Ql ^I ,
9119 which is the default.
9120 Be sure to quote the value if it contains spaces or tabs.
9123 .It Va keep
9124 \*(BO If set, an empty
9125 .Mx -sx
9126 .Sx "primary system mailbox"
9127 file is not removed.
9128 Note that, in conjunction with
9129 .Va posix
9130 mode any empty file will be removed unless this variable is set.
9131 This may improve the interoperability with other mail user agents
9132 when using a common folder directory, and prevents malicious users
9133 from creating fake mailboxes in a world-writable spool directory.
9134 \*(ID Only local regular (MBOX) files are covered, Maildir or other
9135 mailbox types will never be removed, even if empty.
9138 .It Va keep-content-length
9139 \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can
9140 be told to keep the
9141 .Ql Content-Length:
9143 .Ql Lines:
9144 header fields that some MUAs generate by setting this variable.
9145 Since \*(UA does neither use nor update these non-standardized header
9146 fields (which in itself shows one of their conceptual problems),
9147 stripping them should increase interoperability in between MUAs that
9148 work with with same mailbox files.
9149 Note that, if this is not set but
9150 .Va writebackedited ,
9151 as below, is, a possibly performed automatic stripping of these header
9152 fields already marks the message as being modified.
9153 \*(ID At some future time \*(UA will be capable to rewrite and apply an
9154 .Va mime-encoding
9155 to modified messages, and then those fields will be stripped silently.
9158 .It Va keepsave
9159 \*(BO When a message is saved it is usually discarded from the
9160 originating folder when \*(UA is quit.
9161 This setting causes all saved message to be retained.
9164 .It Va line-editor-disable
9165 \*(BO Turn off any enhanced line editing capabilities (see
9166 .Sx "On terminal control and line editor"
9167 for more).
9170 .It Va line-editor-no-defaults
9171 \*(BO\*(OP Do not establish any default key binding.
9174 .It Va log-prefix
9175 Error log message prefix string
9176 .Pf ( Ql "\*(uA: " ) .
9179 .It Va mailbox-display
9180 \*(RO The name of the current mailbox
9181 .Pf ( Ic file ) ,
9182 possibly abbreviated for display purposes.
9185 .It Va mailbox-resolved
9186 \*(RO The fully resolved path of the current mailbox.
9189 .It Va mailx-extra-rc
9190 An additional startup file that is loaded as the last of the
9191 .Sx "Resource files" .
9192 Use this file for commands that are not understood by other POSIX
9193 .Xr mailx 1
9194 implementations, i.e., mostly anything which is not covered by
9195 .Sx "Initial settings" .
9198 .It Va markanswered
9199 \*(BO When a message is replied to and this variable is set,
9200 it is marked as having been
9201 .Ic answered .
9202 See the section
9203 .Sx "Message states" .
9206 .It Va mbox-rfc4155
9207 \*(BO When opening MBOX mailbox databases \*(UA by default uses tolerant
9208 POSIX rules for detecting message boundaries (so-called
9209 .Ql From_
9210 lines) due to compatibility reasons, instead of the stricter rules that
9211 have been standardized in RFC 4155.
9212 This behaviour can be switched to the stricter RFC 4155 rules by
9213 setting this variable.
9214 (This is never necessary for any message newly generated by \*(UA,
9215 it only applies to messages generated by buggy or malicious MUAs, or may
9216 occur in old MBOX databases: \*(UA itself will choose a proper
9217 .Va mime-encoding
9218 to avoid false interpretation of
9219 .Ql From_
9220 content lines in the MBOX database.)
9222 This may temporarily be handy when \*(UA complains about invalid
9223 .Ql From_
9224 lines when opening a MBOX: in this case setting this variable and
9225 re-opening the mailbox in question may correct the result.
9226 If so, copying the entire mailbox to some other file, as in
9227 .Ql copy * SOME-FILE ,
9228 will perform proper, all-compatible
9229 .Ql From_
9230 quoting for all detected messages, resulting in a valid MBOX mailbox.
9231 Finally the variable can be unset again:
9232 .Bd -literal -offset indent
9233 define mboxfix {
9234   localopts yes; wysh set mbox-rfc4155;\e
9235     wysh File "${1}"; eval copy * "${2}"
9237 call mboxfix /tmp/bad.mbox /tmp/good.mbox
9241 .It Va memdebug
9242 \*(BO Internal development variable.
9245 .It Va message-id-disable
9246 \*(BO By setting this variable the generation of
9247 .Ql Message-ID:
9248 can be completely suppressed, effectively leaving this task up to the
9249 .Va mta
9250 (Mail-Transfer-Agent) or the SMTP server.
9251 (According to RFC 5321 a SMTP server is not required to add this
9252 field by itself, so it should be ensured that it accepts messages without
9253 .Ql Message-ID . )
9254 This variable also affects automatic generation of
9255 .Va Content-ID:
9256 MIME header fields.
9259 .It Va message-inject-head
9260 A string to put at the beginning of each new message, followed by a newline.
9261 \*(OB The escape sequences tabulator
9262 .Ql \et
9263 and newline
9264 .Ql \en
9265 are understood (use the
9266 .Cm wysh
9267 prefix when
9268 .Ic set Ns
9269 ting the variable(s) instead).
9272 .It Va message-inject-tail
9273 A string to put at the end of each new message, followed by a newline.
9274 \*(OB The escape sequences tabulator
9275 .Ql \et
9276 and newline
9277 .Ql \en
9278 are understood (use the
9279 .Cm wysh
9280 prefix when
9281 .Ic set Ns
9282 ting the variable(s) instead).
9285 .It Va metoo
9286 \*(BO Usually, when an
9287 .Ic alias
9288 expansion contains the sender, the sender is removed from the expansion.
9289 Setting this option suppresses these removals.
9290 Note that a set
9291 .Va metoo
9292 also causes a
9293 .Ql -m
9294 option to be passed through to the
9295 .Va mta
9296 (Mail-Transfer-Agent); though most of the modern MTAs no longer document
9297 this flag, no MTA is known which does not support it (for historical
9298 compatibility).
9301 .It Va mime-allow-text-controls
9302 \*(BO When sending messages, each part of the message is MIME-inspected
9303 in order to classify the
9304 .Ql Content-Type:
9306 .Ql Content-Transfer-Encoding:
9307 (see
9308 .Va mime-encoding )
9309 that is required to send this part over mail transport, i.e.,
9310 a computation rather similar to what the
9311 .Xr file 1
9312 command produces when used with the
9313 .Ql --mime
9314 option.
9316 This classification however treats text files which are encoded in
9317 UTF-16 (seen for HTML files) and similar character sets as binary
9318 octet-streams, forcefully changing any
9319 .Ql text/plain
9321 .Ql text/html
9322 specification to
9323 .Ql application/octet-stream :
9324 If that actually happens a yet unset charset MIME parameter is set to
9325 .Ql binary ,
9326 effectively making it impossible for the receiving MUA to automatically
9327 interpret the contents of the part.
9329 If this variable is set, and the data was unambiguously identified as
9330 text data at first glance (by a
9331 .Ql .txt
9333 .Ql .html
9334 file extension), then the original
9335 .Ql Content-Type:
9336 will not be overwritten.
9339 .It Va mime-alternative-favour-rich
9340 \*(BO If this variable is set then rich MIME alternative parts (e.g.,
9341 HTML) will be preferred in favour of included plain text versions when
9342 displaying messages, provided that a handler exists which produces
9343 output that can be (re)integrated into \*(UA's normal visual display.
9344 (E.g., at the time of this writing some newsletters ship their full
9345 content only in the rich HTML part, whereas the plain text part only
9346 contains topic subjects.)
9349 .It Va mime-counter-evidence
9350 Normally the
9351 .Ql Content-Type:
9352 field is used to decide how to handle MIME parts.
9353 Some MUAs, however, do not use
9354 .Sx "The mime.types files"
9355 (also see
9356 .Sx "HTML mail and MIME attachments" )
9357 or a similar mechanism to correctly classify content, but specify an
9358 unspecific MIME type
9359 .Pf ( Ql application/octet-stream )
9360 even for plain text attachments.
9361 If this variable is set then \*(UA will try to re-classify such MIME
9362 message parts, if possible, for example via a possibly existing
9363 attachment filename.
9364 A non-empty value may also be given, in which case a number is expected,
9365 actually a carrier of bits.
9366 Creating the bit-carrying number is a simple addition:
9367 .Bd -literal -offset indent
9368 ? !echo Value should be set to $((2 + 4 + 8))
9369 Value should be set to 14
9372 .Bl -bullet -compact
9374 If bit two is set (2) then the detected
9375 .Ic mimetype
9376 will be carried along with the message and be used for deciding which
9377 MIME handler is to be used, for example;
9378 when displaying such a MIME part the part-info will indicate the
9379 overridden content-type by showing a plus sign
9380 .Ql + .
9382 If bit three is set (4) then the counter-evidence is always produced
9383 and a positive result will be used as the MIME type, even forcefully
9384 overriding the parts given MIME type.
9386 If bit four is set (8) then as a last resort the actual content of
9387 .Ql application/octet-stream
9388 parts will be inspected, so that data which looks like plain text can be
9389 treated as such.
9393 .It Va mime-encoding
9394 The MIME
9395 .Ql Content-Transfer-Encoding
9396 to use in outgoing text messages and message parts, where applicable.
9397 (7-bit clean text messages are sent as-is, without a transfer encoding.)
9398 Valid values are:
9400 .Bl -tag -compact -width ".It Ql _%%_"
9401 .It Ql 8bit
9402 .Pf (Or\0 Ql 8b . )
9403 8-bit transport effectively causes the raw data be passed through
9404 unchanged, but may cause problems when transferring mail messages over
9405 channels that are not ESMTP (RFC 1869) compliant.
9406 Also, several input data constructs are not allowed by the
9407 specifications and may cause a different transfer-encoding to be used.
9408 .It Ql quoted-printable
9409 .Pf (Or\0 Ql qp . )
9410 Quoted-printable encoding is 7-bit clean and has the property that ASCII
9411 characters are passed through unchanged, so that an english message can
9412 be read as-is; it is also acceptible for other single-byte locales that
9413 share many characters with ASCII, like, e.g., ISO-8859-1.
9414 The encoding will cause a large overhead for messages in other character
9415 sets: e.g., it will require up to twelve (12) bytes to encode a single
9416 UTF-8 character of four (4) bytes.
9417 .It Ql base64
9418 .Pf (Or\0 Ql b64 . )
9419 The default encoding, it is 7-bit clean and will always be used for
9420 binary data.
9421 This encoding has a constant input:output ratio of 3:4, regardless of
9422 the character set of the input data it will encode three bytes of input
9423 to four bytes of output.
9424 This transfer-encoding is not human readable without performing
9425 a decoding step.
9429 .It Va mimetypes-load-control
9430 Can be used to control which of
9431 .Sx "The mime.types files"
9432 are loaded: if the letter
9433 .Ql u
9434 is part of the option value, then the user's personal
9435 .Pa ~/.mime.types
9436 file will be loaded (if it exists); likewise the letter
9437 .Ql s
9438 controls loading of the system wide
9439 .Pa /etc/mime.types ;
9440 directives found in the user file take precedence, letter matching is
9441 case-insensitive.
9442 If this variable is not set \*(UA will try to load both files.
9443 Incorporation of the \*(UA-built-in MIME types cannot be suppressed,
9444 but they will be matched last (the order can be listed via
9445 .Ic mimetype ) .
9447 More sources can be specified by using a different syntax: if the
9448 value string contains an equals sign
9449 .Ql =
9450 then it is instead parsed as a comma-separated list of the described
9451 letters plus
9452 .Ql f=FILENAME
9453 pairs; the given filenames will be expanded and loaded, and their
9454 content may use the extended syntax that is described in the section
9455 .Sx "The mime.types files" .
9456 Directives found in such files always take precedence (are prepended to
9457 the MIME type cache).
9461 .It Va mta
9462 To choose an alternate Mail-Transfer-Agent, set this option to either
9463 the full pathname of an executable (optionally prefixed with a
9464 .Ql file://
9465 protocol indicator), or \*(OPally a SMTP protocol URL, e.g., \*(IN
9467 .Dl smtps?://[user[:password]@]server[:port]
9469 (\*(OU:
9470 .Ql [smtp://]server[:port] . )
9471 The default has been chosen at compile time.
9472 All supported data transfers are executed in child processes, which
9473 run asynchronously and without supervision unless either the
9474 .Va sendwait
9475 or the
9476 .Va verbose
9477 variable is set.
9478 If such a child receives a TERM signal, it will abort and
9479 .Va save
9480 the message to
9481 .Ev DEAD ,
9482 if so configured.
9485 For a file-based MTA it may be necessary to set
9486 .Va mta-argv0
9487 in in order to choose the right target of a modern
9488 .Xr mailwrapper 8
9489 environment.
9490 It will be passed command line arguments from several possible sources:
9491 from the variable
9492 .Va mta-arguments
9493 if set, from the command line if given and the variable
9494 .Va expandargv
9495 allows their use.
9496 Argument processing of the MTA will be terminated with a
9497 .Fl \&\&-
9498 separator.
9501 The otherwise occurring implicit usage of the following MTA command
9502 line arguments can be disabled by setting the boolean variable
9503 .Va mta-no-default-arguments
9504 (which will also disable passing
9505 .Fl \&\&-
9506 to the MTA):
9507 .Fl \&\&i
9508 (for not treating a line with only a dot
9509 .Ql \&.
9510 character as the end of input),
9511 .Fl \&\&m
9512 (shall the variable
9513 .Va metoo
9514 be set) and
9515 .Fl \&\&v
9516 (if the
9517 .Va verbose
9518 variable is set); in conjunction with the
9519 .Fl r
9520 command line option \*(UA will also (not) pass
9521 .Fl \&\&f
9522 as well as possibly
9523 .Fl \&\&F .
9526 \*(OPally \*(UA can send mail over SMTP network connections to a single
9527 defined SMTP smart host by specifying a SMTP URL as the value (see
9528 .Sx "On URL syntax and credential lookup" ) .
9529 Encrypted network connections are \*(OPally available, the section
9530 .Sx "Encrypted network communication"
9531 should give an overview and provide links to more information on this.
9532 \*(UA also supports forwarding of all network traffic over a specified
9533 .Va socks-proxy .
9534 Note that with some mail providers it may be necessary to set the
9535 .Va smtp-hostname
9536 variable in order to use a specific combination of
9537 .Va from ,
9538 .Va hostname
9540 .Va mta .
9541 The following SMTP variants may be used:
9543 .Bl -bullet
9545 The plain SMTP protocol (RFC 5321) that normally lives on the
9546 server port 25 and requires setting the
9547 .Va smtp-use-starttls
9548 variable to enter a SSL/TLS encrypted session state.
9549 Assign a value like \*(IN
9550 .Ql smtp://[user[:password]@]server[:port]
9551 (\*(OU
9552 .Ql smtp://server[:port] )
9553 to choose this protocol.
9555 The so-called SMTPS which is supposed to live on server port 465
9556 and is automatically SSL/TLS secured.
9557 Unfortunately it never became a standardized protocol and may thus not
9558 be supported by your hosts network service database
9559 \(en in fact the port number has already been reassigned to other
9560 protocols!
9562 SMTPS is nonetheless a commonly offered protocol and thus can be
9563 chosen by assigning a value like \*(IN
9564 .Ql smtps://[user[:password]@]server[:port]
9565 (\*(OU
9566 .Ql smtps://server[:port] ) ;
9567 due to the mentioned problems it is usually necessary to explicitly
9568 specify the port as
9569 .Ql :465 ,
9570 however.
9572 Finally there is the SUBMISSION protocol (RFC 6409), which usually
9573 lives on server port 587 and is practically identically to the SMTP
9574 protocol from \*(UA's point of view beside that; it requires setting the
9575 .Va smtp-use-starttls
9576 variable to enter a SSL/TLS secured session state.
9577 Assign a value like \*(IN
9578 .Ql submission://[user[:password]@]server[:port]
9579 (\*(OU
9580 .Ql submission://server[:port] ) .
9585 .It Va mta-arguments
9586 Arguments to pass through to a file-based
9587 .Va mta
9588 can be given via this variable, which is parsed according to
9589 .Sx "Shell-style argument quoting"
9590 into an array of arguments, and which will be joined onto MTA options
9591 from other sources, and then passed individually to the MTA:
9592 .Ql ? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' .
9595 .It Va mta-no-default-arguments
9596 \*(BO Unless this variable is set \*(UA will pass some well known
9597 standard command line options to a file-based
9598 .Va mta
9599 (Mail-Transfer-Agent), see there for more.
9602 .It Va mta-argv0
9603 Many systems use a so-called
9604 .Xr mailwrapper 8
9605 environment to ensure compatibility with
9606 .Xr sendmail 1 .
9607 This works by inspecting the name that was used to invoke the mail
9608 delivery system.
9609 If this variable is set then the mailwrapper (the program that is
9610 actually executed when calling the file-based
9611 .Va mta )
9612 will treat its contents as that name.
9614 .Mx Va netrc-lookup
9615 .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup
9616 \*(BO\*(IN\*(OP Used to control usage of the users
9617 .Pa .netrc
9618 file for lookup of account credentials, as documented in the section
9619 .Sx "On URL syntax and credential lookup"
9620 and for the command
9621 .Ic netrc ;
9622 the section
9623 .Sx "The .netrc file"
9624 documents the file format.
9625 Also see
9626 .Va netrc-pipe .
9629 .It Va netrc-pipe
9630 \*(IN\*(OP When
9631 .Pa .netrc
9632 is loaded (see
9633 .Ic netrc
9635 .Va netrc-lookup )
9636 then \*(UA will read the output of a shell pipe instead of the users
9637 .Pa .netrc
9638 file if this variable is set (to the desired shell command).
9639 This can be used to, e.g., store
9640 .Pa .netrc
9641 in encrypted form:
9642 .Ql ? set netrc-pipe='gpg -qd ~/.netrc.pgp' .
9645 .It Va newfolders
9646 If this variable has the value
9647 .Ql maildir ,
9648 newly created local folders will be in Maildir instead of MBOX format.
9651 .It Va newmail
9652 Checks for new mail in the current folder each time the prompt is shown.
9653 A Maildir folder must be re-scanned to determine if new mail has arrived.
9654 If this variable is set to the special value
9655 .Ql nopoll
9656 then a Maildir folder will not be rescanned completely, but only
9657 timestamp changes are detected.
9660 .It Va outfolder
9661 \*(BO Causes the filename given in the
9662 .Va record
9663 variable
9664 and the sender-based filenames for the
9665 .Ic Copy
9667 .Ic Save
9668 commands to be interpreted relative to the directory given in the
9669 .Va folder
9670 variable rather than to the current directory,
9671 unless it is set to an absolute pathname.
9674 .It Va on-compose-cleanup
9675 Macro hook which will be called after the message has been sent (or not,
9676 in case of failures), as the very last step before unrolling compose mode
9677 .Ic localopts .
9678 This hook is run even in case of fatal errors, and it is advisable to
9679 perform only absolutely necessary actions, like cleaning up
9680 .Ic alternates ,
9681 for example.
9683 For compose mode hooks that may affect the message content please see
9684 .Va on-compose-enter , on-compose-leave , on-compose-splice .
9685 \*(ID This hook exists because
9686 .Ic alias , alternates , commandalias , shortcut ,
9687 to name a few, are not covered by
9688 .Ic localopts :
9689 changes applied in compose mode will continue to be in effect thereafter.
9694 .It Va on-compose-enter , on-compose-leave
9695 Macro hooks which will be called once compose mode is entered,
9696 and after composing has been finished, but before a set
9697 .Va message-inject-tail
9698 has been injected etc., respectively.
9699 .Ic localopts
9700 are enabled for these hooks, and changes on variables will be forgotten
9701 after the message has been sent.
9702 .Va on-compose-cleanup
9703 can be used to perform other necessary cleanup steps.
9705 The following (read-only) variables will be set temporarily during
9706 execution of the macros to represent the according message headers, or
9707 the empty string for non-existent; they correspond to accoding virtual
9708 temporary message headers that can be accessed (also from within
9709 .Va on-compose-splice
9710 hooks) via
9711 .Ic ~^ ,
9712 one of the
9713 .Sx "COMMAND ESCAPES" :
9716 .Bl -tag -compact -width ".It Va mailx_subject"
9717 .It Va mailx-command
9718 The command that generates the message.
9719 .It Va mailx-subject
9720 The subject.
9721 .It Va mailx-from
9722 .Va from .
9723 .It Va mailx-sender
9724 .Va sender .
9725 .It Va mailx-to , mailx-cc , mailx-bcc
9726 The list of receiver addresses as a space-separated list.
9727 .It Va mailx-raw-to , mailx-raw-cc , mailx-raw-bcc
9728 The list of receiver addresses before any mangling (due to, e.g.,
9729 .Ic alternates ,
9730 .Ic alias
9731 .Va recipients-in-cc )
9732 as a space-separated list.
9733 .It Va mailx-orig-from
9734 When replying, forwarding or resending, this will be set to the
9735 .Ql From:
9736 of the given message.
9737 .It Va mailx-orig-to , mailx-orig-cc , mailx-orig-bcc
9738 When replying, forwarding or resending, this will be set to the
9739 receivers of the given message.
9743 Here is am example that injects a signature via
9744 .Va message-inject-tail ;
9745 instead using
9746 .Va on-compose-splice
9747 to simply inject the file of desire via
9748 .Ic ~<
9750 .Ic ~<!
9751 may be a better approach.
9753 .Bd -literal -offset indent
9754 define t_ocl {
9755   vput ! i cat ~/.mysig
9756   if [ $? -eq 0 ]
9757      vput vexpr message-inject-tail trim-end $i
9758   end
9759   return
9760   # Alternatively
9761   readctl create ~/.mysig
9762   if [ $? -eq 0 ]
9763     readall i
9764     if [ $? -eq 0 ]
9765       vput vexpr message-inject-tail trim-end $i
9766     end
9767     readctl remove ~/.mysig
9768   end
9770 set on-compose-leave=t_ocl
9776 .It Va on-compose-splice , on-compose-splice-shell
9777 These hooks run once the normal compose mode is finished, but before the
9778 .Va on-compose-leave
9779 macro hook is called, the
9780 .Va message-inject-tail
9781 is injected etc.
9782 Both hooks will be executed in a subprocess, with their input and output
9783 connected to \*(UA such that they can act as if they would be an
9784 interactive user.
9785 The difference in between them is that the latter is a
9786 .Ev SHELL
9787 command, whereas the former is a normal \*(UA macro, but which is
9788 restricted to a small set of commands (the
9789 .Va verbose
9790 output of, e.g.,
9791 .Ic list
9792 will indicate said capability).
9793 .Ic localopts
9794 are enabled for these hooks (in the parent process), causing any setting
9795 to be forgotten after the message has been sent;
9796 .Va on-compose-cleanup
9797 can be used to perform other cleanup as necessary.
9800 During execution of these hooks \*(UA will temporarily forget whether it
9801 has been started in interactive mode, (a restricted set of)
9802 .Sx "COMMAND ESCAPES"
9803 will always be available, and for guaranteed reproducibilities sake
9804 .Va escape
9806 .Va ifs
9807 will be set to their defaults.
9808 The compose mode command
9809 .Ic ~^
9810 has been especially designed for scriptability (via these hooks).
9811 The first line the hook will read on its standard input is the protocol
9812 version of said command escape, currently
9813 .Dq 0 0 1 :
9814 backward incompatible protocol changes have to be expected.
9817 Care must be taken to avoid deadlocks and other false control flow:
9818 if both involved processes wait for more input to happen at the
9819 same time, or one does not expect more input but the other is stuck
9820 waiting for consumption of its output, etc.
9821 There is no automatic synchronization of the hook: it will not be
9822 stopped automatically just because it, e.g., emits
9823 .Ql ~x .
9824 The hooks will however receive a termination signal if the parent enters
9825 an error condition.
9826 \*(ID Protection against and interaction with signals is not yet given;
9827 it is likely that in the future these scripts will be placed in an
9828 isolated session, which is signalled in its entirety as necessary.
9830 .Bd -literal -offset indent
9831 define ocs_signature {
9832   read version
9833   echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'
9835 set on-compose-splice=ocs_signature
9837 wysh set on-compose-splice-shell=$'\e
9838   read version;\e
9839   printf "hello $version!  Headers: ";\e
9840   echo \e'~^header list\e';\e
9841   read status result;\e
9842   echo "status=$status result=$result";\e
9843   '
9845 define ocsm {
9846   read version
9847   echo Splice protocol version is $version
9848   echo '~^h l'; read hl; vput vexpr es substring "${hl}" 0 1
9849   if [ "$es" != 2 ]
9850     echoerr 'Cannot read header list'; echo '~x'; xit
9851   endif
9852   if [ "$hl" @i!% ' cc' ]
9853     echo '~^h i cc Diet is your <mirr.or>'; read es;\e
9854       vput vexpr es substring "${es}" 0 1
9855     if [ "$es" != 2 ]
9856       echoerr 'Cannot insert Cc: header'; echo '~x'
9857       # (no xit, macro finishs anyway)
9858     endif
9859   endif
9861 set on-compose-splice=ocsm
9866 .It Va on-resend-cleanup
9867 \*(ID Identical to
9868 .Va on-compose-cleanup ,
9869 but is only triggered by
9870 .Ic resend .
9873 .It Va on-resend-enter
9874 \*(ID Identical to
9875 .Va on-compose-enter ,
9876 but is only triggered by
9877 .Ic resend .
9880 .It Va page
9881 \*(BO If set, each message feed through the command given for
9882 .Ic pipe
9883 is followed by a formfeed character
9884 .Ql \ef .
9886 .Mx Va password
9887 .It Va password-USER@HOST , password-HOST , password
9888 \*(IN Variable chain that sets a password, which is used in case none has
9889 been given in the protocol and account-specific URL;
9890 as a last resort \*(UA will ask for a password on the user's terminal if
9891 the authentication method requires a password.
9892 Specifying passwords in a startup file is generally a security risk;
9893 the file should be readable by the invoking user only.
9895 .It Va password-USER@HOST
9896 \*(OU (see the chain above for \*(IN)
9897 Set the password for
9898 .Ql USER
9899 when connecting to
9900 .Ql HOST .
9901 If no such variable is defined for a host,
9902 the user will be asked for a password on standard input.
9903 Specifying passwords in a startup file is generally a security risk;
9904 the file should be readable by the invoking user only.
9907 .It Va piperaw
9908 \*(BO Send messages to the
9909 .Ic pipe
9910 command without performing MIME and character set conversions.
9914 .It Va pipe-TYPE/SUBTYPE
9915 When a MIME message part of type
9916 .Ql TYPE/SUBTYPE
9917 (case-insensitive) is displayed or quoted,
9918 its text is filtered through the value of this variable interpreted as
9919 a shell command.
9920 Note that only parts which can be displayed inline as plain text (see
9921 .Cd copiousoutput )
9922 are displayed unless otherwise noted, other MIME parts will only be
9923 considered by and for the command
9924 .Ic mimeview .
9927 The special value commercial at
9928 .Ql @
9929 forces interpretation of the message part as plain text, e.g.,
9930 .Ql set pipe-application/xml=@
9931 will henceforth display XML
9932 .Dq as is .
9933 (The same could also be achieved by adding a MIME type marker with the
9934 .Ic mimetype
9935 command.
9936 And \*(OPally MIME type handlers may be defined via
9937 .Sx "The Mailcap files"
9938 \(em these directives,
9939 .Cd copiousoutput
9940 has already been used, should be referred to for further documentation.
9943 The commercial at
9944 .Ql @
9945 can in fact be used as a trigger character to adjust usage and behaviour
9946 of a following shell command specification more thoroughly by appending
9947 more special characters which refer to further mailcap directives, e.g.,
9948 the following hypothetical command specification could be used:
9950 .Bd -literal -offset indent
9951 ? set pipe-X/Y='@!++=@vim ${MAILX_FILENAME_TEMPORARY}'
9955 .Bl -tag -compact -width ".It Ql __"
9956 .It Ql *
9957 The command produces plain text to be integrated in \*(UAs output:
9958 .Cd copiousoutput .
9960 .It Ql #
9961 If set the handler will not be invoked when a message is to be quoted,
9962 but only when it will be displayed:
9963 .Cd x-mailx-noquote .
9965 .It Ql &
9966 Run the command asynchronously, i.e., without blocking \*(UA:
9967 .Cd x-mailx-async .
9969 .It Ql \&!
9970 The command must be run on an interactive terminal, \*(UA will
9971 temporarily release the terminal to it:
9972 .Cd needsterminal .
9974 .It Ql +
9975 Request creation of a zero-sized temporary file, the absolute pathname
9976 of which will be made accessible via the environment variable
9977 .Ev MAILX_FILENAME_TEMPORARY :
9978 .Cd x-mailx-tmpfile .
9979 If given twice then the file will be unlinked automatically by \*(UA
9980 when the command loop is entered again at latest:
9981 .Cd x-mailx-tmpfile-unlink .
9983 .It Ql =
9984 Normally the MIME part content is passed to the handler via standard
9985 input; if this flag is set then the data will instead be written into
9986 .Ev MAILX_FILENAME_TEMPORARY
9987 .Pf ( Cd x-mailx-tmpfile-fill ) ,
9988 the creation of which is implied; note however that in order to cause
9989 deletion of the temporary file you still have to use two plus signs
9990 .Ql ++
9991 explicitly!
9993 .It Ql @
9994 To avoid ambiguities with normal shell command content you can use
9995 another commercial at to forcefully terminate interpretation of
9996 remaining characters.
9997 (Any character not in this list will have the same effect.)
10001 Some information about the MIME part to be displayed is embedded into
10002 the environment of the shell command:
10005 .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED"
10007 .It Ev MAILX_CONTENT
10008 The MIME content-type of the part, if known, the empty string otherwise.
10011 .It Ev MAILX_CONTENT_EVIDENCE
10013 .Va mime-counter-evidence
10014 includes the carry-around-bit (2), then this will be set to the detected
10015 MIME content-type; not only then identical to
10016 .Ev \&\&MAILX_CONTENT
10017 otherwise.
10020 .It Ev MAILX_FILENAME
10021 The filename, if any is set, the empty string otherwise.
10024 .It Ev MAILX_FILENAME_GENERATED
10025 A random string.
10028 .It Ev MAILX_FILENAME_TEMPORARY
10029 If temporary file creation has been requested through the command prefix
10030 this variable will be set and contain the absolute pathname of the
10031 temporary file.
10036 .It Va pipe-EXTENSION
10037 This is identical to
10038 .Va pipe-TYPE/SUBTYPE
10039 except that
10040 .Ql EXTENSION
10041 (normalized to lowercase using character mappings of the ASCII charset)
10042 names a file extension, e.g.,
10043 .Ql xhtml .
10044 Handlers registered using this method take precedence.
10046 .Mx Va pop3-auth
10047 .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth
10048 \*(OP\*(IN Variable chain that sets the POP3 authentication method.
10049 The only possible value as of now is
10050 .Ql plain ,
10051 which is thus the default.
10054 .Mx Va pop3-bulk-load
10055 .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load
10056 \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of
10057 the messages, and only requests the message bodies on user request.
10058 For the POP3 protocol this means that the message headers will be
10059 downloaded twice.
10060 If this variable is set then \*(UA will download only complete messages
10061 from the given POP3 server(s) instead.
10063 .Mx Va pop3-keepalive
10064 .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive
10065 \*(OP POP3 servers close the connection after a period of inactivity;
10066 the standard requires this to be at least 10 minutes,
10067 but practical experience may vary.
10068 Setting this variable to a numeric value greater than
10069 .Ql 0
10070 causes a
10071 .Ql NOOP
10072 command to be sent each value seconds if no other operation is performed.
10074 .Mx Va pop3-no-apop
10075 .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop
10076 \*(BO\*(OP Unless this variable is set the
10077 .Ql APOP
10078 authentication method will be used when connecting to a POP3 server that
10079 advertises support.
10080 The advantage of
10081 .Ql APOP
10082 is that the password is not sent in clear text over the wire and that
10083 only a single packet is sent for the user/password tuple.
10084 Note that
10085 .Va pop3-no-apop-HOST
10086 requires \*(IN.
10088 .Mx Va pop3-use-starttls
10089 .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls
10090 \*(BO\*(OP Causes \*(UA to issue a
10091 .Ql STLS
10092 command to make an unencrypted POP3 session SSL/TLS encrypted.
10093 This functionality is not supported by all servers,
10094 and is not used if the session is already encrypted by the POP3S method.
10095 Note that
10096 .Va pop3-use-starttls-HOST
10097 requires \*(IN.
10101 .It Va posix
10102 \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA
10103 where that deviates from standardized behaviour.
10104 It will be set implicitly before the
10105 .Sx "Resource files"
10106 are loaded if the environment variable
10107 .Ev POSIXLY_CORRECT
10108 is set, and adjusting any of those two will be reflected by the other
10109 one implicitly.
10110 The following behaviour is covered and enforced by this mechanism:
10113 .Bl -bullet -compact
10115 In non-interactive mode, any error encountered while loading resource
10116 files during program startup will cause a program exit, whereas in
10117 interactive mode such errors will stop loading of the currently loaded
10118 (stack of) file(s, i.e., recursively).
10119 These exits can be circumvented on a per-command base by using
10120 .Cm ignerr ,
10121 one of the
10122 .Sx "Command modifiers" ,
10123 for each command which shall be allowed to fail.
10126 .Ic alternates
10127 will replace the list of alternate addresses instead of appending to it.
10130 The variable inserting
10131 .Sx "COMMAND ESCAPES"
10132 .Ic ~A ,
10133 .Ic ~a ,
10134 .Ic ~I
10136 .Ic ~i
10137 will expand embedded character sequences
10138 .Ql \et
10139 horizontal tabulator and
10140 .Ql \en
10141 line feed.
10142 \*(ID For compatibility reasons this step will always be performed.
10145 Upon changing the active
10146 .Ic file
10147 no summary of
10148 .Ic headers
10149 will be displayed even if
10150 .Va header
10151 is set.
10154 Setting
10155 .Va ignoreeof
10156 implies the behaviour described by
10157 .Va dot .
10160 The variable
10161 .Va keep
10162 is extended to cover any empty mailbox, not only empty
10163 .Mx -sx
10164 .Sx "primary system mailbox" Ns
10165 es: they will be removed when they are left in empty state otherwise.
10170 .It Va print-alternatives
10171 \*(BO When a MIME message part of type
10172 .Ql multipart/alternative
10173 is displayed and it contains a subpart of type
10174 .Ql text/plain ,
10175 other parts are normally discarded.
10176 Setting this variable causes all subparts to be displayed,
10177 just as if the surrounding part was of type
10178 .Ql multipart/mixed .
10181 .It Va prompt
10182 The string used as a prompt in interactive mode.
10183 Whenever the variable is evaluated the value is expanded as via
10184 dollar-single-quote expansion (see
10185 .Sx "Shell-style argument quoting" ) .
10186 This (post-assignment, i.e., second) expansion can be used to embed
10187 status information, for example
10188 .Va \&? ,
10189 .Va \&! ,
10190 .Va account
10192 .Va mailbox-display .
10194 In order to embed characters which should not be counted when
10195 calculating the visual width of the resulting string, enclose the
10196 characters of interest in a pair of reverse solidus escaped brackets:
10197 .Ql \e[\eE[0m\e] ;
10198 a slot for coloured prompts is also available with the \*(OPal command
10199 .Ic colour .
10200 Prompting may be prevented by setting this to the null string
10201 (a.k.a.\|
10202 .Ql set noprompt ) .
10205 .It Va prompt2
10206 This string is used for secondary prompts, but is otherwise identical to
10207 .Va prompt .
10208 The default is
10209 .Ql ..\0 .
10212 .It Va quiet
10213 \*(BO Suppresses the printing of the version when first invoked.
10216 .It Va quote
10217 If set, \*(UA starts a replying message with the original message
10218 prefixed by the value of the variable
10219 .Va indentprefix .
10220 Normally, a heading consisting of
10221 .Dq Fromheaderfield wrote:
10222 is put before the quotation.
10223 If the string
10224 .Ql noheading
10225 is assigned to the
10226 .Va \&\&quote
10227 variable, this heading is omitted.
10228 If the string
10229 .Ql headers
10230 is assigned, only the headers selected by the
10231 .Ql type
10232 .Ic headerpick
10233 selection are put above the message body,
10234 thus
10235 .Va \&\&quote
10236 acts like an automatic
10237 .Pf ` Ic ~m Ns '
10238 .Sx "COMMAND ESCAPES"
10239 command, then.
10240 If the string
10241 .Ql allheaders
10242 is assigned, all headers are put above the message body and all MIME
10243 parts are included, making
10244 .Va \&\&quote
10245 act like an automatic
10246 .Pf ` Ic ~M Ns '
10247 command; also see
10248 .Va quote-as-attachment .
10251 .It Va quote-as-attachment
10252 \*(BO Add the original message in its entirety as a
10253 .Ql message/rfc822
10254 MIME attachment when replying to a message.
10255 Note this works regardless of the setting of
10256 .Va quote .
10259 .It Va quote-fold
10260 \*(OP Can be set in addition to
10261 .Va indentprefix .
10262 Setting this turns on a more fancy quotation algorithm in that leading
10263 quotation characters are compressed and overlong lines are folded.
10264 .Va \&\&quote-fold
10265 can be set to either one or two (space separated) numeric values,
10266 which are interpreted as the maximum (goal) and the minimum line length,
10267 respectively, in a spirit rather equal to the
10268 .Xr fmt 1
10269 program, but line-, not paragraph-based.
10270 If not set explicitly the minimum will reflect the goal algorithmically.
10271 The goal cannot be smaller than the length of
10272 .Va indentprefix
10273 plus some additional pad.
10274 Necessary adjustments take place silently.
10277 .It Va r-option-implicit
10278 \*(BO Setting this option evaluates the contents of
10279 .Va from
10280 (or, if that contains multiple addresses,
10281 .Va sender )
10282 and passes the results onto the used (file-based) MTA as described for the
10283 .Fl r
10284 option (empty argument case).
10287 .It Va recipients-in-cc
10288 \*(BO When doing a
10289 .Ic reply ,
10290 the original
10291 .Ql From:
10293 .Ql To:
10294 are by default merged into the new
10295 .Ql To: .
10296 If this variable is set, only the original
10297 .Ql From:
10298 ends in the new
10299 .Ql To: ,
10300 the rest is merged into
10301 .Ql Cc: .
10304 .It Va record
10305 Unless this variable is defined, no copies of outgoing mail will be saved.
10306 If defined it gives the pathname, subject to the usual
10307 .Sx "Filename transformations" ,
10308 of a folder where all new, replied-to or forwarded messages are saved:
10309 when saving to this folder fails the message is not sent, but instead
10310 .Va save Ns
10311 d to
10312 .Ev DEAD .
10313 The standard defines that relative (fully expanded) paths are to be
10314 interpreted relative to the current directory
10315 .Pf ( Ic cwd ) ,
10316 to force interpretation relative to
10317 .Va folder
10318 .Va outfolder
10319 needs to be set in addition.
10322 .It Va record-files
10323 \*(BO If this variable is set the meaning of
10324 .Va record
10325 will be extended to cover messages which target only file and pipe
10326 recipients (see
10327 .Va expandaddr ) .
10328 These address types will not appear in recipient lists unless
10329 .Va add-file-recipients
10330 is also set.
10333 .It Va record-resent
10334 \*(BO If this variable is set the meaning of
10335 .Va record
10336 will be extended to also cover the
10337 .Ic resend
10339 .Ic Resend
10340 commands.
10343 .It Va reply-in-same-charset
10344 \*(BO If this variable is set \*(UA first tries to use the same
10345 character set of the original message for replies.
10346 If this fails, the mechanism described in
10347 .Sx "Character sets"
10348 is evaluated as usual.
10351 .It Va reply-strings
10352 Can be set to a comma-separated list of (case-insensitive according to
10353 ASCII rules) strings which shall be recognized in addition to the
10354 built-in strings as
10355 .Ql Subject:
10356 reply message indicators \(en built-in are
10357 .Ql Re: ,
10358 which is mandated by RFC 5322, as well as the german
10359 .Ql Aw: ,
10360 .Ql Antw: ,
10361 and the
10362 .Ql Wg:
10363 which often has been seen in the wild;
10364 I.e., the separating colon has to be specified explicitly.
10367 .It Va reply-to
10368 A list of addresses to put into the
10369 .Ql Reply-To:
10370 field of the message header.
10371 Members of this list are handled as if they were in the
10372 .Ic alternates
10373 list.
10375 .It Va replyto
10376 \*(OB Variant of
10377 .Va reply-to .
10380 .It Va reply-to-honour
10381 Controls whether a
10382 .Ql Reply-To:
10383 header is honoured when replying to a message via
10384 .Ic reply
10386 .Ic Lreply .
10387 This is a quadoption; if set without a value it defaults to
10388 .Dq yes .
10391 .It Va rfc822-body-from_
10392 \*(BO This variable can be used to force displaying a so-called
10393 .Ql From_
10394 line for messages that are embedded into an envelope mail via the
10395 .Ql message/rfc822
10396 MIME mechanism, for more visual convenience.
10399 .It Va save
10400 \*(BO Enable saving of (partial) messages in
10401 .Ev DEAD
10402 upon interrupt or delivery error.
10405 .It Va screen
10406 The number of lines that represents a
10407 .Dq screenful
10408 of lines, used in
10409 .Ic headers
10410 summary display,
10411 .Ic from
10412 .Ic search Ns
10413 ing, message
10414 .Ic top Ns
10415 line display and scrolling via
10416 .Ic z .
10417 If this variable is not set \*(UA falls back to a calculation based upon
10418 the detected terminal window size and the baud rate: the faster the
10419 terminal, the more will be shown.
10420 Overall screen dimensions and pager usage is influenced by the
10421 environment variables
10422 .Ev COLUMNS
10424 .Ev LINES
10425 and the variable
10426 .Va crt .
10429 .It Va searchheaders
10430 \*(BO Expand message-list specifiers in the form
10431 .Ql /x:y
10432 to all messages containing the substring
10433 .Dq y
10434 in the header field
10435 .Ql x .
10436 The string search is case insensitive.
10439 .It Va sendcharsets
10440 \*(OP A comma-separated list of character set names that can be used in
10441 outgoing internet mail.
10442 The value of the variable
10443 .Va charset-8bit
10444 is automatically appended to this list of character sets.
10445 If no character set conversion capabilities are compiled into \*(UA then
10446 the only supported charset is
10447 .Va ttycharset .
10448 Also see
10449 .Va sendcharsets-else-ttycharset
10450 and refer to the section
10451 .Sx "Character sets"
10452 for the complete picture of character set conversion in \*(UA.
10455 .It Va sendcharsets-else-ttycharset
10456 \*(BO\*(OP If this variable is set, but
10457 .Va sendcharsets
10458 is not, then \*(UA acts as if
10459 .Va sendcharsets
10460 had been set to the value of the variable
10461 .Va ttycharset .
10462 In effect this combination passes through the message data in the
10463 character set of the current locale encoding:
10464 therefore mail message text will be (assumed to be) in ISO-8859-1
10465 encoding when send from within a ISO-8859-1 locale, and in UTF-8
10466 encoding when send from within an UTF-8 locale.
10468 The 8-bit fallback
10469 .Va charset-8bit
10470 never comes into play as
10471 .Va ttycharset
10472 is implicitly assumed to be 8-bit and capable to represent all files the
10473 user may specify (as is the case when no character set conversion
10474 support is available in \*(UA and the only supported character set is
10475 .Va ttycharset :
10476 .Sx "Character sets" ) .
10477 This might be a problem for scripts which use the suggested
10478 .Ql LC_ALL=C
10479 setting, since in this case the character set is US-ASCII by definition,
10480 so that it is better to also override
10481 .Va ttycharset ,
10482 then.
10485 .It Va sender
10486 An address that is put into the
10487 .Ql Sender:
10488 field of outgoing messages, quoting RFC 5322: the mailbox of the agent
10489 responsible for the actual transmission of the message.
10490 This field should normally not be used unless the
10491 .Va from
10492 field contains more than one address, on which case it is required.
10494 .Va \&\&sender
10495 address is handled as if it were in the
10496 .Ic alternates
10497 list; also see
10498 .Fl r ,
10499 .Va r-option-implicit .
10501 .It Va sendmail
10502 \*(OB Predecessor of
10503 .Va mta .
10505 .It Va sendmail-arguments
10506 \*(OB Predecessor of
10507 .Va mta-arguments .
10509 .It Va sendmail-no-default-arguments
10510 \*(OB\*(BO Predecessor of
10511 .Va mta-no-default-arguments .
10513 .It Va sendmail-progname
10514 \*(OB Predecessor of
10515 .Va mta-argv0 .
10518 .It Va sendwait
10519 \*(BO When sending a message wait until the
10520 .Va mta
10521 (including the built-in SMTP one) exits before accepting further commands.
10522 .Sy Only
10523 with this variable set errors reported by the MTA will be recognizable!
10524 If the MTA returns a non-zero exit status,
10525 the exit status of \*(UA will also be non-zero.
10528 .It Va showlast
10529 \*(BO This setting causes \*(UA to start at the last message
10530 instead of the first one when opening a mail folder.
10533 .It Va showname
10534 \*(BO Causes \*(UA to use the sender's real name instead of the plain
10535 address in the header field summary and in message specifications.
10538 .It Va showto
10539 \*(BO Causes the recipient of the message to be shown in the header
10540 summary if the message was sent by the user.
10543 .It Va Sign
10544 The value backing
10545 .Ic ~A ,
10546 one of the
10547 .Sx "COMMAND ESCAPES" .
10548 Also see
10549 .Va message-inject-tail ,
10550 .Va on-compose-leave
10552 .Va on-compose-splice .
10555 .It Va sign
10556 The value backing
10557 .Ic ~a ,
10558 one of the
10559 .Sx "COMMAND ESCAPES" .
10560 Also see
10561 .Va message-inject-tail ,
10562 .Va on-compose-leave
10564 .Va on-compose-splice .
10567 .It Va signature
10568 \*(OB Please use
10569 .Va on-compose-splice
10571 .Va on-compose-splice-shell
10573 .Va on-compose-leave
10574 and (if necessary)
10575 .Va message-inject-tail
10576 instead!
10579 .It Va skipemptybody
10580 \*(BO If an outgoing message does not contain any text in its first or
10581 only message part, do not send it but discard it silently (see also the
10582 command line option
10583 .Fl E ) .
10587 .It Va smime-ca-dir , smime-ca-file
10588 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
10589 Enhanced Mail) format as a directory and a file, respectively, for the
10590 purpose of verification of S/MIME signed messages.
10591 It is possible to set both, the file will be loaded immediately, the
10592 directory will be searched whenever no match has yet been found.
10593 The set of CA certificates which are built into the SSL/TLS library can
10594 be explicitly turned off by setting
10595 .Va smime-ca-no-defaults ,
10596 and further fine-tuning is possible via
10597 .Va smime-ca-flags .
10600 .It Va smime-ca-flags
10601 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
10602 storage, and the certificate verification that is used.
10603 The actual values and their meanings are documented for
10604 .Va ssl-ca-flags .
10607 .It Va smime-ca-no-defaults
10608 \*(BO\*(OP Do not load the default CA locations that are built into the
10609 used to SSL/TLS library to verify S/MIME signed messages.
10611 .Mx Va smime-cipher
10612 .It Va smime-cipher-USER@HOST , smime-cipher
10613 \*(OP Specifies the cipher to use when generating S/MIME encrypted
10614 messages (for the specified account).
10615 RFC 5751 mandates a default of
10616 .Ql aes128
10617 (AES-128 CBC).
10618 Possible values are (case-insensitive and) in decreasing cipher strength:
10619 .Ql aes256
10620 (AES-256 CBC),
10621 .Ql aes192
10622 (AES-192 CBC),
10623 .Ql aes128
10624 (AES-128 CBC),
10625 .Ql des3
10626 (DES EDE3 CBC, 168 bits; default if
10627 .Ql aes128
10628 is not available) and
10629 .Ql des
10630 (DES CBC, 56 bits).
10632 The actually available cipher algorithms depend on the cryptographic
10633 library that \*(UA uses.
10634 \*(OP Support for more cipher algorithms may be available through
10635 dynamic loading via, e.g.,
10636 .Xr EVP_get_cipherbyname 3
10637 (OpenSSL) if \*(UA has been compiled to support this.
10640 .It Va smime-crl-dir
10641 \*(OP Specifies a directory that contains files with CRLs in PEM format
10642 to use when verifying S/MIME messages.
10645 .It Va smime-crl-file
10646 \*(OP Specifies a file that contains a CRL in PEM format to use when
10647 verifying S/MIME messages.
10650 .It Va smime-encrypt-USER@HOST
10651 \*(OP If this variable is set, messages send to the given receiver are
10652 encrypted before sending.
10653 The value of the variable must be set to the name of a file that
10654 contains a certificate in PEM format.
10656 If a message is sent to multiple recipients,
10657 each of them for whom a corresponding variable is set will receive an
10658 individually encrypted message;
10659 other recipients will continue to receive the message in plain text
10660 unless the
10661 .Va smime-force-encryption
10662 variable is set.
10663 It is recommended to sign encrypted messages, i.e., to also set the
10664 .Va smime-sign
10665 variable.
10668 .It Va smime-force-encryption
10669 \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages.
10672 .It Va smime-sign
10673 \*(BO\*(OP S/MIME sign outgoing messages with the user's private key
10674 and include the user's certificate as a MIME attachment.
10675 Signing a message enables a recipient to verify that the sender used
10676 a valid certificate,
10677 that the email addresses in the certificate match those in the message
10678 header and that the message content has not been altered.
10679 It does not change the message text,
10680 and people will be able to read the message as usual.
10681 Also see
10682 .Va smime-sign-cert , smime-sign-include-certs
10684 .Va smime-sign-message-digest .
10686 .Mx Va smime-sign-cert
10687 .It Va smime-sign-cert-USER@HOST , smime-sign-cert
10688 \*(OP Points to a file in PEM format.
10689 For the purpose of signing and decryption this file needs to contain the
10690 user's private key, followed by his certificate.
10692 For message signing
10693 .Ql USER@HOST
10694 is always derived from the value of
10695 .Va from
10696 (or, if that contains multiple addresses,
10697 .Va sender ) .
10698 For the purpose of encryption the recipient's public encryption key
10699 (certificate) is expected; the command
10700 .Ic certsave
10701 can be used to save certificates of signed messages (the section
10702 .Sx "Signed and encrypted messages with S/MIME"
10703 gives some details).
10704 This mode of operation is usually driven by the specialized form.
10706 When decrypting messages the account is derived from the recipient
10707 fields
10708 .Pf ( Ql To:
10710 .Ql Cc: )
10711 of the message, which are searched for addresses for which such
10712 a variable is set.
10713 \*(UA always uses the first address that matches,
10714 so if the same message is sent to more than one of the user's addresses
10715 using different encryption keys, decryption might fail.
10717 For signing and decryption purposes it is possible to use encrypted
10718 keys, and the pseudo-host(s)
10719 .Ql USER@HOST.smime-cert-key
10720 for the private key
10721 (and
10722 .Ql USER@HOST.smime-cert-cert
10723 for the certificate stored in the same file)
10724 will be used for performing any necessary password lookup,
10725 therefore the lookup can be automatized via the mechanisms described in
10726 .Sx "On URL syntax and credential lookup" .
10727 For example, the hypothetical address
10728 .Ql bob@exam.ple
10729 could be driven with a private key / certificate pair path defined in
10730 .Va \&\&smime-sign-cert-bob@exam.ple ,
10731 and needed passwords would then be looked up via the pseudo hosts
10732 .Ql bob@exam.ple.smime-cert-key
10733 (and
10734 .Ql bob@exam.ple.smime-cert-cert ) .
10735 To include intermediate certificates, use
10736 .Va smime-sign-include-certs .
10738 .Mx Va smime-sign-include-certs
10739 .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs
10740 \*(OP If used, this is supposed to a consist of a comma-separated list
10741 of files, each of which containing a single certificate in PEM format to
10742 be included in the S/MIME message in addition to the
10743 .Va smime-sign-cert
10744 certificate.
10745 This can be used to include intermediate certificates of the certificate
10746 authority, in order to allow the receiver's S/MIME implementation to
10747 perform a verification of the entire certificate chain, starting from
10748 a local root certificate, over the intermediate certificates, down to the
10749 .Va smime-sign-cert .
10750 Even though top level certificates may also be included in the chain,
10751 they won't be used for the verification on the receiver's side.
10753 For the purpose of the mechanisms involved here,
10754 .Ql USER@HOST
10755 refers to the content of the internal variable
10756 .Va from
10757 (or, if that contains multiple addresses,
10758 .Va sender ) .
10759 The pseudo-host
10760 .Ql USER@HOST.smime-include-certs
10761 will be used for performing password lookups for these certificates,
10762 shall they have been given one, therefore the lookup can be automatized
10763 via the mechanisms described in
10764 .Sx "On URL syntax and credential lookup" .
10766 .Mx Va smime-sign-message-digest
10767 .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest
10768 \*(OP Specifies the message digest to use when signing S/MIME messages.
10769 RFC 5751 mandates a default of
10770 .Ql sha1 .
10771 Possible values are (case-insensitive and) in decreasing cipher strength:
10772 .Ql sha512 ,
10773 .Ql sha384 ,
10774 .Ql sha256 ,
10775 .Ql sha224
10777 .Ql md5 .
10779 The actually available message digest algorithms depend on the
10780 cryptographic library that \*(UA uses.
10781 \*(OP Support for more message digest algorithms may be available
10782 through dynamic loading via, e.g.,
10783 .Xr EVP_get_digestbyname 3
10784 (OpenSSL) if \*(UA has been compiled to support this.
10785 Remember that for this
10786 .Ql USER@HOST
10787 refers to the variable
10788 .Va from
10789 (or, if that contains multiple addresses,
10790 .Va sender ) .
10792 .It Va smtp
10793 \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in
10794 .Va mta .
10795 \*(ID For compatibility reasons a set
10796 .Va smtp
10797 is used in preference of
10798 .Va mta .
10800 .Mx Va smtp-auth
10801 .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth
10802 \*(OP Variable chain that controls the SMTP
10803 .Va mta
10804 authentication method, possible values are
10805 .Ql none
10806 (\*(OU default),
10807 .Ql plain
10808 (\*(IN default),
10809 .Ql login
10810 as well as the \*(OPal methods
10811 .Ql cram-md5
10813 .Ql gssapi .
10815 .Ql none
10816 method does not need any user credentials,
10817 .Ql gssapi
10818 requires a user name and all other methods require a user name and
10819 a password.
10820 See \*(IN
10821 .Va mta ,
10822 .Va user
10824 .Va password
10825 (\*(OU
10826 .Va smtp-auth-password
10828 .Va smtp-auth-user ) .
10829 Note that
10830 .Va smtp-auth-HOST
10831 is \*(IN.
10832 \*(OU: Note for
10833 .Va smtp-auth-USER@HOST :
10834 may override dependent on sender address in the variable
10835 .Va from .
10837 .It Va smtp-auth-password
10838 \*(OP\*(OU Sets the global fallback password for SMTP authentication.
10839 If the authentication method requires a password, but neither
10840 .Va smtp-auth-password
10841 nor a matching
10842 .Va smtp-auth-password-USER@HOST
10843 can be found,
10844 \*(UA will ask for a password on the user's terminal.
10846 .It Va smtp-auth-password-USER@HOST
10847 \*(OU Overrides
10848 .Va smtp-auth-password
10849 for specific values of sender addresses, dependent upon the variable
10850 .Va from .
10852 .It Va smtp-auth-user
10853 \*(OP\*(OU Sets the global fallback user name for SMTP authentication.
10854 If the authentication method requires a user name, but neither
10855 .Va smtp-auth-user
10856 nor a matching
10857 .Va smtp-auth-user-USER@HOST
10858 can be found,
10859 \*(UA will ask for a user name on the user's terminal.
10861 .It Va smtp-auth-user-USER@HOST
10862 \*(OU Overrides
10863 .Va smtp-auth-user
10864 for specific values of sender addresses, dependent upon the variable
10865 .Va from .
10868 .It Va smtp-hostname
10869 \*(OP\*(IN Normally \*(UA uses the variable
10870 .Va from
10871 to derive the necessary
10872 .Ql USER@HOST
10873 information in order to issue a
10874 .Ql MAIL FROM:<>
10875 SMTP
10876 .Va mta
10877 command.
10878 Setting
10879 .Va smtp-hostname
10880 can be used to use the
10881 .Ql USER
10882 from the SMTP account
10883 .Pf ( Va mta
10884 or the
10885 .Va user
10886 variable chain)
10887 and the
10888 .Ql HOST
10889 from the content of this variable (or, if that is the empty string,
10890 .Va hostname
10891 or the local hostname as a last resort).
10892 This often allows using an address that is itself valid but hosted by
10893 a provider other than which (in
10894 .Va from )
10895 is about to send the message.
10896 Setting this variable also influences generated
10897 .Ql Message-ID:
10899 .Ql Content-ID:
10900 header fields.
10902 .Mx Va smtp-use-starttls
10903 .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls
10904 \*(BO\*(OP Causes \*(UA to issue a
10905 .Ql STARTTLS
10906 command to make an SMTP
10907 .Va mta
10908 session SSL/TLS encrypted, i.e., to enable transport layer security.
10910 .Mx Va socks-proxy
10911 .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy
10912 \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then
10913 \*(UA will proxy all of its network activities through it.
10914 This can be used to proxy SMTP, POP3 etc. network traffic through the
10915 Tor anonymizer, for example.
10916 The following would create a local SOCKS proxy on port 10000 that
10917 forwards to the machine
10918 .Ql HOST ,
10919 and from which the network traffic is actually instantiated:
10920 .Bd -literal -offset indent
10921 # Create local proxy server in terminal 1 forwarding to HOST
10922 $ ssh -D 10000 USER@HOST
10923 # Then, start a client that uses it in terminal 2
10924 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000
10928 .It Va spam-interface
10929 \*(OP In order to use any of the spam-related commands (like, e.g.,
10930 .Ic spamrate )
10931 the desired spam interface must be defined by setting this variable.
10932 Please refer to the manual section
10933 .Sx "Handling spam"
10934 for the complete picture of spam handling in \*(UA.
10935 All or none of the following interfaces may be available:
10937 .Bl -tag -width ".It Ql _ilte_"
10938 .It Ql spamc
10939 Interaction with
10940 .Xr spamc 1
10941 from the
10942 .Xr spamassassin 1
10943 .Pf ( Lk http://spamassassin.apache.org SpamAssassin )
10944 suite.
10945 Different to the generic filter interface \*(UA will automatically add
10946 the correct arguments for a given command and has the necessary
10947 knowledge to parse the program's output.
10948 A default value for
10949 .Va spamc-command
10950 will have been compiled into the \*(UA binary if
10951 .Xr spamc 1
10952 has been found in
10953 .Ev PATH
10954 during compilation.
10955 Shall it be necessary to define a specific connection type (rather than
10956 using a configuration file for that), the variable
10957 .Va spamc-arguments
10958 can be used as in, e.g.,
10959 .Ql -d server.example.com -p 783 .
10960 It is also possible to specify a per-user configuration via
10961 .Va spamc-user .
10962 Note that this interface does not inspect the
10963 .Ql is-spam
10964 flag of a message for the command
10965 .Ic spamforget .
10967 .It Ql filter
10968 generic spam filter support via freely configurable hooks.
10969 This interface is meant for programs like
10970 .Xr bogofilter 1
10971 and requires according behaviour in respect to the hooks' exit
10972 status for at least the command
10973 .Ic spamrate
10974 .Pf ( Ql 0
10975 meaning a message is spam,
10976 .Ql 1
10977 for non-spam,
10978 .Ql 2
10979 for unsure and any other return value indicating a hard error);
10980 since the hooks can include shell code snippets diverting behaviour
10981 can be intercepted as necessary.
10982 The hooks are
10983 .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \
10984   spamfilter-rate
10986 .Va spamfilter-spam ;
10987 the manual section
10988 .Sx "Handling spam"
10989 contains examples for some programs.
10990 The process environment of the hooks will have the variable
10991 .Ev MAILX_FILENAME_GENERATED
10992 set.
10993 Note that spam score support for
10994 .Ic spamrate
10995 is not supported unless the \*(OPtional regular expression support is
10996 available and the
10997 .Va spamfilter-rate-scanscore
10998 variable is set.
11003 .It Va spam-maxsize
11004 \*(OP Messages that exceed this size will not be passed through to the
11005 configured
11006 .Va spam-interface .
11007 If unset or 0, the default of 420000 bytes is used.
11010 .It Va spamc-command
11011 \*(OP The path to the
11012 .Xr spamc 1
11013 program for the
11014 .Ql spamc
11015 .Va spam-interface .
11016 Note that the path is not expanded, but used
11017 .Dq as is .
11018 A fallback path will have been compiled into the \*(UA binary if the
11019 executable had been found during compilation.
11022 .It Va spamc-arguments
11023 \*(OP Even though \*(UA deals with most arguments for the
11024 .Ql spamc
11025 .Va spam-interface
11026 automatically, it may at least sometimes be desirable to specify
11027 connection-related ones via this variable, e.g.,
11028 .Ql -d server.example.com -p 783 .
11031 .It Va spamc-user
11032 \*(OP Specify a username for per-user configuration files for the
11033 .Ql spamc
11034 .Va spam-interface .
11035 If this is set to the empty string then \*(UA will use the name of the
11036 current
11037 .Va user .
11044 .It Va spamfilter-ham , spamfilter-noham , \
11045   spamfilter-nospam , spamfilter-rate , spamfilter-spam
11046 \*(OP Command and argument hooks for the
11047 .Ql filter
11048 .Va spam-interface .
11049 The manual section
11050 .Sx "Handling spam"
11051 contains examples for some programs.
11054 .It Va spamfilter-rate-scanscore
11055 \*(OP Because of the generic nature of the
11056 .Ql filter
11057 .Va spam-interface
11058 spam scores are not supported for it by default, but if the \*(OPnal
11059 regular expression support is available then setting this variable can
11060 be used to overcome this restriction.
11061 It is interpreted as follows: first a number (digits) is parsed that
11062 must be followed by a semicolon
11063 .Ql \&;
11064 and an extended regular expression.
11065 Then the latter is used to parse the first output line of the
11066 .Va spamfilter-rate
11067 hook, and, in case the evaluation is successful, the group that has been
11068 specified via the number is interpreted as a floating point scan score.
11072 .It Va ssl-ca-dir , ssl-ca-file
11073 \*(OP Specify the location of trusted CA certificates in PEM (Privacy
11074 Enhanced Mail) format as a directory and a file, respectively, for the
11075 purpose of verification of SSL/TLS server certificates.
11076 It is possible to set both, the file will be loaded immediately, the
11077 directory will be searched whenever no match has yet been found.
11078 The set of CA certificates which are built into the SSL/TLS library can
11079 be explicitly turned off by setting
11080 .Va ssl-ca-no-defaults ,
11081 and further fine-tuning is possible via
11082 .Va ssl-ca-flags ;
11083 also see
11084 .Xr SSL_CTX_load_verify_locations 3
11085 for more information.
11086 \*(UA will try to use the TLS/SNI (ServerNameIndication) extension when
11087 establishing TLS connections to servers identified with hostnames.
11091 .It Va ssl-ca-flags
11092 \*(OP Can be used to fine-tune behaviour of the X509 CA certificate
11093 storage, and the certificate verification that is used (also see
11094 .Va ssl-verify ) .
11095 The value is expected to consist of a comma-separated list of
11096 configuration directives, with any intervening whitespace being ignored.
11097 The directives directly map to flags that can be passed to
11098 .Xr X509_STORE_set_flags 3 ,
11099 which are usually defined in a file
11100 .Pa openssl/x509_vfy.h ,
11101 and the availability of which depends on the used SSL/TLS library
11102 version: a directive without mapping is ignored (error log subject to
11103 .Va debug ) .
11104 Directives currently understood (case-insensitively) include:
11107 .Bl -tag -compact -width ".It Cd BaNg"
11108 .It Cd no-alt-chains
11109 If the initial chain is not trusted, do not attempt to build an
11110 alternative chain.
11111 Setting this flag will make OpenSSL certificate verification match that
11112 of older OpenSSL versions, before automatic building and checking of
11113 alternative chains has been implemented; also see
11114 .Cd trusted-first .
11115 .It Cd no-check-time
11116 Do not check certificate/CRL validity against current time.
11117 .It Cd partial-chain
11118 By default partial, incomplete chains which cannot be verified up to the
11119 chain top, a self-signed root certificate, will not verify.
11120 With this flag set, a chain succeeds to verify if at least one signing
11121 certificate of the chain is in any of the configured trusted stores of
11122 CA certificates.
11123 The OpenSSL manual page
11124 .Xr SSL_CTX_load_verify_locations 3
11125 gives some advise how to manage your own trusted store of CA certificates.
11126 .It Cd strict
11127 Disable workarounds for broken certificates.
11128 .It Cd trusted-first
11129 Try building a chain using issuers in the trusted store first to avoid
11130 problems with server-sent legacy intermediate certificates.
11131 Newer versions of OpenSSL support alternative chain checking and enable
11132 it by default, resulting in the same behaviour; also see
11133 .Cd no-alt-chains .
11138 .It Va ssl-ca-no-defaults
11139 \*(BO\*(OP Do not load the default CA locations that are built into the
11140 used to SSL/TLS library to verify SSL/TLS server certificates.
11142 .Mx Va ssl-cert
11143 .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert
11144 \*(OP Variable chain that sets the filename for a SSL/TLS client
11145 certificate required by some servers.
11146 This is a direct interface to the
11147 .Ql Certificate
11148 slot of the
11149 .Xr SSL_CONF_cmd 3
11150 function of the OpenSSL library, if available.
11152 .Mx Va ssl-cipher-list
11153 .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list
11154 \*(OP Specifies a list of ciphers for SSL/TLS connections.
11155 This is a direct interface to the
11156 .Ql CipherString
11157 slot of the
11158 .Xr SSL_CONF_cmd 3
11159 function of the OpenSSL library, if available; see
11160 .Xr ciphers 1
11162 .Xr SSL_CTX_set_cipher_list 3
11163 for more information.
11164 By default \*(UA does not set a list of ciphers, in effect using a
11165 .Va ssl-protocol
11166 specific cipher (protocol standards ship with a list of acceptable
11167 ciphers), possibly cramped to what the actually used SSL/TLS library
11168 supports \(en the manual section
11169 .Sx "An example configuration"
11170 also contains a SSL/TLS use case.
11173 .It Va ssl-config-file
11174 \*(OP If this variable is set \*(UA will call
11175 .Xr CONF_modules_load_file 3
11176 to allow OpenSSL to be configured according to the host system wide
11177 security settings.
11178 If a non-empty value is given then this will be used to specify the
11179 configuration file to be used instead of the global OpenSSL default;
11180 note that in this case it is an error if the file cannot be loaded.
11181 The application name will always be passed as
11182 .Dq \*(uA .
11184 .Mx Va ssl-curves
11185 .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves
11186 \*(OP Specifies a list of supported curves for SSL/TLS connections.
11187 This is a direct interface to the
11188 .Ql Curves
11189 slot of the
11190 .Xr SSL_CONF_cmd 3
11191 function of the OpenSSL library, if available; see
11192 .Xr SSL_CTX_set1_curves_list 3
11193 for more information.
11194 By default \*(UA does not set a list of curves.
11198 .It Va ssl-crl-dir , ssl-crl-file
11199 \*(OP Specify a directory / a file, respectively that contains a CRL in
11200 PEM format to use when verifying SSL/TLS server certificates.
11202 .Mx Va ssl-key
11203 .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key
11204 \*(OP Variable chain that sets the filename for the private key of
11205 a SSL/TLS client certificate.
11206 If unset, the name of the certificate file is used.
11207 The file is expected to be in PEM format.
11208 This is a direct interface to the
11209 .Ql PrivateKey
11210 slot of the
11211 .Xr SSL_CONF_cmd 3
11212 function of the OpenSSL library, if available.
11214 .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method
11215 \*(OB\*(OP Please use the newer and more flexible
11216 .Va ssl-protocol
11217 instead: if both values are set,
11218 .Va ssl-protocol
11219 will take precedence!
11220 Can be set to the following values, the actually used
11221 .Va ssl-protocol
11222 specification to which it is mapped is shown in parenthesis:
11223 .Ql tls1.2
11224 .Pf ( Ql -ALL, TLSv1.2 ) ,
11225 .Ql tls1.1
11226 .Pf ( Ql -ALL, TLSv1.1 ) ,
11227 .Ql tls1
11228 .Pf ( Ql -ALL, TLSv1 )
11230 .Ql ssl3
11231 .Pf ( Ql -ALL, SSLv3 ) ;
11232 the special value
11233 .Ql auto
11234 is mapped to
11235 .Ql ALL, -SSLv2
11236 and thus includes the SSLv3 protocol.
11237 Note that SSLv2 is no longer supported at all.
11239 .Mx Va ssl-protocol
11240 .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol
11241 \*(OP Specify the used SSL/TLS protocol.
11242 This is a direct interface to the
11243 .Ql Protocol
11244 slot of the
11245 .Xr SSL_CONF_cmd 3
11246 function of the OpenSSL library, if available;
11247 otherwise an \*(UA internal parser is used which understands the
11248 following subset of (case-insensitive) command strings:
11249 .Ql SSLv3 ,
11250 .Ql TLSv1 ,
11251 .Ql TLSv1.1
11253 .Ql TLSv1.2 ,
11254 as well as the special value
11255 .Ql ALL .
11256 Multiple specifications may be given via a comma-separated list which
11257 ignores any whitespace.
11258 An optional
11259 .Ql +
11260 plus sign prefix will enable a protocol, a
11261 .Ql -
11262 hyphen-minus prefix will disable it, so that
11263 .Ql -ALL, TLSv1.2
11264 will enable only the TLSv1.2 protocol.
11266 It depends upon the used TLS/SSL library which protocols are actually
11267 supported and which protocols are used if
11268 .Va ssl-protocol
11269 is not set, but note that SSLv2 is no longer supported at all and
11270 actively disabled.
11271 Especially for older protocols explicitly securing
11272 .Va ssl-cipher-list
11273 may be worthwile, see
11274 .Sx "An example configuration" .
11277 .It Va ssl-rand-egd
11278 \*(OP Gives the pathname to an entropy daemon socket, see
11279 .Xr RAND_egd 3 .
11280 Not all SSL/TLS libraries support this.
11283 .It Va ssl-rand-file
11284 \*(OP Gives the filename to a file with random entropy data, see
11285 .Xr RAND_load_file 3 .
11286 If this variable is not set, or set to the empty string, or if the
11287 .Sx "Filename transformations"
11288 fail, then
11289 .Xr RAND_file_name 3
11290 will be used to create the filename if, and only if,
11291 .Xr RAND_status 3
11292 documents that the SSL PRNG is not yet sufficiently seeded.
11293 If \*(UA successfully seeded the SSL PRNG then it will update the file
11294 .Pf ( Xr RAND_write_file 3 ) .
11295 This variable is only used if
11296 .Va ssl-rand-egd
11297 is not set (or not supported by the SSL/TLS library).
11299 .Mx Va ssl-verify
11300 .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify
11301 \*(OP Variable chain that sets the action to be performed if an error
11302 occurs during SSL/TLS server certificate validation against the
11303 specified or default trust stores
11304 .Va ssl-ca-dir ,
11305 .Va ssl-ca-file ,
11306 or the SSL/TLS library built-in defaults (unless usage disallowed via
11307 .Va ssl-ca-no-defaults ) ,
11308 and as fine-tuned via
11309 .Va ssl-ca-flags .
11310 Valid (case-insensitive) values are
11311 .Ql strict
11312 (fail and close connection immediately),
11313 .Ql ask
11314 (ask whether to continue on standard input),
11315 .Ql warn
11316 (show a warning and continue),
11317 .Ql ignore
11318 (do not perform validation).
11319 The default is
11320 .Ql ask .
11323 .It Va stealthmua
11324 If only set without an assigned value, then this setting inhibits the
11325 generation of the
11326 .Ql Message-ID: ,
11327 .Ql Content-ID:
11329 .Ql User-Agent:
11330 header fields that include obvious references to \*(UA.
11331 There are two pitfalls associated with this:
11332 First, the message id of outgoing messages is not known anymore.
11333 Second, an expert may still use the remaining information in the header
11334 to track down the originating mail user agent.
11335 If set to the value
11336 .Ql noagent ,
11337 then the mentioned
11338 .Ql Message-ID:
11340 .Ql Content-ID:
11341 suppression does not occur.
11345 .It Va termcap
11346 (\*(OP) This specifies a comma-separated list of
11347 .Lb libterminfo
11348 and/or
11349 .Lb libtermcap
11350 capabilities (see
11351 .Sx "On terminal control and line editor" ,
11352 escape commas with reverse solidus) to be used to overwrite or define
11353 entries.
11354 .Sy Note
11355 this variable will only be queried once at program startup and can
11356 thus only be specified in resource files or on the command line.
11359 String capabilities form
11360 .Ql cap=value
11361 pairs and are expected unless noted otherwise.
11362 Numerics have to be notated as
11363 .Ql cap#number
11364 where the number is expected in normal decimal notation.
11365 Finally, booleans do not have any value but indicate a true or false
11366 state simply by being defined or not; this indeed means that \*(UA
11367 does not support undefining an existing boolean.
11368 String capability values will undergo some expansions before use:
11369 for one notations like
11370 .Ql ^LETTER
11371 stand for
11372 .Ql control-LETTER ,
11373 and for clarification purposes
11374 .Ql \eE
11375 can be used to specify
11376 .Ql escape
11377 (the control notation
11378 .Ql ^[
11379 could lead to misreadings when a left bracket follows, which it does for
11380 the standard CSI sequence);
11381 finally three letter octal sequences, as in
11382 .Ql \e061 ,
11383 are supported.
11384 To specify that a terminal supports 256-colours, and to define sequences
11385 that home the cursor and produce an audible bell, one might write:
11387 .Bd -literal -offset indent
11388 ? set termcap='Co#256,home=\eE[H,bel=^G'
11392 The following terminal capabilities are or may be meaningful for the
11393 operation of the built-in line editor or \*(UA in general:
11396 .Bl -tag -compact -width ".It Cd yay"
11397 .\" HAVE_COLOUR
11398 .It Cd colors Ns \0or Cd Co
11399 .Cd max_colors :
11400 numeric capability specifying the maximum number of colours.
11401 Note that \*(UA does not actually care about the terminal beside that,
11402 but always emits ANSI / ISO 6429 escape sequences.
11404 .\" HAVE_TERMCAP
11405 .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti
11406 .Cd exit_ca_mode
11408 .Cd enter_ca_mode ,
11409 respectively: exit and enter the alternative screen ca-mode,
11410 effectively turning \*(UA into a fullscreen application.
11411 This must be enabled explicitly by setting
11412 .Va termcap-ca-mode .
11414 .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke
11415 .Cd keypad_xmit
11417 .Cd keypad_local ,
11418 respectively: enable and disable the keypad.
11419 This is always enabled if available, because it seems even keyboards
11420 without keypads generate other key codes for, e.g., cursor keys in that
11421 case, and only if enabled we see the codes that we are interested in.
11423 .It Cd ed Ns \0or Cd cd
11424 .Cd clr_eos :
11425 clear the screen.
11427 .It Cd clear Ns \0or Cd cl
11428 .Cd clear_screen :
11429 clear the screen and home cursor.
11430 (Will be simulated via
11431 .Cd ho
11432 plus
11433 .Cd cd . )
11435 .It Cd home Ns \0or Cd ho
11436 .Cd cursor_home :
11437 home cursor.
11439 .\" HAVE_MLE
11440 .It Cd el Ns \0or Cd ce
11441 .Cd clr_eol :
11442 clear to the end of line.
11443 (Will be simulated via
11444 .Cd ch
11445 plus repetitions of space characters.)
11447 .It Cd hpa Ns \0or Cd ch
11448 .Cd column_address :
11449 move the cursor (to the given column parameter) in the current row.
11450 (Will be simulated via
11451 .Cd cr
11452 plus
11453 .Cd nd . )
11455 .It Cd cr
11456 .Cd carriage_return :
11457 move to the first column in the current row.
11458 The default built-in fallback is
11459 .Ql \er .
11461 .It Cd cub1 Ns \0or Cd le
11462 .Cd cursor_left :
11463 move the cursor left one space (non-destructively).
11464 The default built-in fallback is
11465 .Ql \eb .
11467 .It Cd cuf1 Ns \0or Cd nd
11468 .Cd cursor_right :
11469 move the cursor right one space (non-destructively).
11470 The default built-in fallback is
11471 .Ql \eE[C ,
11472 which is used by most terminals.
11473 Less often occur
11474 .Ql \eEC
11476 .Ql \eEOC .
11480 Many more capabilities which describe key-sequences are documented for
11481 .Ic bind .
11485 .It Va termcap-ca-mode
11486 \*(OP Allow usage of the
11487 .Cd exit_ca_mode
11489 .Cd enter_ca_mode
11490 terminal capabilities, effectively turning \*(UA into a fullscreen
11491 application, as documented for
11492 .Va termcap .
11493 .Sy Note
11494 this variable will only be queried once at program startup and can
11495 thus only be specified in resource files or on the command line.
11498 .It Va termcap-disable
11499 \*(OP Disable any interaction with a terminal control library.
11500 If set only some generic fallback built-ins and possibly the content of
11501 .Va termcap
11502 describe the terminal to \*(UA.
11503 .Sy Note
11504 this variable will only be queried once at program startup and can
11505 thus only be specified in resource files or on the command line.
11508 .It Va toplines
11509 If defined, gives the number of lines of a message to be displayed
11510 with the command
11511 .Ic top ;
11512 if unset, the first five lines are printed, if set to 0 the variable
11513 .Va screen
11514 is inspected.
11515 If the value is negative then its absolute value will be used for
11516 unsigned right shifting (see
11517 .Ic vexpr )
11519 .Va screen
11520 height.
11523 .It Va topsqueeze
11524 \*(BO If set then the
11525 .Ic top
11526 command series will strip adjacent empty lines and quotations.
11529 .It Va ttycharset
11530 The character set of the terminal \*(UA operates on,
11531 and the one and only supported character set that \*(UA can use if no
11532 character set conversion capabilities have been compiled into it,
11533 in which case it defaults to ISO-8859-1 unless it can deduce a value
11534 from the locale specified in the
11535 .Ev LC_CTYPE
11536 environment variable (if supported, see there for more).
11537 It defaults to UTF-8 if conversion is available.
11538 Refer to the section
11539 .Sx "Character sets"
11540 for the complete picture about character sets.
11543 .It Va typescript-mode
11544 \*(BO A special multiplex variable that disables all variables and
11545 settings which result in behaviour that interferes with running \*(UA in
11546 .Xr script 1 ,
11547 e.g., it sets
11548 .Va colour-disable ,
11549 .Va line-editor-disable
11550 and (before startup completed only)
11551 .Va termcap-disable .
11552 Unsetting it does not restore the former state of the covered settings.
11555 .It Va umask
11556 For a safety-by-default policy \*(UA sets its process
11557 .Xr umask 2
11559 .Ql 0077 ,
11560 but this variable can be used to override that:
11561 set it to an empty value to do not change the (current) setting (on
11562 startup), otherwise the process file mode creation mask is updated to
11563 the new value.
11564 Child processes inherit the process file mode creation mask.
11566 .Mx Va user
11567 .It Va user-HOST , user
11568 \*(IN Variable chain that sets a global fallback user name, which is
11569 used in case none has been given in the protocol and account-specific
11570 URL.
11571 This variable defaults to the name of the user who runs \*(UA.
11574 .It Va v15-compat
11575 \*(BO Setting this enables upward compatibility with \*(UA
11576 version 15.0 in respect to which configuration options are available and
11577 how they are handled.
11578 This manual uses \*(IN and \*(OU to refer to the new and the old way of
11579 doing things, respectively.
11582 .It Va verbose
11583 \*(BO This setting, also controllable via the command line option
11584 .Fl v ,
11585 causes \*(UA to be more verbose, e.g., it will display obsoletion
11586 warnings and SSL/TLS certificate chains.
11587 Even though marked \*(BO this option may be set twice in order to
11588 increase the level of verbosity even more, in which case even details of
11589 the actual message delivery and protocol conversations are shown.
11590 A single
11591 .Pf no Va verbose
11592 is sufficient to disable verbosity as such.
11599 .It Va version , version-date , version-major , version-minor , version-update
11600 \*(RO \*(UA version information: the first variable contains a string
11601 containing the complete version identification, the latter three contain
11602 only digits: the major, minor and update version numbers.
11603 The date is in ISO 8601 notation.
11604 The output of the command
11605 .Ic version
11606 will include this information.
11609 .It Va writebackedited
11610 If this variable is set messages modified using the
11611 .Ic edit
11613 .Ic visual
11614 commands are written back to the current folder when it is quit;
11615 it is only honoured for writable folders in MBOX format, though.
11616 Note that the editor will be pointed to the raw message content in that
11617 case, i.e., neither MIME decoding nor decryption will have been
11618 performed, and proper RFC 4155
11619 .Ql From_
11620 quoting of newly added or edited content is also left as an excercise to
11621 the user.
11623 .\" }}} (Variables)
11625 .\" }}} (INTERNAL VARIABLES)
11628 .\" .Sh ENVIRONMENT {{{
11629 .Sh ENVIRONMENT
11631 The term
11632 .Dq environment variable
11633 should be considered an indication that these variables are either
11634 standardized as vivid parts of process environments, or that they are
11635 commonly found in there.
11636 The process environment is inherited from the
11637 .Xr sh 1
11638 once \*(UA is started, and unless otherwise explicitly noted handling of
11639 the following variables transparently integrates into that of the
11640 .Sx "INTERNAL VARIABLES"
11641 from \*(UA's point of view.
11642 This means that, e.g., they can be managed via
11643 .Ic set
11645 .Ic unset ,
11646 causing automatic program environment updates (to be inherited by
11647 newly created child processes).
11650 In order to transparently integrate other environment variables equally
11651 they need to be imported (linked) with the command
11652 .Ic environ .
11653 This command can also be used to set and unset non-integrated
11654 environment variables from scratch, sufficient system support provided.
11655 The following example, applicable to a POSIX shell, sets the
11656 .Ev COLUMNS
11657 environment variable for \*(UA only, and beforehand exports the
11658 .Ev EDITOR
11659 in order to affect any further processing in the running shell:
11661 .Bd -literal -offset indent
11662 $ EDITOR="vim -u ${HOME}/.vimrc"
11663 $ export EDITOR
11664 $ COLUMNS=80 \*(uA -R
11667 .Bl -tag -width ".It Ev BaNg"
11669 .It Ev COLUMNS
11670 The user's preferred width in column positions for the terminal screen
11671 or window.
11672 Queried and used once on program startup, actively managed for child
11673 processes and the MLE (see
11674 .Sx "On terminal control and line editor" )
11675 in interactive mode thereafter.
11676 Ignored in non-interactive mode, which always uses 80 columns, unless in
11677 .fl #
11678 batch mode.
11681 .It Ev DEAD
11682 The name of the (mailbox)
11683 .Ic file
11684 to use for saving aborted messages if
11685 .Va save
11686 is set; this defaults to
11687 .Pa dead.letter
11688 in the user's
11689 .Ev HOME
11690 directory.
11691 If the variable
11692 .Va debug
11693 is set no output will be generated, otherwise the contents of the file
11694 will be replaced.
11697 .It Ev EDITOR
11698 Pathname of the text editor to use in the
11699 .Ic edit
11700 command and
11701 .Ic ~e
11702 .Sx "COMMAND ESCAPES" .
11703 A default editor is used if this value is not defined.
11706 .It Ev HOME
11707 The user's home directory.
11708 This variable is only used when it resides in the process environment.
11709 The calling user's home directory will be used instead if this directory
11710 does not exist, is not accessible or cannot be read.
11711 (No test for being writable is performed to allow usage by
11712 non-privileged users within read-only jails, but dependent on the
11713 variable settings this directory is a default write target, e.g. for
11714 .Ev DEAD ,
11715 .Ev MBOX
11716 and more.)
11721 .It Ev LC_ALL , LC_CTYPE , LANG
11722 \*(OP The (names in lookup order of the)
11723 .Xr locale 7
11724 (and / or see
11725 .Xr setlocale 3 )
11726 which indicates the used
11727 .Sx "Character sets" .
11728 Runtime changes trigger automatic updates of the entire locale system,
11729 updating and overwriting also a
11730 .Va ttycharset
11731 set by the user.
11734 .It Ev LINES
11735 The user's preferred number of lines on a page or the vertical screen
11736 or window size in lines.
11737 Queried and used once on program startup, actively managed for child
11738 processes in interactive mode thereafter.
11739 Ignored in non-interactive mode, which always uses 24 lines, unless in
11740 .fl #
11741 batch mode.
11744 .It Ev LISTER
11745 Pathname of the directory lister to use in the
11746 .Ic folders
11747 command when operating on local mailboxes.
11748 Default is
11749 .Xr ls 1
11750 (path search through
11751 .Ev SHELL ) .
11754 .It Ev LOGNAME
11755 Upon startup \*(UA will actively ensure that this variable refers to the
11756 name of the user who runs \*(UA, in order to be able to pass a verified
11757 name to any newly created child process.
11760 .It Ev MAIL
11761 Is used as the users
11762 .Mx -sx
11763 .Sx "primary system mailbox"
11764 unless
11765 .Va inbox
11766 is set.
11767 This is assumed to be an absolute pathname.
11770 .It Ev MAILCAPS
11771 \*(OP Overrides the default path search for
11772 .Sx "The Mailcap files" ,
11773 which is defined in the standard RFC 1524 as
11774 .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap .
11775 .\" TODO we should have a mailcaps-default virtual RDONLY option!
11776 (\*(UA makes it a configuration option, however.)
11777 Note this is not a search path, but a path search.
11780 .It Ev MAILRC
11781 Is used as a startup file instead of
11782 .Pa \*(ur
11783 if set.
11784 When \*(UA scripts are invoked on behalf of other users,
11785 either this variable should be set to
11786 .Pa /dev/null
11787 or the
11788 .Fl \&:
11789 command line option should be used in order to avoid side-effects from
11790 reading their configuration files.
11791 This variable is only used when it resides in the process environment.
11794 .It Ev MAILX_NO_SYSTEM_RC
11795 If this variable is set then reading of
11796 .Pa \*(UR
11797 at startup is inhibited, i.e., the same effect is achieved as if \*(UA
11798 had been started up with the option
11799 .Fl \&:
11800 (and according argument) or
11801 .Fl n .
11802 This variable is only used when it resides in the process environment.
11805 .It Ev MBOX
11806 The name of the users
11807 .Mx -sx
11808 .Sx "secondary mailbox"
11809 file.
11810 A logical subset of the special
11811 .Sx "Filename transformations"
11812 (also see
11813 .Ic file )
11814 are supported.
11815 The default is
11816 .Pa ~/mbox .
11817 Traditionally this MBOX is used as the file to save messages from the
11818 .Mx -sx
11819 .Sx "primary system mailbox"
11820 that have been read.
11821 Also see
11822 .Sx "Message states" .
11825 .It Ev NETRC
11826 \*(IN\*(OP This variable overrides the default location of the user's
11827 .Pa ~/.netrc
11828 file.
11831 .It Ev PAGER
11832 Pathname of the program to use for backing the command
11833 .Ic more ,
11834 and when the
11835 .Va crt
11836 variable enforces usage of a pager for output.
11837 The default paginator is
11838 .Xr more 1
11839 (path search through
11840 .Ev SHELL ) .
11842 \*(UA inspects the contents of this variable: if its contains the string
11843 .Dq less
11844 then a non-existing environment variable
11845 .Ev LESS
11846 will be set to
11847 .Ql Ri ,
11848 likewise for
11849 .Dq lv
11850 .Ev LV
11851 will optionally be set to
11852 .Ql -c .
11853 Alse see
11854 .Va colour-pager .
11857 .It Ev PATH
11858 A colon-separated list of directories that is searched by the shell when
11859 looking for commands, e.g.,
11860 .Ql /bin:/usr/bin:/usr/local/bin .
11863 .It Ev POSIXLY_CORRECT
11864 This variable is automatically looked for upon startup, see
11865 .Va posix
11866 for more.
11869 .It Ev SHELL
11870 The shell to use for the commands
11871 .Ic \&! ,
11872 .Ic shell ,
11874 .Ic ~!
11875 .Sx "COMMAND ESCAPES"
11876 and when starting subprocesses.
11877 A default shell is used if this environment variable is not defined.
11880 .It Ev SOURCE_DATE_EPOCH
11881 This specifies a time in seconds since the Unix epoch (1970-01-01) to be
11882 used in place of the current time.
11883 This variable is looked up upon program startup, and its existence will
11884 switch \*(UA to a completely reproducible mode which causes
11885 deterministic random numbers, a special fixed (non-existent?)
11886 .Ev LOGNAME
11887 and more to be used and set.
11888 It is to be used during development or by software packagers.
11889 \*(ID Currently an invalid setting is only ignored, rather than causing
11890 a program abortion.
11892 .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA
11895 .It Ev TERM
11896 \*(OP The terminal type for which output is to be prepared.
11897 For extended colour and font control please refer to
11898 .Sx "Coloured display" ,
11899 and for terminal management in general to
11900 .Sx "On terminal control and line editor" .
11903 .It Ev TMPDIR
11904 Used as directory for temporary files instead of
11905 .Pa /tmp ,
11906 if set, existent, accessible as well as read- and writable.
11907 This variable is only used when it resides in the process environment,
11908 but \*(UA will ensure at startup that this environment variable is
11909 updated to contain a usable temporary directory.
11912 .It Ev USER
11913 Identical to
11914 .Ev LOGNAME
11915 (see there), but this variable is not standardized, should therefore not
11916 be used, and is only corrected if already set.
11919 .It Ev VISUAL
11920 Pathname of the text editor to use in the
11921 .Ic visual
11922 command and
11923 .Ic ~v
11924 .Sx "COMMAND ESCAPES" .
11927 .\" }}}
11930 .\" .Sh FILES {{{
11931 .Sh FILES
11933 .\" file list {{{
11934 .Bl -tag -width ".It Pa BaNg"
11935 .It Pa \*(ur
11936 File giving initial commands, one of the
11937 .Sx "Resource files" .
11939 .It Pa \*(UR
11940 System wide initialization file, one of the
11941 .Sx "Resource files" .
11944 .It Pa ~/.mailcap
11945 \*(OP Personal MIME type handler definition file, see
11946 .Sx "The Mailcap files" .
11947 This location is part of the RFC 1524 standard search path, which is
11948 a configuration option and can be overridden via
11949 .Ev MAILCAPS .
11952 .It Pa /etc/mailcap
11953 \*(OP System wide MIME type handler definition file, see
11954 .Sx "The Mailcap files" .
11955 This location is part of the RFC 1524 standard search path, which is
11956 a configuration option and can be overridden via
11959 .It Pa ~/mbox
11960 The default value for
11961 .Ev MBOX .
11962 The actually used path is a configuration option.
11965 .It Pa ~/.mime.types
11966 Personal MIME types, see
11967 .Sx "The mime.types files" .
11968 The actually used path is a configuration option.
11971 .It Pa /etc/mime.types
11972 System wide MIME types, see
11973 .Sx "The mime.types files" .
11974 The actually used path is a configuration option.
11977 .It Pa ~/.netrc
11978 \*(IN\*(OP The default location of the users
11979 .Pa .netrc
11980 file \(en the section
11981 .Sx "The .netrc file"
11982 documents the file format.
11983 The actually used path is a configuration option and can be overridden via
11984 .Ev NETRC .
11987 .It Pa /dev/null
11988 The data sink
11989 .Xr null 4 .
11990 The actually used path is a compile-time constant.
11992 .\" }}}
11994 .\" .Ss "Resource files" {{{
11995 .Ss "Resource files"
11997 Upon startup \*(UA reads in several resource files:
11999 .Bl -tag -width ".It Pa BaNg"
12001 .It Pa \*(UR
12002 System wide initialization file.
12003 Reading of this file can be suppressed, either by using the
12004 .Fl \&:
12005 (and according argument) or
12006 .Fl n
12007 command line options, or by setting the
12008 .Sx ENVIRONMENT
12009 variable
12010 .Ev MAILX_NO_SYSTEM_RC .
12013 .It Pa \*(ur
12014 File giving initial commands.
12015 A different file can be chosen by setting the
12016 .Sx ENVIRONMENT
12017 variable
12018 .Ev MAILRC .
12019 Reading of this file can be suppressed with the
12020 .Fl \&:
12021 command line option.
12023 .It Va mailx-extra-rc
12024 Defines a startup file to be read after all other resource files.
12025 It can be used to specify settings that are not understood by other
12026 .Xr mailx 1
12027 implementations, for example.
12028 This variable is only honoured when defined in a resource file, e.g.,
12029 it is one of the
12030 .Sx "INTERNAL VARIABLES" .
12034 The content of these files is interpreted as follows:
12037 .Bl -bullet -compact
12039 The whitespace characters space, tabulator and newline,
12040 as well as those defined by the variable
12041 .Va ifs ,
12042 are removed from the beginning and end of input lines.
12044 Empty lines are ignored.
12046 Any other line is interpreted as a command.
12047 It may be spread over multiple input lines if the newline character is
12048 .Dq escaped
12049 by placing a reverse solidus character
12050 .Ql \e
12051 as the last character of the line; whereas any leading whitespace of
12052 follow lines is ignored, trailing whitespace before a escaped newline
12053 remains in the input.
12055 If the line (content) starts with the number sign
12056 .Ql #
12057 then it is a comment-command and also ignored.
12058 (The comment-command is a real command, which does nothing, and
12059 therefore the usual follow lines mechanism applies!)
12063 Unless \*(UA is about to enter interactive mode syntax errors that occur
12064 while loading these files are treated as errors and cause program exit.
12065 More files with syntactically equal content can be
12066 .Ic source Ns ed .
12067 The following, saved in a file, would be an examplary content:
12069 .Bd -literal -offset indent
12070  # This line is a comment command.  And y\e
12071     es, it is really continued here.
12072 set debug \e
12073     verbose
12074     set editheaders
12076 .\" }}}
12078 .\" .Ss "The mime.types files" {{{
12079 .Ss "The mime.types files"
12081 As stated in
12082 .Sx "HTML mail and MIME attachments"
12083 \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions)
12084 media types in order to classify message and attachment content.
12085 One source for them are
12086 .Pa mime.types
12087 files, the loading of which can be controlled by setting the variable
12088 .Va mimetypes-load-control .
12089 Another is the command
12090 .Ic mimetype ,
12091 which also offers access to \*(UAs MIME type cache.
12092 .Pa mime.types
12093 files have the following syntax:
12095 .Bd -literal -offset indent
12096 type/subtype extension [extension ...]
12097 # E.g., text/html html htm
12101 where
12102 .Ql type/subtype
12103 define the MIME media type, as standardized in RFC 2046:
12104 .Ql type
12105 is used to declare the general type of data, while the
12106 .Ql subtype
12107 specifies a specific format for that type of data.
12108 One or multiple filename
12109 .Ql extension Ns
12110 s, separated by whitespace, can be bound to the media type format.
12111 Comments may be introduced anywhere on a line with a number sign
12112 .Ql # ,
12113 causing the remaining line to be discarded.
12115 \*(UA also supports an extended, non-portable syntax in especially
12116 crafted files, which can be loaded via the alternative value syntax of
12117 .Va mimetypes-load-control ,
12118 and prepends an optional
12119 .Ql type-marker :
12122 .Dl [type-marker ]type/subtype extension [extension ...]
12125 The following type markers are supported:
12128 .Bl -tag -compact -width ".It Ar _n_u"
12129 .It Ar @
12130 Treat message parts with this content as plain text.
12131 .It Ar @t
12132 The same as plain
12133 .Ar @ .
12134 .It Ar @h
12135 Treat message parts with this content as HTML tagsoup.
12136 If the \*(OPal HTML-tagsoup-to-text converter is not available treat
12137 the content as plain text instead.
12138 .It Ar @H
12139 Likewise
12140 .Ar @h ,
12141 but instead of falling back to plain text require an explicit content
12142 handler to be defined.
12146 Further reading:
12147 for sending messages:
12148 .Ic mimetype ,
12149 .Va mime-allow-text-controls ,
12150 .Va mimetypes-load-control .
12151 For reading etc. messages:
12152 .Sx "HTML mail and MIME attachments" ,
12153 .Sx "The Mailcap files" ,
12154 .Ic mimetype ,
12155 .Va mime-counter-evidence ,
12156 .Va mimetypes-load-control ,
12157 .Va pipe-TYPE/SUBTYPE ,
12158 .Va pipe-EXTENSION .
12159 .\" }}}
12161 .\" .Ss "The Mailcap files" {{{
12162 .Ss "The Mailcap files"
12164 .\" TODO MAILCAP DISABLED
12165 .Sy This feature is not available in v14.9.0, sorry!
12166 RFC 1524 defines a
12167 .Dq User Agent Configuration Mechanism
12168 which \*(UA \*(OPally supports (see
12169 .Sx "HTML mail and MIME attachments" ) .
12170 It defines a file format to be used to inform mail user agent programs
12171 about the locally-installed facilities for handling various data
12172 formats, i.e., about commands and how they can be used to display, edit
12173 et cetera MIME part contents, as well as a default path search that
12174 includes multiple possible locations of
12175 .Dq mailcap
12176 files and the
12177 .Ev MAILCAPS
12178 environment variable that can be used to overwrite that (repeating here
12179 that it is not a search path, but instead a path search specification).
12180 Any existing files will be loaded in sequence, appending any content to
12181 the list of MIME type handler directives.
12184 .Dq Mailcap
12185 files consist of a set of newline separated entries.
12186 Comment lines start with a number sign
12187 .Ql #
12188 (in the first column!) and are ignored.
12189 Empty lines are also ignored.
12190 All other lines form individual entries that must adhere to the syntax
12191 described below.
12192 To extend a single entry (not comment) its line can be continued on
12193 follow lines if newline characters are
12194 .Dq escaped
12195 by preceding them with the reverse solidus character
12196 .Ql \e .
12197 The standard does not specify how leading whitespace of follow lines
12198 is to be treated, therefore \*(UA retains it.
12201 .Dq Mailcap
12202 entries consist of a number of semicolon
12203 .Ql \&;
12204 separated fields, and the reverse solidus
12205 .Ql \e
12206 character can be used to escape any following character including
12207 semicolon and itself.
12208 The first two fields are mandatory and must occur in the specified
12209 order, the remaining fields are optional and may appear in any order.
12210 Leading and trailing whitespace of content is ignored (removed).
12213 The first field defines the MIME
12214 .Ql TYPE/SUBTYPE
12215 the entry is about to handle (case-insensitively, and no reverse solidus
12216 escaping is possible in this field).
12217 If the subtype is specified as an asterisk
12218 .Ql *
12219 the entry is meant to match all subtypes of the named type, e.g.,
12220 .Ql audio/*
12221 would match any audio type.
12222 The second field defines the shell command which shall be used to
12223 .Dq display
12224 MIME parts of the given type; it is implicitly called the
12225 .Cd view
12226 command.
12229 For data
12230 .Dq consuming
12231 shell commands message (MIME part) data is passed via standard input
12232 unless the given shell command includes one or more instances of the
12233 (unquoted) string
12234 .Ql %s ,
12235 in which case these instances will be replaced with a temporary filename
12236 and the data will have been stored in the file that is being pointed to.
12237 Likewise, for data
12238 .Dq producing
12239 shell commands data is assumed to be generated on standard output unless
12240 the given command includes (one ore multiple)
12241 .Ql %s .
12242 In any case any given
12243 .Ql %s
12244 format is replaced with a(n already) properly quoted filename.
12245 Note that when a command makes use of a temporary file via
12246 .Ql %s
12247 then \*(UA will remove it again, as if the
12248 .Cd x-mailx-tmpfile ,
12249 .Cd x-mailx-tmpfile-fill
12251 .Cd x-mailx-tmpfile-unlink
12252 flags had been set; see below for more.
12255 The optional fields either define a shell command or an attribute (flag)
12256 value, the latter being a single word and the former being a keyword
12257 naming the field followed by an equals sign
12258 .Ql =
12259 succeeded by a shell command, and as usual for any
12260 .Dq Mailcap
12261 content any whitespace surrounding the equals sign will be removed, too.
12262 Optional fields include the following:
12265 .Bl -tag -width ".It Cd BaNg"
12266 .It Cd compose
12267 A program that can be used to compose a new body or body part in the
12268 given format.
12269 (Currently unused.)
12271 .It Cd composetyped
12272 Similar to the
12273 .Cd compose
12274 field, but is to be used when the composing program needs to specify the
12275 .Ql Content-type:
12276 header field to be applied to the composed data.
12277 (Currently unused.)
12279 .It Cd edit
12280 A program that can be used to edit a body or body part in the given
12281 format.
12282 (Currently unused.)
12284 .It Cd print
12285 A program that can be used to print a message or body part in the given
12286 format.
12287 (Currently unused.)
12289 .It Cd test
12290 Specifies a program to be run to test some condition, e.g., the machine
12291 architecture, or the window system in use, to determine whether or not
12292 this mailcap entry applies.
12293 If the test fails, a subsequent mailcap entry should be sought; also see
12294 .Cd x-mailx-test-once .
12297 .It Cd needsterminal
12298 This flag field indicates that the given shell command must be run on
12299 an interactive terminal.
12300 \*(UA will temporarily release the terminal to the given command in
12301 interactive mode, in non-interactive mode this entry will be entirely
12302 ignored; this flag implies
12303 .Cd x-mailx-noquote .
12306 .It Cd copiousoutput
12307 A flag field which indicates that the output of the
12308 .Cd view
12309 command will be an extended stream of textual output that can be
12310 (re)integrated into \*(UA's normal visual display.
12311 It is mutually exclusive with
12312 .Cd needsterminal .
12314 .It Cd textualnewlines
12315 A flag field which indicates that this type of data is line-oriented and
12316 that, if encoded in
12317 .Ql base64 ,
12318 all newlines should be converted to canonical form (CRLF) before
12319 encoding, and will be in that form after decoding.
12320 (Currently unused.)
12322 .It Cd nametemplate
12323 This field gives a filename format, in which
12324 .Ql %s
12325 will be replaced by a random string, the joined combination of which
12326 will be used as the filename denoted by
12327 .Ev MAILX_FILENAME_TEMPORARY .
12328 One could specify that a GIF file being passed to an image viewer should
12329 have a name ending in
12330 .Ql .gif
12331 by using
12332 .Ql nametemplate=%s.gif .
12333 Note that \*(UA ignores the name template unless that solely specifies
12334 a filename suffix that consists of (ASCII) alphabetic and numeric
12335 characters, the underscore and dot only.
12337 .It Cd x11-bitmap
12338 Names a file, in X11 bitmap (xbm) format, which points to an appropriate
12339 icon to be used to visually denote the presence of this kind of data.
12340 This field is not used by \*(UA.
12342 .It Cd description
12343 A textual description that describes this type of data.
12346 .It Cd x-mailx-even-if-not-interactive
12347 An extension flag test field \(em by default handlers without
12348 .Cd copiousoutput
12349 are entirely ignored in non-interactive mode, but if this flag is set
12350 then their use will be considered.
12351 It is an error if this flag is set for commands that use the flag
12352 .Cd needsterminal .
12355 .It Cd x-mailx-noquote
12356 An extension flag field that indicates that even a
12357 .Cd copiousoutput
12358 .Cd view
12359 command shall not be used to generate message quotes
12360 (as it would be by default).
12363 .It Cd x-mailx-async
12364 Extension flag field that denotes that the given
12365 .Cd view
12366 command shall be executed asynchronously, without blocking \*(UA.
12367 Cannot be used in conjunction with
12368 .Cd needsterminal .
12371 .It Cd x-mailx-test-once
12372 Extension flag which denotes whether the given
12373 .Cd test
12374 command shall be evaluated once only and the (boolean) result be cached.
12375 This is handy if some global unchanging condition is to be queried, like
12376 .Dq running under the X Window System .
12379 .It Cd x-mailx-tmpfile
12380 Extension flag field that requests creation of a zero-sized temporary
12381 file, the name of which is to be placed in the environment variable
12382 .Ev MAILX_FILENAME_TEMPORARY .
12383 It is an error to use this flag with commands that include a
12384 .Ql %s
12385 format.
12388 .It Cd x-mailx-tmpfile-fill
12389 Normally the MIME part content is passed to the handler via standard
12390 input; if this flag is set then the data will instead be written into
12391 the implied
12392 .Cd x-mailx-tmpfile .
12393 In order to cause deletion of the temporary file you will have to set
12394 .Cd x-mailx-tmpfile-unlink
12395 explicitly!
12396 It is an error to use this flag with commands that include a
12397 .Ql %s
12398 format.
12401 .It Cd x-mailx-tmpfile-unlink
12402 Extension flag field that requests that the temporary file shall be
12403 deleted automatically when the command loop is entered again at latest.
12404 (Do not use this for asynchronous handlers.)
12405 It is an error to use this flag with commands that include a
12406 .Ql %s
12407 format, or in conjunction with
12408 .Cd x-mailx-async ,
12409 or without also setting
12410 .Cd x-mailx-tmpfile
12412 .Cd x-mailx-tmpfile-fill .
12415 .It Cd x-mailx-tmpfile-keep
12416 Using the string
12417 .Ql %s
12418 implies the three tmpfile related flags above, but if you want, e.g.,
12419 .Cd x-mailx-async
12420 and deal with the temporary file yourself, you can add in this flag to
12421 forcefully ignore
12422 .Cd x-mailx-tmpfile-unlink .
12427 The standard includes the possibility to define any number of additional
12428 entry fields, prefixed by
12429 .Ql x- .
12430 Flag fields apply to the entire
12431 .Dq Mailcap
12432 entry \(em in some unusual cases, this may not be desirable, but
12433 differentiation can be accomplished via separate entries, taking
12434 advantage of the fact that subsequent entries are searched if an earlier
12435 one does not provide enough information.
12436 E.g., if a
12437 .Cd view
12438 command needs to specify the
12439 .Cd needsterminal
12440 flag, but the
12441 .Cd compose
12442 command shall not, the following will help out the latter (with enabled
12443 .Va debug
12444 or an increased
12445 .Va verbose
12446 level \*(UA will show information about handler evaluation):
12448 .Bd -literal -offset indent
12449 application/postscript; ps-to-terminal %s; needsterminal
12450 application/postscript; ps-to-terminal %s; compose=idraw %s
12454 In fields any occurrence of the format string
12455 .Ql %t
12456 will be replaced by the
12457 .Ql TYPE/SUBTYPE
12458 specification.
12459 Named parameters from the
12460 .Ql Content-type:
12461 field may be placed in the command execution line using
12462 .Ql %{
12463 followed by the parameter name and a closing
12464 .Ql }
12465 character.
12466 The entire parameter should appear as a single command line argument,
12467 regardless of embedded spaces; thus:
12469 .Bd -literal -offset indent
12470 # Message
12471 Content-type:  multipart/mixed; boundary=42
12473 # Mailcap file
12474 multipart/*; /usr/local/bin/showmulti \e
12475   %t %{boundary}  ;  composetyped  = /usr/local/bin/makemulti
12477 # Executed shell command
12478 /usr/local/bin/showmulti multipart/mixed 42
12482 .\" TODO v15: Mailcap: %n,%F
12483 Note that \*(UA does not support handlers for multipart MIME parts as
12484 shown in this example (as of today).
12485 \*(UA does not support the additional formats
12486 .Ql %n
12488 .Ql %F .
12489 An example file, also showing how to properly deal with the expansion of
12490 .Ql %s ,
12491 which includes any quotes that are necessary to make it a valid shell
12492 argument by itself and thus will cause undesired behaviour when placed
12493 in additional user-provided quotes:
12495 .Bd -literal -offset indent
12496 # Comment line
12497 text/richtext; richtext %s; copiousoutput
12499 text/x-perl; perl -cWT %s
12501 application/pdf; \e
12502   infile=%s\e; \e
12503     trap "rm -f ${infile}" EXIT\e; \e
12504     trap "exit 75" INT QUIT TERM\e; \e
12505     mupdf %s; \e
12506   x-mailx-async; x-mailx-tmpfile-keep
12508 application/*; echo "This is \e"%t\e" but \e
12509     is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vET; \e
12510   copiousoutput; x-mailx-noquote
12514 Further reading:
12515 .Sx "HTML mail and MIME attachments" ,
12516 .Sx "The mime.types files" ,
12517 .Ic mimetype ,
12518 .Ev MAILCAPS ,
12519 .Va mime-counter-evidence ,
12520 .Va pipe-TYPE/SUBTYPE ,
12521 .Va pipe-EXTENSION .
12522 .\" }}}
12524 .\" .Ss "The .netrc file" {{{
12525 .Ss "The .netrc file"
12528 .Pa .netrc
12529 file contains user credentials for machine accounts.
12530 The default location in the user's
12531 .Ev HOME
12532 directory may be overridden by the
12533 .Ev NETRC
12534 environment variable.
12535 The file consists of space, tabulator or newline separated tokens.
12536 \*(UA implements a parser that supports a superset of the original BSD
12537 syntax, but users should nonetheless be aware of portability glitches
12538 of that file format, shall their
12539 .Pa .netrc
12540 be usable across multiple programs and platforms:
12543 .Bl -bullet -compact
12545 BSD does not support single, but only double quotation marks, e.g.,
12546 .Ql password="pass with spaces" .
12548 BSD (only?) supports escaping of single characters via a reverse solidus
12549 (e.g., a space can be escaped via
12550 .Ql \e\0 ) ,
12551 in- as well as outside of a quoted string.
12553 BSD does not require a final quotation mark of the last user input token.
12555 The original BSD (Berknet) parser also supported a format which allowed
12556 tokens to be separated with commas \(en whereas at least Hewlett-Packard
12557 still seems to support this syntax, \*(UA does not!
12559 As a non-portable extension some widely-used programs support
12560 shell-style comments: if an input line starts, after any amount of
12561 whitespace, with a number sign
12562 .Ql # ,
12563 then the rest of the line is ignored.
12565 Whereas other programs may require that the
12566 .Pa .netrc
12567 file is accessible by only the user if it contains a
12568 .Cd password
12569 token for any other
12570 .Cd login
12571 than
12572 .Dq anonymous ,
12573 \*(UA will always require these strict permissions.
12577 Of the following list of supported tokens \*(UA only uses (and caches)
12578 .Cd machine ,
12579 .Cd login
12581 .Cd password .
12582 At runtime the command
12583 .Ic netrc
12584 can be used to control \*(UA's
12585 .Pa .netrc
12586 cache.
12588 .Bl -tag -width ".It Cd BaNg"
12589 .It Cd machine Ar name
12590 The hostname of the entries' machine, lowercase-normalized by \*(UA
12591 before use.
12592 Any further file content, until either end-of-file or the occurrence
12593 of another
12594 .Cd machine
12595 or a
12596 .Cd default
12597 first-class token is bound (only related) to the machine
12598 .Ar name .
12600 As an extension that should not be the cause of any worries
12601 \*(UA supports a single wildcard prefix for
12602 .Ar name :
12603 .Bd -literal -offset indent
12604 machine *.example.com login USER password PASS
12605 machine pop3.example.com login USER password PASS
12606 machine smtp.example.com login USER password PASS
12609 which would match
12610 .Ql xy.example.com
12611 as well as
12612 .Ql pop3.example.com ,
12613 but neither
12614 .Ql example.com
12616 .Ql local.smtp.example.com .
12617 Note that in the example neither
12618 .Ql pop3.example.com
12620 .Ql smtp.example.com
12621 will be matched by the wildcard, since the exact matches take
12622 precedence (it is however faster to specify it the other way around).
12624 .It Cd default
12625 This is the same as
12626 .Cd machine
12627 except that it is a fallback entry that is used shall none of the
12628 specified machines match; only one default token may be specified,
12629 and it must be the last first-class token.
12631 .It Cd login Ar name
12632 The user name on the remote machine.
12634 .It Cd password Ar string
12635 The user's password on the remote machine.
12637 .It Cd account Ar string
12638 Supply an additional account password.
12639 This is merely for FTP purposes.
12641 .It Cd macdef Ar name
12642 Define a macro.
12643 A macro is defined with the specified
12644 .Ar name ;
12645 it is formed from all lines beginning with the next line and continuing
12646 until a blank line is (consecutive newline characters are) encountered.
12647 (Note that
12648 .Cd macdef
12649 entries cannot be utilized by multiple machines, too, but must be
12650 defined following the
12651 .Ic machine
12652 they are intended to be used with.)
12653 If a macro named
12654 .Ar init
12655 exists, it is automatically run as the last step of the login process.
12656 This is merely for FTP purposes.
12658 .\" }}}
12660 .\" }}}
12663 .\" .Sh EXAMPLES {{{
12664 .Sh EXAMPLES
12666 .\" .Ss "An example configuration" {{{
12667 .Ss "An example configuration"
12669 .Bd -literal -offset indent
12670 # This example assumes v15.0 compatibility mode
12671 set v15-compat
12673 # Request strict transport security checks!
12674 set ssl-verify=strict
12676 # Where are the up-to-date SSL certificates?
12677 # (Since we manage up-to-date ones explicitly, do not use any,
12678 # possibly outdated, default certificates shipped with OpenSSL)
12679 #set ssl-ca-dir=/etc/ssl/certs
12680 set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
12681 set ssl-ca-no-defaults
12682 #set ssl-ca-flags=partial-chain
12683 wysh set smime-ca-file="${ssl-ca-file}" \e
12684   smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"
12686 # Do not use protocols older than TLS v1.2.
12687 # Change this only when the remote server does not support it:
12688 # maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
12689 # such explicit exceptions, then, e.g.
12690 #   set ssl-protocol-exam.ple='-ALL,+TLSv1.1'
12691 set ssl-protocol='-ALL,+TLSv1.2'
12693 # Explicitly define the list of ciphers, which may improve security,
12694 # especially with protocols older than TLS v1.2.  See ciphers(1).
12695 # Including "@STRENGTH" will sort the final list by algorithm strength.
12696 # In reality it is possibly best to only use ssl-cipher-list-HOST
12697 # (or -USER@HOST), as necessary, again..
12698 set ssl-cipher-list=TLSv1.2:!aNULL:!eNULL:@STRENGTH
12700 # - TLSv1.2:!aNULL:!eNULL:\e
12701 #     ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e
12702 #     DHE-RSA-AES256-SHA:@STRENGTH
12703 # -ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH
12704 # Especially with TLSv1.3 curves selection may be desired:
12705 #set ssl-curves=P-521:P-384:P-256
12707 # Essential setting: select allowed character sets
12708 set sendcharsets=utf-8,iso-8859-1
12710 # A very kind option: when replying to a message, first try to
12711 # use the same encoding that the original poster used herself!
12712 set reply-in-same-charset
12714 # When replying, do not merge From: and To: of the original message
12715 # into To:.  Instead old From: -> new To:, old To: -> merge Cc:.
12716 set recipients-in-cc
12718 # When sending messages, wait until the Mail-Transfer-Agent finishs.
12719 # Only like this you will be able to see errors reported through the
12720 # exit status of the MTA (including the built-in SMTP one)!
12721 set sendwait
12723 # Only use built-in MIME types, no mime.types(5) files
12724 set mimetypes-load-control
12726 # Default directory where we act in (relative to $HOME)
12727 set folder=mail
12728 # A leading "+" (often) means: under *folder*
12729 # *record* is used to save copies of sent messages
12730 set MBOX=+mbox.mbox DEAD=+dead.txt \e
12731   record=+sent.mbox record-files record-resent
12733 # Make "file mymbox" and "file myrec" go to..
12734 shortcut mymbox %:+mbox.mbox myrec +sent.mbox
12736 # Not really optional, e.g., for S/MIME
12737 set from='Your Name <address@exam.ple>'
12739 # It may be necessary to set hostname and/or smtp-hostname
12740 # if the "SERVER" of mta and "domain" of from do not match.
12741 # The `urlencode' command can be used to encode USER and PASS
12742 set mta=(smtps?|submission)://[USER[:PASS]@]SERVER[:PORT] \e
12743   smtp-auth=login/plain... \e
12744   smtp-use-starttls
12746 # Never refuse to start into interactive mode, and more
12747 set emptystart \e
12748   colour-pager crt= \e
12749   followup-to followup-to-honour=ask-yes \e
12750   history-file=+.\*(uAhist history-size=-1 history-gabby \e
12751   mime-counter-evidence=0xE \e
12752   prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e
12753   reply-to-honour=ask-yes \e
12754   umask=
12756 # Only include the selected header fields when typing messages
12757 headerpick type retain from_ date from to cc subject \e
12758   message-id mail-followup-to reply-to
12759 # ...when forwarding messages
12760 headerpick forward retain subject date from to cc
12761 # ...when saving message, etc.
12762 #headerpick save ignore ^Original-.*$ ^X-.*$
12764 # Some mailing lists
12765 mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$'
12766 mlsubscribe '^xfans@xfans\e.xyz$'
12768 # Handle a few file extensions (to store MBOX databases)
12769 filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e
12770   gz 'gzip -dc' 'gzip -c'  xz 'xz -dc' 'xz -zc' \e
12771   zst 'zstd -dc' 'zstd -19 -zc' \e
12772   zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e'
12774 # A real life example of a very huge free mail provider
12775 # Instead of directly placing content inside `account',
12776 # we `define' a macro: like that we can switch "accounts"
12777 # from within *on-compose-splice*, for example!
12778 define XooglX {
12779   set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent
12780   set from='Your Name <address@examp.ple>'
12782   set pop3-no-apop-pop.gmXil.com
12783   shortcut pop %:pop3s://pop.gmXil.com
12784   shortcut imap %:imaps://imap.gmXil.com
12786   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
12787   # Alternatively:
12788   set mta=smtps://USER:PASS@smtp.gmail.com:465
12790 account XooglX {
12791   \ecall XooglX
12794 # Here is a pretty large one which does not allow sending mails
12795 # if there is a domain name mismatch on the SMTP protocol level,
12796 # which would bite us if the value of from does not match, e.g.,
12797 # for people who have a sXXXXeforge project and want to speak
12798 # with the mailing list under their project account (in from),
12799 # still sending the message through their normal mail provider
12800 define XandeX {
12801   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12802   set from='Your Name <address@exam.ple>'
12804   shortcut pop %:pop3s://pop.yaXXex.ru
12806   set mta=smtps://USER:PASS@smtp.yaXXex.ru:465 \e
12807     hostname=yaXXex.com smtp-hostname=
12809 account XandeX {
12810   \ecall Xandex
12813 # Create some new commands so that, e.g., `ls /tmp' will..
12814 commandalias lls '!ls ${LS_COLOR_FLAG} -aFlrS'
12815 commandalias llS '!ls ${LS_COLOR_FLAG} -aFlS'
12817 # We do not support gpg(1) directly yet.  But simple --clearsign'd
12818 # message parts can be dealt with as follows:
12819 define V {
12820   localopts yes
12821   wysh set pipe-text/plain=$'@*#++=@\e
12822     < "${MAILX_FILENAME_TEMPORARY}" awk \e
12823         -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e
12824       BEGIN{done=0}\e
12825       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e
12826         if(done++ != 0)\e
12827           next;\e
12828         print "--- GPG --verify ---";\e
12829         system("gpg --verify " TMPFILE " 2>&1");\e
12830         print "--- GPG --verify ---";\e
12831         print "";\e
12832         next;\e
12833       }\e
12834       /^-----BEGIN PGP SIGNATURE-----/,\e
12835           /^-----END PGP SIGNATURE-----/{\e
12836         next;\e
12837       }\e
12838       {print}\e
12839     \e''
12840     print
12842 commandalias V '\e'call V
12846 When storing passwords in
12847 .Pa \*(ur
12848 appropriate permissions should be set on this file with
12849 .Ql $ chmod 0600 \*(ur .
12850 If the \*(OPal
12851 .Va netrc-lookup
12852 is available user credentials can be stored in the central
12853 .Pa .netrc
12854 file instead; e.g., here is a different version of the example account
12855 that sets up SMTP and POP3:
12857 .Bd -literal -offset indent
12858 define XandeX {
12859   set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent
12860   set from='Your Name <address@exam.ple>'
12861   set netrc-lookup
12862   # Load an encrypted ~/.netrc by uncommenting the next line
12863   #set netrc-pipe='gpg -qd ~/.netrc.pgp'
12865   set mta=smtps://smtp.yXXXXx.ru:465 \e
12866       smtp-hostname= hostname=yXXXXx.com
12867   set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru
12868   commandalias xp fi pop3s://pop.yXXXXx.ru
12870 account XandeX {
12871   \ecall XandeX
12876 and, in the
12877 .Pa .netrc
12878 file:
12880 .Bd -literal -offset indent
12881 machine *.yXXXXx.ru login USER password PASS
12885 This configuration should now work just fine:
12888 .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple
12889 .\" }}}
12891 .\" .Ss "S/MIME step by step" {{{
12892 .Ss "S/MIME step by step"
12894 \*(OP The first thing you need for participating in S/MIME message
12895 exchange is your personal certificate, including a private key.
12896 The certificate contains public information, in particular your name and
12897 your email address(es), and the public key that is used by others to
12898 encrypt messages for you,
12899 and to verify signed messages they supposedly received from you.
12900 The certificate is included in each signed message you send.
12901 The private key must be kept secret.
12902 It is used to decrypt messages that were previously encrypted with your
12903 public key, and to sign messages.
12906 For personal use it is recommended that you get a S/MIME certificate
12907 from one of the major CAs on the Internet using your WWW browser.
12908 Many CAs offer such certificates for free.
12909 There is also
12910 .Lk https://www.CAcert.org
12911 which issues client and server certificates to members of their
12912 community for free; their root certificate
12913 .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt )
12914 is often not in the default set of trusted CA root certificates, though,
12915 which means you will have to download their root certificate separately
12916 and ensure it is part of our S/MIME certificate validation chain by
12917 including it in
12918 .Va smime-ca-dir
12919 or as a vivid member of the
12920 .Va smime-ca-file .
12921 But let us take a step-by-step tour on how to setup S/MIME with
12922 a certificate from CAcert.org despite this situation!
12925 First of all you will have to become a member of the CAcert.org
12926 community, simply by registrating yourself via the web interface.
12927 Once you are, create and verify all email addresses you want to be able
12928 to create signed and encrypted messages for/with using the corresponding
12929 entries of the web interface.
12930 Now ready to create S/MIME certificates, so let us create a new
12931 .Dq client certificate ,
12932 ensure to include all email addresses that should be covered by the
12933 certificate in the following web form, and also to use your name as the
12934 .Dq common name .
12937 Create a private key and a certificate request on your local computer
12938 (please see the manual pages of the used commands for more in-depth
12939 knowledge on what the used arguments etc. do):
12942 .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem
12945 Afterwards copy-and-paste the content of
12946 .Dq creq.pem
12947 into the certificate-request (CSR) field of the web form on the
12948 CAcert.org website (you may need to unfold some
12949 .Dq advanced options
12950 to see the corresponding text field).
12951 This last step will ensure that your private key (which never left your
12952 box) and the certificate belong together (through the public key that
12953 will find its way into the certificate via the certificate-request).
12954 You are now ready and can create your CAcert certified certificate.
12955 Download and store or copy-and-paste it as
12956 .Dq pub.crt .
12959 Yay.
12960 In order to use your new S/MIME setup a combined private key/public key
12961 (certificate) file has to be created:
12964 .Dl $ cat key.pem pub.crt > ME@HERE.com.paired
12967 This is the file \*(UA will work with.
12968 If you have created your private key with a passphrase then \*(UA will
12969 ask you for it whenever a message is signed or decrypted.
12970 Set the following variables to henceforth use S/MIME (setting
12971 .Va smime-ca-file
12972 is of interest for verification only):
12974 .Bd -literal -offset indent
12975 ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e
12976     smime-sign-cert=ME@HERE.com.paired \e
12977     smime-sign-message-digest=SHA256 \e
12978     smime-sign
12981 .\" }}}
12983 .\" .Ss "Using CRLs with S/MIME or SSL/TLS" {{{
12984 .Ss "Using CRLs with S/MIME or SSL/TLS"
12986 \*(OP Certification authorities (CAs) issue certificate revocation
12987 lists (CRLs) on a regular basis.
12988 These lists contain the serial numbers of certificates that have been
12989 declared invalid after they have been issued.
12990 Such usually happens because the private key for the certificate has
12991 been compromised,
12992 because the owner of the certificate has left the organization that is
12993 mentioned in the certificate, etc.
12994 To seriously use S/MIME or SSL/TLS verification,
12995 an up-to-date CRL is required for each trusted CA.
12996 There is otherwise no method to distinguish between valid and
12997 invalidated certificates.
12998 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
12999 the Internet, so they have to be retrieved by some external mechanism.
13002 \*(UA accepts CRLs in PEM format only;
13003 CRLs in DER format must be converted, like, e.\|g.:
13006 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
13009 To tell \*(UA about the CRLs, a directory that contains all CRL files
13010 (and no other files) must be created.
13012 .Va smime-crl-dir
13014 .Va ssl-crl-dir
13015 variables, respectively, must then be set to point to that directory.
13016 After that, \*(UA requires a CRL to be present for each CA that is used
13017 to verify a certificate.
13018 .\" }}}
13020 .\" }}} (Examples)
13023 .\" .Sh "FAQ" {{{
13024 .Sh "FAQ"
13026 In general it is a good idea to turn on
13027 .Va debug
13028 .Pf ( Fl d )
13029 and / or
13030 .Va verbose
13031 .Pf ( Fl v ,
13032 twice) if something does not work well.
13033 Very often a diagnostic message can be produced that leads to the
13034 problems' solution.
13036 .\" .Ss "\*(UA shortly hangs on startup" {{{
13037 .Ss "\*(UA shortly hangs on startup"
13039 This can have two reasons, one is the necessity to wait for a file lock
13040 and cannot be helped, the other being that \*(UA calls the function
13041 .Xr uname 2
13042 in order to query the nodename of the box (sometimes the real one is
13043 needed instead of the one represented by the internal variable
13044 .Va hostname ) .
13045 One may have varying success by ensuring that the real hostname and
13046 .Ql localhost
13047 have entries in
13048 .Pa /etc/hosts ,
13049 or, more generally, that the name service is properly setup \(en
13050 and does
13051 .Xr hostname 1
13052 return the expected value?
13053 Does this local hostname have a domain suffix?
13054 RFC 6762 standardized the link-local top-level domain
13055 .Ql .local ,
13056 try again after adding an (additional) entry with this extension.
13057 .\" }}}
13059 .\" .Ss "I cannot login to Google mail aka GMail" {{{
13060 .Ss "I cannot login to Google mail aka GMail"
13062 Since 2014 some free service providers classify programs as
13063 .Dq less secure
13064 unless they use a special authentification method (OAuth 2.0) which
13065 was not standardized for non-HTTP protocol authentication token query
13066 until August 2015 (RFC 7628).
13069 Different to Kerberos / GSSAPI, which is developed since the mid of the
13070 1980s, where a user can easily create a local authentication ticket for
13071 her- and himself with the locally installed
13072 .Xr kinit 1
13073 program, that protocol has no such local part but instead requires
13074 a world-wide-web query to create or fetch a token; since there is no
13075 local cache this query would have to be performed whenever \*(UA is
13076 invoked (in interactive sessions situation may differ).
13079 \*(UA does not support OAuth.
13080 Because of this it is necessary to declare \*(UA a
13081 .Dq less secure app
13082 (on the providers account web page) in order to read and send mail.
13083 However, it also seems possible to take the following steps instead:
13086 .Bl -enum -compact
13088 give the provider the number of a mobile phone,
13090 enable
13091 .Dq 2-Step Verification ,
13093 create an application specific password (16 characters), and
13095 use that special password instead of the real Google account password in
13096 \*(UA (for more on that see the section
13097 .Sx "On URL syntax and credential lookup" ) .
13099 .\" }}}
13101 .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{
13102 .Ss "Not \(dqdefunctional\(dq, but the editor key does not work"
13104 It can happen that the terminal library (see
13105 .Sx "On terminal control and line editor",
13106 .Ic bind ,
13107 .Va termcap )
13108 reports different codes than the terminal really sends, in which case
13109 \*(UA will tell that a key binding is functional, but will not be able to
13110 recognize it because the received data does not match anything expected.
13111 Especially without the \*(OPal terminal capability library support one
13112 reason for this may be that the (possibly even non-existing) keypad
13113 is not turned on and the resulting layout reports the keypad control
13114 codes for the normal keyboard keys.
13116 .Va verbose
13117 listing of
13118 .Ic bind Ns
13119 ings will show the byte sequences that are expected.
13122 To overcome the situation, use, e.g., the program
13123 .Xr cat 1 ,
13124 in conjunction with the command line option
13125 .Fl \&\&v ,
13126 if available, to see the byte sequences which are actually produced
13127 by keypresses, and use the variable
13128 .Va termcap
13129 to make \*(UA aware of them.
13130 E.g., the terminal this is typed on produces some false sequences, here
13131 an example showing the shifted home key:
13133 .Bd -literal -offset indent
13134 ? set verbose
13135 ? bind*
13136 # 1B 5B=[ 31=1 3B=; 32=2 48=H
13137   bind base :kHOM z0
13138 ? x
13139 $ cat -v
13140 ^[[H
13141 ? \*(uA -v -Stermcap='kHOM=\eE[H'
13142 ? bind*
13143 # 1B 5B=[ 48=H
13144   bind base :kHOM z0
13146 .\" }}}
13148 .\" }}}
13151 .\" .Sh "IMAP CLIENT" {{{
13152 .Sh "IMAP CLIENT"
13154 \*(OPally there is IMAP client support available.
13155 This part of the program is obsolete and will vanish in v15 with the
13156 large MIME and I/O layer rewrite, because it uses old-style blocking I/O
13157 and makes excessive use of signal based long code jumps.
13158 Support can hopefully be readded later based on a new-style I/O, with
13159 SysV signal handling.
13160 In fact the IMAP support had already been removed from the codebase, but
13161 was reinstantiated on user demand: in effect the IMAP code is at the
13162 level of \*(UA v14.8.16 (with
13163 .Ic imapcodec
13164 being the sole exception), and should be treated with some care.
13167 IMAP uses the
13168 .Ql imap://
13170 .Ql imaps://
13171 protocol prefixes, and an IMAP-based
13172 .Va folder
13173 may be used.
13174 IMAP URLs (paths) undergo inspections and possible transformations
13175 before use (and the command
13176 .Ic imapcodec
13177 can be used to manually apply them to any given argument).
13178 Hierarchy delimiters are normalized, a step which is configurable via the
13179 .Va imap-delim
13180 variable chain, but defaults to the first seen delimiter otherwise.
13181 \*(UA supports internationalised IMAP names, and en- and decodes the
13182 names from and to the
13183 .Va ttycharset
13184 as necessary and possible.
13185 If a mailbox name is expanded (see
13186 .Sx "Filename transformations" )
13187 to an IMAP mailbox, all names that begin with `+' then refer to IMAP
13188 mailboxes below the
13189 .Va folder
13190 target box, while folder names prefixed by `@' refer to folders below
13191 the hierarchy base.
13194 Note: some IMAP servers do not accept the creation of mailboxes in
13195 the hierarchy base, but require that they are created as subfolders of
13196 `INBOX' \(en with such servers a folder name of the form
13198 .Dl imaps://mylogin@imap.myisp.example/INBOX.
13200 should be used (the last character is the server's hierarchy
13201 delimiter).
13202 The following IMAP-specific commands exist:
13205 .Bl -tag -width ".It Ic BaNg"
13207 .It Ic cache
13208 Only applicable to cached IMAP mailboxes;
13209 takes a message list and reads the specified messages into the IMAP
13210 cache.
13213 .It Ic connect
13214 If operating in disconnected mode on an IMAP mailbox,
13215 switch to online mode and connect to the mail server while retaining
13216 the mailbox status.
13217 See the description of the
13218 .Va disconnected
13219 variable for more information.
13222 .It Ic disconnect
13223 If operating in online mode on an IMAP mailbox,
13224 switch to disconnected mode while retaining the mailbox status.
13225 See the description of the
13226 .Va disconnected
13227 variable for more.
13228 A list of messages may optionally be given as argument;
13229 the respective messages are then read into the cache before the
13230 connection is closed, thus
13231 .Ql disco *
13232 makes the entire mailbox available for disconnected use.
13235 .It Ic imap
13236 Sends command strings directly to the current IMAP server.
13237 \*(UA operates always in IMAP `selected state' on the current mailbox;
13238 commands that change this will produce undesirable results and should be
13239 avoided.
13240 Useful IMAP commands are:
13241 .Bl -tag -offset indent -width ".Ic getquotearoot"
13242 .It create
13243 Takes the name of an IMAP mailbox as an argument and creates it.
13244 .It getquotaroot
13245 (RFC 2087) Takes the name of an IMAP mailbox as an argument
13246 and prints the quotas that apply to the mailbox.
13247 Not all IMAP servers support this command.
13248 .It namespace
13249 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
13250 the Other User's Namespaces and the Shared Namespaces.
13251 Each namespace type is printed in parentheses;
13252 if there are multiple namespaces of the same type,
13253 inner parentheses separate them.
13254 For each namespace a prefix and a hierarchy separator is listed.
13255 Not all IMAP servers support this command.
13259 .It Ic imapcodec
13260 Perform IMAP path transformations.
13261 Supports
13262 .Cm vput
13263 (see
13264 .Sx "Command modifiers" ) ,
13265 and manages the error number
13266 .Va \&! .
13267 The first argument specifies the operation:
13268 .Ar e[ncode]
13269 normalizes hierarchy delimiters (see
13270 .Va imap-delim )
13271 and converts the strings from the locale
13272 .Va ttycharset
13273 to the internationalized variant used by IMAP,
13274 .Ar d[ecode]
13275 performs the reverse operation.
13280 The following IMAP-specific internal variables exist:
13283 .Bl -tag -width ".It Va BaNg"
13285 .It Va disconnected
13286 \*(BO When an IMAP mailbox is selected and this variable is set,
13287 no connection to the server is initiated.
13288 Instead, data is obtained from the local cache (see
13289 .Va imap-cache Ns
13291 Mailboxes that are not present in the cache
13292 and messages that have not yet entirely been fetched from the server
13293 are not available;
13294 to fetch all messages in a mailbox at once,
13295 the command
13296 .No ` Ns Li copy * /dev/null Ns '
13297 can be used while still in connected mode.
13298 Changes that are made to IMAP mailboxes in disconnected mode are queued
13299 and committed later when a connection to that server is made.
13300 This procedure is not completely reliable since it cannot be guaranteed
13301 that the IMAP unique identifiers (UIDs) on the server still match the
13302 ones in the cache at that time.
13303 Data is saved to
13304 .Ev DEAD
13305 when this problem occurs.
13307 .It Va disconnected-USER@HOST
13308 The specified account is handled as described for the
13309 .Va disconnected
13310 variable above,
13311 but other accounts are not affected.
13313 .Mx Va imap-auth
13314 .It Va imap-auth-USER@HOST , imap-auth
13315 Sets the IMAP authentication method.
13316 Valid values are `login' for the usual password-based authentication
13317 (the default),
13318 `cram-md5', which is a password-based authentication that does not send
13319 the password over the network in clear text,
13320 and `gssapi' for GSS-API based authentication.
13323 .It Va imap-cache
13324 Enables caching of IMAP mailboxes.
13325 The value of this variable must point to a directory that is either
13326 existent or can be created by \*(UA.
13327 All contents of the cache can be deleted by \*(UA at any time;
13328 it is not safe to make assumptions about them.
13330 .Mx Va imap-delim
13331 .It Va imap-delim-USER@HOST , imap-delim-HOST , imap-delim
13332 The hierarchy separator used by the IMAP server.
13333 Whenever an IMAP path is specified it will undergo normalization.
13334 One of the normalization steps is the squeezing and adjustment of
13335 hierarchy separators.
13336 If this variable is set, any occurrence of any character of the given
13337 value that exists in the path will be replaced by the first member of
13338 the value; an empty value will cause the default to be used, it is
13339 .Ql /. .
13340 If not set, we will reuse the first hierarchy separator character that
13341 is discovered in a user-given mailbox name.
13343 .Mx Va imap-keepalive
13344 .It Va imap-keepalive-USER@HOST , imap-keepalive-HOST , imap-keepalive
13345 IMAP servers may close the connection after a period of
13346 inactivity; the standard requires this to be at least 30 minutes,
13347 but practical experience may vary.
13348 Setting this variable to a numeric `value' greater than 0 causes
13349 a `NOOP' command to be sent each `value' seconds if no other operation
13350 is performed.
13353 .It Va imap-list-depth
13354 When retrieving the list of folders on an IMAP server, the
13355 .Ic folders
13356 command stops after it has reached a certain depth to avoid possible
13357 infinite loops.
13358 The value of this variable sets the maximum depth allowed.
13359 The default is 2.
13360 If the folder separator on the current IMAP server is a slash `/',
13361 this variable has no effect and the
13362 .Ic folders
13363 command does not descend to subfolders.
13365 .Mx Va imap-use-starttls
13366 .It Va imap-use-starttls-USER@HOST , imap-use-starttls-HOST , imap-use-starttls
13367 Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
13368 IMAP session SSL/TLS encrypted.
13369 This functionality is not supported by all servers,
13370 and is not used if the session is already encrypted by the IMAPS method.
13373 .\" }}}
13376 .\" .Sh "SEE ALSO" {{{
13377 .Sh "SEE ALSO"
13379 .Xr bogofilter 1 ,
13380 .Xr gpg 1 ,
13381 .Xr more 1 ,
13382 .Xr newaliases 1 ,
13383 .Xr openssl 1 ,
13384 .Xr sendmail 1 ,
13385 .Xr sh 1 ,
13386 .Xr spamassassin 1 ,
13387 .Xr iconv 3 ,
13388 .Xr setlocale 3 ,
13389 .Xr aliases 5 ,
13390 .Xr termcap 5 ,
13391 .Xr terminfo 5 ,
13392 .Xr locale 7 ,
13393 .Xr mailaddr 7 ,
13394 .Xr re_format 7 ,
13395 .Xr mailwrapper 8 ,
13396 .Xr sendmail 8
13398 .\" }}}
13401 .\" .Sh HISTORY {{{
13402 .Sh HISTORY
13404 M. Douglas McIlroy writes in his article
13405 .Dq A Research UNIX Reader: Annotated Excerpts \
13406 from the Programmer's Manual, 1971-1986
13407 that a
13408 .Xr mail 1
13409 command already appeared in First Edition
13411 in 1971:
13413 .Bd -ragged -offset indent
13414 Electronic mail was there from the start.
13415 Never satisfied with its exact behavior, everybody touched it at one
13416 time or another: to assure the safety of simultaneous access, to improve
13417 privacy, to survive crashes, to exploit uucp, to screen out foreign
13418 freeloaders, or whatever.
13419 Not until v7 did the interface change (Thompson).
13420 Later, as mail became global in its reach, Dave Presotto took charge and
13421 brought order to communications with a grab-bag of external networks
13422 (v8).
13427 Mail was written in 1978 by Kurt Shoens and developed as part of the
13430 distribution until 1995.
13431 Mail has then seen further development in open source
13433 variants, noticeably by Christos Zoulas in
13434 .Pf Net Bx .
13435 Based upon this Nail, later Heirloom Mailx, was developed by Gunnar
13436 Ritter in the years 2000 until 2008.
13437 Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso.
13438 This man page is derived from
13439 .Dq The Mail Reference Manual
13440 that was originally written by Kurt Shoens.
13442 .\" }}}
13445 .Sh AUTHORS
13447 .An -nosplit
13448 .An "Kurt Shoens" ,
13449 .An "Edward Wang" ,
13450 .An "Keith Bostic" ,
13451 .An "Christos Zoulas" ,
13452 .An "Gunnar Ritter" .
13453 \*(UA is developed by
13454 .An "Steffen Nurpmeso" Aq steffen@sdaoden.eu .
13457 .\" .Sh CAVEATS {{{
13458 .Sh CAVEATS
13460 \*(ID Interrupting an operation via
13461 .Dv \&\&SIGINT
13463 .Ql control-C
13464 from anywhere else but a command prompt is very problematic and likely
13465 to leave the program in an undefined state: many library functions
13466 cannot deal with the
13467 .Fn siglongjmp 3
13468 that this software (still) performs; even though efforts have been taken
13469 to address this, no sooner but in v15 it will have been worked out:
13470 interruptions have not been disabled in order to allow forceful breakage
13471 of hanging network connections, for example (all this is unrelated to
13472 .Va ignore ) .
13475 The SMTP and POP3 protocol support of \*(UA is very basic.
13476 Also, if it fails to contact its upstream SMTP server, it will not make
13477 further attempts to transfer the message at a later time (setting
13478 .Va save
13480 .Va sendwait
13481 may be useful).
13482 If this is a concern, it might be better to set up a local SMTP server
13483 that is capable of message queuing.
13485 .\" }}}
13488 .Sh BUGS
13490 After deleting some message of a POP3 mailbox the header summary falsely
13491 claims that there are no messages to display, one needs to perform
13492 a scroll or dot movement to restore proper state.
13494 In threaded display a power user may encounter crashes very
13495 occasionally (this is may and very).
13497 The file
13498 .Pa TODO
13499 in the source repository lists future directions.
13502 Please report bugs to the
13503 .Va contact-mail
13504 address, e.g., from within \*(uA:
13505 .\" v15-compat: drop eval as `mail' will expand variable?
13506 .Ql ? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail .
13507 More information is available on the web:
13508 .Ql $ \*(uA -X 'echo Ns \| $ Ns Va contact-web Ns ' -Xx .
13510 .\" s-ts-mode