36 Sending Mail
To send a message in Emacs, you start by typing a command (C-x m)
to select and initialize the ‘*mail*’ buffer. Then you edit the text
and headers of the message in this buffer, and type another command
(C-c C-s or C-c C-c) to send the message.
- C-x m
- Begin composing a message to send (
compose-mail
).
- C-x 4 m
- Likewise, but display the message in another window
(
compose-mail-other-window
).
- C-x 5 m
- Likewise, but make a new frame (
compose-mail-other-frame
).
- C-c C-s
- In Mail mode, send the message (
mail-send
).
- C-c C-c
- Send the message and bury the mail buffer (
mail-send-and-exit
).
The command C-x m (compose-mail
) selects a buffer named
‘*mail*’ and initializes it with the skeleton of an outgoing
message. C-x 4 m (compose-mail-other-window
) selects the
‘*mail*’ buffer in a different window, leaving the previous current
buffer visible. C-x 5 m (compose-mail-other-frame
) creates
a new frame to select the ‘*mail*’ buffer.
Because the mail-composition buffer is an ordinary Emacs buffer, you can
switch to other buffers while in the middle of composing mail, and switch
back later (or never). If you use the C-x m command again when you
have been composing another message but have not sent it, you are asked to
confirm before the old message is erased. If you answer n, the
‘*mail*’ buffer remains selected with its old contents, so you can
finish the old message and send it. C-u C-x m is another way to do
this. Sending the message marks the ‘*mail*’ buffer “unmodified,”
which avoids the need for confirmation when C-x m is next used.
If you are composing a message in the ‘*mail*’ buffer and want to
send another message before finishing the first, rename the
‘*mail*’ buffer using M-x rename-uniquely (see Misc Buffer). Then you can use C-x m or its variants described above
to make a new ‘*mail*’ buffer. Once you've done that, you can work
with each mail buffer independently.
The variable mail-default-directory
controls the default
directory for mail buffers, and also says where to put their auto-save
files.