16.4 About the Sendmail SMTP Server

16.4.1 About Sendmail Configuration Files

Sendmail is highly configurable and is the most commonly used MTA on the Internet. Sendmail is mainly used to transfer email between systems, but it is capable of controlling almost every aspect of how email is handled.

Sendmail is distributed in the following packages:

procmail

Contains Procmail, which acts as the default local MDA for Sendmail. This package is installed as a dependency of the sendmail package.

sendmail

Contains the Sendmail MTA.

sendmail-cf

Contains configuration files for Sendmail.

To install the Sendmail packages, enter:

# yum install sendmail sendmail-cf

For more information, see the sendmail(8) manual page.

16.4.1 About Sendmail Configuration Files

The main configuration file for Sendmail is /etc/mail/sendmail.cf, which is not intended to be manually edited. Instead, make any configuration changes in the /etc/mail/sendmail.mc file.

If you want Sendmail to relay email from other systems, change the following line in sendmail.mc:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

so that it reads:

dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

The leading dnl stands for delete to new line, and effectively comments out the line.

After you have edited sendmail.mc, restart the sendmail service to regenerate sendmail.cf:

# service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]

Alternatively, you can use the make script in /etc/mail:

# /etc/mail/make all

However, Sendmail does not use the regenerated configuration file until you restart the server.

Other important Sendmail configuration files in /etc/mail include:

access

Configures a relay host that processes outbound mail from the local host to other systems. This is the default configuration:

Connect: localhost.localdomain      RELAY
Connect: localhost                  RELAY
Connect: 127.0.0.1                  RELAY

To configure Sendmail to relay mail from other systems on a local network, add an entry such as the following:

Connect: 192.168.2                    RELAY
mailertable

Configures forwarding of email from one domain to another. The following example forwards email sent to the yourorg.org domain to the SMTP server for the mydom.com domain:

yourorg.org        smtp:[mydom.com] 
virtusertable

Configures serving of email to multiple domains. Each line starts with a destination address followed by the address to which Sendmail forwards the email. For example, the following entry forwards email addressed to any user at yourorg.org to the same user name at mydom.com:

@yourorg.org           %1@mydom.com

Each of these configuration files has a corresponding database (.db) file in /etc/mail that Sendmail reads. After making any changes to any of the configuration files, restart the sendmail service. To regenerate the database files, run the /etc/mail/make all command. As for sendmail.cf, Sendmail does not use the regenerated database files until you restart the server.