General-Purpose Mail Filter
A literal is any sequence of characters enclosed in single or double quotes.
reject actions two special kinds of
literals are recognized: three-digit numeric values represent
RFC 2821 reply codes, and literals consisting of tree digit
groups separated by dots represent an extended reply code as per
RFC 1893/2034. For example:
510 # A reply code 5.7.1 # An extended reply code
String literals enclosed in double quotation marks (double-quoted strings) are subject to backslash interpretation, macro expansion, variable interpretation and back reference interpretation.
Backslash interpretation is performed at compilation time. It consists in replacing the following escape sequences with the corresponding single characters:
|\a||Audible bell character (ASCII 7)|
|\b||Backspace character (ASCII 8)|
|\f||Form-feed character (ASCII 12)|
|\n||Newline character (ASCII 10)|
|\r||Carriage return character (ASCII 13)|
|\t||Horizontal tabulation character (ASCII 9)|
|\v||Vertical tabulation character (ASCII 11)|
In addition, the sequence ‘\newline’ has the same effect as ‘\n’, for example:
"a string with\ embedded newline" "a string with\n embedded newline"
Any escape sequence of the form ‘\xhh’, where h denotes any hex digit is replaced with the character whose ASCII value is hh. For example:
"\x61nother" ⇒ "another"
Similarly, an escape sequence of the form ‘\0ooo’, where o is an octal digit, is replaced with the character whose ASCII value is ooo.
Macro expansion and variable interpretation occur at run-time. During
these phases all Sendmail macros (see Sendmail Macros),
mailfromd variables (see Variables), and constants
(see Constants) referenced in the string are replaced by their
actual values. For example, if the Sendmail macro
f has the
value ‘firstname.lastname@example.org’ and the variable
has the value ‘127.0.0.1’, then the
"$f last connected from %last_ip;"
will be expanded to
"email@example.com last connected from 127.0.0.1;"
A back reference is a sequence ‘\d’, where d
is a decimal number. It refers to the dth parenthesized
subexpression in the last
matches statement11. Any back reference occurring within a
double-quoted string is replaced by the value of the corresponding
subexpression. See Special comparisons, for a detailed
description of this process. Back reference interpretation is
performed at run time.
Any characters enclosed in single quotation marks are read unmodified.
The following examples contain pairs of equivalent strings:
"a string" 'a string' "\\(.*\\):" '\(.*\):'
Notice the last example. Single quotes are particularly useful in writing regular expressions (see Special comparisons).
Implementation note: actually, the references are not interpreted within the string, instead, each such string is split at compilation time into a series of concatenated atoms. Thus, our sample string will actually be compiled as:
$f . " last connected from " . last_ip . ";"
CONCAT: CONCAT: CONCAT: SYMBOL: f CONSTANT: " last connected from " VARIABLE last_ip (13) CONSTANT: ";"
The subexpressions are numbered by the positions of their opening parentheses, left to right.
This document was generated on January 3, 2019 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.