Go to the first, previous, next, last section, table of contents.


Format of filter files

Apart from leading white space, the first text in a filter file must be

# Exim filter

This is what distinguishes it from a conventional `.forward' file. If the file does not have this initial line it is treated as a conventional `.forward' file, both when delivering mail and when using the `-bf' testing mechanism. The white space in the line is optional, and any capitalization may be used. Further text on the same line is treated as a comment. For example, you could have

#   Exim filter   <<== do not edit or remove this line!

The remainder of the file is a sequence of filtering commands, which consist of keywords and data values, separated by white space or line breaks, except in the case of conditions for the "if" command, where round brackets (parentheses) also act as separators. For example, in the command

deliver gulliver@lilliput.fict.book

the keyword is "deliver" and the data value is "gulliver@lilliput.fict.book". The commands are in free format, and there are no special terminators. If the character # follows a separator, then everything from # up to the next newline is ignored. This provides a way of including comments in a filter file.

There are two ways in a data value can be input:

In addition to the escape character processing that occurs when strings are enclosed in quotes, most data values are also subject to string expansion (as described in the next section), in which case the characters `$' and `\' are also significant. This means that if a single backslash is actually required in such a string, and the string is also quoted, \\\\ has to be entered.


Go to the first, previous, next, last section, table of contents.