Exim Filter Specification section 8

Previous Next Contents (Exim Filter Specification)

## 8. Header variables

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, 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.

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`.

Previous Next Contents (Exim Filter Specification)