Editing a Draft

[previous] [next] [table of contents] [index]

Note: HTML conversion may not be complete.

When you edit a message that you want to send (called a draft in this case), the mode used is MH-Letter. This mode provides several commands in addition to the normal Emacs editing commands to help you edit your draft.

Command    |  Description
C-c C-y    |  Insert  contents  of  message  to   which
           |  you're replying
C-c C-i    |  Insert message from a folder
C-c C-f C-t|  Move to To: header field
C-c C-f C-c|  Move to cc: header field
C-c C-f C-s|  Move to Subject: header field
C-c C-c C-r|  Move to From: header field
C-c C-f C-b|  Move to Bcc: header field
C-c C-c C-f|  Move to Fcc: header field
C-c C-f C-d|  Move to Dcc: header field
C-c C-w    |  Display expanded recipient list
C-c C-s    |  Insert signature in message
C-c C-m C-f|  Include forwarded message (MIME)
C-c C-m C-e|  Include anonymous ftp reference (MIME)
C-c C-m C-t|  Include  anonymous   ftp   reference   to
           |  compressed tar file (MIME)
C-c C-m C-i|  Include binary, image, sound, etc. (MIME)
C-c C-e    |  Run through mhn before sending
C-c C-m C-u|  Undo effects of mhn
C-c C-c    |  Save draft and send message
C-c C-q    |  Quit editing and delete draft message

Editing Textual Messages

The following sections show you how to edit a draft. The commands described here are also applicable to messages that have multimedia components.

Inserting letter to which you're replying

It is often useful to insert a snippet of text from a letter that someone mailed to provide some context for your reply. The command C-c C-y does this by yanking a portion of text from the message to which you're replying and inserting "> " before each line.

You can control how much text is included when you run this command. If you run this command right away, without entering the buffer containing the message to you, this command will yank the entire message, as is, into your reply. (If you'd rather have the header cleaned up, use C-u r instead of r when replying (see the Section Replying to Mail).)

If you enter the buffer containing the message sent to you and move the cursor to a certain point and return to your reply and run C-c C-y, then the text yanked will range from that point to the end of the message. Finally, the most common action you'll perform is to enter the message sent to you, move the cursor to the beginning of a paragraph or phrase, set the mark with C-SPC or C-@, and move the cursor to the end of the paragraph or phrase. The cursor position is called the point, and the space between the mark and point is called the region. Having done that, C-c C-y will insert the region or phrase you selected.

Inserting Messages

Messages can be inserted with C-c C-i. This command prompts you for the folder and message number and inserts the message, indented by "> ". Certain undesirable header fields are removed before insertion. If given a prefix argument (like C-u C-c C-y), the header is left intact, the message is not indented, and "> " is not inserted before each line.

Editing the Header

Because the header is part of the message, you can edit the header fields as you wish. However, several convenience functions exist to help you create and edit them. For example, the command C-c C-f C-t (alternatively, C-c C-f t) moves the cursor to the To: header field, creating it if necessary. The functions to move to the cc:, Subject:, From:, Bcc:, and Dcc: header fields are similar. The Section Fields You Add to a Header explains the fields Bcc:, Dcc:, and others.

One function behaves differently from the others, namely, C-c C-f C-f (alternatively, C-c C-f f). This function can be given a prefix argument (for instance, C-u C-c C-f C-f outfolder RET which will cause the function to prompt you for the folder name in which to refile the draft).

Be sure to leave a row of dashes or a blank line between the header and the body of the message.

Checking recipients

Aliases can be expanded and addresses can be checked by using the C-c C-w command. A new buffer is created with the output of whom(1) (The Section What now? -- and the whatnow Program).

Inserting your signature

You can insert your signature at the current cursor location with the C-c C-s command. Place the text of your signature in the file ~/.signature before typing the command.

Editing Multimedia Messages

mh-e has the capability to create multimedia messages. It uses the MIME (Multipurpose Internet Mail Extensions) protocol. The MIME protocol allows you to incorporate images, sound, video, binary files, and even commands that fetch a file with ftp(1) when your recipient reads the message! If you were to create a multimedia message with plain MH commands, you would use mhn; indeed, the mh-e MIME commands merely insert mhn directives which are later expanded by mhn.

Each of the mh-e commands for editing multimedia messages or for incorporating multimedia objects is prefixed with C-c C-m.

Several MIME objects are defined. They are called content types. The table in the Section Editing a Draft contains a list of the content types that mh-e currently knows about. Several of the mh-e commands fill in the content type for you, whereas others require you to enter one. Most of the time, it should be obvious which one to use (that is, use image/gif to include a GIF image). If not, you can refer to the Chapter Introduction to MIME to learn more about MIME in general.

You are also sometimes asked for a content description. This is simply an optional brief phrase, in your own words, that describes the object. If you don't care to enter a content description, just press return and none will be included; however, a reader may skip over multimedia fields unless the content description is compelling.

Remember: you can always add mhn directives by hand. The Section Composing and Sending MIME Messages explains how.

Forwarding multimedia messages

Mail may be forwarded with MIME using the command C-c C-m C-f. You are prompted for a content description, the name of the folder in which the messages to forward are located, and the messages' numbers.

Including an ftp reference

You can even have your message initiate an ftp transfer when the recipient reads the message. To do this, use the C-c C-m C-e command. You are prompted for the remote host and pathname, the content type, and the content description.

Including tar files

If the remote file is a compressed tar file, you can use C-c C-m C-t. Then, in addition to retrieving the file via anonymous ftp, the file will also be uncompressed and untarred. You are prompted for the remote host and pathname and the content description. The pathname should contain at least one / (slash), because the pathname is broken up into directory and name components.

Including other multimedia objects

Images, sound, and video can be inserted in your message with the C-c C-m C-i command. You are prompted for the filename containing the object, the content type, and a content description of the object.

Readying multimedia messages for sending

When you are finished editing a MIME message, it might look like the Figure mh-e MIME draft:

Figure: mh-e MIME draft


The lines added by the previous commands are mhn directives and need to be converted to MIME directives before sending. This is accomplished by the command C-c C-e, which runs mhn on the message. The Figure mh-e MIME draft ready to send shows what those commands look like in full MIME format. You can see why mail user agents are usually built to hide these details from the user.

This action can be undone by running C-c C-m C-u. It does this by reverting to a backup file. You are prompted to confirm this action, but you can avoid the confirmation by adding an argument (for example, C-u C-c C-m C-u).

Sending a Message

When you are all through editing a message, you send it with the C-c C-c command. You can give an argument (as in C-u C-c C-c) to monitor the first stage of the delivery (see the Section What now? -- and the whatnow Program for more details).

Figure: mh-e MIME draft ready to send


Killing the Draft

If for some reason you are not happy with the draft, you can kill it instead with C-c C-q. Emacs then kills the draft buffer and deletes the draft message.

[Table of Contents] [Index] [Previous: Sending Mail] [Next: Moving Your Mail Around]

(This section was written by Bill Wohler.)
Last change $Date: 1996/07/14 17:35:00 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Bill Wohler <wohler@newt.com>