# Sending Mail

This section explains xmh features you'll use to compose and send mail. The drafts can be composed in a main window or a composition window. You can work on more than one draft at the same time, store them, and come back some time later or make a "form letter" draft that you use over and over.

## Draft Messages and the drafts Folder

xmh automatically makes a folder named drafts. Like the draft folder in MH, the draft messages you compose are stored here. For more about folders, see the Section Organizing Messages with Folders.

Making a New Draft with Compose Message

If you're using the master xmh window or other main windows like it, you can select `Compose Message` on the `Message` menu -- a composition window will open for your new draft message. Or, if you're already working in a composition window and you click the `Compose Message` button at the bottom, it will make another composition window. You can work on several different drafts at once. For instance, in the Figure below I have two composition windows open. I'm clicking the `Compose Message` button on the `drafts:1` window to open a third composition window.

Figure: Working on several drafts at once

Each time you use `Compose Message`, xmh automatically creates an empty draft file in the drafts folder. If your draft folder is empty, the first draft you create will be message number 1 in the folder. A message-composition window will open onto that draft; the titlebar will say `drafts:1`. You can click the `Send` button to send that draft message right away or you can click `Save Message` and then `Close Window`. If you save without sending, the draft file stays in the drafts folder for you to finish later.

If you start a second draft before you've sent the first, that draft will be number 2 (unless there's already a message 2 in the draft folder). An editor window will open onto that draft; the titlebar will say `drafts:2`. From here, as you did before, you can send or save the message.

A composition window's titlebar will be marked `[Temporary]` unless the message has been saved at least once. See the Figure above.

Re-editing an Existing Draft

There are at least two ways you can work on a draft that you saved a while ago:

1. Open a new main window onto the drafts folder. To do that, select the `drafts` folder button, then select `Open Folder in New Window` on the `Folder` menu. A new xmh main window will open. The new window will be on top of the first one unless you've set the compGeometry resource to open the window in a particular place. (See the Section Changing How Commands Work.)

   Then, select a draft message from the list of messages: either click on it in the Table of Contents or make it the current message by displaying it. Finally, select `Use as Composition` on the `Message` menu -- and be sure to use the `Message` menu on the window that's showing the drafts folder.

   After you move this composition window (if you want to), your screen will look something like the Figure below.

   Figure: Recomposing a draft from a second main window

2. If you don't want to open a new main window on your drafts folder, just view the drafts folder in any main window. You can select a message, and then open a composition window with `Use as Composition` on the `Message` menu.

   If you are viewing the draft message in a view window (Section View Window), you can also click `Use as Composition` in the buttonbox at the bottom of the window.

If you're typing a long message, remember to click the `Save Message` button every so often. This saves your work (so that you won't lose it if the system goes down) then lets you keep editing.

After you save a draft once, it will stay in the drafts folder even after you send it. This is a nice way to make "form letters" that you send every so often -- you can change a few details of the draft, send it... then come back later, change some parts, send it again...

If you've saved the draft at least once, remember to delete it when you're done.

## Changing the Draft Message Header

You can edit the header (`To:`, etc.) of your messages while you're in the composition window. You can add other header fields then, too -- like `Fcc: project`, which puts a copy of the message you send directly into your folder named project. (If this is the first time you've used a particular folder, such as the project folder shown here, the folder will be silently created when you send the message. But a button for the new folder won't appear in the master window until you restart xmh. Also note that if you `Fcc:` a message to a folder, xmh will have to rescan the folder the next time you look at it.)

For more information, see the Section Template Draft Files Set Headers.

## More About Forwarding

The Section Forwarding Messages has an introduction to forwarding copies of messages. There are two ways to forward messages in xmh. The `Forward` button on the view window forwards the message you're viewing there. The `Forward` command on the `Message` menu of the main window forwards all of the selected messages. To forward messages that aren't next to each other in the table of contents, add them to a sequence, open the sequence, and select all the messages in the sequence.

Parts of the Section Formatting Forwarded Messages explain changes you can make to the ways that messages are forwarded.

## More About Replying

You can set an entry in your resource file that will let you include a copy of the original message in your reply when you press the `Insert` button at the bottom of the composition window. See the Section ReplyInsertFilter.

Because xmh runs the MH repl command to build the draft message before it opens the composition window, some `repl:` switches in your MH profile will affect the draft you get. For example, an entry such as the following:

        repl: -filter replfilt

includes the original message in your reply, formatted through the replfilt filter file. See the Section Including the Original Message with -filter.

Some switches can cause trouble. For example, using the repl -query switch in your MH profile will "freeze" xmh. The best answer is probably to use a separate MH profile for xmh. The Section Conflicts Between xmh and MH Customization explains how.

MH profile switches that aren't used to build the draft message won't affect xmh replies, though. For example, the -annotate switch, which asks the MH repl command to annotate the original message with a `Replied:` field in the header, won't work under xmh.

## Resend Messages with Use As Composition

When you're viewing a message, you can copy it into your drafts folder and start editing the copy. This is handy for resending a "bounced" mail message that was returned to you with some problems. (Usually, the problem is in the message's header.)

To do this, use the `Use as Composition` command on the `Message` or `View` menus. (Or click the `Use as Composition` button at the bottom of a view window.) It copies the message into the drafts folder and opens a composition window. (Note that Messages already in the drafts folder aren't copied to it.)

For example, in the Figure below the bad parts of a bounced mail message are being deleted by selecting the region (shown in inverse video) and pressing CTRL-W to kill the region. The `To:` address field has been fixed (the hostname was wrong). Don't forget to delete any `End of Unsent Draft` line at the end. Clicking the `Send` button will send the fixed-up draft.

Figure: Resending a returned message with Use As Composition

## Aliases

Because xmh uses the MH send(1) command, you can use MH mail aliases. These let you replace long lists of mail addresses with one short alias name. For example, instead of typing all of the addresses below:

        To: alissa@ketneg.com, uunet!abo!pxu341i, abd@mvus.bitnet

you could type the name of your alias that stands for those addresses:

        To: project

You have to maintain the aliases from a shell window or editor window instead of an xmh window. But once you're set up, you can use aliases from an xmh composition window just as you'd use any other address. For details, see the Section MH Aliases.