sending.texi 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. @c This is part of the Emacs manual.
  2. @c Copyright (C) 1985,86,87,93,94,95,97,2000,2001
  3. @c Free Software Foundation, Inc.
  4. @c See file emacs.texi for copying conditions.
  5. @node Sending Mail, Rmail, Picture, Top
  6. @chapter Sending Mail
  7. @cindex sending mail
  8. @cindex mail
  9. @cindex message
  10. To send a message in Emacs, you start by typing a command (@kbd{C-x m})
  11. to select and initialize the @samp{*mail*} buffer. Then you edit the text
  12. and headers of the message in this buffer, and type another command
  13. (@kbd{C-c C-s} or @kbd{C-c C-c}) to send the message.
  14. @table @kbd
  15. @item C-x m
  16. Begin composing a message to send (@code{compose-mail}).
  17. @item C-x 4 m
  18. Likewise, but display the message in another window
  19. (@code{compose-mail-other-window}).
  20. @item C-x 5 m
  21. Likewise, but make a new frame (@code{compose-mail-other-frame}).
  22. @item C-c C-s
  23. In Mail mode, send the message (@code{mail-send}).
  24. @item C-c C-c
  25. Send the message and bury the mail buffer (@code{mail-send-and-exit}).
  26. @end table
  27. @kindex C-x m
  28. @findex compose-mail
  29. @kindex C-x 4 m
  30. @findex compose-mail-other-window
  31. @kindex C-x 5 m
  32. @findex compose-mail-other-frame
  33. The command @kbd{C-x m} (@code{compose-mail}) selects a buffer named
  34. @samp{*mail*} and initializes it with the skeleton of an outgoing
  35. message. @kbd{C-x 4 m} (@code{compose-mail-other-window}) selects the
  36. @samp{*mail*} buffer in a different window, leaving the previous current
  37. buffer visible. @kbd{C-x 5 m} (@code{compose-mail-other-frame}) creates
  38. a new frame to select the @samp{*mail*} buffer.
  39. Because the mail-composition buffer is an ordinary Emacs buffer, you can
  40. switch to other buffers while in the middle of composing mail, and switch
  41. back later (or never). If you use the @kbd{C-x m} command again when you
  42. have been composing another message but have not sent it, you are asked to
  43. confirm before the old message is erased. If you answer @kbd{n}, the
  44. @samp{*mail*} buffer is left selected with its old contents, so you can
  45. finish the old message and send it. @kbd{C-u C-x m} is another way to do
  46. this. Sending the message marks the @samp{*mail*} buffer ``unmodified,''
  47. which avoids the need for confirmation when @kbd{C-x m} is next used.
  48. If you are composing a message in the @samp{*mail*} buffer and want to
  49. send another message before finishing the first, rename the
  50. @samp{*mail*} buffer using @kbd{M-x rename-uniquely} (@pxref{Misc
  51. Buffer}). Then you can use @kbd{C-x m} or its variants described above
  52. to make a new @samp{*mail*} buffer. Once you've done that, you can work
  53. with each mail buffer independently.
  54. @ignore
  55. @c Commented out because it is not user-oriented;
  56. @c it doesn't say how to do some job. -- rms.
  57. @cindex directory servers
  58. @cindex LDAP
  59. @cindex PH/QI
  60. @cindex names and addresses
  61. There is an interface to directory servers using various protocols such
  62. as LDAP or the CCSO white pages directory system (PH/QI), described in a
  63. separate manual. It may be useful for looking up names and addresses.
  64. @xref{Top,,EUDC, eudc, EUDC Manual}.
  65. @end ignore
  66. @menu
  67. * Format: Mail Format. Format of the mail being composed.
  68. * Headers: Mail Headers. Details of permitted mail header fields.
  69. * Aliases: Mail Aliases. Abbreviating and grouping mail addresses.
  70. * Mode: Mail Mode. Special commands for editing mail being composed.
  71. * Amuse: Mail Amusements. Distracting the NSA; adding fortune messages.
  72. * Methods: Mail Methods. Using alternative mail-composition methods.
  73. @end menu
  74. @node Mail Format
  75. @section The Format of the Mail Buffer
  76. In addition to the @dfn{text} or @dfn{body}, a message has @dfn{header
  77. fields} which say who sent it, when, to whom, why, and so on. Some
  78. header fields, such as @samp{Date} and @samp{Sender}, are created
  79. automatically when you send the message. Others, such as the recipient
  80. names, must be specified by you in order to send the message properly.
  81. Mail mode provides a few commands to help you edit some header fields,
  82. and some are preinitialized in the buffer automatically at times. You can
  83. insert and edit header fields using ordinary editing commands.
  84. The line in the buffer that says
  85. @example
  86. --text follows this line--
  87. @end example
  88. @noindent
  89. is a special delimiter that separates the headers you have specified from
  90. the text. Whatever follows this line is the text of the message; the
  91. headers precede it. The delimiter line itself does not appear in the
  92. message actually sent. The text used for the delimiter line is controlled
  93. by the variable @code{mail-header-separator}.
  94. Here is an example of what the headers and text in the mail buffer
  95. might look like.
  96. @example
  97. To: gnu@@gnu.org
  98. CC: lungfish@@spam.org, byob@@spam.org
  99. Subject: The Emacs Manual
  100. --Text follows this line--
  101. Please ignore this message.
  102. @end example
  103. @node Mail Headers
  104. @section Mail Header Fields
  105. @cindex headers (of mail message)
  106. A header field in the mail buffer starts with a field name at the
  107. beginning of a line, terminated by a colon. Upper and lower case are
  108. equivalent in field names (and in mailing addresses also). After the
  109. colon and optional whitespace comes the contents of the field.
  110. You can use any name you like for a header field, but normally people
  111. use only standard field names with accepted meanings. Here is a table
  112. of fields commonly used in outgoing messages.
  113. @table @samp
  114. @item To
  115. This field contains the mailing addresses to which the message is
  116. addressed. If you list more than one address, use commas, not spaces,
  117. to separate them.
  118. @item Subject
  119. The contents of the @samp{Subject} field should be a piece of text
  120. that says what the message is about. The reason @samp{Subject} fields
  121. are useful is that most mail-reading programs can provide a summary of
  122. messages, listing the subject of each message but not its text.
  123. @item CC
  124. This field contains additional mailing addresses to send the message to,
  125. like @samp{To} except that these readers should not regard the message
  126. as directed at them.
  127. @item BCC
  128. This field contains additional mailing addresses to send the message to,
  129. which should not appear in the header of the message actually sent.
  130. Copies sent this way are called @dfn{blind carbon copies}.
  131. @vindex mail-self-blind
  132. @cindex copy of every outgoing message
  133. To send a blind carbon copy of every outgoing message to yourself, set
  134. the variable @code{mail-self-blind} to @code{t}. To send a blind carbon
  135. copy of every message to some other @var{address}, set the variable
  136. @code{mail-default-headers} to @code{"Bcc: @var{address}\n"}.
  137. @item FCC
  138. This field contains the name of one file and directs Emacs to append a
  139. copy of the message to that file when you send the message. If the file
  140. is in Rmail format, Emacs writes the message in Rmail format; otherwise,
  141. Emacs writes the message in system mail file format. To specify
  142. more than one file, use several @samp{FCC} fields, with one file
  143. name in each field.
  144. @vindex mail-archive-file-name
  145. To put a fixed file name in the @samp{FCC} field each time you start
  146. editing an outgoing message, set the variable
  147. @code{mail-archive-file-name} to that file name. Unless you remove the
  148. @samp{FCC} field before sending, the message will be written into that
  149. file when it is sent.
  150. @item From
  151. Use the @samp{From} field to say who you are, when the account you are
  152. using to send the mail is not your own. The contents of the @samp{From}
  153. field should be a valid mailing address, since replies will normally go
  154. there. If you don't specify the @samp{From} field yourself, Emacs uses
  155. the value of @code{user-mail-address} as the default.
  156. @item Reply-to
  157. Use this field to direct replies to a different address. Most
  158. mail-reading programs (including Rmail) automatically send replies to
  159. the @samp{Reply-to} address in preference to the @samp{From} address.
  160. By adding a @samp{Reply-to} field to your header, you can work around
  161. any problems your @samp{From} address may cause for replies.
  162. @cindex @env{REPLYTO} environment variable
  163. @vindex mail-default-reply-to
  164. To put a fixed @samp{Reply-to} address into every outgoing message, set
  165. the variable @code{mail-default-reply-to} to that address (as a string).
  166. Then @code{mail} initializes the message with a @samp{Reply-to} field as
  167. specified. You can delete or alter that header field before you send
  168. the message, if you wish. When Emacs starts up, if the environment
  169. variable @env{REPLYTO} is set, @code{mail-default-reply-to} is
  170. initialized from that environment variable.
  171. @item In-reply-to
  172. This field contains a piece of text describing the message you are
  173. replying to. Some mail systems can use this information to correlate
  174. related pieces of mail. Normally this field is filled in by Rmail
  175. when you reply to a message in Rmail, and you never need to
  176. think about it (@pxref{Rmail}).
  177. @item References
  178. This field lists the message IDs of related previous messages. Rmail
  179. sets up this field automatically when you reply to a message.
  180. @end table
  181. The @samp{To}, @samp{CC}, and @samp{BCC} header fields can appear
  182. any number of times, and each such header field can contain multiple
  183. addresses, separated by commas. This way, you can specify any number
  184. of places to send the message. These fields can also have
  185. continuation lines: one or more lines starting with whitespace,
  186. following the starting line of the field, are considered part of the
  187. field. Here's an example of a @samp{To} field with a continuation
  188. line:@refill
  189. @example
  190. @group
  191. To: foo@@here.net, this@@there.net,
  192. me@@gnu.cambridge.mass.usa.earth.spiral3281
  193. @end group
  194. @end example
  195. @vindex mail-from-style
  196. When you send the message, if you didn't write a @samp{From} field
  197. yourself, Emacs puts in one for you. The variable
  198. @code{mail-from-style} controls the format:
  199. @table @code
  200. @item nil
  201. Use just the email address, as in @samp{king@@grassland.com}.
  202. @item parens
  203. Use both email address and full name, as in @samp{king@@grassland.com (Elvis
  204. Parsley)}.
  205. @item angles
  206. Use both email address and full name, as in @samp{Elvis Parsley
  207. <king@@grassland.com>}.
  208. @item system-default
  209. Allow the system to insert the @samp{From} field.
  210. @end table
  211. @vindex mail-default-headers
  212. You can direct Emacs to insert certain default headers into the
  213. outgoing message by setting the variable @code{mail-default-headers}
  214. to a string. Then @code{C-x m} inserts this string into the message
  215. headers. If the default header fields are not appropriate for a
  216. particular message, edit them as appropriate before sending the
  217. message.
  218. @node Mail Aliases
  219. @section Mail Aliases
  220. @cindex mail aliases
  221. @cindex @file{.mailrc} file
  222. @cindex mailrc file
  223. You can define @dfn{mail aliases} in a file named @file{~/.mailrc}.
  224. These are short mnemonic names which stand for mail addresses or groups of
  225. mail addresses. Like many other mail programs, Emacs expands aliases
  226. when they occur in the @samp{To}, @samp{From}, @samp{CC}, @samp{BCC}, and
  227. @samp{Reply-to} fields, plus their @samp{Resent-} variants.
  228. To define an alias in @file{~/.mailrc}, write a line in the following
  229. format:
  230. @example
  231. alias @var{shortaddress} @var{fulladdresses}
  232. @end example
  233. @noindent
  234. Here @var{fulladdresses} stands for one or more mail addresses for
  235. @var{shortaddress} to expand into. Separate multiple addresses with
  236. spaces; if an address contains a space, quote the whole address with a
  237. pair of double-quotes.
  238. For instance, to make @code{maingnu} stand for
  239. @code{gnu@@gnu.org} plus a local address of your own, put in
  240. this line:@refill
  241. @example
  242. alias maingnu gnu@@gnu.org local-gnu
  243. @end example
  244. Emacs also recognizes include commands in @samp{.mailrc} files.
  245. They look like this:
  246. @example
  247. source @var{filename}
  248. @end example
  249. @noindent
  250. The file @file{~/.mailrc} is used primarily by other mail-reading
  251. programs; it can contain various other commands. Emacs ignores
  252. everything in it except for alias definitions and include commands.
  253. @findex define-mail-alias
  254. Another way to define a mail alias, within Emacs alone, is with the
  255. @code{define-mail-alias} command. It prompts for the alias and then the
  256. full address. You can use it to define aliases in your @file{.emacs}
  257. file, like this:
  258. @example
  259. (define-mail-alias "maingnu" "gnu@@gnu.org")
  260. @end example
  261. @vindex mail-aliases
  262. @code{define-mail-alias} records aliases by adding them to a
  263. variable named @code{mail-aliases}. If you are comfortable with
  264. manipulating Lisp lists, you can set @code{mail-aliases} directly. The
  265. initial value of @code{mail-aliases} is @code{t}, which means that
  266. Emacs should read @file{.mailrc} to get the proper value.
  267. @vindex mail-personal-alias-file
  268. You can specify a different file name to use instead of
  269. @file{~/.mailrc} by setting the variable
  270. @code{mail-personal-alias-file}.
  271. @findex expand-mail-aliases
  272. Normally, Emacs expands aliases when you send the message. You do not
  273. need to expand mail aliases before sending the message, but you can
  274. expand them if you want to see where the mail will actually go. To do
  275. this, use the command @kbd{M-x expand-mail-aliases}; it expands all mail
  276. aliases currently present in the mail headers that hold addresses.
  277. If you like, you can have mail aliases expand as abbrevs, as soon as
  278. you type them in (@pxref{Abbrevs}). To enable this feature, execute the
  279. following:
  280. @example
  281. (add-hook 'mail-mode-hook 'mail-abbrevs-setup)
  282. @end example
  283. @noindent
  284. @findex define-mail-abbrev
  285. @vindex mail-abbrevs
  286. This can go in your @file{.emacs} file. @xref{Hooks}. If you use this
  287. feature, you must use @code{define-mail-abbrev} instead of
  288. @code{define-mail-alias}; the latter does not work with this package.
  289. Note that the mail abbreviation package uses the variable
  290. @code{mail-abbrevs} instead of @code{mail-aliases}, and that all alias
  291. names are converted to lower case.
  292. @kindex C-c C-a @r{(Mail mode)}
  293. @findex mail-interactive-insert-alias
  294. The mail abbreviation package also provides the @kbd{C-c C-a}
  295. (@code{mail-interactive-insert-alias}) command, which reads an alias
  296. name (with completion) and inserts its definition at point. This is
  297. useful when editing the message text itself or a header field such as
  298. @samp{Subject} in which Emacs does not normally expand aliases.
  299. Note that abbrevs expand only if you insert a word-separator character
  300. afterward. However, you can rebind @kbd{C-n} and @kbd{M->} to cause
  301. expansion as well. Here's how to do that:
  302. @smallexample
  303. (add-hook 'mail-mode-hook
  304. (lambda ()
  305. (substitute-key-definition
  306. 'next-line 'mail-abbrev-next-line
  307. mail-mode-map global-map)
  308. (substitute-key-definition
  309. 'end-of-buffer 'mail-abbrev-end-of-buffer
  310. mail-mode-map global-map)))
  311. @end smallexample
  312. @node Mail Mode
  313. @section Mail Mode
  314. @cindex Mail mode
  315. @cindex mode, Mail
  316. The major mode used in the mail buffer is Mail mode, which is much
  317. like Text mode except that various special commands are provided on the
  318. @kbd{C-c} prefix. These commands all have to do specifically with
  319. editing or sending the message. In addition, Mail mode defines the
  320. character @samp{%} as a word separator; this is helpful for using the
  321. word commands to edit mail addresses.
  322. Mail mode is normally used in buffers set up automatically by the
  323. @code{mail} command and related commands. However, you can also switch
  324. to Mail mode in a file-visiting buffer. This is a useful thing to do if
  325. you have saved the text of a draft message in a file.
  326. @menu
  327. * Mail Sending:: Commands to send the message.
  328. * Header Editing:: Commands to move to header fields and edit them.
  329. * Citing Mail:: Copying all or part of a message you are replying to.
  330. * Mail Mode Misc:: Spell checking, signatures, etc.
  331. @end menu
  332. @node Mail Sending
  333. @subsection Mail Sending
  334. Mail mode has two commands for sending the message you have been
  335. editing:
  336. @table @kbd
  337. @item C-c C-s
  338. Send the message, and leave the mail buffer selected (@code{mail-send}).
  339. @item C-c C-c
  340. Send the message, and select some other buffer (@code{mail-send-and-exit}).
  341. @end table
  342. @kindex C-c C-s @r{(Mail mode)}
  343. @kindex C-c C-c @r{(Mail mode)}
  344. @findex mail-send
  345. @findex mail-send-and-exit
  346. @kbd{C-c C-s} (@code{mail-send}) sends the message and marks the mail
  347. buffer unmodified, but leaves that buffer selected so that you can
  348. modify the message (perhaps with new recipients) and send it again.
  349. @kbd{C-c C-c} (@code{mail-send-and-exit}) sends and then deletes the
  350. window or switches to another buffer. It puts the mail buffer at the
  351. lowest priority for reselection by default, since you are finished with
  352. using it. This is the usual way to send the message.
  353. In a file-visiting buffer, sending the message does not clear the
  354. modified flag, because only saving the file should do that. As a
  355. result, you don't get a warning if you try to send the same message
  356. twice.
  357. @c This is indexed in mule.texi, node "Recognize Coding".
  358. @c @vindex sendmail-coding-system
  359. When you send a message that contains non-ASCII characters, they need
  360. to be encoded with a coding system (@pxref{Coding Systems}). Usually
  361. the coding system is specified automatically by your chosen language
  362. environment (@pxref{Language Environments}). You can explicitly specify
  363. the coding system for outgoing mail by setting the variable
  364. @code{sendmail-coding-system} (@pxref{Recognize Coding}).
  365. If the coding system thus determined does not handle the characters in
  366. a particular message, Emacs asks you to select the coding system to use,
  367. showing a list of possible coding systems.
  368. @node Header Editing
  369. @subsection Mail Header Editing
  370. Mail mode provides special commands to move to particular header
  371. fields and to complete addresses in headers.
  372. @table @kbd
  373. @item C-c C-f C-t
  374. Move to the @samp{To} header field, creating one if there is none
  375. (@code{mail-to}).
  376. @item C-c C-f C-s
  377. Move to the @samp{Subject} header field, creating one if there is
  378. none (@code{mail-subject}).
  379. @item C-c C-f C-c
  380. Move to the @samp{CC} header field, creating one if there is none
  381. (@code{mail-cc}).
  382. @item C-c C-f C-b
  383. Move to the @samp{BCC} header field, creating one if there is none
  384. (@code{mail-bcc}).
  385. @item C-c C-f C-f
  386. Move to the @samp{FCC} header field, creating one if there is none
  387. (@code{mail-fcc}).
  388. @item M-@key{TAB}
  389. Complete a mailing address (@code{mail-complete}).
  390. @end table
  391. @kindex C-c C-f C-t @r{(Mail mode)}
  392. @findex mail-to
  393. @kindex C-c C-f C-s @r{(Mail mode)}
  394. @findex mail-subject
  395. @kindex C-c C-f C-c @r{(Mail mode)}
  396. @findex mail-cc
  397. @kindex C-c C-f C-b @r{(Mail mode)}
  398. @findex mail-bcc
  399. @kindex C-c C-f C-f @r{(Mail mode)}
  400. @findex mail-fcc
  401. There are five commands to move point to particular header fields, all
  402. based on the prefix @kbd{C-c C-f} (@samp{C-f} is for ``field''). They
  403. are listed in the table above. If the field in question does not exist,
  404. these commands create one. We provide special motion commands for these
  405. particular fields because they are the fields users most often want to
  406. edit.
  407. @findex mail-complete
  408. @kindex M-TAB @r{(Mail mode)}
  409. While editing a header field that contains mailing addresses, such as
  410. @samp{To:}, @samp{CC:} and @samp{BCC:}, you can complete a mailing
  411. address by typing @kbd{M-@key{TAB}} (@code{mail-complete}). It inserts
  412. the full name corresponding to the address, if it can determine the full
  413. name. The variable @code{mail-complete-style} controls whether to insert
  414. the full name, and what style to use, as in @code{mail-from-style}
  415. (@pxref{Mail Headers}).
  416. For completion purposes, the valid mailing addresses are taken to be
  417. the local users' names plus your personal mail aliases. You can
  418. specify additional sources of valid addresses; look at the customization
  419. group @samp{mailalias} to see the options for this
  420. (@pxref{Customization Groups}).
  421. If you type @kbd{M-@key{TAB}} in the body of the message,
  422. @code{mail-complete} invokes @code{ispell-complete-word}, as in Text
  423. mode.
  424. @node Citing Mail
  425. @subsection Citing Mail
  426. @cindex citing mail
  427. Mail mode also has commands for yanking or @dfn{citing} all or part of
  428. a message that you are replying to. These commands are active only when
  429. you started sending a message using an Rmail command.
  430. @table @kbd
  431. @item C-c C-y
  432. Yank the selected message from Rmail (@code{mail-yank-original}).
  433. @item C-c C-r
  434. Yank the region from the Rmail buffer (@code{mail-yank-region}).
  435. @item C-c C-q
  436. Fill each paragraph cited from another message
  437. (@code{mail-fill-yanked-message}).
  438. @end table
  439. @kindex C-c C-y @r{(Mail mode)}
  440. @findex mail-yank-original
  441. When mail sending is invoked from the Rmail mail reader using an Rmail
  442. command, @kbd{C-c C-y} can be used inside the mail buffer to insert
  443. the text of the message you are replying to. Normally it indents each line
  444. of that message three spaces and eliminates most header fields. A numeric
  445. argument specifies the number of spaces to indent. An argument of just
  446. @kbd{C-u} says not to indent at all and not to eliminate anything.
  447. @kbd{C-c C-y} always uses the current message from the Rmail buffer,
  448. so you can insert several old messages by selecting one in Rmail,
  449. switching to @samp{*mail*} and yanking it, then switching back to
  450. Rmail to select another.
  451. @vindex mail-yank-prefix
  452. You can specify the text for @kbd{C-c C-y} to insert at the beginning
  453. of each line: set @code{mail-yank-prefix} to the desired string. (A
  454. value of @code{nil} means to use indentation; this is the default.)
  455. However, @kbd{C-u C-c C-y} never adds anything at the beginning of the
  456. inserted lines, regardless of the value of @code{mail-yank-prefix}.
  457. @kindex C-c C-r @r{(Mail mode)}
  458. @findex mail-yank-region
  459. To yank just a part of an incoming message, set the region in Rmail to
  460. the part you want; then go to the @samp{*Mail*} message and type
  461. @kbd{C-c C-r} (@code{mail-yank-region}). Each line that is copied is
  462. indented or prefixed according to @code{mail-yank-prefix}.
  463. @kindex C-c C-q @r{(Mail mode)}
  464. @findex mail-fill-yanked-message
  465. After using @kbd{C-c C-y} or @kbd{C-c C-r}, you can type @kbd{C-c C-q}
  466. (@code{mail-fill-yanked-message}) to fill the paragraphs of the yanked
  467. old message or messages. One use of @kbd{C-c C-q} fills all such
  468. paragraphs, each one individually. To fill a single paragraph of the
  469. quoted message, use @kbd{M-q}. If filling does not automatically
  470. handle the type of citation prefix you use, try setting the fill prefix
  471. explicitly. @xref{Filling}.
  472. @node Mail Mode Misc
  473. @subsection Mail Mode Miscellany
  474. @table @kbd
  475. @item C-c C-t
  476. Move to the beginning of the message body text (@code{mail-text}).
  477. @item C-c C-w
  478. Insert the file @file{~/.signature} at the end of the message text
  479. (@code{mail-signature}).
  480. @item C-c C-i @var{file} @key{RET}
  481. Insert the contents of @var{file} at the end of the outgoing message
  482. (@code{mail-attach-file}).
  483. @item M-x ispell-message
  484. Perform spelling correction on the message text, but not on citations from
  485. other messages.
  486. @end table
  487. @kindex C-c C-t @r{(Mail mode)}
  488. @findex mail-text
  489. @kbd{C-c C-t} (@code{mail-text}) moves point to just after the header
  490. separator line---that is, to the beginning of the message body text.
  491. @kindex C-c C-w @r{(Mail mode)}
  492. @findex mail-signature
  493. @vindex mail-signature
  494. @kbd{C-c C-w} (@code{mail-signature}) adds a standard piece of text at
  495. the end of the message to say more about who you are. The text comes
  496. from the file @file{~/.signature} in your home directory. To insert
  497. your signature automatically, set the variable @code{mail-signature} to
  498. @code{t}; after that, starting a mail message automatically inserts the
  499. contents of your @file{~/.signature} file. If you want to omit your
  500. signature from a particular message, delete it from the buffer before
  501. you send the message.
  502. You can also set @code{mail-signature} to a string; then that string
  503. is inserted automatically as your signature when you start editing a
  504. message to send. If you set it to some other Lisp expression, the
  505. expression is evaluated each time, and its value (which should be a
  506. string) specifies the signature.
  507. @findex ispell-message
  508. You can do spelling correction on the message text you have written
  509. with the command @kbd{M-x ispell-message}. If you have yanked an
  510. incoming message into the outgoing draft, this command skips what was
  511. yanked, but it checks the text that you yourself inserted. (It looks
  512. for indentation or @code{mail-yank-prefix} to distinguish the cited
  513. lines from your input.) @xref{Spelling}.
  514. @kindex C-c C-i @r{(Mail mode)}
  515. @findex mail-attach-file
  516. To include a file in the outgoing message, you can use @kbd{C-x i},
  517. the usual command to insert a file in the current buffer. But it is
  518. often more convenient to use a special command, @kbd{C-c C-i}
  519. (@code{mail-attach-file}). This command inserts the file contents at
  520. the end of the buffer, after your signature if any, with a delimiter
  521. line that includes the file name.
  522. @vindex mail-mode-hook
  523. @vindex mail-setup-hook
  524. Turning on Mail mode (which @kbd{C-x m} does automatically) runs the
  525. normal hooks @code{text-mode-hook} and @code{mail-mode-hook}.
  526. Initializing a new outgoing message runs the normal hook
  527. @code{mail-setup-hook}; if you want to add special fields to your mail
  528. header or make other changes to the appearance of the mail buffer, use
  529. that hook. @xref{Hooks}.
  530. The main difference between these hooks is just when they are
  531. invoked. Whenever you type @kbd{M-x mail}, @code{mail-mode-hook} runs
  532. as soon as the @samp{*mail*} buffer is created. Then the
  533. @code{mail-setup} function inserts the default contents of the buffer.
  534. After these default contents are inserted, @code{mail-setup-hook} runs.
  535. @node Mail Amusements
  536. @section Mail Amusements
  537. @findex spook
  538. @cindex NSA
  539. @kbd{M-x spook} adds a line of randomly chosen keywords to an outgoing
  540. mail message. The keywords are chosen from a list of words that suggest
  541. you are discussing something subversive.
  542. The idea behind this feature is the suspicion that the
  543. NSA@footnote{The US National Security Agency.} snoops on
  544. all electronic mail messages that contain keywords suggesting they might
  545. find them interesting. (The NSA says they don't, but that's what they
  546. @emph{would} say.) The idea is that if lots of people add suspicious
  547. words to their messages, the NSA will get so busy with spurious input
  548. that they will have to give up reading it all.
  549. Here's how to insert spook keywords automatically whenever you start
  550. entering an outgoing message:
  551. @example
  552. (add-hook 'mail-setup-hook 'spook)
  553. @end example
  554. Whether or not this confuses the NSA, it at least amuses people.
  555. @findex fortune-to-signature
  556. @cindex fortune cookies
  557. You can use the @code{fortune} program to put a ``fortune cookie''
  558. message into outgoing mail. To do this, add
  559. @code{fortune-to-signature} to @code{mail-setup-hook}:
  560. @example
  561. (add-hook 'mail-setup-hook 'fortune-to-signature)
  562. @end example
  563. @node Mail Methods
  564. @section Mail-Composition Methods
  565. @cindex mail-composition methods
  566. @cindex MH mail interface
  567. @cindex Message mode for sending mail
  568. In this chapter we have described the usual Emacs mode for editing
  569. and sending mail---Mail mode. Emacs has alternative facilities for
  570. editing and sending mail, including
  571. MH-E and Message mode, not documented in this manual.
  572. @xref{MH-E,,,mh-e, The Emacs Interface to MH}. @xref{Message,,,message,
  573. Message Manual}. You can choose any of them as your preferred method.
  574. The commands @code{C-x m}, @code{C-x 4 m} and @code{C-x 5 m} use
  575. whichever agent you have specified, as do various other Emacs commands
  576. and facilities that send mail.
  577. @vindex mail-user-agent
  578. To specify your mail-composition method, customize the variable
  579. @code{mail-user-agent}. Currently legitimate values include
  580. @code{sendmail-user-agent} (Mail mode), @code{mh-e-user-agent},
  581. @code{message-user-agent} and @code{gnus-user-agent}.
  582. If you select a different mail-composition method, the information
  583. in this chapter about the @samp{*mail*} buffer and Mail mode does not
  584. apply; the other methods use a different format of text in a different
  585. buffer, and their commands are different as well.