Header Behavior in conf.c
The sendmail program has a built-in understanding of many header names. How those names are used is determined by a set of flags in the source file conf.c supplied with the source distribution. Site policy determines which flags are applied to which headers, but, in general, conf.c applies them in the way that is best suited for almost all Internet sites. If you desire to redefine the flags for a particular header name, look for the name's declaration in the C language structure definition HdrInfo
in conf.c. Be sure to read the comments in that file. Changes to header flags represent a permanent site policy change and should not be undertaken lightly. (We illustrate this process after explaining the flags.)
The flags that determine header use are listed in Table 35.2. Note that each flag name is prefixed with an H_
. Also note that the hexadecimal values are displayed by the -d31.6
debugging switch (see -d31.6).
Flag | Hex | Version | Description | |
---|---|---|---|---|
H_EOH | "H_EOH" | and up | Terminates all headers | |
H_RCPT | "H_RCPT" | and up | Contains a recipient address | |
H_DEFAULT | "H_DEFAULT" | and up | If already in headers, don't insert | |
H_RESENT | "H_RESENT" | and up | Is a Resent- header
| |
H_CHECK | "H_CHECK" | and up | Process ? flags ?
| |
H_ACHECK | "H_ACHECK" | and up | Ditto, but always, not just default | |
H_FORCE | "H_FORCE" | and up | Insert header (allows duplicates) | |
H_TRACE | "H_TRACE" | and up | Count these to get the hop count | |
H_FROM | "H_FROM" | and up | Contains a sender address | |
H_VALID | "H_VALID" | and up | Has a validated field value | |
H_ERRSTO | "H_ERRSTO" | and up | An errors-to: header
| |
H_CTE | "H_CTE" | and up | Is "constant transfer encoding" | |
H_CTYPE | "H_CTYPE" | and up | Is "content type" | |
H_BCC | "H_BCC" | and up | Strip value from header | |
H_ENCODABLE | "H_ENCODABLE" | and up | Field can be RFC1522 encoded |
Note that there is no flag that always causes a particular header to be removed, nor is there a flag that always causes a particular header to be replaced (although you can trick sendmail with H_ACHECK see "Replacing Headers with H_ACHECK").
H_EOH
Headers that are marked with the H_EOH flag cause sendmail to immediately stop all header processing and treat the rest of the header lines as message body. This is useful for separating RFC822-compliant header lines from headers created by a noncompliant network.
H_RCPT
Headers that are marked with the H_RCPT flag are assumed to contain valid recipient addresses in their fields. Only headers with this flag can lead to message delivery. These addresses will be rewritten. These headers are used to determine the recipient address only if the -t
command-line switch (see -t) is used.
H_DEFAULT
The sendmail program automatically sets the H_DEFAULT flag for all headers declared in the configuration file. This flag tells sendmail to macro expand the header just before it is used. Only one of each header that is marked with this flag is allowed to exist in the headers portion of a mail message. If such a header already exists, sendmail does not add another. The H_FORCE and H_TRACE flags override this flag in that regard. This flag must never be specified in conf.c - it is set automatically by H
configuration command (see "The H Configuration Command").
H_RESENT
The H_RESENT flag tells sendmail that the header line is prefixed with the resent-
string. Only headers that are marked with this flag can tell sendmail that this is a "forwarded" message. If no "forwarded" headers are found, sendmail strips any bogus resent-
header lines from the message's header.
H_CHECK
If a header definition in the configuration file begins with a ?
flags
?
conditional, this flag is set for that header. It tells sendmail to insert this header only if one of its ?
flags
?
corresponds to one of the delivery agent's F=
flags (see "?flags? in Header Definitions"). This flag must never be specified in conf.c - it is set automatically when sendmail reads H
lines with ?
flags
?
header flags.
H_ACHECK
The H_ACHECK flag marks a header that should normally be discarded unless a delivery agent's F=
flag calls for its inclusion. It is usually set for the Bcc:
header, which is discarded for the privacy of a blind carbon copy list, and the Full-Name:
header, which is intended as a way for a user to add a full name (see the $x
macro, ) when there is no full name defined in the passwd(5) file. Note that H_ACHECK, when combined with bogus ?
flags
?
of a header configuration file declaration can cause appropriate headers to always be deleted or replaced (see ). Also note that under V8 sendmail the H_ACHECK flag alone always causes a header to be replaced.
H_FORCE
The H_FORCE flag causes sendmail to always insert a header. It is used in the conf.c file with selected trace headers. It can be thought of as allowing duplicates. That is, the header will be inserted even if one like it is already present.
H_TRACE
Headers that are marked with the H_TRACE flag are counted in determining a mail message's "hop" count. This flag is intended for use in the conf.c file.
H_FROM
Headers that are marked with the H_FROM flag are assumed to contain a valid sender address. This flag is intended for use in the conf.c file.
H_VALID
The H_VALID flag is set and cleared internally by sendmail to indicate to itself that a particular header line has been correctly processed and can now be used as is. This flag should never be used in the conf.c file.
H_ERRSTO
The H_ERRSTO flag specifies which headers can be used for returning error notification mail. Those headers take priority over all others for that notification if the UseErrorsTo
(l
) option is true (see UseErrorsTo (l)).
H_CTE
The H_CTE flag specifies that a header is the MIME RFC1521 content transfer encoding header (see Content-Transfer-Encoding:).
H_CTYPE
The H_CTYPE flag specifies that a header is a MIME RFC1521 content-type header (see Content-Type:).
H_BCC
The H_BCC flag indicates that a header is either a Bcc:
(see Bcc:) or a Resent-Bcc:
header. The disposition of those headers is covered under the NoRecipient-Action
option (see NoRecipientAction).
H_ENCODABLE
The H_ENCODABLE flag tells sendmail that the field part may be encoded in the way described in RFC1522. As of V8.8, this flag is unsupported in code.
Replacing Headers with H_ACHECK
Some MUAs tend to insert their own Message-ID:
header (see Message-ID:). This can cause difficulty tracing email problems, because those MUA headers lack the sendmail queue identifier. One solution is possible at sites that have a central mail hub machine. At such a site, all the client machines use a simple configuration file that forwards all mail to the hub for processing.
To delete the bogus Message-ID:
, so that a good one will be generated on the hub, you can redefine Message-ID:
in conf.c:
"message-id", 0, "message-id", H_ACHECK,change to this
Here, we changed the flag for the Message-ID:
header into a H_ACHECK flag. We do this only on the client machine versions of sendmail but not on the hub. The Message-ID:
header will then be stripped from every outgoing message on every client machine and created (if missing) on the hub.