11.3. Mail Transport Agents
188.8.131.52. Purpose and Limitations
184.108.40.206. The Default Sendmail Installation
/etc/mail/sendmail.cf. Avoid editing the
sendmail.cffile directly. Instead, to make configuration changes to Sendmail, edit the
/etc/mail/sendmail.mcfile, back up the original
/etc/mail/sendmail.cf, and then use the included
m4macro processor to create a new
/etc/mail/sendmail.cf. More information on configuring Sendmail can be found in Section 220.127.116.11, “Common Sendmail Configuration Changes”.
access— Specifies which systems can use Sendmail for outbound email.
domaintable— Specifies domain name mapping.
local-host-names— Specifies aliases for the host.
mailertable— Specifies instructions that override routing for particular domains.
virtusertable— Specifies a domain-specific form of aliasing, allowing multiple virtual domains to be hosted on one machine.
/etc/mail/, such as
virtusertable, must actually store their information in database files before Sendmail can use any configuration changes. To include any changes made to these configurations in their database files, run the command
makemap hash /etc/mail/<name> < /etc/mail/<name>
example.comdomain delivered to firstname.lastname@example.org, add the following line to the
virtusertable.dbfile must be updated using the following command as root:
makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable
virtusertable.dbfile containing the new configuration.
18.104.22.168. Common Sendmail Configuration Changes
sendmail.cffile, it is a good idea to create a backup copy.
/etc/mail/sendmail.mcfile as the root user. When finished, use the
m4macro processor to generate a new
sendmail.cfby executing the following command:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
m4macro processor is installed with Sendmail but is part of the
/etc/mail/sendmail.cffile, restart Sendmail for the changes to take effect. The easiest way to do this is to type the following command:
/sbin/service sendmail restart
sendmail.cffile does not allow Sendmail to accept network connections from any host other than the local computer. To configure Sendmail as a server for other clients, edit the
/etc/mail/sendmail.mcfile, and either change the address specified in the
Addr=option of the
127.0.0.1to the IP address of an active network device or comment out the
DAEMON_OPTIONSdirective all together by placing
dnlat the beginning of the line. When finished, regenerate
/etc/mail/sendmail.cfby executing the following command:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
/etc/mail/sendmail.mcfile must be reconfigured and a new
/etc/mail/sendmail.cfmust be generated.
/usr/share/sendmail-cf/READMEfile before editing any files in the directories under the
/usr/share/sendmail-cfdirectory, as they can affect the future configuration of
mail.example.comthat handles all of their email and assigns a consistent return address to all outgoing mail.
FEATURE(always_add_domain)dnl FEATURE(`masquerade_entire_domain') FEATURE(`masquerade_envelope') FEATURE(`allmasquerade') MASQUERADE_AS(`bigcorp.com.') MASQUERADE_DOMAIN(`bigcorp.com.') MASQUERADE_AS(bigcorp.com)
m4, this configuration makes all mail from inside the network appear as if it were sent from
22.214.171.124. Stopping Spam
x.edu) to accept messages from one party (
y.com) and sent them to a different party (
z.net). Now, however, Sendmail must be configured to permit any domain to relay mail through the server. To configure relay domains, edit the
/etc/mail/relay-domainsfile and restart Sendmail.
/etc/mail/accessfile can be used to prevent connections from unwanted hosts. The following example illustrates how this file can be used to both block and specifically allow access to the Sendmail server:
badspammer.com ERROR:550 "Go away and do not spam us anymore" tux.badspammer.com OK 10.0 RELAY
badspammer.comis blocked with a 550 RFC-821 compliant error code, with a message sent back to the spammer. Email sent from the
tux.badspammer.comsub-domain, is accepted. The last line shows that any email sent from the 10.0.*.* network can be relayed through the mail server.
/etc/mail/access.dbis a database, use
makemapto activate any changes. Do this using the following command as root:
makemap hash /etc/mail/access < /etc/mail/access
/usr/share/sendmail-cf/READMEfor more information and examples.
126.96.36.199. Using Sendmail with LDAP
virtusertables, on different mail servers that work together to support a medium- to enterprise-level organization. In short, LDAP abstracts the mail routing level from Sendmail and its separate configuration files to a powerful LDAP cluster that can be leveraged by many different applications.
/etc/mail/sendmail.mcto include the following:
/usr/share/sendmail-cf/READMEfor detailed LDAP routing configuration instructions and examples.
/etc/mail/sendmail.cffile by running
m4and restarting Sendmail. Refer to Section 188.8.131.52, “Common Sendmail Configuration Changes” for instructions.