In this section we'll look at how we can configure sendmail to enable it to be used for mail delivery on our system. This has traditionally been a very awkward task to perform. The main reason for this concerns the configuration file itself, /etc/mail/sendmail.cf—it contains everything required to get the mail system functioning, but is notoriously difficult to set up.
Originally, there was only one way to create the correct sendmail.cf. This was by copying an existing (functioning) or template file, working through it, and editing it as required. Two template files (main.cf and subsidiary.cf) were, and still are, included to help with this should you still want to follow that procedure—you'll find them in /etc/mail. When the operating system is installed, the /etc/mail/sendmail.cf file is actually a copy of the subsidiary.cf template. The choice of which template file to use depends on the required operating mode of the machine. Table 20.3 shows the different modes along with the name of the correct file that the working sendmail.cf should be based on.
From this table we can see that if we are setting up a mail client or mail server, we don't have to make any changes to the system to get it working. The only machine we would need to configure would be the mail host.
Thankfully, starting from Version 8 of sendmail, this manual method has been replaced by a mechanism based on a program named m4. This is a macroprocessor that has long been associated with C and other programming languages. In fact, because of this association, it's also located in the same directory as the programming-type tools—/usr/ccs/bin. This directory isn't defined in the normal profile by default, but for our examples here, we'll assume we have updated the path to suit.
In this chapter, we'll concentrate on this newer method of configuration. So let's move on and see how it works.
Operating Mode | Explanation | Configuration File |
---|---|---|
Mail Host | The main mail machine on the network | main.cf |
Mail Server | A system that stores mail in its mailbox directory, /var/mail | subsidiary.cf |
Mail Client | A machine that uses the mail capabilities (including the mailbox area) of the mail server | subsidiary.cf |
Mail Gateway | A machine that handles connections between different networks or protocols | main.cf |