JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Managing sendmail Services in Oracle Solaris 11.1     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Mail Services (Overview)

2.  Mail Services (Tasks)

Task Map for Mail Services

Planning Your Mail System

Local Mail Only

Local Mail and a Remote Connection

Setting Up Mail Services (Task Map)

Setting Up Mail Services

How to Set Up a Mail Server

How to Set Up a Mail Client

How to Set Up a Mail Host

How to Set Up a Mail Gateway

How to Use DNS With sendmail

Changing the sendmail Configuration (Task Map)

Changing the sendmail Configuration

How to Build a New sendmail.cf File

Setting Up a Virtual Host

How to Automatically Rebuild a Configuration File

How to Use sendmail in the Open Mode

How to Set SMTP to Use TLS

How to Manage Mail Delivery by Using an Alternate Configuration of sendmail.cf

Administering Mail Alias Files (Task Map)

Administering Mail Alias Files

How to Set Up an NIS mail.aliases Map

How to Set Up a Local Mail Alias File

How to Create a Keyed Map File

Managing the postmaster Alias

How to Create a postmaster Alias in Each Local /etc/mail/aliases File

How to Create a Separate Mailbox for postmaster

How to Add the postmaster Mailbox to the Aliases in the /etc/mail/aliases File

Administering the Queue Directories (Task Map)

Administering the Queue Directories

How to Display the Contents of the Mail Queue, /var/spool/mqueue

How to Force Mail Queue Processing in the Mail Queue, /var/spool/mqueue

How to Run a Subset of the Mail Queue, /var/spool/mqueue

How to Move the Mail Queue, /var/spool/mqueue

How to Run the Old Mail Queue, /var/spool/omqueue

Administering .forward Files (Task Map)

Administering .forward Files

How to Disable .forward Files

How to Change the .forward-File Search Path

How to Create and Populate /etc/shells

Troubleshooting Procedures and Tips for Mail Services (Task Map)

Troubleshooting Procedures and Tips for Mail Services

How to Test the Mail Configuration

How to Check Mail Aliases

How to Test the sendmail Rule Sets

How to Verify Connections to Other Systems

Logging Error Messages

Other Sources for Mail Diagnostic Information

Resolving Error Messages

3.  Mail Services (Reference)

Index

Setting Up Mail Services

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

Mail requires two types of configurations for local mail. Refer to Figure 2-1 in Local Mail Only for a representation of these configurations. Mail requires two more configurations for communication with networks outside your domain. Refer to Figure 1-1 in Overview of the Hardware Components or Figure 2-2 in Local Mail and a Remote Connection for a representation of these configurations. You can combine these configurations on the same system or provide these configurations on separate systems. For example, if your mail host and mail server functions are on the same system, follow the directions in this section for setting up that system as a mail host. Then, follow the directions in this section 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, which eliminates the need for the following procedures.


How to Set Up a Mail Server

No special steps are required to set up a mail server that is only serving mail for local users. The user must have an entry in the password file or in the namespace. Also, for mail to be delivered, the user should have a local home directory for checking the ~/.forward file. For this reason, home directory servers are often set up as the mail server. Hardware Components in Chapter 3, Mail Services (Reference) provides more information about the mail server.

The mail server can route mail for many mail clients. This type of mail server must have adequate spooling space for client mailboxes.


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.

For clients to access their mailboxes, the /var/mail directory should be available for remote mounting. Alternately, a service such as Post Office Protocol (POP) or Internet Message Access Protocol (IMAP) should be available from the server. The following task shows you how to set up a mail server by using the /var/mail directory. To provide configuration guidelines for POP or IMAP is beyond the scope of this document.


For the following task, ensure that the /etc/dfs/dfstab file shows that the /var/mail directory is exported.

  1. Become an administrator.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Stop sendmail.
    # svcadm disable -t network/smtp:sendmail
  3. Check if the /var/mail directory is available for remote access.
    # share

    If the /var/mail directory is listed, proceed to step 5.

    If the /var/mail directory is not listed or if no list appears, continue with the appropriate substep.

    1. (Optional) If no list appears, start NFS services.

      Follow the procedure, How to Set Up Automatic File-System Sharing in Managing Network File Systems in Oracle Solaris 11.1, to use the /var/mail directory to start NFS services.

    2. (Optional) If the /var/mail directory is not included in the list, add the directory to /etc/dfs/dfstab.

      Add the following command line to the /etc/dfs/dfstab file.

      share -F nfs -o rw /var/mail
  4. Make the file system available for mounting.
    # shareall
  5. Ensure that your name service has been started.
    1. (Optional) If you are running NIS, use this command.
      # ypwhich

      For more information, refer to the ypwhich(1) man page.

    2. (Optional) If you are running DNS, use this command.
      # nslookup hostname
      hostname

      Use your host name.

      For more information, refer to the nslookup(1M) man page.

    3. (Optional) If you are running LDAP, use this command.
      # ldaplist

      For more information, refer to the ldaplist(1) man page.

  6. Restart sendmail.
    # svcadm enable network/smtp:sendmail

