s-nail (1) Linux Manual Page
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 COMMANDS change to Sx 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 and receiving mail. It is intended to provide the functionality of the POSIX mailx(1) command, but is MIME capable and optionally offers extensions for line editing, S/MIME, SMTP and POP3, among others. S-nail divides incoming mail into its constituent messages and allows the user to deal with them in any order. It offers many Sx COMMANDS and Sx INTERNAL VARIABLES for manipulating messages and sending mail. It provides the user simple editing capabilities to ease the composition of outgoing messages, and increasingly powerful and reliable non-interactive scripting capabilities.
Options
-:spec , –-resource-files =..- Controls loading of (as via
sourceSx Resource files : spec is parsed case-insensitively, the letter `s’ corresponds to the system wide s-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 -Aname , –-account =..- Activate user
accountname after program startup is complete (resource files loaded, only –Xcommands are to be executed), and switch to its Sx primary system mailbox (most likely the inbox ) If activation fails the program exit s if used non-interactively, or if any oferrexit or posix are set. -afile [=input-charset [#output-charset ] ]-
Fl Fl attach Ns =.. (Send mode) Attach file For (Compose mode) opportunities refer to ~@and~^file is subject to tilde expansion (see Sx Filename transformations andfolder )if it is not accessible but contains a `=’ character, anything before the last `=’ will be used as the filename, anything thereafter as a character set specification, as shown.If only an input character set is specified, the input side is fixed, and no character set conversion will be applied; an empty or the special string hyphen-minus `-‘ is taken for ttycharset (the default). If an output character set has also been specified the desired conversion is performed immediately, not considering file type and content, except for an empty string or hyphen-minus `-‘ , which select the default conversion algorithm (see Sx Character sets ) : no immediate conversion is performed, file and its contents will be MIME-classified ( Sx HTML mail and MIME attachments , The mime.types files) first — only the latter mode is available unless features includes `,+iconv,’
-B- ([Obsolete]: S-nail will always use line-buffered output, to gain line-buffered input even in batch mode enable batch mode via –
# .-baddr , –-bcc =..- (Send mode) Send a blind carbon copy to recipient addr The option may be used multiple times. Also see the section Sx On sending mail, and non-interactive mode .
-Cfield: 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 variable customhdr and in (Compose mode)
~^one of the Sx COMMAND ESCAPES , as well asdigmsgare the most flexible and powerful options to manage message headers. This option may be used multiple times.-caddr , –-cc =..- (Send mode) Just like –
bexcept it places the argument in the list of carbon copies.-D , –disconnected- [Option] Startup with disconnected
set-d , –debug- Enter a debug-only sandbox mode by setting the internal variable debug the same can be achieved via `-
S‘ Va debug or `set‘ Va debug . Also see –v-E , –discard-empty-messages- (Send mode)
setskipemptybody and thus discard messages with an empty message part body, successfully.-e , –check-and-exit- Just check if mail is present (in the system inbox or the one specified via –
f )if yes, return an exit status of zero, a non-zero value otherwise. To restrict the set of mails to consider in this evaluation a message specification can be added with the option –LQuickrun: does not open an interactive session.-F- (Send mode) Save the message to send in a file named after the local part of the first recipient’s address (instead of in record
).-f , –file- Read in the contents of the user’s Sx secondary mailbox
MBOX(or the specified file) for processing; when S-nail is quit, it writes undeleted messages back to this file (but be aware of the hold option). The optional file argument will undergo some special Sx Filename transformations (as viafolder )Note that file is not an argument to the flag –fbut is instead taken from the command line after option processing has been completed. In order to use a file that starts with a hyphen-minus, prefix with a relative path, as in `./-hyphenbox.mbox’-H , –header-summary- Display a summary of
headersfor the givenfolder(depending on –uinbox orMAILor as specified via –f )then exit. A configurable summary view is available via the option –LThis mode does not honour showlast Quickrun: does not open an interactive session.-h , –help- Show a brief usage summary; use –
-long-helpfor a list long options.-isetignore to ignore tty interrupt signals.-Lspec , –-search =..- Display a summary of
headersof all messages that match the given spec in thefolderfound by the same algorithm used by –Hthen exit. See the section Sx Specifying messages for the format of spec This mode does not honour showlastIf the –
eoption has been given in addition no header summary is produced, but S-nail will instead indicate via its exit status whether spec matched any messages ( `0′ or not ( `1′ ); note that any verbose output is suppressed in this mode and must instead be enabled explicitly (see –v )Quickrun: does not open an interactive session.-Mtype- (Send mode) Will flag standard input with the MIME `Content-Type:’ set to the given known type ( 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 of message-inject-head and message-inject-tail Also see –
q , m , t-mfile- (Send mode) MIME classify the specified file and use it as the main message body. [v15 behaviour may differ] Using this option will bypass processing of message-inject-head and message-inject-tail Also see –
q , M , t-N , –no-header-summary- inhibit the initial display of message headers when reading mail or editing a mailbox
folderby callingunsetfor the internal variable header-n- Standard flag that inhibits reading the system wide s-nail.rc upon startup. The option –
:allows more control over the startup sequence; also see Sx Resource files .-qfile , –-quote-file =..- (Send mode) Initialize the message body with the contents of file which may be standard input `-‘ only in non-interactive context. Also see –
M , m , t-R , –read-only- Any mailbox
folderakafolderopened will be in read-only mode.-rfrom-addr , –-from-address =..- The RFC 5321 reverse-path used for relaying and delegating messages to its destination(s), for example to report delivery errors, is normally derived from the address which appears in the from header (or, if that contains multiple addresses, in sender ) A file-based aka local executable mta (Mail-Transfer-Agent), however, instead uses the local identity of the initiating user.
When this command line option is used the given single addressee from-addr will be assigned to the internal variable from but in addition the command line option –
ffrom-addr will be passed to a file-based mta whenever a message is sent. Shall from-addr include a user name the address components will be separated and the name part will be passed to a file-based mta individually via –Fname Even though not a recipient the `shquote’ expandaddr flag is supported.If an empty string is passed as from-addr then the content of the variable from (or, if that contains multiple addresses, sender will be evaluated and used for this purpose whenever the file-based mta is contacted. By default, without –
rthat is, neither –fnor –Fcommand line options are used when contacting a file-based MTA, unless this automatic deduction is enforced byset ting the internal variabler-option-implicitRemarks: many default installations and sites disallow overriding the local user identity like this unless either the MTA has been configured accordingly or the user is member of a group with special privileges. Passing an invalid address will cause an error.
-Svar [=value , –set =..]set(or, with a prefix string `no’ , as documented in Sx INTERNAL VARIABLES ,unsetvariable and optionally assignvalue if supported; [v15 behaviour may differ] the entire expression is evaluated as if specified within dollar-single-quotes (see Sx Shell-style argument quoting ) if the internal variable v15-compat is set. If the operation fails the program will exit if any of errexit or posix are set. Settings established via –Scannot be changed from within Sx Resource files or an account switch initiated by –AThey will become mutable again before commands registered via –Xare executed.-ssubject , –-subject =..- (Send mode) Specify the subject of the message to be sent. Newline (NL) and carriage-return (CR) bytes are invalid and will be normalized to space (SP) characters.
-Tfield: addr , –-target =..- (Send mode) Add addr to the list of receivers targeted by field for now supported are only `bcc’ , `cc’ , `fcc’ , and `to’ Field and body (address) are separated by a colon `:’ and optionally blank (space, tabulator) characters. The `shquote’ expandaddr flag is supported. addr is parsed like a message header address line, as if it would be part of a template message fed in via –
tand 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 multiple plain 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 with any 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 to expandaddr validity 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 overriding reply-to ) `Sender:’ ( sender `From:’ ( from and / or option –
r )`Message-ID:’ , `In-Reply-To:’ , `References:’ and `Mail-Followup-To:’ , by default created automatically dependent on message context, will be used if specified (a special address massage will however still occur for the latter). Any other custom header field (also see –Ccustomhdr and~^is passed through entirely unchanged, and in conjunction with the options –~or –#it is possible to embed Sx COMMAND ESCAPES . Also see –M , m , q-uuser , –-inbox-of =..- Initially read the Sx primary system mailbox of user appropriate privileges presumed; effectively identical to `-
f‘ Ns %user .-V , –version- Show S-nails version and exit. The command
versionwill also show the list of features `$’ s-nail -:/ -Xversion -Xx .-v , –verboseset s the internal variableverbose to enable logging of informational context messages. (Increases level of verbosity when used multiple times.) Also see –d-Xcmd , –-startup-cmd =..- Add the given (or multiple for a multiline argument) cmd to a list of commands to be executed before normal operation starts. The commands will be evaluated as a unit, just as via
sourceCorrelates with –#and errexit-Ycmd , –-cmd =..- Add the given (or multiple for a multiline argument) cmd to a list of commands to be executed after normal operation has started. The commands will be evaluated successively in the given order, and as if given on the program’s standard input — before interactive prompting begins in interactive mode, after standard input has been consumed otherwise.
-~ , –enable-cmd-escapes- Enable Sx COMMAND ESCAPES in (Compose mode) even in non-interactive use cases. This can for example be used to automatically format the composed message text before sending the message:
$ ( echo 'line one. Word. Word2.';\ echo '~| /usr/bin/fmt -tuw66' ) |\ LC_ALL=C s-nail -d~:/ -Sttycharset=utf-8 bob [at] exam.ple-# , –batch-mode- Enables batch mode: standard input is made line buffered, the complete set of (interactive) commands is available, processing of Sx COMMAND ESCAPES is enabled in Sx Compose mode , and diverse Sx INTERNAL VARIABLES are adjusted for batch necessities, exactly as if done via –
Semptystart no errexit no header no posix quiet sendwait typescript-mode as well asMAILMBOXand inbox (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 ~s ubject Text ~. ' "${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, see Sx On sending mail, and non-interactive mode .
If the setting of expandargv allows their recognition all mta-option arguments given at the end of the command line after a `–‘ separator will be passed through to a file-based mta (Mail-Transfer-Agent) and persist for the entire session. expandargv constraints do not apply to the content of mta-arguments Command line receiver address handling supports the `shquote’ constraint of expandaddr for more please see Sx 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 of BSD Mail, itself a successor to the Research UNIX mail which “was there from the start” according to Sx HISTORY . It thus represents the user side of the UNIX mail system, whereas the system side (Mail-Transfer-Agent, MTA) was traditionally taken by sendmail(8) (and most MTAs provide a binary of this name for compatibility reasons). If the [Option]al SMTP mta is included in the features of S-nail then the system side is not a mandatory precondition for mail delivery.
S-nail strives for compliance with the POSIX mailx(1) standard, but posix one of the Sx INTERNAL VARIABLES , or its Sx ENVIRONMENT Ns al equivalent POSIXLY_CORRECT needs to be set to adjust behaviour to be almost on par. Almost, because there is one important difference: POSIX Sx Shell-style argument quoting is ([v15 behaviour may differ] increasingly) used instead of the Sx Old-style argument quoting that the standard documents, which is believed to be a feature. The builtin as well as the (default) global s-nail.rc Sx Resource files already bend the standard imposed settings a bit.
For example, hold and keepsave are set in order to suppress the automatic moving of messages to the Sx secondary mailbox MBOX that would otherwise occur (see Sx Message states ) , and keep to not remove empty system MBOX mailbox files (or all empty such files in posix mode) to avoid mangling of file permissions when files eventually get recreated.
To enter interactive mode even if the initial mailbox is empty emptystart is set, editheaders to allow editing of headers as well as fullnames to not strip down addresses in Sx Compose mode , and quote to include the message that is being responded to when reply ing, which is indented by an indentprefix that also deviates from standard imposed settings. mime-counter-evidence is fully enabled, too. It sets followup-to-honour and reply-to-honour to comply with reply address desires.
Credentials and other settings are easily addressable by grouping them via account The file mode creation mask can be managed with umask Files and shell pipe output can be source d for eval uation, also during startup from within the Sx Resource files . Informational context can be available by set ting verbose or debug (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-in mta (Mail-Transfer-Agent) transport to actually deliver the generated mail message, S-nail can be invoked with arguments which are the names of people to whom the mail will be sent, and the command line options –b and –c can 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 to alternates filtering, names only are first expanded through alias and mta-aliases An address in angle brackets consisting only of a valid local user `<name>’ will be converted to a fully qualified address if either hostname is not set, or set to a non-empty value; if set to the empty value the conversion is left up to the mta By setting expandaddr fine-grained control of recipient address types other than user names and network addresses is possible. Recipients are classified as follows: any name that starts with a vertical bar `|’ 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, see Sx 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 in Sx Compose mode . But many settings are static and can be set more generally. The envelope sender address for example is defined by from explicitly defining an originating hostname may be desirable, especially with the built-in SMTP Mail-Transfer-Agent mta Sx Character sets for outgoing message and MIME part content are configurable via sendcharsets whereas input data is assumed to be in ttycharset Message data will be passed over the wire in a mime-encoding and MIME parts aka attachments need a mimetype usually taken out of Sx The mime.types files . Saving copies of sent messages in a record mailbox may be desirable – as for most mailbox folder targets Sx Filename transformations will be performed.
For the purpose of arranging a complete environment of settings that can be switched to with a single command or command line option there are account s Alternatively a flat configuration could be possible, making use of 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.ple would find pop3-no-apop-yaa [at] exam.ple pop3-no-apop-exam.ple and pop3-no-apop in order. For more please see Sx On URL syntax and credential lookup and Sx INTERNAL VARIABLES .
To avoid environmental noise scripts should create a script-local environment, ideally with the command line options –: to disable configuration files in conjunction with repetitions of –S to 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 clean LC_ALL “C” but will nonetheless take and send UTF-8 in the message text by using ttycharset If character set conversion is compiled in ( features includes the term `,+iconv,’ ) invalid (according to ttycharset character input data would normally cause errors; setting mime-force-sendout will instead, as a last resort, classify the input as binary data, and therefore allow message creation to be successful. (Such content can then be inspected either by installing a pipe-TYPE/SUBTYPE handler for `application/octet-stream’ , or possibly automatically through mime-counter-evidence )
In interactive mode, introduced soon, messages can be sent by calling the mail command 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 of escape are special – these are so-called Sx COMMAND ESCAPES which can be used to read in files, process shell commands, add and edit attachments and more. For example ~v or ~e will start the VISUAL text EDITOR respectively, to revise the message in its current state, ~h allows editing of the most important message headers, with the potent ~^ custom headers can be created, for example (more specifically than with –C and customhdr ) [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 a folder target, after having been subject to Sx Filename transformations : this is the only way to create a file-carbon-copy without introducing an ambiguity regarding the interpretation of the address, file names with leading vertical bars or commercial ats can be used. Like all other recipients `Fcc:’ is subject to the checks of expandaddr Any local file and pipe command addressee honours the setting of mbox-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 ~x or ~q the latter of which will save the message in the file denoted by DEAD unless no save is set. And unless ignoreeof is 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 ~q is always reachable by typing end-of-text (ETX) twice via `control-C’ ( `^C’ ).
The compose mode hooks on-compose-enter , on-compose-splice , on-compose-leave and on-compose-cleanup may be set to define d macros and provide reliable and increasingly powerful mechanisms to perform 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 setting autocc , autobcc ) To achieve that the command digmsg may be used in order to query and adjust status of message(s). The splice hook can also make use of Sx COMMAND ESCAPES . ([v15 behaviour may differ] The compose mode hooks work for forward , mail , reply and variants; resend and Resend only provide the hooks on-resend-enter and on-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 which mails may be read. When used like that the user’s system inbox (for more on mailbox types please see the command folder is read in and a one line header of each message therein is displayed if the variable header is set. The visual style of this summary of headers can be adjusted through the variable headline and the possible sorting criterion via autosort Scrolling through screen fuls of headers can be performed with the command z If the initially opened mailbox is empty S-nail will instead exit immediately (after displaying a message) unless the variable emptystart is set.
At the prompt the command list will give a listing of all available commands and help will [Option]ally give a summary of some common ones. If the [Option]al documentation strings are available (see features one can type `help’ X (or `?X’ and see the actual expansion of `X’ and what its purpose is, i.e., commands can be abbreviated (note that POSIX defines some abbreviations, so that the alphabetical order of commands does not necessarily relate to the abbreviations; it is however possible to define overwrites with commandalias ) These commands can also produce a more verbose output.
Messages are given numbers (starting at 1) which uniquely identify messages; the current message – the “dot” – will either be the first new message, or the first unread message, or the first message of the mailbox; the internal variable showlast will instead cause usage of the last message for this purpose. The command headers will display a screen ful of header summaries containing the “dot” whereas from will display only the summaries of the given messages, defaulting to the “dot”
Message content can be displayed with the command type ( `t’ alias print ) Here the variable crt controls whether and when S-nail will use the configured PAGER for display instead of directly writing to the user terminal screen the sole difference to the command more which will always use the PAGER The command top will instead only show the first toplines of a message (maybe even compressed if topsqueeze is set). Message display experience may improve by setting and adjusting mime-counter-evidence and also see Sx HTML mail and MIME attachments .
By default the current message ( “dot” is displayed, but like with many other commands it is possible to give a fancy message specification (see Sx Specifying messages ) , for example `t:u’ will display all unread messages, `t.’ will display the “dot” `t’ 1 5 will type the messages 1 and 5, `t’ 1-5 will type the messages 1 through 5, and `t-‘ and `t+’ will display the previous and the next message, respectively. The command search (a more substantial alias for from will display a header summary of the given message specification list instead 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 be type d, but fields can be white- or blacklisted for a variety of applications by using the command headerpick e.g., to restrict their display to a very restricted set for type `headerpick ‘ Cd type retain Ar from to cc subject . In order to display all header fields of a message regardless of currently active ignore or retain lists, use the commands Type and Top Show will show the raw message content. Note that historically the global s-nail.rc not only adjusts the list of displayed headers, but also sets crt ([v15 behaviour may differ] A yet somewhat restricted) Reliable scriptable message inspection is available via digmsg
Dependent upon the configuration a line editor (see the section Sx On terminal control and line editor ) aims at making the user experience with the many Sx COMMANDS a bit nicer. When reading the system inbox or when –f (or folder specified a mailbox explicitly prefixed with the special `%:’ modifier (to propagate it to a Sx primary system mailbox ) , then messages which have been read (see Sx Message states will be automatically moved to a Sx secondary mailbox , the user’s MBOX file, when the mailbox is left, either by changing the active mailbox or by quitting S-nail – this automatic moving from a system- or primary- to the secondary mailbox is not performed when the variable hold is set. Messages can also be explicitly move d to other mailboxes, whereas copy keeps the original message. write can be used to write out data content of specific parts of messages.
After examining a message the user can reply `r’ to the sender and all recipients (which will also be placed in `To:’ unless recipients-in-cc is set), or Reply `R’ exclusively to the sender(s). To comply with with the receivers desired reply address the Sx quadoption Ns s followup-to-honour and reply-to-honour should usually be set. The commands Lreply and Lfollowup know how to apply a special addressee massage, see Sx Mailing lists . Dependent on the presence and value of quote the message being replied to will be included in a quoted form. forward ing a message will allow editing the new message: the original message will be contained in the message body, adjusted according to headerpick It is possible to resend or Resend messages: the former will add a series of `Resent-‘ headers, whereas the latter will not; different to newly created messages editing is not possible and no copy will be saved even with record unless the additional variable record-resent is set. When sending, replying or forwarding messages comments and full names will be stripped from recipient addresses unless the internal variable fullnames is set.
Of course messages can be delete `d’ and they can spring into existence again via undelete or when the S-nail session is ended via the exit or xit commands to perform a quick program termation. To end a mail processing session regularly and perform a full program exit one may issue the command quit It will, among others, move read messages to the Sx secondary mailbox MBOX as necessary, discard deleted messages in the current mailbox, and update the [Option]al (see features line editor history-file By the way, whenever the main event loop is about to look out for the next input line it will trigger the hook on-main-loop-tick
HTML mail and MIME attachments
HTML-only messages become more and more common, and many messages come bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions) parts and attachments. To get a notion of MIME types there is a built-in default set, onto which the content of Sx The mime.types files will be added (as configured and allowed by mimetypes-load-control ) Types can also become registered and listed with the command mimetype To improve interaction with the faulty MIME part declarations of real life mime-counter-evidence will allow verification of the given assertion, and the possible provision of an alternative, better MIME type. Note plain text parts will always be preferred in `multipart/alternative’ MIME messages unless mime-alternative-favour-rich is set.
Whereas a simple HTML-to-text filter for displaying HTML messages is [Option]ally supported (indicated by `,+filter-html-tagsoup,’ in features ) MIME types other than plain text cannot be handled directly. To deal with specific non-text MIME types or file extensions programs need to be registered which either prepare (re-)integrable plain text versions of their input (a mode which is called copiousoutput ) or display the content externally, for example in a graphical window: the latter type is only considered by and for the command mimeview
To install a handler program for a MIME type an according pipe-TYPE/SUBTYPE variable needs to be set; to define a handler for a file extension pipe-EXTENSION can be used – these handlers take precedence. [Option]ally mail user agent configuration is supported (see Sx The Mailcap files ) , and will be queried for display or quote handlers after the former ones. Type-markers registered via mimetype are the last possible source for information how to handle a MIME type.
For example, to display HTML messages integrated via the text browsers lynx(1) or elinks(1), register a MathML MIME type and enable its plain text display, and to open PDF attachments in an external PDF viewer, asynchronously and with some other magic attached:
? 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 ?
? ype “$@”
? }
?
