start page | rating of books | rating of authors | reviews | copyrights

sendmail

sendmailSearch this book
Previous: 6.1 The client.cf File Chapter 6
The Mail Hub and Delivery Agents
Next: 6.3 The local Delivery Agent
 

6.2 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.

Mhub

The M that begins the line defines a mail delivery agent. The hub immediately following is the symbolic name for the delivery agent. This symbolic name will be referenced by other parts of the configuration file when you write them.

P=[IPC]

The P= equate stands for Path. This says that the full pathname of the program that is used to handle the delivery is called [IPC] . ( [IPC] is a special name used internally by sendmail to represent its internal ability to communicate over TCP/IP networks. It stands for interprocessor communications). For other mail delivery agent definitions the name following the = would be the full pathname of a program, such as /bin/mail .

A=IPC $h

The A= equate stands for Argument vector (list). It is used to specify the command-line arguments that will be given to the P= program when it is run. The zeroth argument is the name of the program (here IPC without brackets). The rest of the arguments, of which there is only one here, the $h , are the actual command-line arguments. The $h is a macro that contains the recipient's hostname. We'll describe macros in the next chapter. The A= equate is traditionally the last item in a delivery agent definition.

6.2.1 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.


Previous: 6.1 The client.cf File sendmail Next: 6.3 The local Delivery Agent
6.1 The client.cf File Book Index 6.3 The local Delivery Agent