BSD 2 development
[unix-history] / doc / Mail / mail3.nr
CommitLineData
a80efa1b
KS
1.sh 1 "Tilde escapes"
2.pp
3While typing in a message to be sent to others, it is often
4useful to be able to invoke the text editor on the partial message,
5print the message, execute a shell command, or perform some other
6auxiliary function. Mail provides these capabilities through
7.i "tilde escapes" ,
8which consist of a tilde (~) at the beginning of a line, followed by
9a single character which indicates the function to be performed. For
10example, to print the text of the message so far, use:
11.(l
12~p
13.)l
14which will print a line of dashes, the recipients of your message, and
15the text of the message so far. If you are dissatisfied with the message as
16it stands, you can invoke the text editor on it using the escape
17.(l
18~e
19.)l
20which causes the message to be copied into a temporary file and an
21instance of the editor to be spawned. After modifying the message to
22your satisfaction, write it out and quit the editor. Mail will respond
23by typing
24.(l
25(continue)
26.)l
27after which you may continue typing text which will be appended to your
28message, or type <control-d> to end the message.
29.pp
30It is often useful to be able to include the contents of some
31file in your message; the escape
32.(l
33~r filename
34.)l
35is provided for this purpose, and causes the named file to be appended
36to your current message. Mail complains if the file doesn't exist
37or can't be read. If the read is successful, the number of lines and
38characters appended to your message is printed, after which you may continue
39appending text.
40.pp
41As a special case of ~r, the escape
42.(l
43~d
44.)l
45reads in the file
46.q dead.letter
47in your home directory. This is often useful since Mail copies the text
48of your message there when you abort a message with \s-2RUBOUT\s0.
49.pp
50In order to save the current text of your message on a file you may use the
51.(l
52~w filename
53.)l
54escape. Mail will print out the number of lines and characters written
55to the file, after which you may continue appending text to your message.
56.pp
57If you are sending mail from within Mail's command mode (read about the
58.b reply
59and
60.b mail
61commands, section six), you can read a message sent to you into the message
62you are constructing with the escape:
63.(l
64~m 4
65.)l
66which will read message 4 into the current message, shifted right by
67one tab stop. You can name any non-deleted message, or list of messages.
68This is the usual way to forward a message.
69.pp
70If, in the process of composing a message, you decide to add additional
71people to the list of message recipients, you can do so with the escape
72.(l
73~t name1 name2 ...
74.)l
75You may name as few or many additional recipients as you wish. Note
76that the users originally on the recipient list will still receive
77the message; in fact, you cannot remove someone from the recipient
78list with ~t.
79.pp
80If you wish, you can associate a subject with your message by using the
81escape
82.(l
83~s Arbitrary string of text
84.)l
85which replaces any previous subject with
86.q "Arbitrary string of text."
87The subject, if given, is sent near the
88top of the message prefixed with
89.q "Subj:"
90You can see what the message will look like by using ~p.
91.pp
92For political reasons, one occasionally prefers to list certain
93people as recipients of carbon copies of a message rather than
94direct recipients. The escape
95.(l
96~c name1 name2 ...
97.)l
98adds the named people to the
99.q "Cc:"
100list, similar to ~t.
101Again, you can execute ~p to see what the message will look like.
102.pp
103The recipients of the message together constitute the
104.q "To:"
105field, the subject the
106.q "Subj:"
107field, and the carbon copies the
108.q "Cc:"
109field. If you wish to edit these in ways impossible with the ~t, ~s,
110and ~c escapes, you can use the escape
111.(l
112~h
113.)l
114which prints
115.q "To:"
116followed by the current list of recipients and leaves the cursor
117(or printhead) at the end of the line. If you type in ordinary
118characters, they are appended to the end of the current list of
119recipients. You can also use your erase character to erase back into
120the list of recipients, or your kill character to erase them altogether.
121Thus, for example, if your erase and kill characters are the standard
122# and @ symbols,
123.(l
124~h
125To: root kurt####bill
126.)l
127would change the initial recipients
128.q "root kurt"
129to
130.q "root bill."
131When you type a newline, Mail advances to the
132.q "Subj:"
133field, where the same rules apply. Another newline brings you to
134the
135.q "Cc:"
136field, which may be edited in the same fashion. Another newline
137leaves you appending text to the end of your message. You can use
138~p to print the current text of the header fields and the body
139of the message.
140.pp
141To effect a temporary escape to the shell, the escape
142.(l
143~!command
144.)l
145is used, which executes
146.i command
147and returns you to mailing mode without altering the text of
148your message. If you wish, instead, to filter the body of your
149message through a shell command, then you can use
150.(l
151~|command
152.)l
153which pipes your message through the command and uses the output
154as the new text of your message. If the command produces no output,
155Mail assumes that something is amiss and retains the old version
156of your message. A frequently-used filter is the command
157.i fmt
158which is designed to format outgoing mail.
159.pp
160If you wish (for some reason) to send a message which contains
161a line beginning with a tilde, you must double it. Thus, for example,
162.(l
163~~This line begins with a tilde.
164.)l
165sends the line
166.(l
167~This line begins with a tilde.
168.)l
169.pp
170Finally, the escape
171.(l
172~?
173.)l
174prints out a brief summary of the available tilde escapes.