How to Set Up a Mail Client

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


Note - You can also perform the task of setting up a mail client by using a service such as Post Office Protocol (POP) or Internet Message Access Protocol (IMAP). However, to provide configuration guidelines for POP or IMAP is beyond the scope of this document.


  1. Become an administrator on the mail client's system.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Stop sendmail.
    # svcadm disable -t network/smtp:sendmail
  3. Ensure that a /var/mail mount point exists on the mail client's system.

    The mount point should have been created during the installation process. You can use ls to ensure that the file system exists. The following example shows the response that you receive if the file system has not been created.

    # ls -l /var/mail
    /var/mail not found
  4. Ensure that no files are in the /var/mail directory.

    If mail files do exist in this directory, you should move them so that they are not covered when the /var/mail directory is mounted from the server.

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

    You can mount the mail directory automatically or at boot time.

    1. (Optional) Mount /var/mail automatically.

      Add an entry such as the following to the /etc/auto_direct file.

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

      Use the assigned server name.

    2. (Optional) Mount /var/mail at boot time.

      Add the following entry to the /etc/vfstab file. This entry permits the /var/mail directory on the mail server that is specified to mount the local /var/mail directory.

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

      The client's mailbox is automatically mounted whenever the system is rebooted. If you are not rebooting the system, type the following command to mount the client mailbox.

      # mountall

      Caution

      Caution - For mailbox locking and mailbox access to work properly, you must include the actimeo=0 option when mounting mail from an NFS server.


  6. Update /etc/hosts.

    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.

    # cat /etc/hosts
    #
    # Internet host table
    #
    ..
    IP-address     mailhost  mailhost  mailhost.example.com
    IP-address

    Use the assigned IP addresses.

    example.com

    Use the assigned domain.

    mailhost

    Use the assigned mailhost.

    For more information, refer to the hosts(4) man page.

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

    Refer to Administering Mail Alias Files (Task Map) for a task map about administering mail alias files. Note that 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.

  8. Restart sendmail.
    # svcadm enable network/smtp:sendmail

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 an administrator on the mail host system.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Stop sendmail.
    # svcadm disable -t network/smtp:sendmail
  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/sbin/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, 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.13.1+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, edit the /etc/hosts file on each system in the network.

      Create the following entry.

      IP-address mailhost mailhost mailhost.domain loghost
  5. Restart sendmail.
    # svcadm enable network/smtp:sendmail
  6. Test your mail configuration.

    See How to Test the Mail Configuration for instructions.


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


How to Set Up a Mail Gateway

A mail gateway manages communication with networks outside 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 that is attached to Ethernet and phone lines. Another good candidate is a system that is configured as a router to the Internet. You can configure the mail host or another system as the mail gateway. You might choose to configure more than one mail gateway for your domain. If you have UNIX-to-UNIX Copy Program (UUCP) connections, you should configure the system (or systems) with UUCP connections as the mail gateway.

  1. Become an administrator on the mail gateway system.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Stop sendmail.
    # svcadm disable -t network/smtp:sendmail
  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/sbin/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. If you need help with this step, refer to Step 4 of How to Set Up a Mail Host.

  4. Ensure that your name service has been started.
    1. (Optional) If you are running NIS, use this command.
      # ypwhich

      For more information, refer to the ypwhich(1) man page.

    2. (Optional) If you are running DNS, use this command.
      # nslookup hostname
      hostname

      Use your host name.

      For more information, refer to the nslookup(1M) man page.

    3. (Optional) If you are running LDAP, use this command.
      # ldaplist

      For more information, refer to the ldaplist(1) man page.

  5. Restart sendmail.
    # svcadm enable network/smtp:sendmail
  6. Test your mail configuration.

    See How to Test the Mail Configuration for instructions.


    Note - For more information about the mail gateway, refer to Hardware Components in Chapter 3, Mail Services (Reference).


How to Use DNS With sendmail

The DNS name service does not support aliases for individuals. This name service does support aliases for hosts or domains that use Mail Exchanger (MX) records and CNAME records. You can specify host names, domain names, or both names in the DNS database. For more information about sendmail and DNS, see Interactions of sendmail With Name Services in Chapter 3, Mail Services (Reference), or see the Oracle Solaris Administration: Naming and Directory Services.

  1. Become an administrator.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Check for a mailhost and mailhost.domain entry.

    Use nslookup to ensure that an entry exists for mailhost and mailhost.domain in the DNS database. For more information, refer to the nslookup(1M) man page.