RFC1891 specifies that the keyword ENVID
can be given to the MAIL FROM: command:
MAIL From:<address> ENVID=envelopeID
ENVID is used to propagate a consistent envelope identifier (distinct
from the Message-ID: header; see Message-ID:) that will be permanently associated with the
message. The envelopeID can contain any ASCII
characters between ! and ~,
except + and =. Any characters
outside that range must be encoded by prefixing an uppercase,
two-digit, hexadecimal representation of it with a plus. For example,
an envelopeID composed of the letter
X followed by a delete character would be encoded
like this:
X+7F
When mail is received over an SMTP channel and an ENVID identifier is
specified, that identifier is saved as part of the envelope
information. The value of the ENVID identifier is saved in and
restored from the qf file's
Z line (Z line). For bounced
mail, the ENVID identifier is printed with the
Original-Envelope-Id: DSN header (see RFC1894) as
part of the DSN MIME body. Beginning with V8.8
sendmail, an ENVID identifier can also be
assigned to a message with the -V command-line
switch (-V).
The ${envid} macro is set only during delivery. By
contrast, the ${dsn_envid} macro (${dsn_envid}) is set when mail is received via SMTP and
when the -V command-line switch (-V) is used to set the envelope identifier.
When mail is delivered, the value of the envelope's
ENVID identifier is saved in the ${envid} macro.
That macro is available for use with delivery agents that understand
DSN.
${envid} is transient. If it is defined in the
configuration file or in the command line, that definition can be
ignored by sendmail. Note that a
$& prefix is necessary when you reference this
macro in rules (that is, use $&{envid}, not
${envid}).