COHERENT manpages

This page displays the COHERENT manpage for mail [Electronic mail system].

List of available manpages
Index


mail -- Overview

Electronic mail system

The COHERENT system includes a full-featured, UNIX-style mail system.  This
system consists  of commands with which your system  can send, receive, and
forward  mail;  and  configuration  files,  with  which  you  can  describe
potential recipients of mail, either on your system or other systems.  This
article describes  the design of  the COHERENT mail  system, and introduces
the commands and files that compose it.

The COHERENT  mail system has three major components:  the user agent (also
called the mailer); the routing  agents (the commands smail and rmail); and
the delivery agents (the commands lmail and uux).

This  structure may  seem  overly complex  (you  may ask  why  all of  this
functionality could  not be bundled into  one program); however, experience
has shown that it is best  to organize each set of functions within its own
program.  One advantage this gives you  is that you can replace one part of
the  mail system  with another,  superior  program, without  disturbing the
operation of the  system as a whole.  For example,  you may wish to replace
the mailer mail with another mailer, such as elm. Because the mailer is its
program, you  can replace mail  with elm without affecting  the delivery or
routing agents  at all.  You  may never need  to modify how  the routing or
delivery agents work, but studying the overall structure of the mail system
will help you  to decide intelligently on whether to  replace a part of the
mail system, and will also help you diagnose any problems that may crop up.

The following describes each set of agents in turn.

The User Agent

The user agent  (also called the mailer) presents to  you the messages that
have been delivered into your  mailbox.  It also collects messages from you
and hands them to the routing  agent for delivery.  This is the program you
invoke when you wish to read mail or send a mail message.

COHERENT comes with one mailer, called mail. When you invoke it without any
arguments, it  reads the contents of  file /usr/spool/mail/user (where user
is your  login identifier), breaks  its contents into  individual messages,
and presents the messages to you one by one.  (File /usr/spool/mail/user is
also  called  your  ``mailbox'', because  that  is  where  the mail  system
deposits  your messages.)  You can  read  a mail  message; then,  by giving
commands to  mail, you can reply  to the message if you  wish, then copy it
into a file for archiving or throw it away.

If you wish to send mail, type the command

    mail user

where user identifies the user to  whom you wish to send the message.  user
can either be a user on  your system, or on a remote system; if the latter,
you must also name the site on which user resides.  The syntax for naming a
remote sites is described in further detail below.  When you invoke mail to
send  a mail  message, mail  presents the prompt  Subject:, upon  which you
should type the  subject of the message.  When you  have typed the subject,
press <return>; you can then type  the body of the message.  Press <return>
when you  come to the end  of a line; the cursor jumps  to the beginning of
the next line  on your screen, and you can  continue typing.  When you have
finished typing, type  <ctrl-D> or a `.' at the  beginning of a line;
this signals  mail that you have finished entering  the message.  mail then
passes the message to the routing  agents for delivery, as described in the
next section.

If, while you are typing the  body of your message, you type the letter `?'
at the beginning of a line,  mail invokes an editor and copies your message
into  it.  The  editor it  invokes is  the set  named by  the environmental
variable EDITOR. You can then use the editor to finish typing your message.
When  you have  finished typing  your  message, exit  from the  editor; the
message will then dispatched.

When the mail dispatches your message,  it checks your home directory for a
file named .signature. This is  your signature file: the mailer appends the
contents of this  file onto the end of your  message, as your signature.  A
signature can be any mass of text that you wish; usually, it gives a user's
name and e-mail address, and sometimes includes a joke, motto, or slogan as
a form  of self-expression.  It's  generally considered bad form  to have a
signature that exceeds five lines of text, or that uses vulgar, obscene, or
abusive language.

