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