# 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 (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: https://www.nongnu.org/nmh/
- Source: https://git.savannah.gnu.org/cgit/nmh.git
- Documentation: https://git.savannah.gnu.org/cgit/nmh.git/tree/man

## Install

### Linux

Native.

- apt: `sudo apt install nmh`
- dnf: `sudo dnf install nmh`
- AUR: `yay -S nmh`

### macOS

Native.

- Homebrew: `brew install nmh`

### Windows

Through WSL. No native Windows build; run it in WSL.

- WSL: `sudo apt install nmh`

### BSD

Native.

- FreeBSD pkg: `pkg install nmh`
- OpenBSD: `pkg_add nmh`

### Android

Through Termux.

- Termux: `pkg install nmh`

## Protocols

- IMAP: Through a separate tool
- POP3: Yes
- SMTP: Yes
- JMAP: No
- Maildir: Yes
- mbox: Yes
- notmuch: No

## Features

- 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

- 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

File: `~/.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
```

| 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. Password: the one from Generate Password next to the alias. Folders: INBOX, Drafts, Sent Mail, Trash, Spam and Archive.

## 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

- https://www.nongnu.org/nmh/
- https://savannah.nongnu.org/projects/nmh/
- https://git.savannah.gnu.org/cgit/nmh.git
- https://git.savannah.gnu.org/cgit/nmh.git/tree/COPYRIGHT
- https://git.savannah.gnu.org/cgit/nmh.git/tree/man/inc.man
- https://git.savannah.gnu.org/cgit/nmh.git/tree/man/send.man
- https://git.savannah.gnu.org/cgit/nmh.git/tree/man/mh-profile.man
- https://git.savannah.gnu.org/cgit/nmh.git/tree/man/mh-tailor.man
- https://git.savannah.gnu.org/cgit/nmh.git/tree/man/mhical.man
- https://git.savannah.gnu.org/cgit/nmh.git/tree/sbr/credentials.c
- https://packages.debian.org/trixie/nmh
- https://mdapi.fedoraproject.org/rawhide/pkg/nmh
- https://aur.archlinux.org/packages/nmh
- https://formulae.brew.sh/formula/nmh
- https://github.com/Homebrew/homebrew-core/blob/main/Formula/n/nmh.rb
- https://github.com/freebsd/freebsd-ports/blob/main/mail/nmh/Makefile
- https://github.com/openbsd/ports/blob/master/mail/nmh/Makefile
- https://github.com/termux/termux-packages/blob/master/packages/nmh/build.sh
