MH & nmh: Email for Users & Programmers

May, 2006

The Built-in Editor
by Brent Welch

The built-in editor provides a handful of text editing commands and several operations that affect the formatting of a mail message. Its window is shown in the Figure below.

Figure: Built-in editor


Editing Commands

The editor has about 20 key bindings for editing and moving the cursor. The bindings are Emacs-like, and the complete set is given in the Section Editing Keys. For example, <Control-f> moves the cursor forward one character, and <Control-d> deletes the character ahead of the cursor. The arrow keys are also bound to cursor motion. As noted in the Section Mousing Around, paste is <Control-y> and cut is <Control-w>. If you want to change these bindings, use the Simple Edit menu item under the main Bindings menu. This dialog lets you set up the second mouse button for paste, as well as change the keybindings for its editing and cursor motion commands. You have to press Save in this dialog before the binding changes take effect.

Sending a Message

Basically all you need to do is fill in your message header, type in the message body, and press the Send button in the upper-right corner of the editor window.

When you start, the cursor will be positioned at the end of the first empty header field -- or at the begining of the message body if, as with reply, all the fields are already initialized. When entering the header, <Tab> takes you to the next field, while <Double-Tab> positions the cursor at the start of the message body.

An important rule to remember about mail messages is that the header and body are separated by a blank line. MH also allows a separator line of all dashes (------).

Saving a Draft

If you want to save a message draft and return to it later, use the Save&Quit button. If you want to send a message but save it for use as another draft, select the Keep on Send checkbox item under the More... menu. In this case, when you click Send, the editor will remain open and the message will stay in your drafts folder. Otherwise the draft message is removed from the drafts folder after the message has been successfully sent. (Actually, it is renamed in the same fashion that rmm renames deleted messages. If you quit exmh and you have drafts in progress, then they are saved automatically and remain in your drafts folder.

CAUTION: The Save button under the More... writes the editor's buffer to the file system. It does not imply that the draft remains after it is sent. You probably want to use Save&Quit or Keep on Send instead.

Aborting a Draft

If you don't want to send a message, you can press the Abort button to delete it. If you haven't changed the initial template, emxh deletes the draft message immediately. Otherwise exmh prompts for confirmation.

Trick: A second click on the Abort button is the same as clicking the OK button in the confirmation dialog.


The editor supports signatures in two ways. If you select Auto-sign from the Simple Editor preferences section, then your ~/.signature file is appended to the message when you press the Send button. Without auto-sign, you have to click Sign to insert your ~/.signature file at the end of the message.

If there are several files in your home directory whose names start with .signature, the Sign button will be replaced with a Sign... menu of signature files. You can choose the default signature file in the Simple Editor preference section. With auto-sign, the Sign... menu has a set of check box items for choosing the signature file appended when you send the message. Without auto-sign, a signature is appended when you select one from the Sign... menu. If you are composing a multipart MIME message, your signature is added as another MIME part.

Tip: If your signature file has the execute permission set, then exmh tries to execute it and use its output for the signature. If you accidentally have the execute bit set, the error that occurs may not be that clear.


The PGP... menu provides access to the Pretty Good Privacy public key system. PGP sends messages with a digital signature to certify that you sent the message. You can also encrypt and decrypt messages with PGP. A complete discussion of PGP is far beyond the scope of this chapter. The Nutshell Handbook PGP: Pretty Good Privacy should be helpful. If you know PGP, you'll find the PGP features of exmh useful.