The Format of Headers Section

Mail headers are those lines found at the beginning of a mail message that provide administrative information about the mail message, such as when and from where it was sent. The Format of Headers section defines the headers that sendmail inserts into mail. The header definitions from the Red Hat file are shown in Listing 5.4.

Listing 5.4: Header Commands

$.$?{auth_type}(authenticated$?{auth_ssf} (${auth_ssf} bits)$.) $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}

(using ${tls_version} with cipher ${cipher} (${cipher_bits} bits) verified ${verify})$.$?u for $u; $|; $.$b

H?F?Resent-From: $?x$x <$g>$|$g$. H?F?From: $?x$x <$g>$|$g$. H?x?Full-Name: $x

H?M?Resent-Message-Id: <[email protected]$j> H?M?Message-Id: <[email protected]$j>

Each header line begins with the H command, which is optionally followed by header flags enclosed in question marks. The header flags control whether or not the header is inserted into mail that is bound for a specific mailer. If no flags are specified, the header is used for all mailers. If a flag is specified, the header is used only for a mailer that has the same flag set in the mailer's definition. (Mailer definitions are covered later in this chapter.) Header flags only control header insertion. If a header is received in the input, it is passed to the output, regardless of the flag settings.

Each line also contains a header name, a colon, and a header template. These fields define the structure of the actual header. Macros in the header template are expanded before the header is inserted into a message. Look at the first header in the sample. $g says to use the value stored in the g macro, which holds the sender's e-mail address. Assume the sender is David. After the macro expansion, the header might contain

Return-Path: <[email protected]>

Note The second header shows examples of long macro names, such as {auth_ type}. The sample headers provide examples of a conditional syntax that can be used in header templates and macro definitions. It is an if/else construct where $? is the "if," $| is the "else," and $. is the "endif." A simple example from Listing 5.4 is

The header template $?x$x <$g>$|$g$ says that if ($?) macro x exists, use $x <$g> as the header template, else ($|) use $g as the template. Macro x contains the full name of the sender. Thus if it exists, the header is

Resent-From: David Craig <[email protected]>

If x doesn't exist, the header is

Resent-From: [email protected]

The headers provided in your system's file should be correct and sufficient for your installation. Header formats are defined in RFC standards documents. There is no need to create customized headers.

Was this article helpful?

0 0

Post a comment