.\"@ nail.1 - S-nail(1) reference manual. .\" .\" Copyright (c) 2012 - 2020 Steffen (Daode) Nurpmeso . .\" SPDX-License-Identifier: ISC .\" .\" Permission to use, copy, modify, and/or distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .\"--MKREL-START-- .\"@ S-nail v14.9.24 / 2022-03-26 .Dd March 26, 2022 .ds VV \\%v14.9.24 .\"--MKREL-END-- .ds VV \\%v14.9.24 .ds UU \\%S-NAIL .ds UA \\%S-nail .ds uA \\%s-nail .ds UR \\%s-nail.rc .ds ur \\%~/\:.mailrc .ds VD \\%~/\:dead.letter .ds VM \\%~/\:mbox .ds VN \\%~/\:.netrc .ds VT \\%/\:tmp .ds vS \\%/\:etc/\:mime.types .ds vU \\%~/\:.mime.types .\" --BEGINSTRIP-- .\" .ds BO (Boolean) .ds CM (Compose mode) .ds ID [v15 behaviour may differ] .ds IN [v15-compat] .ds NQ [Only new quoting rules] .ds OB [Obsolete] .ds OP [Option] .ds OU [no v15-compat] .ds RO (Read-only) .ds SM (Send mode) .\" .if !d str-Lb-libterminfo \ .ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo) . .Dt "\*(UU" 1 .Os .Mx -enable . . .Sh NAME .Nm \*(UA \%[\*(VV] .Nd send and receive Internet mail . . .\" .Sh SYNOPSIS {{{ .Sh SYNOPSIS . .\" Keep in SYNC: ./nail.1:"SYNOPSIS, main() .Nm \*(uA .Bk -words .Op Fl DdEFinv~# .Op Fl \&: Ar spec .Op Fl A Ar account .Op : Ns Fl a Ar attachment Ns \&: .Op : Ns Fl b Ar bcc-addr Ns \&: .Op : Ns Fl C Ar """field:\0body""" Ns \&: .Op : Ns Fl c Ar cc-addr Ns \&: .Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t .Op Fl r Ar from-addr .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc .Op Fl s Ar subject .Op : Ns Fl T Ar """field:\0addr""" Ns \&: .Op : Ns Fl X Ar cmd Ns \&: .Op : Ns Fl Y Ar cmd Ns \&: .Op Fl \&. .Pf : Ar to-addr Ns \&: .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&: .Ek .Pp .Nm \*(uA .Bk -words .Op Fl DdEeHiNnRv~# .Op Fl \&: Ar spec .Op Fl A Ar account .Op : Ns Fl C Ar """field:\0body""" Ns \&: .Op Fl L Ar spec .Op Fl r Ar from-addr .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc .Op Fl u Ar user .Op : Ns Fl X Ar cmd Ns \&: .Op : Ns Fl Y Ar cmd Ns \&: .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&: .Ek .Nm \*(uA .Bk -words .Op Fl DdEeHiNnRv~# .Op Fl \&: Ar spec .Op Fl A Ar account .Op : Ns Fl C Ar """field:\0body""" Ns \&: .Fl f .Op Fl L Ar spec .Op Fl r Ar from-addr .Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc .Op : Ns Fl X Ar cmd Ns \&: .Op : Ns Fl Y Ar cmd Ns \&: .Op Ar file .Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&: .Ek .Pp .Nm \*(uA .Fl h | Fl Fl help .Nm \*(uA .Fl V | Fl Fl version . .\" }}} . . .Mx -toc -tree html pdf ps xhtml . . .\" .Sh DESCRIPTION {{{ .Sh DESCRIPTION . .Bd -filled -compact -offset indent .Sy Note: S-nail (\*(UA) will see major changes in v15.0 (circa 2022). Some backward incompatibilities cannot be avoided. .Sx COMMANDS change to .Sx "Shell-style argument quoting" , and shell metacharacters will become (more) meaningful. Some commands accept new syntax today via .Cm wysh .Pf ( Sx "Command modifiers" ) . Behaviour is flagged \*(IN and \*(OU, .Ic set Ns ting .Va v15-compat .Pf ( Sx "INTERNAL VARIABLES" ) will choose new behaviour when applicable; giving it a value makes .Cm wysh an implied default. \*(OB flags what will vanish. .Pp .Sy Warning! .Va v15-compat (with value) will be a default in v14.10.0! .Ed . .Pp \*(UA provides a simple and friendly environment for sending and receiving mail. It is intended to provide the functionality of the POSIX .Xr mailx 1 command, but is MIME capable and optionally offers extensions for line editing, S/MIME, SMTP and POP3, among others. \*(UA divides incoming mail into its constituent messages and allows the user to deal with them in any order. It offers many .Sx COMMANDS and .Sx "INTERNAL VARIABLES" for manipulating messages and sending mail. It provides the user simple editing capabilities to ease the composition of outgoing messages, and increasingly powerful and reliable non-interactive scripting capabilities. . .\" .Ss "Options" {{{ .Ss "Options" . .Bl -tag -width ".It Fl BaNg" .Mx .It Fl \&: Ar spec , Fl Fl resource-files Ns =.. Controls loading of (as via .Ic source ) .Sx "Resource files" : .Ar spec is parsed case-insensitively, the letter .Ql s corresponds to the system wide .Pa \*(UR , .Ql u the user's personal file .Pa \*(ur . The (original) system wide resource is also compiled-in, accessible via .Ql x . The letters .Ql - and .Ql / disable usage of resource files. Order matters, default is .Ql su . This option overrides .Fl n . . .Mx .It Fl A Ar name , Fl Fl account Ns =.. Activate user .Ic account .Ar name after program startup is complete (resource files loaded, only .Fl X commands are to be executed), and switch to its .Mx -sx .Sx "primary system mailbox" (most likely the .Va inbox ) . If activation fails the program .Pf e Ic xit Ns s if used non-interactively, or if any of .Va errexit or .Va posix are set. . .Mx .It Fl a Ar file Ns Oo Ar =input-charset Ns Oo Ar #output-charset Oc Oc , \ Fl Fl attach Ns =.. \*(SM Attach .Ar file . For \*(CM opportunities refer to .Ic ~@ and .Ic ~^ . .Ar file is subject to tilde expansion (see .Sx "Filename transformations" and .Ic folder ) ; if it is not accessible but contains a .Ql = character, anything before the last .Ql = will be used as the filename, anything thereafter as a character set specification, as shown. .Pp If only an input character set .Mx -ix "character set specification" is specified, the input side is fixed, and no character set conversion will be applied; an empty or the special string hyphen-minus .Ql - is taken for .Va ttycharset (the default). If an output character set has also been specified the desired conversion is performed immediately, not considering file type and content, except for an empty string or hyphen-minus .Ql - , which select the default conversion algorithm (see .Sx "Character sets" ) : no immediate conversion is performed, .Ar file and its contents will be MIME-classified .Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files") first \(em only the latter mode is available unless .Va features includes .Ql ,+iconv, . . .It Fl B (\*(OB: \*(UA will always use line-buffered output, to gain line-buffered input even in batch mode enable batch mode via .Fl # . ) . .Mx .It Fl b Ar addr , Fl Fl bcc Ns =.. \*(SM Send a blind carbon copy to recipient .Ar addr . The option may be used multiple times. Also see the section .Sx "On sending mail, and non-interactive mode" . . .Mx .It Fl C Ar """field: body""" , Fl Fl custom-header Ns =.. Create a custom header which persists for an entire session. A custom header consists of the field name followed by a colon .Ql \&: and the field content body, for example .Ql -C """Blah: Neminem laede; imo omnes, quantum potes, juva""" . Standard header field names cannot be overwritten by custom headers. Runtime adjustable custom headers are available via the variable .Va customhdr , and in \*(CM .Ic ~^ , one of the .Sx "COMMAND ESCAPES" , as well as .Ic digmsg are the most flexible and powerful options to manage message headers. This option may be used multiple times. . .Mx .It Fl c Ar addr , Fl Fl cc Ns =.. \*(SM Just like .Fl b , except it places the argument in the list of carbon copies. . .Mx .It Fl D , Fl Fl disconnected \*(OP Startup with .Va disconnected .Ic set . . .Mx .It Fl d , Fl Fl debug Enter a debug-only sandbox mode by setting the internal variable .Va debug ; the same can be achieved via .Ql Fl S Va \&\&debug or .Ql Ic set Va \&\&debug . Also see .Fl v . . .Mx .It Fl E , Fl Fl discard-empty-messages \*(SM .Ic set .Va skipemptybody and thus discard messages with an empty message part body, successfully. . .Mx .It Fl e , Fl Fl check-and-exit Just check if mail is present (in the system .Va inbox or the one specified via .Fl f ) : if yes, return an exit status of zero, a non-zero value otherwise. To restrict the set of mails to consider in this evaluation a message specification can be added with the option .Fl L . Quickrun: does not open an interactive session. . .Mx .It Fl F \*(SM Save the message to send in a file named after the local part of the first recipient's address (instead of in .Va record Ns ). . .Mx .It Fl f , Fl Fl file Read in the contents of the user's .Mx -sx .Sx "secondary mailbox" .Ev MBOX (or the specified file) for processing; when \*(UA is quit, it writes undeleted messages back to this file (but be aware of the .Va hold option). The optional .Ar file argument will undergo some special .Sx "Filename transformations" (as via .Ic folder ) . Note that .Ar file is not an argument to the flag .Fl \&\&f , but is instead taken from the command line after option processing has been completed. In order to use a .Ar file that starts with a hyphen-minus, prefix with a relative path, as in .Ql ./-hyphenbox.mbox . . .Mx .It Fl H , Fl Fl header-summary Display a summary of .Ic headers for the given .Ic folder (depending on .Fl u , .Va inbox or .Ev MAIL , or as specified via .Fl f ) , then exit. A configurable summary view is available via the option .Fl L . This mode does not honour .Va showlast . Quickrun: does not open an interactive session. . .Mx .It Fl h , Fl Fl help Show a brief usage summary; use .Fl Fl long-help for a list long options. . .Mx .It Fl i .Ic set .Va ignore to ignore tty interrupt signals. . .Mx .It Fl L Ar spec , Fl Fl search Ns =.. Display a summary of .Ic headers of all messages that match the given .Ar spec in the .Ic folder found by the same algorithm used by .Fl H , then exit. See the section .Sx "Specifying messages" for the format of .Ar spec . This mode does not honour .Va showlast . .Pp If the .Fl e option has been given in addition no header summary is produced, but \*(UA will instead indicate via its exit status whether .Ar spec matched any messages .Pf ( Ql 0 ) or not .Pf ( Ql 1 ) ; note that any verbose output is suppressed in this mode and must instead be enabled explicitly (see .Fl v ) . Quickrun: does not open an interactive session. . .Mx .It Fl M Ar type \*(SM Will flag standard input with the MIME .Ql Content-Type: set to the given known .Ar type .Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files" ) and use it as the main message body. \*(ID Using this option will bypass processing of .Va message-inject-head and .Va message-inject-tail . Also see .Fl q , m , t . . .Mx .It Fl m Ar file \*(SM MIME classify the specified .Ar file and use it as the main message body. \*(ID Using this option will bypass processing of .Va message-inject-head and .Va message-inject-tail . Also see .Fl q , M , t . . .Mx .It Fl N , Fl Fl no-header-summary inhibit the initial display of message headers when reading mail or editing a mailbox .Ic folder by calling .Ic unset for the internal variable .Va header . . .Mx .It Fl n Standard flag that inhibits reading the system wide .Pa \*(UR upon startup. The option .Fl \&: allows more control over the startup sequence; also see .Sx "Resource files" . . .Mx .It Fl q Ar file , Fl Fl quote-file Ns =.. \*(SM Initialize the message body with the contents of .Ar file , which may be standard input .Ql - only in non-interactive context. Also see .Fl M , m , t . . .Mx .It Fl R , Fl Fl read-only Any mailbox .Ic folder aka\& .Ic folder opened will be in read-only mode. . . .Mx .It Fl r Ar from-addr , Fl Fl from-address Ns =.. The RFC 5321 reverse-path used for relaying and delegating messages to its destination(s), for example to report delivery errors, is normally derived from the address which appears in the .Va from header (or, if that contains multiple addresses, in .Va sender ) . A file-based aka local executable .Va mta (Mail-Transfer-Agent), however, instead uses the local identity of the initiating user. . .Pp When this command line option is used the given single addressee .Ar from-addr will be assigned to the internal variable .Va from , but in addition the command line option .Fl \&\&f Ar from-addr will be passed to a file-based .Va mta whenever a message is sent. Shall .Ar from-addr include a user name the address components will be separated and the name part will be passed to a file-based .Va mta individually via .Fl \&\&F Ar name . Even though not a recipient the .Ql shquote .Va expandaddr flag is supported. . .Pp If an empty string is passed as .Ar from-addr then the content of the variable .Va from (or, if that contains multiple addresses, .Va sender ) will be evaluated and used for this purpose whenever the file-based .Va mta is contacted. By default, without .Fl \&\&r that is, neither .Fl \&\&f nor .Fl \&\&F command line options are used when contacting a file-based MTA, unless this automatic deduction is enforced by .Ic set Ns ting the internal variable .Va r-option-implicit . . .Pp Remarks: many default installations and sites disallow overriding the local user identity like this unless either the MTA has been configured accordingly or the user is member of a group with special privileges. Passing an invalid address will cause an error. . . .Mx .It Fl S Ar var Ns Oo = Ns value Oc , Fl Fl set Ns =.. .Ic set (or, with a prefix string .Ql no , as documented in .Sx "INTERNAL VARIABLES" , .Ic unset ) .Ar var Ns iable and optionally assign .Ar value , if supported; \*(ID the entire expression is evaluated as if specified within dollar-single-quotes (see .Sx "Shell-style argument quoting" ) if the internal variable .Va v15-compat is set. If the operation fails the program will exit if any of .Va errexit or .Va posix are set. Settings established via .Fl \&\&S cannot be changed from within .Sx "Resource files" or an account switch initiated by .Fl A . They will become mutable again before commands registered via .Fl X are executed. . .Mx .It Fl s Ar subject , Fl Fl subject Ns =.. \*(SM Specify the subject of the message to be sent. Newline (NL) and carriage-return (CR) bytes are invalid and will be normalized to space (SP) characters. . .Mx .It Fl T Ar """field: addr""" , Fl Fl target Ns =.. \*(SM Add .Ar addr to the list of receivers targeted by .Ar field , for now supported are only .Ql bcc , .Ql cc , .Ql fcc , and .Ql to . Field and body (address) are separated by a colon .Ql \&: and optionally blank (space, tabulator) characters. The .Ql shquote .Va expandaddr flag is supported. .Ar addr is parsed like a message header address line, as if it would be part of a template message fed in via .Fl t , and the same modifier suffix is supported. This option may be used multiple times. . .Mx .It Fl t , Fl Fl template \*(SM The text message given (on standard input) is expected to contain, separated from the message body by an empty line, one or multiple plain text message headers. \*(ID Readily prepared MIME mail messages cannot be passed. Headers can span multiple consecutive lines if follow lines start with any amount of whitespace. A line starting with the number sign .Ql # in the first column is ignored. Message recipients can be given via the message headers .Ql To: , .Ql Cc: , .Ql Bcc: (the .Ql ?single modifier enforces treatment as a single addressee, for example .Ql To?single: exa, ) or .Ql Fcc: , they will be added to any recipients specified on the command line, and are likewise subject to .Va expandaddr validity checks. If a message subject is specified via .Ql Subject: then it will be used in favour of one given on the command line. .Pp More optional headers are .Ql Reply-To: (possibly overriding .Va reply-to ) , .Ql Sender: .Pf ( Va sender ) , .Ql From: .Pf ( Va from and / or option .Fl r ) . .Ql Message-ID: , .Ql In-Reply-To: , .Ql References: and .Ql Mail-Followup-To: , by default created automatically dependent on message context, will be used if specified (a special address massage will however still occur for the latter). Any other custom header field (also see .Fl C , .Va customhdr and .Ic ~^ ) is passed through entirely unchanged, and in conjunction with the options .Fl ~ or .Fl # it is possible to embed .Sx "COMMAND ESCAPES" . Also see .Fl M , m , q . . .Mx .It Fl u Ar user , Fl Fl inbox-of Ns =.. Initially read the .Mx -sx .Sx "primary system mailbox" of .Ar user , appropriate privileges presumed; effectively identical to .Ql Fl \&\&f Ns \0%user . . .Mx .It Fl V , Fl Fl version Show \*(UAs .Va version and exit. The command .Ic version will also show the list of .Va features : .Ql $ \*(uA -:/ -Xversion -Xx . . .Mx .It Fl v , Fl Fl verbose .Ic set Ns s the internal variable .Va verbose to enable logging of informational context messages. (Increases level of verbosity when used multiple times.) Also see .Fl d . . .Mx .It Fl X Ar cmd , Fl Fl startup-cmd Ns =.. Add the given (or multiple for a multiline argument) .Ar cmd to a list of commands to be executed before normal operation starts. The commands will be evaluated as a unit, just as via .Ic source . Correlates with .Fl # and .Va errexit . . .Mx .It Fl Y Ar cmd , Fl Fl cmd Ns =.. Add the given (or multiple for a multiline argument) .Ar cmd to a list of commands to be executed after normal operation has started. The commands will be evaluated successively in the given order, and as if given on the program's standard input \(em before interactive prompting begins in interactive mode, after standard input has been consumed otherwise. . .Mx .It Fl ~ , Fl Fl enable-cmd-escapes Enable .Sx "COMMAND ESCAPES" in \*(CM even in non-interactive use cases. This can for example be used to automatically format the composed message text before sending the message: .Bd -literal -offset indent $ ( echo 'line one. Word. Word2.';\e echo '~| /usr/bin/fmt -tuw66' ) |\e LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple .Ed . .Mx .It Fl # , Fl Fl batch-mode Enables batch mode: standard input is made line buffered, the complete set of (interactive) commands is available, processing of .Sx "COMMAND ESCAPES" is enabled in .Sx "Compose mode" , and diverse .Sx "INTERNAL VARIABLES" are adjusted for batch necessities, exactly as if done via .Fl S : .Va emptystart , .Pf no Va errexit , .Pf no Va header , .Pf no Va posix , .Va quiet , .Va sendwait , .Va typescript-mode as well as .Ev MAIL , .Ev MBOX and .Va inbox (the latter three to .Pa /dev/null ) . Also, the values of .Ev COLUMNS and .Ev LINES are looked up, and acted upon. The following prepares an email message in a batched dry run: .Bd -literal -offset indent $ for name in bob alice@exam.ple lisa@exam.ple; do printf 'mail %s\en~s ubject\enText\en~.\en' "${name}" done | LC_ALL=C \*(uA -#:x -Smta=test \e -X'alias bob bob@exam.ple' .Ed . .Mx .It Fl \&. , Fl Fl end-options This flag forces termination of option processing in order to prevent .Dq option injection (attacks). It also forcefully puts \*(UA into send mode, see .Sx "On sending mail, and non-interactive mode" . .El . .Pp If the setting of .Va expandargv allows their recognition all .Ar mta-option arguments given at the end of the command line after a .Ql -- separator will be passed through to a file-based .Va mta (Mail-Transfer-Agent) and persist for the entire session. .Va expandargv constraints do not apply to the content of .Va mta-arguments . Command line receiver address handling supports the .Ql shquote constraint of .Va expandaddr , for more please see .Sx "On sending mail, and non-interactive mode" . . .Bd -literal -offset indent $ \*(uA -#:/ -X 'addrcodec enc Hey, ho ' -Xx .Ed .\" }}} . .\" .Ss "A starter" {{{ review .Ss "A starter" . \*(UA is a direct descendant of .Bx Mail, itself a successor to the Research .Ux mail which .Dq was there from the start according to .Sx HISTORY . It thus represents the user side of the .Ux mail system, whereas the system side (Mail-Transfer-Agent, MTA) was traditionally taken by .Xr sendmail 8 (and most MTAs provide a binary of this name for compatibility reasons). If the \*(OPal SMTP .Va mta is included in the .Va features of \*(UA then the system side is not a mandatory precondition for mail delivery. . .Pp \*(UA strives for compliance with the POSIX .Xr mailx 1 standard, but .Va posix , one of the .Sx "INTERNAL VARIABLES" , or its .Sx ENVIRONMENT Ns al equivalent .Ev POSIXLY_CORRECT , needs to be set to adjust behaviour to be almost on par. Almost, because there is one important difference: POSIX .Sx "Shell-style argument quoting" is (\*(ID increasingly) used instead of the .Sx "Old-style argument quoting" that the standard documents, which is believed to be a feature. The builtin as well as the (default) global .Pa \*(UR .Sx "Resource files" already bend the standard imposed settings a bit. . .Pp For example, .Va hold and .Va keepsave are .Ic set in order to suppress the automatic moving of messages to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX that would otherwise occur (see .Sx "Message states" ) , and .Va keep to not remove empty system MBOX mailbox files (or all empty such files in .Va posix mode) to avoid mangling of file permissions when files eventually get recreated. . .Pp To enter interactive mode even if the initial mailbox is empty .Va emptystart is set, .Va editheaders to allow editing of headers as well as .Va fullnames to not strip down addresses in .Sx "Compose mode" , and .Va quote to include the message that is being responded to when .Ic reply Ns ing, which is indented by an .Va indentprefix that also deviates from standard imposed settings. .Va mime-counter-evidence is fully enabled, too. It sets .Va followup-to-honour and .Va reply-to-honour to comply with reply address desires. . .Pp Credentials and other settings are easily addressable by grouping them via .Ic account . The file mode creation mask can be managed with .Va umask . Files and shell pipe output can be .Ic source Ns d for .Ic eval Ns uation, also during startup from within the .Sx "Resource files" . Informational context can be available by .Ic set Ns ting .Va verbose or .Va debug (as via .Fl v , d ) . .\" }}} . .\" .Ss "On sending mail, and non-interactive mode" {{{ .Ss "On sending mail, and non-interactive mode" . To send a message to one or more people, using a local or built-in .Va mta (Mail-Transfer-Agent) transport to actually deliver the generated mail message, \*(UA can be invoked with arguments which are the names of people to whom the mail will be sent, and the command line options .Fl b and .Fl c can be used to add (blind) carbon copy receivers: . .Bd -literal -offset indent # Via test MTA $ echo Hello, world | \*(uA -:/ -Smta=test -s test $LOGNAME # Via sendmail(1) MTA $ ' eric@exam.ple # With SMTP (no real sending due to -d debug dry-run) $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Sttycharset=utf8 \e -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e -S from=scriptreply@exam.ple \e -a /etc/mail.rc --end-options \e eric@exam.ple < /tmp/letter.txt .Ed . .Pp Email addresses and plain user names are subject to .Ic alternates filtering, names only are first expanded through .Ic alias and .Va mta-aliases . An address in angle brackets consisting only of a valid local user .Ql will be converted to a fully qualified address if either .Va hostname is not set, or set to a non-empty value; if set to the empty value the conversion is left up to the .Va mta . .\" When changing any of the following adjust any RECIPIENTADDRSPEC; .\" grep the latter for the complete picture By setting .Va expandaddr fine-grained control of recipient address types other than user names and network addresses is possible. Recipients are classified as follows: any name that starts with a vertical bar .Ql | character specifies a command pipe \(en the command string following the .Ql | is executed and the message is sent to its standard input; likewise, any name that consists only of hyphen-minus .Ql - or starts with the character solidus .Ql / or the character sequence dot solidus .Ql ./ is treated as a file, regardless of the remaining content. Any other name which contains a commercial at .Ql @ character is a network address; Any other name which starts with a plus sign .Ql + character is a mailbox name; Any other name which contains a solidus .Ql / character but no exclamation mark .Ql \&! or percent sign .Ql % character before is also a mailbox name; What remains is treated as a network address. This classification can be avoided by using a .Ql Fcc: header, see .Sx "Compose mode" . . .Bd -literal -offset indent $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox' $ echo safe | LC_ALL=C \e \*(uA -:/ -Smta=test -Sv15-compat -Sttycharset=utf8 \e --set mime-force-sendout --set fullnames \e -S expandaddr=fail,-all,+addr,failinvaddr -s test \e --end-options 'Imagine John ' .Ed . .Pp Before messages are sent they undergo editing in .Sx "Compose mode" . But many settings are static and can be set more generally. The envelope sender address for example is defined by .Va from , explicitly defining an originating .Va hostname may be desirable, especially with the built-in SMTP Mail-Transfer-Agent .Va mta . .Sx "Character sets" for outgoing message and MIME part content are configurable via .Va sendcharsets , whereas input data is assumed to be in .Va ttycharset . Message data will be passed over the wire in a .Va mime-encoding , and MIME parts aka attachments need a .Ic mimetype , usually taken out of .Sx "The mime.types files" . Saving copies of sent messages in a .Va record mailbox may be desirable \(en as for most mailbox .Ic folder targets .Sx "Filename transformations" will be performed. . .Pp For the purpose of arranging a complete environment of settings that can be switched to with a single command or command line option there are .Ic account Ns s . Alternatively a flat configuration could be possible, making use of so-called variable chains which automatically pick .Ql USER@HOST or .Ql HOST context-dependent variants some variables support: for example addressing .Ql Ic Folder Ns \& pop3://yaa@exam.ple would find .Va \&\&pop3-no-apop-yaa@exam.ple , .Va \&\&pop3-no-apop-exam.ple and .Va pop3-no-apop in order. For more please see .Sx "On URL syntax and credential lookup" and .Sx "INTERNAL VARIABLES" . . .Pp To avoid environmental noise scripts should create a script-local environment, ideally with the command line options .Fl \&: to disable configuration files in conjunction with repetitions of .Fl S to specify variables: . .Bd -literal -offset indent $ env LC_ALL=C \*(uA -:/ \e -Sv15-compat \e -Sttycharset=utf-8 -Smime-force-sendout \e -Sexpandaddr=fail,-all,failinvaddr \e -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e -S from=scriptreply@exam.ple \e -s 'Subject to go' -a attachment_file \e -Sfullnames -. \e 'Recipient 1 ' rec2@exam.ple \e < content_file .Ed . .Pp As shown, scripts producing messages can .Dq fake a locale environment, the above specifies the all-compatible 7-bit clean .Ev LC_ALL .Dq C , but will nonetheless take and send UTF-8 in the message text by using .Va ttycharset . If character set conversion is compiled in .Pf ( Va features includes the term .Ql ,+iconv, ) invalid (according to .Va ttycharset ) character input data would normally cause errors; setting .Va mime-force-sendout will instead, as a last resort, classify the input as binary data, and therefore allow message creation to be successful. (Such content can then be inspected either by installing a .Va pipe-TYPE/SUBTYPE handler for .Ql application/octet-stream , or possibly automatically through .Va mime-counter-evidence ) . . .Pp In interactive mode, introduced soon, messages can be sent by calling the .Ic mail command with a list of recipient addresses: . .Bd -literal -offset indent $ \*(uA -:/ -Squiet -Semptystart -Sfullnames -Smta=test "/var/spool/mail/user": 0 messages ? mail "Recipient 1 ", rec2@exam.ple \&... ? # Will do the right thing (tm) ? m rec1@exam.ple rec2@exam.ple .Ed .\" }}} . .\" .Ss "Compose mode" {{{ .Ss "Compose mode" . If standard input is a terminal rather than the message to be sent, the user is expected to type in the message contents. In compose mode lines beginning with the character .Ql ~ (in fact the value of .Va escape ) are special \(en these are so-called .Sx "COMMAND ESCAPES" which can be used to read in files, process shell commands, add and edit attachments and more. For example .Ic ~v or .Ic ~e will start the .Ev VISUAL text .Ev EDITOR , respectively, to revise the message in its current state, .Ic ~h allows editing of the most important message headers, with the potent .Ic ~^ custom headers can be created, for example (more specifically than with .Fl C and .Va customhdr ) . \*(OPally .Ic ~? gives an overview of most other available command escapes. . .Pp To create file-carbon-copies the special recipient header .Ql Fcc: may be used as often as desired, for example via .Ic ~^ . Its entire value (or body in standard terms) is interpreted as a .Ic folder target, after having been subject to .Sx "Filename transformations" : this is the only way to create a file-carbon-copy without introducing an ambiguity regarding the interpretation of the address, file names with leading vertical bars or commercial ats can be used. Like all other recipients .Ql Fcc: is subject to the checks of .Va expandaddr . Any local file and pipe command addressee honours the setting of .Va mbox-fcc-and-pcc . . .Pp Once finished with editing the command escape .Ic ~. (see there) will call hooks, insert automatic injections and receivers, leave compose mode and send the message once it is completed. Aborting letter composition is possible with either of .Ic ~x or .Ic ~q , the latter of which will save the message in the file denoted by .Ev DEAD unless .Pf no Va save is set. And unless .Va ignoreeof is set the effect of .Ic ~. can also be achieved by typing end-of-transmission (EOT) via .Ql control-D .Pf ( Ql ^D ) at the beginning of an empty line, and .Ic ~q is always reachable by typing end-of-text (ETX) twice via .Ql control-C .Pf ( Ql ^C ) . . .Pp The compose mode hooks .Va on-compose-enter , on-compose-splice , on-compose-leave and .Va on-compose-cleanup may be set to .Ic define Ns d macros and provide reliable and increasingly powerful mechanisms to perform automated message adjustments dependent on message context, for example addition of message signatures .Pf ( Va message-inject-head , message-inject-tail ) or creation of additional receiver lists (also by setting .Va autocc , autobcc ) . To achieve that the command .Ic digmsg may be used in order to query and adjust status of message(s). The splice hook can also make use of .Sx "COMMAND ESCAPES" . (\*(ID The compose mode hooks work for .Ic forward , mail , reply and variants; .Ic resend and .Ic Resend only provide the hooks .Va on-resend-enter and .Va on-resend-cleanup , which are pretty restricted due to the nature of the operation.) .\" }}} . .\" .Ss "On reading mail, and more on interactive mode" {{{ .Ss "On reading mail, and more on interactive mode" . When invoked without addressees \*(UA enters interactive mode in which mails may be read. When used like that the user's system .Va inbox (for more on mailbox types please see the command .Ic folder ) is read in and a one line header of each message therein is displayed if the variable .Va header is set. The visual style of this summary of .Ic headers can be adjusted through the variable .Va headline and the possible sorting criterion via .Va autosort . Scrolling through .Va screen Ns fuls of .Ic headers can be performed with the command .Ic z . If the initially opened mailbox is empty \*(UA will instead exit immediately (after displaying a message) unless the variable .Va emptystart is set. . .Pp At the .Va prompt the command .Ic list will give a listing of all available commands and .Ic help will \*(OPally give a summary of some common ones. If the \*(OPal documentation strings are available (see .Va features ) one can type .Ql help X .Pf "(or " Ql \&?X ) and see the actual expansion of .Ql X and what its purpose is, i.e., commands can be abbreviated (note that POSIX defines some abbreviations, so that the alphabetical order of commands does not necessarily relate to the abbreviations; it is however possible to define overwrites with .Ic commandalias ) . These commands can also produce a more .Va verbose output. . .Pp Messages are given numbers (starting at 1) which uniquely identify messages; the current message \(en the .Dq dot \(en will either be the first new message, or the first unread message, or the first message of the mailbox; the internal variable .Va showlast will instead cause usage of the last message for this purpose. The command .Ic headers will display a .Va screen Ns ful of header summaries containing the .Dq dot , whereas .Ic from will display only the summaries of the given messages, defaulting to the .Dq dot . . .Pp Message content can be displayed with the command .Ic type .Pf ( Ql t , alias .Ic print ) . Here the variable .Va crt controls whether and when \*(UA will use the configured .Ev PAGER for display instead of directly writing to the user terminal .Va screen , the sole difference to the command .Ic more , which will always use the .Ev PAGER . The command .Ic top will instead only show the first .Va toplines of a message (maybe even compressed if .Va topsqueeze is set). Message display experience may improve by setting and adjusting .Va mime-counter-evidence , and also see .Sx "HTML mail and MIME attachments" . . .Pp By default the current message .Pf ( Dq dot ) is displayed, but like with many other commands it is possible to give a fancy message specification (see .Sx "Specifying messages" ) , for example .Ql t:u will display all unread messages, .Ql t. will display the .Dq dot , .Ql t 1 5 will type the messages 1 and 5, .Ql t 1-5 will type the messages 1 through 5, and .Ql t- and .Ql t+ will display the previous and the next message, respectively. The command .Ic search (a more substantial alias for .Ic from ) will display a header summary of the given message specification list instead of their content; the following will search for subjects: . .Pp .Dl ? from "'@Some subject to search for'" . .Pp In the default setup all header fields of a message will be .Ic type Ns d, but fields can be white- or blacklisted for a variety of applications by using the command .Ic headerpick , e.g., to restrict their display to a very restricted set for .Ic type : .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject . In order to display all header fields of a message regardless of currently active ignore or retain lists, use the commands .Ic Type and .Ic Top ; .Ic Show will show the raw message content. Note that historically the global .Pa \*(UR not only adjusts the list of displayed headers, but also sets .Va crt . (\*(ID A yet somewhat restricted) Reliable scriptable message inspection is available via .Ic digmsg . . .Pp Dependent upon the configuration a line editor (see the section .Sx "On terminal control and line editor" ) aims at making the user experience with the many .Sx COMMANDS a bit nicer. When reading the system .Va inbox , or when .Fl f (or .Ic folder ) specified a mailbox explicitly prefixed with the special .Ql %: modifier (to propagate it to a .Mx -sx .Sx "primary system mailbox" ) , then messages which have been read .Pf (see\0 Sx "Message states" ) will be automatically moved to a .Mx -sx .Sx "secondary mailbox" , the user's .Ev MBOX file, when the mailbox is left, either by changing the active mailbox or by quitting \*(UA \(en this automatic moving from a system- or primary- to the secondary mailbox is not performed when the variable .Va hold is set. Messages can also be explicitly .Ic move Ns d to other mailboxes, whereas .Ic copy keeps the original message. .Ic write can be used to write out data content of specific parts of messages. . .Pp After examining a message the user can .Ic reply Ql r to the sender and all recipients (which will also be placed in .Ql To: unless .Va recipients-in-cc is set), or .Ic Reply Ql R exclusively to the sender(s). To comply with with the receivers desired reply address the .Mx -sx .Sx quadoption Ns s .Va followup-to-honour and .Va reply-to-honour should usually be set. The commands .Ic Lreply and .Ic Lfollowup know how to apply a special addressee massage, see .Sx "Mailing lists" . Dependent on the presence and value of .Va quote the message being replied to will be included in a quoted form. .Ic forward Ns ing a message will allow editing the new message: the original message will be contained in the message body, adjusted according to .Ic headerpick . It is possible to .Ic resend or .Ic Resend messages: the former will add a series of .Ql Resent- headers, whereas the latter will not; different to newly created messages editing is not possible and no copy will be saved even with .Va record unless the additional variable .Va record-resent is set. When sending, replying or forwarding messages comments and full names will be stripped from recipient addresses unless the internal variable .Va fullnames is set. . .Pp Of course messages can be .Ic delete Ql d , and they can spring into existence again via .Ic undelete , or when the \*(UA session is ended via the .Ic exit or .Ic xit commands to perform a quick program termation. To end a mail processing session regularly and perform a full program exit one may issue the command .Ic quit . It will, among others, move read messages to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX as necessary, discard deleted messages in the current mailbox, and update the \*(OPal (see .Va features ) line editor .Va history-file . By the way, whenever the main event loop is about to look out for the next input line it will trigger the hook .Va on-main-loop-tick . .\" }}} . .\" .Ss "HTML mail and MIME attachments" {{{ review .Ss "HTML mail and MIME attachments" . HTML-only messages become more and more common, and many messages come bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions) parts and attachments. To get a notion of MIME types there is a built-in default set, onto which the content of .Sx "The mime.types files" will be added (as configured and allowed by .Va mimetypes-load-control ) . Types can also become registered and listed with the command .Ic mimetype . To improve interaction with the faulty MIME part declarations of real life .Va mime-counter-evidence will allow verification of the given assertion, and the possible provision of an alternative, better MIME type. Note plain text parts will always be preferred in .Ql multipart/alternative MIME messages unless .Va mime-alternative-favour-rich is set. . .Pp Whereas a simple HTML-to-text filter for displaying HTML messages is \*(OPally supported (indicated by .Ql ,+filter-html-tagsoup, in .Va features ) , MIME types other than plain text cannot be handled directly. To deal with specific non-text MIME types or file extensions programs need to be registered which either prepare (re-)integrable plain text versions of their input (a mode which is called .Cd copiousoutput ) , or display the content externally, for example in a graphical window: the latter type is only considered by and for the command .Ic mimeview . . .Pp To install a handler program for a MIME type an according .Va pipe-TYPE/SUBTYPE variable needs to be set; to define a handler for a file extension .Va pipe-EXTENSION can be used \(en these handlers take precedence. \*(OPally mail user agent configuration is supported (see .Sx "The Mailcap files" ) , and will be queried for display or quote handlers after the former ones. Type-markers registered via .Ic mimetype are the last possible source for information how to handle a MIME type. . .Pp For example, to display HTML messages integrated via the text browsers .Xr lynx 1 or .Xr elinks 1 , register a MathML MIME type and enable its plain text display, and to open PDF attachments in an external PDF viewer, asynchronously and with some other magic attached: . .Bd -literal -offset indent ? if "$features" !% ,+filter-html-tagsoup, ? #set pipe-text/html='?* elinks -force-html -dump 1' ? set pipe-text/html='?* lynx -stdin -dump -force_html' ? # Display HTML as plain text instead ? #set pipe-text/html=?t ? endif ? mimetype ?t application/mathml+xml mathml ? wysh set pipe-application/pdf='?&=? \e trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e mupdf "${MAILX_FILENAME_TEMPORARY}"' ? define showhtml { ? \elocalopts yes ? \eset mime-alternative-favour-rich pipe-text/html=?h? ? \etype "$@" ? } ? \ecommandalias html \e\ecall showhtml .Ed .\" }}} . .\" .Ss "Mailing lists" {{{ .Ss "Mailing lists" . Known or subscribed-to mailing lists may be flagged in the summary of .Ic headers .Pf ( Va headline format character .Ql %L ) , and will gain special treatment when sending mails: the variable .Va followup-to-honour will ensure that a .Ql Mail-\:Followup-\:To: header is honoured when a message is being replied to .Pf ( Ic reply , .Ic followup , .Ic Lreply , .Ic Lfollowup ) , and .Va followup-to controls creation of this header when creating .Ic mail Ns s, if the necessary user setup .Pf ( from , sender ) ; is available; then, it may also be created automatically, for example when list-replying via .Ic Lreply or .Ic Lfollowup , when .Ic followup or .Ic reply is used and the messages .Ql Mail-Followup-To: is honoured etc. . .Pp The commands .Ic mlist and .Ic mlsubscribe manage \*(UAs notion of which addresses are mailing lists. With the \*(OPal regular expression support any address .Mx -ix "magic regular expression characters" which contains any of the magic regular expression characters .Ql ( ^[*+?|$ ; see .Xr re_format 7 or .Xr regex 7 , dependent on the host system) will be compiled and used as one, possibly matching many addresses. It is not possible to escape the .Dq magic : in order to match special characters as-is, bracket expressions must be used, for example .Ql Ic search Li @subject@'[[]open bracket' . . .Bd -literal -offset indent ? set followup-to followup-to-honour=ask-yes \e reply-to-honour=ask-yes ? mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$' ? mlsubscribe a4@b4.c4 exact@lists.c3 .Ed . .Pp Known and subscribed lists differ in that for the latter the .Va user Ns s address is not part of a generated .Ql Mail-Followup-To: . There are exceptions, for example if multiple lists are addressed and not all have the subscription attribute. When replying to a message its list address .Pf ( Ql List-Post: header) is automatically and temporarily treated like a known .Ic mlist ; dependent on the variable .Va reply-to-honour an existing .Ql Reply-To: is used instead (if it is a single address on the same domain as .Ql List-Post: ) in order to accept a list administrator's wish that is supposed to have been manifested like that. . .Pp For convenience and compatibility with mail programs that do not honour the non-standard M-F-T, an automatic user entry in the carbon-copy .Ql Cc: address list of generated message can be created by setting .Va followup-to-add-cc . This entry will be added whenever the user will be placed in the .Ql Mail-Followup-To: list, and is not a regular addressee already. .Va reply-to-swap-in tries to deal with the address rewriting that many mailing-lists nowadays perform to work around DKIM / DMARC etc. standard imposed problems. .\" }}} . .\" .Ss "Signed and encrypted messages with S/MIME" {{{ .Ss "Signed and encrypted messages with S/MIME" . \*(OP S/MIME provides two central mechanisms: message signing and message encryption. A signed message contains some data in addition to the regular text. The data can be used to verify that the message has been sent using a valid certificate, that the sender address matches that in the certificate, and that the message text has not been altered. Signing a message does not change its regular text; it can be read regardless of whether the recipients software is able to handle S/MIME. It is thus usually possible to sign all outgoing messages if so desired. . .Pp Encryption, in contrast, makes the message text invisible for all people except those who have access to the secret decryption key. To encrypt a message, the specific recipients public encryption key must be known. It is therefore not possible to send encrypted mail to people unless their key has been retrieved from either previous communication or public key directories. Because signing is performed with private keys, and encryption with public keys, messages should always be signed before being encrypted. . .Pp A central concept to S/MIME is that of the certification authority (CA). A CA is a trusted institution that issues certificates. For each of these certificates it can be verified that it really originates from the CA, provided that the CA's own certificate is previously known. A set of CA certificates is usually delivered and installed together with the cryptographical library that is used on the local system. Therefore reasonable security for S/MIME on the Internet is provided if the source that provides that library installation is trusted. It is also possible to use a specific pool of trusted certificates. If this is desired, .Va smime-ca-no-defaults should be set to avoid using the default certificate pool, and .Va smime-ca-file and/or .Va smime-ca-dir should be pointed to a trusted pool of certificates. A certificate cannot be more secure than the method its CA certificate has been retrieved with. . .Pp This trusted pool of certificates is used by the command .Ic verify to ensure that the given S/MIME messages can be trusted. If so, verified sender certificates that were embedded in signed messages can be saved locally with the command .Ic certsave , and used by \*(UA to encrypt further communication with these senders: . .Bd -literal -offset indent ? certsave FILENAME ? set smime-encrypt-USER@HOST=FILENAME \e smime-cipher-USER@HOST=AES256 .Ed . .Pp To sign outgoing messages, in order to allow receivers to verify the origin of these messages, a personal S/MIME certificate is required. \*(UA supports password-protected personal certificates (and keys), see .Va smime-sign-cert . The section .Sx "On URL syntax and credential lookup" gives an overview of the possible sources of user credentials, and .Sx "S/MIME step by step" shows examplarily how a private S/MIME certificate can be obtained. In general, if such a private key plus certificate .Dq pair is available, all that needs to be done is to set some variables: . .Bd -literal -offset indent ? set smime-sign-cert=ME@exam.ple.paired \e smime-sign-digest=SHA512 \e smime-sign from=myname@my.host .Ed . .Pp Variables of interest for S/MIME in general are .Va smime-ca-dir , .Va smime-ca-file , .Va smime-ca-flags , .Va smime-ca-no-defaults , .Va smime-crl-dir , .Va smime-crl-file . For S/MIME signing of interest are .Va smime-sign , .Va smime-sign-cert , .Va smime-sign-include-certs and .Va smime-sign-digest . Additional variables of interest for S/MIME en- and decryption: .Va smime-cipher and .Va smime-encrypt-USER@HOST . Variables of secondary interest may be .Va content-description-smime-message and .Va content-description-smime-signature . S/MIME is available if .Ql ,+smime, is included in .Va features . . .Pp \*(ID Note that neither S/MIME signing nor encryption applies to message subjects or other header fields yet. Thus they may not contain sensitive information for encrypted messages, and cannot be trusted even if the message content has been verified. When sending signed messages, it is recommended to repeat any important header information in the message text. .\" }}} . .\" .Ss "On URL syntax and credential lookup" {{{ review .Ss "On URL syntax and credential lookup" . For accessing protocol-specific resources Uniform Resource Locators (URL, RFC 3986) have become omnipresent. Here they are expected in a .Dq normalized variant, not used in data exchange, but only meant as a compact, easy-to-use way of defining and representing information in a well-known notation; as such they do not conform to any real standard. Optional parts are placed in brackets .Ql [] , optional either because there also exist other ways to define the information, or because the part is protocol specific. .Ql /path for example is used by the \*(OPal Maildir .Ic folder type and the IMAP protocol, but not by POP3. If .Ql USER and .Ql PASSWORD are included in an URL server specification, URL percent encoded (RFC 3986) forms are needed, generable with .Ic urlcodec . . .Pp .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path] . .Pp Often .Sx "INTERNAL VARIABLES" exist in multiple versions, called .Dq variable chains in this document: the plain .Ql variable as well as .Ql variable-HOST and .Ql variable-USER@HOST . If a port was specified .Ql HOST really means .Ql server:port , not .Ql server . And this .Ql USER is never in URL percent encoded form. For example, whether the hypothetical .Ql smtp://\:wings\:%3A\:of\:@a.dove including user and password was used, or whether it was .Ql smtp://a.dove and it came from a different source, to lookup the chain .Va tls-config-pairs first .Ql tls-\:config-\:pairs-\:wings:of@a.dove is looked up, then .Ql tls-\:config-pairs\-\:a.dove , before finally looking up the plain variable. . .Pp The logic to collect (an .Ic account Ns s) credential information is as follows: . .Bl -bullet .It A user is always required. If no .Ql USER has been given in the URL the variables .Va user-HOST and .Va user are looked up. Afterwards, when enforced by the \*(OPal variables .Va netrc-lookup-HOST or .Va netrc-lookup , .Sx "The .netrc file" of the user will be searched for a .Ql HOST specific entry which provides a .Ql login name: only unambiguous entries are used (one possible matching entry for .Ql HOST ) . .Pp If there is still no .Ql USER then the verified .Ev LOGNAME , known to be a valid user on the current host, is used. . .It Authentication: unless otherwise noted the chain .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth is checked, falling back to a protocol-specific default as necessary. . .It If no .Ql PASSWORD has been given in the URL, then if the .Ql USER has been found through the \*(OPal .Va netrc-lookup , that may have also provided the password. Otherwise the chain .Va password-USER@HOST , password-HOST , password is looked up. .Pp Thereafter the (now complete) \*(OPal chain .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup is checked, if set the .Ic netrc cache is searched for a password only (multiple user accounts for a single machine may exist as well as a fallback entry without user but with a password). .Pp If at that point there is still no password available, but the (protocols') chosen authentication type requires a password, then in interactive mode the user will be prompted on the terminal. .El . .Pp .Sy Note: S/MIME verification works relative to the values found in the .Ql From: (or .Ql Sender: ) header field(s), which means the values of .Va smime-sign , smime-sign-cert , smime-sign-include-certs and .Va smime-sign-digest will not be looked up using the .Ql USER and .Ql HOST chains from above, but instead use the corresponding values from the message that is being worked on. If no address matches we assume and use the setting of .Va from . In unusual cases multiple and different .Ql USER and .Ql HOST combinations may therefore be involved \(en on the other hand those unusual cases become possible. The usual case is as short as: . .Bd -literal -offset indent set mta=smtp://USER:PASS@HOST smtp-use-starttls \e smime-sign smime-sign-cert=+smime.pair \e from=myname@my.host .Ed . .Pp The section .Sx EXAMPLES contains complete example configurations. .\" }}} . .\" .Ss "Encrypted network communication" {{{ review .Ss "Encrypted network communication" . \*(OP SSL (Secure Sockets Layer) aka its successor TLS (Transport Layer Security) are protocols which aid in securing communication by providing a safely initiated and encrypted network connection. A central concept of TLS are certificates: as part of each network connection setup a (set of) certificates will be exchanged through which the identity of the network peer can be cryptographically verified; if possible the TLS/SNI (ServerNameIndication) extension will be enabled to allow servers fine-grained control over the certificates being used. A locally installed pool of trusted certificates will then be inspected, and verification will succeed if it contains a(n in)direct signer of the presented certificate(s). . .Pp The local pool of trusted so-called CA (Certification Authority) certificates is usually delivered with and used along the TLS library. A custom pool of trusted certificates can be selected by pointing .Va tls-ca-file and/or (with special preparation) .Va tls-ca-dir to the desired location; setting .Va tls-ca-no-defaults in addition will avoid additional inspection of the default pool. A certificate cannot be more secure than the method its CA certificate has been retrieved with. For inspection or other purposes, the certificate of a server (as seen when connecting to it) can be fetched with the command .Ic tls (port can usually be the protocol name, too, and .Va tls-verify is taken into account here): . .Bd -literal -offset indent $ \*(uA -vX 'tls certchain SERVER-URL[:PORT]; x' .Ed . .Pp A local pool of CA certificates is not strictly necessary, however, server certificates can also be verified via their fingerprint. For this a message digest will be calculated and compared against the variable chain .Va tls-fingerprint , and verification will succeed if the fingerprint matches. The message digest (algorithm) can be configured via the variable chain .Va tls-fingerprint-digest ; .Ic tls can again be used: . .Bd -literal -offset indent $ \*(uA -X 'wysh set verbose; tls fingerprint SERVER-URL[:PORT]; x' .Ed . .Pp It depends on the used protocol whether encrypted communication is possible, and which configuration steps have to be taken to enable it. Some protocols, like POP3S, are implicitly encrypted, others, like POP3, can upgrade a plain text connection if so requested. For example, to use the .Ql STLS that POP3 offers (a member of) the variable (chain) .Va pop3-use-starttls needs to be set, with convenience via .Ic shortcut : . .Bd -literal -offset indent shortcut encpop1 pop3s://pop1.exam.ple shortcut encpop2 pop3://pop2.exam.ple set pop3-use-starttls-pop2.exam.ple set mta=smtps://smtp.exam.ple:465 set mta=smtp://smtp.exam.ple smtp-use-starttls .Ed . .Pp Normally that is all there is to do, given that TLS libraries try to provide safe defaults, plenty of knobs however exist to adjust settings. For example certificate verification settings can be fine-tuned via .Va tls-ca-flags , and the TLS configuration basics are accessible via .Va tls-config-pairs , for example to control protocol versions or cipher lists. In the past hints on how to restrict the set of protocols to highly secure ones were indicated, but as of the time of this writing the list of protocols or ciphers may need to become relaxed in order to be able to connect to some servers; the following example allows connecting to a .Dq Lion that uses OpenSSL 0.9.8za from June 2014 (refer to .Sx "INTERNAL VARIABLES" for more on variable chains): . .Bd -literal -offset indent wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e CipherString=TLSv1.2:!aNULL:!eNULL:\e ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e DHE-RSA-AES256-SHA:@STRENGTH' .Ed . .Pp The OpenSSL program .Xr ciphers 1 should be referred to when creating a custom cipher list. Variables of interest for TLS in general are .Va tls-ca-dir , .Va tls-ca-file , .Va tls-ca-flags , .Va tls-ca-no-defaults , .Va tls-config-file , .Va tls-config-module , .Va tls-config-pairs , .Va tls-crl-dir , .Va tls-crl-file , .Va tls-rand-file as well as .Va tls-verify . Also see .Va tls-features . TLS is available if .Ql +tls is included in .Va features . .\" }}} . .\" .Ss "Character sets" review {{{ .Ss "Character sets" . \*(OP The user's locale environment is detected by looking at the .Ev LC_ALL environment variable. The internal variable .Va ttycharset will be set to the detected terminal character set accordingly, and will thus show up in the output of commands like .Ic set and .Ic varshow . This character set will be targeted when trying to display data, and user input data is expected to be in this character set, too. . .Pp When creating messages their character input data is classified. 7-bit clean text data and attachments will be classified as .Va charset-7bit . 8-bit data will \*(OPally be converted into members of .Va sendcharsets until a character set conversion succeeds. .Va charset-8bit is the implied default last member of this list. If no 8-bit character set is capable to represent input data, no message will be sent, and its text will optionally be .Va save Ns d in .Ev DEAD . If that is not acceptable, for example in script environments, .Va mime-force-sendout can be set to force sending of non-convertible data as .Ql application/octet-stream classified binary content instead: like this receivers still have the option to inspect message content (for example via .Va mime-counter-evidence ) . If the \*(OPal character set conversion is not available .Pf ( Va features misses .Ql ,+iconv, ) , .Va ttycharset is the only supported character set for non 7-bit clean data, and it is simply assumed it can be used to exchange 8-bit messages. . .Pp .Va ttycharset may also be given an explicit value to send mail in a completely .Dq faked locale environment, which can be used to generate and send for example 8-bit UTF-8 input data in a pure 7-bit US-ASCII .Ql LC_ALL=C environment (an example of this can be found in the section .Sx "On sending mail, and non-interactive mode" ) . Due to lack of programming interfaces reading mail will not really work as expected in a faked environment: whereas .Va ttycharset might be addressable, any output will be made safely printable, as via .Ic vexpr .Cm makeprint , according to the actual locale environment, which is not affected by .Va ttycharset. . .Pp Classifying 7-bit clean data as .Va charset-7bit is a problem if the input character set .Pf ( Va ttycharset ) is a multibyte character set that is itself 7-bit clean. For example, the Japanese character set ISO-2022-JP is, but is capable to encode the rich set of Japanese Kanji, Hiragana and Katakana characters: in order to notify receivers of this character set the mail message must be MIME encoded so that the character set ISO-2022-JP can be advertised, otherwise an invalid email message would result! To achieve this, the variable .Va charset-7bit can be set to ISO-2022-JP. (Today a better approach regarding email is the usage of UTF-8, which uses 8-bit bytes for non-US-ASCII data.) . .Pp When replying to a message and the variable .Va reply-in-same-charset is set, the character set of the message being replied to is tried first as a target character set (still being a subject of .Ic charsetalias filtering, however). Another opportunity is .Va sendcharsets-else-ttycharset to reflect the user's locale environment automatically, it will treat .Va ttycharset as an implied member of (an unset) .Va sendcharsets . . .Pp \*(OP When reading messages, their text data is converted into .Va ttycharset as necessary in order to display them on the user's terminal. Unprintable characters and invalid byte sequences are detected and replaced by substitution characters. Character set mappings for source character sets can be established with .Ic charsetalias , which may be handy to work around faulty or incomplete character set catalogues (one could for example add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment of one character set as another one .Pf ( Dq interpret LATIN1 as CP1252 ) . Also see .Va charset-unknown-8bit to deal with another hairy aspect of message interpretation. . .Pp In general, if a message saying .Dq cannot convert from a to b appears, either some characters are not appropriate for the currently selected (terminal) character set, or the needed conversion is not supported by the system. In the first case, it is necessary to set an appropriate .Ev LC_CTYPE locale and/or the variable .Va ttycharset . The best results are usually achieved when running in a UTF-8 locale on a UTF-8 capable terminal, in which case the full Unicode spectrum of characters is available. In this setup characters from various countries can be displayed, while it is still possible to use more simple character sets for sending to retain maximum compatibility with older mail clients. . .Pp On the other hand the POSIX standard defines a locale-independent 7-bit .Dq portable character set that should be used when overall portability is an issue, the even more restricted subset named .Dq portable filename character set consists of A-Z, a-z, 0-9, period .Ql \&. , underscore .Ql _ and hyphen-minus .Ql - . .\" }}} . .\" .Ss "Message states" {{{ .Ss "Message states" . \*(UA differentiates in between several message states; the current state will be reflected in the summary of .Ic headers if the .Va attrlist of the configured .Va headline allows, and .Sx "Specifying messages" dependent on their state is possible. When operating on the system .Va inbox , or in any other .Mx -sx .Sx "primary system mailbox" , special actions, like the automatic moving of messages to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX , may be applied when the mailbox is left (also implicitly by program termination, unless the command .Ic exit was used) \(en however, because this may be irritating to users which are used to .Dq more modern mail-user-agents, the provided global .Pa \*(UR template sets the internal .Va hold and .Va keepsave variables in order to suppress this behaviour. . .Bl -hang -width ".It Ql new" .It Ql new Message has neither been viewed nor moved to any other state. Such messages are retained even in the .Mx -sx .Sx "primary system mailbox" . . .It Ql unread Message has neither been viewed nor moved to any other state, but the message was present already when the mailbox has been opened last: Such messages are retained even in the .Mx -sx .Sx "primary system mailbox" . . .It Ql read The message has been processed by one of the following commands: .Ic ~f , .Ic ~m , .Ic ~F , .Ic ~M , .Ic copy , .Ic mbox , .Ic next , .Ic pipe , .Ic Print , .Ic print , .Ic top , .Ic Type , .Ic type , .Ic undelete . The commands .Ic dp and .Ic dt will always try to automatically .Dq step and .Ic type the .Dq next logical message, and may thus mark multiple messages as read, the .Ic delete command will do so if the internal variable .Va autoprint is set. .Pp Except when the .Ic exit command is used, messages that are in a .Mx -sx .Sx "primary system mailbox" and are in .Ql read state when the mailbox is left will be saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX unless the internal variable .Va hold it set. . .It Ql deleted The message has been processed by one of the following commands: .Ic delete , .Ic dp , .Ic dt . Only .Ic undelete can be used to access such messages. . .It Ql preserved The message has been processed by a .Ic preserve command and it will be retained in its current location. . .It Ql saved The message has been processed by one of the following commands: .Ic save or .Ic write . Unless when the .Ic exit command is used, messages that are in a .Mx -sx .Sx "primary system mailbox" and are in .Ql saved state when the mailbox is left will be deleted; they will be saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX when the internal variable .Va keepsave is set. .El . .Pp In addition to these message states, flags which otherwise have no technical meaning in the mail system except allowing special ways of addressing them when .Sx "Specifying messages" can be set on messages. These flags are saved with messages and are thus persistent, and are portable between a set of widely used MUAs. . .Bl -hang -width ".It Ic answered" .It Ic answered Mark messages as having been answered. .It Ic draft Mark messages as being a draft. .It Ic flag Mark messages which need special attention. .El .\" }}} . .\" .Ss "Specifying messages" {{{ .Ss "Specifying messages" . \*(NQ .Ic COMMANDS which take .Sx "Message list arguments" , such as .Ic search , .Ic type , .Ic copy , and .Ic delete , can perform actions on a number of messages at once. Specifying invalid messages, or using illegal syntax, will cause errors to be reported through the .Sx "INTERNAL VARIABLES" .Va \&! , .Va ^ERR and companions, as well as the command exit status .Va \&? . . .Pp For example, .Ql delete 1 2 deletes the messages 1 and 2, whereas .Ql delete 1-5 will delete the messages 1 through 5. In sorted or threaded mode (see the .Ic sort command), .Ql delete 1-5 will delete the messages that are located between (and including) messages 1 through 5 in the sorted/threaded order, as shown in the .Ic headers summary. . .Pp Errors can for example be .Va ^ERR Ns -BADMSG when requesting an invalid message, .Va ^ERR Ns -NOMSG if no applicable message can be found, .Va ^ERR Ns -CANCELED for missing informational data (mostly thread-related). .Va ^ERR Ns -INVAL for invalid syntax as well as .Va ^ERR Ns -IO for input/output errors can happen. The following special message names exist: . . .Bl -tag -width ".It Ar BaNg" .It Ar \&. The current message, the so-called .Dq dot . . .It Ar \&; The message that was previously the current message; needs to be quoted. . .It Ar \&, The parent message of the current message, that is the message with the Message-ID given in the .Ql In-Reply-To: field or the last entry of the .Ql References: field of the current message. . .It Ar - The previous undeleted message, or the previous deleted message for the .Ic undelete command; In .Ic sort Ns ed or .Ql thread Ns ed mode, the previous such message in the according order. . .It Ar + The next undeleted message, or the next deleted message for the .Ic undelete command; In .Ic sort Ns ed or .Ql thread Ns ed mode, the next such message in the according order. . .It Ar ^ The first undeleted message, or the first deleted message for the .Ic undelete command; In .Ic sort Ns ed or .Ql thread Ns ed mode, the first such message in the according order. . .It Ar $ The last message; In .Ic sort Ns ed or .Ql thread Ns ed mode, the last such message in the according order. Needs to be quoted. . .It Ar & Ns Ar x In .Ql thread Ns ed .Ic sort mode, selects the message addressed with .Ar x , where .Ar x is any other message specification, and all messages from the thread that begins at it. Otherwise it is identical to .Ar x . If .Ar x is omitted, the thread beginning with the current message is selected. . .It Ar * All messages. . .It Ar ` All messages that were included in the .Sx "Message list arguments" of the previous command; needs to be quoted. (A convenient way to read all new messages is to select them via .Ql from :n , as below, and then to read them in order with the default command \(em .Ic next \(em simply by successively typing .Ql ` ; for this to work .Va showlast must be set.) . .It Ar x-y An inclusive range of message numbers. Selectors that may also be used as endpoints include any of .Ar .;-+^$ . . .It Ar address A case-insensitive .Dq any substring matches search against the .Ql From: header, which will match addresses (too) even if .Va showname is set (and POSIX says .Dq any address as shown in a header summary shall be matchable in this form ) ; However, if the .Va allnet variable is set, only the local part of the address is evaluated for the comparison, not ignoring case, and the setting of .Va showname is completely ignored. For finer control and match boundaries use the .Ql @ search expression. . .It Ar / Ns Ar string All messages that contain .Ar string in the subject field (case ignored according to locale). See also the .Va searchheaders variable. If .Ar string is empty, the string from the previous specification of that type is used again. . . .It Xo Op Ar @ Ns Ar name-list Ns .Ar @ Ns Ar expr .Xc All messages that contain the given case-insensitive search .Ar expr Ns ession; If the \*(OPal regular expression support is available .Ar expr will be interpreted as (an extended) one if any of the .Mx -sx .Sx "magic regular expression characters" is seen. If the optional .Ar @ Ns Ar name-list part is missing the search is restricted to the subject field body, but otherwise .Ar name-list specifies a comma-separated list of header fields to search, for example . .Pp .Dl '@to,from,cc@Someone i ought to know' . .Pp In order to search for a string that includes a .Ql @ (commercial at) character the .Ar name-list is effectively non-optional, but may be given as the empty string. Also, specifying an empty search .Ar expr Ns ession will effectively test for existence of the given header fields. Some special header fields may be abbreviated: .Ql f , .Ql t , .Ql c , .Ql b and .Ql s will match .Ql From , .Ql To , .Ql Cc , .Ql Bcc and .Ql Subject , respectively and case-insensitively. \*(OPally, and just like .Ar expr , .Ar name-list will be interpreted as (an extended) regular expression if any of the .Mx -sx .Sx "magic regular expression characters" is seen. . .Pp The special names .Ql header or .Ql < can be used to search in (all of) the header(s) of the message, and the special names .Ql body or .Ql > and .Ql text or .Ql = will perform full text searches \(en whereas the former searches only the body, the latter also searches the message header (\*(ID this mode yet brute force searches over the entire decoded content of messages, including administrativa strings). . .Pp This specification performs full text comparison, but even with regular expression support it is almost impossible to write a search expression that safely matches only a specific address domain. To request that the body content of the header is treated as a list of addresses, and to strip those down to the plain email address which the search expression is to be matched against, prefix the effective .Ar name-list with a tilde .Ql ~ : . .Pp .Dl '@~f,c@@a\e.safe\e.domain\e.match$' . . .It Ar :c All messages of state or with matching condition .Ql c , where .Ql c is one or multiple of the following colon modifiers: .Pp .Bl -tag -compact -width ".It Ar :M" .It Ar a .Ic answered messages (cf. the variable .Va markanswered ) . .It Ar d .Ql deleted messages (for the .Ic undelete and .Ic from commands only). .It Ar f .Ic flag Ns ged messages. .It Ar L Messages with receivers that match .Ic mlsubscribe Ns d addresses. .It Ar l Messages with receivers that match .Ic mlist Ns ed addresses. .It Ar n .Ql new messages. .It Ar o Old messages (any not in state .Ql read or .Ql new ) . .It Ar r .Ql read messages. .It Ar S \*(OP Messages with unsure spam classification (see .Sx "Handling spam" ) . .It Ar s \*(OP Messages classified as spam. .It Ar t Messages marked as .Ic draft . .It Ar u .Ql unread messages. .El .El . . .Pp \*(OP IMAP-style SEARCH expressions may also be used. These consist of keywords and criterions, and because .Sx "Message list arguments" are split into tokens according to .Sx "Shell-style argument quoting" it is necessary to quote the entire IMAP search expression in order to ensure that it remains a single token. This addressing mode is available with all types of mailbox .Ic folder Ns s; \*(UA will perform the search locally as necessary. Strings must be enclosed by double quotation marks .Ql \&" in their entirety if they contain whitespace or parentheses; within the quotes, only reverse solidus .Ql \e is recognized as an escape character. All string searches are case-insensitive. When the description indicates that the .Dq envelope representation of an address field is used, this means that the search string is checked against both a list constructed as . .Bd -literal -offset indent \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)' .Ed . .Pp for each address, and the addresses without real names from the respective header field. These search expressions can be nested using parentheses, see below for examples. . .Pp .Bl -tag -compact -width ".It Ar _n_u" .It Ar ( criterion ) All messages that satisfy the given .Ar criterion . .It Ar ( criterion1 criterion2 ... criterionN ) All messages that satisfy all of the given criteria. . .It Ar ( or criterion1 criterion2 ) All messages that satisfy either .Ar criterion1 or .Ar criterion2 , or both. To connect more than two criteria using .Ql or specifications have to be nested using additional parentheses, as with .Ql (or a (or b c)) , since .Ql (or a b c) really means .Ql ((a or b) and c) . For a simple .Ql or operation of independent criteria on the lowest nesting level, it is possible to achieve similar effects by using three separate criteria, as with .Ql (a) (b) (c) . . .It Ar ( not criterion ) All messages that do not satisfy .Ar criterion . .It Ar ( bcc \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql Bcc: field. .It Ar ( cc \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql Cc: field. .It Ar ( from \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql From: field. .It Ar ( subject \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the .Ql Subject: field. .It Ar ( to \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql To: field. .It Ar ( header name \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the specified .Ql Name: field. .It Ar ( body \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in their body. .It Ar ( text \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in their header or body. .It Ar ( larger size ) All messages that are larger than .Ar size (in bytes). .It Ar ( smaller size ) All messages that are smaller than .Ar size (in bytes). . .It Ar ( before date ) All messages that were received before .Ar date , which must be in the form .Ql d[d]-mon-yyyy , where .Ql d denotes the day of the month as one or two digits, .Ql mon is the name of the month \(en one of .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec , and .Ql yyyy is the year as four digits, for example .Ql 28-Dec-2012 . . .It Ar ( on date ) All messages that were received on the specified date. .It Ar ( since date ) All messages that were received since the specified date. .It Ar ( sentbefore date ) All messages that were sent on the specified date. .It Ar ( senton date ) All messages that were sent on the specified date. .It Ar ( sentsince date ) All messages that were sent since the specified date. .It Ar () The same criterion as for the previous search. This specification cannot be used as part of another criterion. If the previous command line contained more than one independent criterion then the last of those criteria is used. .El .\" }}} . .\" .Ss "On terminal control and line editor" {{{ review .Ss "On terminal control and line editor" . \*(OP Terminal control through one of the standard .Ux libraries, .Lb libtermcap or .Lb libterminfo , may be available. For the .Ev TERM Ns inal defined in the environment interactive usage aspects, for example .Sx "Coloured display" , and insight of cursor and function keys for the Mailx-Line-Editor (MLE), will be enhanced or enabled. Library interaction can be disabled on a per-invocation basis via .Va termcap-disable , whereas the internal variable .Va termcap is always used as a preferred source of terminal capabilities. (For a usage example see the .Sx FAQ entry .Sx "Not \(dqdefunctional\(dq, but the editor key does not work" . ) . .Pp \*(OP The built-in Mailx-Line-Editor (MLE) should work in all environments which comply to the ISO C standard .St -isoC-amd1 , and will support wide glyphs if possible (the necessary functionality had been removed from ISO C, but was included in .St -xpg4 ) . Usage of a line editor in interactive mode can be prevented by setting .Va line-editor-disable . Especially if the \*(OPal terminal control support is missing setting entries in .Va termcap will help shall the MLE misbehave, see there for more. The MLE can support a little bit of .Ic colour . . .Pp \*(OP If the .Ic history feature is available then input from line editor prompts will be saved in a history list that can be searched in and be expanded from. Such saving can be prevented by prefixing input with any amount of whitespace. Aspects of history, like allowed content and maximum size, as well as whether history shall be saved persistently, can be configured with the internal variables .Va history-file , .Va history-gabby , .Va history-gabby-persist and .Va history-size . There also exists the macro hook .Va on-history-addition which can be used to apply finer control on what enters history. . .Pp The MLE supports a set of editing and control commands. By default (as) many (as possible) of these will be assigned to a set of single-letter control codes, which should work on any terminal (and can be generated by holding the .Dq control key while pressing the key of desire, for example .Ql control-D ) . If the \*(OPal .Ic bind command is available then the MLE commands can also be accessed freely by assigning the command name, which is shown in parenthesis in the list below, to any desired key-sequence, and the MLE will instead and also use .Ic bind to establish its built-in key bindings (more of them if the \*(OPal terminal control is available), an action which can then be suppressed completely by setting .Va line-editor-no-defaults . .Sx "Shell-style argument quoting" notation is used in the following: . . .Pp .Bl -tag -compact -width ".It Ql \eBa" .It Ql \ecA Go to the start of the line .Mx .Pf ( Cd mle-go-home ) . . .It Ql \ecB Move the cursor backward one character .Mx .Pf ( Cd mle-go-bwd ) . . .It Ql \ecC .Xr raise 3 .Ql SIGINT .Mx .Pf ( Cd mle-raise-int ) . . .It Ql \ecD Forward delete the character under the cursor; quits \*(UA if used on the empty line unless the internal variable .Va ignoreeof is set .Mx .Pf ( Cd mle-del-fwd ) . . .It Ql \ecE Go to the end of the line .Mx .Pf ( Cd mle-go-end ) . . .It Ql \ecF Move the cursor forward one character .Mx .Pf ( Cd mle-go-fwd ) . . .It Ql \ecG Cancel current operation, full reset. If there is an active history search or tabulator expansion then this command will first reset that, reverting to the former line content; thus a second reset is needed for a full reset in this case .Mx .Pf ( Cd mle-reset ) . . .It Ql \ecH Backspace: backward delete one character .Mx .Pf ( Cd mle-del-bwd ) . . .It Ql \ecI \*(NQ Horizontal tabulator: try to expand the word before the cursor, supporting the usual .Sx "Filename transformations" .Mx .Pf ( Cd mle-complete ; this is affected by .Cd mle-quote-rndtrip and .Va line-editor-cpl-word-breaks ) . . .It Ql \ecJ Newline: commit the current line .Mx .Pf ( Cd mle-commit ) . . .It Ql \ecK Cut all characters from the cursor to the end of the line .Mx .Pf ( Cd mle-snarf-end ) . . .It Ql \ecL Repaint the line .Mx .Pf ( Cd mle-repaint ) . . .It Ql \ecN \*(OP Go to the next history entry .Mx .Pf ( Cd mle-hist-fwd ) . . .It Ql \ecO (\*(OPally context-dependent) Invokes the command .Ic dt . . .It Ql \ecP \*(OP Go to the previous history entry .Mx .Pf ( Cd mle-hist-bwd ) . . .It Ql \ecQ Toggle roundtrip mode shell quotes, where produced, on and off .Mx .Pf ( Cd mle-quote-rndtrip ) . This setting is temporary, and will be forgotten once the command line is committed; also see .Ic shcodec . . .It Ql \ecR \*(OP Complete the current line from (the remaining) older history entries .Mx .Pf ( Cd mle-hist-srch-bwd ) . . .It Ql \ecS \*(OP Complete the current line from (the remaining) newer history entries .Mx .Pf ( Cd mle-hist-srch-fwd ) . . .It Ql \ecT Paste the snarf buffer .Mx .Pf ( Cd mle-paste ) . . .It Ql \ecU The same as .Ql \ecA followed by .Ql \ecK .Mx .Pf ( Cd mle-snarf-line ) . . .It Ql \ecV Prompts for a Unicode character (hexadecimal number without prefix, see .Ic vexpr ) to be inserted .Mx .Pf ( Cd mle-prompt-char ) . Note this command needs to be assigned to a single-letter control code in order to become recognized and executed during input of a key-sequence (only three single-letter control codes can be used for that shortcut purpose); this control code is then special-treated and thus cannot be part of any other sequence (because it will trigger the .Cd \&\&mle-prompt-char function immediately). . .It Ql \ecW Cut the characters from the one preceding the cursor to the preceding word boundary .Mx .Pf ( Cd mle-snarf-word-bwd ) . . .It Ql \ecX Move the cursor forward one word boundary .Mx .Pf ( Cd mle-go-word-fwd ) . . .It Ql \ecY Move the cursor backward one word boundary .Mx .Pf ( Cd mle-go-word-bwd ) . . .It Ql \ecZ .Xr raise 3 .Ql SIGTSTP .Mx .Pf ( Cd mle-raise-tstp ) . . .It Ql \ec[ Escape: reset a possibly used multibyte character input state machine and \*(OPally a lingering, incomplete key binding .Mx .Pf ( Cd mle-cancel ) . This command needs to be assigned to a single-letter control code in order to become recognized and executed during input of a key-sequence (only three single-letter control codes can be used for that shortcut purpose). This control code may also be part of a multi-byte sequence, but if a sequence is active and the very control code is currently also an expected input, then the active sequence takes precedence and will consume the control code. . .It Ql \ec\e (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns + . . .It Ql \ec] (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns $ . . .It Ql \ec^ (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns 0 . . .It Ql \ec_ Cut the characters from the one after the cursor to the succeeding word boundary .Mx .Pf ( Cd mle-snarf-word-fwd ) . . .It Ql \ec? Backspace: .Cd mle-del-bwd . . .It \(en .Mx .Cd mle-bell : ring the audible bell. . .It \(en \*(OP .Mx .Cd mle-clear-screen : move the cursor home and clear the screen. . .It \(en .Mx .Cd mle-fullreset : different to .Cd mle-reset this will immediately reset a possibly active search etc. . .It \(en .Mx .Cd mle-go-screen-bwd : move the cursor backward one screen width. . .It \(en .Mx .Cd mle-go-screen-fwd : move the cursor forward one screen width. . .It \(en .Mx .Cd mle-raise-quit: .Xr raise 3 .Ql SIGQUIT . .El .\" }}} . .\" .Ss "Coloured display" {{{ review .Ss "Coloured display" . \*(OP Colours and font attributes through ANSI a.k.a. ISO 6429 SGR (select graphic rendition) escape sequences are optionally supported. Usage of colours and font attributes solely depends upon the capability of the detected terminal type .Pf ( Ev TERM ) , and as fine-tuned through .Va termcap . Colours and font attributes can be managed with the multiplexer command .Ic colour , and .Ic uncolour removes the given mappings. Setting .Va colour-disable suppresses usage of colour and font attribute sequences, while leaving established mappings unchanged. . .Pp Whether actually applicable colour and font attribute sequences should also be generated when output is going to be paged through the external .Ev PAGER (also see .Va crt Ns ) depends upon the setting of .Va colour-pager , because pagers usually need to be configured in order to support ISO escape sequences. Knowledge of some widely used pagers is however built-in, and in a clean environment it is often enough to simply set .Va colour-pager ; please refer to that variable for more on this topic. . .Pp It might make sense to conditionalize colour setup on interactive mode via .Ic if .Pf ( Ql terminal indeed means .Dq interactive ) : . .Bd -literal -offset indent if terminal && "$features" =% ,+colour, colour iso view-msginfo ft=bold,fg=green colour iso view-header ft=bold,fg=red (from|subject) # regex colour iso view-header fg=red uncolour iso view-header from,subject colour iso view-header ft=bold,fg=magenta,bg=cyan colour 256 view-header ft=bold,fg=208,bg=230 "subject,from" colour mono view-header ft=bold colour mono view-header ft=bold,ft=reverse subject,from endif .Ed .\" }}} . .\" .Ss "Handling spam" {{{ .Ss "Handling spam" . \*(OP \*(UA can make use of several spam interfaces for the purpose of identification of, and, in general, dealing with spam messages. A precondition of most commands in order to function is that the .Va spam-interface variable is set to one of the supported interfaces. .Sx "Specifying messages" that have been identified as spam is possible via their (volatile) .Ql is-spam state by using the .Ql Ar :s and .Ql Ar :S specifications, and their .Va attrlist entries will be used when displaying the .Va headline in the summary of .Ic headers . . .Bl -bullet .It .Ic spamrate rates the given messages and sets their .Ql is-spam flag accordingly. If the spam interface offers spam scores these can be shown in .Va headline by using the format .Ql %$ . .It .Ic spamham , .Ic spamspam and .Ic spamforget will interact with the Bayesian filter of the chosen interface and learn the given messages as .Dq ham or .Dq spam , respectively; the last command can be used to cause .Dq unlearning of messages; it adheres to their current .Ql is-spam state and thus reverts previous teachings. .It .Ic spamclear and .Ic spamset will simply set and clear, respectively, the mentioned volatile .Ql is-spam message flag, without any interface interaction. .El . .Pp The .Xr spamassassin 1 based .Va spam-interface .Ql spamc requires a running instance of the .Xr spamd 1 server in order to function, started with the option .Fl -allow-tell shall Bayesian filter learning be possible. . .Bd -literal -offset indent $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l] $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e --daemonize [--local] [--allow-tell] .Ed . .Pp Thereafter \*(UA can make use of these interfaces: . .Bd -literal -offset indent $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e -Sspamc-command=/usr/local/bin/spamc \e -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user= or $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e -Sspamc-command=/usr/local/bin/spamc \e -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user= .Ed . .Pp Using the generic filter approach allows usage of programs like .Xr bogofilter 1 . Here is an example, requiring it to be accessible via .Ev PATH : . .Bd -literal -offset indent $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e -Sspamfilter-ham="bogofilter -n" \e -Sspamfilter-noham="bogofilter -N" \e -Sspamfilter-nospam="bogofilter -S" \e -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e -Sspamfilter-spam="bogofilter -s" \e -Sspamfilter-rate-scanscore="1;^(.+)$" .Ed . .Pp Because messages must exist on local storage in order to be scored (or used for Bayesian filter training), it is possibly a good idea to perform the local spam check last. Spam can be checked automatically when opening specific folders by setting a specialized form of the internal variable .Va folder-hook . . .Bd -literal -offset indent define spamdelhook { # Server side DCC spamset (header x-dcc-brand-metrics "bulk") # Server-side spamassassin(1) spamset (header x-spam-flag "YES") del :s # TODO we HAVE to be able to do `spamrate :u ! :sS' move :S +maybe-spam spamrate :u del :s move :S +maybe-spam } set folder-hook-SOMEFOLDER=spamdelhook .Ed . .Pp See also the documentation for the variables .Va spam-interface , spam-maxsize , .Va spamc-command , spamc-arguments , spamc-user , .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \ spamfilter-rate and .Va spamfilter-rate-scanscore . .\" }}} . .\" }}} (DESCRIPTION) . . .\" .Sh COMMANDS {{{ .Sh COMMANDS . \*(UA reads input in lines. An unquoted reverse solidus .Ql \e at the end of a command line .Dq escapes the newline character: it is discarded and the next line of input is used as a follow-up line, with all leading whitespace removed; once an entire line is completed, the whitespace characters .Cm space , tabulator , newline as well as those defined by the variable .Va ifs are removed from the beginning and end. Placing any whitespace characters at the beginning of a line will prevent a possible addition of the command line to the \*(OPal .Ic history . . .Pp The beginning of such input lines is then scanned for the name of a known command: command names may be abbreviated, in which case the first command that matches the given prefix will be used. .Sx "Command modifiers" may prefix a command in order to modify its behaviour. A name may also be a .Ic commandalias , which will become expanded until no more expansion is possible. Once the command that shall be executed is known, the remains of the input line will be interpreted according to command-specific rules, documented in the following. . .Pp This behaviour is different to the .Xr sh 1 Ns ell, which is a programming language with syntactic elements of clearly defined semantics, and therefore capable to sequentially expand and evaluate individual elements of a line. .Ql \&? set one=value two=$one for example will never possibly assign value to one, because the variable assignment is performed no sooner but by the command .Pf ( Ic set ) , long after the expansion happened. . .Pp A list of all commands in lookup order is dumped by the command .Ic list . \*(OPally the command .Ic help (or .Ic \&? ) , when given an argument, will show a documentation string for the command matching the expanded argument, as in .Ql \&?t , which should be a shorthand of .Ql \&?type ; with these documentation strings both commands support a more .Va verbose listing mode which includes the argument type of the command and other information which applies; a handy suggestion might thus be: . .Bd -literal -offset indent ? define __xv { # Before v15: need to enable sh(1)ell-style on _entire_ line! localopts yes;wysh set verbose;ignerr eval "${@}";return ${?} } ? commandalias xv '\ecall __xv' ? xv help set .Ed . .\" .Ss "Command modifiers" {{{ .Ss "Command modifiers" . Commands may be prefixed by none to multiple command modifiers. Some command modifiers can be used with a restricted set of commands only, the .Va verbose version of .Ic list will (\*(OPally) show which modifiers apply. . .Bl -bullet .It The modifier reverse solidus .Mx .Cm \e , to be placed first, prevents .Ic commandalias expansions on the remains of the line, for example .Ql \eecho will always evaluate the command .Ic echo , even if an (command)alias of the same name exists. .Ic commandalias content may itself contain further command modifiers, including an initial reverse solidus to prevent further expansions. . .It The modifier .Mx .Cm ignerr indicates that any error generated by the following command should be ignored by the state machine and not cause a program exit with enabled .Va errexit or for the standardized exit cases in .Va posix mode. .Va \&? , one of the .Sx "INTERNAL VARIABLES" , will be set to the real exit status of the command regardless. . .It .Mx .Cm local will alter the called command to apply changes only temporarily, local to block-scope, and can thus only be used inside of a .Ic define Ns d macro or an .Ic account definition. Specifying it implies the modifier .Cm wysh . Local variables will not be inherited by macros deeper in the .Ic call chain, and all local settings will be garbage collected once the local scope is left. To record and unroll changes in the global scope use the command .Ic localopts . . .It .Mx .Cm scope does yet not implement any functionality. . .It .Mx .Cm u does yet not implement any functionality. . .It Some commands support the .Mx .Cm vput modifier: if used, they expect the name of a variable, which can itself be a variable, i.e., shell expansion is applied, as their first argument, and will place their computation result in it instead of the default location (it is usually written to standard output). .Pp The given name will be tested for being a valid .Xr sh 1 variable name, and may therefore only consist of upper- and lowercase characters, digits, and the underscore; the hyphen-minus may be used as a non-portable extension; digits may not be used as first, hyphen-minus may not be used as last characters. In addition the name may either not be one of the known .Sx "INTERNAL VARIABLES" , or must otherwise refer to a writable (non-boolean) value variable. The actual put operation may fail nonetheless, for example if the variable expects a number argument only a number will be accepted. Any error during these operations causes the command as such to fail, and the error number .Va \&! will be set to .Va ^ERR Ns -NOTSUP , the exit status .Va \&? should be set to .Ql -1 , but some commands deviate from the latter, which is documented. . .It Last, but not least, the modifier .Mx .Cm wysh can be used for some old and established commands to choose the new .Sx "Shell-style argument quoting" rules over the traditional .Sx "Old-style argument quoting" . This modifier is implied if .Va v15-compat is set to a non-empty value. .El .\" }}} . .\" .Ss "Old-style argument quoting" v15-compat: rename Obsolete.. {{{ .Ss "Old-style argument quoting" . \*(ID This section documents the traditional and POSIX standardized style of quoting non-message list arguments to commands which expect this type of arguments: whereas still used by the majority of such commands, the new .Sx "Shell-style argument quoting" may be available even for those via .Cm wysh , one of the .Sx "Command modifiers" . Nonetheless care must be taken, because only new commands have been designed with all the capabilities of the new quoting rules in mind, which can, for example generate control characters. . . .Bl -bullet -offset indent .It An argument can be enclosed between paired double-quotes .Ql """argument""" or single-quotes .Ql 'argument' ; any whitespace, shell word expansion, or reverse solidus characters (except as described next) within the quotes are treated literally as part of the argument. A double-quote will be treated literally within single-quotes and vice versa. Inside such a quoted string the actually used quote character can be used nonetheless by escaping it with a reverse solidus .Ql \e , as in .Ql """y\e""ou""" . . .It An argument that is not enclosed in quotes, as above, can usually still contain space characters if those spaces are reverse solidus escaped, as in .Ql you\e are . . .It A reverse solidus outside of the enclosing quotes is discarded and the following character is treated literally as part of the argument. .El .\" }}} . .\" .Ss "Shell-style argument quoting" {{{ .Ss "Shell-style argument quoting" . .Xr sh 1 Ns ell-style, and therefore POSIX standardized, argument parsing and quoting rules are used by most commands. \*(ID Most new commands only support these new rules and are flagged \*(NQ, some elder ones can use them with the command modifier .Cm wysh ; in the future only this type of argument quoting will remain. . .Pp A command line is parsed from left to right and an input token is completed whenever an unquoted, otherwise ignored, metacharacter is seen. Metacharacters are vertical bar .Cm \&| , ampersand .Cm & , semicolon .Cm \&; , as well as all characters from the variable .Va ifs , and / or .Cm space , tabulator , newline . The additional metacharacters left and right parenthesis .Cm \&( , \&) and less-than and greater-than signs .Cm < , > that the .Xr sh 1 supports are not used, and are treated as ordinary characters: for one these characters are a vivid part of email addresses, and it seems highly unlikely that their function will become meaningful to \*(UA. . .Bd -filled -offset indent .Sy Compatibility note: \*(ID Please note that even many new-style commands do not yet honour .Va ifs to parse their arguments: whereas the .Xr sh 1 Ns ell is a language with syntactic elements of clearly defined semantics, \*(UA parses entire input lines and decides on a per-command base what to do with the rest of the line. This also means that whenever an unknown command is seen all that \*(UA can do is cancellation of the processing of the remains of the line. .Pp It also often depends on an actual subcommand of a multiplexer command how the rest of the line should be treated, and until v15 we are not capable to perform this deep inspection of arguments. Nonetheless, at least the following commands which work with positional parameters fully support .Va ifs for an almost shell-compatible field splitting: .Ic call , call_if , read , vpospar , xcall . .Ed . .Pp Any unquoted number sign .Ql # at the beginning of a new token starts a comment that extends to the end of the line, and therefore ends argument processing. An unquoted dollar sign .Ql $ will cause variable expansion of the given name, which must be a valid .Xr sh 1 Ns ell-style variable name (see .Cm vput ) : .Sx "INTERNAL VARIABLES" as well as .Sx ENVIRONMENT (shell) variables can be accessed through this mechanism, brace enclosing the name is supported (i.e., to subdivide a token). . .Pp Whereas the metacharacters .Cm space , tabulator , newline only complete an input token, vertical bar .Cm \&| , ampersand .Cm & and semicolon .Cm \&; also act as control operators and perform control functions. For now supported is semicolon .Cm \&; , which terminates a single command, therefore sequencing the command line and making the remainder of the line a subject to reevaluation. With sequencing, multiple command argument types and quoting rules may therefore apply to a single line, which can become problematic before v15: e.g., the first of the following will cause surprising results. . .Pp .Dl ? echo one; set verbose; echo verbose=$verbose. .Dl ? echo one; wysh set verbose; echo verbose=$verbose. . .Pp Quoting is a mechanism that will remove the special meaning of metacharacters and reserved words, and will prevent expansion. There are four quoting mechanisms: the escape character, single-quotes, double-quotes and dollar-single-quotes: . . .Bl -bullet -offset indent .It The literal value of any character can be preserved by preceding it with the escape character reverse solidus .Ql \e . . .It Arguments which are enclosed in .Ql 'single-\:quotes' retain their literal value. A single-quote cannot occur within single-quotes. . .It The literal value of all characters enclosed in .Ql \(dqdouble-\:quotes\(dq is retained, with the exception of dollar sign .Ql $ , which will cause variable expansion, as above, backquote (grave accent) .Ql ` , (which not yet means anything special), reverse solidus .Ql \e , which will escape any of the characters dollar sign .Ql $ (to prevent variable expansion), backquote (grave accent) .Ql ` , double-quote .Ql \(dq (to prevent ending the quote) and reverse solidus .Ql \e (to prevent escaping, i.e., to embed a reverse solidus character as-is), but has no special meaning otherwise. . .It Arguments enclosed in .Ql $'dollar-\:single-\:quotes' extend normal single quotes in that reverse solidus escape sequences are expanded as follows: .Pp .Bl -tag -compact -width ".Ql \eNNN" .It Ql \ea bell control character (ASCII and ISO-10646 BEL). .It Ql \eb backspace control character (ASCII and ISO-10646 BS). .It Ql \eE escape control character (ASCII and ISO-10646 ESC). .It Ql \ee the same. .It Ql \ef form feed control character (ASCII and ISO-10646 FF). .It Ql \en line feed control character (ASCII and ISO-10646 LF). .It Ql \er carriage return control character (ASCII and ISO-10646 CR). .It Ql \et horizontal tabulator control character (ASCII and ISO-10646 HT). .It Ql \ev vertical tabulator control character (ASCII and ISO-10646 VT). .It Ql \e\e emits a reverse solidus character. .It Ql \e' single quote. .It Ql \e" double quote (escaping is optional). .It Ql \eNNN eight-bit byte with the octal value .Ql NNN (one to three octal digits), optionally prefixed by an additional .Ql 0 . A 0 byte will suppress further output for the quoted argument. .It Ql \exHH eight-bit byte with the hexadecimal value .Ql HH (one or two hexadecimal characters, no prefix, see .Ic vexpr ) . A 0 byte will suppress further output for the quoted argument. .It Ql \eUHHHHHHHH the Unicode / ISO-10646 character with the hexadecimal codepoint value .Ql HHHHHHHH (one to eight hexadecimal characters) \(em note that Unicode defines the maximum codepoint ever to be supported as .Ql 0x10FFFF (in planes of .Ql 0xFFFF characters each). This escape is only supported in locales that support Unicode (see .Sx "Character sets" ) , in other cases the sequence will remain unexpanded unless the given code point is ASCII compatible or (if the \*(OPal character set conversion is available) can be represented in the current locale. The character NUL will suppress further output for the quoted argument. .It Ql \euHHHH Identical to .Ql \eUHHHHHHHH except it takes only one to four hexadecimal characters. .It Ql \ecX Emits the non-printable (ASCII and compatible) C0 control codes 0 (NUL) to 31 (US), and 127 (DEL). Printable representations of ASCII control codes can be created by mapping them to a different, visible part of the ASCII character set. Adding the number 64 achieves this for the codes 0 to 31, here 7 (BEL): .Ql 7 + 64 = 71 = G . The real operation is a bitwise logical XOR with 64 (bit 7 set, see .Ic vexpr ) , thus also covering code 127 (DEL), which is mapped to 63 (question mark): .Ql \&?\0vexpr\0^\0127\064 . .Pp Whereas historically circumflex notation has often been used for visualization purposes of control codes, as in .Ql ^G , the reverse solidus notation has been standardized: .Ql \ecG . Some control codes also have standardized (ISO-10646, ISO C) aliases, as shown above .Pf ( Ql \ea , .Ql \en , .Ql \et etc) : whenever such an alias exists it will be used for display purposes. The control code NUL .Pf ( Ql \ec@ , a non-standard extension) will suppress further output for the remains of the token (which may extend beyond the current quote), or, depending on the context, the remains of all arguments for the current command. .It Ql \e$NAME Non-standard extension: expand the given variable name, as above. Brace enclosing the name is supported. .It Ql \e`{command} Not yet supported, just to raise awareness: Non-standard extension. .El .El . .Pp Caveats: . .Bd -literal -offset indent ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment ? echo Quotes ${HOME} and tokens differ! # comment ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A' .Ed .\" }}} . .\" .Ss "Message list arguments" {{{ .Ss "Message list arguments" . Many commands operate on message list specifications, as documented in .Sx "Specifying messages" . The argument input is first split into individual tokens via .Sx "Shell-style argument quoting" , which are then interpreted as the mentioned specifications. If no explicit message list has been specified, many commands will search for and use the next message forward that satisfies the commands' requirements, and if there are no messages forward of the current message, the search proceeds backwards; if there are no good messages at all to be found, an error message is shown and the command is aborted. The .Va verbose output of the command .Ic list will indicate whether a command searches for a default message, or not. .\" }}} . .\" .Ss "Raw data arguments for codec commands" {{{ .Ss "Raw data arguments for codec commands" . A special set of commands, which all have the string .Dq codec in their name, like .Ic addrcodec , .Ic shcodec , .Ic urlcodec , take raw string data as input, which means that the content of the command input line is passed completely unexpanded and otherwise unchanged: like this the effect of the actual codec is visible without any noise of possible shell quoting rules etc., i.e., the user can input one-to-one the desired or questionable data. To gain a level of expansion, the entire command line can be .Ic eval Ns uated first, for example . .Bd -literal -offset indent ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt ? echo $res $'/usr/Sch\eu00F6nes Wetter/heute.txt' ? shcodec d $res $'/usr/Sch\eu00F6nes Wetter/heute.txt' ? eval shcodec d $res /usr/Sch\[:o]nes Wetter/heute.txt .Ed .\" }}} . .\" .Ss "Filename transformations" {{{ .Ss "Filename transformations" . Filenames, where expected, and unless documented otherwise, are subsequently subject to the following filename transformations, in sequence: . .Bl -bullet -offset indent .It If the given name is a registered .Ic shortcut , it will be replaced with the expanded shortcut. This step is mostly taken for .Ic folder Ns s only. . .It The filename is matched against the following patterns or strings. But for plus .Ar +file .Va folder expansion this step is mostly taken for .Ic folder Ns s only. . . .Pp .Bl -hang -compact -width ".Ar %user" .It Ar # (Number sign) is expanded to the previous file. . .It Ar % (Percent sign) is replaced by the invoking .Mx -ix "primary system mailbox" user's primary system mailbox, which either is the (itself expandable) .Va inbox if that is set, the standardized absolute pathname indicated by .Ev MAIL if that is set, or a built-in compile-time default otherwise. When opening a .Ic folder the used name is actively checked for being a primary mailbox, first against .Va \&\&inbox , then against .Ev MAIL . . .It Ar %user Expands to the primary system mailbox of .Ar user (and never the value of .Va inbox , regardless of its actual setting). . .It Ar & (Ampersand) is replaced with the invoking user's .Mx -ix "secondary mailbox" secondary mailbox, the .Ev MBOX . . .It Ar +file Refers to a .Ar file in the .Va folder directory (if that variable is set). . .It Ar %:filespec Expands to the same value as .Ar filespec , but has special meaning when used with, for example, the command .Ic folder : the file will be treated as a primary system mailbox by, among others, the .Ic mbox and .Ic save commands, meaning that messages that have been read in the current session will be moved to the .Ev MBOX mailbox instead of simply being flagged as read. .El . . .It Meta expansions may be applied to the resulting filename, as allowed by the operation and applicable to the resulting access protocol (also see .Sx "On URL syntax and credential lookup" ) . For the file-protocol, a leading tilde .Ql ~ character will be replaced by the expansion of .Ev HOME , except when followed by a valid user name, in which case the home directory of the given user is used instead. .Pp A shell expansion as if specified in double-quotes (see .Sx "Shell-style argument quoting" ) may be applied, so that any occurrence of .Ql $VARIABLE (or .Ql ${VARIABLE} ) will be replaced by the expansion of the variable, if possible; .Sx "INTERNAL VARIABLES" as well as .Sx ENVIRONMENT (shell) variables can be accessed through this mechanism. .Pp Shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) may be applied as documented. If the fully expanded filename results in multiple pathnames and the command is expecting only one file, an error results. .Pp In interactive context, in order to allow simple value acceptance (via .Dq ENTER ) , arguments will usually be displayed in a properly quoted form, so a file .Ql diet\e is \ecurd.txt may be displayed as .Ql 'diet\e is \ecurd.txt' . .El .\" }}} . .\" .Ss "Commands" {{{ .Ss "Commands" . The following commands are available: . .Bl -tag -width ".It Ic BaNg" . . .Mx .It Ic \&! Executes the .Ev SHELL command which follows, replacing unescaped exclamation marks with the previously executed command if the internal variable .Va bang is set. This command supports .Cm vput as documented in .Sx "Command modifiers" , and manages the error number .Va \&! . A 0 or positive exit status .Va \&? reflects the exit status of the command, negative ones that an error happened before the command was executed, or that the program did not exit cleanly, but maybe due to a signal: the error number is .Va ^ERR Ns -CHILD , then. . .Pp In conjunction with the .Cm vput modifier the following special cases exist: a negative exit status occurs if the collected data could not be stored in the given variable, which is a .Va ^ERR Ns -NOTSUP error that should otherwise not occur. .Va ^ERR Ns -CANCELED indicates that no temporary file could be created to collect the command output at first glance. In case of catchable out-of-memory situations .Va ^ERR Ns -NOMEM will occur and \*(UA will try to store the empty string, just like with all other detected error conditions. . . .Mx .It Ic # The comment-command causes the entire line to be ignored. .Sy Note: this really is a normal command which' purpose is to discard its arguments, not a .Dq comment-start indicating special character, which means that for example trailing comments on a line are not possible (except for commands which use .Sx "Shell-style argument quoting" ) . . .Mx .It Ic + Goes to the next message in sequence and types it (like .Dq ENTER ) . . .Mx .It Ic - Display the preceding message, or the n'th previous message if given a numeric argument n. . .Mx .It Ic = Shows the message number of the current message (the .Dq dot ) when used without arguments, that of the given list otherwise. Output numbers will be separated from each other with the first character of .Va ifs , and followed by the first character of .Va if-ws , if that is not empty and not identical to the first. If that results in no separation at all a .Cm space character is used. This command supports .Cm vput (see .Sx "Command modifiers" ) , and manages the error number .Va \&! . . .Mx .It Ic \&? \*(OP Show a brief summary of commands. \*(OP Given an argument a synopsis for the command in question is shown instead; commands can be abbreviated in general and this command can be used to see the full expansion of an abbreviation including the synopsis, try, for example .Ql \&?h , .Ql \&?hel and .Ql \&?help and see how the output changes. To avoid that aliases are resolved the modifier .Cm \e can be prepended to the argument, but note it must be quoted. This mode also supports a more .Va verbose output, which will provide the information documented for .Ic list . . .Mx .It Ic \&| A synonym for the .Ic pipe command. . .Mx .Mx .It Ic account , unaccount (ac, una) Creates, selects or lists (an) account(s). Accounts are special incarnations of .Ic define Ns d macros and group commands and variable settings which together usually arrange the environment for the purpose of creating an email account. Different to normal macros settings which are covered by .Ic localopts \(en here by default enabled! \(en will not be reverted before the .Ic account is changed again. The special account .Ql null (case-insensitive) always exists, and all but it can be deleted by the latter command, and in one operation with the special name .Ql * . Also for all but it a possibly set .Va on-account-cleanup hook is called once they are left, also for program exit. .Pp Without arguments a listing of all defined accounts is shown. With one argument the given account is activated: the system .Va inbox of that account will be activated (as via .Ic folder ) , a possibly installed .Va folder-hook will be run, and the internal variable .Va account will be updated. The two argument form behaves identical to defining a macro as via .Ic define . Important settings for accounts include .Va folder , from , hostname , inbox , mta , password and .Va user .Pf ( Sx "On URL syntax and credential lookup" ) , as well as things like .Va tls-config-pairs .Pf ( Sx "Encrypted network communication" ) , and protocol specifics like .Va imap-auth , pop3-auth , smtp-auth . .Bd -literal -offset indent account myisp { set folder=~/mail inbox=+syste.mbox record=+sent.mbox set from='(My Name) myname@myisp.example' set mta=smtp://mylogin@smtp.myisp.example } .Ed . . .Mx .It Ic addrcodec Perform email address codec transformations on raw-data argument, rather according to email standards (RFC 5322; \*(ID will furtherly improve). Supports .Cm vput (see .Sx "Command modifiers" ) , and manages the error number .Va \&! . The first argument must be either .Ar [+[+[+]]]e[ncode] , .Ar d[ecode] , .Ar s[kin] or .Ar skinl[ist] and specifies the operation to perform on the rest of the line. . .Pp Decoding will show how a standard-compliant MUA will display the given argument, which should be an email address. Please be aware that most MUAs have difficulties with the address standards, and vary wildly when (comments) in parenthesis, .Dq double-quoted strings, or quoted-pairs, as below, become involved. \*(ID \*(UA currently does not perform decoding when displaying addresses. . .Pp Skinning is identical to decoding but only outputs the plain address, without any string, comment etc. components. Another difference is that it may fail with the error number .Va \&! set to .Va ^ERR Ns -INVAL if decoding fails to find a(n) (valid) email address, in which case the unmodified input will be output again. . .Pp .Ar skinlist first performs a skin operation, and thereafter checks a valid address for whether it is a registered mailing list (see .Ic mlist and .Ic mlsubscribe ) , eventually reporting that state in the error number .Va \&! as .Va ^ERR Ns -EXIST . (This state could later become overwritten by an I/O error, though.) . .Pp Encoding supports four different modes, lesser automated versions can be chosen by prefixing one, two or three plus signs: the standard imposes a special meaning on some characters, which thus have to be transformed to so-called quoted-pairs by pairing them with a reverse solidus .Ql \e in order to remove the special meaning; this might change interpretation of the entire argument from what has been desired, however! Specify one plus sign to remark that parenthesis shall be left alone, two for not turning double quotation marks into quoted-pairs, and three for also leaving any user-specified reverse solidus alone. The result will always be valid, if a successful exit status is reported (\*(ID the current parser fails this assertion for some constructs). \*(ID Addresses need to be specified in between angle brackets .Ql < , .Ql > if the construct becomes more difficult, otherwise the current parser will fail; it is not smart enough to guess right. . .Bd -literal -offset indent ? addrc enc "Hey, you",\e out\e there "\e"Hey, you\e", \e\e out\e\e there" ? addrc d "\e"Hey, you\e", \e\e out\e\e there" "Hey, you", \e out\e there ? addrc s "\e"Hey, you\e", \e\e out\e\e there" diet@exam.ple .Ed . . .Mx .Mx .It Ic alias , unalias \*(NQ(a, una) Define or list, and remove, respectively, address aliases, which are a method of creating personal distribution lists that map a single name to none to multiple receivers, to be expanded after .Sx "Compose mode" is left; the expansion correlates with .Va metoo . The latter command removes all given aliases, the special name asterisk .Ql * will remove all existing aliases. When used without arguments the former shows a list of all currently known aliases, with one argument only the target(s) of the given one. When given two arguments, hyphen-minus .Ql - being the first, the target(s) of the second is/are expanded recursively. . .Pp In all other cases the given alias is newly defined, or will be appended to: arguments must either be themselves valid alias names, or any other address type (see .Sx "On sending mail, and non-interactive mode" ) . Recursive expansion of aliases can be prevented by prefixing the desired argument with the modifier reverse solidus .Cm \&\&\e . A valid alias name conforms to .Va mta-aliases syntax, but follow-up characters can also be the number sign .Ql # , colon .Ql \&: , commercial at .Ql @, exclamation mark .Ql \&! , period .Ql \&. as well as .Dq any character that has the high bit set . The dollar sign .Ql $ may be the last character. The number sign .Ql # may need .Sx "Shell-style argument quoting" . . .Pp .\" ALIASCOLON next sentence \*(ID Unfortunately the colon is currently not supported, as it interferes with normal address parsing rules. .\" ALIASCOLON next sentence \*(ID Such high bit characters will likely cause warnings at the moment for the same reasons why colon is unsupported; also, in the future locale dependent character set validity checks will be performed. . .Bd -literal -offset indent ? alias cohorts bill jkf mark kridle@ucbcory ~/cohorts.mbox ? alias mark mark@exam.ple ? set mta-aliases=/etc/aliases .Ed . . .Mx .Mx .It Ic alternates , unalternates \*(NQ (alt) Manage a list of alternate addresses or names of the active user, members of which will be removed from recipient lists (except one). There is a set of implicit alternates which is formed of the values of .Ev LOGNAME , .Va from , .Va sender and .Va reply-to . .Va from will not be used if .Va sender is set. The latter command removes the given list of alternates, the special name .Ql * will discard all existing alternate names. .Pp The former command manages the error number .Va \&! . It shows the current set of alternates when used without arguments; in this mode only it also supports .Cm vput (see .Sx "Command modifiers" ) . Otherwise the given arguments (after being checked for validity) are appended to the list of alternate names; in .Va posix mode they replace that list instead. . .Mx .Mx .It Ic answered , unanswered Take a message lists and mark each message as (not) having been answered. Messages will be marked answered when being .Ic reply Ns d to automatically if the .Va markanswered variable is set. See the section .Sx "Message states" . . . .Mx .Mx .It Ic bind , unbind \*(OP\*(NQ The bind command extends the MLE (see .Sx "On terminal control and line editor" ) with freely configurable key bindings. The latter command removes from the given context the given key binding, both of which may be specified as a wildcard .Ql * , so that .Ql unbind * * will remove all bindings of all contexts. Due to initialization order unbinding will not work for built-in key bindings upon program startup, however: please use .Va line-editor-no-defaults for this purpose instead. . .Pp With zero arguments, or with a context name the former command shows all key bindings (of the given context; an asterisk .Ql * will iterate over all contexts); a more verbose listing will be produced if either of .Va debug or .Va verbose are set. With two or more arguments a specific binding is shown, or (re)established: the first argument is the context to which the binding shall apply, the second argument is a comma-separated list of the .Dq keys which form the binding. Further arguments will be joined to form the expansion, and cause the binding to be created or updated. To indicate that a binding shall not be auto-committed, but that the expansion shall instead be furtherly editable by the user, a commercial at .Ql @ (that will be removed) can be placed last in the expansion, from which leading and trailing whitespace will finally be removed. Reverse solidus cannot be used as the last character of expansion. An empty expansion will be rejected. . .Pp Contexts define when a binding applies, i.e., a binding will not be seen unless the context for which it is defined for is currently active. This is not true for the shared binding .Ql base , which is the foundation for all other bindings and as such always applies, its bindings, however, only apply secondarily. The available contexts are the shared .Ql base , the .Ql default context which is used in all not otherwise documented situations, and .Ql compose , which applies only to .Sx "Compose mode" . . .Pp Bindings are specified as a comma-separated list of byte-sequences, where each list entry corresponds to one .Dq key (press). Byte sequence boundaries will be forcefully terminated after .Va bind-inter-byte-timeout milliseconds, whereas key sequences can be timed out via .Va bind-inter-key-timeout . A list entry may, indicated by a leading colon character .Ql \&: , also refer to the name of a terminal capability; several dozen names are compiled in and may be specified either by their .Xr terminfo 5 , or, if existing, by their .Xr termcap 5 name, regardless of the actually used \*(OPal terminal control library. But any capability may be used, as long as the name is resolvable by the \*(OPal control library, or was defined via the internal variable .Va termcap . Input sequences are not case-normalized, an exact match is required to update or remove a binding. It is advisable to use an initial escape or other control character (like .Ql \ecA ) for user (as opposed to purely terminal capability based) bindings in order to avoid ambiguities; it also reduces search time. Examples: . .Bd -literal -offset indent ? bind base a,b echo one ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape) ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete ? bind default $'\ecA',:khome,w 'echo Editable binding@' ? bind default a,b,c rm -irf / @ # Also editable ? bind default :kf1 File % ? bind compose :kf1 ~v .Ed . .Pp Note that the entire comma-separated list is first parsed (over) as a shell-token with whitespace as the field separator, then parsed and expanded for real with comma as the field separator, therefore whitespace needs to be properly quoted, see .Sx "Shell-style argument quoting" . Using Unicode reverse solidus escape sequences renders a binding defunctional if the locale does not support Unicode (see .Sx "Character sets" ) , and using terminal capabilities does so if no (corresponding) terminal control support is (currently) available. Adding, deleting or modifying a key binding invalidates the internal prebuilt lookup tree, it will be recreated as necessary: this process will be visualized in most .Va verbose as well as in .Va debug mode. . .Pp The following terminal capability names are built-in and can be used in .Xr terminfo 5 or (if available) the two-letter .Xr termcap 5 notation. See the respective manual for a list of capabilities. The program .Xr infocmp 1 can be used to show all the capabilities of .Ev TERM or the given terminal type; using the .Fl \&\&x flag will also show supported (non-standard) extensions. . .Pp .Bl -tag -compact -width kcuuf_or_kcuuf .It Cd kbs Ns \0or Cd kb Backspace. .It Cd kdch1 Ns \0or Cd kD Delete character. .It Cd kDC Ns \0or Cd *4 \(em shifted variant. .It Cd kel Ns \0or Cd kE Clear to end of line. .It Cd kext Ns \0or Cd @9 Exit. .It Cd kich1 Ns \0or Cd kI Insert character. .It Cd kIC Ns \0or Cd #3 \(em shifted variant. .It Cd khome Ns \0or Cd kh Home. .It Cd kHOM Ns \0or Cd #2 \(em shifted variant. .It Cd kend Ns \0or Cd @7 End. .It Cd knp Ns \0or Cd kN Next page. .It Cd kpp Ns \0or Cd kP Previous page. .It Cd kcub1 Ns \0or Cd kl Left cursor (with more modifiers: see below). .It Cd kLFT Ns \0or Cd #4 \(em shifted variant. .It Cd kcuf1 Ns \0or Cd kr Right cursor (ditto). .It Cd kRIT Ns \0or Cd %i \(em shifted variant. .It Cd kcud1 Ns \0or Cd kd Down cursor (ditto). .It Cd kDN \(em shifted variant (only terminfo). .It Cd kcuu1 Ns \0or Cd ku Up cursor (ditto). .It Cd kUP \(em shifted variant (only terminfo). .It Cd kf0 Ns \0or Cd k0 Function key 0. Add one for each function key up to .Cd kf9 and .Cd k9 , respectively. .It Cd kf10 Ns \0or Cd k; Function key 10. .It Cd kf11 Ns \0or Cd F1 Function key 11. Add one for each function key up to .Cd kf19 and .Cd F9 , respectively. .El . .Pp Some terminals support key-modifier combination extensions, e.g., .Ql Alt+Shift+xy . For example, the delete key, .Cd kdch1 : in its shifted variant, the name is mutated to .Cd kDC , then a number is appended for the states .Ql Alt .Pf ( Cd kDC3 ) , .Ql Shift+Alt .Pf ( Cd kDC4 ) , .Ql Control .Pf ( Cd kDC5 ) , .Ql Shift+Control .Pf ( Cd kDC6 ) , .Ql Alt+Control .Pf ( Cd kDC7 ) , finally .Ql Shift+Alt+Control .Pf ( Cd kDC8 ) . The same for the left cursor key, .Cd kcub1 : .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 . . . .Mx .It Ic call \*(NQ Calls the given macro, which must have been created via .Ic define (see there for more), otherwise an .Va ^ERR Ns -NOENT error occurs. Calling macros recursively will at some time excess the stack size limit, causing a hard program abortion; if recursively calling a macro is the last command of the current macro, consider to use the command .Ic xcall , which will first release all resources of the current macro before replacing the current macro with the called one. . . .Mx .It Ic call_if Identical to .Ic call if the given macro has been created via .Ic define , but does not fail nor warn if the macro does not exist. . .Mx .It Ic cd Synonym for .Ic chdir . . .Mx .It Ic certsave \*(OP Only applicable to S/MIME signed messages. Takes an optional message list and a filename and saves the certificates contained within the message signatures to the named file in both human-readable and PEM format. The certificates can later be used to send encrypted messages to the respective message senders by setting .Va smime-encrypt-USER@HOST variables. . .Mx .Mx .It Ic charsetalias , uncharsetalias \*(NQ Manage alias mappings for (conversion of) .Sx "Character sets" . Alias processing is not performed for .Sx "INTERNAL VARIABLES" , for example .Va charset-8bit , and mappings are ineffective if character set conversion is not available .Pf ( Va features does not announce .Ql ,+iconv, ) . Expansion happens recursively for cases where aliases point to other aliases (built-in loop limit: 8). .Pp The latter command deletes all aliases given as arguments, or all at once when given the asterisk .Ql * . The former shows the list of all currently defined aliases if used without arguments, or the target of the given single argument; when given two arguments, hyphen-minus .Ql - being the first, the second is instead expanded recursively. In all other cases the given arguments are treated as pairs of character sets and their desired target alias name, creating new or updating already existing aliases. . .Mx .It Ic chdir \*(NQ(ch) Change the working directory to .Ev HOME or the given argument. Synonym for .Ic cd . . .Mx .Mx .It Ic collapse , uncollapse Only applicable to .Ql thread Ns ed .Ic sort mode. Takes a message list and makes all replies to these messages invisible in header summaries, except for .Ql new messages and the .Dq dot . Also when a message with collapsed replies is displayed, all of these are automatically uncollapsed. The latter command undoes collapsing. . . .\" FIXME review until this point .Mx .Mx .It Ic colour , uncolour \*(OP\*(NQ Manage colour mappings of and for a .Sx "Coloured display" . Without arguments the former shows all currently defined mappings. Otherwise a colour type is expected (case-insensitively), it must be one of .Ql 256 for 256-colour terminals, .Ql 8 , .Ql ansi or .Ql iso for the standard 8-colour ANSI / ISO 6429 colour palette, and .Ql 1 or .Ql mono for monochrome terminals, which only support (some) font attributes. Without further arguments the list of all currently defined mappings of the given type is shown (here the special .Ql all or .Ql * also show all currently defined mappings). . .Pp Otherwise the second argument defines the mappable slot, the third argument a (comma-separated list of) colour and font attribute specification(s), and the optionally supported fourth argument can be used to specify a precondition: if conditioned mappings exist they are tested in (creation) order unless a (case-insensitive) match has been found, and the default mapping (if any has been established) will only be chosen as a last resort. The types of available preconditions depend on the mappable slot, the following of which exist: . .Pp Mappings prefixed with .Ql mle- are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see .Sx "On terminal control and line editor" ) and do not support preconditions. .Pp .Bl -tag -compact -width view-partinfo .It Ar mle-position This mapping is used for the position indicator that is visible when a line cannot be fully displayed on the screen. .It Ar mle-prompt Used for the .Va prompt . .It Ar mle-error Used for the occasionally appearing error indicator that is joined onto .Va prompt . \*(ID Also used for error messages written on standard error . .El . .Pp Mappings prefixed with .Ql sum- are used in header summaries, and they all understand the preconditions .Ql dot (the current message) and .Ql older for elder messages (only honoured in conjunction with .Va datefield-markout-older ) . .Pp .Bl -tag -compact -width view-partinfo .It Ar sum-dotmark This mapping is used for the .Dq dotmark that can be created with the .Ql %> or .Ql %< formats of the variable .Va headline . .It Ar sum-header For the complete header summary line except the .Dq dotmark and the thread structure. .It Ar sum-thread For the thread structure which can be created with the .Ql %i format of the variable .Va headline . .El . .Pp Mappings prefixed with .Ql view- are used when displaying messages. .Pp .Bl -tag -compact -width view-partinfo .It Ar view-from_ This mapping is used for so-called .Ql From_ lines, which are MBOX file format specific header lines (also see .Va mbox-rfc4155 ) . .It Ar view-header For header lines. A comma-separated list of headers to which the mapping applies may be given as a precondition; if the \*(OPal regular expression support is available then if any of the .Mx -sx .Sx "magic regular expression characters" is seen the precondition will be evaluated as (an extended) one. .It Ar view-msginfo For the introductional message info line. .It Ar view-partinfo For MIME part info lines. .El . .Pp The following (case-insensitive) colour definitions and font attributes are understood, multiple of which can be specified in a comma-separated list: . .Bl -tag -width ft= .It Ar ft= a font attribute: .Ql bold , .Ql reverse or .Ql underline . It is possible (and often applicable) to specify multiple font attributes for a single mapping. . .It Ar fg= foreground colour attribute, in order (numbers 0 - 7) .Ql black , .Ql red , .Ql green , .Ql brown , .Ql blue , .Ql magenta , .Ql cyan or .Ql white . To specify a 256-colour mode a decimal number colour specification in the range 0 to 255, inclusive, is supported, and interpreted as follows: .Pp .Bl -tag -compact -width "999 - 999" .It 0 - 7 the standard ISO 6429 colours, as above. .It 8 - 15 high intensity variants of the standard colours. .It 16 - 231 216 colours in tuples of 6. .It 232 - 255 grayscale from black to white in 24 steps. .El .Bd -literal -offset indent #!/bin/sh - fg() { printf "\e033[38;5;${1}m($1)"; } bg() { printf "\e033[48;5;${1}m($1)"; } i=0 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done printf "\e033[0m\en" i=0 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done printf "\e033[0m\en" .Ed . .It Ar bg= background colour attribute (see .Cd fg= for possible values). .El . .Pp The command .Ic \&uncolour will remove for the given colour type (the special type .Ql * selects all) the given mapping; if the optional precondition argument is given only the exact tuple of mapping and precondition is removed. The special name .Ql * will remove all mappings (no precondition allowed), thus .Ql uncolour * * will remove all established mappings. . . .Mx .Mx .It Ic commandalias , uncommandalias \*(NQ Define or list, and remove, respectively, command aliases. An (command)alias can be used everywhere a normal command can be used, but always takes precedence: any arguments that are given to the command alias are joined onto the alias expansion, and the resulting string forms the command line that is, in effect, executed. The latter command removes all given aliases, the special name asterisk .Ql * will remove all existing aliases. When used without arguments the former shows a list of all currently known aliases, with one argument only the expansion of the given one. .Pp With two or more arguments a command alias is defined or updated: the first argument is the name under which the remaining command line should be accessible, the content of which can be just about anything. An alias may itself expand to another alias, but to avoid expansion loops further expansion will be prevented if an alias refers to itself or if an expansion depth limit is reached. Explicit expansion prevention is available via reverse solidus .Cm \e , one of the .Sx "Command modifiers" . .Bd -literal -offset indent ? commandalias xx \*(uA: `commandalias': no such alias: xx ? commandalias xx echo hello, ? commandalias xx commandalias xx 'echo hello,' ? xx hello, ? xx world hello, world .Ed . .Mx .It Ic Copy (C) Similar to .Ic copy , but copy the messages to a file named after the local part of the sender of the first message instead of taking a filename argument; .Va outfolder is inspected to decide on the actual storage location. . .Mx .It Ic copy (c) Copy messages to the named file and do not mark them as being saved; otherwise identical to .Ic save . . . .Mx .It Ic csop \*(NQ A multiplexer command which provides C-style string operations on 8-bit bytes without a notion of locale settings and character sets, effectively assuming ASCII data. For numeric and other operations refer to .Ic vexpr . .Cm vput , one of the .Sx "Command modifiers" , is supported. The error result is .Ql -1 for usage errors and numeric results, the empty string otherwise; missing data errors, as for unsuccessful searches, result in the .Va \&! error number being set to .Va ^ERR Ns -NODATA . Where the question mark .Ql \&? modifier suffix is supported, a case-insensitive (ASCII mapping) operation mode is supported; the keyword .Ql case is optional so that .Ql find? and .Ql find?case are identical. . .Bl -hang -width ".It Cm length" .It Cm length Queries the length of the given argument. . .It Cm hash , Cm hash32 Calculates a hash value of the given argument. The latter will return a 32-bit result regardless of host environment. .Ql \&? modifier suffix is supported. These use Chris Torek's hash algorithm, the resulting hash value is bit mixed as shown by Bret Mulvey. . .It Cm find Search for the second in the first argument. Shows the resulting 0-based offset shall it have been found. .Ql \&? modifier suffix is supported. . .It Cm substring Creates a substring of its first argument. The optional second argument is the 0-based starting offset, a negative one counts from the end; the optional third argument specifies the length of the desired result, a negative length leaves off the given number of bytes at the end of the original string; by default the entire string is used. This operation tries to work around faulty arguments (set .Va verbose for error logs), but reports them via the error number .Va \&! as .Va ^ERR Ns -OVERFLOW . . .It Cm trim Trim away whitespace characters from both ends of the argument. . .It Cm trim-front Trim away whitespace characters from the begin of the argument. . .It Cm trim-end Trim away whitespace characters from the end of the argument. .El . . .Mx .It Ic cwd Show the name of the current working directory, as reported by .Xr getcwd 3 . Supports .Cm vput (see .Sx "Command modifiers" ) . The return status is tracked via .Va \&? . . .Mx .It Ic Decrypt \*(OP For unencrypted messages this command is identical to .Ic Copy ; Encrypted messages are first decrypted, if possible, and then copied. . .Mx .It Ic decrypt \*(OP For unencrypted messages this command is identical to .Ic copy ; Encrypted messages are first decrypted, if possible, and then copied. . . .Mx .Mx .It Ic define , undefine The latter command deletes the given macro, the special name .Ql * will discard all existing macros. Deletion of (a) macro(s) can be performed from within running (a) macro(s), including self-deletion. Without arguments the former command prints the current list of macros, including their content, otherwise it defines a macro, replacing an existing one of the same name as applicable. . .Pp A defined macro can be invoked explicitly by using the .Ic call , .Ic call_if and .Ic xcall commands, or implicitly if a macro hook is triggered, for example a .Va folder-hook . Execution of a macro body can be stopped from within by calling .Ic return . . .Pp Temporary macro block-scope variables can be created or deleted with the .Cm local command modifier in conjunction with the commands .Ic set and .Ic unset , respectively. To enforce unrolling of changes made to (global) .Sx "INTERNAL VARIABLES" the command .Ic localopts can be used instead; its covered scope depends on how (i.e., .Dq as what : normal macro, folder hook, hook, .Ic account switch) the macro is invoked. . .Pp Inside a .Ic call Ns ed macro, the given positional parameters are implicitly local to the macro's scope, and may be accessed via the variables .Va * , .Va @ , .Va # and .Va 1 and any other positive unsigned decimal number less than or equal to .Va # . Positional parameters can be .Ic shift Ns ed, or become completely replaced, removed etc. via .Ic vpospar . A helpful command for numeric computation and string evaluations is .Ic vexpr , .Ic csop offers C-style byte string operations. . .Bd -literal -offset indent define name { command1 command2 ... commandN } define exmac { echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@} return 1000 0 } call exmac Hello macro exmac! echo ${?}/${!}/${^ERRNAME} .Ed . . .Mx .Mx .It Ic delete , undelete (d, u) Marks the given message list as being or not being .Ql deleted , respectively; if no argument has been specified then the usual search for a visible message is performed, as documented for .Sx "Message list arguments" , showing only the next input prompt if the search fails. Deleted messages will neither be saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX nor will they be available for most other commands. If the .Va autoprint variable is set, the new .Dq dot or the last message restored, respectively, is automatically .Ic type Ns d; also see .Ic dp , .Ic dt . . . .Mx .It Ic digmsg \*(NQ Digging (information out of) messages is possible through .Ic \&\&digmsg objects, which can be .Cm create Ns d for the given message number; in .Sx "Compose mode" the hyphen-minus .Ql - will instead open the message that is being composed. If a hyphen-minus is given as the optional third argument then output will be generated on the standard output channel instead of being subject to consumption by the .Ic readall (or .Ic read and .Ic readsh ) command(s). Note: output must be consumed before normal processing can continue; for .Ic \&\&digmsg objects this means each command output has to be read until the end of file (EOF) state occurs. . .Pp The objects may be .Cm remove Ns d again by giving the same identifier used for creation; this step could be omitted: objects will be automatically closed when the active .Ic folder (mailbox) or the compose mode is left, respectively. In all other use cases the second argument is an object identifier, and the third and all following arguments are interpreted as via .Ic ~^ (see .Sx "COMMAND ESCAPES" ) : . .Bd -literal -offset indent ? vput = msgno; digmsg create $msgno ? digmsg $msgno header list; readall x; echon $x 210 Subject From To Message-ID References In-Reply-To ? digmsg $msgno header show Subject;readall x;echon $x 212 Subject \(aqHello, world' ? digmsg remove $msgno .Ed . . .Mx .It Ic discard (di) Identical to .Ic ignore . Superseded by the multiplexer .Ic headerpick . . .Mx .Mx .It Ic dp , dt Delete the given messages and automatically .Ic type the new .Dq dot if one exists, regardless of the setting of .Va autoprint . . .Mx .It Ic dotmove Move the .Dq dot up or down by one message when given .Ql + or .Ql - argument, respectively. . .Mx .Mx .It Ic draft , undraft Take message lists and mark each given message as being draft, or not being draft, respectively, as documented in the section .Sx "Message states" . . .Mx .It Ic echo \*(NQ(ec) Print the given strings, equivalent to the shell utility .Xr echo 1 , that is, .Sx "Shell-style argument quoting" expansion is performed and, different to the otherwise identical .Ic echon , a trailing newline is echoed. .Cm vput as documented in .Sx "Command modifiers" is supported, and the error number .Va \&! is managed: if data is stored in a variable then the return value reflects the length of the result string in case of success and is .Ql -1 on error. .Pp .Sy Remarks: this command traditionally (in BSD Mail) also performed .Sx "Filename transformations" , which is standard incompatible and hard to handle because quoting transformation patterns is not possible; the subcommand .Cm file-expand of .Ic vexpr can be used to expand filenames. . .Mx .It Ic echoerr \*(NQ Identical to .Ic echo , but the message is written to standard error, and prefixed by .Va log-prefix . Also see .Ic echoerrn . In interactive sessions the \*(OPal message ring queue for .Ic errors will be used instead, if available and .Cm vput was not used. . .Mx .It Ic echon \*(NQ Identical to .Ic echo , but does not write or store a trailing newline. . .Mx .It Ic echoerrn \*(NQ Identical to .Ic echoerr , but does not write or store a trailing newline. . .Mx .It Ic edit (e) Point the text .Ev EDITOR at each message from the given list in turn. Modified contents are discarded unless the .Va writebackedited variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status. .Ic visual can be used instead for a more display oriented editor. . .Mx .It Ic elif Part of the .Ic if (see there for more), .Ic elif , else , endif conditional \(em if the condition of a preceding .Ic if was false, check the following condition and execute the following block if it evaluates true. . .Mx .It Ic else (el) Part of the .Ic if (see there for more), .Ic elif , else , endif conditional \(em if none of the conditions of the preceding .Ic if and .Ic elif commands was true, the .Ic else block is executed. . .Mx .It Ic endif (en) Marks the end of an .Ic if (see there for more), .Ic elif , else , endif conditional execution block. . . .Mx .It Ic environ \*(NQ There is a strict separation in between .Sx "INTERNAL VARIABLES" and the program .Sx ENVIRONMENT , which is inherited by child processes. Some variables of the latter are however vivid for program operation, their purpose is known, therefore they have been integrated transparently into handling of the former, as accessible via .Ic set and .Ic unset . To integrate any other environment variable, and/or to export internal variables into the process environment where they normally are not, a .Cm link needs to become established with this command, for example . .Pp .Dl environ link PERL5LIB TZ . .Pp Afterwards changing such variables with .Ic set will cause automatic updates of the environment, too. Sufficient system support provided (it was in BSD as early as 1987, and is standardized since Y2K) removing such variables with .Ic unset will remove them also from the environment, but in any way the knowledge they ever have been .Cm link Ns ed will be lost. This implies that .Ic localopts may cause loss of such links. . .Pp The subcommand .Cm unlink removes an existing link without otherwise touching variables, the .Cm set and .Cm unset subcommands are identical to .Ic set and .Ic unset , but additionally update the program environment accordingly; removing a variable breaks any freely established .Cm link . . . .Mx .It Ic errors \*(OP As console user interfaces at times scroll error messages by too fast and/or out of scope, data can additionally be sent to an error queue manageable by this command: .Ar show or no argument will display and clear the queue, .Ar clear will only clear it. As the queue becomes filled with .Va errors-limit entries the eldest entries are being dropped. There are also the variables .Va ^ERRQUEUE-COUNT and .Va ^ERRQUEUE-EXISTS . . .Mx .It Ic eval \*(NQ Construct a command by concatenating the arguments, separated with a single space character, and then evaluate the result. This command passes through the exit status .Va \&? and error number .Va \&! of the evaluated command; also see .Ic call . .Bd -literal -offset indent define xxx { echo "xxx arg <$1>" shift if $# -gt 0 \excall xxx "$@" endif } define yyy { eval "$@ ' ball" } call yyy '\ecall xxx' "b\e$'\et'u ' " call xxx arg call xxx arg < > call xxx arg .Ed . .Mx .It Ic exit (ex or x) Exit from \*(UA without changing the active mailbox and skip any saving of messages in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX , as well as a possibly tracked line editor .Va history-file . A possibly set .Va on-account-cleanup will be invoked, however. The optional status number argument will be passed through to .Xr exit 3 . \*(ID For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status. . .Mx .It Ic File (Fi) Like .Ic folder , but open the mailbox read-only. . .Mx .It Ic file (fi) See .Ic folder . . .Mx .Mx .It Ic filetype , unfiletype \*(NQ Define, list, and remove, respectively, file handler hooks, which provide (shell) commands that enable \*(UA to load and save MBOX files from and to files with the registered file extensions, as shown and described for .Ic folder . The extensions are used case-insensitively, yet the auto-completion feature of for example .Ic folder will only work case-sensitively. An intermediate temporary file will be used to store the expanded data. The latter command will remove hooks for all given extensions, asterisk .Ql * will remove all existing handlers. .Pp When used without arguments the former shows a list of all currently defined file hooks, with one argument the expansion of the given alias. Otherwise three arguments are expected, the first specifying the file extension for which the hook is meant, and the second and third defining the load- and save commands to deal with the file type, respectively, both of which must read from standard input and write to standard output. Changing hooks will not affect already opened mailboxes (\*(ID except below). \*(ID For now too much work is done, and files are oftened read in twice where once would be sufficient: this can cause problems if a filetype is changed while such a file is opened; this was already so with the built-in support of .gz etc. in Heirloom, and will vanish in v15. \*(ID For now all handler strings are passed to the .Ev SHELL for evaluation purposes; in the future a .Ql \&! prefix to load and save commands may mean to bypass this shell instance: placing a leading space will avoid any possible misinterpretations. .Bd -literal -offset indent ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e gz 'gzip -dc' 'gzip -c' xz 'xz -dc' 'xz -zc' \e zst 'zstd -dc' 'zstd -19 -zc' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' ? set record=+sent.zst.pgp .Ed . .Mx .Mx .It Ic flag , unflag Take message lists and mark the messages as being flagged, or not being flagged, respectively, for urgent/special attention. See the section .Sx "Message states" . . .Mx .It Ic Folder (Fold) Like .Ic folder , but open the mailbox read-only. . . .Mx .It Ic folder (fold) Open a new, or show status information of the current mailbox. If an argument is given, changes (such as deletions) will be written out, a new mailbox will be opened, the internal variables .Va mailbox-resolved and .Va mailbox-display will be updated, a set according .Va folder-hook is executed, and optionally a summary of .Ic headers is displayed if the variable .Va header is set. . .Pp .Sx "Filename transformations" will be applied to the .Ar name argument, and .Ql protocol:// prefixes are, i.e., URL (see .Sx "On URL syntax and credential lookup" ) syntax is understood, as in .Ql mbox:///tmp/somefolder . If a protocol prefix is used the mailbox type is fixated, otherwise opening none-existing .Ic folders uses the protocol defined in .Va newfolders . . .Pp For the protocols .Ar mbox and .Ar file (MBOX database), as well as .Ar eml (electronic mail message \*(ID read-only) the list of all registered .Ic filetype Ns s is traversed to check whether hooks shall be used to load (and save) data from (and to) the given .Ar name . Changing hooks will not affect already opened mailboxes. For example, the following creates hooks for the .Xr gzip 1 compression tool and a combined compressed and encrypted format: . .Bd -literal -offset indent ? filetype \e gzip 'gzip -dc' 'gzip -c' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' .Ed . .Pp For historic reasons .Ic filetype Ns s provide limited (case-sensitive) auto-completion capabilities. For example .Ql mbox.gz will be found for .Ql \&? file mbox , provided that corresponding handlers are installed. It will neither find .Ql mbox.GZ nor .Ql mbox.Gz however, but an explicit .Ql \&? file mbox.GZ will find and use the handler for .Ql gz . \*(ID The latter mode can only be used for MBOX files. . .Pp EML files consist of only one mail message, \*(ID and can only be opened read-only. When reading MBOX files tolerant POSIX rules are used by default. Invalid message boundaries that can be found quite often in historic MBOX files will be complained about (even more with .Va debug ) : in this case the method described for .Va mbox-rfc4155 can be used to create a valid MBOX database from the invalid input. . .Pp MBOX databases and EML files will always be protected via file-region locks .Pf ( Xr fcntl 2 ) during file operations to protect against concurrent modifications. .Mx -ix "dotlock files" \*(OP An MBOX .Va inbox .Pf ( Ev MAIL ) or .Mx -sx .Sx "primary system mailbox" will also be protected by so-called dotlock files, the traditional way of mail spool file locking: for any file .Ql x a lock file .Ql x.lock will be created during the synchronization, in the same directory and with the same user and group identities as the file of interest \(em as necessary created by an external privileged dotlock helper. .Va dotlock-disable disables dotlock files. Also see .Sx FAQ : .Sx "Howto handle stale dotlock files" . . .Pp \*(OP If no protocol has been fixated, and .Ar name refers to a directory with the subdirectories .Ql tmp , .Ql new and .Ql cur , then it is treated as a folder in .Dq Maildir format. The maildir format stores each message in its own file, and has been designed so that file locking is not necessary when reading or writing files. . .Pp \*(OPally URLs can be used to access network resources, securely via .Sx "Encrypted network communication" , if so supported. Network communication socket timeouts are configurable via .Va socket-connect-timeout . All network traffic may be proxied over a SOCKS server via .Va socks-proxy . . .Pp .Dl \*(IN protocol://[user[:password]@]host[:port][/path] .Dl \*(OU protocol://[user@]host[:port][/path] . .Pp \*(OPally supported network protocols are .Ar pop3 (POP3) and .Ar pop3s (POP3 with TLS encrypted transport), .Ar imap and .Ar imaps . The .Ar [/path] part is valid only for IMAP; there it defaults to .Ar INBOX . Network URLs require a special encoding as documented in the section .Sx "On URL syntax and credential lookup" . . . .Mx .It Ic folders Lists the names of all folders below the given argument or .Va folder . For file-based protocols .Ev LISTER will be used for display purposes. . .Mx .Mx .It Ic Followup , followup \*(CM(F,fo) Similar to .Ic Reply , and .Ic reply , respectively, but save the message in a file named after the local part of the (first) recipient's address, possibly overwriting .Va record , and honouring .Va outfolder . Also see .Ic Copy and .Ic Save . . .Mx .It Ic Forward \*(CM Similar to .Ic forward , but saves the message in a file named after the local part of the recipient's address (instead of in .Va record Ns ). . .Mx .It Ic forward \*(CM Take a message list and the address of a recipient, subject to .Va fullnames , to whom the messages are sent. The text of the original message is included in the new one, enclosed by the values of .Va forward-inject-head and .Va forward-inject-tail . .Va content-description-forwarded-message is inspected. The list of included headers can be filtered with the .Ql forward slot of the white- and blacklisting command .Ic headerpick . Only the first part of a multipart message is included but for .Va forward-as-attachment . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, or was rejected by .Va expandaddr policy, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. It can also fail with errors of .Sx "Specifying messages" . Any error stops processing of further messages. . .Mx .It Ic from (f) Takes a list of message specifications and displays a summary of their message headers, exactly as via .Ic headers , making the first message of the result the new .Dq dot (the last message if .Va showlast is set). An alias of this command is .Ic search . Also see .Sx "Specifying messages" . . .It Ic Fwd \*(OB Alias for .Ic Forward . . .It Ic fwd \*(OB Alias for .Ic forward . . .It Ic fwdignore \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic fwdretain \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic ghost , unghost \*(OB Replaced by .Ic commandalias , .Ic uncommandalias . . .Mx .Mx .It Ic headerpick , unheaderpick \*(NQ Multiplexer command to manage white- and blacklisting selections of header fields for a variety of applications. Without arguments the set of contexts that have settings is displayed. When given arguments, the first argument is the context to which the command applies, one of (case-insensitive) .Ql type for display purposes (for example .Ic type ) , .Ql save for selecting which headers shall be stored persistently when .Ic save , .Ic copy , .Ic move or even .Ic decrypt Ns ing messages (note that MIME related etc. header fields should not be ignored in order to not destroy usability of the message in this case), .Ql forward for stripping down messages when .Ic forward Ns ing message (has no effect if .Va forward-as-attachment is set), and .Ql top for defining user-defined set of fields for the command .Ic top . .Pp The current settings of the given context are displayed if it is the only argument. A second argument denotes the type of restriction that is to be chosen, it may be (a case-insensitive prefix of) .Ql retain or .Ql ignore for white- and blacklisting purposes, respectively. Establishing a whitelist suppresses inspection of the corresponding blacklist. .Pp If no further argument is given the current settings of the given type will be displayed, otherwise the remaining arguments specify header fields, which \*(OPally may be given as regular expressions, to be added to the given type. The special wildcard field (asterisk, .Ql * ) will establish a (fast) shorthand setting which covers all fields. .Pp The latter command always takes three or more arguments and can be used to remove selections, i.e., from the given context, the given type of list, all the given headers will be removed, the special argument .Ql * will remove all headers. . .Mx .It Ic headers (h) Show the current group of headers, the size of which depends on the variable .Va screen in interactive mode, and the format of which can be defined with .Va headline . If a message-specification is given the group of headers containing the first message therein is shown and the message at the top of the screen becomes the new .Dq dot ; the last message is targeted if .Va showlast is set. . .Mx .It Ic help (hel) A synonym for .Ic \&? . . .Mx .It Ic history \*(OP Without arguments or when given .Cm show all history entries are shown (this mode also supports a more .Va verbose output). .Cm load will replace the list of entries with the content of .Va history-file , and .Cm save will dump all entries to said file, replacing former content, and .Cm clear will delete all entries. The argument can also be a signed decimal .Ar NUMBER , which will select and evaluate the respective history entry, and move it to the top of the history; a negative number is used as an offset to the current command so that .Ql -1 will select the last command, the history top, whereas .Cm delete will delete all given entries .Pf ( Ar :NUMBER: ) . Also see .Sx "On terminal control and line editor" . . .Mx .It Ic hold (ho, also .Ic preserve ) Takes a message list and marks each message therein to be saved in the user's system .Va inbox instead of in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX . Does not override the .Ic delete command. \*(UA deviates from the POSIX standard with this command, because a .Ic next command issued after .Ic hold will display the following message, not the current one. . . .Mx .It Ic if (i) Part of the .Ic \&\&if , Ic elif , else , endif conditional execution construct \(em if the given condition is true then the encapsulated block is executed. The POSIX standard only supports the (case-insensitive) conditions .Ql r Ns eceive and .Ql s Ns end, the remaining are non-portable extensions. \*(ID In conjunction with the .Cm wysh command prefix(es) .Sx "Shell-style argument quoting" and more test operators are available. . .Bd -literal -offset indent if receive commands ... else commands ... endif .Ed . .Pp Further (case-insensitive) one-argument conditions are .Ql t Ns erminal which evaluates to true in interactive terminal sessions (running with standard input or standard output attached to a terminal, and none of the .Dq quickrun command line options .Fl e , .Fl H and .Fl L have been used), as well as any boolean value (see .Sx "INTERNAL VARIABLES" for textual boolean representations) to mark an enwrapped block as .Dq never execute or .Dq always execute . (Remarks: condition syntax errors skip all branches until .Ic endif . ) . .Pp \*(OU and without .Cm wysh : It is possible to check .Sx "INTERNAL VARIABLES" as well as .Sx ENVIRONMENT variables for existence or compare their expansion against a user given value or another variable by using the .Ql $ .Pf ( Dq variable next ) conditional trigger character; a variable on the right hand side may be signalled using the same mechanism. Variable names may be enclosed in a pair of matching braces. When this mode has been triggered, several operators are available (\*(IN and .Cm wysh : they are always available, and there is no trigger: variables will have been expanded by the shell-compatible parser before the .Ic if etc. command sees them). . .Pp \*(IN Two argument conditions. Variables can be tested for existence and expansion: .Ql -N will test whether the given variable exists, so that .Ql -N editalong will evaluate to true when .Va editalong is set, whereas .Ql -Z editalong will if it is not. .Ql -n """$editalong""" will be true if the variable is set and expands to a non-empty string, .Ql -z $'\e$editalong' only if the expansion is empty, whether the variable exists or not. The remaining conditions take three arguments. . .Pp Integer operators treat the arguments on the left and right hand side of the operator as integral numbers and compare them arithmetically. It is an error if any of the operands is not a valid integer, an empty argument (which implies it had been quoted) is treated as if it were 0. Via the question mark .Ql \&? modifier suffix a saturated operation mode is available where numbers will linger at the minimum or maximum possible value, instead of overflowing (or trapping), the keyword .Ql saturated is optional, .Ql ==? , .Ql ==?satu and .Ql ==?saturated are therefore identical. Available operators are .Ql -lt (less than), .Ql -le (less than or equal to), .Ql -eq (equal), .Ql -ne (not equal), .Ql -ge (greater than or equal to), and .Ql -gt (greater than). . .Pp String and regular expression data operators compare the left and right hand side according to their textual content. Unset variables are treated as the empty string. Via the question mark .Ql \&? modifier suffix a case-insensitive operation mode is available, the keyword .Ql case is optional, .Ql ==? and .Ql ==?case are identical. . .Pp Available string operators are .Ql < (less than), .Ql <= (less than or equal to), .Ql == (equal), .Ql != (not equal), .Ql >= (greater than or equal to), .Ql > (greater than), .Ql =% (is substring of) and .Ql !% (is not substring of). By default these operators work on bytes and (therefore) do not take into account character set specifics. If the case-insensitivity modifier has been used, case is ignored according to the rules of the US-ASCII encoding, i.e., bytes are still compared. . .Pp When the \*(OPal regular expression support is available, the additional string operators .Ql =~ and .Ql !~ can be used. They treat the right hand side as an extended regular expression that is matched according to the active locale (see .Sx "Character sets" ) , i.e., character sets should be honoured correctly. . .Pp Conditions can be joined via AND-OR lists (where the AND operator is .Ql && and the OR operator is .Ql || ) , which have equal precedence and will be evaluated with left associativity, thus using the same syntax that is known for the .Xr sh 1 . It is also possible to form groups of conditions and lists by enclosing them in pairs of brackets .Ql [\ \&.\&.\&.\ ] , which may be interlocked within each other, and also be joined via AND-OR lists. . .Pp The results of individual conditions and entire groups may be modified via unary operators: the unary operator .Ql \&! will reverse the result. . .Bd -literal -offset indent wysh set v15-compat=yes # with value: automatic "wysh"! if -N debug;echo *debug* set;else;echo not;endif if "$ttycharset" == UTF-8 || "$ttycharset" ==?cas UTF8 echo ttycharset is UTF-8, the former case-sensitive! endif set t1=one t2=one if [ "${t1}" == "${t2}" ] echo These two variables are equal endif if "$features" =% ,+regex, && "$TERM" =~?case ^xterm\&.* echo ..in an X terminal endif if [ [ true ] && [ [ "${debug}" != '' ] || \e [ "$verbose" != '' ] ] ] echo Noisy, noisy endif if true && [ -n "$debug" || -n "${verbose}" ] echo Left associativity, as is known from the shell endif .Ed . . .Mx .It Ic ignore (ig) Identical to .Ic discard . Superseded by the multiplexer .Ic headerpick . . .Mx .It Ic list Shows the names of all available commands, in command lookup order. \*(OP In conjunction with a set variable .Va verbose additional information will be provided for each command: the argument type will be indicated, the documentation string will be shown, and the set of command flags will show up: .Pp .Bl -tag -compact -width ".It Ql NEEDS_BOX" .It Ql "`local'" command supports the command modifier .Cm local . .It Ql "`vput'" command supports the command modifier .Cm vput . .It Ql "*!*" the error number is tracked in .Va \&! . .It Ql needs-box whether the command needs an active mailbox, a .Ic folder . .It Ql ok: indicators whether command is \&.\h'.3m'.\h'.3m'. .Bl -tag -compact -width ".It Ql SUBPROCESS" .It Ql batch/interactive usable in interactive or batch mode .Pf ( Fl # ) . .It Ql send-mode usable in send mode. .It Ql subprocess allowed to be used when running in a subprocess instance, for example from within a macro that is called via .Va on-compose-splice . .El .It Ql not ok: indicators whether command is not \&.\h'.3m'.\h'.3m'. .Bl -tag -compact -width ".It Ql COMPOSE_MODE" .It Ql compose mode available in .Sx "Compose mode". .It Ql startup available during program startup, like in .Sx "Resource files" . .El .It Ql "gabby" The command produces .Va history-gabby .Ic history entries. .El . . .Mx .It Ic localopts Enforce change localization of .Ic environ (linked) .Sx ENVIRONMENT as well as (global) .Sx "INTERNAL VARIABLES" , meaning that their state will be reverted to the former one once the .Dq covered scope is left. Just like the command modifier .Cm local , which provides block-scope localization for some commands (instead), it can only be used inside of macro definition blocks introduced by .Ic account or .Ic define . The covered scope of an .Ic account is left once a different account is activated, and some macros, notably .Va folder-hook Ns s , use their own specific notion of covered scope, here it will be extended until the folder is left again. . .Pp This setting stacks up: i.e., if .Ql macro1 enables change localization and calls .Ql macro2 , which explicitly resets localization, then any value changes within .Ql macro2 will still be reverted when the scope of .Ql macro1 is left. (Caveats: if in this example .Ql macro2 changes to a different .Ic account which sets some variables that are already covered by localizations, their scope will be extended, and in fact leaving the .Ic account will (thus) restore settings in (likely) global scope which actually were defined in a local, macro private context!) . .Pp This command takes one or two arguments, the optional first one specifies an attribute that may be one of .Cm \&\&scope , which refers to the current scope and is thus the default, .Cm call , which causes any macro that is being .Ic call Ns ed to be started with localization enabled by default, as well as .Cm call-fixate , which (if enabled) disallows any called macro to turn off localization: like this it can be ensured that once the current scope regains control, any changes made in deeper levels have been reverted. The latter two are mutually exclusive, and neither affects .Ic xcall . The (second) argument is interpreted as a boolean (string, see .Sx "INTERNAL VARIABLES" ) and states whether the given attribute shall be turned on or off. . .Bd -literal -offset indent define temporary_settings { set possibly_global_option1 localopts on set localized_option1 set localized_option2 localopts scope off set possibly_global_option2 } .Ed . . .Mx .Mx .It Ic Lfollowup , Lreply \*(CM Reply to messages that come in via known .Pf ( Ic mlist ) or subscribed .Pf ( Ic mlsubscribe ) mailing lists, or pretend to do so (see .Sx "Mailing lists" ) : on top of the usual .Ic followup and .Ic reply , respectively, functionality this will actively resort and even remove message recipients in order to generate a message that is supposed to be sent to a mailing list. For example it will also implicitly generate a .Ql Mail-Followup-To: header if that seems useful, regardless of the setting of the variable .Va followup-to . For more documentation please refer to .Sx "On sending mail, and non-interactive mode" . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. It can also fail with errors of .Sx "Specifying messages" . Occurrence of some of the errors depend on the value of .Va expandaddr . Any error stops processing of further messages. . .Mx .It Ic Mail \*(CM Similar to .Ic mail , but saves the message in a file named after the local part of the first recipient's address (instead of in .Va record Ns ). . .Mx .It Ic mail \*(CM(m) Takes a (list of) recipient address(es) as (an) argument(s), or asks on standard input if none were given; then collects the remaining mail content and sends it out. Unless the internal variable .Va fullnames is set recipient addresses will be stripped from comments, names etc. For more documentation please refer to .Sx "On sending mail, and non-interactive mode" . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -NOTSUP if multiple messages have been specified, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. It can also fail with errors of .Sx "Specifying messages" . Occurrence of some of the errors depend on the value of .Va expandaddr . . .Mx .It Ic mailcap \*(OP When used without arguments or if .Ar show has been given the content of .Sx "The Mailcap files" cache is shown, (re-)initializing it first (as necessary. If the argument is .Ar load then the cache will only be (re-)initialized, and .Ar clear will remove its contents. Note that \*(UA will try to load the files only once, use .Ql Ic \&\&mailcap Ns \:\0\:clear to unlock further attempts. Loading and parsing can be made more .Va verbose . . .Mx .It Ic mbox (mb) The given message list is to be sent to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX when \*(UA is quit; this is the default action unless the variable .Va hold is set. \*(ID This command can only be used in a .Mx -sx .Sx "primary system mailbox" . . .Mx .Mx .It Ic mimetype , unmimetype \*(NQ Without arguments the content of the MIME type cache will displayed; a more verbose listing will be produced if either of .Va debug or .Va verbose are set. When given arguments they will be joined, interpreted as shown in .Sx "The mime.types files" (also see .Sx "HTML mail and MIME attachments" ) , and the resulting entry will be added (prepended) to the cache. In any event MIME type sources are loaded first as necessary \(en .Va mimetypes-load-control can be used to fine-tune which sources are actually loaded. .Pp The latter command deletes all specifications of the given MIME type, thus .Ql \&? unmimetype text/plain will remove all registered specifications for the MIME type .Ql text/plain . The special name .Ql * will discard all existing MIME types, just as will .Ql reset , but which also reenables cache initialization via .Va mimetypes-load-control . . .Mx .It Ic mimeview \*(ID Only available in interactive mode, this command allows execution of external MIME type handlers which do not integrate into the normal .Ic type output (see .Sx "HTML mail and MIME attachments" ) . (\*(ID No syntax to directly address parts, this restriction may vanish.) The user will be asked for each non-text part of the given message in turn whether the registered handler shall be used to display the part. . .Mx .Mx .It Ic mlist , unmlist \*(NQ Manage the list of known .Sx "Mailing lists" ; subscriptions are controlled via .Ic mlsubscribe . The latter command deletes all given arguments, or all at once when given the asterisk .Ql * . The former shows the list of all currently known lists if used without arguments, otherwise the given arguments will become known. \*(OP In the latter case, arguments which contain any of the .Mx -sx .Sx "magic regular expression characters" will be interpreted as one, possibly matching many addresses; these will be sequentially matched via linked lists instead of being looked up in a dictionary. . .Mx .Mx .It Ic mlsubscribe , unmlsubscribe Building upon the command pair .Ic mlist , unmlist , but only managing the subscription attribute of mailing lists. (The former will also create not yet existing mailing lists.) . .Mx .It Ic Move Similar to .Ic move , but move the messages to a file named after the local part of the sender of the first message instead of taking a filename argument; .Va outfolder is inspected to decide on the actual storage location. . .Mx .It Ic move Acts like .Ic copy but marks the messages for deletion if they were transferred successfully. . .Mx .It Ic More Like .Ic more , but also displays header fields which would not pass the .Ic headerpick selection, and all MIME parts. Identical to .Ic Page . . .Mx .It Ic more Invokes the .Ev PAGER on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to .Ic page . . .Mx .It Ic mtaaliases \*(OP When used without arguments or if .Ar show has been given the content of the .Va mta-aliases cache is shown, (re-)initializing it first (as necessary). If the argument is .Ar load then the cache will only be (re-)initialized, and .Ar clear will remove its contents. . .Mx .It Ic netrc \*(OP When used without arguments, or when the argument was .Ar show the content of the .Pa \*(VN cache is shown, initializing it as necessary. If the argument is .Ar load then the cache will be (re)loaded, whereas .Ar clear removes it. Loading and parsing can be made more .Va verbose . .Ar lookup will query the cache for the URL given as the second argument .Pf ( Ql [USER@]HOST ) . See .Va netrc-lookup , .Va netrc-pipe and the section .Sx "On URL syntax and credential lookup" ; the section .Sx "The .netrc file" documents the file format in detail. . .Mx .It Ic newmail Checks for new mail in the current folder without committing any changes before. If new mail is present, a message is shown. If the .Va header variable is set, the headers of each new message are also shown. This command is not available for all mailbox types. . .Mx .It Ic next (n) (like .Ql + or .Dq ENTER ) Goes to the next message in sequence and types it. With an argument list, types the next matching message. . .Mx .It Ic New Same as .Ic Unread . . .Mx .It Ic new Same as .Ic unread . . .Mx .It Ic noop If the current folder is accessed via a network connection, a .Dq NOOP command is sent, otherwise no operation is performed. . .Mx .It Ic Page Like .Ic page , but also displays header fields which would not pass the .Ic headerpick selection, and all MIME parts. Identical to .Ic More . . .Mx .It Ic page Invokes the .Ev PAGER on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to .Ic more . . .Mx .It Ic Pipe Like .Ic pipe but also pipes header fields which would not pass the .Ic headerpick selection, and all parts of MIME .Ql multipart/alternative messages. . .Mx .It Ic pipe (pi) Takes an optional message list and shell command (that defaults to .Va cmd ) , and pipes the messages through the command. If the .Va page variable is set, every message is followed by a formfeed character. . .Mx .It Ic preserve (pre) A synonym for .Ic hold . . .Mx .It Ic Print (P) Alias for .Ic Type . . .Mx .It Ic print (p) Research .Ux equivalent of .Ic type . . .Mx .It Ic quit (q) Terminates the session, saving all undeleted, unsaved messages in the current .Mx -sx .Sx "secondary mailbox" .Ev MBOX , preserving all messages marked with .Ic hold or .Ic preserve or never referenced in the system .Va inbox , and removing all other messages from the .Mx -sx .Sx "primary system mailbox" . If new mail has arrived during the session, the message .Dq You have new mail will be shown. If given while editing a mailbox file with the command line option .Fl f , then the edit file is rewritten. A return to the shell is effected, unless the rewrite of edit file fails, in which case the user can escape with the exit command. The optional status number argument will be passed through to .Xr exit 3 . \*(ID For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status. . .Mx .It Ic read \*(NQ Read a line from standard input, or the channel set active via .Ic readctl , and assign the data, which will be split as indicated by .Va ifs , to the given variables. The variable names are checked by the same rules as documented for .Cm vput , and the same error codes will be seen in .Va \&! ; the exit status .Va \&? indicates the number of bytes read, it will be .Ql -1 with the error number .Va \&! set to .Va ^ERR Ns -BADF in case of I/O errors, or .Va ^ERR Ns -NONE upon End-Of-File. If there are more fields than variables, assigns successive fields to the last given variable. If there are less fields than variables, assigns the empty string to the remains. .Bd -literal -offset indent ? read a b c H e l l o ? echo "<$a> <$b> <$c>" ? wysh set ifs=:; read a b c;unset ifs hey2.0,:"'you ",:world!:mars.: ? echo $?/$^ERRNAME / <$a><$b><$c> 0/NONE / <"'you ",><><> .Ed . .Mx .It Ic readsh \*(NQ Like .Ic read , but splits on shell token boundaries (see .Sx "Shell-style argument quoting" ) rather than at .Va ifs . \*(ID Could become a .Ic commandalias , maybe .Ql read --tokenize -- . . .Mx .It Ic readall \*(NQ Read anything from standard input, or the channel set active via .Ic readctl , and assign the data to the given variable. The variable name is checked by the same rules as documented for .Cm vput , and the same error codes will be seen in .Va \&! ; the exit status .Va \&? indicates the number of bytes read, it will be .Ql -1 with the error number .Va \&! set to .Va ^ERR Ns -BADF in case of I/O errors, or .Va ^ERR Ns -NONE upon End-Of-File. \*(ID The input data length is restricted to 31-bits. . .Mx .It Ic readctl \*(NQ Manages input channels for .Ic read , .Ic readsh and .Ic readall , to be used to avoid complicated or impracticable code, like calling .Ic \&\&read from within a macro in non-interactive mode. Without arguments, or when the first argument is .Cm show , a listing of all known channels is printed. Channels can otherwise be .Cm create Ns d, and existing channels can be .Cm set active and .Cm remove Ns d by giving the string used for creation. .Pp The channel name is expected to be a file descriptor number, or, if parsing the numeric fails, an input file name that undergoes .Sx "Filename transformations" . For example (this example requires a modern shell): .Bd -literal -offset indent $ printf 'echon "hey, "\enread a\enyou\enecho $a' |\e \*(uA -R# hey, you $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6' hey, you .Ed . .Mx .It Ic remove \*(NQ Removes the named files or directories. If a name refers to a mailbox, say a Maildir mailbox, then a mailbox type specific removal will be performed, deleting the complete mailbox. In interactive mode the user is asked for confirmation. . .Mx .It Ic rename \*(NQ Takes the name of an existing folder and the name for the new folder and renames the first to the second one. .Sx "Filename transformations" including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) are performed on both arguments. Both folders must be of the same type. . .Mx .Mx .It Ic Reply , Respond \*(CM(R) Identical to .Ic reply except that it replies to only the sender of each message of the given list, by using the first message as the template to quote, for the .Ql Subject: etc.; setting .Va flipr will exchange this command with .Ic reply . . .Mx .Mx .It Ic reply , respond \*(CM(r) Take a message (list) and group-respond (to each in turn) by addressing the sender and all recipients, subject to .Va fullnames and .Ic alternates processing. .Va followup-to , .Va followup-to-honour , .Va reply-to-honour as well as .Va recipients-in-cc influence response behaviour. .Va quote as well as .Va quote-as-attachment configure whether responded-to message shall be quoted etc., .Va content-description-quote-attachment may be used. Setting .Va flipr will exchange this command with .Ic Reply . The command .Ic Lreply offers special support for replying to mailing lists. For more documentation please refer to .Sx "On sending mail, and non-interactive mode" . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, or was rejected by .Va expandaddr policy, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. It can also fail with errors of .Sx "Specifying messages" . Any error stops processing of further messages. . .Mx .It Ic Resend Like .Ic resend , but does not add any header lines. This is not a way to hide the sender's identity, but useful for sending a message again to the same recipients. . .Mx .It Ic resend Takes a list of messages and a name, and sends each message to the given addressee, which is subject to .Va fullnames . .Ql Resent-From: and related header fields are prepended to the new copy of the message. Saving in .Va record is only performed if .Va record-resent is set. \*(ID\*(CM is not entered, the only supported hooks are .Va on-resend-enter and .Va on-resend-cleanup . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, or was rejected by .Va expandaddr policy, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. It can also fail with errors of .Sx "Specifying messages" . Any error stops processing of further messages. . .Mx .It Ic retain (ret) Superseded by the multiplexer .Ic headerpick . . .Mx .It Ic return Only available inside of a .Ic define Ns d macro or an .Ic account , this command returns control of execution to the outer scope. The two optional parameters are positive decimal numbers and default to 0: the first specifies the 32-bit return value (stored in .Va \&? \*(ID and later extended to 64-bit), the second the 32-bit error number (stored in .Va \&! ) . As documented for .Va \&? a non-0 exit status may cause the program to exit. . .Mx .It Ic Save (S) Similar to .Ic save, but saves the messages in a file named after the local part of the sender of the first message instead of taking a filename argument; .Va outfolder is inspected to decide on the actual storage location. . .Mx .It Ic save (s) Takes a message list and a filename and appends each message in turn to the end of the file. .Sx "Filename transformations" including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) is performed on the filename. If no filename is given, the .Mx -sx .Sx "secondary mailbox" .Ev MBOX is used. The filename in quotes, followed by the generated character count is echoed on the user's terminal. If editing a .Mx -sx .Sx "primary system mailbox" the messages are marked for deletion. To filter the saved header fields to the desired subset use the .Ql save slot of the white- and blacklisting command .Ic headerpick . Also see .Ic Copy . . .It Ic savediscard \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic saveignore \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic saveretain \*(OB Superseded by the multiplexer .Ic headerpick . . .Mx .It Ic search Takes a message specification (list) and displays a header summary of all matching messages, as via .Ic headers . This command is an alias of .Ic from . Also see .Sx "Specifying messages" . . .Mx .It Ic seen Takes a message list and marks all messages as having been read. . . .Mx .Mx .It Ic set , unset (se, \*(NQ uns) The latter command will delete all given global variables, or only block-scope local ones if the .Cm local command modifier has been used. The former, when used without arguments, will show all currently known variables, being more verbose if either of .Va debug or .Va verbose is set. Remarks: this list mode will not automatically link-in (known) .Sx ENVIRONMENT variables, this only happens for explicit addressing, examples are .Ic varshow , using a variable in an .Ic if condition or a string passed to .Ic echo , explicit .Ic \&\&set Ns ting, as well as some program-internal use cases (look-ups). . .Pp Otherwise the given variables (and arguments) are set or adjusted. Arguments are of the form .Ql name=value (no space before or after .Ql = ) , or plain .Ql name if there is no value, i.e., a boolean variable. If a name begins with .Ql no , as in .Ql set nosave , the effect is the same as invoking the .Ic \&\&unset command with the remaining part of the variable .Pf ( Ql unset save ) . \*(ID In conjunction with the .Cm wysh .Pf (or\0 Cm local ) command prefix(es) .Sx "Shell-style argument quoting" can be used to quote arguments as necessary. \*(ID Otherwise quotation marks may be placed around any part of the assignment statement to quote blanks or tabs. . .Pp When operating in global scope any .Ql name that is known to map to an environment variable will automatically cause updates in the program environment (unsetting a variable in the environment requires corresponding system support) \(em use the command .Ic environ for further environmental control. If the command modifier .Cm local has been used to enforce local scoping then the given user variables will be garbage collected when the local scope is left; for .Sx "INTERNAL VARIABLES" , however, .Cm local behaves the same as if .Ic localopts would have been set (temporarily), which means that changes are inherited by deeper scopes. Also see .Ic varshow and the sections .Sx "INTERNAL VARIABLES" and .Sx ENVIRONMENT . . .Bd -literal -offset indent ? wysh set indentprefix=' -> ' ? wysh set atab=$'\t' aspace=' ' zero=0 .Ed . . .Mx .It Ic shcodec Apply shell quoting rules to the given raw-data arguments. Supports .Cm vput (see .Sx "Command modifiers" ) . The first argument specifies the operation: .Ar [+]e[ncode] or .Ar d[ecode] cause shell quoting to be applied to the remains of the line, and expanded away thereof, respectively. If the former is prefixed with a plus-sign, the quoted result will not be roundtrip enabled, and thus can be decoded only in the very same environment that was used to perform the encode; also see .Cd mle-quote-rndtrip . If the coding operation fails the error number .Va \&! is set to .Va ^ERR Ns -CANCELED , and the unmodified input is used as the result; the error number may change again due to output or result storage errors. . .Mx .It Ic shell \*(NQ (sh) Invokes an interactive version of the shell, and returns its exit status. . .Mx .Mx .It Ic shortcut , unshortcut \*(NQ Manage the file- or pathname shortcuts as documented for .Ic folder . The latter command deletes all shortcuts given as arguments, or all at once when given the asterisk .Ql * . The former shows the list of all currently defined shortcuts if used without arguments, the target of the given with a single argument. Otherwise arguments are treated as pairs of shortcuts and their desired expansion, creating new or updating already existing ones. . .Mx .It Ic shift \*(NQ Shift the positional parameter stack (starting at .Va 1 ) by the given number (which must be a positive decimal), or 1 if no argument has been given. It is an error if the value exceeds the number of positional parameters. If the given number is 0, no action is performed, successfully. The stack as such can be managed via .Ic vpospar . Note this command will fail in .Ic account and hook macros unless the positional parameter stack has been explicitly created in the current context via .Ic vpospar . . .Mx .It Ic show Like .Ic type , but performs neither MIME decoding nor decryption, so that the raw message text is shown. . .Mx .It Ic size (si) Shows the size in characters of each message of the given message list. . .Mx .It Ic sleep \*(NQ Sleep for the specified number of seconds (and optionally milliseconds), by default interruptible. If a third argument is given the sleep will be uninterruptible, otherwise the error number .Va \&! will be set to .Va ^ERR Ns -INTR if the sleep has been interrupted. The command will fail and the error number will be .Va ^ERR Ns -OVERFLOW if the given duration(s) overflow the time datatype, and .Va ^ERR Ns -INVAL if the given durations are no valid integers. . . .Mx .Mx .It Ic sort , unsort The latter command disables sorted or threaded mode, returns to normal message order and, if the .Va header variable is set, displays a header summary. The former command shows the current sorting criterion when used without an argument, but creates a sorted representation of the current folder otherwise, and changes the .Ic next command and the addressing modes such that they refer to messages in the sorted order. Message numbers are the same as in regular mode. If the .Va header variable is set, a header summary in the new order is also displayed. Automatic folder sorting can be enabled by setting the .Va autosort variable, as in .Ql set autosort=thread . Possible sorting criterions are: . .Pp .Bl -tag -compact -width "subject" .It Ar date Sort the messages by their .Ql Date: field, that is by the time they were sent. .It Ar from Sort messages by the value of their .Ql From: field, that is by the address of the sender. If the .Va showname variable is set, the sender's real name (if any) is used. .It Ar size Sort the messages by their size. .It spam \*(OP Sort the message by their spam score, as has been classified by .Ic spamrate . .It Ar status Sort the messages by their message status. .It Ar subject Sort the messages by their subject. .It Ar thread Create a threaded display. .It Ar to Sort messages by the value of their .Ql To: field, that is by the address of the recipient. If the .Va showname variable is set, the recipient's real name (if any) is used. .El . . .Mx .It Ic source \*(NQ (so) The source command reads commands from the given file. .Sx "Filename transformations" will be applied. If the given expanded argument ends with a vertical bar .Ql | then the argument will instead be interpreted as a shell command and \*(UA will read the output generated by it. Dependent on the settings of .Va posix and .Va errexit , and also dependent on whether the command modifier .Cm ignerr had been used, encountering errors will stop sourcing of the given input. \*(ID Note that .Ic \&\&source cannot be used from within macros that execute as .Va folder-hook Ns s or .Ic account Ns s , i.e., it can only be called from macros that were .Ic call Ns ed . . .Mx .It Ic source_if \*(NQ The difference to .Ic source (beside not supporting pipe syntax aka shell command input) is that this command will not generate an error nor warn if the given file argument cannot be opened successfully. . .Mx .It Ic spamclear \*(OP Takes a list of messages and clears their .Ql is-spam flag. . .Mx .It Ic spamforget \*(OP Takes a list of messages and causes the .Va spam-interface to forget it has ever used them to train its Bayesian filter. Unless otherwise noted the .Ql is-spam flag of the message is inspected to chose whether a message shall be forgotten to be .Dq ham or .Dq spam . . .Mx .It Ic spamham \*(OP Takes a list of messages and informs the Bayesian filter of the .Va spam-interface that they are .Dq ham . This also clears the .Ql is-spam flag of the messages in question. . .Mx .It Ic spamrate \*(OP Takes a list of messages and rates them using the configured .Va spam-interface , without modifying the messages, but setting their .Ql is-spam flag as appropriate; because the spam rating headers are lost the rate will be forgotten once the mailbox is left. Refer to the manual section .Sx "Handling spam" for the complete picture of spam handling in \*(UA. . .Mx .It Ic spamset \*(OP Takes a list of messages and sets their .Ql is-spam flag. . .Mx .It Ic spamspam \*(OP Takes a list of messages and informs the Bayesian filter of the .Va spam-interface that they are .Dq spam . This also sets the .Ql is-spam flag of the messages in question. . .It Ic thread \*(OB The same as .Ql sort thread (consider using a .Ql commandalias as necessary). . . .Mx .It Ic tls \*(NQ TLS information and management command multiplexer to aid in .Sx "Encrypted network communication" , mostly available only if the term .Ql ,+sockets, is included in .Va features . Commands support .Cm vput if so documented (see .Sx "Command modifiers" ) . The result that is shown in case of errors is always the empty string, errors can be identified via the error number .Va \&! . For example, string length overflows are caught and set .Va \&! to .Va ^ERR Ns -OVERFLOW . The TLS configuration is honoured, especially .Va tls-verify . . .Bd -literal -offset indent ? vput tls result fingerprint pop3s://ex.am.ple ? echo $?/$!/$^ERRNAME: $result .Ed . .Bl -hang -width ".It Cm random" .It Cm certchain Show the complete verified peer certificate chain. Includes informational fields in conjunction with .Va verbose . .It Cm certificate Show only the peer certificate, without any signers. Includes informational fields in conjunction with .Va verbose . .It Cm fingerprint Show the .Va tls-fingerprint-digest Ns ed fingerprint of the certificate of the given HOST .Pf ( Ql server:port , where the port defaults to the HTTPS port, 443). .Va tls-fingerprint is actively ignored for the runtime of this command. .El . . .Mx .It Ic Top Like .Ic top but always uses the .Ic headerpick .Ql type slot for white- and blacklisting header fields. . .Mx .It Ic top (to) Takes a message list and types out the first .Va toplines lines of each message on the user's terminal. Unless a special selection has been established for the .Ql top slot of the .Ic headerpick command, the only header fields that are displayed are .Ql From: , .Ql To: , .Ql Cc: , and .Ql Subject: . .Ic Top will always use the .Ql type .Ic headerpick selection instead. It is possible to apply compression to what is displayed by setting .Va topsqueeze . Messages are decrypted and converted to the terminal character set if necessary. . .Mx .It Ic touch (tou) Takes a message list and marks the messages for saving in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX . \*(UA deviates from the POSIX standard with this command, as a following .Ic next command will display the following message instead of the current one. . .Mx .It Ic Type (T) Like .Ic type but also displays header fields which would not pass the .Ic headerpick selection, and all visualizable parts of MIME .Ql multipart/alternative messages. . .Mx .It Ic type (t) Takes a message list and types out each message on the user's terminal. The display of message headers is selectable via .Ic headerpick . For MIME multipart messages, all parts with a content type of .Ql text , all parts which have a registered MIME type handler (see .Sx "HTML mail and MIME attachments" ) which produces plain text output, and all .Ql message parts are shown, others are hidden except for their headers. Messages are decrypted and converted to the terminal character set if necessary. The command .Ic mimeview can be used to display parts which are not displayable as plain text. . .It Ic unaccount See .Ic account . . .It Ic unalias (una) See .Ic alias . . .It Ic unanswered See .Ic answered . . .It Ic unbind See .Ic bind . . .It Ic uncollapse See .Ic collapse . . .It Ic uncolour See .Ic colour . . .It Ic undefine See .Ic define . . .It Ic undelete See .Ic delete . . .It Ic undraft See .Ic draft . . .It Ic unflag See .Ic flag . . .It Ic unfwdignore \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic unfwdretain \*(OB Superseded by the multiplexer .Ic headerpick . . .Mx .It Ic unignore Superseded by the multiplexer .Ic headerpick . . .It Ic unmimetype See .Ic mimetype . . .It Ic unmlist See .Ic mlist . . .It Ic unmlsubscribe See .Ic mlsubscribe . . .Mx .It Ic Unread Same as .Ic unread . . .Mx .It Ic unread Takes a message list and marks each message as not having been read. . .Mx .It Ic unretain Superseded by the multiplexer .Ic headerpick . . .It Ic unsaveignore \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic unsaveretain \*(OB Superseded by the multiplexer .Ic headerpick . . .It Ic unset \*(NQ (uns) See .Ic set . . .It Ic unshortcut See .Ic shortcut . . .It Ic unsort See .Ic short . . .It Ic unthread \*(OB Same as .Ic unsort . . .Mx .It Ic urlcodec Perform URL percent codec operations on the raw-data argument, rather according to RFC 3986. The first argument specifies the operation: .Ar e[ncode] or .Ar d[ecode] perform plain URL percent en- and decoding, respectively. .Ar p[ath]enc[ode] and .Ar p[ath]dec[ode] perform a slightly modified operation which should be better for pathnames: it does not allow a tilde .Ql ~ , and will neither accept hyphen-minus .Ql - nor dot .Ql . as an initial character. The remains of the line form the URL data which is to be converted. This is a character set agnostic operation, and it may thus decode bytes which are invalid in the current .Va ttycharset . .Pp Supports .Cm vput (see .Sx "Command modifiers" ) , and manages the error number .Va \&! . If the coding operation fails the error number .Va \&! is set to .Va ^ERR Ns -CANCELED , and the unmodified input is used as the result; the error number may change again due to output or result storage errors. \*(ID This command does not know about URLs beside what is documented. .Pf ( Ic vexpr offers a .Cm makeprint subcommand, shall the URL be displayed.) . .Mx .It Ic varshow \*(NQ This command produces the same output as the listing mode of .Ic set , including .Va verbose Ns ity adjustments, but only for the given variables. . .Mx .It Ic verify \*(OP Takes a message list and verifies each message. If a message is not a S/MIME signed message, verification will fail for it. The verification process checks if the message was signed using a valid certificate, if the message sender's email address matches one of those contained within the certificate, and if the message content has been altered. . .Mx .It Ic version Shows the .Va version and .Va features of \*(UA, optionally in a more .Va verbose form which also includes the build and running system environment. This command supports .Cm vput (see .Sx "Command modifiers" ) . . . .Mx .It Ic vexpr \*(NQ A multiplexer command which offers signed 64-bit numeric calculations, as well as other, mostly string-based operations. C-style byte string operations are available via .Ic csop . The first argument defines the number, type, and meaning of the remaining arguments. An empty number argument is treated as 0. Supports .Cm vput (see .Sx "Command modifiers" ) . The result shown in case of errors is .Ql -1 for usage errors and numeric operations, the empty string otherwise; .Dq soft errors, like when a search operation failed, will also set the .Va \&! error number to .Va ^ERR Ns -NODATA . Except when otherwise noted numeric arguments are parsed as signed 64-bit numbers, and errors will be reported in the error number .Va \&! as the numeric error .Va ^ERR Ns -RANGE . . .Pp Numeric operations work on one or two signed 64-bit integers. Numbers prefixed with .Ql 0x or .Ql 0X are interpreted as hexadecimal (base 16) numbers, whereas .Ql 0 indicates octal (base 8), and .Ql 0b as well as .Ql 0B denote binary (base 2) numbers. It is possible to use any base in between 2 and 36, inclusive, with the .Ql BASE#number notation, where the base is given as an unsigned decimal number, so .Ql 16#AFFE is a different way of specifying a hexadecimal number. Unsigned interpretation of a number can be enforced by prefixing an .Ql u (case-insensitively), as in .Ql u-110 ; this is not necessary for power-of-two bases (2, 4, 8, 16 and 32), which will be interpreted as unsigned by default, but it still makes a difference regarding overflow detection and overflow constant. It is possible to enforce signed interpretation by (instead) prefixing a .Ql s (case-insensitively). The number sign notation uses a permissive parse mode and as such supports complicated conditions out of the box: .Bd -literal -offset indent ? wysh set ifs=:;read i;unset ifs;echo $i;vexpr pb 2 10#$i -009 < -009> 0b1001 .Ed . .Pp One integer is expected by assignment (equals sign .Ql = ) , which does nothing but parsing the argument, thus detecting validity and possible overflow conditions, unary not (tilde .Ql ~ ) , which creates the bitwise complement, and unary plus and minus. Two integers are used by addition (plus sign .Ql + ) , subtraction (hyphen-minus .Ql - ) , multiplication (asterisk .Ql * ) , division (solidus .Ql / ) and modulo (percent sign .Ql % ) , as well as for the bitwise operators logical or (vertical bar .Ql | , to be quoted) , bitwise and (ampersand .Ql \&& , to be quoted) , bitwise xor (circumflex .Ql ^ ) , the bitwise signed left- and right shifts .Pf ( Ql << , .Ql >> ) , as well as for the unsigned right shift .Ql >>> . . .Pp Another numeric operation is .Cm pbase , which takes a number base in between 2 and 36, inclusive, and will act on the second number given just the same as what equals sign .Ql = does, but the number result will be formatted in the base given, as a signed 64-bit number unless unsigned interpretation of the input number had been forced (with an u prefix). . .Pp Numeric operations support a saturated mode via the question mark .Ql \&? modifier suffix; the keyword .Ql saturated is optional, .Ql +? , .Ql +?satu , and .Ql +?saturated are therefore identical. In saturated mode overflow errors and division and modulo by zero are no longer reported via the exit status, but the result will linger at the minimum or maximum possible value, instead of overflowing (or trapping). This is true also for the argument parse step. For the bitwise shifts, the saturated maximum is 63. Any caught overflow will be reported via the error number .Va \&! as .Va ^ERR Ns -OVERFLOW . . .Bd -literal -offset indent ? vput vexpr res -? +1 -9223372036854775808 ? echo $?/$!/$^ERRNAME:$res 0/75/OVERFLOW:-9223372036854775808 .Ed . .Pp Character set agnostic string functions have no notion of locale settings and character sets. . .Bl -hang -width ".It Cm random" .It Cm date-utc Outputs the current date and time in UTC (Coordinated Universal Time) with values named such that .Ql vput vexpr x date-utc; eval wysh set $x creates accessible variables. .It Cm date-stamp-utc Outputs a RFC 3339 internet date/time format of UTC. .It Cm epoch The seconds and nanoseconds since the Unix epoch (1970-01-01T00:00:00) named .Ql epoch_sec and .Ql epoch_nsec such that .Ql vput vexpr x epoch; eval wysh set $x creates accessible variables. .It Cm file-expand Performs the usual .Sx "Filename transformations" on its argument. .It Cm file-stat , file-lstat Perform the usual .Sx "Filename transformations" on the argument, then call .Xr stat 2 and .Xr lstat 2 , respectively, and output values such that .Ql vput vexpr x file-stat FILE; eval wysh set $x creates accessible variables. The variable .Ql st_type uses solidus .Ql / to denote directories, commercial at .Ql @ for links, number sign .Ql # for block devices, percent sign .Ql % for for character devices, vertical bar .Ql | for FIFOs, equal sign .Ql = for sockets, and the period .Ql \&. for the rest. .It Cm random Generates a random string of the given length, or of .Dv \&\&PATH_MAX bytes (a constant from .Pa /usr/include ) if the value 0 is given; the random string will be base64url encoded according to RFC 4648, and thus be usable as a (portable) filename. .El . .Pp String operations work, sufficient support provided, according to the active user's locale encoding and character set (see .Sx "Character sets" ) . Where the question mark .Ql \&? modifier suffix is supported, a case-insensitive operation mode is available; the keyword .Ql case is optional, .Ql regex? and .Ql regex?case are therefore identical. . .Bl -hang -width ".It Cm regex" .It Cm makeprint (One-way) Converts the argument to something safely printable on the terminal. . .It Cm regex \*(OP A string operation that will try to match the first argument with the regular expression given as the second argument. .Ql \&? modifier suffix is supported. If the optional third argument has been given then instead of showing the match offset a replacement operation is performed: the third argument is treated as if specified within dollar-single-quote (see .Sx "Shell-style argument quoting" ) , and any occurrence of a positional parameter, for example .Va \&0 , 1 etc. is replaced with the according match group of the regular expression: .Bd -literal -offset indent ? vput vexpr res regex bananarama \e (.*)NanA(.*) '\e${1}au\e$2' ? echo $?/$!/$^ERRNAME:$res: 1/61/NODATA:: ? vput vexpr res regex?case bananarama \e (.*)NanA(.*) '\e${1}uauf\e$2' ? echo $?/$!/$^ERRNAME:$res: 0/0/NONE:bauauframa: .Ed .El . . .Mx .It Ic vpospar \*(NQ Manage the positional parameter stack (see .Va 1 , # , * , @ as well as .Ic shift ) . If the first argument is .Ql clear , then the positional parameter stack of the current context, or the global one, if there is none, is cleared. If it is .Ql set , then the remaining arguments will be used to (re)create the stack, if the parameter stack size limit is excessed an .Va ^ERR Ns -OVERFLOW error will occur. . .Pp If the first argument is .Ql quote , a round-trip capable representation of the stack contents is created, with each quoted parameter separated from each other with the first character of .Va ifs , and followed by the first character of .Va if-ws , if that is not empty and not identical to the first. If that results in no separation at all a .Cm space character is used. This mode supports .Cm vput (see .Sx "Command modifiers" ) . I.e., the subcommands .Ql set and .Ql quote can be used (in conjunction with .Ic eval ) to (re)create an argument stack from and to a single variable losslessly. . .Bd -literal -offset indent ? vpospar set hey, "'you ", world! ? echo $#: <${1}><${2}><${3}> ? vput vpospar x quote ? vpospar clear ? echo $#: <${1}><${2}><${3}> ? eval vpospar set ${x} ? echo $#: <${1}><${2}><${3}> .Ed . . .Mx .It Ic visual (v) Takes a message list and invokes the .Ev VISUAL display editor on each message. Modified contents are discarded unless the .Va writebackedited variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status. .Ic edit can be used instead for a less display oriented editor. . .Mx .It Ic write (w) For conventional messages the body without all headers is written. The original message is never marked for deletion in the originating mail folder. The output is decrypted and converted to its native format as necessary. If the output file exists, the text is appended. If a message is in MIME multipart format its first part is written to the specified file as for conventional messages, handling of the remains depends on the execution mode. No special handling of compressed files is performed. .Pp In interactive mode the user is consecutively asked for the filenames of the processed parts. For convenience saving of each part may be skipped by giving an empty value, the same result as writing it to .Pa /dev/null . Shell piping the part content by specifying a leading vertical bar .Ql | character for the filename is supported. Other user input undergoes the usual .Sx "Filename transformations" , including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) and shell variable expansion for the message as such, not the individual parts, and contents of the destination file are overwritten if the file previously existed. Character set conversion to .Va ttycharset is performed when saving text data. .Pp \*(ID In non-interactive mode any part which does not specify a filename is ignored, and suspicious parts of filenames of the remaining parts are URL percent encoded (as via .Ic urlcodec ) to prevent injection of malicious character sequences, resulting in a filename that will be written into the current directory. Existing files will not be overwritten, instead the part number or a dot are appended after a number sign .Ql # to the name until file creation succeeds (or fails due to other reasons). . .Mx .It Ic xcall \*(NQ The sole difference to .Ic call is that the new macro is executed in place of the current one, which will not regain control: all resources of the current macro will be released first. This implies that any setting covered by .Ic localopts will be forgotten and covered variables will become cleaned up. If this command is not used from within a .Ic call Ns ed macro it will silently be (a more expensive variant of) .Ic call . . .Mx .It Ic xit (x) A synonym for .Ic exit . . .Mx .It Ic z \*(NQ \*(UA presents message headers in .Va screen Ns fuls as described under the .Ic headers command. Without arguments this command scrolls to the next window of messages, likewise if the argument is .Ql + . An argument of .Ql - scrolls to the last, .Ql ^ scrolls to the first, and .Ql $ to the last .Va \&\&screen of messages. A number argument prefixed by .Ql + or .Ql \- indicates that the window is calculated in relation to the current position, and a number without a prefix specifies an absolute position. . .Mx .It Ic Z \*(NQ Similar to .Ic z , but scrolls to the next or previous window that contains at least one .Ql new or .Ic flag Ns ged message. .El .\" }}} . .\" }}} . . .\" .Sh COMMAND ESCAPES {{{ .Sh "COMMAND ESCAPES" . Command escapes are available in .Sx "Compose mode" during interactive usage, when explicitly requested via .Fl ~ , and in batch mode .Pf ( Fl # ) . They perform special functions, like editing headers of the message being composed, calling normal .Sx COMMANDS , yielding a shell, etc. Command escapes are only recognized at the beginning of lines, and consist of an escape followed by a command character. The default .Va escape character is the tilde .Ql ~ . . .Pp Unless otherwise documented command escapes ensure proper updates of the error number .Va \&! and the exit status .Va \&? . The variable .Va errexit controls whether a failed operation errors out message compose mode and causes program exit. Escapes may be prefixed by none to multiple single character command modifiers, interspersed whitespace is ignored: . .Bl -bullet .It An effect equivalent to the command modifier .Cm ignerr can be achieved with hyphen-minus .Ql - , overriding .Va errexit . .It The modifier dollar .Ql $ .Ic eval Ns uates the remains of the line; also see .Sx "Shell-style argument quoting" . \*(ID For now the entire input line is evaluated as a whole; to avoid that control operators like semicolon .Cm \&; are interpreted unintentionally, they must be quoted. .El . .Pp Addition of the command line to the \*(OPal history can be prevented by placing whitespace directly after .Va escape . The \*(OPal key .Ic bind Ns ings support a compose mode specific context. The following command escapes are supported: . . .Bl -tag -width ".It Ic BaNg" .Mx .It Ic ~~ Ar string Insert the string of text in the message prefaced by a single .Ql ~ . (If the escape character has been changed, that character must be doubled instead.) . .Mx .It Ic ~! Ar command Execute the indicated shell .Ar command which follows, replacing unescaped exclamation marks with the previously executed command if the internal variable .Va bang is set, then return to the message. . .Mx .It Ic ~. End compose mode and send the message. The hooks .Va on-compose-splice-shell and .Va on-compose-splice , in order, will be called when set, after which, in interactive mode .Va askatend (leading to .Va askcc , askbcc ) and .Va askattach will be checked as well as .Va asksend , after which a set .Va on-compose-leave hook will be called, .Va autocc and .Va autobcc will be joined in if set, finally a given .Va message-inject-tail will be incorporated, after which the compose mode is left. . .Mx .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command Can be used to execute .Sx COMMANDS (which are allowed in compose mode). . .Mx .It Ic ~< Ar filename Identical to .Ic ~r . . .Mx .It Ic ~' . Non-network addresses use the first field to indicate the type (hyphen-minus .Ql - for files, vertical bar .Ql | for pipes, and number sign .Ql # for names which will undergo .Ic alias processing) instead, the actual value will be in the second field. . .It Ql 212 Status ok; the rest of the line is optionally used for more status. What follows are lines of furtherly unspecified (quoted) string content, terminated by an empty line. All the input, including the empty line, must be consumed before further commands can be issued. . .It Ql 500 Syntax error; invalid command. . .It Ql 501 Syntax error or otherwise invalid parameters or arguments. . .It Ql 505 Error: an argument fails verification. For example an invalid address has been specified (also see .Va expandaddr ) , or an attempt was made to modify anything in \*(UA's own namespace, or a modifying subcommand has been used on a read-only message. . .It Ql 506 Error: an otherwise valid argument is rendered invalid due to context. For example, a second address is added to a header which may consist of a single address only. .El . . .Pp If a command indicates failure then the message will have remained unmodified. Most commands can fail with .Ql 500 if required arguments are missing, or excessive arguments have been given (false command usage). (\*(ID The latter does not yet occur regularly, because as stated in .Sx "Shell-style argument quoting" our argument parser is not yet smart enough to work on subcommand base; for example one might get excess argument error for a three argument subcommand that receives four arguments, but not for a four argument subcommand which receives six arguments: here excess will be joined.) The following (case-insensitive) commands are supported: . . .Bl -hang -width ".It Cm version" .It Cm attachment This command allows listing, removal and addition of message attachments. The second argument specifies the subcommand to apply, one of: . .Bl -hang -width ".It Cm remove" .It Cm attribute This uses the same search mechanism as described for .Cm remove and prints any known attributes of the first found attachment via .Ql 212 upon success or .Ql 501 if no such attachment can be found. The attributes are written as lines with a keyword and a value token. . .It Cm attribute-at This uses the same search mechanism as described for .Cm remove-at and is otherwise identical to .Cm attribute . . .It Cm attribute-set This uses the same search mechanism as described for .Cm remove , and will set the attribute given as the fourth to the value given as the fifth token argument. If the value is an empty token, then the given attribute is removed, or reset to a default value if existence of the attribute is crucial. .Pp It returns via .Ql 210 upon success, with the index of the found attachment following, .Ql 505 for message attachments or if the given keyword is invalid, and .Ql 501 if no such attachment can be found. The following keywords may be used (case-insensitively): .Pp .Bl -hang -compact -width ".It Ql filename" .It Ql filename Sets the filename of the MIME part, i.e., the name that is used for display and when (suggesting a name for) saving (purposes). .It Ql content-description Associate some descriptive information to the attachment's content, used in favour of the plain filename by some MUAs. .It Ql content-id May be used for uniquely identifying MIME entities in several contexts; this expects a special reference address format as defined in RFC 2045 and generates a .Ql 505 upon address content verification failure. .It Ql content-type Defines the media type/subtype of the part, which is managed automatically, but can be overwritten. .It Ql content-disposition Automatically set to the string .Ql attachment . .El . .It Cm attribute-set-at This uses the same search mechanism as described for .Cm remove-at and is otherwise identical to .Cm attribute-set . . .It Cm insert Adds the attachment given as the third argument, specified exactly as documented for the command line option .Fl a , and supporting the message number extension as documented for .Ic ~@ . This reports .Ql 210 upon success, with the index of the new attachment following, .Ql 505 if the given file cannot be opened, .Ql 506 if an on-the-fly performed character set conversion fails, otherwise .Ql 501 is reported; this is also reported if character set conversion is requested but not available. . .It Cm list List all attachments via .Ql 212 , or report .Ql 501 if no attachments exist. This command is the default command of .Cm attachment if no second argument has been given. . .It Cm remove This will remove the attachment given as the third argument, and report .Ql 210 upon success or .Ql 501 if no such attachment can be found. If there exists any path component in the given argument, then an exact match of the path which has been used to create the attachment is used directly, but if only the basename of that path matches then all attachments are traversed to find an exact match first, and the removal occurs afterwards; if multiple basenames match, a .Ql 506 error occurs. Message attachments are treated as absolute pathnames. .Pp If no path component exists in the given argument, then all attachments will be searched for .Ql filename= parameter matches as well as for matches of the basename of the path which has been used when the attachment has been created; multiple matches result in a .Ql 506 . . .It Cm remove-at This will interpret the third argument as a number and remove the attachment at that list position (counting from one!), reporting .Ql 210 upon success or .Ql 505 if the argument is not a number or .Ql 501 if no such attachment exists. .El . . .It Cm header This command allows listing, inspection, and editing of message headers. Header name case is not normalized, so that case-insensitive comparison should be used when matching names. The second argument specifies the subcommand to apply, one of: . . .Bl -hang -width ".It Cm remove" .It Cm insert Create a new or an additional instance of the header given in the third argument, with the header body content as given in the fourth token. It may return .Ql 501 if the third argument specifies a free-form header field name that is invalid, or if body content extraction fails to succeed, .Ql 505 if any extracted address does not pass syntax and/or security checks or on \*(UA namespace violations, and .Ql 506 to indicate prevention of excessing a single-instance header \(em note that .Ql Subject: can be appended to (a space separator will be added automatically first). .Ql To: , .Ql Cc: and .Ql Bcc: support the .Ql ?single modifier to enforce treatment as a single addressee, for example .Ql header insert To?single: 'exa, ' ; the word .Ql single is optional. .Pp .Ql 210 is returned upon success, followed by the name of the header and the list position of the newly inserted instance. The list position is always 1 for single-instance header fields. All free-form header fields are managed in a single list; also see .Va customhdr . . .It Cm list Without a third argument a list of all yet existing headers is given via .Ql 210 ; this command is the default command of .Cm header if no second argument has been given. A third argument restricts output to the given header only, which may fail with .Ql 501 if no such field is defined. . .It Cm remove This will remove all instances of the header given as the third argument, reporting .Ql 210 upon success, .Ql 501 if no such header can be found, and .Ql 505 on \*(UA namespace violations. . .It Cm remove-at This will remove from the header given as the third argument the instance at the list position (counting from one!) given with the fourth argument, reporting .Ql 210 upon success or .Ql 505 if the list position argument is not a number or on \*(UA namespace violations, and .Ql 501 if no such header instance exists. . .It Cm show Shows the content of the header given as the third argument. Dependent on the header type this may respond with .Ql 211 or .Ql 212 ; any failure results in .Ql 501 . .El . . .Pp In compose-mode read-only access to optional pseudo headers in the \*(UA private namespace is available: . . .Pp .Bl -tag -compact -width ".It Va BaNg" .It Ql Mailx-Command: The name of the command that generates the message, one of .Ql forward , .Ql Lreply , .Ql mail , .Ql Reply , .Ql reply , .Ql resend . This pseudo header always exists (in compose-mode). . .It Ql Mailx-Raw-To: .It Ql Mailx-Raw-Cc: .It Ql Mailx-Raw-Bcc: Represent the frozen initial state of these headers before any transformation .Pf ( Ic alias , .Ic alternates , .Va recipients-in-cc etc.) took place. . .It Ql Mailx-Orig-Sender: .It Ql Mailx-Orig-From: .It Ql Mailx-Orig-To: .It Ql Mailx-Orig-Cc: .It Ql Mailx-Orig-Bcc: The values of said headers of the original message which has been addressed by any of .Ic reply , forward , resend . The sender field is special as it is filled in with the sole sender according to RFC 5322 rules, it may thus be equal to the from field. .El . . .It Cm help , \&? Show an abstract of the above commands via .Ql 211 . . .It Cm version This command will print the protocol version via .Ql 210 . .El . . .Mx .It Ic ~A The same as .Ql Ic ~i Ns \| Va Sign . . .Mx .It Ic ~a The same as .Ql Ic ~i Ns \| Va sign . . .Mx .It Ic ~b Ar name ... Add the given names to the list of blind carbon copy recipients. . .Mx .It Ic ~c Ar name ... Add the given names to the list of carbon copy recipients. . .Mx .It Ic ~d Read the file specified by the .Ev DEAD variable into the message. . .Mx .It Ic ~e Invoke the text .Ev EDITOR on the message collected so far, then return to compose mode. .Ic ~v can be used for a more display oriented editor, and .Ic ~| Ns | offers a pipe-based editing approach. . .Mx .It Ic ~F Ar messages Read the named messages into the message being sent, including all message headers and MIME parts, and honouring .Va forward-add-cc as well as .Va forward-inject-head and .Va forward-inject-tail . If no messages are specified, read in the current message, the .Dq dot . . .Mx .It Ic ~f Ar messages Read the named messages into the message being sent. If no messages are specified, read in the current message, the .Dq dot . Strips down the list of header fields according to the .Ql forward (with .Va posix : .Ql type ) white- and blacklist selection of .Ic headerpick , and honours .Va forward-add-cc as well as .Va forward-inject-head and .Va forward-inject-tail . For MIME multipart messages, only the first displayable part is included. . .Mx .It Ic ~H In interactive mode, edit the message header fields .Ql From: , .Ql Reply-To: and .Ql Sender: by typing each one in turn and allowing the user to edit the field. The default values for these fields originate from the .Va from , reply-to and .Va sender variables. In non-interactive mode this sets .Va ^ERR Ns -NOTTY . . .Mx .It Ic ~h In interactive mode, edit the message header fields .Ql To: , .Ql Cc: , .Ql Bcc: and .Ql Subject: by typing each one in turn and allowing the user to edit the field. In non-interactive mode this sets .Va ^ERR Ns -NOTTY . . .Mx .It Ic ~I Ar variable Insert the value of the specified variable into the message. The message remains unaltered if the variable is unset or empty. Any embedded character sequences .Ql \et horizontal tabulator and .Ql \en line feed are expanded in .Va posix mode; otherwise the expansion should occur at .Ic set time (\*(ID by using the command modifier .Va wysh ) . . .Mx .It Ic ~i Ar variable Like .Ic ~I , but appends a newline character. . .Mx .It Ic ~M Ar messages Read the named messages into the message being sent, indented by .Va indentprefix . If no messages are specified, read the current message, the .Dq dot . Honours .Va forward-add-cc as well as .Va forward-inject-head and .Va forward-inject-tail . . .Mx .It Ic ~m Ar messages Read the named messages into the message being sent, indented by .Va indentprefix . If no messages are specified, read the current message, the .Dq dot . Strips down the list of header fields according to the .Ql type white- and blacklist selection of .Ic headerpick . Honours .Va forward-add-cc as well as .Va forward-inject-head and .Va forward-inject-tail . For MIME multipart messages, only the first displayable part is included. . .Mx .It Ic ~p Display the message collected so far, prefaced by the message header fields and followed by the attachment list, if any. . .Mx .It Ic ~Q Read in the given / current message(s) using the algorithm of .Va quote (except that is implicitly assumed, even if not set), honouring .Va quote-add-cc . . .Mx .It Ic ~q Abort the message being sent, copying it to the file specified by the .Ev DEAD variable if .Va save is set. . .Mx .It Ic ~R Ar filename Identical to .Ic ~r , but indent each line that has been read by .Va indentprefix . . .Mx .It Ic ~r Ar filename Op Ar HERE-delimiter Read the named file, object to .Sx "Filename transformations" excluding shell globs and variable expansions, into the message; if .Ar filename is the hyphen-minus .Ql - then standard input is used (for pasting, for example). Only in this latter mode .Ar HERE-delimiter may be given: if it is data will be read in until the given .Ar HERE-delimiter is seen on a line by itself, and encountering EOF is an error; the .Ar HERE-delimiter is a required argument in non-interactive mode; if it is single-quote quoted then the pasted content will not be expanded, \*(ID otherwise a future version of \*(UA may perform shell-style expansion on the content. . .Mx .It Ic ~s Ar string Cause the named string to become the current subject field. Newline (NL) and carriage-return (CR) bytes are invalid and will be normalized to space (SP) characters. . .Mx .It Ic ~t Ar name ... Add the given name(s) to the direct recipient list. . .Mx .It Ic ~U Ar messages Read in the given / current message(s) excluding all headers, indented by .Va indentprefix . Honours .Va forward-add-cc as well as .Va forward-inject-head and .Va forward-inject-tail . . .Mx .It Ic ~u Ar messages Read in the given / current message(s), excluding all headers. Honours .Va forward-add-cc as well as .Va forward-inject-head and .Va forward-inject-tail . . .Mx .It Ic ~v Invoke the .Ev VISUAL editor on the message collected so far, then return to compose mode. .Ic ~e can be used for a less display oriented editor, and .Ic ~| Ns | offers a pipe-based editing approach. . .Mx .It Ic ~w Ar filename Write the message onto the named file, which is object to the usual .Sx "Filename transformations" . If the file exists, the message is appended to it. . .Mx .It Ic ~x Same as .Ic ~q , except that the message is not saved at all. .El . .\" }}} . . .\" .Sh INTERNAL VARIABLES {{{ .Sh "INTERNAL VARIABLES" . Internal \*(UA variables are controlled via the .Ic set and .Ic unset commands; prefixing a variable name with the string .Ql no and calling .Ic set has the same effect as using .Ic unset : .Ql unset crt and .Ql set nocrt do the same thing. .Ic varshow will give more insight on the given variable(s), and .Ic set , when called without arguments, will show a listing of all variables. Both commands support a more .Va verbose listing mode. Some well-known variables will also become inherited from the program .Sx ENVIRONMENT implicitly, others can be imported explicitly with the command .Ic environ and henceforth share said properties. . .Pp Two different kinds of internal variables exist, and both of which can also form chains. There are boolean variables, which can only be in one of the two states .Dq set and .Dq unset , and value variables with a(n optional) string value. For the latter proper quoting is necessary upon assignment time, the introduction of the section .Sx COMMANDS documents the supported quoting rules. . .Bd -literal -offset indent ? wysh set one=val\e 1 two="val 2" \e three='val "3"' four=$'val \e'4\e''; \e varshow one two three four; \e unset one two three four .Ed . .Pp Dependent upon the actual option string values may become interpreted as colour names, command specifications, normal text, etc. They may be treated as numbers, in which case decimal values are expected if so documented, but otherwise any numeric format and base that is valid and understood by the .Ic vexpr command may be used, too. . .Pp There also exists a special kind of string value, the .Dq boolean string , which must either be a decimal integer (in which case .Ql 0 is false and .Ql 1 and any other value is true) or any of the (case-insensitive) strings .Ql off , .Ql no , .Ql n and .Ql false for a false boolean and .Ql on , .Ql yes , .Ql y and .Ql true for a true boolean; .Mx -ix quadoption a special kind of boolean string is the .Dq quadoption : it can optionally be prefixed with the (case-insensitive) term .Ql ask- , as in .Ql ask-yes ; in interactive mode the user will be prompted, otherwise the actual boolean is used. . .Pp Variable chains extend a plain .Ql variable with .Ql variable-HOST and .Ql variable-USER@HOST variants. Here .Ql HOST will be converted to all lowercase when looked up (but not when the variable is set or unset!), \*(OPally IDNA converted, and indeed means .Ql server:port if a .Ql port had been specified in the contextual Uniform Resource Locator URL, see .Sx "On URL syntax and credential lookup" . Even though this mechanism is based on URLs no URL percent encoding may be applied to neither of .Ql USER nor .Ql HOST , variable chains need to be specified using raw data; the mentioned section contains examples. Variables which support chains are explicitly documented as such, and \*(UA treats the base name of any such variable special, meaning that users should not create custom names like .Ql variable-xyz in order to avoid false classifications and treatment of such variables. . .\" .Ss "Initial settings" {{{ .\" (Keep in SYNC: mx/nail.h:okeys, ./nail.rc, ./nail.1:"Initial settings") .Ss "Initial settings" . The standard POSIX 2008/Cor 2-2016 mandates the following initial variable settings: .Pf no Va allnet , .Pf no Va append , .Va asksub , .Pf no Va askbcc , .Pf no Va autoprint , .Pf no Va bang , .Pf no Va cmd , .Pf no Va crt , .Pf no Va debug , .Pf no Va dot , .Va escape set to .Ql ~ , .Pf no Va flipr , .Pf no Va folder , .Va header , .Pf no Va hold , .Pf no Va ignore , .Pf no Va ignoreeof , .Pf no Va keep , .Pf no Va keepsave , .Pf no Va metoo , .Pf no Va outfolder , .Pf no Va page , .Va prompt set to .Ql \&?\0 , .Pf no Va quiet , .Pf no Va record , .Va save , .Pf no Va sendwait , .Pf no Va showto , .Pf no Va Sign , .Pf no Va sign , .Va toplines set to .Ql 5 . . .Pp However, \*(UA has built-in some initial (and some default) settings which (may) diverge, others may become adjusted by one of the .Sx "Resource files" . Displaying the former is accomplished via .Ic set : .Ql $ \*(uA -:/ -v -Xset -Xx . In general this implementation sets (and has extended the meaning of) .Va sendwait , and does not support the .Pf no Va onehop variable \(en use command line options or .Va mta-arguments to pass options through to a .Va mta . The default global resource file sets, among others, the variables .Va hold , .Va keep and .Va keepsave , establishes a default .Ic headerpick selection etc., and should thus be taken into account. .\" }}} . .\" .Ss "Variables" {{{ .Ss "Variables" . .Bl -tag -width ".It Va BaNg" . .Mx .It Va \&? \*(RO The exit status of the last command, or the .Ic return value of the macro .Ic call Ns ed last. This status has a meaning in the state machine: in conjunction with .Va errexit any non-0 exit status will cause a program exit, and in .Va posix mode any error while loading (any of the) resource files will have the same effect. .Cm ignerr , one of the .Sx "Command modifiers" , can be used to instruct the state machine to ignore errors. . .Mx .It Va \&! \*(RO The current error number .Pf ( Xr errno 3 ) , which is set after an error occurred; it is also available via .Va ^ERR , and the error name and documentation string can be queried via .Va ^ERRNAME and .Va ^ERRDOC . \*(ID This machinery is new and the error number is only really usable if a command explicitly states that it manages the variable .Va \&! , for others errno will be used in case of errors, or .Va ^ERR Ns -INVAL if that is 0: it thus may or may not reflect the real error. The error number may be set with the command .Ic return . . . .Mx .It Va ^ \*(RO This is a multiplexer variable which performs dynamic expansion of the requested state or condition, of which there are: . .Bl -tag -width ".It Va BaNg" .Mx .Mx .Mx .It Va ^ERR , ^ERRDOC , ^ERRNAME The number, documentation, and name of the current .Xr errno 3 , respectively, which is usually set after an error occurred. The documentation is an \*(OP, the name is used if not available. \*(ID This machinery is new and is usually reliable only if a command explicitly states that it manages the variable .Va \&! , which is effectively identical to .Va \&\&^ERR . Each of those variables can be suffixed with a hyphen minus followed by a name or number, in which case the expansion refers to the given error. Note this is a direct mapping of (a subset of) the system error values: .Bd -literal -offset indent define work { eval echo \e$1: \e$^ERR-$1:\e \e$^ERRNAME-$1: \e$^ERRDOC-$1 vput vexpr i + "$1" 1 if [ $i -lt 16 ] \excall work $i end } call work 0 .Ed . .Mx .Mx .It Va ^ERRQUEUE-COUNT , ^ERRQUEUE-EXISTS The number of messages in the \*(OPal queue of .Ic errors , and a string indicating queue state: empty or (translated) .Dq ERROR . Always 0 and the empty string, respectively, unless .Va features includes .Ql ,+errors, . .El . . .Mx .It Va * \*(RO Expands all positional parameters (see .Va 1 ) , separated by the first character of the value of .Va ifs . \*(ID The special semantics of the equally named special parameter of the .Xr sh 1 are not yet supported. . .Mx .It Va @ \*(RO Expands all positional parameters (see .Va 1 ) , separated by a space character. If placed in double quotation marks, each positional parameter is properly quoted to expand to a single parameter again. . .Mx .It Va # \*(RO Expands to the number of positional parameters, i.e., the size of the positional parameter stack in decimal. . .Mx .It Va \&0 \*(RO Inside the scope of a .Ic define Ns d and .Ic call Ns ed macro this expands to the name of the calling macro, or to the empty string if the macro is running from top-level. For the \*(OPal regular expression search and replace operator of .Ic vexpr this expands to the entire matching expression. It represents the program name in global context. . .Mx .It Va 1 \*(RO Access of the positional parameter stack. All further parameters can be accessed with this syntax, too, .Ql 2 , .Ql 3 etc.; positional parameters can be shifted off the stack by calling .Ic shift . The parameter stack contains, for example, the arguments of a .Ic call Ns ed .Ic define Ns d macro, the matching groups of the \*(OPal regular expression search and replace expression of .Ic vexpr , and can be explicitly created or overwritten with the command .Ic vpospar . . .Mx .It Va account \*(RO Is set to the active .Ic account . . .Mx .It Va add-file-recipients \*(BO When file or pipe recipients have been specified, mention them in the corresponding address fields of the message instead of silently stripping them from their recipient list. By default such addressees are not mentioned. . .Mx .It Va allnet \*(BO Causes only the local part to be evaluated when comparing addresses. . .Mx .It Va append \*(BO Causes messages saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX to be appended to the end rather than prepended. This should always be set. . .Mx .It Va askatend \*(BO Causes the prompts for .Ql Cc: and .Ql Bcc: lists to appear after the message has been edited. . .Mx .It Va askattach \*(BO If set, \*(UA asks an interactive user for files to attach at the end of each message; An empty line finalizes the list. . .Mx .It Va askcc \*(BO Causes the interactive user to be prompted for carbon copy recipients (at the end of each message if .Va askatend or .Va bsdcompat are set). . .Mx .It Va askbcc \*(BO Causes the interactive user to be prompted for blind carbon copy recipients (at the end of each message if .Va askatend or .Va bsdcompat are set). . .Mx .It Va asksend \*(BO Causes the interactive user to be prompted for confirmation to send the message or reenter compose mode after having been shown a preliminary envelope summary. . .Mx .It Va asksign \*(BO\*(OP Causes the interactive user to be prompted if the message is to be signed at the end of each message. The .Va smime-sign variable is ignored when this variable is set. . .Mx .It Va asksub .\" The alternative *ask* is not documented on purpose \*(BO Causes \*(UA to prompt the interactive user for the subject upon entering compose mode unless a subject already exists. . .Mx .It Va attrlist A sequence of characters to display in the .Ql attribute column of the .Va headline as shown in the display of .Ic headers ; each for one type of messages (see .Sx "Message states" ) , with the default being .Ql NUROSPMFAT+\-$~ or .Ql NU\ \ *HMFAT+\-$~ if the .Va bsdflags variable is set, in the following order: .Pp .Bl -tag -compact -width ".It Ql _" .It Ql N new. .It Ql U unread but old. .It Ql R new but read. .It Ql O read and old. .It Ql S saved. .It Ql P preserved. .It Ql M mboxed. .It Ql F flagged. .It Ql A answered. .It Ql T draft. .It Ql + \*(ID start of a (collapsed) thread in threaded mode (see .Va autosort , .Ic thread ) ; .It Ql - \*(ID an uncollapsed thread in threaded mode; only used in conjunction with .Fl L . .It Ql $ classified as spam. .It Ql ~ classified as possible spam. .El . . .Mx .It Va autobcc Specifies a list of recipients to which a blind carbon copy of each outgoing message will be sent automatically. . .Mx .It Va autocc Specifies a list of recipients to which a carbon copy of each outgoing message will be sent automatically. . .Mx .It Va autocollapse \*(BO Causes threads to be collapsed automatically when .Ql thread Ns ed .Ic sort mode is entered (see the .Ic collapse command). . .Mx .It Va autoprint \*(BO Enable automatic .Ic type Ns ing of a(n existing) .Dq successive message after .Ic delete and .Ic undelete commands: the message that becomes the new .Dq dot is shown automatically, as via .Ic dp or .Ic dt . . .Mx .It Va autosort Causes sorted mode (see the .Ic sort command) to be entered automatically with the value of this variable as sorting method when a folder is opened, for example .Ql set autosort=thread . . .Mx .It Va bang \*(BO Enables the substitution of all not (reverse-solidus) escaped exclamation mark .Ql \&! characters by the contents of the last executed command for the .Ic \&! shell escape command and .Ic ~! , one of the compose mode .Sx "COMMAND ESCAPES" . If this variable is not set no reverse solidus stripping is performed. . .Mx .It Va bind-timeout \*(OB Predecessor of .Va bind-inter-byte-timeout . \*(ID Setting this automatically sets the successor. . .Mx .It Va bind-inter-byte-timeout \*(OP Terminals may generate multi-byte sequences for special function keys, for example, but these sequences may not become read as a unit. And multi-byte sequences can be defined freely via .Ic bind . This variable specifies the timeout in milliseconds that the MLE (see .Sx "On terminal control and line editor" ) waits for more bytes to arrive unless it considers a sequence .Dq complete . The default is 200, the maximum is about 10 seconds. In the following example the comments state which sequences are affected by this timeout: .Bd -literal -offset indent ? bind base abc echo 0 # abc ? bind base ab,c echo 1 # ab ? bind base abc,d echo 2 # abc ? bind base ac,d echo 3 # ac ? bind base a,b,c echo 4 ? bind base a,b,c,d echo 5 ? bind base a,b,cc,dd echo 6 # cc and dd .Ed . .Mx .It Va bind-inter-key-timeout \*(OP Multi-key .Ic bind sequences do not time out by default. If this variable is set, then the current key sequence is forcefully terminated once the timeout (in milliseconds) triggers. The value should be (maybe significantly) larger than .Va bind-inter-byte-timeout , but may not excess the maximum, too. . .Mx .It Va bsdcompat \*(BO Sets some cosmetical features to traditional BSD style; has the same affect as setting .Va askatend and all other variables prefixed with .Ql bsd ; it also changes the behaviour of .Va emptystart (which does not exist in BSD). . .Mx .It Va bsdflags \*(BO Changes the letters shown in the first column of a header summary to traditional BSD style. . .Mx .It Va bsdheadline \*(BO Changes the display of columns in a header summary to traditional BSD style. . .Mx .It Va bsdmsgs \*(BO Changes some informational messages to traditional BSD style. . .Mx .It Va bsdorder \*(BO Causes the .Ql Subject: field to appear immediately after the .Ql To: field in message headers and with the .Ic ~h .Sx "COMMAND ESCAPES" . . .Mx .Mx .Mx .Mx .It Va build-cc , build-ld , build-os , build-rest \*(RO The build environment, including the compiler, the linker, the operating system \*(UA has been build for, usually taken from .Xr uname 1 via .Ql uname -s , and then lowercased, as well as all the possibly interesting rest of the configuration and build environment. This information is also available in the .Va verbose output of the command .Ic version . . .Mx .It Va charset-7bit The value that should appear in the .Ql charset= parameter of .Ql Content-Type: MIME header fields when no character set conversion of the message data was performed. This defaults to US-ASCII, and the chosen character set should be US-ASCII compatible. . .Mx .It Va charset-8bit \*(OP The default 8-bit character set that is used as an implicit last member of the variable .Va sendcharsets . This defaults to UTF-8 if character set conversion capabilities are available, and to ISO-8859-1 otherwise (unless the operating system environment is known to always and exclusively support UTF-8 locales), in which case the only supported character set is .Va ttycharset and this variable is effectively ignored. . .Mx .It Va charset-unknown-8bit \*(OP RFC 1428 specifies conditions when internet mail gateways shall .Dq upgrade the content of a mail message by using a character set with the name .Ql unknown-8bit . Because of the unclassified nature of this character set \*(UA will not be capable to convert this character set to any other character set. If this variable is set any message part which uses the character set .Ql unknown-8bit is assumed to really be in the character set given in the value, otherwise the (final) value of .Va charset-8bit is used for this purpose. .Pp This variable will also be taken into account if a MIME type (see .Sx "The mime.types files" ) of a MIME message part that uses the .Ql binary character set is forcefully treated as text. . .Mx .It Va cmd The default value for the .Ic pipe command. . .Mx .It Va colour-disable \*(BO\*(OP Forcefully disable usage of colours. Also see the section .Sx "Coloured display" . . .Mx .It Va colour-pager \*(BO\*(OP Whether colour shall be used for output that is paged through .Ev PAGER . Note that pagers may need special command line options, for example .Xr less 1 requires the option .Fl \&\&R and .Xr lv 1 the option .Fl \&\&c in order to support colours. Often doing manual adjustments is unnecessary since \*(UA may perform adjustments dependent on the value of the environment variable .Ev PAGER (see there for more). . .Mx .Mx .It Va contact-mail , contact-web \*(RO Addresses for contact per email and web, respectively, for bug reports, suggestions, or anything else regarding \*(UA. The former can be used directly: .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail . . .Mx .Mx .Mx .Mx .It Va content-description-forwarded-message , \ content-description-quote-attachment , \ content-description-smime-message , \ content-description-smime-signature \*(OP(partially) Strings which will be placed in according .Ql Content-Description: headers if non-empty. They all have default values, for example .Ql Forwarded message . . .Mx .It Va crt In a(n interactive) terminal session, then if this valued variable is set it will be used as a threshold to determine how many lines the given output has to span before it will be displayed via the configured .Ev PAGER ; Usage of the .Ev PAGER can be forced by setting this to the value .Ql 0 , setting it without a value will deduce the current height of the terminal screen to compute the threshold (see .Ev LINES , .Va screen and .Xr stty 1 ) . \*(ID At the moment this uses the count of lines of the message in wire format, which, dependent on the .Va mime-encoding of the message, is unrelated to the number of display lines. (The software is old and historically the relation was a given thing.) . .Mx .It Va customhdr Define a set of custom headers to be injected into newly composed or forwarded messages. A custom header consists of the field name followed by a colon .Ql \&: and the field content body. Standard header field names cannot be overwritten by a custom header, with the exception of .Ql Comments: and .Ql Keywords: . Different to the command line option .Fl C the variable value is interpreted as a comma-separated list of custom headers: to include commas in header bodies they need to become escaped with reverse solidus .Ql \e . Headers can be managed more freely in .Sx "Compose mode" via .Ic ~^ . .Pp .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2, Hdr2: Body2' . .Mx .It Va datefield Controls the appearance of the .Ql %d date and time format specification of the .Va headline variable, that is used, for example, when viewing the summary of .Ic headers . If unset, then the local receiving date is used and displayed unformatted, otherwise the message sending .Ql Date: . It is possible to assign a .Xr strftime 3 format string and control formatting, but embedding newlines via the .Ql %n format is not supported, and will result in display errors. The default is .Ql %Y-%m-%d %H:%M , and also see .Va datefield-markout-older . . .Mx .It Va datefield-markout-older Only used in conjunction with .Va datefield . Can be used to create a visible distinction of messages dated more than a day in the future, or older than six months, a concept comparable to the .Fl \&\&l option of the POSIX utility .Xr ls 1 . If set to the empty string, then the plain month, day and year of the .Ql Date: will be displayed, but a .Xr strftime 3 format string to control formatting can be assigned. The default is .Ql %Y-%m-%d . . .Mx .It Va debug \*(BO (Almost) Enter a debug-only sandbox mode which generates many log messages, disables the actual delivery of messages, and also implies .Pf no Va record as well as .Pf no Va save . Also see .Va verbose . . .Mx .It Va disposition-notification-send \*(BO\*(OP Emit a .Ql Disposition-Notification-To: header (RFC 3798) with the message. This requires the .Va from variable to be set. .\" TODO .It Va disposition-notification-send-HOST .\"Overrides .\".Va disposition-notification-send .\" for SMTP accounts on a specific host. .\" TODO .It Va disposition-notification-send-USER@HOST .\"Overrides .\".Va disposition-notification-send .\"for a specific account. . .Mx .It Va dot \*(BO When dot is set, a period .Ql \&. on a line by itself during message input in (interactive or batch .Fl # ) .Sx "Compose mode" will be treated as end-of-message (in addition to the normal end-of-file condition). This behaviour is implied in .Va posix mode with a set .Va ignoreeof . . .Mx .It Va dotlock-disable \*(BO\*(OP Disable creation of .Mx -sx .Sx "dotlock files" for MBOX databases. . .It Va dotlock-ignore-error \*(OB\*(BO\*(OP Ignore failures when creating .Mx -sx .Sx "dotlock files" . Please use .Va dotlock-disable instead. . .Mx .It Va editalong If this variable is set then the editor is started automatically when a message is composed in interactive mode. If the value starts with the letter .Ql v then this acts as if .Ic ~v , otherwise as if .Ic ~e .Pf (see\0 Sx "COMMAND ESCAPES" ) had been specified. The .Va editheaders variable is implied for this automatically spawned editor session. . .Mx .It Va editheaders \*(BO When a message is edited while being composed, its header is included in the editable text. . .Mx .It Va emptystart \*(BO When entering interactive mode \*(UA normally writes .Dq \&No mail for user and exits immediately if a mailbox is empty or does not exist. If this variable is set \*(UA starts even with an empty or non-existent mailbox (the latter behaviour furtherly depends upon .Va bsdcompat , though). . .Mx .It Va errexit \*(BO Let each command with a non-0 exit status, including every .Ic call Ns ed macro which .Ic return Ns s a non-0 status, cause a program exit unless prefixed by .Cm ignerr (see .Sx "Command modifiers" ) . This also affects .Sx "COMMAND ESCAPES" , but which use a different modifier for ignoring the error. Please refer to the variable .Va \&? for more on this topic. . .Mx .It Va errors-limit \*(OP Maximum number of entries in the .Ic errors queue. . .Mx .It Va escape The first character of this value defines the escape character for .Sx "COMMAND ESCAPES" in .Sx "Compose mode" . The default value is the character tilde .Ql ~ . If set to the empty string, command escapes are disabled. . . .Mx .It Va expandaddr If unset only user name and email address recipients are allowed .Sx "On sending mail, and non-interactive mode" . If set without value all possible recipient types will be accepted. A value is parsed as a comma-separated list of case-insensitive strings, and if that contains .Ql restrict behaviour equals the former except when in interactive mode or if .Sx "COMMAND ESCAPES" were enabled via .Fl ~ or .Fl # , in which case it equals the latter, allowing all address types. .Ql restrict really acts like .Ql restrict,\:-all,\:+name,\:+addr , so care for ordering issues must be taken. . .Pp Recipient types can be added and removed with a plus sign .Ql + or hyphen-minus .Ql - prefix, respectively. By default invalid or disallowed types are filtered out and cause a warning, hard send errors need to be enforced by including .Ql fail . The value .Ql all covers all types, .Ql fcc whitelists .Ql Fcc: header targets regardless of other settings, .Ql file file targets (it includes .Ql fcc ) , .Ql pipe command pipeline targets, .Ql name user names still unexpanded after .Ic alias and .Va mta-aliases processing and thus left for expansion by the .Va mta (invalid for the built-in SMTP one), and .Ql addr network addresses. Targets are interpreted in the given order, so that .Ql restrict,\:fail,\:+file,\:-all,\:+addr will cause hard errors for any non-network address recipient address unless running interactively or having been started with the option .Fl ~ or .Fl # ; in the latter case(s) any type may be used. . .Pp User name receivers addressing valid local users can be expanded to fully qualified network addresses (also see .Va hostname ) by including .Ql nametoaddr in the list. Historically invalid recipients were stripped off without causing errors, this can be changed by making .Ql failinvaddr an entry of the list (it really acts like .Ql failinvaddr,\:+addr ) . Likewise, .Ql domaincheck .Pf (really\0\: Ql domaincheck,\:+addr ) compares address domain names against a whitelist and strips off .Pf ( Ql fail for hard errors) addressees which fail this test; the domain name .Ql localhost and the non-empty value of .Va hostname (the real hostname otherwise) are always whitelisted, .Va expandaddr-domaincheck can be set to extend this list. Finally some address providers (for example .Fl b , c and all other command line recipients) will be evaluated as if specified within dollar-single-quotes (see .Sx "Shell-style argument quoting" ) if the value list contains the string .Ql shquote . . . .Mx .It Va expandaddr-domaincheck Can be set to a comma-separated list of domain names which should be whitelisted for the evaluation of the .Ql domaincheck mode of .Va expandaddr . IDNA encoding is not automatically performed, .Ic addrcodec can be used to prepare the domain (of an address). . .Mx .It Va expandargv Unless this variable is set additional .Va mta (Mail-Transfer-Agent) arguments from the command line, as can be given after a .Fl \&\&- separator, results in a program termination with failure status. The same can be accomplished by using the special (case-insensitive) value .Ql fail . A lesser strict variant is the otherwise identical .Ql restrict , which does accept such arguments in interactive mode, or if tilde commands were enabled explicitly by using one of the command line options .Fl ~ or .Fl # . The empty value will allow unconditional usage. . .Mx .It Va features \*(RO String giving a list of optional features. Features are preceded with a plus sign .Ql + if they are available, with a hyphen-minus .Ql - otherwise. To ease substring matching the string starts and ends with a comma. The output of the command .Ic version includes this information in a more pleasant output. . .Mx .It Va flipr \*(BO This setting reverses the meanings of a set of reply commands, turning the lowercase variants, which by default address all recipients included in the header of a message .Pf ( Ic reply , respond , followup ) into the uppercase variants, which by default address the sender only .Pf ( Ic Reply , Respond , Followup ) and vice versa. . .Mx .It Va folder The default path under which mailboxes are to be saved: filenames that begin with the plus sign .Ql + will have the plus sign replaced with the value of this variable if set, otherwise the plus sign will remain unchanged when doing .Sx "Filename transformations" ; also see .Ic folder for more on this topic, and know about standard imposed implications of .Va outfolder . The value supports a subset of transformations itself, and if the non-empty value does not start with a solidus .Ql / , then the value of .Ev HOME will be prefixed automatically. Once the actual value is evaluated first, the internal variable .Va folder-resolved will be updated for caching purposes. . .Mx Va folder-hook .It Va folder-hook-FOLDER , Va folder-hook Names a .Ic define Ns d macro which will be called whenever a .Ic folder is opened. The macro will also be invoked when new mail arrives, but message lists for commands executed from the macro only include newly arrived messages then. .Ic localopts are activated by default in a folder hook, causing the covered settings to be reverted once the folder is left again. .Pp The specialized form will override the generic one if .Ql FOLDER matches the file that is opened. Unlike other folder specifications, the fully expanded name of a folder, without metacharacters, is used to avoid ambiguities. However, if the mailbox resides under .Va folder then the usual .Ql + specification is tried in addition, so that if .Va \&\&folder is .Dq mail (and thus relative to the user's home directory) then .Pa /home/usr1/mail/sent will be tried as .Ql folder-hook-/home/usr1/mail/sent first, but then followed by .Ql folder-hook-+sent . . .Mx .It Va folder-resolved \*(RO Set to the fully resolved path of .Va folder once that evaluation has occurred; rather internal. . .Mx .It Va followup-to \*(BO Controls whether a .Ql Mail-Followup-To: header is generated when sending messages to known mailing lists. The user as determined via .Va from (or, if that contains multiple addresses, .Va sender ) will be placed in there if any list addressee is not a subscribed list. Also see .Va followup-to-honour and the commands .Ic mlist , mlsubscribe , reply and .Ic Lreply . . .Mx .It Va followup-to-add-cc \*(BO Controls whether the user will be added to the messages' .Ql Cc: list in addition to placing an entry in .Ql Mail-Followup-To: (see .Va followup-to ) . . .Mx .It Va followup-to-honour Controls whether a .Ql Mail-Followup-To: header is honoured when group-replying to a message via .Ic reply or .Ic Lreply . This is a .Mx -sx .Sx quadoption ; if set without a value it defaults to .Dq yes , and see .Va followup-to . . .Mx .It Va forward-add-cc \*(BO Whether senders of messages forwarded via .Ic ~F , ~f , ~m , ~U or .Ic ~u shall be made members of the carbon copies .Ql Cc: list. . .Mx .It Va forward-as-attachment \*(BO Original messages are normally sent as inline text with the .Ic forward command, and only the first part of a multipart message is included. With this setting enabled messages are sent as unmodified MIME .Ql message/rfc822 attachments with all of their parts included. . .Mx .Mx .It Va forward-inject-head , forward-inject-tail The strings to put before and after the text of a message with the .Ic forward command, respectively. The former defaults to .Ql -------- Original Message --------\en . Special format directives in these strings will be expanded if possible, and if so configured the output will be folded according to .Va quote-fold ; for more please refer to .Va quote-inject-head . Injections will not be performed by .Ic forward if the variable .Va forward-as-attachment is set \(em the .Sx "COMMAND ESCAPES" .Ic ~F , ~f , ~M , ~m , ~U , ~u always inject. . . .Mx .It Va from The address (or a list of addresses) to put into the .Ql From: field of the message header, quoting RFC 5322: the author(s) of the message, that is, the mailbox(es) of the person(s) or system(s) responsible for the writing of the message. According to that RFC setting the .Va sender variable is required if .Va \&\&from contains more than one address. \*(ID Please expect automatic management of the .Va from and .Va sender relationship. Dependent on the context these addresses are handled as if they were in the list of .Ic alternates . . .Pp If a file-based MTA is used, then .Va \&\&from (or, if that contains multiple addresses, .Va sender ) can nonetheless be used as the envelope sender address at the MTA protocol level (the RFC 5321 reverse-path), either via the .Fl r command line option (without argument; see there for more), or by setting .Va r-option-implicit . . .Pp If the machine's hostname is not valid at the Internet (for example at a dialup machine), then either this variable or .Va hostname (\*(IN a SMTP-based .Va mta adds even more fine-tuning capabilities with .Va smtp-hostname ) have to be set: if so the message and MIME part related unique ID fields .Ql Message-ID: and .Ql Content-ID: will be created (except when disallowed by .Va message-id-disable or .Va stealthmua ) . . . .Mx .It Va fullnames \*(BO Due to historical reasons comments and name parts of email addresses are removed by default when sending mail, replying to or forwarding a message. If this variable is set such stripping is not performed. . .It Va fwdheading \*(OB Predecessor of .Va forward-inject-head . . .Mx .It Va header \*(BO Causes the header summary to be written at startup and after commands that affect the number of messages or the order of messages in the current .Ic folder . Unless in .Va posix mode a header summary will also be displayed on folder changes. The command line option .Fl N can be used to set .Pf no Va header . . . .Mx .It Va headline A format string to use for the summary of .Ic headers . Format specifiers in the given string start with a percent sign .Ql % and may be followed by an optional decimal number indicating the field width \(em if that is negative, the field is to be left-aligned. Names and addresses are subject to modifications according to .Va showname and .Va showto . Valid format specifiers are: . .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql %% A plain percent sign. .It Ql %> .Dq Dotmark : a space character but for the current message .Pf ( Dq dot ) , for which it expands to .Ql > (dependent on .Va headline-plain ) . .It Ql %< .Dq Dotmark : a space character but for the current message .Pf ( Dq dot ) , for which it expands to .Ql < (dependent on .Va headline-plain ) . .It Ql %$ \*(OP The spam score of the message, as has been classified via the command .Ic spamrate . Shows only a replacement character if there is no spam support. .It Ql %a Message attribute character (status flag); the actual content can be adjusted by setting .Va attrlist . .It Ql %d The date found in the .Ql Date: header of the message when .Va datefield is set (the default), otherwise the date when the message was received. Formatting can be controlled by assigning a .Xr strftime 3 format string to .Va datefield (and .Va datefield-markout-older ) . .It Ql %e The indenting level in .Ql thread Ns ed .Ic sort mode. .It Ql %f The address of the message sender. .It Ql %i The message thread tree structure. (Note that this format does not support a field width, and honours .Va headline-plain . ) .It Ql %L Mailing list status: is the addressee of the message a known .Ql l .Pf ( Ic mlist ) or .Ql L .Ic mlsubscribe Ns d mailing list? The letter .Ql P announces the presence of a RFC 2369 .Ql List-Post: header, which makes a message a valuable target of .Ic Lreply . .It Ql %l The number of lines of the message, if available. .It Ql %m Message number. .It Ql %o The number of octets (bytes) in the message, if available. .It Ql %S Message subject (if any) in double quotes. .It Ql %s Message subject (if any). .It Ql %t The position in threaded/sorted order. .It Ql \&%U The value 0 except in an IMAP mailbox, where it expands to the UID of the message. .El .Pp The default is .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s , or .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S if .Va bsdcompat is set. Also see .Va attrlist , .Va headline-plain and .Va headline-bidi . . . .Mx .It Va headline-bidi Bidirectional text requires special treatment when displaying headers, because numbers (in dates or for file sizes etc.) will not affect the current text direction, in effect resulting in ugly line layouts when arabic or other right-to-left text is to be displayed. On the other hand only a minority of terminals is capable to correctly handle direction changes, so that user interaction is necessary for acceptable results. Note that extended host system support is required nonetheless, e.g., detection of the terminal character set is one precondition; and this feature only works in an Unicode (i.e., UTF-8) locale. .Pp In general setting this variable will cause \*(UA to encapsulate text fields that may occur when displaying .Va headline (and some other fields, like dynamic expansions in .Va prompt ) with special Unicode control sequences; it is possible to fine-tune the terminal support level by assigning a value: no value (or any value other than .Ql 1 , .Ql 2 and .Ql 3 ) will make \*(UA assume that the terminal is capable to properly deal with Unicode version 6.3, in which case text is embedded in a pair of U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE) characters. In addition no space on the line is reserved for these characters. .Pp Weaker support is chosen by using the value .Ql 1 (Unicode 6.3, but reserve the room of two spaces for writing the control sequences onto the line). The values .Ql 2 and .Ql 3 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter again reserves room for two spaces in addition. . .Mx .It Va headline-plain \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are used by default for certain entries of .Va headline . If this variable is set only basic US-ASCII symbols will be used. . .Mx .It Va history-file \*(OP The (expandable) location of a permanent .Ic history file for the MLE line editor .Pf ( Sx "On terminal control and line editor" ) . Also see .Va history-size . . .Mx .It Va history-gabby \*(OP Add more entries to the MLE .Ic history as is normally done. A comma-separated list of case-insensitive strings can be used to fine-tune which gabby entries shall be allowed. If it contains .Ql errors , erroneous commands will also be added. .Ql all adds all optional entries, and is the fallback chattiness identifier of .Va on-history-addition . . .Mx .It Va history-gabby-persist \*(BO\*(OP The .Va history-gabby entries will not be saved in persistent storage unless this variable is set. The knowledge of whether a persistent entry was gabby is not lost. Also see .Va history-file . . .Mx .It Va history-size \*(OP Setting this variable imposes a limit on the number of concurrent .Ic history entries. If set to the value 0 then no further history entries will be added, and loading and incorporation of the .Va history-file upon program startup can also be suppressed by doing this. Runtime changes will not be reflected before the .Ic history is saved or loaded (again). . .Mx .It Va hold \*(BO This setting controls whether messages are held in the system .Va inbox , and it is set by default. . .Mx .It Va hostname Used instead of the value obtained from .Xr uname 3 and .Xr getaddrinfo 3 as the hostname when expanding local addresses, for example in .Ql From: (also see .Sx "On sending mail, and non-interactive mode" , for expansion of addresses that have a valid user-, but no domain name in angle brackets). If either of .Va from or this variable is set the message and MIME part related unique ID fields .Ql Message-ID: and .Ql Content-ID: will be created (except when disallowed by .Va message-id-disable or .Va stealthmua ) . If the \*(OPal IDNA support is available (see .Va idna-disable ) variable assignment is aborted when a necessary conversion fails. .Pp Setting it to the empty string will cause the normal hostname to be used, but nonetheless enables creation of said ID fields. \*(IN in conjunction with the built-in SMTP .Va mta .Va smtp-hostname also influences the results: one should produce some test messages with the desired combination of .Va \&\&hostname , and/or .Va from , .Va sender etc. first. . .Mx .It Va idna-disable \*(BO\*(OP Can be used to turn off the automatic conversion of domain names according to the rules of IDNA (internationalized domain names for applications). Since the IDNA code assumes that domain names are specified with the .Va ttycharset character set, an UTF-8 locale charset is required to represent all possible international domain names (before conversion, that is). . .Mx .It Va ifs The input field separator that is used (\*(ID by some functions) to determine where to split input data. .Pp .Bl -tag -compact -width ".It MMM" .It 1. Unsetting is treated as assigning the default value, .Ql \& \et\en . .It 2. If set to the empty value, no field splitting will be performed. .It 3. If set to a non-empty value, all whitespace characters are extracted and assigned to the variable .Va ifs-ws . .El .Pp .Bl -tag -compact -width ".It MMM" .It a. .Va \&\&ifs-ws will be ignored at the beginning and end of input. Diverging from POSIX shells default whitespace is removed in addition, which is owed to the entirely different line content extraction rules. .It b. Each occurrence of a character of .Va \&\&ifs will cause field-splitting, any adjacent .Va \&\&ifs-ws characters will be skipped. .El . .Mx .It Va ifs-ws \*(RO Automatically deduced from the whitespace characters in .Va ifs . . .Mx .It Va ignore \*(BO Ignore interrupt signals from the terminal while entering messages; instead echo them as .Ql @ characters and discard the current line. . .Mx .It Va ignoreeof \*(BO Ignore end-of-file conditions .Pf ( Ql control-D ) in .Sx "Compose mode" on message input and in interactive command input. If set an interactive command input session can only be left by explicitly using one of the commands .Ic exit and .Ic quit , and message input in compose mode can only be terminated by entering a period .Ql \&. on a line by itself or by using the .Ic ~. .Sx "COMMAND ESCAPES" ; Setting this implies the behaviour that .Va dot describes in .Va posix mode. . .Mx .It Va inbox If this is set to a non-empty string it will specify the user's .Mx -sx .Sx "primary system mailbox" , overriding .Ev MAIL and the system-dependent default, and (thus) be used to replace .Ql % when doing .Sx "Filename transformations" ; also see .Ic folder for more on this topic. The value supports a subset of transformations itself. .Mx .It Va indentprefix String used by the .Ic ~m , ~M and .Ic ~R .Sx "COMMAND ESCAPES" and by the .Va quote option for indenting messages, in place of the POSIX mandated default tabulator character .Ql \et . Also see .Va quote-chars . . .Mx .It Va keep \*(BO If set, an empty .Mx -sx .Sx "primary system mailbox" file is not removed. Note that, in conjunction with .Va posix mode any empty file will be removed unless this variable is set. This may improve the interoperability with other mail user agents when using a common folder directory, and prevents malicious users from creating fake mailboxes in a world-writable spool directory. \*(ID Only local regular (MBOX) files are covered, Maildir and other mailbox types will never be removed, even if empty. . .Mx .It Va keep-content-length \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can be told to keep the .Ql Content-Length: and .Ql Lines: header fields that some MUAs generate by setting this variable. Since \*(UA does neither use nor update these non-standardized header fields (which in itself shows one of their conceptual problems), stripping them should increase interoperability in between MUAs that work with with same mailbox files. Note that, if this is not set but .Va writebackedited , as below, is, a possibly performed automatic stripping of these header fields already marks the message as being modified. \*(ID At some future time \*(UA will be capable to rewrite and apply an .Va mime-encoding to modified messages, and then those fields will be stripped silently. . .Mx .It Va keepsave \*(BO When a message is saved it is usually discarded from the originating folder when \*(UA is quit. This setting causes all saved message to be retained. . .Mx .It Va line-editor-cpl-word-breaks \*(OP List of bytes which are used by the .Cd mle-complete tabulator completion to decide where word boundaries exist, by default .Ql """'@=;|: \*(ID This mechanism is yet restricted. . .Mx .It Va line-editor-disable \*(BO Turn off any line editing capabilities (from \*(UAs POW, see .Sx "On terminal control and line editor" for more). . .Mx .It Va line-editor-no-defaults \*(BO\*(OP Do not establish any default key binding. . .Mx .It Va log-prefix Error log message prefix string .Pf ( Ql "\*(uA: " ) . . .Mx .It Va mailbox-display \*(RO The name of the current mailbox .Pf ( Ic folder ) , possibly abbreviated for display purposes. . .Mx .It Va mailbox-resolved \*(RO The fully resolved path of the current mailbox. . .Mx .It Va mailcap-disable \*(BO\*(OP Turn off consideration of MIME type handlers from, and implicit loading of .Sx "The Mailcap files" . . .Mx .It Va mailx-extra-rc An additional startup file that is loaded as the last of the .Sx "Resource files" . Use this file for commands that are not understood by other POSIX .Xr mailx 1 implementations, i.e., mostly anything which is not covered by .Sx "Initial settings" . . .Mx .It Va markanswered \*(BO When a message is replied to and this variable is set, it is marked as having been .Ic answered . See the section .Sx "Message states" . . .Mx .It Va mbox-fcc-and-pcc \*(BO By default all file and pipe message receivers (see .Va expandaddr ) will be fed valid MBOX database entry message data (see .Ic folder , .Va mbox-rfc4155 ) , and existing file targets will become extended in compliance to RFC 4155. If this variable is unset then a plain standalone RFC 5322 message will be written, and existing file targets will be overwritten. . .Mx .It Va mbox-rfc4155 \*(BO When opening MBOX mailbox databases, and in order to achieve compatibility with old software, the very tolerant POSIX standard rules for detecting message boundaries (so-called .Ql From_ lines) are used instead of the stricter rules from the standard RFC 4155. This behaviour can be switched by setting this variable. .Pp This may temporarily be handy when \*(UA complains about invalid .Ql From_ lines when opening a MBOX: in this case setting this variable and re-opening the mailbox in question may correct the result. If so, copying the entire mailbox to some other file, as in .Ql copy * SOME-FILE , will perform proper, all-compatible .Ql From_ quoting for all detected messages, resulting in a valid MBOX mailbox. (\*(ID The better and non-destructive approach is to re-encode invalid messages, as if it would be created anew, instead of mangling the .Ql From_ lines; this requires the structural code changes of the v15 rewrite.) Finally the variable can be unset again: .Bd -literal -offset indent define mboxfix { localopts yes; wysh set mbox-rfc4155;\e wysh File "${1}"; copy * "${2}" } call mboxfix /tmp/bad.mbox /tmp/good.mbox .Ed . .Mx .It Va memdebug \*(BO Internal development variable. (Keeps memory debug enabled even if .Va debug is not set.) . .Mx .It Va message-id-disable \*(BO By setting this variable the generation of .Ql Message-ID: and .Ql Content-ID: message and MIME part headers can be completely suppressed, effectively leaving this task up to the .Va mta (Mail-Transfer-Agent) or the SMTP server. Note that according to RFC 5321 a SMTP server is not required to add this field by itself, so it should be ensured that it accepts messages without .Ql Message-ID . . .Mx .It Va message-inject-head A string to put at the beginning of each new message, followed by a newline. \*(OB The escape sequences tabulator .Ql \et and newline .Ql \en are understood (use the .Cm wysh prefix when .Ic set Ns ting the variable(s) instead). . .Mx .It Va message-inject-tail A string to put at the end of each new message, followed by a newline. \*(OB The escape sequences tabulator .Ql \et and newline .Ql \en are understood (use the .Cm wysh prefix when .Ic set Ns ting the variable(s) instead). Also see .Va on-compose-leave . . .Mx .It Va metoo \*(BO Usually, when an .Ic alias expansion contains the sender, the sender is removed from the expansion. Setting this option suppresses these removals. Note that a set .Va metoo also causes a .Ql -m option to be passed through to the .Va mta (Mail-Transfer-Agent); though most of the modern MTAs no longer document this flag, no MTA is known which does not support it (for historical compatibility). . .Mx .It Va mime-allow-text-controls \*(BO When sending messages, each part of the message is MIME-inspected in order to classify the .Ql Content-Type: and .Ql Content-Transfer-Encoding: (see .Va mime-encoding ) that is required to send this part over mail transport, i.e., a computation rather similar to what the .Xr file 1 command produces when used with the .Ql --mime option. .Pp This classification however treats text files which are encoded in UTF-16 (seen for HTML files) and similar character sets as binary octet-streams, forcefully changing any .Ql text/plain or .Ql text/html specification to .Ql application/octet-stream : If that actually happens a yet unset charset MIME parameter is set to .Ql binary , effectively making it impossible for the receiving MUA to automatically interpret the contents of the part. .Pp If this variable is set, and the data was unambiguously identified as text data at first glance (by a .Ql .txt or .Ql .html file extension), then the original .Ql Content-Type: will not be overwritten. . .Mx .It Va mime-alternative-favour-rich \*(BO If this variable is set then rich MIME alternative parts (e.g., HTML) will be preferred in favour of included plain text versions when displaying messages, provided that a handler exists which produces output that can be (re)integrated into \*(UA's normal visual display. . .Mx .It Va mime-counter-evidence Normally the .Ql Content-Type: field is used to decide how to handle MIME parts. Some MUAs, however, do not use .Sx "The mime.types files" (also see .Sx "HTML mail and MIME attachments" ) or a similar mechanism to correctly classify content, but specify an unspecific MIME type .Pf ( Ql application/octet-stream ) even for plain text attachments. If this variable is set then \*(UA will try to re-classify such MIME message parts, if possible, for example via a possibly existing attachment filename. A non-empty value may also be given, in which case a number is expected, actually a carrier of bits, best specified as a binary value, like .Ql 0b1111 . .Pp .Bl -bullet -compact .It If bit two is set (counting from 1, decimal 2) then the detected .Ic mimetype will be carried along with the message and be used for deciding which MIME handler is to be used, for example; when displaying such a MIME part the part-info will indicate the overridden content-type by showing a plus sign .Ql + . .It If bit three is set (decimal 4) then the counter-evidence is always produced and a positive result will be used as the MIME type, even forcefully overriding the parts given MIME type. .It If bit four is set (decimal 8) as a last resort the actual content of .Ql application/octet-stream parts will be inspected, so that data which looks like plain text can be treated as such. This mode is even more relaxed when data is to be displayed to the user or used as a message quote (data consumers which mangle data for display purposes, which includes masking of control characters, for example). .El . . .Mx .It Va mime-encoding The MIME .Ql Content-Transfer-Encoding to use in outgoing text messages and message parts, where applicable (7-bit clean text messages are without an encoding if possible): . .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql 8bit .Pf (Or\0 Ql 8b . ) 8-bit transport effectively causes the raw data be passed through unchanged, but may cause problems when transferring mail messages over channels that are not ESMTP (RFC 1869) compliant. Also, several input data constructs are not allowed by the specifications and may cause a different transfer-encoding to be used. By established rules and popular demand occurrences of .Ql ^From_ (see .Va mbox-rfc4155 ) will be MBOXO quoted (prefixed with greater-than sign .Ql > ) instead of causing a non-destructive encoding like .Ql quoted-printable to be chosen, unless context (like message signing) requires otherwise. . .It Ql quoted-printable .Pf (Or\0 Ql qp . ) Quoted-printable encoding is 7-bit clean and has the property that ASCII characters are passed through unchanged, so that an english message can be read as-is; it is also acceptable for other single-byte locales that share many characters with ASCII, for example ISO-8859-1. The encoding will cause a large overhead for messages in other character sets: for example it will require up to twelve (12) bytes to encode a single UTF-8 character of four (4) bytes. It is the default encoding. . .It Ql base64 .Pf (Or\0 Ql b64 . ) This encoding is 7-bit clean and will always be used for binary data. This encoding has a constant input:output ratio of 3:4, regardless of the character set of the input data it will encode three bytes of input to four bytes of output. This transfer-encoding is not human readable without performing a decoding step. .El . . .Mx .It Va mime-force-sendout \*(BO\*(OP Whenever it is not acceptable to fail sending out messages because of non-convertible character content this variable may be set. It will, as a last resort, classify the part content as .Ql application/octet-stream . Please refer to the section .Sx "Character sets" for the complete picture of character set conversion, and .Sx "HTML mail and MIME attachments" for how to internally or externally handle part content. . .Mx .It Va mimetypes-load-control Can be used to control which of .Sx "The mime.types files" are loaded: if the letter .Ql u is part of the option value, then the user's personal .Pa \*(vU file will be loaded (if it exists); likewise the letter .Ql s controls loading of the system wide .Pa \*(vS ; directives found in the user file take precedence, letter matching is case-insensitive. If this variable is not set \*(UA will try to load both files. Incorporation of the \*(UA-built-in MIME types cannot be suppressed, but they will be matched last (the order can be listed via .Ic mimetype ) . .Pp More sources can be specified by using a different syntax: if the value string contains an equals sign .Ql = then it is instead parsed as a comma-separated list of the described letters plus .Ql f=FILENAME pairs; the given filenames will be expanded and loaded, and their content may use the extended syntax that is described in the section .Sx "The mime.types files" . Directives found in such files always take precedence (are prepended to the MIME type cache). . . .Mx .It Va mta Select an alternate Mail-Transfer-Agent by either specifying the full pathname of an executable (a .Ql file:// prefix may be given), or \*(OPally a SMTP aka SUBMISSION protocol URL \*(IN: .Pp .Dl submissions://[user[:password]@]server[:port] .Pp (\*(OU: .Ql [smtp://]server[:port] . ) The default has been chosen at compile time. MTA data transfers are always performed in asynchronous child processes, and without supervision unless either the .Va sendwait or the .Va verbose variable is set. Also see .Va mta-bcc-ok . \*(OPally expansion of .Xr aliases 5 can be performed by setting .Va mta-aliases . . .Pp For testing purposes there is the .Ql test pseudo-MTA, which dumps to standard output or optionally to a file, and honours .Va mbox-fcc-and-pcc : . .Bd -literal -offset indent $ echo text | \*(uA -:/ -Smta=test -s ubject ex@am.ple $ "'; read es;\e vput csop es substring "${es}" 0 1 if "$es" != 2 echoerr 'Cannot insert Cc: header'; echo '~x' # (no xit, macro finishes anyway) endif endif } set on-compose-splice=ocsm .Ed . . .Mx .It Va on-history-addition This hook will be called if an entry is about to be added to the .Ic history of the MLE, as documented in .Sx "On terminal control and line editor" . It will be called with three arguments: the first is the name of the input context (see .Ic bind ) , the second is either an empty string or the matching .Va history-gabby type, and the third being the complete command line to be added. The entry will not be added to history if the hook uses a non-0 .Ic return . \*(ID A future version will give the expanded command name as the third argument, followed by the tokenized command line as parsed in the remaining arguments, the first of which is the original unexpanded command name; i.e., one may do .Ql Ic shift Ns \| 4 and will then be able to access the positional parameters as usual via .Va * , # , 1 etc. . .Mx .It Va on-main-loop-tick This hook will be called whenever the program's main event loop is about to read the next input line. Note variable and other changes it performs are not scoped as via .Ic localopts ! . .Mx .It Va on-program-exit This hook will be called when the program exits, whether via .Ic exit or .Ic quit , or because the send mode is done. .Sy Note: this runs late and so terminal settings etc. are already teared down. . .Mx .It Va on-resend-cleanup \*(ID Identical to .Va on-compose-cleanup , but is only triggered by .Ic resend . . .Mx .It Va on-resend-enter \*(ID Identical to .Va on-compose-enter , but is only triggered by .Ic resend ; currently there is no .Ic digmsg support, for example. . .Mx .It Va page \*(BO If set, each message feed through the command given for .Ic pipe is followed by a formfeed character .Ql \ef . . .Mx Va password .It Va password-USER@HOST , password-HOST , password \*(IN Variable chain that sets a password, which is used in case none has been given in the protocol and account-specific URL; as a last resort \*(UA will ask for a password on the user's terminal if the authentication method requires a password. Specifying passwords in a startup file is generally a security risk; the file should be readable by the invoking user only. . .It Va password-USER@HOST \*(OU (see the chain above for \*(IN) Set the password for .Ql USER when connecting to .Ql HOST . If no such variable is defined for a host, the user will be asked for a password on standard input. Specifying passwords in a startup file is generally a security risk; the file should be readable by the invoking user only. . .Mx .It Va piperaw \*(BO Send messages to the .Ic pipe command without performing MIME and character set conversions. . .Mx .It Va pipe-EXTENSION Identical to .Va pipe-TYPE/SUBTYPE except that .Ql EXTENSION (normalized to lowercase using character mappings of the ASCII charset) denotes a file extension, for example .Ql xhtml . Handlers registered using this method take precedence. . . .Mx .It Va pipe-TYPE/SUBTYPE A MIME message part identified as .Ql TYPE/SUBTYPE (case-insensitive, normalized to lowercase using character mappings of the ASCII charset) is displayed or quoted, its text is filtered through the value of this variable interpreted as a shell command. Unless noted only parts displayable as inline plain text (see .Cd copiousoutput ) are covered, other MIME parts will only be considered by and for .Ic mimeview . . .Pp The special value question mark .Ql \&? forces interpretation of the message part as plain text, for example .Ql set pipe-application/xml=? . (This can also be achieved by adding a MIME type-marker via .Ic mimetype . ) \*(OPally MIME type handlers may be defined via .Sx "The Mailcap files" to which should be referred to for documentation of flags like .Cd copiousoutput . Question mark is indeed a trigger character to indicate flags that adjust behaviour and usage of the rest of the value, the shell command, for example: . .Bd -literal -offset indent ? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}' .Ed . .Pp .Bl -tag -compact -width ".It Ql __" .It Ql * The command output can be reintegrated into this MUA's normal processing: .Cd copiousoutput . Implied when using a plain .Ql \& . . .It Ql # Only use this handler for display, not for quoting a message: .Cd x-mailx-noquote . . .It Ql & Run the command asynchronously, do not wait for the handler to exit: .Cd x-mailx-async . The standard output of the command will go to .Pa /dev/null . . .It Ql \&! The command must be run on an interactive terminal, the terminal will temporarily be released for it to run: .Cd needsterminal . . .It Ql + Request creation of a zero-sized temporary file, the absolute pathname of which will be made accessible via the environment variable .Ev MAILX_FILENAME_TEMPORARY : .Cd x-mailx-tmpfile . If given twice then the file will be unlinked automatically by \*(UA when the command loop is entered again at latest: .Cd x-mailx-tmpfile-unlink ; it is an error to use automatic deletion in conjunction with .Cd x-mailx-async . . .It Ql = Normally the MIME part content is passed to the handler via standard input; with this the data will instead be written into .Ev MAILX_FILENAME_TEMPORARY .Pf ( Cd x-mailx-tmpfile-fill ) , the creation of which is implied; in order to cause automatic deletion of the temporary file two plus signs .Ql ++ still have to be used. . .It Ql t Text type-marker: display this as normal plain text (for type-markers: .Sx "The mime.types files" ) . Identical to only giving plain .Ql \&? , implies .Cd copiousoutput . . .It Ql h \*(OP HTML type-marker: display via built-in HTML-to-text filter. Implies .Cd copiousoutput . . .It Ql \&? To avoid ambiguities with normal shell command content another question mark can be used to forcefully terminate interpretation of remaining characters. (Any character not in this list will have the same effect.) .El . .Pp Some information about the MIME part to be displayed is embedded into the environment of the shell command: . .Pp .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED" .Mx .It Ev MAILX_CONTENT The MIME content-type of the part, if known, the empty string otherwise. . .Mx .It Ev MAILX_CONTENT_EVIDENCE If .Va mime-counter-evidence includes the carry-around-bit (2), then this will be set to the detected MIME content-type; not only then identical to .Ev \&\&MAILX_CONTENT otherwise. . .Mx .It Ev MAILX_EXTERNAL_BODY_URL MIME parts of type .Ql message/external-body access-type=url will store the access URL in this variable, it is empty otherwise. URL targets should not be activated automatically, without supervision. . .Mx .It Ev MAILX_FILENAME The filename, if any is set, the empty string otherwise. . .Mx .It Ev MAILX_FILENAME_GENERATED A random string. . .Mx .It Ev MAILX_FILENAME_TEMPORARY If temporary file creation has been requested through the command prefix this variable will be set and contain the absolute pathname of the temporary file. .El . . .Mx Va pop3-auth .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth \*(OP\*(IN Variable chain that sets the POP3 authentication method. Supported are the default .Ql plain , \*(IN .Ql oauthbearer (see .Sx FAQ entry .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) , as well as \*(IN .Ql external and .Ql externanon for TLS secured connections which pass a client certificate via .Va tls-config-pairs . There may be the \*(OPal method \*(IN .Ql gssapi . .Ql externanon does not need any user credentials, .Ql external and .Ql gssapi need a .Va user , the remains also require a .Va password . .Ql externanon solely builds upon the credentials passed via a client certificate, and is usually the way to go since tested servers do not actually follow RFC 4422, and fail if additional credentials are actually passed. Unless .Va pop3-no-apop is set the .Ql plain method will \*(OPally be replaced with APOP if possible (see there). . .Mx Va pop3-bulk-load .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of the messages, and only requests the message bodies on user request. For the POP3 protocol this means that the message headers will be downloaded twice. If this variable is set then \*(UA will download only complete messages from the given POP3 server(s) instead. . .Mx Va pop3-keepalive .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive \*(OP POP3 servers close the connection after a period of inactivity; the standard requires this to be at least 10 minutes, but practical experience may vary. Setting this variable to a numeric value greater than .Ql 0 causes a .Ql NOOP command to be sent each value seconds if no other operation is performed. . .Mx Va pop3-no-apop .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop \*(BO\*(OP Unless this variable is set the MD5 based .Ql APOP authentication method will be used instead of a chosen .Ql plain .Va pop3-auth when connecting to a POP3 server that advertises support. The advantage of .Ql APOP is that only a single packet is sent for the user/password tuple. (Originally also that the password is not sent in clear text over the wire, but for one MD5 does not any longer offer sufficient security, and then today transport is almost ever TLS secured.) Note that .Va pop3-no-apop-HOST requires \*(IN. . .Mx Va pop3-use-starttls .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls \*(BO\*(OP Causes \*(UA to issue a .Ql STLS command to make an unencrypted POP3 session TLS encrypted. This functionality is not supported by all servers, and is not used if the session is already encrypted by the POP3S method. Note that .Va pop3-use-starttls-HOST requires \*(IN. . . .Mx .It Va posix \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA where that deviates from standardized behaviour. It is automatically squared with the environment variable .Ev POSIXLY_CORRECT , changing the one will adjust the other. The following behaviour is covered and enforced by this mechanism: . .Pp .Bl -bullet -compact .It In non-interactive mode, any error encountered while loading resource files during program startup will cause a program exit, whereas in interactive mode such errors will stop loading of the currently loaded (stack of) file(s, i.e., recursively). These exits can be circumvented on a per-command base by using .Cm ignerr , one of the .Sx "Command modifiers" , for each command which shall be allowed to fail. . .It .Ic alternates will replace the list of alternate addresses instead of appending to it. In addition alternates will only be honoured for any sort of message .Ic reply , and for aliases. . .It The variable inserting .Sx "COMMAND ESCAPES" .Ic ~A , .Ic ~a , .Ic ~I and .Ic ~i will expand embedded character sequences .Ql \et horizontal tabulator and .Ql \en line feed. \*(ID For compatibility reasons this step will always be performed. . .It Reading in messages via .Ic ~f .Pf ( Sx "COMMAND ESCAPES" ) will use the .Ql type not the .Ql forward .Ic headerpick selection. . .It Upon changing the active .Ic folder no summary of .Ic headers will be displayed even if .Va header is set. . .It Setting .Va ignoreeof implies the behaviour described by .Va dot . . .It The variable .Va keep is extended to cover any empty mailbox, not only empty .Mx -sx .Sx "primary system mailbox" Ns es: they will be removed when they are left in empty state otherwise. . .It Each command has an exit .Va \&? and error .Va \&! status that overwrites that of the last command. In POSIX mode the program exit status will signal failure regardless unless all messages were successfully sent out to the .Va mta ; also see .Va sendwait . .El . . .Mx .It Va print-alternatives \*(BO When a MIME message part of type .Ql multipart/alternative is displayed and it contains a subpart of type .Ql text/plain , other parts are normally discarded. Setting this variable causes all subparts to be displayed, just as if the surrounding part was of type .Ql multipart/mixed . . .Mx .It Va prompt The string used as a prompt in interactive mode. Whenever the variable is evaluated the value is treated as if specified within dollar-single-quotes (see .Sx "Shell-style argument quoting" ) . This (post-assignment, i.e., second) expansion can be used to embed status information, for example .Va \&? , .Va \&! , .Va account or .Va mailbox-display . .Pp In order to embed characters which should not be counted when calculating the visual width of the resulting string, enclose the characters of interest in a pair of reverse solidus escaped brackets: .Ql \e[\eE[0m\e] ; a slot for coloured prompts is also available with the \*(OPal command .Ic colour . Prompting may be prevented by setting this to the null string (aka\| .Ql set noprompt ) . . .Mx .It Va prompt2 This string is used for secondary prompts, but is otherwise identical to .Va prompt . The default is .Ql ..\0 . . .Mx .It Va quiet \*(BO Suppresses the printing of the version when first invoked. . .Mx .It Va quote If set messages processed by variants of .Ic followup and .Ic reply will start with the original message, lines of which prefixed by .Va indentprefix , taking into account .Va quote-chars and .Va quote-fold . No headers will be quoted when set without value or for .Ql noheading , for .Ql headers the .Ql type .Ic headerpick selection will be included in the quote, .Ql allbodies embeds the (body) contents of all MIME parts, and .Ql allheaders also includes all headers. The quoted message will be enclosed by the expansions of .Va quote-inject-head and .Va quote-inject-tail . Also see .Va quote-add-cc , .Va quote-as-attachment and .Ic ~Q , one of the .Sx "COMMAND ESCAPES" . . .Mx .It Va quote-add-cc \*(BO Whether senders of messages quoted via .Ic ~Q shall be made members of the carbon copies .Ql Cc: list. . .Mx .It Va quote-as-attachment \*(BO Add the original message in its entirety as a .Ql message/rfc822 MIME attachment when replying to a message. Note this works regardless of the setting of .Va quote . . .Mx .It Va quote-chars Can be set to a string consisting of non-whitespace ASCII characters which shall be treated as quotation leaders, the default being .Ql >|}: . . .Mx .It Va quote-fold \*(OP Can be set in addition to .Va indentprefix , and creates a more fancy quotation in that leading quotation characters .Pf ( Va quote-chars ) are compressed and overlong lines are folded. .Va \&\"e-fold can be set to either one, two or three (space separated) numeric values, which are interpreted as the maximum (goal) and the minimum line length, respectively, in a spirit rather equal to the .Xr fmt 1 program, but line- instead of paragraph-based. The third value is used as the maximum line length instead of the first if no better break point can be found; it is ignored unless it is larger than the minimum and smaller than the maximum. If not set explicitly the minimum will reflect the goal algorithmically. The goal cannot be smaller than the length of .Va indentprefix plus some additional pad; necessary adjustments take place silently. . . .Mx .Mx .It Va quote-inject-head , quote-inject-tail The strings to put before and after the text of a .Va quote Ns d message, if non-empty, and respectively. The former defaults to .Ql %f wrote:\en\en . Special format directives will be expanded if possible, and if so configured the output will be folded according to .Va quote-fold . Format specifiers in the given strings start with a percent sign .Ql % and expand values of the original message, unless noted otherwise. Note that names and addresses are not subject to the setting of .Va showto . Valid format specifiers are: . .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql %% A plain percent sign. .It Ql %a The address(es) of the sender(s). .It Ql %d The date found in the .Ql Date: header of the message when .Va datefield is set (the default), otherwise the date when the message was received. Formatting can be controlled by assigning a .Xr strftime 3 format string to .Va datefield (and .Va datefield-markout-older ) . .It Ql %f The full name(s) (name and address, as given) of the sender(s). .It Ql %i The .Ql Message-ID: . .It Ql %n The real name(s) of the sender(s) if there is one and .Va showname allows usage, the address(es) otherwise. .It Ql %r The senders real name(s) if there is one, the address(es) otherwise. .El . . .Mx .It Va r-option-implicit \*(BO Setting this option evaluates the contents of .Va from (or, if that contains multiple addresses, .Va sender ) and passes the results onto the used (file-based) MTA as described for the .Fl r option (empty argument case). . .Mx .It Va recipients-in-cc \*(BO When doing a .Ic reply , the original .Ql From: and .Ql To: as well as addressees which possibly came in via .Ql Reply-To: and .Ql Mail-Followup-To: are by default merged into the new .Ql To: . If this variable is set a sensitive algorithm tries to place in .Ql To: only the sender of the message being replied to, others are placed in .Ql Cc: . . .Mx .It Va record Unless this variable is defined, no copies of outgoing mail will be saved. If defined it gives the pathname, subject to the usual .Sx "Filename transformations" , of a folder where all new, replied-to or forwarded messages are saved: when saving to this folder fails the message is not sent, but instead .Va save Ns d to .Ev DEAD . The standard defines that relative (fully expanded) paths are to be interpreted relative to the current directory .Pf ( Ic cwd ) , to force interpretation relative to .Va folder .Va outfolder needs to be set in addition. . .Mx .It Va record-files \*(BO If this variable is set the meaning of .Va record will be extended to cover messages which target only file and pipe recipients (see .Va expandaddr ) . These address types will not appear in recipient lists unless .Va add-file-recipients is also set. . .Mx .It Va record-resent \*(BO If this variable is set the meaning of .Va record will be extended to also cover the .Ic resend and .Ic Resend commands. . .Mx .It Va reply-in-same-charset \*(BO If this variable is set \*(UA first tries to use the same character set of the original message for replies. If this fails, the mechanism described in .Sx "Character sets" is evaluated as usual. . .Mx .It Va reply-strings Can be set to a comma-separated list of (case-insensitive according to ASCII rules) strings which shall be recognized in addition to the built-in strings as .Ql Subject: reply message indicators \(en built-in are .Ql Re: , which is mandated by RFC 5322, as well as the german .Ql Aw: , .Ql Antw: , and the .Ql Wg: which often has been seen in the wild; I.e., the separating colon has to be specified explicitly. . .Mx .It Va reply-to A list of addresses to put into the .Ql Reply-To: field of the message header. Members of this list are handled as if they were in the .Ic alternates list. . .It Va replyto \*(OB Variant of .Va reply-to . . .Mx .It Va reply-to-honour Controls whether a .Ql Reply-To: header is honoured when replying to a message via .Ic reply or .Ic Lreply . This is a .Mx -sx .Sx quadoption ; if set without a value it defaults to .Dq yes . . .Mx .It Va reply-to-swap-in Standards like DKIM and (in conjunction with) DMARC caused many .Sx "Mailing lists" to use sender address rewriting in the style of .Ql Name via List , where the original sender address often being placed in .Ql Reply-To: . If this is set and a .Ql Reply-To: exists, and consists of only one addressee (!), then that is used in place of the pretended sender. This works independently from .Va reply-to-honour . The optional value, a comma-separated list of strings, offers more fine-grained control on when swapping shall be used; for now supported is .Va mlist , here swapping occurs if the sender is a mailing-list as defined by .Ic mlist . . .Mx .It Va rfc822-body-from_ \*(BO This variable can be used to force displaying a so-called .Ql From_ line for messages that are embedded into an envelope mail via the .Ql message/rfc822 MIME mechanism, for more visual convenience, also see .Va mbox-rfc4155 . . .Mx .It Va save \*(BO Enable saving of (partial) messages in .Ev DEAD upon interrupt or delivery error. . .Mx .It Va screen The number of lines that represents a .Dq screenful of lines, used in .Ic headers summary display, .Ic from .Ic search Ns ing, message .Ic top Ns line display and scrolling via .Ic z . If this variable is not set \*(UA falls back to a calculation based upon the detected terminal window size and the baud rate: the faster the terminal, the more will be shown. Overall screen dimensions and pager usage is influenced by the environment variables .Ev COLUMNS and .Ev LINES and the variable .Va crt . . .Mx .It Va searchheaders \*(BO Expand message list specifiers in the form .Ql /x:y to all messages containing the substring .Dq y in the header field .Ql x . The string search is case insensitive. . .Mx .It Va sendcharsets \*(OP A comma-separated list of character set names that can be used in outgoing internet mail. The value of the variable .Va charset-8bit is automatically appended to this list of character sets. If no character set conversion capabilities are compiled into \*(UA then the only supported charset is .Va ttycharset . Also see .Va sendcharsets-else-ttycharset and refer to the section .Sx "Character sets" for the complete picture of character set conversion in \*(UA. . .Mx .It Va sendcharsets-else-ttycharset \*(BO\*(OP If this variable is set, but .Va sendcharsets is not, then \*(UA acts as if .Va sendcharsets had been set to the value of the variable .Va ttycharset . In effect this combination passes through the message data in the character set of the current locale encoding: therefore mail message text will be (assumed to be) in ISO-8859-1 encoding when send from within a ISO-8859-1 locale, and in UTF-8 encoding when send from within an UTF-8 locale. .Pp The 8-bit fallback .Va charset-8bit never comes into play as .Va ttycharset is implicitly assumed to be 8-bit and capable to represent all files the user may specify (as is the case when no character set conversion support is available in \*(UA and the only supported character set is .Va ttycharset , see .Sx "Character sets" ) . This might be a problem for scripts which use the suggested .Ql LC_ALL=C setting, since in this case the character set is US-ASCII by definition, so that it is better to also override .Va ttycharset , then; and/or do something like the following in the resource file: .Bd -literal -offset indent # Avoid ASCII "propagates to 8-bit" when scripting \eif ! t && "$LC_ALL" != C && "$LC_CTYPE" != C \eset sendcharsets-else-ttycharset \eend .Ed . .Mx .It Va sender An address that is put into the .Ql Sender: field of outgoing messages, quoting RFC 5322: the mailbox of the agent responsible for the actual transmission of the message. This field should normally not be used unless the .Va from field contains more than one address, on which case it is required. \*(ID Please expect automatic management of the .Va from and .Va sender relationship. Dependent on the context this address is handled as if it were in the list of .Ic alternates . Also see .Fl r , .Va r-option-implicit . . .It Va sendmail \*(OB Predecessor of .Va mta . . .It Va sendmail-arguments \*(OB Predecessor of .Va mta-arguments . . .It Va sendmail-no-default-arguments \*(OB\*(BO Predecessor of .Va mta-no-default-arguments . . .It Va sendmail-progname \*(OB Predecessor of .Va mta-argv0 . . .Mx .It Va sendwait Sending messages to the chosen .Va mta or to command-pipe receivers (see .Sx "On sending mail, and non-interactive mode" ) will be performed asynchronously. This means that only startup errors of the respective program will be recognizable, but no delivery errors. Also, no guarantees can be made as to when the respective program will actually run, as well as to when they will have produced output. .Pp If this variable is set then child program exit is waited for, and its exit status code is used to decide about success. Remarks: in conflict with the POSIX standard this variable is built-in to be initially set. Another difference is that it can have a value, which is interpreted as a comma-separated list of case-insensitive strings naming specific subsystems for which synchronousness shall be ensured (only). Possible values are .Ql mta for .Va mta delivery, and .Ql pcc for command-pipe receivers. . .Mx .It Va showlast \*(BO This setting causes \*(UA to start at the last message instead of the first one when opening a mail folder, as well as with .Ic from and .Ic headers . . .Mx .It Va showname \*(BO Causes \*(UA to use the sender's real name instead of the plain address in the header field summary and in message specifications. . .Mx .It Va showto \*(BO Causes the recipient of the message to be shown in the header summary if the message was sent by the user. . .Mx .It Va Sign The value backing .Ic ~A , one of the .Sx "COMMAND ESCAPES" . Also see .Va message-inject-tail , .Va on-compose-leave and .Va on-compose-splice . . .Mx .It Va sign The value backing .Ic ~a , one of the .Sx "COMMAND ESCAPES" . Also see .Va message-inject-tail , .Va on-compose-leave and .Va on-compose-splice . . .Mx .It Va signature \*(OB Please use .Va on-compose-splice or .Va on-compose-splice-shell or .Va on-compose-leave and (if necessary) .Va message-inject-tail instead! . .Mx .It Va skipemptybody \*(BO If an outgoing message has an empty first or only message part, do not send, but discard it, successfully (also see the command line option .Fl E ) . . .Mx .Mx .It Va smime-ca-dir , smime-ca-file \*(OP Specify the location of trusted CA certificates in PEM (Privacy Enhanced Mail) for the purpose of verification of S/MIME signed messages. .Va tls-ca-dir documents the necessary preparation steps to use the former. The set of CA certificates which are built into the TLS library can be explicitly turned off by setting .Va smime-ca-no-defaults , and further fine-tuning is possible via .Va smime-ca-flags . . .Mx .It Va smime-ca-flags \*(OP Can be used to fine-tune behaviour of the X509 CA certificate storage, and the certificate verification that is used. The actual values and their meanings are documented for .Va tls-ca-flags . . .Mx .It Va smime-ca-no-defaults \*(BO\*(OP Do not load the default CA locations that are built into the used to TLS library to verify S/MIME signed messages. . .Mx Va smime-cipher .It Va smime-cipher-USER@HOST , smime-cipher \*(OP Specifies the cipher to use when generating S/MIME encrypted messages (for the specified account). RFC 5751 mandates a default of .Ql aes128 (AES-128 CBC). Possible values are (case-insensitive and) in decreasing cipher strength: .Ql aes256 (AES-256 CBC), .Ql aes192 (AES-192 CBC), .Ql aes128 (AES-128 CBC), .Ql des3 (DES EDE3 CBC, 168 bits; default if .Ql aes128 is not available) and .Ql des (DES CBC, 56 bits). .Pp The actually available cipher algorithms depend on the cryptographic library that \*(UA uses. \*(OP Support for more cipher algorithms may be available through dynamic loading via .Xr EVP_get_cipherbyname 3 (OpenSSL) if \*(UA has been compiled to support this. . .Mx .It Va smime-crl-dir \*(OP Specifies a directory that contains files with CRLs in PEM format to use when verifying S/MIME messages. . .Mx .It Va smime-crl-file \*(OP Specifies a file that contains a CRL in PEM format to use when verifying S/MIME messages. . .Mx .It Va smime-encrypt-USER@HOST \*(OP If this variable is set, messages send to the given receiver are encrypted before sending. The value of the variable must be set to the name of a file that contains a certificate in PEM format. .Pp If a message is sent to multiple recipients, each of them for whom a corresponding variable is set will receive an individually encrypted message; other recipients will continue to receive the message in plain text unless the .Va smime-force-encryption variable is set. It is recommended to sign encrypted messages, i.e., to also set the .Va smime-sign variable. .Va content-description-smime-message will be inspected for messages which become encrypted. . .Mx .It Va smime-force-encryption \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages. . .Mx .It Va smime-sign \*(BO\*(OP S/MIME sign outgoing messages with the user's .Pf ( Va from ) private key and include the users certificate as a MIME attachment. Signing a message enables a recipient to verify that the sender used a valid certificate, that the email addresses in the certificate match those in the message header and that the message content has not been altered. It does not change the message text, and people will be able to read the message as usual. .Va content-description-smime-signature will be inspected. Also see .Va smime-sign-cert , smime-sign-include-certs and .Va smime-sign-digest . . .Mx Va smime-sign-cert .It Va smime-sign-cert-USER@HOST , smime-sign-cert \*(OP Points to a file in PEM format. For the purpose of signing and decryption this file needs to contain the user's private key, followed by his certificate. .Pp For message signing .Ql USER@HOST is always derived from the value of .Va from (or, if that contains multiple addresses, .Va sender ) . For the purpose of encryption the recipients public encryption key (certificate) is expected; the command .Ic certsave can be used to save certificates of signed messages (the section .Sx "Signed and encrypted messages with S/MIME" gives some details). This mode of operation is usually driven by the specialized form. .Pp When decrypting messages the account is derived from the recipient fields .Pf ( Ql To: and .Ql Cc: ) of the message, which are searched for addresses for which such a variable is set. \*(UA always uses the first address that matches, so if the same message is sent to more than one of the user addresses using different encryption keys, decryption might fail. .Pp Password-encrypted keys may be used for signing and decryption. Automated password lookup is possible via the .Dq pseudo-hosts .Ql USER@HOST.smime-cert-key for the private key, and .Ql USER@HOST.smime-cert-cert for the certificate stored in the same file. For example, the hypothetical address .Ql bob@exam.ple could be driven with a private key / certificate pair path defined in .Va \&\&smime-sign-cert-bob@exam.ple , and the needed passwords would then be looked up as .Ql bob@exam.ple.smime-cert-key and .Ql bob@exam.ple.smime-cert-cert . When decrypting the value of .Va from will be tried as a fallback to provide the necessary .Ql USER@HOST . To include intermediate certificates, use .Va smime-sign-include-certs . The possible password sources are documented in .Sx "On URL syntax and credential lookup" . . .Mx Va smime-sign-digest .It Va smime-sign-digest-USER@HOST , smime-sign-digest \*(OP Specifies the message digest to use when signing S/MIME messages. Please remember that for this use case .Ql USER@HOST refers to the variable .Va from (or, if that contains multiple addresses, .Va sender ) . The available algorithms depend on the used cryptographic library, but at least one usable built-in algorithm is ensured as a default. If possible the standard RFC 5751 will be violated by using .Ql SHA512 instead of the mandated .Ql SHA1 due to security concerns. This variable is ignored for very old (released before 2010) cryptographic libraries which do not offer the necessary interface: it will be logged if that happened. .Pp \*(UA will try to add built-in support for the following message digests, names are case-insensitive: .Ql BLAKE2b512 , .Ql BLAKE2s256 , .Ql SHA3-512 , .Ql SHA3-384 , .Ql SHA3-256 , .Ql SHA3-224 , as well as the widely available .Ql SHA512 , .Ql SHA384 , .Ql SHA256 , .Ql SHA224 , and the proposed insecure .Ql SHA1 , finally .Ql MD5 . More digests may \*(OPally be available through dynamic loading via the OpenSSL function .Xr EVP_get_digestbyname 3 . . .Mx Va smime-sign-include-certs .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs \*(OP If used, this is supposed to a consist of a comma-separated list of files, each of which containing a single certificate in PEM format to be included in the S/MIME message in addition to the .Va smime-sign-cert certificate. This can be used to include intermediate certificates of the certificate authority, in order to allow the receiver's S/MIME implementation to perform a verification of the entire certificate chain, starting from a local root certificate, over the intermediate certificates, down to the .Va smime-sign-cert . Even though top level certificates may also be included in the chain, they will not be used for the verification on the receiver's side. .Pp For the purpose of the mechanisms involved here, .Ql USER@HOST refers to the content of the internal variable .Va from (or, if that contains multiple addresses, .Va sender ) . The pseudo-host .Ql USER@HOST.smime-include-certs will be used for performing password lookups for these certificates, shall they have been given one, therefore the lookup can be automated via the mechanisms described in .Sx "On URL syntax and credential lookup" . . .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest \*(OB\*(OP Predecessor(s) of .Va smime-sign-digest . . .It Va smtp \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in .Va mta . \*(ID For compatibility reasons a set .Va smtp is used in preference of .Va mta . . .Mx Va smtp-auth .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth \*(OP Variable chain that controls the SMTP .Va mta authentication method, possible values are .Ql none (\*(OU default), .Ql plain (\*(IN default), .Ql login , \*(IN .Ql oauthbearer (see .Sx FAQ entry .Sx "But, how about XOAUTH2 / OAUTHBEARER?" ) as well as \*(IN .Ql external and .Ql externanon for TLS secured connections which pass a client certificate via .Va tls-config-pairs . There may be the \*(OPal methods .Ql cram-md5 and .Ql gssapi . .Ql none and .Ql externanon do not need any user credentials, .Ql external and .Ql gssapi require a user name, and all other methods require a .Va user name and a .Va password . .Ql externanon solely builds upon the credentials passed via a client certificate, and is usually the way to go since tested servers do not actually follow RFC 4422 aka RFC 4954, and fail if additional credentials are passed. Also see .Va mta . Note that .Va smtp-auth-HOST is \*(IN. (\*(OU Requires .Va smtp-auth-password and .Va smtp-auth-user . Note for .Va smtp-auth-USER@HOST : may override dependent on sender address in the variable .Va from . ) . .It Va smtp-auth-password \*(OP\*(OU Sets the global fallback password for SMTP authentication. If the authentication method requires a password, but neither .Va smtp-auth-password nor a matching .Va smtp-auth-password-USER@HOST can be found, \*(UA will ask for a password on the user's terminal. . .It Va smtp-auth-password-USER@HOST \*(OU Overrides .Va smtp-auth-password for specific values of sender addresses, dependent upon the variable .Va from . . .It Va smtp-auth-user \*(OP\*(OU Sets the global fallback user name for SMTP authentication. If the authentication method requires a user name, but neither .Va smtp-auth-user nor a matching .Va smtp-auth-user-USER@HOST can be found, \*(UA will ask for a user name on the user's terminal. . .It Va smtp-auth-user-USER@HOST \*(OU Overrides .Va smtp-auth-user for specific values of sender addresses, dependent upon the variable .Va from . . .Mx .It Va smtp-hostname \*(OP\*(IN Normally \*(UA uses the variable .Va from to derive the necessary .Ql USER@HOST information in order to issue a .Ql MAIL FROM:<> SMTP .Va mta command. Setting .Va smtp-hostname can be used to use the .Ql USER from the SMTP account .Pf ( Va mta or the .Va user variable chain) and the given .Ql HOST .Pf ( Va hostname if the empty string is given, or the local hostname as a last resort). This often allows using an address that is itself valid but hosted by a provider other than from which (in .Va from ) the message is sent. Setting this variable also influences generated .Ql Message-ID: and .Ql Content-ID: header fields. If the \*(OPal IDNA support is available (see .Va idna-disable ) variable assignment is aborted when a necessary conversion fails. . .Mx Va smtp-use-starttls .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls \*(BO\*(OP Causes \*(UA to issue a .Ql STARTTLS command to make an SMTP .Va mta session TLS encrypted, i.e., to enable transport layer security. . .Mx .It Va socket-connect-timeout \*(OP A positive number that defines the timeout to wait for establishing a socket connection before forcing .Va ^ERR Ns -TIMEDOUT . . .Mx Va socks-proxy .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy \*(OP If set to the URL of a SOCKS5 server then all network activities are proxied through it, except for the single DNS name lookup necessary to resolve the proxy URL (unnecessary when given an already resolved IP address). It is automatically squared with the environment variable .Ev SOCKS5_PROXY , changing the one will adjust the other. This example creates a local SOCKS5 proxy on port 10000 that forwards to the machine .Ql HOST (with identity .Ql USER ) , and from which actual network traffic happens: .Bd -literal -offset indent $ ssh -D 10000 USER@HOST $ \*(uA -Ssocks-proxy=[socks5://]localhost:10000 # or =localhost:10000; no local DNS: =127.0.0.1:10000 .Ed . .Mx .It Va spam-interface \*(OP In order to use any of the spam-related commands (like .Ic spamrate ) the desired spam interface must be defined by setting this variable. Please refer to the manual section .Sx "Handling spam" for the complete picture of spam handling in \*(UA. All or none of the following interfaces may be available: . .Bl -tag -width ".It Ql _ilte_" .It Ql spamc Interaction with .Xr spamc 1 from the .Xr spamassassin 1 .Pf ( Lk http://spamassassin.apache.org SpamAssassin ) suite. Different to the generic filter interface \*(UA will automatically add the correct arguments for a given command and has the necessary knowledge to parse the program's output. A default value for .Va spamc-command will have been compiled into the \*(UA binary if .Xr spamc 1 has been found in .Ev PATH during compilation. Shall it be necessary to define a specific connection type (rather than using a configuration file for that), the variable .Va spamc-arguments can be used as in for example .Ql -d server.example.com -p 783 . It is also possible to specify a per-user configuration via .Va spamc-user . Note that this interface does not inspect the .Ql is-spam flag of a message for the command .Ic spamforget . . .It Ql filter generic spam filter support via freely configurable hooks. This interface is meant for programs like .Xr bogofilter 1 and requires according behaviour in respect to the hooks' exit status for at least the command .Ic spamrate .Pf ( Ql 0 meaning a message is spam, .Ql 1 for non-spam, .Ql 2 for unsure and any other return value indicating a hard error); since the hooks can include shell code snippets diverting behaviour can be intercepted as necessary. The hooks are .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \ spamfilter-rate and .Va spamfilter-spam ; the manual section .Sx "Handling spam" contains examples for some programs. The process environment of the hooks will have the variable .Ev MAILX_FILENAME_GENERATED set. Note that spam score support for .Ic spamrate is not supported unless the \*(OPtional regular expression support is available and the .Va spamfilter-rate-scanscore variable is set. .El . . .Mx .It Va spam-maxsize \*(OP Messages that exceed this size will not be passed through to the configured .Va spam-interface . If unset or 0, the default of 420000 bytes is used. . .Mx .It Va spamc-command \*(OP The path to the .Xr spamc 1 program for the .Ql spamc .Va spam-interface . Note that the path is not expanded, but used .Dq as is . A fallback path will have been compiled into the \*(UA binary if the executable had been found during compilation. . .Mx .It Va spamc-arguments \*(OP Even though \*(UA deals with most arguments for the .Ql spamc .Va spam-interface automatically, it may at least sometimes be desirable to specify connection-related ones via this variable, for example .Ql -d server.example.com -p 783 . . .Mx .It Va spamc-user \*(OP Specify a username for per-user configuration files for the .Ql spamc .Va spam-interface . If this is set to the empty string then \*(UA will use the name of the current .Va user . . .Mx .Mx .Mx .Mx .Mx .It Va spamfilter-ham , spamfilter-noham , \ spamfilter-nospam , spamfilter-rate , spamfilter-spam \*(OP Command and argument hooks for the .Ql filter .Va spam-interface . The manual section .Sx "Handling spam" contains examples for some programs. . .Mx .It Va spamfilter-rate-scanscore \*(OP Because of the generic nature of the .Ql filter .Va spam-interface spam scores are not supported for it by default, but if the \*(OPnal regular expression support is available then setting this variable can be used to overcome this restriction. It is interpreted as follows: first a number (digits) is parsed that must be followed by a semicolon .Ql \&; and an extended regular expression. Then the latter is used to parse the first output line of the .Va spamfilter-rate hook, and, in case the evaluation is successful, the group that has been specified via the number is interpreted as a floating point scan score. . .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\ ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file \*(OB\*(OP Predecessors of .Va tls-ca-file , .Va tls-ca-dir . . .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags \*(OB\*(OP Predecessor of .Va tls-ca-flags . . .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\ ssl-ca-no-defaults \*(OB\*(BO\*(OP Predecessor of .Va tls-ca-no-defaults . . .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert \*(OB\*(OP Please use the .Cd Certificate slot of .Va tls-config-pairs . . .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list \*(OB\*(OP Please use the .Cd CipherString slot of .Va tls-config-pairs . . .It Va ssl-config-file \*(OB\*(OP Predecessor of .Va tls-config-file . . .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\ ssl-config-module \*(OB\*(OP Predecessor of .Va tls-config-module . . .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs \*(OB\*(OP Predecessor of .Va tls-config-pairs . . .It Va ssl-crl-dir , ssl-crl-file \*(OB\*(OP Predecessors of .Va tls-crl-dir , .Va tls-crl-file . . .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves \*(OB\*(OP Please use the .Cd Curves slot of .Va tls-config-pairs . . .It Va ssl-features \*(OB\*(OP\*(RO Predecessor of .Va tls-features . . .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key \*(OB\*(OP Please use the .Cd PrivateKey slot of .Va tls-config-pairs . . .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method \*(OB\*(OP Please use the .Cd Protocol slot of .Va tls-config-pairs . . .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol \*(OB\*(OP Please use the .Cd Protocol slot of .Va tls-config-pairs . . .It Va ssl-rand-file \*(OB\*(OP Predecessor of .Va tls-rand-file . . .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify \*(OB\*(OP Predecessor of .Va tls-verify . . .Mx .It Va stealthmua If only set without an assigned value, then this setting inhibits the generation of the .Ql Message-ID: , .Ql Content-ID: and .Ql User-Agent: header fields that include obvious references to \*(UA. There are two pitfalls associated with this: First, the message id of outgoing messages is not known anymore. Second, an expert may still use the remaining information in the header to track down the originating mail user agent. If set to the value .Ql noagent , then the mentioned .Ql Message-ID: and .Ql Content-ID: suppression does not occur. . .Mx .It Va system-mailrc \*(RO The compiled in path of the system wide initialization file one of the .Sx "Resource files" : .Pa \*(UR . . . .Mx .It Va termcap (\*(OP) This specifies a comma-separated list of .Lb libterminfo and/or .Lb libtermcap capabilities (see .Sx "On terminal control and line editor" , escape commas with reverse solidus .Ql \e ) to be used to overwrite or define entries. .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. It will always be inspected, regardless of whether .Va features denotes termcap/terminfo library support via .Ql ,+termcap, . . .Pp String capabilities form .Ql cap=value pairs and are expected unless noted otherwise. Numerics have to be notated as .Ql cap#number where the number is expected in normal decimal notation. Finally, booleans do not have any value but indicate a true or false state simply by being defined or not; this indeed means that \*(UA does not support undefining an existing boolean. String capability values will undergo some expansions before use: for one notations like .Ql ^LETTER stand for .Ql control-LETTER , and for clarification purposes .Ql \eE can be used to specify .Ql escape (the control notation .Ql ^[ could lead to misreadings when a left bracket follows, which it does for the standard CSI sequence); finally three letter octal sequences, as in .Ql \e061 , are supported. To specify that a terminal supports 256-colours, and to define sequences that home the cursor and produce an audible bell, one might write: . .Bd -literal -offset indent ? set termcap='Co#256,home=\eE[H,bel=^G' .Ed . .Pp The following terminal capabilities are or may be meaningful for the operation of the built-in line editor or \*(UA in general: . .Pp .Bl -tag -compact -width ".It Cd yay" .It Cd am .Cd auto_right_margin : boolean which indicates if the right margin needs special treatment; the .Cd xenl capability is related, for more see .Ev COLUMNS . This capability is only used when backed by library support. . .It Cd clear Ns \0or Cd cl .Cd clear_screen : clear the screen and home cursor. (Will be simulated via .Cd ho plus .Cd cd . ) . .\" mx_HAVE_COLOUR .It Cd colors Ns \0or Cd Co .Cd max_colors : numeric capability specifying the maximum number of colours. Note that \*(UA does not actually care about the terminal beside that, but always emits ANSI / ISO 6429 escape sequences; also see .Ic colour . . .It Cd cr .Cd carriage_return : move to the first column in the current row. The default built-in fallback is .Ql \er . . .It Cd cub1 Ns \0or Cd le .Cd cursor_left : move the cursor left one space (non-destructively). The default built-in fallback is .Ql \eb . . .It Cd cuf1 Ns \0or Cd nd .Cd cursor_right : move the cursor right one space (non-destructively). The default built-in fallback is .Ql \eE[C , which is used by most terminals. Less often occur .Ql \eEC and .Ql \eEOC . . .It Cd ed Ns \0or Cd cd .Cd clr_eos : clear the screen. . .\" mx_HAVE_MLE .It Cd el Ns \0or Cd ce .Cd clr_eol : clear to the end of line. (Will be simulated via .Cd ch plus repetitions of space characters.) . .It Cd home Ns \0or Cd ho .Cd cursor_home : home cursor. . .It Cd hpa Ns \0or Cd ch .Cd column_address : move the cursor (to the given column parameter) in the current row. (Will be simulated via .Cd cr plus .Cd nd . ) . .\" mx_HAVE_TERMCAP .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti .Cd exit_ca_mode and .Cd enter_ca_mode , respectively: exit and enter the alternative screen ca-mode, effectively turning \*(UA into a fullscreen application. This must be enabled explicitly by setting .Va termcap-ca-mode . . .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke .Cd keypad_xmit and .Cd keypad_local , respectively: enable and disable the keypad. This is always enabled if available, because it seems even keyboards without keypads generate other key codes for, e.g., cursor keys in that case, and only if enabled we see the codes that we are interested in. . .It Cd xenl Ns \0or Cd xn .Cd eat_newline_glitch : boolean which indicates whether a newline written in the last column of an .Cd auto_right_margin indicating terminal is ignored. With it the full terminal width is available even on autowrap terminals. This will be inspected even without .Ql ,+termcap, .Va features . .El . .Pp Many more capabilities which describe key-sequences are documented for .Ic bind . . . .Mx .It Va termcap-ca-mode \*(OP Allow usage of the .Cd exit_ca_mode and .Cd enter_ca_mode .Va termcap Ns abilities in order to enter an alternative exclusive screen, the so-called ca-mode; this usually requires special configuration of the .Ev PAGER , also dependent on the value of .Va crt . .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. . .Mx .It Va termcap-disable \*(OP Disable any interaction with a terminal control library. If set only some generic fallback built-ins and possibly the content of .Va termcap describe the terminal to \*(UA. .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. . .Mx Va tls-ca-file .Mx Va tls-ca-dir .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\ tls-ca-file-USER@HOST , tls-ca-file-HOST , tls-ca-file \*(OP Directory and file, respectively, for pools of trusted CA certificates in PEM (Privacy Enhanced Mail) format, for the purpose of verification of TLS server certificates. Concurrent use is possible, the file is loaded once needed first, the directory lookup is performed anew as a last resort whenever necessary. The CA certificate pool built into the TLS library can be disabled via .Va tls-ca-no-defaults , further fine-tuning is possible via .Va tls-ca-flags . The directory search requires special filename conventions, please see .Xr SSL_CTX_load_verify_locations 3 and .Xr verify 1 (or .Xr c_rehash 1 ) . . . .Mx Va tls-ca-flags .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags \*(OP Can be used to fine-tune behaviour of the X509 CA certificate storage, and the certificate verification that is used (also see .Va tls-verify ) . The value is expected to consist of a comma-separated list of configuration directives, with any intervening whitespace being ignored. The directives directly map to flags that can be passed to .Xr X509_STORE_set_flags 3 , which are usually defined in a file .Pa openssl/x509_vfy.h , and the availability of which depends on the used TLS library version: a directive without mapping is ignored (error log subject to .Va debug ) . Directives currently understood (case-insensitively) include: . .Pp .Bl -tag -compact -width ".It Cd BaNg" .It Cd no-alt-chains If the initial chain is not trusted, do not attempt to build an alternative chain. Setting this flag will make OpenSSL certificate verification match that of older OpenSSL versions, before automatic building and checking of alternative chains has been implemented; also see .Cd trusted-first . .It Cd no-check-time Do not check certificate/CRL validity against current time. .It Cd partial-chain By default partial, incomplete chains which cannot be verified up to the chain top, a self-signed root certificate, will not verify. With this flag set, a chain succeeds to verify if at least one signing certificate of the chain is in any of the configured trusted stores of CA certificates. The OpenSSL manual page .Xr SSL_CTX_load_verify_locations 3 gives some advise how to manage your own trusted store of CA certificates. .It Cd strict Disable workarounds for broken certificates. .It Cd trusted-first Try building a chain using issuers in the trusted store first to avoid problems with server-sent legacy intermediate certificates. Newer versions of OpenSSL support alternative chain checking and enable it by default, resulting in the same behaviour; also see .Cd no-alt-chains . .El . . .Mx Va tls-ca-no-defaults .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\ tls-ca-no-defaults \*(BO\*(OP Do not load the default CA locations that are built into the used to TLS library to verify TLS server certificates. . .Mx .It Va tls-config-file \*(OP If this variable is set .Xr CONF_modules_load_file 3 (if announced via .Ql ,+modules-load-file, in .Va tls-features ) is used to allow resource file based configuration of the TLS library. This happens once the library is used first, which may also be early during startup (logged with .Va verbose ) ! If a non-empty value is given then the given file, after performing .Sx "Filename transformations" , will be used instead of the TLS libraries global default, and it is an error if the file cannot be loaded. The application name will always be passed as .Ql \*(uA . Some TLS libraries support application-specific configuration via resource files loaded like this, please see .Va tls-config-module . . .Mx Va tls-config-module .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\ tls-config-module \*(OP If file based application-specific configuration via .Va tls-config-file is available, announced as .Ql ,+ctx-config, by .Va tls-features , indicating availability of .Xr SSL_CTX_config 3 , then, it becomes possible to use a central TLS configuration file for all programs, including \*(uA, for example .Bd -literal -offset indent # Register a configuration section for \*(uA \*(uA = mailx_master # The top configuration section creates a relation # in between dynamic SSL configuration and an actual # program specific configuration section [mailx_master] ssl_conf = mailx_tls_config # And that program specific configuration section now # can map diverse tls-config-module names to sections, # as in: tls-config-module=account_xy [mailx_tls_config] account_xy = mailx_account_xy account_yz = mailx_account_yz [mailx_account_xy] MinProtocol = TLSv1.2 Curves=P-521 [mailx_account_yz] CipherString = TLSv1.2:!aNULL:!eNULL: MinProtocol = TLSv1.1 Options = Bugs .Ed . . .Mx Va tls-config-pairs .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs \*(OP The value of this variable chain will be interpreted as a comma-separated list of directive/value pairs. Directives and values need to be separated by equals signs .Ql = , any whitespace surrounding pair members is removed. Keys are (usually) case-insensitive. Different to when placing these pairs in a .Va tls-config-module section of a .Va tls-config-file , commas .Ql \&, need to be escaped with a reverse solidus .Ql \e when included in pairs; also different: if the equals sign .Ql = is preceded with an asterisk .Ql * .Sx "Filename transformations" will be performed on the value; it is an error if these fail. Unless proper support is announced by .Va tls-features .Pf ( Ql ,+conf-ctx, ) only the keys below are supported, otherwise the pairs will be used directly as arguments to the function .Xr SSL_CONF_cmd 3 . . .Pp .Bl -tag -compact -width ".It Cd C_rtificate_" .It Cd Certificate Filename of a TLS client certificate (chain) required by some servers. Fallback support via .Xr SSL_CTX_use_certificate_chain_file 3 . .Sx "Filename transformations" are performed. .Cd PrivateKey will be set to the same value if not initialized explicitly. Some services support so-called .Ql external authentication if a TLS client certificate was successfully presented during connection establishment .Pf ( Dq connecting is authenticating ) . . .It Cd CipherString A list of ciphers for TLS connections, see .Xr ciphers 1 . By default no list of ciphers is set, resulting in a .Cd Protocol Ns - Ns specific list of ciphers (the protocol standards define lists of acceptable ciphers; possibly cramped by the used TLS library). Fallback support via .Xr SSL_CTX_set_cipher_list 3 . . .It Cd Ciphersuites A list of ciphers used for TLSv1.3 connections, see .Xr ciphers 1 . These will be joined onto the list of ciphers from .Cd CipherString . Available if .Va tls-features announces .Ql ,+ctx-set-ciphersuites, , as necessary via .Xr SSL_CTX_set_ciphersuites 3 . . .It Cd Curves A list of supported elliptic curves, if applicable. By default no curves are set. Fallback support via .Xr SSL_CTX_set1_curves_list 3 , if available. . .It Cd MaxProtocol , MinProtocol The maximum and minimum supported TLS versions, respectively. Available if .Va tls-features announces .Ql ,+ctx-set-maxmin-proto, , as necessary via .Xr SSL_CTX_set_max_proto_version 3 and .Xr SSL_CTX_set_min_proto_version 3 ; these fallbacks use an internal parser which understands the strings .Ql SSLv3 , .Ql TLSv1 , .Ql TLSv1.1 , .Ql TLSv1.2 , .Ql TLSv1.3 , and the special value .Ql None , which disables the given limit. . .It Cd Options Various flags to set. Fallback via .Xr SSL_CTX_set_options 3 , in which case any other value but (exactly) .Ql Bugs results in an error. . .It Cd PrivateKey Filename of the private key in PEM format of a TLS client certificate. If unset, the value of .Cd Certificate is used. .Sx "Filename transformations" are performed. Fallback via .Xr SSL_CTX_use_PrivateKey_file 3 . . .It Cd Protocol The used TLS protocol. If .Va tls-features announces .Ql ,+conf-ctx, or .Ql ctx-set-maxmin-proto then using .Cd MaxProtocol and .Cd MinProtocol is preferable. Fallback is .Xr SSL_CTX_set_options 3 , driven via an internal parser which understands the strings .Ql SSLv3 , .Ql TLSv1 , .Ql TLSv1.1 , .Ql TLSv1.2 , .Ql TLSv1.3 , and the special value .Ql ALL . Multiple protocols may be given as a comma-separated list, any whitespace is ignored, an optional plus sign .Ql + prefix enables, a hyphen-minus .Ql - prefix disables a protocol, so that .Ql -ALL, TLSv1.2 enables only the TLSv1.2 protocol. .El . . .Mx .Mx .It Va tls-crl-dir , tls-crl-file \*(OP Specify a directory / a file, respectively, that contains a CRL in PEM format to use when verifying TLS server certificates. . .Mx .It Va tls-features \*(OP\*(RO This expands to a comma-separated list of the TLS library identity and optional features. To ease substring matching the string starts and ends with a comma. Currently supported identities are .Ql libressl (LibreSSL) , .Ql libssl-0x30000 (OpenSSL v3.0.0 series), .Ql libssl-0x10100 (OpenSSL v1.1.x series) and .Ql libssl-0x10000 (elder OpenSSL series, other clones). Optional features are preceded with a plus sign .Ql + when available, and with a hyphen-minus .Ql - otherwise. .Pp Currently known features are .Ql conf-ctx .Pf ( Va tls-config-pairs ) , .Ql ctx-config .Pf ( Va tls-config-module ) , .Ql ctx-set-ciphersuites .Pf ( Cd Ciphersuites slot of .Va tls-config-pairs ) , .Ql ctx-set-maxmin-proto .Pf ( Va tls-config-pairs ) , .Ql modules-load-file .Pf ( Va tls-config-file ) , and .Ql tls-rand-file .Pf ( Va tls-rand-file ) . . .Mx Va tls-fingerprint .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint \*(OP It is possible to replace the verification of the connection peer certificate against the entire local pool of CAs (for more see .Sx "Encrypted network communication" ) with the comparison against a precalculated certificate message digest, the so-called fingerprint, to be specified as the used .Va tls-fingerprint-digest . This fingerprint can for example be calculated with .Ql Ic tls Ns \:\0\:fingerprint HOST . . .Mx Va tls-fingerprint-digest .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \ tls-fingerprint-digest \*(OP The message digest to be used when creating TLS certificate fingerprints, the defaults, if available, in test order, being .Ql BLAKE2s256 , .Ql SHA256 . For the complete list of digest algorithms refer to .Va smime-sign-digest . . .Mx .It Va tls-rand-file \*(OP If .Va tls-features announces .Ql ,+tls-rand-file, then this will be queried to find a file with random entropy data which can be used to seed the P(seudo)R(andom)N(umber)G(enerator), see .Xr RAND_load_file 3 . The default filename .Pf ( Xr RAND_file_name 3 , normally .Pa ~/.rnd ) will be used if this variable is not set or empty, or if the .Sx "Filename transformations" fail. Shall seeding the PRNG have been successful, .Xr RAND_write_file 3 will be called to update the entropy. Remarks: libraries which do not announce this feature seed the PRNG by other means. . .Mx Va tls-verify .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify \*(OP Variable chain that sets the action to be performed if an error occurs during TLS server certificate validation against the specified or default trust stores .Va tls-ca-dir , .Va tls-ca-file , or the TLS library built-in defaults (unless usage disallowed via .Va tls-ca-no-defaults ) , and as fine-tuned via .Va tls-ca-flags . Valid (case-insensitive) values are .Ql strict (fail and close connection immediately), .Ql ask (ask whether to continue on standard input), .Ql warn (show a warning and continue), .Ql ignore (do not perform validation). The default is .Ql ask . .Mx .It Va toplines If defined, gives the number of lines of a message to be displayed with the command .Ic top ; if unset, the first five lines are printed, if set to 0 the variable .Va screen is inspected. If the value is negative then its absolute value will be used for unsigned right shifting (see .Ic vexpr ) the .Va screen height. . .Mx .It Va topsqueeze \*(BO If set then the .Ic top command series will strip adjacent empty lines and quotations. . .Mx .It Va ttycharset The character set of the terminal \*(UA operates on, and the one and only supported character set that \*(UA can use if no character set conversion capabilities have been compiled into it, in which case it defaults to ISO-8859-1. Otherwise it defaults to UTF-8. Sufficient locale support provided the default will be preferably deduced from the locale environment if that is set (for example .Ev LC_CTYPE , see there for more); runtime locale changes will be reflected by .Va \&\&ttycharset except during the program startup phase and if .Fl S had been used to freeze the given value. Refer to the section .Sx "Character sets" for the complete picture about character sets. . .Mx .It Va typescript-mode \*(BO A special multiplex variable that disables all variables and settings which result in behaviour that interferes with running \*(UA in .Xr script 1 ; it sets .Va colour-disable , .Va line-editor-disable and (before startup completed only) .Va termcap-disable . Unsetting it does not restore the former state of the covered settings. . .Mx .It Va umask For a safe-by-default policy the process file mode creation mask .Xr umask 2 will be set to .Ql 0077 on program startup after the resource files have been loaded, and unless this variable is set. By assigning this an empty value the active setting will not be changed, otherwise the given value will be made the new file mode creation mask. Child processes inherit the file mode creation mask of their parent. . .Mx Va user .It Va user-HOST , user \*(IN Variable chain that sets a global fallback user name, used in case none has been given in the protocol and account-specific URL. This variable defaults to the name of the user who runs \*(UA. . .Mx .It Va v15-compat Enable upward compatibility with \*(UA version 15.0 in respect to which configuration options are available and how they are handled. If set to a non-empty value the command modifier .Cm wysh is implied and thus enforces .Sx "Shell-style argument quoting" over .Sx "Old-style argument quoting" for all commands which support both. This manual uses \*(IN and \*(OU to refer to the new and the old way of doing things, respectively. . .Mx .It Va verbose Verbose mode enables logging of informational context messages. Historically a \*(BO variable, this can either be set multiple times (what the command line option .Fl v uses), or be assigned a numeric value in order to increase verbosity. Assigning the value 0 disables verbosity and thus (almost) equals .Ic unset . The maximum number is 3. Also see .Va debug . . .Mx .Mx .Mx .Mx .Mx .Mx .It Va version , version-date , \ version-hexnum , version-major , version-minor , version-update \*(RO \*(UA version information: the first variable is a string with the complete version identification, the second the release date in ISO 8601 notation without time. The third is a 32-bit hexadecimal number with the upper 8 bits storing the major, followed by the minor and update version numbers which occupy 12 bits each. The latter three variables contain only decimal digits: the major, minor and update version numbers. The output of the command .Ic version will include this information. . .Mx .It Va writebackedited If this variable is set messages modified using the .Ic edit or .Ic visual commands are written back to the current folder when it is quit; it is only honoured for writable folders in MBOX format, though. Note that the editor will be pointed to the raw message content in that case, i.e., neither MIME decoding nor decryption will have been performed, and proper .Va mbox-rfc4155 .Ql From_ quoting of newly added or edited content is also left as an exercise to the user. .El .\" }}} (Variables) . .\" }}} (INTERNAL VARIABLES) . . .\" .Sh ENVIRONMENT {{{ .Sh ENVIRONMENT . The term .Dq environment variable should be considered an indication that these variables are either standardized as vivid parts of process environments, or that they are commonly found in there. The process environment is inherited from the .Xr sh 1 once \*(UA is started, and unless otherwise explicitly noted handling of the following variables transparently integrates into that of the .Sx "INTERNAL VARIABLES" from \*(UA's point of view. This means they can be managed via .Ic set and .Ic unset , causing automatic program environment updates (to be inherited by newly created child processes). . .Pp In order to integrate other environment variables equally they need to be imported (linked) with the command .Ic environ . This command can also be used to set and unset non-integrated environment variables from scratch, sufficient system support provided. The following example, applicable to a POSIX shell, sets the .Ev COLUMNS environment variable for \*(UA only, and beforehand exports the .Ev EDITOR in order to affect any further processing in the running shell: . .Bd -literal -offset indent $ EDITOR="vim -u ${HOME}/.vimrc" $ export EDITOR $ COLUMNS=80 \*(uA -R .Ed . .Bl -tag -width ".It Ev BaNg" .Mx .It Ev COLUMNS The user's preferred width in column positions for the terminal screen. Queried and used once on program startup in interactive or batch .Pf ( Fl \&# ) mode, actively managed for child processes and the MLE (see .Sx "On terminal control and line editor" ) in interactive mode thereafter. Non-interactive mode always uses, and the fallback default is a compile-time constant, by default 80 columns. If in batch mode .Ev \&\&COLUMNS and .Ev LINES are both set but not both are usable (empty, not a number, or 0) at program startup, then the real terminal screen size will be (tried to be) determined once. (Normally the .Xr sh 1 manages these variables, and unsets them for pipe specifications etc.) . .Mx .It Ev DEAD The name of the (mailbox) .Ic folder to use for saving aborted messages if .Va save is set; this defaults to .Pa \*(VD . If the variable .Va debug is set no output will be generated, otherwise the contents of the file will be replaced. Except shell globs .Sx "Filename transformations" (also see .Ic folder ) will be performed. . .Mx .It Ev EDITOR Pathname of the text editor to use for the .Ic edit command and .Ic ~e .Pf (see\0 Sx "COMMAND ESCAPES" ) ; .Ev VISUAL is used for a more display oriented editor. . .Mx .It Ev HOME The user's home directory. This variable is only used when it resides in the process environment. The calling user's home directory will be used instead if this directory does not exist, is not accessible or cannot be read; it will always be used for the root user. (No test for being writable is performed to allow usage by non-privileged users within read-only jails, but dependent on settings this directory is a default write target for, for example, .Ev DEAD , .Ev MBOX and more.) . .Mx .Mx .Mx .It Ev LC_ALL , LC_CTYPE , LANG \*(OP The (names in lookup order of the) .Xr locale 7 (and / or see .Xr setlocale 3 ) which indicates the used .Sx "Character sets" . Runtime changes trigger automatic updates of the entire locale system, which includes updating .Va ttycharset (except during startup if the variable has been frozen via .Fl S ) . . .Mx .It Ev LINES The user's preferred number of lines for the terminal screen. The behaviour is as described for .Ev COLUMNS , yet the compile-time constant used in non-interactive mode and as a fallback defaults to 24 (lines). . .Mx .It Ev LISTER Pathname of the directory lister to use in the .Ic folders command when operating on local mailboxes. Default is .Xr ls 1 (path search through .Ev SHELL ) . . .Mx .It Ev LOGNAME Upon startup \*(UA will actively ensure that this variable refers to the name of the user who runs \*(UA, in order to be able to pass a verified name to any newly created child process. . .Mx .It Ev MAIL Is used as the user's .Mx -sx .Sx "primary system mailbox" unless .Va inbox is set. If the environmental fallback is also not set, a built-in compile-time default is used. This is assumed to be an absolute pathname. . .Mx .It Ev MAILCAPS \*(OP Override the default path search of .Sx "The Mailcap files" : any existing file therein will be loaded in sequence, appending any content to the list of MIME type handler directives. The RFC 1524 standard imposed default value is assigned otherwise: .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap . (The default value is a compile-time \*(OP.) . .Mx .It Ev MAILRC Is used as a startup file instead of .Pa \*(ur if set. In order to avoid side-effects from configuration files scripts should either set this variable to .Pa /dev/null or the .Fl \&: command line option should be used. . .Mx .It Ev MAILX_NO_SYSTEM_RC If this variable is set then reading of .Pa \*(UR (aka\& .Va system-mailrc ) at startup is inhibited, i.e., the same effect is achieved as if \*(UA had been started up with the option .Fl \&: (and according argument) or .Fl n . This variable is only used when it resides in the process environment. . .Mx .It Ev MBOX The name of the user's .Mx -sx .Sx "secondary mailbox" file. A logical subset of the special .Sx "Filename transformations" (also see .Ic folder ) are supported. The default is .Pa \*(VM . Traditionally this MBOX is used as the file to save messages from the .Mx -sx .Sx "primary system mailbox" that have been read. Also see .Sx "Message states" . . .Mx .It Ev NETRC \*(IN\*(OP This variable overrides the default location of the user's .Pa \*(VN file. . .Mx .It Ev PAGER Pathname of the program to use for backing the command .Ic more , and when the .Va crt variable enforces usage of a pager for output. The default paginator is .Xr more 1 (path search through .Ev SHELL ) . .Pp \*(UA inspects the contents of this variable: if its contains the string .Dq less then a non-existing environment variable .Ev LESS will be set to (the portable) .Ql RI , likewise for .Dq lv .Ev LV will optionally be set to .Ql -c . Also see .Va colour-pager . . .Mx .It Ev PATH A colon-separated list of directories that is searched by the shell when looking for commands, for example .Ql /bin:/usr/bin:/usr/local/bin . . .Mx .It Ev POSIXLY_CORRECT This environment entry is automatically squared with .Va posix . . .Mx .It Ev SHELL The shell to use for the commands .Ic \&! , .Ic shell , the .Ic ~! .Sx "COMMAND ESCAPES" and when starting subprocesses. A default shell is used if this environment variable is not defined. . .Mx .It Ev SOCKS5_PROXY This environment entry is automatically squared with .Va socks-proxy . . .Mx .It Ev SOURCE_DATE_EPOCH Specifies a time in seconds since the Unix epoch (1970-01-01) to be used in place of the current time. This variable is looked up upon program startup, and its existence will switch \*(UA to a reproducible mode .Pf ( Lk https://reproducible-builds.org ) which uses deterministic random numbers, a special fixated pseudo .Ev LOGNAME and more. This operation mode is used for development and by software packagers. \*(ID Currently an invalid setting is only ignored, rather than causing a program abortion. .Pp .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA . .Mx .It Ev TERM \*(OP The terminal type for which output is to be prepared. For extended colour and font control please refer to .Sx "Coloured display" , and for terminal management in general to .Sx "On terminal control and line editor" . . .Mx .It Ev TMPDIR Except for the root user this variable defines the directory for temporary files to be used instead of .Pa \*(VT (or the given compile-time constant) if set, existent, accessible as well as read- and writable. This variable is only used when it resides in the process environment, but \*(UA will ensure at startup that this environment variable is updated to contain a usable temporary directory. . .Mx .It Ev USER Identical to .Ev LOGNAME (see there), but this variable is not standardized, should therefore not be used, and is only corrected if already set. . .Mx .It Ev VISUAL Pathname of the text editor to use for the .Ic visual command and .Ic ~v .Pf (see\0 Sx "COMMAND ESCAPES" ) ; .Ev EDITOR is used for a less display oriented editor. .El . .\" }}} . . .\" .Sh FILES {{{ .Sh FILES . .\" file list {{{ .Bl -tag -width ".It Pa BaNg" .Mx .Mx .It Pa ~/.mailcap , /etc/mailcap \*(OP Personal and system-wide MIME type handler definition files, see .Sx "The Mailcap files" . (The shown names are part of the RFC 1524 standard search path .Ev MAILCAPS . ) . .It Pa \*(ur , \*(UR User-specific and system-wide files giving initial commands, the .Sx "Resource files" . (The used filenames come from .Va MAILRC and .Va system-mailrc , respectively.) . .Mx .It Pa \*(VM The default value for .Ev MBOX . . .Mx .Mx .It Pa \*(vU , \*(vS Personal and system-wide MIME types, see .Sx "The mime.types files" . . .Mx .It Pa \*(VN \*(IN\*(OP The default location of the user's .Pa .netrc file \(en the section .Sx "The .netrc file" documents the file format. The used path can be set via .Ev NETRC . . .Mx .It Pa /dev/null The data sink .Xr null 4 . . .Mx .It Pa ~/.rnd \*(OP Possible location for persistent random entropy seed storage, see .Va tls-rand-file . .El .\" }}} . .\" .Ss "Resource files" {{{ .Ss "Resource files" . Upon startup \*(UA reads in several resource files, in order: . .Bl -tag -width ".It Pa BaNg" .Mx .It Pa \*(UR System wide initialization file .Pf ( Va system-mailrc ) . Reading of this file can be suppressed, either by using the .Fl \&: (and according argument) or .Fl n command line options, or by setting the .Sx ENVIRONMENT variable .Ev MAILX_NO_SYSTEM_RC . . .Mx .It Pa \*(ur File giving initial commands. A different file can be chosen by setting the .Sx ENVIRONMENT variable .Ev MAILRC . Reading of this file can be suppressed with the .Fl \&: command line option. . .It Va mailx-extra-rc Defines a startup file to be read after all other resource files. It can be used to specify settings that are not understood by other .Xr mailx 1 implementations, for example. .El . .Pp The content of these files is interpreted as follows: . .Pp .Bl -bullet -compact .It The whitespace characters space, tabulator and newline, as well as those defined by the variable .Va ifs , are removed from the beginning and end of input lines. .It Empty lines are ignored. .It Any other line is interpreted as a command. It may be spread over multiple input lines if the newline character is .Dq escaped by placing a reverse solidus character .Ql \e as the last character of the line; whereas any leading whitespace of follow lines is ignored, trailing whitespace before a escaped newline remains in the input. .It If the line (content) starts with the number sign .Ql # then it is a comment-command and also ignored. (The comment-command is a real command, which does nothing, and therefore the usual follow lines mechanism applies!) .El . .Pp Errors while loading these files are subject to the settings of .Va errexit and .Va posix . More files with syntactically equal content can be .Ic source Ns ed . The following, saved in a file, would be an examplary content: . .Bd -literal -offset indent # This line is a comment command. And y\e es, it is really continued here. set debug \e verbose set editheaders .Ed .\" }}} . .\" .Ss "The mime.types files" {{{ .Ss "The mime.types files" . As stated in .Sx "HTML mail and MIME attachments" \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions) media types in order to classify message and attachment content. One source for them are .Pa mime.types files, the loading of which can be controlled by setting the variable .Va mimetypes-load-control . Another is the command .Ic mimetype , which also offers access to \*(UAs MIME type cache. .Pa mime.types files have the following syntax: . .Bd -literal -offset indent type/subtype extension [extension ...] # For example text/html html htm .Ed . .Pp where .Ql type/subtype define the MIME media type, as standardized in RFC 2046: .Ql type is used to declare the general type of data, while the .Ql subtype specifies a specific format for that type of data. One or multiple filename .Ql extension Ns s, separated by whitespace, can be bound to the media type format. Comments may be introduced anywhere on a line with a number sign .Ql # , causing the remaining line to be discarded. . \*(UA also supports an extended, non-portable syntax in especially crafted files, which can be loaded via the alternative value syntax of .Va mimetypes-load-control , and prepends an optional .Ql type-marker : . .Pp .Dl [type-marker ]type/subtype extension [extension ...] . .Pp The following type markers are supported: . .Pp .Bl -tag -compact -width ".It Ar _n_u" .It Ar \&? Treat message parts with this content as plain text. .It Ar ?t The same as plain .Ar \&? . .It Ar ?h Treat message parts with this content as HTML tagsoup. If the \*(OPal HTML-tagsoup-to-text converter is not available treat the content as plain text instead. .It Ar ?H Likewise .Ar ?h , but instead of falling back to plain text require an explicit content handler to be defined. .It Ar ?q If no handler can be found a text message is displayed which says so. This can be annoying, for example signatures serve a contextual purpose, their content is of no use by itself. This marker will avoid displaying the text message. .El . .Pp Further reading: for sending messages: .Ic mimetype , .Va mime-allow-text-controls , .Va mimetypes-load-control . For reading etc. messages: .Sx "HTML mail and MIME attachments" , .Sx "The Mailcap files" , .Ic mimetype , .Va mime-counter-evidence , .Va mimetypes-load-control , .Va pipe-TYPE/SUBTYPE , .Va pipe-EXTENSION . .\" }}} . .\" .Ss "The Mailcap files" {{{ review .Ss "The Mailcap files" . \*(OP RFC 1524 defines a .Dq User Agent Configuration Mechanism to be used to inform mail user agent programs about the locally installed facilities for handling various data formats, i.e., about commands and how they can be used to display, edit et cetera MIME part contents, as well as a default path search that includes multiple possible locations of resource files, and the .Ev MAILCAPS environment variable to overwrite that. Handlers found from doing the path search will be cached, the command .Ic mailcap operates on that cache, and the variable .Va mailcap-disable will suppress automatic loading, and usage of any mailcap handlers. .Sx "HTML mail and MIME attachments" gives a general overview of how MIME types are handled. . .Pp .Dq Mailcap files consist of a set of newline separated entries. Comment lines start with a number sign .Ql # (in the first column!) and are ignored. Empty lines are ignored. All other lines are interpreted as mailcap entries. An entry definition may be split over multiple lines by placing the reverse solidus character .Ql \e last in all but the final line. The standard does not specify how leading whitespace of successive lines is to be treated, therefore they are retained. . .Pp .Dq Mailcap entries consist of a number of semicolon .Ql \&; separated fields. The first two fields are mandatory and must occur in the specified order, the remaining fields are optional and may appear in any order. Leading and trailing whitespace of field content is ignored (removed). The reverse solidus .Ql \e character can be used to escape any following character including semicolon and itself in the content of the second field, and in value parts of any optional key/value field. . .Pp The first field defines the MIME .Ql TYPE/SUBTYPE the entry is about to handle (case-insensitively). If the subtype is specified as an asterisk .Ql * the entry is meant to match all subtypes of the named type, e.g., .Ql audio/* would match any audio type. The second field is the .Cd view shell command used to display MIME parts of the given type. . .Pp Data consuming shell commands will be fed message (MIME part) data on standard input unless one or more instances of the (unquoted) string .Ql %s are used: these formats will be replaced with a temporary file(name) that has been prefilled with the parts data. Data producing shell commands are expected to generata data on their standard output unless that format is used. In all cases any given .Ql %s format is replaced with a properly shell quoted filename. When a command requests a temporary file via .Ql %s then that will be removed again, as if the .Cd x-mailx-tmpfile and .Cd x-mailx-tmpfile-fill flags had been set; unless the command requests .Cd x-mailx-async the .Cd x-mailx-tmpfile-unlink flag is also implied; see below for more. . .Pp Optional fields define single-word flags (case-insensitive), or key / value pairs consisting of a case-insensitive keyword, an equals sign .Ql = , and a shell command; whitespace surrounding the equals sign is removed. Optional fields include the following: . . .Bl -tag -width ".It Cd BaNg" .It Cd compose A program that can be used to compose a new body or body part in the given format. (Currently unused.) . .It Cd composetyped Similar to the .Cd compose field, but is to be used when the composing program needs to specify the .Ql Content-type: header field to be applied to the composed data. (Currently unused.) . .Mx .It Cd copiousoutput A flag field which indicates that the output of the .Cd view command is integrable into \*(UAs normal visual display. It is mutually exclusive with .Cd needsterminal . . .It Cd description A textual description that describes this type of data. The text may optionally be enclosed within double quotation marks .Ql \&" . . .It Cd edit A program that can be used to edit a body or body part in the given format. (Currently unused.) . .It Cd nametemplate This field specifies a filename format for the .Ql %s format used in the shell command fields, in which .Ql %s will be replaced by a random string. (The filename is also stored in and passed to subprocesses via .Ev MAILX_FILENAME_TEMPORARY . ) The standard says this is .Dq only expected to be relevant in environments \ where filename extensions are meaningful , and so this field is ignored unless the .Ql %s is a prefix, optionally followed by (ASCII) alphabetic and numeric characters, the underscore and the period. For example, to specify that a JPG file is to be passed to an image viewer with a name ending in .Ql .jpg , .Ql nametemplate=%s.jpg can be used. . .Mx .It Cd needsterminal This flag field indicates that the given shell command must be run on an interactive terminal. \*(UA will temporarily release the terminal to the given command in interactive mode, in non-interactive mode this entry will be entirely ignored; this flag implies .Cd x-mailx-noquote . . .It Cd print A program that can be used to print a message or body part in the given format. (Currently unused.) . .It Cd test Specifies a program to be run to test some condition, for example, the machine architecture, or the window system in use, to determine whether or not this mailcap entry applies. If the test fails, a subsequent mailcap entry should be sought; also see .Cd x-mailx-test-once . Standard I/O of the test program is redirected from and to .Pa /dev/null , and the format .Ql %s is not supported (the data does not yet exist). . .It Cd textualnewlines A flag field which indicates that this type of data is line-oriented and that, if encoded in .Ql base64 , all newlines should be converted to canonical form (CRLF) before encoding, and will be in that form after decoding. (Currently unused.) . .It Cd x11-bitmap Names a file, in X11 bitmap (xbm) format, which points to an appropriate icon to be used to visually denote the presence of this kind of data. This field is not used by \*(UA. . .Mx .It Cd x-mailx-async Extension flag field that denotes that the given .Cd view command shall be executed asynchronously, without blocking \*(UA. Cannot be used in conjunction with .Cd needsterminal ; the standard output of the command will go to .Pa /dev/null . . .Mx .It Cd x-mailx-noquote An extension flag field that indicates that even a .Cd copiousoutput .Cd view command shall not be used when .Va quote Ns ing messages, as it would by default. . .Mx .It Cd x-mailx-test-once Extension flag which denotes whether the given .Cd test command shall be evaluated once only with its exit status being cached. This is handy if some global unchanging condition is to be queried, like .Dq running under the X Window System . . .Mx .It Cd x-mailx-tmpfile Extension flag field that requests creation of a zero-sized temporary file, the name of which is to be placed in the environment variable .Ev MAILX_FILENAME_TEMPORARY . It is an error to use this flag with commands that include a .Ql %s format (because that is implemented by means of this temporary file). . .Mx .It Cd x-mailx-tmpfile-fill Normally the MIME part content is passed to the handler via standard input; if this flag is set then the data will instead be written into the implied .Cd x-mailx-tmpfile . In order to cause deletion of the temporary file you will have to set .Cd x-mailx-tmpfile-unlink explicitly! It is an error to use this flag with commands that include a .Ql %s format. . .Mx .It Cd x-mailx-tmpfile-unlink Extension flag field that requests that the temporary file shall be deleted automatically when the command loop is entered again at latest. It is an error to use this flag with commands that include a .Ql %s format, or in conjunction with .Cd x-mailx-async . .Cd x-mailx-tmpfile is implied. . .Mx .It Cd x-mailx-last-resort An extension flag that indicates that this handler shall only be used as a last resort, when no other source (see .Sx "HTML mail and MIME attachments" ) provides a MIME handler. . .Mx .It Cd x-mailx-ignore An extension that enforces that this handler is not used at all. .El . . .Pp The standard includes the possibility to define any number of additional fields, prefixed by .Ql x- . Flag fields apply to the entire .Dq Mailcap entry \(em in some unusual cases, this may not be desirable, but differentiation can be accomplished via separate entries, taking advantage of the fact that subsequent entries are searched if an earlier one does not provide enough information. For example, if a .Cd view command needs to specify the .Cd needsterminal flag, but the .Cd compose command shall not, the following will help out the latter: . .Bd -literal -offset indent application/postscript; ps-to-terminal %s; needsterminal application/postscript; ps-to-terminal %s; compose=idraw %s .Ed . .Pp In value parts of command fields any occurrence of the format string .Ql %t will be replaced by the .Ql TYPE/SUBTYPE specification. Any named parameter from a messages' .Ql Content-type: field may be embedded into the command line using the format .Ql %{ followed by the parameter name and a closing brace .Ql } character. The entire parameter should appear as a single command line argument, regardless of embedded spaces, shell quoting will be performed by the RFC 1524 processor, thus: . .Bd -literal -offset indent # Message Content-type: multipart/mixed; boundary=42 # Mailcap file multipart/*; /usr/local/bin/showmulti \e %t %{boundary} ; composetyped = /usr/local/bin/makemulti # Executed shell command /usr/local/bin/showmulti multipart/mixed 42 .Ed . .Pp Note that \*(UA does not support handlers for multipart MIME parts as shown in this example (as of today). It does not support the additional formats .Ql %n and .Ql %F . An example file, also showing how to properly deal with the expansion of .Ql %s , which includes any quotes that are necessary to make it a valid shell argument by itself and thus will cause undesired behaviour when placed in additional user-provided quotes: . .Bd -literal -offset indent # Comment line text/richtext; richtext %s; copiousoutput text/x-perl; perl -cWT %s; nametemplate = %s.pl # Exit EX_TEMPFAIL=75 on signal application/pdf; \e infile=%s\e; \e trap "rm -f ${infile}" EXIT\e; \e trap "exit 75" INT QUIT TERM\e; \e mupdf "${infile}"; \e test = [ -n "${DISPLAY}" ]; \e nametemplate = %s.pdf; x-mailx-async application/pdf; pdftotext -layout - -; copiousoutput application/*; echo "This is \e\e"%t\e\e" but \e is 50 \e% Greek to me" \e; < %s head -c 512 | cat -vet; \e copiousoutput; x-mailx-noquote; x-mailx-last-resort .Ed . .Pp Further reading: .Sx "HTML mail and MIME attachments" , .Sx "The mime.types files" , .Ic mimetype , .Ev MAILCAPS , .Va mime-counter-evidence , .Va pipe-TYPE/SUBTYPE , .Va pipe-EXTENSION . .\" }}} . .\" .Ss "The .netrc file" {{{ review .Ss "The .netrc file" . User credentials for machine accounts (see .Sx "On URL syntax and credential lookup" ) can be placed in the .Pa .netrc file, which will be loaded and cached when requested by .Va netrc-lookup . The default location .Pa \*(VN may be overridden by the .Ev NETRC environment variable. As long as syntax constraints are honoured the file source may be replaced with the output of the shell command set in .Va netrc-pipe , to load an encrypted file, for example. The cache can be managed with the command .Ic netrc . . .Pp The file consists of space, tabulator or newline separated tokens. This parser implements a superset of the original BSD syntax, but users should nonetheless be aware of portability glitches, shall their .Pa .netrc be usable across multiple programs and platforms: . .Pp .Bl -bullet -compact .It BSD only supports double quotation marks, for example .Ql password """pass with spaces""" . .It BSD (only?) supports escaping of single characters via a reverse solidus (a space could be escaped via .Ql \e\0 ) , in- as well as outside of a quoted string. This method is assumed to be present, and will actively be used to quote double quotation marks .Ql \&" and reverse solidus .Ql \e characters inside the .Cd login and .Cd password tokens, for example for display purposes. .It BSD does not require a final quotation mark of the last user input token. .It The original BSD (Berknet) parser also supported a format which allowed tokens to be separated with commas \(en whereas at least Hewlett-Packard still seems to support this syntax, this parser does not! .It As a non-portable extension some widely-used programs support shell-style comments: if an input line starts, after any amount of whitespace, with a number sign .Ql # , then the rest of the line is ignored. .It Whereas other programs may require that the .Pa .netrc file is accessible by only the user if it contains a .Cd password token for any other .Cd login than .Dq anonymous , this parser will always require these strict permissions. .El . .Pp Of the following list of supported tokens this parser uses (and caches) .Cd machine , .Cd login and .Cd password . An existing .Cd default entry will not be used. . .Bl -tag -width ".It Cd BaNg" .It Cd machine Ar name The hostname of the entries' machine, lowercase-normalized before use. Any further file content, until either end-of-file or the occurrence of another .Cd machine or a .Cd default first-class token is bound (only related) to the machine .Ar name . .Pp As an extension that should not be the cause of any worries this parser supports a single wildcard prefix for .Ar name : .Bd -literal -offset indent machine *.example.com login USER password PASS machine pop3.example.com login USER password PASS machine smtp.example.com login USER password PASS .Ed .Pp which would match .Ql xy.example.com as well as .Ql pop3.example.com , but neither .Ql example.com nor .Ql local.smtp.example.com . In the example neither .Ql pop3.example.com nor .Ql smtp.example.com will be matched by the wildcard, since the exact matches take precedence (it is however faster to specify it the other way around). . .It Cd default This is the same as .Cd machine except that it is a fallback entry that is used shall none of the specified machines match; only one default token may be specified, and it must be the last first-class token. . .It Cd login Ar name The user name on the remote machine. . .It Cd password Ar string The user's password on the remote machine. . .It Cd account Ar string Supply an additional account password. This is merely for FTP purposes. . .It Cd macdef Ar name Define a macro. A macro is defined with the specified .Ar name ; it is formed from all lines beginning with the next line and continuing until a blank line is (consecutive newline characters are) encountered. (Note that .Cd macdef entries cannot be utilized by multiple machines, too, but must be defined following the .Ic machine they are intended to be used with.) If a macro named .Ar init exists, it is automatically run as the last step of the login process. This is merely for FTP purposes. .El .\" }}} . .\" }}} . . .\" .Sh EXAMPLES {{{ .Sh EXAMPLES . .\" .Ss "An example configuration" {{{ .Ss "An example configuration" . .Bd -literal -offset indent # This example assumes v15.0 compatibility mode set v15-compat # Request strict TLL transport layer security checks set tls-verify=strict # Where are the up-to-date TLS certificates? # (Since we manage up-to-date ones explicitly, do not use any, # possibly outdated, default certificates shipped with OpenSSL) #set tls-ca-dir=/etc/ssl/certs set tls-ca-file=/etc/ssl/certs/ca-certificates.crt set tls-ca-no-defaults #set tls-ca-flags=partial-chain wysh set smime-ca-file="${tls-ca-file}" \e smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}" # This could be outsourced to a central configuration file via # tls-config-file plus tls-config-module if the used library allows. # CipherString: explicitly define the list of ciphers, which may # improve security, especially with protocols older than TLS v1.2. # See ciphers(1). Possibly best to only use tls-config-pairs-HOST # (or -USER@HOST), as necessary, again.. # Note that TLSv1.3 uses Ciphersuites= instead, which will join # with CipherString (if protocols older than v1.3 are allowed) # Curves: especially with TLSv1.3 curves selection may be desired. # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2. # Change this only when the remote server does not support it: # maybe use chain support via tls-config-pairs-HOST / -USER@HOST # to define such explicit exceptions, then, e.g., # MinProtocol=TLSv1.1 if "$tls-features" =% ,+ctx-set-maxmin-proto, wysh set tls-config-pairs='\e CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e Curves=P-521:P-384:P-256,\e MinProtocol=TLSv1.1' else wysh set tls-config-pairs='\e CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e Curves=P-521:P-384:P-256,\e Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2\e, +TLSv1.3' endif # Essential setting: select allowed character sets set sendcharsets=utf-8,iso-8859-1 # A very kind option: when replying to a message, first try to # use the same encoding that the original poster used herself! set reply-in-same-charset # When replying, do not merge From: and To: of the original message # into To:. Instead old From: -> new To:, old To: -> merge Cc:. set recipients-in-cc # When sending messages, wait until the Mail-Transfer-Agent finishs. # Only like this you will be able to see errors reported through the # exit status of the MTA (including the built-in SMTP one)! set sendwait # Only use built-in MIME types, no mime.types(5) files set mimetypes-load-control # Default directory where we act in (relative to $HOME) set folder=mail # A leading "+" (often) means: under *folder* # *record* is used to save copies of sent messages set MBOX=+mbox.mbox DEAD=+dead.txt \e record=+sent.mbox record-files record-resent # Make "file mymbox" and "file myrec" go to.. shortcut mymbox %:+mbox.mbox myrec +sent.mbox # Not really optional, e.g., for S/MIME set from='Your Name ' # It may be necessary to set hostname and/or smtp-hostname # if the "SERVER" of mta and "domain" of from do not match. # The `urlencode' command can be used to encode USER and PASS set mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \e smtp-auth=login/plain... \e smtp-use-starttls # Never refuse to start into interactive mode, and more set emptystart \e colour-pager crt= \e followup-to followup-to-honour=ask-yes fullnames \e history-file=+.\*(uAhist history-size=-1 history-gabby \e mime-counter-evidence=0b1111 \e prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e reply-to-honour=ask-yes \e umask= # Only include the selected header fields when typing messages headerpick type retain from_ date from to cc subject \e message-id mail-followup-to reply-to # ...when forwarding messages headerpick forward retain subject date from to cc # ...when saving message, etc. #headerpick save ignore ^Original-.*$ ^X-.*$ # Some mailing lists mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$' mlsubscribe '^xfans@xfans\e.xyz$' # Handle a few file extensions (to store MBOX databases) filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e gz 'gzip -dc' 'gzip -c' xz 'xz -dc' 'xz -zc' \e zst 'zstd -dc' 'zstd -19 -zc' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' # A real life example of a very huge free mail provider # Instead of directly placing content inside `account', # we `define' a macro: like that we can switch "accounts" # from within *on-compose-splice*, for example! define XooglX { set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent set from='Your Name ' set pop3-no-apop-pop.gmXil.com shortcut pop %:pop3s://pop.gmXil.com shortcut imap %:imaps://imap.gmXil.com # Or, entirely IMAP based setup #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e # imap-cache=~/spool/cache set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls # Alternatively: set mta=smtps://USER:PASS@smtp.gmail.com:465 } account XooglX { \ecall XooglX } # Here is a pretty large one which does not allow sending mails # if there is a domain name mismatch on the SMTP protocol level, # which would bite us if the value of from does not match, e.g., # for people who have a sXXXXeforge project and want to speak # with the mailing list under their project account (in from), # still sending the message through their normal mail provider define XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent set from='Your Name ' shortcut pop %:pop3s://pop.yaXXex.com shortcut imap %:imaps://imap.yaXXex.com set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e hostname=yaXXex.com smtp-hostname= } account XandeX { \ecall Xandex } # Create some new commands so that, e.g., `ls /tmp' will.. commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS' commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS' set pipe-message/external-body='?* echo $MAILX_EXTERNAL_BODY_URL' # We do not support gpg(1) directly yet. But simple --clearsign'd # message parts can be dealt with as follows: define V { localopts yes wysh set pipe-text/plain=$'?*#++=?\e < "${MAILX_FILENAME_TEMPORARY}" awk \e -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e BEGIN{done=0}\e /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e if(done++ != 0)\e next;\e print "--- GPG --verify ---";\e system("gpg --verify " TMPFILE " 2>&1");\e print "--- GPG --verify ---";\e print "";\e next;\e }\e /^-----BEGIN PGP SIGNATURE-----/,\e /^-----END PGP SIGNATURE-----/{\e next;\e }\e {print}\e \e'' print } commandalias V '\e'call V .Ed . .Pp When storing passwords in .Pa \*(ur appropriate permissions should be set on this file with .Ql $ chmod 0600 \*(ur . If the \*(OPal .Va netrc-lookup is available user credentials can be stored in the central .Pa \*(VN file instead; e.g., here is a different version of the example account that sets up SMTP and POP3: . .Bd -literal -offset indent define XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent set from='Your Name ' set netrc-lookup # Load an encrypted ~/.netrc by uncommenting the next line #set netrc-pipe='gpg -qd ~/.netrc.pgp' set mta=smtps://smtp.yXXXXx.ru:465 \e smtp-hostname= hostname=yXXXXx.com set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru commandalias xp fi pop3s://pop.yXXXXx.ru } account XandeX { \ecall XandeX } .Ed . .Pp and, in the .Pa \*(VN file: . .Bd -literal -offset indent machine *.yXXXXx.ru login USER password PASS .Ed . .Pp This configuration should now work just fine: . .Pp .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple .\" }}} . .\" .Ss "S/MIME step by step" {{{ .Ss "S/MIME step by step" . \*(OP The first thing that is needed for .Sx "Signed and encrypted messages with S/MIME" is a personal certificate, and a private key. The certificate contains public information, in particular a name and email address(es), and the public key that can be used by others to encrypt messages for the certificate holder (the owner of the private key), and to .Ic verify signed messages generated with that certificate('s private key). Whereas the certificate is included in each signed message, the private key must be kept secret. It is used to decrypt messages that were previously encrypted with the public key, and to sign messages. . .Pp For personal use it is recommended to get a S/MIME certificate from one of the major CAs on the Internet. Many CAs offer such certificates for free. Usually offered is a combined certificate and private key in PKCS#12 format which \*(UA does not accept directly. To convert it to PEM format, the following shell command can be used; please read on for how to use these PEM files. . .Bd -literal -offset indent $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes $ # Alternatively $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes .Ed . .Pp There is also .Lk https://www.CAcert.org which issues client and server certificates to members of their community for free; their root certificate .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt ) is often not in the default set of trusted CA root certificates, though, which means their root certificate has to be downloaded separately, and needs to be part of the S/MIME certificate validation chain by including it in .Va smime-ca-dir or as a vivid member of the .Va smime-ca-file . But let us take a step-by-step tour on how to setup S/MIME with a certificate from CAcert.org despite this situation! . .Pp First of all you will have to become a member of the CAcert.org community, simply by registrating yourself via the web interface. Once you are, create and verify all email addresses you want to be able to create signed and encrypted messages for/with using the corresponding entries of the web interface. Now ready to create S/MIME certificates, so let us create a new .Dq client certificate , ensure to include all email addresses that should be covered by the certificate in the following web form, and also to use your name as the .Dq common name . . .Pp Create a private key and a certificate request on your local computer (please see the manual pages of the used commands for more in-depth knowledge on what the used arguments etc. do): . .Pp .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem . .Pp Afterwards copy-and-paste the content of .Dq creq.pem into the certificate-request (CSR) field of the web form on the CAcert.org website (you may need to unfold some .Dq advanced options to see the corresponding text field). This last step will ensure that your private key (which never left your box) and the certificate belong together (through the public key that will find its way into the certificate via the certificate-request). You are now ready and can create your CAcert certified certificate. Download and store or copy-and-paste it as .Dq pub.crt . . .Pp Yay. In order to use your new S/MIME setup a combined private key/public key (certificate) file has to be created: . .Pp .Dl $ cat key.pem pub.crt > ME@HERE.com.paired . .Pp This is the file \*(UA will work with. If you have created your private key with a passphrase then \*(UA will ask you for it whenever a message is signed or decrypted, unless this operation has been automated as described in .Sx "Signed and encrypted messages with S/MIME" . Set the following variables to henceforth use S/MIME (setting .Va smime-ca-file is of interest for verification only): . .Bd -literal -offset indent ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e smime-sign-cert=ME@HERE.com.paired \e smime-sign-digest=SHA512 \e smime-sign from=myname@my.host .Ed . .\" }}} . .\" .Ss "Using CRLs with S/MIME or TLS" {{{ .Ss "Using CRLs with S/MIME or TLS" . \*(OP Certification authorities (CAs) issue certificate revocation lists (CRLs) on a regular basis. These lists contain the serial numbers of certificates that have been declared invalid after they have been issued. Such usually happens because the private key for the certificate has been compromised, because the owner of the certificate has left the organization that is mentioned in the certificate, etc. To seriously use S/MIME or TLS verification, an up-to-date CRL is required for each trusted CA. There is otherwise no method to distinguish between valid and invalidated certificates. \*(UA currently offers no mechanism to fetch CRLs, nor to access them on the Internet, so they have to be retrieved by some external mechanism. . .Pp \*(UA accepts CRLs in PEM format only; CRLs in DER format must be converted, like, e.\|g.: . .Pp .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem . .Pp To tell \*(UA about the CRLs, a directory that contains all CRL files (and no other files) must be created. The .Va smime-crl-dir or .Va tls-crl-dir variables, respectively, must then be set to point to that directory. After that, \*(UA requires a CRL to be present for each CA that is used to verify a certificate. .\" }}} . .\" }}} (Examples) . . .\" .Sh "FAQ" {{{ .Sh "FAQ" . In general it is a good idea to turn on .Va debug .Pf ( Fl d ) and / or .Va verbose .Pf ( Fl v , twice) if something does not work well. Very often a diagnostic message can be produced that leads to the problems' solution. . .\" .Ss "\*(UA shortly hangs on startup" {{{ .Ss "\*(UA shortly hangs on startup" . This can have two reasons, one is the necessity to wait for a file lock and cannot be helped, the other being that \*(UA calls the function .Xr uname 2 in order to query the nodename of the box (sometimes the real one is needed instead of the one represented by the internal variable .Va hostname ) . One may have varying success by ensuring that the real hostname and .Ql localhost have entries in .Pa /etc/hosts , or, more generally, that the name service is properly setup \(en and does .Xr hostname 1 return the expected value? Does this local hostname have a domain suffix? RFC 6762 standardized the link-local top-level domain .Ql .local , try again after adding an (additional) entry with this extension. .\" }}} . .\" .Ss "I cannot login to Google mail (via OAuth)" {{{ .Ss "I cannot login to Google mail \&(via OAuth\&)" . Since 2014 some free service providers classify programs as .Dq less secure unless they use a special authentication method (OAuth 2.0) which was not standardized for non-HTTP protocol authentication token query until August 2015 (RFC 7628). . .Pp Different to Kerberos / GSSAPI, which is developed since the mid of the 1980s, where a user can easily create a local authentication ticket for her- and himself with the locally installed .Xr kinit 1 program, that protocol has no such local part but instead requires a world-wide-web query to create or fetch a token; since there is no local cache this query would have to be performed whenever \*(UA is invoked (in interactive sessions situation may differ). . .Pp \*(UA does not directly support OAuth. It, however, supports XOAUTH2 / OAUTHBEARER, see .Sx "But, how about XOAUTH2 / OAUTHBEARER?" If that is not used it is necessary to declare \*(UA a .Dq less secure app (on the providers account web page) in order to read and send mail. However, it also seems possible to take the following steps instead: . .Pp .Bl -enum -compact .It give the provider the number of a mobile phone, .It enable .Dq 2-Step Verification , .It create an application specific password (16 characters), and .It use that special password instead of the real Google account password in \*(UA (for more on that see the section .Sx "On URL syntax and credential lookup" ) . .El .\" }}} . .\" .Ss "But, how about XOAUTH2 / OAUTHBEARER?" {{{ .Ss "But, how about XOAUTH2 / OAUTHBEARER?" . Following up .Sx "I cannot login to Google mail \&(via OAuth\&)" one OAuth-based authentication method is available: the OAuth 2.0 bearer token usage as standardized in RFC 6750 (according SASL mechanism in RFC 7628), also known as XOAUTH2 and OAUTHBEARER, allows fetching a temporary access token via the web that can locally be used as a .Va password . The protocol is simple and extendable, token updates or even password changes via a simple TLS secured server login would be possible in theory, but today a web browser and an external support tool are prerequisites for using this authentication method. The token times out and must be periodically refreshed via the web. . .Pp Some hurdles must be taken before being able to use this method. Using GMail as an example, an application (that is a name) must be registered, for which credentials, a .Dq client ID and a .Dq client secret , need to be created and saved locally (in a secure way). These initial configuration steps can be performed at .Lk https://console.developers.google.com/apis/credentials . Thereafter a refresh token can be requested; a python program to do this for GMail accounts is .Lk https://github.com/google/\:gmail-oauth2-tools/\:raw/\:\ master/\:python/\:oauth2.py : . .Bd -literal -offset indent $ python oauth2.py --user=EMAIL \e --client-id=THE-ID --client-secret=THE-SECRET \e --generate_oauth2_token To authorize token, visit this url and follow the directions: https://accounts.google.com/o/oauth2/auth?client_id=... Enter verification code: ... Refresh Token: ... Access Token: ... Access Token Expiration Seconds: 3600 $ # Of which the last three are actual token responses. $ # Thereafter access tokens can regularly be refreshed $ # via the created refresh token (read on) .Ed . .Pp The generated refresh token must also be saved locally (securely). The procedure as a whole can be read at .Lk https://github.com/google/\:gmail-oauth2-tools/\:wiki/\:\ OAuth2DotPyRunThrough . Since periodic timers are not yet supported, keeping an access token up-to-date (from within \*(UA) can only be performed via the hook .Va on-main-loop-tick , or (for sending only) .Va on-compose-enter (for more on authentication please see the section .Sx "On URL syntax and credential lookup" ) : . .Bd -literal -offset indent set on-main-loop-tick=o-m-l-t on-compose-enter=o-c-e define o-m-l-t { xcall update_access_token } define o-c-e { xcall update_access_token } set access_token_=0 define update_access_token { local set i epoch_sec epoch_nsec vput vexpr i epoch eval set $i # set epoch_sec/_nsec of vexpr epoch vput vexpr i + $access_token_ 2100 if $epoch_sec -ge $i vput ! password python oauth2.py --user=EMAIL \e --client-id=THE-ID --client-secret=THE-SECRET \e --refresh-token=THE-REFRESH-TOKEN |\e sed '1b PASS;d; :PASS s/^.\e{1,\e}:\e(.\e{1,\e}\e)$/\e1/' vput csop password trim "$password" if -n "$verbose" echo password is <$password> endif set access_token_=$epoch_sec endif } .Ed .\" }}} . .\" .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" {{{ review .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" . Two thinkable situations: the first is a shadowed sequence; setting .Va debug , or the most possible .Va verbose mode, causes a printout of the .Ic bind tree after that is built; being a cache, this happens only upon startup or after modifying bindings. . .Pp Or second, terminal libraries (see .Sx "On terminal control and line editor", .Ic bind , .Va termcap ) may report different codes than the terminal really sends, rendering bindings dysfunctional because expected and received data do not match; the .Va verbose listing of .Ic bind Ns ings will show the byte sequences that are expected. (One common source of problems is that the \(em possibly even non-existing \(em keypad is not turned on, and the resulting layout reports the keypad control codes for the normal keyboard keys.) . .Pp To overcome the situation use for example the program .Xr cat 1 with its option .Fl \&\&v , if available, to see the byte sequences which are actually produced by keypresses, and use the variable .Va termcap to make \*(UA aware of them. The terminal this is typed on produces some unexpected sequences, here for an example the shifted home key: . .Bd -literal -offset indent ? set verbose ? bind* # 1B 5B=[ 31=1 3B=; 32=2 48=H bind base :kHOM z0 ? x $ cat -v ^[[H $ \*(uA -v -Stermcap='kHOM=\eE[H' ? bind* # 1B 5B=[ 48=H bind base :kHOM z0 .Ed .\" }}} . .\" .Ss "Can \*(UA git-send-email?" {{{ .Ss "Can \*(UA git-send-email?" . Yes. Put (at least parts of) the following in your .Pa ~/.gitconfig : . .Bd -literal -offset indent [sendemail] smtpserver = /usr/bin/\*(uA smtpserveroption = -t #smtpserveroption = -Sexpandaddr smtpserveroption = -Athe-account-you-need ## suppresscc = all suppressfrom = false assume8bitEncoding = UTF-8 #to = /tmp/OUT confirm = always chainreplyto = true multiedit = false thread = true quiet = true annotate = true .Ed . .Pp Newer .Xr git 1 versions (v2.33.0) added the option .Cm sendmailCmd . Patches can also be send directly, for example: . .Bd -literal -offset indent $ git format-patch -M --stdout HEAD^ | \*(uA -A the-account-you-need -t RECEIVER .Ed .\" }}} . .\" .Ss "Howto handle stale dotlock files" {{{ .Ss "Howto handle stale dotlock files" . .Ic folder sometimes fails to open MBOX mail databases because creation of .Mx -sx .Sx "dotlock files" is impossible due to existing but unowned lock files. \*(UA does not offer an option to deal with those files, because it is considered a site policy what counts as unowned, and what not. The site policy is usually defined by administrator(s), and expressed in the configuration of a locally installed MTA (for example Postfix .Ql stale_lock_time=500s ) . Therefore the suggestion: . .Bd -literal -offset indent $