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