Полезная информация

sendmail

sendmailSearch this book
Previous: 5.1 OverviewChapter 5
The sendmail.cf File
Next: 5.3 A Quick Tour
 

5.2 The Minimal File

The smallest possible configuration file contains absolutely nothing. Create an empty configuration file by copying /dev/null to it:

% cp /dev/null client.cf

This is the configuration file that we will continue to develop throughout this tutorial. We call it client.cf to avoid the possibility of overwriting the system sendmail.cf file.

Now run sendmail to test the validity of this new file:

% ./sendmail -Cclient.cf -bt < /dev/null
%

The -C command line switch tells sendmail to use your (empty) configuration file in place of the system configuration file. The -bt switch tells sendmail to run in rule-testing mode (which we will use frequently in the chapters to follow). Notice that sendmail reads your empty configuration file, runs, and exits without complaint. Also notice that you can now begin to run the version of sendmail that you compiled in Chapter 2, Have a V8. You couldn't run it before because you lacked a configuration file, but now you have one (although it contains nothing useful).

5.2.1 Version

To prevent older versions of sendmail from breaking when reading new style sendmail.cf files, a V (for version) command was introduced beginning with V8.1. The form for the version command looks like this:

V7

Edit the client.cf file and add this single line. The V must begin the line. The version number that follows must be 7 to enable all the new features of V8.8 sendmail.cf. The number 7 indicates that the syntax of the sendmail.cf file has undergone seven major changes over the years, the seventh being the current and most recent. The meaning of each version is detailed in Section 27.5, "The V Configuration Command".

5.2.2 Comments

Comments can help other people to understand your configuration file. They can also remind you about something you might have done months ago. They slow down sendmail by only the tiniest amount, so don't be afraid to use them. As was mentioned earlier, when the # character begins a line in the sendmail.cf file, that entire line is treated as a comment and ignored. For example, the entire following line is ignored by the sendmail program:

# This is a comment

Besides beginning a line, comments can also follow commands. [2] That is,

[2] Before V8 sendmail, comments could follow only three commands: S (rule set), P (priority), and R (rewriting rule).

V7                   # this is another comment

Add some comments to your client.cf file. It should look something like this:

# This is a comment
V7        # this is another comment

The sendmail program will still read this file without complaint:

% ./sendmail -Cclient.cf -bt < /dev/null
%


Previous: 5.1 OverviewsendmailNext: 5.3 A Quick Tour
5.1 OverviewBook Index5.3 A Quick Tour