The exmh mail agent (described in the handout ``Exmh: the basics'') is handy when you have a graphical user interface to support it. However, if you're away from MathLAN and have to log in through some software that provides only a text interface, exmh won't run. What then?

It turns out that exmh is in many respects only a front end to an older mail agent, MH, which was originally developed for character-based terminals. MH itself is available on MathLAN, so once you're accustomed to the exmh way of doing things, it's not a great stretch to use MH to accomplish the same results.

MH is a family of programs rather than a single program. As a first approximation, imagine that each of the labelled buttons in the exmh interface -- Inc, Comp, Reply, Delete, and so on -- runs a different program. Using MH, you start the program from the shell directly instead of clicking on a button to start it

The .mh_profile file

Using MH is a more pleasant experience if you do some one-time configuration work before hand. The configuration file for MH (and exmh) is a plain text file named .mh_profile, in your home directory. You can edit this file, adding lines that express your preferences about the appearance and behavior of MH.

The line that you're most likely to want to add specifies which of the editors available on MathLAN MH should invoke when you've asked to compose or reply to a message. Remember, it can't be one that depends on a graphical user interface. XEmacs is a possible choice; if you log in remotely, XEmacs detects that you have only a text interface and comes up in ``tty mode.'' If you are familiar with vi, that's another possibility. Most MH users, however, use a special-purpose front end called prompter, which collects a message line by line. To make prompter your message editor (for MH, not for exmh), add the line

Editor: prompter

anywhere in your .mh_profile file.

Collecting, reading, deleting, and filing mail

To pick up your incoming mail and move it into your inbox folder, type the command

$ inc

at the shell prompt. MH responds by printing the serial numbers, senders, and subject lines of the newly received messages.

$ inc
Incorporating new mail into inbox...

  55+ 08/08 Armin Groesslinge  [ANNOUNCE] HDoc: a "javadoc for Haskell"<<Hello,
  56  08/08 Greg Francis       Re: student accounts<<On 8 Aug 2000, Amos Gouaux
  57  08/08 Paul Fernhout      Re: xctocc documentation link bad?<<Thanks for t
  58  08/08 John David Stone   Having a wonderful time<<... except for the bad 

To see all of the messages in your inbox folder, including old and new messages, type

$ scan

at the shell prompt. MH displays the list in the same format:

$ scan
  54  08/07 Chris Hill         Database status<<(Continuing in my role as a min
  55+ 08/08 Armin Groesslinge  [ANNOUNCE] HDoc: a "javadoc for Haskell"<<Hello,
  56  08/08 Greg Francis       Re: student accounts<<On 8 Aug 2000, Amos Gouaux
  57  08/08 Paul Fernhout      Re: xctocc documentation link bad?<<Thanks for t
  58  08/08 John David Stone   Having a wonderful time<<... except for the bad 

To read the current message (marked by the plus sign in the list produced by scan), type


at the shell prompt:

$ show
(Message inbox:55)
Date:    Tue, 08 Aug 2000 20:25:08 +0200
From:    Armin Groesslinger <>
Subject: [ANNOUNCE] HDoc: a "javadoc for Haskell"

Delivery-Date: Tue Aug  8 13:22:26 CDT 

If the message is more than a few lines long, MH displays it through a pager -- a program that breaks it up into smaller units and doles them out one by one onto the screen, waiting for the user to press the <Enter> key between units.

To proceed to the next message, type


at the shell prompt. Similarly, to back up to the preceding message, type


To delete the current message, which is usually the last one you read, type


(``remove message'') at the shell prompt.

To create a new folder for messages -- one that is named, say, workshop -- type

folder +workshop

The plus sign is not considered to be part of the name of the folder, but it is a conventional way of signalling, within an MH command line, that what follows it is the name of a folder. Adding the name of a folder (preceded by a plus sign) to any of the preceding commands executes it with reference to the folder named.

If you're reading mail in your inbox folder and decide to file the current message in your workshop folder, type the command

refile +workshop

at the shell prompt. The variant

refile -link +workshop

files it in workshop without removing it from the current folder, so that you can file it again in another folder if you like.

Composing, replying to, and forwarding messages

To create and send a message through MH, type


at the shell prompt. This command starts your chosen editor, which collects your message; when the editor exits, comp resumes control and prints the prompt What now? -- allowing you either to send the message, file it as a draft, or discard it without sending.

Here is comp interacting with prompter to collect and send a message with a one-line body. What the user types is shown in boldface. Prompter exits when the user presses <Ctrl/D> (in this example, at the beginning of the line following the word `strike').

$ comp
Subject: Having a wonderful time
... except for the bad weather and the hotel employees' strike.

What now? send

Other possible responses to the What now? prompt include list (which reprints your message), edit (which re-enters the editor), quit (which saves the message in your drafts folder and then exits), and quit -delete (which discards the message and exits).

To reply to the current message, type


at the shell prompt. MH starts up your preferred editor and fills in the To and Subject lines for you:

$ repl
To: John David Stone <>
Subject: Re: Having a wonderful time 
In-Reply-To: Your message of "Tue, 08 Aug 2000 14:10:23 CDT."
Glad it's you and not me.

What now? send

To forward the current message, type


at the shell prompt. MH loads the current message into your editor and allows you to fill in the headers at the top (and to add to or edit the forwarded message, if you like).

Command-line arguments

Many of the preceding commands (show, rmm, refile, repl, forw) take a message number as an optional command-line argument. So, for instance, typing

show 55

at the shell prompt prints out message number 55 and makes it the current message, even if it was not current before.

All MH commands take other command-line arguments and options not mentioned here. For details, see the manual pages for the particular programs that belong to the MH family or the on-line book MH & xmh: email for users & programmers, by Jerry Peek.


To expand aliases, MH consults the same file (probably ~/.mh_aliases) that exmh uses. It is a plain text file, and most MH users add or delete aliases by just editing it.

To find out the expansion of a given alias, say linguistics, type

ali linguistics

at the shell prompt:

$ ali linguistics,,,

(laurel leaf logo)

created August 8, 2000
last revised June 26, 2001

John David Stone (