1 @node Sending Mail, Reading Mail, Picture, Top
6 To send a message in Emacs, start by typing the command (@kbd{C-x m})
7 to select and initialize the @samp{*mail*} buffer. You can then edit the text
8 and headers of the message in the mail buffer, and type the command
9 (@kbd{C-c C-c}) to send the message.
13 Begin composing a message to send (@code{mail}).
15 Likewise, but display the message in another window
16 (@code{mail-other-window}).
18 In Mail mode, send the message and switch to another buffer
19 (@code{mail-send-and-exit}).
25 @findex mail-other-window
26 The command @kbd{C-x m} (@code{mail}) selects a buffer named
27 @samp{*mail*} and initializes it with the skeleton of an outgoing message.
28 @kbd{C-x 4 m} (@code{mail-other-window}) selects the @samp{*mail*} buffer
29 in a different window, leaving the previous current buffer visible.@refill
31 Because the buffer for mail composition is an ordinary Emacs buffer, you can
32 switch to other buffers while in the middle of composing mail, and switch
33 back later (or never). If you use the @kbd{C-x m} command again when you
34 have been composing another message but have not sent it, a new mail
35 buffer will be created; in this way, you can compose multiple messages
36 at once. You can switch back to and complete an unsent message by using
37 the normal buffer selection mechanisms.
39 @kbd{C-u C-x m} is another way to switch back to a message in progress:
40 it will search for an existing, unsent mail message buffer and select it.
43 * Format: Mail Format. Format of the mail being composed.
44 * Headers: Mail Headers. Details of allowed mail header fields.
45 * Mode: Mail Mode. Special commands for editing mail being composed.
48 @node Mail Format, Mail Headers, Sending Mail, Sending Mail
49 @section The Format of the Mail Buffer
51 In addition to the @dfn{text} or contents, a message has @dfn{header
52 fields}, which say who sent it, when, to whom, why, and so on. Some header
53 fields, such as the date and sender, are created automatically after the
54 message is sent. Others, such as the recipient names, must be specified by
55 you in order to send the message properly.
57 Mail mode provides a few commands to help you edit some header fields,
58 and some are preinitialized in the buffer automatically at times. You can
59 insert or edit any header fields using ordinary editing commands.
61 The line in the buffer that says:
64 --text follows this line--
67 @vindex mail-header-separator
69 is a special delimiter that separates the headers you have specified from
70 the text. Whatever follows this line is the text of the message; the
71 headers precede it. The delimiter line itself does not appear in the
72 message actually sent. The text used for the delimiter line is controlled
73 by the variable @code{mail-header-separator}.
75 Here is an example of what the headers and text in the @samp{*mail*} buffer
81 Subject: The XEmacs User's Manual
82 --Text follows this line--
83 Please ignore this message.
86 @node Mail Headers, Mail Mode, Mail Format, Sending Mail
87 @section Mail Header Fields
88 @cindex headers (of mail message)
90 There are several header fields you can use in the @samp{*mail*} buffer.
91 Each header field starts with a field name at the beginning of a line,
92 terminated by a colon. It does not matter whether you use upper or lower
93 case in the field name. After the colon and optional whitespace comes the
94 contents of the field.
98 This field contains the mailing addresses of the message.
101 The contents of the @samp{Subject} field should be a piece of text that
102 says what the message is about. Subject fields are useful because most
103 mail-reading programs can provide a summary of messages, listing the
104 subject of each message but not its text.
107 This field contains additional mailing addresses to send the message
108 to, but whose readers should not regard the message as addressed to
112 This field contains additional mailing addresses to send the message
113 to, but which should not appear in the header of the message actually
117 This field contains the name of one file (in Unix mail file format) to
118 which a copy of the message should be appended when the message is
122 Use the @samp{From} field to say who you are, when the account you are
123 using to send the mail is not your own. The contents of the
124 @samp{From} field should be a valid mailing address, since replies
125 will normally go there.
128 Use the @samp{Reply-To} field to direct replies to a different
129 address, not your own. @samp{From} and
130 @samp{Reply-To} have the same effect on where replies go, but they convey a
131 different meaning to the person who reads the message.
134 This field contains a piece of text describing a message you are
135 replying to. Some mail systems can use the information to correlate
136 related pieces of mail. This field is normally filled in by your mail
137 handling package when you are replying to a message and you never need
142 The @samp{To}, @samp{CC}, @samp{BCC} and @samp{FCC} fields can appear
143 any number of times, to specify many places to send the message.
146 The @samp{To}, @samp{CC}, and @samp{BCC}, fields can have continuation
147 lines. All the lines starting with whitespace, following the line on
148 which the field starts, are considered part of the field. For
152 To: foo@@here, this@@there,
153 me@@gnu.cambridge.mass.usa.earth.spiral3281
157 @vindex mail-abbrev-mailrc-file
158 If you have a @file{~/.mailrc} file, Emacs scans it for mail aliases the
159 first time you try to send mail in an Emacs session. Emacs expands
160 aliases found in the @samp{To}, @samp{CC}, and @samp{BCC} fields where
161 appropriate. You can set the variable @code{mail-abbrev-mailrc-file} to
162 the name of the file with mail aliases. If @code{nil}, @file{~/.mailrc}
166 Your @file{.mailrc} file ensures that word-abbrevs are defined for each
167 of your mail aliases when point is in a @samp{To}, @samp{CC},
168 @samp{BCC}, or @samp{From} field. The aliases are defined in your
169 @file{.mailrc} file or in a file specified by the @b{MAILRC}
170 environment variable if it exists. Your mail aliases expand any time
171 you type a word-delimiter at the end of an abbreviation.
173 In this version of Emacs, what you see is what you get: in contrast to
174 some other versions, no abbreviations are expanded after you have sent the
175 mail. This means you don't suffer the annoyance of having the system do
176 things behind your back---if the system rewrites an address you typed,
177 you know it immediately, instead of after the mail has been sent and
178 it's too late to do anything about it. For example, you will never
179 again be in trouble because you forgot to delete an old alias from your
180 @file{.mailrc} and a new local user is given a userid which conflicts
181 with one of your aliases.
183 @vindex mail-abbrev-mode-regexp
184 Your mail alias abbrevs are in effect only when point is in an
185 appropriate header field. The mail aliases will not expand in the body
186 of the message, or in other header fields. The default mode-specific
187 abbrev table @code{mail-mode-abbrev-table} is used instead if defined.
188 That means if you have been using mail-mode specific abbrevs, this code
189 will not adversely affect you. You can control which header fields the
190 abbrevs are used in by changing the variable @code{mail-abbrev-mode-regexp}.
192 If auto-fill mode is on, abbrevs wrap at commas instead of at word
193 boundaries, and header continuation lines will be properly indented.
195 @findex mail-interactive-insert-alias
196 You can also insert a mail alias with @code{mail-interactive-insert-alias}.
197 This function, which is bound to @kbd{C-c C-a}, prompts you for an alias
198 (with completion) and inserts its expansion at point.
200 In this version of Emacs, it is possible to have lines like the
201 following in your @file{.mailrc} file:
204 alias someone "John Doe <doe@@quux.com>"
207 That is, if you want an address to have embedded spaces, simply surround
208 it with double-quotes. The quotes are necessary because the format of
209 the @file{.mailrc} file uses spaces as address delimiters.
211 Aliases in the @file{.mailrc} file may be nested. For example, assume
212 you define aliases like:
214 alias group1 fred ethel
215 alias group2 larry curly moe
216 alias everybody group1 group2
219 When you now type @samp{everybody} on the @samp{To} line, it will expand to:
221 fred, ethyl, larry, curly, moe
224 Aliases may contain forward references; the alias of @samp{everybody} in the
225 example above can precede the aliases of @samp{group1} and @samp{group2}.
227 In this version of Emacs, you can use the @code{source} @file{.mailrc} command
228 for reading aliases from some other file as well.
230 Aliases may contain hyphens, as in @code{"alias foo-bar foo@@bar"}, even
231 though word-abbrevs normally cannot contain hyphens.
233 To read in the contents of another @file{.mailrc}-type file from Emacs, use the
234 command @code{M-x merge-mail-aliases}. The @code{rebuild-mail-aliases}
235 command is similar, but deletes existing aliases first.
237 @vindex mail-alias-separator-string
238 If you want multiple addresses separated by a string other than @samp{,}
239 (a comma), then set the variable @code{mail-alias-separator-string} to
240 it. This has to be a comma bracketed by whitespace if you want any kind
241 of reasonable behavior.