Commit | Line | Data |
---|---|---|
6bf7aab6 | 1 | @c This is part of the Emacs manual. |
acaf905b | 2 | @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012 |
8838673e | 3 | @c Free Software Foundation, Inc. |
6bf7aab6 | 4 | @c See file emacs.texi for copying conditions. |
65609f22 | 5 | @node Sending Mail |
6bf7aab6 DL |
6 | @chapter Sending Mail |
7 | @cindex sending mail | |
8 | @cindex mail | |
e73c2434 | 9 | @cindex email |
6bf7aab6 DL |
10 | @cindex message |
11 | ||
e73c2434 CY |
12 | @kindex C-x m |
13 | @findex compose-mail | |
b30941db CY |
14 | To send an email message from Emacs, type @kbd{C-x m}. This |
15 | switches to a buffer named @samp{*unsent mail*}, where you can edit | |
16 | the text and headers of the message. When done, type @kbd{C-c C-s} or | |
17 | @kbd{C-c C-c} to send it. | |
6bf7aab6 DL |
18 | |
19 | @table @kbd | |
20 | @item C-x m | |
e73c2434 | 21 | Begin composing mail (@code{compose-mail}). |
6bf7aab6 | 22 | @item C-x 4 m |
e73c2434 | 23 | Likewise, in another window (@code{compose-mail-other-window}). |
6bf7aab6 | 24 | @item C-x 5 m |
e73c2434 | 25 | Likewise, but in a new frame (@code{compose-mail-other-frame}). |
6bf7aab6 | 26 | @item C-c C-s |
e73c2434 | 27 | In the mail buffer, send the message (@code{message-send}). |
6bf7aab6 | 28 | @item C-c C-c |
e73c2434 CY |
29 | In the mail buffer, send the message and bury the buffer |
30 | (@code{message-send-and-exit}). | |
6bf7aab6 DL |
31 | @end table |
32 | ||
b30941db CY |
33 | The mail buffer is an ordinary Emacs buffer, so you can switch to |
34 | other buffers while composing the mail. If you want to send another | |
35 | mail before finishing the current one, type @kbd{C-x m} again to open | |
36 | a new mail buffer whose name has a different numeric suffix | |
37 | (@pxref{Misc Buffer}). If you invoke the command with a prefix | |
38 | argument, @w{@kbd{C-u C-x m}}, Emacs switches back to the last mail | |
39 | buffer, and asks if you want to erase the message in that buffer; if | |
40 | you answer no, this lets you pick up editing the message where you | |
41 | left off. | |
42 | ||
6bf7aab6 DL |
43 | @kindex C-x 4 m |
44 | @findex compose-mail-other-window | |
45 | @kindex C-x 5 m | |
46 | @findex compose-mail-other-frame | |
b30941db CY |
47 | The command @kbd{C-x 4 m} (@code{compose-mail-other-window}) does |
48 | the same as @kbd{C-x m}, except it displays the mail buffer in a | |
49 | different window. The command @kbd{C-x 5 m} | |
50 | (@code{compose-mail-other-frame}) does it in a new frame. | |
51 | ||
52 | When you type @kbd{C-c C-c} or @kbd{C-c C-s} to send the mail, Emacs | |
53 | may ask you how it should deliver the mail---either directly via SMTP, | |
54 | or using some other method. @xref{Mail Sending}, for details. | |
8233e79a | 55 | |
6bf7aab6 | 56 | @menu |
8838673e | 57 | * Format: Mail Format. Format of a mail message. |
e73c2434 CY |
58 | * Headers: Mail Headers. Details of some standard mail header fields. |
59 | * Aliases: Mail Aliases. Abbreviating and grouping mail addresses. | |
60 | * Commands: Mail Commands. Special commands for editing mail being composed. | |
61 | * Signature: Mail Signature. Adding a signature to every message. | |
62 | * Amuse: Mail Amusements. Distracting the NSA; adding fortune messages. | |
63 | * Methods: Mail Methods. Using alternative mail-composition methods. | |
6bf7aab6 DL |
64 | @end menu |
65 | ||
66 | @node Mail Format | |
67 | @section The Format of the Mail Buffer | |
68 | ||
b30941db | 69 | Here is an example of the contents of a mail buffer: |
6bf7aab6 DL |
70 | |
71 | @example | |
b30941db CY |
72 | To: subotai@@example.org |
73 | CC: mongol.soldier@@example.net, rms@@gnu.org | |
74 | Subject: Re: What is best in life? | |
75 | From: conan@@example.org | |
df1a3e06 | 76 | --text follows this line-- |
b30941db CY |
77 | To crush your enemies, see them driven before you, and to hear the |
78 | lamentation of their women. | |
6bf7aab6 DL |
79 | @end example |
80 | ||
b30941db CY |
81 | @noindent |
82 | At the top of the mail buffer is a set of @dfn{header fields}, which | |
83 | are used for specifying information about the email's recipient(s), | |
84 | subject, and so on. The above buffer contains header fields for | |
85 | @samp{To}, @samp{Cc}, @samp{Subject}, and @samp{From}. Some header | |
86 | fields are automatically pre-initialized in the mail buffer, when | |
87 | appropriate. | |
88 | ||
89 | The line that says @samp{--text follows this line--} separates the | |
90 | header fields from the @dfn{body} (or @dfn{text}) of the message. | |
91 | Everything above that line is treated as part of the headers; | |
92 | everything below it is treated as the body. The delimiter line itself | |
93 | does not appear in the message actually sent. | |
94 | ||
95 | You can insert and edit header fields using ordinary editing | |
96 | commands. @xref{Header Editing}, for commands specific to editing | |
97 | header fields. Certain headers, such as @samp{Date} and | |
98 | @samp{Message-Id}, are normally omitted from the mail buffer and are | |
99 | created automatically when the message is sent. | |
100 | ||
6bf7aab6 DL |
101 | @node Mail Headers |
102 | @section Mail Header Fields | |
103 | @cindex headers (of mail message) | |
104 | ||
105 | A header field in the mail buffer starts with a field name at the | |
106 | beginning of a line, terminated by a colon. Upper and lower case are | |
b30941db CY |
107 | equivalent in field names. After the colon and optional whitespace |
108 | comes the contents of the field. | |
6bf7aab6 | 109 | |
e73c2434 | 110 | You can use any name you like for a header field, but normally |
b30941db | 111 | people use only standard field names with accepted meanings. |
6bf7aab6 | 112 | |
b30941db | 113 | @vindex user-full-name |
e73c2434 | 114 | @vindex user-mail-address |
b30941db CY |
115 | The @samp{From} header field identifies the person sending the email |
116 | (i.e.@: you). This should be a valid mailing address, as replies are | |
117 | normally sent there. The default contents of this header field are | |
118 | computed from the variables @code{user-full-name} (which specifies | |
119 | your full name) and @code{user-mail-address} (your email address). On | |
120 | some operating systems, Emacs initializes these two variables using | |
121 | environment variables (@pxref{General Variables}). If this | |
122 | information is unavailable or wrong, you should customize the | |
123 | variables yourself (@pxref{Easy Customization}). | |
e73c2434 | 124 | |
b30941db CY |
125 | @vindex mail-from-style |
126 | The value of the variable @code{mail-from-style} specifies how to | |
127 | format the contents of the @samp{From} field: | |
128 | ||
129 | @table @asis | |
130 | @item @code{nil} | |
131 | Use just the address, as in @samp{king@@grassland.com}. | |
132 | @item @code{parens} | |
133 | Use both address and full name, as in:@* | |
134 | @samp{king@@grassland.com (Elvis Parsley)}. | |
135 | @item @code{angles} | |
136 | Use both address and full name, as in:@* | |
137 | @samp{Elvis Parsley <king@@grassland.com>}. | |
138 | @item any other value | |
139 | Use @code{angles} normally. But if the address must be ``quoted'' to | |
140 | remain syntactically valid under the @code{angles} format but not | |
141 | under the @code{parens} format, use @code{parens} instead. This is | |
142 | the default. | |
143 | @end table | |
144 | ||
145 | Apart from @samp{From}, here is a table of commonly-used fields: | |
146 | ||
147 | @table @samp | |
6bf7aab6 | 148 | @item To |
e73c2434 | 149 | The mailing address(es) to which the message is addressed. To list |
b30941db | 150 | more than one address, use commas to separate them. |
6bf7aab6 DL |
151 | |
152 | @item Subject | |
b30941db | 153 | The subject of the message. |
6bf7aab6 DL |
154 | |
155 | @item CC | |
e73c2434 CY |
156 | Additional mailing address(es) to send the message to. This is like |
157 | @samp{To}, except that these readers should not regard the message as | |
158 | directed at them. | |
6bf7aab6 DL |
159 | |
160 | @item BCC | |
e73c2434 CY |
161 | Additional mailing address(es) to send the message to, which should |
162 | not appear in the header of the message actually sent. ``BCC'' stands | |
163 | for @dfn{blind carbon copies}. | |
6bf7aab6 DL |
164 | |
165 | @item FCC | |
b30941db | 166 | The name of a file, to which a copy of the sent message should be |
e73c2434 CY |
167 | appended. Emacs writes the message in mbox format, unless the file is |
168 | in Babyl format (used by Rmail before Emacs 23), in which case Emacs | |
b30941db CY |
169 | writes in Babyl format. If an Rmail buffer is visiting the file, |
170 | Emacs updates it accordingly. To specify more than one file, use | |
171 | several @samp{FCC} fields, with one file name in each field. | |
6bf7aab6 DL |
172 | |
173 | @item Reply-to | |
e73c2434 | 174 | An address to which replies should be sent, instead of @samp{From}. |
b30941db CY |
175 | This is used if, for some reason, your @samp{From} address cannot |
176 | receive replies. | |
df1a3e06 | 177 | |
2186d13f | 178 | @item Mail-reply-to |
b30941db CY |
179 | This field takes precedence over @samp{Reply-to}. It is used because |
180 | some mailing lists set the @samp{Reply-to} field for their own | |
181 | purposes (a somewhat controversial practice). | |
2186d13f | 182 | |
df1a3e06 | 183 | @item Mail-followup-to |
b30941db CY |
184 | One of more address(es) to use as default recipient(s) for follow-up |
185 | messages. This is typically used when you reply to a message from a | |
186 | mailing list that you are subscribed to, and want replies to go to the | |
187 | list without sending an extra copy to you. | |
6bf7aab6 DL |
188 | |
189 | @item In-reply-to | |
b30941db CY |
190 | An identifier for the message you are replying to. Most mail readers |
191 | use this information to group related messages together. Normally, | |
192 | this header is filled in automatically when you reply to a message in | |
193 | any mail program built into Emacs. | |
6bf7aab6 DL |
194 | |
195 | @item References | |
b30941db CY |
196 | Identifiers for previous related messages. Like @samp{In-reply-to}, |
197 | this is normally filled in automatically for you. | |
6bf7aab6 DL |
198 | @end table |
199 | ||
e73c2434 CY |
200 | @noindent |
201 | The @samp{To}, @samp{CC}, and @samp{BCC} fields can appear any number | |
202 | of times, and each such header field can contain multiple addresses, | |
203 | separated by commas. This way, you can specify any number of places | |
204 | to send the message. These fields can also have continuation lines: | |
205 | one or more lines starting with whitespace, following the starting | |
206 | line of the field, are considered part of the field. Here's an | |
207 | example of a @samp{To} field with a continuation line: | |
6bf7aab6 DL |
208 | |
209 | @example | |
210 | @group | |
e73c2434 CY |
211 | To: foo@@example.net, this@@example.net, |
212 | bob@@example.com | |
6bf7aab6 DL |
213 | @end group |
214 | @end example | |
215 | ||
df1a3e06 GM |
216 | @c There is also mail-specify-envelope-from and mail-envelope-from, but |
217 | @c these are probably not topics for the Emacs manual. | |
218 | ||
c7fa86d5 | 219 | @vindex mail-default-headers |
e73c2434 CY |
220 | You can direct Emacs to insert certain default headers into the mail |
221 | buffer by setting the variable @code{mail-default-headers} to a | |
222 | string. Then @kbd{C-x m} inserts this string into the message | |
223 | headers. For example, here is how to add a @samp{Reply-to} and | |
224 | @samp{FCC} header to each message: | |
225 | ||
226 | @smallexample | |
227 | (setq mail-default-headers | |
228 | "Reply-to: foo@@example.com\nFCC: ~/Mail/sent") | |
229 | @end smallexample | |
230 | ||
231 | @noindent | |
232 | If the default header fields are not appropriate for a | |
2186d13f | 233 | particular message, edit them as necessary before sending the message. |
c7fa86d5 | 234 | |
6bf7aab6 DL |
235 | @node Mail Aliases |
236 | @section Mail Aliases | |
237 | @cindex mail aliases | |
238 | @cindex @file{.mailrc} file | |
239 | @cindex mailrc file | |
e73c2434 | 240 | @vindex mail-personal-alias-file |
6bf7aab6 | 241 | |
e73c2434 | 242 | You can define @dfn{mail aliases}, which are short mnemonic names |
b30941db CY |
243 | that stand for one or more mailing addresses. By default, mail |
244 | aliases are defined in the file @file{~/.mailrc}. You can specify a | |
245 | different file name to use, by setting the variable | |
e73c2434 | 246 | @code{mail-personal-alias-file}. |
6bf7aab6 | 247 | |
b30941db | 248 | To define an alias in @file{.mailrc}, write a line like this: |
6bf7aab6 DL |
249 | |
250 | @example | |
e73c2434 | 251 | alias @var{nick} @var{fulladdresses} |
6bf7aab6 DL |
252 | @end example |
253 | ||
254 | @noindent | |
e73c2434 CY |
255 | This means that @var{nick} should expand into @var{fulladdresses}, |
256 | where @var{fulladdresses} can be either a single address, or multiple | |
257 | addresses separated with spaces. For instance, to make @code{maingnu} | |
258 | stand for @code{gnu@@gnu.org} plus a local address of your own, put in | |
6bf7aab6 DL |
259 | this line:@refill |
260 | ||
261 | @example | |
262 | alias maingnu gnu@@gnu.org local-gnu | |
263 | @end example | |
264 | ||
f5f79394 | 265 | @noindent |
e73c2434 CY |
266 | If an address contains a space, quote the whole address with a pair of |
267 | double quotes, like this: | |
f5f79394 RS |
268 | |
269 | @example | |
2186d13f | 270 | alias jsmith "John Q. Smith <none@@example.com>" |
f5f79394 RS |
271 | @end example |
272 | ||
273 | @noindent | |
e73c2434 CY |
274 | Note that you need not include double quotes around individual parts |
275 | of the address, such as the person's full name. Emacs puts them in if | |
276 | they are needed. For instance, it inserts the above address as | |
2186d13f | 277 | @samp{"John Q. Smith" <none@@example.com>}. |
f5f79394 | 278 | |
e73c2434 CY |
279 | Emacs also recognizes ``include'' commands in @file{.mailrc}. They |
280 | look like this: | |
6bf7aab6 DL |
281 | |
282 | @example | |
283 | source @var{filename} | |
284 | @end example | |
285 | ||
286 | @noindent | |
e73c2434 CY |
287 | The @file{.mailrc} file is not unique to Emacs; many other |
288 | mail-reading programs use it for mail aliases, and it can contain | |
289 | various other commands. However, Emacs ignores everything except | |
290 | alias definitions and include commands. | |
df1a3e06 | 291 | |
df1a3e06 | 292 | @findex mail-abbrev-insert-alias |
e73c2434 CY |
293 | Mail aliases expand as abbrevs---that is to say, as soon as you type |
294 | a word-separator character after an alias (@pxref{Abbrevs}). This | |
295 | expansion takes place only within the @samp{To}, @samp{From}, | |
296 | @samp{CC}, @samp{BCC}, and @samp{Reply-to} header fields (plus their | |
297 | @samp{Resent-} variants); it does not take place in other header | |
298 | fields, such as @samp{Subject}. | |
299 | ||
300 | You can also insert an aliased address directly, using the command | |
301 | @kbd{M-x mail-abbrev-insert-alias}. This reads an alias name, with | |
302 | completion, and inserts its definition at point. | |
303 | ||
304 | @node Mail Commands | |
305 | @section Mail Commands | |
306 | @cindex Message mode | |
307 | @cindex mode, Message | |
308 | ||
309 | The default major mode for the @samp{*mail*} buffer is called | |
310 | Message mode. It behaves like Text mode in many ways, but provides | |
311 | several additional commands on the @kbd{C-c} prefix, which make | |
312 | editing a message more convenient. | |
313 | ||
314 | In this section, we will describe some of the most commonly-used | |
315 | commands available in Message mode. | |
316 | @ifnottex | |
317 | Message mode also has its own manual, where its features are described | |
318 | in greater detail. @xref{Top,,Message, message, Message}. | |
319 | @end ifnottex | |
6bf7aab6 DL |
320 | |
321 | @menu | |
322 | * Mail Sending:: Commands to send the message. | |
323 | * Header Editing:: Commands to move to header fields and edit them. | |
e73c2434 CY |
324 | * Citing Mail:: Quoting a message you are replying to. |
325 | * Mail Misc:: Attachments, spell checking, etc. | |
6bf7aab6 DL |
326 | @end menu |
327 | ||
328 | @node Mail Sending | |
329 | @subsection Mail Sending | |
330 | ||
6bf7aab6 | 331 | @table @kbd |
6bf7aab6 | 332 | @item C-c C-c |
b8ecfdfe | 333 | Send the message, and bury the mail buffer (@code{message-send-and-exit}). |
e73c2434 CY |
334 | @item C-c C-s |
335 | Send the message, and leave the mail buffer selected (@code{message-send}). | |
6bf7aab6 DL |
336 | @end table |
337 | ||
e73c2434 CY |
338 | @kindex C-c C-s @r{(Message mode)} |
339 | @kindex C-c C-c @r{(Message mode)} | |
340 | @findex message-send | |
b8ecfdfe CY |
341 | @vindex message-kill-buffer-on-exit |
342 | The usual command to send a message is @kbd{C-c C-c} | |
343 | (@code{mail-send-and-exit}). This sends the message and then | |
e73c2434 | 344 | ``buries'' the mail buffer, putting it at the lowest priority for |
b8ecfdfe CY |
345 | reselection. If you want it to kill the mail buffer instead, change |
346 | the variable @code{message-kill-buffer-on-exit} to @code{t}. | |
e73c2434 CY |
347 | |
348 | @findex message-send-and-exit | |
349 | The command @kbd{C-c C-s} (@code{message-send}) sends the message | |
b8ecfdfe CY |
350 | and leaves the buffer selected. Use this command if you want to |
351 | modify the message (perhaps with new recipients) and send it again. | |
e73c2434 CY |
352 | |
353 | @vindex message-send-hook | |
b8ecfdfe CY |
354 | Sending a message runs the hook @code{message-send-hook}. It also |
355 | marks the mail buffer as unmodified, except if the mail buffer is also | |
356 | a file-visiting buffer (in that case, only saving the file does that, | |
357 | and you don't get a warning if you try to send the same message | |
358 | twice). | |
6bf7aab6 | 359 | |
b1d28079 SJ |
360 | @cindex SMTP |
361 | @cindex Feedmail | |
362 | @cindex Sendmail | |
df1a3e06 | 363 | @cindex Mailclient |
b1d28079 | 364 | @vindex send-mail-function |
b30941db | 365 | The variable @code{send-mail-function} controls how the message is |
b8ecfdfe | 366 | delivered. Its value should be one of the following functions: |
8233e79a CY |
367 | |
368 | @table @code | |
b30941db | 369 | @item sendmail-query-once |
b8ecfdfe CY |
370 | Query for a delivery method (one of the other entries in this list), |
371 | and use that method for this message; then save the method to | |
372 | @code{send-mail-function}, so that it is used for future deliveries. | |
373 | This is the default, unless you have already set the variables for | |
374 | sending mail via @code{smtpmail-send-it} (see below). | |
b30941db CY |
375 | |
376 | @item smtpmail-send-it | |
b8ecfdfe CY |
377 | Send mail using the through an external mail host, such as your |
378 | Internet service provider's outgoing SMTP mail server. If you have | |
379 | not told Emacs how to contact the SMTP server, it prompts for this | |
380 | information, which is saved in the variables | |
381 | @code{smtpmail-smtp-server} and @code{smtpmail-auth-credentials}. | |
382 | @xref{Top,,Emacs SMTP Library, smtpmail, Sending mail via SMTP}. | |
b30941db | 383 | |
8233e79a | 384 | @item sendmail-send-it |
b30941db CY |
385 | Send mail using the system's default @command{sendmail} program, or |
386 | equivalent. This requires the system to be set up for delivering mail | |
387 | directly via SMTP. | |
8233e79a CY |
388 | |
389 | @item mailclient-send-it | |
b30941db CY |
390 | Pass the mail buffer on to the system's designated mail client. See |
391 | the commentary section in the file @file{mailclient.el} for details. | |
8233e79a CY |
392 | |
393 | @item feedmail-send-it | |
394 | This is similar to @code{sendmail-send-it}, but allows you to queue | |
395 | messages for later sending. See the commentary section in the file | |
b30941db | 396 | @file{feedmail.el} for details. |
8233e79a | 397 | @end table |
b1d28079 | 398 | |
b8ecfdfe CY |
399 | @vindex sendmail-coding-system |
400 | When you send a message containing non-@acronym{ASCII} characters, | |
401 | they need to be encoded with a coding system (@pxref{Coding Systems}). | |
402 | Usually the coding system is specified automatically by your chosen | |
403 | language environment (@pxref{Language Environments}). You can | |
404 | explicitly specify the coding system for outgoing mail by setting the | |
405 | variable @code{sendmail-coding-system} (@pxref{Recognize Coding}). If | |
406 | the coding system thus determined does not handle the characters in a | |
407 | particular message, Emacs asks you to select the coding system to use, | |
408 | showing a list of possible coding systems. | |
409 | ||
6bf7aab6 DL |
410 | @node Header Editing |
411 | @subsection Mail Header Editing | |
412 | ||
e73c2434 CY |
413 | Message mode provides the following special commands to move to |
414 | particular header fields and to complete addresses in headers. | |
6bf7aab6 DL |
415 | |
416 | @table @kbd | |
417 | @item C-c C-f C-t | |
e73c2434 | 418 | Move to the @samp{To} header (@code{message-goto-to}). |
6bf7aab6 | 419 | @item C-c C-f C-s |
e73c2434 | 420 | Move to the @samp{Subject} header (@code{message-goto-subject}). |
6bf7aab6 | 421 | @item C-c C-f C-c |
e73c2434 | 422 | Move to the @samp{CC} header (@code{message-goto-cc}). |
6bf7aab6 | 423 | @item C-c C-f C-b |
e73c2434 | 424 | Move to the @samp{BCC} header (@code{message-goto-bcc}). |
df1a3e06 | 425 | @item C-c C-f C-r |
e73c2434 | 426 | Move to the @samp{Reply-To} header (@code{message-goto-reply-to}). |
6bf7aab6 | 427 | @item C-c C-f C-f |
e73c2434 CY |
428 | Move to the @samp{Mail-Followup-To} header field |
429 | (@code{message-goto-followup-to}). | |
430 | @item C-c C-f C-w | |
df1a3e06 | 431 | Add a new @samp{FCC} header field, with file-name completion |
e73c2434 CY |
432 | (@code{message-goto-fcc}). |
433 | @item C-c C-b | |
434 | Move to the start of the message body (@code{message-goto-body}). | |
435 | @item @key{TAB} | |
436 | Complete a mailing address (@code{message-tab}). | |
6bf7aab6 DL |
437 | @end table |
438 | ||
e73c2434 CY |
439 | @kindex C-c C-f C-t @r{(Message mode)} |
440 | @findex message-goto-to | |
441 | @kindex C-c C-f C-s @r{(Message mode)} | |
442 | @findex message-goto-subject | |
443 | @kindex C-c C-f C-c @r{(Message mode)} | |
444 | @findex message-goto-cc | |
445 | @kindex C-c C-f C-b @r{(Message mode)} | |
446 | @findex message-goto-bcc | |
447 | @kindex C-c C-f C-r @r{(Message mode)} | |
448 | @findex goto-reply-to | |
449 | @kindex C-c C-f C-f @r{(Message mode)} | |
450 | @findex goto-followup-to | |
451 | @kindex C-c C-f C-w @r{(Message mode)} | |
452 | @findex message-goto-fcc | |
453 | The commands to move point to particular header fields are all based | |
454 | on the prefix @kbd{C-c C-f} (@samp{C-f} is for ``field''). If the | |
455 | field in question does not exist, the command creates one (the | |
456 | exception is @code{mail-fcc}, which creates a new field each time). | |
457 | ||
458 | @kindex C-c C-b @r{(Message mode)} | |
459 | @findex mail-text | |
460 | The command @kbd{C-c C-b} (@code{message-goto-body}) moves point to | |
461 | just after the header separator line---that is, to the beginning of | |
462 | the body. | |
463 | ||
464 | @findex message-tab | |
465 | @kindex TAB @r{(Message mode)} | |
466 | While editing a header field that contains addresses, such as | |
467 | @samp{To:}, @samp{CC:} and @samp{BCC:}, you can complete an address by | |
468 | typing @key{TAB} (@code{message-tab}). This attempts to insert the | |
469 | full name corresponding to the address based on a couple of methods, | |
470 | including EUDC, a library that recognizes a number of directory server | |
471 | protocols (@pxref{Top,,EUDC,eudc, The Emacs Unified Directory | |
472 | Client}). Failing that, it attempts to expand the address as a mail | |
473 | alias (@pxref{Mail Aliases}). If point is on a header field that does | |
474 | not take addresses, or if it is in the message body, then @key{TAB} | |
475 | just inserts a tab character. | |
6bf7aab6 DL |
476 | |
477 | @node Citing Mail | |
478 | @subsection Citing Mail | |
479 | @cindex citing mail | |
480 | ||
6bf7aab6 DL |
481 | @table @kbd |
482 | @item C-c C-y | |
b30941db CY |
483 | Yank the selected message from the mail reader, as a citation |
484 | (@code{message-yank-original}). | |
6bf7aab6 DL |
485 | @item C-c C-q |
486 | Fill each paragraph cited from another message | |
e73c2434 | 487 | (@code{message-fill-yanked-message}). |
6bf7aab6 DL |
488 | @end table |
489 | ||
e73c2434 CY |
490 | @kindex C-c C-y @r{(Message mode)} |
491 | @findex message-yank-original | |
492 | @findex message-yank-prefix | |
493 | You can use the command @kbd{C-c C-y} (@code{message-yank-original}) | |
494 | to @dfn{cite} a message that you are replying to. This inserts the | |
b30941db CY |
495 | text of that message into the mail buffer. This command works only if |
496 | the mail buffer is invoked from a mail reader running in Emacs, such | |
497 | as Rmail. | |
e73c2434 CY |
498 | |
499 | By default, Emacs inserts the string @samp{>} in front of each line | |
500 | of the cited text; this prefix string is specified by the variable | |
501 | @code{message-yank-prefix}. If you call @code{message-yank-original} | |
502 | with a prefix argument, the citation prefix is not inserted. | |
503 | ||
504 | @kindex C-c C-q @r{(Message mode)} | |
6bf7aab6 | 505 | @findex mail-fill-yanked-message |
e73c2434 CY |
506 | After using @kbd{C-c C-y}, you can type @kbd{C-c C-q} |
507 | (@code{message-fill-yanked-message}) to fill the paragraphs of the | |
508 | cited message. One use of @kbd{C-c C-q} fills all such paragraphs, | |
509 | each one individually. To fill a single paragraph of the quoted | |
510 | message, use @kbd{M-q}. If filling does not automatically handle the | |
511 | type of citation prefix you use, try setting the fill prefix | |
6bf7aab6 DL |
512 | explicitly. @xref{Filling}. |
513 | ||
df1a3e06 GM |
514 | @vindex mail-citation-hook |
515 | You can customize mail citation through the hook | |
516 | @code{mail-citation-hook}. For example, you can use the Supercite | |
517 | package, which provides more flexible citation | |
518 | (@pxref{Introduction,,,sc, Supercite}). | |
519 | ||
e73c2434 CY |
520 | @node Mail Misc |
521 | @subsection Mail Miscellany | |
df1a3e06 | 522 | |
e73c2434 CY |
523 | @kindex C-c C-a @r{(Message mode)} |
524 | @findex mail-attach-file | |
525 | @cindex MIME | |
526 | @cindex Multipurpose Internet Mail Extensions | |
527 | You can @dfn{attach} a file to an outgoing message by typing | |
528 | @kbd{C-c C-a} (@code{mml-attach-file}) in the mail buffer. Attaching | |
c3760c17 EZ |
529 | is done using the Multipurpose Internet Mail Extensions |
530 | (@acronym{MIME}) standard. | |
e73c2434 CY |
531 | |
532 | The @code{mml-attach-file} command prompts for the name of the file, | |
533 | and for the attachment's @dfn{content type}, @dfn{description}, and | |
534 | @dfn{disposition}. The content type is normally detected | |
535 | automatically; just type @key{RET} to accept the default. The | |
536 | description is a single line of text that the recipient will see next | |
537 | to the attachment; you may also choose to leave this empty. The | |
538 | disposition is either @samp{inline} (the default), which means the | |
539 | recipient will see a link to the attachment within the message body, | |
540 | or @samp{attachment}, which means the link will be separate from the | |
541 | body. | |
542 | ||
c3760c17 EZ |
543 | @findex mail-add-attachment |
544 | The @code{mml-attach-file} command is specific to Message mode; in | |
545 | Mail mode use @kbd{mail-add-attachment} instead. It will prompt only | |
546 | for the name of the file, and will determine the content type and the | |
547 | disposition automatically. If you want to include some description of | |
548 | the attached file, type that in the message body. | |
549 | ||
e73c2434 CY |
550 | The actual contents of the attached file are not inserted into the |
551 | mail buffer. Instead, some placeholder text is inserted into the mail | |
552 | buffer, like this: | |
6bf7aab6 | 553 | |
e73c2434 CY |
554 | @smallexample |
555 | <#part type="text/plain" filename="~/foo.txt" disposition=inline> | |
556 | <#/part> | |
557 | @end smallexample | |
6bf7aab6 | 558 | |
e73c2434 CY |
559 | @noindent |
560 | When you type @kbd{C-c C-c} or @kbd{C-c C-s} to send the message, the | |
561 | attached file will be delivered with it. | |
6bf7aab6 DL |
562 | |
563 | @findex ispell-message | |
e73c2434 CY |
564 | While composing a message, you can do spelling correction on the |
565 | message text by typing @kbd{M-x ispell-message}. If you have yanked | |
566 | an incoming message into the outgoing draft, this command skips what | |
567 | was yanked, but it checks the text that you yourself inserted (it | |
568 | looks for indentation or @code{mail-yank-prefix} to distinguish the | |
569 | cited lines from your input). @xref{Spelling}. | |
6bf7aab6 DL |
570 | |
571 | @vindex mail-mode-hook | |
572 | @vindex mail-setup-hook | |
e73c2434 CY |
573 | Turning on Message mode (which @kbd{C-x m} does automatically) runs |
574 | the normal hooks @code{text-mode-hook} and @code{message-mode-hook}. | |
6bf7aab6 | 575 | Initializing a new outgoing message runs the normal hook |
e73c2434 CY |
576 | @code{message-setup-hook}; you can use this hook if you want to make |
577 | changes to the appearance of the mail buffer. @xref{Hooks}. | |
6bf7aab6 DL |
578 | |
579 | The main difference between these hooks is just when they are | |
e73c2434 CY |
580 | invoked. Whenever you type @kbd{C-x m}, @code{message-mode-hook} runs |
581 | as soon as the mail buffer is created. Then the @code{message-setup} | |
582 | function inserts the default contents of the buffer. After these | |
583 | default contents are inserted, @code{message-setup-hook} runs. | |
584 | ||
585 | If you use @kbd{C-x m} to continue an existing composition, | |
586 | @code{message-mode-hook} runs immediately after switching to the mail | |
587 | buffer. If the buffer is unmodified, or if you decide to erase it and | |
588 | start again, @code{message-setup-hook} runs after the default contents | |
589 | are inserted. | |
590 | ||
591 | @node Mail Signature | |
592 | @section Mail Signature | |
593 | ||
594 | @cindex mail signature | |
595 | @vindex mail-signature-file | |
596 | @vindex mail-signature | |
597 | You can add a standard piece of text---your @dfn{mail | |
598 | signature}---to the end of every message. This signature may contain | |
599 | information such as your telephone number or your physical location. | |
600 | The variable @code{mail-signature} determines how Emacs handles the | |
601 | mail signature. | |
602 | ||
603 | The default value of @code{mail-signature} is @code{t}; this means | |
604 | to look for your mail signature in the file @file{~/.signature}. If | |
605 | this file exists, its contents are automatically inserted into the end | |
606 | of the mail buffer. You can change the signature file via the | |
607 | variable @code{mail-signature-file}. | |
608 | ||
609 | If you change @code{mail-signature} to a string, that specifies the | |
610 | text of the signature directly. | |
611 | ||
612 | @kindex C-c C-w @r{(Message mode)} | |
613 | @findex message-insert-signature | |
614 | If you change @code{mail-signature} to @code{nil}, Emacs will not | |
615 | insert your mail signature automatically. You can insert your mail | |
616 | signature by typing @kbd{C-c C-w} (@code{message-insert-signature}) in | |
617 | the mail buffer. Emacs will look for your signature in the signature | |
618 | file. | |
619 | ||
620 | By convention, a mail signature should be marked by a line whose | |
621 | contents are @samp{-- }. If your signature lacks this prefix, it is | |
622 | added for you. The remainder of your signature should be no more than | |
623 | four lines. | |
df1a3e06 | 624 | |
2e2cdb68 RS |
625 | @node Mail Amusements |
626 | @section Mail Amusements | |
6bf7aab6 DL |
627 | |
628 | @findex spook | |
629 | @cindex NSA | |
630 | @kbd{M-x spook} adds a line of randomly chosen keywords to an outgoing | |
631 | mail message. The keywords are chosen from a list of words that suggest | |
632 | you are discussing something subversive. | |
633 | ||
2394fd21 | 634 | The idea behind this feature is the suspicion that the |
df1a3e06 GM |
635 | NSA@footnote{The US National Security Agency.} and other intelligence |
636 | agencies snoop on all electronic mail messages that contain keywords | |
637 | suggesting they might find them interesting. (The agencies say that | |
638 | they don't, but that's what they @emph{would} say.) The idea is that if | |
639 | lots of people add suspicious words to their messages, the agencies will | |
640 | get so busy with spurious input that they will have to give up reading | |
641 | it all. Whether or not this is true, it at least amuses some people. | |
6bf7aab6 | 642 | |
58eca4a5 | 643 | @findex fortune-to-signature |
58eca4a5 | 644 | @cindex fortune cookies |
2e2cdb68 | 645 | You can use the @code{fortune} program to put a ``fortune cookie'' |
7fc1fe09 | 646 | message into outgoing mail. To do this, add |
2e2cdb68 RS |
647 | @code{fortune-to-signature} to @code{mail-setup-hook}: |
648 | ||
649 | @example | |
650 | (add-hook 'mail-setup-hook 'fortune-to-signature) | |
651 | @end example | |
58eca4a5 | 652 | |
df1a3e06 GM |
653 | @noindent |
654 | You will probably need to set the variable @code{fortune-file} before | |
655 | using this. | |
656 | ||
6bf7aab6 DL |
657 | @node Mail Methods |
658 | @section Mail-Composition Methods | |
659 | @cindex mail-composition methods | |
e73c2434 CY |
660 | @cindex Mail mode |
661 | @cindex mode, Mail | |
6bf7aab6 | 662 | |
26064e9b DL |
663 | @cindex MH mail interface |
664 | @cindex Message mode for sending mail | |
2e2cdb68 | 665 | In this chapter we have described the usual Emacs mode for editing |
e73c2434 CY |
666 | and sending mail---Message mode. This is only one of several |
667 | available modes. Prior to Emacs 23.2, the default mode was Mail mode, | |
668 | which is similar to Message mode in many respects but lacks features | |
669 | such as MIME support. Another available mode is MH-E | |
670 | (@pxref{Top,,MH-E,mh-e, The Emacs Interface to MH}). | |
6bf7aab6 DL |
671 | |
672 | @vindex mail-user-agent | |
e73c2434 CY |
673 | You can choose any of these @dfn{mail user agents} as your preferred |
674 | method for editing and sending mail. The commands @code{C-x m}, | |
675 | @code{C-x 4 m} and @code{C-x 5 m} use whichever agent you have | |
676 | specified; so do various other parts of Emacs that send mail, such as | |
677 | the bug reporter (@pxref{Bugs}). To specify a mail user agent, | |
678 | customize the variable @code{mail-user-agent}. Currently, legitimate | |
679 | values include @code{message-user-agent} (Message mode) | |
680 | @code{sendmail-user-agent} (Mail mode), @code{gnus-user-agent}, and | |
681 | @code{mh-e-user-agent}. | |
6bf7aab6 | 682 | |
2e2cdb68 | 683 | If you select a different mail-composition method, the information |
e73c2434 CY |
684 | in this chapter about the mail buffer and Message mode does not apply; |
685 | the other methods use a different format of text in a different | |
2e2cdb68 | 686 | buffer, and their commands are different as well. |
ab5796a9 | 687 | |
df1a3e06 GM |
688 | @vindex read-mail-command |
689 | Similarly, to specify your preferred method for reading mail, | |
690 | customize the variable @code{read-mail-command}. The default is | |
691 | @code{rmail} (@pxref{Rmail}). |