previous next contents

Sendmail Configuration


Sendmail stores the vast majority of its configuration information in a single file, sendmail.cf, which is usually localted in the /etc directory. The location of this file is set when sendmail is compiled, and from version 8.7 onwards, placing sendmail.cf anywhere other than /etc may cause problems with system upgrades. Sendmail reads this file every time it is started. When first encountered, the sendmail.cf file can seem somewhat cryptic; Nick Petreley of Infoworld had the following to say about it:-

Sendmail is, shall we say, unique. Some people say that a monkey would bang out the complete works of Shakespeare on a typewriter given an unlimited amount of time. In the meantime, what they would probably produce is a valid sendmail configuration file.

Few people understand the inner workings of sendmail, and even fewer know how to hand-customize sendmail configuration files (those that do are generally heavily medicated and only allow visitors once a month).

The sendmail.cf file is line orientated, with one configuration command to each line. A sendmail.cf will include at least the following types of configuration commands:-



m4

Most system administrators begin to feel faint at the idea of sitting down and writing a working sendmail.cf file from scratch, and fortunately, an easier way has been provided. The sendmail.cf file provides a huge degree of control and flexibility, but most administrators want their mail systems to do more or less the same things, and do not need the full level of control offered by the sendmail.cf file.

This is where m4 comes in. The m4 program is a macro preprocessor, and in the context of sendmail, it can be used to generate a sendmail.cf file from a macro configuration (mc) file. The sendmail distribution comes with a large number of m4 include files, each of which define different aspects of sendmails behaviour. This means that a simple mc file can be written, detailing which features should be placed into the sendmail.cf file, and then this can be fed into m4, which will then output a working sendmail.cf file.

The mc file should contain system specific definitions, features of sendmail that the user wishes to enable, and mail delivery agents to be defined.

If a correct mc file is written, it should not be necessary to do any hand editing of sendmail.cf at all - m4 will generate a working sendmail.cf for you, which will need no further alteration. It is considerably easier to maintain a small mc file, and it is well worth taking the time to make sure that the m4 output works without any changes.


previous next contents