home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / 1_1_contri / usd / 07_mail / mail4_nr < prev    next >
Encoding:
Text File  |  1986-05-23  |  11.8 KB  |  386 lines

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