(Generated by groff(1))

S-nail manual

This plain groff(1) HTML output has only been fixed slightly — i am sorry for false list indentions etc.!


S-nail [v14.9.5, "Marsh tit engaged with a peanut"] — send and receive Internet mail

SYNOPSIS [2]

s-nail −h | −−help

s-nail [−BdEFinv~#] [−: spec] [−A account] [:−a attachment:] [:−b bcc-addr:] [:−c cc-addr:]

[−M type −m file −q file −t] [−r from-addr] [

[:−S var[=value]: ] [−s subject] [:−X cmd:] [−.] :to-addr: [−− :mta-option:]

s-nail [−BdEeHiNnRv~#] [−: spec] [−A account] [−L spec] [−r from-addr] [

[:−S var[=value]: ] [−u user] [:−X cmd:] [−− :mta-option:]

s-nail [−BdEeHiNnRv~#] [−: spec] [−A account] −f [−L spec] [−r from-addr] [

[:−S var[=value]: ] [:−X cmd:] [file] [−− :mta-option:]

TABLE OF CONTENTS [3]
NAME[1]
SYNOPSIS[2]
TABLE OF CONTENTS[3]
DESCRIPTION[4]

Options[5]
A starter[6]
On sending mail, and non-interactive mode[7]
On reading mail, and interactive mode[8]
HTML mail and MIME attachments[9]
Mailing lists[10]
Signed and encrypted messages with S/MIME[11]
On URL syntax and credential lookup[12]
Encrypted network communication[13]
Character sets[14]
Message states[15]
Specifying messages[16]
On terminal control and line editor[17]
Coloured display[18]
Handling spam[19]

COMMANDS[19]

Command modifiers[21]
Message list arguments[22]
Old-style argument quoting[23]
Shell-style argument quoting[24]
Raw data arguments for codec commands[25]
Filename transformations[26]
Commands[27]

COMMAND ESCAPES[28]
INTERNAL VARIABLES[29]

Initial settings[30]
Variables[31]

ENVIRONMENT[32]
FILES[33]

Resource files[34]
The mime.types files[35]
The Mailcap files[36]
The .netrc file[37]

EXAMPLES[38]

An example configuration[39]
S/MIME step by step[40]
Using CRLs with S/MIME or SSL/TLS[41]

FAQ[42]

S-nail shortly hangs on startup[43]
I cannot login to Google mail aka GMail[44]
Not "defunctional", but the editor key does not work[45]

IMAP CLIENT[46]
SEE ALSO[47]
HISTORY[48]
AUTHORS[49]
CAVEATS[50]
BUGS[51]

DESCRIPTION [4]

Compatibility note: S-nail (S-nail) will wrap up into S-mailx in v15.0 (circa 2020). Backward incompatibility has to be expected – COMMANDS[20] will use Shell-style argument quoting[24] rules, for example, and shell metacharacters will become meaningful. New and old behaviour is flagged [v15-compat] and [no v15-compat], and setting v15-compat[557] , one of the many INTERNAL VARIABLES[29] , will choose new behaviour when applicable. [Obsolete] flags what will vanish, and enabling −d[58] or −v[79] enables obsoletion warnings.

S-nail 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. S-nail divides incoming mail into its constituent messages and allows the user to deal with them in any order. It offers many COMMANDS[20] and INTERNAL VARIABLES[29] for manipulating messages and sending mail. It provides the user simple editing capabilities to ease the composition of outgoing messages, and increasingly powerful and reliable non-interactive scripting capabilities.

Options [5]

−: spec

Explicitly control which of the Resource files[34] shall be source[263] d (loaded): if the letter ‘s’ is (case-insensitively) part of the spec then the system wide s-nail.rc[597] is sourced, likewise the letter ‘u’ controls sourcing of the user’s personal ~/.mailrc[598] file, whereas the letters ‘-’ and ‘/’ explicitly forbid sourcing of any resource files. Scripts should use this option: to avoid environmental noise they should ‘‘detach’’ from any configuration and create a script-specific environment, setting any of the desired INTERNAL VARIABLES[29] via −S[74] and running configurating commands via −X[80] . This option overrides −n[70] .

−A account

Executes an account[125] command for the given user email account after program startup is complete (all resource files are loaded, any −S[74] setting is being established; only −X[80] commands have not been evaluated yet). Being a special incarnation of define[154] d macros for the purpose of bundling longer-lived set[251] tings, activating such an email account also switches to the accounts primary system mailbox[116] (most likely the inbox[413] ).

−a file[=input-charset[#output-charset]]

Attach file to the message (for compose mode opportunities refer to ~@[300] and ~^[302] ). Filename transformations[26] (also see file[177] ) will be performed, except that shell variables are not expanded. Shall file not be accessible but contain a ‘=’ character, then anything before the ‘=’ 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 special string hyphen-minus ‘-’ will be treated as if ttycharset[553] has been specified (the default).

If an output character set has also been given then the conversion will be performed exactly as specified and on-the-fly, not considering the file’s type and content. As an exception, if the output character set is specified as the empty string or hyphen-minus ‘-’, then the default conversion algorithm (see Character sets[14] ) is applied (therefore no conversion is performed on-the-fly, file will be MIME-classified and its contents will be inspected first) — without support for character set conversions (features[388] does not include the term ‘+iconv’) only this argument is supported.

−B

([Obsolete]: S-nail will always use line-buffered output, to gain line-buffered input even in batch mode enable batch mode via −#[82] .)

−b addr

Send a blind carbon copy to address, if the set[251] ting of expandaddr[386] , one of the INTERNAL VARIABLES[29] , allows. The option may be used multiple times. Also see the section On sending mail, and non-interactive mode[7] .

−c addr

Send carbon copies to the given receiver, if so allowed by expandaddr[386] . May be used multiple times.

−d

set[251] the internal variable debug[377] which enables debug messages and disables message delivery, among others; effectively turns almost any operation into a dry-run.

−E

set[251] skipemptybody[500] and thus discard messages with an empty message part body. This command line option is [Obsolete].

−e

Just check if mail is present (in the system inbox[413] or the one specified via −f[62] ): if yes, return an exit status of zero, a non-zero value otherwise. To restrict the set of mails to consider in this evaluation a message specification can be added with the option −L[66] .

−F

Save the message to send in a file named after the local part of the first recipient’s address (instead of in record[479] ).

−f

Read in the contents of the user’s secondary mailbox[117] MBOX[579] (or the specified file) for processing; when S-nail is quit, it writes undeleted messages back to this file (but be aware of the hold[406] option). The optional file argument will undergo some special Filename transformations[26] (also see file[177] ). 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

Display a summary of headers[193] and exit; a configurable summary view is available via the −L[66] option.

−h

Show a short usage summary.

−i

set[251] ignore[411] to ignore tty interrupt signals.

−L spec

Display a summary of headers[193] of all messages that match the given spec, then exit. See the section Specifying messages[16] for the format of spec. If the −e[60] option has been given in addition no header summary is produced, but S-nail 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[79] ).

−M type

Special send mode that will flag standard input with the MIME ‘Content-Type:’ set to the given type and use it as the main message body. [v15 behaviour may differ] Using this option will bypass processing of message-inject-head[428] and message-inject-tail[429] . Also see −q[71] , −m[68] , −t[76] .

−m file

Special send mode that will MIME classify the specified file and use it as the main message body. [v15 behaviour may differ] Using this option will bypass processing of message-inject-head[428] and message-inject-tail[429] . Also see −q[71] , −M[67] , −t[76] .

−N

inhibit the initial display of message headers when reading mail or editing a mailbox folder[182] by calling unset[252] for the internal variable header[399] .

−n

Standard flag that inhibits reading the system wide s-nail.rc[597] upon startup. The option −:[52] allows more control over the startup sequence; also see Resource files[34] .

−q 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[67] , −m[68] , −t[76] .

−R

Any mailbox folder[182] opened will be in read-only mode.

−r from-addr

Whereas the source address that appears in the from[397] header of a message (or in the sender[492] header if the former contains multiple addresses) is honoured by the builtin SMTP transport, it is not used by a file-based mta[436] (Mail-Transfer-Agent) for the RFC 5321 reverse-path used for relaying and delegating a message 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 from-addr will be assigned to the internal variable from[397] , but in addition the command line option −f from-addr will be passed to a file-based mta[436] 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[436] individually via −F name.

If an empty string is passed as from-addr then the content of the variable from[397] (or, if that contains multiple addresses, sender[492] ) will be evaluated and used for this purpose whenever the file-based mta[436] is contacted. By default, without −r that is, neither −f nor −F command line options are used when contacting a file-based MTA, unless this automatic deduction is enforced by set[251] ing the internal variable r-option-implicit[477] .

Remarks: many default installations and sites disallow overriding the local user identity like this unless either the MTA has been configured accordingly or the user is member of a group with special privileges.

−S var[=value]

set[251] (or, with a prefix string ‘no’, as documented in INTERNAL VARIABLES[29] , unset[252] ) variable and optionally assign value, if supported. If the operation fails the program will exit if any of errexit[384] or posix[469] are set. Settings established via −S cannot be changed from within Resource files[34] or an account switch initiated by −A[53] . They will become mutable again before commands registered via −X[80] are executed.

−s subject

Specify the subject of the message to be sent. Newline (NL) and carriage-return (CR) bytes are invalid and will be normalized to space (SP) characters.

−t

The message given (on standard input) is expected to contain, separated from the message body by an empty line, a message header with ‘To:’, ‘Cc:’, or ‘Bcc:’ fields giving its recipients, which will be added to any recipients specified on the command line. If a message subject is specified via ‘Subject:’ then it will be used in favour of one given on the command line.

Also understood are ‘Reply-To:’ (possibly overriding reply-to[484] ), ‘Sender:’ (sender[492] ), ‘From:’ (from[397] and / or option −r[73] ). ‘Message-ID:’, ‘In-Reply-To:’, ‘References:’ and ‘Mail-Followup-To:’, by default created automatically dependent on message context, will be used if specified (a special address massage will however still occur for the latter). Any other custom header field (also see customhdr[374] and ~^[302] ) is passed through entirely unchanged, and in conjunction with the options −~[81] or −#[82] it is possible to embed COMMAND ESCAPES[28] . Also see −M[67] , −m[68] , −q[71] .

−u user

Initially read the primary system mailbox[116] of user, appropriate privileges presumed; effectively identical to ‘−f %user’.

−V

Show S-nail’s version[559] and exit. The command version[284] will also show the list of features[388] : ‘$ s-nail -Xversion -Xx’.

−v

set[251] ting the internal variable verbose[558] enables display of some informational context messages. Using it twice increases the level of verbosity.

−X cmd

Add the given (or multiple for a multiline argument) cmd to the list of commands to be executed, as a last step of program startup, before normal operation starts. This is the only possibility to execute commands in non-interactive mode when reading startup files is actively prohibited. The commands will be evaluated as a unit, just as via source[263] . Correlates with −#[82] and errexit[384] .

−~

Enable COMMAND ESCAPES[28] in compose mode even in non-interactive use cases. This can be used to, e.g., automatically format the composed message text before sending the message:

$ ( echo ’line one. Word. Word2.’;\
echo ’~| /usr/bin/fmt -tuw66’ ) |\
LC_ALL=C s-nail -d~:/ -Sttycharset=utf-8 bob@exam.ple

−#

Enables batch mode: standard input is made line buffered, the complete set of (interactive) commands is available, processing of COMMAND ESCAPES[28] is enabled in compose mode, and diverse INTERNAL VARIABLES[29] are adjusted for batch necessities, exactly as if done via set[251] : emptystart[383] , noerrexit[384] , noheader[399] , noposix[469] , quiet[473] , sendwait[493] , typescript-mode[554] as well as MAIL[575] , MBOX[579] and inbox[413] (the latter three to /dev/null[596] ). The following prepares an email message in a batched dry run:

$ LC_ALL=C printf ’m bob\n~s ubject\nText\n~.\nx\n’ |\
LC_ALL=C s-nail -d#:/ -X’alias bob bob@exam.ple’

−.

This flag forces termination of option processing in order to prevent ‘‘option injection’’ (attacks). It also forcefully puts S-nail into send mode, see On sending mail, and non-interactive mode[7] .

All given to-addr arguments and all receivers established via −b[56] and −c[57] are subject to the checks established by expandaddr[386] , one of the INTERNAL VARIABLES[29] . If the setting of expandargv[387] allows their recognition all mta-option arguments given at the end of the command line after a ‘--’ separator will be passed through to a file-based mta[436] (Mail-Transfer-Agent) and persist for the entire session. expandargv[387] constraints do not apply to the content of mta-arguments[437] .

A starter [6]
S-nail is a direct descendant of BSD Mail, itself a successor of the Research UNIX mail which ‘‘was there from the start’’ according to HISTORY[48] . It thus represents the user side of the UNIX mail system, whereas the system side (Mail-Transfer-Agent, MTA) was traditionally taken by sendmail(8), and most MTAs provide a binary of this name for compatibility purposes. If the [Option]al SMTP mta[436] is included in the features[388] of S-nail then the system side is not a mandatory precondition for mail delivery.

Because S-nail strives for compliance with POSIX mailx(1) it is likely that some configuration settings have to be adjusted before using it is a smooth experience. (Rather complete configuration examples can be found in the section EXAMPLES[38] .) The default global s-nail.rc[597] , one of the Resource files[34] , bends those standard imposed settings of the INTERNAL VARIABLES[29] a bit towards more user friendliness and safety already.

For example, it set[251] s hold[406] and keepsave[417] in order to suppress the automatic moving of messages to the secondary mailbox[117] MBOX[579] that would otherwise occur (see Message states[15] ), and keep[415] to not remove empty system MBOX mailbox files in order not to mangle file permissions when files eventually get recreated (all empty (MBOX) mailbox files will be removed unless this variable is set whenever posix[469] a.k.a. POSIXLY_CORRECT[583] mode has been enabled).

It also enables sendwait[493] in order to synchronize S-nail with the exit status report of the used mta[436] when sending mails. It set[251] s emptystart[383] to enter interactive startup even if the initial mailbox is empty, editheaders[382] to allow editing of headers as well as fullnames[398] to not strip down addresses in compose mode, and quote[474] to include the message that is being responded to when reply[236] ing.

Some random remarks. The file mode creation mask can be explicitly managed via the variable umask[555] . Sufficient system support provided symbolic links will not be followed when files are opened for writing. Files and shell pipe output can be source[263] d for evaluation, also during startup from within the Resource files[34] .

On sending mail, and non-interactive mode [7]
To send a message to one or more people, using a local or built-in mta[436] (Mail-Transfer-Agent) transport to actually deliver the generated mail message, S-nail can be invoked with arguments which are the names of people to whom the mail will be sent, and the command line options −b[56] and −c[57] can be used to add (blind) carbon copy receivers:

# Via sendmail(1)
$ s-nail -s ubject -a ttach.txt bill@exam.ple

# But... try it in an isolated dry-run mode (-d) first
$ LC_ALL=C s-nail -d -:/ -Ssendwait -Sttycharset=utf8 \
-b bcc@exam.ple -c cc@exam.ple \
-Sfullnames -. \
’(Lovely) Bob <bob@exam.ple>’ eric@exam.ple

# With SMTP
$ LC_ALL=C s-nail -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \
-S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \
-S from=scriptreply@exam.ple \
-a /etc/mail.rc \
-. eric@exam.ple

If standard input is a terminal rather than the message to be sent, the user is expected to type in the message contents. In this compose mode S-nail treats lines beginning with the character ‘~’ special – these are so-called COMMAND ESCAPES[28] , which can be used to read in files, process shell commands, add and edit attachments and more; e.g., the command escape ~e[308] will start the text editor to revise the message in its current state, ~h[312] allows editing of the most important message headers, with ~^[302] custom headers can be created (more specifically than with customhdr[374] ). ~?[299] gives an overview of most other available command escapes. The command escape ~.[295] will leave compose mode and send the message once it is completed. Alternatively typing ‘control-D’ (‘^D’) at the beginning of an empty line has the same effect, whereas typing ‘control-C’ (‘^C’) twice will abort the current letter (saving its contents in the file denoted by DEAD[566] unless nosave[487] is set).

A number of ENVIRONMENT[32] and INTERNAL VARIABLES[29] can be used to alter default behavior. E.g., messages are sent asynchronously, without supervision, unless the internal variable sendwait[493] is set, therefore send errors will not be recognizable until then. set[251] ting (also via −S[74] ) editalong[381] will automatically startup a text editor when compose mode is entered, editheaders[382] allows editing of headers additionally to plain body content, askcc[345] and askbcc[346] will cause the user to be prompted actively for (blind) carbon-copy recipients, respectively, and (the default) asksend[347] will request confirmation whether the message shall be sent.

The envelope sender address is defined by from[397] , explicitly defining an originating hostname[407] may be desirable, especially with the builtin SMTP Mail-Transfer-Agent mta[436] . Character sets[14] for outgoing message and MIME part content are configurable via sendcharsets[490] , whereas input data is assumed to be in ttycharset[553] . Message data will be passed over the wire in a mime-encoding[434] . MIME parts a.k.a. attachments need to be assigned a mimetype[205] , usually taken out of The mime.types files[35] . Saving a copy of sent messages in a record[479] mailbox may be desirable – as for most mailbox file[177] targets the value will undergo Filename transformations[26] . Some introductional −d[58] or debug[377] sandbox dry-run tests will prove correctness.

Message recipients (as specified on the command line or defined in ‘To:’, ‘Cc:’ or ‘Bcc:’) may not only be email addressees but can also be names of mailboxes and even complete shell command pipe specifications. If the variable expandaddr[386] is not set then only network addresses (see mailaddr(7) for a description of mail addresses) and plain user names (including MTA aliases) may be used, other types will be filtered out, giving a warning message. The command addrcodec[127] can be used to generate standard compliant network addresses.

If the variable expandaddr[386] is set then extended recipient addresses will optionally be accepted: Any name which starts with a vertical bar ‘|’ character specifies a command pipe – the command string following the ‘|’ is executed and the message is sent to its standard input; Likewise, any name that starts with the character solidus ‘/’ or the character sequence dot solidus ‘./’ is treated as a file, regardless of the remaining content; likewise a name that solely consists of a hyphen-minus ‘-’. Any other name which contains a commercial at ‘@’ character is treated as a network address; Any other name which starts with a plus sign ‘+’ character specifies a mailbox name; Any other name which contains a solidus ‘/’ character but no exclamation mark ‘!’ or percent sign ‘%’ character before also specifies a mailbox name; What remains is treated as a network address.

$ echo bla | s-nail -Sexpandaddr -s test ./mbox.mbox
$ echo bla | s-nail -Sexpandaddr -s test ’|cat >> ./mbox.mbox’
$ echo safe | LC_ALL=C \
s-nail -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \
-Sexpandaddr=fail,-all,+addr,failinvaddr -s test \
-. bob@exam.ple

It is possible to create personal distribution lists via the alias[128] command, so that, for instance, the user can send mail to ‘cohorts’ and have it go to a group of people. These aliases have nothing in common with the system wide aliases that may be used by the MTA, which are subject to the ‘name’ constraint of expandaddr[386] and are often tracked in a file /etc/aliases (and documented in aliases(5) and sendmail(1)). Personal aliases will be expanded by S-nail before the message is sent, and are thus a convenient alternative to specifying each addressee by itself; they correlate with the active set of alternates[130] and are subject to metoo[430] filtering.

alias cohorts bill jkf mark kridle@ucbcory ~/mail/cohorts.mbox

on-compose-enter[447] , on-compose-leave[448] and on-compose-cleanup[446] hook variables may be set to define[154] d macros to automatically adjust some settings dependent on receiver, sender or subject contexts, and via the on-compose-splice[449] as well as on-compose-splice-shell[450] variables, the former also to be set to a define[154] d macro, increasingly powerful mechanisms to perform automated message adjustments, including signature creation, are available. ([v15 behaviour may differ] These hooks work for commands which newly create messages, namely forward[189] , mail[203] , reply[236] and variants; resend[240] and Resend[239] for now provide only the hooks on-resend-enter[452] and on-resend-cleanup[451] .)

For the purpose of arranging a complete environment of settings that can be switched to with a single command or command line option there are account[125] s. Alternatively it is also possible to use a flat configuration, making use of so-called variable chains which automatically pick ‘USER@HOST’ or ‘HOST’ context-dependend variable variants: for example addressing ‘File[176] pop3://yaa@exam.ple’ would find pop3-no-apop-yaa@exam.ple, pop3-no-apop-exam.ple and pop3-no-apop[467] in order. See On URL syntax and credential lookup[12] and INTERNAL VARIABLES[29] .

To avoid environmental noise scripts should ‘‘detach’’ S-nail from any configuration files and create a script-local environment, ideally with the command line options −:[52] to disable any configuration file in conjunction with repetitions of −S[74] to specify variables:

$ env LC_ALL=C s-nail -:/ \
-Sv15-compat -Ssendwait -Sttycharset=utf-8 \
-Sexpandaddr=fail,-all,failinvaddr \
-S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \
-S from=scriptreply@exam.ple \
-s ’Subject to go’ -a attachment_file \
-Sfullnames -. \
’Recipient 1 <rec1@exam.ple>’ rec2@exam.ple \
< content_file

As shown, scripts can ‘‘fake’’ a locale environment, the above specifies the all-compatible 7-bit clean LC_ALL[569] ‘‘C’’, but will nonetheless take and send UTF-8 in the message text by using ttycharset[553] . In interactive mode, which is introduced in the next section, messages can be sent by calling the mail[203] command with a list of recipient addresses:

$ s-nail -d -Squiet -Semptystart
"/var/spool/mail/user": 0 messages
? mail "Recipient 1 <rec1@exam.ple>", rec2@exam.ple
? # Will do the right thing (tm)
? m rec1@exam.ple rec2@exam.ple

On reading mail, and interactive mode [8]
When invoked without addressees S-nail enters interactive mode in which mails may be read. When used like that the user’s system inbox[413] (for more on mailbox types please see the command file[177] ) is read in and a one line header of each message therein is displayed if the variable header[399] is set. The visual style of this summary of headers[193] can be adjusted through the variable headline[400] and the possible sorting criterion via autosort[355] . Scrolling through screen[488] fuls of headers[193] can be performed with the command z[291] . If the initially opened mailbox is empty S-nail will instead exit immediately (after displaying a message) unless the variable emptystart[383] is set.

At the prompt[471] the command list[199] will give a listing of all available commands and help[194] will give a summary of some common ones. If the [Option]al documentation strings are available one can type ‘help X’ (or ‘?X’) and see the actual expansion of ‘X’ and what its purpose is, i.e., commands can be abbreviated (note that POSIX defines some abbreviations, so that the alphabetical order of commands does not necessarily relate to the abbreviations; it is however possible to define overwrites with commandalias[147] ). These commands can also produce a more verbose[558] output.

Messages are given numbers (starting at 1) which uniquely identify messages; the current message – the ‘‘dot’’ – will either be the first new message, or the first unread message, or the first message of the mailbox; the internal variable showlast[494] will instead cause usage of the last message for this purpose. The command headers[193] will display a screen[488] ful of header summaries containing the ‘‘dot’’, whereas from[190] will display only the summaries of the given messages, defaulting to the ‘‘dot’’.

Message content can be displayed with the command type[275] (‘t’, alias print[228] ). Here the variable crt[373] controls whether and when S-nail will use the configured PAGER[581] for display instead of directly writing to the user terminal screen[488] , the sole difference to the command more[215] , which will always use the PAGER[581] . The command top[272] will instead only show the first toplines[551] of a message (maybe even compressed if topsqueeze[552] is set). Message display experience may improve by setting and adjusting mime-counter-evidence[433] , and also see HTML mail and MIME attachments[9] .

By default the current message (‘‘dot’’) is displayed, but like with many other commands it is possible to give a fancy message specification (see Specifying messages[16] ), e.g., ‘t:u’ will display all unread messages, ‘t.’ will display the ‘‘dot’’, ‘t 1 5’ will type the messages 1 and 5, ‘t 1-5’ will type the messages 1 through 5, and ‘t-’ and ‘t+’ will display the last and the next message, respectively. The command search[249] (a more substantial alias for from[190] ) will display a header summary of the given message specification list instead of their content, e.g., the following will search for subjects:

? from ’@Some subject to search for’

In the default setup all header fields of a message will be type[275] d, but fields can be white- or blacklisted for a variety of applications by using the command headerpick[191] , e.g., to restrict their display to a very restricted set for type[275] : ‘headerpick type retain from to cc subject’. In order to display all header fields of a message regardless of currently active ignore or retain lists, use the commands Type[274] and Top[271] ; Show will show the raw message content. Note that historically the global s-nail.rc[597] not only adjusts the list of displayed headers, but also sets crt[373] .

Dependent upon the configuration a line editor (see the section On terminal control and line editor[17] ) aims at making the user experience with the many COMMANDS[20] a bit nicer. When reading the system inbox[413] or when −f[62] (or file[177] ) specified a mailbox explicitly prefixed with the special ‘%:’ modifier (propagating the mailbox to a primary system mailbox[116] ), then messages which have been read will be automatically moved to a secondary mailbox[117] , the users MBOX[579] file, when the mailbox is left, either by changing the active mailbox or by quitting S-nail (also see Message states[15] ) – this automatic moving from a system or primary to the secondary mailbox is not performed when the variable hold[406] is set. Messages can also be explicitly move[213] d to other mailboxes, whereas copy[150] keeps the original message. write[288] can be used to write out data content of specific parts of messages.

After examining a message the user can reply[236] ‘r’ to the sender and all recipients (which will also be placed in ‘To:’ unless recipients-in-cc[478] is set) or Reply[235] ‘R’ exclusively to the sender(s). forward[189] ing a message will allow editing the new message: the original message will be contained in the message body, adjusted according to headerpick[191] . It is possible to resend[240] or Resend[239] messages: the former will add a series of ‘Resent-’ headers, whereas the latter will not; different to newly created messages editing is not possible and no copy will be saved even with record[479] unless the additional variable record-resent[481] is set. When sending, replying or forwarding messages comments and full names will be stripped from recipient addresses unless the internal variable fullnames[398] is set. Of course messages can be delete[156] ‘d’, and they can spring into existence again via undelete[157] or when the S-nail session is ended via the exit[175] ‘x’ command.

To end a mail processing session one may either issue quit[229] ‘q’ to cause a full program exit, which possibly includes automatic moving of read messages to the secondary mailbox[117] MBOX[579] as well as updating the [Option]al line editor history-file[402] , or use the command exit[175] ‘x’ instead in order to prevent any of these actions.

HTML mail and MIME attachments [9]
Messages which are HTML-only become more and more common and of course many messages come bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions) parts for, e.g., attachments. To get a notion of MIME types, S-nail will first read The mime.types files[35] (as configured and allowed by mimetypes-load-control[435] ), and then add onto that types registered directly with mimetype[205] . It (normally) has a default set of types built-in, too. To improve interaction with faulty MIME part declarations which are often seen in real-life messages, setting mime-counter-evidence[433] will allow S-nail to verify the given assertion and possibly provide an alternative MIME type.

Whereas S-nail [Option]ally supports a simple HTML-to-text converter for HTML messages, it cannot handle MIME types other than plain text itself. Instead programs need to become registered to deal with specific MIME types or file extensions. These programs may either prepare plain text versions of their input in order to enable S-nail to integrate their output neatlessly in its own message visualization (a mode which is called copiousoutput[600] ), or display the content themselves, for example in an external graphical window: such handlers will only be considered by and for the command mimeview[209] .

To install a handler program for a specific MIME type an according pipe-TYPE/SUBTYPE[456] variable needs to be set; to instead define a handler for a specific file extension the respective pipe-EXTENSION[463] variable can be used – these handlers take precedence. [Option]ally S-nail supports mail user agent configuration as defined in RFC 1524; this mechanism (see The Mailcap files[36] ) will be queried for display or quote handlers if none of the former two did; it will be the sole source for handlers of other purpose. A last source for handlers is the MIME type definition itself, when a (S-nail specific) type-marker was registered with the command mimetype[205] (which many built-in MIME types do).

E.g., to display a HTML message inline (that is, converted to a more fancy plain text representation than the built-in converter is capable to produce) with either of the text-mode browsers lynx(1) or elinks(1), teach S-nail about MathML documents and make it display them as plain text, and to open PDF attachments in an external PDF viewer, asynchronously and with some other magic attached:

? if [ "$features" !% +filter-html-tagsoup ]
? #set pipe-text/html=’@* elinks -force-html -dump 1’
? set pipe-text/html=’@* lynx -stdin -dump -force_html’
? # Display HTML as plain text instead
? #set pipe-text/html=@
? endif
? mimetype @ application/mathml+xml mathml
? wysh set pipe-application/pdf=’@&=@ \
trap "rm -f \"${MAILX_FILENAME_TEMPORARY}\"" EXIT;\
trap "trap \"\" INT QUIT TERM; exit 1" INT QUIT TERM;\
mupdf "${MAILX_FILENAME_TEMPORARY}"’

Mailing lists [10]
S-nail offers some support to ease handling of mailing lists. The command mlist[207] promotes all given arguments to known mailing lists, and mlsubscribe[210] sets their subscription attribute, creating them first as necessary. (On the other hand unmlsubscribe[211] does not unmlist[208] automatically, but only resets the subscription attribute.) Using the commands without arguments will show (a subset of) all currently defined mailing lists. The headline[400] format ‘%T’ can be used to mark out messages with configured list addresses in the header display.

[Option]ally mailing lists may also be specified as (extended) regular expressions, which allows matching of many addresses with a single expression. However, all fully qualified list addresses are matched via a fast dictionary, whereas expressions are placed in (a) list(s) which is (are) matched sequentially.

? set followup-to followup-to-honour=ask-yes \
reply-to-honour=ask-yes
? wysh mlist a1@b1.c1 a2@b2.c2 ’.*@lists\.c3$’
? mlsubscribe a4@b4.c4 exact@lists.c3

The variable followup-to-honour[394] will ensure that a ‘Mail-Followup-To:’ header is honoured when the message is being replied to (via reply[236] and Lreply[201] ) and followup-to[393] controls whether this header is created when sending mails; it will be created automatically for a couple of reasons, too, like when the special ‘‘mailing list specific’’ respond command Lreply[201] is used, when reply[236] is used to respond to a message with its ‘Mail-Followup-To:’ being honoured etc.

A difference in between the handling of known and subscribed lists is that the address of the sender is usually not part of a generated ‘Mail-Followup-To:’ when addressing the latter, whereas it is for the former kind of lists. Usually because there are exceptions: say, if multiple lists are addressed and not all of them are subscribed lists.

For convenience S-nail will, temporarily, automatically add a list address that is presented in the ‘List-Post:’ header of a message that is being responded to to the list of known mailing lists. Shall that header have existed S-nail will instead, dependent on the variable reply-to-honour[485] , use an also set ‘Reply-To:’ for this purpose in order to accept a list administrators’ wish that is supposed to have been manifested like that (but only if it provides a single address which resides on the same domain as what is stated in ‘List-Post:’).

Signed and encrypted messages with S/MIME [11]
[Option] S/MIME provides two central mechanisms: message signing and message encryption. A signed message contains some data in addition to the regular text. The data can be used to verify that the message was sent using a valid certificate, that the sender’s address in the message header matches that in the certificate, and that the message text has not been altered. Signing a message does not change its regular text; it can be read regardless of whether the recipient’s software is able to handle S/MIME. It is thus usually possible to sign all outgoing messages if so desired.

Encryption, in contrast, makes the message text invisible for all people except those who have access to the secret decryption key. To encrypt a message, the specific recipient’s public encryption key must be known. It is therefore not possible to send encrypted mail to people unless their key has been retrieved from either previous communication or public key directories. A message should always be signed before it is encrypted. Otherwise, it is still possible that the encrypted message text is altered.

A central concept to S/MIME is that of the certification authority (CA). A CA is a trusted institution that issues certificates. For each of these certificates it can be verified that it really originates from the CA, provided that the CA’s own certificate is previously known. A set of CA certificates is usually delivered with OpenSSL and installed on your system. If you trust the source of your OpenSSL software installation, this offers reasonable security for S/MIME on the Internet. Otherwise set smime-ca-no-defaults[504] to avoid using the default certificates and point smime-ca-file[502] and/or smime-ca-dir[501] to a trusted pool of certificates. In general, a certificate cannot be more secure than the method its CA certificate has been retrieved with.

This trusted pool of certificates is used by the command verify[283] to ensure that the given S/MIME messages can be trusted. If so, verified sender certificates that were embedded in signed messages can be saved locally with the command certsave[139] , and used by S-nail to encrypt further communication with these senders:

? certsave FILENAME
? set smime-encrypt-USER@HOST=FILENAME \
smime-cipher-USER@HOST=AES256

To sign outgoing messages in order to allow receivers to verify the origin of these messages a personal S/MIME certificate is required. S-nail supports password-protected personal certificates (and keys), for more on this, and its automatization, please see the section On URL syntax and credential lookup[12] . The section S/MIME step by step[40] shows examplarily how such a private certificate can be obtained. In general, if such a private key plus certificate ‘‘pair’’ is available, all that needs to be done is to set some variables:

? set smime-sign-cert=ME@HERE.com.paired \
smime-sign-message-digest=SHA256 \
smime-sign

Variables of interest for S/MIME in general are smime-ca-dir[501] , smime-ca-file[502] , smime-ca-flags[503] , smime-ca-no-defaults[504] , smime-crl-dir[506] , smime-crl-file[507] . For S/MIME signing of interest are smime-sign[510] , smime-sign-cert[511] , smime-sign-include-certs[512] and smime-sign-message-digest[513] . Additional variables of interest for S/MIME en- and decryption: smime-cipher[505] and smime-encrypt-USER@HOST[508] .

[v15 behaviour may differ] Note that neither S/MIME signing nor encryption applies to message subjects or other header fields yet. Thus they may not contain sensitive information for encrypted messages, and cannot be trusted even if the message content has been verified. When sending signed messages, it is recommended to repeat any important header information in the message text.

On URL syntax and credential lookup [12]
[v15-compat] For accessing protocol-specific resources usage of Uniform Resource Locators (URL, RFC 1738) has become omnipresent. S-nail expects and understands URLs in the following form; parts in brackets ‘[]’ denote optional parts, optional either because there also exist other ways to define the information in question or because support of the part is protocol-specific (e.g., ‘/path’ is used by the local maildir and the IMAP protocol, but not by POP3); If any of ‘USER’ and ‘PASSWORD’ are specified they must be given in URL percent encoded form (RFC 3986; the command urlcodec[280] may be helpful):

PROTOCOL://[USER[:PASSWORD]@]server[:port][/path]

Note that these S-nail URLs most often do not conform to any real standard, but instead represent a normalized variant of RFC 1738 – they are not used in data exchange but only meant as a compact, easy-to-use way of defining and representing information in a well-known notation.

Many internal variables of S-nail exist in multiple versions, called variable chains for the rest of this document: the plain ‘variable’ as well as ‘variable-HOST’ and ‘variable-USER@HOST’. Here ‘HOST’ indeed means ‘server:port’ if a ‘port’ had been specified in the respective URL, otherwise it refers to the plain ‘server’. Also, ‘USER’ is not truly the ‘USER’ that had been found when doing the user chain lookup as is described below, i.e., this ‘USER’ will never be in URL percent encoded form, whether it came from an URL or not; i.e., variable chain name extensions of INTERNAL VARIABLES[29] must not be URL percent encoded.

For example, whether an hypothetical URL ‘smtp://hey%3Ayou@our.house’ had been given that includes a user, or whether the URL was ‘smtp://our.house’ and the user had been found differently, to lookup the variable chain smtp-use-starttls[516] S-nail first looks for whether ‘smtp- use-starttls-hey:you@our.house’ is defined, then whether ‘smtp-use- starttls-our.house’ exists before finally ending up looking at the plain variable itself.

S-nail obeys the following logic scheme when dealing with the necessary credential information of an account:

If no ‘USER’ has been given in the URL the variables user-HOST and user[556] are looked up; if no such variable(s) can be found then S-nail will, when enforced by the [Option]al variables netrc-lookup-HOST or netrc-lookup[440] , search the users .netrc file for a ‘HOST’ specific entry which provides a ‘login’ name: this lookup will only succeed if unambiguous (one possible matching entry for ‘HOST’). It is possible to load encrypted .netrc files via netrc-pipe[441] .

If there is still no ‘USER’ then S-nail will fall back to the user who is supposed to run S-nail, the identity of which has been fixated during S-nail startup and is known to be a valid user on the current host.

Authentication: unless otherwise noted this will lookup the PROTOCOL-auth-USER@HOST, PROTOCOL-auth-HOST, PROTOCOL-auth variable chain, falling back to a protocol-specific default should this have no success.

If no ‘PASSWORD’ has been given in the URL, then if the ‘USER’ has been found through the [Option]al netrc-lookup[440] that may have already provided the password, too. Otherwise the variable chain password-USER@HOST, password-HOST, password[454] is looked up and used if existent.

Afterwards the complete [Option]al variable chain netrc-lookup-USER@HOST, netrc-lookup-HOST, netrc-lookup[440] is looked up. If set, the netrc[216] cache is searched for a password only (multiple user accounts for a single machine may exist as well as a fallback entry without user but with a password).

If at that point there is still no password available, but the (protocols’) chosen authentication type requires a password, then in interactive mode the user will be prompted on the terminal.

Note: S/MIME verification works relative to the values found in the ‘From:’ (or ‘Sender:’) header field(s), which means that the values of smime-sign[510] , smime-sign-cert[511] , smime-sign-include-certs[512] and smime-sign-message-digest[513] will not be looked up using the ‘USER’ and ‘HOST’ chains from above but instead use the corresponding values from the message that is being worked on. In unusual cases multiple and different ‘USER’ and ‘HOST’ combinations may therefore be involved – on the other hand those unusual cases become possible. The usual case is as short as:

set mta=smtp://USER:PASS@HOST smtp-use-starttls \
smime-sign smime-sign-cert=+smime.pair

The section EXAMPLES[38] contains complete example configurations.

Encrypted network communication [13]
SSL (Secure Sockets Layer) a.k.a. its successor TLS (Transport Layer Security) are protocols which aid in securing communication by providing a safely initiated and encrypted network connection. A central concept of SSL/TLS is that of certificates: as part of each network connection setup a (set of) certificates will be exchanged, and by using those the identity of the network peer can be cryptographically verified. SSL/TLS works by using a locally installed pool of trusted certificates, and verifying the connection peer succeeds if that provides a certificate which has been issued or is trusted by any certificate in the trusted local pool.

The local pool of trusted so-called CA (Certification Authority) certificates is usually delivered with the used SSL/TLS library, and will be selected automatically, but it is also possible to create and use an own pool of trusted certificates. If this is desired, set ssl-ca-no-defaults[531] to avoid using the default certificate pool, and point ssl-ca-file[529] and/or ssl-ca-dir[546] to a trusted pool of certificates. A certificate cannot be more secure than the method its CA certificate has been retrieved with.

It depends on the used protocol whether encrypted communication is possible, and which configuration steps have to be taken to enable it. Some protocols, e.g., POP3S, are implicitly encrypted, others, like POP3, can upgrade a plain text connection if so requested: POP3 offers ‘STLS’, which will be used if the variable (chain) pop3-use-starttls[468] is set:

shortcut encpop1 pop3s://pop1.exam.ple

shortcut encpop2 pop3://pop2.exam.ple
set pop3-use-starttls-pop2.exam.ple

set mta=smtps://smtp.exam.ple:465
set mta=smtp://smtp.exam.ple smtp-use-starttls

Normally that is all there is to do, given that SSL/TLS libraries try to provide safe defaults, plenty of knobs however exist to adjust settings. For example certificate verification settings can be fine-tuned via ssl-ca-flags[530] , and the SSL/TLS configuration basics are accessible via ssl-config-pairs[536] , e.g., to specify the allowed protocols or cipher lists that a communication channel may use. In the past hints of how to restrict the set of protocols to highly secure ones were indicated, as of the time of this writing the allowed protocols or cipher list may need to become relaxed in order to be able to connect to some servers; the following example allows connecting to a ‘‘Lion’’ that uses OpenSSL 0.9.8za from June 2014 (refer to INTERNAL VARIABLES[29] for more on variable chains):

wysh set ssl-config-pairs-lion@exam.ple=’MinProtocol=TLSv1.1,\
CipherList=TLSv1.2:!aNULL:!eNULL:\
ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\
DHE-RSA-AES256-SHA:@STRENGTH’

The OpenSSL program ciphers(1) can be used and should be referred to when creating a custom cipher list. Variables of interest for SSL/TLS in general are ssl-ca-dir[546] , ssl-ca-file[529] , ssl-ca-flags[530] , ssl-ca-no-defaults[531] , ssl-config-file[534] , ssl-config-module[535] , ssl-config-pairs[536] ssl-crl-dir[537] , ssl-crl-file[538] , ssl-rand-file[544] as well as ssl-verify[545] .

Character sets [14]
[Option] S-nail detects the character set of the terminal by using mechanisms that are controlled by the LC_CTYPE[570] environment variable (in fact LC_ALL[569] , LC_CTYPE, LANG[571] , in that order, see there). The internal variable ttycharset[553] will be set to the detected terminal character set accordingly, and will thus show up in the output of commands like, e.g., set[251] and varshow[282] .

However, the user may give a value for ttycharset[553] during startup, so that it is possible to send mail in a completely ‘‘faked’’ locale environment, an option which can be used to generate and send, e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII ‘LC_ALL=C’ environment (an example of this can be found in the section On sending mail, and non-interactive mode[7] ). Changing the value does not mean much beside that, because several aspects of the real character set are implied by the locale environment of the system, which stays unaffected by ttycharset[553] .

Messages and attachments which consist of 7-bit clean data will be classified as consisting of charset-7bit[365] character data. This is a problem if the ttycharset[553] character set is a multibyte character set that is also 7-bit clean. For example, the Japanese character set ISO-2022-JP is 7-bit clean but capable to encode the rich set of Japanese Kanji, Hiragana and Katakana characters: in order to notify receivers of this character set the mail message must be MIME encoded so that the character set ISO-2022-JP can be advertised! To achieve this, the variable charset-7bit[365] must be set to ISO-2022-JP. (Today a better approach regarding email is the usage of UTF-8, which uses 8-bit bytes for non-US-ASCII data.)

If the [Option]al character set conversion capabilities are not available (features[388] does not include the term ‘+iconv’), then ttycharset[553] will be the only supported character set, it is simply assumed that it can be used to exchange 8-bit messages (over the wire an intermediate, configurable mime-encoding[434] may be applied), and the rest of this section does not apply; it may however still be necessary to explicitly set it if automatic detection fails, since in that case it defaults to LATIN1 a.k.a. ISO-8859-1.

[Option] When reading messages, their text is converted into ttycharset[553] as necessary in order to display them on the users terminal. Unprintable characters and invalid byte sequences are detected and replaced by proper substitution characters. Character set mappings for source character sets can be established with the command charsetalias[140] , which may be handy to work around faulty character set catalogues (e.g., to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment of one character set as another one (e.g., to interpret LATIN1 as CP1252). Also see charset-unknown-8bit[367] to deal with another hairy aspect of message interpretation.

When sending messages all their parts and attachments are classified. Whereas no character set conversion is performed on those parts which appear to be binary data, the character set being used must be declared within the MIME header of an outgoing text part if it contains characters that do not conform to the set of characters that are allowed by the email standards. Permissible values for character sets used in outgoing messages can be declared using the sendcharsets[490] variable, and charset-8bit[366] , which defines a catch-all last-resort fallback character set that is implicitly appended to the list of character sets in sendcharsets[490] .

When replying to a message and the variable reply-in-same-charset[482] is set, then the character set of the message being replied to is tried first (still being a subject of charsetalias[140] ). And it is also possible to make S-nail work even more closely related to the current locale setting automatically by using the variable sendcharsets-else-ttycharset[491] , please see there for more information.

All the specified character sets are tried in order unless the conversion of the part or attachment succeeds. If none of the tried (8-bit) character sets is capable to represent the content of the part or attachment, then the message will not be sent and its text will optionally be save[487] d in DEAD[566] . In general, if a message saying ‘‘cannot convert from a to b’’ appears, either some characters are not appropriate for the currently selected (terminal) character set, or the needed conversion is not supported by the system. In the first case, it is necessary to set an appropriate LC_CTYPE[570] locale and/or the variable ttycharset[553] .

The best results are usually achieved when S-nail is run in a UTF-8 locale on an UTF-8 capable terminal, in which case the full Unicode spectrum of characters is available. In this setup characters from various countries can be displayed, while it is still possible to use more simple character sets for sending to retain maximum compatibility with older mail clients.

On the other hand the POSIX standard defines a locale-independent 7-bit ‘‘portable character set’’ that should be used when overall portability is an issue, the even more restricted subset named ‘‘portable filename character set’’ consists of A-Z, a-z, 0-9, period ‘.’, underscore ‘_’ and hyphen-minus ‘-’.

Message states [15]
S-nail differentiates in between several different message states; the current state will be reflected in header summary displays if headline[400] is configured to do so (via the internal variable attrlist[350] ), and messages can also be selected and be acted upon depending on their state (see Specifying messages[16] ). When operating on the system inbox[413] , or in any other primary system mailbox[116] , special actions, like the automatic moving of messages to the secondary mailbox[117] MBOX[579] , may be applied when the mailbox is left (also implicitly via a successful exit of S-nail, but not if the special command exit[175] is used) – however, because this may be irritating to users which are used to ‘‘more modern’’ mail-user-agents, the default global s-nail.rc[597] sets the internal hold[406] and keepsave[417] variables in order to suppress this behaviour.

‘new’

Message has neither been viewed nor moved to any other state. Such messages are retained even in the primary system mailbox[116] .

‘unread’

Message has neither been viewed nor moved to any other state, but the message was present already when the mailbox has been opened last: Such messages are retained even in the primary system mailbox[116] .

‘read’

The message has been processed by one of the following commands: ~f[310] , ~m[316] , ~F[309] , ~M[315] , copy[150] , mbox[204] , next[218] , pipe[225] , Print[227] , print[228] , top[272] , Type[274] , type[275] , undelete[157] . The commands dp[159] and dt[160] will always try to automatically ‘‘step’’ and type[275] the ‘‘next’’ logical message, and may thus mark multiple messages as read, the delete[156] command will do so if the internal variable autoprint[354] is set. Except when the exit[175] command is used, messages that are in a primary system mailbox[116] and are in ‘read’ state when the mailbox is left will be saved in the secondary mailbox[117] MBOX[579] unless the internal variable hold[406] it set.

‘deleted’

The message has been processed by one of the following commands: delete[156] , dp[159] , dt[160] . Only undelete[157] can be used to access such messages.

‘preserved’

The message has been processed by a preserve[226] command and it will be retained in its current location.

‘saved’

The message has been processed by one of the following commands: save[248] or write[288] . Unless when the exit[175] command is used, messages that are in a primary system mailbox[116] and are in ‘saved’ state when the mailbox is left will be deleted; they will be saved in the secondary mailbox[117] MBOX[579] when the internal variable keepsave[417] is set.

In addition to these message states, flags which otherwise have no technical meaning in the mail system except allowing special ways of addressing them when Specifying messages[16] can be set on messages. These flags are saved with messages and are thus persistent, and are portable between a set of widely used MUAs.

answered[132]

Mark messages as having been answered.

draft[162]

Mark messages as being a draft.

flag[180]

Mark messages which need special attention.

Specifying messages [16]
Commands such as from[190] , type[275] and delete[156] can be given a list of message numbers as arguments to apply to a number of messages at once. Thus ‘delete 1 2’ deletes messages 1 and 2, whereas ‘delete 1-5’ will delete the messages 1 through 5. In sorted or threaded mode (see the sort[261] command), ‘delete 1-5’ will delete the messages that are located between (and including) messages 1 through 5 in the sorted/threaded order, as shown in the headers[193] summary. The following special message names exist:

.

The current message, the so-called ‘‘dot’’.

;

The message that was previously the current message.

,

The parent message of the current message, that is the message with the Message-ID given in the ‘In-Reply-To:’ field or the last entry of the ‘References:’ field of the current message.

-

The next previous undeleted message, or the next previous deleted message for the undelete[157] command. In sorted/threaded mode, the next previous such message in the sorted/threaded order.

+

The next undeleted message, or the next deleted message for the undelete[157] command. In sorted/threaded mode, the next such message in the sorted/threaded order.

^

The first undeleted message, or the first deleted message for the undelete[157] command. In sorted/threaded mode, the first such message in the sorted/threaded order.

$

The last message. In sorted/threaded mode, the last message in the sorted/threaded order.

&x

In threaded mode, selects the message addressed with x, where x is any other message specification, and all messages from the thread that begins at it. Otherwise it is identical to x. If x is omitted, the thread beginning with the current message is selected.

*

All messages.

All messages that were included in the Message list arguments[22] of the previous command.

x-y

An inclusive range of message numbers. Selectors that may also be used as endpoints include any of .;-+^$.

address

A case-insensitive ‘‘any substring matches’’ search against the ‘From:’ header, which will match addresses (too) even if showname[495] is set (and POSIX says ‘‘any address as shown in a header summary shall be matchable in this form’’); However, if the allnet[341] variable is set, only the local part of the address is evaluated for the comparison, not ignoring case, and the setting of showname[495] is completely ignored. For finer control and match boundaries use the ‘@’ search expression.

/string

All messages that contain string in the subject field (case ignored). See also the searchheaders[489] variable. If string is empty, the string from the previous specification of that type is used again.

[@name-list]@expr

All messages that contain the given case-insensitive search expression; if the [Option]al regular expression (see re_format(7)) support is available expr will be interpreted as (an extended) one if any of the ‘‘magical’’ (extended) regular expression characters is seen: in this case this should match strings correctly which are in the locale LC_CTYPE[570] encoding. If the optional @name-list part is missing, the search is restricted to the subject field body, but otherwise name-list specifies a comma-separated list of header fields to search, as in

’@to,from,cc@Someone i ought to know’

In order to search for a string that includes a ‘@’ (commercial at) character the name-list is effectively non-optional, but may be given as the empty string. Some special header fields may be abbreviated: ‘f’, ‘t’, ‘c’, ‘b’ and ‘s’ will match ‘From’, ‘To’, ‘Cc’, ‘Bcc’ and ‘Subject’, respectively and case-insensitively. The special names ‘header’ or ‘<’ can be used to search in (all of) the header(s) of the message, and the special names ‘body’ or ‘>’ and ‘text’ or ‘=’ can be used to perform full text searches – whereas the former searches only the body, the latter also searches the message header.

This message specification performs full text comparison, but even with regular expression support it is almost impossible to write a search expression that savely matches only a specific address domain. To request that the content of the header is treated as a list of addresses, and to strip those down to the plain email address which the search expression is to be matched against, prefix the header name (abbreviation) with a tilde ‘~’:

@~f@@a\.safe\.domain\.match$

:c

All messages of state or with matching condition ‘c’, where ‘c’ is one or multiple of the following colon modifiers:

a

answered[132] messages (cf. the variable markanswered[424] ).

d

‘deleted’ messages (for the undelete[157] and from[190] commands only).

f

flag[180] ged messages.

L

Messages with receivers that match mlsubscribe[210] d addresses.

l

Messages with receivers that match mlist[207] ed addresses.

n

‘new’ messages.

o

Old messages (any not in state ‘read’ or ‘new’).

r

‘read’ messages.

S

[Option] Messages with unsure spam classification (see Handling spam[19] ).

s

[Option] Messages classified as spam.

t

Messages marked as draft[162] .

u

‘unread’ messages.

[Option] IMAP-style SEARCH expressions may also be used. This addressing mode is available with all types of mailbox folder[182] s; S-nail will perform the search locally as necessary. Strings must be enclosed by double quotes ‘"’ in their entirety if they contain whitespace or parentheses; within the quotes, only reverse solidus ‘\’ is recognized as an escape character. All string searches are case-insensitive. When the description indicates that the ‘‘envelope’’ representation of an address field is used, this means that the search string is checked against both a list constructed as

("name" "source" "local-part" "domain-part")

for each address, and the addresses without real names from the respective header field. These search expressions can be nested using parentheses, see below for examples.

(criterion)

All messages that satisfy the given criterion.

(criterion1 criterion2 ... criterionN)

All messages that satisfy all of the given criteria.

(or criterion1 criterion2)

All messages that satisfy either criterion1 or criterion2, or both. To connect more than two criteria using ‘or’ specifications have to be nested using additional parentheses, as with ‘(or a (or b c))’, since ‘(or a b c)’ really means ‘((a or b) and c)’. For a simple ‘or’ operation of independent criteria on the lowest nesting level, it is possible to achieve similar effects by using three separate criteria, as with ‘(a) (b) (c)’.

(not criterion)

All messages that do not satisfy criterion.

(bcc "string")

All messages that contain string in the envelope representation of the ‘Bcc:’ field.

(cc "string")

All messages that contain string in the envelope representation of the ‘Cc:’ field.

(from "string")

All messages that contain string in the envelope representation of the ‘From:’ field.

(subject "string")

All messages that contain string in the ‘Subject:’ field.

(to "string")

All messages that contain string in the envelope representation of the ‘To:’ field.

(header name "string")

All messages that contain string in the specified ‘Name:’ field.

(body "string")

All messages that contain string in their body.

(text "string")

All messages that contain string in their header or body.

(larger size)

All messages that are larger than size (in bytes).

(smaller size)

All messages that are smaller than size (in bytes).

(before date)

All messages that were received before date, which must be in the form ‘d[d]-mon-yyyy’, where ‘d’ denotes the day of the month as one or two digits, ‘mon’ is the name of the month – one of ‘Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec’, and ‘yyyy’ is the year as four digits, e.g., ‘28-Dec-2012’.

(on date)

All messages that were received on the specified date.

(since date)

All messages that were received since the specified date.

(sentbefore date)

All messages that were sent on the specified date.

(senton date)

All messages that were sent on the specified date.

(sentsince date)

All messages that were sent since the specified date.

()

The same criterion as for the previous search. This specification cannot be used as part of another criterion. If the previous command line contained more than one independent criterion then the last of those criteria is used.

On terminal control and line editor [17]
[Option] Terminal control will be realized through one of the standard UNIX libraries, either the Termcap Access Library (libtermcap, −ltermcap), or, alternatively, the Terminal Information Library (libterminfo, −lterminfo), both of which will be initialized to work with the environment variable TERM[586] . Terminal control will enhance or enable interactive usage aspects, e.g., Coloured display[18] , and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the byte-sequences of keys like the cursor and function keys.

The internal variable termcap[548] can be used to overwrite settings or to learn (correct(ed)) keycodes. S-nail may also become a fullscreen application by entering the so-called ca-mode and switching to an alternative exclusive screen (content) shall the terminal support it and the internal variable termcap-ca-mode[549] has been set explicitly. Actual interaction with the chosen library can be disabled completely by setting the internal variable termcap-disable[550] ; termcap[548] will be queried regardless, which is true even if the [Option]al library support has not been enabled at configuration time as long as some other [Option] which (may) query terminal control sequences has been enabled.

[Option] The built-in Mailx-Line-Editor (MLE) should work in all environments which comply to the ISO C standard ISO/IEC 9899/AMD1:1995 (‘‘ISO C90, Amendment 1’’), and will support wide glyphs if possible (the necessary functionality had been removed from ISO C, but was included in X/Open Portability Guide Issue 4 (‘‘XPG4’’)). Prevent usage of a line editor in interactive mode by setting the internal variable line-editor-disable[418] . Especially if the [Option]al terminal control support is missing setting entries in the internal variable termcap[548] will help shall the MLE misbehave, see there for more. The MLE can support a little bit of colour[145] .

[Option] If the history[195] feature is available then input from line editor prompts will be saved in a history list that can be searched in and be expanded from. Such saving can be prevented by prefixing input with any amount of whitespace. Aspects of history, like allowed content and maximum size, as well as whether history shall be saved persistently, can be configured with the internal variables history-file[402] , history-gabby[403] , history-gabby-persist[404] and history-size[405] .

The MLE supports a set of editing and control commands. By default (as) many (as possible) of these will be assigned to a set of single-letter control codes, which should work on any terminal (and can be generated by holding the ‘‘control’’ key while pressing the key of desire, e.g., ‘control-D’). If the [Option]al bind[134] command is available then the MLE commands can also be accessed freely by assigning the command name, which is shown in parenthesis in the list below, to any desired key-sequence, and the MLE will instead and also use bind[134] to establish its built-in key bindings (more of them if the [Option]al terminal control is available), an action which can then be suppressed completely by setting line-editor-no-defaults[419] . Shell-style argument quoting[24] notation is used in the following; combinations not mentioned either cause job control signals or do not generate a (unique) keycode:

‘\cA’

Go to the start of the line (mle-go-home ).

‘\cB’

Move the cursor backward one character (mle-go-bwd ).

‘\cD’

Forward delete the character under the cursor; quits S-nail if used on the empty line unless the internal variable ignoreeof[412] is set (mle-del-fwd ).

‘\cE’

Go to the end of the line (mle-go-end ).

‘\cF’

Move the cursor forward one character (mle-go-fwd ).

‘\cG’

Cancel current operation, full reset. If there is an active history search or tabulator expansion then this command will first reset that, reverting to the former line content; thus a second reset is needed for a full reset in this case (mle-reset ).

‘\cH’

Backspace: backward delete one character (mle-del-bwd ).

‘\cI’

[Only new quoting rules] Horizontal tabulator: try to expand the word before the cursor, supporting the usual Filename transformations[26] (mle-complete ). This is affected by mle-quote-rndtrip[97] .

‘\cJ’

Newline: commit the current line (mle-commit ).

‘\cK’

Cut all characters from the cursor to the end of the line (mle-snarf-end ).

‘\cL’

Repaint the line (mle-repaint ).

‘\cN’

[Option] Go to the next history entry (mle-hist-fwd ).

‘\cO’

([Option]ally context-dependent) Invokes the command dt[160] .

‘\cP’

[Option] Go to the previous history entry (mle-hist-bwd ).

‘\cQ’

Toggle roundtrip mode shell quotes, where produced, on and off (mle-quote-rndtrip ). This setting is temporary, and will be forgotten once the command line is committed; also see shcodec[253] .

‘\cR’

[Option] Complete the current line from (the remaining) older history entries (mle-hist-srch-bwd ).

‘\cS’

[Option] Complete the current line from (the remaining) newer history entries (mle-hist-srch-fwd ).

‘\cT’

Paste the snarf buffer (mle-paste ).

‘\cU’

The same as ‘\cA’ followed by ‘\cK’ (mle-snarf-line ).

‘\cV’

Prompts for a Unicode character (its hexadecimal number) to be inserted (mle-prompt-char ). Note this command needs to be assigned to a single-letter control code in order to become recognized and executed during input of a key-sequence (only three single-letter control codes can be used for that shortcut purpose); this control code is special-treated and cannot be part of any other sequence, because any occurrence will perform the mle-prompt-char[102] function immediately.

‘\cW’

Cut the characters from the one preceding the cursor to the preceding word boundary (mle-snarf-word-bwd ).

‘\cX’

Move the cursor forward one word boundary (mle-go-word-fwd ).

‘\cY’

Move the cursor backward one word boundary (mle-go-word-bwd ).

‘\c[’

Escape: reset a possibly used multibyte character input state machine and [Option]ally a lingering, incomplete key binding (mle-cancel ). This command needs to be assigned to a single-letter control code in order to become recognized and executed during input of a key-sequence (only three single-letter control codes can be used for that shortcut purpose). This control code may also be part of a multi-byte sequence, but if a sequence is active and the very control code is currently also an expected input, then it will first be consumed by the active sequence.

‘\c\’

([Option]ally context-dependent) Invokes the command ‘z[291] +’.

‘\c]’

([Option]ally context-dependent) Invokes the command ‘z[291] $’.

‘\c^’

([Option]ally context-dependent) Invokes the command ‘z[291] 0’.

‘\c_’

Cut the characters from the one after the cursor to the succeeding word boundary (mle-snarf-word-fwd ).

‘\c?’

Backspace: mle-del-bwd[90] .

mle-fullreset : different to mle-reset[89] this will immediately reset a possibly active search etc.

mle-bell : ring the audible bell.

Coloured display [18]
[Option] S-nail can be configured to support a coloured display and font attributes by emitting ANSI a.k.a. ISO 6429 SGR (select graphic rendition) escape sequences. Usage of colours and font attributes solely depends upon the capability of the detected terminal type that is defined by the environment variable TERM[586] and which can be fine-tuned by the user via the internal variable termcap[548] .

On top of what S-nail knows about the terminal the boolean variable colour-pager[370] defines whether the actually applicable colour and font attribute sequences should also be generated when output is going to be paged through the external program defined by the environment variable PAGER[581] (also see crt[373] ). This is not enabled by default because different pager programs need different command line switches or other configuration in order to support those sequences. S-nail however knows about some widely used pagers and in a clean environment it is often enough to simply set colour-pager[370] ; please refer to that variable for more on this topic.

If the variable colour-disable[369] is set then any active usage of colour and font attribute sequences is suppressed, but without affecting possibly established colour[145] mappings.

To define and control colours and font attributes a single multiplexer command family exists: colour[145] shows or defines colour mappings for the given colour type (e.g., monochrome) and uncolour[146] can be used to remove mappings of a given colour type. Since colours are only available in interactive mode, it may make sense to conditionalize the colour setup by encapsulating it with if[197] :

if terminal && [ "$features" =% +colour ]
colour iso view-msginfo ft=bold,fg=green
colour iso view-header ft=bold,fg=red from,subject
colour iso view-header fg=red

uncolour iso view-header from,subject
colour iso view-header ft=bold,fg=magenta,bg=cyan
colour 256 view-header ft=bold,fg=208,bg=230 "subject,from"
colour mono view-header ft=bold
colour mono view-header ft=bold,ft=reverse subject,from
endif

Handling spam [19]
[Option] S-nail can make use of several spam interfaces for the purpose of identification of, and, in general, dealing with spam messages. A precondition of most commands in order to function is that the spam-interface[518] variable is set to one of the supported interfaces. Once messages have been identified as spam their (volatile) ‘is-spam’ state can be prompted: the ‘:s’ and ‘:S’ message specifications will address respective messages and their attrlist[350] entries will be used when displaying the headline[400] in the header display.

spamrate[268] rates the given messages and sets their ‘is-spam’ flag accordingly. If the spam interface offers spam scores those can also be displayed in the header display by including the ‘%$’ format in the headline[400] variable.

spamham[267] , spamspam[270] and spamforget[266] will interact with the Bayesian filter of the chosen interface and learn the given messages as ‘‘ham’’ or ‘‘spam’’, respectively; the last command can be used to cause ‘‘unlearning’’ of messages; it adheres to their current ‘is-spam’ state and thus reverts previous teachings.

spamclear[265] and spamset[269] will simply set and clear, respectively, the mentioned volatile ‘is-spam’ message flag, without any interface interaction.

The spamassassin(1) based spam-interface[518] ‘spamc’ requires a running instance of the spamd(1) server in order to function, started with the option −-allow-tell shall Bayesian filter learning be possible.

$ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
$ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \
--daemonize [--local] [--allow-tell]

Thereafter S-nail can make use of these interfaces:

$ s-nail -Sspam-interface=spamc -Sspam-maxsize=500000 \
-Sspamc-command=/usr/local/bin/spamc \
-Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user=
or
$ s-nail -Sspam-interface=spamc -Sspam-maxsize=500000 \
-Sspamc-command=/usr/local/bin/spamc \
-Sspamc-arguments="-d localhost -p 2142" -Sspamc-user=

Using the generic filter approach allows usage of programs like bogofilter(1). Here is an example, requiring it to be accessible via PATH[582] :

$ s-nail -Sspam-interface=filter -Sspam-maxsize=500000 \
-Sspamfilter-ham="bogofilter -n" \
-Sspamfilter-noham="bogofilter -N" \
-Sspamfilter-nospam="bogofilter -S" \
-Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \
-Sspamfilter-spam="bogofilter -s" \
-Sspamfilter-rate-scanscore="1;^(.+)$"

Because messages must exist on local storage in order to be scored (or used for Bayesian filter training), it is possibly a good idea to perform the local spam check last. Spam can be checked automatically when opening specific folders by setting a specialized form of the internal variable folder-hook[391] .

define spamdelhook {
# Server side DCC
spamset (header x-dcc-brand-metrics "bulk")
# Server-side spamassassin(1)
spamset (header x-spam-flag "YES")
del :s # TODO we HAVE to be able to do ‘spamrate :u ! :sS’
move :S +maybe-spam
spamrate :u
del :s
move :S +maybe-spam
}
set folder-hook-SOMEFOLDER=spamdelhook

See also the documentation for the variables spam-interface[518] , spam-maxsize[519] , spamc-command[520] , spamc-arguments[521] , spamc-user[522] , spamfilter-ham[523] , spamfilter-noham[524] , spamfilter-nospam[525] , spamfilter-rate[526] and spamfilter-rate-scanscore[528] .

COMMANDS [20]

S-nail 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 whitespace removed; once an entire line is completed, the whitespace characters space, tabulator, newline as well as those defined by the variable ifs[409] are removed from the beginning and end. Placing any whitespace characters at the beginning of a line will prevent a possible addition of the command line to the [Option]al history[195] .

The beginning of such input lines is then scanned for the name of a known command: command names may be abbreviated, in which case the first command that matches the given prefix will be used. Command modifiers[21] may prefix a command in order to modify its behaviour. A name may also be a commandalias[147] , which will become expanded until no more expansion is possible. Once the command that shall be executed is known, the remains of the input line will be interpreted according to command-specific rules, documented in the following.

This behaviour is different to the sh(1)ell, which is a programming language with syntactic elements of clearly defined semantics, and therefore capable to sequentially expand and evaluate individual elements of a line. S-nail 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[251] ), not the language.

The command list[199] can be used to show the list of all commands, either alphabetically sorted or in prefix search order (these do not match, also because the POSIX standard prescribes a set of abbreviations). [Option]ally the command help[194] (or ?[123] ), 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[558] 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 1;wysh set verbose;ignerr eval "${@}";return ${?}
}
? commandalias xv ’\call __xv’
? xv help set

Command modifiers [21]
Commands may be prefixed by one or multiple command modifiers.

The modifier reverse solidus \ , to be placed first, prevents commandalias[147] expansions on the remains of the line, e.g., ‘\echo’ will always evaluate the command echo[164] , even if an (command)alias of the same name exists. commandalias[147] content may itself contain further command modifiers, including an initial reverse solidus to prevent further expansions.

The modifier ignerr indicates that any error generated by the following command should be ignored by the state machine and not cause a program exit with enabled errexit[384] or for the standardized exit cases in posix[469] mode. ?[328] , one of the INTERNAL VARIABLES[29] , will be set to the real exit status of the command regardless.

local 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 expansion is applied, as their first argument, and will place their computation result in it instead of the default location (it is usually written to standard output).

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[29] , 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 ![329] will be set to ^ERR[331] -NOTSUP, the exit status ?[328] 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[24] rules over the traditional Old-style argument quoting[23] .

Message list arguments [22]
Some commands expect arguments that represent messages (actually their symbolic message numbers), as has been documented above under Specifying messages[16] already. If no explicit message list has been specified, the next message forward that satisfies the command’s requirements will be used, 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.

Old-style argument quoting [23]
[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[24] may be available even for those via wysh[115] , one of the Command modifiers[21] . Nonetheless care must be taken, because only new commands have been designed with all the capabilities of the new quoting rules in mind, which can, e.g., generate control characters.

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 nonetheless by escaping it with a reverse solidus ‘\’, as in ‘"y\"ou"’.

An argument that is not enclosed in quotes, as above, can usually still contain space characters if those spaces are reverse solidus escaped, as in ‘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 [24]
Commands which don’t expect message-list arguments use sh(1)ell-style, and therefore POSIX standardized, argument parsing and quoting rules. [v15 behaviour may differ] Most new commands only support these new rules and are flagged [Only new quoting rules], some elder ones can use them with the command modifier wysh[115] ; 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 completed whenever an unquoted, otherwise ignored, metacharacter is seen. Metacharacters are vertical bar |, ampersand &, semicolon ;, as well as all characters from the variable ifs[409] , 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 S-nail.

Compatibility note: [v15 behaviour may differ] Please note that even many new-style commands do not yet honour ifs[409] to parse their arguments: whereas the sh(1)ell is a language with syntactic elements of clearly defined semantics, S-nail 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 S-nail can do is cancellation of the processing of the remains of the line.

It also often depends on an actual subcommand of a multiplexer command how the rest of the line should be treated, and until v15 we are not capable to perform this deep inspection of arguments. Nonetheless, at least the following commands which work with positional parameters fully support ifs[409] for an almost shell-compatible field splitting: call[136] , call_if[137] , read[230] , vpospar[286] , xcall[289] .

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[114] ): INTERNAL VARIABLES[29] as well as ENVIRONMENT[32] (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 input token, vertical bar |, ampersand & and semicolon ; also act as control operators and perform control functions. For now supported is semicolon ;, which terminates a single command, therefore sequencing the command line and making the remainder of the line a subject to reevaluation. With sequencing, multiple command argument types and quoting rules may therefore apply to a single line, which can become problematic before v15: e.g., the first of the following will cause surprising results.

? 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 metacharacters 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 preceding 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 accent) ‘‘’, double-quote ‘"’ (to prevent ending the quote) and reverse solidus ‘\’ (to prevent escaping, i.e., to embed a reverse solidus character as-is), but has no special meaning otherwise.

Arguments enclosed in ‘$’dollar-single-quotes’’ extend normal single quotes in that reverse solidus escape sequences are expanded as follows:

‘\a’

bell control character (ASCII and ISO-10646 BEL).

‘\b’

backspace control characer (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). A 0 byte will suppress further output for the quoted argument.

‘\UHHHHHHHH’

the Unicode / ISO-10646 character with the hexadecimal codepoint value ‘HHHHHHHH’ (one to eight hexadecimal digits) — note that Unicode defines the maximum codepoint ever to be supported as ‘0x10FFFF’ (in planes of ‘0xFFFF’ characters each). This escape is only supported in locales that support Unicode (see Character sets[14] ), in other cases the sequence will remain unexpanded 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 digits.

‘\cX’

Emits the non-printable (ASCII and compatible) C0 control codes 0 (NUL) to 31 (US), and 127 (DEL). Printable representations of ASCII control codes can be created by mapping them to a different part of the ASCII character set, which is possible by adding the number 64 for the codes 0 to 31, e.g., 7 (BEL) is ‘7 + 64 = 71 = G’. The real operation is a bitwise logical XOR with 64 (bit 7 set, see vexpr[285] ), 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 standardized: ‘\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 context, the remains of all arguments for the current command.

‘\$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-standard 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’

Raw data arguments for codec commands [25]
A special set of commands, which all have the string ‘‘codec’’ in their name, e.g., addrcodec[127] , shcodec[253] , urlcodec[280] , take raw string data as input, which means that the content of the command input line is passed completely unexpanded and otherwise unchanged: like this the effect of the actual codec is visible without any noise of possible shell quoting rules etc., i.e., the user can input one-to-one the desired or questionable data. To gain a level of expansion, the entire command line can be eval[174] uated 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 [26]
Filenames, where expected, and unless documented otherwise, are subsequently subject to the following filename transformations, in sequence:

If the given name is a registered shortcut[255] , 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 primary system mailbox, which either is the (itself expandable) inbox[413] if that is set, the standardized absolute pathname indicated by MAIL[575] 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[413] , regardless of its actual setting).

&

(Ampersand) is replaced with the invoking users secondary mailbox, the MBOX[579] .

+file

Refers to a file in the folder[390] directory (if that variable is set).

%:filespec

Expands to the same value as filespec, but has special meaning when used with, e.g., the command file[177] : the file will be treated as a primary system mailbox by, e.g., the mbox[204] and save[248] commands, meaning that messages that have been read in the current session will be moved to the MBOX[579] 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[12] ). For the file-protocol, a leading tilde ‘~’ character will be replaced by the expansion of HOME[568] , 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[24] ) may be applied, so that any occurrence of ‘$VARIABLE’ (or ‘${VARIABLE}’) will be replaced by the expansion of the variable, if possible; INTERNAL VARIABLES[29] as well as ENVIRONMENT[32] (shell) variables can be accessed through this mechanism.

Shell pathname wildcard pattern expansions (glob(7)) may be applied as documented. If the fully expanded filename results in multiple pathnames and the command is expecting only one file, an error results.

In interactive context, in order to allow simple value acceptance (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 [27]
The following commands are available:

!

Executes the SHELL[584] command which follows, replacing unescaped exclamation marks with the previously executed command if the internal variable bang[356] is set. This command supports vput[114] as documented in Command modifiers[21] , and manages the error number ![329] . A 0 or positive exit status ?[328] 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[331] -CHILD, then.

In conjunction with the vput[114] 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[331] -NOTSUP error that should otherwise not occur. ^ERR[331] -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[331] -NOMEM will occur and S-nail 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 discard its arguments, not a ‘‘comment-start’’ indicating special character, which means that, e.g., trailing comments on a line are not possible.

+

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.

=

Show the current message number (the ‘‘dot’’).

?

Show a brief summary of commands. [Option] Given an argument a synopsis for the command in question is shown instead; commands can be abbreviated in general and this command can be used to see the full expansion of an abbreviation including the synopsis, try, e.g., ‘?h’, ‘?hel’ and ‘?help’ and see how the output changes. This mode also supports a more verbose[558] output, which will provide the informations documented for list[199] .

|

A synonym for the pipe[225] command.

account , unaccount

(ac, una) Creates, selects or lists (an) account(s). Accounts are special incarnations of define[154] d macros and group commands and variable settings which together usually arrange the environment for the purpose of creating an email account. Different to normal macros settings which are covered by localopts[200] – here by default enabled! – will not be reverted before the account[125] is changed again. The special account ‘null’ (case-insensitive) 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[445] hook is called once they are left.

Without arguments a listing of all defined accounts is shown. With one argument the given account is activated: the system inbox[413] of that account will be activated (as via file[177] ), a possibly installed folder-hook[391] will be run, and the internal variable account[339] will be updated. The two argument form is identical to defining a macro as via define[154] :

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 argument, rather according to email standards (RFC 5322; [v15 behaviour may differ] will furtherly improve). Supports vput[114] (see Command modifiers[21] ), and manages the error number ![329] . 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 involved. [v15 behaviour may differ] S-nail 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 ![329] set to ^ERR[331] -INVAL if decoding fails to find a(n) (valid) email address, 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[207] and mlsubscribe[210] ), eventually reporting that state in the error number ![329] as ^ERR[331] -EXIST. (This state could later become overwritten by an I/O error, though.)

Encoding supports four different modes, lesser automated versions can be chosen by prefixing one, two or three plus signs: the standard imposes a special meaning on some characters, which thus have to be transformed to so-called quoted-pairs by pairing them with a reverse solidus ‘\’ in order to remove the special meaning; this might change interpretation of the entire argument from what has been desired, however! Specify one plus sign to remark that parenthesis shall be left alone, two for not turning double quotation marks into quoted-pairs, and three for also leaving any user-specified reverse solidus alone. The result will always be valid, if a successful exit status is reported. [v15 behaviour may differ] 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",<diet@exam.ple>\ out\ there
"\"Hey, you\", \\ out\\ there" <diet@exam.ple>
? addrc d "\"Hey, you\", \\ out\\ there" <diet@exam.ple>
"Hey, you", \ out\ there <diet@exam.ple>
? addrc s "\"Hey, you\", \\ out\\ there" <diet@exam.ple>
diet@exam.ple

alias , unalias

(a, una) Aliases are a method of creating personal distribution lists that map a single alias name to none to multiple real receivers; these aliases become expanded after message composing is completed. The latter command removes the given list of aliases, the special name ‘*’ will discard all existing aliases.

The former command shows all currently defined aliases when used without arguments, and with one argument the expansion of the given alias. With more than one argument, creates or appends to the alias name given as the first argument the remaining arguments. Alias names adhere to the Postfix MTA aliases(5) rules and are thus restricted to alphabetic characters, digits, the underscore, hyphen-minus, the number sign, colon and commercial at, the last character can also be the dollar sign; the regular expression: ‘[[:alnum:]_#:@-]+$?’. As extensions the exclamation mark ‘!’, period ‘.’ as well as ‘‘any character that has the high bit set’’ may be used.

alternates , unalternates

[Only new quoting rules] (alt) Manage a list of alternate addresses or names of the active user, members of which will be removed from recipient lists. The latter command removes the given list of alternates, the special name ‘*’ will discard all existing aliases. The former command manages the error number ![329] and shows the current set of alternates when used without arguments; in this mode it supports vput[114] (see Command modifiers[21] ). Otherwise the given arguments (after being checked for validity) are appended to the list of alternate names; in posix[469] mode they replace that list instead. There is a set of implicit alternates which is formed of the values of LOGNAME[574] , from[397] , sender[492] and reply-to[484] .

answered , unanswered

Take a message lists and mark each message as having been answered, having not been answered, respectively. Messages will be marked answered when being reply[236] d to automatically if the markanswered[424] variable is set. See the section Message states[15] .

bind , unbind

[Option][Only new quoting rules] The bind command extends the MLE (see On terminal control and line editor[17] ) with freely configurable key bindings. The latter command removes from the given context the given key binding, both of which may be specified as a wildcard ‘*’, so that, e.g., ‘unbind * *’ will remove all bindings of all contexts. Due to initialization order unbinding will not work for built-in key bindings upon program startup, however: please use line-editor-no-defaults[419] for this purpose instead.

With one argument the former command shows all key bindings for the given context, specifying an asterisk ‘*’ will show the bindings of all contexts; a more verbose listing will be produced if either of debug[377] or verbose[558] are set. With two or more arguments a binding is (re)established: the first argument is the context to which the binding shall apply, the second argument is a comma-separated list of the ‘‘keys’’ which form the binding, and any remaining arguments form the expansion. To indicate that a binding shall not be auto-committed, but that the expansion shall instead be furtherly editable by the user, a commercial at ‘@’ (that will be removed) can be placed last in the expansion, from which leading and trailing whitespace will finally be removed. Reverse solidus cannot be used as the last character of expansion.

Contexts define when a binding applies, i.e., a binding will not be seen unless the context for which it is defined for is currently active. This is not true for the shared binding ‘base’, which is the foundation for all other bindings and as such always applies, its bindings, however, only apply secondarily. The available contexts are the shared ‘base’, the ‘default’ context which is used in all not otherwise documented situations, and ‘compose’, which applies to compose mode only.

‘‘Keys’’ which form the binding are specified as a comma-separated list of byte-sequences, where each list entry corresponds to one key(press). A list entry may, indicated by a leading colon character ‘:’, also refer to the name of a terminal capability; several dozen names will be compiled in and may be specified either by their terminfo(5), or, if existing, by their termcap(5) name, regardless of the actually used [Option]al terminal control library. It is possible to use any capability, as long as the name is resolvable by the [Option]al control library or was defined via the internal variable termcap[548] . Input sequences are not case-normalized, so that an exact match is required to update or remove a binding. Examples:

? bind base $’\E’,d mle-snarf-word-fwd # Esc(ape)
? bind base $’\E’,$’\c?’ mle-snarf-word-bwd # Esc, Delete
? bind default $’\cA’,:khome,w ’echo An editable binding@’
? bind default a,b,c rm -irf / @ # Another editable binding
? bind default :kf1 File %
? bind compose :kf1 ~e

Note that the entire comma-separated list is first parsed (over) as a shell-token with whitespace as the field separator, before being parsed and expanded for real with comma as the field separator, therefore whitespace needs to be properly quoted, see Shell-style argument quoting[24] . Using Unicode reverse solidus escape sequences renders a binding defunctional if the locale does not support Unicode (see Character sets[14] ), and using terminal capabilities does so if no (corresponding) terminal control support is (currently) available.

The following terminal capability names are built-in and can be used in terminfo(5) or (if available) the two-letter termcap(5) notation. See the respective manual for a list of capabilities. The program infocmp(1) can be used to show all the capabilities of TERM[586] or the given terminal type; using the −x flag will also show supported (non-standard) extensions.

kbs or kb

Backspace.

kdch1 or kD

Delete character.

kDC or *4

— shifted variant.

kel or kE

Clear to end of line.

kext or @9

Exit.

kich1 or kI

Insert character.

kIC or #3

— shifted variant.

khome or kh

Home.

kHOM or #2

— shifted variant.

kend or @7

End.

knp or kN

Next page.

kpp or kP

Previous page.

kcub1 or kl

Left cursor (with more modifiers: see below).

kLFT or #4

— shifted variant.

kcuf1 or kr

Right cursor (ditto).

kRIT or %i

— shifted variant.

kcud1 or kd

Down cursor (ditto).

kDN

— shifted variant (only terminfo).

kcuu1 or ku

Up cursor (ditto).

kUP

— shifted variant (only terminfo).

kf0 or k0

Function key 0. Add one for each function key up to kf9 and k9, respectively.

kf10 or k;

Function key 10.

kf11 or F1

Function key 11. Add one for each function key up to kf19 and F9, respectively.

Some terminals support key-modifier combination extensions, e.g., ‘Alt+Shift+xy’. For example, the delete key, kdch1: in its shifted variant, the name is mutated to kDC, then a number is appended for the states ‘Alt’ (kDC3), ‘Shift+Alt’ (kDC4), ‘Control’ (kDC5), ‘Shift+Control’ (kDC6), ‘Alt+Control’ (kDC7), finally ‘Shift+Alt+Control’ (kDC8). The same for the left cursor key, kcub1: KLFT, KLFT3, KLFT4, KLFT5, KLFT6, KLFT7, KLFT8.

It is advisable to use an initial escape or other control character (e.g., ‘\cA’) for bindings which describe user key combinations (as opposed to purely terminal capability based ones), in order to avoid ambiguities whether input belongs to key sequences or not; it also reduces search time. Adjusting bind-timeout[357] may help shall keys and sequences be falsely recognized.

call

[Only new quoting rules] Calls the given macro, which must have been created via define[154] , otherwise a ^ERR[331] -NOENT error occurs. Parameters given to macros are implicitly local to the macro’s scope, and may be accessed via special (positional) parameters, e.g., 1[338] , *[334] , @[335] , #[336] . The positional parameters may be removed by shift[257] ing them off the stack (exceeding the supported number of arguments results in a ^ERR[331] -OVERFLOW), and are otherwise controllable via vpospar[286] . Changes to other ENVIRONMENT[32] as well as INTERNAL VARIABLES[29] can be reverted before the current level regains control by setting localopts[200] for called macro(s) (or in them, of course). Macro execution can be terminated at any time by calling return[246] .

Calling macros recursively will at some time excess the stack size limit, causing a hard program abortion; if recursively calling a macro is the last command of the current macro, consider to use the command xcall[289] , which will first release all resources of the current macro before replacing the current macro with the called one. Numeric and string operations can be performed via vexpr[285] , and eval[174] may be helpful to recreate argument lists.

define exmac {
echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@}
return 1000 0
}
call exmac Hello macro exmac!

call_if

Identical to call[136] if the given macro has been created via define[154] , but doesn’t fail nor warn if the macro doesn’t exist.

cd

(ch) Change the working directory to HOME[568] or the given argument. Synonym for chdir[142] .

certsave

[Option] Only applicable to S/MIME signed messages. Takes a message list and a filename and saves the certificates contained within the message signatures to the named file in both human-readable and PEM format. The certificates can later be used to send encrypted messages to the respective message senders by setting smime-encrypt-USER@HOST[508] variables.

charsetalias , uncharsetalias

[Only new quoting rules] Manage (character set conversion) character set alias mappings, as documented in the section Character sets[14] . Character set aliases are expanded recursively, but no expansion is performed on values of the user-settable variables, e.g., charset-8bit[366] . These are effectively no-operations if character set conversion is not available (i.e., no ‘+iconv’ in features[388] ). Without arguments the list of all currently defined aliases is shown, with one argument the expansion of the given alias. Otherwise all given arguments are treated as pairs of character sets and their desired target alias name, creating new or changing already existing aliases, as necessary.

The latter deletes all aliases given as arguments, the special argument ‘*’ will remove all aliases.

chdir

(ch) Change the working directory to HOME[568] or the given argument. Synonym for cd[138] .

collapse , uncollapse

Only applicable to threaded mode. Takes a message list and makes all replies to these messages invisible in header summaries, except for ‘new’ messages and the ‘‘dot’’. Also when a message with collapsed replies is displayed, all of these are automatically uncollapsed. The latter command undoes collapsing.

colour , uncolour

[Option][Only new quoting rules] Manage colour mappings of and for a Coloured display[18] . The type of colour is given as the (case-insensitive) first argument, which must be one of ‘256’ for 256-colour terminals, ‘8’, ‘ansi’ or ‘iso’ for the standard 8-colour ANSI / ISO 6429 color palette and ‘1’ or ‘mono’ for monochrome terminals. Monochrome terminals cannot deal with colours, but only (some) font attributes.

Without further arguments the list of all currently defined mappings for the given colour type is shown (as a special case giving ‘all’ or ‘*’ will show the mappings of all types). Otherwise the second argument defines the mappable slot, and the third argument a (comma-separated list of) colour and font attribute specification(s), and the optional fourth argument can be used to specify a precondition: if conditioned mappings exist they are tested in (creation) order unless a (case-insensitive) match has been found, and the default mapping (if any has been established) will only be chosen as a last resort. The types of precondition available depend on the mappable slot (see Coloured display[18] for some examples), the following of which exist:

Mappings prefixed with ‘mle-’ are used for the [Option]al built-in Mailx-Line-Editor (MLE, see On terminal control and line editor[17] ) and do not support preconditions.

mle-position

This mapping is used for the position indicator that is visible when a line cannot be fully displayed on the screen.

mle-prompt

Used for the prompt[471] .

Mappings prefixed with ‘sum-’ are used in header summaries, and they all understand the preconditions ‘dot’ (the current message) and ‘older’ for elder messages (only honoured in conjunction with datefield-markout-older[376] ).

sum-dotmark

This mapping is used for the ‘‘dotmark’’ that can be created with the ‘%>’ or ‘%<’ formats of the variable headline[400] .

sum-header

For the complete header summary line except the ‘‘dotmark’’ and the thread structure.

sum-thread

For the thread structure which can be created with the ‘%i’ format of the variable headline[400] .

Mappings prefixed with ‘view-’ are used when displaying messages.

view-from_

This mapping is used for so-called ‘From_’ lines, which are MBOX file format specific header lines.

view-header

For header lines. A comma-separated list of headers to which the mapping applies may be given as a precondition; if the [Option]al regular expression support is available then if any of the ‘‘magical’’ (extended) regular expression characters is seen the precondition will be evaluated as (an extended) one.

view-msginfo

For the introductional message info line.

view-partinfo

For MIME part info lines.

The following (case-insensitive) colour definitions and font attributes are understood, multiple of which can be specified in a comma-separated list:

ft=

a font attribute: ‘bold’, ‘reverse’ or ‘underline’. It is possible (and often applicable) to specify multiple font attributes for a single mapping.

fg=

foreground colour attribute: ‘black’, ‘blue’, ‘green’, ‘red’, ‘brown’, ‘magenta’, ‘cyan’ or ‘white’. To specify a 256-color mode a decimal number colour specification in the range 0 to 255, inclusive, is supported, and interpreted as follows:

0 - 7

the standard ISO 6429 colors, as above.

8 - 15

high intensity variants of the standard colors.

16 - 231

216 colors in tuples of 6.

232 - 255

grayscale from black to white in 24 steps.

#!/bin/sh -
fg() { printf "\033[38;5;${1}m($1)"; }
bg() { printf "\033[48;5;${1}m($1)"; }
i=0
while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
printf "\033[0m\n"
i=0
while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
printf "\033[0m\n"

bg=

background colour attribute (see fg= for possible values).

The command uncolour[146] will remove for the given colour type (the special type ‘*’ selects all) the given mapping; if the optional precondition argument is given only the exact tuple of mapping and precondition is removed. The special name ‘*’ will remove all mappings (no precondition allowed), thus ‘uncolour * *’ will remove all established mappings.

commandalias , uncommandalias

[Only new quoting rules] Define or list, and remove, respectively, command aliases. An (command)alias can be used everywhere a normal command can be used, but always takes precedence: any arguments that are given to the command alias are joined onto the alias expansion, and the resulting string forms the command line that is, in effect, executed. The latter command removes all given aliases, the special name ‘*’ will remove all existing aliases. When used without arguments the former shows a list of all currently known aliases, with one argument only the expansion of the given one.

With two or more arguments a command alias is defined or updated: the first argument is the name under which the remaining command line should be accessible, the content of which can be just about anything. An alias may itself expand to another alias, but to avoid expansion loops further expansion will be prevented if an alias refers to itself or if an expansion depth limit is reached. Explicit expansion prevention is available via reverse solidus \[110] , one of the Command modifiers[21] .

? commandalias xx
s-nail: ‘commandalias’: no such alias: xx
? commandalias xx echo hello,
? commandalias xx
commandalias xx ’echo hello,’
? xx
hello,
? xx world
hello, world

Copy

(C) Copy messages to files whose names are derived from the author of the respective message and do not mark them as being saved; otherwise identical to Save[247] .

copy

(c) Copy messages to the named file and do not mark them as being saved; otherwise identical to save[248] .

cwd

Show the name of the current working directory, as reported by getcwd(3). Supports vput[114] (see Command modifiers[21] ). The return status is tracked via ![329] .

Decrypt

[Option] For unencrypted messages this command is identical to Copy[149] ; Encrypted messages are first decrypted, if possible, and then copied.

decrypt

[Option] For unencrypted messages this command is identical to copy[150] ; Encrypted messages are first decrypted, if possible, and then copied.

define , undefine

Without arguments the current list of macros, including their content, is shown, otherwise a macro is defined, replacing an existing macro of the same name. A macro definition is a sequence of commands in the following form:

define name {
command1
command2
...
commandN
}

A defined macro can be invoked explicitly by using the call[136] , call_if[137] and xcall[289] commands, or implicitly if a macro hook is triggered, e.g., a folder-hook[391] . It is possible to localize adjustments, like creation, deletion and modification of INTERNAL VARIABLES[29] , by using the localopts[200] command; the scope which is localized depends on how (i.e., ‘‘as what’’: normal macro, folder hook, hook, account[125] switch) the macro is invoked. Execution of a macro body can be stopped from within by calling return[246] . Inside a call[136] ed macro, given positional parameters can be shift[257] ed, or become completely replaced, removed etc. via vpospar[286] .

The latter command deletes the given macro, the special name ‘*’ will discard all existing macros. Creation and deletion of (a) macro(s) can be performed from within a running macro.

delete , undelete

(d, u) Marks the given message list as being or not being ‘deleted’, respectively; if no argument has been specified then the usual search for a visible message is performed, as documented for Message list arguments[22] , showing only the next input prompt if the search fails. Deleted messages will neither be saved in the secondary mailbox[117] MBOX[579] nor will they be available for most other commands. If the autoprint[354] variable is set, the new ‘‘dot’’ or the last message restored, respectively, is automatically type[275] d; also see dp[159] , dt[160] .

discard

(di) Identical to ignore[198] . Superseded by the multiplexer headerpick[191] .

dp , dt

Delete the given messages and automatically type[275] the new ‘‘dot’’ if one exists, regardless of the setting of autoprint[354] .

dotmove

Move the ‘‘dot’’ up or down by one message when given ‘+’ or ‘-’ argument, respectively.

draft , undraft

Take message lists and mark each given message as being draft, or not being draft, respectively, as documented in the section Message states[15] .

echo

[Only new quoting rules] (ec) Echoes arguments to standard output and writes a trailing newline, whereas the otherwise identical echon[166] does not. Shell-style argument quoting[24] is used, Filename transformations[26] are applied to the expanded arguments. This command also supports vput[114] as documented in Command modifiers[21] , and manages the error number ![329] : if data is stored in a variable then the return value reflects the length of the result string in case of success and is ‘-1’ on error.

echoerr

[Only new quoting rules] Identical to echo[164] except that is echoes to standard error. Also see echoerrn[167] . In interactive sessions the [Option]al message ring queue for errors[173] will be used instead, if available and vput[114] was not used.

echon

[Only new quoting rules] Identical to echo[164] , but does not write or store a trailing newline.

echoerrn

[Only new quoting rules] Identical to echoerr[165] , but does not write or store a trailing newline.

edit

(e) Point the text editor (as defined in EDITOR[567] ) at each message from the given list in turn. Modified contents are discarded unless the writebackedited[564] variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status.

elif

Part of the if[197] / elif[169] / else[170] / endif[171] conditional — if the condition of a preceding if[197] was false, check the following condition and execute the following block if it evaluates true.

else

(el) Part of the if[197] / elif[169] / else[170] / endif[171] conditional — if none of the conditions of the preceding if[197] and elif[169] commands was true, the else[170] block is executed.

endif

(en) Marks the end of an if[197] / elif[169] / else[170] / endif[171] conditional execution block.

environ

[Only new quoting rules] S-nail has a strict notion about which variables are INTERNAL VARIABLES[29] and which are managed in the program ENVIRONMENT[32] . Since some of the latter are a vivid part of S-nails functioning, however, they are transparently integrated into the normal handling of internal variables via set[251] and unset[252] . To integrate other environment variables of choice into this transparent handling, and also to export internal variables into the process environment where they normally are not, a ‘link’ needs to become established with this command, as in, e.g.,

environ link PERL5LIB TZ

Afterwards changing such variables with set[251] will cause automatic updates of the program environment, and therefore be inherited by newly created child processes. Sufficient system support provided (it was in BSD as early as 1987, and is standardized since Y2K) removing such variables with unset[252] will remove them also from the program environment, but in any way the knowledge they ever have been ‘link’ed will be lost. Note that this implies that localopts[200] may cause loss of such links.

The command ‘unlink’ will remove an existing link, but leaves the variables as such intact. Additionally the subcommands ‘set’ and ‘unset’ are provided, which work exactly the same as the documented commands set[251] and unset[252] , but (additionally un)link the variable(s) with the program environment and thus immediately export them to, or remove them from (if possible), respectively, the program environment.

errors

[Option] Since S-nail uses the console as a user interface it can happen that messages scroll by too fast to become recognized. An error message ring queue is available which stores duplicates of any error message and notifies the user in interactive sessions whenever a new error has occurred. The queue is finite: if its maximum size is reached any new message replaces the eldest. The command errors[173] can be used to manage this message queue: if given show or no argument the queue will be displayed and cleared, clear will only clear all messages from the queue.

eval

[Only new quoting rules] Construct a command by concatenating the arguments, separated with a single space character, and then evaluate the result. This command passes through the exit status ?[328] and error number ![329] of the evaluated command; also see call[136] .

define xxx {
echo "xxx arg <$1>"
shift
if [ $# -gt 0 ]
\xcall xxx "$@"
endif
}
define yyy {
eval "$@ ’ ball"
}
call yyy ’\call xxx’ "b\$’\t’u ’ "
call xxx arg <b u>
call xxx arg < >
call xxx arg <ball>

exit

(ex or x) Exit from S-nail without changing the active mailbox and skip any saving of messages in the secondary mailbox[117] MBOX[579] , as well as a possibly tracked line editor history-file[402] . The optional status number argument will be passed through to exit(3). [v15 behaviour may differ] For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status.

File

(Fi) Like file[177] , but open the mailbox read-only.

file

(fi) The file command switches to a new mailbox. Without arguments it shows status information of the current mailbox. If an argument is given, it will write out changes (such as deletions) the user has made, open a new mailbox, update the internal variables mailbox-resolved[422] and mailbox-display[421] , and optionally display a summary of headers[193] if the variable header[399] is set.

Filename transformations[26] will be applied to the name argument, and ‘protocol://’ prefixes are, i.e., URL syntax is understood, e.g., ‘maildir:///tmp/mdirbox’: if a protocol prefix is used the mailbox type is fixated and neither the auto-detection (read on) nor the newfolders[442] mechanisms apply. [Option]ally URLs can also be used to access network resources, which may be accessed securely via Encrypted network communication[13] if so supported, and it is possible to proxy all network traffic over a SOCKS5 server given via socks-proxy[517] .

[v15-compat] protocol://[user[:password]@]host[:port][/path]
[no v15-compat] protocol://[user@]host[:port][/path]

[Option]ally supported network protocols are pop3 (POP3) and pop3s (POP3 with SSL/TLS encrypted transport), imap and imaps. The [/path] part is valid only for IMAP; there it defaults to INBOX. Network URLs require a special encoding as documented in the section On URL syntax and credential lookup[12] .

If the resulting file protocol (MBOX database) name is located on a local filesystem then the list of all registered filetype[178] s is traversed in order to see whether a transparent intermediate conversion step is necessary to handle the given mailbox, in which case S-nail will use the found hook to load and save data into and from a temporary file, respectively. Changing hooks will not affect already opened mailboxes. For example, the following creates hooks for the gzip(1) compression tool and a combined compressed and encrypted format:

? filetype \
gzip ’gzip -dc’ ’gzip -c’ \
zst.pgp ’gpg -d | zstd -dc’ ’zstd -19 -zc | gpg -e’

MBOX database files are generally locked during file operations in order to avoid inconsistencies due to concurrent modifications. [Option]al Mailbox files which S-nail treats as the system inbox[413] (MAIL[575] ), and primary system mailbox[116] es in general will also be protected by so-called dotlock files, the traditional way of mail spool file locking: for any file ‘a’ a lock file ‘a.lock’ will be created for the duration of the synchronization — as necessary a privilege-separated dotlock child process will be used to accommodate for necessary privilege adjustments in order to create the dotlock file in the same directory and with the same user and group identities as the file of interest.

S-nail by default uses tolerant POSIX rules when reading MBOX database files, but it will detect invalid message boundaries in this mode and complain (even more with debug[377] ) if any is seen: in this case mbox-rfc4155[425] can be used to create a valid MBOX database from the invalid input.

If no protocol has been fixated, and name refers to a directory with the subdirectories ‘tmp’, ‘new’ and ‘cur’, then it is treated as a folder in ‘‘Maildir’’ format. The maildir format stores each message in its own file, and has been designed so that file locking is not necessary when reading or writing files.

[v15 behaviour may differ] If no protocol has been fixated and no existing file has been found, the variable newfolders[442] controls the format of mailboxes yet to be created.

filetype , unfiletype

[Only new quoting rules] Define or list, and remove, respectively, file handler hooks, which provide (shell) commands that enable S-nail to load and save MBOX files from and to files with the registered file extensions; it will use an intermediate temporary file to store the plain data. The latter command removes the hooks for all given extensions, ‘*’ will remove all existing handlers.

When used without arguments the former shows a list of all currently defined file hooks, with one argument the expansion of the given alias. Otherwise three arguments are expected, the first specifying the file extension for which the hook is meant, and the second and third defining the load- and save commands, respectively, to deal with the file type, both of which must read from standard input and write to standard output. Changing hooks will not affect already opened mailboxes ([v15 behaviour may differ] except below). [v15 behaviour may differ] For now too much work is done, and files are oftened read in twice where once would be sufficient: this can cause problems if a filetype is changed while such a file is opened; this was already so with the built-in support of .gz etc. in Heirloom, and will vanish in v15. [v15 behaviour may differ] For now all handler strings are passed to the SHELL for evaluation purposes; in the future a ‘!’ prefix to load and save commands may mean to bypass this shell instance: placing a leading space will avoid any possible misinterpretations.

? 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’
? set record=+sent.zst.pgp

flag , unflag

Take message lists and mark the messages as being flagged, or not being flagged, respectively, for urgent/special attention. See the section Message states[15] .

folder

(fold) The same as file[177] .

folders

With no arguments, list the names of the folders in the folder directory. With an existing folder as an argument, lists the names of folders below the named folder.

Followup

(F) Similar to Respond[241] , but saves the message in a file named after the local part of the first recipient’s address (instead of in record[479] ).

followup

(fo) Similar to respond[242] , but saves the message in a file named after the local part of the first recipient’s address (instead of in record[479] ).

followupall

Similar to followup[185] , but responds to all recipients regardless of the flipr[389] variable.

followupsender

Similar to Followup[184] , but responds to the sender only regardless of the flipr[389] variable.

Forward

Similar to forward[189] , but saves the message in a file named after the local part of the recipient’s address (instead of in record[479] ).

forward

Takes a message and the address of a recipient and forwards the message to him. The text of the original message is included in the new one, with the value of the forward-inject-head[396] variable preceding it. To filter the included header fields to the desired subset use the ‘forward’ slot of the white- and blacklisting command headerpick[191] . Only the first part of a multipart message is included unless forward-as-attachment[395] , and recipient addresses will be stripped from comments, names etc. unless the internal variable fullnames[398] is set.

This may generate the errors ^ERR[331] -DESTADDRREQ if no receiver has been specified, ^ERR[331] -PERM if some addressees where rejected by expandaddr[386] , ^ERR[331] -NODATA if no applicable messages have been given, ^ERR[331] -NOTSUP if multiple messages have been specified, ^ERR[331] -IO if an I/O error occurs, ^ERR[331] -NOTSUP if a necessary character set conversion fails, and ^ERR[331] -INVAL for other errors.

from

(f) Takes a list of message specifications and displays a summary of their message headers, exactly as via headers[193] . An alias of this command is search[249] . Also see Specifying messages[16] .

Fwd

[Obsolete] Alias for Forward[188] .

fwd

[Obsolete] Alias for forward[189] .

fwdignore

[Obsolete] Superseded by the multiplexer headerpick[191] .

fwdretain

[Obsolete] Superseded by the multiplexer headerpick[191] .

ghost, unghost

[Obsolete] Replaced by commandalias[147] , uncommandalias[148] .

headerpick , unheaderpick

[Only new quoting rules] Multiplexer command to manage white- and blacklisting selections of header fields for a variety of applications. Without arguments the set of contexts that have settings is displayed. When given arguments, the first argument is the context to which the command applies, one of (case-insensitive) ‘type’ for display purposes (via, e.g., type[275] ), ‘save’ for selecting which headers shall be stored persistently when save[248] , copy[150] , move[213] or even decrypt[153] ing messages (note that MIME related etc. header fields should not be ignored in order to not destroy usability of the message in this case), ‘forward’ for stripping down messages when forward[189] ing message (has no effect if forward-as-attachment[395] is set), and ‘top’ for defining user-defined set of fields for the command top[272] .

The current settings of the given context are displayed if it is the only argument. A second argument denotes the type of restriction that is to be chosen, it may be (a case-insensitive prefix of) ‘retain’ or ‘ignore’ for white- and blacklisting purposes, respectively. Establishing a whitelist suppresses inspection of the corresponding blacklist.

If no further argument is given the current settings of the given type will be displayed, otherwise the remaining arguments specify header fields, which [Option]ally may be given as regular expressions, to be added to the given type. The special wildcard field (asterisk, ‘*’) will establish a (fast) shorthand setting which covers all fields.

The latter command always takes three or more arguments and can be used to remove selections, i.e., from the given context, the given type of list, all the given headers will be removed, the special argument ‘*’ will remove all headers.

headers

(h) Show the current group of headers, the size of which depends on the variable screen[488] , and the style of which can be adjusted with the variable headline[400] . If a message-specification is given the group of headers containing the first message therein is shown and the message at the top of the screen becomes the new ‘‘dot’’.

help

(hel) A synonym for ?[123] .

history

[Option] Either show (this mode also supports a more verbose[558] output) or clear the list of history entries; a decimal NUMBER argument selects and evaluates the respective history entry, which will become the new history top; a negative number is used as an offset to the current command, e.g., ‘-1’ will select the last command, the history top. The default mode if no arguments are given is show. Please see On terminal control and line editor[17] for more on this topic.

hold

(ho, also preserve[226] ) Takes a message list and marks each message therein to be saved in the user’s system inbox[413] instead of in the secondary mailbox[117] MBOX[579] . Does not override the delete[156] command. S-nail deviates from the POSIX standard with this command, because a next[218] command issued after hold[196] will display the following message, not the current one.

if

(i) Part of the nestable if[197] / elif[169] / else[170] / endif[171] conditional execution construct — if the given condition is true then the encapsulated block is executed. The POSIX standards supports the (case-insensitive) conditions ‘r’eceive and ‘s’end, all remaining conditions are non-portable extensions. [v15 behaviour may differ] These commands do not yet use Shell-style argument quoting[24] and therefore do not know about input tokens, so that syntax elements have to be surrounded by whitespace; in v15 S-nail will inspect all conditions bracket group wise and consider the tokens, representing values and operators, therein, which also means that variables will already have been expanded at that time (just like in the shell).

if receive
commands ...
else
commands ...
endif

The (case-insensitive) condition ‘t’erminal will evaluate to true if the standard input is a terminal, i.e., in interactive sessions. Another condition can be any boolean value (see the section INTERNAL VARIABLES[29] for textual boolean representations) to mark an enwrapped block as ‘‘never execute’’ or ‘‘always execute’’. (It shall be remarked that a faulty condition skips all branches until endif[171] .)

([v15 behaviour may differ] In v15 Shell-style argument quoting[24] will be used, and this command will simply interpret expanded tokens.) It is possible to check INTERNAL VARIABLES[29] as well as ENVIRONMENT[32] variables for existence or compare their expansion against a user given value or another variable by using the ‘$’ (‘‘variable next’’) conditional trigger character; a variable on the right hand side may be signalled using the same mechanism. Variable names may be enclosed in a pair of matching braces. When this mode has been triggered, several operators are available:

Integer operators treat the arguments on the left and right hand side of the operator as integral numbers and compare them arithmetically. It is an error if any of the operands is not a valid integer, an empty argument (which implies it had been quoted) is treated as if it were 0. Available operators are ‘-lt’ (less than), ‘-le’ (less than or equal to), ‘-eq’ (equal), ‘-ne’ (not equal), ‘-ge’ (greater than or equal to), and ‘-gt’ (greater than).

String data operators compare the left and right hand side according to their textual content. Unset variables are treated as the empty string. The behaviour of string operators can be adjusted by prefixing the operator with the modifier trigger commercial at ‘@’, followed by none to multiple modifiers: for now supported is ‘i’, which turns the comparison into a case-insensitive one: this is implied if no modifier follows the trigger.

Available string operators are ‘<’ (less than), ‘<=’ (less than or equal to), ‘==’ (equal), ‘!=’ (not equal), ‘>=’ (greater than or equal to), ‘>’ (greater than), ‘=%’ (is substring of) and ‘!%’ (is not substring of). By default these operators work on bytes and (therefore) do not take into account character set specifics. If the case-insensitivity modifier has been used, case is ignored according to the rules of the US-ASCII encoding, i.e., bytes are still compared.

When the [Option]al regular expression support is available, the additional string operators ‘=~’ and ‘!~’ can be used. They treat the right hand side as an extended regular expression that is matched according to the active locale (see Character sets[14] ), i.e., character sets should be honoured correctly.

Conditions can be joined via AND-OR lists (where the AND operator is ‘&&’ and the OR operator is ‘||’), which have equal precedence and will be evaluated with left associativity, thus using the same syntax that is known for the sh(1). It is also possible to form groups of conditions and lists by enclosing them in pairs of brackets ‘[ ... ]’, which may be interlocked within each other, and also be joined via AND-OR lists.

The results of individual conditions and entire groups may be modified via unary operators: the unary operator ‘!’ will reverse the result.

# (This not in v15, there [ -n "$debug"]!)
if $debug
echo *debug* is set
endif
if [ "$ttycharset" == UTF-8 ] || [ "$ttycharset" @i== UTF8 ]
echo *ttycharset* is UTF-8, the former case-sensitive!
endif
set t1=one t2=one
if [ "${t1}" == "${t2}" ]
echo These two variables are equal
endif
if [ "$features" =% +regex ] && [ "$TERM" @i=~ "^xterm.*" ]
echo ..in an X terminal
endif
if [ [ true ] && [ [ "${debug}" != ’’ ] || \
[ "$verbose" != ’’ ] ] ]
echo Noisy, noisy
endif
if true && [ "$debug" != ’’ ] || [ "${verbose}" != ’’ ]
echo Left associativity, as is known from the shell
endif

ignore

(ig) Identical to discard[158] . Superseded by the multiplexer headerpick[191] .

list

Shows the names of all available commands, alphabetically sorted. If given any non-whitespace argument the list will be shown in the order in which command prefixes are searched. [Option] In conjunction with a set variable verbose[558] additional information will be provided for each command: the argument type will be indicated, the documentation string will be shown, and the set of command flags will show up:

‘vput modifier’

command supports the command modifier vput[114] .

‘errno in *!*’

the error number is tracked in ![329] .

‘needs box’

commands needs an active mailbox, a file[177] .

‘ok: batch or interactive’

command may only be used in interactive or −#[82] batch mode.

‘ok: send mode’

command can be used in send mode.

‘not ok: compose mode’

command is not available when in compose mode.

‘not ok: during startup’

command cannot be used during program startup, e.g., while loading Resource files[34] .

‘ok: in subprocess’

command is allowed to be used when running in a subprocess instance, e.g., from within a macro that is called via on-compose-splice[449] .

localopts

This command can be used to localize changes to (linked) ENVIRONMENT[32] as well as INTERNAL VARIABLES[29] , meaning that their state will be reverted to the former one once the ‘‘covered scope’’ is left. [v15 behaviour may differ] Note in the future the coverage may be extended to none or any of alias[128] , alternates[130] , charsetalias[140] , commandalias[147] , filetype[178] , mlist[207] , mlsubscribe[210] , shortcut[255] , to name a few. It can only be used inside of macro definition blocks introduced by account[125] or define[154] . The covered scope of an account[125] is left once a different account is activated, and some macros, notably folder-hook[391] s, use their own specific notion of covered scope, here it will be extended until the folder is left again.

This setting stacks up: i.e., if ‘macro1’ enables change localization and calls ‘macro2’, which explicitly resets localization, then any value changes within ‘macro2’ will still be reverted when the scope of ‘macro1’ is left. (Caveats: if in this example ‘macro2’ changes to a different account[125] which sets some variables that are already covered by localizations, their scope will be extended, and in fact leaving the account[125] will (thus) restore settings in (likely) global scope which actually were defined in a local, macro private context!)

This command takes one or two arguments, the optional first one specifies an attribute that may be one of scope, which refers to the current scope and is thus the default, call, which causes any macro that is being call[136] ed to be started with localization enabled by default, as well as call-fixate, which (if enabled) disallows any called macro to turn off localization: like this it can be ensured that once the current scope regains control, any changes made in deeper levels have been reverted. The latter two are mutually exclusive. The (second) argument is interpreted as a boolean (string, see INTERNAL VARIABLES[29] ) and states whether the given attribute shall be turned on or off.

define temporary_settings {
set possibly_global_option1
localopts on
set local_option1
set local_option2
localopts scope off
set possibly_global_option2
}

Lreply

Reply to messages that come in via known (mlist[207] ) or subscribed (mlsubscribe[210] ) mailing lists, or pretend to do so (see Mailing lists[10] ): on top of the usual reply[236] functionality this will actively resort and even remove message recipients in order to generate a message that is supposed to be sent to a mailing list. For example it will also implicitly generate a ‘Mail-Followup-To:’ header if that seems useful, regardless of the setting of the variable followup-to[393] . For more documentation please refer to On sending mail, and non-interactive mode[7] .

This may generate the errors ^ERR[331] -DESTADDRREQ if no receiver has been specified, ^ERR[331] -PERM if some addressees where rejected by expandaddr[386] , ^ERR[331] -NODATA if no applicable messages have been given, ^ERR[331] -IO if an I/O error occurs, ^ERR[331] -NOTSUP if a necessary character set conversion fails, and ^ERR[331] -INVAL for other errors. Any error stops processing of further messages.

Mail

Similar to mail[203] , but saves the message in a file named after the local part of the first recipient’s address (instead of in record[479] ).

mail

(m) Takes a (list of) recipient address(es) as (an) argument(s), or asks on standard input if none were given; then collects the remaining mail content and sends it out. Unless the internal variable fullnames[398] is set recipient addresses will be stripped from comments, names etc. For more documentation please refer to On sending mail, and non-interactive mode[7] .

This may generate the errors ^ERR[331] -DESTADDRREQ if no receiver has been specified, ^ERR[331] -PERM if some addressees where rejected by expandaddr[386] , ^ERR[331] -NODATA if no applicable messages have been given, ^ERR[331] -NOTSUP if multiple messages have been specified, ^ERR[331] -IO if an I/O error occurs, ^ERR[331] -NOTSUP if a necessary character set conversion fails, and ^ERR[331] -INVAL for other errors.

mbox

(mb) The given message list is to be sent to the secondary mailbox[117] MBOX[579] when S-nail is quit; this is the default action unless the variable hold[406] is set. [v15 behaviour may differ] This command can only be used in a primary system mailbox[116] .

mimetype , unmimetype

Without arguments the content of the MIME type cache will displayed; a more verbose listing will be produced if either of debug[377] or verbose[558] are set. When given arguments they will be joined, interpreted as shown in The mime.types files[35] (also see HTML mail and MIME attachments[9] ), and the resulting entry will be added (prepended) to the cache. In any event MIME type sources are loaded first as necessary – mimetypes-load-control[435] can be used to fine-tune which sources are actually loaded.

The latter command deletes all specifications of the given MIME type, thus ‘? unmimetype text/plain’ will remove all registered specifications for the MIME type ‘text/plain’. The special name ‘*’ will discard all existing MIME types, just as will ‘reset’, but which also reenables cache initialization via mimetypes-load-control[435] .

mlist , unmlist

The latter command removes all given mailing-lists, the special name ‘*’ can be used to remove all registered lists. The former will list all currently defined mailing lists (and their attributes, if any) when used without arguments; a more verbose listing will be produced if either of debug[377] or verbose[558] are set. Otherwise all given arguments will be added and henceforth be recognized as mailing lists. If the [Option]al regular expression support is available then mailing lists may also be specified as (extended) regular expressions (see re_format(7) for more on those). The mlsubscribe[210] pair of commands manages subscription attributes of mailing-lists.

mimeview

[v15 behaviour may differ] Only available in interactive mode, this command allows to display MIME parts which require external MIME handler programs to run which do not integrate in S-nails normal type[275] output (see HTML mail and MIME attachments[9] ). ([v15 behaviour may differ] No syntax to directly address parts, this restriction may vanish.) The user will be asked for each non-text part of the given message in turn whether the registered handler shall be used to display the part.

mlsubscribe , unmlsubscribe

The latter command removes the subscription attribute from all given mailing-lists, the special name ‘*’ can be used to do so for any registered list. The former will list all currently defined mailing lists which have a subscription attribute when used without arguments; a more verbose listing will be produced if either of debug[377] or verbose[558] are set. Otherwise this attribute will be set for all given mailing lists, newly creating them as necessary (as via mlist[207] ). Also see followup-to[393] .

Move

Similar to move[213] , but moves the messages to a file named after the local part of the sender address of the first message (instead of in record[479] ).

move

Acts like copy[150] but marks the messages for deletion if they were transferred successfully.

More

Like more[215] , but also displays header fields which would not pass the headerpick[191] selection, and all MIME parts. Identical to Page[222] .

more

Invokes the PAGER[581] on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to page[223] .

netrc

[Option] When used without arguments or if show has been given the content of the .netrc cache is shown, loading it first as necessary. If the argument is load then the cache will only be initialized and clear will remove its contents. Note that S-nail will try to load the file only once, use ‘netrc clear’ to unlock further attempts. See netrc-lookup[440] , netrc-pipe[441] and the section On URL syntax and credential lookup[12] ; the section The .netrc file[37] documents the file format in detail.

newmail

Checks for new mail in the current folder without committing any changes before. If new mail is present, a message is shown. If the header[399] variable is set, the headers of each new message are also shown. This command is not available for all mailbox types.

next

(n) (like ‘+’ or ‘‘ENTER’’) Goes to the next message in sequence and types it. With an argument list, types the next matching message.

New

Same as Unread[277] .

new

Same as unread[278] .

noop

If the current folder is accessed via a network connection, a ‘‘NOOP’’ command is sent, otherwise no operation is performed.

Page

Like page[223] , but also displays header fields which would not pass the headerpick[191] selection, and all MIME parts. Identical to More[214] .

page

Invokes the PAGER[581] on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to more[215] .

Pipe

Like pipe[225] but also pipes header fields which would not pass the headerpick[191] selection, and all parts of MIME ‘multipart/alternative’ messages.

pipe

(pi) Takes a message list and a shell command and pipes the messages through the command. Without an argument the current message is piped through the command given by the cmd[368] variable. If the page[453] variable is set, every message is followed by a formfeed character.

preserve

(pre) A synonym for hold[196] .

Print

(P) Alias for Type[274] .

print

(p) Research UNIX equivalent of type[275] .

quit

(q) Terminates the session, saving all undeleted, unsaved messages in the current secondary mailbox[117] MBOX[579] , preserving all messages marked with hold[196] or preserve[226] or never referenced in the system inbox[413] , and removing all other messages from the primary system mailbox[116] . If new mail has arrived during the session, the message ‘‘You have new mail’’ will be shown. If given while editing a mailbox file with the command line option −f[62] , then the edit file is rewritten. A return to the shell is effected, unless the rewrite of edit file fails, in which case the user can escape with the exit command. The optional status number argument will be passed through to exit(3). [v15 behaviour may differ] For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status.

read

[Only new quoting rules] Read a line from standard input, or the channel set active via readctl[232] , and assign the data, which will be splitted as indicated by ifs[409] , to the given variables. The variable names are checked by the same rules as documented for vput[114] , and the same error codes will be seen in ![329] ; the exit status ?[328] indicates the number of bytes read, it will be ‘-1’ with the error number ![329] set to ^ERR[331] -BADF in case of I/O errors, or ^ERR[331] -NONE upon End-Of-File. If there are more fields than variables, assigns successive fields to the last given variable. If there are less fields than variables, assigns the empty string to the remains.

? read a b c
H e l l o
? echo "<$a> <$b> <$c>"
<H> <e> <l l o>
? wysh set ifs=:; read a b c;unset ifs
hey2.0,:"’you ",:world!:mars.:
? echo $?/$^ERRNAME / <$a><$b><$c>
0/NONE / <hey2.0,><"’you ",><world!:mars.:><><>

readall

[Only new quoting rules] Read anything from standard input, or the channel set active via readctl[232] , and assign the data to the given variable. The variable name is checked by the same rules as documented for vput[114] , and the same error codes will be seen in ![329] ; the exit status ?[328] indicates the number of bytes read, it will be ‘-1’ with the error number ![329] set to ^ERR[331] -BADF in case of I/O errors, or ^ERR[331] -NONE upon End-Of-File. [v15 behaviour may differ] The input data length is restricted to 31-bits.

readctl

[Only new quoting rules] Manages input channels for read[230] and readall[231] , to be used to avoid complicated or impracticable code, like calling read from within a macro in non-interactive mode. Without arguments, or when the first argument is show, a listing of all known channels is printed. Channels can otherwise be created, and existing channels can be set active and removed by giving the string used for creation.

The channel name is expected to be a file descriptor number, or, if parsing the numeric fails, an input file name that undergoes Filename transformations[26] . E.g. (this example requires a modern shell):

$ LC_ALL=C printf ’echon "hey, "\nread a\nyou\necho $a’ |\
LC_ALL=C s-nail -R#
hey, you
$ LC_ALL=C printf ’echon "hey, "\nread a\necho $a’ |\
LC_ALL=C 6<<< ’you’ s-nail -R#X’readctl create 6’
hey, you

redirect

[Obsolete] Same as resend[240] .

Redirect

[Obsolete] Same as Resend[239] .

remove

Removes the named files or directories. Filename transformations[26] including shell pathname wildcard pattern expansions (glob(7)) are performed on the arguments. If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox type specific removal will be performed, deleting the complete mailbox. The user is asked for confirmation in interactive mode.

rename

Takes the name of an existing folder and the name for the new folder and renames the first to the second one. Filename transformations[26] including shell pathname wildcard pattern expansions (glob(7)) are performed on both arguments. Both folders must be of the same type.

Reply

(R) Replies to only the sender of each message of the given message list, by using the first message as the template to quote, for the ‘Subject:’ etc. flipr[389] will exchange this command with reply[236] . Unless the internal variable fullnames[398] is set the recipient address will be stripped from comments, names etc. ‘Reply-To:’ headers will be inspected if reply-to-honour[485] is set.

This may generate the errors ^ERR[331] -DESTADDRREQ if no receiver has been specified, ^ERR[331] -PERM if some addressees where rejected by expandaddr[386] , ^ERR[331] -NODATA if no applicable messages have been given, ^ERR[331] -IO if an I/O error occurs, ^ERR[331] -NOTSUP if a necessary character set conversion fails, and ^ERR[331] -INVAL for other errors.

reply

(r) Take a message and group-responds to it by addressing the sender and all recipients, subject to alternates[130] processing. followup-to[393] , followup-to-honour[394] , reply-to-honour[485] as well as recipients-in-cc[478] influence response behaviour. Unless the internal variable fullnames[398] is set recipient addresses will be stripped from comments, names etc. If flipr[389] is set the commands Reply[235] and reply[236] are exchanged. The command Lreply[201] offers special support for replying to mailing lists. For more documentation please refer to On sending mail, and non-interactive mode[7] .

This may generate the errors ^ERR[331] -DESTADDRREQ if no receiver has been specified, ^ERR[331] -PERM if some addressees where rejected by expandaddr[386] , ^ERR[331] -NODATA if no applicable messages have been given, ^ERR[331] -IO if an I/O error occurs, ^ERR[331] -NOTSUP if a necessary character set conversion fails, and ^ERR[331] -INVAL for other errors. Any error stops processing of further messages.

replyall

Similar to reply[236] , but initiates a group-reply regardless of the value of flipr[389] .

replysender

Similar to Reply[235] , but responds to the sender only regardless of the value of flipr[389] .

Resend

Like resend[240] , but does not add any header lines. This is not a way to hide the sender’s identity, but useful for sending a message again to the same recipients.

resend

Takes a list of messages and a user name and sends each message to the named user. ‘Resent-From:’ and related header fields are prepended to the new copy of the message. Saving in record[479] is only performed if record-resent[481] is set.

This may generate the errors ^ERR[331] -DESTADDRREQ if no receiver has been specified, ^ERR[331] -PERM if some addressees where rejected by expandaddr[386] , ^ERR[331] -NODATA if no applicable messages have been given, ^ERR[331] -IO if an I/O error occurs, ^ERR[331] -NOTSUP if a necessary character set conversion fails, and ^ERR[331] -INVAL for other errors. Any error stops processing of further messages.

Respond

Same as Reply[235] .

respond

Same as reply[236] .

respondall

Same as replyall[237] .

respondsender

Same as replysender[238] .

retain

(ret) Superseded by the multiplexer headerpick[191] .

return

Only available inside the scope of a define[154] d macro or an account[125] , this will stop evaluation of any further macro content, and return execution control to the caller. The two optional parameters must be specified as positive decimal numbers and default to the value 0: the first argument specifies the signed 32-bit return value (stored in ?[328] [v15 behaviour may differ] and later extended to signed 64-bit), the second the signed 32-bit error number (stored in ![329] ). As documented for ?[328] a non-0 exit status may cause the program to exit.

Save

(S) Similar to save, but saves the messages in a file named after the local part of the sender of the first message instead of (in record[479] and) taking a filename argument; the variable outfolder[444] is inspected to decide on the actual storage location.

save

(s) Takes a message list and a filename and appends each message in turn to the end of the file. Filename transformations[26] including shell pathname wildcard pattern expansions (glob(7)) is performed on the filename. If no filename is given, the secondary mailbox[117] MBOX[579] is used. The filename in quotes, followed by the generated character count is echoed on the user’s terminal. If editing a primary system mailbox[116] the messages are marked for deletion. Filename transformations[26] will be applied. To filter the saved header fields to the desired subset use the ‘save’ slot of the white- and blacklisting command headerpick[191] .

savediscard

[Obsolete] Superseded by the multiplexer headerpick[191] .

saveignore

[Obsolete] Superseded by the multiplexer headerpick[191] .

saveretain

[Obsolete] Superseded by the multiplexer headerpick[191] .

search

Takes a message specification (list) and displays a header summary of all matching messages, as via headers[193] . This command is an alias of from[190] . Also see Specifying messages[16] .

seen

Takes a message list and marks all messages as having been read.

set , unset

(se, [Only new quoting rules] uns) The latter command will delete all given variables, the former, when used without arguments, will show all variables which are currently known to S-nail. A more verbose listing will be produced if either of debug[377] or verbose[558] are set. Remarks: the list mode will not automatically link-in known ENVIRONMENT[32] variables, but only explicit addressing will, e.g., via varshow[282] , using a variable in an if[197] condition or a string passed to echo[164] , explicit set[251] ting, as well as some program-internal use cases.

Otherwise the given variables (and arguments) are set or adjusted. Arguments are of the form ‘name=value’ (no space before or after ‘=’), or plain ‘name’ if there is no value, i.e., a boolean variable. [v15 behaviour may differ] In conjunction with the wysh[115] command prefix Shell-style argument quoting[24] can be used to quote arguments as necessary. [v15 behaviour may differ] Otherwise quotation marks may be placed around any part of the assignment statement to quote blanks or tabs.

? wysh set indentprefix=’ -> ’

If an argument begins with ‘no’, as in ‘set nosave’, the effect is the same as invoking the unset[252] command with the remaining part of the variable (‘unset save’).

Any ‘name’ that is known to map to an environment variable will automatically cause updates in the program environment (unsetting a variable in the environment requires corresponding system support) — use the command environ[172] for further environmental control. Also see varedit[281] , varshow[282] and the sections INTERNAL VARIABLES[29] and ENVIRONMENT[32] .

shcodec

Apply shell quoting rules to the given raw-data arguments. Supports vput[114] (see Command modifiers[21] ). The first argument specifies the operation: [+]e[ncode] or d[ecode] cause shell quoting to be applied to the remains of the line, and expanded away thereof, respectively. If the former is prefixed with a plus-sign, the quoted result will not be roundtrip enabled, and thus can be decoded only in the very same environment that was used to perform the encode; also see mle-quote-rndtrip[97] . If the coding operation fails the error number ![329] is set to ^ERR[331] -CANCELED, and the unmodified input is used as the result; the error number may change again due to output or result storage errors.

shell

[Only new quoting rules] (sh) Invokes an interactive version of the shell, and returns its exit status.

shortcut , unshortcut

Without arguments the list of all currently defined shortcuts is shown, with one argument the expansion of the given shortcut. Otherwise all given arguments are treated as pairs of shortcuts and their expansions, creating new or changing already existing shortcuts, as necessary. The latter command will remove all given shortcuts, the special name ‘*’ will remove all registered shortcuts.

shift

[Only new quoting rules] Shift the positional parameter stack (starting at 1[338] ) by the given number (which must be a positive decimal), or 1 if no argument has been given. It is an error if the value exceeds the number of positional parameters. If the given number is 0, no action is performed, successfully. The stack as such can be managed via vpospar[286] . Note this command will fail in account[125] and hook macros unless the positional parameter stack has been explicitly created in the current context via vpospar[286] .

show

Like type[275] , but performs neither MIME decoding nor decryption, so that the raw message text is shown.

size

(si) Shows the size in characters of each message of the given message-list.

sleep

[Only new quoting rules] Sleep for the specified number of seconds (and optionally milliseconds), by default interruptably. If a third argument is given the sleep will be uninterruptible, otherwise the error number ![329] will be set to ^ERR[331] -INTR if the sleep has been interrupted. The command will fail and the error number will be ^ERR[331] -OVERFLOW if the given duration(s) overflow the time datatype, and ^ERR[331] -INVAL if the given durations are no valid integers.

sort , unsort

The latter command disables sorted or threaded mode, returns to normal message order and, if the header[399] variable is set, displays a header summary. The former command shows the current sorting criterion when used without an argument, but creates a sorted representation of the current folder otherwise, and changes the next[218] command and the addressing modes such that they refer to messages in the sorted order. Message numbers are the same as in regular mode. If the header[399] variable is set, a header summary in the new order is also displayed. Automatic folder sorting can be enabled by setting the autosort[355] variable, as in, e.g., ‘set autosort=thread’. Possible sorting criterions are:

date

Sort the messages by their ‘Date:’ field, that is by the time they were sent.

from

Sort messages by the value of their ‘From:’ field, that is by the address of the sender. If the showname[495] variable is set, the sender’s real name (if any) is used.

size

Sort the messages by their size.

spam

[Option] Sort the message by their spam score, as has been classified by spamrate[268] .

status

Sort the messages by their message status.

subject

Sort the messages by their subject.

thread

Create a threaded display.

to

Sort messages by the value of their ‘To:’ field, that is by the address of the recipient. If the showname[495] variable is set, the recipient’s real name (if any) is used.

source

[Only new quoting rules] (so) The source command reads commands from the given file. Filename transformations[26] will be applied. If the given expanded argument ends with a vertical bar ‘|’ then the argument will instead be interpreted as a shell command and S-nail will read the output generated by it. Dependent on the settings of posix[469] and errexit[384] , and also dependent on whether the command modifier ignerr[111] had been used, encountering errors will stop sourcing of the given input. [v15 behaviour may differ] Note that source cannot be used from within macros that execute as folder-hook[391] s or account[125] s, i.e., it can only be called from macros that were call[136] ed.

source_if

[Only new quoting rules] The difference to source[263] (beside not supporting pipe syntax aka shell command input) is that this command will not generate an error nor warn if the given file argument cannot be opened successfully.

spamclear

[Option] Takes a list of messages and clears their ‘is-spam’ flag.

spamforget

[Option] Takes a list of messages and causes the spam-interface[518] to forget it has ever used them to train its Bayesian filter. Unless otherwise noted the ‘is-spam’ flag of the message is inspected to chose whether a message shall be forgotten to be ‘‘ham’’ or ‘‘spam’’.

spamham

[Option] Takes a list of messages and informs the Bayesian filter of the spam-interface[518] that they are ‘‘ham’’. This also clears the ‘is-spam’ flag of the messages in question.

spamrate

[Option] Takes a list of messages and rates them using the configured spam-interface[518] , without modifying the messages, but setting their ‘is-spam’ flag as appropriate; because the spam rating headers are lost the rate will be forgotten once the mailbox is left. Refer to the manual section Handling spam[19] for the complete picture of spam handling in S-nail.

spamset

[Option] Takes a list of messages and sets their ‘is-spam’ flag.

spamspam

[Option] Takes a list of messages and informs the Bayesian filter of the spam-interface[518] that they are ‘‘spam’’. This also sets the ‘is-spam’ flag of the messages in question.

thread

[Obsolete] The same as ‘sort thread’ (consider using a ‘commandalias’ as necessary).

Top

Like top[272] but always uses the headerpick[191] ‘type’ slot for white- and blacklisting header fields.

top

(to) Takes a message list and types out the first toplines[551] lines of each message on the users’ terminal. Unless a special selection has been established for the ‘top’ slot of the headerpick[191] command, the only header fields that are displayed are ‘From:’, ‘To:’, ‘CC:’, and ‘Subject:’. Top[271] will always use the ‘type’ headerpick[191] selection instead. It is possible to apply compression to what is displayed by setting topsqueeze[552] . Messages are decrypted and converted to the terminal character set if necessary.

touch

(tou) Takes a message list and marks the messages for saving in the secondary mailbox[117] MBOX[579] . S-nail deviates from the POSIX standard with this command, as a following next[218] command will display the following message instead of the current one.

Type

(T) Like type[275] but also displays header fields which would not pass the headerpick[191] selection, and all visualizable parts of MIME ‘multipart/alternative’ messages.

type

(t) Takes a message list and types out each message on the users terminal. The display of message headers is selectable via headerpick[191] . For MIME multipart messages, all parts with a content type of ‘text’, all parts which have a registered MIME type handler (see HTML mail and MIME attachments[9] ) which produces plain text output, and all ‘message’ parts are shown, others are hidden except for their headers. Messages are decrypted and converted to the terminal character set if necessary. The command mimeview[209] can be used to display parts which are not displayable as plain text.

unaccount[126]

See account[125] .

unalias[129]

(una) See alias[128] .

unanswered[133]

See answered[132] .

unbind[135]

See bind[134] .

uncollapse[144]

See collapse[143] .

uncolour[146]

See colour[145] .

undefine[155]

See define[154] .

undelete[157]

See delete[156] .

undraft[163]

See draft[162] .

unflag[181]

See flag[180] .

unfwdignore

[Obsolete] Superseded by the multiplexer headerpick[191] .

unfwdretain

[Obsolete] Superseded by the multiplexer headerpick[191] .

unignore

Superseded by the multiplexer headerpick[191] .

unmimetype[206]

See mimetype[205] .

unmlist[208]

See mlist[207] .

unmlsubscribe[211]

See mlsubscribe[210] .

Unread

Same as unread[278] .

unread

Takes a message list and marks each message as not having been read.

unretain

Superseded by the multiplexer headerpick[191] .

unsaveignore

[Obsolete] Superseded by the multiplexer headerpick[191] .

unsaveretain

[Obsolete] Superseded by the multiplexer headerpick[191] .

unset[252]

[Only new quoting rules] (uns) See set[251] .

unshortcut[256]

See shortcut[255] .

unsort[262]

See short.

unthread

[Obsolete] Same as unsort[262] .

urlcodec

Perform URL percent codec operations on the raw-data argument, rather according to RFC 3986. Supports vput[114] (see Command modifiers[21] ), and manages the error number ![329] . This is a character set agnostic and thus locale dependent operation, and it may decode bytes which are invalid in the current ttycharset[553] . [v15 behaviour may differ] This command does not know about URLs beside that.

The first argument specifies the operation: e[ncode] or d[ecode] perform plain URL percent en- and decoding, respectively. p[ath]enc[ode] and p[ath]dec[ode] perform a slightly modified operation which should be better for pathnames: it does not allow a tilde ‘~’, and will neither accept hyphen-minus ‘-’ nor dot ‘’. as an initial character. The remains of the line form the URL data which is to be converted. If the coding operation fails the error number ![329] is set to ^ERR[331] -CANCELED, and the unmodified input is used as the result; the error number may change again due to output or result storage errors.

varedit

[Only new quoting rules] Edit the values of or create the given variable(s) in the EDITOR[567] . Boolean variables cannot be edited, and variables can also not be unset[252] with this command.

varshow

[Only new quoting rules] This command produces the same output as the listing mode of set[251] , including verbose[558] ity adjustments, but only for the given variables.

verify

[Option] Takes a message list and verifies each message. If a message is not a S/MIME signed message, verification will fail for it. The verification process checks if the message was signed using a valid certificate, if the message sender’s email address matches one of those contained within the certificate, and if the message content has been altered.

version

Shows the version[559] and features[388] of S-nail.

vexpr

[Only new quoting rules] Evaluate arguments according to a given operator. This is a multiplexer command which can be used to perform signed 64-bit numeric calculations as well as byte string and string operations. It uses polish notation, i.e., the operator is the first argument and defines the number and type, and the meaning of the remaining arguments. An empty argument is replaced with a 0 if a number is expected. Supports vput[114] (see Command modifiers[21] ).

The result that is shown in case of errors is always ‘-1’ for usage errors and numeric operations, and the empty string for byte string and string operations; if the latter two fail to provide result data for ‘‘soft’’ errors, e.g., when a search operation failed, they also set the ![329] error number to ^ERR[331] -NODATA. Except when otherwise noted numeric arguments are parsed as signed 64-bit numbers, and errors will be reported in the error number ![329] as the numeric error ^ERR[331] -RANGE.

Numeric operations work on one or two signed 64-bit integers. One integer is expected by assignment (equals sign ‘=’), which does nothing but parsing the argument, thus detecting validity and possible overflow conditions, and unary not (tilde ‘~’), which creates the bitwise complement. Two integers are used by addition (plus sign ‘+’), subtraction (hyphen-minus ‘-’), multiplication (asterisk ‘*’), division (solidus ‘/’) and modulo (percent sign ‘%’), as well as for the bitwise operators logical or (vertical bar ‘|’, to be quoted) , bitwise and (ampersand ‘&’, to be quoted) , bitwise xor (circumflex ‘^’), the bitwise signed left- and right shifts (‘<<’, ‘>>’), as well as for the unsigned right shift ‘>>>’.

All numeric operators can be suffixed with a commercial at ‘@’, e.g., ‘*@’: this will turn the operation into a saturated one, which means that overflow errors and division and modulo by zero are no longer reported via the exit status, but the result will linger at the minimum or maximum possible value, instead of overflowing (or trapping). This is true also for the argument parse step. For the bitwise shifts, the saturated maximum is 63. Any catched overflow will be reported via the error number ![329] as ^ERR[331] -OVERFLOW.

? vexpr -@ +1 -9223372036854775808
? echo $?/$!/$^ERRNAME

Character set agnostic string functions have no notion of locale settings and character sets.

file-expand

Performs the usual Filename transformations[26] on its argument.

random

Generates a random string of the given length, or of PATH_MAX bytes (a constant from /usr/include) if the value 0 is given; the random string will be base64url encoded according to RFC 4648, and thus be usable as a (portable) filename.

Byte string operations work on 8-bit bytes and have no notion of locale settings and character sets, effectively assuming ASCII data.

length

Queries the length of the given argument.

hash

Calculates the Chris Torek hash of the given argument.

find

Byte-searches in the first for the second argument. Shows the resulting 0-based offset shall it have been found.

ifind

Identical to find, but works case-insensitively according to the rules of the ASCII character set.

substring

Creates a substring of its first argument. The second argument is the 0-based starting offset, a negative one counts from the end; the optional third argument specifies the length of the desired result, a negative length leaves off the given number of bytes at the end of the original string, by default the entire string is used; this operation tries to work around faulty arguments (set verbose[558] for error logs), but reports them via the error number ![329] as ^ERR[331] -OVERFLOW.

trim

Trim away whitespace characters from both ends of the argument.

trim-front

Trim away whitespace characters from the begin of the argument.

trim-end

Trim away whitespace characters from the end of the argument.

String operations work, sufficient support provided, according to the active user’s locale encoding and character set (see Character sets[14] ).

makeprint

(One-way) Converts the argument to something safely printable on the terminal.

regex

[Option] A string operation that will try to match the first argument with the regular expression given as the second argument. If the optional third argument has been given then instead of showing the match offset a replacement operation is performed: the third argument is treated as if specified via dollar-single-quote (see Shell-style argument quoting[24] ), and any occurrence of a positional parameter, e.g., 1[338] , is replaced by the corresponding match group of the regular expression:

? vput vexpr res regex bananarama \
(.*)NanA(.*) ’\${1}au\$2’
? echo $?/$!/$^ERRNAME: $res

iregex

On otherwise identical case-insensitive equivalent to regex:

? vput vexpr res ire bananarama \
(.*)NanA(.*) ’\${1}au\$2’
? echo $?/$!/$^ERRNAME: $res

vpospar

[Only new quoting rules] Manage the positional parameter stack (see 1[338] , #[336] , *[334] , @[335] as well as shift[257] ). If the first argument is ‘clear’, then the positional parameter stack of the current context, or the global one, if there is none, is cleared. If it is ‘set’, then the remaining arguments will be used to (re)create the stack, if the parameter stack size limit is excessed an ^ERR[331] -OVERFLOW error will occur.

If the first argument is ‘quote’, a round-trip capable representation of the stack contents is created, with each quoted parameter separated from each other with the first character of ifs[409] , 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 mode supports vput[114] (see Command modifiers[21] ). I.e., the subcommands ‘set’ and ‘quote’ can be used (in conjunction with eval[174] ) to (re)create an argument stack from and to a single variable losslessly.

? vpospar set hey, "’you ", world!
? echo $#: <${1}><${2}><${3}>
? vput vpospar x quote
? vpospar clear
? echo $#: <${1}><${2}><${3}>
? eval vpospar set ${x}
? echo $#: <${1}><${2}><${3}>

visual

(v) Takes a message list and invokes the display editor on each message. Modified contents are discarded unless the writebackedited[564] variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status.

write

(w) For conventional messages the body without all headers is written. The original message is never marked for deletion in the originating mail folder. The output is decrypted and converted to its native format as necessary. If the output file exists, the text is appended. If a message is in MIME multipart format its first part is written to the specified file as for conventional messages, handling of the remains depends on the execution mode. No special handling of compressed files is performed.

In interactive mode the user is consecutively asked for the filenames of the processed parts. For convience saving of each part may be skipped by giving an empty value, the same result as writing it to /dev/null[596] . Shell piping the part content by specifying a leading vertical bar ‘|’ character for the filename is supported. Other user input undergoes the usual Filename transformations[26] , including shell pathname wildcard pattern expansions (glob(7)) and shell variable expansion for the message as such, not the individual parts, and contents of the destination file are overwritten if the file previously existed.

[v15 behaviour may differ] In non-interactive mode any part which does not specify a filename is ignored, and suspicious parts of filenames of the remaining parts are URL percent encoded (as via urlcodec[280] ) to prevent injection of malicious character sequences, resulting in a filename that will be written into the current directory. Existing files will not be overwritten, instead the part number or a dot are appended after a number sign ‘#’ to the name until file creation succeeds (or fails due to other reasons).

xcall

[Only new quoting rules] The sole difference to call[136] is that the new macro is executed in place of the current one, which will not regain control: all resources of the current macro will be released first. This implies that any setting covered by localopts[200] will be forgotten and covered variables will become cleaned up. If this command is not used from within a call[136] ed macro it will silently be (a more expensive variant of) call[136] .

xit

(x) A synonym for exit[175] .

z

[Only new quoting rules] S-nail presents message headers in screen[488] fuls as described under the headers[193] command. Without arguments this command scrolls to the next window of messages, likewise if the argument is ‘+’. An argument of ‘-’ scrolls to the last, ‘^’ scrolls to the first, and ‘$’ to the last screen of messages. A number argument prefixed by ‘+’ or ‘−’ indicates that the window is calculated in relation to the current position, and a number without a prefix specifies an absolute position.

Z

[Only new quoting rules] Similar to z[291] , but scrolls to the next or previous window that contains at least one ‘new’ or flag[180] ged message.

COMMAND ESCAPES [28]

Here is a summary of the command escapes available in compose mode, which are used to perform special functions when composing messages. Command escapes are only recognized at the beginning of lines, and consist of a trigger (escape) and a command character. The actual escape character can be set via the internal variable escape[385] , it defaults to the tilde ‘~’. Otherwise ignored whitespace characters following the escape character will prevent a possible addition of the command line to the [Option]al history.

Unless otherwise noted all compose mode command escapes ensure proper updates of the variables which represent the error number ![329] and the exit status ?[328] . If the variable errexit[384] is set they will, unless stated otherwise, error out message compose mode and cause a progam exit if an operation fails. It is however possible to place the character hyphen-minus ‘-’ after (possible whitespace following) the escape character, which has an effect equivalent to the command modifier ignerr[111] . If the [Option]al key bindings are available it is possible to create bind[134] ings 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 command if the internal variable bang[356] is set, then return to the message.

~.

Same effect as typing the end-of-file character.

~: S-nail-command or ~_ S-nail-command

Execute the given S-nail command. Not all commands, however, are allowed.

~< filename

Identical to ~r[320] .

~<! command

command is executed using the shell. Its standard output is inserted into the message.

~?

Write a summary of command escapes.

~@ [filename...]

Append or edit the list of attachments. Does not manage the error number ![329] and the exit status ?[328] , (please use ~^[302] instead if this is a concern). A list of filename arguments is expected as shell tokens (see Shell-style argument quoting[24] ; token-separating commas are ignored, too), to be interpreted as documented for the command line option −a[54] , with the message number exception as below.

Without filename arguments the attachment list is edited, entry by entry; if a filename is left empty, that attachment is deleted from the list; once the end of the list is reached either new attachments may be entered or the session can be quit by committing an empty ‘‘new’’ attachment.

For all mode, if a given filename solely consists of the number sign ‘#’ followed by a valid message number of the currently active mailbox, then the given message is attached as a ‘message/rfc822’ MIME message part. As the shell comment character the number sign must be quoted.

~| command

Pipe the message through the specified filter command. If the command gives no output or terminates abnormally, retain the original text of the message. E.g., the command fmt(1) is often used as a rejustifying filter.

~^ cmd [subcmd [arg3 [arg4]]]

Low-level command meant for scripted message access, i.e., for on-compose-splice[449] and on-compose-splice-shell[450] . The used protocol is likely subject to changes, and therefore the mentioned hooks receive the used protocol version as an initial line. In general the first field of a 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. Does not manage the error number ![329] and the exit status ?[328] , because errors are reported via the protocol (hard errors like I/O failures cannot be handled). This command has read-only access to several virtual pseudo headers in the S-nail private namespace, which may not exist (except for the first):

‘Mailx-Command:’

The name of the command that generates the message, one of ‘forward’, ‘Lreply’, ‘mail’, ‘Reply’, ‘reply’, ‘resend’.

‘Mailx-Raw-To:’
‘Mailx-Raw-Cc:’
‘Mailx-Raw-Bcc:’

Represent the frozen initial state of these headers before any transformation (e.g., alias[128] , alternates[130] , recipients-in-cc[478] etc.) took place.

‘Mailx-Orig-From:’
‘Mailx-Orig-To:’
‘Mailx-Orig-Cc:’
‘Mailx-Orig-Bcc:’

The values of said headers of the original message which has been addressed by any of reply[236] , forward[189] , resend[240] .

The status codes are:

‘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. The address lines consist of two fields, the first of which is the plain address, e.g., ‘bob@exam.ple’, separated by a single ASCII SP space from the second which contains the unstripped address, even if that is identical to the first field, e.g., ‘(Lovely) Bob <bob@exam.ple>’. All the input, including the empty line, must be consumed before further commands can be issued.

‘212’

Status ok; the rest of the line is optionally used for more status. What follows are lines of furtherly unspecified string content, terminated by an empty line. All the input, including the empty line, must be consumed before further commands can be issued.

‘500’

Syntax error; invalid command.

‘501’

Syntax error in parameters or arguments.

‘505’

Error: an argument fails verification. For example an invalid address has been specified, or an attempt was made to modify anything in S-nail’s own namespace.

‘506’

Error: an otherwise valid argument is rendered invalid due to context. For example, a second address is added to a header which may consist of a single address only.

If a command indicates failure then the message will have remained unmodified. Most commands can fail with ‘500’ if required arguments are missing (false command usage). The following (case-insensitive) commands are supported:

header

This command allows listing, inspection, and editing of message headers. Header name case is not normalized, and case-insensitive comparison should be used when matching names. The second argument specifies the subcommand to apply, one of:

list

Without a third argument a list of all yet existing headers is given via ‘210’; this command is the default command of header if no second argument has been given. A third argument restricts output to the given header only, which may fail with ‘501’ if no such field is defined.

show

Shows the content of the header given as the third argument. Dependent on the header type this may respond with ‘211’ or ‘212’; any failure results in ‘501’.

remove

This will remove all instances of the header given as the third argument, reporting ‘210’ upon success, ‘501’ if no such header can be found, and Ql 505 on S-nail namespace violations.

remove-at

This will remove from the header given as the third argument the instance at the list position (counting from one!) given with the fourth argument, reporting ‘210’ upon success or ‘505’ if the list position argument is not a number or on S-nail namespace violations, and ‘501’ if no such header instance exists.

insert

Create a new or an additional instance of the header given in the third argument, with the header body content as given in the fourth argument (the remains of the line). It may return ‘501’ if the third argument specifies a free-form header field name that is invalid, or if body content extraction fails to succeed, ‘505’ if any extracted address does not pass syntax and/or security checks or on S-nail namespace violations, and ‘506’ to indicate prevention of excessing a single-instance header — note that ‘Subject:’ can be appended to (a space separator will be added automatically first).

‘210’ is returned upon success, followed by the name of the header and the list position of the newly inserted instance. The list position is always 1 for single-instance header fields. All free-form header fields are managed in a single list.

attachment

This command allows listing, removal and addition of message attachments. The second argument specifies the subcommand to apply, one of:

list

List all attachments via ‘212’, or report ‘501’ if no attachments exist. This command is the default command of attachment if no second argument has been given.

remove

This will remove the attachment given as the third argument, and report ‘210’ upon success or ‘501’ if no such attachment can be found. If there exists any path component in the given argument, then an exact match of the path which has been used to create the attachment is used directly, but if only the basename of that path matches then all attachments are traversed to find an exact match first, and the removal occurs afterwards; if multiple basenames match, a ‘506’ error occurs. Message attachments are treated as absolute pathnames.

If no path component exists in the given argument, then all attachments will be searched for ‘filename=’ parameter matches as well as for matches of the basename of the path which has been used when the attachment has been created; multiple matches result in a ‘506’.

remove-at

This will interpret the third argument as a number and remove the attachment at that list position (counting from one!), reporting ‘210’ upon success or ‘505’ if the argument is not a number or ‘501’ if no such attachment exists.

insert

Adds the attachment given as the third argument, specified exactly as documented for the command line option −a[54] , and supporting the message number extension as documented for ~@[300] . This reports ‘210’ upon success, with the index of the new attachment following, ‘505’ if the given file cannot be opened, ‘506’ if an on-the-fly performed character set conversion fails, otherwise ‘501’ is reported; this is also reported if character set conversion is requested but not available.

attribute

This uses the same search mechanism as described for remove and prints any known attributes of the first found attachment via ‘212’ upon success or ‘501’ if no such attachment can be found. The attributes are written as lines of keyword and value tuples, the keyword being separated from the rest of the line with an ASCII SP space character.

attribute-at

This uses the same search mechanism as described for remove-at and is otherwise identical to attribute.

attribute-set

This uses the same search mechanism as described for remove, and will assign the attribute given as the fourth argument, which is expected to be a value tuple of keyword and other data, separated by a ASCII SP space or TAB tabulator character. If the value part is empty, then the given attribute is removed, or reset to a default value if existence of the attribute is crucial.

It returns via ‘210’ upon success, with the index of the found attachment following, ‘505’ for message attachments or if the given keyword is invalid, and ‘501’ if no such attachment can be found. The following keywords may be used (case-insensitively):

‘filename’

Sets the filename of the MIME part, i.e., the name that is used for display and when (suggesting a name for) saving (purposes).

‘content-description’

Associate some descriptive information to the attachment’s content, used in favour of the plain filename by some MUAs.

‘content-id’

May be used for uniquely identifying MIME entities in several contexts; this expects a special reference address format as defined in RFC 2045 and generates a ‘505’ upon address content verification failure.

‘content-type’

Defines the media type/subtype of the part, which is managed automatically, but can be overwritten.

‘content-disposition’

Automatically set to the string ‘attachment’.

attribute-set-at

This uses the same search mechanism as described for remove-at and is otherwise identical to attribute-set.

~A

The same as ‘~i[314] Sign[497] ’.

~a

The same as ‘~i[314] sign[498] ’.

~b name ...

Add the given names to the list of blind carbon copy recipients.

~c name ...

Add the given names to the list of carbon copy recipients.

~d

Read the file specified by the DEAD[566] variable into the message.

~e

Invoke the text editor on the message collected so far. After the editing session is finished, the user may continue appending text to the message.

~F messages

Read the named messages into the message being sent, including all message headers and MIME parts. If no messages are specified, read in the current message, the ‘‘dot’’.

~f messages

Read the named messages into the message being sent. If no messages are specified, read in the current message, the ‘‘dot’’. Strips down the list of header fields according to the ‘type’ white- and blacklist selection of headerpick[191] . For MIME multipart messages, only the first displayable part is included.

~H

Edit the message header fields ‘From:’, ‘Reply-To:’ and ‘Sender:’ by typing each one in turn and allowing the user to edit the field. The default values for these fields originate from the from[397] , reply-to[484] and sender[492] variables.

~h

Edit the message header fields ‘To:’, ‘Cc:’, ‘Bcc:’ and ‘Subject:’ by typing each one in turn and allowing the user to edit the field.

~I variable

Insert the value of the specified variable into the message. The message remains unaltered if the variable is unset or empty. Any embedded character sequences ‘\t’ horizontal tabulator and ‘\n’ line feed are expanded in posix[469] mode; otherwise the expansion should occur at set[251] time by using the command modifier wysh.

~i variable

Insert the value of the specified variable followed by a newline character into the message. The message remains unaltered if the variable is unset or empty. Any embedded character sequences ‘\t’ horizontal tabulator and ‘\n’ line feed are expanded in posix[469] mode; otherwise the expansion should occur at set[251] time by using the command modifier wysh.

~M messages

Read the named messages into the message being sent, indented by indentprefix[414] . If no messages are specified, read the current message, the ‘‘dot’’.

~m messages

Read the named messages into the message being sent, indented by indentprefix[414] . If no messages are specified, read the current message, the ‘‘dot’’. Strips down the list of header fields according to the ‘type’ white- and blacklist selection of headerpick[191] . For MIME multipart messages, only the first displayable part is included.

~p

Display the message collected so far, prefaced by the message header fields and followed by the attachment list, if any.

~q

Abort the message being sent, copying it to the file specified by the DEAD[566] variable if save[487] is set.

~R filename

Identical to ~r[320] , but indent each line that has been read by indentprefix[414] .

~r filename [HERE-delimiter]

Read the named file, object to the usual Filename transformations[26] , into the message; if (the expanded) filename is the hyphen-minus ‘-’ then standard input is used, e.g., for pasting purposes. Only in this latter mode HERE-delimiter may be given: if it is data will be read in until the given HERE-delimiter is seen on a line by itself, and encountering EOF is an error; the HERE-delimiter is a required argument in non-interactive mode; if it is single-quote quoted then the pasted content will not be expanded, [v15 behaviour may differ] otherwise a future version of S-nail may perform shell-style expansion on the content.

~s string

Cause the named string to become the current subject field. Newline (NL) and carriage-return (CR) bytes are invalid and will be normalized to space (SP) characters.

~t name ...

Add the given name(s) to the direct recipient list.

~U messages

Read in the given / current message(s) excluding all headers, indented by indentprefix[414] .

~u messages

Read in the given / current message(s), excluding all headers.

~v

Invoke an alternate editor (defined by the VISUAL[589] environment variable) on the message collected so far. Usually, the alternate editor will be a screen editor. After the editor is quit, the user may resume appending text to the end of the message.

~w filename

Write the message onto the named file, which is object to the usual Filename transformations[26] . If the file exists, the message is appended to it.

~x

Same as ~q[318] , except that the message is not saved at all.

INTERNAL VARIABLES [29]

Internal S-nail variables are controlled via the set[251] and unset[252] commands; prefixing a variable name with the string ‘no’ and calling set[251] has the same effect as using unset[252] : ‘unset crt’ and ‘set nocrt’ do the same thing. Creation or editing of variables can be performed in the EDITOR[567] with the command varedit[281] . varshow[282] will give more insight on the given variable(s), and set[251] , when called without arguments, will show a listing of all variables. Both commands support a more verbose[558] listing mode. Some well-known variables will also become inherited from the program ENVIRONMENT[32] implicitly, others can be imported explicitly with the command environ[172] 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 optional) string value. For the latter proper quoting is necessary upon assignment time, the introduction of the section COMMANDS[20] 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 the string values will be interpreted as numbers, colour names, normal text etc., but 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’ indeed means ‘server:port’ if a ‘port’ had been specified in the contextual Uniform Resource Locator URL (see On URL syntax and credential lookup[12] ). 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. Variables which support chains are explicitly documented as such.

Initial settings [30]
The standard POSIX 2008/Cor 2-2016 mandates the following initial variable settings: noallnet[341] , noappend[342] , asksub[349] , noaskbcc[346] , noautoprint[354] , nobang[356] , nocmd[368] , nocrt[373] , nodebug[377] , nodot[379] , escape[385] set to ‘~’, noflipr[389] , nofolder[390] , header[399] , nohold[406] , noignore[411] , noignoreeof[412] , nokeep[415] , nokeepsave[417] , nometoo[430] , nooutfolder[444] , nopage[453] , prompt[471] set to ‘? ’, noquiet[473] , norecord[479] , save[487] , nosendwait[493] , noshowto[496] , noSign[497] , nosign[498] , toplines[551] set to ‘5’.

Notes: S-nail does not support the noonehop variable – use command line options or mta-arguments[437] to pass options through to a mta[436] . And the default global s-nail.rc[597] file, which is loaded unless the −:[52] (with according argument) or −n[70] command line options have been used, or the MAILX_NO_SYSTEM_RC[578] environment variable is set (see Resource files[34] ) bends those initial settings a bit, e.g., it sets the variables hold[406] , keepsave[417] and keep[415] , to name a few, establishes a default headerpick[191] selection etc., and should thus be taken into account.

Variables [31]

?

(Read-only) The exit status of the last command, or the return[246] value of the macro call[136] ed last. This status has a meaning in the state machine: in conjunction with errexit[384] any non-0 exit status will cause a program exit, and in posix[469] mode any error while loading (any of the) resource files will have the same effect. ignerr[111] , one of the Command modifiers[21] , 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[331] , and the error name and documentation string can be queried via ^ERRNAME[333] and ^ERRDOC[332] . [v15 behaviour may differ] This machinery is new and the error number is only really usable if a command explicitly states that it manages the variable ![329] , for others errno will be used in case of errors, or ^ERR[331] -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[246] .

^

(Read-only) This is a multiplexer variable which performs dynamic 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. [v15 behaviour may differ] This machinery is new and is usually reliable only if a command explicitly states that it manages the variable ![329] , which is effectively identical 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

*

(Read-only) Expands all positional parameters (see 1[338] ), separated by a space character. [v15 behaviour 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[338] ), separated 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 define[154] d and call[136] ed macro this expands to the name of the calling macro, or to the empty string if the macro is running from top-level. For the [Option]al regular expression search and replace operator of vexpr[285] 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 further parameters can be accessed with this syntax, too, e.g., ‘2’, ‘3’ etc.; positional parameters can be shifted off the stack by calling shift[257] . The parameter stack contains, e.g., the arguments of a call[136] ed define[154] d macro, the matching groups of the [Option]al regular expression search and replace expression of vexpr[285] , and can be explicitly created or overwritten with the command vpospar[286] .

account

(Read-only) Is set to the active account[125] .

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 comparing addresses.

append

(Boolean) Causes messages saved in the secondary mailbox[117] MBOX[579] 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 appear after the message has been edited.

askattach

(Boolean) If set, S-nail asks for files to attach at the end of each message. An empty line finalizes the list.

askcc

(Boolean) Causes the user to be prompted for carbon copy recipients (at the end of each message if askatend[343] or bsdcompat[358] are set).

askbcc

(Boolean) Causes the user to be prompted for blind carbon copy recipients (at the end of each message if askatend[343] or bsdcompat[358] are set).

asksend

(Boolean) Causes the user to be prompted for confirmation to send the message or reenter compose mode after having been shown an envelope summary. This is by default enabled.

asksign

(Boolean)[Option] Causes the user to be prompted if the message is to be signed at the end of each message. The smime-sign[510] variable is ignored when this variable is set.

asksub

(Boolean) Causes S-nail to prompt for the subject upon entering compose mode unless a subject already exists.

attrlist

A sequence of characters to display in the ‘attribute’ column of the headline[400] as shown in the display of headers[193] ; each for one type of messages (see Message states[15] ), with the default being ‘NUROSPMFAT+−$~’ or ‘NU  *HMFAT+−$~’ if the bsdflags[359] variable 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.

‘+’

start of a collapsed thread.

‘-’

an uncollapsed thread (TODO ignored for now).

‘$’

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 threaded mode is entered (see the collapse[143] command).

autoprint

(Boolean) Enable automatic type[275] ing of a(n existing) ‘‘successive’’ message after delete[156] and undelete[157] commands, e.g., the message that becomes the new ‘‘dot’’ is shown automatically, as via dp[159] or dt[160] .

autosort

Causes sorted mode (see the sort[261] command) to be entered automatically 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 ![118] shell escape command and ~![294] , one of the compose mode COMMAND ESCAPES[28] . 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 sequences as a whole, but byte-by-byte, and the latter is what S-nail actually reads. This variable specifies the timeout in milliseconds that the MLE (see On terminal control and line editor[17] ) 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[343] and all other variables prefixed with ‘bsd’; it also changes the behaviour of emptystart[383] (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 after the ‘To:’ field in message headers and with the ~h[312] COMMAND ESCAPES[28] .

build-os , build-osenv

(Read-only) The operating system S-nail has been build for, usually taken from uname(1) via ‘uname -s’ and ‘uname -srm’, respectively, the former being lowercased.

charset-7bit

The value that should appear in the ‘charset=’ parameter of ‘Content-Type:’ MIME header fields when no character set conversion of the message data was performed. This defaults to US-ASCII, and the chosen character set should be US-ASCII compatible.

charset-8bit

[Option] The default 8-bit character set that is used as an implicit last member of the variable sendcharsets[490] . This defaults to UTF-8 if character set conversion capabilities are available, and to ISO-8859-1 otherwise, in which case the only supported character set is ttycharset[553] and this variable is effectively ignored. Refer to the section Character sets[14] for the complete picture of character set conversion in S-nail.

charset-unknown-8bit

[Option] RFC 1428 specifies conditions when internet mail gateways shall ‘‘upgrade’’ the content of a mail message by using a character set with the name ‘unknown-8bit’. Because of the unclassified nature of this character set S-nail will not be capable to convert this character set to any other character set. If this variable is set any message part which uses the character set ‘unknown-8bit’ is assumed to really be in the character set given in the value, otherwise the (final) value of charset-8bit[366] is used for this purpose.

This variable will also be taken into account if a MIME type (see The mime.types files[35] ) of a MIME message part that uses the ‘binary’ character set is forcefully treated as text.

cmd

The default value for the pipe[225] command.

colour-disable

(Boolean)[Option] Forcefully disable usage of colours. Also see the section Coloured display[18] .

colour-pager

(Boolean)[Option] Whether colour shall be used for output that is paged through PAGER[581] . Note that pagers may need special command 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 S-nail may perform adjustments dependent on the value of the environment variable PAGER[581] (see there for more).

contact-mail , contact-web

(Read-only) Addresses for contact per email and web, respectively, e.g., for bug reports, suggestions, or help regarding S-nail. The former can be used directly: ‘? eval[174] mail[203] $contact-mail’.

crt

In a(n interactive) terminal session, then if this valued variable is set it will be used as a threshold to determine how many lines the given output has to span before it will be displayed via the configured PAGER[581] ; Usage of the PAGER[581] 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 treshold (see LINES[572] , screen[488] 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[434] of the message, is unrelated to the number of display lines. (The software is old and historically the relation was a given thing.)

customhdr

Define a set of custom headers to be injected into newly composed or forwarded messages; it is also possible to create custom headers in compose mode with ~^[302] , which can be automated by setting one of the hooks on-compose-splice[449] or on-compose-splice-shell[450] . The value is interpreted as a comma-separated list of custom headers to be injected, to include commas in the header bodies escape them with reverse solidus. [v15 behaviour may differ] Overwriting of automatically managed headers is neither supported nor prevented.

? set customhdr=’Hdr1: Body1-1\, Body1-2, Hdr2: Body2’

datefield

Controls the appearance of the ‘%d’ date and time format specification of the headline[400] variable, that is used, for example, when viewing the summary of headers[193] . 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[376] .

datefield-markout-older

Only used in conjunction with datefield[375] . 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 formatting can be assigned. The default is ‘%Y-%m-%d’.

debug

(Boolean) Enables debug messages and obsoletion warnings, disables the actual delivery of messages and also implies norecord[479] as well as nosave[487] .

disposition-notification-send

(Boolean)[Option] Emit a ‘Disposition-Notification-To:’ header (RFC 3798) with the message. This requires the from[397] variable to be set.

dot

(Boolean) When dot is set, a period ‘.’ on a line by itself during message input in (interactive or batch −#[82] ) compose mode will be treated as end-of-message (in addition to the normal end-of-file condition). This behaviour is implied in posix[469] mode with a set ignoreeof[412] .

dotlock-ignore-error

(Boolean)[Option] Synchronization of mailboxes which S-nail treats as primary system mailbox[116] es (see, e.g., the notes on Filename transformations[26] , as well as the documentation of file[177] ) will be protected with so-called dotlock files—the traditional mail spool file locking method—in addition to system file locking. Because S-nail ships with a privilege-separated dotlock creation program that should always be able to create such a dotlock file there is no good reason to ignore dotlock file creation errors, and thus these are fatal unless this variable is set.

editalong

(Boolean) If this variable is set then the editor is started automatically when a message is composed in interactive mode, as if the ~e[308] COMMAND ESCAPES[28] had been specified. The editheaders[382] 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 S-nail normally writes ‘‘No mail for user’’ and exits immediately if a mailbox is empty or does not exist. If this variable is set S-nail starts even with an empty or non-existent mailbox (the latter behaviour furtherly depends upon bsdcompat[358] , though).

errexit

(Boolean) Let each command with a non-0 exit status, including every call[136] ed macro which return[246] s a non-0 status, cause a program exit unless prefixed by ignerr[111] (see Command modifiers[21] ). This also affects COMMAND ESCAPES[28] , but which use a different modifier for ignoring the error. Please refer to the variable ?[328] for more on this topic.

escape

The first character of this value defines the escape character for COMMAND ESCAPES[28] in compose mode. The default value is the character tilde ‘~’. If set to the empty string, command escapes are disabled.

expandaddr

If not set then file and command pipeline targets are not allowed, and any such address will be filtered out, giving a warning message. If set without a value then all possible recipient address specifications will be accepted – see the section On sending mail, and non-interactive mode[7] for more on this. To accept them, but only in interactive mode, or when tilde commands were enabled explicitly by using one of the command line options −~[81] or −#[82] , set this to the (case-insensitive) value ‘restrict’ (it actually acts like ‘restrict,-all,+name,+addr’, so that care for ordering issues must be taken) .

In fact the value is interpreted as a comma-separated list of values. If it contains ‘fail’ then the existence of disallowed specifications is treated as a hard send error instead of only filtering them out. The remaining values specify whether a specific type of recipient address specification is allowed (optionally indicated by a plus sign ‘+’ prefix) or disallowed (prefixed with a hyphen-minus ‘-’). The value ‘all’ addresses all possible address specifications, ‘file’ file targets, ‘pipe’ command pipeline targets, ‘name’ plain user names and (MTA) aliases and ‘addr’ network addresses. These kind of values 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 S-nail is in interactive mode or has been started with the −~[81] or −#[82] command line option; in the latter case(s) any address may be used, then.

Historically invalid network addressees are silently stripped off. To change this so that any encountered invalid email address causes a hard error it must be ensured that ‘failinvaddr’ is an entry in the above list. Setting this automatically enables network addressees (it actually acts like ‘failinvaddr,+addr’, so that care for ordering issues must be taken) .

expandargv

Unless this variable is set additional mta[436] (Mail-Transfer-Agent) arguments from the command line, as can be given after a −- separator, are ignored due to safety reasons. However, if set to the special (case-insensitive) value ‘fail’, then the presence of additional MTA arguments is treated as a hard error that causes S-nail to exit with failure status. A lesser strict variant is the otherwise identical ‘restrict’, which does accept such arguments in interactive mode, or if tilde commands were enabled explicitly by using one of the command line options −~[81] or −#[82] .

features

(Read-only) String giving a list of optional features, preceded with a plus sign ‘+’ if it is available, and a hyphen-minus ‘-’ otherwise. The output of the command version[284] will include 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 address all recipients included in the header of a message (reply[236] , respond[242] , followup[185] ) into the uppercase variants, which by default address the sender only (Reply[235] , Respond[241] , Followup[184] ) and vice versa. The commands replysender[238] , respondsender[244] , followupsender[187] as well as replyall[237] , respondall[243] , followupall[186] are not affected by the current setting of flipr[389] .

folder

The default path under which mailboxes are to be saved: filenames 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[26] ; also see file[177] for more on this topic. 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[568] will be prefixed automatically. Once the actual value is evaluated first, the internal variable folder-resolved[392] will be updated for caching purposes.

folder-hook-FOLDER, folder-hook

Names a define[154] d macro which will be called whenever a file[177] is opened. The macro will also be invoked when new mail arrives, but message lists for commands executed from the macro only include newly arrived messages then. localopts[200] 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 specifications, the fully expanded name of a folder, without metacharacters, is used to avoid ambiguities. However, if the mailbox resides under folder[390] 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[390] once that evaluation has occurred; rather internal.

followup-to

(Boolean) Controls whether a ‘Mail-Followup-To:’ header is generated when sending messages to known mailing lists. Also see followup-to-honour[394] and the commands mlist[207] , mlsubscribe[210] , reply[236] and Lreply[201] .

followup-to-honour

Controls whether a ‘Mail-Followup-To:’ header is honoured when group-replying to a message via reply[236] or Lreply[201] . This is a quadoption; if set without a value it defaults to ‘‘yes’’. Also see followup-to[393] and the commands mlist[207] and mlsubscribe[210] .

forward-as-attachment

(Boolean) Original messages are normally sent as inline text with the forward[189] command, and only the first part of a multipart 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

The string to put before the text of a message with the forward[189] command instead of the default ‘‘-------- Original Message --------’’. No heading is put if it is set to the empty string. This variable is ignored if the forward-as-attachment[395] 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 system(s) responsible for the writing of the message. According to that RFC setting the sender[492] variable is required if from contains more than one address. When reply[236] ing to messages these addresses are handled as if they were in the alternates[130] list.

If a file-based MTA is used, then from (or, if that contains multiple addresses, sender[492] ) can nonetheless be enforced to appear as the envelope sender address at the MTA protocol level (the RFC 5321 reverse-path), either by using the −r[73] 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[477] .

If the machine’s hostname is not valid at the Internet (for example at a dialup machine) then either this variable or hostname[407] ([v15-compat] a SMTP-based mta[436] adds even more fine-tuning capabilities with smtp-hostname[515] ), 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[427] or stealthmua[547] ).

fullnames

(Boolean) Due to historical reasons comments and name parts of email addresses are removed by default when sending mail, replying to or forwarding a message. If this variable is set such stripping is not performed.

fwdheading

[Obsolete] Predecessor of forward-inject-head[396] .

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[182] . Unless in posix[469] mode a header summary will also be displayed on folder changes. The command line option −N[69] can be used to set noheader[399] .

headline

A format string to use for the summary of headers[193] , similar to the ones used for printf(3) formats. 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. Valid format specifiers are:

‘%%’

A plain percent sign.

‘%>’

‘‘Dotmark’’: a space character but for the current message (‘‘dot’’), for which it expands to ‘>’.

‘%<’

‘‘Dotmark’’: a space character but for the current message (‘‘dot’’), for which it expands to ‘<’.

‘%$’

[Option] The spam score of the message, as has been classified via the command spamrate[268] . 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[350] .

‘%d’

The date found in the ‘From:’ header of the message when datefield[375] 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[375] .

‘%e’

The indenting level in threaded mode.

‘%f’

The address of the message sender.

‘%i’

The message thread tree structure. (Note that this format does not support a field width.)

‘%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).

‘%S’

Message subject (if any) in double quotes.

‘%T’

Message recipient flags: is the addressee of the message a known or subscribed mailing list – see mlist[207] and mlsubscribe[210] .

‘%t’

The position in threaded/sorted order.

The default is ‘%>%a%m %-18f %16d %4l/%−5o %i%-s’, or ‘%>%a%m %20-f  %16d %3l/%−5o %i%-S’ if bsdcompat[358] is set. Also see attrlist[350] and headline-bidi[401] .

headline-bidi

Bidirectional text requires special treatment when displaying headers, because numbers (in dates or for file sizes etc.) will not affect the current text direction, in effect resulting in ugly line layouts when arabic or other right-to-left text is to be displayed. On the other hand only a minority of terminals is capable to correctly handle direction changes, so that user interaction is necessary for acceptable results. Note that extended host system support is required nonetheless, e.g., detection of the terminal character set is one precondition; and this feature only works in an Unicode (i.e., UTF-8) locale.

In general setting this variable will cause S-nail to encapsulate text fields that may occur when displaying headline[400] (and some other fields, like dynamic expansions in prompt[471] ) with special Unicode control sequences; it is possible to fine-tune the terminal support level by assigning a value: no value (or any value other than ‘1’, ‘2’ and ‘3’) will make S-nail assume that the terminal is capable to properly deal with Unicode version 6.3, in which case text is embedded in a pair of U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE) characters. In addition no space on the line is reserved for these characters.

Weaker support is chosen by using the value ‘1’ (Unicode 6.3, but reserve the room of two spaces for writing the control sequences onto the line). The values ‘2’ and ‘3’ select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter again reserves room for two spaces in addition.

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[405] .

history-gabby

(Boolean)[Option] Add more entries to the history as is normally done.

history-gabby-persist

(Boolean)[Option] S-nail’s own MLE will not save the additional history-gabby[403] entries in persistent storage unless this variable 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[402] .

history-size

[Option] Setting this variable imposes a limit on the number of concurrent history entries. If set to the value 0 then no further history entries will be added, and loading and incorporation of the history-file[402] upon program startup can also be suppressed by doing this. Runtime changes will not be reflected, but will affect the number of entries saved to permanent storage.

hold

(Boolean) This setting controls whether messages are held in the system inbox[413] , 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:’. If either of from[397] or this variable Is set the message and MIME part related unique ID fields ‘Message-ID:’ and ‘Content-ID:’ will be created (except when disallowed by message-id-disable[427] or stealthmua[547] ). 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[436] smtp-hostname[515] also influences the results: one should produce some test messages with the desired combination of hostname, and/or from[397] , sender[492] etc. first.

idna-disable

(Boolean)[Option] Can be used to turn off the automatic conversion of domain names according to the rules of IDNA (internationalized domain names for applications). Since the IDNA code assumes that domain names are specified with the ttycharset[553] 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 differ] 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 characters are extracted and assigned to the variable ifs-ws[410] .

a.

ifs-ws will be ignored at the beginning and end of input. Diverging from POSIX shells default whitespace is removed in addition, which is owed to the entirely different line content extraction rules.

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 characters in ifs[409] .

ignore

(Boolean) Ignore interrupt signals from the terminal while entering messages; instead echo them as ‘@’ characters and discard the current line.

ignoreeof

(Boolean) Ignore end-of-file conditions (‘control-D’) in compose mode on message input and in interactive command input. If set an interactive command input session can only be left by explicitly using one of the commands exit[175] and quit[229] , and message input in compose mode can only be terminated by entering a period ‘.’ on a line by itself or by using the ~.[295] COMMAND ESCAPES[28] ; Setting this implies the behaviour that dot[379] describes in posix[469] mode.

inbox

If this is set to a non-empty string it will specify the users primary system mailbox[116] , overriding MAIL[575] and the system-dependent default, and (thus) be used to replace ‘%’ when doing Filename transformations[26] ; also see file[177] for more on this topic. The value supports a subset of transformations itself.

indentprefix

String used by the ~m[316] , ~M[315] and ~R[319] COMMAND ESCAPES[28] and by the quote[474] option for indenting messages, in place of the normal tabulator character ‘^I’, which is the default. Be sure to quote the value if it contains spaces or tabs.

keep

(Boolean) If set, an empty primary system mailbox[116] file is not removed. Note that, in conjunction with posix[469] mode any empty file will be removed unless this variable is set. This may improve the interoperability with other mail user agents when using a common folder directory, and prevents malicious users from creating fake mailboxes in a world-writable spool directory. [v15 behaviour may differ] Only local regular (MBOX) files are covered, Maildir or other mailbox types will never be removed, even if empty.

keep-content-length

(Boolean) When (editing messages and) writing MBOX mailbox files S-nail can be told to keep the ‘Content-Length:’ and ‘Lines:’ header fields that some MUAs generate by setting this variable. Since S-nail does neither use nor update these non-standardized header fields (which in itself shows one of their conceptual problems), stripping them should increase interoperability in between MUAs that work with with same mailbox files. Note that, if this is not set but writebackedited[564] , as below, is, a possibly performed automatic stripping of these header fields already marks the message as being modified. [v15 behaviour may differ] At some future time S-nail will be capable to rewrite and apply an mime-encoding[434] 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 S-nail is quit. This setting causes all saved message to be retained.

line-editor-disable

(Boolean) Turn off any enhanced line editing capabilities (see On terminal control and line editor[17] for more).

line-editor-no-defaults

(Boolean)[Option] Do not establish any default key binding.

log-prefix

Error log message prefix string (‘s-nail: ’).

mailbox-display

(Read-only) The name of the current mailbox (file[177] ), 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[34] . Use this file for commands that are not understood by other POSIX mailx(1) implementations, i.e., mostly anything which is not covered by Initial settings[30] .

markanswered

(Boolean) When a message is replied to and this variable is set, it is marked as having been answered[132] . See the section Message states[15] .

mbox-rfc4155

(Boolean) When opening MBOX mailbox databases S-nail by default uses tolerant POSIX rules for detecting message boundaries (so-called ‘From_’ lines) due to compatibility reasons, instead of the stricter rules that have been standardized in RFC 4155. This behaviour can be switched to the stricter RFC 4155 rules by setting this variable. (This is never necessary for any message newly generated by S-nail, it only applies to messages generated by buggy or malicious MUAs, or may occur in old MBOX databases: S-nail itself will choose a proper mime-encoding[434] to avoid false interpretation of ‘From_’ content lines in the MBOX database.)

This may temporarily be handy when S-nail 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. Finally the variable can be unset again:

define mboxfix {
localopts yes; wysh set mbox-rfc4155;\
wysh File "${1}"; eval copy * "${2}"
}
call mboxfix /tmp/bad.mbox /tmp/good.mbox

memdebug

(Boolean) Internal development variable.

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[436] (Mail-Transfer-Agent) or the SMTP server. Note that according to RFC 5321 a SMTP server is not required to add this field by itself, so it should be ensured that it accepts messages without ‘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[115] prefix when set[251] ting 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[115] prefix when set[251] ting the variable(s) instead).

