S-nail
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
| System | Support | Install |
|---|---|---|
| Linux | Native | apt sudo apt install s-naildnf sudo dnf install s-nailpacman sudo pacman -S s-nail |
| macOS | Native | Homebrew brew install s-nail |
| Windows | Through WSL | WSL sudo apt install s-nailNo native Windows build; run it in WSL. |
| BSD | Native | FreeBSD pkg pkg install s-nailOpenBSD pkg_add s-nail |
| Android | Not supported | No Termux package. |
Protocols and features
| Protocol | S-nail |
|---|---|
| IMAP | Yes |
| POP3 | Yes |
| SMTP | Yes |
| JMAP | No |
| Maildir | Yes |
| mbox | Yes |
| notmuch | No |
| Feature | S-nail |
|---|---|
| OpenPGP | No |
| S/MIME | Yes |
| OAuth2 sign-in | via script |
| Threads | Yes |
| Search | built-in message specifications and the search command; IMAP SEARCH on IMAP folders |
| HTML mail | built-in tag-soup filter or external viewer via mailcap |
| Mouse | No |
| Multiple accounts | Yes |
| Offline use | IMAP cache with disconnected mode |
| Calendar | No |
| Contacts | aliases via the alias command |
| Vim-style keys | No |
| 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 (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| Protocol | Server | Port | Security |
|---|---|---|---|
| IMAP | imap.forwardemail.net | 993 | SSL/TLS |
| POP3 | pop3.forwardemail.net | 995 | SSL/TLS |
| SMTP | smtp.forwardemail.net | 465 | SSL/TLS |
| SMTP | smtp.forwardemail.net | 587 | STARTTLS |
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
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
- sdaoden.eu/code.html
- sdaoden.eu/code-nail.html
- git.sdaoden.eu/browse/s-nail.git
- git.sdaoden.eu/browse/s-nail.git/tree/COPYING?h=v14.9.25
- git.sdaoden.eu/browse/s-nail.git/tree/README?h=v14.9.25
- git.sdaoden.eu/browse/s-nail.git/tree/nail.1?h=v14.9.25
- git.sdaoden.eu/browse/s-nail.git/tree/make.rc?h=v14.9.25
- packages.debian.org/trixie/s-nail
- mdapi.fedoraproject.org/rawhide/pkg/s-nail
- archlinux.org/packages/core/x86_64/s-nail/
- formulae.brew.sh/formula/s-nail
- github.com/freebsd/freebsd-ports/blob/main/mail/s-nail/Makefile
- github.com/openbsd/ports/blob/master/mail/s-nail/Makefile
- github.com/termux/termux-packages/tree/master/packages
- github.com/forwardemail/forwardemail.net/blob/master/helpers/ensure-default-mailboxes.js