Previous Table of Contents Next

H (Define Header)

The format of the header lines is defined by the H line. The syntax of this line is

H[c ?c mflagsc ?]c hnamec :c htemplate

Continuation lines in this specification are inserted directly into the outgoing message. The htemplate is macro-expanded before it is inserted into the message. If the expansion is empty, the header line is not included. If the mflags (surrounded by question marks) are specified, at least one of the specified flags must be stated in the mailer definition for this header to be automatically output. If one of these headers is in the input, it is directed to the output regardless of these flags.

Special Header Lines

Several header lines have special interpretations defined by the configuration file. Others have interpretations built into sendmail that cannot be changed without changing the code. The built-in features are described in the following list:

  Return-Receipt-To: If this header is sent, a message will be sent to any specified names when the final delivery is complete. The mailer must have the l flag (local delivery) set in the mailer descriptor.
  Errors-To: If errors occur anywhere during processing, this header sends error messages to the listed names rather than to the sender. Use this header line for mailing lists so that errors are returned to the list administrator.
  To: If a message comes in with no recipients listed in the message (in a To:, CC:, or BCC: line), sendmail adds an Apparently To: header line for each recipient specified on the sendmail command line.

S and R (Rewriting Rules)

Address parsing is performed using the rewriting rules, which are a simple pattern-matching system. Scanning through the set of rewriting rules, sendmail looks for a match on the left-hand side (LHS) of the rule. When a rule matches, the name is replaced by the right-hand side (RHS) of the rule.

There are several sets of rewriting rules. Some of the rewriting sets are used internally and must have specific semantics. Other rewriting sets do not have specifically assigned semantics and may be referenced by the mailer definitions or by other rewriting sets. For example,


sets the current ruleset being collected to n. If you begin a ruleset more than once, it deletes the old definition.

R is used to define a rule in the ruleset. The syntax of the R line is

Rlhs     rhs     comments

An example of how a rule definition might look follows:

# handle "from:<>" special case
R<>       $@@       turn into magic token

The fields must be separated by at least one Tab character; you may use embedded spaces in the fields. The lhs is a pattern that is applied to the input. If it matches, the input is rewritten to the rhs. The comments are ignored.

M (Define Mailer)

Programs and interfaces to mailers are defined on this line. The format is

Mname,P=,F=,S=,R=,A=,and so on
{c field =c value}*

in which name is the name of the mailer (used in error messages) and the field=value pairs define attributes of the mailer. The fields are shown in Table 4-5. (Only the first character of the field name is checked.)

Table 4-5 Mailer Definition Fields

Field Description
P[ath] The pathname of the mailer
F[lags] Special flags for this mailer
S[ender] A rewriting set for sender names
R[ecipient] A rewriting ruleset for recipient names
A[rgv] An argument vector to pass to this mailer
E[ol] The end-of-line string for this mailer
M[axsize] The maximum message length to this mailer
L[ength] The maximum length of the argument vector (argv) for this mailer

Previous Table of Contents Next