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