]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/doc/usd/07.mail/mail4.nr
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / doc / usd / 07.mail / mail4.nr
1 .\" Copyright (c) 1980, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)mail4.nr    8.1 (Berkeley) 6/8/93
33 .\"
34 .bp
35 .sh 1 "More about sending mail"
36 .sh 2 "Tilde escapes"
37 .pp
38 While typing in a message to be sent to others, it is often
39 useful to be able to invoke the text editor on the partial message,
40 print the message, execute a shell command, or do some other
41 auxiliary function. 
42 .i Mail
43 provides these capabilities through
44 .i "tilde escapes" ,
45 which consist of a tilde (~) at the beginning of a line, followed by
46 a single character which indicates the function to be performed.  For
47 example, to print the text of the message so far, use:
48 .(l
49 ~p
50 .)l
51 which will print a line of dashes, the recipients of your message, and
52 the text of the message so far.
53 Since
54 .i Mail
55 requires two consecutive \s-2RUBOUT\s0's to abort a letter, you
56 can use a single \s-2RUBOUT\s0 to abort the output of ~p or any other
57 ~ escape without killing your letter.
58 .pp
59 If you are dissatisfied with the message as
60 it stands, you can invoke the text editor on it using the escape
61 .(l
62 ~e
63 .)l
64 which causes the message to be copied into a temporary file and an
65 instance of the editor to be spawned.  After modifying the message to
66 your satisfaction, write it out and quit the editor. 
67 .i Mail
68 will respond
69 by typing
70 .(l
71 (continue)
72 .)l
73 after which you may continue typing text which will be appended to your
74 message, or type <control-d> to end the message.
75 A standard text editor is provided by
76 .i Mail .
77 You can override this default by setting the valued option
78 .q EDITOR
79 to something else.  For example, you might prefer:
80 .(l
81 set EDITOR=/usr/bin/ex
82 .)l
83 .pp
84 Many systems offer a screen editor as an alternative to the standard
85 text editor, such as the
86 .i vi
87 editor from UC Berkeley.
88 To use the screen, or
89 .i visual
90 editor, on your current message, you can use the escape,
91 .(l
92 ~v
93 .)l
94 ~v works like ~e, except that the screen editor is invoked instead.
95 A default screen editor is defined by
96 .i Mail .
97 If it does not suit you, you can set the valued option
98 .q VISUAL
99 to the path name of a different editor.
100 .pp
101 It is often useful to be able to include the contents of some
102 file in your message; the escape
103 .(l
104 ~r filename
105 .)l
106 is provided for this purpose, and causes the named file to be appended
107 to your current message. 
108 .i Mail
109 complains if the file doesn't exist
110 or can't be read.  If the read is successful, the number of lines and
111 characters appended to your message is printed, after which you may continue
112 appending text.  The filename may contain shell metacharacters like * and ?
113 which are expanded according to the conventions of your shell.
114 .pp
115 As a special case of ~r, the escape
116 .(l
117 ~d
118 .)l
119 reads in the file
120 .q dead.letter
121 in your home directory.  This is often useful since
122 .i Mail
123 copies the text
124 of your message there when you abort a message with \s-2RUBOUT\s0.
125 .pp
126 To save the current text of your message on a file you may use the
127 .(l
128 ~w filename
129 .)l
130 escape. 
131 .i Mail
132 will print out the number of lines and characters written
133 to the file, after which you may continue appending text to your message.
134 Shell metacharacters may be used in the filename, as in ~r and are expanded
135 with the conventions of your shell.
136 .pp
137 If you are sending mail from within
138 .i Mail's
139 command mode
140 you can read a message sent to you into the message
141 you are constructing with the escape:
142 .(l
143 ~m 4
144 .)l
145 which will read message 4 into the current message, shifted right by
146 one tab stop.  You can name any non-deleted message, or list of messages.
147 Messages can also be forwarded without shifting by a tab stop with ~f.
148 This is the usual way to forward a message.
149 .pp
150 If, in the process of composing a message, you decide to add additional
151 people to the list of message recipients, you can do so with the escape
152 .(l
153 ~t name1 name2 ...
154 .)l
155 You may name as few or many additional recipients as you wish.  Note
156 that the users originally on the recipient list will still receive
157 the message; you cannot remove someone from the recipient
158 list with ~t.
159 .pp
160 If you wish, you can associate a subject with your message by using the
161 escape
162 .(l
163 ~s Arbitrary string of text
164 .)l
165 which replaces any previous subject with
166 .q "Arbitrary string of text."
167 The subject, if given, is sent near the
168 top of the message prefixed with
169 .q "Subject:"
170 You can see what the message will look like by using ~p.
171 .pp
172 For political reasons, one occasionally prefers to list certain
173 people as recipients of carbon copies of a message rather than
174 direct recipients.  The escape
175 .(l
176 ~c name1 name2 ...
177 .)l
178 adds the named people to the
179 .q "Cc:"
180 list, similar to ~t.
181 Again, you can execute ~p to see what the message will look like.
182 .pp
183 The escape
184 .(l
185 ~b name1 name2 ...
186 .)l
187 adds the named people to the
188 .q "Cc:"
189 list, but does not make the names visible in the
190 .q "Cc:"
191 line ("blind" carbon copy).
192 .pp
193 The recipients of the message together constitute the
194 .q "To:"
195 field, the subject the
196 .q "Subject:"
197 field, and the carbon copies the
198 .q "Cc:"
199 field.  If you wish to edit these in ways impossible with the ~t, ~s, ~c
200 and ~b escapes, you can use the escape
201 .(l
202 ~h
203 .)l
204 which prints
205 .q "To:"
206 followed by the current list of recipients and leaves the cursor
207 (or printhead) at the end of the line.  If you type in ordinary
208 characters, they are appended to the end of the current list of
209 recipients.  You can also use your erase character to erase back into
210 the list of recipients, or your kill character to erase them altogether.
211 Thus, for example, if your erase and kill characters are the standard
212 (on printing terminals) # and @ symbols,
213 .(l
214 ~h
215 To: root kurt####bill
216 .)l
217 would change the initial recipients
218 .q "root kurt"
219 to
220 .q "root bill."
221 When you type a newline,
222 .i Mail
223 advances to the
224 .q "Subject:"
225 field, where the same rules apply.  Another newline brings you to
226 the
227 .q "Cc:"
228 field, which may be edited in the same fashion.  Another newline
229 brings you to the
230 .q "Bcc:"
231 ("blind" carbon copy) field, which follows the same rules as the "Cc:"
232 field.  Another newline
233 leaves you appending text to the end of your message.  You can use
234 ~p to print the current text of the header fields and the body
235 of the message.
236 .pp
237 To effect a temporary escape to the shell, the escape
238 .(l
239 ~!command
240 .)l
241 is used, which executes
242 .i command
243 and returns you to mailing mode without altering the text of
244 your message.  If you wish, instead, to filter the body of your
245 message through a shell command, then you can use
246 .(l
247 ~|command
248 .)l
249 which pipes your message through the command and uses the output
250 as the new text of your message.  If the command produces no output,
251 .i Mail
252 assumes that something is amiss and retains the old version
253 of your message.  A frequently-used filter is the command
254 .i fmt ,
255 designed to format outgoing mail.
256 .pp
257 To effect a temporary escape to
258 .i Mail
259 command mode instead, you can use the
260 .(l
261 ~:\fIMail command\fP
262 .)l
263 escape.  This is especially useful for retyping the message you are
264 replying to, using, for example:
265 .(l
266 ~:t
267 .)l
268 It is also useful for setting options and modifying aliases.
269 .pp
270 If you wish abort the current message, you can use the escape
271 .(l
272 ~q
273 .)l
274 This will terminate the current message and return you to the
275 shell (or \fIMail\fP if you were using the \fBmail\fP command).
276 If the \fBsave\fP option is set, the message will be copied
277 to the file
278 .q dead.letter
279 in your home directory.
280 .pp
281 If you wish (for some reason) to send a message that contains
282 a line beginning with a tilde, you must double it.  Thus, for example,
283 .(l
284 ~~This line begins with a tilde.
285 .)l
286 sends the line
287 .(l
288 ~This line begins with a tilde.
289 .)l
290 .pp
291 Finally, the escape
292 .(l
293 ~?
294 .)l
295 prints out a brief summary of the available tilde escapes.
296 .pp
297 On some terminals (particularly ones with no lower case)
298 tilde's are difficult to type.
299 .i Mail
300 allows you to change the escape character with the
301 .q escape
302 option.  For example, I set
303 .(l
304 set escape=]
305 .)l
306 and use a right bracket instead of a tilde.  If I ever need to
307 send a line beginning with right bracket, I double it, just as for ~.
308 Changing the escape character removes the special meaning of ~.
309 .sh 2 "Network access"
310 .pp
311 This section describes how to send mail to people on other machines.
312 Recall that sending to a plain login name sends mail to that person
313 on your machine.  If your machine is directly (or sometimes, even,
314 indirectly) connected to the Arpanet, you can send messages to people
315 on the Arpanet using a name of the form
316 .(l
317 name@host.domain
318 .)l
319 where
320 .i name
321 is the login name of the person you're trying to reach,
322 .i host
323 is the name of the machine on the Arpanet,
324 and 
325 .i domain
326 is the higher-level scope within which the hostname is known, e.g. EDU (for educational
327 institutions), COM (for commercial entities), GOV (for governmental agencies),
328 ARPA for many other things, BITNET or CSNET for those networks.
329 .pp
330 If your recipient logs in on a machine connected to yours by
331 UUCP (the Bell Laboratories supplied network that communicates
332 over telephone lines), sending mail can be a bit more complicated.
333 You must know the list of machines through which your message must
334 travel to arrive at his site.  So, if his machine is directly connected
335 to yours, you can send mail to him using the syntax:
336 .(l
337 host!name
338 .)l
339 where, again,
340 .i host
341 is the name of the machine and
342 .i name
343 is the login name.
344 If your message must go through an intermediary machine first, you
345 must use the syntax:
346 .(l
347 intermediary!host!name
348 .)l
349 and so on.  It is actually a feature of UUCP that the map of all
350 the systems in the network is not known anywhere (except where people
351 decide to write it down for convenience).  Talk to your system administrator
352 about good ways to get places; the
353 .i uuname
354 command will tell you systems whose names are recognized, but not which
355 ones are frequently called or well-connected.
356 .pp
357 When you use the
358 .b reply
359 command to respond to a letter, there is a problem of figuring out the
360 names of the users in the
361 .q "To:"
362 and
363 .q "Cc:"
364 lists
365 .i "relative to the current machine" .
366 If the original letter was sent to you by someone on the local machine,
367 then this problem does not exist, but if the message came from a remote
368 machine, the problem must be dealt with.
369 .i Mail
370 uses a heuristic to build the correct name for each user relative
371 to the local machine.  So, when you
372 .b reply
373 to remote mail, the names in the
374 .q "To:"
375 and
376 .q "Cc:"
377 lists may change somewhat.
378 .sh 2 "Special recipients"
379 .pp
380 As described previously, you can send mail to either user names or
381 .b alias
382 names.  It is also possible to send messages directly to files or to
383 programs, using special conventions.  If a recipient name has a
384 `/' in it or begins with a `+', it is assumed to be the
385 path name of a file into which
386 to send the message.  If the file already exists, the message is
387 appended to the end of the file.  If you want to name a file in
388 your current directory (ie, one for which a `/' would not usually
389 be needed) you can precede the name with `./'
390 So, to send mail to the file
391 .q memo
392 in the current directory, you can give the command:
393 .(l
394 % Mail ./memo
395 .)l
396 If the name begins with a `+,' it is expanded into the full path name
397 of the folder name in your folder directory.
398 This ability to send mail to files can be used for a variety of
399 purposes, such as maintaining a journal and keeping a record of
400 mail sent to a certain group of users.  The second example can be
401 done automatically by including the full pathname of the record
402 file in the
403 .b alias
404 command for the group.  Using our previous
405 .b alias
406 example, you might give the command:
407 .(l
408 alias project sam sally steve susan /usr/project/mail_record
409 .)l
410 Then, all mail sent to "project" would be saved on the file
411 .q /usr/project/mail_record
412 as well as being sent to the members of the project.  This file
413 can be examined using
414 .i "Mail \-f" .
415 .pp
416 It is sometimes useful to send mail directly to a program, for
417 example one might write a project billboard program and want to access
418 it using
419 .i Mail .
420 To send messages to the billboard program, one can send mail
421 to the special name `|billboard' for example.
422 .i Mail
423 treats recipient names that begin with a `|' as a program to send
424 the mail to.  An
425 .b alias
426 can be set up to reference a `|' prefaced name if desired.
427 .i Caveats :
428 the shell treats `|' specially, so it must be quoted on the command
429 line.  Also, the `| program' must be presented as a single argument to
430 mail.  The safest course is to surround the entire name with double
431 quotes.  This also applies to usage in the
432 .b alias
433 command.  For example, if we wanted to alias `rmsgs' to `rmsgs \-s'
434 we would need to say:
435 .(l
436 alias rmsgs "| rmsgs -s"
437 .)l