metoo

(Boolean) Usually, when an alias[128] expansion contains the sender, the sender is removed from the expansion. Setting this option suppresses these removals. Note that a set metoo[430] also causes a ‘-m’ option to be passed through to the mta[436] (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[434] ) that is required to send this part over mail transport, i.e., a computation 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 identified as text data at first glance (by a ‘.txt’ or ‘.html’ file extension), then the original ‘Content-Type:’ will not be overwritten.

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 S-nail’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[35] (also see HTML mail and MIME attachments[9] ) 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 S-nail will try to re-classify such MIME message parts, if possible, for example via a possibly existing attachment filename. A non-empty value may also be given, in which case a number is expected, actually a carrier of bits. Creating the bit-carrying number is a simple addition:

? !echo Value should be set to $((2 + 4 + 8))
Value should be set to 14

If bit two is set (2) then the detected mimetype[205] 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 (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 (8) then as a last resort the actual content of ‘application/octet-stream’ parts will be inspected, so that data which looks like plain text can be treated as such.

mime-encoding

The MIME ‘Content-Transfer-Encoding’ to use in outgoing text messages and message parts, where applicable. (7-bit clean text messages are sent as-is, without a transfer encoding.) Valid values are:

‘8bit’

(Or ‘8b’.) 8-bit transport effectively causes the raw data be passed through unchanged, but may cause problems when transferring mail messages over channels that are not ESMTP (RFC 1869) compliant. Also, several input data constructs are not allowed by the specifications and may cause a different transfer-encoding to be used.

‘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 acceptible 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 encode a single UTF-8 character of four (4) bytes.

‘base64’

(Or ‘b64’.) The default encoding, it is 7-bit clean and will always be used for binary data. This encoding has a constant input:output ratio of 3:4, regardless of the character set of the input data it will encode three bytes of input to four bytes of output. This transfer-encoding is not human readable without performing a decoding step.

mimetypes-load-control

Can be used to control which of The mime.types files[35] are loaded: if the letter ‘u’ is part of the option value, then the user’s personal ~/.mime.types[593] file will be loaded (if it exists); likewise the letter ‘s’ controls loading of the system wide /etc/mime.types[594] ; directives found in the user file take precedence, letter matching is case-insensitive. If this variable is not set S-nail will try to load both files. Incorporation of the S-nail-built-in MIME types cannot be suppressed, but they will be matched last (the order can be listed via mimetype[205] ).

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[35] . Directives found in such files always take precedence (are prepended to the MIME type cache).

mta

To choose an alternate Mail-Transfer-Agent, set this option to either the full pathname of an executable (optionally prefixed with a ‘file://’ protocol indicator), or [Option]ally a SMTP protocol URL, e.g., [v15-compat]

smtps?://[user[:password]@]server[:port]

([no v15-compat]: ‘[smtp://]server[:port]’.) The default has been chosen at compile time. All supported data transfers are executed in child processes, which run asynchronously and without supervision unless either the sendwait[493] or the verbose[558] variable is set. If such a child receives a TERM signal, it will abort and save[487] the message to DEAD[566] , if so configured.

For a file-based MTA it may be necessary to set mta-argv0[439] in in order to choose the right target of a modern mailwrapper(8) environment. It will be passed command line arguments from several possible sources: from the variable mta-arguments[437] if set, from the command line if given and the variable expandargv[387] allows their use. Argument processing of the MTA will be terminated 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[438] (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[430] be set) and −v (if the verbose[558] variable is set); in conjunction with the −r[73] command line option S-nail will also (not) pass −f as well as possibly −F.

[Option]ally S-nail can send mail over SMTP network connections to a single defined SMTP smart host by specifying a SMTP URL as the value (see On URL syntax and credential lookup[12] ). Encrypted network connections are [Option]ally available, the section Encrypted network communication[13] should give an overview and provide links to more information on this. S-nail also supports forwarding of all network traffic over a specified socks-proxy[517] . Note that with some mail providers it may be necessary to set the smtp-hostname[515] variable in order to use a specific combination of from[397] , hostname[407] and mta[436] . The following 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[516] variable to enter a SSL/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 SSL/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 protocols!

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.

Finally there is the SUBMISSION protocol (RFC 6409), which usually lives on server port 587 and is practically identically to the SMTP protocol from S-nail’s point of view beside that; it requires setting the smtp-use-starttls[516] variable to enter a SSL/TLS secured session state. Assign a value like [v15-compat] ‘submission://[user[:password]@]server[:port]’ ([no v15-compat] ‘submission://server[:port]’).

mta-arguments

Arguments to pass through to a file-based mta[436] can be given via this variable, which is parsed according to Shell-style argument quoting[24] into an array of arguments, and which will be joined onto MTA options from other sources, and then passed individually to the MTA: ‘? wysh set mta-arguments=’-t -X "/tmp/my log"’’.

mta-no-default-arguments

(Boolean) Unless this variable is set S-nail will pass some well known standard command line options to a file-based mta[436] (Mail-Transfer-Agent), see there for more.

mta-argv0

Many systems use a so-called mailwrapper(8) environment to ensure 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[436] ) 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 users .netrc file for lookup of account credentials, as documented in the section On URL syntax and credential lookup[12] and for the command netrc[216] ; the section The .netrc file[37] documents the file format. Also see netrc-pipe[441] .

netrc-pipe

[v15-compat][Option] When .netrc is loaded (see netrc[216] and netrc-lookup[440] ) then S-nail will read the output of a shell pipe instead of the users .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

If this variable has the value ‘maildir’, newly created 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 completely, but only timestamp changes are detected.

outfolder

(Boolean) Causes the filename given in the record[479] variable and the sender-based filenames for the Copy[149] and Save[247] commands to be interpreted relative to the directory given in the folder[390] variable rather than to the current directory, unless it is set to an absolute pathname.

on-account-cleanup-ACCOUNT, on-account-cleanup

Macro hook which will be called once an account[125] is left, as the very last step before unrolling per-account localopts[200] . This hook is run even in case of fatal errors, and it is advisable to perform only absolutely necessary actions, like cleaning up alternates[130] , 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 unrolling compose mode localopts[200] . This hook is run even in case of fatal errors, and it is advisable to perform only absolutely necessary actions, like cleaning up alternates[130] , for example.

For compose mode hooks that may affect the message content please see on-compose-enter[447] , on-compose-leave[448] , on-compose-splice[449] . [v15 behaviour may differ] This hook exists because alias[128] , alternates[130] , commandalias[147] , shortcut[255] , to name a few, are not covered by localopts[200] : changes applied 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, but before a set message-inject-tail[429] has been injected etc., respectively. localopts[200] are enabled for these hooks, and changes on variables will be forgotten after the message has been sent. on-compose-cleanup[446] can be used to perform other necessary cleanup steps.

The following (read-only) variables will be set temporarily during execution of the macros to represent respective message headers, to the empty string otherwise; most of them correspond to according virtual message headers that can be accessed via ~^[302] , one of the COMMAND ESCAPES[28] (also from within on-compose-splice[449] hooks):

mailx-command

The command that generates the message.

mailx-subject

The subject.

mailx-from

from[397] .

mailx-sender

sender[492] .

mailx-to, mailx-cc, mailx-bcc

The list of receiver addresses as a space-separated list.

mailx-raw-to, mailx-raw-cc, mailx-raw-bcc

The list of receiver addresses before any mangling (due to, e.g., alternates[130] , alias[128] recipients-in-cc[478] ) as a space-separated list.

mailx-orig-from

When replying, forwarding or resending, this will be set to the ‘From:’ of the given message.

mailx-orig-to, mailx-orig-cc, mailx-orig-bcc

When replying, forwarding or resending, this will be set to the receivers of the given message.

Here is am example that injects a signature via message-inject-tail[429] ; instead using on-compose-splice[449] to simply inject the file of desire via ~<[297] or ~<![298] may be a better approach.

define t_ocl {
vput ! i cat ~/.mysig
if [ $? -eq 0 ]
vput vexpr message-inject-tail trim-end $i
end

# Alternatively
readctl create ~/.mysig
if [ $? -eq 0 ]
readall i
if [ $? -eq 0 ]
vput vexpr message-inject-tail trim-end $i
end
readctl remove ~/.mysig
end
}
set on-compose-leave=t_ocl

on-compose-splice , on-compose-splice-shell

These hooks run once the normal compose mode is finished, but before the on-compose-leave[448] macro hook is called, the message-inject-tail[429] is injected etc. Both hooks will be executed in a subprocess, with their input and output connected to S-nail such that they can act as if they would be an interactive user. The difference in between them is that the latter is a SHELL[584] command, whereas the former is a normal S-nail macro, but which is restricted to a small set of commands (the verbose[558] output of, e.g., list[199] will indicate said capability). localopts[200] are enabled for these hooks (in the parent process), causing any setting to be forgotten after the message has been sent; on-compose-cleanup[446] can be used to perform other cleanup as necessary.

During execution of these hooks S-nail will temporarily forget whether it has been started in interactive mode, (a restricted set of) COMMAND ESCAPES[28] will always be available, and for guaranteed reproducibilities sake escape[385] and ifs[409] will be set to their defaults. The compose mode command ~^[302] has been especially designed for scriptability (via these hooks). The first line the hook will read on its standard input is the protocol version of said command escape, currently ‘‘0 0 1’’: backward incompatible protocol changes have to be expected.

Care must be taken to avoid deadlocks and other false control flow: if both involved processes wait for more input to happen at the same time, or one does not expect more input but the other is stuck waiting for consumption of its output, etc. There is no automatic synchronization of the hook: it will not be stopped automatically just because it, e.g., emits ‘~x’. The hooks will however receive a termination signal if the parent enters an error condition. [v15 behaviour may differ] Protection against and interaction with signals is not yet given; it is likely that in the future these scripts will be placed in an isolated session, which is signalled in its entirety as necessary.

define ocs_signature {
read version
echo ’~< ~/.mysig’ # ’~<! fortune pathtofortunefile’
}
set on-compose-splice=ocs_signature

wysh set on-compose-splice-shell=$’\
read version;\
printf "hello $version! Headers: ";\
echo \’~^header list\’;\
read status result;\
echo "status=$status result=$result";\

define ocsm {
read version
echo Splice protocol version is $version
echo ’~^h l’; read hl; vput vexpr es substring "${hl}" 0 1
if [ "$es" != 2 ]
echoerr ’Cannot read header list’; echo ’~x’; xit
endif
if [ "$hl" @i!% ’ cc’ ]
echo ’~^h i cc Diet is your <mirr.or>’; read es;\
vput vexpr 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-resend-cleanup

[v15 behaviour may differ] Identical to on-compose-cleanup[446] , but is only triggered by resend[240] .

on-resend-enter

[v15 behaviour may differ] Identical to on-compose-enter[447] , but is only triggered by resend[240] .

page

(Boolean) If set, each message feed through the command given for pipe[225] 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-specific URL; as a last resort S-nail will ask for a password on the user’s terminal if the authentication method requires a password. Specifying passwords in a startup file is generally a security risk; the file should be readable by the invoking user only.

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[225] command without performing MIME and character set conversions.

pipe-TYPE/SUBTYPE

When a MIME message part of type ‘TYPE/SUBTYPE’ (case-insensitive) 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[600] ) are displayed unless otherwise noted, other MIME parts will only be considered by and for the command mimeview[209] .

The special value commercial at ‘@’ 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[205] command. And [Option]ally MIME type handlers may be defined via The Mailcap files[36] — these directives, copiousoutput[600] has already been used, should be referred to for further documentation.

The commercial at ‘@’ can in fact be used as a trigger character to adjust usage and behaviour of a following shell command specification more thoroughly by appending more special characters which refer to further mailcap directives, e.g., the following hypothetical command specification could be used:

? set pipe-X/Y=’@!++=@vim ${MAILX_FILENAME_TEMPORARY}’

‘*’

The command produces plain text to be integrated in S-nails output: copiousoutput[600] .

‘#’

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[602] .

‘&’

Run the command asynchronously, i.e., without blocking S-nail: x-mailx-async[603] .

‘!’

The command must be run on an interactive terminal, S-nail will temporarily release the terminal to it: needsterminal[599] .

‘+’

Request creation of a zero-sized temporary file, the absolute pathname of which will be made accessible via the environment variable MAILX_FILENAME_TEMPORARY[462] : x-mailx-tmpfile[605] . If given twice then the file will be unlinked automatically by S-nail when the command loop is entered again at latest: x-mailx-tmpfile-unlink[607] .

‘=’

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 MAILX_FILENAME_TEMPORARY[462] (x-mailx-tmpfile-fill[606] ), the creation of which is implied; note however that in order to cause deletion of the temporary file you still have to use two plus signs ‘++’ explicitly!

‘@’

To avoid ambiguities with normal shell command content you can use another commercial at 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 embedded 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[433] 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 otherwise.

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[456] except that ‘EXTENSION’ (normalized to lowercase using character mappings of the ASCII charset) names a file extension, e.g., ‘xhtml’. Handlers registered using this method take precedence.

pop3-auth-USER@HOST, pop3-auth-HOST, pop3-auth

[Option][v15-compat] Variable chain that sets the POP3 authentication method. The only possible value as of now is ‘plain’, which is thus the default.

pop3-bulk-load-USER@HOST, pop3-bulk-load-HOST, pop3-bulk-load

(Boolean)[Option] When accessing a POP3 server S-nail 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 S-nail 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 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.

pop3-no-apop-USER@HOST, pop3-no-apop-HOST, pop3-no-apop

(Boolean)[Option] Unless this variable is set the ‘APOP’ authentication method will be used when connecting to a POP3 server that advertises support. The advantage of ‘APOP’ is that the password is not sent in clear text over the wire and that only a single packet is sent for the user/password tuple. Note that pop3-no-apop-HOST requires [v15-compat].

pop3-use-starttls-USER@HOST, pop3-use-starttls-HOST, pop3-use-starttls

(Boolean)[Option] Causes S-nail to issue a ‘STLS’ command to make an unencrypted POP3 session SSL/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 S-nail where that deviates from standardized behaviour. It will be set implicitly before the Resource files[34] are loaded if the environment variable POSIXLY_CORRECT[583] 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 mechanism:

In non-interactive mode, any error encountered while loading resource files during program startup will cause a program exit, whereas in interactive mode such errors will stop loading of the currently loaded (stack of) file(s, i.e., recursively). These exits can be circumvented on a per-command base by using ignerr[111] , one of the Command modifiers[21] , for each command which shall be allowed to fail.

alternates[130] will replace the list of alternate addresses instead of appending to it.

The variable inserting COMMAND ESCAPES[28] ~A[303] , ~a[304] , ~I[313] and ~i[314] will expand embedded character sequences ‘\t’ horizontal tabulator and ‘\n’ line feed. [v15 behaviour may differ] For compatibility reasons this step will always be performed.

Upon changing the active file[177] no summary of headers[193] will be displayed even if header[399] is set.

Setting ignoreeof[412] implies the behaviour described by dot[379] .

The variable keep[415] is extended to cover any empty mailbox, not only empty primary system mailbox[116] es: they will be removed 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. Setting 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 expanded as via dollar-single-quote expansion (see Shell-style argument quoting[24] ). This (post-assignment, i.e., second) expansion can be used to embed status information, for example ?[328] , ![329] , account[339] or mailbox-display[421] .

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[145] . Prompting may be prevented by setting this to the null string (a.k.a. ‘set noprompt’).

prompt2

This string is used for secondary prompts, but is otherwise identical to prompt[471] . The default is ‘.. ’.

quiet

(Boolean) Suppresses the printing of the version when first invoked.

quote

If set, S-nail starts a replying message with the original message prefixed by the value of the variable indentprefix[414] . Normally, a heading consisting of ‘‘Fromheaderfield wrote:’’ is put before the quotation. If the string ‘noheading’ is assigned to the quote variable, this heading is omitted. If the string ‘headers’ is assigned, only the headers selected by the ‘type’ headerpick[191] selection are put above the message body, thus quote acts like an automatic ‘~m[316]COMMAND ESCAPES[28] command, then. If the string ‘allheaders’ is assigned, all headers are put above the message body and all MIME parts are included, making quote act like an automatic ‘~M[315] ’ command; also see quote-as-attachment[475] .

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[474] .

quote-fold

[Option] Can be set in addition to indentprefix[414] . Setting this turns on a more fancy quotation algorithm in that leading quotation characters are compressed and overlong lines are folded. quote-fold can be set to either one or two (space separated) 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-, not paragraph-based. If not set explicitly the minimum will reflect the goal algorithmically. The goal cannot be smaller than the length of indentprefix[414] plus some additional pad. Necessary adjustments take place silently.

r-option-implicit

(Boolean) Setting this option evaluates the contents of from[397] (or, if that contains multiple addresses, sender[492] ) and passes the results onto the used (file-based) MTA as described for the −r[73] option (empty argument case).

recipients-in-cc

(Boolean) When doing a reply[236] , 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[26] , 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 save[487] d to DEAD[566] . The standard defines that relative (fully expanded) paths are to be interpreted relative to the current directory (cwd[151] ), to force interpretation relative to folder[390] outfolder[444] needs to be set in addition.

record-files

(Boolean) If this variable is set the meaning of record[479] will be extended to cover messages which target only file and pipe recipients (see expandaddr[386] ). These address types will not appear in recipient lists unless add-file-recipients[340] is also set.

record-resent

(Boolean) If this variable is set the meaning of record[479] will be extended to also cover the resend[240] and Resend[239] commands.

reply-in-same-charset

(Boolean) If this variable is set S-nail first tries to use the same character set of the original message for replies. If this fails, the mechanism described in Character sets[14] is evaluated as usual.

reply-strings

Can be set to a comma-separated list of (case-insensitive according to ASCII rules) strings which shall be recognized in addition to the built-in strings as ‘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[130] list.

replyto

[Obsolete] Variant of reply-to[484] .

reply-to-honour

Controls whether a ‘Reply-To:’ header is honoured when replying to a message via reply[236] or Lreply[201] . 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 envelope mail via the ‘message/rfc822’ MIME mechanism, for more visual convenience.

save

(Boolean) Enable saving of (partial) messages in DEAD[566] upon interrupt or delivery error.

screen

The number of lines that represents a ‘‘screenful’’ of lines, used in headers[193] summary display, from[190] search[249] ing, message top[272] line display and scrolling via z[291] . If this variable is not set S-nail falls back to a calculation based upon the detected terminal window size and the baud rate: the faster the terminal, the more will be shown. Overall screen dimensions and pager usage is influenced by the environment variables COLUMNS[565] and LINES[572] and the variable crt[373] .

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[366] is automatically appended to this list of character sets. If no character set conversion capabilities are compiled into S-nail then the only supported charset is ttycharset[553] . Also see sendcharsets-else-ttycharset[491] and refer to the section Character sets[14] for the complete picture of character set conversion in S-nail.

sendcharsets-else-ttycharset

(Boolean)[Option] If this variable is set, but sendcharsets[490] is not, then S-nail acts as if sendcharsets[490] had been set to the value of the variable ttycharset[553] . 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[366] never comes into play as ttycharset[553] 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 S-nail and the only supported character set is ttycharset[553] : Character sets[14] ). This might be a problem for scripts which use the suggested ‘LC_ALL=C’ setting, since in this case the character set is US-ASCII by definition, so that it is better to also override ttycharset[553] , then.

sender

An address that is put into the ‘Sender:’ field of outgoing messages, quoting RFC 5322: the mailbox of the agent responsible for the actual transmission of the message. This field should normally not be used unless the from[397] field contains more than one address, on which case it is required. The sender address is handled as if it were in the alternates[130] list; also see −r[73] , r-option-implicit[477] .

sendmail

[Obsolete] Predecessor of mta[436] .

sendmail-arguments

[Obsolete] Predecessor of mta-arguments[437] .

sendmail-no-default-arguments

[Obsolete](Boolean) Predecessor of mta-no-default-arguments[438] .

sendmail-progname

[Obsolete] Predecessor of mta-argv0[439] .

sendwait

(Boolean) When sending a message wait until the mta[436] (including the built-in SMTP one) exits before accepting further commands. Only with this variable set errors reported by the MTA will be recognizable! If the MTA returns a non-zero exit status, the exit status of S-nail will also be non-zero.

showlast

(Boolean) This setting causes S-nail to start at the last message instead of the first one when opening a mail folder.

showname

(Boolean) Causes S-nail 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[303] , one of the COMMAND ESCAPES[28] . Also see message-inject-tail[429] , on-compose-leave[448] and on-compose-splice[449] .

sign

The value backing ~a[304] , one of the COMMAND ESCAPES[28] . Also see message-inject-tail[429] , on-compose-leave[448] and on-compose-splice[449] .

signature

[Obsolete] Please use on-compose-splice[449] or on-compose-splice-shell[450] or on-compose-leave[448] and (if necessary) message-inject-tail[429] 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[59] ).

smime-ca-dir , smime-ca-file

[Option] Specify the location of trusted CA certificates in PEM (Privacy Enhanced Mail) format as a directory and a file, respectively, for the purpose of verification of S/MIME signed messages. It is possible to set both, the file will be loaded immediately, the directory will be searched whenever no match has yet been found. The set of CA certificates which are built into the SSL/TLS library can be explicitly turned off by setting smime-ca-no-defaults[504] , and further fine-tuning is possible via smime-ca-flags[503] .

smime-ca-flags

[Option] Can be used to fine-tune behaviour of the X509 CA certificate storage, and the certificate verification that is used. The actual values and their meanings are documented for ssl-ca-flags[530] .

smime-ca-no-defaults

(Boolean)[Option] Do not load the default CA locations that are built into the used to SSL/TLS library to verify S/MIME signed messages.

smime-cipher-USER@HOST, smime-cipher

[Option] Specifies the cipher to use when generating S/MIME encrypted messages (for the specified account). RFC 5751 mandates 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 cryptographic library that S-nail uses. [Option] Support for more cipher algorithms may be available through dynamic loading via, e.g., EVP_get_cipherbyname(3) (OpenSSL) if S-nail has been compiled 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 variable must be set to the name of a file that contains a certificate in PEM format.

If a message is sent to multiple recipients, each of them for whom a corresponding variable is set will receive an individually encrypted message; other recipients will continue to receive the message in plain text unless the smime-force-encryption[509] variable is set. It is recommended to sign encrypted messages, i.e., to also set the smime-sign[510] variable.

smime-force-encryption

(Boolean)[Option] Causes S-nail 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 attachment. Signing a message enables a recipient to verify that the sender used a valid certificate, that the email addresses in the certificate match those in the message header and that the message content has not been altered. It does not change the message text, and people will be able to read the message as usual. Also see smime-sign-cert[511] , smime-sign-include-certs[512] and smime-sign-message-digest[513] .

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[397] (or, if that contains multiple addresses, sender[492] ). For the purpose of encryption the recipient’s public encryption key (certificate) is expected; the command certsave[139] can be used to save certificates of signed messages (the section Signed and encrypted messages with S/MIME[11] gives some details). This mode of operation is usually driven by the specialized form.

When decrypting messages the account is derived from the recipient fields (‘To:’ and ‘Cc:’) of the message, which are searched for addresses for which such a variable is set. S-nail always uses the first address that matches, so if the same message 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 encrypted 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 performing any necessary password lookup, therefore the lookup can be automatized via the mechanisms described in On URL syntax and credential lookup[12] . 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 certificates, use smime-sign-include-certs[512] .

smime-sign-include-certs-USER@HOST, smime-sign-include-certs

[Option] If used, this is supposed to a consist of a comma-separated list of files, each of which containing a single certificate in PEM format to be included in the S/MIME message in addition to the smime-sign-cert[511] certificate. This can be used to include intermediate certificates of the certificate authority, in order to allow the receiver’s S/MIME implementation to perform a verification of the entire certificate chain, starting from a local root certificate, over the intermediate certificates, down to the smime-sign-cert[511] . Even though top level certificates may also be included in the chain, they won’t 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[397] (or, if that contains multiple addresses, sender[492] ). 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 automatized via the mechanisms described in On URL syntax and credential lookup[12] .

smime-sign-message-digest-USER@HOST, smime-sign-message-digest

[Option] Specifies the message digest to use when signing S/MIME messages. RFC 5751 mandates a default of ‘sha1’. Possible values are (case-insensitive and) in decreasing cipher strength: ‘sha512’, ‘sha384’, ‘sha256’, ‘sha224’ and ‘md5’.

The actually available message digest algorithms depend on the cryptographic library that S-nail uses. [Option] Support for more message digest algorithms may be available through dynamic loading via, e.g., EVP_get_digestbyname(3) (OpenSSL) if S-nail has been compiled to support this. Remember that for this ‘USER@HOST’ refers to the variable from[397] (or, if that contains multiple addresses, sender[492] ).

smtp

[Obsolete][Option] To use the built-in SMTP transport, specify a SMTP URL in mta[436] . [v15 behaviour may differ] For compatibility reasons a set smtp is used in preference of mta[436] .

smtp-auth-USER@HOST, smtp-auth-HOST, smtp-auth

[Option] Variable chain that controls the SMTP mta[436] authentication method, possible values are ‘none’ ([no v15-compat] default), ‘plain’ ([v15-compat] default), ‘login’ as well as the [Option]al methods ‘cram-md5’ and ‘gssapi’. The ‘none’ method does not need any user credentials, ‘gssapi’ requires a user name and all other methods require a user name and a password. See [v15-compat] mta[436] , user[556] and password[454] ([no v15-compat] smtp-auth-password and smtp-auth-user). Note that smtp-auth-HOST is [v15-compat]. [no v15-compat]: Note for smtp-auth-USER@HOST: may override dependent on sender address in the variable from[397] .

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, S-nail will ask for a password on the user’s terminal.

smtp-auth-password-USER@HOST

[no v15-compat] Overrides smtp-auth-password for specific values of sender addresses, dependent upon the variable from[397] .

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, S-nail 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[397] .

smtp-hostname

[Option][v15-compat] Normally S-nail uses the variable from[397] to derive the necessary ‘USER@HOST’ information in order to issue a ‘MAIL FROM:<>’ SMTP mta[436] command. Setting smtp-hostname[515] can be used to use the ‘USER’ from the SMTP account (mta[436] or the user[556] variable chain) and the ‘HOST’ from the content of this variable (or, if that is the empty string, hostname[407] or the local hostname as a last resort). This often allows using an address that is itself valid but hosted by a provider other than which (in from[397] ) is about to send the message. Setting this variable also influences generated ‘Message-ID:’ and ‘Content-ID:’ header fields.

smtp-use-starttls-USER@HOST, smtp-use-starttls-HOST, smtp-use-starttls

(Boolean)[Option] Causes S-nail to issue a ‘STARTTLS’ command to make an SMTP mta[436] session SSL/TLS encrypted, i.e., to enable transport layer security.

socks-proxy-USER@HOST, socks-proxy-HOST, socks-proxy

[Option] If this is set to the hostname (SOCKS URL) of a SOCKS5 server then S-nail 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 actually 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
$ s-nail -Ssocks-proxy-USER@HOST=localhost:10000

spam-interface

[Option] In order to use any of the spam-related commands (like, e.g., spamrate[268] ) the desired spam interface must be defined by setting this variable. Please refer to the manual section Handling spam[19] for the complete picture of spam handling in S-nail. All or none of the following interfaces may be available:

‘spamc’

Interaction with spamc(1) from the spamassassin(1) (http://spamassassin.apache.org SpamAssassin) suite. Different to the generic filter interface S-nail 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[520] will have been compiled into the S-nail binary if spamc(1) has been found in PATH[582] during compilation. Shall it be necessary to define a specific connection type (rather than using a configuration file for that), the variable spamc-arguments[521] 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[522] . Note that this interface does not inspect the ‘is-spam’ flag of a message for the command spamforget[266] .

‘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[268] (‘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[523] , spamfilter-noham[524] , spamfilter-nospam[525] , spamfilter-rate[526] and spamfilter-spam[527] ; the manual section Handling spam[19] contains examples for some programs. The process environment of the hooks will have the variable MAILX_FILENAME_GENERATED[461] set. Note that spam score support for spamrate[268] is not supported unless the [Option]tional regular expression support is available and the spamfilter-rate-scanscore[528] variable is set.

spam-maxsize

[Option] Messages that exceed this size will not be passed through to the configured spam-interface[518] . 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[518] . Note that the path is not expanded, but used ‘‘as is’’. A fallback path will have been compiled into the S-nail binary if the executable had been found during compilation.

spamc-arguments

[Option] Even though S-nail deals with most arguments for the ‘spamc’ spam-interface[518] automatically, it may at least sometimes be desirable to specify connection-related ones via this variable, e.g., ‘-d server.example.com -p 783’.

spamc-user

[Option] Specify a username for per-user configuration files for the ‘spamc’ spam-interface[518] . If this is set to the empty string then S-nail will use the name of the current user[556] .

spamfilter-ham , spamfilter-noham , spamfilter-nospam , spamfilter-rate , spamfilter-spam

[Option] Command and argument hooks for the ‘filter’ spam-interface[518] . The manual section Handling spam[19] contains examples for some programs.

spamfilter-rate-scanscore

[Option] Because of the generic nature of the ‘filter’ spam-interface[518] 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[526] 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[546] , ssl-ca-file-USER@HOST, ssl-ca-file-HOST, ssl-ca-file

[Option] Specify the location of trusted CA certificates in PEM (Privacy Enhanced Mail) format as a directory and a file, respectively, for the purpose of verification of SSL/TLS server certificates. It is possible to set both, the file will be loaded immediately, the directory will be searched whenever no match has yet been found. The set of CA certificates which are built into the SSL/TLS library can be explicitly turned off by setting ssl-ca-no-defaults[531] , and further fine-tuning is possible via ssl-ca-flags[530] ; also see SSL_CTX_load_verify_locations(3) for more information. S-nail will try to use the TLS/SNI (ServerNameIndication) extension when establishing TLS connections to servers identified with hostnames.

ssl-ca-flags-USER@HOST, ssl-ca-flags-HOST, ssl-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 ssl-verify[545] ). 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 SSL/TLS library version: a directive without mapping is ignored (error log subject to debug[377] ). 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.

ssl-ca-no-defaults-USER@HOST, ssl-ca-no-defaults-HOST, ssl-ca-no-defaults

(Boolean)[Option] Do not load the default CA locations that are built into the used to SSL/TLS library to verify SSL/TLS server certificates.

ssl-cert-USER@HOST, ssl-cert-HOST, ssl-cert

[Obsolete][Option] Please use the Certificate slot of ssl-config-pairs[536] .

ssl-cipher-list-USER@HOST, ssl-cipher-list-HOST, ssl-cipher-list

[Obsolete][Option] Please use the CipherList slot of ssl-config-pairs[536] .

ssl-config-file

[Option] If this variable is set CONF_modules_load_file(3) (if announced via ‘+modules-load-file’ in ssl-features[540] ) is used to allow resource file based configuration of the SSL/TLS library. This happens once the library is used first, which may also be early during startup (logged with verbose[558] )! If a non-empty value is given then the given file, after performing Filename transformations[26] , will be used instead of the global OpenSSL default, and it is an error if the file cannot be loaded. The application name will always be passed as ‘s-nail’. Some SSL/TLS libraries support application-specific configuration via resource files loaded like this, please see ssl-config-module[535] .

ssl-config-module-USER@HOST, ssl-config-module-HOST, ssl-config-module

[Option] If file based application-specific configuration via ssl-config-file[534] is available, announced as ‘+ctx-config’ by ssl-features[540] , indicating availability of SSL_CTX_config(3), then, it becomes possible to use a central SSL/TLS configuration file for all programs, including s-nail, e.g.:

# Register a configuration section for s-nail
s-nail = 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_ssl_config
# Well that actual program specific configuration section
# now can map individual ssl-config-module names to sections,
# e.g., ssl-config-module=account_xy
[mailx_ssl_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

ssl-config-pairs-USER@HOST, ssl-config-pairs-HOST, ssl-config-pairs

[Option] The value of this variable chain will be interpreted as a comma-separated list of directive/value pairs. Different to when placing these pairs in a ssl-config-module[535] section of a ssl-config-file[534] commas ‘,’ need to be escaped with a reverse solidus ‘\’ when included in pairs. Just likewise directives and values need to be separated by equals signs ‘=’, any whitespace surrounding pair members is removed. Keys are (usually) case-insensitive. Unless proper support is announced by ssl-features[540] (‘+conf-ctx’) only the keys below are supported, otherwise the pairs will be used directly as arguments to the function SSL_CONF_cmd(3). Said equals sign ‘=’ may be preceded with an asterisk ‘*’ to indicate that Filename transformations[26] shall be performed on the value; it is an error if these fail.

Certificate

Filename of a SSL/TLS client certificate (chain) required by some servers. Fallback support via SSL_CTX_use_certificate_chain_file(3). Filename transformations[26] are performed. Note: if you use this you need to specify the private key via PrivateKey, ssl-key[541] will not be used!

CipherList

A list of ciphers for SSL/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 SSL/TLS library). Fallback support via SSL_CTX_set_cipher_list(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 SSL/TLS versions, respectively. Optional fallback support via SSL_CTX_set_max_proto_version(3) and SSL_CTX_set_min_proto_version(3) if ssl-features[540] announces ‘+ctx-set-maxmin-proto’, otherwise this directive results in an error. The fallback uses an internal parser which understands the strings ‘SSLv3’, ‘TLSv1’, ‘TLSv1.1’, ‘TLSv1.2’, 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 SSL/TLS client certificate. If unset, the name of the certificate file is used. Filename transformations[26] are performed. Fallback via SSL_CTX_use_PrivateKey_file(3). Note: if you use this you need to specify the certificate (chain) via Certificate, ssl-cert[532] will not be used!

Protocol

The used SSL/TLS protocol. If ssl-features[540] 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’, 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.

ssl-crl-dir , ssl-crl-file

[Option] Specify a directory / a file, respectively that contains a CRL in PEM format to use when verifying SSL/TLS server certificates.

ssl-curves-USER@HOST, ssl-curves-HOST, ssl-curves

[Obsolete][Option] Please use the Curves slot of ssl-config-pairs[536] .

ssl-features

[Option](Read-only) This expands to a comma separated list of the TLS/SSL library identity and optional TLS/SSL library features. Currently supported identities are ‘libressl’ (LibreSSL) , ‘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: ‘modules-load-file’ (ssl-config-file[534] ), ‘conf-ctx’ (ssl-config-pairs[536] ), ‘ctx-config’ (ssl-config-module[535] ), ‘ctx-set-maxmin-proto’ (ssl-config-pairs[536] ) and ‘rand-egd’ (ssl-rand-egd[543] ).

ssl-key-USER@HOST, ssl-key-HOST, ssl-key

[Obsolete][Option] Please use the PrivateKey slot of ssl-config-pairs[536] .

ssl-method-USER@HOST, ssl-method-HOST, ssl-method

[Obsolete][Option] Please use the Protocol slot of ssl-config-pairs[536] .

ssl-protocol-USER@HOST, ssl-protocol-HOST, ssl-protocol

[Obsolete][Option] Please use the Protocol slot of ssl-config-pairs[536] .

ssl-rand-egd

[Option] Gives the pathname to an entropy daemon socket, see RAND_egd(3). Not all SSL/TLS libraries support this, ssl-features[540] announces availability with ‘+rand-egd’.

ssl-rand-file

[Option] Gives the filename to a file with random entropy data, see RAND_load_file(3). If this variable is not set, or set to the empty string, or if the Filename transformations[26] fail, then RAND_file_name(3) will be used to create the filename. If the SSL PRNG was seeded successfully The file will be updated (RAND_write_file(3)) if and only if seeding and buffer stirring succeeds. This variable is only used if ssl-rand-egd[543] is not set (or not supported by the SSL/TLS library).

ssl-verify-USER@HOST, ssl-verify-HOST, ssl-verify

[Option] Variable chain that sets the action to be performed if an error occurs during SSL/TLS server certificate validation against the specified or default trust stores ssl-ca-dir , ssl-ca-file[529] , or the SSL/TLS library built-in defaults (unless usage disallowed via ssl-ca-no-defaults[531] ), and as fine-tuned via ssl-ca-flags[530] . 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’.

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 S-nail. 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.

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[17] , 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 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 S-nail 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 S-nail in general:

colors or Co

max_colors: numeric capability specifying the maximum number of colours. Note that S-nail does not actually care about the terminal beside that, but always emits ANSI / ISO 6429 escape sequences.

rmcup or te / smcup or ti

exit_ca_mode and enter_ca_mode, respectively: exit and enter the alternative screen ca-mode, effectively turning S-nail into a fullscreen application. This must be enabled explicitly by setting termcap-ca-mode[549] .

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.

ed or cd

clr_eos: clear the screen.

clear or cl

clear_screen: clear the screen and home cursor. (Will be simulated via ho plus cd.)

home or ho

cursor_home: home cursor.

el or ce

clr_eol: clear to the end of line. (Will be simulated via ch plus repetitions of space characters.)

hpa or ch

column_address: move the cursor (to the given column parameter) in the current row. (Will be simulated via cr plus nd.)

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’.

Many more capabilities which describe key-sequences are documented for bind[134] .

termcap-ca-mode

[Option] Allow usage of the exit_ca_mode and enter_ca_mode terminal capabilities, effectively turning S-nail into a fullscreen application, as documented for termcap[548] . 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[548] describe the terminal to S-nail. 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.

toplines

If defined, gives the number of lines of a message to be displayed with the command top[272] ; if unset, the first five lines are printed, if set to 0 the variable screen[488] is inspected. If the value is negative then its absolute value will be used for unsigned right shifting (see vexpr[285] ) the screen[488] height.

topsqueeze

(Boolean) If set then the top[272] command series will strip adjacent empty lines and quotations.

ttycharset

The character set of the terminal S-nail operates on, and the one and only supported character set that S-nail can use if no character set conversion capabilities have been compiled into it, in which case it defaults to ISO-8859-1 unless it can deduce a value from the locale specified in the LC_CTYPE[570] environment variable (if supported, see there for more). It defaults to UTF-8 if conversion is available. Refer to the section Character sets[14] 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 S-nail in script(1), e.g., it sets colour-disable[369] , line-editor-disable[418] and (before startup completed only) termcap-disable[550] . Unsetting it does not restore the former state of the covered settings.

umask

For a safety-by-default policy S-nail sets its process umask(2) to ‘0077’, but this variable can be used to override that: set it to an empty value to do not change the (current) setting (on startup), otherwise the process file mode creation mask is updated to the new value. Child processes inherit the process file mode creation mask.

user-HOST, user

[v15-compat] Variable chain that sets a global fallback user name, which is 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 S-nail.

v15-compat

(Boolean) Setting this enables upward compatibility with S-nail version 15.0 in respect to which configuration options are available and how they are handled. 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[79] , causes S-nail to be more verbose, e.g., it will display obsoletion warnings and SSL/TLS certificate chains. Even though marked (Boolean) this option may be set twice in order to increase the level of verbosity even more, in which case even details of the actual message delivery and protocol conversations are shown. A single noverbose[558] is sufficient to disable verbosity as such.

version , version-date , version-major , version-minor , version-update

(Read-only) S-nail version information: the first variable contains a string containing the complete version identification, the latter three contain only digits: the major, minor and update version numbers. The date is in ISO 8601 notation. The output of the command version[284] will include this information.

writebackedited

If this variable is set messages modified using the edit[168] or visual[287] 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 RFC 4155 ‘From_’ quoting of newly added or edited content is also left as an excercise to the user.

ENVIRONMENT [32]

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 S-nail is started, and unless otherwise explicitly noted handling of the following variables transparently integrates into that of the INTERNAL VARIABLES[29] from S-nail’s point of view. This means that, e.g., they can be managed via set[251] and unset[252] , causing automatic program environment updates (to be inherited by newly created child processes).

In order to transparently integrate other environment variables equally they need to be imported (linked) with the command environ[172] . 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[565] environment variable for S-nail only, and beforehand exports the EDITOR[567] in order to affect any further processing in the running shell:

$ EDITOR="vim -u ${HOME}/.vimrc"
$ export EDITOR
$ COLUMNS=80 s-nail -R

COLUMNS

The user’s preferred width in column positions for the terminal screen or window. Queried and used once on program startup, actively managed for child processes and the MLE (see On terminal control and line editor[17] ) in interactive mode thereafter. Ignored in non-interactive mode, which always uses 80 columns, unless in
batch mode.

DEAD

The name of the (mailbox) file[177] to use for saving aborted messages if save[487] is set; this defaults to dead.letter in the user’s HOME[568] directory. If the variable debug[377] is set no output will be generated, otherwise the contents of the file will be replaced.

EDITOR

Pathname of the text editor to use in the edit[168] command and ~e[308] COMMAND ESCAPES[28] . A default editor is used if this value is not defined.

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. (No test for being writable is performed 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[566] , MBOX[579] 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[14] . Runtime changes trigger automatic updates of the entire locale system, updating and overwriting also a ttycharset[553] set by the user.

LINES

The user’s preferred number of lines on a page or the vertical screen or window size in lines. Queried and used once on program startup, actively managed for child processes in interactive mode thereafter. Ignored in non-interactive mode, which always uses 24 lines, unless in
batch mode.

LISTER

Pathname of the directory lister to use in the folders[183] command when operating on local mailboxes. Default is ls(1) (path search through SHELL[584] ).

LOGNAME

Upon startup S-nail will actively ensure that this variable refers to the name of the user who runs S-nail, in order to be able to pass a verified name to any newly created child process.

MAIL

Is used as the users primary system mailbox[116] unless inbox[413] is set. This is assumed to be an absolute pathname.

MAILCAPS

[Option] Overrides the default path search for The Mailcap files[36] , which is defined in the standard RFC 1524 as ‘~/.mailcap: /etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap’. (S-nail makes it a configuration option, however.) Note this is not a search path, but a path search.

MAILRC

Is used as a startup file instead of ~/.mailrc[598] if set. In order to avoid side-effects from configuration files scripts should either set this variable to /dev/null[596] or the −:[52] command line option should be used.

MAILX_NO_SYSTEM_RC

If this variable is set then reading of s-nail.rc[597] at startup is inhibited, i.e., the same effect is achieved as if S-nail had been started up with the option −:[52] (and according argument) or −n[70] . This variable is only used when it resides in the process environment.

MBOX

The name of the users secondary mailbox[117] file. A logical subset of the special Filename transformations[26] (also see file[177] ) are supported. The default is ~/mbox[592] . Traditionally this MBOX is used as the file to save messages from the primary system mailbox[116] that have been read. Also see Message states[15] .

NETRC

[v15-compat][Option] This variable overrides the default location of the user’s ~/.netrc[595] file.

PAGER

Pathname of the program to use for backing the command more[215] , and when the crt[373] variable enforces usage of a pager for output. The default paginator is more(1) (path search through SHELL[584] ).

S-nail 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[370] .

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[469] for more.

SHELL

The shell to use for the commands ![118] , shell[254] , the ~![294] COMMAND ESCAPES[28] and when starting subprocesses. A default shell is used if this environment variable is not defined.

SOURCE_DATE_EPOCH

This 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 S-nail to a completely reproducible mode which causes deterministic random numbers, a special fixed (non-existent?) LOGNAME[574] and more to be used and set. It is to be used during development or 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‘ s-nail

TERM

[Option] The terminal type for which output is to be prepared. For extended colour and font control please refer to Coloured display[18] , and for terminal management in general to On terminal control and line editor[17] .

TMPDIR

Used as directory for temporary files instead of /tmp, if set, existent, accessible as well as read- and writable. This variable is only used when it resides in the process environment, but S-nail will ensure at startup that this environment variable is updated to contain a usable temporary directory.

USER

Identical to LOGNAME[574] (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 in the visual[287] command and ~v[325] COMMAND ESCAPES[28] .

FILES [33]
~/.mailrc[598]

File giving initial commands, one of the Resource files[34] .

s-nail.rc[597]

System wide initialization file, one of the Resource files[34] .

~/.mailcap

[Option] Personal MIME type handler definition file, see The Mailcap files[36] . This location is part of the RFC 1524 standard search path, which is a configuration option and can be overridden via MAILCAPS[576] .

/etc/mailcap

[Option] System wide MIME type handler definition file, see The Mailcap files[36] . This location is part of the RFC 1524 standard search path, which is a configuration option and can be overridden via

~/mbox

The default value for MBOX[579] . The actually used path is a configuration option.

~/.mime.types

Personal MIME types, see The mime.types files[35] . The actually used path is a configuration option.

/etc/mime.types

System wide MIME types, see The mime.types files[35] . The actually used path is a configuration option.

~/.netrc

[v15-compat][Option] The default location of the users .netrc file – the section The .netrc file[37] documents the file format. The actually used path is a configuration option and can be overridden via NETRC[580] .

/dev/null

The data sink null(4). The actually used path is a compile-time constant.

Resource files [34]
Upon startup S-nail reads in several resource files:

s-nail.rc

System wide initialization file. Reading of this file can be suppressed, either by using the −:[52] (and according argument) or −n[70] command line options, or by setting the ENVIRONMENT[32] variable MAILX_NO_SYSTEM_RC[578] .

~/.mailrc

File giving initial commands. A different file can be chosen by setting the ENVIRONMENT[32] variable MAILRC[577] . Reading of this file can be suppressed with the −:[52] command line option.

mailx-extra-rc[423]

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. This variable is only honoured when defined in a resource file, e.g., it is one of the INTERNAL VARIABLES[29] .

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[409] , 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 S-nail 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 source[263] ed. 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 [35]
As stated in HTML mail and MIME attachments[9] S-nail 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[435] . Another is the command mimetype[205] , which also offers access to S-nails 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 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. S-nail also supports an extended, non-portable syntax in especially crafted files, which can be loaded via the alternative value syntax of mimetypes-load-control[435] , 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[205] , mime-allow-text-controls[431] , mimetypes-load-control[435] . For reading etc. messages: HTML mail and MIME attachments[9] , The Mailcap files[36] , mimetype[205] , mime-counter-evidence[433] , mimetypes-load-control[435] , pipe-TYPE/SUBTYPE[456] , pipe-EXTENSION[463] .

The Mailcap files [36]
This feature is not available in v14.9.0, sorry!
RFC 1524 defines a ‘‘User Agent Configuration Mechanism’’ which S-nail [Option]ally supports (see HTML mail and MIME attachments[9] ). It defines a file format 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 ‘‘mailcap’’ files and the MAILCAPS[576] 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 ignored. Empty lines are also ignored. All other lines form individual entries that must adhere to the syntax described below. To extend a single entry (not comment) its line can be continued on follow lines if newline 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 S-nail 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 S-nail will remove it again, as if the x-mailx-tmpfile[605] , x-mailx-tmpfile-fill[606] and x-mailx-tmpfile-unlink[607] 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 naming the field followed by an equals sign ‘=’ succeeded by a shell command, and as usual for any ‘‘Mailcap’’ content any whitespace surrounding the equals sign will be removed, too. 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.)

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[604] .

needsterminal

This flag field indicates that the given shell command must be run on an interactive terminal. S-nail 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[602] .

copiousoutput

A flag field which indicates that the output of the view command will be an extended stream of textual output that can be (re)integrated into S-nail’s normal visual display. It is mutually exclusive with needsterminal[599] .

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 replaced by a random string, the joined combination of which will be used as the filename denoted by MAILX_FILENAME_TEMPORARY[462] . 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 S-nail ignores the name template unless that solely specifies a filename suffix that consists of (ASCII) alphabetic and numeric characters, the underscore 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 S-nail.

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[600] 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[599] .

x-mailx-noquote

An extension flag field that indicates that even a copiousoutput[600] view command shall not be used to generate message 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 S-nail. Cannot be used in conjunction with needsterminal[599] .

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 environment variable MAILX_FILENAME_TEMPORARY[462] . 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[605] . In order to cause deletion of the temporary file you will have to set x-mailx-tmpfile-unlink[607] 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[603] , or without also setting x-mailx-tmpfile[605] or x-mailx-tmpfile-fill[606] .

x-mailx-tmpfile-keep

Using the string ‘%s’ implies the three tmpfile related flags above, but if you want, e.g., x-mailx-async[603] and deal with the temporary file yourself, you can add in this flag to forcefully ignore x-mailx-tmpfile-unlink[607] .

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 advantage 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[599] flag, but the compose command shall not, the following will help out the latter (with enabled debug[377] or an increased verbose[558] level S-nail 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 entire parameter should appear as a single command line argument, regardless 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 S-nail does not support handlers for multipart MIME parts as shown in this example (as of today). S-nail 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

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[9] , The mime.types files[35] , mimetype[205] , MAILCAPS[576] , mime-counter-evidence[433] , pipe-TYPE/SUBTYPE[456] , pipe-EXTENSION[463] .

The .netrc file [37]
The .netrc file contains user credentials for machine accounts. The default location in the user’s HOME[568] directory may be overridden by the NETRC[580] environment variable. The file consists of space, tabulator or newline separated tokens. S-nail 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 outside 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 allowed tokens to be separated with commas – whereas at least Hewlett-Packard still seems to support this syntax, S-nail does not!

As a non-portable extension some widely-used programs support shell-style comments: if an input line starts, after any amount of whitespace, with a number sign ‘#’, 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’’, S-nail will always require these strict permissions.

Of the following list of supported tokens S-nail only uses (and caches) machine, login and password. At runtime the command netrc[216] can be used to control S-nail’s .netrc cache.

machine name

The hostname of the entries’ machine, lowercase-normalized by S-nail 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 S-nail 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 continuing 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 [38]

An example configuration [39]

# This example assumes v15.0 compatibility mode
set v15-compat

# Request strict SSL/TLS transport security checks
set ssl-verify=strict

# Where are the up-to-date SSL/TLS certificates?
# (Since we manage up-to-date ones explicitly, do not use any,
# possibly outdated, default certificates shipped with OpenSSL)
#set ssl-ca-dir=/etc/ssl/certs
set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
set ssl-ca-no-defaults
#set ssl-ca-flags=partial-chain
wysh set smime-ca-file="${ssl-ca-file}" \
smime-ca-no-defaults #smime-ca-flags="${ssl-ca-flags}"

# This could be outsourced to a central configuration file via
# ssl-config-file plus ssl-config-module if the used library allows.
# CipherList: 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 ssl-cipher-list-HOST
# (or -USER@HOST), as necessary, again..
# 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 ssl-config-pairs-HOST / -USER@HOST
# to define such explicit exceptions, then, e.g.
# MinProtocol=TLSv1.1
if [ "$ssl-features" =% +ctx-set-maxmin-proto ]
wysh set ssl-config-pairs=’\
CipherList=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\
Curves=P-521:P-384:P-256,\
MinProtocol=TLSv1.1’
else
wysh set ssl-config-pairs=’\
CipherList=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\
Curves=P-521:P-384:P-256,\
Protocol=-ALL\,+TLSv1.1 \, +TLSv1.2’
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 <address@exam.ple>’

# 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?|submission)://[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=+.s-nailhist history-size=-1 history-gabby \
mime-counter-evidence=0xE \
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 <address@examp.ple>’

set pop3-no-apop-pop.gmXil.com
shortcut pop %:pop3s://pop.gmXil.com
shortcut imap %:imaps://imap.gmXil.com
#set record="+[Gmail]/Sent Mail"
# Select: File imaps://imap.gmXil.com/[Gmail]/Sent\ Mail

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 <address@exam.ple>’

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_COLOR_FLAG} -aFlrS’
commandalias llS ’!ls ${LS_COLOR_FLAG} -aFlS’

wysh 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[598] appropriate permissions should be set on this file with ‘$ chmod 0600 ~/.mailrc’. If the [Option]al netrc-lookup[440] 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 <address@exam.ple>’
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 | s-nail -dvv -AXandeX -s Subject user@exam.ple

S/MIME step by step [40]
[Option] The first thing you need for participating in S/MIME message exchange is your personal certificate, including a private key. The certificate contains public information, in particular your name and your email address(es), and the public key that is used by others to encrypt messages for you, and to verify signed messages they supposedly received from you. The certificate is included in each signed message you send. The private key must be kept secret. It is used to decrypt messages that were previously encrypted with your public key, and to sign messages.

For personal use it is recommended that you get a S/MIME certificate from one of the major CAs on the Internet using your WWW browser. Many CAs offer such certificates for free. There is also https://www.CAcert.org which issues client and server certificates 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 you will have to download their root certificate separately and ensure it is part of our S/MIME certificate validation chain by including it in smime-ca-dir[501] or as a vivid member of the smime-ca-file[502] . 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 community, simply by registrating yourself via the web interface. Once you are, create and verify all email addresses you want to be able to create signed and encrypted messages for/with using the corresponding entries of the web interface. Now ready to create S/MIME certificates, so let us create a new ‘‘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-request). You are now ready and can create your CAcert certified certificate. 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 S-nail will work with. If you have created your private key with a passphrase then S-nail will ask you for it whenever a message is signed or decrypted. Set the following variables to henceforth use S/MIME (setting smime-ca-file[502] is of interest for verification only):

? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \
smime-sign-cert=ME@HERE.com.paired \
smime-sign-message-digest=SHA256 \
smime-sign

Using CRLs with S/MIME or SSL/TLS [41]
[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 issued. Such usually happens because the private key for the certificate has been compromised, because the owner of the certificate has left the organization that is mentioned in the certificate, etc. To seriously use S/MIME or SSL/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. S-nail currently offers no mechanism to fetch CRLs, nor to access them on the Internet, so they have to be retrieved by some external mechanism.

S-nail accepts CRLs in PEM format only; CRLs in DER format must be converted, like, e.g.:

$ openssl crl −inform DER −in crl.der −out crl.pem

To tell S-nail about the CRLs, a directory that contains all CRL files (and no other files) must be created. The smime-crl-dir[506] or ssl-crl-dir[537] variables, respectively, must then be set to point to that directory. After that, S-nail requires a CRL to be present for each CA that is used to verify a certificate.

FAQ [42]

In general it is a good idea to turn on debug[377] (−d[58] ) and / or verbose[558] (−v[79] , twice) if something does not work well. Very often a diagnostic message can be produced that leads to the problems’ solution.

S-nail shortly hangs on startup [43]
This can have two reasons, one is the necessity to wait for a file lock and cannot be helped, the other being that S-nail 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[407] ). One may have varying success by ensuring that the real hostname and ‘localhost’ have entries in /etc/hosts, or, more generally, that the name service is properly setup – and does hostname(1) return the expected 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 aka GMail [44]
Since 2014 some free service providers classify programs as ‘‘less secure’’ unless they use a special authentification method (OAuth 2.0) which was not standardized for non-HTTP protocol authentication token query until August 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 protocol has no such local part but instead requires a world-wide-web query to create or fetch a token; since there is no local cache this query would have to be performed whenever S-nail is invoked (in interactive sessions situation may differ).

S-nail does not support OAuth. Because of this it is necessary to declare S-nail 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 following 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 password in S-nail (for more on that see the section On URL syntax and credential lookup[12] ).

Not "defunctional", but the editor key does not work [45]
It can happen that the terminal library (see On terminal control and line editor[17] , bind[134] , termcap[548] ) reports different codes than the terminal really sends, in which case S-nail 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[558] listing of bind[134] ings 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[548] to make S-nail 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
? s-nail -v -Stermcap=’kHOM=\E[H’
? bind*
# 1B 5B=[ 48=H
bind base :kHOM z0

IMAP CLIENT [46]

[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 reinstantiated on user demand: in effect the IMAP code is at the level of S-nail v14.8.16 (with imapcodec[613] being the sole exception), and should be treated with some care.

IMAP uses the ‘imap://’ and ‘imaps://’ protocol prefixes, and an IMAP-based folder[390] may be used. IMAP URLs (paths) undergo inspections and possible transformations before use (and the command imapcodec[613] can be used to manually apply them to any given argument). Hierarchy delimiters are normalized, a step which is configurable via the imap-delim[617] variable chain, but defaults to the first seen delimiter otherwise. S-nail supports internationalised IMAP names, and en- and decodes the names from and to the ttycharset[553] as necessary and possible. If a mailbox name is expanded (see Filename transformations[26] ) to an IMAP mailbox, all names that begin with ‘+’ then refer to IMAP mailboxes below the folder[390] 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 ‘INBOX’ – 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[614] variable for more information.

disconnect

If operating in online mode on an IMAP mailbox, switch to disconnected mode while retaining the mailbox status. See the description of the disconnected[614] 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. S-nail operates always in IMAP ‘selected state’ on the current mailbox; commands that change this will produce undesirable results 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 mailbox 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 parentheses; if there are multiple namespaces of the same type, inner parentheses separate 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[114] (see Command modifiers[21] ), and manages the error number ![329] . The first argument specifies the operation: e[ncode] normalizes hierarchy delimiters (see imap-delim[617] ) and converts the strings from the locale ttycharset[553] to the internationalized variant used by IMAP, d[ecode] performs the reverse operation.

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[616] ). 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[566] when this problem occurs.

disconnected-USER@HOST

The specified account is handled as described for the disconnected[614] variable above, but other accounts are not affected.

imap-auth-USER@HOST, imap-auth

Sets the IMAP authentication method. Valid values are ‘login’ for the usual password-based authentication (the default), ‘cram-md5’, which is a password-based authentication that does not send the password over the network in clear text, and ‘gssapi’ for GSS-API based authentication.

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 S-nail. All contents of the cache can be deleted by S-nail 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 hierarchy 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 discovered 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 inactivity; 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[183] 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 variable has no effect and the folders[183] command does not descend to subfolders.

imap-use-starttls-USER@HOST, imap-use-starttls-HOST, imap-use-starttls

Causes S-nail to issue a ‘STARTTLS’ command to make an unencrypted IMAP session SSL/TLS encrypted. This functionality is not supported by all servers, and is not used if the session is already encrypted by the IMAPS method.

SEE ALSO [47]

bogofilter(1), gpg(1), more(1), newaliases(1), openssl(1), sendmail(1), sh(1), spamassassin(1), iconv(3), setlocale(3), aliases(5), termcap(5), terminfo(5), locale(7), mailaddr(7), re_format(7), mailwrapper(8), sendmail(8)

HISTORY [48]

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 assure the safety of simultaneous access, to improve privacy, to survive 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 external networks (v8).

BSD Mail was written in 1978 by Kurt Shoens and developed as part of the BSD UNIX distribution until 1995. Mail has then seen further development in open source BSD variants, noticeably by Christos Zoulas in NetBSD. Based upon this Nail, later Heirloom Mailx, was developed by Gunnar Ritter in the years 2000 until 2008. Since 2012 S-nail is maintained by Steffen (Daode) Nurpmeso. This man page is derived from ‘‘The Mail Reference Manual’’ that was originally written by Kurt Shoens.

AUTHORS [49]

Kurt Shoens, Edward Wang, Keith Bostic, Christos Zoulas, Gunnar Ritter. S-nail is developed by Steffen Nurpmeso <steffen@sdaoden.eu>.

CAVEATS [50]

[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 functions cannot deal with the siglongjmp(3) that this software (still) performs; 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[411] ).

The SMTP and POP3 protocol support of S-nail is very basic. Also, if it fails to contact its upstream SMTP server, it will not make further attempts to transfer the message at a later time (setting save[487] and sendwait[493] may be useful). If this is a concern, it might be better to set up a local SMTP server that is capable of message queuing.

BUGS [51]

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 threaded display a power user may encounter crashes very occasionally (this is may and very). The file TODO in the source repository lists future directions.

Please report bugs to the contact-mail[371] address, e.g., from within s-nail: ‘? eval[174] mail[203] $contact-mail’. More information is available on the web: ‘$ s-nail -X ’echo $contact-web[372] ’ -Xx’.

Copyright (c) 1997 - 2017, Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>
@(#)code-nail.html-w42 1.106 2017-10-23T16:30:30+0000