Mail Administration Guide

Setting Up Mail Services

You can set up a mail service relatively easily if your site does not provide connections to electronic mail (email) services outside your company or if your company is in a single domain.

Chapter 3, Customizing sendmail Configuration Files, contains information about how to create more complicated configuration files.

Mail requires two types of configurations for local mail and two more for communication with networks outside of your domain. You can combine these configurations on the same system or provide them on separate systems. You need to set up systems on your site to perform the functions described in Table 2-1.

Table 2-1 Mail Configurations

Configuration 

Description 

Mail client

Mail clients are users who have mailboxes on a mail server. 

Mail server

The mail server stores mailboxes in the /var/mail directory.

Mail host

You need at least one mail host. The mail host resolves difficult email addresses and reroutes mail within your domain. 

Mail gateway

A mail gateway is a connection between different networks outside your domain or between differing communications networks. You must add rules to the sendmail.cf file to set up a gateway. See Chapter 3, Customizing sendmail Configuration Files, for information about adding rules. If you have to set up a mail gateway, you should find a gateway configuration file that is close to what you need and modify it to fit your situation.

Before you begin to set up your mail service, choose the systems to act as mail servers, mail hosts, and mail gateways. You should also make a list of all the mail clients for which you will be providing service and include the location of their mailboxes. This list will help you when you are ready to create mail aliases for your users. See Chapter 1, Understanding Mail Services, for more information about the function each of these systems provides. For your convenience, guidelines about which systems are good candidates for mail server, mail host, and mail gateways are repeated in the following sections.

To simplify the setup instructions, this chapter tells you what you need to do to set up individual mail servers, mail hosts, mail clients, and relay hosts. If a system in your mail services configuration is acting in more than one capacity, follow the appropriate instructions for each type of system. For example, if your mail host and mail server functions are on the same system, follow the directions for setting up that system as a mail host and then follow the directions for setting up the same system as a mail server.


Note -

The following procedures for setting up a mail server and mail client apply when mailboxes are NFS-mounted. However, mailboxes typically are maintained in locally mounted /var/mail directories--in which case the following procedures are not needed.


Setting Up Mail Security

By default, security permissions on a /var/mail directory allow read, write, and execute access to the owner, members of groups to which the owner belongs, and all others. On Solaris 2.x mail servers, you can make a /var/mail directory more secure by changing its default permissions to allow only read and write access to anyone outside the owner's groups, as long no SunOS 4.1.x mail clients are connected. For more information about changing directory permissions, see the System Administration Guide.

How to Set Up a Mail Server

There are no special steps required to set up a mail server that is only serving the mail for local users. The user must have an entry in the password file or in the name space, and the user should have a local home directory (so that ~/.forward can be checked) for mail to be delivered. This is why home directory servers are often set up as the mail server.

The mail server may route all mail for many mail clients. The only resource requirement for this type of mail server is that it have adequate spooling space for client mailboxes. The /var/mail directory must be made available for remote mounting.

For this task, check the /etc/dfs/dfstab file to be sure the /var directory is exported.

  1. Type share and press Return.

    If the /var directory is shared, you do not need to do more. If the /var directory is not exported, continue with the next step.

  2. Type share -F nfs /var/mail and press Return.

  3. To permanently share the file system, edit /etc/dfs/dfstab and add the command line used in step 2.


Note -

The mail.local program automatically creates mailboxes in the /var/mail directory the first time a message is delivered. You do not need to create individual mailboxes for your mail clients.


How to Set Up a Mail Client

