There is a special set of expansion variables containing the header lines of the message being processed. These variables have names beginning with $header_ followed by the name of the header line, terminated by a colon. For example,
$header_from: $header_subject:
The whole item, including the terminating colon, is replaced by the contents of the message header line. If there is more than one header line with the same name, their contents are concatenated. For header lines whose data consists of a list of addresses (for example, From: and To:), a comma and newline is inserted between each set of data. For all other header lines, just a newline is used.
Leading and trailing white space is removed from header line data. If you do not want this to happen, you can specify $rheader_ instead of $header_. This inserts the ``raw'' header line, unmodified.
The text that is contained in the header variables is the character string that is actually present in the header line. If the header line is encoded using RFC 2047 because it contains non-ASCII characters, the character string is not the same as the decoded value that an MUA would present. It is possible that this may change in a future release. If you want to inspect the raw data, you should use $rheader_.
The capitalization of the name following $header_ is not significant. Because any printing character except colon may appear in the name of a message's header (this is a requirement of RFC 2822, the document that describes the format of a mail message) curly brackets must not be used in this case, as they will be taken as part of the header name. Two shortcuts are allowed in naming header variables:
The initiating $header_ can be abbreviated to $h_.
The terminating colon can be omitted if the next character is white space. The white space character is retained in the expanded string. However, this is not recommended, because it makes it easy to forget the colon when it really is needed.
If the message does not contain a header of the given name, an empty string is substituted. Thus it is important to spell the names of headers correctly. Do not use $header_Reply_to when you really mean $header_Reply-to.