@c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000
-@c Free Software Foundation, Inc.
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
+@c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
-@node Sending Mail, Rmail, Picture, Top
+@node Sending Mail
@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.
to make a new @samp{*mail*} buffer. Once you've done that, you can work
with each mail buffer independently.
+@vindex mail-default-directory
+ The variable @code{mail-default-directory} controls the default
+directory for mail buffers, and also says where to put their auto-save
+files.
+
@ignore
@c Commented out because it is not user-oriented;
@c it doesn't say how to do some job. -- rms.
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
This field contains the name of one file and directs Emacs to append a
copy of the message to that file when you send the message. If the file
is in Rmail format, Emacs writes the message in Rmail format; otherwise,
-Emacs writes the message in system mail file format.
+Emacs writes the message in system mail file format. To specify
+more than one file, use several @samp{FCC} fields, with one file
+name in each field.
@vindex mail-archive-file-name
To put a fixed file name in the @samp{FCC} field each time you start
initialized from that environment variable.
@item In-reply-to
-This field contains a piece of text describing a message you are
+This field contains a piece of text describing the message you are
replying to. Some mail systems can use this information to correlate
related pieces of mail. Normally this field is filled in by Rmail
when you reply to a message in Rmail, and you never need to
sets up this field automatically when you reply to a message.
@end table
- The @samp{To}, @samp{CC}, @samp{BCC} and @samp{FCC} header fields can
-appear any number of times, and each such header field can contain
-multiple addresses, separated by commas. This way, you can specify any
-number of places to send the message. A @samp{To}, @samp{CC}, or
-@samp{BCC} field can also have 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
+ The @samp{To}, @samp{CC}, and @samp{BCC} header fields can appear
+any number of times, and each such header field can contain multiple
+addresses, separated by commas. This way, you can specify any number
+of places to send the message. These fields can also have
+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:
@example
@group
@item nil
Use just the email address, as in @samp{king@@grassland.com}.
@item parens
-Use both email address and full name, as in @samp{king@@grassland.com (Elvis
-Parsley)}.
+Use both email address and full name, as in:@*
+@samp{king@@grassland.com (Elvis Parsley)}.
@item angles
-Use both email address and full name, as in @samp{Elvis Parsley
-<king@@grassland.com>}.
+Use both email address and full name, as in:@*
+@samp{Elvis Parsley <king@@grassland.com>}.
@item system-default
Allow the system to insert the @samp{From} field.
@end table
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 in @samp{.mailrc}. 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)))
+ (lambda ()
+ (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
Mail mode is normally used in buffers set up automatically by the
@code{mail} command and related commands. However, you can also switch
-to Mail mode in a file-visiting buffer. That is a useful thing to do if
-you have saved draft message text in a file.
+to Mail mode in a file-visiting buffer. This is a useful thing to do if
+you have saved the text of a draft message in a file.
@menu
* Mail Sending:: Commands to send the message.
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; use the customization buffer
-to see the options for this.
+the local users' names plus your personal mail aliases. You can
+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, it invokes
-@code{ispell-complete-word}, as in Text mode.
+ If you type @kbd{M-@key{TAB}} in the body of the message,
+@code{mail-complete} invokes @code{ispell-complete-word}, as in Text
+mode.
@node Citing Mail
@subsection Citing Mail
Insert the contents of @var{file} at the end of the outgoing message
(@code{mail-attach-file}).
@item M-x ispell-message
-Do spelling correction on the message text, but not on citations from
+Perform spelling correction on the message text, but not on citations from
other messages.
@end table
the end of the message to say more about who you are. The text comes
from the file @file{~/.signature} in your home directory. To insert
your signature automatically, set the variable @code{mail-signature} to
-@code{t}; then starting a mail message automatically inserts the
+@code{t}; after that, starting a mail message automatically inserts the
contents of your @file{~/.signature} file. If you want to omit your
signature from a particular message, delete it from the buffer before
you send the message.
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
The main difference between these hooks is just when they are
invoked. Whenever you type @kbd{M-x mail}, @code{mail-mode-hook} runs
as soon as the @samp{*mail*} buffer is created. Then the
-@code{mail-setup} function puts in the default contents of the buffer.
+@code{mail-setup} function inserts the default contents of the buffer.
After these default contents are inserted, @code{mail-setup-hook} runs.
@node Mail Amusements
@findex fortune-to-signature
@cindex fortune cookies
You can use the @code{fortune} program to put a ``fortune cookie''
-message into outpoing mail. To do this, add
+message into outgoing mail. To do this, add
@code{fortune-to-signature} to @code{mail-setup-hook}:
@example
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. So do various other Emacs commands
+whichever agent you have specified, as do various other Emacs commands
and facilities that send mail.
@vindex mail-user-agent
apply; the other methods use a different format of text in a different
buffer, and their commands are different as well.
+@ignore
+ arch-tag: d8a3dfc3-5d87-45c5-a7f2-69871b8e4fd6
+@end ignore