System Administration Guide: Resource Management and Network Services

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 network to the outside world or to a parent domain. The following procedure shows you how to set up a mail host.

  1. Become superuser on the mail host system or assume an equivalent role.

    For information about roles, refer to “Using Privileged Applications” in System Administration Guide: Security Services.

  2. Stop sendmail.

    # /etc/init.d/sendmail stop
  3. Verify the host-name configuration.

    Run the check-hostname script to verify that sendmail can identify the fully qualified host name for this server.

    % /usr/lib/mail/sh/check-hostname
    hostname phoenix OK: fully qualified as

    If this script is not successful in identifying the fully qualified host name, you need to add the fully qualified host name as the first alias for the host in /etc/hosts.

  4. Update the /etc/hosts file.

    Choose the step that is appropriate for you.

    1. (Optional) If you are using NIS or NIS+, edit the /etc/hosts file on the system that is assigned to be the new mail host.

      Add the word mailhost and mailhost.domain after the IP address and system name of the mail host system.

      IP_address mailhost mailhost mailhost.domain loghost


      Use the assigned IP address. 


      Use the system name of the mail host system. 


      Use the expanded domain name. 

      The system is now designated as a mail host. The domain should be identical to the string that is given as the subdomain name in the output of the following command.

      % /usr/lib/sendmail -bt -d0 </dev/null
      Version 8.12.0+Sun
                      QUEUE SCANF SMTP USERDB XDEBUG
      ============ SYSTEM IDENTITY (after readcf) ============
            (short domain name) $w = phoenix
        (canonical domain name) $j =
               (subdomain name) $m =
                    (node name) $k = phoenix

      See the following example of how the hosts file should look after these changes.

      # cat /etc/hosts
      # Internet host table
      #   localhost       phoenix mailhost loghost
    2. (Optional) If you are not using NIS or NIS+, edit the /etc/hosts file on each system in the network and create the following entry.

      IP_address mailhost mailhost mailhost.domain loghost
  5. Select the correct configuration file to copy and rename.

    The following command copies and renames the /etc/mail/ file.

    # cp /etc/mail/ /etc/mail/
  6. Restart sendmail.

    # /etc/init.d/sendmail start
  7. Test your mail configuration.

    See How to Test the Mail Configuration for instructions.

For further information about mail hosts, refer to Hardware Components in Chapter 26, Mail Services (Reference).