Skip to main content

How do I use the MH e-mail clients (nmh and exmh)?

nmh (which replaces the now-obsolete MH) is a command-line-oriented e-mail client which is highly customizable, but has a rather steep learning curve. Its documentation is linked from https://www.nongnu.org/nmh/

exmh is a a TK-based graphical user interface for nmh. Documentation on how to use it can be found at http://www.beedub.com/exmh/

Both programs are available on all ENCS-managed Linux servers and desktops.

In both cases, one distinguishing feature of the programs is that they store one e-mail message per file, and a mail folder is a directory. This is in contrast to most other e-mail software, which stores all of the messages of a mail folder in a single file. This means that messages in nmh/exmh are plain text files that can be handled with familiar Unix utility programs, such as “grep”.

Because access to mail is via the filesystem, in order to read your messages, you must be logged into a host that has access to them. For all folders except “INBOX”, any ENCS-managed server or desktop will do, since your mail folders are (by default) on your Unix home directory in the subdirectory “Mail”. However, the standard mail spool (user INBOXes) are available only on “login.encs.concordia.ca”. For how to deal with this, see below.

Documentation

If you have never run mh (nmh or exmh) before, you will need to run install-mh to create a default .mh_profile file, Mail directory, and Mail/inbox subdirectory.

The mail spool (your standard INBOX) is accessible only on the general login server, login.encs.concordia.ca.

To use inc on the standard INBOX (which pulls your new messages into nmh's own “inbox” folder), log into login.encs.concordia.ca using ssh. Then issue inc.

You can tell procmail to refile your incoming e-mail messages automatically, thus avoiding using inc altogether. This way, whenever any new e-mail arrives, it will automatically be delivered to your mh inbox folder. To check for new email you then only need to run scan +inbox.

To configure procmail to do this, first make sure the following environment variable is included in your .procmailrc file:

  MAILDIR=$HOME/Mail                

(Note that ~/Mail is your MH mail folder, versus the all-lowercase ~/mail, which is used by IMAP, and which you probably won't be using if you use MH.)

Add only one of the following pairs of lines at the end of your procmailrc file:

  : 0
  $HOME/Mail/inbox/.

or

  : 0w :$HOME/Mail/inbox/procmail$LOCKEXT 
  | rcvstore -create -unseen +inbox

The first one is simplest, but does not update the “unseen sequence”. The second one does update it, as long as you've set this in your .mh_profile file:

  Unseen-Sequence: unseen

For the second one, the lockfile is required otherwise multiple invocations of rcvstore may corrupt the sequences file. (Alternatively, you can use a single global lockfile; this is decribed in our procmail documentation.)

Note that only newly arriving messages will be processed by the above settings. You probably have mail still in your spool that needs to be inced. So after making the above changes, ssh to login.encs.concordia.ca and run inc one last time to incorporate any remaining spooled email into your mh inbox.

Detailed procmail instructions are available in https://www.concordia.ca/ginacody/aits/support/faq/procmail.html

Back to top

© Concordia University