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