Next: , Up: Mail Mode


36.4.1 Mail Sending

Mail mode has two commands for sending the message you have been editing:

C-c C-s
Send the message, and leave the mail buffer selected (mail-send).
C-c C-c
Send the message, and select some other buffer (mail-send-and-exit).

C-c C-s (mail-send) sends the message and marks the mail buffer unmodified, but leaves that buffer selected so that you can modify the message (perhaps with new recipients) and send it again. C-c C-c (mail-send-and-exit) sends and then deletes the window or switches to another buffer. It puts the mail buffer at the lowest priority for reselection by default, since you are finished with using it. This is the usual way to send the message.

In a file-visiting buffer, sending the message does not clear the modified flag, because only saving the file should do that. As a result, you don't get a warning if you try to send the same message twice.

When you send a message that contains non-ASCII characters, they need to be encoded with a coding system (see Coding Systems). Usually the coding system is specified automatically by your chosen language environment (see Language Environments). You can explicitly specify the coding system for outgoing mail by setting the variable sendmail-coding-system (see Recognize Coding).

If the coding system thus determined does not handle the characters in a particular message, Emacs asks you to select the coding system to use, showing a list of possible coding systems.

The variable send-mail-function controls how the default mail user agent sends mail. It should be set to a function. The default is sendmail-send-it, which delivers mail using the Sendmail installation on the local host. To send mail through a SMTP server, set it to smtpmail-send-it and set up the Emacs SMTP library (see Sending mail via SMTP). A third option is feedmail-send-it, see the commentary section of the feedmail.el package for more information.