68
81
the initial message headers is treated as body con-
71
Note: message headers are examined one logical header at a
72
time, even when a message header spans multiple lines.
73
Body lines are always examined one line at a time.
84
<b>FILTERS AFTER RECEIVING MAIL</b>
85
Postfix supports a subset of the built-in content inspec-
86
tion classes after the message is received:
88
<b><a href="postconf.5.html#milter_header_checks">milter_header_checks</a></b> (default: empty)
89
These are applied to headers that are added with
92
This feature is available in Postfix 2.7 and later.
94
<b>FILTERS WHILE DELIVERING MAIL</b>
95
Postfix supports all four content inspection classes while
96
delivering mail via SMTP.
98
<b><a href="postconf.5.html#smtp_header_checks">smtp_header_checks</a></b> (default: empty)
100
<b><a href="postconf.5.html#smtp_mime_header_checks">smtp_mime_header_checks</a></b> (default: empty)
102
<b><a href="postconf.5.html#smtp_nested_header_checks">smtp_nested_header_checks</a></b> (default: empty)
104
<b><a href="postconf.5.html#smtp_body_checks">smtp_body_checks</a></b> (default: empty)
105
These features are available in Postfix 2.5 and
75
108
<b>COMPATIBILITY</b>
76
109
With Postfix version 2.2 and earlier specify "<b>postmap -fq</b>"
77
110
to query a table that contains case sensitive patterns. By
78
default, <a href="regexp_table.5.html">regexp</a>: and <a href="pcre_table.5.html">pcre</a>: patterns are case insensitive.
111
default, <a href="regexp_table.5.html">regexp</a>: and <a href="pcre_table.5.html">pcre</a>: patterns are case insensitive.
80
113
<b>TABLE FORMAT</b>
81
This document assumes that header and <a href="postconf.5.html#body_checks">body_checks</a> rules
82
are specified in the form of Postfix regular expression
83
lookup tables. Usually the best performance is obtained
114
This document assumes that header and <a href="postconf.5.html#body_checks">body_checks</a> rules
115
are specified in the form of Postfix regular expression
116
lookup tables. Usually the best performance is obtained
84
117
with <b>pcre</b> (Perl Compatible Regular Expression) tables, but
85
the slower <b>regexp</b> (POSIX regular expressions) support is
86
more widely available. Use the command "<b>postconf -m</b>" to
87
find out what lookup table types your Postfix system sup-
118
the slower <b>regexp</b> (POSIX regular expressions) support is
119
more widely available. Use the command "<b>postconf -m</b>" to
120
find out what lookup table types your Postfix system sup-
90
123
The general format of Postfix regular expression tables is
91
given below. For a discussion of specific pattern or
92
flags syntax, see <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a> or <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a>,
124
given below. For a discussion of specific pattern or
125
flags syntax, see <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a> or <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a>,
95
128
<b>/</b><i>pattern</i><b>/</b><i>flags action</i>
96
When /<i>pattern</i>/ matches the input string, execute
97
the corresponding <i>action</i>. See below for a list of
129
When /<i>pattern</i>/ matches the input string, execute
130
the corresponding <i>action</i>. See below for a list of
100
133
<b>!/</b><i>pattern</i><b>/</b><i>flags action</i>
101
When /<i>pattern</i>/ does <b>not</b> match the input string,
134
When /<i>pattern</i>/ does <b>not</b> match the input string,
102
135
execute the corresponding <i>action</i>.
104
137
<b>if /</b><i>pattern</i><b>/</b><i>flags</i>
106
139
<b>endif</b> Match the input string against the patterns between
107
<b>if</b> and <b>endif</b>, if and only if the same input string
140
<b>if</b> and <b>endif</b>, if and only if the same input string
108
141
also matches /<i>pattern</i>/. The <b>if</b>..<b>endif</b> can nest.
110
Note: do not prepend whitespace to patterns inside
143
Note: do not prepend whitespace to patterns inside
111
144
<b>if</b>..<b>endif</b>.
113
146
<b>if !/</b><i>pattern</i><b>/</b><i>flags</i>
115
148
<b>endif</b> Match the input string against the patterns between
116
<b>if</b> and <b>endif</b>, if and only if the same input string
149
<b>if</b> and <b>endif</b>, if and only if the same input string
117
150
does <b>not</b> match /<i>pattern</i>/. The <b>if</b>..<b>endif</b> can nest.
119
152
blank lines and comments
120
Empty lines and whitespace-only lines are ignored,
121
as are lines whose first non-whitespace character
153
Empty lines and whitespace-only lines are ignored,
154
as are lines whose first non-whitespace character
125
A pattern/action line starts with non-whitespace
126
text. A line that starts with whitespace continues
158
A pattern/action line starts with non-whitespace
159
text. A line that starts with whitespace continues
129
162
<b>TABLE SEARCH ORDER</b>
130
For each line of message input, the patterns are applied
131
in the order as specified in the table. When a pattern is
132
found that matches the input line, the corresponding
133
action is executed and then the next input line is
163
For each line of message input, the patterns are applied
164
in the order as specified in the table. When a pattern is
165
found that matches the input line, the corresponding
166
action is executed and then the next input line is
136
169
<b>TEXT SUBSTITUTION</b>
137
Substitution of substrings from the matched expression
138
into the <i>action</i> string is possible using the conventional
139
Perl syntax (<b>$1</b>, <b>$2</b>, etc.). The macros in the result
140
string may need to be written as <b>${n}</b> or <b>$(n)</b> if they
170
Substitution of substrings from the matched expression
171
into the <i>action</i> string is possible using the conventional
172
Perl syntax (<b>$1</b>, <b>$2</b>, etc.). The macros in the result
173
string may need to be written as <b>${n}</b> or <b>$(n)</b> if they
141
174
aren't followed by whitespace.
143
Note: since negated patterns (those preceded by <b>!</b>) return
176
Note: since negated patterns (those preceded by <b>!</b>) return
144
177
a result when the expression does not match, substitutions
145
178
are not available for negated patterns.
205
241
This feature is available in Postfix 2.0 and later.
243
This feature is not supported with smtp header/body
207
246
<b>HOLD</b> <i>optional text...</i>
208
Arrange for the message to be placed on the <b>hold</b>
209
queue, and inspect the next input line. The mes-
210
sage remains on <b>hold</b> until someone either deletes
211
it or releases it for delivery. Log the optional
247
Arrange for the message to be placed on the <b>hold</b>
248
queue, and inspect the next input line. The mes-
249
sage remains on <b>hold</b> until someone either deletes
250
it or releases it for delivery. Log the optional
212
251
text if specified, otherwise log a generic message.
214
Mail that is placed on hold can be examined with
215
the <a href="postcat.1.html"><b>postcat</b>(1)</a> command, and can be destroyed or
253
Mail that is placed on hold can be examined with
254
the <a href="postcat.1.html"><b>postcat</b>(1)</a> command, and can be destroyed or
216
255
released with the <a href="postsuper.1.html"><b>postsuper</b>(1)</a> command.
218
Note: use "<b>postsuper -r</b>" to release mail that was
219
kept on hold for a significant fraction of <b>$<a href="postconf.5.html#maximal_queue_lifetime">maxi</a>-</b>
257
Note: use "<b>postsuper -r</b>" to release mail that was
258
kept on hold for a significant fraction of <b>$<a href="postconf.5.html#maximal_queue_lifetime">maxi</a>-</b>
220
259
<b><a href="postconf.5.html#maximal_queue_lifetime">mal_queue_lifetime</a></b> or <b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>, or
221
longer. Use "<b>postsuper -H</b>" only for mail that will
260
longer. Use "<b>postsuper -H</b>" only for mail that will
222
261
not expire within a few delivery attempts.
224
Note: this action affects all recipients of the
263
Note: this action affects all recipients of the
227
266
This feature is available in Postfix 2.0 and later.
268
This feature is not supported with smtp header/body
229
271
<b>IGNORE</b> Delete the current line from the input, and inspect
230
272
the next input line.
274
<b>INFO</b> <i>optional text...</i>
275
Log an "info:" record with the <i>optional text...</i> (or
276
log a generic text), and inspect the next input
277
line. This action is useful for routine logging or
280
This feature is available in Postfix 2.8 and later.
232
282
<b>PREPEND</b> <i>text...</i>
233
283
Prepend one line with the specified text, and
234
284
inspect the next input line.
255
305
This feature is available in Postfix 2.1 and later.
307
This feature is not supported with mil-
257
310
<b>REDIRECT</b> <i>user@domain</i>
258
Write a message redirection request to the queue
259
file, and inspect the next input line. After the
311
Write a message redirection request to the queue
312
file, and inspect the next input line. After the
260
313
message is queued, it will be sent to the specified
261
314
address instead of the intended recipient(s).
263
Note: this action overrides the <b>FILTER</b> action, and
264
affects all recipients of the message. If multiple
265
<b>REDIRECT</b> actions fire, only the last one is exe-
316
Note: this action overrides the <b>FILTER</b> action, and
317
affects all recipients of the message. If multiple
318
<b>REDIRECT</b> actions fire, only the last one is exe-
268
321
This feature is available in Postfix 2.1 and later.
323
This feature is not supported with smtp header/body
270
326
<b>REPLACE</b> <i>text...</i>
271
327
Replace the current line with the specified text,
272
328
and inspect the next input line.