Terminal Email

S-nail

CLIEmail client

Command-line mail program that implements POSIX mailx, with MIME, IMAP, POP3, SMTP, Maildir and S/MIME support.

S-nail is a fork of Heirloom mailx and works as a POSIX mailx(1) for reading and sending mail from a line-oriented prompt or from scripts. It speaks POP3, IMAP and SMTP itself, reads mbox and Maildir folders, and supports S/MIME signing and encryption. Upstream notes that its IMAP code is kept at an older level and should be used with care. It suits users who want a classic mail command for shell scripts and quick terminal use.

Type
Email client
Interface
Command-line tools and prompts
Systems
Runs on Linux, macOS and BSD, on Windows through WSL. Not available for Android.
Language
C
License
ISC and BSD 2-Clause and BSD 3-Clause and BSD 4-Clause
Latest version
14.9.25
Background
Fork of Heirloom mailx, which descends from BSD Mail
Maintained
Yes
Website
sdaoden.eu
Source
git.sdaoden.eu/browse/s-nail.git
Documentation
sdaoden.eu

Install

SystemSupportInstall
LinuxNative
aptsudo apt install s-nail
dnfsudo dnf install s-nail
pacmansudo pacman -S s-nail
macOSNative
Homebrewbrew install s-nail
WindowsThrough WSL
WSLsudo apt install s-nail

No native Windows build; run it in WSL.

BSDNative
FreeBSD pkgpkg install s-nail
OpenBSDpkg_add s-nail
AndroidNot supported

No Termux package.

Protocols and features

Protocols
ProtocolS-nail
IMAPYes
POP3Yes
SMTPYes
JMAPNo
MaildirYes
mboxYes
notmuchNo
Features
FeatureS-nail
OpenPGPNo
S/MIMEYes
OAuth2 sign-invia script
ThreadsYes
Searchbuilt-in message specifications and the search command; IMAP SEARCH on IMAP folders
HTML mailbuilt-in tag-soup filter or external viewer via mailcap
MouseNo
Multiple accountsYes
Offline useIMAP cache with disconnected mode
CalendarNo
Contactsaliases via the alias command
Vim-style keysNo
Configuration~/.mailrc command file

Pros and cons

Pros

  • Drop-in POSIX mailx, so it works in existing shell scripts and cron jobs.
  • Built-in SMTP, POP3 and IMAP with TLS; no separate sync or send tool needed.
  • S/MIME signing and encryption are built in.

Cons

  • Line-oriented prompt instead of a full-screen interface.
  • No built-in OpenPGP; upstream documents a gpg pipe workaround only.
  • IMAP support is kept at an older code level and upstream advises care.

Use S-nail with Forward Email

A working setup for a Forward Email mailbox. Replace you@example.com with your alias and the password command with your own. The same settings work with any provider once the server names change.

~/.mailrc
# ~/.mailrc  (start with: s-nail -A forwardemail)
set v15-compat
set tls-verify=strict
# Read credentials from an encrypted netrc file
set netrc-lookup netrc-pipe='gpg -qd ~/.netrc.gpg'

account forwardemail {
  set from='Your Name <you@example.com>'
  set folder=imaps://you%40example.com@imap.forwardemail.net \
      inbox=imaps://you%40example.com@imap.forwardemail.net/INBOX \
      record="+Sent Mail"
  set mta=smtps://you%40example.com@smtp.forwardemail.net:465
}

# Decrypted contents of ~/.netrc.gpg:
# machine imap.forwardemail.net login you@example.com password YOUR-GENERATED-PASSWORD
# machine smtp.forwardemail.net login you@example.com password YOUR-GENERATED-PASSWORD
# For POP3 instead of IMAP: set inbox=pop3s://you%40example.com@pop3.forwardemail.net
ProtocolServerPortSecurity
IMAPimap.forwardemail.net993SSL/TLS
POP3pop3.forwardemail.net995SSL/TLS
SMTPsmtp.forwardemail.net465SSL/TLS
SMTPsmtp.forwardemail.net587STARTTLS

Username: your full alias address, such as you@example.com. Password: the one shown by Generate Password next to the alias in your Forward Email account. Folders: INBOX, Drafts, Sent Mail, Trash, Spam and Archive.

Prefer no config at all? Forward Email's terminal app signs in with your account and has mail, calendar and contacts in one program.

Compare S-nail

All S-nail alternatives

Questions

Does S-nail work on Windows?

Not natively. It runs in Windows Subsystem for Linux (WSL). No native Windows build; run it in WSL.

Does S-nail support IMAP?

Yes, S-nail connects to IMAP servers directly.

Is S-nail open source?

Yes, under the ISC and BSD 2-Clause and BSD 3-Clause and BSD 4-Clause.

How do I use S-nail with Forward Email?

Use the config in the Forward Email section on this page, saved as ~/.mailrc, and replace the address and password with your own.

Sources