@c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001, 2003
-@c Free Software Foundation, Inc.
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
+@c 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
-@node Sending Mail, Rmail, Picture, Top
+@node Sending Mail, Rmail, Abbrevs, Top
@chapter Sending Mail
@cindex sending mail
@cindex mail
back later (or never). If you use the @kbd{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 @kbd{n}, the
-@samp{*mail*} buffer is left selected with its old contents, so you can
+@samp{*mail*} buffer remains selected with its old contents, so you can
finish the old message and send it. @kbd{C-u C-x m} is another way to do
this. Sending the message marks the @samp{*mail*} buffer ``unmodified,''
which avoids the need for confirmation when @kbd{C-x m} is next used.
* Mode: Mail Mode. Special commands for editing mail being composed.
* Amuse: Mail Amusements. Distracting the NSA; adding fortune messages.
* Methods: Mail Methods. Using alternative mail-composition methods.
-* SMTP: Sending via SMTP. Sending mail via SMTP.
@end menu
@node Mail Format
automatically when you send the message. Others, such as the recipient
names, must be specified by you in order to send the message properly.
- Mail mode provides a few commands to help you edit some header fields,
-and some are preinitialized in the buffer automatically at times. You can
-insert and edit header fields using ordinary editing commands.
+ In the mail buffer, you can insert and edit header fields using
+ordinary editing commands. Mail mode provides a commands to help you
+edit some header fields, and some are preinitialized in the buffer
+automatically when appropriate.
The line in the buffer that says
message actually sent. The text used for the delimiter line is controlled
by the variable @code{mail-header-separator}.
-Here is an example of what the headers and text in the mail buffer
+ Here is an example of what the headers and text in the mail buffer
might look like.
@example
continuation lines: one or more lines starting with whitespace,
following the starting line of the field, are considered part of the
field. Here's an example of a @samp{To} field with a continuation
-line:@refill
+line:
@example
@group
alias maingnu gnu@@gnu.org local-gnu
@end example
- Emacs also recognizes include commands in @samp{.mailrc} files.
+@noindent
+Addresses specified in this way should use doublequotes around an
+entire address when the address contains spaces. But you need not
+include doublequotes around parts of the address, such as the person's
+full name. Emacs puts them in if they are needed. For example,
+
+@example
+alias chief-torturer "George W. Bush <bush@@whitehouse.gov>"
+@end example
+
+@noindent
+is correct. Emacs will insert the address as @samp{"George W. Bush"
+<bush@@whitehouse.gov>}.
+
+ Emacs also recognizes ``include'' commands in @samp{.mailrc} files.
They look like this:
@example
@smallexample
(add-hook 'mail-mode-hook
(lambda ()
- (substitute-key-definition
- 'next-line 'mail-abbrev-next-line
- mail-mode-map global-map)
- (substitute-key-definition
- 'end-of-buffer 'mail-abbrev-end-of-buffer
- mail-mode-map global-map)))
+ (define-key
+ mail-mode-map [remap next-line] 'mail-abbrev-next-line)
+ (define-key
+ mail-mode-map [remap end-of-buffer] 'mail-abbrev-end-of-buffer)))
@end smallexample
@node Mail Mode
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.
+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.
@c This is indexed in mule.texi, node "Recognize Coding".
@c @vindex sendmail-coding-system
- When you send a message that contains non-ASCII characters, they need
+ When you send a message that contains non-@acronym{ASCII} characters, they need
to be encoded with a coding system (@pxref{Coding Systems}). Usually
the coding system is specified automatically by your chosen language
environment (@pxref{Language Environments}). You can explicitly specify
a particular message, Emacs asks you to select the coding system to use,
showing a list of possible coding systems.
+@cindex SMTP
+@cindex Feedmail
+@cindex Sendmail
+@vindex send-mail-function
+ The variable @code{send-mail-function} controls how the default mail
+user agent sends mail. It should be set to a function. The default
+is @code{sendmail-send-it}, which delivers mail using the Sendmail
+installation on the local host. To send mail through a SMTP server,
+set it to @code{smtpmail-send-it} and set up the Emacs SMTP library
+(@pxref{Top,,Emacs SMTP Library, smtpmail, Sending mail via SMTP}). A
+third option is @code{feedmail-send-it}, see the commentary section of
+the @file{feedmail.el} package for more information.
+
@node Header Editing
@subsection Mail Header Editing
@findex mail-complete
@kindex M-TAB @r{(Mail mode)}
- While editing a header field that contains mailing addresses, such as
-@samp{To:}, @samp{CC:} and @samp{BCC:}, you can complete a mailing
-address by typing @kbd{M-@key{TAB}} (@code{mail-complete}). It inserts
-the full name corresponding to the address, if it can determine the full
-name. The variable @code{mail-complete-style} controls whether to insert
-the full name, and what style to use, as in @code{mail-from-style}
-(@pxref{Mail Headers}).
+ While editing a header field that contains mailing addresses, such
+as @samp{To:}, @samp{CC:} and @samp{BCC:}, you can complete a mailing
+address by typing @kbd{M-@key{TAB}} (@code{mail-complete}). It
+inserts the full name corresponding to the address, if it can
+determine the full name. The variable @code{mail-complete-style}
+controls whether to insert the full name, and what style to use, as in
+@code{mail-from-style} (@pxref{Mail Headers}). (If your window
+manager defines @kbd{M-@key{TAB}} to switch windows, you can type
+@kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.)
For completion purposes, the valid mailing addresses are taken to be
the local users' names plus your personal mail aliases. You can
-specify additional sources of valid addresses; look at the customization
-group @samp{mailalias} to see the options for this
-(@pxref{Customization Groups}).
+specify additional sources of valid addresses; see the customization
+group @samp{mailalias} to see the variables for customizing this
+feature (@pxref{Customization Groups}).
If you type @kbd{M-@key{TAB}} in the body of the message,
@code{mail-complete} invokes @code{ispell-complete-word}, as in Text
often more convenient to use a special command, @kbd{C-c C-i}
(@code{mail-attach-file}). This command inserts the file contents at
the end of the buffer, after your signature if any, with a delimiter
-line that includes the file name.
+line that includes the file name. Note that this is not a MIME
+attachment.
@vindex mail-mode-hook
@vindex mail-setup-hook
and sending mail---Mail mode. Emacs has alternative facilities for
editing and sending mail, including
MH-E and Message mode, not documented in this manual.
-@xref{MH-E,,,mh-e, The Emacs Interface to MH}. @xref{Message,,,message,
+@xref{Top,,MH-E,mh-e, The Emacs Interface to MH}. @xref{Top,,Message,message,
Message Manual}. You can choose any of them as your preferred method.
The commands @code{C-x m}, @code{C-x 4 m} and @code{C-x 5 m} use
whichever agent you have specified, as do various other Emacs commands
apply; the other methods use a different format of text in a different
buffer, and their commands are different as well.
-@node Sending via SMTP
-@section Sending via SMTP
-@cindex SMTP
-
- Emacs includes a package for sending your mail to a SMTP server and
-have it take care of delivering it to the final destination, rather
-than letting the MTA on your local system take care of it. This can
-be useful if you don't have a MTA set up on your host, or if your
-machine is often disconnected from the Internet.
-
- Sending mail via SMTP requires configuring your mail user agent
-(@pxref{Mail Methods}) to use the SMTP library. How to do this should
-be described for each mail user agent; for the Message and Gnus user
-agents the variable @code{message-send-mail-function} (@pxref{Mail
-Variables,,,message}) is used.
-
-@vindex send-mail-function
- The variable @code{send-mail-function} controls how the default mail
-user agent sends mail. It should be set to a function. The default
-is @code{sendmail-send-it}, but must be set to @code{smtpmail-send-it}
-in order to use the SMTP library. @code{feedmail-send-it} is another
-option.
-
- Before using SMTP you must find out the hostname of the SMTP server
-to use. Your system administrator should provide you with this
-information, but often it is the same as the server you receive mail
-from.
-
-@vindex smtpmail-smtp-server
- The variable @code{smtpmail-smtp-server} controls the hostname of
-the server to use. It is a string with an IP address or hostname. It
-defaults to the contents of the @code{SMTPSERVER} environment
-variable, or, if empty, the contents of
-@code{smtpmail-default-smtp-server}.
-
-@vindex smtpmail-default-smtp-server
- The variable @code{smtpmail-default-smtp-server} controls the
-default hostname of the server to use. It is a string with an IP
-address or hostname. It must be set before the SMTP library is
-loaded. It has no effect if set after the SMTP library has been
-loaded, or if @code{smtpmail-smtp-server} is defined. It is usually
-set by system administrators in a site wide initialization file.
-
-@cindex Mail Submission
-SMTP is normally used on the registered ``smtp'' TCP service port 25.
-Some environments use SMTP in ``Mail Submission'' mode, which uses
-port 587. Using other ports is not uncommon, either for security by
-obscurity purposes, port forwarding, or otherwise.
-
-@vindex smtpmail-smtp-service
- The variable @code{smtpmail-smtp-service} controls the port on the
-server to contact. It is either a string, in which case it will be
-translated into an integer using system calls, or an integer.
-
-Many environments require SMTP clients to authenticate themselves
-before they are allowed to route mail via a server. The two following
-variables contains the authentication information needed for this.
-The first variable, @code{smtpmail-auth-credentials}, instructs the
-SMTP library to use a SASL authentication step, currently only the
-CRAM-MD5, PLAIN and LOGIN-MD5 mechanisms are supported and will be
-selected in that order if the server supports them. The second
-variable, @code{smtpmail-starttls-credentials}, instructs the SMTP
-library to connect to the server using STARTTLS. This means the
-protocol exchange can be integrity protected and confidential by using
-TLS, and optionally also authentication of the client. It is common
-to use both these mechanisms, e.g. to use STARTTLS to achieve
-integrity and confidentiality and then use SASL for client
-authentication.
-
-@vindex smtpmail-auth-credentials
- The variable @code{smtpmail-auth-credentials} contains a list of
-hostname, port, username and password tuples. When the SMTP library
-connects to a host on a certain port, this variable is searched to
-find a matching entry for that hostname and port. If an entry is
-found, the authentication process is invoked and the credentials are
-used. The hostname field follows the same format as
-@code{smtpmail-smtp-server} (i.e., a string) and the port field the
-same format as @code{smtpmail-smtp-service} (i.e., a string or an
-integer). The username and password fields, which either can be
-@samp{nil} to indicate that the user is queried for the value
-interactively, should be strings with the username and password,
-respectively, information that is normally provided by system
-administrators.
-
-@vindex smtpmail-starttls-credentials
- The variable @code{smtpmail-starttls-credentials} contains a list of
-tuples with hostname, port, name of file containing client key, and
-name of file containing client certificate. The processing is similar
-to the previous variable. The client key and certificate may be
-@samp{nil} if you do not wish to use client authentication. The use
-of this variable requires the @samp{starttls} external program to be
-installed, you can get it from
-@samp{ftp://ftp.opaopa.org/pub/elisp/starttls-*.tar.gz}.
-
-The remaining variables are more esoteric and is normally not needed.
-
-@vindex smtpmail-debug-info
- The variable @code{smtpmail-debug-info} controls whether to print
-the SMTP protocol exchange in the minibuffer, and retain the entire
-exchange in a buffer @samp{*trace of SMTP session to
-mail.example.org*}.
-
-@vindex smtpmail-debug-verb
- The variable @code{smtpmail-debug-verb} controls whether to send the
-VERB token to the server. The VERB server instructs the server to be
-more verbose, and often also to attempt final delivery while your SMTP
-session is still running. It is usually only useful together with
-@code{smtpmail-debug-info}. Note that this may cause mail delivery to
-take considerable time if the final destination cannot accept mail.
-
-@vindex smtpmail-local-domain
- The variable @code{smtpmail-local-domain} controls the hostname sent
-in the first EHLO or HELO command sent to the server. It should only
-be set if the @code{system-name} function returns a name that isn't
-accepted by the server. Do not set this variable unless your server
-complains.
-
-@vindex smtpmail-sendto-domain
- The variable @code{smtpmail-sendto-domain} makes the SMTP library
-add @samp{@@} and the specified value to recipients specified in the
-message when they are sent using the RCPT TO command. Some
-configurations of sendmail requires this behaviour. Don't bother to
-set this unless you have get an error like:
-
-@example
- Sending failed; SMTP protocol error
-@end example
-
-when sending mail, and the *trace of SMTP session to <somewhere>*
-buffer (enabled via @code{smtpmail-debug-info}) includes an exchange
-like:
-
-@example
- RCPT TO: <someone>
- 501 <someone>: recipient address must contain a domain
-@end example
-
-@vindex smtpmail-queue-mail
- The variable @code{smtpmail-queue-mail} controls whether a simple
-off line mail sender is active. This variable is a boolean, and
-defaults to @samp{nil} (disabled). If this is non-nil, mail is not
-sent immediately but rather queued in the directory
-@code{smtpmail-queue-dir} and can be later sent manually by invoking
-@code{smtpmail-send-queued-mail} (typically when you connect to the
-Internet).
-
-@vindex smtpmail-queue-dir
- The variable @code{smtpmail-queue-dir} specifies the name of the
-directory to hold queued messages. It defaults to
-@samp{~/Mail/queued-mail/}.
-
-@findex smtpmail-send-queued-mail
- The function @code{smtpmail-send-queued-mail} can be used to send
-any queued mail when @code{smtpmail-queue-mail} is enabled. It is
-typically invoked interactively with @kbd{M-x RET
-smtpmail-send-queued-mail RET} when you are connected to the Internet.
+@ignore
+ arch-tag: d8a3dfc3-5d87-45c5-a7f2-69871b8e4fd6
+@end ignore