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

sendmail

sendmailSearch this book
Previous: 14.1 Headers Chapter 14
Headers, Precedence, and Trust
Next: 14.3 Headers Learned So Far
 

14.2 Headers Versus Delivery Agent Flags

Some headers should be inserted into a mail message only if a certain delivery agent is used. For example, one traditionally should include the Full-Name: header when mail is being delivered with UUCP but should not include it for most other delivery agents.

The mechanism that governs inclusion is a list of flags that prefix the header definition in the configuration file. Those flags are composed of a series of one or more letters, all of which are surrounded with a pair of ? characters.

H

?



flags



?

name: value

When sendmail decides whether a header is to be added to the mail message, it compares the flags listed with the flags of the delivery agent's F= equate:

Mhub,   P=[IPC], S=Hubset, R=0, F=mDFMuXa, T=DNS/RFC822/SMTP, A=IPC $h                                   
-^
                                   
flags

If a given flag (letter) appears in both, the header is added to the mail message. Otherwise, it is not.

Traditionally, for example, the x flag is used to indicate the need for a Full-Name: header. But our hub delivery agent does not have an x in its F= flags. Since that is the only delivery agent we use, we need to add that flag to the client.cf file.

14.2.1 The Full-Name: Header

The Full-Name: header is used to display the full name of the sender, as taken from the gecos field of the passwd (5) file. You saw above how the hub machine tries to add the sender's full name to the From: header. But since you don't necessarily have control over the hub, you should add a Full-Name: header locally, so that the full name is displayed even if the hub fails to add it.

The way to declare the Full-Name: header is like this:

H?x?Full-Name: $?x$x$.         # Add full name if available

First prefix it with the ?x? flag. This means that the Full-Name: header is added only if the delivery agent also contains that flag.

The value given to the Full-Name: header is just like the conditional that you saw earlier. If ( $? ) the macro x contains a value, use that value ( $x ), and endif ( $. ). We use this conditional test so that the full name is added only if it is known.

Next, to make the Full-Name: effective, you need to add an x flag to the hub delivery agent declaration:

Mhub,   P=[IPC], S=Hubset, R=0, F=

x

mDFMuXa, T=DNS/RFC822/SMTP, A=IPC $h                                   
-^
                                   
add

Now any mail that uses the hub delivery agent for a recipient (in other words, all mail) will add a Full-Name: header to the message if there is not already one there. If the full name is known ( $x has a value), that name follows the Full-Name: header on the same line; otherwise, the header contains only the header name and is omitted entirely.

14.2.2 The Date: Header

The Date: header is required in all messages to show the time and day that the message originated. It is a good idea to include ? flags ? in its definition so that custom delivery agents that do not need the Date: can be designed later.

H?D?Date: $a                    # Add if F=D

The $a is the origin date of the mail message in RFC822 format. That date is set internally by sendmail to be correct for inclusion in the Date: header.

An F=D flag already exists in the hub delivery agent:

Mhub,   P=[IPC], S=Hubset, R=0, F=xm

D

FMuXa, T=DNS/RFC822/SMTP, A=IPC $h                                     
-^
                                     
add the date if missing

That D was originally put in this delivery agent definition with the Date: header in mind.

14.2.3 The Message-ID: Header

The Message-ID: header is used to uniquely identify each mail message. It must be inserted into the message when it is first created (first handled by sendmail ). The form of the Message-ID: header is very specific:

H?M?Message-Id: <$t.$i@$j>      # Add if F=M

Here, a ?M? prefix is included. The hub delivery agent definition already has the F=M flag listed:

Mhub,   P=[IPC], S=Hubset, R=0, F=xmDF

M

uXa, T=DNS/RFC822/SMTP, A=IPC $h                                       
-^
                                       
add the message identifier if missing

The field following the Message-ID: must follow particular rules. First, it must be surrounded by angle brackets. Then, what appears between the angle brackets must look like a legal address:

<
address>

The address must be composed of pieces of information that uniquely identify the mail message worldwide. We create that address in a way that is commonly used in most configuration files:

<$t.$i@$j>

$t is the current date and time represented by an integer. $i is the local unique identifier for the queue file for this message (even if the message isn't queued), and $j is your host's fully qualified domain name. Other information may be used, provided that the result looks like a legal address and provided that no two identical identifiers ever go out.


Previous: 14.1 Headers sendmail Next: 14.3 Headers Learned So Far
14.1 Headers Book Index 14.3 Headers Learned So Far