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