send and receive Internet mail
TLDR
Send a typed email message. The command-line below continues after pressing Enter key. Input CC email-id (optional) press Enter key. Input message text (can be multiline). Press Ctrl-D key to complete the message text
Send an email that contains file content
Send a tar.gz file as an attachment
SYNOPSIS
mail [-DdEFinv~#] [-: spec] [-A account] [:-a attachment:] [:-b bcc-addr:] [:-C "field: body":] [:-c cc-addr:] [-M type | -m file | -q file | -t] [-r from-addr] [:-S var[=value]:] [-s subject] [:-T "field: addr":] [:-X cmd:] [:-Y cmd:] [-.] :to-addr: [-- :mta-option:] mail [-DdEeHiNnRv~#] [-: spec] [-A account] [:-C "field: body":] [-L spec] [-r from-addr] [:-S var[=value]:] [-u user] [:-X cmd:] [:-Y cmd:] [-- :mta-option:] mail [-DdEeHiNnRv~#] [-: spec] [-A account] [:-C "field: body":] -f [-L spec] [-r from-addr] [:-S var[=value]:] [:-X cmd:] [:-Y cmd:] [file] [-- :mta-option:] mail -h | --help mail -V | --versio
IMAP CLIENT
[Option]ally there is IMAP client support available. This part of the program is obsolete and will vanish in v15 with the large MIME and I/O layer rewrite, because it uses old-style blocking I/O and makes excessive use of signal based long code jumps. Support can hopefully be readded later based on a new-style I/O, with SysV signal handling. In fact the IMAP support had already been removed from the codebase, but was rein‐ stantiated on user demand: in effect the IMAP code is at the level of Mail v14.8.16 (with imapcodec being the sole exception), and should be treated with some care. IMAP uses the ‘imap://’ and ‘imaps://’ protocol prefixes, and an IMAP- based folder may be used. IMAP URLs (paths) undergo inspections and pos‐ sible transformations before use (and the command imapcodec can be used to manually apply them to any given argument). Hierarchy delimiters are normalized, a step which is configurable via the imap-delim variable chain, but defaults to the first seen delimiter otherwise. Mail supports internationalised IMAP names, and en- and decodes the names from and to the ttycharset as necessary and possible. If a mailbox name is expanded (see Filename transformations) to an IMAP mailbox, all names that begin with `+' then refer to IMAP mailboxes below the folder target box, while folder names prefixed by `@' refer to folders below the hierarchy base, e.g., the following lists all folders below the current one when in an IMAP mailbox: ‘folders @’. Note: some IMAP servers do not accept the creation of mailboxes in the hierarchy base, but require that they are created as subfolders of `IN‐ BOX' – with such servers a folder name of the form imaps://mylogin@imap.myisp.example/INBOX. should be used (the last character is the server's hierarchy delimiter). The following IMAP-specific commands exist: cache Only applicable to cached IMAP mailboxes; takes a message list and reads the specified messages into the IMAP cache. connect If operating in disconnected mode on an IMAP mailbox, switch to online mode and connect to the mail server while retaining the mailbox status. See the description of the disconnected vari‐ able for more information. disconnect If operating in online mode on an IMAP mailbox, switch to dis‐ connected mode while retaining the mailbox status. See the de‐ scription of the disconnected variable for more. A list of messages may optionally be given as argument; the respective messages are then read into the cache before the connection is closed, thus ‘disco *’ makes the entire mailbox available for disconnected use. imap Sends command strings directly to the current IMAP server. Mail operates always in IMAP `selected state' on the current mailbox; commands that change this will produce undesirable re‐ sults and should be avoided. Useful IMAP commands are: create Takes the name of an IMAP mailbox as an argument and creates it. getquotaroot (RFC 2087) Takes the name of an IMAP mail‐ box as an argument and prints the quotas that apply to the mailbox. Not all IMAP servers support this command. namespace (RFC 2342) Takes no arguments and prints the Personal Namespaces, the Other User's Namespaces and the Shared Namespaces. Each namespace type is printed in paren‐ theses; if there are multiple namespaces of the same type, inner parentheses sepa‐ rate them. For each namespace a prefix and a hierarchy separator is listed. Not all IMAP servers support this command. imapcodec Perform IMAP path transformations. Supports vput (see Command modifiers), and manages the error number !. The first argument specifies the operation: e[ncode] normalizes hierarchy delim‐ iters (see imap-delim) and converts the strings from the locale ttycharset to the internationalized variant used by IMAP, d[ecode] performs the reverse operation. Encoding will honour the (global) value of imap-delim. The following IMAP-specific internal variables exist: disconnected (Boolean) When an IMAP mailbox is selected and this variable is set, no connection to the server is initiated. Instead, data is obtained from the local cache (see imap-cache). Mailboxes that are not present in the cache and messages that have not yet entirely been fetched from the server are not available; to fetch all messages in a mailbox at once, the command `copy * /dev/null' can be used while still in connected mode. Changes that are made to IMAP mailboxes in disconnected mode are queued and committed later when a connection to that server is made. This procedure is not completely reliable since it cannot be guaranteed that the IMAP unique identifiers (UIDs) on the server still match the ones in the cache at that time. Data is saved to DEAD when this problem occurs. disconnected-USER@HOST The specified account is handled as described for the disconnected variable above, but other accounts are not af‐ fected. imap-auth-USER@HOST, imap-auth Sets the IMAP authentication method. Supported are the default ‘login’, [v15-compat] ‘oauthbearer’ (see FAQ entry But, how about XOAUTH2 / OAUTHBEARER?), [v15-compat] ‘external’ and ‘externanon’ (for TLS secured connections which pass a client certificate via tls-config-pairs), as well as the [Option]al ‘cram-md5’ and ‘gssapi’. All methods need a user and a password except ‘gssapi’ and ‘external’, which only need the former. ‘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 ad‐ ditional credentials are actually passed. imap-cache Enables caching of IMAP mailboxes. The value of this variable must point to a directory that is either existent or can be created by Mail. All contents of the cache can be deleted by Mail at any time; it is not safe to make assumptions about them. imap-delim-USER@HOST, imap-delim-HOST, imap-delim The hierarchy separator used by the IMAP server. Whenever an IMAP path is specified it will undergo normalization. One of the normalization steps is the squeezing and adjustment of hi‐ erarchy separators. If this variable is set, any occurrence of any character of the given value that exists in the path will be replaced by the first member of the value; an empty value will cause the default to be used, it is ‘/.’. If not set, we will reuse the first hierarchy separator character that is dis‐ covered in a user-given mailbox name. imap-keepalive-USER@HOST, imap-keepalive-HOST, imap-keepalive IMAP servers may close the connection after a period of inac‐ tivity; the standard requires this to be at least 30 minutes, but practical experience may vary. Setting this variable to a numeric `value' greater than 0 causes a `NOOP' command to be sent each `value' seconds if no other operation is performed. imap-list-depth When retrieving the list of folders on an IMAP server, the folders command stops after it has reached a certain depth to avoid possible infinite loops. The value of this variable sets the maximum depth allowed. The default is 2. If the folder separator on the current IMAP server is a slash `/', this vari‐ able has no effect and the folders command does not descend to subfolders. imap-use-starttls-USER@HOST, imap-use-starttls-HOST, imap-use-starttls Causes Mail to issue a `STARTTLS' command to make an unen‐ crypted IMAP session TLS encrypted. This functionality is not supported by all servers, and is not used if the session is al‐ ready encrypted by the IMAPS method.
DESCRIPTION
Note: S-nail (Mail) will see major changes in v15.0 (circa 2020).
Some backward incompatibilities cannot be avoided. COMMANDS change
to Shell-style argument quoting, and shell metacharacters will be‐
come (more) meaningful. Some commands accept new syntax today via
wysh (Command modifiers). Behaviour is flagged [v15-compat] and
[no v15-compat], setting v15-compat (INTERNAL VARIABLES) will
choose new behaviour when applicable; giving it a value makes wysh
an implied default. [Obsolete] flags what will vanish. Using -d
or -v enables obsoletion warnings.
Warning! v15-compat (with value) will be a default in v14.10.0!
Mail provides a simple and friendly environment for sending and receiving
mail. It is intended to provide the functionality of the POSIX mailx(1)
command, but is MIME capable and optionally offers extensions for line
editing, S/MIME, SMTP and POP3, among others. Mail divides incoming mail
into its constituent messages and allows the user to deal with them in
any order. It offers many COMMANDS and INTERNAL VARIABLES for manipulat‐
ing messages and sending mail. It provides the user simple editing capa‐
bilities to ease the composition of outgoing messages, and increasingly
powerful and reliable non-interactive scripting capabilities.
Options
-: spec, --resource-files=..
Explicitly control which of the Resource files shall be sourced
(loaded): if the letter ‘s’ is (case-insensitively) part of the
spec then the system wide mail.rc is sourced, likewise the let‐
ter ‘u’ controls sourcing of the user's personal ~/.mailrc
file, whereas the letters ‘-’ and ‘/’ explicitly forbid sourc‐
ing of any resource files. Scripts should use this option: to
avoid environmental noise they should “detach” from any config‐
uration and create a script-specific environment, setting any
of the desired INTERNAL VARIABLES via -S and running configu‐
rating commands via -X. This option overrides -n.
-A name, --account=..
Executes an account command for the given user email account
name after program startup is complete (all resource files are
loaded, any -S setting is being established, but -X commands
have not been evaluated yet). Being a special incarnation of
defined macros for the purpose of bundling longer-lived
settings, activating such an email account also switches to the
accounts primary system mailbox (most likely the inbox). If
the operation fails the program will exit if it is used non-in‐
teractively, or if any of errexit or posix are set.
-a file[=input-charset[#output-charset]], --attach=..
Attach file to the message (for compose mode opportunities re‐
fer to ~@ and ~^). Filename transformations (also see file)
will be performed, except that shell variables are not ex‐
panded. Shall file not be accessible but contain a ‘=’ charac‐
ter, then anything before the last ‘=’ will be used as the
filename, anything thereafter as a character set specification.
If an input character set is specified, but no output character
set, then the given input character set is fixed as-is, and no
conversion will be applied; giving the empty string or the spe‐
cial string hyphen-minus ‘-’ will be treated as if ttycharset
has been specified (the default).
If an output character set has also been given then the conver‐
sion will be performed exactly as specified and on-the-fly, not
considering the file type and content. As an exception the
empty string or hyphen-minus ‘-’, select the default conversion
algorithm (see Character sets): no conversion is performed on-
the-fly, file and its contents will be MIME-classified (HTML
mail and MIME attachments, The mime.types files); Only this
mode is supported without support for character set conversions
(features does not mention ‘+iconv’).
-B ([Obsolete]: Mail will always use line-buffered output, to gain
line-buffered input even in batch mode enable batch mode via
-#.)
-b addr, --bcc=..
Send a blind carbon copy to recipient addr, if the setting of
expandaddr, one of the INTERNAL VARIABLES, allows; the
‘shquote’ expandaddr flag is supported. The option may be used
multiple times. Also see the section On sending mail, and non-
interactive mode.
-C "field: body", --custom-header=..
Create a custom header which persists for an entire session. A
custom header consists of the field name followed by a colon
‘:’ and the field content body, e.g., ‘-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 customhdr, and in
compose mode ~^, one of the COMMAND ESCAPES, as well as digmsg
are the most flexible and powerful options to manage message
headers. This option may be used multiple times.
-c addr, --cc=..
Just like -b, except it places the argument in the list of car‐
bon copies.
-D, --disconnected
([Option]) Startup with disconnected set.
-d, --debug
Almost enable a sandbox mode with the internal variable debug;
the same can be achieved via ‘-S debug’ or ‘set debug’.
-E, --discard-empty-messages
set skipemptybody and thus discard messages with an empty mes‐
sage part body.
-e, --check-and-exit
Just check if mail is present (in the system inbox or the one
specified via -f): if yes, return an exit status of zero, a
non-zero value otherwise. To restrict the set of mails to con‐
sider in this evaluation a message specification can be added
with the option -L. Quickrun: does not open an interactive
session.
-F Save the message to send in a file named after the local part
of the first recipient's address (instead of in record).
-f, --file
Read in the contents of the user's secondary mailbox MBOX (or
the specified file) for processing; when Mail is quit, it
writes undeleted messages back to this file (but be aware of
the hold option). The optional file argument will undergo some
special Filename transformations (as via file). Note that file
is not an argument to the flag -f, but is instead taken from
the command line after option processing has been completed.
In order to use a file that starts with a hyphen-minus, prefix
with a relative path, as in ‘./-hyphenbox.mbox’.
-H, --header-summary
Display a summary of headers for the given file (depending on
-u, inbox or MAIL, or as specified via -f), then exit. A con‐
figurable summary view is available via the option -L. This
mode does not honour showlast. Quickrun: does not open an in‐
teractive session.
-h, --help
Show a brief usage summary; use --long-help for a list long op‐
tions.
-i set ignore to ignore tty interrupt signals.
-L spec, --header-search=..
Display a summary of headers of all messages that match the
given spec in the file found by the same algorithm used by -H,
then exit. See the section Specifying messages for the format
of spec. This mode does not honour showlast.
If the -e option has been given in addition no header summary
is produced, but Mail will instead indicate via its exit status
whether spec matched any messages (‘0’) or not (‘1’); note that
any verbose output is suppressed in this mode and must instead
be enabled explicitly (e.g., by using the option -v). Quick‐
run: does not open an interactive session.
-M type Special send mode that will flag standard input with the MIME
‘Content-Type:’ set to the given known type (HTML mail and MIME
attachments, The mime.types files) and use it as the main mes‐
sage body. [v15 behaviour may differ] Using this option will
bypass processing of message-inject-head and
message-inject-tail. Also see -q, -m, -t.
-m file Special send mode that will MIME classify the specified file,
and use it as the main message body. [v15 behaviour may dif‐
fer] Using this option will bypass processing of
message-inject-head and message-inject-tail. Also see -q, -M,
-t.
-N, --no-header-summary
inhibit the initial display of message headers when reading
mail or editing a mailbox folder by calling unset for the in‐
ternal variable header.
-n Standard flag that inhibits reading the system wide mail.rc
upon startup. The option -: allows more control over the
startup sequence; also see Resource files.
-q file, --quote-file=..
Special send mode that will initialize the message body with
the contents of the specified file, which may be standard input
‘-’ only in non-interactive context. Also see -M, -m, -t.
-R, --read-only
Any mailbox folder aka file opened will be in read-only mode.
-r from-addr, --from-address=..
Whereas the source address that appears in the from header of a
message (or in the sender header if the former contains multi‐
ple addresses) is honoured by the built-in SMTP transport, it
is not used by a file-based mta (Mail-Transfer-Agent) for the
RFC 5321 reverse-path used for relaying and delegating a mes‐
sage to its destination(s), for delivery errors etc., but it
instead uses the local identity of the initiating user.
When this command line option is used the given single ad‐
dressee from-addr will be assigned to the internal variable
from, but in addition the command line option -f from-addr will
be passed to a file-based mta whenever a message is sent.
Shall from-addr include a user name the address components will
be separated and the name part will be passed to a file-based
mta individually via -F name. Even though not a recipient the
‘shquote’ expandaddr flag is supported.
If an empty string is passed as from-addr then the content of
the variable from (or, if that contains multiple addresses,
sender) will be evaluated and used for this purpose whenever
the file-based mta is contacted. By default, without -r that
is, neither -f nor -F command line options are used when con‐
tacting a file-based MTA, unless this automatic deduction is
enforced by seting the internal variable r-option-implicit.
Remarks: many default installations and sites disallow overrid‐
ing 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.
-S var[=value], --set=..
set (or, with a prefix string ‘no’, as documented in INTERNAL
VARIABLES, unset) variable and optionally assign value, if sup‐
ported; [v15 behaviour may differ] the entire expression is
evaluated as if specified within dollar-single-quotes (see
Shell-style argument quoting) if the internal variable
v15-compat is set. If the operation fails the program will
exit if any of errexit or posix are set. Settings established
via -S cannot be changed from within Resource files or an ac‐
count switch initiated by -A. They will become mutable again
before commands registered via -X are executed.
-s subject, --subject=..
Specify the subject of the message to be sent. Newline (NL)
and carriage-return (CR) bytes are invalid and will be normal‐
ized to space (SP) characters.
-T "field: addr", --target=..
Add addr to the list of receivers targeted by field, for now
supported are only ‘bcc’, ‘cc’, ‘fcc’, and ‘to’. Field and
body (address) are separated by a colon ‘:’ and optionally
blank (space, tabulator) characters. The ‘shquote’ expandaddr
flag is supported. addr is parsed like a message header ad‐
dress line, as if it would be part of a template message fed in
via -t, and the same modifier suffix is supported. This option
may be used multiple times.
-t, --template
The text message given (on standard input) is expected to con‐
tain, separated from the message body by an empty line, one or
multiple plain text message headers. [v15 behaviour may dif‐
fer] 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 ‘#’ in the first column is ignored. Message recip‐
ients can be given via the message headers ‘To:’, ‘Cc:’, ‘Bcc:’
(the ‘?single’ modifier enforces treatment as a single ad‐
dressee, e.g., ‘To?single: exa,
COMMANDS
Mail reads input in lines. An unquoted reverse solidus ‘\’ at the end of
a command line “escapes” the newline character: it is discarded and the
next line of input is used as a follow-up line, with all leading white‐
space removed; once an entire line is completed, the whitespace charac‐
ters space, tabulator, newline as well as those defined by the variable
ifs are removed from the beginning and end. Placing any whitespace char‐
acters at the beginning of a line will prevent a possible addition of the
command line to the [Option]al history.
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 com‐
mand that matches the given prefix will be used. Command modifiers may
prefix a command in order to modify its behaviour. A name may also be a
commandalias, which will become expanded until no more expansion is pos‐
sible. 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.
This behaviour is different to the sh(1)ell, which is a programming lan‐
guage with syntactic elements of clearly defined semantics, and therefore
capable to sequentially expand and evaluate individual elements of a
line. Mail will never be able to handle ‘? set one=value two=$one’ in a
single statement, because the variable assignment is performed by the
command (set), not the language.
The command list can be used to show the list of all commands, either al‐
phabetically sorted or in prefix search order (these do not match, also
because the POSIX standard prescribes a set of abbreviations). [Op‐
tion]ally the command help (or ?), when given an argument, will show a
documentation string for the command matching the expanded argument, as
in ‘?t’, which should be a shorthand of ‘?type’; with these documentation
strings both commands support a more verbose listing mode which includes
the argument type of the command and other information which applies; a
handy suggestion might thus be:
? define __xv {
# Before v15: need to enable sh(1)ell-style on _entire_ line!
localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}
}
? commandalias xv '\call __xv'
? xv help set
Command modifiers
Commands may be prefixed by one or multiple command modifiers. Some com‐
mand modifiers can be used with a restricted set of commands only, the
verbose version of list will ([Option]ally) show which modifiers apply.
• The modifier reverse solidus \, to be placed first, prevents
commandalias expansions on the remains of the line, e.g., ‘\echo’
will always evaluate the command echo, even if an (command)alias of
the same name exists. commandalias content may itself contain fur‐
ther command modifiers, including an initial reverse solidus to pre‐
vent further expansions.
• The modifier ignerr indicates that any error generated by the follow‐
ing command should be ignored by the state machine and not cause a
program exit with enabled errexit or for the standardized exit cases
in posix mode. ?, one of the INTERNAL VARIABLES, will be set to the
real exit status of the command regardless.
• local will alter the called command to apply changes only temporar‐
ily, local to block-scope, and can thus only be used inside of a
defined macro or an account definition. Specifying it implies the
modifier wysh. Block-scope settings will not be inherited by macros
deeper in the call chain, and will be garbage collected once the cur‐
rent block is left. To record and unroll changes in the global scope
use the command localopts.
• scope does yet not implement any functionality.
• u does yet not implement any functionality.
• Some commands support the vput modifier: if used, they expect the
name of a variable, which can itself be a variable, i.e., shell ex‐
pansion is applied, as their first argument, and will place their
computation result in it instead of the default location (it is usu‐
ally written to standard output).
The given name will be tested for being a valid 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 INTERNAL VARIABLES, or must otherwise refer to a
writable (non-boolean) value variable. The actual put operation may
fail nonetheless, e.g., 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 ! will be
set to ^ERR-NOTSUP, the exit status ? should be set to ‘-1’, but some
commands deviate from the latter, which is documented.
• Last, but not least, the modifier wysh can be used for some old and
established commands to choose the new Shell-style argument quoting
rules over the traditional Old-style argument quoting. This modifier
is implied if v15-compat is set to a non-empty value.
Old-style argument quoting
[v15 behaviour may differ] This section documents the old, traditional
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 Shell-style argument quoting may be available even for those via
wysh, one of the Command modifiers. Nonetheless care must be taken, be‐
cause only new commands have been designed with all the capabilities of
the new quoting rules in mind, which can, e.g., generate control charac‐
ters.
• An argument can be enclosed between paired double-quotes
‘"argument"’ or single-quotes ‘'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 nonethe‐
less by escaping it with a reverse solidus ‘\’, as in
‘"y\"ou"’.
• An argument that is not enclosed in quotes, as above, can usu‐
ally still contain space characters if those spaces are reverse
solidus escaped, as in ‘you\ are’.
• A reverse solidus outside of the enclosing quotes is discarded
and the following character is treated literally as part of the
argument.
Shell-style argument quoting
sh(1)ell-style, and therefore POSIX standardized, argument parsing and
quoting rules are used by most commands. [v15 behaviour may differ] Most
new commands only support these new rules and are flagged [Only new quot‐
ing rules], some elder ones can use them with the command modifier wysh;
in the future only this type of argument quoting will remain.
A command line is parsed from left to right and an input token is com‐
pleted whenever an unquoted, otherwise ignored, metacharacter is seen.
Metacharacters are vertical bar |, ampersand &, semicolon ;, as well as
all characters from the variable ifs, and / or space, tabulator, newline.
The additional metacharacters left and right parenthesis (, ) and less-
than and greater-than signs <, > that the 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 Mail.
Compatibility note: [v15 behaviour may differ] Please note that
even many new-style commands do not yet honour ifs to parse their
arguments: whereas the sh(1)ell is a language with syntactic ele‐
ments of clearly defined semantics, Mail 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 Mail can do is cancellation of the processing of the remains
of the line.
It also often depends on an actual subcommand of a multiplexer com‐
mand 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 posi‐
tional parameters fully support ifs for an almost shell-compatible
field splitting: call, call_if, read, vpospar, xcall.
Any unquoted number sign ‘#’ 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 ‘$’ will cause variable expansion of
the given name, which must be a valid sh(1)ell-style variable name (see
vput): INTERNAL VARIABLES as well as ENVIRONMENT (shell) variables can be
accessed through this mechanism, brace enclosing the name is supported
(i.e., to subdivide a token).
Whereas the metacharacters space, tabulator, newline only complete an in‐
put token, vertical bar |, ampersand & and semicolon ; also act as con‐
trol operators and perform control functions. For now supported is semi‐
colon ;, which terminates a single command, therefore sequencing the com‐
mand 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.
? echo one; set verbose; echo verbose=$verbose.
? echo one; wysh set verbose; echo verbose=$verbose.
Quoting is a mechanism that will remove the special meaning of metachar‐
acters and reserved words, and will prevent expansion. There are four
quoting mechanisms: the escape character, single-quotes, double-quotes
and dollar-single-quotes:
• The literal value of any character can be preserved by preced‐
ing it with the escape character reverse solidus ‘\’.
• Arguments which are enclosed in ‘'single-quotes'’ retain their
literal value. A single-quote cannot occur within single-
quotes.
• The literal value of all characters enclosed in ‘"double-
quotes"’ is retained, with the exception of dollar sign ‘$’,
which will cause variable expansion, as above, backquote (grave
accent) ‘`’, (which not yet means anything special), reverse
solidus ‘\’, which will escape any of the characters dollar
sign ‘$’ (to prevent variable expansion), backquote (grave ac‐
cent) ‘`’, double-quote ‘"’ (to prevent ending the quote) and
reverse solidus ‘\’ (to prevent escaping, i.e., to embed a re‐
verse solidus character as-is), but has no special meaning oth‐
erwise.
• Arguments enclosed in ‘$'dollar-single-quotes'’ extend normal
single quotes in that reverse solidus escape sequences are ex‐
panded as follows:
‘\a’ bell control character (ASCII and ISO-10646 BEL).
‘\b’ backspace control character (ASCII and ISO-10646 BS).
‘\E’ escape control character (ASCII and ISO-10646 ESC).
‘\e’ the same.
‘\f’ form feed control character (ASCII and ISO-10646 FF).
‘\n’ line feed control character (ASCII and ISO-10646 LF).
‘\r’ carriage return control character (ASCII and ISO-10646
CR).
‘\t’ horizontal tabulator control character (ASCII and
ISO-10646 HT).
‘\v’ vertical tabulator control character (ASCII and
ISO-10646 VT).
‘\\’ emits a reverse solidus character.
‘\'’ single quote.
‘\"’ double quote (escaping is optional).
‘\NNN’ eight-bit byte with the octal value ‘NNN’ (one to three
octal digits), optionally prefixed by an additional
‘0’. A 0 byte will suppress further output for the
quoted argument.
‘\xHH’ eight-bit byte with the hexadecimal value ‘HH’ (one or
two hexadecimal characters, no prefix, see vexpr). A 0
byte will suppress further output for the quoted argu‐
ment.
‘\UHHHHHHHH’
the Unicode / ISO-10646 character with the hexadecimal
codepoint value ‘HHHHHHHH’ (one to eight hexadecimal
characters) — note that Unicode defines the maximum
codepoint ever to be supported as ‘0x10FFFF’ (in planes
of ‘0xFFFF’ characters each). This escape is only sup‐
ported in locales that support Unicode (see Character
sets), in other cases the sequence will remain unex‐
panded unless the given code point is ASCII compatible
or (if the [Option]al character set conversion is
available) can be represented in the current locale.
The character NUL will suppress further output for the
quoted argument.
‘\uHHHH’
Identical to ‘\UHHHHHHHH’ except it takes only one to
four hexadecimal characters.
‘\cX’ Emits the non-printable (ASCII and compatible) C0 con‐
trol codes 0 (NUL) to 31 (US), and 127 (DEL). Print‐
able representations of ASCII control codes can be cre‐
ated 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, e.g., 7 (BEL): ‘7 + 64 = 71
= G’. The real operation is a bitwise logical XOR with
64 (bit 7 set, see vexpr), thus also covering code 127
(DEL), which is mapped to 63 (question mark):
‘? vexpr ^ 127 64’.
Whereas historically circumflex notation has often been
used for visualization purposes of control codes, e.g.,
‘^G’, the reverse solidus notation has been standard‐
ized: ‘\cG’. Some control codes also have standardized
(ISO-10646, ISO C) aliases, as shown above (e.g., ‘\a’,
‘\n’, ‘\t’): whenever such an alias exists it will be
used for display purposes. The control code NUL
(‘\c@’, 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 con‐
text, the remains of all arguments for the current com‐
mand.
‘\$NAME’
Non-standard extension: expand the given variable name,
as above. Brace enclosing the name is supported.
‘\`{command}’
Not yet supported, just to raise awareness: Non-stan‐
dard extension.
Caveats:
? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment
? echo Quotes ${HOME} and tokens differ! # comment
? echo Don"'"t you worry$'\x21' The sun shines on us. $'\u263A'
Message list arguments
Many commands operate on message list specifications, as documented in
Specifying messages. The argument input is first split into individual
tokens via Shell-style argument quoting, which are then interpreted as
the mentioned specifications. If no explicit message list has been spec‐
ified, 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 verbose output of the command list will in‐
dicate whether a command searches for a default message, or not.
Raw data arguments for codec commands
A special set of commands, which all have the string “codec” in their
name, e.g., addrcodec, shcodec, urlcodec, take raw string data as input,
which means that the content of the command input line is passed com‐
pletely 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
evaluated first, e.g.,
? vput shcodec res encode /usr/Schönes Wetter/heute.txt
? echo $res
$'/usr/Sch\u00F6nes Wetter/heute.txt'
? shcodec d $res
$'/usr/Sch\u00F6nes Wetter/heute.txt'
? eval shcodec d $res
/usr/Schönes Wetter/heute.txt
Filename transformations
Filenames, where expected, and unless documented otherwise, are subse‐
quently subject to the following filename transformations, in sequence:
• If the given name is a registered shortcut, it will be replaced
with the expanded shortcut.
• The filename is matched against the following patterns or
strings:
# (Number sign) is expanded to the previous file.
% (Percent sign) is replaced by the invoking user's pri‐
mary system mailbox, which either is the (itself expand‐
able) inbox if that is set, the standardized absolute
pathname indicated by MAIL if that is set, or a built-in
compile-time default otherwise.
%user Expands to the primary system mailbox of user (and never
the value of inbox, regardless of its actual setting).
& (Ampersand) is replaced with the invoking user's sec‐
ondary mailbox, the MBOX.
+file Refers to a file in the folder directory (if that vari‐
able is set).
%:filespec Expands to the same value as filespec, but has spe‐
cial meaning when used with, e.g., the command file: the
file will be treated as a primary system mailbox by,
e.g., the mbox and save commands, meaning that messages
that have been read in the current session will be moved
to the MBOX mailbox instead of simply being flagged as
read.
• Meta expansions may be applied to the resulting filename, as
allowed by the operation and applicable to the resulting access
protocol (also see On URL syntax and credential lookup). For
the file-protocol, a leading tilde ‘~’ character will be re‐
placed by the expansion of HOME, except when followed by a
valid user name, in which case the home directory of the given
user is used instead.
A shell expansion as if specified in double-quotes (see
Shell-style argument quoting) may be applied, so that any oc‐
currence of ‘$VARIABLE’ (or ‘${VARIABLE}’) will be replaced by
the expansion of the variable, if possible; INTERNAL VARIABLES
as well as ENVIRONMENT (shell) variables can be accessed
through this mechanism.
Shell pathname wildcard pattern expansions (glob(7)) may be ap‐
plied as documented. If the fully expanded filename results in
multiple pathnames and the command is expecting only one file,
an error results.
In interactive context, in order to allow simple value accep‐
tance (via “ENTER”), arguments will usually be displayed in a
properly quoted form, e.g., a file ‘diet\ is \curd.txt’ may be
displayed as ‘'diet\ is \curd.txt'’.
Commands
The following commands are available:
! Executes the SHELL command which follows, replacing unescaped
exclamation marks with the previously executed command if the
internal variable bang is set. This command supports vput as
documented in Command modifiers, and manages the error number
!. A 0 or positive exit status ? 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, e.g., due to a signal: the error number is ^ERR-CHILD,
then.
In conjunction with the 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
^ERR-NOTSUP error that should otherwise not occur.
^ERR-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 ^ERR-NOMEM will occur and
Mail will try to store the empty string, just like with all
other detected error conditions.
# The comment-command causes the entire line to be ignored.
Note: this really is a normal command which' purpose is to dis‐
card its arguments, not a “comment-start” indicating special
character, which means that, e.g., trailing comments on a line
are not possible (except for commands which use Shell-style
argument quoting).
+ Goes to the next message in sequence and types it (like
“ENTER”).
- Display the preceding message, or the n'th previous message if
given a numeric argument n.
= Shows the message number of the current message (the “dot”)
when used without arguments, that of the given list otherwise.
Output numbers will be separated from each other with the first
character of ifs, and followed by the first character of if-ws,
if that is not empty and not identical to the first. If that
results in no separation at all a space character is used.
This command supports vput (see Command modifiers), and manages
the error number !.
? [Option] Show a brief summary of commands. [Option] Given an
argument a synopsis for the command in question is shown in‐
stead; commands can be abbreviated in general and this command
can be used to see the full expansion of an abbreviation in‐
cluding the synopsis, try, e.g., ‘?h’, ‘?hel’ and ‘?help’ and
see how the output changes. This mode also supports a more
verbose output, which will provide the information documented
for list.
| A synonym for the pipe command.
account, unaccount
(ac, una) Creates, selects or lists (an) account(s). Accounts
are special incarnations of defined macros and group commands
and variable settings which together usually arrange the envi‐
ronment for the purpose of creating an email account. Differ‐
ent to normal macros settings which are covered by localopts –
here by default enabled! – will not be reverted before the
account is changed again. The special account ‘null’ (case-in‐
sensitive) always exists, and all but it can be deleted by the
latter command, and in one operation with the special name ‘*’.
Also for all but it a possibly set on-account-cleanup hook is
called once they are left, including program exit.
Without arguments a listing of all defined accounts is shown.
With one argument the given account is activated: the system
inbox of that account will be activated (as via file), a possi‐
bly installed folder-hook will be run, and the internal vari‐
able account will be updated. The two argument form is identi‐
cal to defining a macro as via define:
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
}
addrcodec
Perform email address codec transformations on raw-data argu‐
ment, rather according to email standards (RFC 5322; [v15 be‐
haviour may differ] will furtherly improve). Supports vput
(see Command modifiers), and manages the error number !. The
first argument must be either [+[+[+]]]e[ncode], d[ecode],
s[kin] or skinl[ist] and specifies the operation to perform on
the rest of the line.
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,
“double-quoted” strings, or quoted-pairs, as below, become in‐
volved. [v15 behaviour may differ] Mail currently does not
perform decoding when displaying addresses.
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 ! set to
^ERR-INVAL if decoding fails to find a(n) (valid) email ad‐
dress, in which case the unmodified input will be output again.
skinlist first performs a skin operation, and thereafter checks
a valid address for whether it is a registered mailing list
(see mlist and mlsubscribe), eventually reporting that state in
the error number ! as ^ERR-EXIST. (This state could later be‐
come overwritten by an I/O error, though.)
Encoding supports four different modes, lesser automated ver‐
sions 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 ‘\’ 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 re‐
ported ([v15 behaviour may differ] the current parser fails
this assertion for some constructs). [v15 behaviour may dif‐
fer] Addresses need to be specified in between angle brackets
‘<’, ‘>’ if the construct becomes more difficult, otherwise the
current parser will fail; it is not smart enough to guess
right.
? addrc enc "Hey, you",
COMMAND ESCAPES
Command escapes are available in compose mode, and are used to perform
special functions when composing messages. Command escapes are only rec‐
ognized at the beginning of lines, and consist of a trigger (escape), and
a command character. The actual escape character can be set via the in‐
ternal variable escape, it defaults to the tilde ‘~’. Otherwise ignored
whitespace characters following the escape character will prevent a pos‐
sible addition of the command line to the [Option]al history.
Unless otherwise noted all compose mode command escapes ensure proper up‐
dates of the variables which represent the error number ! and the exit
status ?. If the variable errexit is set they will, unless stated other‐
wise, error out message compose mode and cause a program exit if an oper‐
ation fails; an effect equivalent to the command modifier ignerr can how‐
ever be achieved by placing a hyphen-minus ‘-’ after (possible whitespace
following) the escape character. If the [Option]al key bindings are
available it is possible to create bindings specifically for the compose
mode.
~~ string
Insert the string of text in the message prefaced by a single
‘~’. (If the escape character has been changed, that character
must be doubled instead.)
~! command
Execute the indicated shell command which follows, replacing
unescaped exclamation marks with the previously executed com‐
mand if the internal variable bang is set, then return to the
message.
~. End compose mode and send the message. The hooks
on-compose-splice-shell and on-compose-splice, in order, will
be called when set, after which, in interactive mode askatend
(leading to askcc, askbcc) and askattach will be checked as
well as asksend, after which a set on-compose-leave hook will
be called, autocc and autobcc will be joined in if set, finally
a given message-inject-tail will be incorporated, after which
the compose mode is left.
~: Mail-command or ~_ Mail-command
Execute the given Mail command. Not all commands, however, are
allowed.
~< filename
Identical to ~r.
~fmt(1) is
often used as a rejustifying filter.
If the first character of the command is a vertical bar, then
the entire message including header fields is subject to the
filter command, e.g., ‘~|| echo Fcc: /tmp/test; cat’ will
prepend a file-carbon-copy message header. Also see ~e, ~v.
~^ cmd [subcmd [arg3 [arg4]]]
Low-level compose mode command which shares semantics with
digmsg. Does not manage the error number ! and the exit status
?: errors are handled via the protocol, and hard errors like
I/O failures cannot be handled. The protocol consists of com‐
mand lines followed by (a) response line(s). The first field
of the response line represents a status code which specifies
whether a command was successful or not, whether result data is
to be expected, and if, the format of the result data. Error
status code lines may optionally contain additional context:
‘210’ Status ok; the remains of the line are the result.
‘211’ Status ok; the rest of the line is optionally used
for more status. What follows are lines of result
addresses, terminated by an empty line. All the in‐
put, including the empty line, must be consumed be‐
fore further commands can be issued. Address lines
consist of two fields, first the plain network ad‐
dress, e.g., ‘bob@exam.ple’, separated by a single
ASCII SP space from the full address as known, e.g.,
‘(Lovely) Bob
INTERNAL VARIABLES
Internal Mail variables are controlled via the set and unset commands; prefixing a variable name with the string ‘no’ and calling set has the same effect as using unset: ‘unset crt’ and ‘set nocrt’ do the same thing. varshow will give more insight on the given variable(s), and set, when called without arguments, will show a listing of all variables. Both commands support a more verbose listing mode. Some well-known vari‐ ables will also become inherited from the program ENVIRONMENT implicitly, others can be imported explicitly with the command environ and henceforth share said properties. 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 “set” and “unset”, and value variables with a(n op‐ tional) string value. For the latter proper quoting is necessary upon assignment time, the introduction of the section COMMANDS documents the supported quoting rules. ? wysh set one=val\ 1 two="val 2" \ three='val "3"' four=$'val \'4\''; \ varshow one two three four; \ unset one two three four 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 docu‐ mented, but otherwise any numeric format and base that is valid and un‐ derstood by the vexpr command may be used, too. There also exists a special kind of string value, the “boolean string”, which must either be a decimal integer (in which case ‘0’ is false and ‘1’ and any other value is true) or any of the (case-insensitive) strings ‘off’, ‘no’, ‘n’ and ‘false’ for a false boolean and ‘on’, ‘yes’, ‘y’ and ‘true’ for a true boolean; a special kind of boolean string is the “quadoption”, which is a boolean string that can optionally be prefixed with the (case-insensitive) term ‘ask-’, as in ‘ask-yes’, which causes prompting of the user in interactive mode, with the given boolean as the default value. Variable chains extend a plain ‘variable’ with ‘variable-HOST’ and ‘variable-USER@HOST’ variants. Here ‘HOST’ will be converted to all low‐ ercase when looked up (but not when the variable is set or unset!), [Op‐ tion]ally IDNA converted, and indeed means ‘server:port’ if a ‘port’ had been specified in the contextual Uniform Resource Locator URL, see On URL syntax and credential lookup. Even though this mechanism is based on URLs no URL percent encoding may be applied to neither of ‘USER’ nor ‘HOST’, variable chains need to be specified using raw data; the men‐ tioned section contains examples. Variables which support chains are ex‐ plicitly documented as such, and Mail treats the base name of any such variable special, meaning that users should not create custom names like ‘variable-xyz’ in order to avoid false classifications and treatment of such variables. Initial settings The standard POSIX 2008/Cor 2-2016 mandates the following initial vari‐ able settings: noallnet, noappend, asksub, noaskbcc, noautoprint, nobang, nocmd, nocrt, nodebug, nodot, escape set to ‘~’, noflipr, nofolder, header, nohold, noignore, noignoreeof, nokeep, nokeepsave, nometoo, nooutfolder, nopage, prompt set to ‘? ’, noquiet, norecord, save, nosendwait, noshowto, noSign, nosign, toplines set to ‘5’. However, Mail has built-in some initial (and some default) settings which (may) diverge, others may become adjusted by one of the Resource files. Displaying the former is accomplished via set: ‘$ mail -:/ -v -Xset -Xx’. In general this implementation sets (and has extended the meaning of) sendwait, and does not support the noonehop variable – use command line options or mta-arguments to pass options through to a mta. The default global resource file sets, among others, the variables hold, keep and keepsave, establishes a default headerpick selection etc., and should thus be taken into account. Variables ? (Read-only) The exit status of the last command, or the return value of the macro called last. This status has a meaning in the state machine: in conjunction with errexit any non-0 exit status will cause a program exit, and in posix mode any error while loading (any of the) resource files will have the same effect. ignerr, one of the Command modifiers, can be used to instruct the state machine to ignore errors. ! (Read-only) The current error number (errno(3)), which is set after an error occurred; it is also available via ^ERR, and the error name and documentation string can be queried via ^ERRNAME and ^ERRDOC. [v15 behaviour may differ] This machinery is new and the error number is only really usable if a command explic‐ itly states that it manages the variable !, for others errno will be used in case of errors, or ^ERR-INVAL if that is 0: it thus may or may not reflect the real error. The error number may be set with the command return. ^ (Read-only) This is a multiplexer variable which performs dy‐ namic expansion of the requested state or condition, of which there are: ^ERR, ^ERRDOC, ^ERRNAME The number, documentation, and name of the current errno(3), respectively, which is usually set after an error occurred. The documentation is an [Option], the name is used if not available. [v15 behaviour may differ] This machinery is new and is usually re‐ liable only if a command explicitly states that it manages the variable !, which is effectively identi‐ cal to ^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: define work { eval echo \$1: \$^ERR-$1:\ \$^ERRNAME-$1: \$^ERRDOC-$1 vput vexpr i + "$1" 1 if [ $i -lt 16 ] \xcall work $i end } call work 0 ^ERRQUEUE-COUNT, ^ERRQUEUE-EXISTS The number of messages present in the [Option]al log queue of errors, and a boolean which indicates whether the queue is not empty, respectively; both are always 0 unless features indicates ‘+errors’. * (Read-only) Expands all positional parameters (see 1), sepa‐ rated by the first character of the value of ifs. [v15 behav‐ iour may differ] The special semantics of the equally named special parameter of the sh(1) are not yet supported. @ (Read-only) Expands all positional parameters (see 1), sepa‐ rated by a space character. If placed in double quotation marks, each positional parameter is properly quoted to expand to a single parameter again. # (Read-only) Expands to the number of positional parameters, i.e., the size of the positional parameter stack in decimal. 0 (Read-only) Inside the scope of a defined and called 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 [Op‐ tion]al regular expression search and replace operator of vexpr this expands to the entire matching expression. It represents the program name in global context. 1 (Read-only) Access of the positional parameter stack. All fur‐ ther parameters can be accessed with this syntax, too, e.g., ‘2’, ‘3’ etc.; positional parameters can be shifted off the stack by calling shift. The parameter stack contains, e.g., the arguments of a called defined macro, the matching groups of the [Option]al regular expression search and replace expression of vexpr, and can be explicitly created or overwritten with the command vpospar. account (Read-only) Is set to the active account. add-file-recipients (Boolean) 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. allnet (Boolean) Causes only the local part to be evaluated when com‐ paring addresses. append (Boolean) Causes messages saved in the secondary mailbox MBOX to be appended to the end rather than prepended. This should always be set. askatend (Boolean) Causes the prompts for ‘Cc:’ and ‘Bcc:’ lists to ap‐ pear after the message has been edited. askattach (Boolean) If set, Mail asks an interactive user for files to attach at the end of each message; An empty line finalizes the list. askcc (Boolean) Causes the interactive user to be prompted for carbon copy recipients (at the end of each message if askatend or bsdcompat are set). askbcc (Boolean) Causes the interactive user to be prompted for blind carbon copy recipients (at the end of each message if askatend or bsdcompat are set). asksend (Boolean) Causes the interactive user to be prompted for con‐ firmation to send the message or reenter compose mode after having been shown an envelope summary. This is by default en‐ abled. asksign (Boolean)[Option] Causes the interactive user to be prompted if the message is to be signed at the end of each message. The smime-sign variable is ignored when this variable is set. asksub (Boolean) Causes Mail to prompt the interactive user for the subject upon entering compose mode unless a subject already ex‐ ists. attrlist A sequence of characters to display in the ‘attribute’ column of the headline as shown in the display of headers; each for one type of messages (see Message states), with the default be‐ ing ‘NUROSPMFAT+-$~’ or ‘NU *HMFAT+-$~’ if the bsdflags vari‐ able is set, in the following order: ‘N’ new. ‘U’ unread but old. ‘R’ new but read. ‘O’ read and old. ‘S’ saved. ‘P’ preserved. ‘M’ mboxed. ‘F’ flagged. ‘A’ answered. ‘T’ draft. ‘+’ [v15 behaviour may differ] start of a (collapsed) thread in threaded mode (see autosort, thread); ‘-’ [v15 behaviour may differ] an uncollapsed thread in threaded mode; only used in conjunction with -L. ‘$’ classified as spam. ‘~’ classified as possible spam. autobcc Specifies a list of recipients to which a blind carbon copy of each outgoing message will be sent automatically. autocc Specifies a list of recipients to which a carbon copy of each outgoing message will be sent automatically. autocollapse (Boolean) Causes threads to be collapsed automatically when .Ql thread Ns ed sort mode is entered (see the collapse command). autoprint (Boolean) Enable automatic typeing of a(n existing) “successive” message after delete and undelete commands, e.g., the message that becomes the new “dot” is shown automatically, as via dp or dt. autosort Causes sorted mode (see the sort command) to be entered auto‐ matically with the value of this variable as sorting method when a folder is opened, e.g., ‘set autosort=thread’. bang (Boolean) Enables the substitution of all not (reverse-solidus) escaped exclamation mark ‘!’ characters by the contents of the last executed command for the ! shell escape command and ~!, one of the compose mode COMMAND ESCAPES. If this variable is not set no reverse solidus stripping is performed. bind-timeout [Option] Terminals generate multi-byte sequences for certain forms of input, for example for function and other special keys. Some terminals however do not write these multi-byte se‐ quences as a whole, but byte-by-byte, and the latter is what Mail actually reads. This variable specifies the timeout in milliseconds that the MLE (see On terminal control and line editor) waits for more bytes to arrive unless it considers a sequence “complete”. The default is 200. bsdcompat (Boolean) Sets some cosmetical features to traditional BSD style; has the same affect as setting askatend and all other variables prefixed with ‘bsd’; it also changes the behaviour of emptystart (which does not exist in BSD). bsdflags (Boolean) Changes the letters shown in the first column of a header summary to traditional BSD style. bsdheadline (Boolean) Changes the display of columns in a header summary to traditional BSD style. bsdmsgs (Boolean) Changes some informational messages to traditional BSD style. bsdorder (Boolean) Causes the ‘Subject:’ field to appear immediately af‐ ter the ‘To:’ field in message headers and with the ~h COMMAND ESCAPES. build-cc, build-ld, build-os, build-rest (Read-only) The build environment, including the compiler, the linker, the operating system Mail has been build for, usually taken from uname(1) via ‘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 verbose output of the command version. charset-7bit The value that should appear in the ‘charset=’ parameter of ‘Content-Type:’ MIME header fields when no character set con‐ version of the message data was performed. This defaults to US-ASCII, and the chosen character set should be US-ASCII com‐ patible. charset-8bit [Option] The default 8-bit character set that is used as an im‐ plicit last member of the variable sendcharsets. This defaults to UTF-8 if character set conversion capabilities are avail‐ able, 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 ttycharset and this variable is effectively ignored. charset-unknown-8bit [Option] RFC 1428 specifies conditions when internet mail gate‐ ways shall “upgrade” the content of a mail message by using a character set with the name ‘unknown-8bit’. Because of the un‐ classified nature of this character set Mail will not be capa‐ ble to convert this character set to any other character set. If this variable is set any message part which uses the charac‐ ter set ‘unknown-8bit’ is assumed to really be in the character set given in the value, otherwise the (final) value of charset-8bit is used for this purpose. This variable will also be taken into account if a MIME type (see The mime.types files) of a MIME message part that uses the ‘binary’ character set is forcefully treated as text. cmd The default value for the pipe command. colour-disable (Boolean)[Option] Forcefully disable usage of colours. Also see the section Coloured display. colour-pager (Boolean)[Option] Whether colour shall be used for output that is paged through PAGER. Note that pagers may need special com‐ mand line options, e.g., less(1) requires the option -R and lv(1) the option -c in order to support colours. Often doing manual adjustments is unnecessary since Mail may perform ad‐ justments dependent on the value of the environment variable PAGER (see there for more). contact-mail, contact-web (Read-only) Addresses for contact per email and web, respec‐ tively, e.g., for bug reports, suggestions, or help regarding Mail. The former can be used directly: ‘? eval mail $contact-mail’. crt In a(n interactive) terminal session, then if this valued vari‐ able is set it will be used as a threshold to determine how many lines the given output has to span before it will be dis‐ played via the configured PAGER; Usage of the PAGER can be forced by setting this to the value ‘0’, setting it without a value will deduce the current height of the terminal screen to compute the threshold (see LINES, screen and stty(1)). [v15 behaviour may differ] At the moment this uses the count of lines of the message in wire format, which, dependent on the mime-encoding of the message, is unrelated to the number of display lines. (The software is old and historically the rela‐ tion was a given thing.) customhdr Define a set of custom headers to be injected into newly com‐ posed or forwarded messages. A custom header consists of the field name followed by a colon ‘:’ and the field content body. Standard header field names cannot be overwritten by a custom header. Different to the command line option -C the variable value is interpreted as a comma-separated list of custom head‐ ers: to include commas in header bodies they need to become es‐ caped with reverse solidus ‘\’. Headers can be managed more freely in compose mode via ~^. ? set customhdr='Hdr1: Body1-1\, Body1-2, Hdr2: Body2' datefield Controls the appearance of the ‘%d’ date and time format speci‐ fication of the headline variable, that is used, for example, when viewing the summary of headers. If unset, then the local receiving date is used and displayed unformatted, otherwise the message sending ‘Date:’. It is possible to assign a strftime(3) format string and control formatting, but embedding newlines via the ‘%n’ format is not supported, and will result in display errors. The default is ‘%Y-%m-%d %H:%M’, and also see datefield-markout-older. datefield-markout-older Only used in conjunction with 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 -l option of the POSIX utility ls(1). If set to the empty string, then the plain month, day and year of the ‘Date:’ will be displayed, but a strftime(3) format string to control for‐ matting can be assigned. The default is ‘%Y-%m-%d’. debug (Boolean) Enables debug messages and obsoletion warnings, dis‐ ables the actual delivery of messages and also implies norecord as well as nosave. disposition-notification-send (Boolean)[Option] Emit a ‘Disposition-Notification-To:’ header (RFC 3798) with the message. This requires the from variable to be set. dot (Boolean) When dot is set, a period ‘.’ on a line by itself during message input in (interactive or batch -#) compose mode will be treated as end-of-message (in addition to the normal end-of-file condition). This behaviour is implied in posix mode with a set ignoreeof. dotlock-disable (Boolean)[Option] Disable creation of dotlock files for MBOX databases. dotlock-ignore-error [Obsolete](Boolean)[Option] Ignore failures when creating dotlock files. Please use dotlock-disable instead. editalong If this variable is set then the editor is started automati‐ cally when a message is composed in interactive mode. If the value starts with the letter ‘v’ then this acts as if ~v, oth‐ erwise as if ~e (see COMMAND ESCAPES) had been specified. The editheaders variable is implied for this automatically spawned editor session. editheaders (Boolean) When a message is edited while being composed, its header is included in the editable text. emptystart (Boolean) When entering interactive mode Mail normally writes “No mail for user” and exits immediately if a mailbox is empty or does not exist. If this variable is set Mail starts even with an empty or non-existent mailbox (the latter behaviour furtherly depends upon bsdcompat, though). errexit (Boolean) Let each command with a non-0 exit status, including every called macro which returns a non-0 status, cause a pro‐ gram exit unless prefixed by ignerr (see Command modifiers). This also affects COMMAND ESCAPES, but which use a different modifier for ignoring the error. Please refer to the variable ? for more on this topic. escape The first character of this value defines the escape character for COMMAND ESCAPES in compose mode. The default value is the character tilde ‘~’. If set to the empty string, command es‐ capes are disabled. expandaddr If unset then file and command pipeline address targets are not allowed, and any such address will be filtered out, giving a warning message. If set then all possible recipient address specifications will be accepted, unless the optional value is more specific (also see On sending mail, and non-interactive mode). If the value contains ‘restrict’ then behaviour equals the former unless in interactive mode, or when tilde commands were enabled explicitly via -~ or -#, in which case it equals the latter, and thus allows all addressees. ‘restrict’ really acts like ‘restrict,-all,+name,+addr’, so care for ordering is‐ sues must be taken. Indeed the value is interpreted as a comma-separated list of case-insensitive strings. Hard send errors can be enforced for disallowed address types by setting ‘fail’; by default these are only filtered out. User name receivers addressing valid local users can be expanded to a network address (also see hostname) by setting ‘namehostex’. Address targets can be added and removed with a plus sign ‘+’ or hyphen-minus ‘-’ pre‐ fix, respectively: the value ‘all’ addresses all possible spec‐ ifications, ‘fcc’ whitelists targets specified via ‘Fcc:’ head‐ ers regardless of other settings, ‘file’ file targets (it in‐ cludes ‘fcc’), ‘pipe’ command pipeline targets, ‘name’ plain user names left for further expansion by the MTA (implicitly disallowed for the SMTP based mta), and ‘addr’ network ad‐ dresses. Targets are interpreted in the given order, so that ‘restrict,fail,+file,-all,+addr’ will cause hard errors for any non-network address recipient address unless running interac‐ tively or having been started with the option -~ or -#; in the latter case(s) any address may be used, then. Historically invalid network addressees were silently stripped off — shall they cause hard errors instead it must be ensured that ‘failinvaddr’ is an entry of the list (it really acts like ‘failinvaddr,+addr’). Likewise, ‘domaincheck’ (actually ‘domaincheck,+addr’) compares address domain names against a whitelist and strips off (‘fail’ for hard errors) addressees which fail this test; the domain name ‘localhost’ and the non- empty value of hostname (the real hostname otherwise) are al‐ ways whitelisted, expandaddr-domaincheck can be set to extend this list. Finally some address providers (for example -b, -c and all other command line recipients) will be evaluated as if specified within dollar-single-quotes (see Shell-style argument quoting) if the value list contains the string ‘shquote’. expandaddr-domaincheck Can be set to a comma-separated list of domain names which should be whitelisted for the evaluation of the ‘domaincheck’ mode of expandaddr. IDNA encoding is not automatically per‐ formed, addrcodec can be used to prepare the domain (of an ad‐ dress). expandargv Unless this variable is set additional mta (Mail-Transfer- Agent) arguments from the command line, as can be given after a -- separator, results in a program termination with failure status. The same can be accomplished by using the special (case-insensitive) value ‘fail’. A lesser strict variant is the otherwise identical ‘restrict’, which does accept such ar‐ guments in interactive mode, or if tilde commands were enabled explicitly by using one of the command line options -~ or -#. The empty value will allow unconditional usage. features (Read-only) String giving a list of optional features. Fea‐ tures are preceded with a plus sign ‘+’ if they are available, with a hyphen-minus ‘-’ otherwise. The output of the command version includes this information in a more pleasant output. flipr (Boolean) This setting reverses the meanings of a set of reply commands, turning the lowercase variants, which by default ad‐ dress all recipients included in the header of a message (reply, respond, followup) into the uppercase variants, which by default address the sender only (Reply, Respond, Followup) and vice versa. The commands replysender, respondsender, followupsender as well as replyall, respondall, followupall are not affected by the current setting of flipr. folder The default path under which mailboxes are to be saved: file‐ names that begin with the plus sign ‘+’ will have the plus sign replaced with the value of this variable if set, otherwise the plus sign will remain unchanged when doing Filename transformations; also see file for more on this topic, and know about standard imposed implications of outfolder. The value supports a subset of transformations itself, and if the non- empty value does not start with a solidus ‘/’, then the value of HOME will be prefixed automatically. Once the actual value is evaluated first, the internal variable folder-resolved will be updated for caching purposes. folder-hook-FOLDER, folder-hook Names a defined macro which will be called whenever a file is opened. The macro will also be invoked when new mail arrives, but message lists for commands executed from the macro only in‐ clude newly arrived messages then. localopts are activated by default in a folder hook, causing the covered settings to be reverted once the folder is left again. The specialized form will override the generic one if ‘FOLDER’ matches the file that is opened. Unlike other folder specifi‐ cations, the fully expanded name of a folder, without metachar‐ acters, is used to avoid ambiguities. However, if the mailbox resides under folder then the usual ‘+’ specification is tried in addition, e.g., if folder is “mail” (and thus relative to the user's home directory) then /home/usr1/mail/sent will be tried as ‘folder-hook-/home/usr1/mail/sent’ first, but then followed by ‘folder-hook-+sent’. folder-resolved (Read-only) Set to the fully resolved path of folder once that evaluation has occurred; rather internal. followup-to (Boolean) Controls whether a ‘Mail-Followup-To:’ header is gen‐ erated when sending messages to known mailing lists. The user as determined via from (or, if that contains multiple ad‐ dresses, sender) will be placed in there if any list addressee is not a subscribed list. Also see followup-to-honour and the commands mlist, mlsubscribe, reply and Lreply. followup-to-add-cc (Boolean) Controls whether the user will be added to the mes‐ sages' ‘Cc:’ list in addition to placing an entry in ‘Mail-Followup-To:’ (see followup-to). followup-to-honour Controls whether a ‘Mail-Followup-To:’ header is honoured when group-replying to a message via reply or Lreply. This is a quadoption; if set without a value it defaults to “yes”, and see followup-to. forward-as-attachment (Boolean) Original messages are normally sent as inline text with the forward command, and only the first part of a multi‐ part message is included. With this setting enabled messages are sent as unmodified MIME ‘message/rfc822’ attachments with all of their parts included. forward-inject-head, forward-inject-tail The strings to put before and after the text of a message with the forward command, respectively. The former defaults to ‘-------- Original Message --------\n’. Special format direc‐ tives in these strings will be expanded if possible, and if so configured the output will be folded according to quote-fold; for more please refer to quote-inject-head. These variables are ignored if the forward-as-attachment variable is set. from The address (or a list of addresses) to put into the ‘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 sys‐ tem(s) responsible for the writing of the message. According to that RFC setting the sender variable is required if from contains more than one address. Dependent on the context these addresses are handled as if they were in the list of alternates. If a file-based MTA is used, then from (or, if that contains multiple addresses, sender) can nonetheless be enforced to ap‐ pear as the envelope sender address at the MTA protocol level (the RFC 5321 reverse-path), either by using the -r command line option (with an empty argument; see there for the complete picture on this topic), or by setting the internal variable r-option-implicit. If the machine's hostname is not valid at the Internet (for ex‐ ample at a dialup machine) then either this variable or hostname ([v15-compat] a SMTP-based mta adds even more fine- tuning capabilities with smtp-hostname) have to be set: if so the message and MIME part related unique ID fields ‘Message-ID:’ and ‘Content-ID:’ will be created (except when disallowed by message-id-disable or stealthmua). fullnames (Boolean) Due to historical reasons comments and name parts of email addresses are removed by default when sending mail, re‐ plying to or forwarding a message. If this variable is set such stripping is not performed. fwdheading [Obsolete] Predecessor of forward-inject-head. header (Boolean) 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 folder. Unless in posix mode a header summary will also be displayed on folder changes. The command line option -N can be used to set noheader. headline A format string to use for the summary of headers. Format specifiers in the given string start with a percent sign ‘%’ and may be followed by an optional decimal number indicating the field width — if that is negative, the field is to be left- aligned. Names and addresses are subject to modifications ac‐ cording to showname and showto. Valid format specifiers are: ‘%%’ A plain percent sign. ‘%>’ “Dotmark”: a space character but for the current mes‐ sage (“dot”), for which it expands to ‘>’ (dependent on headline-plain). ‘%<’ “Dotmark”: a space character but for the current mes‐ sage (“dot”), for which it expands to ‘<’ (dependent on headline-plain). ‘%$’ [Option] The spam score of the message, as has been classified via the command spamrate. Shows only a replacement character if there is no spam support. ‘%a’ Message attribute character (status flag); the actual content can be adjusted by setting attrlist. ‘%d’ The date found in the ‘Date:’ header of the message when datefield is set (the default), otherwise the date when the message was received. Formatting can be controlled by assigning a strftime(3) format string to datefield (and datefield-markout-older). ‘%e’ The indenting level in ‘thread’ed sort mode. ‘%f’ The address of the message sender. ‘%i’ The message thread tree structure. (Note that this format does not support a field width, and honours headline-plain.) ‘%L’ Mailing list status: is the addressee of the message a known (mlist) or mlsubscribed mailing list? ‘%l’ The number of lines of the message, if available. ‘%m’ Message number. ‘%o’ The number of octets (bytes) in the message, if available. ‘%S’ Message subject (if any) in double quotes. ‘%s’ Message subject (if any). ‘%t’ The position in threaded/sorted order. ‘%U’ The value 0 except in an IMAP mailbox, where it ex‐ pands to the UID of the message. The default is ‘%>%a%m %-18f %16d %4l/%-5o %i%-s’, or ‘%>%a%m %20-f %16d %3l/%-5o %i%-S’ if bsdcompat is set. Also see attrlist, headline-plain and headline-bidi. 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 ex‐ tended host system support is required nonetheless, e.g., de‐ tection of the terminal character set is one precondition; and this feature only works in an Unicode (i.e., UTF-8) locale. In general setting this variable will cause Mail to encapsulate text fields that may occur when displaying headline (and some other fields, like dynamic expansions in prompt) with special Unicode control sequences; it is possible to fine-tune the ter‐ minal support level by assigning a value: no value (or any value other than ‘1’, ‘2’ and ‘3’) will make Mail 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) charac‐ ters. In addition no space on the line is reserved for these characters. Weaker support is chosen by using the value ‘1’ (Unicode 6.3, but reserve the room of two spaces for writing the control se‐ quences onto the line). The values ‘2’ and ‘3’ select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter again re‐ serves room for two spaces in addition. headline-plain (Boolean) On Unicode (UTF-8) aware terminals enhanced graphical symbols are used by default for certain entries of headline. If this variable is set only basic US-ASCII symbols will be used. history-file [Option] If a line editor is available then this can be set to name the (expandable) path of the location of a permanent history file; also see history-size. history-gabby (Boolean)[Option] Add more entries to the history as is nor‐ mally done. history-gabby-persist (Boolean)[Option] Mail's own MLE will not save the additional history-gabby entries in persistent storage unless this vari‐ able is set. On the other hand it will not loose the knowledge of whether a persistent entry was gabby or not. Also see history-file. history-size [Option] Setting this variable imposes a limit on the number of concurrent history entries. If set to the value 0 then no fur‐ ther history entries will be added, and loading and incorpora‐ tion of the history-file upon program startup can also be sup‐ pressed by doing this. Runtime changes will not be reflected before the history is saved or loaded (again). hold (Boolean) This setting controls whether messages are held in the system inbox, and it is set by default. hostname Used instead of the value obtained from uname(3) and getaddrinfo(3) as the hostname when expanding local addresses, e.g., in ‘From:’ (also see On sending mail, and non-interactive mode, e.g., for expansion of addresses that have a valid user-, but no domain name in angle brackets). If either of from or this variable is set the message and MIME part related unique ID fields ‘Message-ID:’ and ‘Content-ID:’ will be created (ex‐ cept when disallowed by message-id-disable or stealthmua). If the [Option]al IDNA support is available (see idna-disable) variable assignment is aborted when a necessary conversion fails. Setting it to the empty string will cause the normal hostname to be used, but nonetheless enables creation of said ID fields. [v15-compat] in conjunction with the built-in SMTP mta smtp-hostname also influences the results: one should produce some test messages with the desired combination of hostname, and/or from, sender etc. first. idna-disable (Boolean)[Option] Can be used to turn off the automatic conver‐ sion of domain names according to the rules of IDNA (interna‐ tionalized domain names for applications). Since the IDNA code assumes that domain names are specified with the ttycharset character set, an UTF-8 locale charset is required to represent all possible international domain names (before conversion, that is). ifs The input field separator that is used ([v15 behaviour may dif‐ fer] by some functions) to determine where to split input data. 1. Unsetting is treated as assigning the default value, ‘ \t\n’. 2. If set to the empty value, no field splitting will be performed. 3. If set to a non-empty value, all whitespace charac‐ ters are extracted and assigned to the variable ifs-ws. a. ifs-ws will be ignored at the beginning and end of input. Diverging from POSIX shells default white‐ space is removed in addition, which is owed to the entirely different line content extraction rules. b. Each occurrence of a character of ifs will cause field-splitting, any adjacent ifs-ws characters will be skipped. ifs-ws (Read-only) Automatically deduced from the whitespace charac‐ ters in ifs. ignore (Boolean) Ignore interrupt signals from the terminal while en‐ tering messages; instead echo them as ‘@’ characters and dis‐ card the current line. ignoreeof (Boolean) Ignore end-of-file conditions (‘control-D’) in com‐ pose 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 exit and quit, and message input in compose mode can only be terminated by entering a pe‐ riod ‘.’ on a line by itself or by using the ~. COMMAND ESCAPES; Setting this implies the behaviour that dot describes in posix mode. inbox If this is set to a non-empty string it will specify the user's primary system mailbox, overriding MAIL and the system-depen‐ dent default, and (thus) be used to replace ‘%’ when doing Filename transformations; also see file for more on this topic. The value supports a subset of transformations itself. indentprefix String used by the ~m, ~M and ~R COMMAND ESCAPES and by the quote option for indenting messages, in place of the POSIX man‐ dated default tabulator character ‘\t’. Also see quote-chars. keep (Boolean) If set, an empty primary system mailbox file is not removed. Note that, in conjunction with posix mode any empty file will be removed unless this variable is set. This may im‐ prove the interoperability with other mail user agents when us‐ ing a common folder directory, and prevents malicious users from creating fake mailboxes in a world-writable spool direc‐ tory. [v15 behaviour may differ] Only local regular (MBOX) files are covered, Maildir and other mailbox types will never be removed, even if empty. keep-content-length (Boolean) When (editing messages and) writing MBOX mailbox files Mail can be told to keep the ‘Content-Length:’ and ‘Lines:’ header fields that some MUAs generate by setting this variable. Since Mail does neither use nor update these non- standardized header fields (which in itself shows one of their conceptual problems), stripping them should increase interoper‐ ability in between MUAs that work with with same mailbox files. Note that, if this is not set but writebackedited, as below, is, a possibly performed automatic stripping of these header fields already marks the message as being modified. [v15 be‐ haviour may differ] At some future time Mail will be capable to rewrite and apply an mime-encoding to modified messages, and then those fields will be stripped silently. keepsave (Boolean) When a message is saved it is usually discarded from the originating folder when Mail is quit. This setting causes all saved message to be retained. line-editor-cpl-word-breaks [Option] List of bytes which are used by the mle-complete tabu‐ lator completion to decide where word boundaries exist, by de‐ fault ‘"'@=;|:’ [v15 behaviour may differ] This mechanism is yet restricted. line-editor-disable (Boolean) Turn off any line editing capabilities (from Mails POW, see On terminal control and line editor for more). line-editor-no-defaults (Boolean)[Option] Do not establish any default key binding. log-prefix Error log message prefix string (‘mail: ’). mailbox-display (Read-only) The name of the current mailbox (file), possibly abbreviated for display purposes. mailbox-resolved (Read-only) The fully resolved path of the current mailbox. mailx-extra-rc An additional startup file that is loaded as the last of the Resource files. Use this file for commands that are not under‐ stood by other POSIX mailx(1) implementations, i.e., mostly anything which is not covered by Initial settings. markanswered (Boolean) When a message is replied to and this variable is set, it is marked as having been answered. See the section Message states. mbox-fcc-and-pcc (Boolean) By default all file and pipe message receivers (see expandaddr) will be fed valid MBOX database entry message data (see file, 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. mbox-rfc4155 (Boolean) 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 ‘From_’ lines) are used instead of the stricter rules from the standard RFC 4155. This behaviour can be switched by setting this variable. This may temporarily be handy when Mail complains about invalid ‘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 ‘copy * SOME-FILE’, will perform proper, all-compatible ‘From_’ quoting for all detected messages, resulting in a valid MBOX mailbox. ([v15 behaviour may differ] The better and non- destructive approach is to re-encode invalid messages, as if it would be created anew, instead of mangling the ‘From_’ lines; this requires the structural code changes of the v15 rewrite.) Finally the variable can be unset again: define mboxfix { localopts yes; wysh set mbox-rfc4155;\ wysh File "${1}"; copy * "${2}" } call mboxfix /tmp/bad.mbox /tmp/good.mbox memdebug (Boolean) Internal development variable. (Keeps memory debug enabled even if debug is not set.) message-id-disable (Boolean) By setting this variable the generation of ‘Message-ID:’ and ‘Content-ID:’ message and MIME part headers can be completely suppressed, effectively leaving this task up to the 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 mes‐ sages without ‘Message-ID’. message-inject-head A string to put at the beginning of each new message, followed by a newline. [Obsolete] The escape sequences tabulator ‘\t’ and newline ‘\n’ are understood (use the wysh prefix when setting the variable(s) instead). message-inject-tail A string to put at the end of each new message, followed by a newline. [Obsolete] The escape sequences tabulator ‘\t’ and newline ‘\n’ are understood (use the wysh prefix when setting the variable(s) instead). Also see on-compose-leave. metoo (Boolean) Usually, when an alias expansion contains the sender, the sender is removed from the expansion. Setting this option suppresses these removals. Note that a set metoo also causes a ‘-m’ option to be passed through to the 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). mime-allow-text-controls (Boolean) When sending messages, each part of the message is MIME-inspected in order to classify the ‘Content-Type:’ and ‘Content-Transfer-Encoding:’ (see mime-encoding) that is re‐ quired to send this part over mail transport, i.e., a computa‐ tion rather similar to what the file(1) command produces when used with the ‘--mime’ option. 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 ‘text/plain’ or ‘text/html’ specification to ‘application/octet-stream’: If that actually happens a yet unset charset MIME parameter is set to ‘binary’, effectively making it impossible for the receiving MUA to automatically interpret the contents of the part. If this variable is set, and the data was unambiguously identi‐ fied as text data at first glance (by a ‘.txt’ or ‘.html’ file extension), then the original ‘Content-Type:’ will not be over‐ written. mime-alternative-favour-rich (Boolean) 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 Mail's normal visual display. (E.g., at the time of this writing some newsletters ship their full content only in the rich HTML part, whereas the plain text part only contains topic subjects.) mime-counter-evidence Normally the ‘Content-Type:’ field is used to decide how to handle MIME parts. Some MUAs, however, do not use The mime.types files (also see HTML mail and MIME attachments) or a similar mechanism to correctly classify content, but specify an unspecific MIME type (‘application/octet-stream’) even for plain text attachments. If this variable is set then Mail 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 ex‐ pected, actually a carrier of bits, best specified as a binary value, e.g., ‘0b1111’. • If bit two is set (counting from 1, decimal 2) then the de‐ tected 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 ‘+’. • 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. • If bit four is set (decimal 8) as a last resort the actual content of ‘application/octet-stream’ parts will be in‐ spected, 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). mime-encoding The MIME ‘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): ‘8bit’ (Or ‘8b’.) 8-bit transport effectively causes the raw data be passed through unchanged, but may cause problems when transferring mail messages over chan‐ nels that are not ESMTP (RFC 1869) compliant. Also, several input data constructs are not allowed by the specifications and may cause a different transfer-en‐ coding to be used. By established rules and popular demand occurrences of ‘^From_’ (see mbox-rfc4155) will be MBOXO quoted (prefixed with greater-than sign ‘>’) instead of causing a non-destructive encoding like ‘quoted-printable’ to be chosen, unless context (e.g., message signing) requires otherwise. ‘quoted-printable’ (Or ‘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, like, e.g., ISO-8859-1. The encoding will cause a large overhead for messages in other character sets: e.g., it will require up to twelve (12) bytes to en‐ code a single UTF-8 character of four (4) bytes. It is the default encoding. ‘base64’ (Or ‘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 trans‐ fer-encoding is not human readable without performing a decoding step. mime-force-sendout (Boolean)[Option] 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 ‘application/octet-stream’. Please refer to the section Character sets for the complete picture of charac‐ ter set conversion in Mail. mimetypes-load-control Can be used to control which of The mime.types files are loaded: if the letter ‘u’ is part of the option value, then the user's personal ~/.mime.types file will be loaded (if it ex‐ ists); likewise the letter ‘s’ controls loading of the system wide /etc/mime.types; directives found in the user file take precedence, letter matching is case-insensitive. If this vari‐ able is not set Mail will try to load both files. Incorpora‐ tion of the Mail-built-in MIME types cannot be suppressed, but they will be matched last (the order can be listed via mimetype). More sources can be specified by using a different syntax: if the value string contains an equals sign ‘=’ then it is instead parsed as a comma-separated list of the described letters plus ‘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 The mime.types files. Directives found in such files always take precedence (are prepended to the MIME type cache). mta Select an alternate Mail-Transfer-Agent by either specifying the full pathname of an executable (optionally prefixed with the protocol ‘file://’), or [Option]ally a SMTP aka SUBMISSION protocol URL, e.g., [v15-compat] submissions://[user[:password]@]server[:port] ([no v15-compat]: ‘[smtp://]server[:port]’.) The default has been chosen at compile time. MTA data transfers are always performed in asynchronous child processes, and without supervi‐ sion unless either the sendwait or the verbose variable is set. [Option]ally Mail can take care of expansion of the usual mta-aliases (aliases(5)). For testing purposes there is the ‘test’ pseudo-MTA, which dumps to standard output or optionally to a file, and honours mbox-fcc-and-pcc: $ echo text | mail -:/ -Smta=test -s ubject user@exam.ple $ mailwrapper(8) en‐ vironment. It will be passed command line arguments from sev‐ eral possible sources: from the variable mta-arguments if set, from the command line if given and the variable expandargv al‐ lows their use. Argument processing of the MTA will be termi‐ nated with a -- separator. The otherwise occurring implicit usage of the following MTA command line arguments can be disabled by setting the boolean variable mta-no-default-arguments (which will also disable passing -- to the MTA): -i (for not treating a line with only a dot ‘.’ character as the end of input), -m (shall the variable metoo be set) and -v (if the verbose variable is set); in con‐ junction with the -r command line option Mail will also (not) pass -f as well as possibly -F. [Option]ally Mail can send mail over SMTP aka SUBMISSION net‐ work connections to a single defined smart host by setting this variable to a SMTP or SUBMISSION URL (see On URL syntax and credential lookup). An authentication scheme can be specified via the variable chain smtp-auth. Encrypted network connec‐ tions are [Option]ally available, the section Encrypted network communication should give an overview and provide links to more information on this. Note that with some mail providers it may be necessary to set the smtp-hostname variable in order to use a specific combination of from, hostname and mta. Network com‐ munication socket timeouts are configurable, e.g., socket-connect-timeout. All generated network traffic may be proxied over the SOCKS5 server given in socks-proxy. The fol‐ lowing SMTP variants may be used: • The plain SMTP protocol (RFC 5321) that normally lives on the server port 25 and requires setting the smtp-use-starttls variable to enter a TLS encrypted session state. Assign a value like [v15-compat] ‘smtp://[user[:password]@]server[:port]’ ([no v15-compat] ‘smtp://server[:port]’) to choose this protocol. • The so-called SMTPS which is supposed to live on server port 465 and is automatically TLS secured. Unfortunately it never became a standardized protocol and may thus not be supported by your hosts network service database – in fact the port number has already been reassigned to other proto‐ cols! SMTPS is nonetheless a commonly offered protocol and thus can be chosen by assigning a value like [v15-compat] ‘smtps://[user[:password]@]server[:port]’ ([no v15-compat] ‘smtps://server[:port]’); due to the mentioned problems it is usually necessary to explicitly specify the port as ‘:465’, however. • The SUBMISSION protocol (RFC 6409) lives on server port 587 and is identically to the SMTP protocol from Mail's point of view; it requires setting smtp-use-starttls to enter a TLS secured session state; e.g., [v15-compat] ‘submission://[user[:password]@]server[:port]’. • The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is TLS secured by default. It can be chosen by assigning a value like [v15-compat] ‘submissions://[user[:password]@]server[:port]’. Due to the problems mentioned for SMTPS above and the fact that SUBMISSIONS is new and a successor that lives on the same port as the historical engineering mismanagement named SMTPS, it is usually necessary to explicitly specify the port as ‘:465’. mta-aliases [Option] If set to a valid path pointing to a text file in MTA aliases(5) format, plain ‘name’ (see expandaddr) message re‐ ceiver names are recursively expanded as a last expansion step, after the distribution lists which can be created with alias. Constraints on aliases(5) content support: only local addresses (names) which are valid usernames (‘[a-z_][a-z0-9_-]*[$]?’) are understood, and [v15 behaviour may differ] ‘:include:/file/name’ directives are not supported. By includ‐ ing ‘-name’ in the setting of expandaddr it can be asserted that only expanded names (mail addresses) are passed through to the MTA, hard errors occur otherwise. The file content is cached, but variable as well as file size and modification time changes will cause an update. mta-arguments Arguments to pass through to a file-based mta can be given via this variable, which is parsed according to Shell-style argument quoting into an array of arguments, and which will be joined onto MTA options from other sources, and then passed in‐ dividually to the MTA: ‘? wysh set mta-arguments='-t -X "/tmp/my log"'’. mta-no-default-arguments (Boolean) Unless this variable is set Mail will pass some well known standard command line options to a file-based mta (Mail- Transfer-Agent), see there for more. mta-no-receiver-arguments (Boolean) By default a file-based mta will be passed all re‐ ceiver addresses on the command line. This variable can be set to suppress any such argument. mta-argv0 Many systems use a so-called mailwrapper(8) environment to en‐ sure compatibility with sendmail(1). This works by inspecting the name that was used to invoke the mail delivery system. If this variable is set then the mailwrapper (the program that is actually executed when calling the file-based mta) will treat its contents as that name. netrc-lookup-USER@HOST, netrc-lookup-HOST, netrc-lookup (Boolean)[v15-compat][Option] Used to control usage of the user's ~/.netrc file for lookup of account credentials, as doc‐ umented in the section On URL syntax and credential lookup and for the command netrc; the section The .netrc file documents the file format. Also see netrc-pipe. netrc-pipe [v15-compat][Option] When ~/.netrc is loaded (see netrc and netrc-lookup) then Mail will read the output of a shell pipe instead of the user's ~/.netrc file if this variable is set (to the desired shell command). This can be used to, e.g., store ~/.netrc in encrypted form: ‘? set netrc-pipe='gpg -qd ~/.netrc.pgp'’. newfolders [Option] If this variable has the value ‘maildir’, newly cre‐ ated local folders will be in Maildir instead of MBOX format. newmail Checks for new mail in the current folder each time the prompt is shown. A Maildir folder must be re-scanned to determine if new mail has arrived. If this variable is set to the special value ‘nopoll’ then a Maildir folder will not be rescanned com‐ pletely, but only timestamp changes are detected. Maildir folders are [Option]al. outfolder (Boolean) Unless specified as absolute pathnames, causes the filename given in the record variable and the sender-based filenames for the Copy and Save commands to be interpreted rel‐ ative to the directory given in the folder variable rather than relative to the current directory. on-account-cleanup-ACCOUNT, on-account-cleanup Macro hook which will be called once an account is left, as the very last step before unrolling per-account localopts. This hook is run even in case of fatal errors, and it is advisable to perform only absolutely necessary actions, like cleaning up alternates, for example. The specialized form is used in favour of the generic one if found. on-compose-cleanup Macro hook which will be called after the message has been sent (or not, in case of failures), as the very last step before un‐ rolling compose mode localopts. This hook is run even in case of fatal errors, and it is advisable to perform only absolutely necessary actions, like cleaning up alternates, for example. For compose mode hooks that may affect the message content please see on-compose-enter, on-compose-leave, on-compose-splice. [v15 behaviour may differ] This hook exists because alias, alternates, commandalias, shortcut, to name a few, are neither covered by localopts nor by local: changes ap‐ plied in compose mode will continue to be in effect thereafter. on-compose-enter, on-compose-leave Macro hooks which will be called once compose mode is entered, and after composing has been finished, respectively; the exact order of the steps taken is documented for ~., one of the COMMAND ESCAPES. Context about the message being worked on can be queried via digmsg. localopts are enabled for these hooks, and changes on variables will be forgotten after the message has been sent. on-compose-cleanup can be used to perform other necessary cleanup steps. Here is an example that injects a signature via message-inject-tail; instead using on-compose-splice to simply inject the file of desire via ~< or ~'; read es;\ vput csop es substring "${es}" 0 1 if [ "$es" != 2 ] echoerr 'Cannot insert Cc: header'; echo '~x' # (no xit, macro finishs anyway) endif endif } set on-compose-splice=ocsm on-history-addition This hook will be called if an entry is about to be added to the history of the MLE, as is documented in On terminal control and line editor. It will be called with three arguments: the first is the name of the input context (see bind), the second whether the command relates to history-gabby, and the third be‐ ing the complete command line to be added. The entry will not be added to history if the hook uses a non-0 return. [v15 be‐ haviour may differ] 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 ‘shift 4’ and will then be able to access the positional param‐ eters as usual via *, #, 1 etc. 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, e.g., via localopts! on-program-exit This hook will be called when the program exits, whether via exit or quit, or because the send mode is done. on-resend-cleanup [v15 behaviour may differ] Identical to on-compose-cleanup, but is only triggered by resend. on-resend-enter [v15 behaviour may differ] Identical to on-compose-enter, but is only triggered by resend; currently there is no digmsg sup‐ port, for example. page (Boolean) If set, each message feed through the command given for pipe is followed by a formfeed character ‘\f’. password-USER@HOST, password-HOST, password [v15-compat] Variable chain that sets a password, which is used in case none has been given in the protocol and account-spe‐ cific URL; as a last resort Mail will ask for a password on the user's terminal if the authentication method requires a pass‐ word. Specifying passwords in a startup file is generally a security risk; the file should be readable by the invoking user only. password-USER@HOST [no v15-compat] (see the chain above for [v15-compat]) Set the password for ‘USER’ when connecting to ‘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. piperaw (Boolean) Send messages to the pipe command without performing MIME and character set conversions. pipe-TYPE/SUBTYPE When a MIME message part of type ‘TYPE/SUBTYPE’ (case-insensi‐ tive) is displayed or quoted, its text is filtered through the value of this variable interpreted as a shell command. Note that only parts which can be displayed inline as plain text (see copiousoutput) are displayed unless otherwise noted, other MIME parts will only be considered by and for the command mimeview. The special value question mark ‘?’ forces interpretation of the message part as plain text, e.g., ‘set pipe-application/xml=?’ will henceforth display XML “as is”. (The same could also be achieved by adding a MIME type marker with the mimetype command. And [Option]ally MIME type handlers may be defined via The Mailcap files — these directives, copiousoutput has already been used, should be referred to for further documentation. The question mark ‘?’ can in fact be used as a trigger charac‐ ter to adjust usage and behaviour of a following shell command specification more thoroughly by appending more special charac‐ ters which refer to further mailcap directives, e.g., the fol‐ lowing hypothetical command specification could be used: ? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}' ‘*’ The command produces plain text to be integrated in Mails output: copiousoutput. ‘#’ If set the handler will not be invoked when a message is to be quoted, but only when it will be displayed: x-mailx-noquote. ‘&’ Run the command asynchronously, i.e., without block‐ ing Mail: x-mailx-async. The standard output of the command will go to /dev/null. ‘!’ The command must be run on an interactive terminal, Mail will temporarily release the terminal to it: needsterminal. ‘+’ Request creation of a zero-sized temporary file, the absolute pathname of which will be made accessible via the environment variable MAILX_FILENAME_TEMPORARY: x-mailx-tmpfile. If given twice then the file will be unlinked automatically by Mail when the command loop is entered again at lat‐ est: x-mailx-tmpfile-unlink; it is an error to use automatic deletion in conjunction with x-mailx-async. ‘=’ Normally the MIME part content is passed to the han‐ dler via standard input; if this flag is set then the data will instead be written into MAILX_FILENAME_TEMPORARY (x-mailx-tmpfile-fill), the creation of which is implied; in order to cause auto‐ matic deletion of the temporary file two plus signs ‘++’ still have to be used. ‘?’ To avoid ambiguities with normal shell command con‐ tent another question mark can be used to forcefully terminate interpretation of remaining characters. (Any character not in this list will have the same effect.) Some information about the MIME part to be displayed is embed‐ ded into the environment of the shell command: MAILX_CONTENT The MIME content-type of the part, if known, the empty string otherwise. MAILX_CONTENT_EVIDENCE If 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 MAILX_CONTENT otherwise. MAILX_EXTERNAL_BODY_URL MIME parts of type ‘message/external-body access-type=url’ will store the access URL in this variable, it is empty oth‐ erwise. URL targets should not be ac‐ tivated automatically, without super‐ vision. MAILX_FILENAME The filename, if any is set, the empty string otherwise. MAILX_FILENAME_GENERATED A random string. 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. pipe-EXTENSION This is identical to pipe-TYPE/SUBTYPE except that ‘EXTENSION’ (normalized to lowercase using character mappings of the ASCII charset) names a file extension, e.g., ‘xhtml’. Handlers reg‐ istered using this method take precedence. pop3-auth-USER@HOST, pop3-auth-HOST, pop3-auth [Option][v15-compat] Variable chain that sets the POP3 authen‐ tication method. Supported are the default ‘plain’, [v15-com‐ pat] ‘oauthbearer’ (see FAQ entry But, how about XOAUTH2 / OAUTHBEARER?), as well as [v15-compat] ‘external’ and ‘externanon’ for TLS secured connections which pass a client certificate via tls-config-pairs. There may be the [Option]al method [v15-compat] ‘gssapi’. ‘externanon’ does not need any user credentials, ‘external’ and ‘gssapi’ need a user, the re‐ mains also require a password. ‘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 pop3-no-apop is set the ‘plain’ method will [Option]ally be replaced with APOP if possible (see there). pop3-bulk-load-USER@HOST, pop3-bulk-load-HOST, pop3-bulk-load (Boolean)[Option] When accessing a POP3 server Mail 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 Mail will download only complete messages from the given POP3 server(s) instead. pop3-keepalive-USER@HOST, pop3-keepalive-HOST, pop3-keepalive [Option] POP3 servers close the connection after a period of inactivity; the standard requires this to be at least 10 min‐ utes, but practical experience may vary. Setting this variable to a numeric value greater than ‘0’ causes a ‘NOOP’ command to be sent each value seconds if no other operation is performed. pop3-no-apop-USER@HOST, pop3-no-apop-HOST, pop3-no-apop (Boolean)[Option] Unless this variable is set the MD5 based ‘APOP’ authentication method will be used instead of a chosen ‘plain’ pop3-auth when connecting to a POP3 server that adver‐ tises support. The advantage of ‘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 pop3-no-apop-HOST requires [v15-compat]. pop3-use-starttls-USER@HOST, pop3-use-starttls-HOST, pop3-use-starttls (Boolean)[Option] Causes Mail to issue a ‘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 pop3-use-starttls-HOST requires [v15-compat]. posix (Boolean) This flag enables POSIX mode, which changes behaviour of Mail where that deviates from standardized behaviour. It will be set implicitly before the Resource files are loaded if the environment variable POSIXLY_CORRECT is set, and adjusting any of those two will be reflected by the other one implicitly. The following behaviour is covered and enforced by this mecha‐ nism: • In non-interactive mode, any error encountered while load‐ ing resource files during program startup will cause a pro‐ gram 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 ignerr, one of the Command modifiers, for each command which shall be allowed to fail. • alternates will replace the list of alternate addresses in‐ stead of appending to it. In addition alternates will only be honoured for any sort of message reply, and for aliases. • The variable inserting COMMAND ESCAPES ~A, ~a, ~I and ~i will expand embedded character sequences ‘\t’ horizontal tabulator and ‘\n’ line feed. [v15 behaviour may differ] For compatibility reasons this step will always be per‐ formed. • Upon changing the active file no summary of headers will be displayed even if header is set. • Setting ignoreeof implies the behaviour described by dot. • The variable keep is extended to cover any empty mailbox, not only empty primary system mailboxes: they will be re‐ moved when they are left in empty state otherwise. print-alternatives (Boolean) When a MIME message part of type ‘multipart/alternative’ is displayed and it contains a subpart of type ‘text/plain’, other parts are normally discarded. Set‐ ting this variable causes all subparts to be displayed, just as if the surrounding part was of type ‘multipart/mixed’. 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 Shell-style argument quoting). This (post-assignment, i.e., second) expansion can be used to embed status information, for example ?, !, account or mailbox-display. 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: ‘\[\E[0m\]’; a slot for coloured prompts is also available with the [Option]al command colour. Prompting may be prevented by setting this to the null string (aka ‘set noprompt’). prompt2 This string is used for secondary prompts, but is otherwise identical to prompt. The default is ‘.. ’. quiet (Boolean) Suppresses the printing of the version when first in‐ voked. quote If set a reply message is started with the quoted original mes‐ sage, the lines of which are prefixed by the value of the vari‐ able indentprefix, taking into account quote-chars and quote-fold. If set to the empty value, the quoted message will be preceded and followed by the expansions of the values of quote-inject-head and quote-inject-tail, respectively. None of the headers of the quoted message is included in the quote if the value equals ‘noheading’, and only the headers selected by the ‘type’ headerpick selection are put above the message body for ‘headers’, whereas all headers and all MIME parts are in‐ cluded for ‘allheaders’. Also see quote-as-attachment and ~Q, one of the COMMAND ESCAPES. quote-as-attachment (Boolean) Add the original message in its entirety as a ‘message/rfc822’ MIME attachment when replying to a message. Note this works regardless of the setting of quote. quote-chars Can be set to a string consisting of non-whitespace ASCII char‐ acters which shall be treated as quotation leaders, the default being ‘>|}:’. quote-fold [Option] Can be set in addition to indentprefix, and creates a more fancy quotation in that leading quotation characters (quote-chars) are compressed and overlong lines are folded. quote-fold can be set to either one, two or three (space sepa‐ rated) numeric values, which are interpreted as the maximum (goal) and the minimum line length, respectively, in a spirit rather equal to the fmt(1) program, but line- instead of para‐ graph-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 indentprefix plus some additional pad; necessary adjustments take place silently. quote-inject-head, quote-inject-tail The strings to put before and after the text of a quoted mes‐ sage, respectively. The former defaults to ‘%f wrote:\n\n’. Special format directives will be expanded if possible, and if so configured the output will be folded according to quote-fold. Format specifiers in the given strings start with a percent sign ‘%’ and expand values of the original message, unless noted otherwise. Note that names and addresses are not subject to the setting of showto. Valid format specifiers are: ‘%%’ A plain percent sign. ‘%a’ The address(es) of the sender(s). ‘%d’ The date found in the ‘Date:’ header of the message when datefield is set (the default), otherwise the date when the message was received. Formatting can be controlled by assigning a strftime(3) format string to datefield (and datefield-markout-older). ‘%f’ The full name(s) (name and address, as given) of the sender(s). ‘%i’ The ‘Message-ID:’. ‘%n’ The real name(s) of the sender(s) if there is one and showname allows usage, the address(es) otherwise. ‘%r’ The senders real name(s) if there is one, the ad‐ dress(es) otherwise. r-option-implicit (Boolean) Setting this option evaluates the contents of from (or, if that contains multiple addresses, sender) and passes the results onto the used (file-based) MTA as described for the -r option (empty argument case). recipients-in-cc (Boolean) When doing a reply, the original ‘From:’ and ‘To:’ are by default merged into the new ‘To:’. If this variable is set, only the original ‘From:’ ends in the new ‘To:’, the rest is merged into ‘Cc:’. record Unless this variable is defined, no copies of outgoing mail will be saved. If defined it gives the pathname, subject to the usual 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 saved to DEAD. The standard defines that relative (fully expanded) paths are to be interpreted relative to the current directory (cwd), to force interpretation relative to folder outfolder needs to be set in addition. record-files (Boolean) If this variable is set the meaning of record will be extended to cover messages which target only file and pipe re‐ cipients (see expandaddr). These address types will not appear in recipient lists unless add-file-recipients is also set. record-resent (Boolean) If this variable is set the meaning of record will be extended to also cover the resend and Resend commands. reply-in-same-charset (Boolean) If this variable is set Mail first tries to use the same character set of the original message for replies. If this fails, the mechanism described in Character sets is evalu‐ ated as usual. reply-strings Can be set to a comma-separated list of (case-insensitive ac‐ cording to ASCII rules) strings which shall be recognized in addition to the built-in strings as ‘Subject:’ reply message indicators – built-in are ‘Re:’, which is mandated by RFC 5322, as well as the german ‘Aw:’, ‘Antw:’, and the ‘Wg:’ which often has been seen in the wild; I.e., the separating colon has to be specified explicitly. reply-to A list of addresses to put into the ‘Reply-To:’ field of the message header. Members of this list are handled as if they were in the alternates list. replyto [Obsolete] Variant of reply-to. reply-to-honour Controls whether a ‘Reply-To:’ header is honoured when replying to a message via reply or Lreply. This is a quadoption; if set without a value it defaults to “yes”. rfc822-body-from_ (Boolean) This variable can be used to force displaying a so- called ‘From_’ line for messages that are embedded into an en‐ velope mail via the ‘message/rfc822’ MIME mechanism, for more visual convenience, also see mbox-rfc4155. save (Boolean) Enable saving of (partial) messages in DEAD upon in‐ terrupt or delivery error. screen The number of lines that represents a “screenful” of lines, used in headers summary display, from searching, message topline display and scrolling via z. If this variable is not set Mail falls back to a calculation based upon the detected terminal window size and the baud rate: the faster the termi‐ nal, the more will be shown. Overall screen dimensions and pager usage is influenced by the environment variables COLUMNS and LINES and the variable crt. searchheaders (Boolean) Expand message-list specifiers in the form ‘/x:y’ to all messages containing the substring “y” in the header field ‘x’. The string search is case insensitive. sendcharsets [Option] A comma-separated list of character set names that can be used in outgoing internet mail. The value of the variable charset-8bit is automatically appended to this list of charac‐ ter sets. If no character set conversion capabilities are com‐ piled into Mail then the only supported charset is ttycharset. Also see sendcharsets-else-ttycharset and refer to the section Character sets for the complete picture of character set con‐ version in Mail. sendcharsets-else-ttycharset (Boolean)[Option] If this variable is set, but sendcharsets is not, then Mail acts as if sendcharsets had been set to the value of the variable 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. The 8-bit fallback charset-8bit never comes into play as 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 Mail and the only supported character set is ttycharset, see Character sets). This might be a problem for scripts which use the sug‐ gested ‘LC_ALL=C’ setting, since in this case the character set is US-ASCII by definition, so that it is better to also over‐ ride ttycharset, then; and/or do something like the following in the resource file: if [ "$LC_ALL" == C ] || [ "$LC_CTYPE" == C ] unset sendcharsets-else-ttycharset end sender An address that is put into the ‘Sender:’ field of outgoing messages, quoting RFC 5322: the mailbox of the agent responsi‐ ble for the actual transmission of the message. This field should normally not be used unless the from field contains more than one address, on which case it is required. Dependent on the context this address is handled as if it were in the list of alternates. Also see -r, r-option-implicit. sendmail [Obsolete] Predecessor of mta. sendmail-arguments [Obsolete] Predecessor of mta-arguments. sendmail-no-default-arguments [Obsolete](Boolean) Predecessor of mta-no-default-arguments. sendmail-progname [Obsolete] Predecessor of mta-argv0. sendwait Sending messages to the chosen mta or to command-pipe receivers (see On sending mail, and non-interactive mode) will be per‐ formed 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 respec‐ tive program will actually run, as well as to when they will have produced output. If this variable is set then child program exit is waited for, and its exit status code is used to decide about success. Re‐ marks: 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 ‘mta’ for mta delivery, and ‘pcc’ for command-pipe re‐ ceivers. showlast (Boolean) This setting causes Mail to start at the last message instead of the first one when opening a mail folder, as well as with from and headers. showname (Boolean) Causes Mail to use the sender's real name instead of the plain address in the header field summary and in message specifications. showto (Boolean) Causes the recipient of the message to be shown in the header summary if the message was sent by the user. Sign The value backing ~A, one of the COMMAND ESCAPES. Also see message-inject-tail, on-compose-leave and on-compose-splice. sign The value backing ~a, one of the COMMAND ESCAPES. Also see message-inject-tail, on-compose-leave and on-compose-splice. signature [Obsolete] Please use on-compose-splice or on-compose-splice-shell or on-compose-leave and (if necessary) message-inject-tail instead! skipemptybody (Boolean) If an outgoing message does not contain any text in its first or only message part, do not send it but discard it silently (see also the command line option -E). smime-ca-dir, smime-ca-file [Option] Specify the location of trusted CA certificates in PEM (Privacy Enhanced Mail) for the purpose of verification of S/MIME signed messages. tls-ca-dir documents the necessary preparation steps to use the former. The set of CA certifi‐ cates which are built into the TLS library can be explicitly turned off by setting smime-ca-no-defaults, and further fine- tuning is possible via smime-ca-flags. smime-ca-flags [Option] Can be used to fine-tune behaviour of the X509 CA cer‐ tificate storage, and the certificate verification that is used. The actual values and their meanings are documented for tls-ca-flags. smime-ca-no-defaults (Boolean)[Option] Do not load the default CA locations that are built into the used to TLS library to verify S/MIME signed mes‐ sages. smime-cipher-USER@HOST, smime-cipher [Option] Specifies the cipher to use when generating S/MIME en‐ crypted messages (for the specified account). RFC 5751 man‐ dates a default of ‘aes128’ (AES-128 CBC). Possible values are (case-insensitive and) in decreasing cipher strength: ‘aes256’ (AES-256 CBC), ‘aes192’ (AES-192 CBC), ‘aes128’ (AES-128 CBC), ‘des3’ (DES EDE3 CBC, 168 bits; default if ‘aes128’ is not available) and ‘des’ (DES CBC, 56 bits). The actually available cipher algorithms depend on the crypto‐ graphic library that Mail uses. [Option] Support for more ci‐ pher algorithms may be available through dynamic loading via, e.g., EVP_get_cipherbyname(3) (OpenSSL) if Mail has been com‐ piled to support this. smime-crl-dir [Option] Specifies a directory that contains files with CRLs in PEM format to use when verifying S/MIME messages. smime-crl-file [Option] Specifies a file that contains a CRL in PEM format to use when verifying S/MIME messages. smime-encrypt-USER@HOST [Option] If this variable is set, messages send to the given receiver are encrypted before sending. The value of the vari‐ able must be set to the name of a file that contains a certifi‐ cate in PEM format. If a message is sent to multiple recipients, each of them for whom a corresponding variable is set will receive an individu‐ ally encrypted message; other recipients will continue to re‐ ceive the message in plain text unless the smime-force-encryption variable is set. It is recommended to sign encrypted messages, i.e., to also set the smime-sign vari‐ able. smime-force-encryption (Boolean)[Option] Causes Mail to refuse sending unencrypted messages. smime-sign (Boolean)[Option] S/MIME sign outgoing messages with the user's private key and include the user's certificate as a MIME at‐ tachment. 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. Also see smime-sign-cert, smime-sign-include-certs and smime-sign-digest. smime-sign-cert-USER@HOST, smime-sign-cert [Option] 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. For message signing ‘USER@HOST’ is always derived from the value of from (or, if that contains multiple addresses, sender). For the purpose of encryption the recipient's public encryption key (certificate) is expected; the command certsave can be used to save certificates of signed messages (the sec‐ tion Signed and encrypted messages with S/MIME gives some de‐ tails). This mode of operation is usually driven by the spe‐ cialized form. When decrypting messages the account is derived from the recip‐ ient fields (‘To:’ and ‘Cc:’) of the message, which are searched for addresses for which such a variable is set. Mail always uses the first address that matches, so if the same mes‐ sage is sent to more than one of the user's addresses using different encryption keys, decryption might fail. For signing and decryption purposes it is possible to use en‐ crypted keys, and the pseudo-host(s) ‘USER@HOST.smime-cert-key’ for the private key (and ‘USER@HOST.smime-cert-cert’ for the certificate stored in the same file) will be used for perform‐ ing any necessary password lookup, therefore the lookup can be automated via the mechanisms described in On URL syntax and credential lookup. For example, the hypothetical address ‘bob@exam.ple’ could be driven with a private key / certificate pair path defined in smime-sign-cert-bob@exam.ple, and needed passwords would then be looked up via the pseudo hosts ‘bob@exam.ple.smime-cert-key’ (and ‘bob@exam.ple.smime-cert-cert’). To include intermediate cer‐ tificates, use smime-sign-include-certs. smime-sign-digest-USER@HOST, smime-sign-digest [Option] Specifies the message digestto use when signing S/MIME messages. Please remember that for this use case ‘USER@HOST’ refers to the variable from (or, if that contains multiple ad‐ dresses, sender). The available algorithms depend on the used cryptographic library, but at least one usable built-in algo‐ rithm is ensured as a default. If possible the standard RFC 5751 will be violated by using ‘SHA512’ instead of the mandated ‘SHA1’ due to security concerns. Mail will try to add built-in support for the following message digests, names are case-insensitive: ‘BLAKE2b512’, ‘BLAKE2s256’, ‘SHA3-512’, ‘SHA3-384’, ‘SHA3-256’, ‘SHA3-224’, as well as the widely available ‘SHA512’, ‘SHA384’, ‘SHA256’, ‘SHA224’, and the proposed insecure ‘SHA1’, finally ‘MD5’. More digests may [Option]ally be available through dynamic loading via, e.g., the OpenSSL function EVP_get_digestbyname(3). smime-sign-include-certs-USER@HOST, smime-sign-include-certs [Option] If used, this is supposed to a consist of a comma-sep‐ arated list of files, each of which containing a single cer‐ tificate in PEM format to be included in the S/MIME message in addition to the smime-sign-cert certificate. This can be used to include intermediate certificates of the certificate author‐ ity, in order to allow the receiver's S/MIME implementation to perform a verification of the entire certificate chain, start‐ ing from a local root certificate, over the intermediate cer‐ tificates, down to the 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. For the purpose of the mechanisms involved here, ‘USER@HOST’ refers to the content of the internal variable from (or, if that contains multiple addresses, sender). The pseudo-host ‘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 mecha‐ nisms described in On URL syntax and credential lookup. smime-sign-message-digest-USER@HOST, smime-sign-message-digest [Obsolete][Option] Predecessor(s) of smime-sign-digest. smtp [Obsolete][Option] To use the built-in SMTP transport, specify a SMTP URL in mta. [v15 behaviour may differ] For compatibil‐ ity reasons a set smtp is used in preference of mta. smtp-auth-USER@HOST, smtp-auth-HOST, smtp-auth [Option] Variable chain that controls the SMTP mta authentica‐ tion method, possible values are ‘none’ ([no v15-compat] de‐ fault), ‘plain’ ([v15-compat] default), ‘login’, [v15-compat] ‘oauthbearer’ (see FAQ entry But, how about XOAUTH2 / OAUTHBEARER?) as well as [v15-compat] ‘external’ and ‘externanon’ for TLS secured connections which pass a client certificate via tls-config-pairs. There may be the [Option]al methods ‘cram-md5’ and ‘gssapi’. ‘none’ and ‘externanon’ do not need any user credentials, ‘external’ and ‘gssapi’ require a user name, and all other methods require a user name and a password. ‘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 mta. Note that smtp-auth-HOST is [v15-compat]. ([no v15-com‐ pat] Requires smtp-auth-password and smtp-auth-user. Note for smtp-auth-USER@HOST: may override dependent on sender address in the variable from.) smtp-auth-password [Option][no v15-compat] Sets the global fallback password for SMTP authentication. If the authentication method requires a password, but neither smtp-auth-password nor a matching smtp-auth-password-USER@HOST can be found, Mail will ask for a password on the user's terminal. smtp-auth-password-USER@HOST [no v15-compat] Overrides smtp-auth-password for specific val‐ ues of sender addresses, dependent upon the variable from. smtp-auth-user [Option][no v15-compat] Sets the global fallback user name for SMTP authentication. If the authentication method requires a user name, but neither smtp-auth-user nor a matching smtp-auth-user-USER@HOST can be found, Mail will ask for a user name on the user's terminal. smtp-auth-user-USER@HOST [no v15-compat] Overrides smtp-auth-user for specific values of sender addresses, dependent upon the variable from. smtp-hostname [Option][v15-compat] Normally Mail uses the variable from to derive the necessary ‘USER@HOST’ information in order to issue a ‘MAIL FROM:<>’ SMTP mta command. Setting smtp-hostname can be used to use the ‘USER’ from the SMTP account (mta or the user variable chain) and the ‘HOST’ from the content of this variable (or, if that is the empty string, hostname or the lo‐ cal hostname as a last resort). This often allows using an ad‐ dress that is itself valid but hosted by a provider other than which (in from) is about to send the message. Setting this variable also influences generated ‘Message-ID:’ and ‘Content-ID:’ header fields. If the [Option]al IDNA support is available (see idna-disable) variable assignment is aborted when a necessary conversion fails. smtp-use-starttls-USER@HOST, smtp-use-starttls-HOST, smtp-use-starttls (Boolean)[Option] Causes Mail to issue a ‘STARTTLS’ command to make an SMTP mta session TLS encrypted, i.e., to enable trans‐ port layer security. socket-connect-timeout [Option] A positive number that defines the timeout to wait for establishing a socket connection before forcing ^ERR-TIMEDOUT. socks-proxy-USER@HOST, socks-proxy-HOST, socks-proxy [Option] If this is set to the hostname (SOCKS URL) of a SOCKS5 server then Mail will proxy all of its network activities through it. This can be used to proxy SMTP, POP3 etc. network traffic through the Tor anonymizer, for example. The following would create a local SOCKS proxy on port 10000 that forwards to the machine ‘HOST’, and from which the network traffic is actu‐ ally instantiated: # Create local proxy server in terminal 1 forwarding to HOST $ ssh -D 10000 USER@HOST # Then, start a client that uses it in terminal 2 $ mail -Ssocks-proxy-USER@HOST=localhost:10000 spam-interface [Option] In order to use any of the spam-related commands (like, e.g., spamrate) the desired spam interface must be de‐ fined by setting this variable. Please refer to the manual section Handling spam for the complete picture of spam handling in Mail. All or none of the following interfaces may be avail‐ able: ‘spamc’ Interaction with spamc(1) from the spamassassin(1) (SpamAssassin: http://spamassassin.apache.org) suite. Different to the generic filter interface Mail 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 spamc-command will have been compiled into the Mail binary if spamc(1) has been found in PATH during compilation. Shall it be necessary to define a specific connection type (rather than using a configuration file for that), the variable spamc-arguments can be used as in, e.g., ‘-d server.example.com -p 783’. It is also possible to specify a per-user configuration via spamc-user. Note that this interface does not in‐ spect the ‘is-spam’ flag of a message for the command spamforget. ‘filter’ generic spam filter support via freely configurable hooks. This interface is meant for programs like bogofilter(1) and requires according behaviour in re‐ spect to the hooks' exit status for at least the com‐ mand spamrate (‘0’ meaning a message is spam, ‘1’ for non-spam, ‘2’ for unsure and any other return value indicating a hard error); since the hooks can include shell code snippets diverting behaviour can be inter‐ cepted as necessary. The hooks are spamfilter-ham, spamfilter-noham, spamfilter-nospam, spamfilter-rate and spamfilter-spam; the manual section Handling spam contains examples for some programs. The process en‐ vironment of the hooks will have the variable MAILX_FILENAME_GENERATED set. Note that spam score support for spamrate is not supported unless the [Op‐ tion]tional regular expression support is available and the spamfilter-rate-scanscore variable is set. spam-maxsize [Option] Messages that exceed this size will not be passed through to the configured spam-interface. If unset or 0, the default of 420000 bytes is used. spamc-command [Option] The path to the spamc(1) program for the ‘spamc’ spam-interface. Note that the path is not expanded, but used “as is”. A fallback path will have been compiled into the Mail binary if the executable had been found during compilation. spamc-arguments [Option] Even though Mail deals with most arguments for the ‘spamc’ spam-interface automatically, it may at least sometimes be desirable to specify connection-related ones via this vari‐ able, e.g., ‘-d server.example.com -p 783’. spamc-user [Option] Specify a username for per-user configuration files for the ‘spamc’ spam-interface. If this is set to the empty string then Mail will use the name of the current user. spamfilter-ham, spamfilter-noham, spamfilter-nospam, spamfilter-rate, spamfilter-spam [Option] Command and argument hooks for the ‘filter’ spam-interface. The manual section Handling spam contains ex‐ amples for some programs. spamfilter-rate-scanscore [Option] Because of the generic nature of the ‘filter’ spam-interface spam scores are not supported for it by default, but if the [Option]nal regular expression support is available then setting this variable can be used to overcome this re‐ striction. It is interpreted as follows: first a number (dig‐ its) is parsed that must be followed by a semicolon ‘;’ and an extended regular expression. Then the latter is used to parse the first output line of the 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. ssl-ca-dir-USER@HOST, ssl-ca-dir-HOST, ssl-ca-dir, ssl-ca-file-USER@HOST, ssl-ca-file-HOST, ssl-ca-file [Obsolete][Option] Predecessors of tls-ca-file, tls-ca-dir. ssl-ca-flags-USER@HOST, ssl-ca-flags-HOST, ssl-ca-flags [Obsolete][Option] Predecessor of tls-ca-flags. ssl-ca-no-defaults-USER@HOST, ssl-ca-no-defaults-HOST, ssl-ca-no-defaults [Obsolete](Boolean)[Option] Predecessor of tls-ca-no-defaults. ssl-cert-USER@HOST, ssl-cert-HOST, ssl-cert [Obsolete][Option] Please use the Certificate slot of tls-config-pairs. ssl-cipher-list-USER@HOST, ssl-cipher-list-HOST, ssl-cipher-list [Obsolete][Option] Please use the CipherString slot of tls-config-pairs. ssl-config-file [Obsolete][Option] Predecessor of tls-config-file. ssl-config-module-USER@HOST, ssl-config-module-HOST, ssl-config-module [Obsolete][Option] Predecessor of tls-config-module. ssl-config-pairs-USER@HOST, ssl-config-pairs-HOST, ssl-config-pairs [Obsolete][Option] Predecessor of tls-config-pairs. ssl-crl-dir, ssl-crl-file [Obsolete][Option] Predecessors of tls-crl-dir, tls-crl-file. ssl-curves-USER@HOST, ssl-curves-HOST, ssl-curves [Obsolete][Option] Please use the Curves slot of tls-config-pairs. ssl-features [Obsolete][Option](Read-only) Predecessor of tls-features. ssl-key-USER@HOST, ssl-key-HOST, ssl-key [Obsolete][Option] Please use the PrivateKey slot of tls-config-pairs. ssl-method-USER@HOST, ssl-method-HOST, ssl-method [Obsolete][Option] Please use the Protocol slot of tls-config-pairs. ssl-protocol-USER@HOST, ssl-protocol-HOST, ssl-protocol [Obsolete][Option] Please use the Protocol slot of tls-config-pairs. ssl-rand-file [Obsolete][Option] Predecessor of tls-rand-file. ssl-verify-USER@HOST, ssl-verify-HOST, ssl-verify [Obsolete][Option] Predecessor of tls-verify. stealthmua If only set without an assigned value, then this setting in‐ hibits the generation of the ‘Message-ID:’, ‘Content-ID:’ and ‘User-Agent:’ header fields that include obvious references to Mail. 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 ‘noagent’, then the mentioned ‘Message-ID:’ and ‘Content-ID:’ suppression does not occur. system-mailrc (Read-only) The compiled in path of the system wide initializa‐ tion file one of the Resource files: mail.rc. termcap ([Option]) This specifies a comma-separated list of Terminal Information Library (libterminfo, -lterminfo) and/or Termcap Access Library (libtermcap, -ltermcap) capabilities (see On terminal control and line editor, escape commas with reverse solidus) to be used to overwrite or define entries. 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. String capabilities form ‘cap=value’ pairs and are expected un‐ less noted otherwise. Numerics have to be notated as ‘cap#number’ where the number is expected in normal decimal no‐ tation. Finally, booleans do not have any value but indicate a true or false state simply by being defined or not; this indeed means that Mail does not support undefining an existing bool‐ ean. String capability values will undergo some expansions be‐ fore use: for one notations like ‘^LETTER’ stand for ‘control-LETTER’, and for clarification purposes ‘\E’ can be used to specify ‘escape’ (the control notation ‘^[’ could lead to misreadings when a left bracket follows, which it does for the standard CSI sequence); finally three letter octal se‐ quences, as in ‘\061’, are supported. To specify that a termi‐ nal supports 256-colours, and to define sequences that home the cursor and produce an audible bell, one might write: ? set termcap='Co#256,home=\E[H,bel=^G' The following terminal capabilities are or may be meaningful for the operation of the built-in line editor or Mail in gen‐ eral: am auto_right_margin: boolean which indicates if the right margin needs special treatment; the xenl capa‐ bility is related, for more see COLUMNS. clear or cl clear_screen: clear the screen and home cursor. (Will be simulated via ho plus cd.) colors or Co max_colors: numeric capability specifying the maximum number of colours. Note that Mail does not actually care about the terminal beside that, but always emits ANSI / ISO 6429 escape sequences. cr carriage_return: move to the first column in the cur‐ rent row. The default built-in fallback is ‘\r’. cub1 or le cursor_left: move the cursor left one space (non-de‐ structively). The default built-in fallback is ‘\b’. cuf1 or nd cursor_right: move the cursor right one space (non- destructively). The default built-in fallback is ‘\E[C’, which is used by most terminals. Less often occur ‘\EC’ and ‘\EOC’. ed or cd clr_eos: clear the screen. el or ce clr_eol: clear to the end of line. (Will be simu‐ lated via ch plus repetitions of space characters.) home or ho cursor_home: home cursor. hpa or ch column_address: move the cursor (to the given column parameter) in the current row. (Will be simulated via cr plus nd.) rmcup or te / smcup or ti exit_ca_mode and enter_ca_mode, respectively: exit and enter the alternative screen ca-mode, effectively turning Mail into a fullscreen application. This must be enabled explicitly by setting termcap-ca-mode. smkx or ks / rmkx or ke keypad_xmit and 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. xenl or xn eat_newline_glitch: boolean which indicates whether a newline written in the last column of an auto_right_margin indicating terminal is ignored. With it the full terminal width is available even on autowrap terminals. Many more capabilities which describe key-sequences are docu‐ mented for bind. termcap-ca-mode [Option] Allow usage of the exit_ca_mode and enter_ca_mode ter‐ minal capabilities, see termcap. Note this variable will only be queried once at program startup and can thus only be speci‐ fied in resource files or on the command line. termcap-disable [Option] Disable any interaction with a terminal control li‐ brary. If set only some generic fallback built-ins and possi‐ bly the content of termcap describe the terminal to Mail. 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. tls-ca-dir-USER@HOST, tls-ca-dir-HOST, tls-ca-dir, tls-ca-file-USER@HOST, tls-ca-file-HOST, tls-ca-file [Option] 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 di‐ rectory lookup is performed anew as a last resort whenever nec‐ essary. The CA certificate pool built into the TLS library can be disabled via tls-ca-no-defaults, further fine-tuning is pos‐ sible via tls-ca-flags. Note the directory search variant re‐ quires the certificate files to adhere special filename conven‐ tions, please see SSL_CTX_load_verify_locations(3) and verify(1) (or c_rehash(1)). tls-ca-flags-USER@HOST, tls-ca-flags-HOST, tls-ca-flags [Option] Can be used to fine-tune behaviour of the X509 CA cer‐ tificate storage, and the certificate verification that is used (also see tls-verify). The value is expected to consist of a comma-separated list of configuration directives, with any in‐ tervening whitespace being ignored. The directives directly map to flags that can be passed to X509_STORE_set_flags(3), which are usually defined in a file 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 debug). Directives currently understood (case-insensitively) include: 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 imple‐ mented; also see trusted-first. no-check-time Do not check certificate/CRL validity against current time. partial-chain By default partial, incomplete chains which cannot be verified up to the chain top, a self-signed root cer‐ tificate, will not verify. With this flag set, a chain succeeds to verify if at least one signing cer‐ tificate of the chain is in any of the configured trusted stores of CA certificates. The OpenSSL man‐ ual page SSL_CTX_load_verify_locations(3) gives some advise how to manage your own trusted store of CA certificates. strict Disable workarounds for broken certificates. 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 no-alt-chains. tls-ca-no-defaults-USER@HOST, tls-ca-no-defaults-HOST, tls-ca-no-defaults (Boolean)[Option] Do not load the default CA locations that are built into the used to TLS library to verify TLS server cer‐ tificates. tls-config-file [Option] If this variable is set CONF_modules_load_file(3) (if announced via ‘+modules-load-file’ in 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 verbose)! If a non-empty value is given then the given file, after performing 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 ‘mail’. Some TLS libraries support application-specific configuration via resource files loaded like this, please see tls-config-module. tls-config-module-USER@HOST, tls-config-module-HOST, tls-config-module [Option] If file based application-specific configuration via tls-config-file is available, announced as ‘+ctx-config’ by tls-features, indicating availability of SSL_CTX_config(3), then, it becomes possible to use a central TLS configuration file for all programs, including mail, e.g.: # Register a configuration section for mail mail = 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 # Well that actual program specific configuration section # now can map individual tls-config-module names to sections, # e.g., 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 tls-config-pairs-USER@HOST, tls-config-pairs-HOST, tls-config-pairs [Option] 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 ‘=’, any white‐ space surrounding pair members is removed. Keys are (usually) case-insensitive. Different to when placing these pairs in a tls-config-module section of a tls-config-file, commas ‘,’ need to be escaped with a reverse solidus ‘\’ when included in pairs; also different: if the equals sign ‘=’ is preceded with an asterisk ‘*’ Filename transformations will be performed on the value; it is an error if these fail. Unless proper support is announced by tls-features (‘+conf-ctx’) only the keys below are supported, otherwise the pairs will be used directly as ar‐ guments to the function SSL_CONF_cmd(3). Certificate Filename of a TLS client certificate (chain) re‐ quired by some servers. Fallback support via SSL_CTX_use_certificate_chain_file(3). Filename transformations are performed. PrivateKey will be set to the same value if not initialized ex‐ plicitly. Some services support so-called ‘external’ authentication if a TLS client cer‐ tificate was successfully presented during con‐ nection establishment (“connecting is authenticating”). CipherString A list of ciphers for TLS connections, see ciphers(1). By default no list of ciphers is set, resulting in a Protocol-specific list of ci‐ phers (the protocol standards define lists of ac‐ ceptable ciphers; possibly cramped by the used TLS library). Fallback support via SSL_CTX_set_cipher_list(3). Ciphersuites A list of ciphers used for TLSv1.3 connections, see ciphers(1). These will be joined onto the list of ciphers from CipherString. Available if tls-features announces ‘+ctx-set-ciphersuites’, as necessary via SSL_CTX_set_ciphersuites(3). Curves A list of supported elliptic curves, if applica‐ ble. By default no curves are set. Fallback support via SSL_CTX_set1_curves_list(3), if available. MaxProtocol, MinProtocol The maximum and minimum supported TLS versions, respectively. Available if tls-features an‐ nounces ‘+ctx-set-maxmin-proto’, as necessary via SSL_CTX_set_max_proto_version(3) and SSL_CTX_set_min_proto_version(3); these fallbacks use an internal parser which understands the strings ‘SSLv3’, ‘TLSv1’, ‘TLSv1.1’, ‘TLSv1.2’, ‘TLSv1.3’, and the special value ‘None’, which disables the given limit. Options Various flags to set. Fallback via SSL_CTX_set_options(3), in which case any other value but (exactly) ‘Bugs’ results in an error. PrivateKey Filename of the private key in PEM format of a TLS client certificate. If unset, the value of Certificate is used. Filename transformations are performed. Fallback via SSL_CTX_use_PrivateKey_file(3). Protocol The used TLS protocol. If tls-features announces ‘+conf-ctx’ or ‘ctx-set-maxmin-proto’ then using MaxProtocol and MinProtocol is preferable. Fall‐ back is SSL_CTX_set_options(3), driven via an in‐ ternal parser which understands the strings ‘SSLv3’, ‘TLSv1’, ‘TLSv1.1’, ‘TLSv1.2’, ‘TLSv1.3’, and the special value ‘ALL’. Multiple protocols may be given as a comma-separated list, any whitespace is ignored, an optional plus sign ‘+’ prefix enables, a hyphen-minus ‘-’ prefix disables a protocol, so that ‘-ALL, TLSv1.2’ en‐ ables only the TLSv1.2 protocol. tls-crl-dir, tls-crl-file [Option] Specify a directory / a file, respectively, that con‐ tains a CRL in PEM format to use when verifying TLS server cer‐ tificates. tls-features [Option](Read-only) This expands to a comma-separated list of the TLS library identity and optional features. Currently sup‐ ported identities are ‘libressl’ (LibreSSL) , ‘libssl-0x10100’ (OpenSSL v1.1.x series) and ‘libssl-0x10000’ (elder OpenSSL se‐ ries, other clones). Optional features are preceded with a plus sign ‘+’ when available, and with a hyphen-minus ‘-’ oth‐ erwise. Currently known features are ‘conf-ctx’ (tls-config-pairs), ‘ctx-config’ (tls-config-module), ‘ctx-set-ciphersuites’ (Ciphersuites slot of tls-config-pairs), ‘ctx-set-maxmin-proto’ (tls-config-pairs), ‘modules-load-file’ (tls-config-file), and ‘tls-rand-file’ (tls-rand-file). tls-fingerprint-USER@HOST, tls-fingerprint-HOST, tls-fingerprint [Option] It is possible to replace the verification of the con‐ nection peer certificate against the entire local pool of CAs (for more see Encrypted network communication) with the compar‐ ison against a precalculated certificate message digest, the so-called fingerprint, to be specified as the used tls-fingerprint-digest. This fingerprint can be calculated with, e.g., ‘tls fingerprint HOST’. tls-fingerprint-digest-USER@HOST, tls-fingerprint-digest-HOST, tls-fingerprint-digest [Option] The message digest to be used when creating TLS cer‐ tificate fingerprints, the defaults, if available, in test or‐ der, being ‘BLAKE2s256’, ‘SHA256’. For the complete list of digest algorithms refer to smime-sign-digest. tls-rand-file [Option] If tls-features announces ‘+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 RAND_load_file(3). The default filename (RAND_file_name(3), normally ~/.rnd) will be used if this vari‐ able is not set or empty, or if the Filename transformations fail. Shall seeding the PRNG have been successful, RAND_write_file(3) will be called to update the entropy. Re‐ marks: libraries which do not announce this feature seed the PRNG by other means. tls-verify-USER@HOST, tls-verify-HOST, tls-verify [Option] 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 tls-ca-dir, tls-ca-file, or the TLS library built-in defaults (unless usage disallowed via tls-ca-no-defaults), and as fine-tuned via tls-ca-flags. Valid (case-insensitive) values are ‘strict’ (fail and close connection immediately), ‘ask’ (ask whether to continue on standard input), ‘warn’ (show a warning and con‐ tinue), ‘ignore’ (do not perform validation). The default is ‘ask’. toplines If defined, gives the number of lines of a message to be dis‐ played with the command top; if unset, the first five lines are printed, if set to 0 the variable screen is inspected. If the value is negative then its absolute value will be used for un‐ signed right shifting (see vexpr) the screen height. topsqueeze (Boolean) If set then the top command series will strip adja‐ cent empty lines and quotations. ttycharset The character set of the terminal Mail operates on, and the one and only supported character set that Mail can use if no char‐ acter 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 (e.g., LC_CTYPE, see there for more); runtime locale changes will be reflected by ttycharset except during the pro‐ gram startup phase and if -S had been used to freeze the given value. Refer to the section Character sets for the complete picture about character sets. typescript-mode (Boolean) A special multiplex variable that disables all vari‐ ables and settings which result in behaviour that interferes with running Mail in script(1), e.g., it sets colour-disable, line-editor-disable and (before startup completed only) termcap-disable. Unsetting it does not restore the former state of the covered settings. umask For a safe-by-default policy the process file mode creation mask umask(2) will be set to ‘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. user-HOST, user [v15-compat] Variable chain that sets a global fallback user name, used in case none has been given in the protocol and ac‐ count-specific URL. This variable defaults to the name of the user who runs Mail. v15-compat Enable upward compatibility with Mail 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 wysh is implied and thus enforces Shell-style argument quoting over Old-style argument quoting for all commands which support both. This manual uses [v15-compat] and [no v15-compat] to refer to the new and the old way of doing things, respectively. verbose (Boolean) This setting, also controllable via the command line option -v, causes Mail to be more verbose, e.g., it will dis‐ play obsoletion warnings and TLS certificate chains. Even though marked (Boolean) this option may be set up to three times in order to increase the level of verbosity, higher lev‐ els show details of the actual message delivery, protocol con‐ versations and even variable lookups; a single unset verbose is sufficient to disable verbosity as such. version, version-date, version-hexnum, version-major, version-minor, version-update (Read-only) Mail 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 ma‐ jor, followed by the minor and update version numbers which oc‐ cupy 12 bits each. The latter three variables contain only decimal digits: the major, minor and update version numbers. The output of the command version will include this informa‐ tion. writebackedited If this variable is set messages modified using the edit or visual commands are written back to the current folder when it is quit; it is only honoured for writable folders in MBOX for‐ mat, 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 mbox-rfc4155 ‘From_’ quoting of newly added or edited content is also left as an exercise to the user.
ENVIRONMENT
The term “environment variable” should be considered an indication that these variables are either standardized as vivid parts of process envi‐ ronments, or that they are commonly found in there. The process environ‐ ment is inherited from the sh(1) once Mail is started, and unless other‐ wise explicitly noted handling of the following variables transparently integrates into that of the INTERNAL VARIABLES from Mail's point of view. This means that, e.g., they can be managed via set and unset, causing au‐ tomatic program environment updates (to be inherited by newly created child processes). In order to integrate other environment variables equally they need to be imported (linked) with the command 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 COLUMNS environment variable for Mail only, and beforehand exports the EDITOR in order to affect any further processing in the running shell: $ EDITOR="vim -u ${HOME}/.vimrc" $ export EDITOR $ COLUMNS=80 mail -R COLUMNS The user's preferred width in column positions for the terminal screen. Queried and used once on program startup in interac‐ tive or batch (-#) mode, actively managed for child processes and the MLE (see On terminal control and line editor) in inter‐ active mode thereafter. Non-interactive mode always uses, and the fallback default is a compile-time constant, by default 80 columns. If in batch mode COLUMNS and 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 sh(1) manages these vari‐ ables, and unsets them for pipe specifications etc.) DEAD The name of the (mailbox) file to use for saving aborted mes‐ sages if save is set; this defaults to ~/dead.letter. If the variable debug is set no output will be generated, otherwise the contents of the file will be replaced. EDITOR Pathname of the text editor to use for the edit command and ~e (see COMMAND ESCAPES); VISUAL is used for a more display ori‐ ented editor. 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 ex‐ ist, is not accessible or cannot be read; it will always be used for the root user. (No test for being writable is per‐ formed to allow usage by non-privileged users within read-only jails, but dependent on the variable settings this directory is a default write target, e.g., for DEAD, MBOX and more.) LC_ALL, LC_CTYPE, LANG [Option] The (names in lookup order of the) locale(7) (and / or see setlocale(3)) which indicates the used Character sets. Runtime changes trigger automatic updates of the entire locale system, which includes updating ttycharset (except during startup if the variable has been frozen via -S). LINES The user's preferred number of lines for the terminal screen. The behaviour is as described for COLUMNS, yet the compile-time constant used in non-interactive mode and as a fallback de‐ faults to 24 (lines). LISTER Pathname of the directory lister to use in the folders command when operating on local mailboxes. Default is ls(1) (path search through SHELL). LOGNAME Upon startup Mail will actively ensure that this variable refers to the name of the user who runs Mail, in order to be able to pass a verified name to any newly created child process. MAIL Is used as the user's primary system mailbox unless inbox is set. This is assumed to be an absolute pathname. If this en‐ vironmental fallback is also not set, a built-in compile-time default is used. MAILCAPS [Option] Overrides the default path search for The Mailcap files, which is defined in the standard RFC 1524 as ‘~/.mailcap:/etc/mailcap:/usr/etc/mailcap: /usr/local/etc/mailcap’. (Mail makes it a configuration op‐ tion, however.) Note this is not a search path, but a path search. MAILRC Is used as a startup file instead of ~/.mailrc if set. In or‐ der to avoid side-effects from configuration files scripts should either set this variable to /dev/null or the -: command line option should be used. MAILX_NO_SYSTEM_RC If this variable is set then reading of mail.rc (aka system-mailrc) at startup is inhibited, i.e., the same effect is achieved as if Mail had been started up with the option -: (and according argument) or -n. This variable is only used when it resides in the process environment. MBOX The name of the user's secondary mailbox file. A logical sub‐ set of the special Filename transformations (also see file) are supported. The default is ~/mbox. Traditionally this MBOX is used as the file to save messages from the primary system mailbox that have been read. Also see Message states. NETRC [v15-compat][Option] This variable overrides the default loca‐ tion of the user's ~/.netrc file. PAGER Pathname of the program to use for backing the command more, and when the crt variable enforces usage of a pager for output. The default paginator is more(1) (path search through SHELL). Mail inspects the contents of this variable: if its contains the string “less” then a non-existing environment variable LESS will be set to ‘Ri’, likewise for “lv” LV will optionally be set to ‘-c’. Alse see colour-pager. PATH A colon-separated list of directories that is searched by the shell when looking for commands, e.g., ‘/bin:/usr/bin:/usr/local/bin’. POSIXLY_CORRECT This variable is automatically looked for upon startup, see posix for more. SHELL The shell to use for the commands !, shell, the ~! COMMAND ESCAPES and when starting subprocesses. A default shell is used if this environment variable is not defined. 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 Mail to a reproducible mode (https://reproducible-builds.org) which uses deterministic random numbers, a special fixated pseudo LOGNAME and more. This operation mode is used for de‐ velopment and by software packagers. [v15 behaviour may dif‐ fer] Currently an invalid setting is only ignored, rather than causing a program abortion. $ SOURCE_DATE_EPOCH=`date +%s` mail TERM [Option] The terminal type for which output is to be prepared. For extended colour and font control please refer to Coloured display, and for terminal management in general to On terminal control and line editor. TMPDIR Except for the root user this variable defines the directory for temporary files to be used instead of /tmp (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 Mail will ensure at startup that this environment variable is updated to contain a usable temporary directory. USER Identical to LOGNAME (see there), but this variable is not standardized, should therefore not be used, and is only cor‐ rected if already set. VISUAL Pathname of the text editor to use for the visual command and ~v (see COMMAND ESCAPES); EDITOR is used for a less display oriented editor.
FILES
~/.mailrc User-specific file giving initial commands, one of the Resource files. The actual value is read from MAILRC. mail.rc System wide initialization file, one of the Resource files. The actual value is read from system-mailrc. ~/.mailcap [Option] Personal MIME type handler definition file, see The Mailcap files. This location is part of the RFC 1524 standard search path, which is a configuration option and can be over‐ ridden via MAILCAPS. /etc/mailcap [Option] System wide MIME type handler definition file, see The Mailcap files. This location is part of the RFC 1524 standard search path, which is a configuration option and can be over‐ ridden via ~/mbox The default value for MBOX. ~/.mime.types Personal MIME types, see The mime.types files. /etc/mime.types System wide MIME types, see The mime.types files. ~/.netrc [v15-compat][Option] The default location of the user's .netrc file – the section The .netrc file documents the file format. The actually used path can be overridden via NETRC. /dev/null The data sink null(4). Resource files Upon startup Mail reads in several resource files, in order: mail.rc System wide initialization file (system-mailrc). Reading of this file can be suppressed, either by using the -: (and ac‐ cording argument) or -n command line options, or by setting the ENVIRONMENT variable MAILX_NO_SYSTEM_RC. ~/.mailrc File giving initial commands. A different file can be chosen by setting the ENVIRONMENT variable MAILRC. Reading of this file can be suppressed with the -: command line option. 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 under‐ stood by other mailx(1) implementations, for example. This variable is only honoured when defined in a resource file, e.g., it is one of the INTERNAL VARIABLES. The content of these files is interpreted as follows: • The whitespace characters space, tabulator and newline, as well as those defined by the variable ifs, are removed from the beginning and end of input lines. • Empty lines are ignored. • Any other line is interpreted as a command. It may be spread over multiple input lines if the newline character is “escaped” by placing a reverse solidus character ‘\’ 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. • If the line (content) starts with the number sign ‘#’ 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!) Unless Mail is about to enter interactive mode syntax errors that occur while loading these files are treated as errors and cause program exit. More files with syntactically equal content can be sourceed. The follow‐ ing, saved in a file, would be an examplary content: # This line is a comment command. And y\ es, it is really continued here. set debug \ verbose set editheaders The mime.types files As stated in HTML mail and MIME attachments Mail needs to learn about MIME (Multipurpose Internet Mail Extensions) media types in order to classify message and attachment content. One source for them are mime.types files, the loading of which can be controlled by setting the variable mimetypes-load-control. Another is the command mimetype, which also offers access to Mails MIME type cache. mime.types files have the following syntax: type/subtype extension [extension ...] # E.g.: text/html html htm where ‘type/subtype’ define the MIME media type, as standardized in RFC 2046: ‘type’ is used to declare the general type of data, while the ‘subtype’ specifies a specific format for that type of data. One or mul‐ tiple filename ‘extension’s, separated by whitespace, can be bound to the media type format. Comments may be introduced anywhere on a line with a number sign ‘#’, causing the remaining line to be discarded. Mail also supports an extended, non-portable syntax in especially crafted files, which can be loaded via the alternative value syntax of mimetypes-load-control, and prepends an optional ‘type-marker’: [type-marker ]type/subtype extension [extension ...] The following type markers are supported: ? Treat message parts with this content as plain text. ?t The same as plain ?. ?h Treat message parts with this content as HTML tagsoup. If the [Option]al HTML-tagsoup-to-text converter is not available treat the content as plain text instead. ?H Likewise ?h, but instead of falling back to plain text require an explicit content handler to be defined. ?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. Further reading: for sending messages: mimetype, mime-allow-text-controls, mimetypes-load-control. For reading etc. mes‐ sages: HTML mail and MIME attachments, The Mailcap files, mimetype, mime-counter-evidence, mimetypes-load-control, pipe-TYPE/SUBTYPE, pipe-EXTENSION. The Mailcap files This feature is not available in v14.9.0, sorry! RFC 1524 defines a “User Agent Configuration Mechanism” which Mail [Option]ally supports (see HTML mail and MIME attachments). It defines a file format to be used to in‐ form 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 “mailcap” files and the MAILCAPS environment variable that can be used to overwrite that (repeating here that it is not a search path, but instead a path search specification). Any existing files will be loaded in sequence, appending any content to the list of MIME type handler directives. “Mailcap” files consist of a set of newline separated entries. Comment lines start with a number sign ‘#’ (in the first column!) and are ig‐ nored. Empty lines are also ignored. All other lines form individual entries that must adhere to the syntax described below. To extend a sin‐ gle entry (not comment) its line can be continued on follow lines if new‐ line characters are “escaped” by preceding them with the reverse solidus character ‘\’. The standard does not specify how leading whitespace of follow lines is to be treated, therefore Mail retains it. “Mailcap” entries consist of a number of semicolon ‘;’ separated fields, and the reverse solidus ‘\’ character can be used to escape any following character including semicolon and itself. 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 content is ignored (removed). The first field defines the MIME ‘TYPE/SUBTYPE’ the entry is about to handle (case-insensitively, and no reverse solidus escaping is possible in this field). If the subtype is specified as an asterisk ‘*’ the entry is meant to match all subtypes of the named type, e.g., ‘audio/*’ would match any audio type. The second field defines the shell command which shall be used to “display” MIME parts of the given type; it is implicitly called the view command. For data “consuming” shell commands message (MIME part) data is passed via standard input unless the given shell command includes one or more instances of the (unquoted) string ‘%s’, in which case these instances will be replaced with a temporary filename and the data will have been stored in the file that is being pointed to. Likewise, for data “producing” shell commands data is assumed to be generated on standard output unless the given command includes (one ore multiple) ‘%s’. In any case any given ‘%s’ format is replaced with a(n already) properly quoted filename. Note that when a command makes use of a temporary file via ‘%s’ then Mail will remove it again, as if the x-mailx-tmpfile, x-mailx-tmpfile-fill and x-mailx-tmpfile-unlink flags had been set; see below for more. The optional fields either define a shell command or an attribute (flag) value, the latter being a single word and the former being a keyword nam‐ ing the field followed by an equals sign ‘=’ succeeded by a shell com‐ mand, and as usual for any “Mailcap” content any whitespace surrounding the equals sign will be removed, too. Optional fields include the fol‐ lowing: compose A program that can be used to compose a new body or body part in the given format. (Currently unused.) composetyped Similar to the compose field, but is to be used when the com‐ posing program needs to specify the ‘Content-type:’ header field to be applied to the composed data. (Currently unused.) edit A program that can be used to edit a body or body part in the given format. (Currently unused.) print A program that can be used to print a message or body part in the given format. (Currently unused.) test Specifies a program to be run to test some condition, e.g., 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 x-mailx-test-once. needsterminal This flag field indicates that the given shell command must be run on an interactive terminal. Mail 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 x-mailx-noquote. copiousoutput A flag field which indicates that the output of the view com‐ mand will be an extended stream of textual output that can be (re)integrated into Mail's normal visual display. It is mutu‐ ally exclusive with needsterminal. textualnewlines A flag field which indicates that this type of data is line- oriented and that, if encoded in ‘base64’, all newlines should be converted to canonical form (CRLF) before encoding, and will be in that form after decoding. (Currently unused.) nametemplate This field gives a filename format, in which ‘%s’ will be re‐ placed by a random string, the joined combination of which will be used as the filename denoted by MAILX_FILENAME_TEMPORARY. One could specify that a GIF file being passed to an image viewer should have a name ending in ‘.gif’ by using ‘nametemplate=%s.gif’. Note that Mail ignores the name tem‐ plate unless that solely specifies a filename suffix that con‐ sists of (ASCII) alphabetic and numeric characters, the under‐ score and dot only. 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 Mail. description A textual description that describes this type of data. x-mailx-even-if-not-interactive An extension flag test field — by default handlers without copiousoutput are entirely ignored in non-interactive mode, but if this flag is set then their use will be considered. It is an error if this flag is set for commands that use the flag needsterminal. x-mailx-noquote An extension flag field that indicates that even a copiousoutput view command shall not be used to generate mes‐ sage quotes (as it would be by default). x-mailx-async Extension flag field that denotes that the given view command shall be executed asynchronously, without blocking Mail. Can‐ not be used in conjunction with needsterminal; the standard output of the command will go to /dev/null. x-mailx-test-once Extension flag which denotes whether the given test command shall be evaluated once only and the (boolean) result be cached. This is handy if some global unchanging condition is to be queried, like “running under the X Window System”. 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 envi‐ ronment variable MAILX_FILENAME_TEMPORARY. It is an error to use this flag with commands that include a ‘%s’ format. 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 x-mailx-tmpfile. In order to cause deletion of the temporary file you will have to set x-mailx-tmpfile-unlink explicitly! It is an error to use this flag with commands that include a ‘%s’ format. 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. (Do not use this for asynchronous handlers.) It is an error to use this flag with commands that include a ‘%s’ format, or in conjunction with x-mailx-async, or without also setting x-mailx-tmpfile or x-mailx-tmpfile-fill. x-mailx-tmpfile-keep Using the string ‘%s’ implies the three tmpfile related flags above, but if you want, e.g., x-mailx-async and deal with the temporary file yourself, you can add in this flag to forcefully ignore x-mailx-tmpfile-unlink. The standard includes the possibility to define any number of additional entry fields, prefixed by ‘x-’. Flag fields apply to the entire “Mailcap” entry — in some unusual cases, this may not be desirable, but differentiation can be accomplished via separate entries, taking advan‐ tage of the fact that subsequent entries are searched if an earlier one does not provide enough information. E.g., if a view command needs to specify the needsterminal flag, but the compose command shall not, the following will help out the latter (with enabled debug or an increased verbose level Mail will show information about handler evaluation): application/postscript; ps-to-terminal %s; needsterminal application/postscript; ps-to-terminal %s; compose=idraw %s In fields any occurrence of the format string ‘%t’ will be replaced by the ‘TYPE/SUBTYPE’ specification. Named parameters from the ‘Content-type:’ field may be placed in the command execution line using ‘%{’ followed by the parameter name and a closing ‘}’ character. The en‐ tire parameter should appear as a single command line argument, regard‐ less of embedded spaces; thus: # Message Content-type: multipart/mixed; boundary=42 # Mailcap file multipart/*; /usr/local/bin/showmulti \ %t %{boundary} ; composetyped = /usr/local/bin/makemulti # Executed shell command /usr/local/bin/showmulti multipart/mixed 42 Note that Mail does not support handlers for multipart MIME parts as shown in this example (as of today). Mail does not support the addi‐ tional formats ‘%n’ and ‘%F’. An example file, also showing how to prop‐ erly deal with the expansion of ‘%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: # Comment line text/richtext; richtext %s; copiousoutput text/x-perl; perl -cWT %s application/pdf; \ infile=%s\; \ trap "rm -f ${infile}" EXIT\; \ trap "exit 75" INT QUIT TERM\; \ mupdf %s; \ x-mailx-async; x-mailx-tmpfile-keep application/*; echo "This is \"%t\" but \ is 50 \% Greek to me" \; < %s head -c 1024 | cat -vet; \ copiousoutput; x-mailx-noquote Further reading: HTML mail and MIME attachments, The mime.types files, mimetype, MAILCAPS, mime-counter-evidence, pipe-TYPE/SUBTYPE, pipe-EXTENSION. The .netrc file The .netrc file contains user credentials for machine accounts. The de‐ fault location ~/.netrc may be overridden by the NETRC environment vari‐ able. It is possible to load encrypted .netrc files by using an appro‐ priate value in netrc-pipe. The file consists of space, tabulator or newline separated tokens. Mail implements a parser that supports a superset of the original BSD syntax, but users should nonetheless be aware of portability glitches of that file format, shall their .netrc be usable across multiple programs and platforms: • BSD does not support single, but only double quotation marks, e.g., ‘password="pass with spaces"’. • BSD (only?) supports escaping of single characters via a reverse solidus (e.g., a space can be escaped via ‘\ ’), in- as well as out‐ side of a quoted string. • BSD does not require a final quotation mark of the last user input token. • The original BSD (Berknet) parser also supported a format which al‐ lowed tokens to be separated with commas – whereas at least Hewlett- Packard still seems to support this syntax, Mail does not! • As a non-portable extension some widely-used programs support shell- style comments: if an input line starts, after any amount of white‐ space, with a number sign ‘#’, then the rest of the line is ignored. • Whereas other programs may require that the .netrc file is accessible by only the user if it contains a password token for any other login than “anonymous”, Mail will always require these strict permissions. Of the following list of supported tokens Mail only uses (and caches) machine, login and password. At runtime the command netrc can be used to control Mail's .netrc cache. machine name The hostname of the entries' machine, lowercase-normalized by Mail before use. Any further file content, until either end- of-file or the occurrence of another machine or a default first-class token is bound (only related) to the machine name. As an extension that should not be the cause of any worries Mail supports a single wildcard prefix for name: machine *.example.com login USER password PASS machine pop3.example.com login USER password PASS machine smtp.example.com login USER password PASS which would match ‘xy.example.com’ as well as ‘pop3.example.com’, but neither ‘example.com’ nor ‘local.smtp.example.com’. Note that in the example neither ‘pop3.example.com’ nor ‘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). default This is the same as 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. login name The user name on the remote machine. password string The user's password on the remote machine. account string Supply an additional account password. This is merely for FTP purposes. macdef name Define a macro. A macro is defined with the specified name; it is formed from all lines beginning with the next line and con‐ tinuing until a blank line is (consecutive newline characters are) encountered. (Note that macdef entries cannot be utilized by multiple machines, too, but must be defined following the machine they are intended to be used with.) If a macro named init exists, it is automatically run as the last step of the login process. This is merely for FTP purposes.
EXAMPLES
An example configuration # 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}" \ 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='\ CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\ Curves=P-521:P-384:P-256,\ MinProtocol=TLSv1.1' else wysh set tls-config-pairs='\ CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\ Curves=P-521:P-384:P-256,\ Protocol=-ALL\,+TLSv1.1 \, +TLSv1.2\, +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 \ 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] \ smtp-auth=login/plain... \ smtp-use-starttls # Never refuse to start into interactive mode, and more set emptystart \ colour-pager crt= \ followup-to followup-to-honour=ask-yes fullnames \ history-file=+.mailhist history-size=-1 history-gabby \ mime-counter-evidence=0b1111 \ prompt='?\$?!\$!/\$^ERRNAME[\$account#\$mailbox-display]? ' \ reply-to-honour=ask-yes \ umask= # Only include the selected header fields when typing messages headerpick type retain from_ date from to cc subject \ 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\.xyz$' '@xyzf\.xyz$' mlsubscribe '^xfans@xfans\.xyz$' # Handle a few file extensions (to store MBOX databases) filetype bz2 'bzip2 -dc' 'bzip2 -zc' \ gz 'gzip -dc' 'gzip -c' xz 'xz -dc' 'xz -zc' \ zst 'zstd -dc' 'zstd -19 -zc' \ 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" \ # 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 { \call 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 \ hostname=yaXXex.com smtp-hostname= } account XandeX { \call 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=$'?*#++=?\ < "${MAILX_FILENAME_TEMPORARY}" awk \ -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \'\ BEGIN{done=0}\ /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\ if(done++ != 0)\ next;\ print "--- GPG --verify ---";\ system("gpg --verify " TMPFILE " 2>&1");\ print "--- GPG --verify ---";\ print "";\ next;\ }\ /^-----BEGIN PGP SIGNATURE-----/,\ /^-----END PGP SIGNATURE-----/{\ next;\ }\ {print}\ \'' print } commandalias V '\'call V When storing passwords in ~/.mailrc appropriate permissions should be set on this file with ‘$ chmod 0600 ~/.mailrc’. If the [Option]al netrc-lookup is available user credentials can be stored in the central ~/.netrc file instead; e.g., here is a different version of the example account that sets up SMTP and POP3: 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 \ smtp-hostname= hostname=yXXXXx.com set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru commandalias xp fi pop3s://pop.yXXXXx.ru } account XandeX { \call XandeX } and, in the ~/.netrc file: machine *.yXXXXx.ru login USER password PASS This configuration should now work just fine: $ echo text | mail -dvv -AXandeX -s Subject user@exam.ple S/MIME step by step [Option] The first thing that is needed for Signed and encrypted messages with S/MIME is a personal certificate, and a private key. The certifi‐ cate contains public information, in particular a name and email ad‐ dress(es), and the public key that can be used by others to encrypt mes‐ sages for the certificate holder (the owner of the private key), and to 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 previ‐ ously encrypted with the public key, and to sign messages. 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 Mail 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. $ 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 There is also https://www.CAcert.org which issues client and server cer‐ tificates to members of their community for free; their root certificate (https://www.cacert.org/certs/root.crt) is often not in the default set of trusted CA root certificates, though, which means their root certifi‐ cate has to be downloaded separately, and needs to be part of the S/MIME certificate validation chain by including it in smime-ca-dir or as a vivid member of the 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! First of all you will have to become a member of the CAcert.org commu‐ nity, 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 “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 “common name”. 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): $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem Afterwards copy-and-paste the content of “creq.pem” into the certificate- request (CSR) field of the web form on the CAcert.org website (you may need to unfold some “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-re‐ quest). You are now ready and can create your CAcert certified certifi‐ cate. Download and store or copy-and-paste it as “pub.crt”. Yay. In order to use your new S/MIME setup a combined private key/public key (certificate) file has to be created: $ cat key.pem pub.crt > ME@HERE.com.paired This is the file Mail will work with. If you have created your private key with a passphrase then Mail will ask you for it whenever a message is signed or decrypted, unless this operation has been automated as de‐ scribed in Signed and encrypted messages with S/MIME. Set the following variables to henceforth use S/MIME (setting smime-ca-file is of interest for verification only): ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \ smime-sign-cert=ME@HERE.com.paired \ smime-sign-digest=SHA512 \ smime-sign Using CRLs with S/MIME or TLS [Option] 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 is‐ sued. 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. Mail currently offers no mechanism to fetch CRLs, nor to access them on the Internet, so they have to be re‐ trieved by some external mechanism. Mail accepts CRLs in PEM format only; CRLs in DER format must be con‐ verted, like, e.g.: $ openssl crl -inform DER -in crl.der -out crl.pem To tell Mail about the CRLs, a directory that contains all CRL files (and no other files) must be created. The smime-crl-dir or tls-crl-dir vari‐ ables, respectively, must then be set to point to that directory. After that, Mail requires a CRL to be present for each CA that is used to ver‐ ify a certificate.FAQ
In general it is a good idea to turn on debug (-d) and / or verbose (-v, twice) if something does not work well. Very often a diagnostic message can be produced that leads to the problems' solution. Mail 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 Mail calls the function 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 hostname). One may have varying success by ensuring that the real host‐ name and ‘localhost’ have entries in /etc/hosts, or, more generally, that the name service is properly setup – and does hostname(1) return the ex‐ pected value? Does this local hostname have a domain suffix? RFC 6762 standardized the link-local top-level domain ‘.local’, try again after adding an (additional) entry with this extension. I cannot login to Google mail (via OAuth) Since 2014 some free service providers classify programs as “less secure” unless they use a special authentication method (OAuth 2.0) which was not standardized for non-HTTP protocol authentication token query until Au‐ gust 2015 (RFC 7628). 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 kinit(1) program, that proto‐ col 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 Mail is invoked (in interactive sessions situation may differ). Mail does not support OAuth. Because of this it is necessary to declare Mail a “less secure app” (on the providers account web page) in order to read and send mail. However, it also seems possible to take the follow‐ ing steps instead: 1. give the provider the number of a mobile phone, 2. enable “2-Step Verification”, 3. create an application specific password (16 characters), and 4. use that special password instead of the real Google account pass‐ word in Mail (for more on that see the section On URL syntax and credential lookup). But, how about XOAUTH2 / OAUTHBEARER? Following up 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, also known as XOAUTH2 and OAUTHBEARER, allows fetching a temporary access token via the web that can locally be used as a 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 pre‐ requisites for using this authentication method. The token times out and must be refreshed via the web periodically; in Kerberos / GSSAPI the lo‐ cal programs kinit(1) and kdestroy(1) offer user local control, the lat‐ ter also while offline. Before being able to use OAUTHBEARER, some hurdles must be taken. Using GMail as an example, an application (a simple name) needs to be regis‐ tered, for which credentials need to be created. This configuration step generates a “client ID” and a “client secret”. These two strings need to be saved locally in a secure way. For GMail these initial configuration steps can be performed via https://developers.google.com/identity/protocols/OAuth2 Thereafter access tokens can be requested, the program available for download do do this for a GMail account is https://github.com/google/gmail-oauth2-tools/blob/ master/python/oauth2.py: $ python oauth2.py --user=EMAIL \ --client-id=THE-ID --client-secret=THE-SECRET \ --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 $ # The last three are the actual token responses. $ # To refresh the granted token: $ python oauth2.py --user=EMAIL \ --client-id=THE-ID --client-secret=THE-SECRET \ --refresh-token=THE-REFRESH-TOKEN Mail does not (yet) offer the possibility to (lazy) expand aka run shell commandos which are embedded in variable content, or periodically run some command, therefore keeping an access token up-to-date from within it can only be performed by setting the hook on-main-loop-tick, or (for sending only) on-compose-splice. For more on authentication please see the section On URL syntax and credential lookup. Not "defunctional", but the editor key does not work It can happen that the terminal library (see On terminal control and line editor, bind, termcap) reports different codes than the terminal really sends, in which case Mail will tell that a key binding is functional, but will not be able to recognize it because the received data does not match anything expected. Especially without the [Option]al terminal capability library support one reason for this may be that the (possibly even non- existing) keypad is not turned on and the resulting layout reports the keypad control codes for the normal keyboard keys. The verbose listing of bindings will show the byte sequences that are expected. To overcome the situation, use, e.g., the program cat(1), in conjunction with the command line option -v, if available, to see the byte sequences which are actually produced by keypresses, and use the variable termcap to make Mail aware of them. E.g., the terminal this is typed on produces some false sequences, here an example showing the shifted home key: ? set verbose ? bind* # 1B 5B=[ 31=1 3B=; 32=2 48=H bind base :kHOM z0 ? x $ cat -v ^[[H $ mail -v -Stermcap='kHOM=\E[H' ? bind* # 1B 5B=[ 48=H bind base :kHOM z0 Can Mail git-send-email? Yes. Put (at least parts of) the following in your ~/.gitconfig: [sendemail] smtpserver = /usr/bin/mail 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 Patches can also be send directly, for example: $ git mail-patch HEAD^ | mail -Athe-account-you-need -t RECEIVER Howto handle stale dotlock files file sometimes fails to open MBOX mail databases because creation of dotlock files is impossible due to existing but unowned lock files. Mail does not offer an option to deal with those files, because it is consid‐ ered a site policy what counts as unowned, and what not. The site policy is usually defined by administrator(s), and expressed in the configura‐ tion of a locally installed MTA (for example Postfix ‘stale_lock_time=500s’). Therefore the suggestion: $
HISTORY
M. Douglas McIlroy writes in his article “A Research UNIX Reader: Annotated Excerpts from the Programmer's Manual, 1971-1986” that a mail(1) command already appeared in First Edition UNIX in 1971: Electronic mail was there from the start. Never satisfied with its exact behavior, everybody touched it at one time or another: to as‐ sure the safety of simultaneous access, to improve privacy, to sur‐ vive crashes, to exploit uucp, to screen out foreign freeloaders, or whatever. Not until v7 did the interface change (Thompson). Later, as mail became global in its reach, Dave Presotto took charge and brought order to communications with a grab-bag of ex‐ ternal networks (v8). BSD Mail, in large parts compatible with UNIX mail, was written in 1978 by Kurt Shoens and developed as part of the BSD UNIX distribution until 1995. The common UNIX and BSD denominator became standardized as mailx(1) in the X/Open Portability Guide Issue 2 (January 1987). After the rise of Open Source BSD variants Mail saw continuous development in the individual code forks, noticeably by Christos Zoulas in NetBSD. Based upon this Nail, later Heirloom Mailx, was developed by Gunnar Rit‐ ter in the years 2000 until 2008. Since 2012 S-nail is maintained by Steffen Nurpmeso. This man page is derived from “The Mail Reference Manual” that was originally written by Kurt Shoens. Electronic mail exchange in general is a concept even older. The earli‐ est well documented electronic mail system was part of the Compatible Time Sharing System (CTSS) at MIT, its MAIL command had been proposed in a staff planning memo at the end of 1964 and was implemented in mid-1965 when Tom Van Vleck and Noel Morris wrote the necessary code. Similar communication programs were built for other timesharing systems. One of the most ambitious and influential was Murray Turoff's EMISARI. Created in 1971 for the United States Office of Emergency Preparedness, EMISARI combined private electronic messages with a chat system, public postings, voting, and a user directory. During the 1960s it was common to connect a large number of terminals to a single, central computer. Connecting two computers together was rela‐ tively unusual. This began to change with the development of the ARPANET, the ancestor of today's Internet. In 1971 Ray Tomlinson adapted the SNDMSG program, originally developed for the University of California at Berkeley timesharing system, to give it the ability to transmit a mes‐ sage across the network into the mailbox of a user on a different com‐ puter. For the first time it was necessary to specify the recipient's computer as well as an account name. Tomlinson decided that the under‐ used commercial at ‘@’ would work to separate the two. Sending a message across the network was originally treated as a special instance of transmitting a file, and so a MAIL command was included in RFC 385 on file transfer in 1972. Because it was not always clear when or where a message had come from, RFC 561 in 1973 aimed to formalize electronic mail headers, including “from”, “date”, and “subject”. In 1975 RFC 680 described fields to help with the transmission of messages to multiple users, including “to”, “cc”, and “bcc”. In 1977 these fea‐ tures and others went from best practices to a binding standard in RFC 733. Queen Elizabeth II of England became the first head of state to send electronic mail on March 26 1976 while ceremonially opening a build‐ ing in the British Royal Signals and Radar Establishment (RSRE) in Malvern.
AUTHORS
Kurt Shoens, Edward Wang, Keith Bostic, Christos Zoulas, Gunnar Ritter.
Mail is developed by Steffen Nurpmeso
CAVEATS
[v15 behaviour may differ] Interrupting an operation via SIGINT aka ‘control-C’ from anywhere else but a command prompt is very problematic and likely to leave the program in an undefined state: many library func‐ tions cannot deal with the siglongjmp(3) that this software (still) per‐ forms; even though efforts have been taken to address this, no sooner but in v15 it will have been worked out: interruptions have not been disabled in order to allow forceful breakage of hanging network connections, for example (all this is unrelated to ignore). The SMTP and POP3 protocol support of Mail is very basic. Also, if it fails to contact its upstream SMTP server, it will not make further at‐ tempts to transfer the message at a later time (setting save and sendwait may be useful). If this is a concern, it might be better to set up a lo‐ cal SMTP server that is capable of message queuing.
BUGS
When a network-based mailbox is open, directly changing to another net‐ work-based mailbox of a different protocol (i.e., from POP3 to IMAP or vice versa) will cause a “deadlock”. After deleting some message of a POP3 mailbox the header summary falsely claims that there are no messages to display, one needs to perform a scroll or dot movement to restore proper state. In ‘thread’ed sort mode a power user may encounter crashes very occasion‐ ally (this is may and very). Please report bugs to the contact-mail address, e.g., from within mail: ‘? eval mail $contact-mail’. Including the verbose output of the command version may be helpful, e.g., ? wysh set escape=! verbose; vput version xy; unset verbose;\ eval mail $contact-mail Bug subject !I xy !. Information on the web at ‘$ mail -X 'echo $contact-web; x'’.