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 provides your network with a remote connection or connects your network 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 phoenix.example.com

    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 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

      IP_address

      Use the assigned IP address. 

      mailhost

      Use the system name of the mail host system. 

      domain

      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
       Compiled with: LDAPMAP MAP_REGEX LOG MATCHGECOS MIME7TO8 MIME8TO7
                      NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS
                      NISPLUS QUEUE SCANF SMTP USERDB XDEBUG
      
      ============ SYSTEM IDENTITY (after readcf) ============
            (short domain name) $w = phoenix
        (canonical domain name) $j = phoenix.example.com
               (subdomain name) $m = example.com
                    (node name) $k = phoenix
      ========================================================

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


      # cat /etc/hosts
      #
      # Internet host table
      #
      172.31.255.255   localhost        
      192.168.255.255  phoenix mailhost mailhost.example.com loghost
    2. (Optional) If you are not using NIS or NIS+, edit the /etc/hosts file on each system in the network. 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/main.cf file.


    # cp /etc/mail/main.cf /etc/mail/sendmail.cf
    
  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).