ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

35.4.1 Mail Sending

There are two commands to send a message you have been editing:

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

If you want to send a message and be done with it, type C-c C-c (mail-send-and-exit). This sends the message and then either deletes the window or switches to another buffer. It also “buries” the mail buffer, putting it at the lowest priority for reselection. This is the usual command for sending a message.

The command C-c C-s (message-send) sends the message and marks the mail buffer unmodified, but leaves the buffer selected. Use this command if you want to modify the message (perhaps with new recipients) and send it again.

Sending a message runs the hook message-send-hook.

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

When you send a message containing 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. Its value should be a function, which can be one of the following:

sendmail-send-it
Send mail using the system's default sendmail (or sendmail-compatible) program. This is the default on Unix and GNU, and works provided the system is a valid mail host (that is, provided it can deliver mail via SMTP).
mailclient-send-it
Pass the mail buffer on to the system's designated mail client (see mailclient.el). This is the default on Mac OS X and MS-Windows.
smtpmail-send-it
Send mail through an external mail host (⁖, your Internet service provider's SMTP server). You will need to tell Emacs how to contact the SMTP server, by customizing the variables smtpmail-smtp-server and smtpmail-auth-credentials. See Emacs SMTP Library.
feedmail-send-it
This is similar to sendmail-send-it, but allows you to queue messages for later sending. See the commentary section in the file feedmail.el for more information.
blog comments powered by Disqus