System Administration Guide: Resource Management and Network Services

Building the sendmail.cf Configuration File (Task)

How to Build a New sendmail.cf File shows you how to build the configuration file. Although you can still use older versions of sendmail.cf files, the best practice is to use the new format.

For more details, you should read from the following resources.

The following sections in Chapter 27, What's New With Mail Services (Reference) identify new m4 configuration features.

How to Build a New sendmail.cf File

The following procedure shows you how to build a new configuration file.


Note –

/usr/lib/mail/cf/main-v7sun.mc is now /usr/lib/mail/cf/main.mc.


  1. Become superuser 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. Make a copy of the configuration files that you are changing.


    # cd /usr/lib/mail/cf
    # cp main.mc myhost.mc
    

    myhost

    Select a new name for your .mc file.

  4. Edit the new configuration files (for example, myhost.mc), as necessary.

    For example, add the following command line to enable domain masquerading.


    # cat myhost.mc
    ..
    MASQUERADE_AS(`host.domain')

    host.domain

    Use the desired host name and domain name. 

    In this example, MASQUERADE_AS causes sent mail to be labeled as originating from host.domain, rather than $j.

  5. Build the configuration file by using m4.


    # /usr/ccs/bin/make myhost.cf
    
  6. Test the new configuration file by using the -C option to specify the new file.


    # /usr/lib/sendmail -C myhost.cf -v testaddr </dev/null
    

    While this command displays messages, it sends a message to testaddr. Only outgoing mail can be tested without restarting the sendmail service on the system. For systems that are not handling mail yet, use the full testing procedure in How to Test the Mail Configuration.

  7. Install the new configuration file after making a copy of the original.


    # cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.save
    # cp myhost.cf /etc/mail/sendmail.cf
    
  8. Restart the sendmail service.


    # /etc/init.d/sendmail start