neulab/tldr huggingface dataset:
‘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 for example ‘-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 inspect 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 respect to the hooks' exit status for at least the command 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 intercepted 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 environment of the hooks will have the variable MAILX_FILENAME_GENERATED set.  Note that spam score support for spamrate is not supported unless the [Option]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 variable, for example ‘-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 examples 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 restriction.  It is interpreted as follows: first a number (digits) 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 inhibits 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 initialization 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.  It will always be inspected, regardless of whether features denotes termcap/terminfo library support via ‘,+termcap,’.
String capabilities form ‘cap=value’ pairs and are expected unless noted otherwise.  Numerics have to be notated as ‘cap#number’ where the number is expected in normal decimal notation.  Finally, booleans do not have any value but indicate a true or false state simply by being defined or not; this indeed means that Mail does not support undefining an existing boolean. String capability values will undergo some expansions before 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 sequences, as in ‘\061’, are supported.  To specify that a terminal supports 256-colours, and to define sequences that home the cursor and produce an audible bell, one might write:
? 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 general:
am        auto_right_margin: boolean which indicates if the right margin needs special treatment; the xenl capability is related, for more see COLUMNS.  This capability is only used when backed by library support. 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; also see colour. cr        carriage_return: move to the first column in the current row.  The default built-in fallback is ‘\r’. cub1 or le cursor_left: move the cursor left one space (non- destructively).  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 simulated 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.  This will be inspected even without ‘,+termcap,’ features.
Many more capabilities which describe key-sequences are documented for bind.
termcap-ca-mode [Option] Allow usage of the exit_ca_mode and enter_ca_mode termcapabilities in order to enter an alternative exclusive screen, the so-called ca-mode; this usually requires special configuration of the PAGER, also dependent on the value of crt. 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.
termcap-disable [Option] Disable any interaction with a terminal control library. If set only some generic fallback built-ins and possibly 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 directory lookup is performed anew as a last resort whenever necessary.  The CA certificate pool built into the TLS library can be disabled via tls-ca-no-defaults, further fine-tuning is possible via tls-ca-flags.  The directory search requires special filename conventions, 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 certificate 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 intervening 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 implemented; 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 certificate, will not verify.  With this flag set, a chain succeeds to verify if at least one signing certificate of the chain is in any of the configured trusted stores of CA certificates.  The OpenSSL manual page 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 certificates.
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, for example
# 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 # And that program specific configuration section now # can map diverse tls-config-module names to sections, # as in: tls-config-module=account_xy [mailx_tls_config] account_xy = mailx_account_xy account_yz = mailx_account_yz [mailx_account_xy] MinProtocol = TLSv1.2 Curves=P-521 [mailx_account_yz] CipherString = TLSv1.2:!aNULL:!eNULL: MinProtocol = TLSv1.1 Options = Bugs
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 whitespace 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 arguments to the function SSL_CONF_cmd(3).
Certificate   Filename of a TLS client certificate (chain) required 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 explicitly.  Some services support so-called ‘external’ authentication if a TLS client certificate was successfully presented during connection 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 ciphers (the protocol standards define lists of acceptable 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 applicable. 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 announces ‘,+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. Fallback is SSL_CTX_set_options(3), driven via an internal 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’ enables only the TLSv1.2 protocol.
tls-crl-dir, tls-crl-file [Option] Specify a directory / a file, respectively, that contains a CRL in PEM format to use when verifying TLS server certificates.
tls-features [Option](Read-only) This expands to a comma-separated list of the TLS library identity and optional features.  To ease substring matching the string starts and ends with a comma.  Currently supported identities are ‘libressl’ (LibreSSL) , ‘libssl-0x30000’ (OpenSSL v3.0.0 series), ‘libssl-0x10100’ (OpenSSL v1.1.x series) and ‘libssl-0x10000’ (elder OpenSSL series, other clones). Optional features are preceded with a plus sign ‘+’ when available, and with a hyphen-minus ‘-’ otherwise.
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 connection peer certificate against the entire local pool of CAs (for more see Encrypted network communication) with the comparison against a precalculated certificate message digest, the so-called fingerprint, to be specified as the used tls-fingerprint-digest.  This fingerprint can for example be calculated with ‘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 certificate fingerprints, the defaults, if available, in test order, 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 variable 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.  Remarks: 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 continue), ‘ignore’ (do not perform validation).  The default is ‘ask’.
toplines  If defined, gives the number of lines of a message to be displayed 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 unsigned right shifting (see vexpr) the screen height.
topsqueeze (Boolean) If set then the top command series will strip adjacent 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 character set conversion capabilities have been compiled into it, in which case it defaults to ISO-8859-1.  Otherwise it defaults to UTF-8.  Sufficient locale support provided the default will be preferably deduced from the locale environment if that is set (for example LC_CTYPE, see there for more); runtime locale changes will be reflected by ttycharset except during the program 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 variables and settings which result in behaviour that interferes with running Mail in script(1); 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 account-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   Verbose mode enables logging of informational context messages. Historically a (Boolean) variable, this can either be set multiple times (what the command line option -v uses), or be assigned a numeric value in order to increase verbosity. Assigning the value 0 disables verbosity and thus (almost) equals unset.  The maximum number is 3.  Also see debug.
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 major, followed by the minor and update version numbers which occupy 12 bits each.  The latter three variables contain only decimal digits: the major, minor and update version numbers.  The output of the command version will include this information.
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 format, though.  Note that the editor will be pointed to the raw message content in that case, i.e., neither MIME decoding nor decryption will have been performed, and proper mbox-rfc4155 ‘From_’ quoting of newly added or edited content is also left as an exercise to the user.
The term “environment variable” should be considered an indication that these variables are either standardized as vivid parts of process environments, or that they are commonly found in there.  The process environment is inherited from the sh(1) once Mail is started, and unless otherwise explicitly noted handling of the following variables transparently integrates into that of the INTERNAL VARIABLES from Mail's point of view.  This means they can be managed via set and unset, causing automatic 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 interactive or batch (-#) mode, actively managed for child processes and the MLE (see On terminal control and line editor) in interactive mode thereafter.  Non-interactive mode always uses, and the fallback default is a compile-time constant, by default 80 columns.  If in batch mode 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 variables, and unsets them for pipe specifications etc.)
DEAD      The name of the (mailbox) folder to use for saving aborted messages 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.  Except shell globs Filename transformations (also see folder) will be performed.
EDITOR    Pathname of the text editor to use for the edit command and ~e (see COMMAND ESCAPES); VISUAL is used for a more display oriented 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 exist, is not accessible or cannot be read; it will always be used for the root user.  (No test for being writable is performed to allow usage by non-privileged users within read-only jails, but dependent on settings this directory is a default write target for, for example, 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 defaults 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. If the environmental fallback is also not set, a built-in compile-time default is used.  This is assumed to be an absolute pathname.
MAILCAPS  [Option] Override the default path search of The Mailcap files: any existing file therein will be loaded in sequence, appending any content to the list of MIME type handler directives.  The RFC 1524 standard imposed default value is assigned otherwise: ‘~/.mailcap:/etc/mailcap:/usr/etc/mailcap: /usr/local/etc/mailcap’.  (The default value is a compile-time [Option].)
MAILRC    Is used as a startup file instead of ~/.mailrc if set.  In order 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 subset of the special Filename transformations (also see folder) 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 location 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’.  Also see colour-pager.
PATH      A colon-separated list of directories that is searched by the shell when looking for commands, for example ‘/bin:/usr/bin:/usr/local/bin’.
POSIXLY_CORRECT This environment entry is automatically squared with posix.
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.
SOCKS5_PROXY This environment entry is automatically squared with socks-proxy.
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 development and by software packagers.  [v15 behaviour may differ] 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 corrected 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.
~/.mailcap, /etc/mailcap [Option] Personal and system-wide MIME type handler definition files, see The Mailcap files.  (The shown names are part of the RFC 1524 standard search path MAILCAPS.)
~/.mailrc, mail.rc User-specific and system-wide files giving initial commands, the Resource files.  (The used filenames come from MAILRC and system-mailrc, respectively.)
~/mbox    The default value for MBOX.
~/.mime.types, /etc/mime.types Personal and 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 used path can be set via NETRC.
/dev/null The data sink null(4).
~/.rnd    [Option] Possible location for persistent random entropy seed storage, see tls-rand-file.
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 according 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 understood by other mailx(1) implementations, for example.
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!)
Errors while loading these files are subject to the settings of errexit and posix.  More files with syntactically equal content can be sourceed.  The following, 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 ...] # For example 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 multiple 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. messages: HTML mail and MIME attachments, The Mailcap files, mimetype, mime-counter-evidence, mimetypes-load-control, pipe-TYPE/SUBTYPE, pipe-EXTENSION.
The Mailcap files [Option] RFC 1524 defines a “User Agent Configuration Mechanism” to be used to inform mail user agent programs about the locally installed facilities for handling various data formats, i.e., about commands and how they can be used to display, edit et cetera MIME part contents, as well as a default path search that includes multiple possible locations of resource files, and the MAILCAPS environment variable to overwrite that.  Handlers found from doing the path search will be cached, the command mailcap operates on that cache, and the variable mailcap-disable will suppress automatic loading, and usage of any mailcap handlers.  HTML mail and MIME attachments gives a general overview of how MIME types are handled.
“Mailcap” files consist of a set of newline separated entries.  Comment lines start with a number sign ‘#’ (in the first column!) and are ignored. Empty lines are ignored.  All other lines are interpreted as mailcap entries.  An entry definition may be split over multiple lines by placing the reverse solidus character ‘\’ last in all but the final line.  The standard does not specify how leading whitespace of successive lines is to be treated, therefore they are retained.
“Mailcap” entries consist of a number of semicolon ‘;’ separated fields. The first two fields are mandatory and must occur in the specified order, the remaining fields are optional and may appear in any order.  Leading and trailing whitespace of field content is ignored (removed).  The reverse solidus ‘\’ character can be used to escape any following character including semicolon and itself in the content of the second field, and in value parts of any optional key/value field.
The first field defines the MIME ‘TYPE/SUBTYPE’ the entry is about to handle (case-insensitively).  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 is the view shell command used to display MIME parts of the given type.
Data consuming shell commands will be fed message (MIME part) data on standard input unless one or more instances of the (unquoted) string ‘%s’ are used: these formats will be replaced with a temporary file(name) that has been prefilled with the parts data.  Data producing shell commands are expected to generata data on their standard output unless that format is used.  In all cases any given ‘%s’ format is replaced with a properly shell quoted filename.  When a command requests a temporary file via ‘%s’ then that will be removed again, as if the x-mailx-tmpfile and x-mailx-tmpfile-fill flags had been set; unless the command requests x-mailx-async the x-mailx-tmpfile-unlink flag is also implied; see below for more.
Optional fields define single-word flags (case-insensitive), or key / value pairs consisting of a case-insensitive keyword, an equals sign ‘=’, and a shell command; whitespace surrounding the equals sign is removed.  Optional fields include the following:
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 composing program needs to specify the ‘Content-type:’ header field to be applied to the composed data.  (Currently unused.)
copiousoutput A flag field which indicates that the output of the view command is integrable into Mails normal visual display.  It is mutually exclusive with needsterminal.
description A textual description that describes this type of data.  The text may optionally be enclosed within double quotation marks ‘"’.
edit      A program that can be used to edit a body or body part in the given format.  (Currently unused.)
nametemplate This field specifies a filename format for the ‘%s’ format used in the shell command fields, in which ‘%s’ will be replaced by a random string.  (The filename is also stored in and passed to subprocesses via MAILX_FILENAME_TEMPORARY.)  The standard says this is “only expected to be relevant in environments where filename extensions are meaningful”, and so this field is ignored unless the ‘%s’ is a prefix, optionally followed by (ASCII) alphabetic and numeric characters, the underscore and the period. For example, to specify that a JPG file is to be passed to an image viewer with a name ending in ‘.jpg’, ‘nametemplate=%s.jpg’ can be used.
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.
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, for example, the machine architecture, or the window system in use, to determine whether or not this mailcap entry applies.  If the test fails, a subsequent mailcap entry should be sought; also see x-mailx-test-once.  Standard I/O of the test program is redirected from and to /dev/null, and the format ‘%s’ is not supported (the data does not yet exist).
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.)
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.
x-mailx-async Extension flag field that denotes that the given view command shall be executed asynchronously, without blocking Mail.  Cannot be used in conjunction with needsterminal; the standard output of the command will go to /dev/null.
x-mailx-noquote An extension flag field that indicates that even a copiousoutput view command shall not be used when quoteing messages, as it would by default.
x-mailx-test-once Extension flag which denotes whether the given test command shall be evaluated once only with its exit status being cached.  This is handy if some global unchanging condition is to be queried, like “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 environment variable MAILX_FILENAME_TEMPORARY.  It is an error to use this flag with commands that include a ‘%s’ format (because that is implemented by means of this temporary file).
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.  It is an error to use this flag with commands that include a ‘%s’ format, or in conjunction with x-mailx-async. x-mailx-tmpfile is implied.
x-mailx-last-resort An extension flag that indicates that this handler shall only be used as a last resort, when no other source (see HTML mail and MIME attachments) provides a MIME handler.
x-mailx-ignore An extension that enforces that this handler is not used at all.
The standard includes the possibility to define any number of additional 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 advantage of the fact that subsequent entries are searched if an earlier one does not provide enough information.  For example, if a view command needs to specify the needsterminal flag, but the compose command shall not, the following will help out the latter:
application/postscript; ps-to-terminal %s; needsterminal application/postscript; ps-to-terminal %s; compose=idraw %s
In value parts of command fields any occurrence of the format string ‘%t’ will be replaced by the ‘TYPE/SUBTYPE’ specification.  Any named parameter from a messages' ‘Content-type:’ field may be embedded into the command line using the format ‘%{’ followed by the parameter name and a closing brace ‘}’ character.  The entire parameter should appear as a single command line argument, regardless of embedded spaces, shell quoting will be performed by the RFC 1524 processor, thus:
# 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).  It does not support the additional formats ‘%n’ and ‘%F’.  An example file, also showing how to properly 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; nametemplate = %s.pl
# Exit EX_TEMPFAIL=75 on signal application/pdf; \ infile=%s\; \ trap "rm -f ${infile}" EXIT\; \ trap "exit 75" INT QUIT TERM\; \ mupdf "${infile}"; \ test = [ -n "${DISPLAY}" ]; \ nametemplate = %s.pdf; x-mailx-async application/pdf; pdftotext -layout - -; copiousoutput
application/*; echo "This is \\"%t\\" but \ is 50 \% Greek to me" \; < %s head -c 512 | cat -vet; \ copiousoutput; x-mailx-noquote; x-mailx-last-resort
Further reading: HTML mail and MIME attachments, The mime.types files, mimetype, MAILCAPS, mime-counter-evidence, pipe-TYPE/SUBTYPE, pipe-EXTENSION.
The .netrc file User credentials for machine accounts (see On URL syntax and credential lookup) can be placed in the .netrc file, which will be loaded and cached when requested by netrc-lookup.  The default location ~/.netrc may be overridden by the NETRC environment variable.  As long as syntax constraints are honoured the file source may be replaced with the output of the shell command set in netrc-pipe, to load an encrypted file, for example.  The cache can be managed with the command netrc.
The file consists of space, tabulator or newline separated tokens.  This parser implements a superset of the original BSD syntax, but users should nonetheless be aware of portability glitches, shall their .netrc be usable across multiple programs and platforms: