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
:
# systemctl restart sendmail
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 themydom.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 atmydom.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.