Define a Mail Delivery Agent

Other than forwarding mail messages over a TCP/IP network, sendmail does not handle mail delivery itself. Instead, it runs other programs that perform delivery (see Figure 6.2). The programs it runs are called delivery agents. Information about which agent performs which kind of delivery is defined in the sendmail.cf file.

Figure 6.2: The nature of the recipient determines the delivery agent

Figure 6.2

The first item to put in your client.cf file is a definition of the program (delivery agent) that forwards mail to the hub machine. That definition provides sendmail with the information it needs to deliver mail using that delivery agent. Initially, sendmail needs to include only the name and location of that program. Therefore, in its preliminary form, the definition for the mail delivery program looks like this:

# This is a comment V7 # this is another comment # Delivery agent definition to forward mail to hub <-new Mhub, P=[IPC], A=IPC $h <-new

This is a minimal (and still useless) configuration file. Go ahead and add these new lines to client.cf. The second line is a configuration command that defines a delivery agent. It contains three parts, each separated from the others by commas: a symbolic name and two equates.

Testing the client.cf File

Run sendmail with this command line:

% /usr/lib/sendmail -oQ/tmp -Cclient.cf -bp

Note that you need to include -oQ/tmp in the command line to prevent sendmail from trying to change to the mqueue directory (which probably doesn't exist under the current directory). If you leave out the -oQ/tmp switch, sendmail exits with this confusing error:

cannot chdir((null)): Bad file number

The -Cclient.cf switch tells sendmail to use the file client.cf in the current directory as its configuration file, rather than the system /etc/sendmail.cf file. The -bp switch tells sendmail to print the contents of the queue. The above command line should produce output like the following:

No local mailer defined

The lack of a local mailer is not important yet. [4] The sendmail program prints it and stops but otherwise found no errors in our client.cf file.

[4] A local delivery agent is not required in rule-testing mode (-bt) but is required for all other modes.