# nmh

From ArchWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Related articles

- S-nail
- msmtp
- Mutt
- Postfix
- Notmuch

nmh (new message handler), is a powerful electronic mail handling system. Following the Unix Philosophy, nmh is made up by a collection of simple programs each of which has a single purpose. This architecture allows the user to intersperse nmh with other commands at the shell prompt and to write scripts tailored to their needs.

## Installing

Install nmhAUR or nmh-gitAUR from the AUR.

Optionally install a utility to handle IMAP or POP, for example fdm, offlineimap or getmailAUR.

Also optionally install msmtp or another utility for sending mail.

## Configuring

nmh is extensively configurable in a variety of ways. The primary of these is the `~/.mh_profile` file.

The syntax for .mh_profile is unusual. For example, nmh will refuse to run if there are blank lines in the file. Read the mh_profile (5) man page for more.

By default, nmh uses `~/Mail` as your mail folder. To change this, set `Path`:

     Path: path/to/mail/folder

Note:

- Path can be either full (if prefixed with `/`) or relative to $HOME.
- Nmh uses the mh mail format, which is different from the maildir and mbox. Setting your Path to a preexisting maildir folder, for example, will not work.

Set inbox (relative to Path):

     Inbox: inbox

Also by default, nmh populates the mail folder with the `inc` command, which incorporates mail from the user's mail drop (`/var/mail/user`).

If you have a non-standard mail drop path, you can set an environment variable `$MAILDROP`, or set MailDrop in `mh_profile`:

     MailDrop: /path/to/mail-drop

or set inc:

     inc: -file /path/to/mail-drop

Note: For each nmh command (see list below) the user can set default flags with a line of the form `command: -flag` format in mh_profile. These work much like bash aliases.

Nmh is also capable of retrieving mail via POP. A basic POP setup (see inc (1) man page for more):

     inc: -host example.com -user username -sasl

## Usage

To become familiar with basic nmh usage, learn and practice the following commands:

Command | Description
--- | ---
inc | Incorporate new mail.
scan | Scan the contents of the current folder.
folder/folders | Change the current folder or list folders and their contents.
show | Display messages.
comp | Compose a new message.
repl | Reply to a message.
refile | Move a message to another folder.

## Frontends

While nmh is fully usable from the command-line, several console-based and graphical user interfaces exist. Also, some common mail tools interact smoothly with the mh format.

### MH-specific Frontends

- MH-V, a console interface to mh/nmh with vi- keybindings.
- MH-E, a console interface to mh/nmh with Emacs keybindings.
- exmh, a TK-based mh GUI.

### MH-compatible Frontends

- Popular MUA mutt understands mh format. (Use `set mbox_type = mh` in your muttrc.)
- Full-text mail indexer and search utility mairix can read and write in mh format. (Use `mh=path/to/mh/folder` and `mformat=mh` in .mairixrc)

## See also

- Nmh official site
- Nmh project page on savannah
- Nmh-workers mailing list
- 'MH & nmh: Email for Users & Programmers' (book)

Category:

- Email clients