428
|
1
|
|
2 @node Sending Mail, Reading Mail, Picture, Top
|
|
3 @chapter Sending Mail
|
|
4 @cindex mail
|
|
5 @cindex message
|
|
6
|
|
7 To send a message in Emacs, start by typing the command (@kbd{C-x m})
|
|
8 to select and initialize the @samp{*mail*} buffer. You can then edit the text
|
|
9 and headers of the message in the mail buffer, and type the command
|
|
10 (@kbd{C-c C-c}) to send the message.
|
|
11
|
|
12 @table @kbd
|
|
13 @item C-x m
|
|
14 Begin composing a message to send (@code{mail}).
|
|
15 @item C-x 4 m
|
|
16 Likewise, but display the message in another window
|
|
17 (@code{mail-other-window}).
|
|
18 @item C-c C-c
|
|
19 In Mail mode, send the message and switch to another buffer
|
|
20 (@code{mail-send-and-exit}).
|
|
21 @end table
|
|
22
|
|
23 @kindex C-x m
|
|
24 @findex mail
|
|
25 @kindex C-x 4 m
|
|
26 @findex mail-other-window
|
|
27 The command @kbd{C-x m} (@code{mail}) selects a buffer named
|
|
28 @samp{*mail*} and initializes it with the skeleton of an outgoing message.
|
|
29 @kbd{C-x 4 m} (@code{mail-other-window}) selects the @samp{*mail*} buffer
|
|
30 in a different window, leaving the previous current buffer visible.@refill
|
|
31
|
|
32 Because the buffer for mail composition is an ordinary Emacs buffer, you can
|
|
33 switch to other buffers while in the middle of composing mail, and switch
|
|
34 back later (or never). If you use the @kbd{C-x m} command again when you
|
|
35 have been composing another message but have not sent it, a new mail
|
|
36 buffer will be created; in this way, you can compose multiple messages
|
|
37 at once. You can switch back to and complete an unsent message by using
|
|
38 the normal buffer selection mechanisms.
|
|
39
|
|
40 @kbd{C-u C-x m} is another way to switch back to a message in progress:
|
|
41 it will search for an existing, unsent mail message buffer and select it.
|
|
42
|
|
43 @menu
|
|
44 * Format: Mail Format. Format of the mail being composed.
|
|
45 * Headers: Mail Headers. Details of allowed mail header fields.
|
|
46 * Mode: Mail Mode. Special commands for editing mail being composed.
|
|
47 @end menu
|
|
48
|
|
49 @node Mail Format, Mail Headers, Sending Mail, Sending Mail
|
|
50 @section The Format of the Mail Buffer
|
|
51
|
|
52 In addition to the @dfn{text} or contents, a message has @dfn{header
|
|
53 fields}, which say who sent it, when, to whom, why, and so on. Some header
|
|
54 fields, such as the date and sender, are created automatically after the
|
|
55 message is sent. Others, such as the recipient names, must be specified by
|
|
56 you in order to send the message properly.
|
|
57
|
|
58 Mail mode provides a few commands to help you edit some header fields,
|
|
59 and some are preinitialized in the buffer automatically at times. You can
|
|
60 insert or edit any header fields using ordinary editing commands.
|
|
61
|
|
62 The line in the buffer that says:
|
|
63
|
|
64 @example
|
|
65 --text follows this line--
|
|
66 @end example
|
|
67
|
|
68 @vindex mail-header-separator
|
|
69 @noindent
|
|
70 is a special delimiter that separates the headers you have specified from
|
|
71 the text. Whatever follows this line is the text of the message; the
|
|
72 headers precede it. The delimiter line itself does not appear in the
|
|
73 message actually sent. The text used for the delimiter line is controlled
|
|
74 by the variable @code{mail-header-separator}.
|
|
75
|
|
76 Here is an example of what the headers and text in the @samp{*mail*} buffer
|
|
77 might look like.
|
|
78
|
|
79 @example
|
|
80 To: rms@@mc
|
|
81 CC: mly@@mc, rg@@oz
|
|
82 Subject: The XEmacs User's Manual
|
|
83 --Text follows this line--
|
|
84 Please ignore this message.
|
|
85 @end example
|
|
86
|
|
87 @node Mail Headers, Mail Mode, Mail Format, Sending Mail
|
|
88 @section Mail Header Fields
|
|
89 @cindex headers (of mail message)
|
|
90
|
|
91 There are several header fields you can use in the @samp{*mail*} buffer.
|
|
92 Each header field starts with a field name at the beginning of a line,
|
|
93 terminated by a colon. It does not matter whether you use upper or lower
|
|
94 case in the field name. After the colon and optional whitespace comes the
|
|
95 contents of the field.
|
|
96
|
|
97 @table @samp
|
|
98 @item To
|
|
99 This field contains the mailing addresses of the message.
|
|
100
|
|
101 @item Subject
|
|
102 The contents of the @samp{Subject} field should be a piece of text that
|
|
103 says what the message is about. Subject fields are useful because most
|
|
104 mail-reading programs can provide a summary of messages, listing the
|
|
105 subject of each message but not its text.
|
|
106
|
|
107 @item CC
|
|
108 This field contains additional mailing addresses to send the message
|
|
109 to, but whose readers should not regard the message as addressed to
|
|
110 them.
|
|
111
|
|
112 @item BCC
|
|
113 This field contains additional mailing addresses to send the message
|
|
114 to, but which should not appear in the header of the message actually
|
|
115 sent.
|
|
116
|
|
117 @item FCC
|
|
118 This field contains the name of one file (in Unix mail file format) to
|
|
119 which a copy of the message should be appended when the message is
|
|
120 sent.
|
|
121
|
|
122 @item From
|
|
123 Use the @samp{From} field to say who you are, when the account you are
|
|
124 using to send the mail is not your own. The contents of the
|
|
125 @samp{From} field should be a valid mailing address, since replies
|
|
126 will normally go there.
|
|
127
|
|
128 @item Reply-To
|
|
129 Use the @samp{Reply-To} field to direct replies to a different
|
|
130 address, not your own. @samp{From} and
|
|
131 @samp{Reply-To} have the same effect on where replies go, but they convey a
|
|
132 different meaning to the person who reads the message.
|
|
133
|
|
134 @item In-Reply-To
|
|
135 This field contains a piece of text describing a message you are
|
|
136 replying to. Some mail systems can use the information to correlate
|
|
137 related pieces of mail. This field is normally filled in by your mail
|
|
138 handling package when you are replying to a message and you never need
|
|
139 to think about it.
|
|
140 @end table
|
|
141
|
|
142 @noindent
|
|
143 The @samp{To}, @samp{CC}, @samp{BCC} and @samp{FCC} fields can appear
|
|
144 any number of times, to specify many places to send the message.
|
|
145
|
|
146 @noindent
|
|
147 The @samp{To}, @samp{CC}, and @samp{BCC}, fields can have continuation
|
|
148 lines. All the lines starting with whitespace, following the line on
|
|
149 which the field starts, are considered part of the field. For
|
|
150 example,@refill
|
|
151
|
|
152 @example
|
|
153 To: foo@@here, this@@there,
|
|
154 me@@gnu.cambridge.mass.usa.earth.spiral3281
|
|
155 @end example
|
|
156
|
|
157 @noindent
|
|
158 @vindex mail-abbrev-mailrc-file
|
|
159 If you have a @file{~/.mailrc} file, Emacs scans it for mail aliases the
|
|
160 first time you try to send mail in an Emacs session. Emacs expands
|
|
161 aliases found in the @samp{To}, @samp{CC}, and @samp{BCC} fields where
|
|
162 appropriate. You can set the variable @code{mail-abbrev-mailrc-file} to
|
|
163 the name of the file with mail aliases. If @code{nil}, @file{~/.mailrc}
|
|
164 is used.
|
|
165
|
|
166 @cindex .mailrc file
|
|
167 Your @file{.mailrc} file ensures that word-abbrevs are defined for each
|
|
168 of your mail aliases when point is in a @samp{To}, @samp{CC},
|
|
169 @samp{BCC}, or @samp{From} field. The aliases are defined in your
|
|
170 @file{.mailrc} file or in a file specified by the @b{MAILRC}
|
|
171 environment variable if it exists. Your mail aliases expand any time
|
|
172 you type a word-delimiter at the end of an abbreviation.
|
|
173
|
|
174 In this version of Emacs, what you see is what you get: in contrast to
|
|
175 some other versions, no abbreviations are expanded after you have sent the
|
|
176 mail. This means you don't suffer the annoyance of having the system do
|
440
|
177 things behind your back---if the system rewrites an address you typed,
|
428
|
178 you know it immediately, instead of after the mail has been sent and
|
|
179 it's too late to do anything about it. For example, you will never
|
|
180 again be in trouble because you forgot to delete an old alias from your
|
|
181 @file{.mailrc} and a new local user is given a userid which conflicts
|
|
182 with one of your aliases.
|
|
183
|
|
184 @vindex mail-abbrev-mode-regexp
|
|
185 Your mail alias abbrevs are in effect only when point is in an
|
|
186 appropriate header field. The mail aliases will not expand in the body
|
|
187 of the message, or in other header fields. The default mode-specific
|
|
188 abbrev table @code{mail-mode-abbrev-table} is used instead if defined.
|
|
189 That means if you have been using mail-mode specific abbrevs, this code
|
|
190 will not adversely affect you. You can control which header fields the
|
|
191 abbrevs are used in by changing the variable @code{mail-abbrev-mode-regexp}.
|
|
192
|
|
193 If auto-fill mode is on, abbrevs wrap at commas instead of at word
|
|
194 boundaries, and header continuation lines will be properly indented.
|
|
195
|
|
196 @findex mail-interactive-insert-alias
|
|
197 You can also insert a mail alias with @code{mail-interactive-insert-alias}.
|
|
198 This function, which is bound to @kbd{C-c C-a}, prompts you for an alias
|
|
199 (with completion) and inserts its expansion at point.
|
|
200
|
|
201 In this version of Emacs, it is possible to have lines like the
|
|
202 following in your @file{.mailrc} file:
|
|
203
|
|
204 @example
|
|
205 alias someone "John Doe <doe@@quux.com>"
|
|
206 @end example
|
|
207
|
|
208 That is, if you want an address to have embedded spaces, simply surround
|
|
209 it with double-quotes. The quotes are necessary because the format of
|
|
210 the @file{.mailrc} file uses spaces as address delimiters.
|
|
211
|
|
212 Aliases in the @file{.mailrc} file may be nested. For example, assume
|
|
213 you define aliases like:
|
|
214 @example
|
|
215 alias group1 fred ethel
|
|
216 alias group2 larry curly moe
|
|
217 alias everybody group1 group2
|
|
218 @end example
|
|
219
|
|
220 When you now type @samp{everybody} on the @samp{To} line, it will expand to:
|
|
221 @example
|
|
222 fred, ethyl, larry, curly, moe
|
|
223 @end example
|
|
224
|
|
225 Aliases may contain forward references; the alias of @samp{everybody} in the
|
|
226 example above can precede the aliases of @samp{group1} and @samp{group2}.
|
|
227
|
|
228 In this version of Emacs, you can use the @code{source} @file{.mailrc} command
|
|
229 for reading aliases from some other file as well.
|
|
230
|
|
231 Aliases may contain hyphens, as in @code{"alias foo-bar foo@@bar"}, even
|
|
232 though word-abbrevs normally cannot contain hyphens.
|
|
233
|
|
234 To read in the contents of another @file{.mailrc}-type file from Emacs, use the
|
|
235 command @code{M-x merge-mail-aliases}. The @code{rebuild-mail-aliases}
|
|
236 command is similar, but deletes existing aliases first.
|
|
237
|
|
238 @vindex mail-alias-seperator-string
|
|
239 If you want multiple addresses separated by a string other than @samp{,}
|
|
240 (a comma), then set the variable @code{mail-alias-seperator-string} to
|
|
241 it. This has to be a comma bracketed by whitespace if you want any kind
|
|
242 of reasonable behavior.
|
|
243
|
|
244 @vindex mail-archive-file-name
|
|
245 If the variable @code{mail-archive-file-name} is non-@code{nil}, it
|
|
246 should be a string naming a file. Each time you start to edit a message
|
|
247 to send, an @samp{FCC} field is entered for that file. Unless you
|
|
248 remove the @samp{FCC} field, every message is written into that
|
|
249 file when it is sent.
|
|
250
|
|
251 @node Mail Mode,, Mail Headers, Sending Mail
|
|
252 @section Mail Mode
|
|
253
|
|
254 The major mode used in the @samp{*mail*} buffer is Mail mode. Mail
|
|
255 mode is similar to Text mode, but several commands are provided on
|
|
256 the @kbd{C-c} prefix. These commands all deal specifically with
|
|
257 editing or sending the message.
|
|
258
|
|
259 @table @kbd
|
|
260 @item C-c C-s
|
|
261 Send the message, and leave the @samp{*mail*} buffer selected
|
|
262 (@code{mail-send}).
|
|
263 @item C-c C-c
|
|
264 Send the message, and select some other buffer (@code{mail-send-and-exit}).
|
|
265 @item C-c C-f C-t
|
|
266 Move to the @samp{To} header field, creating one if there is none
|
|
267 (@code{mail-to}).
|
|
268 @item C-c C-f C-s
|
|
269 Move to the @samp{Subject} header field, creating one if there is
|
|
270 none (@code{mail-subject}).
|
|
271 @item C-c C-f C-c
|
|
272 Move to the @samp{CC} header field, creating one if there is none
|
|
273 (@code{mail-cc}).
|
|
274 @item C-c C-w
|
|
275 Insert the file @file{~/.signature} at the end of the message text
|
|
276 (@code{mail-signature}).
|
|
277 @item C-c C-y
|
|
278 Yank the selected message (@code{mail-yank-original}).
|
|
279 @item C-c C-q
|
|
280 Fill all paragraphs of yanked old messages, each individually
|
|
281 (@code{mail-fill-yanked-message}).
|
|
282 @item @key{button3}
|
|
283 Pops up a menu of useful mail-mode commands.
|
|
284 @end table
|
|
285
|
|
286 @kindex C-c C-s (Mail mode)
|
|
287 @kindex C-c C-c (Mail mode)
|
|
288 @findex mail-send
|
|
289 @findex mail-send-and-exit
|
|
290 There are two ways to send a message. @kbd{C-c C-c}
|
|
291 (@code{mail-send-and-exit}) is the usual way to send the message. It
|
|
292 sends the message and then deletes the window (if there is another
|
|
293 window) or switches to another buffer. It puts the @samp{*mail*} buffer
|
|
294 at the lowest priority for automatic reselection, since you are finished
|
|
295 with using it. @kbd{C-c C-s} (@code{mail-send}) sends the
|
|
296 message and marks the @samp{*mail*} buffer unmodified, but leaves that
|
|
297 buffer selected so that you can modify the message (perhaps with new
|
|
298 recipients) and send it again.
|
|
299
|
|
300 @kindex C-c C-f C-t (Mail mode)
|
|
301 @findex mail-to
|
|
302 @kindex C-c C-f C-s (Mail mode)
|
|
303 @findex mail-subject
|
|
304 @kindex C-c C-f C-c (Mail mode)
|
|
305 @findex mail-cc
|
|
306 Mail mode provides some other special commands that are useful for
|
|
307 editing the headers and text of the message before you send it. There are
|
|
308 three commands defined to move point to particular header fields, all based
|
|
309 on the prefix @kbd{C-c C-f} (@samp{C-f} is for ``field''). They are
|
|
310 @kbd{C-c C-f C-t} (@code{mail-to}) to move to the @samp{To} field, @kbd{C-c
|
|
311 C-f C-s} (@code{mail-subject}) for the @samp{Subject} field, and @kbd{C-c
|
|
312 C-f C-c} (@code{mail-cc}) for the @samp{CC} field. These fields have
|
|
313 special motion commands because they are edited most frequently.
|
|
314
|
|
315
|
|
316 @kindex C-c C-w (Mail mode)
|
|
317 @findex mail-signature
|
|
318 @kbd{C-c C-w} (@code{mail-signature}) adds a standard piece of text at
|
|
319 the end of the message to say more about who you are. The text comes
|
|
320 from the file @file{.signature} in your home directory.
|
|
321
|
|
322 @kindex C-c C-y (Mail mode)
|
|
323 @findex mail-yank-original
|
|
324 When you use an Rmail command to send mail from the Rmail mail reader,
|
|
325 you can use @kbd{C-c C-y} @code{mail-yank-original} inside the
|
|
326 @samp{*mail*} buffer to insert the
|
|
327 text of the message you are replying to. Normally Rmail indents each line
|
|
328 of that message four spaces and eliminates most header fields. A
|
|
329 numeric argument specifies the number of spaces to indent. An argument
|
|
330 of just @kbd{C-u} says not to indent at all and not to eliminate
|
|
331 anything. @kbd{C-c C-y} always uses the current message from the
|
|
332 @samp{RMAIL} buffer, so you can insert several old messages by selecting
|
|
333 one in @samp{RMAIL}, switching to @samp{*mail*} and yanking it, then
|
|
334 switching back to @samp{RMAIL} to select another.@refill
|
|
335
|
|
336 @kindex C-c C-q (Mail mode)
|
|
337 @findex mail-fill-yanked-message
|
|
338 After using @kbd{C-c C-y}, you can use the command @kbd{C-c C-q}
|
|
339 (@code{mail-fill-yanked-message}) to fill the paragraphs of the yanked
|
|
340 old message or messages. One use of @kbd{C-c C-q} fills all such
|
|
341 paragraphs, each one separately.
|
|
342
|
|
343 Clicking the right mouse button in a mail buffer pops up a menu of
|
|
344 the above commands, for easy access.
|
|
345
|
|
346 @vindex mail-mode-hook
|
|
347 Turning on Mail mode (which @kbd{C-x m} does automatically) calls the
|
|
348 value of @code{text-mode-hook}, if it is not void or @code{nil}, and
|
|
349 then calls the value of @code{mail-mode-hook} if that is not void or
|
|
350 @code{nil}.
|