To  mail a  file  to another  user,  use the  shell's redirection  operator
`<'.  For example, the command

    mail stephen < bug.report

mails file bug.report to user stephen.  The file will be prefixed with your
address, and suffixed with your mail ``signature'', should you have one.

For details  on how  to use  the mailer and  its commands, see  the Lexicon
entry for the command mail.

Other  mailers are  also available  for COHERENT; the  most popular  one is
named elm. This mailer uses a visual interface to display the messages that
are in your mailbox; you can  use the arrow keys on your keyboard to move a
cursor and select  the message you want.  Sources and  binaries for elm are
available on the MWC BBS and on other sites on the Internet.

Routing Agents

The routing agent, as term implies, figures out how to deliver a message to
its destination, and dispatches it appropriately.

The routing agent rmail (``route mail'') receives mail from another system.
If the mail is intended for your local system, rmail passes the mail to the
delivery agent  lmail (described below)  for delivery on  your system.  If,
however,  the mail  is  intended for  forwarding to  another system,  rmail
forwards it appropriately.  rmail does  most of its work in the background;
you will seldom if ever will need to work with it directly.

The  routing  agent  smail  (``send  mail'')  receives mail  from  you  and
dispatches to its target user, either  on your system or on another system.
smail  actually is  a large,  complex program  that handles  mail correctly
under a  great variety of conditions.  Under COHERENT,  rmail actually is a
link to smail.

When you  mail a  message to  user, smail performs  the following  steps to
route the message:

-> smail first looks up user in the file /usr/lib/mail/aliases. For details
   on aliases, see the Lexicon entry aliases.

-> If smail finds user in one  of these files, it substitutes the alias for
   user. If the alias is of the form

       sys!user

or

    sys! ... !user

or

    user@sys[.domain]

     smail treats  it as a  remote destination, and invokes  command uux to
     spool  the message  to sys.  When  uux has  delivered the  message, it
     becomes the responsibility of command uuxqt on sys to pass the message
     to user.

->   If smail finds no match  in /usr/lib/mail/aliases, it looks up user in
     the file  /etc/passwd, to see if  she is a user  on your local system.
     If smail does not find user in /etc/passwd, it throws away the message
     and mails an error message to the sender.

->   If  smail  does find  user  in  /etc/passwd, it  then  looks for  file
     .forward in user's home directory.  This file normally contains a list
     of addresses to which mail is to be forwarded.

->   If user's home directory does not contain a file named .forward, smail
     passes the  message to  lmail which writes  the message into  the file
     /usr/spool/mail/user (the user's ``mailbox'').

->   If, however, user does have file .forward in her home directory, smail
     reads it,  and forwards the  message to the address  or addresses that
     that file contains.

For further information on smail,  and on its suite of configuration files,
see the Lexicon entry for smail.

Before you  can send mail  to a remote  site, you must  have set up  a UUCP
connect to  that site,  either directly or  indirectly.  That is,  you must
have set up UUCP to send mail to that site, or to a system that can forward
the  mail to  some other  that may  have permission to  access the  site in
question.  See  the tutorial  and Lexicon articles  on UUCP for  details on
using UUCP to exchange mail and files with remote sites.

Please note  that the routing  agents are the  only components of  the mail
system that must run setuid to assume the privilege of the superuser root.

Delivery Agents

The delivery agents actually move messages to their destination.

The  delivery agent  lmail  (``local mail'')  places  messages into  users'
mailboxes.  To  discourage the forging of mail, lmail  does not use setuid.
It must be  run by a privileged user (generally  root) so that it will have
permission to  write mail into every  user's mailbox.  As a  rule, lmail is
invoked only by the routing agent;  you seldom, if ever, will work directly
with lmail.

The UUCP  uux queues commands for  execution on a remote  system.  The mail
system uses uux as a delivery agent; in fact, on most systems, the delivery
of mail  is uux's principal task.   When a message is to  be forwarded to a
remote  site,   smail  invokes  uux  to  create   two  files  in  directory
/usr/spool/uucp/site  (where site  names the  site to  which mail  is being
sent).  One file,  which has the prefix `C', contains  the rmail command to
be executed on  the remote site; the other file,  which has the prefix `D',
contains the  body of the  message that rmail  is to route.   The next time
your system  polls site (or is  polled by site), those  files are copied to
site, where they are executed by site's copy of the command uuxqt.

You can use uux directly to spool commands for execution.  For details, see
the Lexicon entries for uux and uuxqt.

uux uses setuid to assume the  identity of user uucp in order to write into
the necessary spool  directories.  Please note that it is  very easy to use
uux to forge messages to remote  systems.  Keep this in mind if you plan to
use electronic mail for any kind of authorization system.

Setting Up a Mail Feed

One of the most useful tasks a personal computer can perform for you is let
you exchange  electronic mail with users on  remote systems.  The following
describes how  you can  set up your  mail system so  you can plug  into the
Internet and begin to exchange mail with the outside world.

To  begin, the  COHERENT system  at present can  exchange mail  with remote
systems only  via UUCP.  To receive  mail, you must find a  site that has a
connection to the  Internet -- either direct or indirect  -- and is willing
to act  as a UUCP feeder  for you.  Such a  site may be a  local college or
university, or a commercial ``Internet provider.''

Once you have located such a site, set up a UUCP connection with that site,
as  described in  this  manual's tutorial  on  UUCP.  If  you  do not  have
experience in setting up a UUCP site, read this tutorial carefully, as this
can be rather tricky.

Next, edit  file /etc/domain, and set  your system's domain to  the name of
the system from which you will be receiving your feed.  For example, if you
have purchased Internet service from site acme.com, then /etc/domain should
read:

    acme.com

Finally, you  must edit file /usr/lib/mail/config to  tell smail to forward
to the  feeder system all  messages that are  bound for the  outside world.
You must change two attributes within this file:

domains
     This attribute  sets the domain name that smail  writes into each mail
     message's header.   This is required so that other  users can reply to
     your messages.  Set it to the name of your feeder system; it should be
     identical to the name you  wrote into /etc/domain. For example, if you
     are purchasing  your Internet service  from system acme.com,  then set
     the attribute domains to:

         domains=acme.com

smart_path
     Set this  to the name  of the remote site  as you have set  it in file
     /usr/lib/uucp/sys. For example, if you are purchasing Internet service
     from site acme.com,  you may have used the name  acme to name the site
     within  file /usr/lib/uucp/sys.  In this instance,  you set  the smail
     attribute smart_path as follows:

         smart_path=acme

That's all there is to  it.  smail's default configurations will handle the
rest.  Once you have the UUCP connection working properly, then any mail to
a user who is not on your local system will be forwarded to the system that
is providing your mail feed, and from there forwarded to the remote site to
which you addressed it.

For details on  setting up a UUCP feed, see  the UUCP tutorial that appears
earlier in this  manual; also see the Lexicon entries  for UUCP, sys, dial,
and port. For more information on modifying smail's configuration file, see
the Lexicon entry for config.

Mailing to Networks

The following  gives directions  on how  to send mail  to users  on popular
networks:

America Online
    Send mail to user@aol.com.
Applelink
    Send mail to user@applelink.apple.com.
ATTMail
    Send mail to user@attmail.com.
BITNET
    Send mail to user@host.bitnet or to user%host.bitnet@gateway.
Compuserve
    Send mail to number.number@compuserve.com.    Note    that   Compuserve
    addresses  are usually  given as  number,number;  you must  convert the
    comma to a period.

FidoNet
    This network  uses an unusual addressing scheme.  To  send mail to John
    Doe at 1:123/456.0, use the following domain address:

        f456.n123.z1.fidonet.org.

    The z1 comes  from the 1: at the front  of the FidoNode address.  Then,
    put the person's name in front of this, with the at-sign between them:

        john.doe@f456.n123.z1.fidonet.org

    If the host label does not end in .0, as in 1:123/456.4, use that digit
    with p prefixed to it, as follows:

        john.doe@p4.f456.n123.z1.fidonet.org

MCIMail
    Send mail to user@mcimail.com.   MCIMail usually  includes a  hyphen in
    user's name; be sure to remove it.
UUnet
    Send mail to user@host.uucp, or to user%host.uucp@gateway,     or    to
    user@domain.

These directions  assume that you have  a UUCP link to  another system that
gives you  access to the  Internet or other intelligent  network.  For more
information on  sending mail  to remote systems  via UUCP, see  the Lexicon
entry for UUCP.

Files

$HOME/.forward -- Forwarding instructions for inbound mail
$HOME/.signature -- Personal signature
$HOME/dead.letter -- Message that mail could not send
/etc/domain -- Name of your system's domain
/etc/passwd -- User identities
/etc/uucpname -- Name of your system
/tmp/mail* -- Temporary and lock files
/usr/lib/mail/aliases -- Aliases of users
/usr/lib/mail/config -- smail configuration file
/usr/lib/mail/fullnames -- Short full name aliases of users
/usr/lib/mail/paths -- Mail routing control file
/usr/lib/mail/routers -- Information on routing mail to remote sites
/usr/lib/mail/transports -- Information on mail-transportation programs
/usr/spool/mail -- Mailbox directory, filed by user name

See Also

aliases,
commands,
config,
cvmail,
.forward,
mail,
mkfnames,
msg,
nptx,
paths,
rmail,
smail,
UUCP
Krol, E.: The Whole  Internet: User's Guide &amp; Catalog. Sebastopol, Ca.:
O'Reilly & Associates, Inc., 1992.  Highly recommended.