A mail client is a user of mail services, with a mailbox on a mail server, and a mail alias in the /etc/mail/aliases file that points to the location of the mailbox.

  1. Become root on the mail client's system.

  2. Make sure that there is a /var/mail mount point on the mail client's system.

  3. Mount the /var/mail directory from the mail server.

    The mail directory may be automatically mounted or mounted at boot time.

    1. To mount /var/mail automatically, edit /etc/auto_direct and add an entry like this one:


      /var/mail -rw,hard,actimeo=0 server:/var/mail
    2. To mount /var/mail at boot time, edit the /etc/vfstab file and add an entry for the /var/mail directory on the mail server, mounting it on the local /var/mail directory.


      server:/var/mail - /var/mail nfs - no rw,hard,actimeo=0

      The client's mailbox will be automatically mounted any time the system is rebooted. Type mountall to mount the client mailbox until the system is rebooted.


      Caution - Caution -

      You must include the actimeo=0 option when mounting mail from an NFS server to allow mailbox locking and access to work properly.


  4. Use the Administration Tool to edit the /etc/hosts file and add an entry for the mail server.

    This step is not required if you are using a name service.

  5. Add an entry for the client to one of the alias files.

    See "Creating Mail Aliases" for information about how to create mail aliases for different kinds of mail configurations.


    Note -

    The mail.local program automatically creates mailboxes in the /var/mail directory the first time a message is delivered. You do not need to create individual mailboxes for your mail clients.


How to Set Up a Mail Host

A mail host resolves email addresses and reroutes mail within your domain. A good candidate for a mail host is a system that connects your systems to the outside world or to a parent domain.

  1. Become root on the mail host system.

  2. Use the Administration Tool to edit the /etc/hosts file.

    Add the word mailhost after the IP address and system name of the mail host system. The system is designated as a mail host.

  3. Create an entry for the new mail host in one of the hosts files.

    If you are using NIS or NIS+, add an entry including a host alias called mailhost to the host entry for the new mail host.

    If you are not using NIS or NIS+, you must create an entry in /etc/hosts for each system on the network. The entry should use this format: IP address mailhost_name mailhost

  4. Type cp /etc/mail/main.cf /etc/mail/sendmail.cf and press Return.

    This copies and renames the /etc/mail/main.cf file.

  5. Reboot the mail host and test your mail configuration.

    See "Testing the Mail Configuration" for information.

How to Set Up a Mail Gateway

A mail gateway manages communication with networks outside of your domain. The mailer on the sending mail gateway can match the mailer on the receiving system.

A good candidate for a mail gateway is a system attached to Ethernet and phone lines or a system configured as a router to the Internet. You might want to configure the mail host or another system as mail gateway. You might choose to configure more than one mail gateway for your domain. If you have UUCP connections, you should configure the system (or systems) with UUCP connections as the mail gateway.

  1. Become root on the mail gateway.

  2. Type cp /etc/mail/main.cf /etc/mail/sendmail.cf and press Return.

    This command copies and renames the main.cf file.

  3. Edit the /etc/mail/sendmail.cf file and make the following changes:

    1. Only if your relay mailer is not UUCP, change the default entry DMsmartuucp to the entry that is appropriate for your relay mailer.

      Available mailers are smartuucp (the default), ddn, ether, and uucp. If your relay mailer is UUCP, you do not need to change this entry.

      You can specify a different relay mailer for each mail gateway (if appropriate). You can define rule sets for other relay mailers in the main.cf file. See "Mailers" for a description of each of the default relay mailers.

    2. In the entry DR ddn-gateway, replace ddn-gateway with the name of your mail relay.

      The DR entry defines the mail relay.

    3. In the entry CR ddn-gateway, replace ddn-gateway with the name of your mail relay.

      The CR entry defines the class of the mail relay. You can designate one or more hosts as a member of this class.

    4. (Optional) Add a Dmmaildomain or Lmmaildomain entry to define the mail domain name to be used for mail delivery.

      The m macro defines the mail domain name. If the macro is not defined, the naming service domain name is used with the first component stripped off. For example, ecd.east.acme.com becomes east.acme.com. If you use the L command, sendmail looks up the name to use in the sendmailvars table, using maildomain as the search key.

    5. Save the edits.

  4. Reboot the mail gateway and test your mail configuration.

    See "Testing the Mail Configuration" for information.