Annotation of researchv10no/lbin/Mail/manual/mail4.nr, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.