Terminal Email

nmh

CLIEmail client

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

SystemSupportInstall
LinuxNative
aptsudo apt install nmh
dnfsudo dnf install nmh
AURyay -S nmh
macOSNative
Homebrewbrew install nmh
WindowsThrough WSL
WSLsudo apt install nmh

No native Windows build; run it in WSL.

BSDNative
FreeBSD pkgpkg install nmh
OpenBSDpkg_add nmh
AndroidThrough Termux
Termuxpkg install nmh

Protocols and features

Protocols
Protocolnmh
IMAPThrough a separate tool
POP3Yes
SMTPYes
JMAPNo
MaildirYes
mboxYes
notmuchNo
Features
Featurenmh
OpenPGPNo
S/MIMENo
OAuth2 sign-inNo
ThreadsNo
Searchpick command matches header fields and message text
HTML mailvia mhshow with an external converter such as w3m
MouseNo
Multiple accountsvia per-command switches or separate profiles
Offline usefull; messages are stored as local files
Calendarreplies to invitations with mhical
Contactsaliases via MailAliases and the ali command
Vim-style keysNo
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
# ~/.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
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 nmh

All nmh alternatives

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