nmh
The MH message handling system: separate shell commands to read, file, search and send mail stored one file per message.
nmh (new MH) is a set of small programs such as inc, scan, show, comp, repl and pick that you run from the shell instead of a single mail program. Each message is a plain file in an MH folder, so ordinary Unix tools and scripts work on mail directly. inc pulls mail from a local mbox or Maildir drop or from a POP3 server, and post sends through SMTP with optional TLS and SASL. It suits users who want to script mail handling and compose with their own editor.
- Type
- Email client
- Interface
- Command-line tools and prompts
- Systems
- Runs on Linux, macOS and BSD, on Windows through WSL, on Android through Termux.
- Language
- C
- License
- BSD 3-Clause
- Latest version
1.8- Background
- Based on MH 6.8.3 from the RAND Corporation and the University of California
- Maintained
- Yes
- Website
- nongnu.org
- Source
- git.savannah.gnu.org/cgit/nmh.git
- Documentation
- git.savannah.gnu.org
Install
| System | Support | Install |
|---|---|---|
| Linux | Native | apt sudo apt install nmhdnf sudo dnf install nmhAUR yay -S nmh |
| macOS | Native | Homebrew brew install nmh |
| Windows | Through WSL | WSL sudo apt install nmhNo native Windows build; run it in WSL. |
| BSD | Native | FreeBSD pkg pkg install nmhOpenBSD pkg_add nmh |
| Android | Through Termux | Termux pkg install nmh |
Protocols and features
| Protocol | nmh |
|---|---|
| IMAP | Through a separate tool |
| POP3 | Yes |
| SMTP | Yes |
| JMAP | No |
| Maildir | Yes |
| mbox | Yes |
| notmuch | No |
| Feature | nmh |
|---|---|
| OpenPGP | No |
| S/MIME | No |
| OAuth2 sign-in | No |
| Threads | No |
| Search | pick command matches header fields and message text |
| HTML mail | via mhshow with an external converter such as w3m |
| Mouse | No |
| Multiple accounts | via per-command switches or separate profiles |
| Offline use | full; messages are stored as local files |
| Calendar | replies to invitations with mhical |
| Contacts | aliases via MailAliases and the ali command |
| Vim-style keys | No |
| Configuration | ~/.mh_profile and mts.conf text files |
Pros and cons
Pros
- Every action is a shell command, so mail handling is easy to script.
- One file per message lets grep, find and other Unix tools work on mail.
- Built-in POP3 and SMTP with TLS and SASL; reads mbox and Maildir drops.
Cons
- No IMAP; IMAP mail must be synced to a Maildir first and then incorporated.
- No built-in OpenPGP or S/MIME, and no thread view.
- SMTP authentication needs nmh built with Cyrus SASL and its PLAIN or LOGIN plugin.
Use nmh 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.
# ~/.mh_profile
Path: Mail
Local-Mailbox: Your Name <you@example.com>
send: -server smtp.forwardemail.net -port 465 -initialtls -sasl -saslmech PLAIN -user you@example.com
inc: -host pop3.forwardemail.net -port 995 -initialtls -user you@example.com
# Optional per-user mts.conf: export MHMTSUSERCONF=~/.mts.conf
# mts: smtp
# servers: smtp.forwardemail.net
# Passwords: with no "credentials:" profile entry nmh reads ~/.netrc (chmod 600):
# machine smtp.forwardemail.net login you@example.com password YOUR-GENERATED-PASSWORD
# machine pop3.forwardemail.net login you@example.com password YOUR-GENERATED-PASSWORD
# Usage: inc (fetch over POP3), scan, show, comp (write), send
# For IMAP, sync with mbsync to ~/Maildir/INBOX and run: inc -file ~/Maildir/INBOX| 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 nmh
Questions
Does nmh work on Windows?
Not natively. It runs in Windows Subsystem for Linux (WSL). No native Windows build; run it in WSL.
Does nmh support IMAP?
Through a separate tool. nmh reads local mail, so a sync program such as isync copies it from the IMAP server.
Is nmh open source?
Yes, under the BSD 3-Clause.
How do I use nmh with Forward Email?
Use the config in the Forward Email section on this page, saved as ~/.mh_profile, and replace the address and password with your own.
Sources
- nongnu.org/nmh/
- savannah.nongnu.org/projects/nmh/
- git.savannah.gnu.org/cgit/nmh.git
- git.savannah.gnu.org/cgit/nmh.git/tree/COPYRIGHT
- git.savannah.gnu.org/cgit/nmh.git/tree/man/inc.man
- git.savannah.gnu.org/cgit/nmh.git/tree/man/send.man
- git.savannah.gnu.org/cgit/nmh.git/tree/man/mh-profile.man
- git.savannah.gnu.org/cgit/nmh.git/tree/man/mh-tailor.man
- git.savannah.gnu.org/cgit/nmh.git/tree/man/mhical.man
- git.savannah.gnu.org/cgit/nmh.git/tree/sbr/credentials.c
- packages.debian.org/trixie/nmh
- mdapi.fedoraproject.org/rawhide/pkg/nmh
- aur.archlinux.org/packages/nmh
- formulae.brew.sh/formula/nmh
- github.com/Homebrew/homebrew-core/blob/main/Formula/n/nmh.rb
- github.com/freebsd/freebsd-ports/blob/main/mail/nmh/Makefile
- github.com/openbsd/ports/blob/master/mail/nmh/Makefile
- github.com/termux/termux-packages/blob/master/packages/nmh/build.sh