Table of Contents
Sendmail is the default Mail Transfer Agent (MTA) that Slackware Linux uses. sendmail was originally written by Eric Allman, who still maintains sendmail. The primary role of the sendmail MTA is delivering messages, either locally or remotely. Delivery is usually done through the SMTP protocol. The means that sendmail can accept e-mail from remote sites through the SMTP port, and that sendmail delivers site destined for remote sites to other SMTP servers.
Sendmail is available as the sendmail package in the “n” disk set. If you want to generate your own sendmail configuration files, the sendmail-cf package is also required. For information about how to install packages on Slackware Linux, refer to Chapter 17, Package Management.
You can let Slackware Linux start sendmail during each boot by
making the /etc/rc.d/rc.sendmail
# chmod a+x /etc/rc.d/rc.sendmail
You can also start, stop and restart sendmail by using start, stop, and restart as a parameter to the sendmail initialization script. For example, you can restart sendmail in the following way:
# /etc/rc.d/rc.sendmail restart
The most central sendmail configuration file is
/etc/mail/sendmail.cf/etc/mail/sendmail.cf.mc
Some definitions can easily be changed in the
/etc/mail/sendmail.cf.mc
In this section we will look how you can start off with an
initial mc file, and how to compile your own .cf file to a
cf file. There are many interesting example mc files available
in /usr/share/sendmail/cf/cfsendmail-slackware.mcsendmail.cfsendmail-slackware-tls.mc
# cd /usr/share/sendmail/cf/cf # cp sendmail-slackware.mc sendmail-straw.mc
and start editing sendmail-straw.mc
# m4 sendmail-straw.mc > sendmail-straw.cf
If we want to use this new configuration file as the default
configuration, we can copy it to
/etc/mail/sendmail.cf
# cp sendmail-straw.cf /etc/mail/sendmail.cf
If you would like to use another host to deliver e-mail to locations to which the sendmail server you are configuring can not deliver you can set up sendmail to use a so-called “smart host”. Sendmail will send the undeliverable e-mail to the smart host, which is in turn supposed to handle the e-mail. You do this by defining SMART_HOST in your mc file. For example, if you want to use smtp2.example.org as the smart host, you can add the following line:
define(`SMART_HOST',`stmp2.example.org')
By default sendmail will accept mail destined for localhost, and the current hostname of the system. You can simply add additional hosts or domains to accept e-mail for. The first step is to make sure that the following line is added to your mc configuration:
FEATURE(`use_cw_file')dnl
When this option is enabled you can add host names and domain
names to accept mail for to
/etc/mail/local-host-names
example.org
mail.example.org
www.example.org
Often you may want to map e-mail addresses to user names. This is needed when the user name differs from the part before the “@” part of an e-mail address. To enable this functionality, make sure the following line is added to your mc file:
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
The mappings will now be read from
/etc/mail/virtusertable.db/etc/mail/virtusertable/etc/mail/virtusertable.db
The /etc/mail/virtusertable
john.doe@example.org john
john.doe@mail.example.org john
In this example both e-mail for john.doe@example.org and john.doe@mail.example.org will be delivered to the john account. It is also possible to deliver some e-mail destined for a domain that is hosted on the server to another e-mail address, by specifying the e-mail address to deliver the e-mail to in the second in the second column. For example:
john.doe@example.org john.doe@example.com
After making the necessary changes to the
virtusertable
# makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable