S-nail is a mail processing system with a command syntax reminiscent of ed, with lines replaced by messages. It is based on Heirloom mailx, which in turn is based upon Berkeley Mail 8.1. It is intended to provide the functionality of the POSIX mailx command and offers (mostly optional) extensions for IDNA, MIME, S/MIME, SMTP, POP3 and IMAP. It is usable as a mail batch language.
Sending mail with an external SMTP server
Configuration files are
$HOME/.mailrc and the systemwide
/etc/mail.rc. Add the following text to the appropriate file, changing bold strings:
set smtp=smtp(s)://server:port set smtp-use-starttls set smtp-auth-user=mailuser set smtp-auth-password=password set from="Your Name <youremail@domain>" # optional
Testing and sending emails
To test the configuration:
$ echo "message" | mailx -v -s "subject" firstname.lastname@example.org
Interactive use with an IMAP mailbox
folder is strictly required, the following are some suggested settings for interactive usage.
set folder=imap(s)://mylogin@server:port set record=+Sent # + means relative to folder retain subject from to cc # only print these headers by default set editalong # invoke $EDITOR when composing mail interactively set imap-keepalive=240 # or many servers will expire the session set imap-cache=~/.imap_cache # You may want to define shortcuts to folders, for example: shortcut junk "+INBOX/Junk Mail"
Additional accounts can be configured using the account command; see the man page for details.
When started in interactive mode, S-nail will print a listing of messages in your mailbox.
A message may be printed by typing its number, or the next message may be printed by simply hitting Enter. The following listing instructs basic usage, but once comfortable, a skimming of the manual is strongly encouraged.
- inc (incorporate) prints listing of new messages
- he (headers) reprints the message list
- z-, z+, Z pages the message list
- folders shows folder listing
- folder or fi changes the mailbox file
- r replies to all
- R replies to the sender
- move or mv moves a message
- (un)flag marks a message as (un)flagged
- new marks a message unread
- seen marks it read
- P prints all of a message's headers.
Most commands take a message-list as a parameter, which defaults to the current message.
Composition is started by typing mail user@host or by replying to a message. When you return from $EDITOR you will be placed into the native editor, where many operations can be performed using tilde escapes (listed by ~?). Of particular interest is ~@, which allows the attachment list to be edited.
To send the mail, signal EOT with
Ctrl+d or type "." on its own line.