© 2008 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.

ITCWeb: u010b.sun.mail



   U-010B, A PRIMER FOR UNIX MAIL ON THE SUNS

   This is  a  publication  of  Information  Technology  and  Communication,
   University  of  Virginia,  Charlottesville,  VA,  copyright 1995.  Please
   credit UVa, ITC, and the author when referring  to  and/or  copying  this
   publication for your own purposes.

   This ITC publication  was  designed  to  be  displayed  on-line  using  a
   monospace font such as Courier.





       TITLE:  A Primer for Unix Mail on the Suns   DOCUMENT NO:  U-010B

       DATE:  October 9, 1995                       VERSION NO: 8






   INTRODUCTION

        This document is a primer on how to use the default electronic  mail
   program  (using  the  command  mail)  on  ITC's Sun workstations.  If you
   prefer to use the  same  mail  program  that  is  the  default  on  ITC's
   RS/6000s, use the command mush rather than mail and get a copy of U-010A,
   ``A Primer for Mail on RS/6000 Computers (Mush).''


   REGISTERING FOR NETWORK MAIL

        Before getting into the actual  mechanics  of  reading  and  sending
   mail,  a  brief  description  of the mail addressing system is necessary.
   Mail addresses conform to the domain structure which  is  illustrated  in
   the figure on page 2. The University of Virginia's global mail address is
   "virginia.edu," as shown at the top of the figure.  Each department  with
   a  distinct  mail  subnet is given a unique sub-domain address, as illus-
   trated in the figure by the entry ``ee'' for Electrical Engineering.  ITC
   owns  the  sub-domains "acc," ``acs'' and ``itc,'' and each of these con-
   tains a large number of sub-domains, one for each machine.  Machines  are
   treated  as single domains.  You, our hypothetical user with login (mail)
   id xyz8f, are assumed in the figure to have your mail account on the  Sun
   named  sunipc-3.unixlab.   Thus  your full mail address is "xyz8f@sunipc-
   3.unixlab.virginia.edu," and this is the actual address to which your in-
   coming mail is sent.


        A user defines an alias for his full  mail  address  by  registering
   this on the single machine which corresponds to the virginia.edu level of
   the mail hierarchy.  That is, your registration at the virginia.edu level
   simply  affirms  that all mail addressed to "xyz8f@virginia.edu" is to be
   sent to the full mail address "xyz8f@sunipc-3.acc.virginia.edu." So, your
   friends at other places (or from within the University) can send you mail








   U-010B             A Primer for Unix Mail on the Suns                   2

   at xyz8f@virginia.edu, without needing to know where, in fact,  you  will
   actually  read your mail.  To register, type the command mailreg and fol-
   low the directions.  Those faculty,  staff  and  students  who  have  re-
   gistered  get  their  primary  mail  addresses (and any other aliases  as
   described in Appendix B) printed in the electronic mail  section  of  the
   University Directory, accessible using the command whois.

        Finally, we should point out that a user can forward mail  from  one
   machine  to  another. Thus, if you have accounts on two machines, say poe
   and sunipc-3, you can register at the virginia.edu level for  receipt  of
   mail  on  sunipc-3,  but  you can forward any mail coming to poe (sent by
   someone  who  addresses  you  as  xyz8f@poe.acc.virginia.edu)  to  go  to
   sunipc-3.   To  forward  mail on Unix machines, the forwarding address is
   given as a single line in the file ``.forward'' in your  home  directory.
   Thus, if you had an account on a second Unix machine, poe, then you would
   create a file named ``.forward'' in your home directory on poe containing
   the  line  "xyz8f@virginia.edu." This way you can arrange to have all in-
   coming mail sent to a single machine.


   INVOKING THE MAIL PROGRAM

        To read incoming mail, you simply type the command:

             mailCR

   and you will get a display informing you of the  first  several  incoming
   messages  which  are  sitting  in your mailbox.  This display ends with a
   line consisting of the prompt ``&'' which indicates that you are  now  in
   the  mail  program's "command mode" (see the next section).  Each message
   has a number, and to read message number 3, for example, you  can  simply
   type  3  then press the RETURN key, and the text of message number 3 will
   be displayed on the screen.

        On the other hand, if you log in and want to send a mail message  to
   someone,  you can do this without seeing your incoming messages.  Suppose
   that you want to send a message to Claude J. Boondock, whose mail  id  in
   the  phone  book  is cjb4w (note that this is an imaginary person!), then
   you can simply type

             mail cjb4w@virginia.eduCR

   The system will then prompt you to provide a subject title for  the  mes-
   sage, and after you have typed that, followed by pressing the RETURN key,
   you will be in ``input mode,'' and you can type the  message,  terminated
   by  a  line containing only a period (.) or <Ctrl-d> (hold down the "con-
   trol" key and type the "d" key).  You will see the EOT symbol, indicating
   that your message is on its way, and a while later you will see the usual
   Unix prompt.

        If you mistype an address or give an  incorrect  one,  your  message
   will be returned to you, sometime later, as undeliverable UNLESS the mail
   address you gave is someone else's real address.  In the latter case, the
   mail  will  be  delivered to the person other than whom you intended. The
   appendices describe how to simplify the procedure of sending mail to peo-
   ple with whom you communicate on a regular basis.

        The mail facility on Unix systems is extremely complex  and  endowed
   with numerous options.  For a complete description of the facility, refer
   to manual pages by typing man mail at a Unix  prompt.   Use  the  manpage




   U-010B             A Primer for Unix Mail on the Suns                   3

   command to get a printed copy of the manual,  manpage mail.


   INPUT AND COMMAND MODES

        As mentioned above, the mail program is always in one of two states,
   either  ``input  mode,''  when it is accepting text from your keyboard as
   part of a message, or ``command mode,'' when it is responding to requests
   from  you (such as to read a particular message).  There are over 50 com-
   mands available, and we will only present a few of them in the next  sec-
   tion.  Appendix C is a table of frequently used commands.

        When the mail system is in input mode, it cannot  recognize  English
   word  commands,  for obvious reasons, and thus a special mechanism called
   the "tilde escape" is used to get the mail  program's  attention.   Press
   RETURN to get to a new line and then type the tilde ( ~ ) character, fol-
   lowed by the command name. Thus, if you were  in  the  middle  of  typing
   text,  and you realized that you needed to add bkw9j to the list of reci-
   pients of this message (the " To:" list), you could type
             CR        (to get to a new line)
             ~t bkw9j@virginia.edu
             CR
   and then continue with the input of your message.   A  later  section  of
   this document gives examples of some other useful tilde escapes.


   SOME USEFUL COMMANDS

        After invoking the mail program with the command mail you can peruse
   your  messages.   Pressing  the  RETURN key will display the first unread
   message, and subsequent unread messages can be seen by again pressing RE-
   TURN.   As mentioned earlier, a specific message, including one which has
   been read on a previous occasion and left in your mailbox, can be seen by
   entering the message number.

        After reading a message you may want to reply. To  do  this,  simply
   type  r  if you only want to reply to the sender, or R if you want to get
   your reply to all the recipients of the original message.   Again,  these
   commands must be followed by pressing the RETURN key.  Now you are in the
   mail program's input mode (see above), where any text you enter will  be-
   come  part  of  an outgoing message.  You can enter your response, ending
   your reply with a line consisting only of a period (.) or <Ctrl-d>.   The
   symbol  EOT  (for  end-of-transmission)  will  appear on your screen, and
   after a short wait while the reply is sent, you will get the "&"  prompt.
   Thus, you are now out of input mode and back into command mode.

        After replying, or after only reading a message, you need to  decide
   how  to  dispose of the incoming message.  One option is to simply delete
   the message. To do this, type d and the message is gone forever.   Alter-
   natively, you may want to hold the message in your in-box so that you can
   be confronted with it the next time that you log in. To accomplish  this,
   type  in  pre  (for  "preserve")  after  the  message has been displayed.
   Again, we remind the reader of the need to press the RETURN key after all
   commands.

        You can see the subjects (and sender login ids) of the first several
   messages in your mailbox by typing the command h followed by pressing the
   RETURN key.  Finally, you can get a summary of all the commands by typing
   ?.





   U-010B             A Primer for Unix Mail on the Suns                   4

        To quit the mail program, type q which is the "quit"  command,  fol-
   lowed by the usual
   RETURN.  If you do nothing to delete or preserve a message after  reading
   it,  when  you quit mail, it will be saved in a file named "mbox" in your
   home directory.  The command:
             s filenameCR

   will instead save a copy of the message in the file called filename.  You
   can  also exit mail with the command x.  This terminates the mail program
   without modifying your mailbox (i.e., all new  messages  that  were  read
   will be new again and all deleted messages will be undeleted).

   SOME USEFUL TILDE ESCAPES

        It sometimes happens that you decide that the message you are enter-
   ing  has become so garbled or libelous that you want to obliterate it and
   start afresh (n.b., see the discussion on the use of an  editor,  below).
   You can do this with the tilde command ~q (for "quit").  This disposes of
   the garbled message and puts you back in the place where you were  before
   typing  mail.   If  you  invoked  mail in input mode to send a message as
   described above, the exit will send you back to the Unix prompt.

        An editor is a program which helps you create files of  textual  ma-
   terial. An editor makes it easy to add, delete, and modify text in an ex-
   isting document.  If you are planning to send an important  communication
   to  one  or more people, it is probably wise to first create the document
   as a file, using one of the Unix editors.  Again,  this  is  outside  the
   scope of this document, but we will mention some of the the available ed-
   itors on the Unix  systems  are  Vi,  JOVE,  Pico,  and  Emacs.
   JOVE and Pico are simpler versions of Emacs.  

        Suppose that you have carefully crafted a message, using one of  the
   editors,  and saved it as file "manifesto." You now want to send this do-
   cument to your friend Boondock and also to Slugg, whose e-mail address is
   pws5t.  Enter the mail system with the command:

             mail cjb4w@virginia.edu pws5t@virginia.eduCR

   First of all, you will be asked to  enter  a  subject  for  the  message.
   Then,  naturally, the mail system will sit waiting for you to enter text,
   and you can do so if you want. But, in order to incorporate the  contents
   of  file  "manifesto" into the mail message, you should, while at the be-
   ginning of a line, type in the command:
             ~r manifestoCR

   and the contents of the file will become part of the mail  message.   You
   can then add more text if you want.

        Another tilde command, ~e permits you to use the editor named by the
   EDITOR shell variable, while in mail, to modify the text of a message you
   have already typed or included from a file.  Yet another useful tilde es-
   cape  is  ~p, which prints out the text of the message entered up to that
   point.

        Our advice to novice users is to first  use  the  simple  facilities
   described  above,  and  then  to progress to an understanding of the file
   system and the use of an editor.  As mentioned above,  ITC  offers  short
   courses  on  these  topics  at the beginning of each semester.  Moreover,




   U-010B             A Primer for Unix Mail on the Suns                   5

   they are covered in many introductory Unix texts, available in most local
   bookstores.



   U-010B             A Primer for Unix Mail on the Suns                   6

                                  APPENDIX A

                       ESTABLISHING PRIVATE MAIL ALIASES



        If you correspond regularly with someone whose address  is  hard  or
   long  to  type or if you correspond with a group of people, say a commit-
   tee, you should create ``aliases'' for the addresses.  To do this, use an
   editor such as JOVE or Vi to create a file by the name of .mailrc in your
   home directory.

        Let us suppose that you want to refer to Boondock as "Clem" and that
   you need to communicate with a group of three people, Larry, Mo, and Cur-
   ly, who make up the stooge committee.  Let us assume that  the  mail  ad-
   dresses  of  Larry,  Mo,  and  Curly are, respectively, laa5b, mbb5b, and
   ccc5b.

        If you set up a .mailrc file in the form:

             alias   Clemcjb4w@virginia.edu
             alias   Larrylaa5b@virginia.edu
             alias   Mo  mbb5b@virginia.edu
             alias   Curlyccc5b@virginia.edu
             alias   stoogesLarry Mo Curly

   Then you can type "mail Clem" and the message will be sent  to  Boondock.
   A  message  sent to Larry will go to laa5b@virginia.edu.  Finally, a mes-
   sage addressed to "stooges" will be sent to Larry, Mo, and  Curly.   Note
   that  while  mail addresses like ccc5b@virginia.edu are case-insensitive,
   private aliases defined in the ``.mailrc'' file (like Curly, above),  are
   case-sensitive.  Thus  if  you tried to send a message to ``Stooges'' in-
   stead of ``stooges'' it would fail.


                                  APPENDIX B

                GETTING ADDITIONAL GLOBAL ALIASES FOR YOURSELF



        It is possible to have additional aliases created  for  you  at  the
   virginia.edu  level of the mail system.  For example, if you want to tell
   your  friends  outside  the  University  to  address  mail  to   you   as
   lefty@virginia.edu, then you would make a request to have a "Personalized
   Electronic Mail Alias" set up for you with that name.   Like  other  mail
   addresses,  such  aliases  are case-insensitive.  Your friends inside the
   University can also use that address, but for them it is probably simpler
   to  set up the alias lefty in their own ``.mailrc'' file, as explained in
   Appendix A.

        There are, of course, some restrictions on  permissible  aliases  of
   this  kind.   No duplications can occur, and aliases cannot conflict with
   regular mailids.  We will also reject aliases which we  judge  to  be  in
   poor taste.

        Up to three of these aliases are published in  the  electronic  mail
   section of the University Directory (whois), along with the initial alias
   created by registration at the virginia.edu domain level.  To apply for a
   Personalized   Electronic   Mail   Alias,   send   electronic   mail   to




   U-010B             A Primer for Unix Mail on the Suns                   7

   postmaster@virginia.edu.

   mas8y/October 9, 1995

      -----

   WE REALLY WANT TO KNOW...
         Have you found this publication useful? Are there ways we
         might improve or supplement it or other ITC publications?
         Did you find this document in Web, Gopher, or in hard copy?
         We really want your opinion.  Send e-mail to newsdesk@
         virginia.edu.