s-nail: send and receive Internet mail - Linux Manuals (1) (2024)

s-nail: send and receive Internet mail

Command to display s-nail manual in Linux: $ man 1 s-nail

NAME

S-nail [v14.9.23] - send and receive Internet mail

SYNOPSIS

s-nail[-DdEFinv~#][-: spec][-A account][: -a attachment :][: -b bcc-addr :][: -C field: body :][: -c cc-addr :][-M type | -m file | -q file | -t][-r from-addr][: -S var [= value : ]][-s subject][: -T field: addr :][: -X cmd :][: -Y cmd :][-.]: to-addr :[--~ : mta-option :]


s-nail[-DdEeHiNnRv~#][-: spec][-A account][: -C field: body :][-L spec][-r from-addr][: -S var [= value : ]][-u user][: -X cmd :][: -Y cmd :][--~ : mta-option :]
s-nail[-DdEeHiNnRv~#][-: spec][-A account][: -C field: body :]-f[-L spec][-r from-addr][: -S var [= value : ]][: -X cmd :][: -Y cmd :][file][--~ : mta-option :]


s-nail-h | --help
s-nail-V | --version

DESCRIPTION

Note:S-nail (S-nail) will see major changes in v15.0 (circa 2022).Some backward incompatibilities cannot be avoided.Sx COMMANDSchange toSx Shell-style argument quoting ,and shell metacharacters will become (more) meaningful.Some commands accept new syntax today viawysh( Sx Command modifiers ) Behaviour is flagged [v15-compat] and [no v15-compat],set tingv15-compat( Sx INTERNAL VARIABLES will choose new behaviour when applicable;giving it a value makeswyshan implied default.[Obsolete] flags what will vanish.

Warning!v15-compat(with value) will be a default in v14.10.0!

S-nail provides a simple and friendly environment for sending andreceiving mail.It is intended to provide the functionality of the POSIXmailx(1)command, but is MIME capable and optionally offers extensions forline editing, S/MIME, SMTP and POP3, among others.S-nail divides incoming mail into its constituent messages and allowsthe user to deal with them in any order.It offers manySx COMMANDSandSx INTERNAL VARIABLESfor manipulating messages and sending mail.It provides the user simple editing capabilities to ease the compositionof outgoing messages, and increasingly powerful and reliablenon-interactive scripting capabilities.

Options

-: spec , --resource-files =..
Controls loading of (as viasource Sx Resource files :specis parsed case-insensitively, the letter`s'corresponds to the system wides-nail.rc `u'the user's personal file~/.mailrc The (original) system wide resource is also compiled-in, accessible via`x'The letters`-'and`/'disable usage of resource files.Order matters, default is`su'This option overrides-n
-A name , --account =..
Activate useraccountnameafter program startup is complete (resource files loaded, only-Xcommands are to be executed), and switch to itsSx primary system mailbox(most likely theinbox ) If activation fails the programe xit s if used non-interactively, or if any oferrexitorposixare set.
-a file [=input-charset [#output-charset ]]

Fl Fl attach Ns=..(Send mode) Attachfile For (Compose mode) opportunities refer to~@and~^ fileis subject to tilde expansion (seeSx Filename transformationsandfolder ) if it is not accessible but contains a`='character, anything before the last`='will be used as the filename, anything thereafter as a character setspecification, as shown.

If only an input character setis specified, the input side is fixed, and no character set conversionwill be applied; an empty or the special string hyphen-minus`-'is taken forttycharset(the default).If an output character set has also been specified the desiredconversion is performed immediately, not considering file type andcontent, except for an empty string or hyphen-minus`-',which select the default conversion algorithm (seeSx Character sets ) :no immediate conversion is performed,fileand its contents will be MIME-classified( Sx HTML mail and MIME attachments , The mime.types files)first --- only the latter mode is available unlessfeaturesincludes`,+iconv,'

-B
([Obsolete]: S-nail will always use line-buffered output, to gainline-buffered input even in batch mode enable batch mode via-# .
-b addr , --bcc =..
(Send mode) Send a blind carbon copy to recipientaddr The option may be used multiple times.Also see the sectionSx On sending mail, and non-interactive mode .
-C field: body , --custom-header =..
Create a custom header which persists for an entire session.A custom header consists of the field name followed by a colon`:'and the field content body, for example`-C'Blah: Neminem laede; imo omnes, quantum potes, juva .Standard header field names cannot be overwritten by custom headers.Runtime adjustable custom headers are available via the variablecustomhdr and in (Compose mode)~^ one of theSx COMMAND ESCAPES ,as well asdigmsgare the most flexible and powerful options to manage message headers.This option may be used multiple times.
-c addr , --cc =..
(Send mode) Just like-b except it places the argument in the list of carbon copies.
-D , --disconnected
[Option] Startup withdisconnectedset
-d , --debug
Enter a debug-only sandbox mode by setting the internal variabledebug the same can be achieved via`-S'Va debugor`set'Va debug .Also see-v
-E , --discard-empty-messages
(Send mode)setskipemptybodyand thus discard messages with an empty message part body, successfully.
-e , --check-and-exit
Just check if mail is present (in the systeminboxor the one specified via-f ) if yes, return an exit status of zero, a non-zero value otherwise.To restrict the set of mails to consider in this evaluation a messagespecification can be added with the option-L Quickrun: does not open an interactive session.
-F
(Send mode) Save the message to send in a file named after the local part ofthe first recipient's address (instead of inrecord ).
-f , --file
Read in the contents of the user'sSx secondary mailboxMBOX(or the specified file) for processing;when S-nail is quit, it writes undeleted messages back to this file(but be aware of theholdoption).The optionalfileargument will undergo some specialSx Filename transformations(as viafolder ) Note thatfileis not an argument to the flag-f but is instead taken from the command line after option processing hasbeen completed.In order to use afilethat starts with a hyphen-minus, prefix with a relative path, as in`./-hyphenbox.mbox'
-H , --header-summary
Display a summary ofheadersfor the givenfolder(depending on-u inboxorMAIL or as specified via-f ) then exit.A configurable summary view is available via the option-L This mode does not honourshowlast Quickrun: does not open an interactive session.
-h , --help
Show a brief usage summary; use--long-helpfor a list long options.
-i
setignoreto ignore tty interrupt signals.
-L spec , --search =..
Display a summary ofheadersof all messages that match the givenspecin thefolderfound by the same algorithm used by-H then exit.See the sectionSx Specifying messagesfor the format ofspec This mode does not honourshowlast

If the-eoption has been given in addition no header summary is produced,but S-nail will instead indicate via its exit status whetherspecmatched any messages( `0' or not( `1'); note that any verbose output is suppressed in this mode and must insteadbe enabled explicitly (see-v ) Quickrun: does not open an interactive session.

-M type
(Send mode) Will flag standard input with the MIME`Content-Type:'set to the given knowntype( Sx HTML mail and MIME attachments , The mime.types files and use it as the main message body.[v15 behaviour may differ] Using this option will bypass processing ofmessage-inject-headandmessage-inject-tail Also see-q , m , t
-m file
(Send mode) MIME classify the specifiedfileand use it as the main message body.[v15 behaviour may differ] Using this option will bypass processing ofmessage-inject-headandmessage-inject-tail Also see-q , M , t
-N , --no-header-summary
inhibit the initial display of message headers when reading mail orediting a mailboxfolderby callingunsetfor the internal variableheader
-n
Standard flag that inhibits reading the system wides-nail.rcupon startup.The option-:allows more control over the startup sequence; also seeSx Resource files .
-q file , --quote-file =..
(Send mode) Initialize the message body with the contents offile which may be standard input`-'only in non-interactive context.Also see-M , m , t
-R , --read-only
Any mailboxfolderakafolderopened will be in read-only mode.
-r from-addr , --from-address =..
The RFC 5321 reverse-path used for relaying and delegating messages toits destination(s), for example to report delivery errors, is normallyderived from the address which appears in thefromheader (or, if that contains multiple addresses, insender ) A file-based aka local executablemta(Mail-Transfer-Agent), however, instead uses the local identity of theinitiating user.

When this command line option is used the given single addresseefrom-addrwill be assigned to the internal variablefrom but in addition the command line option-f from-addrwill be passed to a file-basedmtawhenever a message is sent.Shallfrom-addrinclude a user name the address components will be separated andthe name part will be passed to a file-basedmtaindividually via-F name Even though not a recipient the`shquote'expandaddrflag is supported.

If an empty string is passed asfrom-addrthen the content of the variablefrom(or, if that contains multiple addresses,sender will be evaluated and used for this purpose whenever the file-basedmtais contacted.By default, without-rthat is, neither-fnor-Fcommand line options are used when contacting a file-based MTA, unlessthis automatic deduction is enforced byset ting the internal variabler-option-implicit

Remarks: many default installations and sites disallow overriding thelocal user identity like this unless either the MTA has been configuredaccordingly or the user is member of a group with special privileges.Passing an invalid address will cause an error.

-S var [= value , --set =..]
set(or, with a prefix string`no',as documented inSx INTERNAL VARIABLES ,unset var iable and optionally assignvalue if supported; [v15 behaviour may differ] the entire expression is evaluated as if specifiedwithin dollar-single-quotes (seeSx Shell-style argument quoting )if the internal variablev15-compatis set.If the operation fails the program will exit if any oferrexitorposixare set.Settings established via-Scannot be changed from withinSx Resource filesor an account switch initiated by-A They will become mutable again before commands registered via-Xare executed.
-s subject , --subject =..
(Send mode) Specify the subject of the message to be sent.Newline (NL) and carriage-return (CR) bytes are invalid and will benormalized to space (SP) characters.
-T field: addr , --target =..
(Send mode) Addaddrto the list of receivers targeted byfield for now supported are only`bcc',`cc',`fcc',and`to'Field and body (address) are separated by a colon`:'and optionally blank (space, tabulator) characters.The`shquote'expandaddrflag is supported.addris parsed like a message header address line, as if it would be part ofa template message fed in via-t and the same modifier suffix is supported.This option may be used multiple times.
-t , --template
(Send mode) The text message given (on standard input) is expected to contain,separated from the message body by an empty line, one or multipleplain text message headers.[v15 behaviour may differ] Readily prepared MIME mail messages cannot be passed.Headers can span multiple consecutive lines if follow lines start withany amount of whitespace.A line starting with the number sign`#'in the first column is ignored.Message recipients can be given via the message headers`To:',`Cc:',`Bcc:'(the`?single'modifier enforces treatment as a single addressee, for example`To?single:'exa, <m@ple> )or`Fcc:',they will be added to any recipients specified on the command line,and are likewise subject toexpandaddrvalidity checks.If a message subject is specified via`Subject:'then it will be used in favour of one given on the command line.

More optional headers are`Reply-To:'(possibly overridingreply-to ) `Sender:'( sender `From:'( fromand / or option-r ) `Message-ID:',`In-Reply-To:',`References:'and`Mail-Followup-To:',by default created automatically dependent on message context, willbe used if specified (a special address massage will however still occurfor the latter).Any other custom header field (also see-C customhdrand~^ is passed through entirelyunchanged, and in conjunction with the options-~or-#it is possible to embedSx COMMAND ESCAPES .Also see-M , m , q

-u user , --inbox-of =..
Initially read theSx primary system mailboxofuser appropriate privileges presumed; effectively identical to`-f'Ns %user .
-V , --version
Show S-nailsversionand exit.The commandversionwill also show the list offeatures `$'s-nail -:/ -Xversion -Xx .
-v , --verbose
set s the internal variableverboseto enable logging of informational context messages.(Increases level of verbosity when used multiple times.)Also see-d
-X cmd , --startup-cmd =..
Add the given (or multiple for a multiline argument)cmdto a list of commands to be executed before normal operation starts.The commands will be evaluated as a unit, just as viasource Correlates with-#anderrexit
-Y cmd , --cmd =..
Add the given (or multiple for a multiline argument)cmdto a list of commands to be executed after normal operation has started.The commands will be evaluated successively in the given order, and asif given on the program's standard input --- before interactiveprompting begins in interactive mode, after standard input has beenconsumed otherwise.
-~ , --enable-cmd-escapes
EnableSx COMMAND ESCAPESin (Compose mode) even in non-interactive use cases.This can for example be used to automatically format the composedmessage 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 [at] exam.ple
-# , --batch-mode
Enables batch mode: standard input is made line buffered, the completeset of (interactive) commands is available, processing ofSx COMMAND ESCAPESis enabled inSx Compose mode ,and diverseSx INTERNAL VARIABLESare adjusted for batch necessities, exactly as if done via-S emptystart no errexit no header no posix quiet sendwait typescript-modeas well asMAIL MBOXandinbox(the latter three to/dev/null ) Also, the values ofCOLUMNSandLINESare looked up, and acted upon.The following prepares an email message in a batched dry run:
$ for name in bob alice [at] exam.ple lisa [at] exam.ple; do printf 'mail %s\n~s ubject\nText\n~.\n' "${name}" done | LC_ALL=C s-nail -#:x -Smta=test \ -X'alias bob bob [at] exam.ple'
-. , --end-options
This flag forces termination of option processing in order to prevent``option injection''(attacks).It also forcefully puts S-nail into send mode, seeSx On sending mail, and non-interactive mode .

If the setting ofexpandargvallows their recognition allmta-optionarguments given at the end of the command line after a`--'separator will be passed through to a file-basedmta(Mail-Transfer-Agent) and persist for the entire session.expandargvconstraints do not apply to the content ofmta-arguments Command line receiver address handling supports the`shquote'constraint ofexpandaddr for more please seeSx On sending mail, and non-interactive mode .

$ s-nail -#:/ -X 'addrcodec enc Hey, ho <silver@go>' -Xx

A starter

S-nail is a direct descendant ofBSD Mail, itself a successor to the ResearchUNIXmail which``was there from the start''according toSx HISTORY .It thus represents the user side of theUNIXmail system, whereas the system side (Mail-Transfer-Agent, MTA) wastraditionally taken bysendmail(8)(and most MTAs provide a binary of this name for compatibility reasons).If the [Option]al SMTPmtais included in thefeaturesof S-nail then the system side is not a mandatory precondition for maildelivery.

S-nail strives for compliance with the POSIXmailx(1)standard, butposix one of theSx INTERNAL VARIABLES ,or itsSx ENVIRONMENT Nsal equivalentPOSIXLY_CORRECT needs to be set to adjust behaviour to be almost on par.Almost, because there is one important difference: POSIXSx Shell-style argument quotingis ([v15 behaviour may differ] increasingly) used instead of theSx Old-style argument quotingthat the standard documents, which is believed to be a feature.The builtin as well as the (default) globals-nail.rcSx Resource filesalready bend the standard imposed settings a bit.

For example,holdandkeepsavearesetin order to suppress the automatic moving of messages to theSx secondary mailboxMBOXthat would otherwise occur (seeSx Message states ) ,andkeepto not remove empty system MBOX mailbox files (or all empty such files inposixmode) to avoid mangling of file permissions when files eventually getrecreated.

To enter interactive mode even if the initial mailbox is emptyemptystartis set,editheadersto allow editing of headers as well asfullnamesto not strip down addresses inSx Compose mode ,andquoteto include the message that is being responded to whenreply ing, which is indented by anindentprefixthat also deviates from standard imposed settings.mime-counter-evidenceis fully enabled, too.It setsfollowup-to-honourandreply-to-honourto comply with reply address desires.

Credentials and other settings are easily addressable by grouping them viaaccount The file mode creation mask can be managed withumask Files and shell pipe output can besource d foreval uation, also during startup from within theSx Resource files .Informational context can be available byset tingverboseordebug(as via-v , d )

On sending mail, and non-interactive mode

To send a message to one or more people, using a local or built-inmta(Mail-Transfer-Agent) transport to actually deliver the generated mailmessage, S-nail can be invoked with arguments which are the names ofpeople to whom the mail will be sent, and the command line options-band-ccan be used to add (blind) carbon copy receivers:

# Via test MTA$ echo Hello, world | s-nail -:/ -Smta=test -s test $LOGNAME# Via sendmail(1) MTA$ </dev/null s-nail -:x -s test $LOGNAME# Debug dry-run mode:$ </dev/null LC_ALL=C s-nail -d -:/ \ -Sttycharset=utf8 -Sfullnames \ -b bcc [at] exam.ple -c cc [at] exam.ple -. \ '(Lovely) Bob <bob [at] exam.ple>' eric [at] exam.ple# With SMTP (no real sending due to -d debug dry-run)$ LC_ALL=C s-nail -d -:/ -Sv15-compat -Sttycharset=utf8 \ -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \ -S from=scriptreply [at] exam.ple \ -a /etc/mail.rc --end-options \ eric [at] exam.ple < /tmp/letter.txt

Email addresses and plain user names are subject toalternatesfiltering, names only are first expanded throughaliasandmta-aliases An address in angle brackets consisting only of a valid local user`<name>'will be converted to a fully qualified address if eitherhostnameis not set, or set to a non-empty value; if set to the empty value theconversion is left up to themta By settingexpandaddrfine-grained control of recipient address types other than user namesand network addresses is possible.Recipients are classified as follows:any name that 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 consists only of hyphen-minus`-'or starts with the character solidus`/'or the character sequence dot solidus`./'is treated as a file, regardless of the remaining content.Any other name which contains a commercial at`@'character is a network address;Any other name which starts with a plus sign`+'character is a mailbox name;Any other name which contains a solidus`/'character but no exclamation mark`!'or percent sign`%'character before is also a mailbox name;What remains is treated as a network address.This classification can be avoided by using a`Fcc:'header, seeSx Compose mode .

$ 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 -:/ -Smta=test -Sv15-compat -Sttycharset=utf8 \ --set mime-force-sendout --set fullnames \ -S expandaddr=fail,-all,+addr,failinvaddr -s test \ --end-options 'Imagine John <cold [at] turk.ey>'

Before messages are sent they undergo editing inSx Compose mode .But many settings are static and can be set more generally.The envelope sender address for example is defined byfrom explicitly defining an originatinghostnamemay be desirable, especially with the built-in SMTP Mail-Transfer-Agentmta Sx Character setsfor outgoing message and MIME part content are configurable viasendcharsets whereas input data is assumed to be inttycharset Message data will be passed over the wire in amime-encoding and MIME parts aka attachments need amimetype usually taken out ofSx The mime.types files .Saving copies of sent messages in arecordmailbox may be desirable - as for most mailboxfoldertargetsSx Filename transformationswill be performed.

For the purpose of arranging a complete environment of settings that canbe switched to with a single command or command line option there areaccount s Alternatively a flat configuration could be possible, making useof so-called variable chains which automatically pick`USER [at] HOST'or`HOST'context-dependent variants some variables support: for example addressing`Folder'Ns pop3://yaa [at] exam.plewould findpop3-no-apop-yaa [at] exam.ple pop3-no-apop-exam.pleandpop3-no-apopin order.For more please seeSx On URL syntax and credential lookupandSx INTERNAL VARIABLES .

To avoid environmental noise scripts should create a script-localenvironment, ideally with the command line options-:to disable configuration files in conjunction with repetitions of-Sto specify variables:

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

As shown, scripts producing messages can``fake''a locale environment, the above specifies the all-compatible 7-bit cleanLC_ALL``C'' but will nonetheless take and send UTF-8 in the message text by usingttycharset If character set conversion is compiled in( featuresincludes the term`,+iconv,')invalid (according tottycharset character input data would normally cause errors; settingmime-force-sendoutwill instead, as a last resort, classify the input as binary data, andtherefore allow message creation to be successful.(Such content can then be inspected either by installing apipe-TYPE/SUBTYPEhandler for`application/octet-stream',or possibly automatically throughmime-counter-evidence )

In interactive mode, introduced soon, messages can be sent by calling themailcommand with a list of recipient addresses:

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

Compose mode

If standard input is a terminal rather than the message to be sent,the user is expected to type in the message contents.In compose mode lines beginning with the character`~'(in fact the value ofescape are special - these are so-calledSx COMMAND ESCAPESwhich can be used to read in files, process shell commands, add and editattachments and more.For example~vor~ewill start theVISUALtextEDITOR respectively, to revise the message in its current state,~hallows editing of the most important message headers, with the potent~^custom headers can be created, for example (more specifically than with-Candcustomhdr ) [Option]ally~?gives an overview of most other available command escapes.

To create file-carbon-copies the special recipient header`Fcc:'may be used as often as desired, for example via~^ Its entire value (or body in standard terms) is interpreted as afoldertarget, after having been subject toSx Filename transformations :this is the only way to create a file-carbon-copy without introducing anambiguity regarding the interpretation of the address, file names withleading vertical bars or commercial ats can be used.Like all other recipients`Fcc:'is subject to the checks ofexpandaddr Any local file and pipe command addressee honours the setting ofmbox-fcc-and-pcc

Once finished with editing the command escape~.(see there) will call hooks, insert automatic injections and receivers,leave compose mode and send the message once it is completed.Aborting letter composition is possible with either of~xor~q the latter of which will save the message in the file denoted byDEADunlessno saveis set.And unlessignoreeofis set the effect of~.can also be achieved by typing end-of-transmission (EOT) via`control-D'( `^D' at the beginning of an empty line, and~qis always reachable by typing end-of-text (ETX) twice via`control-C'( `^C').

The compose mode hookson-compose-enter , on-compose-splice , on-compose-leaveandon-compose-cleanupmay be set todefine d macros and provide reliable and increasingly powerful mechanisms toperform automated message adjustments dependent on message context,for example addition of message signatures( message-inject-head , message-inject-tail or creation of additional receiver lists (also by settingautocc , autobcc ) To achieve that the commanddigmsgmay be used in order to query and adjust status of message(s).The splice hook can also make use ofSx COMMAND ESCAPES .([v15 behaviour may differ] The compose mode hooks work forforward , mail , replyand variants;resendandResendonly provide the hookson-resend-enterandon-resend-cleanup which are pretty restricted due to the nature of the operation.)

On reading mail, and more on interactive mode

When invoked without addressees S-nail enters interactive mode in whichmails may be read.When used like that the user's systeminbox(for more on mailbox types please see the commandfolder is read in and a one line header of each message therein is displayed ifthe variableheaderis set.The visual style of this summary ofheaderscan be adjusted through the variableheadlineand the possible sorting criterion viaautosort Scrolling throughscreen fuls ofheaderscan be performed with the commandz If the initially opened mailbox is empty S-nail will instead exitimmediately (after displaying a message) unless the variableemptystartis set.

At thepromptthe commandlistwill give a listing of all available commands andhelpwill [Option]ally give a summary of some common ones.If the [Option]al documentation strings are available (seefeatures 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 alphabeticalorder of commands does not necessarily relate to the abbreviations; it ishowever possible to define overwrites withcommandalias ) These commands can also produce a moreverboseoutput.

Messages are given numbers (starting at 1) which uniquely identifymessages; 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 variableshowlastwill instead cause usage of the last message for this purpose.The commandheaderswill display ascreen ful of header summaries containing the``dot'' whereasfromwill display only the summaries of the given messages, defaulting to the``dot''

Message content can be displayed with the commandtype( `t' aliasprint ) Here the variablecrtcontrols whether and when S-nail will use the configuredPAGERfor display instead of directly writing to the user terminalscreen the sole difference to the commandmore which will always use thePAGER The commandtopwill instead only show the firsttoplinesof a message (maybe even compressed iftopsqueezeis set).Message display experience may improve by setting and adjustingmime-counter-evidence and also seeSx HTML mail and MIME attachments .

By default the current message( ``dot'' is displayed, but like with many other commands it is possible to givea fancy message specification (seeSx Specifying messages ) ,for example`t:u'will display all unread messages,`t.'will display the``dot'' `t'1 5will type the messages 1 and 5,`t'1-5will type the messages 1 through 5, and`t-'and`t+'will display the previous and the next message, respectively.The commandsearch(a more substantial alias forfrom will display a header summary of the given message specification listinstead of their content; the following will search for subjects:

? from "'@Some subject to search for'"

In the default setup all header fields of a message will betype d, but fields can be white- or blacklisted for a variety ofapplications by using the commandheaderpick e.g., to restrict their display to a very restricted set fortype `headerpick'Cd type retain Ar from to cc subject .In order to display all header fields of a message regardless ofcurrently active ignore or retain lists, use the commandsTypeandTop Showwill show the raw message content.Note that historically the globals-nail.rcnot only adjusts the list of displayed headers, but also setscrt ([v15 behaviour may differ] A yet somewhat restricted) Reliable scriptable messageinspection is available viadigmsg

Dependent upon the configuration a line editor (see the sectionSx On terminal control and line editor )aims at making the user experience with the manySx COMMANDSa bit nicer.When reading the systeminbox or when-f(orfolder specified a mailbox explicitly prefixed with the special`%:'modifier (to propagate it to aSx primary system mailbox ) ,then messages which have been read(see Sx Message states will be automatically moved to aSx secondary mailbox ,the user'sMBOXfile, when the mailbox is left, either by changing the active mailbox orby quitting S-nail - this automatic moving from a system- or primary-to the secondary mailbox is not performed when the variableholdis set.Messages can also be explicitlymove d to other mailboxes, whereascopykeeps the original message.writecan be used to write out data content of specific parts of messages.

After examining a message the user canreply `r'to the sender and all recipients (which will also be placed in`To:'unlessrecipients-in-ccis set), orReply `R'exclusively to the sender(s).To comply with with the receivers desired reply address theSx quadoption Nssfollowup-to-honourandreply-to-honourshould usually be set.The commandsLreplyandLfollowupknow how to apply a special addressee massage, seeSx Mailing lists .Dependent on the presence and value ofquotethe message being replied to will be included in a quoted form.forward ing a message will allow editing the new message: the original messagewill be contained in the message body, adjusted according toheaderpick It is possible toresendorResendmessages: the former will add a series of`Resent-'headers, whereas the latter will not; different to newly createdmessages editing is not possible and no copy will be saved even withrecordunless the additional variablerecord-resentis set.When sending, replying or forwarding messages comments and full nameswill be stripped from recipient addresses unless the internal variablefullnamesis set.

Of course messages can bedelete `d' and they can spring into existence again viaundelete or when the S-nail session is ended via theexitorxitcommands to perform a quick program termation.To end a mail processing session regularly and perform a full programexit one may issue the commandquit It will, among others, move read messages to theSx secondary mailboxMBOXas necessary, discard deleted messages in the current mailbox,and update the [Option]al (seefeatures line editorhistory-file By the way, whenever the main event loop is about to look out for thenext input line it will trigger the hookon-main-loop-tick

HTML mail and MIME attachments

HTML-only messages become more and more common, and many messages comebundled with a bouquet of MIME (Multipurpose Internet Mail Extensions)parts and attachments.To get a notion of MIME types there is a built-in default set,onto which the content ofSx The mime.types fileswill be added (as configured and allowed bymimetypes-load-control ) Types can also become registered and listed with the commandmimetype To improve interaction with the faulty MIME part declarations of real lifemime-counter-evidencewill allow verification of the given assertion, and the possibleprovision of an alternative, better MIME type.Note plain text parts will always be preferred in`multipart/alternative'MIME messages unlessmime-alternative-favour-richis set.

Whereas a simple HTML-to-text filter for displaying HTML messages is[Option]ally supported (indicated by`,+filter-html-tagsoup,'infeatures ) MIME types other than plain text cannot be handled directly.To deal with specific non-text MIME types or file extensions programsneed to be registered which either prepare (re-)integrable plain textversions of their input (a mode which is calledcopiousoutput ) or display the content externally, for example in a graphical window:the latter type is only considered by and for the commandmimeview

To install a handler program for a MIME type an accordingpipe-TYPE/SUBTYPEvariable needs to be set; to define a handler for a file extensionpipe-EXTENSIONcan be used - these handlers take precedence.[Option]ally mail user agent configuration is supported (seeSx The Mailcap files ) ,and will be queried for display or quote handlers after the former ones.Type-markers registered viamimetypeare the last possible source for information how to handle a MIME type.

For example, to display HTML messages integrated via the text browserslynx(1)orelinks(1),register a MathML MIME type and enable its plain text display, and toopen PDF attachments in an external PDF viewer, asynchronously and withsome 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=?t? endif? mimetype ?t 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}"'? define showhtml {? \localopts yes? \set mime-alternative-favour-rich pipe-text/html=?h?? \type "$@"? }? \commandalias html \\call showhtml

Mailing lists

Known or subscribed-to mailing lists may be flagged in the summary ofheaders( headlineformat character`%L') ,and will gain special treatment when sending mails: the variablefollowup-to-honourwill ensure that a`Mail-Followup-To:'header is honoured when a message is being replied to( reply followup Lreply Lfollowup ) andfollowup-tocontrols creation of this header when creatingmail s, if the necessary user setup( from , sender ) is available; then, it may also be created automatically, for examplewhen list-replying viaLreplyorLfollowup whenfollowuporreplyis used and the messages`Mail-Followup-To:'is honoured etc.

The commandsmlistandmlsubscribemanage S-nails notion of which addresses are mailing lists.With the [Option]al regular expression support any addresswhich contains any of the magic regular expression characters`('^[*+?|$ ;seere_format7orregex(7),dependent on the host system)will be compiled and used as one, possibly matching many addresses.It is not possible to escape the``magic'' in order to match special characters as-is, bracket expressions must beused, for example`search'Li @subject@'[[]open bracket' .

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

Known and subscribed lists differ in that for the latter theuser s address is not part of a generated`Mail-Followup-To:'There are exceptions, for example if multiple lists are addressed andnot all have the subscription attribute.When replying to a message its list address( `List-Post:'header) is automatically and temporarily treated like a knownmlist dependent on the variablereply-to-honouran existing`Reply-To:'is used instead (if it is a single address on the same domain as`List-Post:')in order to accept a list administrator's wish that is supposed to havebeen manifested like that.

For convenience and compatibility with mail programs that do not honourthe non-standard M-F-T, an automatic user entry in the carbon-copy`Cc:'address list of generated message can be created by settingfollowup-to-add-cc This entry will be added whenever the user will be placed in the`Mail-Followup-To:'list, and is not a regular addressee already.reply-to-swap-intries to deal with the address rewriting that many mailing-lists nowadaysperform to work around DKIM / DMARC etc. standard imposed problems.

Signed and encrypted messages with S/MIME

[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 has been sent usinga valid certificate, that the sender address matches that in thecertificate, and that the message text has not been altered.Signing a message does not change its regular text;it can be read regardless of whether the recipients software is able tohandle 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 peopleexcept those who have access to the secret decryption key.To encrypt a message, the specific recipients public encryption keymust be known.It is therefore not possible to send encrypted mail to people unless theirkey has been retrieved from either previous communication or public keydirectories.Because signing is performed with private keys, and encryption withpublic keys, messages should always be signed before being encrypted.

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 reallyoriginates from the CA, provided that the CA's own certificate ispreviously known.A set of CA certificates is usually delivered and installed togetherwith the cryptographical library that is used on the local system.Therefore reasonable security for S/MIME on the Internet is provided ifthe source that provides that library installation is trusted.It is also possible to use a specific pool of trusted certificates.If this is desired,smime-ca-no-defaultsshould be set to avoid using the default certificate pool, andsmime-ca-fileand/orsmime-ca-dirshould be pointed to a trusted pool of certificates.A certificate cannot be more secure than the method its CA certificatehas been retrieved with.

This trusted pool of certificates is used by the commandverifyto ensure that the given S/MIME messages can be trusted.If so, verified sender certificates that were embedded in signedmessages can be saved locally with the commandcertsave and used by S-nail to encrypt further communication with these senders:

? certsave FILENAME? set smime-encrypt-USER [at] HOST=FILENAME \ smime-cipher-USER [at] HOST=AES256

To sign outgoing messages, in order to allow receivers to verify theorigin of these messages, a personal S/MIME certificate is required.S-nail supports password-protected personal certificates (and keys), seesmime-sign-cert The sectionSx On URL syntax and credential lookupgives an overview of the possible sources of user credentials, andSx S/MIME step by stepshows examplarily how a private S/MIME 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 [at] exam.ple.paired \ smime-sign-digest=SHA512 \ smime-sign from=myname [at] my.host

Variables of interest for S/MIME in general aresmime-ca-dir smime-ca-file smime-ca-flags smime-ca-no-defaults smime-crl-dir smime-crl-file For S/MIME signing of interest aresmime-sign smime-sign-cert smime-sign-include-certsandsmime-sign-digest Additional variables of interest for S/MIME en- and decryption:smime-cipherandsmime-encrypt-USER [at] HOST Variables of secondary interest may becontent-description-smime-messageandcontent-description-smime-signature S/MIME is available if`,+smime,'is included infeatures

[v15 behaviour may differ] Note that neither S/MIME signing nor encryption applies tomessage 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 themessage text.

On URL syntax and credential lookup

For accessing protocol-specific resources Uniform Resource Locators(URL, RFC 3986) have become omnipresent.Here they are expected in a``normalized''variant, not used in data exchange, but only meant as a compact,easy-to-use way of defining and representing information in a well-knownnotation; as such they do not conform to any real standard.Optional parts are placed in brackets`[]',optional either because there also exist other ways to define theinformation, or because the part is protocol specific.`/path'for example is used by the [Option]al Maildirfoldertype and the IMAP protocol, but not by POP3.If`USER'and`PASSWORD'are included in an URL server specification, URL percent encoded(RFC 3986) forms are needed, generable withurlcodec

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

OftenSx INTERNAL VARIABLESexist in multiple versions, called``variable chains''in this document: the plain`variable'as well as`variable-HOST'and`variable-USER [at] HOST'If a port was specified`HOST'really means`server:port',not`server'And this`USER'is never in URL percent encoded form.For example, whether the hypothetical`smtp://wings%3Aof@a.dove'including user and password was used, or whether it was`smtp://a.dove'and it came from a different source, to lookup the chaintls-config-pairsfirst`tls-config-pairs-wings:of [at] a.dove'is looked up, then`tls-config-pairs-a.dove',before finally looking up the plain variable.

The logic to collect (anaccount s) credential information is as follows:

  • A user is always required.If no`USER'has been given in the URL the variablesuser-HOSTanduserare looked up.Afterwards, when enforced by the [Option]al variablesnetrc-lookup-HOSTornetrc-lookup Sx The .netrc fileof the user will be searched for a`HOST'specific entry which provides a`login'name: only unambiguous entries are used (one possible matching entry for`HOST') .

    If there is still no`USER'then the verifiedLOGNAME known to be a valid user on the current host, is used.

  • Authentication: unless otherwise noted the chainPROTOCOL-auth-USER [at] HOST , PROTOCOL-auth-HOST , PROTOCOL-authis checked, falling back to a protocol-specific default as necessary.
  • If no`PASSWORD'has been given in the URL, then if the`USER'has been found through the [Option]alnetrc-lookup that may have also provided the password.Otherwise the chainpassword-USER [at] HOST , password-HOST , passwordis looked up.

    Thereafter the (now complete) [Option]al chainnetrc-lookup-USER [at] HOST , netrc-lookup-HOST , netrc-lookupis checked, if set thenetrccache is searched for a password only (multiple user accounts fora single machine may exist as well as a fallback entry without userbut with a password).

    If at that point there is still no password available, but the(protocols') chosen authentication type requires a password, then ininteractive 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 the values ofsmime-sign , smime-sign-cert , smime-sign-include-certsandsmime-sign-digestwill not be looked up using the`USER'and`HOST'chains from above, but instead use the corresponding values from themessage that is being worked on.If no address matches we assume and use the setting offrom In unusual cases multiple and different`USER'and`HOST'combinations may therefore be involved - on the other hand thoseunusual 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 \ from=myname [at] my.host

The sectionSx EXAMPLEScontains complete example configurations.

Encrypted network communication

[Option] SSL (Secure Sockets Layer) aka its successor TLS (Transport LayerSecurity) are protocols which aid in securing communication by providinga safely initiated and encrypted network connection.A central concept of TLS are certificates: as part of each networkconnection setup a (set of) certificates will be exchanged through whichthe identity of the network peer can be cryptographically verified;if possible the TLS/SNI (ServerNameIndication) extension will be enabledto allow servers fine-grained control over the certificates being used.A locally installed pool of trusted certificates will then be inspected,and verification will succeed if it contains a(n in)direct signer of thepresented certificate(s).

The local pool of trusted so-called CA (Certification Authority)certificates is usually delivered with and used along the TLS library.A custom pool of trusted certificates can be selected by pointingtls-ca-fileand/or (with special preparation)tls-ca-dirto the desired location; settingtls-ca-no-defaultsin addition will avoid additional inspection of the default pool.A certificate cannot be more secure than the method its CA certificatehas been retrieved with.For inspection or other purposes, the certificate of a server (as seenwhen connecting to it) can be fetched with the commandtls(port can usually be the protocol name, too, andtls-verifyis taken into account here):

$ s-nail -vX 'tls certchain SERVER-URL[:PORT]; x'

A local pool of CA certificates is not strictly necessary, however,server certificates can also be verified via their fingerprint.For this a message digest will be calculated and compared against thevariable chaintls-fingerprint and verification will succeed if the fingerprint matches.The message digest (algorithm) can be configured via the variable chaintls-fingerprint-digest tlscan again be used:

$ s-nail -X 'wysh set verbose; tls fingerprint SERVER-URL[:PORT]; x'

It depends on the used protocol whether encrypted communication ispossible, and which configuration steps have to be taken to enable it.Some protocols, like POP3S, are implicitly encrypted, others, likePOP3, can upgrade a plain text connection if so requested.For example, to use the`STLS'that POP3 offers (a member of) the variable (chain)pop3-use-starttlsneeds to be set, with convenience viashortcut

shortcut encpop1 pop3s://pop1.exam.pleshortcut encpop2 pop3://pop2.exam.pleset pop3-use-starttls-pop2.exam.pleset mta=smtps://smtp.exam.ple:465set mta=smtp://smtp.exam.ple smtp-use-starttls

Normally that is all there is to do, given that TLS libraries try toprovide safe defaults, plenty of knobs however exist to adjust settings.For example certificate verification settings can be fine-tuned viatls-ca-flags and the TLS configuration basics are accessible viatls-config-pairs for example to control protocol versions or cipher lists.In the past hints on how to restrict the set of protocols to highlysecure ones were indicated, but as of the time of this writing the listof protocols or ciphers may need to become relaxed in order to be ableto connect to some servers; the following example allows connecting to a``Lion''that uses OpenSSL 0.9.8za from June 2014 (refer toSx INTERNAL VARIABLESfor more on variable chains):

wysh set tls-config-pairs-lion [at] exam.ple='MinProtocol=TLSv1.1,\ CipherString=TLSv1.2:!aNULL:!eNULL:\ ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\ DHE-RSA-AES256-SHA:@STRENGTH'

The OpenSSL programciphers(1)should be referred to when creating a custom cipher list.Variables of interest for TLS in general aretls-ca-dir tls-ca-file tls-ca-flags tls-ca-no-defaults tls-config-file tls-config-module tls-config-pairs tls-crl-dir tls-crl-file tls-rand-fileas well astls-verify Also seetls-features TLS is available if`+tls'is included infeatures

Character sets

[Option] The user's locale environment is detected by looking at theLC_ALLenvironment variable.The internal variablettycharsetwill be set to the detected terminal character set accordingly,and will thus show up in the output of commands likesetandvarshow This character set will be targeted when trying to display data,and user input data is expected to be in this character set, too.

When creating messages their character input data is classified.7-bit clean text data and attachments will be classified ascharset-7bit 8-bit data will [Option]ally be converted into members ofsendcharsetsuntil a character set conversion succeeds.charset-8bitis the implied default last member of this list.If no 8-bit character set is capable to represent input data,no message will be sent, and its text will optionally besave dinDEAD If that is not acceptable, for example in script environments,mime-force-sendoutcan be set to force sending of non-convertible data as`application/octet-stream'classified binary content instead: like this receivers still have theoption to inspect message content (for example viamime-counter-evidence ) If the [Option]al character set conversion is not available( featuresmisses`,+iconv,') ,ttycharsetis the only supported character set for non 7-bit clean data, andit is simply assumed it can be used to exchange 8-bit messages.

ttycharsetmay also be given an explicit value to send mail in a completely``faked''locale environment, which can be used to generate and send forexample 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 sectionSx On sending mail, and non-interactive mode ) .Due to lack of programming interfaces reading mail will not really workas expected in a faked environment: whereasttycharsetmight be addressable, any output will be made safely printable, as viavexprmakeprint according to the actual locale environment, which is not affected byttycharset.

Classifying 7-bit clean data ascharset-7bitis a problem if the input character set( ttycharset is a multibyte character set that is itself 7-bit clean.For example, the Japanese character set ISO-2022-JP is, but is capableto encode the rich set of Japanese Kanji, Hiragana and Katakanacharacters: in order to notify receivers of this character set the mailmessage must be MIME encoded so that the character set ISO-2022-JP canbe advertised, otherwise an invalid email message would result!To achieve this, the variablecharset-7bitcan be set to ISO-2022-JP.(Today a better approach regarding email is the usage of UTF-8, whichuses 8-bit bytes for non-US-ASCII data.)

When replying to a message and the variablereply-in-same-charsetis set, the character set of the message being replied to is tried firstas a target character set (still being a subject ofcharsetaliasfiltering, however).Another opportunity issendcharsets-else-ttycharsetto reflect the user's locale environment automatically, it will treatttycharsetas an implied member of (an unset)sendcharsets

[Option] When reading messages, their text data is converted intottycharsetas necessary in order to display them on the user's terminal.Unprintable characters and invalid byte sequences are detectedand replaced by substitution characters.Character set mappings for source character sets can be established withcharsetalias which may be handy to work around faulty or incomplete character setcatalogues (one could for example add a missing LATIN1 to ISO-8859-1mapping), or to enforce treatment of one character set as another one( ``interpret LATIN1 as CP1252'' Also seecharset-unknown-8bitto deal with another hairy aspect of message interpretation.

In general, if a message saying``cannot convert from a to b''appears, either some characters are not appropriate for the currentlyselected (terminal) character set,or the needed conversion is not supported by the system.In the first case, it is necessary to set an appropriateLC_CTYPElocale and/or the variablettycharset The best results are usually achieved when running in a UTF-8locale on a UTF-8 capable terminal, in which case the full Unicodespectrum 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 sendingto 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 morerestricted subset named``portable filename character set''consists of A-Z, a-z, 0-9, period`.',underscore`_'and hyphen-minus`-'

Message states

S-nail differentiates in between several message states; the currentstate will be reflected in the summary ofheadersif theattrlistof the configuredheadlineallows, andSx Specifying messagesdependent on their state is possible.When operating on the systeminbox or in any otherSx primary system mailbox ,special actions, like the automatic moving of messages to theSx secondary mailboxMBOX may be applied when the mailbox is left (also implicitly by programtermination, unless the commandexitwas used) - however, because this may be irritating to users whichare used to``more modern''mail-user-agents, the provided globals-nail.rctemplate sets the internalholdandkeepsavevariables in order to suppress this behaviour.

`new'
Message has neither been viewed nor moved to any other state.Such messages are retained even in theSx primary system mailbox .
`unread'
Message has neither been viewed nor moved to any other state, but themessage was present already when the mailbox has been opened last:Such messages are retained even in theSx primary system mailbox .
`read'
The message has been processed by one of the following commands:~f ~m ~F ~M copy mbox next pipe Print print top Type type undelete The commandsdpanddtwill always try to automatically``step''andtypethe``next''logical message, and may thus mark multiple messages as read, thedeletecommand will do so if the internal variableautoprintis set.

Except when theexitcommand is used, messages that are in aSx primary system mailboxand are in`read'state when the mailbox is left will be saved in theSx secondary mailboxMBOXunless the internal variableholdit set.

`deleted'
The message has been processed by one of the following commands:delete dp dt Onlyundeletecan be used to access such messages.
`preserved'
The message has been processed by apreservecommand and it will be retained in its current location.
`saved'
The message has been processed by one of the following commands:saveorwrite Unless when theexitcommand is used, messages that are in aSx primary system mailboxand are in`saved'state when the mailbox is left will be deleted; they will be saved in theSx secondary mailboxMBOXwhen the internal variablekeepsaveis set.

In addition to these message states, flags which otherwise have notechnical meaning in the mail system except allowing special ways ofaddressing them whenSx Specifying messagescan be set on messages.These flags are saved with messages and are thus persistent, and areportable between a set of widely used MUAs.

answered
Mark messages as having been answered.
draft
Mark messages as being a draft.
flag
Mark messages which need special attention.

Specifying messages

[Only new quoting rules]COMMANDSwhich takeSx Message list arguments ,such assearch type copy anddelete can perform actions on a number of messages at once.Specifying invalid messages, or using illegal syntax, will cause errorsto be reported through theSx INTERNAL VARIABLES! ^ERRand companions, as well as the command exit status?

For example,`delete'1 2deletes the messages 1 and 2,whereas`delete'1-5will delete the messages 1 through 5.In sorted or threaded mode (see thesortcommand),`delete'1-5will delete the messages that are located between (and including)messages 1 through 5 in the sorted/threaded order, as shown in theheaderssummary.

Errors can for example be^ERR -BADMSGwhen requesting an invalid message,^ERR -NOMSGif no applicable message can be found,^ERR -CANCELEDfor missing informational data (mostly thread-related).^ERR -INVALfor invalid syntax as well as^ERR -IOfor input/output errors can happen.The following special message names exist:

.
The current message, the so-called``dot''
;
The message that was previously the current message; needs to be quoted.
,
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.
file ...
The previous undeleted message, or the previous deleted message for theundeletecommand; Insort ed or`thread'Nsed mode, the previous such message in the according order.
file ...
The next undeleted message, or the next deleted message for theundeletecommand; Insort ed or`thread'Nsed mode, the next such message in the according order.
file ...
The first undeleted message,or the first deleted message for theundeletecommand; Insort ed or`thread'Nsed mode, the first such message in the according order.
file ...
The last message; Insort ed or`thread'Nsed mode, the last such message in the according order.Needs to be quoted.
& x
In`thread'Nsedsortmode, selects the message addressed withx wherexis any other message specification,and all messages from the thread that begins at it.Otherwise it is identical tox Ifxis omitted,the thread beginning with the current message is selected.
file ...
All messages.
file ...
All messages that were included in theSx Message list argumentsof the previous command; needs to be quoted.(A convenient way to read all new messages is to select them via`from':n ,as below, and then to read them in order with the default command ---next--- simply by successively typing``';for this to workshowlastmust be set.)
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 ifshownameis set (and POSIX says``any address as shown in a header summary shall be matchable in this form )'' However, if theallnetvariable is set, only the local part of the address is evaluatedfor the comparison, not ignoring case, and the setting ofshownameis completely ignored.For finer control and match boundaries use the`@'search expression.
/ string
All messages that containstringin the subject field (case ignored according to locale).See also thesearchheadersvariable.Ifstringis empty,the string from the previous specification of that type is used again.
[@ name-list @ expr]
All messages that contain the given case-insensitive searchexpr ession; If the [Option]al regular expression support is availableexprwill be interpreted as (an extended) one if any of theSx magic regular expression charactersis seen.If the optional@ name-listpart is missing the search is restricted to the subject field body,but otherwisename-listspecifies a comma-separated list of header fields to search, for example
'@to,from,cc [at] Someone i ought to know'

In order to search for a string that includes a`@'(commercial at) character thename-listis effectively non-optional, but may be given as the empty string.Also, specifying an empty searchexpr ession will effectively test for existence of the given header fields.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.[Option]ally, and just likeexpr name-listwill be interpreted as (an extended) regular expression if any of theSx magic regular expression charactersis seen.

The special names`header'or`<'can be used to search in (all of) the header(s) of the message, and thespecial names`body'or`>'and`text'or`='will perform full text searches - whereas the former searches onlythe body, the latter also searches the message header ([v15 behaviour may differ] this modeyet brute force searches over the entire decoded content of messages,including administrativa strings).

This specification performs full text comparison, but even withregular expression support it is almost impossible to write a searchexpression that safely matches only a specific address domain.To request that the body content of the header is treated as a list ofaddresses, and to strip those down to the plain email address which thesearch expression is to be matched against, prefix the effectivename-listwith a tilde`~':

'@~f,c@@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
answeredmessages (cf. the variablemarkanswered )
d
`deleted'messages (for theundeleteandfromcommands only).
f
flag ged messages.
L
Messages with receivers that matchmlsubscribe d addresses.
l
Messages with receivers that matchmlist 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 (seeSx Handling spam ) .
s
[Option] Messages classified as spam.
t
Messages marked asdraft
u
`unread'messages.

[Option] IMAP-style SEARCH expressions may also be used.These consist of keywords and criterions, and becauseSx Message list argumentsare split into tokens according toSx Shell-style argument quotingit is necessary to quote the entire IMAP search expression in order toensure that it remains a single token.This addressing mode is available with all types of mailboxfolder s; S-nail will perform the search locally as necessary.Strings must be enclosed by double quotation marks`'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 listconstructed 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 forexamples.

( criterion
All messages that satisfy the givencriterion
( criterion1 criterion2 ... criterionN
All messages that satisfy all of the given criteria.
( or criterion1 criterion2
All messages that satisfy eithercriterion1orcriterion2 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 separatecriteria, as with`(a)'(b) (c) .
( not criterion
All messages that do not satisfycriterion
( bcc " string "
All messages that containstringin the envelope representation of the`Bcc:'field.
( cc " string "
All messages that containstringin the envelope representation of the`Cc:'field.
( from " string "
All messages that containstringin the envelope representation of the`From:'field.
( subject " string "
All messages that containstringin the`Subject:'field.
( to " string "
All messages that containstringin the envelope representation of the`To:'field.
( header name " string "
All messages that containstringin the specified`Name:'field.
( body " string "
All messages that containstringin their body.
( text " string "
All messages that containstringin their header or body.
( larger size
All messages that are larger thansize(in bytes).
( smaller size
All messages that are smaller thansize(in bytes).
( before date
All messages that were received beforedate 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, for example`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 independentcriterion then the last of those criteria is used.

On terminal control and line editor

[Option] Terminal control through one of the standardUNIXlibraries,Lb libtermcaporLb libterminfo ,may be available.For theTERM inal defined in the environment interactive usage aspects, for exampleSx Coloured display ,and insight of cursor and function keys for the Mailx-Line-Editor(MLE), will be enhanced or enabled.Library interaction can be disabled on a per-invocation basis viatermcap-disable whereas the internal variabletermcapis always used as a preferred source of terminal capabilities.(For a usage example see theSx FAQentrySx Not "defunctional", but the editor key does not work . )

[Option] The built-in Mailx-Line-Editor (MLE) should work in allenvironments which comply to the ISO C standardSt -isoC-amd1 ,and will support wide glyphs if possible (the necessary functionalityhad been removed from ISO C, but was included inSt -xpg4 ) .Usage of a line editor in interactive mode can be prevented by settingline-editor-disable Especially if the [Option]al terminal control support is missing settingentries intermcapwill help shall the MLE misbehave, see there for more.The MLE can support a little bit ofcolour

[Option] If thehistoryfeature is available then input from line editor prompts will be savedin a history list that can be searched in and be expanded from.Such saving can be prevented by prefixing input with any amount ofwhitespace.Aspects of history, like allowed content and maximum size, as well aswhether history shall be saved persistently, can be configured with theinternal variableshistory-file history-gabby history-gabby-persistandhistory-size There also exists the macro hookon-history-additionwhich can be used to apply finer control on what enters history.

The MLE supports a set of editing and control commands.By default (as) many (as possible) of these will be assigned to a set ofsingle-letter control codes, which should work on any terminal (and canbe generated by holding the``control''key while pressing the key of desire, for example`control-D') .If the [Option]albindcommand is available then the MLE commands can also be accessed freelyby assigning the command name, which is shown in parenthesis in the listbelow, to any desired key-sequence, and the MLE will instead and also usebindto 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 settingline-editor-no-defaults Sx Shell-style argument quotingnotation is used in the following:

`\cA'
Go to the start of the line( mle-go-home
`\cB'
Move the cursor backward one character( mle-go-bwd
`\cC'
raise(3)`SIGINT'( mle-raise-int
`\cD'
Forward delete the character under the cursor;quits S-nail if used on the empty line unless the internal variableignoreeofis 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 thiscommand 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 usualSx Filename transformations( mle-complete this is affected bymle-quote-rndtripandline-editor-cpl-word-breaks )
`\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 commanddt
`\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 lineis committed; also seeshcodec
`\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 (hexadecimal number without prefix, seevexpr to be inserted( mle-prompt-char Note this command needs to be assigned to a single-letter control codein order to become recognized and executed during input ofa key-sequence (only three single-letter control codes can be used forthat shortcut purpose); this control code is then special-treated andthus cannot be part of any other sequence (because it will trigger themle-prompt-charfunction immediately).
`\cW'
Cut the characters from the one preceding the cursor to the precedingword 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
`\cZ'
raise(3)`SIGTSTP'( mle-raise-tstp
`\c['
Escape: reset a possibly used multibyte character input state machineand [Option]ally a lingering, incomplete key binding( mle-cancel This command needs to be assigned to a single-letter control code inorder to become recognized and executed during input of a key-sequence(only three single-letter control codes can be used for that shortcutpurpose).This control code may also be part of a multi-byte sequence, but ifa sequence is active and the very control code is currently also anexpected input, then the active sequence takes precedence and willconsume the control code.
`\c\'
([Option]ally context-dependent) Invokes the command`z'Ns + .
`\c]'
([Option]ally context-dependent) Invokes the command`z'Ns $ .
`\c^'
([Option]ally context-dependent) Invokes the command`z'Ns 0 .
`\c_'
Cut the characters from the one after the cursor to the succeeding wordboundary( mle-snarf-word-fwd
`\c?'
Backspace:mle-del-bwd
-
mle-bell ring the audible bell.
-
[Option]mle-clear-screen move the cursor home and clear the screen.
-
mle-fullreset different tomle-resetthis will immediately reset a possibly active search etc.
-
mle-go-screen-bwd move the cursor backward one screen width.
-
mle-go-screen-fwd move the cursor forward one screen width.
-
mle-raise-quit:raise(3)`SIGQUIT'

Coloured display

[Option] Colours and font attributes through ANSI a.k.a. ISO 6429 SGR(select graphic rendition) escape sequences are optionally supported.Usage of colours and font attributes solely depends upon thecapability of the detected terminal type( TERM and as fine-tuned throughtermcap Colours and font attributes can be managed with the multiplexer commandcolour anduncolourremoves the given mappings.Settingcolour-disablesuppresses usage of colour and font attribute sequences, while leavingestablished mappings unchanged.

Whether actually applicable colour and font attribute sequences shouldalso be generated when output is going to be paged through the externalPAGER(also seecrt ) depends upon the setting ofcolour-pager because pagers usually need to be configured in order to support ISOescape sequences.Knowledge of some widely used pagers is however built-in, and in a cleanenvironment it is often enough to simply setcolour-pager please refer to that variable for more on this topic.

It might make sense to conditionalize colour setup on interactive mode viaif( `terminal'indeed means``interactive )''

if terminal && "$features" =% ,+colour, colour iso view-msginfo ft=bold,fg=green colour iso view-header ft=bold,fg=red (from|subject) # regex colour iso view-header fg=red uncolour iso view-header from,subject colour iso view-header ft=bold,fg=magenta,bg=cyan colour 256 view-header ft=bold,fg=208,bg=230 "subject,from" colour mono view-header ft=bold colour mono view-header ft=bold,ft=reverse subject,fromendif

Handling spam

[Option] S-nail can make use of several spam interfaces for the purpose ofidentification of, and, in general, dealing with spam messages.A precondition of most commands in order to function is that thespam-interfacevariable is set to one of the supported interfaces.Sx Specifying messagesthat have been identified as spam is possible via their (volatile)`is-spam'state by using the`:s'and`:S'specifications, and theirattrlistentries will be used when displaying theheadlinein the summary ofheaders

  • spamraterates the given messages and sets their`is-spam'flag accordingly.If the spam interface offers spam scores these can be shown inheadlineby using the format`%$'
  • spamham spamspamandspamforgetwill interact with the Bayesian filter of the chosen interface and learnthe 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.
  • spamclearandspamsetwill simply set and clear, respectively, the mentioned volatile`is-spam'message flag, without any interface interaction.

Thespamassassin(1)basedspam-interface`spamc'requires a running instance of thespamd(1)server in order to function, started with the option--allow-tellshall 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 likebogofilter(1).Here is an example, requiring it to be accessible viaPATH

$ 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 (orused for Bayesian filter training), it is possibly a good idea toperform the local spam check last.Spam can be checked automatically when opening specific folders bysetting a specialized form of the internal variablefolder-hook

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 variablesspam-interface , spam-maxsize spamc-command , spamc-arguments , spamc-user spamfilter-ham , spamfilter-noham , spamfilter-nospam ,
spamfilter-rateandspamfilter-rate-scanscore

COMMANDS

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 isused as a follow-up line, with all leading whitespace removed;once an entire line is completed, the whitespace charactersspace , tabulator , newlineas well as those defined by the variableifsare removed from the beginning and end.Placing any whitespace characters at the beginning of a line willprevent a possible addition of the command line to the [Option]alhistory

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

This behaviour is different to thesh(1)ell, which is a programming language with syntactic elements of clearlydefined semantics, and therefore capable to sequentially expand andevaluate individual elements of a line.`?'set one=value two=$onefor example will never possibly assign value to one, because thevariable assignment is performed no sooner but by the command( set long after the expansion happened.

A list of all commands in lookup order is dumped by the commandlist [Option]ally the commandhelp(or? ) when given an argument, will show a documentation string for thecommand matching the expanded argument, as in`?t',which should be a shorthand of`?type';with these documentation strings both commands support a moreverboselisting mode which includes the argument type of the command and otherinformation which applies; a handy suggestion might thus be:

? define __xv { # Before v15: need to enable sh(1)ell-style on _entire_ line! localopts yes;wysh set verbose;ignerr eval "${@}";return ${?}}? commandalias xv '\call __xv'? xv help set

Command modifiers

Commands may be prefixed by none to multiple command modifiers.Some command modifiers can be used with a restricted set of commandsonly, theverboseversion oflistwill ([Option]ally) show which modifiers apply.
  • The modifier reverse solidus\ to be placed first, preventscommandaliasexpansions on the remains of the line, for example`\echo'will always evaluate the commandecho even if an (command)alias of the same name exists.commandaliascontent may itself contain further command modifiers, includingan initial reverse solidus to prevent further expansions.
  • The modifierignerrindicates that any error generated by the following command should beignored by the state machine and not cause a program exit with enablederrexitor for the standardized exit cases inposixmode.? one of theSx INTERNAL VARIABLES ,will be set to the real exit status of the command regardless.
  • localwill alter the called command to apply changes only temporarily,local to block-scope, and can thus only be used inside of adefine d macro or anaccountdefinition.Specifying it implies the modifierwysh Local variables will not be inherited by macros deeper in thecallchain, and all local settings will be garbage collected once the localscope is left.To record and unroll changes in the global scope use the commandlocalopts
  • scopedoes yet not implement any functionality.
  • udoes yet not implement any functionality.
  • Some commands support thevputmodifier: if used, they expect the name of a variable, which can itselfbe a variable, i.e., shell expansion is applied, as their firstargument, and will place their computation result in it instead of thedefault location (it is usually written to standard output).

    The given name will be tested for being a validsh(1)variable name, and may therefore only consist of upper- and lowercasecharacters, digits, and the underscore; the hyphen-minus may be used asa non-portable extension; digits may not be used as first, hyphen-minusmay not be used as last characters.In addition the name may either not be one of the knownSx INTERNAL VARIABLES ,or must otherwise refer to a writable (non-boolean) value variable.The actual put operation may fail nonetheless, for example if thevariable expects a number argument only a number will be accepted.Any error during these operations causes the command as such to fail,and the error number!will be set to^ERR -NOTSUP the exit status?should be set to`-1',but some commands deviate from the latter, which is documented.

  • Last, but not least, the modifierwyshcan be used for some old and established commands to choose the newSx Shell-style argument quotingrules over the traditionalSx Old-style argument quoting .This modifier is implied ifv15-compatis set to a non-empty value.

Old-style argument quoting

[v15 behaviour may differ] This section documents the traditional and POSIX standardizedstyle of quoting non-message list arguments to commands which expectthis type of arguments: whereas still used by the majority of suchcommands, the newSx Shell-style argument quotingmay be available even for those viawysh one of theSx Command modifiers .Nonetheless care must be taken, because only new commands have beendesigned with all the capabilities of the new quoting rules in mind,which can, for example generate control characters.
  • An argument can be enclosed between paired double-quotes`argument'orsingle-quotes`'argument'';any whitespace, shell word expansion, or reverse solidus characters(except as described next) within the quotes are treated literally aspart of the argument.A double-quote will be treated literally within single-quotes and viceversa.Inside such a quoted string the actually used quote character can beused nonetheless by escaping it with a reverse solidus`\',as in`y\ou'
  • An argument that is not enclosed in quotes, as above, can usually stillcontain space characters if those spaces are reverse solidus escaped, as in`you\'are .
  • A reverse solidus outside of the enclosing quotes is discardedand the following character is treated literally as part of the argument.

Shell-style argument quoting

sh(1)ell-style, and therefore POSIX standardized, argument parsing andquoting rules are used by most commands.[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 modifierwysh in the future only this type of argument quoting will remain.

A command line is parsed from left to right and an input token iscompleted whenever an unquoted, otherwise ignored, metacharacter is seen.Metacharacters are vertical bar| ampersand& semicolon; as well as all characters from the variableifs and / orspace , tabulator , newline The additional metacharacters left and right parenthesis( , )and less-than and greater-than signs< , that thesh(1)supports are not used, and are treated as ordinary characters: for onethese characters are a vivid part of email addresses, and it seemshighly 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 honourifsto parse their arguments: whereas thesh(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 whatto do with the rest of the line.This also means that whenever an unknown command is seen all that S-nailcan do is cancellation of the processing of the remains of the line.

It also often depends on an actual subcommand of a multiplexer commandhow the rest of the line should be treated, and until v15 we are notcapable to perform this deep inspection of arguments.Nonetheless, at least the following commands which work with positionalparameters fully supportifsfor an almost shell-compatible field splitting:call , call_if , read , vpospar , xcall

Any unquoted number sign`#'at the beginning of a new token starts a comment that extends to the endof the line, and therefore ends argument processing.An unquoted dollar sign`$'will cause variable expansion of the given name, which must be a validsh(1)ell-style variable name (seevput ) Sx INTERNAL VARIABLESas well asSx ENVIRONMENT(shell) variables can be accessed through this mechanism, braceenclosing the name is supported (i.e., to subdivide a token).

Whereas the metacharactersspace , tabulator , newlineonly 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 lineand making the remainder of the line a subject to reevaluation.With sequencing, multiple command argument types and quoting rules maytherefore apply to a single line, which can become problematic beforev15: 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 ofmetacharacters 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 itwith 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 areexpanded as follows:
    `\a'
    bell control character (ASCII and ISO-10646 BEL).
    `\b'
    backspace control character (ASCII and ISO-10646 BS).
    `\E'
    escape control character (ASCII and ISO-10646 ESC).
    `\e'
    the same.
    `\f'
    form feed control character (ASCII and ISO-10646 FF).
    `\n'
    line feed control character (ASCII and ISO-10646 LF).
    `\r'
    carriage return control character (ASCII and ISO-10646 CR).
    `\t'
    horizontal tabulator control character (ASCII and ISO-10646 HT).
    `\v'
    vertical tabulator control character (ASCII and ISO-10646 VT).
    `\\'
    emits a reverse solidus character.
    `\''
    single quote.
    `\'
    double quote (escaping is optional).
    `\NNN'
    eight-bit byte with the octal value`NNN'(one to three octal digits), optionally prefixed by an additional`0'A 0 byte will suppress further output for the quoted argument.
    `\xHH'
    eight-bit byte with the hexadecimal value`HH'(one or two hexadecimal characters, no prefix, seevexpr ) 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 characters) --- note that Unicode defines themaximum codepoint ever to be supported as`0x10FFFF'(in planes of`0xFFFF'characters each).This escape is only supported in locales that support Unicode (seeSx Character sets ) ,in other cases the sequence will remain unexpanded unless the given codepoint is ASCII compatible or (if the [Option]al character set conversion isavailable) can be represented in the current locale.The character NUL will suppress further output for the quoted argument.
    `\uHHHH'
    Identical to`\UHHHHHHHH'except it takes only one to four hexadecimal characters.
    `\cX'
    Emits the non-printable (ASCII and compatible) C0 control codes0 (NUL) to 31 (US), and 127 (DEL).Printable representations of ASCII control codes can be created bymapping them to a different, visible part of the ASCII character set.Adding the number 64 achieves this for the codes 0 to 31, here 7 (BEL):`7'+ 64 = 71 = G .The real operation is a bitwise logical XOR with 64 (bit 7 set, seevexpr ) thus also covering code 127 (DEL), which is mapped to 63 (question mark):`?vexpr^127 64'

    Whereas historically circumflex notation has often been used forvisualization purposes of control codes, as in`^G',the reverse solidus notation has been standardized:`\cG'Some control codes also have standardized (ISO-10646, ISO C) aliases,as shown above( `\a' `\n',`\t'etc) :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 remainsof the token (which may extend beyond the current quote), or, dependingon 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'

Message list arguments

Many commands operate on message list specifications, as documented inSx Specifying messages .The argument input is first split into individual tokens viaSx Shell-style argument quoting ,which are then interpreted as the mentioned specifications.If no explicit message list has been specified, many commands willsearch for and use the next message forward that satisfies the commands'requirements, and if there are no messages forward of the currentmessage, the search proceeds backwards;if there are no good messages at all to be found, an error message isshown and the command is aborted.Theverboseoutput of the commandlistwill indicate whether a command searches for a default message, or not.

Raw data arguments for codec commands

A special set of commands, which all have the string``codec''in their name, likeaddrcodec shcodec urlcodec take raw string data as input, which means that the content of thecommand input line is passed completely unexpanded and otherwiseunchanged: like this the effect of the actual codec is visible withoutany noise of possible shell quoting rules etc., i.e., the user can inputone-to-one the desired or questionable data.To gain a level of expansion, the entire command line can beeval uated first, for example
? vput shcodec res encode /usr/Schönes Wetter/heute.txt? echo $res$'/usr/Sch\u00F6nes Wetter/heute.txt'? shcodec d $res$'/usr/Sch\u00F6nes Wetter/heute.txt'? eval shcodec d $res/usr/Schönes Wetter/heute.txt

Filename transformations

Filenames, where expected, and unless documented otherwise, aresubsequently subject to the following filename transformations, insequence:
  • If the given name is a registeredshortcut it will be replaced with the expanded shortcut.This step is mostly taken forfolder s only.
  • The filename is matched against the following patterns or strings.But for plus+filefolderexpansion this step is mostly taken forfolder s only.
    file ...
    (Number sign) is expanded to the previous file.
    file ...
    (Percent sign) is replaced by the invokinguser's primary system mailbox, which either is the (itself expandable)inboxif that is set, the standardized absolute pathname indicated byMAILif that is set, or a built-in compile-time default otherwise.When opening afolderthe used name is actively checked for being a primary mailbox, firstagainstinbox then againstMAIL
    %user
    Expands to the primary system mailbox ofuser(and never the value ofinbox regardless of its actual setting).
    file ...
    (Ampersand) is replaced with the invoking user'ssecondary mailbox, theMBOX
    +file
    Refers to afilein thefolderdirectory (if that variable is set).
    %:filespec
    Expands to the same value asfilespec but has special meaning when used with, for example, the commandfolder the file will be treated as a primary system mailbox by, among others, themboxandsavecommands, meaning that messages that have been read in the currentsession will be moved to theMBOXmailbox instead of simply being flagged as read.
  • Meta expansions may be applied to the resulting filename, as allowed bythe operation and applicable to the resulting access protocol (also seeSx On URL syntax and credential lookup ) .For the file-protocol, a leading tilde`~'character will be replaced by the expansion ofHOME except when followed by a valid user name, in which case the homedirectory of the given user is used instead.

    A shell expansion as if specified in double-quotes (seeSx Shell-style argument quoting )may be applied, so that any occurrence of`$VARIABLE'(or`${VARIABLE}')will be replaced by the expansion of the variable, if possible;Sx INTERNAL VARIABLESas well asSx ENVIRONMENT(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 thecommand 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, so a file`diet\'is \curd.txtmay be displayed as`'diet\'is \curd.txt' .

Commands

The following commands are available:
!
Executes theSHELLcommand which follows, replacing unescaped exclamation marks with thepreviously executed command if the internal variablebangis set.This command supportsvputas documented inSx Command modifiers ,and manages the error number! A 0 or positive exit status?reflects the exit status of the command, negative ones thatan error happened before the command was executed, or that the programdid not exit cleanly, but maybe due to a signal: the error number is^ERR -CHILD then.

In conjunction with thevputmodifier the following special cases exist:a negative exit status occurs if the collected data could not be storedin the given variable, which is a^ERR -NOTSUPerror that should otherwise not occur.^ERR -CANCELEDindicates that no temporary file could be created to collect the commandoutput at first glance.In case of catchable out-of-memory situations^ERR -NOMEMwill occur and S-nail will try to store the empty string, just like withall 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 itsarguments, not a``comment-start''indicating special character, which means that for example trailingcomments on a line are not possible (except for commands which useSx Shell-style argument quoting ) .
+
Goes to the next message in sequence and types it(like``ENTER )''
-
Display the preceding message, or the n'th previous message if givena numeric argument n.
=
Shows the message number of the current message (the``dot'' when used without arguments, that of the given list otherwise.Output numbers will be separated from each other with the firstcharacter ofifs and followed by the first character ofif-ws if that is not empty and not identical to the first.If that results in no separation at all aspacecharacter is used.This command supportsvput(seeSx Command modifiers ) ,and manages the error number!
?
[Option] Show a brief summary of commands.[Option] Given an argument a synopsis for the command in question isshown instead; commands can be abbreviated in general and this commandcan be used to see the full expansion of an abbreviation including thesynopsis, try, for example`?h',`?hel'and`?help'and see how the output changes.To avoid that aliases are resolved the modifier\can be prepended to the argument, but note it must be quoted.This mode also supports a moreverboseoutput, which will provide the information documented forlist
|
A synonym for thepipecommand.
account , unaccount
(ac, una) Creates, selects or lists (an) account(s).Accounts are special incarnations ofdefine dmacros and group commands and variable settings which together usuallyarrange the environment for the purpose of creating an email account.Different to normal macros settings which are covered bylocalopts- here by default enabled! - will not be reverted before theaccountis changed again.The special account`null'(case-insensitive) always exists, and all but it can be deleted by thelatter command, and in one operation with the special name`*'Also for all but it a possibly seton-account-cleanuphook is called once they are left, also for program exit.

Without arguments a listing of all defined accounts is shown.With one argument the given account is activated: the systeminboxof that account will be activated (as viafolder ) a possibly installedfolder-hookwill be run, and the internal variableaccountwill be updated.The two argument form behaves identical to defining a macro as viadefine Important settings for accounts includefolder , from , hostname , inbox , mta , passwordanduser( Sx On URL syntax and credential lookup ) as well as things liketls-config-pairs( Sx Encrypted network communication ) and protocol specifics likeimap-auth , pop3-auth , smtp-auth

account myisp { set folder=~/mail inbox=+syste.mbox record=+sent.mbox set from='(My Name) myname [at] myisp.example' set mta=smtp://mylogin@smtp.myisp.example}
addrcodec
Perform email address codec transformations on raw-data argument, ratheraccording to email standards (RFC 5322; [v15 behaviour may differ] will furtherly improve).Supportsvput(seeSx Command modifiers ) ,and manages the error number! The first argument must be either[+[+[+]]]e[ncode] d[ecode] s[kin]orskinl[ist]and specifies the operation to perform on the rest of the line.

Decoding will show how a standard-compliant MUA will display the givenargument, which should be an email address.Please be aware that most MUAs have difficulties with the addressstandards, 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!set to^ERR -INVALif decoding fails to find a(n) (valid) email address, in which case theunmodified input will be output again.

skinlistfirst performs a skin operation, and thereafter checks a validaddress for whether it is a registered mailing list (seemlistandmlsubscribe ) eventually reporting that state in the error number!as^ERR -EXIST (This state could later become overwritten by an I/O error, though.)

Encoding supports four different modes, lesser automated versions can bechosen by prefixing one, two or three plus signs: the standard imposesa special meaning on some characters, which thus have to be transformedto so-called quoted-pairs by pairing them with a reverse solidus`\'in order to remove the special meaning; this might change interpretationof 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 threefor 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] the current parser fails this assertion for some constructs).[v15 behaviour may differ] Addresses need to be specified in between angle brackets`<',`>'if the construct becomes more difficult, otherwise the current parserwill fail; it is not smart enough to guess right.

? addrc enc "Hey, you",<diet [at] exam.ple>\ out\ there"\"Hey, you\", \\ out\\ there" <diet [at] exam.ple>? addrc d "\"Hey, you\", \\ out\\ there" <diet [at] exam.ple>"Hey, you", \ out\ there <diet [at] exam.ple>? addrc s "\"Hey, you\", \\ out\\ there" <diet [at] exam.ple>diet [at] exam.ple
alias , unalias
[Only new quoting rules](a, una) Define or list, and remove, respectively, address aliases,which are a method of creating personal distribution lists that mapa single name to none to multiple receivers, to be expanded afterSx Compose modeis left; the expansion correlates withmetoo The latter command removes all given aliases, the special name asterisk`*'will remove all existing aliases.When used without arguments the former shows a list of all currentlyknown aliases, with one argument only the target(s) of the given one.When given two arguments, hyphen-minus`-'being the first, the target(s) of the second is/are expanded recursively.

In all other cases the given alias is newly defined, or will be appendedto: arguments must either be themselves valid alias names, or anyother address type (seeSx On sending mail, and non-interactive mode ) .Recursive expansion of aliases can be prevented by prefixing the desiredargument with the modifier reverse solidus\ A valid alias name conforms tomta-aliasessyntax, but follow-up characters can also be the number sign`#',colon`:',commercial at`@,'exclamation mark`!',period`.'as well as``any character that has the high bit set'' The dollar sign`$'may be the last character.The number sign`#'may needSx Shell-style argument quoting .

[v15 behaviour may differ] Unfortunately the colon is currently not supported, as itinterferes with normal address parsing rules.[v15 behaviour may differ] Such high bit characters will likely cause warnings at the momentfor the same reasons why colon is unsupported; also, in the futurelocale dependent character set validity checks will be performed.

? alias cohorts bill jkf mark kridle [at] ucbcory ~/cohorts.mbox? alias mark mark [at] exam.ple? set mta-aliases=/etc/aliases
alternates , unalternates
[Only new quoting rules] (alt) Manage a list of alternate addresses or names of the activeuser, members of which will be removed from recipient lists (except one).There is a set of implicit alternates which is formed of the values ofLOGNAME from senderandreply-to fromwill not be used ifsenderis set.The latter command removes the given list of alternates, the special name`*'will discard all existing alternate names.

The former command manages the error number! It shows the current set of alternates when used without arguments; inthis mode only it also supportsvput(seeSx Command modifiers ) .Otherwise the given arguments (after being checked for validity) areappended to the list of alternate names; inposixmode they replace that list instead.

answered , unanswered
Take a message lists and mark each message as (not) having been answered.Messages will be marked answered when beingreply dto automatically if themarkansweredvariable is set.See the sectionSx Message states .
bind , unbind
[Option][Only new quoting rules] The bind command extends the MLE (seeSx On terminal control and line editor )with freely configurable key bindings.The latter command removes from the given context the given key binding,both of which may be specified as a wildcard`*',so that`unbind'* *will remove all bindings of all contexts.Due to initialization order unbinding will not work for built-in keybindings upon program startup, however: please useline-editor-no-defaultsfor this purpose instead.

With zero arguments, or with a context name the former command showsall key bindings (of the given context; an asterisk`*'will iterate over all contexts); a more verbose listing will beproduced if either ofdebugorverboseare set.With two or more arguments a specific binding is shown, or(re)established: the first argument is the context to which the bindingshall apply, the second argument is a comma-separated list of the``keys''which form the binding.Further arguments will be joined to form the expansion, and cause thebinding to be created or updated.To indicate that a binding shall not be auto-committed, but that theexpansion shall instead be furtherly editable by the user, a commercial at`@'(that will be removed) can be placed last in the expansion, from whichleading and trailing whitespace will finally be removed.Reverse solidus cannot be used as the last character of expansion.An empty expansion will be rejected.

Contexts define when a binding applies, i.e., a binding will not be seenunless 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 alwaysapplies, 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 only toSx Compose mode .

Bindings are specified as a comma-separated list of byte-sequences,where each list entry corresponds to one``key''(press).Byte sequence boundaries will be forcefully terminated afterbind-inter-byte-timeoutmilliseconds, whereas key sequences can be timed out viabind-inter-key-timeout A list entry may, indicated by a leading colon character`:',also refer to the name of a terminal capability; several dozen namesare compiled in and may be specified either by theirterminfo(5),or, if existing, by theirtermcap(5)name, regardless of the actually used [Option]al terminal control library.But any capability may be used, as long as the name is resolvable by the[Option]al control library, or was defined via the internal variabletermcap Input sequences are not case-normalized, an exact match is required toupdate or remove a binding.It is advisable to use an initial escape or other control character (like`\cA')for user (as opposed to purely terminal capability based) bindings inorder to avoid ambiguities; it also reduces search time.Examples:

? bind base a,b echo one? 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 Editable binding@'? bind default a,b,c rm -irf / @ # Also editable? bind default :kf1 File %? bind compose :kf1 ~v

Note that the entire comma-separated list is first parsed (over) as ashell-token with whitespace as the field separator, then parsed andexpanded for real with comma as the field separator, thereforewhitespace needs to be properly quoted, seeSx Shell-style argument quoting .Using Unicode reverse solidus escape sequences renders a bindingdefunctional if the locale does not support Unicode (seeSx Character sets ) ,and using terminal capabilities does so if no (corresponding) terminalcontrol support is (currently) available.Adding, deleting or modifying a key binding invalidates the internalprebuilt lookup tree, it will be recreated as necessary: this processwill be visualized in mostverboseas well as indebugmode.

The following terminal capability names are built-in and can be used interminfo(5)or (if available) the two-lettertermcap(5)notation.See the respective manual for a list of capabilities.The programinfocmp(1)can be used to show all the capabilities ofTERMor the given terminal type;using the-xflag 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 tokf9andk9 respectively.
kf10 or k;
Function key 10.
kf11 or F1
Function key 11.Add one for each function key up tokf19andF9 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 tokDC 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

call
[Only new quoting rules] Calls the given macro, which must have been created viadefine(see there for more), otherwise an^ERR -NOENTerror occurs.Calling macros recursively will at some time excess the stack sizelimit, causing a hard program abortion; if recursively calling a macrois the last command of the current macro, consider to use the commandxcall which will first release all resources of the current macro beforereplacing the current macro with the called one.
call_if
Identical tocallif the given macro has been created viadefine but does not fail nor warn if the macro does not exist.
cd
Synonym forchdir
certsave
[Option] Only applicable to S/MIME signed messages.Takes an optional message list and a filename and saves the certificatescontained within the message signatures to the named file in bothhuman-readable and PEM format.The certificates can later be used to send encrypted messages to therespective message senders by settingsmime-encrypt-USER [at] HOSTvariables.
charsetalias , uncharsetalias
[Only new quoting rules] Manage alias mappings for (conversion of)Sx Character sets .Alias processing is not performed forSx INTERNAL VARIABLES ,for examplecharset-8bit and mappings are ineffective if character set conversion is not available( featuresdoes not announce`,+iconv,') .Expansion happens recursively for cases where aliases point to otheraliases (built-in loop limit: 8).

The latter command deletes all aliases given as arguments,or all at once when given the asterisk`*'The former shows the list of all currently defined aliases if usedwithout arguments, or the target of the given single argument;when given two arguments, hyphen-minus`-'being the first, the second is instead expanded recursively.In all other cases the given arguments are treated as pairs of charactersets and their desired target alias name, creating new or updatingalready existing aliases.

chdir
[Only new quoting rules](ch) Change the working directory toHOMEor the given argument.Synonym forcd
collapse , uncollapse
Only applicable to`thread'Nsedsortmode.Takes a message list and makes all replies to these messages invisiblein 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 aSx Coloured display .Without arguments the former shows all currently defined mappings.Otherwise a colour type is expected (case-insensitively),it must be one of`256'for 256-colour terminals,`8',`ansi'or`iso'for the standard 8-colour ANSI / ISO 6429 colour palette, and`1'or`mono'for monochrome terminals, which only support (some) font attributes.Without further arguments the list of all currently defined mappingsof the given type is shown (here the special`all'or`*'also show all currently defined mappings).

Otherwise the second argument defines the mappable slot, the thirdargument a (comma-separated list of) colour and font attributespecification(s), and the optionally supported fourth argument can beused to specify a precondition: if conditioned mappings exist they aretested in (creation) order unless a (case-insensitive) match has beenfound, and the default mapping (if any has been established) will onlybe chosen as a last resort.The types of available preconditions depend on the mappable slot,the following of which exist:

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

mle-position
This mapping is used for the position indicator that is visible whena line cannot be fully displayed on the screen.
mle-prompt
Used for theprompt
mle-error
Used for the occasionally appearing error indicator that is joined ontoprompt [v15 behaviour may differ] Also used for error messages written on standard error .

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 withdatefield-markout-older )

sum-dotmark
This mapping is used for the``dotmark''that can be created with the`%>'or`%<'formats of the variableheadline
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 variableheadline

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 (also seembox-rfc4155 )
view-header
For header lines.A comma-separated list of headers to which the mapping applies may begiven as a precondition; if the [Option]al regular expression support isavailable then if any of theSx magic regular expression charactersis 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 attributesare understood, multiple of which can be specified in a comma-separatedlist:

ft=
a font attribute:`bold',`reverse'or`underline'It is possible (and often applicable) to specify multiple fontattributes for a single mapping.
fg=
foreground colour attribute, in order (numbers 0 - 7)`black',`red',`green',`brown',`blue',`magenta',`cyan'or`white'To specify a 256-colour mode a decimal number colour specification inthe range 0 to 255, inclusive, is supported, and interpreted as follows:
0 - 7
the standard ISO 6429 colours, as above.
8 - 15
high intensity variants of the standard colours.
16 - 231
216 colours 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=0while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); doneprintf "\033[0m\n"i=0while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); doneprintf "\033[0m\n"
bg=
background colour attribute (seefg=for possible values).

The commanduncolourwill remove for the given colour type (the special type`*'selects all) the given mapping; if the optional precondition argument isgiven 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 commandalias are joined onto the alias expansion, and the resulting stringforms the command line that is, in effect, executed.The latter command removes all given aliases, the special name asterisk`*'will remove all existing aliases.When used without arguments the former shows a list of all currentlyknown aliases, with one argument only the expansion of the given one.

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

? commandalias xxs-nail: `commandalias': no such alias: xx? commandalias xx echo hello,? commandalias xxcommandalias xx 'echo hello,'? xxhello,? xx worldhello, world
Copy
(C) Similar tocopy but copy the messages to a file named after the local part of thesender of the first message instead of taking a filename argument;outfolderis inspected to decide on the actual storage location.
copy
(c) Copy messages to the named file and do not mark them as being saved;otherwise identical tosave
csop
[Only new quoting rules] A multiplexer command which provides C-style string operations on8-bit bytes without a notion of locale settings and character sets,effectively assuming ASCII data.For numeric and other operations refer tovexpr vput one of theSx Command modifiers ,is supported.The error result is`-1'for usage errors and numeric results, the empty string otherwise;missing data errors, as for unsuccessful searches, result in the!error number being set to^ERR -NODATA Where the question mark`?'modifier suffix is supported, a case-insensitive (ASCII mapping)operation mode is supported; the keyword`case'is optional so that`find?'and`find?case'are identical.
length
Queries the length of the given argument.
hash , hash32
Calculates a hash value of the given argument.The latter will return a 32-bit result regardless of host environment.`?'modifier suffix is supported.These use Chris Torek's hash algorithm, the resulting hash value isbit mixed as shown by Bret Mulvey.
find
Search for the second in the first argument.Shows the resulting 0-based offset shall it have been found.`?'modifier suffix is supported.
substring
Creates a substring of its first argument.The optional second argument is the 0-based starting offset,a negative one counts from the end;the optional third argument specifies the length of the desired result,a negative length leaves off the given number of bytes at the end of theoriginal string; by default the entire string is used.This operation tries to work around faulty arguments (setverbosefor error logs), but reports them via the error number!as^ERR -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.
cwd
Show the name of the current working directory, as reported bygetcwd(3).Supportsvput(seeSx Command modifiers ) .The return status is tracked via?
Decrypt
[Option] For unencrypted messages this command is identical toCopy Encrypted messages are first decrypted, if possible, and then copied.
decrypt
[Option] For unencrypted messages this command is identical tocopy Encrypted messages are first decrypted, if possible, and then copied.
define , undefine
The latter command deletes the given macro, the special name`*'will discard all existing macros.Deletion of (a) macro(s) can be performed from within running (a)macro(s), including self-deletion.Without arguments the former command prints the current list of macros,including their content, otherwise it defines a macro, replacing anexisting one of the same name as applicable.

A defined macro can be invoked explicitly by using thecall call_ifandxcallcommands, or implicitly if a macro hook is triggered, for example afolder-hook Execution of a macro body can be stopped from within by callingreturn

Temporary macro block-scope variables can be created or deleted with thelocalcommand modifier in conjunction with the commandssetandunset respectively.To enforce unrolling of changes made to (global)Sx INTERNAL VARIABLESthe commandlocaloptscan be used instead; its covered scope depends on how (i.e.,``as what'' normal macro, folder hook, hook,accountswitch) the macro is invoked.

Inside acall ed macro, the given positional parameters are implicitly localto the macro's scope, and may be accessed via the variables* @ #and1and any other positive unsigned decimal number less than or equal to# Positional parameters can beshift ed, or become completely replaced, removed etc. viavpospar A helpful command for numeric computation and string evaluations isvexpr csopoffers C-style byte string operations.

define name { command1 command2 ... commandN}define exmac { echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@} return 1000 0}call exmac Hello macro exmac!echo ${?}/${!}/${^ERRNAME}
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 searchfor a visible message is performed, as documented forSx Message list arguments ,showing only the next input prompt if the search fails.Deleted messages will neither be saved in theSx secondary mailboxMBOXnor will they be available for most other commands.If theautoprintvariable is set, the new``dot''or the last message restored, respectively, is automaticallytype d; also seedp dt
digmsg
[Only new quoting rules] Digging (information out of) messages is possible throughdigmsgobjects, which can becreate d for the given message number; inSx Compose modethe hyphen-minus`-'will instead open the message that is being composed.If a hyphen-minus is given as the optional third argument then outputwill be generated on the standard output channel instead of beingsubject to consumption by thereadall(orreadandreadsh command(s).Note: output must be consumed before normal processing can continue; fordigmsgobjects this means each command output has to be read until the end offile (EOF) state occurs.

The objects may beremove d again by giving the same identifier used for creation;this step could be omitted: objects will be automatically closedwhen the activefolder(mailbox) or the compose mode is left, respectively.In all other use cases the second argument is an object identifier,and the third and all following arguments are interpreted as via~^(seeSx COMMAND ESCAPES ) :

? vput = msgno; digmsg create $msgno? digmsg $msgno header list; readall x; echon $x210 Subject From To Message-ID References In-Reply-To? digmsg $msgno header show Subject;readall x;echon $x212 Subject'Hello, world'? digmsg remove $msgno
discard
(di) Identical toignore Superseded by the multiplexerheaderpick
dp , dt
Delete the given messages and automaticallytypethe new``dot''if one exists, regardless of the setting ofautoprint
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 notbeing draft, respectively, as documented in the sectionSx Message states .
echo
[Only new quoting rules](ec) Print the given strings, equivalent to the shell utilityecho(1),that is,Sx Shell-style argument quotingexpansion is performed and, different to the otherwise identicalechon a trailing newline is echoed.vputas documented inSx Command modifiersis supported, and the error number!is managed: if data is stored in a variable then the return valuereflects the length of the result string in case of success and is`-1'on error.

Remarks:this command traditionally (in BSD Mail) also performedSx Filename transformations ,which is standard incompatible and hard to handle because quotingtransformation patterns is not possible; the subcommandfile-expandofvexprcan be used to expand filenames.

echo*rr
[Only new quoting rules] Identical toecho but the message is written to standard error, and prefixed bylog-prefix Also seeecho*rrn In interactive sessions the [Option]al message ring queue forerrorswill be used instead, if available andvputwas not used.
echon
[Only new quoting rules] Identical toecho but does not write or store a trailing newline.
echo*rrn
[Only new quoting rules] Identical toecho*rr but does not write or store a trailing newline.
edit
(e) Point the textEDITORat each message from the given list in turn.Modified contents are discarded unless thewritebackeditedvariable is set, and are not used unless the mailbox can be written toand the editor returns a successful exit status.visualcan be used instead for a more display oriented editor.
elif
Part of theif(see there for more),elif , else , endifconditional --- if the condition of a precedingifwas false, check the following condition and execute the following blockif it evaluates true.
else
(el) Part of theif(see there for more),elif , else , endifconditional --- if none of the conditions of the precedingifandelifcommands was true, theelseblock is executed.
endif
(en) Marks the end of anif(see there for more),elif , else , endifconditional execution block.
environ
[Only new quoting rules] There is a strict separation in betweenSx INTERNAL VARIABLESand the programSx ENVIRONMENT ,which is inherited by child processes.Some variables of the latter are however vivid for program operation,their purpose is known, therefore they have been integratedtransparently into handling of the former, as accessible viasetandunset To integrate any other environment variable, and/or to export internalvariables into the process environment where they normally are not, alinkneeds to become established with this command, for example
environ link PERL5LIB TZ

Afterwards changing such variables withsetwill cause automatic updates of the environment, too.Sufficient system support provided (it was in BSD as early as 1987, andis standardized since Y2K) removing such variables withunsetwill remove them also from the environment, but in any way the knowledgethey ever have beenlink ed will be lost.This implies thatlocaloptsmay cause loss of such links.

The subcommandunlinkremoves an existing link without otherwise touching variables, thesetandunsetsubcommands are identical tosetandunset but additionally update the program environment accordingly; removinga variable breaks any freely establishedlink

errors
[Option] As console user interfaces at times scroll error messages by toofast and/or out of scope, data can additionally be sent to an error queuemanageable by this command:showor no argument will display and clear the queue,clearwill only clear it.As the queue becomes filled witherrors-limitentries the eldest entries are being dropped.There are also the variables^ERRQUEUE-COUNTand^ERRQUEUE-EXISTS
eval
[Only new quoting rules] Construct a command by concatenating the arguments, separated witha single space character, and then evaluate the result.This command passes through the exit status?and error number!of the evaluated command; also seecall
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 skipany saving of messages in theSx secondary mailboxMBOX as well as a possibly tracked line editorhistory-file A possibly seton-account-cleanupwill be invoked, however.The optional status number argument will be passed through toexit(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 anotherwise success indicating status.
File
(Fi) Likefolder but open the mailbox read-only.
file
(fi) Seefolder
filetype , unfiletype
[Only new quoting rules] Define, list, and remove, respectively, file handler hooks,which provide (shell) commands that enable S-nail to load and save MBOXfiles from and to files with the registered file extensions, as shownand described forfolder The extensions are used case-insensitively, yet the auto-completionfeature of for examplefolderwill only work case-sensitively.An intermediate temporary file will be used to store the expanded data.The latter command will remove hooks for all given extensions, asterisk`*'will remove all existing handlers.

When used without arguments the former shows a list of all currentlydefined file hooks, with one argument the expansion of the given alias.Otherwise three arguments are expected, the first specifying the fileextension for which the hook is meant, and the second and third definingthe load- and save commands to deal with the file type, respectively,both of which must read from standard input and write to standardoutput.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 twicewhere once would be sufficient: this can cause problems if a filetype ischanged while such a file is opened; this was already so with thebuilt-in support of .gz etc. in Heirloom, and will vanish in v15.[v15 behaviour may differ] For now all handler strings are passed to theSHELL 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 beingflagged, respectively, for urgent/special attention.See the sectionSx Message states .
Folder
(Fold) Likefolder but open the mailbox read-only.
folder
(fold) Open a new, or show status information of the current mailbox.If an argument is given, changes (such as deletions) will be writtenout, a new mailbox will be opened, the internal variablesmailbox-resolvedandmailbox-displaywill be updated, a set accordingfolder-hookis executed, and optionally a summary ofheadersis displayed if the variableheaderis set.

Sx Filename transformationswill be applied to thenameargument, and`protocol://'prefixes are, i.e., URL (seeSx On URL syntax and credential lookup )syntax is understood, as in`mbox:///tmp/somefolder'If a protocol prefix is used the mailbox type is fixated, otherwiseopening none-existingfoldersuses the protocol defined innewfolders

For the protocolsmboxandfile(MBOX database), as well aseml(electronic mail message [v15 behaviour may differ] read-only) the list of all registeredfiletype s is traversed to check whether hooks shall be used to load (and save)data from (and to) the givenname Changing hooks will not affect already opened mailboxes.For example, the following creates hooks for thegzip(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'

For historic reasonsfiletype s provide limited (case-sensitive) auto-completion capabilities.For example`mbox.gz'will be found for`?'file mbox ,provided that corresponding handlers are installed.It will neither find`mbox.GZ'nor`mbox.Gz however,'but an explicit`?'file mbox.GZwill find and use the handler for`gz'[v15 behaviour may differ] The latter mode can only be used for MBOX files.

EML files consist of only one mail message,[v15 behaviour may differ] and can only be opened read-only.When reading MBOX files tolerant POSIX rules are used by default.Invalid message boundaries that can be found quite often in historicMBOX files will be complained about (even more withdebug ) in this case the method described formbox-rfc4155can be used to create a valid MBOX database from the invalid input.

MBOX databases and EML files will always be protected via file-region locks( fcntl(2) during file operations to protect against concurrent modifications.[Option] An MBOXinbox( MAIL orSx primary system mailboxwill also be protected by so-called dotlock files,the traditional way of mail spool file locking: for any file`x'a lock file`x.lock'will be created during the synchronization, in the same directory andwith the same user and group identities as the file of interest ---as necessary created by an external privileged dotlock helper.dotlock-disabledisables dotlock files.Also seeSx FAQ :Sx Howto handle stale dotlock files .

[Option] If no protocol has been fixated, andnamerefers 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 beendesigned so that file locking is not necessary when reading or writingfiles.

[Option]ally URLs can be used to access network resources, securely viaSx Encrypted network communication ,if so supported.Network communication socket timeouts are configurable viasocket-connect-timeout All network traffic may be proxied over a SOCKS server viasocks-proxy

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

[Option]ally supported network protocols arepop3(POP3) andpop3s(POP3 with TLS encrypted transport),imapandimaps The[/path]part is valid only for IMAP; there it defaults toINBOX Network URLs require a special encoding as documented in the sectionSx On URL syntax and credential lookup .

folders
Lists the names of all folders below the given argument orfolder For file-based protocolsLISTERwill be used for display purposes.
Followup , followup
(Compose mode)(F,fo) Similar toReply andreply respectively, but save the message in a file named after the local partof the (first) recipient's address, possibly overwritingrecord and honouringoutfolder Also seeCopyandSave
Forward
(Compose mode) Similar toforward but saves the message in a file named after the local part of therecipient's address (instead of inrecord ).
forward
(Compose mode) Take a message list and the address of a recipient, subject tofullnames to whom the messages are sent.The text of the original message is included in the new one,enclosed by the values offorward-inject-headandforward-inject-tail content-description-forwarded-messageis inspected.The list of included headers can be filtered with the`forward'slot of the white- and blacklisting commandheaderpick Only the first part of a multipart message is included but forforward-as-attachment

This may generate the errors^ERR -DESTADDRREQif no receiver has been specified, or was rejected byexpandaddrpolicy,^ERR -IOif an I/O error occurs,^ERR -NOTSUPif a necessary character set conversion fails, and^ERR -INVALfor other errors.It can also fail with errors ofSx Specifying messages .Any error stops processing of further messages.

from
(f) Takes a list of message specifications and displays a summary oftheir message headers, exactly as viaheaders making the first message of the result the new``dot''(the last message ifshowlastis set).An alias of this command issearch Also seeSx Specifying messages .
Fwd
[Obsolete] Alias forForward
fwd
[Obsolete] Alias forforward
fwdignore
[Obsolete] Superseded by the multiplexerheaderpick
fwdretain
[Obsolete] Superseded by the multiplexerheaderpick
ghost , unghost
[Obsolete] Replaced bycommandalias uncommandalias
headerpick , unheaderpick
[Only new quoting rules] Multiplexer command to manage white- and blacklistingselections 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 thecommand applies, one of (case-insensitive)`type'for display purposes (for exampletype ) `save'for selecting which headers shall be stored persistently whensave copy moveor evendecrypt ing messages (note that MIME related etc. header fields should not beignored in order to not destroy usability of the message in this case),`forward'for stripping down messages whenforward ing message (has no effect ifforward-as-attachmentis set), and`top'for defining user-defined set of fields for the commandtop

The current settings of the given context are displayed if it is theonly 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 correspondingblacklist.

If no further argument is given the current settings of the given typewill be displayed, otherwise the remaining arguments specify headerfields, which [Option]ally may be given as regular expressions, to be addedto 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 usedto remove selections, i.e., from the given context, the given type oflist, 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 onthe variablescreenin interactive mode, and the format of which can be defined withheadline If a message-specification is given the group of headers containing thefirst message therein is shown and the message at the top of the screenbecomes the new``dot'' the last message is targeted ifshowlastis set.
help
(hel) A synonym for?
history
[Option] Without arguments or when givenshowall history entries are shown (this mode also supports a moreverboseoutput).loadwill replace the list of entries with the content ofhistory-file andsavewill dump all entries to said file, replacing former content, andclearwill delete all entries.The argument can also be a signed decimalNUMBER which will select and evaluate the respective history entry, and move itto the top of the history; a negative number is used as an offset to thecurrent command so that`-1'will select the last command, the history top, whereasdeletewill delete all given entries( :NUMBER: Also seeSx On terminal control and line editor .
hold
(ho, alsopreserve Takes a message list and marks each message therein to be saved in theuser's systeminboxinstead of in theSx secondary mailboxMBOX Does not override thedeletecommand.S-nail deviates from the POSIX standard with this command, because anextcommand issued afterholdwill display the following message, not the current one.
if
(i) Part of theif , elif , else , endifconditional execution construct --- if the given condition is true thenthe encapsulated block is executed.The POSIX standard only supports the (case-insensitive) conditions`r'Nseceiveand`s'Nsend, the remaining are non-portable extensions.[v15 behaviour may differ] In conjunction with thewyshcommand prefix(es)Sx Shell-style argument quotingand more test operators are available.
if receive commands ...else commands ...endif

Further (case-insensitive) one-argument conditions are`t'Nserminal which evaluates to true in interactive terminal sessions(running with standard input or standard output attached to a terminal,and none of the``quickrun''command line options-e -Hand-Lhave been used), as well as any boolean value (seeSx INTERNAL VARIABLESfor textual boolean representations) to mark an enwrapped block as``never execute''or``always execute'' (Remarks: condition syntax errors skip all branches untilendif .

[no v15-compat] and withoutwysh It is possible to checkSx INTERNAL VARIABLESas well asSx ENVIRONMENTvariables for existence or compare their expansion against a user givenvalue or another variable by using the`$'( ``variable next'' conditional trigger character;a variable on the right hand side may be signalled using the samemechanism.Variable names may be enclosed in a pair of matching braces.When this mode has been triggered, several operators are available([v15-compat] andwysh they are always available, and there is no trigger: variables will havebeen expanded by the shell-compatible parser before theifetc. command sees them).

[v15-compat] Two argument conditions.Variables can be tested for existence and expansion:`-N'will test whether the given variable exists, so that`-N'editalongwill evaluate to true wheneditalongis set, whereas`-Z'editalongwill if it is not.`-n'$editalongwill be true if the variable is set and expands to a non-empty string,`-z'$'\$editalong'only if the expansion is empty, whether the variable exists or not.The remaining conditions take three arguments.

Integer operators treat the arguments on the left and right hand side ofthe operator as integral numbers and compare them arithmetically.It is an error if any of the operands is not a valid integer, an emptyargument (which implies it had been quoted) is treated as if it were 0.Via the question mark`?'modifier suffix a saturated operation mode is available where numberswill linger at the minimum or maximum possible value, instead ofoverflowing (or trapping), the keyword`saturated'is optional,`==?',`==?satu'and`==?saturated'are therefore identical.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 and regular expression data operators compare the left and righthand side according to their textual content.Unset variables are treated as the empty string.Via the question mark`?'modifier suffix a case-insensitive operation mode is available, the keyword`case'is optional,`==?'and`==?case'are identical.

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 takeinto account character set specifics.If the case-insensitivity modifier has been used, case is ignoredaccording to the rules of the US-ASCII encoding, i.e., bytes arestill compared.

When the [Option]al regular expression support is available, the additionalstring operators`=~'and`!~'can be used.They treat the right hand side as an extended regular expression that ismatched according to the active locale (seeSx Character sets ) ,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 leftassociativity, thus using the same syntax that is known for thesh(1).It is also possible to form groups of conditions and lists by enclosingthem in pairs of brackets`[...] ,'which may be interlocked within each other, and also be joined viaAND-OR lists.

The results of individual conditions and entire groups may be modifiedvia unary operators: the unary operator`!'will reverse the result.

wysh set v15-compat=yes # with value: automatic "wysh"!if -N debug;echo *debug* set;else;echo not;endifif "$ttycharset" == UTF-8 || "$ttycharset" ==?cas UTF8 echo ttycharset is UTF-8, the former case-sensitive!endifset t1=one t2=oneif [ "${t1}" == "${t2}" ] echo These two variables are equalendifif "$features" =% ,+regex, && "$TERM" =~?case ^xterm.* echo ..in an X terminalendifif [ [ true ] && [ [ "${debug}" != '' ] || \ [ "$verbose" != '' ] ] ] echo Noisy, noisyendifif true && [ -n "$debug" || -n "${verbose}" ] echo Left associativity, as is known from the shellendif
ignore
(ig) Identical todiscard Superseded by the multiplexerheaderpick
list
Shows the names of all available commands, in command lookup order.[Option] In conjunction with a set variableverboseadditional information will be provided for each command: the argumenttype will be indicated, the documentation string will be shown,and the set of command flags will show up:
``local''
command supports the command modifierlocal
``vput''
command supports the command modifiervput
`*!*'
the error number is tracked in!
`needs-box'
whether the command needs an active mailbox, afolder
`ok:'
indicators whether command is ...
`batch/interactive'
usable in interactive or batch mode( -#
`send-mode'
usable in send mode.
`subprocess'
allowed to be used when running in a subprocess instance,for example from within a macro that is called viaon-compose-splice
`not'
ok:indicators whether command is not ...
`compose'
modeavailable inSx Compose mode.
`startup'
available during program startup, like inSx Resource files .
`gabby'
The command produceshistory-gabbyhistoryentries.
localopts
Enforce change localization ofenviron(linked)Sx ENVIRONMENTas well as (global)Sx INTERNAL VARIABLES ,meaning that their state will be reverted to the former one once the``covered scope''is left.Just like the command modifierlocal which provides block-scope localization for some commands (instead),it can only be used inside of macro definition blocks introduced byaccountordefine The covered scope of anaccountis left once a different account is activated, and some macros, notablyfolder-hook s use their own specific notion of covered scope, here it will be extendeduntil 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 differentaccountwhich sets some variables that are already covered by localizations,their scope will be extended, and in fact leaving theaccountwill (thus) restore settings in (likely) global scope which actuallywere defined in a local, macro private context!)

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

define temporary_settings { set possibly_global_option1 localopts on set localized_option1 set localized_option2 localopts scope off set possibly_global_option2}
Lfollowup , Lreply
(Compose mode) Reply to messages that come in via known( mlist or subscribed( mlsubscribe mailing lists, or pretend to do so (seeSx Mailing lists ) :on top of the usualfollowupandreply respectively, functionality this will actively resort and even removemessage recipients in order to generate a message that is supposed to besent 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 variablefollowup-to For more documentation please refer toSx On sending mail, and non-interactive mode .

This may generate the errors^ERR -DESTADDRREQif no receiver has been specified,^ERR -PERMif some addressees where rejected byexpandaddr ^ERR -IOif an I/O error occurs,^ERR -NOTSUPif a necessary character set conversion fails, and^ERR -INVALfor other errors.It can also fail with errors ofSx Specifying messages .Occurrence of some of the errors depend on the value ofexpandaddr Any error stops processing of further messages.

Mail
(Compose mode) Similar tomail but saves the message in a file named after the local part of the firstrecipient's address (instead of inrecord ).
mail
(Compose mode)(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 variablefullnamesis set recipient addresses will be stripped from comments, names etc.For more documentation please refer toSx On sending mail, and non-interactive mode .

This may generate the errors^ERR -DESTADDRREQif no receiver has been specified,^ERR -PERMif some addressees where rejected byexpandaddr ^ERR -NOTSUPif multiple messages have been specified,^ERR -IOif an I/O error occurs,^ERR -NOTSUPif a necessary character set conversion fails, and^ERR -INVALfor other errors.It can also fail with errors ofSx Specifying messages .Occurrence of some of the errors depend on the value ofexpandaddr

mailcap
[Option] When used without arguments or ifshowhas been given the content ofSx The Mailcap filescache is shown, (re-)initializing it first (as necessary.If the argument isloadthen the cache will only be (re-)initialized, andclearwill remove its contents.Note that S-nail will try to load the files only once, use`mailcap'Ns clearto unlock further attempts.Loading and parsing can be made moreverbose
mbox
(mb) The given message list is to be sent to theSx secondary mailboxMBOXwhen S-nail is quit; this is the default action unless the variableholdis set.[v15 behaviour may differ] This command can only be used in aSx primary system mailbox .
mimetype , unmimetype
[Only new quoting rules] Without arguments the content of the MIME type cache will displayed;a more verbose listing will be produced if either ofdebugorverboseare set.When given arguments they will be joined, interpreted as shown inSx The mime.types files(also seeSx HTML mail and MIME attachments ) ,and the resulting entry will be added (prepended) to the cache.In any event MIME type sources are loaded first as necessary -mimetypes-load-controlcan be used to fine-tune which sources are actually loaded.

The latter command deletes all specifications of the given MIME type, thus`?'unmimetype text/plainwill 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 viamimetypes-load-control

mimeview
[v15 behaviour may differ] Only available in interactive mode, this command allows executionof external MIME type handlers which do not integrate into the normaltypeoutput (seeSx HTML mail and MIME attachments ) .([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 inturn whether the registered handler shall be used to display the part.
mlist , unmlist
[Only new quoting rules] Manage the list of knownSx Mailing lists ;subscriptions are controlled viamlsubscribe The latter command deletes all given arguments,or all at once when given the asterisk`*'The former shows the list of all currently known lists if usedwithout arguments, otherwise the given arguments will become known.[Option] In the latter case, arguments which contain any of theSx magic regular expression characterswill be interpreted as one, possibly matching many addresses;these will be sequentially matched via linked lists instead of beinglooked up in a dictionary.
mlsubscribe , unmlsubscribe
Building upon the command pairmlist , unmlist but only managing the subscription attribute of mailing lists.(The former will also create not yet existing mailing lists.)
Move
Similar tomove but move the messages to a file named after the local part of thesender of the first message instead of taking a filename argument;outfolderis inspected to decide on the actual storage location.
move
Acts likecopybut marks the messages for deletion if they were transferredsuccessfully.
More
Likemore but also displays header fields which would not pass theheaderpickselection, and all MIME parts.Identical toPage
more
Invokes thePAGERon the given messages, even in non-interactive mode and as long as thestandard output is a terminal.Identical topage
mtaaliases
[Option] When used without arguments or ifshowhas been given the content of themta-aliasescache is shown, (re-)initializing it first (as necessary).If the argument isloadthen the cache will only be (re-)initialized, andclearwill remove its contents.
netrc
[Option] When used without arguments, or when the argument wasshowthe content of the~/.netrccache is shown, initializing it as necessary.If the argument isloadthen the cache will be (re)loaded, whereasclearremoves it.Loading and parsing can be made moreverbose lookupwill query the cache for the URL given as the second argument( `[USER@]HOST'). Seenetrc-lookup netrc-pipeand the sectionSx On URL syntax and credential lookup ;the sectionSx The .netrc filedocuments the file format in detail.
newmail
Checks for new mail in the current folder without committing any changesbefore.If new mail is present, a message is shown.If theheadervariable 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 asUnread
new
Same asunread
noop
If the current folder is accessed via a network connection, a``NOOP''command is sent, otherwise no operation is performed.
Page
Likepage but also displays header fields which would not pass theheaderpickselection, and all MIME parts.Identical toMore
page
Invokes thePAGERon the given messages, even in non-interactive mode and as long as thestandard output is a terminal.Identical tomore
Pipe
Likepipebut also pipes header fields which would not pass theheaderpickselection, and all parts of MIME`multipart/alternative'messages.
pipe
(pi) Takes an optional message list and shell command (that defaults tocmd ) and pipes the messages through the command.If thepagevariable is set,every message is followed by a formfeed character.
preserve
(pre) A synonym forhold
Print
(P) Alias forType
print
(p) ResearchUNIXequivalent oftype
quit
(q) Terminates the session, saving all undeleted, unsaved messages inthe currentSx secondary mailboxMBOX preserving all messages marked withholdorpreserveor never referenced in the systeminbox and removing all other messages from theSx primary system mailbox .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 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 toexit(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 anotherwise success indicating status.
read
[Only new quoting rules] Read a line from standard input, or the channel set active viareadctl and assign the data, which will be split as indicated byifs to the given variables.The variable names are checked by the same rules as documented forvput and the same error codes will be seen in! the exit status?indicates the number of bytes read, it will be`-1'with the error number!set to^ERR -BADFin case of I/O errors, or^ERR -NONEupon End-Of-File.If there are more fields than variables, assigns successive fields to thelast given variable.If there are less fields than variables, assigns the empty string to theremains.
? 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 ifshey2.0,:"'you ",:world!:mars.:? echo $?/$^ERRNAME / <$a><$b><$c>0/NONE / <hey2.0,><"'you ",><world!:mars.:><><>
readsh
[Only new quoting rules] Likeread but splits on shell token boundaries (seeSx Shell-style argument quoting )rather than atifs [v15 behaviour may differ] Could become acommandalias maybe`read'--tokenize -- .
readall
[Only new quoting rules] Read anything from standard input, or the channel set active viareadctl and assign the data to the given variable.The variable name is checked by the same rules as documented forvput and the same error codes will be seen in! the exit status?indicates the number of bytes read, it will be`-1'with the error number!set to^ERR -BADFin case of I/O errors, or^ERR -NONEupon End-Of-File.[v15 behaviour may differ] The input data length is restricted to 31-bits.
readctl
[Only new quoting rules] Manages input channels forread readshandreadall to be used to avoid complicated or impracticable code, like callingreadfrom within a macro in non-interactive mode.Without arguments, or when the first argument isshow a listing of all known channels is printed.Channels can otherwise becreate d, and existing channels can besetactive andremove d 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 undergoesSx Filename transformations .For example (this example requires a modern shell):

$ printf 'echon "hey, "\nread a\nyou\necho $a' |\ 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
remove
[Only new quoting rules] Removes the named files or directories.If a name refers to a mailbox, say a Maildir mailbox, then a mailboxtype specific removal will be performed, deleting the complete mailbox.In interactive mode the user is asked for confirmation.
rename
[Only new quoting rules] Takes the name of an existing folderand the name for the new folderand renames the first to the second one.Sx Filename transformationsincluding shell pathname wildcard pattern expansions( glob(7) are performed on both arguments.Both folders must be of the same type.
Reply , Respond
(Compose mode)(R) Identical toreplyexcept that it replies to only the sender of each message of the givenlist, by using the first message as the template to quote, for the`Subject:'etc.; settingfliprwill exchange this command withreply
reply , respond
(Compose mode)(r) Take a message (list) and group-respond (to each in turn)by addressing the sender and all recipients, subject tofullnamesandalternatesprocessing.followup-to followup-to-honour reply-to-honouras well asrecipients-in-ccinfluence response behaviour.quoteas well asquote-as-attachmentconfigure whether responded-to message shall be quoted etc.,content-description-quote-attachmentmay be used.Settingfliprwill exchange this command withReply The commandLreplyoffers special support for replying to mailing lists.For more documentation please refer toSx On sending mail, and non-interactive mode .

This may generate the errors^ERR -DESTADDRREQif no receiver has been specified, or was rejected byexpandaddrpolicy,^ERR -IOif an I/O error occurs,^ERR -NOTSUPif a necessary character set conversion fails, and^ERR -INVALfor other errors.It can also fail with errors ofSx Specifying messages .Any error stops processing of further messages.

Resend
Likeresend 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 name,and sends each message to the given addressee, which is subject tofullnames `Resent-From:'and related header fields are prepended to the new copy of the message.Saving inrecordis only performed ifrecord-resentis set.[v15 behaviour may differ](Compose mode) is not entered, the only supported hooks areon-resend-enterandon-resend-cleanup

This may generate the errors^ERR -DESTADDRREQif no receiver has been specified, or was rejected byexpandaddrpolicy,^ERR -IOif an I/O error occurs,^ERR -NOTSUPif a necessary character set conversion fails, and^ERR -INVALfor other errors.It can also fail with errors ofSx Specifying messages .Any error stops processing of further messages.

retain
(ret) Superseded by the multiplexerheaderpick
return
Only available inside of adefine d macro or anaccount this command returns control of execution to the outer scope.The two optional parameters are positive decimal numbers and default to 0:the first specifies the 32-bit return value (stored in?[v15 behaviour may differ] and later extended to 64-bit),the second the 32-bit error number (stored in! ) As documented for?a non-0 exit status may cause the program to exit.
Save
(S) Similar tosave,but saves the messages in a file named after the local part of thesender of the first message instead of taking a filename argument;outfolderis inspected to decide on the actual storage location.
save
(s) Takes a message list and a filename and appends each message in turnto the end of the file.Sx Filename transformationsincluding shell pathname wildcard pattern expansions( glob(7) is performed on the filename.If no filename is given, theSx secondary mailboxMBOXis used.The filename in quotes, followed by the generated character countis echoed on the user's terminal.If editing aSx primary system mailboxthe messages are marked for deletion.To filter the saved header fields to the desired subset use the`save'slot of the white- and blacklisting commandheaderpick Also seeCopy
savediscard
[Obsolete] Superseded by the multiplexerheaderpick
saveignore
[Obsolete] Superseded by the multiplexerheaderpick
saveretain
[Obsolete] Superseded by the multiplexerheaderpick
search
Takes a message specification (list) and displays a header summary ofall matching messages, as viaheaders This command is an alias offrom Also seeSx Specifying messages .
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 globalvariables, or only block-scope local ones if thelocalcommand modifier has been used.The former, when used without arguments, will show allcurrently known variables, being more verbose if either ofdebugorverboseis set.Remarks: this list mode will not automatically link-in (known)Sx ENVIRONMENTvariables, this only happens for explicit addressing, examples arevarshow using a variable in anifcondition or a string passed toecho explicitset ting, as well as some program-internal use cases (look-ups).

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.If a name begins with`no',as in`set'nosave ,the effect is the same as invoking theunsetcommand with the remaining part of the variable( `unset'save ). [v15 behaviour may differ] In conjunction with thewysh(or local command prefix(es)Sx Shell-style argument quotingcan be used to quote arguments as necessary.[v15 behaviour may differ] Otherwise quotation marks may be placed around any part of theassignment statement to quote blanks or tabs.

When operating in global scope any`name'that is known to map to an environment variable will automatically causeupdates in the program environment (unsetting a variable in theenvironment requires corresponding system support) --- use the commandenvironfor further environmental control.If the command modifierlocalhas been used to enforce local scoping then the given user variableswill be garbage collected when the local scope is left;forSx INTERNAL VARIABLES ,however,localbehaves the same as iflocaloptswould have been set (temporarily), which means that changes areinherited by deeper scopes.Also seevarshowand the sectionsSx INTERNAL VARIABLESandSx ENVIRONMENT .

? wysh set indentprefix=' -> '? wysh set atab=$'' aspace=' ' zero=0
shcodec
Apply shell quoting rules to the given raw-data arguments.Supportsvput(seeSx Command modifiers ) .The first argument specifies the operation:[+]e[ncode]ord[ecode]cause shell quoting to be applied to the remains of the line, andexpanded away thereof, respectively.If the former is prefixed with a plus-sign, the quoted result will notbe roundtrip enabled, and thus can be decoded only in the very sameenvironment that was used to perform the encode; also seemle-quote-rndtrip If the coding operation fails the error number!is set to^ERR -CANCELED and the unmodified input is used as the result; the error number maychange 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
[Only new quoting rules] Manage the file- or pathname shortcuts as documented forfolder The latter command deletes all shortcuts given as arguments,or all at once when given the asterisk`*'The former shows the list of all currently defined shortcuts if usedwithout arguments, the target of the given with a single argument.Otherwise arguments are treated as pairs of shortcuts and their desiredexpansion, creating new or updating already existing ones.
shift
[Only new quoting rules] Shift the positional parameter stack (starting at1 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 viavpospar Note this command will fail inaccountand hook macros unless the positional parameter stack has beenexplicitly created in the current context viavpospar
show
Liketype but performs neither MIME decoding nor decryption, so that the rawmessage text is shown.
size
(si) Shows the size in characters of each message of the givenmessage list.
sleep
[Only new quoting rules] Sleep for the specified number of seconds (and optionallymilliseconds), by default interruptible.If a third argument is given the sleep will be uninterruptible,otherwise the error number!will be set to^ERR -INTRif the sleep has been interrupted.The command will fail and the error number will be^ERR -OVERFLOWif the given duration(s) overflow the time datatype, and^ERR -INVALif the given durations are no valid integers.
sort , unsort
The latter command disables sorted or threaded mode, returns to normalmessage order and, if theheadervariable is set,displays a header summary.The former command shows the current sorting criterion when used withoutan argument, but creates a sorted representation of the current folderotherwise, and changes thenextcommand and the addressing modes such that they refer to messages inthe sorted order.Message numbers are the same as in regular mode.If theheadervariable is set,a header summary in the new order is also displayed.Automatic folder sorting can be enabled by setting theautosortvariable, as in`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 theshownamevariable 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 byspamrate
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 theshownamevariable 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.Sx Filename transformationswill be applied.If the given expanded argument ends with a vertical bar`|'then the argument will instead be interpreted as a shell command andS-nail will read the output generated by it.Dependent on the settings ofposixanderrexit and also dependent on whether the command modifierignerrhad been used, encountering errors will stop sourcing of the given input.[v15 behaviour may differ] Note thatsourcecannot be used from within macros that execute asfolder-hook soraccount s i.e., it can only be called from macros that werecall ed
source_if
[Only new quoting rules] The difference tosource(beside not supporting pipe syntax aka shell command input) is thatthis command will not generate an error nor warn if the given fileargument 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 thespam-interfaceto 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 beforgotten to be``ham''or``spam''
spamham
[Option] Takes a list of messages and informs the Bayesian filter of thespam-interfacethat 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 configuredspam-interface without modifying the messages, but setting their`is-spam'flag as appropriate; because the spam rating headers are lost the ratewill be forgotten once the mailbox is left.Refer to the manual sectionSx Handling spamfor 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 thespam-interfacethat 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).
tls
[Only new quoting rules] TLS information and management command multiplexer to aid inSx Encrypted network communication ,mostly available only if the term`,+sockets,'is included infeatures Commands supportvputif so documented (seeSx Command modifiers ) .The result that is shown in case of errors is always the empty string,errors can be identified via the error number! For example, string length overflows are caught and set!to^ERR -OVERFLOW The TLS configuration is honoured, especiallytls-verify
? vput tls result fingerprint pop3s://ex.am.ple? echo $?/$!/$^ERRNAME: $result
certchain
Show the complete verified peer certificate chain.Includes informational fields in conjunction withverbose
certificate
Show only the peer certificate, without any signers.Includes informational fields in conjunction withverbose
fingerprint
Show thetls-fingerprint-digest ed fingerprint of the certificate of the given HOST( `server:port' where the port defaults to the HTTPS port, 443).tls-fingerprintis actively ignored for the runtime of this command.
Top
Liketopbut always uses theheaderpick`type'slot for white- and blacklisting header fields.
top
(to) Takes a message list and types out the firsttoplineslines of each message on the user's terminal.Unless a special selection has been established for the`top'slot of theheaderpickcommand, the only header fields that are displayed are`From:',`To:',`Cc:',and`Subject:'Topwill always use the`type'headerpickselection instead.It is possible to apply compression to what is displayed by settingtopsqueeze Messages are decrypted and converted to the terminal character setif necessary.
touch
(tou) Takes a message list and marks the messages for saving in theSx secondary mailboxMBOX S-nail deviates from the POSIX standard with this command,as a followingnextcommand will display the following message instead of the current one.
Type
(T) Liketypebut also displays header fields which would not pass theheaderpickselection, and all visualizable parts of MIME`multipart/alternative'messages.
type
(t) Takes a message list and types out each message on the user's terminal.The display of message headers is selectable viaheaderpick For MIME multipart messages, all parts with a content type of`text',all parts which have a registered MIME type handler (seeSx HTML mail and MIME attachments )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 setif necessary.The commandmimeviewcan be used to display parts which are not displayable as plain text.
unaccount
Seeaccount
unalias
(una) Seealias
unanswered
Seeanswered
unbind
Seebind
uncollapse
Seecollapse
uncolour
Seecolour
undefine
Seedefine
undelete
Seedelete
undraft
Seedraft
unflag
Seeflag
unfwdignore
[Obsolete] Superseded by the multiplexerheaderpick
unfwdretain
[Obsolete] Superseded by the multiplexerheaderpick
unignore
Superseded by the multiplexerheaderpick
unmimetype
Seemimetype
unmlist
Seemlist
unmlsubscribe
Seemlsubscribe
Unread
Same asunread
unread
Takes a message list and marks each message as not having been read.
unretain
Superseded by the multiplexerheaderpick
unsaveignore
[Obsolete] Superseded by the multiplexerheaderpick
unsaveretain
[Obsolete] Superseded by the multiplexerheaderpick
unset
[Only new quoting rules] (uns) Seeset
unshortcut
Seeshortcut
unsort
Seeshort
unthread
[Obsolete]Same asunsort
urlcodec
Perform URL percent codec operations on the raw-data argument, ratheraccording to RFC 3986.The first argument specifies the operation:e[ncode]ord[ecode]perform plain URL percent en- and decoding, respectively.p[ath]enc[ode]andp[ath]dec[ode]perform a slightly modified operation which should be better forpathnames: 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.This is a character set agnostic operation,and it may thus decode bytes which are invalid in the currentttycharset

Supportsvput(seeSx Command modifiers ) ,and manages the error number! If the coding operation fails the error number!is set to^ERR -CANCELED and the unmodified input is used as the result; the error number maychange again due to output or result storage errors.[v15 behaviour may differ] This command does not know about URLs beside what is documented.( vexproffers amakeprintsubcommand, shall the URL be displayed.)

varshow
[Only new quoting rules] This command produces the same output as the listing mode ofset includingverbose 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 validcertificate,if the message sender's email address matches one of those containedwithin the certificate,and if the message content has been altered.
version
Shows theversionandfeaturesof S-nail, optionally in a moreverboseform which also includes the build and running system environment.This command supportsvput(seeSx Command modifiers ) .
vexpr
[Only new quoting rules] A multiplexer command which offers signed 64-bit numericcalculations, as well as other, mostly string-based operations.C-style byte string operations are available viacsop The first argument defines the number, type, and meaning of theremaining arguments.An empty number argument is treated as 0.Supportsvput(seeSx Command modifiers ) .The result shown in case of errors is`-1'for usage errors and numeric operations, the empty string otherwise;``soft''errors, like when a search operation failed, will also set the!error number to^ERR -NODATA Except when otherwise noted numeric arguments are parsed as signed 64-bitnumbers, and errors will be reported in the error number!as the numeric error^ERR -RANGE

Numeric operations work on one or two signed 64-bit integers.Numbers prefixed with`0x'or`0X'are interpreted as hexadecimal (base 16) numbers, whereas`0'indicates octal (base 8), and`0b'as well as`0B'denote binary (base 2) numbers.It is possible to use any base in between 2 and 36, inclusive, with the`BASE#number'notation, where the base is given as an unsigned decimal number, so`16#AFFE'is a different way of specifying a hexadecimal number.Unsigned interpretation of a number can be enforced by prefixing an`u'(case-insensitively), as in`u-110';this is not necessary for power-of-two bases (2, 4, 8, 16 and 32),which will be interpreted as unsigned by default, but it still makesa difference regarding overflow detection and overflow constant.It is possible to enforce signed interpretation by (instead) prefixing a`s'(case-insensitively).The number sign notation uses a permissive parse mode and as suchsupports complicated conditions out of the box:

? wysh set ifs=:;read i;unset ifs;echo $i;vexpr pb 2 10#$i -009< -009>0b1001

One integer is expected by assignment (equals sign`=') ,which does nothing but parsing the argument, thus detecting validity andpossible overflow conditions, unary not (tilde`~') ,which creates the bitwise complement, and unary plus and minus.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`>>>'

Another numeric operation ispbase which takes a number base in between 2 and 36, inclusive, and will acton the second number given just the same as what equals sign`='does, but the number result will be formatted in the base given, asa signed 64-bit number unless unsigned interpretation of the inputnumber had been forced (with an u prefix).

Numeric operations support a saturated mode via the question mark`?'modifier suffix; the keyword`saturated'is optional,`+?',`+?satu',and`+?saturated'are therefore identical.In saturated mode overflow errors and division and modulo by zero are nolonger reported via the exit status, but the result will linger at theminimum or maximum possible value, instead of overflowing (or trapping).This is true also for the argument parse step.For the bitwise shifts, the saturated maximum is 63.Any caught overflow will be reported via the error number!as^ERR -OVERFLOW

? vput vexpr res -? +1 -9223372036854775808? echo $?/$!/$^ERRNAME:$res0/75/OVERFLOW:-9223372036854775808

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

date-utc
Outputs the current date and time in UTC (Coordinated Universal Time)with values named such that`vput'vexpr x date-utc; eval wysh set $xcreates accessible variables.
date-stamp-utc
Outputs a RFC 3339 internet date/time format of UTC.
epoch
The seconds and nanoseconds since the Unix epoch (1970-01-01T00:00:00)named`epoch_sec'and`epoch_nsec'such that`vput'vexpr x epoch; eval wysh set $xcreates accessible variables.
file-expand
Performs the usualSx Filename transformationson its argument.
file-stat , file-lstat
Perform the usualSx Filename transformationson the argument, then callstat(2)andlstat(2),respectively, and output values such that`vput'vexpr x file-stat FILE; eval wysh set $xcreates accessible variables.The variable`st_type'uses solidus`/'to denote directories, commercial at`@'for links, number sign`#'for block devices, percent sign`%'for for character devices, vertical bar`|'for FIFOs, equal sign`='for sockets, and the period`.'for the rest.
random
Generates a random string of the given length, or ofPATH_MAXbytes (a constant from/usr/include if the value 0 is given; the random string will be base64url encodedaccording to RFC 4648, and thus be usable as a (portable) filename.

String operations work, sufficient support provided, according to theactive user's locale encoding and character set (seeSx Character sets ) .Where the question mark`?'modifier suffix is supported, a case-insensitive operation mode isavailable; the keyword`case'is optional,`regex?'and`regex?case'are therefore identical.

makeprint
(One-way) Converts the argument to something safely printable on theterminal.
regex
[Option] A string operation that will try to match the first argument withthe regular expression given as the second argument.`?'modifier suffix is supported.If the optional third argument has been given then instead of showingthe match offset a replacement operation is performed: the thirdargument is treated as if specified within dollar-single-quote (seeSx Shell-style argument quoting ) ,and any occurrence of a positional parameter, for example0 , 1etc. is replaced with the according match group of the regular expression:
? vput vexpr res regex bananarama \ (.*)NanA(.*) '\${1}au\$2'? echo $?/$!/$^ERRNAME:$res:1/61/NODATA::? vput vexpr res regex?case bananarama \ (.*)NanA(.*) '\${1}uauf\$2'? echo $?/$!/$^ERRNAME:$res:0/0/NONE:bauauframa:
vpospar
[Only new quoting rules] Manage the positional parameter stack (see1 , # , * , as well asshift ) If the first argument is`clear',then the positional parameter stack of the current context, or theglobal 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 -OVERFLOWerror 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 firstcharacter ofifs and followed by the first character ofif-ws if that is not empty and not identical to the first.If that results in no separation at all aspacecharacter is used.This mode supportsvput(seeSx Command modifiers ) .I.e., the subcommands`set'and`quote'can be used (in conjunction witheval 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 theVISUALdisplay editor on each message.Modified contents are discarded unless thewritebackeditedvariable is set, and are not used unless the mailbox can be written toand the editor returns a successful exit status.editcan be used instead for a less display oriented editor.
write
(w) For conventional messages the body without all headers is written.The original message is never marked for deletion in the originatingmail 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 tothe specified file as for conventional messages, handling of the remainsdepends on the execution mode.No special handling of compressed files is performed.

In interactive mode the user is consecutively asked for the filenames ofthe processed parts.For convenience saving of each part may be skipped by giving an emptyvalue, the same result as writing it to/dev/null Shell piping the part content by specifying a leading vertical bar`|'character for the filename is supported.Other user input undergoes the usualSx Filename transformations ,including shell pathname wildcard pattern expansions( glob(7) and shell variable expansion for the message as such, not the individualparts, and contents of the destination file are overwritten if the filepreviously existed.Character set conversion tottycharsetis performed when saving text data.

[v15 behaviour may differ] In non-interactive mode any part which does not specify a filenameis ignored, and suspicious parts of filenames of the remaining parts areURL percent encoded (as viaurlcodec to prevent injection of malicious character sequences, resulting ina filename that will be written into the current directory.Existing files will not be overwritten, instead the part number ora dot are appended after a number sign`#'to the name until file creation succeeds (or fails due to otherreasons).

xcall
[Only new quoting rules] The sole difference tocallis that the new macro is executed in place of the current one, whichwill not regain control: all resources of the current macro will bereleased first.This implies that any setting covered bylocaloptswill be forgotten and covered variables will become cleaned up.If this command is not used from within acall ed macro it will silently be (a more expensive variant of)call
xit
(x) A synonym forexit
z
[Only new quoting rules] S-nail presents message headers inscreen fuls as described under theheaderscommand.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 lastscreenof messages.A number argument prefixed by`+'or`-'indicates that the window is calculated in relation to the currentposition, and a number without a prefix specifies an absolute position.
Z
[Only new quoting rules] Similar toz but scrolls to the next or previous window that contains at least one`new'orflag ged message.

COMMAND ESCAPES

Command escapes are available inSx Compose modeduring interactive usage, when explicitly requested via-~ and in batch mode( -# They perform special functions, like editing headers of the messagebeing composed, calling normalSx COMMANDS ,yielding a shell, etc.Command escapes are only recognized at the beginning of lines, andconsist of an escape followed by a command character.The defaultescapecharacter is the tilde`~'

Unless otherwise documented command escapes ensure proper updates ofthe error number!and the exit status? The variableerrexitcontrols whether a failed operation errors out message compose mode andcauses program exit.Escapes may be prefixed by none to multiple single character commandmodifiers, interspersed whitespace is ignored:

  • An effect equivalent to the command modifierignerrcan be achieved with hyphen-minus`-',overridingerrexit
  • The modifier dollar`$'eval uates the remains of the line; also seeSx Shell-style argument quoting .[v15 behaviour may differ] For now the entire input line is evaluated as a whole; to avoidthat control operators like semicolon;are interpreted unintentionally, they must be quoted.

Addition of the command line to the [Option]al history can be prevented byplacing whitespace directly afterescape The [Option]al keybind ings support a compose mode specific context.The following command escapes are supported:

~~ 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 shellcommandwhich follows, replacing unescaped exclamation marks with the previouslyexecuted command if the internal variablebangis set, then return to the message.
~.
End compose mode and send the message.The hookson-compose-splice-shellandon-compose-splice in order, will be called when set, after which, in interactive modeaskatend(leading toaskcc , askbcc andaskattachwill be checked as well asasksend after which a seton-compose-leavehook will be called,autoccandautobccwill be joined in if set,finally a givenmessage-inject-tailwill be incorporated, after which the compose mode is left.
~: S-nail-command or ~_ S-nail-command
Can be used to executeSx COMMANDS(which are allowed in compose mode).
~< filename
Identical to~r
~<! command
commandis executed using the shell.Its standard output is inserted into the message.
~?
[Option] Write a summary of command escapes.
~@ [filename...]
Append or edit the list of attachments.Does not manage the error number!and the exit status?(please use~^if error handling is necessary).The append mode expects a list offilenamearguments as shell tokens (seeSx Shell-style argument quoting ;token-separating commas are ignored, too), to beinterpreted as documented for the command line option-a with the message number exception as below.

Withoutfilenamearguments 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 beentered or the session can be quit by committing an empty``new''attachment.In non-interactive mode or in batch mode( -# the list of attachments is effectively not edited but instead recreated;again, an empty input ends list creation.

For all modes, if a given filename solely consists of the number sign`#'followed by either a valid message number of the currently activemailbox, or by a period`.',referring to the current message of the active mailbox, the so-called``dot'' then the given message is attached as a`message/rfc822'MIME message part.The number sign must be quoted to avoid misinterpretation as a shellcomment character.

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

If the first character of the command is a vertical bar, then the entiremessage including header fields is subject to the filter command, so`~||'echo Fcc: /tmp/test; catwill prepend a file-carbon-copy message header.Also see~e , ~v

~^ cmd [subcmd [arg3 [arg4]]]
Inspect and modify the message using the semantics ofdigmsg therefore arguments are evaluated according toSx Shell-style argument quoting .Error number!and exit status?are not managed: errors are handled via the protocol,and hard errors like I/O failures cannot be handled.

The protocol consists of command lines followed by (a) response line(s).The first field of the response line represents a status codewhich specifies whether a command was successful or not, whether resultdata is to be expected, and if, the format of the result data.Response data will be shell quoted as necessary for consumption byreadsh orevalandvpospar to name a few.Error status code lines may optionally contain additional context:

`210'
Status ok; the remains of the line are the result.
`211'
Status ok; the rest of the line is optionally used for more status.What follows are lines of result addresses, terminated by an empty line.All the input, including the empty line, must be consumed before furthercommands can be issued.Address lines consist of two token, first the plain network address, e.g.,`bob [at] exam.ple',followed by the (quoted) full address as known:`'(Lovely)'Bob <bob [at] exam.ple>' .Non-network addresses use the first field to indicate the type (hyphen-minus`-'for files, vertical bar`|'for pipes, and number sign`#'for names which will undergoaliasprocessing) instead, the actual value will be in the second field.
`212'
Status ok; the rest of the line is optionally used for more status.What follows are lines of furtherly unspecified (quoted) string content,terminated by an empty line.All the input, including the empty line, must be consumed before furthercommands can be issued.
`500'
Syntax error; invalid command.
`501'
Syntax error or otherwise invalid parameters or arguments.
`505'
Error: an argument fails verification.For example an invalid address has been specified (also seeexpandaddr ) or an attempt was made to modify anything in S-nail's own namespace,or a modifying subcommand has been used on a read-only message.
`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 ofa single address only.

If a command indicates failure then the message will have remainedunmodified.Most commands can fail with`500'if required arguments are missing, or excessive arguments have beengiven (false command usage).([v15 behaviour may differ] The latter does not yet occur regularly, because as stated inSx Shell-style argument quotingour argument parser is not yet smart enough to work on subcommand base;for example one might get excess argument error for a three argumentsubcommand that receives four arguments, but not for a four argumentsubcommand which receives six arguments: here excess will be joined.)The following (case-insensitive) commands are supported:

attachment
This command allows listing, removal and addition of message attachments.The second argument specifies the subcommand to apply, one of:
attribute
This uses the same search mechanism as described forremoveand 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 with a keyword and a value token.
attribute-at
This uses the same search mechanism as described forremove-atand is otherwise identical toattribute
attribute-set
This uses the same search mechanism as described forremove and will set the attribute given as the fourth to the value given asthe fifth token argument.If the value is an empty token, then the given attribute is removed,or reset to a default value if existence of the attribute is crucial.

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 fordisplay and when (suggesting a name for) saving (purposes).
`content-description'
Associate some descriptive information to the attachment's content, usedin 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 2045and generates a`505'upon address content verification failure.
`content-type'
Defines the media type/subtype of the part, which is managedautomatically, but can be overwritten.
`content-disposition'
Automatically set to the string`attachment'
attribute-set-at
This uses the same search mechanism as described forremove-atand is otherwise identical toattribute-set
insert
Adds the attachment given as the third argument, specified exactly asdocumented for the command line option-a and supporting the message number extension as documented for~@ 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 isrequested but not available.
list
List all attachments via`212',or report`501'if no attachments exist.This command is the default command ofattachmentif 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 exactmatch of the path which has been used to create the attachment is useddirectly, but if only the basename of that path matches then allattachments are traversed to find an exact match first, and the removaloccurs 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 attachmentswill be searched for`filename='parameter matches as well as for matches of the basename of the pathwhich has been used when the attachment has been created; multiplematches result in a`506'

remove-at
This will interpret the third argument as a number and remove theattachment 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.
header
This command allows listing, inspection, and editing of message headers.Header name case is not normalized, so that case-insensitive comparisonshould be used when matching names.The second argument specifies the subcommand to apply, one of:
insert
Create a new or an additional instance of the header given in the thirdargument, with the header body content as given in the fourth token.It may return`501'if the third argument specifies a free-form header field name that isinvalid, or if body content extraction fails to succeed,`505'if any extracted address does not pass syntax and/or security checks oron 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).`To:',`Cc:'and`Bcc:'support the`?single'modifier to enforce treatment as a single addressee, for example`header'insert To?single: 'exa, <m@ple>' ;the word`single'is optional.

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

list
Without a third argument a list of all yet existing headers is given via`210';this command is the default command ofheaderif no second argument has been given.A third argument restricts output to the given header only, which mayfail with`501'if no such field is defined.
remove
This will remove all instances of the header given as the thirdargument, reporting`210'upon success,`501'if no such header can be found, and`505'on S-nail namespace violations.
remove-at
This will remove from the header given as the third argument theinstance at the list position (counting from one!) given with the fourthargument, reporting`210'upon success or`505'if the list position argument is not a number or on S-nail namespaceviolations, and`501'if no such header instance exists.
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'

In compose-mode read-only access to optional pseudo headers in the S-nailprivate namespace is available:

`Mailx-Command:'
The name of the command that generates the message, one of`forward',`Lreply',`mail',`Reply',`reply',`resend'This pseudo header always exists (in compose-mode).
`Mailx-Raw-To:'
`Mailx-Raw-Cc:'
`Mailx-Raw-Bcc:'
Represent the frozen initial state of these headers before anytransformation( alias alternates recipients-in-ccetc.) took place.
`Mailx-Orig-Sender:'
`Mailx-Orig-From:'
`Mailx-Orig-To:'
`Mailx-Orig-Cc:'
`Mailx-Orig-Bcc:'
The values of said headers of the original message which has beenaddressed by any ofreply , forward , resend The sender field is special as it is filled in with the sole senderaccording to RFC 5322 rules, it may thus be equal to the from field.
help , ?
Show an abstract of the above commands via`211'
version
This command will print the protocol version via`210'
~A
The same as`~i'Ns Va Sign .
~a
The same as`~i'Ns Va sign .
~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 theDEADvariable into the message.
~e
Invoke the textEDITORon the message collected so far, then return to compose mode.~vcan be used for a more display oriented editor, and~| |offers a pipe-based editing approach.
~F messages
Read the named messages into the message being sent, including allmessage headers and MIME parts, and honouringforward-add-ccas well asforward-inject-headandforward-inject-tail 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`forward'(withposix `type')white- and blacklist selection ofheaderpick and honoursforward-add-ccas well asforward-inject-headandforward-inject-tail For MIME multipart messages,only the first displayable part is included.
~H
In interactive mode, 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 thefrom , reply-toandsendervariables.In non-interactive mode this sets^ERR -NOTTY
~h
In interactive mode, edit the message header fields`To:',`Cc:',`Bcc:'and`Subject:'by typing each one in turn and allowing the user to edit the field.In non-interactive mode this sets^ERR -NOTTY
~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 inposixmode; otherwise the expansion should occur atsettime ([v15 behaviour may differ] by using the command modifierwysh )
~i variable
Like~I but appends a newline character.
~M messages
Read the named messages into the message being sent,indented byindentprefix If no messages are specified, read the current message, the``dot'' Honoursforward-add-ccas well asforward-inject-headandforward-inject-tail
~m messages
Read the named messages into the message being sent,indented byindentprefix 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 ofheaderpick Honoursforward-add-ccas well asforward-inject-headandforward-inject-tail For MIME multipart messages,only the first displayable part is included.
~p
Display the message collected so far,prefaced by the message header fieldsand followed by the attachment list, if any.
~Q
Read in the given / current message(s) using the algorithm ofquote(except that is implicitly assumed, even if not set), honouringquote-add-cc
~q
Abort the message being sent,copying it to the file specified by theDEADvariable ifsaveis set.
~R filename
Identical to~r but indent each line that has been read byindentprefix
~r filename [HERE-delimiter]
Read the named file, object toSx Filename transformationsexcluding shell globs and variable expansions, into the message; iffilenameis the hyphen-minus`-'then standard input is used (for pasting, for example).Only in this latter modeHERE-delimitermay be given: if it is data will be read in until the givenHERE-delimiteris seen on a line by itself, and encountering EOF is an error; theHERE-delimiteris a required argument in non-interactive mode; if it is single-quotequoted then the pasted content will not be expanded, [v15 behaviour may differ] otherwisea 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 benormalized 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 byindentprefix Honoursforward-add-ccas well asforward-inject-headandforward-inject-tail
~u messages
Read in the given / current message(s), excluding all headers.Honoursforward-add-ccas well asforward-inject-headandforward-inject-tail
~v
Invoke theVISUALeditor on the message collected so far, then return to compose mode.~ecan be used for a less display oriented editor, and~| |offers a pipe-based editing approach.
~w filename
Write the message onto the named file, which is object to the usualSx Filename transformations .If the file exists,the message is appended to it.
~x
Same as~q except that the message is not saved at all.

INTERNAL VARIABLES

Internal S-nail variables are controlled via thesetandunsetcommands; prefixing a variable name with the string`no'and callingsethas the same effect as usingunset `unset'crtand`set'nocrtdo the same thing.varshowwill give more insight on the given variable(s), andset when called without arguments, will show a listing of all variables.Both commands support a moreverboselisting mode.Some well-known variables will also become inherited from theprogramSx ENVIRONMENTimplicitly, others can be imported explicitly with the commandenvironand henceforth share said properties.

Two different kinds of internal variables exist, and both of which canalso 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, theintroduction of the sectionSx COMMANDSdocuments the supported quoting rules.

? wysh set one=val\ 1 two="val 2" \ three='val "3"' four=$'val \'4\''; \ varshow one two three four; \ unset one two three four

Dependent upon the actual option string values may become interpreted ascolour names, command specifications, normal text, etc.They may be treated as numbers, in which case decimal values areexpected if so documented, but otherwise any numeric format andbase that is valid and understood by thevexprcommand may be used, too.

There also exists a special kind of string value, the``boolean string'' which must either be a decimal integer (in which case`0'is false and`1'and any other value is true) or any of the (case-insensitive) strings`off',`no',`n'and`false'for a false boolean and`on',`yes',`y'and`true'for a true boolean;a special kind of boolean string is the``quadoption'' it can optionally be prefixed with the (case-insensitive) term`ask-',as in`ask-yes';in interactive mode the user will be prompted, otherwise the actualboolean is used.

Variable chains extend a plain`variable'with`variable-HOST'and`variable-USER [at] HOST'variants.Here`HOST'will be converted to all lowercase when looked up (but not when thevariable is set or unset!), [Option]ally IDNA converted, and indeed means`server:port'if a`port'had been specified in the contextual Uniform Resource Locator URL, seeSx On URL syntax and credential lookup .Even though this mechanism is based on URLs no URL percent encoding maybe applied to neither of`USER'nor`HOST',variable chains need to be specified using raw data;the mentioned section contains examples.Variables which support chains are explicitly documented as such, andS-nail treats the base name of any such variable special, meaning thatusers should not create custom names like`variable-xyz'in order to avoid false classifications and treatment of such variables.

Initial settings

The standard POSIX 2008/Cor 2-2016 mandates the following initialvariable settings:no allnet no append asksub no askbcc no autoprint no bang no cmd no crt no debug no dot escapeset to`~',no flipr no folder header no hold no ignore no ignoreeof no keep no keepsave no metoo no outfolder no page promptset to`?',no quiet no record save no sendwait no showto no Sign no sign toplinesset to`5'

However, S-nail has built-in some initial (and some default) settingswhich (may) diverge, others may become adjusted by one of theSx Resource files .Displaying the former is accomplished viaset `$'s-nail -:/ -v -Xset -Xx .In general this implementation sets (and has extended the meaning of)sendwait and does not support theno onehopvariable - use command line options ormta-argumentsto pass options through to amta The default global resource file sets, among others, the variableshold keepandkeepsave establishes a defaultheaderpickselection etc., and should thus be taken into account.

Variables

?
(Read-only) The exit status of the last command, or thereturnvalue of the macrocall ed last.This status has a meaning in the state machine: in conjunction witherrexitany non-0 exit status will cause a program exit, and inposixmode any error while loading (any of the) resource files will have thesame effect.ignerr one of theSx Command modifiers ,can be used to instruct the state machine to ignore errors.
!
(Read-only) The current error number( errno(3)) which is set after an error occurred; it is also available via^ERR and the error name and documentation string can be queried via^ERRNAMEand^ERRDOC [v15 behaviour may differ] This machinery is new and the error number is only really usableif a command explicitly states that it manages the variable! for others errno will be used in case of errors, or^ERR -INVALif that is 0: it thus may or may not reflect the real error.The error number may be set with the commandreturn
^
(Read-only) This is a multiplexer variable which performs dynamic expansion ofthe requested state or condition, of which there are:
^ERR , ^ERRDOC , ^ERRNAME
The number, documentation, and name of the currenterrno(3),respectively, which is usually set after an error occurred.The documentation is an [Option], the name is used if not available.[v15 behaviour may differ] This machinery is new and is usually reliable only if a commandexplicitly states that it manages the variable! which is effectively identical to^ERR Each of those variables can be suffixed with a hyphen minus followed bya name or number, in which case the expansion refers to the given error.Note this is a direct mapping of (a subset of) the system error values:
define work { eval echo \$1: \$^ERR-$1:\ \$^ERRNAME-$1: \$^ERRDOC-$1 vput vexpr i + "$1" 1 if [ $i -lt 16 ] \xcall work $i end}call work 0
^ERRQUEUE-COUNT , ^ERRQUEUE-EXISTS
The number of messages in the [Option]al queue oferrors and a string indicating queue state: empty or (translated)``ERROR'' Always 0 and the empty string, respectively, unlessfeaturesincludes`,+errors,'
*
(Read-only) Expands all positional parameters (see1 ) separated by the first character of the value ofifs [v15 behaviour may differ] The special semantics of the equally named special parameter of thesh(1)are not yet supported.
@
(Read-only) Expands all positional parameters (see1 ) separated by a space character.If placed in double quotation marks, each positional parameter isproperly quoted to expand to a single parameter again.
#
(Read-only) Expands to the number of positional parameters, i.e., the size ofthe positional parameter stack in decimal.
0
(Read-only) Inside the scope of adefine d andcall ed macro this expands to the name of the calling macro, or to the emptystring if the macro is running from top-level.For the [Option]al regular expression search and replace operator ofvexprthis 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,`2',`3'etc.; positional parameters can be shifted off the stack by callingshift The parameter stack contains, for example, the arguments of acall eddefine d macro, the matching groups of the [Option]al regular expression searchand replace expression ofvexpr and can be explicitly created or overwritten with the commandvpospar
account
(Read-only) Is set to the activeaccount
add-file-recipients
(Boolean) When file or pipe recipients have been specified,mention them in the corresponding address fields of the message insteadof silently stripping them from their recipient list.By default such addressees are not mentioned.
allnet
(Boolean) Causes only the local part to be evaluatedwhen comparing addresses.
append
(Boolean) Causes messages saved in theSx secondary mailboxMBOXto 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 an interactive user for files to attach at theend of each message; An empty line finalizes the list.
askcc
(Boolean) Causes the interactive user to be prompted for carbon copyrecipients (at the end of each message ifaskatendorbsdcompatare set).
askbcc
(Boolean) Causes the interactive user to be prompted for blind carbon copyrecipients (at the end of each message ifaskatendorbsdcompatare set).
asksend
(Boolean) Causes the interactive user to be prompted for confirmation tosend the message or reenter compose mode after having been showna preliminary envelope summary.
asksign
(Boolean)[Option] Causes the interactive user to be prompted if the message isto be signed at the end of each message.Thesmime-signvariable is ignored when this variable is set.
asksub
(Boolean) Causes S-nail to prompt the interactive user for the subject uponentering compose mode unless a subject already exists.
attrlist
A sequence of characters to display in the`attribute'column of theheadlineas shown in the display ofheaders each for one type of messages (seeSx Message states ) ,with the default being`NUROSPMFAT+-$~'or`NU*HMFAT+-$~'if thebsdflagsvariable is set, in the following order:
`N'
new.
`U'
unread but old.
`R'
new but read.
`O'
read and old.
`S'
saved.
`P'
preserved.
`M'
mboxed.
`F'
flagged.
`A'
answered.
`T'
draft.
`+'
[v15 behaviour may differ] start of a (collapsed) thread in threaded mode (seeautosort thread )
`-'
[v15 behaviour may differ] an uncollapsed thread in threaded mode; only used in conjunction with-L
`$'
classified as spam.
`~'
classified as possible spam.
autobcc
Specifies a list of recipients to which a blind carbon copy of eachoutgoing message will be sent automatically.
autocc
Specifies a list of recipients to which a carbon copy of each outgoingmessage will be sent automatically.
autocollapse
(Boolean) Causes threads to be collapsed automatically when .Ql thread Nsedsortmode is entered (see thecollapsecommand).
autoprint
(Boolean) Enable automatictype ing of a(n existing)``successive''message afterdeleteandundeletecommands: the message that becomes the new``dot''is shown automatically, as viadpordt
autosort
Causes sorted mode (see thesortcommand) to be entered automatically with the value of this variable assorting method when a folder is opened, for example`set'autosort=thread .
bang
(Boolean) Enables the substitution of all not (reverse-solidus) escapedexclamation mark`!'characters by the contents of the last executed command for the!shell escape command and~! one of the compose modeSx COMMAND ESCAPES .If this variable is not set no reverse solidus stripping is performed.
bind-timeout
[Obsolete] Predecessor ofbind-inter-byte-timeout [v15 behaviour may differ] Setting this automatically sets the successor.
bind-inter-byte-timeout
[Option] Terminals may generate multi-byte sequences for special functionkeys, for example, but these sequences may not become read as a unit.And multi-byte sequences can be defined freely viabind This variable specifies the timeout in milliseconds that the MLE (seeSx On terminal control and line editor )waits for more bytes to arrive unless it considers a sequence``complete'' The default is 200, the maximum is about 10 seconds.In the following example the comments state which sequences areaffected by this timeout:
? bind base abc echo 0 # abc? bind base ab,c echo 1 # ab? bind base abc,d echo 2 # abc? bind base ac,d echo 3 # ac? bind base a,b,c echo 4? bind base a,b,c,d echo 5? bind base a,b,cc,dd echo 6 # cc and dd
bind-inter-key-timeout
[Option] Multi-keybindsequences do not time out by default.If this variable is set, then the current key sequence is forcefullyterminated once the timeout (in milliseconds) triggers.The value should be (maybe significantly) larger thanbind-inter-byte-timeout but may not excess the maximum, too.
bsdcompat
(Boolean) Sets some cosmetical features to traditional BSD style;has the same affect as settingaskatendand all other variables prefixed with`bsd';it also changes the behaviour ofemptystart(which does not exist in BSD).
bsdflags
(Boolean) Changes the letters shown in the first column of a headersummary to traditional BSD style.
bsdheadline
(Boolean) Changes the display of columns in a header summary to traditionalBSD 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~hSx COMMAND ESCAPES .
build-cc , build-ld , build-os , build-rest
(Read-only) The build environment, including the compiler, the linker, theoperating system S-nail has been build for, usually taken fromuname(1)via`uname'-s ,and then lowercased, as well as all the possibly interesting rest of theconfiguration and build environment.This information is also available in theverboseoutput of the commandversion
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 datawas performed.This defaults to US-ASCII, and the chosen character set should beUS-ASCII compatible.
charset-8bit
[Option] The default 8-bit character set that is used as an implicit lastmember of the variablesendcharsets This defaults to UTF-8 if character set conversion capabilities areavailable, and to ISO-8859-1 otherwise (unless the operating systemenvironment is known to always and exclusively support UTF-8 locales),in which case the only supported character set isttycharsetand this variable is effectively ignored.
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 notbe 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 ofcharset-8bitis used for this purpose.

This variable will also be taken into account if a MIME type (seeSx The mime.types files )of a MIME message part that uses the`binary'character set is forcefully treated as text.

cmd
The default value for thepipecommand.
colour-disable
(Boolean)[Option] Forcefully disable usage of colours.Also see the sectionSx Coloured display .
colour-pager
(Boolean)[Option] Whether colour shall be used for output that is paged throughPAGER Note that pagers may need special command line options, for exampleless(1)requires the option-Randlv(1)the option-cin order to support colours.Often doing manual adjustments is unnecessary since S-nail may performadjustments dependent on the value of the environment variablePAGER(see there for more).
contact-mail , contact-web
(Read-only) Addresses for contact per email and web, respectively, forbug reports, suggestions, or anything else regarding S-nail.The former can be used directly:`?'Ns Ic eval Ns Ic mail Ns $contact-mail .
content-description-forwarded-message

content-description-quote-attachment ,content-description-smime-message ,content-description-smime-signature[Option](partially) Strings which will be placed in according`Content-Description:'headers if non-empty.They all have default values, for example`Forwarded'message .
crt
In a(n interactive) terminal session, then if this valued variable isset it will be used as a threshold to determine how many lines the givenoutput has to span before it will be displayed via the configuredPAGER Usage of thePAGERcan be forced by setting this to the value`0',setting it without a value will deduce the current height of theterminal screen to compute the threshold (seeLINES screenandstty(1)).[v15 behaviour may differ] At the moment this uses the count of lines of the message in wireformat, which, dependent on themime-encodingof 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 orforwarded messages.A custom header consists of the field name followed by a colon`:'and the field content body.Standard header field names cannot be overwritten by a custom header,with the exception of`Comments:'and`Keywords:'Different to the command line option-Cthe variable value is interpreted as a comma-separated list of customheaders: to include commas in header bodies they need to become escapedwith reverse solidus`\'Headers can be managed more freely inSx Compose modevia~^
? set customhdr='Hdr1: Body1-1\, Body1-2, Hdr2: Body2'
datefield
Controls the appearance of the`%d'date and time format specification of theheadlinevariable, that is used, for example, when viewing the summary ofheaders If unset, then the local receiving date is used and displayedunformatted, otherwise the message sending`Date:'It is possible to assign astrftime(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 seedatefield-markout-older
datefield-markout-older
Only used in conjunction withdatefield Can be used to create a visible distinction of messages dated more thana day in the future, or older than six months, a concept comparable to the-loption of the POSIX utilityls(1).If set to the empty string, then the plain month, day and year of the`Date:'will be displayed, but astrftime(3)format string to control formatting can be assigned.The default is`%Y-%m-%d'
debug
(Boolean) (Almost) Enter a debug-only sandbox mode which generates manylog messages, disables the actual delivery of messages, and also impliesno recordas well asno save Also seeverbose
disposition-notification-send
(Boolean)[Option] Emit a`Disposition-Notification-To:'header (RFC 3798) with the message.This requires thefromvariable to be set.
dot
(Boolean) When dot is set, a period`.'on a line by itself during message input in (interactive or batch-# Sx Compose modewill be treated as end-of-message (in addition to thenormal end-of-file condition).This behaviour is implied inposixmode with a setignoreeof
dotlock-disable
(Boolean)[Option] Disable creation ofSx dotlock filesfor MBOX databases.
dotlock-ignore-error
[Obsolete](Boolean)[Option] Ignore failures when creatingSx dotlock files .Please usedotlock-disableinstead.
editalong
If this variable is set then the editor is started automatically whena message is composed in interactive mode.If the value starts with the letter`v'then this acts as if~v otherwise as if~e(see Sx COMMAND ESCAPES had been specified.Theeditheadersvariable 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``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-existentmailbox (the latter behaviour furtherly depends uponbsdcompat though).
errexit
(Boolean) Let each command with a non-0 exit status, including everycall ed macro whichreturn s a non-0 status, cause a program exit unless prefixed byignerr(seeSx Command modifiers ) .This also affectsSx COMMAND ESCAPES ,but which use a different modifier for ignoring the error.Please refer to the variable?for more on this topic.
errors-limit
[Option] Maximum number of entries in theerrorsqueue.
escape
The first character of this value defines the escape character forSx COMMAND ESCAPESinSx Compose mode .The default value is the character tilde`~'If set to the empty string, command escapes are disabled.
expandaddr
If unset only user name and email address recipients are allowedSx On sending mail, and non-interactive mode .If set without value all possible recipient types will be accepted.A value is parsed as a comma-separated list of case-insensitive strings,and if that contains`restrict'behaviour equals the former except when in interactive mode or ifSx COMMAND ESCAPESwere enabled via-~or-# in which case it equals the latter, allowing all address types.`restrict'really acts like`restrict,-all,+name,+addr',so care for ordering issues must be taken.

Recipient types can be added and removed with a plus sign`+'or hyphen-minus`-'prefix, respectively.By default invalid or disallowed types are filtered out andcause a warning, hard send errors need to be enforced by including`fail'The value`all'covers all types,`fcc'whitelists`Fcc:'header targets regardless of other settings,`file'file targets (it includes`fcc') ,`pipe'command pipeline targets,`name'user names still unexpanded afteraliasandmta-aliasesprocessing and thus left for expansion by themta(invalid for the built-in SMTP one), and`addr'network addresses.Targets are interpreted in the given order, so that`restrict,fail,+file,-all,+addr'will cause hard errors for any non-network address recipient addressunless running interactively or having been started with the option-~or-# in the latter case(s) any type may be used.

User name receivers addressing valid local users can be expanded tofully qualified network addresses (also seehostname by including`nametoaddr'in the list.Historically invalid recipients were stripped off without causingerrors, this can be changed by making`failinvaddr'an entry of the list (it really acts like`failinvaddr,+addr') .Likewise,`domaincheck'(really `domaincheck,+addr' compares address domain names against a whitelist and strips off( `fail'for hard errors) addressees which fail this test; the domain name`localhost'and the non-empty value ofhostname(the real hostname otherwise) are always whitelisted,expandaddr-domaincheckcan be set to extend this list.Finally some address providers (for example-b , cand all other command line recipients) will be evaluated asif specified within dollar-single-quotes (seeSx Shell-style argument quoting )if the value list contains the string`shquote'

expandaddr-domaincheck
Can be set to a comma-separated list of domain names which should bewhitelisted for the evaluation of the`domaincheck'mode ofexpandaddr IDNA encoding is not automatically performed,addrcodeccan be used to prepare the domain (of an address).
expandargv
Unless this variable is set additionalmta(Mail-Transfer-Agent)arguments from the command line, as can be given after a--separator, results in a program termination with failure status.The same can be accomplished by using the special (case-insensitive) value`fail'A lesser strict variant is the otherwise identical`restrict',which does accept such arguments in interactive mode, or if tildecommands were enabled explicitly by using one of the command line options-~or-# The empty value will allow unconditional usage.
features
(Read-only) String giving a list of optional features.Features are preceded with a plus sign`+'if they are available, with a hyphen-minus`-'otherwise.To ease substring matching the string starts and ends with a comma.The output of the commandversionincludes 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 recipientsincluded in the header of a message( reply , respond , followup into the uppercase variants, which by default address the sender only( Reply , Respond , Followup and vice versa.
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 doingSx Filename transformations ;also seefolderfor more on this topic, and know about standard imposed implications ofoutfolder The value supports a subset of transformations itself, and if thenon-empty value does not start with a solidus`/',then the value ofHOMEwill be prefixed automatically.Once the actual value is evaluated first, the internal variablefolder-resolvedwill be updated for caching purposes.
folder-hook-FOLDER , folder-hook
Names adefine dmacro which will be called whenever afolderis opened.The macro will also be invoked when new mail arrives,but message lists for commands executed from the macroonly include newly arrived messages then.localoptsare activated by default in a folder hook, causing the covered settingsto 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 underfolderthen the usual`+'specification is tried in addition, so that iffolderis``mail''(and thus relative to the user's home directory) then/home/usr1/mail/sentwill 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 offolderonce 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.The user as determined viafrom(or, if that contains multiple addresses,sender will be placed in there if any list addressee is not a subscribed list.Also seefollowup-to-honourand the commandsmlist , mlsubscribe , replyandLreply
followup-to-add-cc
(Boolean) Controls whether the user will be added to the messages'`Cc:'list in addition to placing an entry in`Mail-Followup-To:'(seefollowup-to )
followup-to-honour
Controls whether a`Mail-Followup-To:'header is honoured when group-replying to a message viareplyorLreply This is aSx quadoption ;if set without a value it defaults to``yes'' and seefollowup-to
forward-add-cc
(Boolean) Whether senders of messages forwarded via~F , ~f , ~m , ~Uor~ushall be made members of the carbon copies`Cc:'list.
forward-as-attachment
(Boolean) Original messages are normally sent as inline text with theforwardcommand,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 , forward-inject-tail
The strings to put before and after the text of a message with theforwardcommand, respectively.The former defaults to`--------'Original Message --------\n .Special format directives in these strings will be expanded if possible,and if so configured the output will be folded according toquote-fold for more please refer toquote-inject-head Injections will not be performed byforwardif the variableforward-as-attachmentis set --- theSx COMMAND ESCAPES~F , ~f , ~M , ~m , ~U , ~ualways inject.
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 thesendervariable is required iffromcontains more than one address.[v15 behaviour may differ] Please expect automatic management of thefromandsenderrelationship.Dependent on the context these addresses are handled as if they were inthe list ofalternates

If a file-based MTA is used, thenfrom(or, if that contains multiple addresses,sender can nonetheless be used as the envelope sender address at the MTAprotocol level (the RFC 5321 reverse-path), either via the-rcommand line option (without argument; see there for more), or by settingr-option-implicit

If the machine's hostname is not valid at the Internet (for example ata dialup machine), then either this variable orhostname([v15-compat] a SMTP-basedmtaadds even more fine-tuning capabilities withsmtp-hostname have to be set: if so the message and MIME part related unique ID fields`Message-ID:'and`Content-ID:'will be created (except when disallowed bymessage-id-disableorstealthmua )

fullnames
(Boolean) Due to historical reasons comments and name parts of emailaddresses are removed by default when sending mail, replying to orforwarding a message.If this variable is set such stripping is not performed.
fwdheading
[Obsolete] Predecessor offorward-inject-head
header
(Boolean) Causes the header summary to be written at startup and aftercommands that affect the number of messages or the order of messages inthe currentfolder Unless inposixmode a header summary will also be displayed on folder changes.The command line option-Ncan be used to setno header
headline
A format string to use for the summary ofheaders Format specifiers in the given string start with a percent sign`%'and may be followed by an optional decimal number indicating the fieldwidth --- if that is negative, the field is to be left-aligned.Names and addresses are subject to modifications according toshownameandshowto Valid format specifiers are:
`%%'
A plain percent sign.
`%>'
``Dotmark'' a space character but for the current message( ``dot'' for which it expands to`>'(dependent onheadline-plain )
`%<'
``Dotmark'' a space character but for the current message( ``dot'' for which it expands to`<'(dependent onheadline-plain )
`%$'
[Option] The spam score of the message, as has been classified via thecommandspamrate Shows only a replacement character if there is no spam support.
`%a'
Message attribute character (status flag); the actual content can beadjusted by settingattrlist
`%d'
The date found in the`Date:'header of the message whendatefieldis set (the default), otherwise the date when the message was received.Formatting can be controlled by assigning astrftime(3)format string todatefield(anddatefield-markout-older )
`%e'
The indenting level in`thread'Nsedsortmode.
`%f'
The address of the message sender.
`%i'
The message thread tree structure.(Note that this format does not support a field width, and honoursheadline-plain .
`%L'
Mailing list status: is the addressee of the message a known`l'( mlist or`L'mlsubscribe d mailing list?The letter`P'announces the presence of a RFC 2369`List-Post:'header, which makes a message a valuable target ofLreply
`%l'
The number of lines of the message, if available.
`%m'
Message number.
`%o'
The number of octets (bytes) in the message, if available.
`%S'
Message subject (if any) in double quotes.
`%s'
Message subject (if any).
`%t'
The position in threaded/sorted order.
`%U'
The value 0 except in an IMAP mailbox,where it expands to the UID of the message.

The default is`%>%a%m%-18f%16d%4l/%-5o%i%-s ,'or`%>%a%m%20-f%16d%3l/%-5o%i%-S'ifbsdcompatis set.Also seeattrlist headline-plainandheadline-bidi

headline-bidi
Bidirectional text requires special treatment when displaying headers,because numbers (in dates or for file sizes etc.) will not affect thecurrent text direction, in effect resulting in ugly line layouts whenarabic or other right-to-left text is to be displayed.On the other hand only a minority of terminals is capable to correctlyhandle direction changes, so that user interaction is necessary foracceptable 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 textfields that may occur when displayingheadline(and some other fields, like dynamic expansions inprompt with special Unicode control sequences;it is possible to fine-tune the terminal support level by assigninga value:no value (or any value other than`1',`2'and`3')will make S-nail assume that the terminal is capable to properly dealwith Unicode version 6.3, in which case text is embedded in a pair ofU+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 controlsequences onto the line).The values`2'and`3'select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latteragain reserves room for two spaces in addition.

headline-plain
(Boolean) On Unicode (UTF-8) aware terminals enhanced graphical symbols areused by default for certain entries ofheadline If this variable is set only basic US-ASCII symbols will be used.
history-file
[Option] The (expandable) location of a permanenthistoryfile for the MLE line editor( Sx On terminal control and line editor ) Also seehistory-size
history-gabby
[Option] Add more entries to the MLEhistoryas is normally done.A comma-separated list of case-insensitive strings can be used tofine-tune which gabby entries shall be allowed.If it contains`errors',erroneous commands will also be added.`all'adds all optional entries, and is the fallback chattiness identifier ofon-history-addition
history-gabby-persist
(Boolean)[Option] Thehistory-gabbyentries will not be saved in persistent storage unless this variable is set.The knowledge of whether a persistent entry was gabby is not lost.Also seehistory-file
history-size
[Option] Setting this variable imposes a limit on the number of concurrenthistoryentries.If set to the value 0 then no further history entries will be added,and loading and incorporation of thehistory-fileupon program startup can also be suppressed by doing this.Runtime changes will not be reflected before thehistoryis saved or loaded (again).
hold
(Boolean) This setting controls whether messages are held in the systeminbox and it is set by default.
hostname
Used instead of the value obtained fromuname(3)andgetaddrinfo(3)as the hostname when expanding local addresses, for example in`From:'(also seeSx On sending mail, and non-interactive mode ,for expansion of addresses that have a valid user-, but no domainname in angle brackets).If either offromor this variable is set the message and MIME part related unique ID fields`Message-ID:'and`Content-ID:'will be created (except when disallowed bymessage-id-disableorstealthmua ) If the [Option]al IDNA support is available (seeidna-disable variable assignment is aborted when a necessary conversion fails.

Setting it to the empty string will cause the normal hostname to beused, but nonetheless enables creation of said ID fields.[v15-compat] in conjunction with the built-in SMTPmtasmtp-hostnamealso influences the results:one should produce some test messages with the desired combination ofhostname and/orfrom senderetc. first.

idna-disable
(Boolean)[Option] Can be used to turn off the automatic conversion of domainnames according to the rules of IDNA (internationalized domain namesfor applications).Since the IDNA code assumes that domain names are specified with thettycharsetcharacter set, an UTF-8 locale charset is required to represent allpossible international domain names (before conversion, that is).
ifs
The input field separator that is used ([v15 behaviour may differ] by some functions) todetermine 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 extractedand assigned to the variableifs-ws
a.
ifs-wswill 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 ofifswill cause field-splitting, any adjacentifs-wscharacters will be skipped.
ifs-ws
(Read-only) Automatically deduced from the whitespace characters inifs
ignore
(Boolean) Ignore interrupt signals from the terminal while enteringmessages; instead echo them as`@'characters and discard the current line.
ignoreeof
(Boolean) Ignore end-of-file conditions( `control-D' inSx Compose modeon message input and in interactive command input.If set an interactive command input session can only be left byexplicitly using one of the commandsexitandquit and message input in compose mode can only be terminated by enteringa period`.'on a line by itself or by using the~.Sx COMMAND ESCAPES ;Setting this implies the behaviour thatdotdescribes inposixmode.
inbox
If this is set to a non-empty string it will specify the user'sSx primary system mailbox ,overridingMAILand the system-dependent default, and (thus) be used to replace`%'when doingSx Filename transformations ;also seefolderfor more on this topic.The value supports a subset of transformations itself.
indentprefix
String used by the~m , ~Mand~RSx COMMAND ESCAPESand by thequoteoption for indenting messages,in place of the POSIX mandated default tabulator character`\t'Also seequote-chars
keep
(Boolean) If set, an emptySx primary system mailboxfile is not removed.Note that, in conjunction withposixmode any empty file will be removed unless this variable is set.This may improve the interoperability with other mail user agentswhen using a common folder directory, and prevents malicious usersfrom creating fake mailboxes in a world-writable spool directory.[v15 behaviour may differ] Only local regular (MBOX) files are covered, Maildir and othermailbox types will never be removed, even if empty.
keep-content-length
(Boolean) When (editing messages and) writing MBOX mailbox files S-nail canbe 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 headerfields (which in itself shows one of their conceptual problems),stripping them should increase interoperability in between MUAs thatwork with with same mailbox files.Note that, if this is not set butwritebackedited as below, is, a possibly performed automatic stripping of these headerfields already marks the message as being modified.[v15 behaviour may differ] At some future time S-nail will be capable to rewrite and apply anmime-encodingto modified messages, and then those fields will be stripped silently.
keepsave
(Boolean) When a message is saved it is usually discarded from theoriginating folder when S-nail is quit.This setting causes all saved message to be retained.
line-editor-cpl-word-breaks
[Option] List of bytes which are used by themle-completetabulator completion to decide where word boundaries exist, by default`'@=;|:'[v15 behaviour may differ] This mechanism is yet restricted.
line-editor-disable
(Boolean) Turn off any line editing capabilities (from S-nails POW, seeSx On terminal control and line editorfor 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( folder possibly abbreviated for display purposes.
mailbox-resolved
(Read-only) The fully resolved path of the current mailbox.
mailcap-disable
(Boolean)[Option] Turn off consideration of MIME type handlers from,and implicit loading ofSx The Mailcap files .
mailx-extra-rc
An additional startup file that is loaded as the last of theSx Resource files .Use this file for commands that are not understood by other POSIXmailx(1)implementations, i.e., mostly anything which is not covered bySx Initial settings .
markanswered
(Boolean) When a message is replied to and this variable is set,it is marked as having beenanswered See the sectionSx Message states .
mbox-fcc-and-pcc
(Boolean) By default all file and pipe message receivers (seeexpandaddr will be fed valid MBOX database entry message data (seefolder mbox-rfc4155 ) and existing file targets will become extended in compliance to RFC 4155.If this variable is unset then a plain standalone RFC 5322 message willbe written, and existing file targets will be overwritten.
mbox-rfc4155
(Boolean) When opening MBOX mailbox databases, and in order to achievecompatibility with old software, the very tolerant POSIX standard rulesfor detecting message boundaries (so-called`From_'lines) are used instead of the stricter rules from the standard RFC 4155.This behaviour can be switched by setting this variable.

This may temporarily be handy when S-nail complains about invalid`From_'lines when opening a MBOX: in this case setting this variable andre-opening the mailbox in question may correct the result.If so, copying the entire mailbox to some other file, as in`copy'* SOME-FILE ,will perform proper, all-compatible`From_'quoting for all detected messages, resulting in a valid MBOX mailbox.([v15 behaviour may differ] The better and non-destructive approach is to re-encode invalidmessages, as if it would be created anew, instead of mangling the`From_'lines; this requires the structural code changes of the v15 rewrite.)Finally the variable can be unset again:

define mboxfix { localopts yes; wysh set mbox-rfc4155;\ wysh File "${1}"; copy * "${2}"}call mboxfix /tmp/bad.mbox /tmp/good.mbox
memdebug
(Boolean) Internal development variable.(Keeps memory debug enabled even ifdebugis not set.)
message-id-disable
(Boolean) By setting this variable the generation of`Message-ID:'and`Content-ID:'message and MIME part headers can be completely suppressed, effectivelyleaving this task up to themta(Mail-Transfer-Agent) or the SMTP server.Note that according to RFC 5321 a SMTP server is not required to add thisfield 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 thewyshprefix whenset 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 thewyshprefix whenset ting the variable(s) instead).Also seeon-compose-leave
metoo
(Boolean) Usually, when analiasexpansion contains the sender, the sender is removed from the expansion.Setting this option suppresses these removals.Note that a setmetooalso causes a`-m'option to be passed through to themta(Mail-Transfer-Agent); though most of the modern MTAs no longer documentthis flag, no MTA is known which does not support it (for historicalcompatibility).
mime-allow-text-controls
(Boolean) When sending messages, each part of the message is MIME-inspectedin order to classify the`Content-Type:'and`Content-Transfer-Encoding:'(seemime-encoding that is required to send this part over mail transport, i.e.,a computation rather similar to what thefile(1)command produces when used with the`--mime'option.

This classification however treats text files which are encoded inUTF-16 (seen for HTML files) and similar character sets as binaryoctet-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 automaticallyinterpret the contents of the part.

If this variable is set, and the data was unambiguously identified astext 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 whendisplaying messages, provided that a handler exists which producesoutput that can be (re)integrated into S-nail's normal visual display.
mime-counter-evidence
Normally the`Content-Type:'field is used to decide how to handle MIME parts.Some MUAs, however, do not useSx The mime.types files(also seeSx HTML mail and MIME attachments )or a similar mechanism to correctly classify content, but specify anunspecific MIME type( `application/octet-stream' even for plain text attachments.If this variable is set then S-nail will try to re-classify such MIMEmessage parts, if possible, for example via a possibly existingattachment filename.A non-empty value may also be given, in which case a number is expected,actually a carrier of bits, best specified as a binary value, like`0b1111'
  • If bit two is set (counting from 1, decimal 2) then the detectedmimetypewill be carried along with the message and be used for deciding whichMIME handler is to be used, for example;when displaying such a MIME part the part-info will indicate theoverridden content-type by showing a plus sign`+'
  • If bit three is set (decimal 4) then the counter-evidence is alwaysproduced and a positive result will be used as the MIME type, evenforcefully overriding the parts given MIME type.
  • If bit four is set (decimal 8) as a last resort the actual content of`application/octet-stream'parts will be inspected, so that data which looks like plain text can betreated as such.This mode is even more relaxed when data is to be displayed to the useror used as a message quote (data consumers which mangle data for displaypurposes, which includes masking of control characters, for example).
mime-encoding
The MIME`Content-Transfer-Encoding'to use in outgoing text messages and message parts, where applicable(7-bit clean text messages are without an encoding if possible):
`8bit'
(Or `8b'8-bit transport effectively causes the raw data be passed throughunchanged, but may cause problems when transferring mail messages overchannels that are not ESMTP (RFC 1869) compliant.Also, several input data constructs are not allowed by thespecifications and may cause a different transfer-encoding to be used.By established rules and popular demand occurrences of`^From_'(seembox-rfc4155 will be MBOXO quoted (prefixed with greater-than sign`>')instead of causing a non-destructive encoding like`quoted-printable'to be chosen, unless context (like message signing) requires otherwise.
`quoted-printable'
(Or `qp'Quoted-printable encoding is 7-bit clean and has the property that ASCIIcharacters are passed through unchanged, so that an english message canbe read as-is; it is also acceptable for other single-byte locales thatshare many characters with ASCII, for example ISO-8859-1.The encoding will cause a large overhead for messages in other charactersets: for example it will require up to twelve (12) bytes to encodea single UTF-8 character of four (4) bytes.It is the default encoding.
`base64'
(Or `b64'This encoding is 7-bit clean and will always be used for binary data.This encoding has a constant input:output ratio of 3:4, regardless ofthe character set of the input data it will encode three bytes of inputto four bytes of output.This transfer-encoding is not human readable without performinga decoding step.
mime-force-sendout
(Boolean)[Option] Whenever it is not acceptable to fail sending out messagesbecause of non-convertible character content this variable may be set.It will, as a last resort, classify the part content as`application/octet-stream'Please refer to the sectionSx Character setsfor the complete picture of character set conversion, andSx HTML mail and MIME attachmentsfor how to internally or externally handle part content.
mimetypes-load-control
Can be used to control which ofSx The mime.types filesare loaded: if the letter`u'is part of the option value, then the user's personal~/.mime.typesfile will be loaded (if it exists); likewise the letter`s'controls loading of the system wide/etc/mime.types directives found in the user file take precedence, letter matching iscase-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 viamimetype )

More sources can be specified by using a different syntax: if thevalue string contains an equals sign`='then it is instead parsed as a comma-separated list of the describedletters plus`f=FILENAME'pairs; the given filenames will be expanded and loaded, and theircontent may use the extended syntax that is described in the sectionSx The mime.types files .Directives found in such files always take precedence (are prepended tothe MIME type cache).

mta
Select an alternate Mail-Transfer-Agent by either specifying the fullpathname of an executable (a`file://'prefix may be given), or [Option]ally a SMTP aka SUBMISSION protocol URL [v15-compat]:
submissions://[user[:password]@]server[:port]

([no v15-compat]:`[smtp://]server[:port]'The default has been chosen at compile time.MTA data transfers are always performed in asynchronous child processes,and without supervision unless either thesendwaitor theverbosevariable is set.Also seemta-bcc-ok [Option]ally expansion ofaliases(5)can be performed by settingmta-aliases

For testing purposes there is the`test'pseudo-MTA, which dumps to standard output or optionally to a file,and honoursmbox-fcc-and-pcc

$ echo text | s-nail -:/ -Smta=test -s ubject ex [at] am.ple$ </dev/null s-nail -:/ -Smta=test://./xy ex [at] am.ple

For a file-based MTA it may be necessary to setmta-argv0in in order to choose the right target of a modernmailwrapper(8)environment.It will be passed command line arguments from several possible sources:from the variablemta-argumentsif set, from the command line if given and the variableexpandargvallows their use.Argument processing of the MTA will be terminated with a--separator.

The otherwise occurring implicit usage of the following MTA commandline arguments can be disabled by setting the boolean variablemta-no-default-arguments(which will also disable passing--to the MTA):-i(for not treating a line with only a dot`.'character as the end of input),-m(shall the variablemetoobe set) and-v(if theverbosevariable is set); in conjunction with the-rcommand line option orr-option-implicit-fas well as possibly-Fwill (not) be passed.

[Option]ally S-nail can send mail over SMTP aka SUBMISSION networkconnections to a single defined smart host by setting this variable toa SMTP or SUBMISSION URL (seeSx On URL syntax and credential lookup ) .An authentication scheme can be specified via the variable chainsmtp-auth Encrypted network connections are [Option]ally available, the sectionSx Encrypted network communicationshould give an overview and provide links to more information on this.Note that with some mail providers it may be necessary to set thesmtp-hostnamevariable in order to use a specific combination offrom hostnameandmta Network communication socket timeouts are configurable viasocket-connect-timeout All generated network traffic may be proxied over a SOCKSsocks-proxy it can be logged by settingverbosetwice.The following SMTP variants may be used:

  • The plain SMTP protocol (RFC 5321) that normally lives on theserver port 25 and requires setting thesmtp-use-starttlsvariable to enter a TLS encrypted session state.Assign a value like [v15-compat]`smtp://[user[:password]@]server[:port]'([no v15-compat]`smtp://server[:port]')to choose this protocol.
  • The so-called SMTPS which is supposed to live on server port 465and is automatically TLS secured.Unfortunately it never became a standardized protocol and may thus notbe supported by your hosts network service database- in fact the port number has already been reassigned to otherprotocols!

    SMTPS is nonetheless a commonly offered protocol and thus can bechosen 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 explicitlyspecify the port as`:465',however.

  • The SUBMISSION protocol (RFC 6409) lives on server port 587 andis identically to the SMTP protocol from S-nail's point of view;it requires settingsmtp-use-starttlsto enter a TLS secured session state; e.g., [v15-compat]`submission://[user[:password]@]server[:port]'
  • The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and isTLS secured by default.It can be chosen by assigning a value like [v15-compat]`submissions://[user[:password]@]server[:port]'Due to the problems mentioned for SMTPS above and the fact thatSUBMISSIONS is new and a successor that lives on the same port as thehistorical engineering mismanagement named SMTPS, it is usuallynecessary to explicitly specify the port as`:465'
mta-aliases
[Option] If set to a path pointing to a text file in valid MTA (Postfix)aliases(5)format, the file is loaded and cached (manageable withmtaaliases ) and henceforth plain`name'(seeexpandaddr message receiver names are recursively expanded as a last expansionstep, after the distribution lists which can be created withalias Constraints onaliases5content support: only local addresses (names) which are valid usernames( `[a-z_][a-z0-9_-]*[$]?' are treated as expandable aliases, and [v15 behaviour may differ]`:include:/file/name'directives are not supported.By including`-name'inexpandaddrit can be asserted that only expanded names (mail addresses) are passedthrough to the MTA.
mta-arguments
Arguments to pass through to a file-basedmta(Mail-Transfer-Agent), parsed according toSx Shell-style argument quotinginto an array of arguments which will be joined onto MTA optionsfrom other sources, for example`?'wysh set mta-arguments='-t -X /tmp/my log' .
mta-no-default-arguments
(Boolean) Avoids passing standard command line options to a file-basedmta(please see there).
mta-no-receiver-arguments
(Boolean) By default all receiver addresses will be passed as command lineoptions to a file-basedmta Setting this variable disables this behaviour to aid those MTAs whichemploy special treatment of such arguments.Doing so can make it necessary to pass a-tviamta-arguments to testify the MTA that it should use the passed message as a template.
mta-argv0
Many systems use a so-calledmailwrapper(8)environment to ensure compatibility withsendmail(1).This works by inspecting the name that was used to invoke the maildelivery system.If this variable is set then the mailwrapper (the program that isactually executed when calling the file-basedmta will treat its contents as that name.
mta-bcc-ok
(Boolean) In violation of RFC 5322 some MTAs do not remove`Bcc:'header lines from transported messages after having noted the respectivereceivers for addressing purposes.(The MTAs Exim and Courier for example require the command line option-tto enforce removal.)Unless this is set corresponding receivers are addressed byprotocol-specific means or MTA command line options only, the headeritself is stripped before being sent over the wire.
netrc-lookup-USER [at] HOST , netrc-lookup-HOST , netrc-lookup
(Boolean)[v15-compat][Option] Used to control usage of the user's~/.netrcfile for lookup of account credentials, as documented in the sectionSx On URL syntax and credential lookupand for the commandnetrc the sectionSx The .netrc filedocuments the file format.Also seenetrc-pipe
netrc-pipe
[v15-compat][Option] When~/.netrcis loaded (seenetrcandnetrc-lookup then S-nail will read the output of a shell pipe instead of the user's~/.netrcfile if this variable is set (to the desired shell command).This can be used to, for example, store~/.netrcin encrypted form:`?'set netrc-pipe='gpg -qd ~/.netrc.pgp' .
newfolders
[Option] 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 onlytimestamp changes are detected.Maildir folders are [Option]al.
outfolder
(Boolean) Causes a non-absolute filename specified inrecord as well as the sender-based filenames of theCopy Save Followupandfollowupcommands to be interpreted relative to thefolderdirectory rather than relative to the current directory.
on-account-cleanup-ACCOUNT , on-account-cleanup
Macro hook which will be called once anaccountis left, as the very last step before unrolling per-accountlocalopts This hook is run even in case of fatal errors, including those generatedby switching to the account as such, and it is advisable to perform onlyabsolutely necessary actions, like cleaning upalternates 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 modelocalopts This hook is run even in case of fatal errors, and it is advisable toperform only absolutely necessary actions, like cleaning upalternates for example.

For compose mode hooks that may affect the message content please seeon-compose-enter , on-compose-leave , on-compose-splice [v15 behaviour may differ] This hook exists becausealias , alternates , commandalias , shortcut to name a few, are neither covered bylocaloptsnor bylocal 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, respectively;the exact order of the steps taken is documented for~. one of theSx COMMAND ESCAPES .Context about the message being worked on can be queried viadigmsg localoptsare enabled for these hooks, and changes on variables will be forgottenafter the message has been sent.on-compose-cleanupcan be used to perform other necessary cleanup steps.

Here is an example that injects a signature viamessage-inject-tail instead usingon-compose-spliceto simply inject the file of desire via~<or~<!may be a better approach.

define t_ocl { vput ! i cat ~/.mysig if $? -eq 0 vput csop message-inject-tail trim-end $i end # Alternatively readctl create ~/.mysig if $? -eq 0 readall i if $? -eq 0 vput csop 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 theon-compose-leavemacro hook is called etc.Both hooks will be executed in a subprocess, with their input and outputconnected to S-nail such that they can act as if they would be aninteractive user.The difference in between them is that the latter is aSHELLcommand, whereas the former is a normaldefine d macro, but which is restricted to a small set of commands (theverboseoutput of for examplelistwill indicate said capability).localoptsare enabled for these hooks (in the parent process), causing any settingto be forgotten after the message has been sent;on-compose-cleanupcan be used to perform other cleanup as necessary.

During execution of these hooks S-nail will temporarily forget whether ithas been started in interactive mode, (a restricted set of)Sx COMMAND ESCAPESwill always be available, and for guaranteed reproducibilities sakeescapeandifswill be set to their defaults.The compose mode command~^has been especially designed for scriptability (via these hooks).The first line the hook will read on its standard input is the protocolversion of said command escape, currently``0 0 2'' 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 thesame time, or one does not expect more input but the other is stuckwaiting for consumption of its output, etc.There is no automatic synchronization of the hook: it will not bestopped automatically just because it, e.g., emits`~x'The hooks will however receive a termination signal if the parent entersan 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 anisolated session, which is signalled in its entirety as necessary.

define ocs_signature { read version echo '~< ~/.mysig' # '~<! fortune pathtofortunefile'}set on-compose-splice=ocs_signaturewysh 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 csop es subs "${hl}" 0 1 if "$es" != 2 echo*rr 'Cannot read header list'; echo '~x'; xit endif if "$hl" !%?case ' cc' echo '~^h i cc "Diet is your <mirr.or>"'; read es;\ vput csop es substring "${es}" 0 1 if "$es" != 2 echo*rr 'Cannot insert Cc: header'; echo '~x' # (no xit, macro finishes anyway) endif endif}set on-compose-splice=ocsm
on-history-addition
This hook will be called if an entry is about to be added to thehistoryof the MLE, as documented inSx On terminal control and line editor .It will be called with three arguments: the first is the name of theinput context (seebind ) the second is either an empty string or the matchinghistory-gabbytype, and the third being the complete command line to be added.The entry will not be added to history if the hook uses a non-0return [v15 behaviour may differ] A future version will give the expanded command name as the thirdargument, followed by the tokenized command line as parsed in theremaining arguments, the first of which is the original unexpandedcommand name; i.e., one may do`shift'Ns 4and will then be able to access the positional parameters as usual via* , # , 1etc.
on-main-loop-tick
This hook will be called whenever the program's main event loop isabout to read the next input line.Note variable and other changes it performs are not scoped as vialocalopts
on-program-exit
This hook will be called when the program exits, whether viaexitorquit or because the send mode is done.Note:this runs late and so terminal settings etc. are already teared down.
on-resend-cleanup
[v15 behaviour may differ] Identical toon-compose-cleanup but is only triggered byresend
on-resend-enter
[v15 behaviour may differ] Identical toon-compose-enter but is only triggered byresend currently there is nodigmsgsupport, for example.
page
(Boolean) If set, each message feed through the command given forpipeis followed by a formfeed character`\f'
password-USER [at] HOST , password-HOST , password
[v15-compat] Variable chain that sets a password, which is used in case none hasbeen given in the protocol and account-specific URL;as a last resort S-nail will ask for a password on the user's terminal ifthe 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 [at] 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 thepipecommand without performing MIME and character set conversions.
pipe-EXTENSION
Identical topipe-TYPE/SUBTYPEexcept that`EXTENSION'(normalized to lowercase using character mappings of the ASCII charset)denotes a file extension, for example`xhtml'Handlers registered using this method take precedence.
pipe-TYPE/SUBTYPE
A MIME message part identified as`TYPE/SUBTYPE'(case-insensitive, normalized to lowercase using character mappings ofthe ASCII charset) is displayed or quoted,its text is filtered through the value of this variable interpreted asa shell command.Unless noted only parts displayable as inline plain text (seecopiousoutput are covered, other MIME parts will only be considered by and formimeview

The special value question mark`?'forces interpretation of the message part as plain text, for example`set'pipe-application/xml=? .(This can also be achieved by adding a MIME type-marker viamimetype . [Option]ally MIME type handlers may be defined viaSx The Mailcap filesto which should be referred to for documentation of flags likecopiousoutput Question mark is indeed a trigger character to indicate flags thatadjust behaviour and usage of the rest of the value, the shell command,for example:

? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}'
`*'
The command output can be reintegrated into this MUA's normal processing:copiousoutput Implied when using a plain`'
`#'
Only use this handler for display, not for quoting a message:x-mailx-noquote
`&'
Run the command asynchronously, do not wait for the handler to exit:x-mailx-async The standard output of the command will go to/dev/null
`!'
The command must be run on an interactive terminal, the terminal willtemporarily be released for it to run:needsterminal
`+'
Request creation of a zero-sized temporary file, the absolute pathnameof which will be made accessible via the environment variableMAILX_FILENAME_TEMPORARY x-mailx-tmpfile If given twice then the file will be unlinked automatically by S-nailwhen the command loop is entered again at latest:x-mailx-tmpfile-unlink it is an error to use automatic deletion in conjunction withx-mailx-async
`='
Normally the MIME part content is passed to the handler via standardinput; with this the data will instead be written intoMAILX_FILENAME_TEMPORARY( x-mailx-tmpfile-fill the creation of which is implied; in order to cause automatic deletionof the temporary file two plus signs`++'still have to be used.
`t'
Text type-marker: display this as normal plain text (for type-markers:Sx The mime.types files ) .Identical to only giving plain`?',impliescopiousoutput
`h'
[Option] HTML type-marker: display via built-in HTML-to-text filter.Impliescopiousoutput
`?'
To avoid ambiguities with normal shell command content anotherquestion mark can be used to forcefully terminate interpretation ofremaining characters.(Any character not in this list will have the same effect.)

Some information about the MIME part to be displayed is embedded intothe environment of the shell command:

MAILX_CONTENT
The MIME content-type of the part, if known, the empty string otherwise.
MAILX_CONTENT_EVIDENCE
Ifmime-counter-evidenceincludes the carry-around-bit (2), then this will be set to the detectedMIME content-type; not only then identical toMAILX_CONTENTotherwise.
MAILX_EXTERNAL_BODY_URL
MIME parts of type`message/external-body'access-type=urlwill store the access URL in this variable, it is empty otherwise.URL targets should not be activated automatically, without supervision.
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 prefixthis variable will be set and contain the absolute pathname of thetemporary file.
pop3-auth-USER [at] HOST , pop3-auth-HOST , pop3-auth
[Option][v15-compat] Variable chain that sets the POP3 authentication method.Supported are the default`plain',[v15-compat]`oauthbearer'(seeSx FAQentrySx But, how about XOAUTH2 / OAUTHBEARER? ) ,as well as [v15-compat]`external'and`externanon'for TLS secured connections which pass a client certificate viatls-config-pairs There may be the [Option]al method [v15-compat]`gssapi'`externanon'does not need any user credentials,`external'and`gssapi'need auser the remains also require apassword `externanon'solely builds upon the credentials passed via a client certificate,and is usually the way to go since tested servers do not actually followRFC 4422, and fail if additional credentials are actually passed.Unlesspop3-no-apopis set the`plain'method will [Option]ally be replaced with APOP if possible (see there).
pop3-bulk-load-USER [at] HOST , pop3-bulk-load-HOST , pop3-bulk-load
(Boolean)[Option] When accessing a POP3 server S-nail loads the headers ofthe messages, and only requests the message bodies on user request.For the POP3 protocol this means that the message headers will bedownloaded twice.If this variable is set then S-nail will download only complete messagesfrom the given POP3 server(s) instead.
pop3-keepalive-USER [at] 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 [at] HOST , pop3-no-apop-HOST , pop3-no-apop
(Boolean)[Option] Unless this variable is set the MD5 based`APOP'authentication method will be used instead of a chosen`plain'pop3-authwhen connecting to a POP3 server that advertises support.The advantage of`APOP'is that only a single packet is sent for the user/password tuple.(Originally also that the password is not sent in clear text over thewire, but for one MD5 does not any longer offer sufficient security,and then today transport is almost ever TLS secured.)Note thatpop3-no-apop-HOSTrequires [v15-compat].
pop3-use-starttls-USER [at] HOST , pop3-use-starttls-HOST , pop3-use-starttls
(Boolean)[Option] Causes S-nail to issue a`STLS'command to make an unencrypted POP3 session TLS encrypted.This functionality is not supported by all servers,and is not used if the session is already encrypted by the POP3S method.Note thatpop3-use-starttls-HOSTrequires [v15-compat].
posix
(Boolean) This flag enables POSIX mode, which changes behaviour of S-nailwhere that deviates from standardized behaviour.It is automatically squared with the environment variablePOSIXLY_CORRECT changing the one will adjust the other.The following behaviour is covered and enforced by this mechanism:
  • In non-interactive mode, any error encountered while loading resourcefiles during program startup will cause a program exit, whereas ininteractive 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 usingignerr one of theSx Command modifiers ,for each command which shall be allowed to fail.
  • alternateswill replace the list of alternate addresses instead of appending to it.In addition alternates will only be honoured for any sort of messagereply and for aliases.
  • The variable insertingSx COMMAND ESCAPES~A ~a ~Iand~iwill expand embedded character sequences`\t'horizontal tabulator and`\n'line feed.[v15 behaviour may differ] For compatibility reasons this step will always be performed.
  • Reading in messages via~f( Sx COMMAND ESCAPES will use the`type'not the`forward'headerpickselection.
  • Upon changing the activefolderno summary ofheaderswill be displayed even ifheaderis set.
  • Settingignoreeofimplies the behaviour described bydot
  • The variablekeepis extended to cover any empty mailbox, not only emptySx primary system mailbox Nses: they will be removed when they are left in empty state otherwise.
  • Each command has an exit?and error!status that overwrites that of the last command.In POSIX mode the program exit status will signal failure regardlessunless all messages were successfully sent out to themta also seesendwait
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 treated as if specifiedwithin dollar-single-quotes (seeSx Shell-style argument quoting ) .This (post-assignment, i.e., second) expansion can be used to embedstatus information, for example? ! accountormailbox-display

In order to embed characters which should not be counted whencalculating the visual width of the resulting string, enclose thecharacters of interest in a pair of reverse solidus escaped brackets:`\[\E[0m\]';a slot for coloured prompts is also available with the [Option]al commandcolour Prompting may be prevented by setting this to the null string(aka`set'noprompt ) .

prompt2
This string is used for secondary prompts, but is otherwise identical toprompt The default is`..'
quiet
(Boolean) Suppresses the printing of the version when first invoked.
quote
If set messages processed by variants offollowupandreplywill start with the original message, lines of which prefixed byindentprefix taking into accountquote-charsandquote-fold No headers will be quoted when set without value or for`noheading',for`headers'the`type'headerpickselection will be included in the quote,`allbodies'embeds the (body) contents of all MIME parts, and`allheaders'also includes all headers.The quoted message will be enclosed by the expansions ofquote-inject-headandquote-inject-tail Also seequote-add-cc quote-as-attachmentand~Q one of theSx COMMAND ESCAPES .
quote-add-cc
(Boolean) Whether senders of messages quoted via~Qshall be made members of the carbon copies`Cc:'list.
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 ofquote
quote-chars
Can be set to a string consisting of non-whitespace ASCII characterswhich shall be treated as quotation leaders, the default being`>|}:'
quote-fold
[Option] Can be set in addition toindentprefix and creates a more fancy quotation in that leading quotation characters( quote-chars are compressed and overlong lines are folded.quote-foldcan be set to either one, two or three (space separated) numeric values,which are interpreted as the maximum (goal) and the minimum line length,respectively, in a spirit rather equal to thefmt(1)program, but line- instead of paragraph-based.The third value is used as the maximum line length instead of the firstif no better break point can be found; it is ignored unless it is largerthan the minimum and smaller than the maximum.If not set explicitly the minimum will reflect the goal algorithmically.The goal cannot be smaller than the length ofindentprefixplus some additional pad; necessary adjustments take place silently.
quote-inject-head , quote-inject-tail
The strings to put before and after the text of aquote d message, if non-empty, and respectively.The former defaults to`%f'wrote:\n\n .Special format directives will be expanded if possible, and if soconfigured the output will be folded according toquote-fold Format specifiers in the given strings start with a percent sign`%'and expand values of the original message, unless noted otherwise.Note that names and addresses are not subject to the setting ofshowto Valid format specifiers are:
`%%'
A plain percent sign.
`%a'
The address(es) of the sender(s).
`%d'
The date found in the`Date:'header of the message whendatefieldis set (the default), otherwise the date when the message was received.Formatting can be controlled by assigning astrftime(3)format string todatefield(anddatefield-markout-older )
`%f'
The full name(s) (name and address, as given) of the sender(s).
`%i'
The`Message-ID:'
`%n'
The real name(s) of the sender(s) if there is one andshownameallows usage, the address(es) otherwise.
`%r'
The senders real name(s) if there is one, the address(es) otherwise.
r-option-implicit
(Boolean) Setting this option evaluates the contents offrom(or, if that contains multiple addresses,sender and passes the results onto the used (file-based) MTA as described for the-roption (empty argument case).
recipients-in-cc
(Boolean) When doing areply the original`From:'and`To:'as well as addressees which possibly came in via`Reply-To:'and`Mail-Followup-To:'are by default merged into the new`To:'If this variable is set a sensitive algorithm tries to place in`To:'only the sender of the message being replied to, others are placed in`Cc:'
record
Unless this variable is defined, no copies of outgoing mail will be saved.If defined it gives the pathname, subject to the usualSx Filename transformations ,of a folder where all new, replied-to or forwarded messages are saved:when saving to this folder fails the message is not sent, but insteadsave d toDEAD The standard defines that relative (fully expanded) paths are to beinterpreted relative to the current directory( cwd to force interpretation relative tofolderoutfolderneeds to be set in addition.
record-files
(Boolean) If this variable is set the meaning ofrecordwill be extended to cover messages which target only file and piperecipients (seeexpandaddr ) These address types will not appear in recipient lists unlessadd-file-recipientsis also set.
record-resent
(Boolean) If this variable is set the meaning ofrecordwill be extended to also cover theresendandResendcommands.
reply-in-same-charset
(Boolean) If this variable is set S-nail first tries to use the samecharacter set of the original message for replies.If this fails, the mechanism described inSx Character setsis evaluated as usual.
reply-strings
Can be set to a comma-separated list of (case-insensitive according toASCII rules) strings which shall be recognized in addition to thebuilt-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 thealternateslist.
replyto
[Obsolete] Variant ofreply-to
reply-to-honour
Controls whether a`Reply-To:'header is honoured when replying to a message viareplyorLreply This is aSx quadoption ;if set without a value it defaults to``yes''
reply-to-swap-in
Standards like DKIM and (in conjunction with) DMARC caused manySx Mailing liststo use sender address rewriting in the style of`Name'via List <list [at] address> ,where the original sender address often being placed in`Reply-To:'If this is set and a`Reply-To:'exists, and consists of only one addressee (!), then that is used inplace of the pretended sender.This works independently fromreply-to-honour The optional value, a comma-separated list of strings, offers morefine-grained control on when swapping shall be used; for now supported ismlist here swapping occurs if the sender is a mailing-list as defined bymlist
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, also seembox-rfc4155
save
(Boolean) Enable saving of (partial) messages inDEADupon interrupt or delivery error.
screen
The number of lines that represents a``screenful''of lines, used inheaderssummary display,fromsearch ing, messagetop line display and scrolling viaz If this variable is not set S-nail falls back to a calculation based uponthe detected terminal window size and the baud rate: the faster theterminal, the more will be shown.Overall screen dimensions and pager usage is influenced by theenvironment variablesCOLUMNSandLINESand the variablecrt
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 inoutgoing internet mail.The value of the variablecharset-8bitis automatically appended to this list of character sets.If no character set conversion capabilities are compiled into S-nail thenthe only supported charset isttycharset Also seesendcharsets-else-ttycharsetand refer to the sectionSx Character setsfor the complete picture of character set conversion in S-nail.
sendcharsets-else-ttycharset
(Boolean)[Option] If this variable is set, butsendcharsetsis not, then S-nail acts as ifsendcharsetshad been set to the value of the variablettycharset In effect this combination passes through the message data in thecharacter set of the current locale encoding:therefore mail message text will be (assumed to be) in ISO-8859-1encoding when send from within a ISO-8859-1 locale, and in UTF-8encoding when send from within an UTF-8 locale.

The 8-bit fallbackcharset-8bitnever comes into play asttycharsetis implicitly assumed to be 8-bit and capable to represent all files theuser may specify (as is the case when no character set conversionsupport is available in S-nail and the only supported character set isttycharset seeSx Character sets ) .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 overridettycharset then; and/or do something like the following in the resource file:

# Avoid ASCII "propagates to 8-bit" when scripting\if ! t && "$LC_ALL" != C && "$LC_CTYPE" != C \set sendcharsets-else-ttycharset\end
sender
An address that is put into the`Sender:'field of outgoing messages, quoting RFC 5322: the mailbox of the agentresponsible for the actual transmission of the message.This field should normally not be used unless thefromfield contains more than one address, on which case it is required.[v15 behaviour may differ] Please expect automatic management of thefromandsenderrelationship.Dependent on the context this address is handled as if it were inthe list ofalternates Also see-r r-option-implicit
sendmail
[Obsolete] Predecessor ofmta
sendmail-arguments
[Obsolete] Predecessor ofmta-arguments
sendmail-no-default-arguments
[Obsolete](Boolean) Predecessor ofmta-no-default-arguments
sendmail-progname
[Obsolete] Predecessor ofmta-argv0
sendwait
Sending messages to the chosenmtaor to command-pipe receivers (seeSx On sending mail, and non-interactive mode )will be performed asynchronously.This means that only startup errors of the respective program will berecognizable, but no delivery errors.Also, no guarantees can be made as to when the respective program willactually run, as well as to when they will have produced output.

If this variable is set then child program exit is waited for, and itsexit status code is used to decide about success.Remarks: in conflict with the POSIX standard this variable is built-into be initially set.Another difference is that it can have a value, which is interpreted asa comma-separated list of case-insensitive strings naming specificsubsystems for which synchronousness shall be ensured (only).Possible values are`mta'formtadelivery, and`pcc'for command-pipe receivers.

showlast
(Boolean) This setting causes S-nail to start at the last messageinstead of the first one when opening a mail folder, as well as withfromandheaders
showname
(Boolean) Causes S-nail to use the sender's real name instead of the plainaddress in the header field summary and in message specifications.
showto
(Boolean) Causes the recipient of the message to be shown in the headersummary if the message was sent by the user.
Sign
The value backing~A one of theSx COMMAND ESCAPES .Also seemessage-inject-tail on-compose-leaveandon-compose-splice
sign
The value backing~a one of theSx COMMAND ESCAPES .Also seemessage-inject-tail on-compose-leaveandon-compose-splice
signature
[Obsolete] Please useon-compose-spliceoron-compose-splice-shelloron-compose-leaveand (if necessary)message-inject-tailinstead!
skipemptybody
(Boolean) If an outgoing message has an empty first or only message part, donot send, but discard it, successfully (also see the command line option-E )
smime-ca-dir , smime-ca-file
[Option] Specify the location of trusted CA certificates in PEM (PrivacyEnhanced Mail) for the purpose of verification of S/MIME signed messages.tls-ca-dirdocuments the necessary preparation steps to use the former.The set of CA certificates which are built into the TLS library canbe explicitly turned off by settingsmime-ca-no-defaults and further fine-tuning is possible viasmime-ca-flags
smime-ca-flags
[Option] Can be used to fine-tune behaviour of the X509 CA certificatestorage, and the certificate verification that is used.The actual values and their meanings are documented fortls-ca-flags
smime-ca-no-defaults
(Boolean)[Option] Do not load the default CA locations that are built into theused to TLS library to verify S/MIME signed messages.
smime-cipher-USER [at] HOST , smime-cipher
[Option] Specifies the cipher to use when generating S/MIME encryptedmessages (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 cryptographiclibrary that S-nail uses.[Option] Support for more cipher algorithms may be available throughdynamic loading viaEVP_get_cipherbyname3(OpenSSL) if S-nail has been compiled to support this.

smime-crl-dir
[Option] Specifies a directory that contains files with CRLs in PEM formatto use when verifying S/MIME messages.
smime-crl-file
[Option] Specifies a file that contains a CRL in PEM format to use whenverifying S/MIME messages.
smime-encrypt-USER [at] HOST
[Option] If this variable is set, messages send to the given receiver areencrypted before sending.The value of the variable must be set to the name of a file thatcontains 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 anindividually encrypted message;other recipients will continue to receive the message in plain textunless thesmime-force-encryptionvariable is set.It is recommended to sign encrypted messages, i.e., to also set thesmime-signvariable.content-description-smime-messagewill be inspected for messages which become encrypted.

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( from private key and include the users certificate as a MIME attachment.Signing a message enables a recipient to verify that the sender useda valid certificate,that the email addresses in the certificate match those in the messageheader 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.content-description-smime-signaturewill be inspected.Also seesmime-sign-cert , smime-sign-include-certsandsmime-sign-digest
smime-sign-cert-USER [at] HOST , smime-sign-cert
[Option] Points to a file in PEM format.For the purpose of signing and decryption this file needs to contain theuser's private key, followed by his certificate.

For message signing`USER [at] HOST'is always derived from the value offrom(or, if that contains multiple addresses,sender ) For the purpose of encryption the recipients public encryption key(certificate) is expected; the commandcertsavecan be used to save certificates of signed messages (the sectionSx Signed and encrypted messages with S/MIMEgives some details).This mode of operation is usually driven by the specialized form.

When decrypting messages the account is derived from the recipientfields( `To:'and`Cc:')of the message, which are searched for addresses for which sucha 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 addressesusing different encryption keys, decryption might fail.

Password-encrypted keys may be used for signing and decryption.Automated password lookup is possible via the``pseudo-hosts''`USER [at] HOST.smime-cert-key'for the private key, and`USER [at] HOST.smime-cert-cert'for the certificate stored in the same file.For example, the hypothetical address`bob [at] exam.ple'could be driven with a private key / certificate pair path defined insmime-sign-cert-bob [at] exam.ple and the needed passwords would then be looked up as`bob [at] exam.ple.smime-cert-key'and`bob [at] exam.ple.smime-cert-cert'When decrypting the value offromwill be tried as a fallback to provide the necessary`USER [at] HOST'To include intermediate certificates, usesmime-sign-include-certs The possible password sources are documented inSx On URL syntax and credential lookup .

smime-sign-digest-USER [at] HOST , smime-sign-digest
[Option] Specifies the message digest to use when signing S/MIME messages.Please remember that for this use case`USER [at] HOST'refers to the variablefrom(or, if that contains multiple addresses,sender ) The available algorithms depend on the used cryptographic library, butat least one usable built-in algorithm is ensured as a default.If possible the standard RFC 5751 will be violated by using`SHA512'instead of the mandated`SHA1'due to security concerns.This variable is ignored for very old (released before 2010)cryptographic libraries which do not offer the necessary interface:it will be logged if that happened.

S-nail will try to add built-in support for the following messagedigests, names are case-insensitive:`BLAKE2b512',`BLAKE2s256',`SHA3-512',`SHA3-384',`SHA3-256',`SHA3-224',as well as the widely available`SHA512',`SHA384',`SHA256',`SHA224',and the proposed insecure`SHA1',finally`MD5'More digests may [Option]ally be available through dynamic loading via theOpenSSL functionEVP_get_digestbyname3.

smime-sign-include-certs-USER [at] HOST , smime-sign-include-certs
[Option] If used, this is supposed to a consist of a comma-separated listof files, each of which containing a single certificate in PEM format tobe included in the S/MIME message in addition to thesmime-sign-certcertificate.This can be used to include intermediate certificates of the certificateauthority, in order to allow the receiver's S/MIME implementation toperform a verification of the entire certificate chain, starting froma local root certificate, over the intermediate certificates, down to thesmime-sign-cert Even though top level certificates may also be included in the chain,they will not be used for the verification on the receiver's side.

For the purpose of the mechanisms involved here,`USER [at] HOST'refers to the content of the internal variablefrom(or, if that contains multiple addresses,sender ) The pseudo-host`USER [at] 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 automatedvia the mechanisms described inSx On URL syntax and credential lookup .

smime-sign-message-digest-USER [at] HOST , smime-sign-message-digest
[Obsolete][Option] Predecessor(s) ofsmime-sign-digest
smtp
[Obsolete][Option] To use the built-in SMTP transport, specify a SMTP URL inmta [v15 behaviour may differ] For compatibility reasons a setsmtpis used in preference ofmta
smtp-auth-USER [at] HOST , smtp-auth-HOST , smtp-auth
[Option] Variable chain that controls the SMTPmtaauthentication method, possible values are`none'([no v15-compat] default),`plain'([v15-compat] default),`login',[v15-compat]`oauthbearer'(seeSx FAQentrySx But, how about XOAUTH2 / OAUTHBEARER? )as well as [v15-compat]`external'and`externanon'for TLS secured connections which pass a client certificate viatls-config-pairs There may be the [Option]al methods`cram-md5'and`gssapi'`none'and`externanon'do not need any user credentials,`external'and`gssapi'require a user name, and all other methods require ausername and apassword `externanon'solely builds upon the credentials passed via a client certificate,and is usually the way to go since tested servers do not actually followRFC 4422 aka RFC 4954, and fail if additional credentials are passed.Also seemta Note thatsmtp-auth-HOSTis [v15-compat].([no v15-compat] Requiressmtp-auth-passwordandsmtp-auth-user Note forsmtp-auth-USER [at] HOST may override dependent on sender address in the variablefrom .
smtp-auth-password
[Option][no v15-compat] Sets the global fallback password for SMTP authentication.If the authentication method requires a password, but neithersmtp-auth-passwordnor a matchingsmtp-auth-password-USER [at] HOSTcan be found,S-nail will ask for a password on the user's terminal.
smtp-auth-password-USER [at] HOST
[no v15-compat] Overridessmtp-auth-passwordfor specific values of sender addresses, dependent upon the variablefrom
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 neithersmtp-auth-usernor a matchingsmtp-auth-user-USER [at] HOSTcan be found,S-nail will ask for a user name on the user's terminal.
smtp-auth-user-USER [at] HOST
[no v15-compat] Overridessmtp-auth-userfor specific values of sender addresses, dependent upon the variablefrom
smtp-hostname
[Option][v15-compat] Normally S-nail uses the variablefromto derive the necessary`USER [at] HOST'information in order to issue a`MAIL'FROM:<>SMTPmtacommand.Settingsmtp-hostnamecan be used to use the`USER'from the SMTP account( mtaor theuservariable chain)and the given`HOST'( hostnameif the empty string is given, or the local hostname as a last resort).This often allows using an address that is itself valid but hosted bya provider other than from which (infrom the message is sent.Setting this variable also influences generated`Message-ID:'and`Content-ID:'header fields.If the [Option]al IDNA support is available (seeidna-disable variable assignment is aborted when a necessary conversion fails.
smtp-use-starttls-USER [at] HOST , smtp-use-starttls-HOST , smtp-use-starttls
(Boolean)[Option] Causes S-nail to issue a`STARTTLS'command to make an SMTPmtasession TLS encrypted, i.e., to enable transport layer security.
socket-connect-timeout
[Option] A positive number that defines the timeout to wait forestablishing a socket connection before forcing^ERR -TIMEDOUT
socks-proxy-USER [at] HOST , socks-proxy-HOST , socks-proxy
[Option] If set to the URL of a SOCKS5 server then all network activitiesare proxied through it, except for the single DNS name lookup necessaryto resolve the proxy URL (unnecessary when given an already resolved IPaddress).It is automatically squared with the environment variableSOCKS5_PROXY changing the one will adjust the other.This example creates a local SOCKS5 proxy on port 10000 that forwards tothe machine`HOST'(with identity`USER') ,and from which actual network traffic happens:
$ ssh -D 10000 USER [at] HOST$ s-nail -Ssocks-proxy=[socks5://]localhost:10000# or =localhost:10000; no local DNS: =127.0.0.1:10000
spam-interface
[Option] In order to use any of the spam-related commands (likespamrate the desired spam interface must be defined by setting this variable.Please refer to the manual sectionSx Handling spamfor the complete picture of spam handling in S-nail.All or none of the following interfaces may be available:
`spamc'
Interaction withspamc(1)from thespamassassin(1)( Lk http://spamassassin.apache.org SpamAssassin suite.Different to the generic filter interface S-nail will automatically addthe correct arguments for a given command and has the necessaryknowledge to parse the program's output.A default value forspamc-commandwill have been compiled into the S-nail binary ifspamc(1)has been found inPATHduring compilation.Shall it be necessary to define a specific connection type (rather thanusing a configuration file for that), the variablespamc-argumentscan be used as in for example`-d'server.example.com -p 783 .It is also possible to specify a per-user configuration viaspamc-user Note that this interface does not inspect the`is-spam'flag of a message for the commandspamforget
`filter'
generic spam filter support via freely configurable hooks.This interface is meant for programs likebogofilter(1)and requires according behaviour in respect to the hooks' exitstatus for at least the commandspamrate( `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 behaviourcan be intercepted as necessary.The hooks arespamfilter-ham , spamfilter-noham , spamfilter-nospam ,
spamfilter-rateandspamfilter-spam the manual sectionSx Handling spamcontains examples for some programs.The process environment of the hooks will have the variableMAILX_FILENAME_GENERATEDset.Note that spam score support forspamrateis not supported unless the [Option]tional regular expression support isavailable and thespamfilter-rate-scanscorevariable is set.
spam-maxsize
[Option] Messages that exceed this size will not be passed through to theconfiguredspam-interface If unset or 0, the default of 420000 bytes is used.
spamc-command
[Option] The path to thespamc(1)program for the`spamc'spam-interface Note that the path is not expanded, but used``as is'' A fallback path will have been compiled into the S-nail binary if theexecutable had been found during compilation.
spamc-arguments
[Option] Even though S-nail deals with most arguments for the`spamc'spam-interfaceautomatically, it may at least sometimes be desirable to specifyconnection-related ones via this variable, for example`-d'server.example.com -p 783 .
spamc-user
[Option] Specify a username for per-user configuration files for the`spamc'spam-interface If this is set to the empty string then S-nail will use the name of thecurrentuser
spamfilter-ham , spamfilter-noham

spamfilter-nospam , spamfilter-rate , spamfilter-spam[Option] Command and argument hooks for the`filter'spam-interface The manual sectionSx Handling spamcontains examples for some programs.
spamfilter-rate-scanscore
[Option] Because of the generic nature of the`filter'spam-interfacespam scores are not supported for it by default, but if the [Option]nalregular expression support is available then setting this variable canbe used to overcome this restriction.It is interpreted as follows: first a number (digits) is parsed thatmust be followed by a semicolon`;'and an extended regular expression.Then the latter is used to parse the first output line of thespamfilter-ratehook, and, in case the evaluation is successful, the group that has beenspecified via the number is interpreted as a floating point scan score.
ssl-ca-dir-USER [at] HOST , ssl-ca-dir-HOST , ssl-ca-dir ,
ssl-ca-file-USER [at] HOST , ssl-ca-file-HOST , ssl-ca-file
[Obsolete][Option] Predecessors oftls-ca-file tls-ca-dir
ssl-ca-flags-USER [at] HOST , ssl-ca-flags-HOST , ssl-ca-flags
[Obsolete][Option] Predecessor oftls-ca-flags
ssl-ca-no-defaults-USER [at] HOST , ssl-ca-no-defaults-HOST ,
ssl-ca-no-defaults
[Obsolete](Boolean)[Option] Predecessor oftls-ca-no-defaults
ssl-cert-USER [at] HOST , ssl-cert-HOST , ssl-cert
[Obsolete][Option] Please use theCertificateslot oftls-config-pairs
ssl-cipher-list-USER [at] HOST , ssl-cipher-list-HOST , ssl-cipher-list
[Obsolete][Option] Please use theCipherStringslot oftls-config-pairs
ssl-config-file
[Obsolete][Option] Predecessor oftls-config-file
ssl-config-module-USER [at] HOST , ssl-config-module-HOST ,
ssl-config-module
[Obsolete][Option] Predecessor oftls-config-module
ssl-config-pairs-USER [at] HOST , ssl-config-pairs-HOST , ssl-config-pairs
[Obsolete][Option] Predecessor oftls-config-pairs
ssl-crl-dir , ssl-crl-file
[Obsolete][Option] Predecessors oftls-crl-dir tls-crl-file
ssl-curves-USER [at] HOST , ssl-curves-HOST , ssl-curves
[Obsolete][Option] Please use theCurvesslot oftls-config-pairs
ssl-features
[Obsolete][Option](Read-only) Predecessor oftls-features
ssl-key-USER [at] HOST , ssl-key-HOST , ssl-key
[Obsolete][Option] Please use thePrivateKeyslot oftls-config-pairs
ssl-method-USER [at] HOST , ssl-method-HOST , ssl-method
[Obsolete][Option] Please use theProtocolslot oftls-config-pairs
ssl-protocol-USER [at] HOST , ssl-protocol-HOST , ssl-protocol
[Obsolete][Option] Please use theProtocolslot oftls-config-pairs
ssl-rand-file
[Obsolete][Option] Predecessor oftls-rand-file
ssl-verify-USER [at] HOST , ssl-verify-HOST , ssl-verify
[Obsolete][Option] Predecessor oftls-verify
stealthmua
If only set without an assigned value, then this setting inhibits thegeneration 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 headerto track down the originating mail user agent.If set to the value`noagent',then the mentioned`Message-ID:'and`Content-ID:'suppression does not occur.
system-mailrc
(Read-only) The compiled in path of the system wide initialization fileone of theSx Resource files :s-nail.rc
termcap
([Option]) This specifies a comma-separated list ofLb libterminfoand/orLb libtermcapcapabilities (seeSx On terminal control and line editor ,escape commas with reverse solidus`\')to be used to overwrite or define entries.Notethis variable will only be queried once at program startup and canthus only be specified in resource files or on the command line.It will always be inspected, regardless of whetherfeaturesdenotes termcap/terminfo library support via`,+termcap,'

String capabilities form`cap=value'pairs and are expected unless noted otherwise.Numerics have to be notated as`cap#number'where the number is expected in normal decimal notation.Finally, booleans do not have any value but indicate a true or falsestate simply by being defined or not; this indeed means that S-naildoes 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 forthe standard CSI sequence);finally three letter octal sequences, as in`\061',are supported.To specify that a terminal supports 256-colours, and to define sequencesthat 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 theoperation of the built-in line editor or S-nail in general:

am
auto_right_margin boolean which indicates if the right margin needs special treatment; thexenlcapability is related, for more seeCOLUMNS This capability is only used when backed by library support.
clear or cl
clear_screen clear the screen and home cursor.(Will be simulated viahopluscd .
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; also seecolour
cr
carriage_return move to the first column in the current row.The default built-in fallback is`\r'
cub1 or le
cursor_left move the cursor left one space (non-destructively).The default built-in fallback is`\b'
cuf1 or nd
cursor_right move the cursor right one space (non-destructively).The default built-in fallback is`\E[C',which is used by most terminals.Less often occur`\EC'and`\EOC'
ed or cd
clr_eos clear the screen.
el or ce
clr_eol clear to the end of line.(Will be simulated viachplus repetitions of space characters.)
home or ho
cursor_home home cursor.
hpa or ch
column_address move the cursor (to the given column parameter) in the current row.(Will be simulated viacrplusnd .
rmcup or te / smcup or ti
exit_ca_modeandenter_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 settingtermcap-ca-mode
smkx or ks / rmkx or ke
keypad_xmitandkeypad_local respectively: enable and disable the keypad.This is always enabled if available, because it seems even keyboardswithout keypads generate other key codes for, e.g., cursor keys in thatcase, and only if enabled we see the codes that we are interested in.
xenl or xn
eat_newline_glitch boolean which indicates whether a newline written in the last column of anauto_right_marginindicating terminal is ignored.With it the full terminal width is available even on autowrap terminals.This will be inspected even without`,+termcap,'features

Many more capabilities which describe key-sequences are documented forbind

termcap-ca-mode
[Option] Allow usage of theexit_ca_modeandenter_ca_modetermcap abilities in order to enter an alternative exclusive screen, theso-called ca-mode; this usually requires special configuration of thePAGER also dependent on the value ofcrt Notethis variable will only be queried once at program startup and canthus 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 oftermcapdescribe the terminal to S-nail.Notethis variable will only be queried once at program startup and canthus only be specified in resource files or on the command line.
tls-ca-dir-USER [at] HOST , tls-ca-dir-HOST , tls-ca-dir ,
tls-ca-file-USER [at] HOST , tls-ca-file-HOST , tls-ca-file
[Option] Directory and file, respectively, for pools of trusted CAcertificates in PEM (Privacy Enhanced Mail) format, for the purpose ofverification of TLS server certificates.Concurrent use is possible, the file is loaded once needed first, thedirectory lookup is performed anew as a last resort whenever necessary.The CA certificate pool built into the TLS library can be disabled viatls-ca-no-defaults further fine-tuning is possible viatls-ca-flags The directory search requires special filename conventions, please seeSSL_CTX_load_verify_locations3andverify(1)(orc_rehash1).
tls-ca-flags-USER [at] HOST , tls-ca-flags-HOST , tls-ca-flags
[Option] Can be used to fine-tune behaviour of the X509 CA certificatestorage, and the certificate verification that is used (also seetls-verify ) The value is expected to consist of a comma-separated list ofconfiguration directives, with any intervening whitespace being ignored.The directives directly map to flags that can be passed toX509_STORE_set_flags3,which are usually defined in a fileopenssl/x509_vfy.h and the availability of which depends on the used TLS libraryversion: a directive without mapping is ignored (error log subject todebug ) Directives currently understood (case-insensitively) include:
no-alt-chains
If the initial chain is not trusted, do not attempt to build analternative chain.Setting this flag will make OpenSSL certificate verification match thatof older OpenSSL versions, before automatic building and checking ofalternative chains has been implemented; also seetrusted-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 thechain top, a self-signed root certificate, will not verify.With this flag set, a chain succeeds to verify if at least one signingcertificate of the chain is in any of the configured trusted stores ofCA certificates.The OpenSSL manual pageSSL_CTX_load_verify_locations3gives 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 avoidproblems with server-sent legacy intermediate certificates.Newer versions of OpenSSL support alternative chain checking and enableit by default, resulting in the same behaviour; also seeno-alt-chains
tls-ca-no-defaults-USER [at] HOST , tls-ca-no-defaults-HOST ,
tls-ca-no-defaults
(Boolean)[Option] Do not load the default CA locations that are built into theused to TLS library to verify TLS server certificates.
tls-config-file
[Option] If this variable is setCONF_modules_load_file3(if announced via`,+modules-load-file,'intls-features is used to allow resource file based configuration of the TLS library.This happens once the library is used first, which may also be earlyduring startup (logged withverbose ) If a non-empty value is given then the given file, after performingSx Filename transformations ,will be used instead of the TLS libraries global default, and it is anerror if the file cannot be loaded.The application name will always be passed as`s-nail'Some TLS libraries support application-specific configuration viaresource files loaded like this, please seetls-config-module
tls-config-module-USER [at] HOST , tls-config-module-HOST ,
tls-config-module
[Option] If file based application-specific configuration viatls-config-fileis available, announced as`,+ctx-config,'bytls-features indicating availability ofSSL_CTX_config3,then, it becomes possible to use a central TLS configuration filefor all programs, including s-nail, for example
# Register a configuration section for s-nails-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_tls_config# And that program specific configuration section now# can map diverse tls-config-module names to sections,# as in: tls-config-module=account_xy[mailx_tls_config]account_xy = mailx_account_xyaccount_yz = mailx_account_yz[mailx_account_xy]MinProtocol = TLSv1.2Curves=P-521[mailx_account_yz]CipherString = TLSv1.2:!aNULL:!eNULL:MinProtocol = TLSv1.1Options = Bugs
tls-config-pairs-USER [at] HOST , tls-config-pairs-HOST , tls-config-pairs
[Option] The value of this variable chain will be interpreted asa comma-separated list of directive/value pairs.Directives and values need to be separated by equals signs`=',any whitespace surrounding pair members is removed.Keys are (usually) case-insensitive.Different to when placing these pairs in atls-config-modulesection of atls-config-file commas`,'need to be escaped with a reverse solidus`\'when included in pairs; also different: if the equals sign`='is preceded with an asterisk`*'Sx Filename transformationswill be performed on the value; it is an error if these fail.Unless proper support is announced bytls-features( `,+conf-ctx,' only the keys below are supported, otherwise the pairs will be useddirectly as arguments to the functionSSL_CONF_cmd3.
Certificate
Filename of a TLS client certificate (chain) required by some servers.Fallback support viaSSL_CTX_use_certificate_chain_file3.Sx Filename transformationsare performed.PrivateKeywill be set to the same value if not initialized explicitly.Some services support so-called`external'authentication if a TLS client certificate was successfully presentedduring connection establishment( ``connecting is authenticating''
CipherString
A list of ciphers for TLS connections, seeciphers(1).By default no list of ciphers is set, resulting in aProtocol - specific list of ciphers (the protocol standards define lists ofacceptable ciphers; possibly cramped by the used TLS library).Fallback support viaSSL_CTX_set_cipher_list3.
Ciphersuites
A list of ciphers used for TLSv1.3 connections, seeciphers(1).These will be joined onto the list of ciphers fromCipherString Available iftls-featuresannounces`,+ctx-set-ciphersuites,',as necessary viaSSL_CTX_set_ciphersuites3.
Curves
A list of supported elliptic curves, if applicable.By default no curves are set.Fallback support viaSSL_CTX_set1_curves_list3,if available.
MaxProtocol , MinProtocol
The maximum and minimum supported TLS versions, respectively.Available iftls-featuresannounces`,+ctx-set-maxmin-proto,',as necessary viaSSL_CTX_set_max_proto_version3andSSL_CTX_set_min_proto_version3;these fallbacks use an internal parser which understands the strings`SSLv3',`TLSv1',`TLSv1.1',`TLSv1.2',`TLSv1.3',and the special value`None',which disables the given limit.
Options
Various flags to set.Fallback viaSSL_CTX_set_options3,in which case any other value but (exactly)`Bugs'results in an error.
PrivateKey
Filename of the private key in PEM format of a TLS client certificate.If unset, the value ofCertificateis used.Sx Filename transformationsare performed.Fallback viaSSL_CTX_use_PrivateKey_file3.
Protocol
The used TLS protocol.Iftls-featuresannounces`,+conf-ctx,'or`ctx-set-maxmin-proto'then usingMaxProtocolandMinProtocolis preferable.Fallback isSSL_CTX_set_options3,driven via an internal parser which understands the strings`SSLv3',`TLSv1',`TLSv1.1',`TLSv1.2',`TLSv1.3',and the special value`ALL'Multiple protocols may be given as a comma-separated list, anywhitespace is ignored, an optional plus sign`+'prefix enables, a hyphen-minus`-'prefix disables a protocol, so that`-ALL,'TLSv1.2enables only the TLSv1.2 protocol.
tls-crl-dir , tls-crl-file
[Option] Specify a directory / a file, respectively, that contains a CRL inPEM format to use when verifying TLS server certificates.
tls-features
[Option](Read-only) This expands to a comma-separated list of the TLS libraryidentity and optional features.To ease substring matching the string starts and ends with a comma.Currently supported identities are`libressl'(LibreSSL) ,`libssl-0x30000'(OpenSSL v3.0.0 series),`libssl-0x10100'(OpenSSL v1.1.x series)and`libssl-0x10000'(elder OpenSSL series, other clones).Optional features are preceded with a plus sign`+'when available, and with a hyphen-minus`-'otherwise.

Currently known features are`conf-ctx'( tls-config-pairs `ctx-config'( tls-config-module `ctx-set-ciphersuites'( Ciphersuitesslot oftls-config-pairs ) `ctx-set-maxmin-proto'( tls-config-pairs `modules-load-file'( tls-config-file and`tls-rand-file'( tls-rand-file

tls-fingerprint-USER [at] HOST , tls-fingerprint-HOST , tls-fingerprint
[Option] It is possible to replace the verification of the connectionpeer certificate against the entire local pool of CAs (for more seeSx Encrypted network communication )with the comparison against a precalculated certificate message digest,the so-called fingerprint, to be specified as the usedtls-fingerprint-digest This fingerprint can for example be calculated with`tls'Ns fingerprint HOST .
tls-fingerprint-digest-USER [at] HOST , tls-fingerprint-digest-HOST

tls-fingerprint-digest[Option] The message digest to be used when creating TLS certificatefingerprints, the defaults, if available, in test order, being`BLAKE2s256',`SHA256'For the complete list of digest algorithms refer tosmime-sign-digest
tls-rand-file
[Option] Iftls-featuresannounces`,+tls-rand-file,'then this will be queried to find a file with random entropy data whichcan be used to seed the P(seudo)R(andom)N(umber)G(enerator), seeRAND_load_file3.The default filename( RAND_file_name3 normally~/.rnd will be used if this variable is not set or empty, or if theSx Filename transformationsfail.Shall seeding the PRNG have been successful,RAND_write_file3will be called to update the entropy.Remarks: libraries which do not announce this feature seed the PRNG byother means.
tls-verify-USER [at] HOST , tls-verify-HOST , tls-verify
[Option] Variable chain that sets the action to be performed if an erroroccurs during TLS server certificate validation against thespecified or default trust storestls-ca-dir tls-ca-file or the TLS library built-in defaults (unless usage disallowed viatls-ca-no-defaults ) and as fine-tuned viatls-ca-flags Valid (case-insensitive) values are`strict'(fail and close connection immediately),`ask'(ask whether to continue on standard input),`warn'(show a warning and continue),`ignore'(do not perform validation).The default is`ask'
toplines
If defined, gives the number of lines of a message to be displayedwith the commandtop if unset, the first five lines are printed, if set to 0 the variablescreenis inspected.If the value is negative then its absolute value will be used forunsigned right shifting (seevexpr thescreenheight.
topsqueeze
(Boolean) If set then thetopcommand 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 nocharacter set conversion capabilities have been compiled into it,in which case it defaults to ISO-8859-1.Otherwise it defaults to UTF-8.Sufficient locale support provided the default will be preferablydeduced from the locale environment if that is set (for exampleLC_CTYPE see there for more); runtime locale changes will be reflected byttycharsetexcept during the program startup phase and if-Shad been used to freeze the given value.Refer to the sectionSx Character setsfor the complete picture about character sets.
typescript-mode
(Boolean) A special multiplex variable that disables all variables andsettings which result in behaviour that interferes with running S-nail inscript(1);it setscolour-disable line-editor-disableand (before startup completed only)termcap-disable Unsetting it does not restore the former state of the covered settings.
umask
For a safe-by-default policy the process file mode creation maskumask(2)will be set to`0077'on program startup after the resource files have been loaded,and unless this variable is set.By assigning this an empty value the active setting will not be changed,otherwise the given value will be made the new file mode creation mask.Child processes inherit the file mode creation mask of their parent.
user-HOST , user
[v15-compat] Variable chain that sets a global fallback user name, used in casenone 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
Enable upward compatibility with S-nail version 15.0 in respect to whichconfiguration options are available and how they are handled.If set to a non-empty value the command modifierwyshis implied and thus enforcesSx Shell-style argument quotingoverSx Old-style argument quotingfor all commands which support both.This manual uses [v15-compat] and [no v15-compat] to refer to the new and the old way ofdoing things, respectively.
verbose
Verbose mode enables logging of informational context messages.Historically a (Boolean) variable, this can either be set multiple times(what the command line option-vuses), or be assigned a numeric value in order to increase verbosity.Assigning the value 0 disables verbosity and thus (almost) equalsunset The maximum number is 3.Also seedebug
version , version-date

version-hexnum , version-major , version-minor , version-update(Read-only) S-nail version information: the first variable is a string withthe complete version identification, the second the release date in ISO8601 notation without time.The third is a 32-bit hexadecimal number with the upper 8 bits storingthe major, followed by the minor and update version numbers which occupy12 bits each.The latter three variables contain only decimal digits: the major, minorand update version numbers.The output of the commandversionwill include this information.
writebackedited
If this variable is set messages modified using theeditorvisualcommands 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 thatcase, i.e., neither MIME decoding nor decryption will have beenperformed, and propermbox-rfc4155`From_'quoting of newly added or edited content is also left as an exerciseto the user.

ENVIRONMENT

The term``environment variable''should be considered an indication that these variables are eitherstandardized as vivid parts of process environments, or that they arecommonly found in there.The process environment is inherited from thesh(1)once S-nail is started, and unless otherwise explicitly noted handling ofthe following variables transparently integrates into that of theSx INTERNAL VARIABLESfrom S-nail's point of view.This means they can be managed viasetandunset causing automatic program environment updates (to be inherited bynewly created child processes).

In order to integrate other environment variables equally they need tobe imported (linked) with the commandenviron This command can also be used to set and unset non-integratedenvironment variables from scratch, sufficient system support provided.The following example, applicable to a POSIX shell, sets theCOLUMNSenvironment variable for S-nail only, and beforehand exports theEDITORin 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.Queried and used once on program startup in interactive or batch( -# mode, actively managed for child processes and the MLE (seeSx On terminal control and line editor )in interactive mode thereafter.Non-interactive mode always uses, and the fallback default isa compile-time constant, by default 80 columns.If in batch modeCOLUMNSandLINESare both set but not both are usable (empty, not a number, or 0) atprogram startup, then the real terminal screen size will be (tried tobe) determined once.(Normally thesh(1)manages these variables, and unsets them for pipe specifications etc.)
DEAD
The name of the (mailbox)folderto use for saving aborted messages ifsaveis set; this defaults to~/dead.letter If the variabledebugis set no output will be generated, otherwise the contents of the filewill be replaced.Except shell globsSx Filename transformations(also seefolder will be performed.
EDITOR
Pathname of the text editor to use for theeditcommand and~e(see Sx COMMAND ESCAPES ) VISUALis used for a more display oriented editor.
HOME
The user's home directory.This variable is only used when it resides in the process environment.The calling user's home directory will be used instead if this directorydoes not exist, is not accessible or cannot be read;it will always be used for the root user.(No test for being writable is performed to allow usage bynon-privileged users within read-only jails, but dependent on settingsthis directory is a default write target for, for example,DEAD MBOXand more.)
LC_ALL , LC_CTYPE , LANG
[Option] The (names in lookup order of the)locale(7)(and / or seesetlocale(3))which indicates the usedSx Character sets .Runtime changes trigger automatic updates of the entire locale system,which includes updatingttycharset(except during startup if the variable has been frozen via-S )
LINES
The user's preferred number of lines for the terminal screen.The behaviour is as described forCOLUMNS yet the compile-time constant used in non-interactive mode and asa fallback defaults to 24 (lines).
LISTER
Pathname of the directory lister to use in thefolderscommand when operating on local mailboxes.Default isls(1)(path search throughSHELL )
LOGNAME
Upon startup S-nail will actively ensure that this variable refers to thename of the user who runs S-nail, in order to be able to pass a verifiedname to any newly created child process.
MAIL
Is used as the user'sSx primary system mailboxunlessinboxis set.If the environmental fallback is also not set, a built-in compile-timedefault is used.This is assumed to be an absolute pathname.
MAILCAPS
[Option] Override the default path search ofSx The Mailcap files :any existing file therein will be loaded in sequence, appending anycontent to the list of MIME type handler directives.The RFC 1524 standard imposed default value is assigned otherwise:`~/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap'(The default value is a compile-time [Option].)
MAILRC
Is used as a startup file instead of~/.mailrcif set.In order to avoid side-effects from configuration files scripts shouldeither set this variable to/dev/nullor the-:command line option should be used.
MAILX_NO_SYSTEM_RC
If this variable is set then reading ofs-nail.rc(akasystem-mailrc at startup is inhibited, i.e., the same effect is achieved as if S-nailhad been started up with the option-:(and according argument) or-n This variable is only used when it resides in the process environment.
MBOX
The name of the user'sSx secondary mailboxfile.A logical subset of the specialSx Filename transformations(also seefolder are supported.The default is~/mbox Traditionally this MBOX is used as the file to save messages from theSx primary system mailboxthat have been read.Also seeSx Message states .
NETRC
[v15-compat][Option] This variable overrides the default location of the user's~/.netrcfile.
PAGER
Pathname of the program to use for backing the commandmore and when thecrtvariable enforces usage of a pager for output.The default paginator ismore(1)(path search throughSHELL )

S-nail inspects the contents of this variable: if its contains the string``less''then a non-existing environment variableLESSwill be set to (the portable)`RI',likewise for``lv''LVwill optionally be set to`-c'Also seecolour-pager

PATH
A colon-separated list of directories that is searched by the shell whenlooking for commands, for example`/bin:/usr/bin:/usr/local/bin'
POSIXLY_CORRECT
This environment entry is automatically squared withposix
SHELL
The shell to use for the commands! shell the~!Sx COMMAND ESCAPESand when starting subprocesses.A default shell is used if this environment variable is not defined.
SOCKS5_PROXY
This environment entry is automatically squared withsocks-proxy
SOURCE_DATE_EPOCH
Specifies a time in seconds since the Unix epoch (1970-01-01) to beused in place of the current time.This variable is looked up upon program startup, and its existence willswitch S-nail to a reproducible mode( Lk https://reproducible-builds.org which uses deterministic random numbers, a special fixated pseudoLOGNAMEand more.This operation mode is used for development and by software packagers.[v15 behaviour may differ] Currently an invalid setting is only ignored, rather than causinga 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 toSx Coloured display ,and for terminal management in general toSx On terminal control and line editor .
TMPDIR
Except for the root user this variable defines the directory fortemporary files to be used instead of/tmp(or the given compile-time constant) if set, existent, accessible aswell 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 isupdated to contain a usable temporary directory.
USER
Identical toLOGNAME(see there), but this variable is not standardized, should therefore notbe used, and is only corrected if already set.
VISUAL
Pathname of the text editor to use for thevisualcommand and~v(see Sx COMMAND ESCAPES ) EDITORis used for a less display oriented editor.

FILES

~/.mailcap , /etc/mailcap
[Option] Personal and system-wide MIME type handler definition files, seeSx The Mailcap files .(The shown names are part of the RFC 1524 standard search pathMAILCAPS .
~/.mailrc , s-nail.rc
User-specific and system-wide files giving initial commands, theSx Resource files .(The used filenames come fromMAILRCandsystem-mailrc respectively.)
~/mbox
The default value forMBOX
~/.mime.types , /etc/mime.types
Personal and system-wide MIME types, seeSx The mime.types files .
~/.netrc
[v15-compat][Option] The default location of the user's.netrcfile - the sectionSx The .netrc filedocuments the file format.The used path can be set viaNETRC
/dev/null
The data sinknull(4).
~/.rnd
[Option] Possible location for persistent random entropy seed storage, seetls-rand-file

Resource files

Upon startup S-nail reads in several resource files, in order:
s-nail.rc
System wide initialization file( system-mailrc Reading of this file can be suppressed, either by using the-:(and according argument) or-ncommand line options, or by setting theSx ENVIRONMENTvariableMAILX_NO_SYSTEM_RC
~/.mailrc
File giving initial commands.A different file can be chosen by setting theSx ENVIRONMENTvariableMAILRC Reading of this file can be suppressed with the-:command line option.
mailx-extra-rc
Defines a startup file to be read after all other resource files.It can be used to specify settings that are not understood by othermailx(1)implementations, for example.

The content of these files is interpreted as follows:

  • The whitespace characters space, tabulator and newline,as well as those defined by the variableifs 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 offollow lines is ignored, trailing whitespace before a escaped newlineremains 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, andtherefore the usual follow lines mechanism applies!)

Errors while loading these files are subject to the settings oferrexitandposix More files with syntactically equal content can besource 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

As stated inSx HTML mail and MIME attachmentsS-nail needs to learn about MIME (Multipurpose Internet Mail Extensions)media types in order to classify message and attachment content.One source for them aremime.typesfiles, the loading of which can be controlled by setting the variablemimetypes-load-control Another is the commandmimetype which also offers access to S-nails MIME type cache.mime.typesfiles have the following syntax:
type/subtype extension [extension ...]# For example text/html html htm

where`type/subtype'define the MIME media type, as standardized in RFC 2046:`type'is used to declare the general type of data, while the`subtype'specifies a specific format for that type of data.One or multiple filename`extension'Nss, 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 especiallycrafted files, which can be loaded via the alternative value syntax ofmimetypes-load-control and prepends an optional`type-marker':

[type-marker ]type/subtype extension [extension ...]

The following type markers are supported:

?
Treat message parts with this content as plain text.
?t
The same as plain?
?h
Treat message parts with this content as HTML tagsoup.If the [Option]al HTML-tagsoup-to-text converter is not available treatthe content as plain text instead.
?H
Likewise?h but instead of falling back to plain text require an explicit contenthandler to be defined.
?q
If no handler can be found a text message is displayed which says so.This can be annoying, for example signatures serve a contextual purpose,their content is of no use by itself.This marker will avoid displaying the text message.

Further reading:for sending messages:mimetype mime-allow-text-controls mimetypes-load-control For reading etc. messages:Sx HTML mail and MIME attachments ,Sx The Mailcap files ,mimetype mime-counter-evidence mimetypes-load-control pipe-TYPE/SUBTYPE pipe-EXTENSION

The Mailcap files

[Option] RFC 1524 defines a``User Agent Configuration Mechanism''to be used to inform mail user agent programs about the locallyinstalled facilities for handling various data formats, i.e., aboutcommands and how they can be used to display, edit et cetera MIME partcontents, as well as a default path search that includes multiplepossible locations of resource files, and theMAILCAPSenvironment variable to overwrite that.Handlers found from doing the path search will be cached, the commandmailcapoperates on that cache, and the variablemailcap-disablewill suppress automatic loading, and usage of any mailcap handlers.Sx HTML mail and MIME attachmentsgives a general overview of how MIME types are handled.

``Mailcap''files consist of a set of newline separated entries.Comment lines start with a number sign`#'(in the first column!) and are ignored.Empty lines are ignored.All other lines are interpreted as mailcap entries.An entry definition may be split over multiple lines by placing thereverse solidus character`\'last in all but the final line.The standard does not specify how leading whitespace of successive linesis to be treated, therefore they are retained.

``Mailcap''entries consist of a number of semicolon`;'separated fields.The first two fields are mandatory and must occur in the specifiedorder, the remaining fields are optional and may appear in any order.Leading and trailing whitespace of field content is ignored (removed).The reverse solidus`\'character can be used to escape any following character includingsemicolon and itself in the content of the second field, and in valueparts of any optional key/value field.

The first field defines the MIME`TYPE/SUBTYPE'the entry is about to handle (case-insensitively).If the subtype is specified as an asterisk`*'the entry is meant to match all subtypes of the named type, e.g.,`audio/*'would match any audio type.The second field is theviewshell command used to display MIME parts of the given type.

Data consuming shell commands will be fed message (MIME part) data onstandard input unless one or more instances of the (unquoted) string`%s'are used: these formats will be replaced with a temporary file(name)that has been prefilled with the parts data.Data producing shell commands are expected to generata data on theirstandard output unless that format is used.In all cases any given`%s'format is replaced with a properly shell quoted filename.When a command requests a temporary file via`%s'then that will be removed again, as if thex-mailx-tmpfileandx-mailx-tmpfile-fillflags had been set; unless the command requestsx-mailx-asyncthex-mailx-tmpfile-unlinkflag is also implied; see below for more.

Optional fields define single-word flags (case-insensitive), or key/ value pairs consisting of a case-insensitive keyword, an equals sign`=',and a shell command; whitespace surrounding the equals sign is removed.Optional fields include the following:

compose
A program that can be used to compose a new body or body part in thegiven format.(Currently unused.)
composetyped
Similar to thecomposefield, but is to be used when the composing program needs to specify the`Content-type:'header field to be applied to the composed data.(Currently unused.)
copiousoutput
A flag field which indicates that the output of theviewcommand is integrable into S-nails normal visual display.It is mutually exclusive withneedsterminal
description
A textual description that describes this type of data.The text may optionally be enclosed within double quotation marks`'
edit
A program that can be used to edit a body or body part in the givenformat.(Currently unused.)
nametemplate
This field specifies a filename format for the`%s'format used in the shell command fields, in which`%s'will be replaced by a random string.(The filename is also stored in and passed to subprocesses viaMAILX_FILENAME_TEMPORARY . The standard says this is``only expected to be relevant in environments''
where filename extensions are meaningful ,and so this field is ignored unless the`%s'is a prefix, optionally followed by (ASCII) alphabetic and numericcharacters, the underscore and the period.For example, to specify that a JPG file is to be passed to an imageviewer with a name ending in`.jpg',`nametemplate=%s.jpg'can be used.
needsterminal
This flag field indicates that the given shell command must be run onan interactive terminal.S-nail will temporarily release the terminal to the given command ininteractive mode, in non-interactive mode this entry will be entirelyignored; this flag impliesx-mailx-noquote
print
A program that can be used to print a message or body part in the givenformat.(Currently unused.)
test
Specifies a program to be run to test some condition, for example, themachine architecture, or the window system in use, to determine whetheror not this mailcap entry applies.If the test fails, a subsequent mailcap entry should be sought; also seex-mailx-test-once Standard I/O of the test program is redirected from and to/dev/null and the format`%s'is not supported (the data does not yet exist).
textualnewlines
A flag field which indicates that this type of data is line-oriented andthat, if encoded in`base64',all newlines should be converted to canonical form (CRLF) beforeencoding, and will be in that form after decoding.(Currently unused.)
x11-bitmap
Names a file, in X11 bitmap (xbm) format, which points to an appropriateicon to be used to visually denote the presence of this kind of data.This field is not used by S-nail.
x-mailx-async
Extension flag field that denotes that the givenviewcommand shall be executed asynchronously, without blocking S-nail.Cannot be used in conjunction withneedsterminal the standard output of the command will go to/dev/null
x-mailx-noquote
An extension flag field that indicates that even acopiousoutputviewcommand shall not be used whenquote ing messages, as it would by default.
x-mailx-test-once
Extension flag which denotes whether the giventestcommand shall be evaluated once only with its exit status being cached.This is handy if some global unchanging condition is to be queried, like``running under the X Window System''
x-mailx-tmpfile
Extension flag field that requests creation of a zero-sized temporaryfile, the name of which is to be placed in the environment variableMAILX_FILENAME_TEMPORARY It is an error to use this flag with commands that include a`%s'format (because that is implemented by means of this temporary file).
x-mailx-tmpfile-fill
Normally the MIME part content is passed to the handler via standardinput; if this flag is set then the data will instead be written intothe impliedx-mailx-tmpfile In order to cause deletion of the temporary file you will have to setx-mailx-tmpfile-unlinkexplicitly!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 bedeleted automatically when the command loop is entered again at latest.It is an error to use this flag with commands that include a`%s'format, or in conjunction withx-mailx-async x-mailx-tmpfileis implied.
x-mailx-last-resort
An extension flag that indicates that this handler shall only be usedas a last resort, when no other source (seeSx HTML mail and MIME attachments )provides a MIME handler.
x-mailx-ignore
An extension that enforces that this handler is not used at all.

The standard includes the possibility to define any number of additionalfields, prefixed by`x-'Flag fields apply to the entire``Mailcap''entry --- in some unusual cases, this may not be desirable, butdifferentiation can be accomplished via separate entries, takingadvantage of the fact that subsequent entries are searched if an earlierone does not provide enough information.For example, if aviewcommand needs to specify theneedsterminalflag, but thecomposecommand shall not, the following will help out the latter:

application/postscript; ps-to-terminal %s; needsterminalapplication/postscript; ps-to-terminal %s; compose=idraw %s

In value parts of command fields any occurrence of the format string`%t'will be replaced by the`TYPE/SUBTYPE'specification.Any named parameter from a messages'`Content-type:'field may be embedded into the command line using the format`%{'followed by the parameter name and a closing brace`}'character.The entire parameter should appear as a single command line argument,regardless of embedded spaces, shell quoting will be performed by theRFC 1524 processor, thus:

# MessageContent-type: multipart/mixed; boundary=42# Mailcap filemultipart/*; /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 asshown in this example (as of today).It does not support the additional formats`%n'and`%F'An example file, also showing how to properly deal with the expansion of`%s',which includes any quotes that are necessary to make it a valid shellargument by itself and thus will cause undesired behaviour when placedin additional user-provided quotes:

# Comment linetext/richtext; richtext %s; copiousoutputtext/x-perl; perl -cWT %s; nametemplate = %s.pl# Exit EX_TEMPFAIL=75 on signalapplication/pdf; \ infile=%s\; \ trap "rm -f ${infile}" EXIT\; \ trap "exit 75" INT QUIT TERM\; \ mupdf "${infile}"; \ test = [ -n "${DISPLAY}" ]; \ nametemplate = %s.pdf; x-mailx-asyncapplication/pdf; pdftotext -layout - -; copiousoutputapplication/*; echo "This is \\"%t\\" but \ is 50 \% Greek to me" \; < %s head -c 512 | cat -vet; \ copiousoutput; x-mailx-noquote; x-mailx-last-resort

Further reading:Sx HTML mail and MIME attachments ,Sx The mime.types files ,mimetype MAILCAPS mime-counter-evidence pipe-TYPE/SUBTYPE pipe-EXTENSION

The .netrc file

User credentials for machine accounts (seeSx On URL syntax and credential lookup )can be placed in the.netrcfile, which will be loaded and cached when requested bynetrc-lookup The default location~/.netrcmay be overridden by theNETRCenvironment variable.As long as syntax constraints are honoured the file source may bereplaced with the output of the shell command set innetrc-pipe to load an encrypted file, for example.The cache can be managed with the commandnetrc

The file consists of space, tabulator or newline separated tokens.This parser implements a superset of the original BSD syntax, but usersshould nonetheless be aware of portability glitches, shall their.netrcbe usable across multiple programs and platforms:

  • BSD only supports double quotation marks, for example`password'pass with spaces .
  • BSD (only?) supports escaping of single characters via a reverse solidus(a space could be escaped via`\') ,in- as well as outside of a quoted string.This method is assumed to be present, and will actively be used to quotedouble quotation marks`'and reverse solidus`\'characters inside theloginandpasswordtokens, for example for display purposes.
  • BSD does not require a final quotation mark of the last user input token.
  • The original BSD (Berknet) parser also supported a format which allowedtokens to be separated with commas - whereas at least Hewlett-Packardstill seems to support this syntax, this parser does not!
  • As a non-portable extension some widely-used programs supportshell-style comments: if an input line starts, after any amount ofwhitespace, with a number sign`#',then the rest of the line is ignored.
  • Whereas other programs may require that the.netrcfile is accessible by only the user if it contains apasswordtoken for any otherloginthan``anonymous'' this parser will always require these strict permissions.

Of the following list of supported tokens this parser uses (and caches)machine loginandpassword An existingdefaultentry will not be used.

machine name
The hostname of the entries' machine, lowercase-normalized before use.Any further file content, until either end-of-file or the occurrenceof anothermachineor adefaultfirst-class token is bound (only related) to the machinename

As an extension that should not be the cause of any worries this parsersupports a single wildcard prefix forname

machine *.example.com login USER password PASSmachine pop3.example.com login USER password PASSmachine 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'In the example neither`pop3.example.com'nor`smtp.example.com'will be matched by the wildcard, since the exact matches takeprecedence (it is however faster to specify it the other way around).

default
This is the same asmachineexcept that it is a fallback entry that is used shall none of thespecified 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 specifiedname it is formed from all lines beginning with the next line and continuinguntil a blank line is (consecutive newline characters are) encountered.(Note thatmacdefentries cannot be utilized by multiple machines, too, but must bedefined following themachinethey are intended to be used with.)If a macro namedinitexists, it is automatically run as the last step of the login process.This is merely for FTP purposes.

EXAMPLES

An example configuration

# This example assumes v15.0 compatibility modeset v15-compat# Request strict TLL transport layer security checksset tls-verify=strict# Where are the up-to-date TLS certificates?# (Since we manage up-to-date ones explicitly, do not use any,# possibly outdated, default certificates shipped with OpenSSL)#set tls-ca-dir=/etc/ssl/certsset tls-ca-file=/etc/ssl/certs/ca-certificates.crtset tls-ca-no-defaults#set tls-ca-flags=partial-chainwysh set smime-ca-file="${tls-ca-file}" \ smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}"# This could be outsourced to a central configuration file via# tls-config-file plus tls-config-module if the used library allows.# CipherString: explicitly define the list of ciphers, which may# improve security, especially with protocols older than TLS v1.2.# See ciphers(1). Possibly best to only use tls-config-pairs-HOST# (or -USER [at] HOST), as necessary, again..# Note that TLSv1.3 uses Ciphersuites= instead, which will join# with CipherString (if protocols older than v1.3 are allowed)# Curves: especially with TLSv1.3 curves selection may be desired.# MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2.# Change this only when the remote server does not support it:# maybe use chain support via tls-config-pairs-HOST / -USER [at] HOST# to define such explicit exceptions, then, e.g.,# MinProtocol=TLSv1.1if "$tls-features" =% ,+ctx-set-maxmin-proto, wysh set tls-config-pairs='\ CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\ Curves=P-521:P-384:P-256,\ MinProtocol=TLSv1.1'else wysh set tls-config-pairs='\ CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\ Curves=P-521:P-384:P-256,\ Protocol=-ALL\,+TLSv1.1 \, +TLSv1.2\, +TLSv1.3'endif# Essential setting: select allowed character setsset 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) filesset 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 messagesset 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/MIMEset from='Your Name <address [at] 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 PASSset mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \ smtp-auth=login/plain... \ smtp-use-starttls# Never refuse to start into interactive mode, and moreset emptystart \ colour-pager crt= \ followup-to followup-to-honour=ask-yes fullnames \ history-file=+.s-nailhist history-size=-1 history-gabby \ mime-counter-evidence=0b1111 \ prompt='?\$?!\$!/\$^ERRNAME[\$account#\$mailbox-display]? ' \ reply-to-honour=ask-yes \ umask=# Only include the selected header fields when typing messagesheaderpick type retain from_ date from to cc subject \ message-id mail-followup-to reply-to# ...when forwarding messagesheaderpick forward retain subject date from to cc# ...when saving message, etc.#headerpick save ignore ^Original-.*$ ^X-.*$# Some mailing listsmlist '@xyz-editor\.xyz$' '@xyzf\.xyz$'mlsubscribe '^xfans [at] 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 [at] examp.ple>' set pop3-no-apop-pop.gmXil.com shortcut pop %:pop3s://pop.gmXil.com shortcut imap %:imaps://imap.gmXil.com # Or, entirely IMAP based setup #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \ # imap-cache=~/spool/cache set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls # Alternatively: set mta=smtps://USER:PASS@smtp.gmail.com:465}account XooglX { \call XooglX}# Here is a pretty large one which does not allow sending mails# if there is a domain name mismatch on the SMTP protocol level,# which would bite us if the value of from does not match, e.g.,# for people who have a sXXXXeforge project and want to speak# with the mailing list under their project account (in from),# still sending the message through their normal mail providerdefine XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent set from='Your Name <address [at] 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_COLOUR_FLAG} -aFlrS'commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS'set pipe-message/external-body='?* echo $MAILX_EXTERNAL_BODY_URL'# We do not support gpg(1) directly yet. But simple --clearsign'd# message parts can be dealt with as follows:define V { localopts yes wysh set pipe-text/plain=$'?*#++=?\ < "${MAILX_FILENAME_TEMPORARY}" awk \ -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \'\ BEGIN{done=0}\ /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\ if(done++ != 0)\ next;\ print "--- GPG --verify ---";\ system("gpg --verify " TMPFILE " 2>&1");\ print "--- GPG --verify ---";\ print "";\ next;\ }\ /^-----BEGIN PGP SIGNATURE-----/,\ /^-----END PGP SIGNATURE-----/{\ next;\ }\ {print}\ \'' print}commandalias V '\'call V

When storing passwords in~/.mailrcappropriate permissions should be set on this file with`$'chmod 0600 ~/.mailrc .If the [Option]alnetrc-lookupis available user credentials can be stored in the central~/.netrcfile instead; e.g., here is a different version of the example accountthat sets up SMTP and POP3:

define XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent set from='Your Name <address [at] 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~/.netrcfile:

machine *.yXXXXx.ru login USER password PASS

This configuration should now work just fine:

$ echo text | s-nail -dvv -AXandeX -s Subject user [at] exam.ple

S/MIME step by step

[Option] The first thing that is needed forSx Signed and encrypted messages with S/MIMEis a personal certificate, and a private key.The certificate contains public information, in particular a name andemail address(es), and the public key that can be used by others toencrypt messages for the certificate holder (the owner of the privatekey), and toverifysigned messages generated with that certificate('s private key).Whereas the certificate is included in each signed message, the privatekey must be kept secret.It is used to decrypt messages that were previously encrypted with thepublic key, and to sign messages.

For personal use it is recommended to get a S/MIME certificate fromone of the major CAs on the Internet.Many CAs offer such certificates for free.Usually offered is a combined certificate and private key in PKCS#12format which S-nail does not accept directly.To convert it to PEM format, the following shell command can be used;please read on for how to use these PEM files.

$ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes$ # Alternatively$ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys$ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes

There is alsoLk https://www.CAcert.orgwhich issues client and server certificates to members of theircommunity for free; their root certificate( Lk https://www.cacert.org/certs/root.crt is often not in the default set of trusted CA root certificates, though,which means their root certificate has to be downloaded separately,and needs to be part of the S/MIME certificate validation chain byincluding it insmime-ca-diror as a vivid member of thesmime-ca-file But let us take a step-by-step tour on how to setup S/MIME witha certificate from CAcert.org despite this situation!

First of all you will have to become a member of the CAcert.orgcommunity, simply by registrating yourself via the web interface.Once you are, create and verify all email addresses you want to be ableto create signed and encrypted messages for/with using the correspondingentries 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 thecertificate 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-depthknowledge 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 theCAcert.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 yourbox) and the certificate belong together (through the public key thatwill 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 [at] 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 willask you for it whenever a message is signed or decrypted, unless thisoperation has been automated as described inSx Signed and encrypted messages with S/MIME .Set the following variables to henceforth use S/MIME (settingsmime-ca-fileis of interest for verification only):

? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \ smime-sign-cert=ME [at] HERE.com.paired \ smime-sign-digest=SHA512 \ smime-sign from=myname [at] my.host

Using CRLs with S/MIME or TLS

[Option] Certification authorities (CAs) issue certificate revocationlists (CRLs) on a regular basis.These lists contain the serial numbers of certificates that have beendeclared invalid after they have been issued.Such usually happens because the private key for the certificate hasbeen compromised,because the owner of the certificate has left the organization that ismentioned in the certificate, etc.To seriously use S/MIME or TLS verification,an up-to-date CRL is required for each trusted CA.There is otherwise no method to distinguish between valid andinvalidated certificates.S-nail currently offers no mechanism to fetch CRLs, nor to access them onthe 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.Thesmime-crl-dirortls-crl-dirvariables, 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 usedto verify a certificate.

FAQ

In general it is a good idea to turn ondebug( -d and / orverbose( -v twice) if something does not work well.Very often a diagnostic message can be produced that leads to theproblems' solution.

S-nail shortly hangs on startup

This can have two reasons, one is the necessity to wait for a file lockand cannot be helped, the other being that S-nail calls the functionuname(2)in order to query the nodename of the box (sometimes the real one isneeded instead of the one represented by the internal variablehostname ) 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 doeshostname(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 (via OAuth)

Since 2014 some free service providers classify programs as``less secure''unless they use a special authentication method (OAuth 2.0) whichwas not standardized for non-HTTP protocol authentication token queryuntil August 2015 (RFC 7628).

Different to Kerberos / GSSAPI, which is developed since the mid of the1980s, where a user can easily create a local authentication ticket forher- and himself with the locally installedkinit(1)program, that protocol has no such local part but instead requiresa world-wide-web query to create or fetch a token; since there is nolocal cache this query would have to be performed whenever S-nail isinvoked (in interactive sessions situation may differ).

S-nail does not directly support OAuth.It, however, supports XOAUTH2 / OAUTHBEARER, seeSx But, how about XOAUTH2 / OAUTHBEARER?If that is not used 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 inS-nail (for more on that see the sectionSx On URL syntax and credential lookup ) .

But, how about XOAUTH2 / OAUTHBEARER?

Following upSx I cannot login to Google mail (via OAuth)one OAuth-based authentication method is available:the OAuth 2.0 bearer token usage as standardized in RFC 6750 (accordingSASL mechanism in RFC 7628), also known as XOAUTH2 and OAUTHBEARER,allows fetching a temporary access token via the web that can locally beused as apassword The protocol is simple and extendable, token updates or even passwordchanges via a simple TLS secured server login would be possible intheory, but today a web browser and an external support tool areprerequisites for using this authentication method.The token times out and must be periodically refreshed via the web.

Some hurdles must be taken before being able to use this method.Using GMail as an example, an application (that is a name) must beregistered, for which credentials, a``client ID''and a``client secret'' need to be created and saved locally (in a secure way).These initial configuration steps can be performed atLk https://console.developers.google.com/apis/credentials .Thereafter a refresh token can be requested;a python program to do this for GMail accounts isLk https://github.com/google/gmail-oauth2-tools/raw/master/python/oauth2.py :

$ python oauth2.py --user=EMAIL \ --client-id=THE-ID --client-secret=THE-SECRET \ --generate_oauth2_tokenTo authorize token, visit this url and follow the directions: https://accounts.google.com/o/oauth2/auth?client_id=... Enter verification code: ... Refresh Token: ... Access Token: ... Access Token Expiration Seconds: 3600$ # Of which the last three are actual token responses.$ # Thereafter access tokens can regularly be refreshed$ # via the created refresh token (read on)

The generated refresh token must also be saved locally (securely).The procedure as a whole can be read atLk https://github.com/google/gmail-oauth2-tools/wiki/OAuth2DotPyRunThrough .Since periodic timers are not yet supported, keeping an access tokenup-to-date (from within S-nail) can only be performed via the hookon-main-loop-tick or (for sending only)on-compose-enter(for more on authentication please see the sectionSx On URL syntax and credential lookup ) :

set on-main-loop-tick=o-m-l-t on-compose-enter=o-c-edefine o-m-l-t { xcall update_access_token}define o-c-e { xcall update_access_token}set access_token_=0define update_access_token { local set i epoch_sec epoch_nsec vput vexpr i epoch eval set $i # set epoch_sec/_nsec of vexpr epoch vput vexpr i + $access_token_ 2100 if $epoch_sec -ge $i vput ! password python oauth2.py --user=EMAIL \ --client-id=THE-ID --client-secret=THE-SECRET \ --refresh-token=THE-REFRESH-TOKEN |\ sed '1b PASS;d; :PASS s/^.\{1,\}:\(.\{1,\}\)$/\1/' vput csop password trim "$password" if -n "$verbose" echo password is <$password> endif set access_token_=$epoch_sec endif}

Not "defunctional", but the editor key does not work

Two thinkable situations: the first is a shadowed sequence; settingdebug or the most possibleverbosemode, causes a printout of thebindtree after that is built; being a cache, this happens only upon startupor after modifying bindings.

Or second, terminal libraries (seeSx On terminal control and line editor,bind termcap may report different codes than the terminal really sends, renderingbindings dysfunctional because expected and received data do not match; theverboselisting ofbind ings will show the byte sequences that are expected.(One common source of problems is that the --- possibly evennon-existing --- keypad is not turned on, and the resulting layoutreports the keypad control codes for the normal keyboard keys.)

To overcome the situation use for example the programcat(1)with its option-v if available, to see the byte sequences which are actually producedby keypresses, and use the variabletermcapto make S-nail aware of them.The terminal this is typed on produces some unexpected sequences,here for an example 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

Can S-nail git-send-email?

Yes.Put (at least parts of) the following in your~/.gitconfig
[sendemail]smtpserver = /usr/bin/s-nailsmtpserveroption = -t#smtpserveroption = -Sexpandaddrsmtpserveroption = -Athe-account-you-need##suppresscc = allsuppressfrom = falseassume8bitEncoding = UTF-8#to = /tmp/OUTconfirm = alwayschainreplyto = truemultiedit = falsethread = truequiet = trueannotate = true

Newergit(1)versions (v2.33.0) added the optionsendmailCmd Patches can also be send directly, for example:

$ git format-patch -M --stdout HEAD^ | s-nail -A the-account-you-need -t RECEIVER

Howto handle stale dotlock files

foldersometimes fails to open MBOX mail databases because creation ofSx dotlock filesis impossible due to existing but unowned lock files.S-nail does not offer an option to deal with those files, because it isconsidered a site policy what counts as unowned, and what not.The site policy is usually defined by administrator(s), and expressed inthe configuration of a locally installed MTA (for example Postfix`stale_lock_time=500s') .Therefore the suggestion:
$ </dev/null s-nail -s 'MTA: be no frog, handle lock' $LOGNAME

By sending a mail to yourself the local MTA can use its normal queuemechanism to try the delivery multiple times, finally decide a lock filehas become stale, and remove it.

IMAP CLIENT

[Option]ally there is IMAP client support available.This part of the program is obsolete and will vanish in v15 with thelarge MIME and I/O layer rewrite, because it uses old-style blocking I/Oand makes excessive use of signal based long code jumps.Support can hopefully be readded later based on a new-style I/O, withSysV signal handling.In fact the IMAP support had already been removed from the codebase, butwas reinstantiated on user demand: in effect the IMAP code is at thelevel of S-nail v14.8.16 (withimapcodecbeing the sole exception), and should be treated with some care.

IMAP uses the`imap://'and`imaps://'protocol prefixes, and an IMAP-basedfoldermay be used.IMAP URLs (paths) undergo inspections and possible transformationsbefore use (and the commandimapcodeccan be used to manually apply them to any given argument).Hierarchy delimiters are normalized, a step which is configurable via theimap-delimvariable chain, but defaults to the first seen delimiter otherwise.S-nail supports internationalised IMAP names, and en- and decodes thenames from and to thettycharsetas necessary and possible.If a mailbox name is expanded (seeSx Filename transformations )to an IMAP mailbox, all names that begin with `+' then refer to IMAPmailboxes below thefoldertarget box, while folder names prefixed by `@' refer to folders belowthe hierarchy base, so the following will list all folders below thecurrent one when in an IMAP mailbox:`folders'@ .

Note: some IMAP servers do not accept the creation of mailboxes inthe 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 hierarchydelimiter).The following IMAP-specific commands exist:

cache
Only applicable to cached IMAP mailboxes;takes a message list and reads the specified messages into the IMAPcache.
connect
If operating in disconnected mode on an IMAP mailbox,switch to online mode and connect to the mail server while retainingthe mailbox status.See the description of thedisconnectedvariable 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 thedisconnectedvariable for more.A list of messages may optionally be given as argument;the respective messages are then read into the cache before theconnection 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 beavoided.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 argumentand 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.Supportsvput(seeSx Command modifiers ) ,and manages the error number! The first argument specifies the operation:e[ncode]normalizes hierarchy delimiters (seeimap-delim and converts the strings from the localettycharsetto the internationalized variant used by IMAP,d[ecode]performs the reverse operation.Encoding will honour the (global) value ofimap-delim

The following IMAP-specific internal variables exist:

disconnected
(Boolean) When an IMAP mailbox is selected and this variable is set,no connection to the server is initiated.Instead, data is obtained from the local cache (seeimap-cache ).Mailboxes that are not present in the cacheand messages that have not yet entirely been fetched from the serverare 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 queuedand committed later when a connection to that server is made.This procedure is not completely reliable since it cannot be guaranteedthat the IMAP unique identifiers (UIDs) on the server still match theones in the cache at that time.Data is saved toDEADwhen this problem occurs.
disconnected-USER [at] HOST
The specified account is handled as described for thedisconnectedvariable above,but other accounts are not affected.
imap-auth-USER [at] HOST , imap-auth
Sets the IMAP authentication method.Supported are the default`login',[v15-compat]`oauthbearer'(seeSx FAQentrySx But, how about XOAUTH2 / OAUTHBEARER? ) ,[v15-compat]`external'and`externanon'(for TLS secured connections which pass a client certificate viatls-config-pairs ) as well as the [Option]al`cram-md5'and`gssapi'All methods need auserand apasswordexcept`gssapi'and`external',which only need the former.`externanon'solely builds upon the credentials passed via a client certificate,and is usually the way to go since tested servers do not actually followRFC 4422, and fail if additional credentials are actually passed.
imap-cache
Enables caching of IMAP mailboxes.The value of this variable must point to a directory that is eitherexistent 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 [at] 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 ofhierarchy separators.If this variable is set, any occurrence of any character of the givenvalue that exists in the path will be replaced by the first member ofthe value; an empty value will cause the default to be used, it is`/.'If not set, we will reuse the first hierarchy separator character thatis discovered in a user-given mailbox name.
imap-keepalive-USER [at] HOST , imap-keepalive-HOST , imap-keepalive
IMAP servers may close the connection after a period ofinactivity; 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 causesa `NOOP' command to be sent each `value' seconds if no other operationis performed.
imap-list-depth
When retrieving the list of folders on an IMAP server, thefolderscommand stops after it has reached a certain depth to avoid possibleinfinite 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 thefolderscommand does not descend to subfolders.
imap-use-starttls-USER [at] HOST , imap-use-starttls-HOST , imap-use-starttls
Causes S-nail to issue a `STARTTLS' command to make an unencryptedIMAP session TLS encrypted.This functionality is not supported by all servers,and is not used if the session is already encrypted by the IMAPS method.

HISTORY

M. Douglas McIlroy writes in his article``A Research UNIX Reader: Annotated Excerpts'' from the Programmer's Manual, 1971-1986that amail(1)command already appeared in First EditionUNIXin 1971:
Electronic mail was there from the start.Never satisfied with its exact behavior, everybody touched it at onetime or another: to assure the safety of simultaneous access, to improveprivacy, to survive crashes, to exploit uucp, to screen out foreignfreeloaders, or whatever.Not until v7 did the interface change (Thompson).Later, as mail became global in its reach, Dave Presotto took charge andbrought order to communications with a grab-bag of external networks(v8).

BSD Mail, in large parts compatible withUNIXmail, was written in 1978 by Kurt Shoens and developed as part of theBSD UNIXdistribution until 1995.This manual page is derived from``The Mail Reference Manual''that Kurt Shoens wrote for Mail 1.3, included in 3BSD in 1980.The commonUNIXandBSD denominator became standardized asmailx(1)in the X/Open Portability Guide Issue 2 (January 1987).After the rise of Open SourceBSD variantsMail saw continuous development in the individual code forks,noticeably by Christos Zoulas inNet BSD Based upon this Nail, later Heirloom Mailx, was developed by GunnarRitter in the years 2000 until 2008.Since 2012 S-nail is maintained by Steffen Nurpmeso.

Electronic mail exchange in general is a concept even older.The earliest well documented electronic mail system was part of theCompatible Time Sharing System (CTSS) at MIT, its MAIL command had beenproposed in a staff planning memo at the end of 1964 and was implementedin mid-1965 when Tom Van Vleck and Noel Morris wrote the necessary code.Similar communication programs were built for other timesharing systems.One of the most ambitious and influential was Murray Turoff's EMISARI.Created in 1971 for the United States Office of Emergency Preparedness,EMISARI combined private electronic messages with a chat system, publicpostings, voting, and a user directory.

During the 1960s it was common to connect a large number of terminals toa single, central computer.Connecting two computers together was relatively unusual.This began to change with the development of the ARPANET, the ancestorof today's Internet.In 1971 Ray Tomlinson adapted the SNDMSG program, originally developedfor the University of California at Berkeley timesharing system, to giveit the ability to transmit a message across the network into the mailboxof a user on a different computer.For the first time it was necessary to specify the recipient's computeras well as an account name.Tomlinson decided that the underused commercial at`@'would work to separate the two.

Sending a message across the network was originally treated as a specialinstance of transmitting a file, and so a MAIL command was included inRFC 385 on file transfer in 1972.Because it was not always clear when or where a message had come from,RFC 561 in 1973 aimed to formalize electronic mail headers, including``from'' ``date'' and``subject'' In 1975 RFC 680 described fields to help with the transmission ofmessages to multiple users, including``to'' ``cc'' and``bcc'' In 1977 these features and others went from best practices to a bindingstandard in RFC 733.Queen Elizabeth II of England became the first head of state to sendelectronic mail on March 26 1976 while ceremonially opening a buildingin the British Royal Signals and Radar Establishment (RSRE) in Malvern.

AUTHORS

An -nosplitAn Kurt Shoens ,An Edward Wang ,An Keith Bostic ,An Christos Zoulas ,An Gunnar Ritter .S-nail is developed byAn Steffen Nurpmeso Aq s-mailx [at] lists.sdaoden.eu .

CAVEATS

[v15 behaviour may differ] Interrupting an operation viaSIGINTaka`control-C'from anywhere else but a command prompt is very problematic and likelyto leave the program in an undefined state: many library functionscannot deal with theFn siglongjmp 3that this software (still) performs; even though efforts have been takento address this, no sooner but in v15 it will have been worked out:interruptions have not been disabled in order to allow forceful breakageof hanging network connections, for example (all this is unrelated toignore )

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 makefurther attempts to transfer the message at a later time (settingsaveandsendwaitmay be useful).If this is a concern, it might be better to set up a local SMTP serverthat is capable of message queuing.

BUGS

When a network-based mailbox is open, directly changing to anothernetwork-based mailbox of a different protocol (i.e., from POP3 to IMAPor vice versa) will cause a``deadlock''

After deleting some message of a POP3 mailbox the header summary falselyclaims that there are no messages to display, one needs to performa scroll or dot movement to restore proper state.

In`thread'Nsedsortmode a power user may encounter crashes very occasionally (this is mayand very).

Please report bugs to thecontact-mailaddress, for example from within s-nail:`?'Ns Ic eval Ns Ic mail Ns $contact-mail .Including theverboseoutput of the commandversionmay be helpful:

? wysh set escape=! verbose; vput version xy; unset verbose;\ eval mail $contact-mailBug subject!I xy!.

Information on the web at`$'s-nail -X 'echo Ns $ Ns Va contact-web Ns ; x' .

SEE ALSO

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_format7(or regex(7)) mailwrapper(8),sendmail(8)

Linux Manuals Copyright Respective Owners. Site Copyright © SysTutorials. All Rights Reserved. Terms and Privacy

s-nail: send and receive Internet mail - Linux Manuals (1) (2024)

References

Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 6454

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.