91063c38f11aa2fa91b2a0ecb7ff2b67d4f0fb8a
[elisp/gnus.git-] / texi / message.texi
1 \input texinfo                  @c -*-texinfo-*-
2
3 @setfilename message
4 @settitle Message (Oort) Manual
5 @synindex fn cp
6 @synindex vr cp
7 @synindex pg cp
8 @dircategory Emacs
9 @direntry
10 * Message: (message).   Mail and news composition mode that goes with Gnus.
11 @end direntry
12 @iftex
13 @finalout
14 @end iftex
15 @setchapternewpage odd
16
17 @ifnottex
18
19 This file documents Message, the Emacs message composition mode.
20
21 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
22
23 Permission is granted to copy, distribute and/or modify this document
24 under the terms of the GNU Free Documentation License, Version 1.1 or
25 any later version published by the Free Software Foundation; with no
26 Invariant Sections, with the Front-Cover texts being ``A GNU
27 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
28 license is included in the section entitled ``GNU Free Documentation
29 License'' in the Emacs manual.
30
31 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
32 this GNU Manual, like GNU software.  Copies published by the Free
33 Software Foundation raise funds for GNU development.''
34
35 This document is part of a collection distributed under the GNU Free
36 Documentation License.  If you want to distribute this document
37 separately from the collection, you can do so by adding a copy of the
38 license to the document, as described in section 6 of the license.
39 @end ifnottex
40
41 @tex
42
43 @titlepage
44 @title Message (Oort) Manual
45
46 @author by Lars Magne Ingebrigtsen
47 @page
48
49 @vskip 0pt plus 1filll
50 Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002 
51      Free Software Foundation, Inc.
52
53 Permission is granted to copy, distribute and/or modify this document
54 under the terms of the GNU Free Documentation License, Version 1.1 or
55 any later version published by the Free Software Foundation; with the
56 Invariant Sections being none, with the Front-Cover texts being ``A GNU
57 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
58 license is included in the section entitled ``GNU Free Documentation
59 License'' in the Emacs manual.
60
61 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
62 this GNU Manual, like GNU software.  Copies published by the Free
63 Software Foundation raise funds for GNU development.''
64
65 This document is part of a collection distributed under the GNU Free
66 Documentation License.  If you want to distribute this document
67 separately from the collection, you can do so by adding a copy of the
68 license to the document, as described in section 6 of the license.
69 @end titlepage
70 @page
71
72 @end tex
73
74 @node Top
75 @top Message
76
77 All message composition from Gnus (both mail and news) takes place in
78 Message mode buffers.
79
80 @menu
81 * Interface::         Setting up message buffers.
82 * Commands::          Commands you can execute in message mode buffers.
83 * Variables::         Customizing the message buffers.
84 * Compatibility::     Making Message backwards compatible.
85 * Appendices::        More technical things.
86 * Index::             Variable, function and concept index.
87 * Key Index::         List of Message mode keys.
88 @end menu
89
90 This manual corresponds to Oort Message.   Message is distributed with
91 the Gnus distribution bearing the same version number as this manual.
92
93
94 @node Interface
95 @chapter Interface
96
97 When a program (or a person) wants to respond to a message -- reply,
98 follow up, forward, cancel -- the program (or person) should just put
99 point in the buffer where the message is and call the required command.
100 @code{Message} will then pop up a new @code{message} mode buffer with
101 appropriate headers filled out, and the user can edit the message before
102 sending it.
103
104 @menu
105 * New Mail Message::     Editing a brand new mail message.
106 * New News Message::     Editing a brand new news message.
107 * Reply::                Replying via mail.
108 * Wide Reply::           Responding to all people via mail.
109 * Followup::             Following up via news.
110 * Canceling News::       Canceling a news article.
111 * Superseding::          Superseding a message.
112 * Forwarding::           Forwarding a message via news or mail.
113 * Resending::            Resending a mail message.
114 * Bouncing::             Bouncing a mail message.
115 * Mailing Lists::        Send mail to mailing lists.
116 @end menu
117
118
119 @node New Mail Message
120 @section New Mail Message
121
122 @findex message-mail
123 The @code{message-mail} command pops up a new message buffer.
124
125 Two optional parameters are accepted: The first will be used as the
126 @code{To} header and the second as the @code{Subject} header.  If these
127 are @code{nil}, those two headers will be empty.
128
129
130 @node New News Message
131 @section New News Message
132
133 @findex message-news
134 The @code{message-news} command pops up a new message buffer.
135
136 This function accepts two optional parameters.  The first will be used
137 as the @code{Newsgroups} header and the second as the @code{Subject}
138 header.  If these are @code{nil}, those two headers will be empty.
139
140
141 @node Reply
142 @section Reply
143
144 @findex message-reply
145 The @code{message-reply} function pops up a message buffer that's a
146 reply to the message in the current buffer.
147
148 @vindex message-reply-to-function
149 Message uses the normal methods to determine where replies are to go
150 (@pxref{Responses}), but you can change the behavior to suit your needs
151 by fiddling with the @code{message-reply-to-function} variable.
152
153 If you want the replies to go to the @code{Sender} instead of the
154 @code{From}, you could do something like this:
155
156 @lisp
157 (setq message-reply-to-function
158       (lambda ()
159        (cond ((equal (mail-fetch-field "from") "somebody")
160                (list (cons 'To (mail-fetch-field "sender"))))
161              (t
162               nil))))
163 @end lisp
164
165 This function will be called narrowed to the head of the article that is
166 being replied to.
167
168 As you can see, this function should return a string if it has an
169 opinion as to what the To header should be.  If it does not, it should
170 just return @code{nil}, and the normal methods for determining the To
171 header will be used.
172
173 This function can also return a list.  In that case, each list element
174 should be a cons, where the car should be the name of an header
175 (eg. @code{Cc}) and the cdr should be the header value
176 (eg. @samp{larsi@@ifi.uio.no}).  All these headers will be inserted into
177 the head of the outgoing mail.
178
179
180 @node Wide Reply
181 @section Wide Reply
182
183 @findex message-wide-reply
184 The @code{message-wide-reply} pops up a message buffer that's a wide
185 reply to the message in the current buffer.  A @dfn{wide reply} is a
186 reply that goes out to all people listed in the @code{To}, @code{From}
187 (or @code{Reply-to}) and @code{Cc} headers.
188
189 @vindex message-wide-reply-to-function
190 Message uses the normal methods to determine where wide replies are to go,
191 but you can change the behavior to suit your needs by fiddling with the
192 @code{message-wide-reply-to-function}.  It is used in the same way as
193 @code{message-reply-to-function} (@pxref{Reply}).
194
195 @vindex message-dont-reply-to-names
196 Addresses that match the @code{message-dont-reply-to-names} regular
197 expression will be removed from the @code{Cc} header.
198
199 @vindex message-wide-reply-confirm-recipients
200 If @code{message-wide-reply-confirm-recipients} is non-@code{nil} you
201 will be asked to confirm that you want to reply to multiple
202 recipients.  The default is @code{nil}.
203
204 @node Followup
205 @section Followup
206
207 @findex message-followup
208 The @code{message-followup} command pops up a message buffer that's a
209 followup to the message in the current buffer.
210
211 @vindex message-followup-to-function
212 Message uses the normal methods to determine where followups are to go,
213 but you can change the behavior to suit your needs by fiddling with the
214 @code{message-followup-to-function}.  It is used in the same way as
215 @code{message-reply-to-function} (@pxref{Reply}).
216
217 @vindex message-use-followup-to
218 The @code{message-use-followup-to} variable says what to do about
219 @code{Followup-To} headers.  If it is @code{use}, always use the value.
220 If it is @code{ask} (which is the default), ask whether to use the
221 value.  If it is @code{t}, use the value unless it is @samp{poster}.  If
222 it is @code{nil}, don't use the value.
223
224
225 @node Canceling News
226 @section Canceling News
227
228 @findex message-cancel-news
229 The @code{message-cancel-news} command cancels the article in the
230 current buffer.
231
232 @vindex message-cancel-message
233 The value of @code{message-cancel-message} is inserted in the body of
234 the cancel message.  The default is @samp{I am canceling my own
235 article.}.
236
237
238 @node Superseding
239 @section Superseding
240
241 @findex message-supersede
242 The @code{message-supersede} command pops up a message buffer that will
243 supersede the message in the current buffer.
244
245 @vindex message-ignored-supersedes-headers
246 Headers matching the @code{message-ignored-supersedes-headers} are
247 removed before popping up the new message buffer.  The default is@*
248 @samp{^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|@*
249 ^Received:\\|^X-From-Line:\\|Return-Path:\\|^Supersedes:}.
250
251
252
253 @node Forwarding
254 @section Forwarding
255
256 @findex message-forward
257 The @code{message-forward} command pops up a message buffer to forward
258 the message in the current buffer.  If given a prefix, forward using
259 news.
260
261 @table @code
262 @item message-forward-ignored-headers
263 @vindex message-forward-ignored-headers
264 All headers that match this regexp will be deleted when forwarding a message.
265
266 @item message-make-forward-subject-function
267 @vindex message-make-forward-subject-function
268 A list of functions that are called to generate a subject header for
269 forwarded messages.  The subject generated by the previous function is
270 passed into each successive function.
271
272 The provided functions are:
273
274 @table @code
275 @item message-forward-subject-author-subject
276 @findex message-forward-subject-author-subject
277 Source of article (author or newsgroup), in brackets followed by the
278 subject.
279
280 @item message-forward-subject-fwd
281 Subject of article with @samp{Fwd:} prepended to it.
282 @end table
283
284 @item message-wash-forwarded-subjects
285 @vindex message-wash-forwarded-subjects
286 If this variable is @code{t}, the subjects of forwarded messages have
287 the evidence of previous forwards (such as @samp{Fwd:}, @samp{Re:},
288 @samp{(fwd)}) removed before the new subject is
289 constructed.  The default value is @code{nil}.
290
291 @item message-forward-as-mime
292 @vindex message-forward-as-mime
293 If this variable is @code{t} (the default), forwarded messages are
294 included as inline @sc{mime} RFC822 parts.  If it's @code{nil}, forwarded
295 messages will just be copied inline to the new message, like previous,
296 non @sc{mime}-savvy versions of gnus would do.
297
298 @item message-forward-before-signature
299 @vindex message-forward-before-signature
300 If non-@code{nil}, put forwarded message before signature, else after.
301
302 @end table
303
304
305 @node Resending
306 @section Resending
307
308 @findex message-resend
309 The @code{message-resend} command will prompt the user for an address
310 and resend the message in the current buffer to that address.
311
312 @vindex message-ignored-resent-headers
313 Headers that match the @code{message-ignored-resent-headers} regexp will
314 be removed before sending the message.  The default is
315 @samp{^Return-receipt}.
316
317
318 @node Bouncing
319 @section Bouncing
320
321 @findex message-bounce
322 The @code{message-bounce} command will, if the current buffer contains a
323 bounced mail message, pop up a message buffer stripped of the bounce
324 information.  A @dfn{bounced message} is typically a mail you've sent
325 out that has been returned by some @code{mailer-daemon} as
326 undeliverable.
327
328 @vindex message-ignored-bounced-headers
329 Headers that match the @code{message-ignored-bounced-headers} regexp
330 will be removed before popping up the buffer.  The default is
331 @samp{^\\(Received\\|Return-Path\\):}.
332
333
334 @node Mailing Lists
335 @section Mailing Lists
336
337 Sometimes while posting to mailing lists, the poster needs to direct
338 followups to the post to specific places.  The Mail-Followup-To (MFT)
339 was created to enable just this.  Two example scenarios where this is
340 useful:
341
342 @itemize @bullet
343 @item
344 A mailing list poster can use MFT to express that responses should be
345 sent to just the list, and not the poster as well.  This will happen
346 if the poster is already subscribed to the list.
347
348 @item
349 A mailing list poster can use MFT to express that responses should be
350 sent to the list and the poster as well.  This will happen if the poster
351 is not subscribed to the list.
352
353 @item
354 If a message is posted to several mailing lists, MFT may also be used
355 to direct the following discussion to one list only, because
356 discussions that are spread over several lists tend to be fragmented
357 and very difficult to follow.
358
359 @end itemize
360
361 Gnus honors the MFT header in other's messages (i.e. while following
362 up to someone else's post) and also provides support for generating
363 sensible MFT headers for outgoing messages as well.
364
365 @c @menu
366 @c * Honoring an MFT post::        What to do when one already exists
367 @c * Composing with a MFT header:: Creating one from scratch.
368 @c @end menu
369
370 @c @node Composing with a MFT header
371 @subsection  Composing a correct MFT header automagically
372
373 The first step in getting Gnus to automagically generate a MFT header
374 in posts you make is to give Gnus a list of the mailing lists
375 addresses you are subscribed to.  You can do this in more than one
376 way.  The following variables would come in handy.
377
378 @table @code
379
380 @vindex message-subscribed-addresses
381 @item message-subscribed-addresses
382 This should be a list of addresses the user is subscribed to.  Its
383 default value is @code{nil}.   Example: 
384 @lisp
385 (setq message-subscribed-addresses 
386       '("ding@@gnus.org" "bing@@noose.org"))
387 @end lisp
388
389 @vindex message-subscribed-regexps
390 @item message-subscribed-regexps
391 This should be a list of regexps denoting the addresses of mailing
392 lists subscribed to.  Default value is @code{nil}.  Example: If you
393 want to achieve the same result as above:
394 @lisp
395 (setq message-subscribed-regexps
396       '("\\(ding@@gnus\\)\\|\\(bing@@noose\\)\\.org")
397 @end lisp
398
399 @vindex message-subscribed-address-functions
400 @item message-subscribed-address-functions
401 This can be a list of functions to be called (one at a time!!) to
402 determine the value of MFT headers.  It is advisable that these
403 functions not take any arguments.  Default value is @code{nil}.
404
405 There is a pre-defined function in Gnus that is a good candidate for
406 this variable.  @code{gnus-find-subscribed-addresses} is a function
407 that returns a list of addresses corresponding to the groups that have
408 the @code{subscribed} (@pxref{(gnus)subscribed})
409 group parameter set to a non-nil value.  This is how you would do it.
410
411 @lisp
412 (setq message-subscribed-address-functions
413       '(gnus-find-subscribed-addresses))
414 @end lisp
415
416 @vindex message-subscribed-address-file
417 @item message-subscribed-address-file
418 You might be one organised human freak and have a list of addresses of
419 all subscribed mailing lists in a separate file!  Then you can just
420 set this variable to the name of the file and life would be good.
421
422 @end table
423
424 You can use one or more of the above variables.  All their values are
425 ``added'' in some way that works :-)
426
427 Now you are all set.  Just start composing a message as you normally do.
428 And just send it; as always.  Just before the message is sent out, Gnus'
429 MFT generation thingy kicks in and checks if the message already has a
430 MFT field.  If there is one, it is left alone.  (Except if it's empty -
431 in that case, the field is removed and is not replaced with an
432 automatically generated one.  This lets you disable MFT generation on a
433 per-message basis.)  If there is none, then the list of recipient
434 addresses (in the To: and Cc: headers) is checked to see if one of them
435 is a list address you are subscribed to.  If none of them is a list
436 address, then no MFT is generated; otherwise, a MFT is added to the
437 other headers and set to the value of all addresses in To: and Cc:
438
439 @kindex C-c C-f C-a
440 @findex message-gen-unsubscribed-mft
441 @kindex C-c C-f C-m
442 @findex message-goto-mail-followup-to
443 Hm. ``So'', you ask, ``what if I send an email to a list I am not
444 subscribed to?  I want my MFT to say that I want an extra copy.''
445 (This is supposed to be interpreted by others the same way as if there
446 were no MFT, but you can use an explicit MFT to override someone
447 else's to-address group parameter.)  The function
448 @code{message-gen-unsubscribed-mft} might come in handy.  It is bound
449 to @kbd{C-c C-f C-a} by default.  In any case, you can insert a MFT of
450 your own choice; @kbd{C-c C-f C-m}
451 (@code{message-goto-mail-followup-to}) will help you get started.
452
453 @c @node Honoring an MFT post
454 @subsection Honoring an MFT post
455
456 @vindex message-use-mail-followup-to
457 When you followup to a post on a mailing list, and the post has a MFT
458 header, Gnus' action will depend on the value of the variable
459 @code{message-use-mail-followup-to}.  This variable can be one of:
460
461 @table @code
462 @item use
463  Always honor MFTs.  The To: and Cc: headers in your followup will be
464  derived from the MFT header of the original post.  This is the default.
465
466 @item nil
467  Always dishonor MFTs (just ignore the darned thing)
468
469 @item ask
470 Gnus will prompt you for an action.
471
472 @end table
473
474 It is considered good nettiquette to honor MFT, as it is assumed the
475 fellow who posted a message knows where the followups need to go
476 better than you do.
477
478 @node Commands
479 @chapter Commands
480
481 @menu
482 * Buffer Entry::        Commands after entering a Message buffer.
483 * Header Commands::     Commands for moving to headers.
484 * Movement::            Moving around in message buffers.
485 * Insertion::           Inserting things into message buffers.
486 * MIME::                @sc{mime} considerations.
487 * Security::            Signing and encrypting messages.
488 * Various Commands::    Various things.
489 * Sending::             Actually sending the message.
490 * Mail Aliases::        How to use mail aliases.
491 * Spelling::            Having Emacs check your spelling.
492 @end menu
493
494
495 @node Buffer Entry
496 @section Buffer Entry
497 @cindex undo
498 @kindex C-_
499
500 You most often end up in a Message buffer when responding to some other
501 message of some sort.  Message does lots of handling of quoted text, and
502 may remove signatures, reformat the text, or the like---depending on
503 which used settings you're using.  Message usually gets things right,
504 but sometimes it stumbles.  To help the user unwind these stumblings,
505 Message sets the undo boundary before each major automatic action it
506 takes.  If you press the undo key (usually located at @kbd{C-_}) a few
507 times, you will get back the un-edited message you're responding to.
508
509
510 @node Header Commands
511 @section Header Commands
512
513 All these commands move to the header in question (except for the
514 @samp{Importance:} related commands).  If it doesn't exist, it will be
515 inserted.
516
517 @table @kbd
518
519 @item C-c ?
520 @kindex C-c ?
521 @findex describe-mode
522 Describe the message mode.
523
524 @item C-c C-f C-t
525 @kindex C-c C-f C-t
526 @findex message-goto-to
527 Go to the @code{To} header (@code{message-goto-to}).
528
529 @item C-c C-f C-o
530 @kindex C-c C-f C-o
531 @findex message-goto-from
532 Go to the @code{From} header (@code{message-goto-from}).  (The ``o''
533 in the key binding is for Originator.)
534
535 @item C-c C-f C-b
536 @kindex C-c C-f C-b
537 @findex message-goto-bcc
538 Go to the @code{Bcc} header (@code{message-goto-bcc}).
539
540 @item C-c C-f C-f
541 @kindex C-c C-f C-f
542 @findex message-goto-fcc
543 Go to the @code{Fcc} header (@code{message-goto-fcc}).
544
545 @item C-c C-f C-c
546 @kindex C-c C-f C-c
547 @findex message-goto-cc
548 Go to the @code{Cc} header (@code{message-goto-cc}).
549
550 @item C-c C-f C-s
551 @kindex C-c C-f C-s
552 @findex message-goto-subject
553 Go to the @code{Subject} header (@code{message-goto-subject}).
554
555 @item C-c C-f C-r
556 @kindex C-c C-f C-r
557 @findex message-goto-reply-to
558 Go to the @code{Reply-To} header (@code{message-goto-reply-to}).
559
560 @item C-c C-f C-n
561 @kindex C-c C-f C-n
562 @findex message-goto-newsgroups
563 Go to the @code{Newsgroups} header (@code{message-goto-newsgroups}).
564
565 @item C-c C-f C-d
566 @kindex C-c C-f C-d
567 @findex message-goto-distribution
568 Go to the @code{Distribution} header (@code{message-goto-distribution}).
569
570 @item C-c C-f C-o
571 @kindex C-c C-f C-o
572 @findex message-goto-followup-to
573 Go to the @code{Followup-To} header (@code{message-goto-followup-to}).
574
575 @item C-c C-f C-k
576 @kindex C-c C-f C-k
577 @findex message-goto-keywords
578 Go to the @code{Keywords} header (@code{message-goto-keywords}).
579
580 @item C-c C-f C-u
581 @kindex C-c C-f C-u
582 @findex message-goto-summary
583 Go to the @code{Summary} header (@code{message-goto-summary}).
584
585 @item C-c C-f C-i
586 @kindex C-c C-f C-i
587 @findex message-insert-or-toggle-importance
588 This inserts the @samp{Importance:} header with a value of
589 @samp{high}.  This header is used to signal the importance of the
590 message to the receiver.  If the header is already present in the
591 buffer, it cycles between the three valid values according to RFC
592 1376: @samp{low}, @samp{normal} and @samp{high}.
593
594 @item M-x message-insert-importance-high
595 @kindex M-x message-insert-importance-high
596 @findex message-insert-importance-high
597 Insert a @samp{Importance:} header with a value of @samp{high},
598 deleting headers if necessary.
599
600 @item M-x message-insert-importance-low
601 @kindex M-x message-insert-importance-low
602 @findex message-insert-importance-low
603 Insert a @samp{Importance:} header with a value of @samp{low},
604 deleting headers if necessary.
605
606 @end table
607
608
609 @node Movement
610 @section Movement
611
612 @table @kbd
613 @item C-c C-b
614 @kindex C-c C-b
615 @findex message-goto-body
616 Move to the beginning of the body of the message
617 (@code{message-goto-body}).
618
619 @item C-c C-i
620 @kindex C-c C-i
621 @findex message-goto-signature
622 Move to the signature of the message (@code{message-goto-signature}).
623
624 @item C-a
625 @kindex C-a
626 @findex message-beginning-of-line
627 If at beginning of header value, go to beginning of line, else go to
628 beginning of header value.  (The header value comes after the header
629 name and the colon.)
630
631 @end table
632
633
634 @node Insertion
635 @section Insertion
636
637 @table @kbd
638
639 @item C-c C-y
640 @kindex C-c C-y
641 @findex message-yank-original
642 Yank the message that's being replied to into the message buffer
643 (@code{message-yank-original}).
644
645 @item C-c C-M-y
646 @kindex C-c C-M-y
647 @findex message-yank-buffer
648 Prompt for a buffer name and yank the contents of that buffer into the
649 message buffer (@code{message-yank-buffer}).
650
651 @item C-c C-q
652 @kindex C-c C-q
653 @findex message-fill-yanked-message
654 Fill the yanked message (@code{message-fill-yanked-message}).  Warning:
655 Can severely mess up the yanked text if its quoting conventions are
656 strange.  You'll quickly get a feel for when it's safe, though.  Anyway,
657 just remember that @kbd{C-x u} (@code{undo}) is available and you'll be
658 all right.
659
660 @item C-c C-w
661 @kindex C-c C-w
662 @findex message-insert-signature
663 Insert a signature at the end of the buffer
664 (@code{message-insert-signature}).
665
666 @item C-c M-h
667 @kindex C-c M-h
668 @findex message-insert-headers
669 Insert the message headers (@code{message-insert-headers}).
670
671 @item C-c M-n
672 @kindex C-c M-n
673 @findex message-insert-disposition-notification-to
674 Insert a request for a disposition
675 notification. (@code{message-insert-disposition-notification-to}).
676 This means that if the recipient support RFC 2298 she might send you a
677 notification that she received the message.
678
679 @end table
680
681
682 @node MIME
683 @section MIME
684 @cindex MML
685 @cindex MIME
686 @cindex multipart
687 @cindex attachment
688
689 Message is a @sc{mime}-compliant posting agent.  The user generally
690 doesn't have to do anything to make the @sc{mime} happen---Message will
691 automatically add the @code{Content-Type} and
692 @code{Content-Transfer-Encoding} headers.
693
694 The most typical thing users want to use the multipart things in
695 @sc{mime} for is to add ``attachments'' to mail they send out.  This can
696 be done with the @kbd{C-c C-a} command, which will prompt for a file
697 name and a @sc{mime} type.
698
699 You can also create arbitrarily complex multiparts using the MML
700 language (@pxref{Composing, , Composing, emacs-mime, The Emacs MIME
701 Manual}).
702
703 @node Security
704 @section Security
705 @cindex Security
706 @cindex S/MIME
707 @cindex PGP
708 @cindex PGP/MIME
709 @cindex sign
710 @cindex encrypt
711 @cindex secure
712
713 Using the MML language, Message is able to create digitally signed and
714 digitally encrypted messages.  Message (or rather MML) currently
715 support PGP (RFC 1991), @sc{pgp/mime} (RFC 2015/3156) and @sc{s/mime}.
716 Instructing MML to perform security operations on a @sc{mime} part is
717 done using the @kbd{C-c C-m s} key map for signing and the @kbd{C-c
718 C-m c} key map for encryption, as follows.
719
720 @table @kbd
721
722 @item C-c C-m s s
723 @kindex C-c C-m s s
724 @findex mml-secure-message-sign-smime
725
726 Digitally sign current message using @sc{s/mime}.
727
728 @item C-c C-m s o
729 @kindex C-c C-m s o
730 @findex mml-secure-message-sign-pgp
731
732 Digitally sign current message using PGP.
733
734 @item C-c C-m s p
735 @kindex C-c C-m s p
736 @findex mml-secure-message-sign-pgpmime
737
738 Digitally sign current message using @sc{pgp/mime}.
739
740 @item C-c C-m c s
741 @kindex C-c C-m c s
742 @findex mml-secure-message-encrypt-smime
743
744 Digitally encrypt current message using @sc{s/mime}.
745
746 @item C-c C-m c o
747 @kindex C-c C-m c o
748 @findex mml-secure-message-encrypt-pgp
749
750 Digitally encrypt current message using PGP.
751
752 @item C-c C-m c p
753 @kindex C-c C-m c p
754 @findex mml-secure-message-encrypt-pgpmime
755
756 Digitally encrypt current message using @sc{pgp/mime}.
757
758 @item C-c C-m C-n
759 @kindex C-c C-m C-n
760 @findex mml-unsecure-message
761 Remove security related MML tags from message.
762
763 @end table
764
765 These commands do not immediately sign or encrypt the message, they
766 merely insert the proper MML secure tag to instruct the MML engine to
767 perform that operation when the message is actually sent. They may
768 perform other operations too, such as locating and retrieving a
769 @sc{s/mime} certificate of the person you wish to send encrypted mail
770 to.  When the mml parsing engine converts your MML into a properly
771 encoded @sc{mime} message, the secure tag will be replaced with either
772 a part or a multipart tag.  If your message contains other mml parts,
773 a multipart tag will be used; if no other parts are present in your
774 message a single part tag will be used.  This way, message mode will
775 do the Right Thing (TM) with signed/encrypted multipart messages.
776
777 By default, when encrypting a message, Gnus will use the "signencrypt"
778 mode.  If you would like to disable this for a particular message,
779 give the mml-secure-message-encrypt-* command a prefix argument. (for
780 example, C-u C-c C-m c p).  Additionally, by default Gnus will
781 separately sign, then encrypt a message which has the mode
782 signencrypt.  If you would like to change this behavior use the
783 @code{mml-signencrypt-style} function.  For example
784
785 @code{(mml-signencrypt-style "pgpmime" 'combined)}
786
787 Will cause Gnus to sign and encrypt in one pass, thus generating a
788 single signed and encrypted part.
789
790 Since signing and especially encryption often is used when sensitive
791 information is sent, you may want to have some way to ensure that your
792 mail is actually signed or encrypted.  After invoking the above
793 sign/encrypt commands, it is possible to preview the raw article by
794 using @kbd{C-u C-c RET P} (@code{mml-preview}).  Then you can
795 verify that your long rant about what your ex-significant other or
796 whomever actually did with that funny looking person at that strange
797 party the other night, actually will be sent encrypted.
798
799 @emph{Note!}  Neither @sc{pgp/mime} nor @sc{s/mime} encrypt/signs
800 RFC822 headers.  They only operate on the @sc{mime} object.  Keep this
801 in mind before sending mail with a sensitive Subject line.
802
803 Actually using the security commands above is not very difficult.  At
804 least not compared with making sure all involved programs talk with each
805 other properly.  Thus, we now describe what external libraries or
806 programs are required to make things work, and some small general hints.
807
808 @subsection Using S/MIME
809
810 @emph{Note!}  This section assume you have a basic familiarity with
811 modern cryptography, @sc{s/mime}, various PKCS standards, OpenSSL and
812 so on.
813
814 The @sc{s/mime} support in Message (and MML) require OpenSSL.  OpenSSL
815 perform the actual @sc{s/mime} sign/encrypt operations.  OpenSSL can
816 be found at @uref{http://www.openssl.org/}.  OpenSSL 0.9.6 and later
817 should work.  Version 0.9.5a cannot extract mail addresses from
818 certificates, and it insert a spurious CR character into @sc{mime}
819 separators so you may wish to avoid it if you would like to avoid
820 being regarded as someone who send strange mail. (Although by sending
821 @sc{s/mime} messages you've probably already lost that contest.)
822
823 To be able to send encrypted mail, a personal certificate is not
824 required.  Message (MML) need a certificate for the person to whom you
825 wish to communicate with though.  You're asked for this when you type
826 @kbd{C-c C-m c s}.  Currently there are two ways to retrieve this
827 certificate, from a local file or from DNS.  If you chose a local
828 file, it need to contain a X.509 certificate in PEM format.  If you
829 chose DNS, you're asked for the domain name where the certificate is
830 stored, the default is a good guess.  To my belief, Message (MML) is
831 the first mail agent in the world to support retrieving @sc{s/mime}
832 certificates from DNS, so you're not likely to find very many
833 certificates out there.  At least there should be one, stored at the
834 domain @code{simon.josefsson.org}.  LDAP is a more popular method of
835 distributing certificates, support for it is planned.  (Meanwhile, you
836 can use @code{ldapsearch} from the command line to retrieve a
837 certificate into a file and use it.)
838
839 As for signing messages, OpenSSL can't perform signing operations
840 without some kind of configuration.  Especially, you need to tell it
841 where your private key and your certificate is stored.  MML uses an
842 Emacs interface to OpenSSL, aptly named @code{smime.el}, and it
843 contain a @code{custom} group used for this configuration.  So, try
844 @kbd{M-x customize-group RET smime RET} and look around.
845
846 Currently there is no support for talking to a CA (or RA) to create
847 your own certificate.  None is planned either.  You need to do this
848 manually with OpenSSL or using some other program.  I used Netscape
849 and got a free @sc{s/mime} certificate from one of the big CA's on the
850 net.  Netscape is able to export your private key and certificate in
851 PKCS #12 format.  Use OpenSSL to convert this into a plain X.509
852 certificate in PEM format as follows.
853
854 @example
855 $ openssl pkcs12 -in ns.p12 -clcerts -nodes > key+cert.pem
856 @end example
857
858 The @file{key+cert.pem} file should be pointed to from the
859 @code{smime-keys} variable.  You should now be able to send signed mail.
860
861 @emph{Note!}  Your private key is store unencrypted in the file, so take
862 care in handling it.
863
864 @subsection Using PGP/MIME
865
866 @sc{pgp/mime} requires an external OpenPGP implementation, such as GNU
867 Privacy Guard (@uref{http://www.gnupg.org/}).  It also requires an
868 Emacs interface to it, such as Mailcrypt (available from
869 @uref{http://www.nb.net/~lbudney/linux/software/mailcrypt.html}) or
870 Florian Weimer's @code{gpg.el}.
871
872 @vindex gpg-temp-directory
873 Note, if you are using the @code{gpg.el} you must make sure that the
874 path specified by @code{gpg-temp-directory} have permissions 0700.
875
876 Creating your own OpenPGP key is described in detail in the
877 documentation of your OpenPGP implementation, so we refer to it.
878
879 @node Various Commands
880 @section Various Commands
881
882 @table @kbd
883
884 @item C-c C-r
885 @kindex C-c C-r
886 @findex message-caesar-buffer-body
887 Caesar rotate (aka. rot13) the current message
888 (@code{message-caesar-buffer-body}).  If narrowing is in effect, just
889 rotate the visible portion of the buffer.  A numerical prefix says how
890 many places to rotate the text.  The default is 13.
891
892 @item C-c C-e
893 @kindex C-c C-e
894 @findex message-elide-region
895 @vindex message-elide-ellipsis
896 Elide the text between point and mark (@code{message-elide-region}).
897 The text is killed and replaced with the contents of the variable
898 @code{message-elide-ellipsis}. The default value is to use an ellipsis
899 (@samp{[...]}).
900
901 @item C-c C-z
902 @kindex C-c C-x
903 @findex message-kill-to-signature
904 Kill all the text up to the signature, or if that's missing, up to the
905 end of the message (@code{message-kill-to-signature}).
906
907 @item C-c C-v
908 @kindex C-c C-v
909 @findex message-delete-not-region
910 Delete all text in the body of the message that is outside the region
911 (@code{message-delete-not-region}).
912
913 @item M-RET
914 @kindex M-RET
915 @findex message-newline-and-reformat
916 Insert four newlines, and then reformat if inside quoted text.
917
918 Here's an example:
919
920 @example
921 > This is some quoted text.  And here's more quoted text.
922 @end example
923
924 If point is before @samp{And} and you press @kbd{M-RET}, you'll get:
925
926 @example
927 > This is some quoted text.
928
929 *
930
931 > And here's more quoted text.
932 @end example
933
934 @samp{*} says where point will be placed.
935
936 @item C-c C-t
937 @kindex C-c C-t
938 @findex message-insert-to
939 Insert a @code{To} header that contains the @code{Reply-To} or
940 @code{From} header of the message you're following up
941 (@code{message-insert-to}).
942
943 @item C-c C-n
944 @kindex C-c C-n
945 @findex message-insert-newsgroups
946 Insert a @code{Newsgroups} header that reflects the @code{Followup-To}
947 or @code{Newsgroups} header of the article you're replying to
948 (@code{message-insert-newsgroups}).
949
950 @item C-c C-o
951 @kindex C-c C-o
952 @findex message-sort-headers
953 @vindex message-header-format-alist
954 Sort headers according to @code{message-header-format-alist}
955 (@code{message-sort-headers}).
956
957 @item C-c M-r
958 @kindex C-c M-r
959 @findex message-rename-buffer
960 Rename the buffer (@code{message-rename-buffer}).  If given a prefix,
961 prompt for a new buffer name.
962
963 @end table
964
965
966 @node Sending
967 @section Sending
968
969 @table @kbd
970 @item C-c C-c
971 @kindex C-c C-c
972 @findex message-send-and-exit
973 Send the message and bury the current buffer
974 (@code{message-send-and-exit}).
975
976 @item C-c C-s
977 @kindex C-c C-s
978 @findex message-send
979 Send the message (@code{message-send}).
980
981 @item C-c C-d
982 @kindex C-c C-d
983 @findex message-dont-send
984 Bury the message buffer and exit (@code{message-dont-send}).
985
986 @item C-c C-k
987 @kindex C-c C-k
988 @findex message-kill-buffer
989 Kill the message buffer and exit (@code{message-kill-buffer}).
990
991 @end table
992
993
994
995 @node Mail Aliases
996 @section Mail Aliases
997 @cindex mail aliases
998 @cindex aliases
999
1000 @vindex message-mail-alias-type
1001 The @code{message-mail-alias-type} variable controls what type of mail
1002 alias expansion to use.  Currently only one form is supported---Message
1003 uses @code{mailabbrev} to handle mail aliases.  If this variable is
1004 @code{nil}, no mail alias expansion will be performed.
1005
1006 @code{mailabbrev} works by parsing the @file{/etc/mailrc} and
1007 @file{~/.mailrc} files.  These files look like:
1008
1009 @example
1010 alias lmi "Lars Magne Ingebrigtsen <larsi@@ifi.uio.no>"
1011 alias ding "ding@@ifi.uio.no (ding mailing list)"
1012 @end example
1013
1014 After adding lines like this to your @file{~/.mailrc} file, you should
1015 be able to just write @samp{lmi} in the @code{To} or @code{Cc} (and so
1016 on) headers and press @kbd{SPC} to expand the alias.
1017
1018 No expansion will be performed upon sending of the message---all
1019 expansions have to be done explicitly.
1020
1021
1022 @node Spelling
1023 @section Spelling
1024 @cindex spelling
1025 @findex ispell-message
1026
1027 There are two popular ways to have Emacs spell-check your messages:
1028 @code{ispell} and @code{flyspell}.  @code{ispell} is the older and
1029 probably more popular package.  You typically first write the message,
1030 and then run the entire thing through @code{ispell} and fix all the
1031 typos.  To have this happen automatically when you send a message, put
1032 something like the following in your @file{.emacs} file:
1033
1034 @lisp
1035 (add-hook 'message-send-hook 'ispell-message)
1036 @end lisp
1037
1038 @vindex ispell-message-dictionary-alist
1039 If you're in the habit of writing in different languages, this can be
1040 controlled by the @code{ispell-message-dictionary-alist} variable:
1041
1042 @lisp
1043 (setq ispell-message-dictionary-alist
1044       '(("^Newsgroups:.*\\bde\\." . "deutsch8")
1045         (".*" . "default")))
1046 @end lisp
1047
1048 @code{ispell} depends on having the external @samp{ispell} command
1049 installed.
1050
1051 The other popular method is using @code{flyspell}.  This package checks
1052 your spelling while you're writing, and marks any mis-spelled words in
1053 various ways.
1054
1055 To use @code{flyspell}, put something like the following in your
1056 @file{.emacs} file:
1057
1058 @lisp
1059 (defun my-message-setup-routine ()
1060   (flyspell-mode 1))
1061 (add-hook 'message-setup-hook 'my-message-setup-routine)
1062 @end lisp
1063
1064 @code{flyspell} depends on having the external @samp{ispell} command
1065 installed.
1066
1067
1068 @node Variables
1069 @chapter Variables
1070
1071 @menu
1072 * Message Headers::             General message header stuff.
1073 * Mail Headers::                Customizing mail headers.
1074 * Mail Variables::              Other mail variables.
1075 * News Headers::                Customizing news headers.
1076 * News Variables::              Other news variables.
1077 * Insertion Variables::         Customizing how things are inserted.
1078 * Various Message Variables::   Other message variables.
1079 * Sending Variables::           Variables for sending.
1080 * Message Buffers::             How Message names its buffers.
1081 * Message Actions::             Actions to be performed when exiting.
1082 @end menu
1083
1084
1085 @node Message Headers
1086 @section Message Headers
1087
1088 Message is quite aggressive on the message generation front.  It has to
1089 be -- it's a combined news and mail agent.  To be able to send combined
1090 messages, it has to generate all headers itself (instead of letting the
1091 mail/news system do it) to ensure that mail and news copies of messages
1092 look sufficiently similar.
1093
1094 @table @code
1095
1096 @item message-generate-headers-first
1097 @vindex message-generate-headers-first
1098 If non-@code{nil}, generate all required headers before starting to
1099 compose the message.
1100
1101 The variables @code{message-required-mail-headers} and
1102 @code{message-required-news-headers} specify which headers are required.
1103
1104 Note that some headers will be removed and re-generated before posting,
1105 because of the variable @code{message-deletable-headers} (see below).
1106
1107 @item message-from-style
1108 @vindex message-from-style
1109 Specifies how @code{From} headers should look.  There are four valid
1110 values:
1111
1112 @table @code
1113 @item nil
1114 Just the address -- @samp{king@@grassland.com}.
1115
1116 @item parens
1117 @samp{king@@grassland.com (Elvis Parsley)}.
1118
1119 @item angles
1120 @samp{Elvis Parsley <king@@grassland.com>}.
1121
1122 @item default
1123 Look like @code{angles} if that doesn't require quoting, and
1124 @code{parens} if it does.  If even @code{parens} requires quoting, use
1125 @code{angles} anyway.
1126
1127 @end table
1128
1129 @item message-deletable-headers
1130 @vindex message-deletable-headers
1131 Headers in this list that were previously generated by Message will be
1132 deleted before posting.  Let's say you post an article.  Then you decide
1133 to post it again to some other group, you naughty boy, so you jump back
1134 to the @code{*post-buf*} buffer, edit the @code{Newsgroups} line, and
1135 ship it off again.  By default, this variable makes sure that the old
1136 generated @code{Message-ID} is deleted, and a new one generated.  If
1137 this isn't done, the entire empire would probably crumble, anarchy would
1138 prevail, and cats would start walking on two legs and rule the world.
1139 Allegedly.
1140
1141 @item message-default-headers
1142 @vindex message-default-headers
1143 This string is inserted at the end of the headers in all message
1144 buffers.
1145
1146 @item message-subject-re-regexp
1147 @vindex message-subject-re-regexp
1148 @cindex Aw
1149 @cindex Sv
1150 @cindex Re
1151 Responses to messages have subjects that start with @samp{Re: }.  This
1152 is @emph{not} an abbreviation of the English word ``response'', but is
1153 Latin, and means ``in response to''.  Some illiterate nincompoops have
1154 failed to grasp this fact, and have ``internationalized'' their software
1155 to use abonimations like @samp{Aw: } (``antwort'') or @samp{Sv: }
1156 (``svar'') instead, which is meaningless and evil.  However, you may
1157 have to deal with users that use these evil tools, in which case you may
1158 set this variable to a regexp that matches these prefixes.  Myself, I
1159 just throw away non-compliant mail.
1160
1161 Here's an example of a value to deal with these headers when
1162 responding to a message:
1163
1164 @lisp
1165 (setq message-subject-re-regexp
1166      "^\\(\\(\\([Rr][Ee]\\|[Ss][Vv]\\|[Aa][Ww]\\): *\\)+\\)")
1167 @end lisp
1168
1169 @item message-alternative-emails
1170 @vindex message-alternative-emails
1171 A regexp to match the alternative email addresses.  The first matched
1172 address (not primary one) is used in the @code{From} field.
1173
1174 @end table
1175
1176
1177 @node Mail Headers
1178 @section Mail Headers
1179
1180 @table @code
1181 @item message-required-mail-headers
1182 @vindex message-required-mail-headers
1183 @xref{News Headers}, for the syntax of this variable.  It is
1184 @code{(From Date Subject (optional . In-Reply-To) Message-ID Lines
1185 (optional . User-Agent))} by default.
1186
1187 @item message-ignored-mail-headers
1188 @vindex message-ignored-mail-headers
1189 Regexp of headers to be removed before mailing.  The default is
1190 @samp{^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:}.
1191
1192 @item message-default-mail-headers
1193 @vindex message-default-mail-headers
1194 This string is inserted at the end of the headers in all message
1195 buffers that are initialized as mail.
1196
1197 @end table
1198
1199
1200 @node Mail Variables
1201 @section Mail Variables
1202
1203 @table @code
1204 @item message-send-mail-function
1205 @vindex message-send-mail-function
1206 @findex message-send-mail-with-sendmail
1207 @findex message-send-mail-with-mh
1208 @findex message-send-mail-with-qmail
1209 @findex smtpmail-send-it
1210 @findex feedmail-send-it
1211 Function used to send the current buffer as mail. The default is
1212 @code{message-send-mail-with-sendmail}. Other valid values include
1213 @code{message-send-mail-with-mh}, @code{message-send-mail-with-qmail},
1214 @code{smtpmail-send-it} and @code{feedmail-send-it}.
1215
1216 @item message-mh-deletable-headers
1217 @vindex message-mh-deletable-headers
1218 Most versions of MH doesn't like being fed messages that contain the
1219 headers in this variable.  If this variable is non-@code{nil} (which is
1220 the default), these headers will be removed before mailing when sending
1221 messages via MH.  Set it to @code{nil} if your MH can handle these
1222 headers.
1223
1224 @item message-qmail-inject-program
1225 @vindex message-qmail-inject-program
1226 @cindex qmail
1227 Location of the qmail-inject program.
1228
1229 @item message-qmail-inject-args
1230 @vindex message-qmail-inject-args
1231 Arguments passed to qmail-inject programs.
1232 This should be a list of strings, one string for each argument.  It
1233 may also be a function.
1234
1235 For e.g., if you wish to set the envelope sender address so that bounces
1236 go to the right place or to deal with listserv's usage of that address, you
1237 might set this variable to @code{'("-f" "you@@some.where")}.
1238
1239 @item message-sendmail-f-is-evil
1240 @vindex message-sendmail-f-is-evil
1241 @cindex sendmail
1242 Non-@code{nil} means don't add @samp{-f username} to the sendmail
1243 command line.  Doing so would be even more evil than leaving it out.
1244
1245 @item message-mailer-swallows-blank-line
1246 @vindex message-mailer-swallows-blank-line
1247 Set this to non-@code{nil} if the system's mailer runs the header and
1248 body together.  (This problem exists on Sunos 4 when sendmail is run
1249 in remote mode.)  The value should be an expression to test whether
1250 the problem will actually occur.
1251
1252 @item message-send-mail-partially-limit
1253 @vindex message-send-mail-partially-limit
1254 The limitation of messages sent as message/partial.
1255 The lower bound of message size in characters, beyond which the message 
1256 should be sent in several parts. If it is nil, the size is unlimited.
1257
1258 @end table
1259
1260
1261 @node News Headers
1262 @section News Headers
1263
1264 @vindex message-required-news-headers
1265 @code{message-required-news-headers} a list of header symbols.  These
1266 headers will either be automatically generated, or, if that's
1267 impossible, they will be prompted for.  The following symbols are valid:
1268
1269 @table @code
1270
1271 @item From
1272 @cindex From
1273 @findex user-full-name
1274 @findex user-mail-address
1275 This required header will be filled out with the result of the
1276 @code{message-make-from} function, which depends on the
1277 @code{message-from-style}, @code{user-full-name},
1278 @code{user-mail-address} variables.
1279
1280 @item Subject
1281 @cindex Subject
1282 This required header will be prompted for if not present already.
1283
1284 @item Newsgroups
1285 @cindex Newsgroups
1286 This required header says which newsgroups the article is to be posted
1287 to.  If it isn't present already, it will be prompted for.
1288
1289 @item Organization
1290 @cindex organization
1291 @vindex message-user-organization
1292 @vindex message-user-organization-file
1293 This optional header will be filled out depending on the
1294 @code{message-user-organization} variable.
1295 @code{message-user-organization-file} will be used if this variable is
1296 @code{t}.  This variable can also be a string (in which case this string
1297 will be used), or it can be a function (which will be called with no
1298 parameters and should return a string to be used).
1299
1300 @item Lines
1301 @cindex Lines
1302 This optional header will be computed by Message.
1303
1304 @item Message-ID
1305 @cindex Message-ID
1306 @vindex mail-host-address
1307 @findex system-name
1308 @cindex Sun
1309 This required header will be generated by Message.  A unique ID will be
1310 created based on the date, time, user name and system name.  Message
1311 will use @code{system-name} to determine the name of the system.  If
1312 this isn't a fully qualified domain name (FQDN), Message will use
1313 @code{mail-host-address} as the FQDN of the machine.
1314
1315 @item User-Agent
1316 @cindex User-Agent
1317 This optional header will be filled out according to the
1318 @code{message-newsreader} local variable.
1319
1320 @item In-Reply-To
1321 This optional header is filled out using the @code{Date} and @code{From}
1322 header of the article being replied to.
1323
1324 @item Expires
1325 @cindex Expires
1326 @vindex message-expires
1327 This extremely optional header will be inserted according to the
1328 @code{message-expires} variable.  It is highly deprecated and shouldn't
1329 be used unless you know what you're doing.
1330
1331 @item Distribution
1332 @cindex Distribution
1333 @vindex message-distribution-function
1334 This optional header is filled out according to the
1335 @code{message-distribution-function} variable.  It is a deprecated and
1336 much misunderstood header.
1337
1338 @item Path
1339 @cindex path
1340 @vindex message-user-path
1341 This extremely optional header should probably never be used.
1342 However, some @emph{very} old servers require that this header is
1343 present.  @code{message-user-path} further controls how this
1344 @code{Path} header is to look.  If it is @code{nil}, use the server name
1345 as the leaf node.  If it is a string, use the string.  If it is neither
1346 a string nor @code{nil}, use the user name only.  However, it is highly
1347 unlikely that you should need to fiddle with this variable at all.
1348 @end table
1349
1350 @findex yow
1351 @cindex Mime-Version
1352 In addition, you can enter conses into this list.  The car of this cons
1353 should be a symbol.  This symbol's name is the name of the header, and
1354 the cdr can either be a string to be entered verbatim as the value of
1355 this header, or it can be a function to be called.  This function should
1356 return a string to be inserted.  For instance, if you want to insert
1357 @code{Mime-Version: 1.0}, you should enter @code{(Mime-Version . "1.0")}
1358 into the list.  If you want to insert a funny quote, you could enter
1359 something like @code{(X-Yow . yow)} into the list.  The function
1360 @code{yow} will then be called without any arguments.
1361
1362 If the list contains a cons where the car of the cons is
1363 @code{optional}, the cdr of this cons will only be inserted if it is
1364 non-@code{nil}.
1365
1366 If you want to delete an entry from this list, the following Lisp
1367 snippet might be useful.  Adjust accordingly if you want to remove
1368 another element.
1369
1370 @lisp
1371 (setq message-required-news-headers
1372       (delq 'Message-ID message-required-news-headers))
1373 @end lisp
1374
1375 Other variables for customizing outgoing news articles:
1376
1377 @table @code
1378
1379 @item message-syntax-checks
1380 @vindex message-syntax-checks
1381 Controls what syntax checks should not be performed on outgoing posts.
1382 To disable checking of long signatures, for instance, add
1383
1384 @lisp
1385 (signature . disabled)
1386 @end lisp
1387
1388 to this list.
1389
1390 Valid checks are:
1391
1392 @table @code
1393 @item subject-cmsg
1394 Check the subject for commands.
1395 @item sender
1396 @cindex Sender
1397 Insert a new @code{Sender} header if the @code{From} header looks odd.
1398 @item multiple-headers
1399 Check for the existence of multiple equal headers.
1400 @item sendsys
1401 @cindex sendsys
1402 Check for the existence of version and sendsys commands.
1403 @item message-id
1404 Check whether the @code{Message-ID} looks ok.
1405 @item from
1406 Check whether the @code{From} header seems nice.
1407 @item long-lines
1408 @cindex long lines
1409 Check for too long lines.
1410 @item control-chars
1411 Check for invalid characters.
1412 @item size
1413 Check for excessive size.
1414 @item new-text
1415 Check whether there is any new text in the messages.
1416 @item signature
1417 Check the length of the signature.
1418 @item approved
1419 @cindex approved
1420 Check whether the article has an @code{Approved} header, which is
1421 something only moderators should include.
1422 @item empty
1423 Check whether the article is empty.
1424 @item invisible-text
1425 Check whether there is any invisible text in the buffer.
1426 @item empty-headers
1427 Check whether any of the headers are empty.
1428 @item existing-newsgroups
1429 Check whether the newsgroups mentioned in the @code{Newsgroups} and
1430 @code{Followup-To} headers exist.
1431 @item valid-newsgroups
1432 Check whether the @code{Newsgroups} and @code{Followup-to} headers
1433 are valid syntactically.
1434 @item repeated-newsgroups
1435 Check whether the @code{Newsgroups} and @code{Followup-to} headers
1436 contains repeated group names.
1437 @item shorten-followup-to
1438 Check whether to add a @code{Followup-to} header to shorten the number
1439 of groups to post to.
1440 @end table
1441
1442 All these conditions are checked by default.
1443
1444 @item message-ignored-news-headers
1445 @vindex message-ignored-news-headers
1446 Regexp of headers to be removed before posting.  The default is@*
1447 @samp{^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:}.
1448
1449 @item message-default-news-headers
1450 @vindex message-default-news-headers
1451 This string is inserted at the end of the headers in all message
1452 buffers that are initialized as news.
1453
1454 @end table
1455
1456
1457 @node News Variables
1458 @section News Variables
1459
1460 @table @code
1461 @item message-send-news-function
1462 @vindex message-send-news-function
1463 Function used to send the current buffer as news.  The default is
1464 @code{message-send-news}.
1465
1466 @item message-post-method
1467 @vindex message-post-method
1468 Gnusish @dfn{select method} (see the Gnus manual for details) used for
1469 posting a prepared news message.
1470
1471 @end table
1472
1473
1474 @node Insertion Variables
1475 @section Insertion Variables
1476
1477 @table @code
1478 @item message-ignored-cited-headers
1479 @vindex message-ignored-cited-headers
1480 All headers that match this regexp will be removed from yanked
1481 messages.  The default is @samp{.}, which means that all headers will be
1482 removed.
1483
1484 @item message-cite-prefix-regexp
1485 @vindex message-cite-prefix-regexp
1486 Regexp matching the longest possible citation prefix on a line.
1487
1488 @item message-citation-line-function
1489 @vindex message-citation-line-function
1490 @cindex attribution line
1491 Function called to insert the citation line.  The default is
1492 @code{message-insert-citation-line}, which will lead to citation lines
1493 that look like:
1494
1495 @example
1496 Hallvard B Furuseth <h.b.furuseth@@usit.uio.no> writes:
1497 @end example
1498
1499 Point will be at the beginning of the body of the message when this
1500 function is called.
1501
1502 Note that Gnus provides a feature where clicking on `writes:' hides the
1503 cited text.  If you change the citation line too much, readers of your
1504 messages will have to adjust their Gnus, too.  See the variable
1505 @code{gnus-cite-attribution-suffix}.  @xref{Article Highlighting, ,
1506 Article Highlighting, gnus}, for details.
1507
1508 @item message-yank-prefix
1509 @vindex message-yank-prefix
1510 @cindex yanking
1511 @cindex quoting
1512 When you are replying to or following up an article, you normally want
1513 to quote the person you are answering.  Inserting quoted text is done
1514 by @dfn{yanking}, and each line you yank will have
1515 @code{message-yank-prefix} prepended to it (except for quoted and
1516 empty lines which uses @code{message-yank-cited-prefix}). The default
1517 is @samp{> }.
1518
1519 @item message-yank-cited-prefix
1520 @vindex message-yank-cited-prefix
1521 @cindex yanking
1522 @cindex cited
1523 @cindex quoting
1524 When yanking text from a article which contains no text or already
1525 cited text, each line will be prefixed with the contents of this
1526 variable.  The default is @samp{>}.  See also
1527 @code{message-yank-prefix}.
1528
1529 @item message-indentation-spaces
1530 @vindex message-indentation-spaces
1531 Number of spaces to indent yanked messages.
1532
1533 @item message-cite-function
1534 @vindex message-cite-function
1535 @findex message-cite-original
1536 @findex sc-cite-original
1537 @findex message-cite-original-without-signature
1538 @cindex Supercite
1539 Function for citing an original message.  The default is
1540 @code{message-cite-original}, which simply inserts the original message
1541 and prepends @samp{> } to each line.
1542 @code{message-cite-original-without-signature} does the same, but elides
1543 the signature.  You can also set it to @code{sc-cite-original} to use
1544 Supercite.
1545
1546 @item message-indent-citation-function
1547 @vindex message-indent-citation-function
1548 Function for modifying a citation just inserted in the mail buffer.
1549 This can also be a list of functions.  Each function can find the
1550 citation between @code{(point)} and @code{(mark t)}.  And each function
1551 should leave point and mark around the citation text as modified.
1552
1553 @item message-signature
1554 @vindex message-signature
1555 String to be inserted at the end of the message buffer.  If @code{t}
1556 (which is the default), the @code{message-signature-file} file will be
1557 inserted instead.  If a function, the result from the function will be
1558 used instead.  If a form, the result from the form will be used instead.
1559 If this variable is @code{nil}, no signature will be inserted at all.
1560
1561 @item message-signature-file
1562 @vindex message-signature-file
1563 File containing the signature to be inserted at the end of the buffer.
1564 The default is @file{~/.signature}.
1565
1566 @end table
1567
1568 Note that RFC1036bis says that a signature should be preceded by the three
1569 characters @samp{-- } on a line by themselves.  This is to make it
1570 easier for the recipient to automatically recognize and process the
1571 signature.  So don't remove those characters, even though you might feel
1572 that they ruin your beautiful design, like, totally.
1573
1574 Also note that no signature should be more than four lines long.
1575 Including ASCII graphics is an efficient way to get everybody to believe
1576 that you are silly and have nothing important to say.
1577
1578
1579 @node Various Message Variables
1580 @section Various Message Variables
1581
1582 @table @code
1583 @item message-default-charset
1584 @vindex message-default-charset
1585 @cindex charset
1586 Symbol naming a @sc{mime} charset.  Non-ASCII characters in messages are
1587 assumed to be encoded using this charset.  The default is @code{nil},
1588 which means ask the user.  (This variable is used only on non-@sc{mule}
1589 Emacsen.  
1590 @xref{Charset Translation, , Charset Translation, emacs-mime, 
1591       Emacs MIME Manual}, for details on the @sc{mule}-to-@sc{mime}
1592 translation process.
1593
1594 @item message-signature-separator
1595 @vindex message-signature-separator
1596 Regexp matching the signature separator.  It is @samp{^-- *$} by
1597 default.
1598
1599 @item mail-header-separator
1600 @vindex mail-header-separator
1601 String used to separate the headers from the body.  It is @samp{--text
1602 follows this line--} by default.
1603
1604 @item message-directory
1605 @vindex message-directory
1606 Directory used by many mailey things.  The default is @file{~/Mail/}.
1607
1608 @item message-auto-save-directory
1609 @vindex message-auto-save-directory
1610 Directory where Message auto-saves buffers if Gnus isn't running.  If
1611 @code{nil}, Message won't auto-save.  The default is @file{~/Mail/drafts/}.
1612
1613 @item message-signature-setup-hook
1614 @vindex message-signature-setup-hook
1615 Hook run when initializing the message buffer.  It is run after the
1616 headers have been inserted but before the signature has been inserted.
1617
1618 @item message-setup-hook
1619 @vindex message-setup-hook
1620 Hook run as the last thing when the message buffer has been initialized,
1621 but before yanked text is inserted.
1622
1623 @item message-header-setup-hook
1624 @vindex message-header-setup-hook
1625 Hook called narrowed to the headers after initializing the headers.
1626
1627 For instance, if you're running Gnus and wish to insert a
1628 @samp{Mail-Copies-To} header in all your news articles and all messages
1629 you send to mailing lists, you could do something like the following:
1630
1631 @lisp
1632 (defun my-message-header-setup-hook ()
1633   (let ((group (or gnus-newsgroup-name "")))
1634     (when (or (message-fetch-field "newsgroups")
1635               (gnus-group-find-parameter group 'to-address)
1636               (gnus-group-find-parameter group 'to-list))
1637       (insert "Mail-Copies-To: never\n"))))
1638
1639 (add-hook 'message-header-setup-hook
1640           'my-message-header-setup-hook)
1641 @end lisp
1642
1643 @item message-send-hook
1644 @vindex message-send-hook
1645 Hook run before sending messages.
1646
1647 If you want to add certain headers before sending, you can use the
1648 @code{message-add-header} function in this hook.  For instance:
1649 @findex message-add-header
1650
1651 @lisp
1652 (add-hook 'message-send-hook 'my-message-add-content)
1653 (defun my-message-add-content ()
1654   (message-add-header "X-In-No-Sense: Nonsense")
1655   (message-add-header "X-Whatever: no"))
1656 @end lisp
1657
1658 This function won't add the header if the header is already present.
1659
1660 @item message-send-mail-hook
1661 @vindex message-send-mail-hook
1662 Hook run before sending mail messages.
1663
1664 @item message-send-news-hook
1665 @vindex message-send-news-hook
1666 Hook run before sending news messages.
1667
1668 @item message-sent-hook
1669 @vindex message-sent-hook
1670 Hook run after sending messages.
1671
1672 @item message-cancel-hook
1673 @vindex message-cancel-hook
1674 Hook run when cancelling news articles.
1675
1676 @item message-mode-syntax-table
1677 @vindex message-mode-syntax-table
1678 Syntax table used in message mode buffers.
1679
1680 @item message-strip-special-text-properties
1681 @vindex message-strip-special-text-properties
1682 Emacs has a number of special text properties which can break message
1683 composing in various ways.  If this option is set, message will strip
1684 these properties from the message composition buffer.  However, some
1685 packages requires these properties to be present in order to work.  If
1686 you use one of these packages, turn this option off, and hope the
1687 message composition doesn't break too bad.
1688
1689 @item message-send-method-alist
1690 @vindex message-send-method-alist
1691
1692 Alist of ways to send outgoing messages.  Each element has the form
1693
1694 @lisp
1695 (TYPE PREDICATE FUNCTION)
1696 @end lisp
1697
1698 @table @var
1699 @item type
1700 A symbol that names the method.
1701
1702 @item predicate
1703 A function called without any parameters to determine whether the
1704 message is a message of type @var{type}.
1705
1706 @item function
1707 A function to be called if @var{predicate} returns non-@code{nil}.
1708 @var{function} is called with one parameter -- the prefix.
1709 @end table
1710
1711 @lisp
1712 ((news message-news-p message-send-via-news)
1713  (mail message-mail-p message-send-via-mail))
1714 @end lisp
1715
1716
1717
1718 @end table
1719
1720
1721
1722 @node Sending Variables
1723 @section Sending Variables
1724
1725 @table @code
1726
1727 @item message-fcc-handler-function
1728 @vindex message-fcc-handler-function
1729 A function called to save outgoing articles.  This function will be
1730 called with the name of the file to store the article in.  The default
1731 function is @code{message-output} which saves in Unix mailbox format.
1732
1733 @item message-courtesy-message
1734 @vindex message-courtesy-message
1735 When sending combined messages, this string is inserted at the start of
1736 the mailed copy.  If the string contains the format spec @samp{%s}, the
1737 newsgroups the article has been posted to will be inserted there.  If
1738 this variable is @code{nil}, no such courtesy message will be added.
1739 The default value is @samp{"The following message is a courtesy copy of
1740 an article\\nthat has been posted to %s as well.\\n\\n"}.
1741
1742 @item message-fcc-externalize-attachments
1743 @vindex message-fcc-externalize-attachments
1744 If @code{nil}, attach files as normal parts in Fcc copies; if it is
1745 non-@code{nil}, attach local files as external parts.
1746
1747 @item message-interactive
1748 @vindex message-interactive
1749 If non-@code{nil} wait for and display errors when sending a message;
1750 if @code{nil} let the mailer mail back a message to report errors.
1751
1752 @end table
1753
1754
1755 @node Message Buffers
1756 @section Message Buffers
1757
1758 Message will generate new buffers with unique buffer names when you
1759 request a message buffer.  When you send the message, the buffer isn't
1760 normally killed off.  Its name is changed and a certain number of old
1761 message buffers are kept alive.
1762
1763 @table @code
1764 @item message-generate-new-buffers
1765 @vindex message-generate-new-buffers
1766 If non-@code{nil}, generate new buffers.  The default is @code{t}.  If
1767 this is a function, call that function with three parameters: The type,
1768 the to address and the group name.  (Any of these may be @code{nil}.)
1769 The function should return the new buffer name.
1770
1771 @item message-max-buffers
1772 @vindex message-max-buffers
1773 This variable says how many old message buffers to keep.  If there are
1774 more message buffers than this, the oldest buffer will be killed.  The
1775 default is 10.  If this variable is @code{nil}, no old message buffers
1776 will ever be killed.
1777
1778 @item message-send-rename-function
1779 @vindex message-send-rename-function
1780 After sending a message, the buffer is renamed from, for instance,
1781 @samp{*reply to Lars*} to @samp{*sent reply to Lars*}.  If you don't
1782 like this, set this variable to a function that renames the buffer in a
1783 manner you like.  If you don't want to rename the buffer at all, you can
1784 say:
1785
1786 @lisp
1787 (setq message-send-rename-function 'ignore)
1788 @end lisp
1789
1790 @item message-kill-buffer-on-exit
1791 @findex message-kill-buffer-on-exit
1792 If non-@code{nil}, kill the buffer immediately on exit.
1793
1794 @end table
1795
1796
1797 @node Message Actions
1798 @section Message Actions
1799
1800 When Message is being used from a news/mail reader, the reader is likely
1801 to want to perform some task after the message has been sent.  Perhaps
1802 return to the previous window configuration or mark an article as
1803 replied.
1804
1805 @vindex message-kill-actions
1806 @vindex message-postpone-actions
1807 @vindex message-exit-actions
1808 @vindex message-send-actions
1809 The user may exit from the message buffer in various ways.  The most
1810 common is @kbd{C-c C-c}, which sends the message and exits.  Other
1811 possibilities are @kbd{C-c C-s} which just sends the message, @kbd{C-c
1812 C-d} which postpones the message editing and buries the message buffer,
1813 and @kbd{C-c C-k} which kills the message buffer.  Each of these actions
1814 have lists associated with them that contains actions to be executed:
1815 @code{message-send-actions}, @code{message-exit-actions},
1816 @code{message-postpone-actions}, and @code{message-kill-actions}.
1817
1818 Message provides a function to interface with these lists:
1819 @code{message-add-action}.  The first parameter is the action to be
1820 added, and the rest of the arguments are which lists to add this action
1821 to.  Here's an example from Gnus:
1822
1823 @lisp
1824   (message-add-action
1825    `(set-window-configuration ,(current-window-configuration))
1826    'exit 'postpone 'kill)
1827 @end lisp
1828
1829 This restores the Gnus window configuration when the message buffer is
1830 killed, postponed or exited.
1831
1832 An @dfn{action} can be either: a normal function, or a list where the
1833 @code{car} is a function and the @code{cdr} is the list of arguments, or
1834 a form to be @code{eval}ed.
1835
1836
1837 @node Compatibility
1838 @chapter Compatibility
1839 @cindex compatibility
1840
1841 Message uses virtually only its own variables---older @code{mail-}
1842 variables aren't consulted.  To force Message to take those variables
1843 into account, you can put the following in your @file{.emacs} file:
1844
1845 @lisp
1846 (require 'messcompat)
1847 @end lisp
1848
1849 This will initialize many Message variables from the values in the
1850 corresponding mail variables.
1851
1852
1853 @node Appendices
1854 @chapter Appendices
1855
1856 @menu
1857 * Responses::          Standard rules for determining where responses go.
1858 @end menu
1859
1860
1861 @node Responses
1862 @section Responses
1863
1864 To determine where a message is to go, the following algorithm is used
1865 by default.
1866
1867 @table @dfn
1868 @item reply
1869 A @dfn{reply} is when you want to respond @emph{just} to the person who
1870 sent the message via mail.  There will only be one recipient.  To
1871 determine who the recipient will be, the following headers are
1872 consulted, in turn:
1873
1874 @table @code
1875 @item Reply-To
1876
1877 @item From
1878 @end table
1879
1880
1881 @item wide reply
1882 A @dfn{wide reply} is a mail response that includes @emph{all} entities
1883 mentioned in the message you are responded to.  All mailboxes from the
1884 following headers will be concatenated to form the outgoing
1885 @code{To}/@code{Cc} headers:
1886
1887 @table @code
1888 @item From
1889 (unless there's a @code{Reply-To}, in which case that is used instead).
1890
1891 @item Cc
1892
1893 @item To
1894 @end table
1895
1896 If a @code{Mail-Copies-To} header is present, it will also be included
1897 in the list of mailboxes.  If this header is @samp{never}, that means
1898 that the @code{From} (or @code{Reply-To}) mailbox will be suppressed.
1899
1900
1901 @item followup
1902 A @dfn{followup} is a response sent via news.  The following headers
1903 (listed in order of precedence) determine where the response is to be
1904 sent:
1905
1906 @table @code
1907
1908 @item Followup-To
1909
1910 @item Newsgroups
1911
1912 @end table
1913
1914 If a @code{Mail-Copies-To} header is present, it will be used as the
1915 basis of the new @code{Cc} header, except if this header is
1916 @samp{never}.
1917
1918 @end table
1919
1920
1921
1922 @node Index
1923 @chapter Index
1924 @printindex cp
1925
1926 @node Key Index
1927 @chapter Key Index
1928 @printindex ky
1929
1930 @summarycontents
1931 @contents
1932 @bye
1933
1934 @c End: