+# - match: direct matching against the query fields
+# Parameters:
+# - match_all: boolean
+# if true, the filter won't match until all conditions
+# are verified. If false, the filter match on the first
+# verified condition.
+# - condition: field_name OP (value)
+# * the field_name is one of the field name of the query
+# emitted by postfix. This list with description of each
+# field is available at:
+# http://www.postfix.org/SMTPD_POLICY_README.html
+# postlicyd also support fields sender_domain and recipient_domain
+# * OP is an operator. Available operators are:
+# == field_name is strictly equal to value
+# =i field_name is case insensitively equal to value
+# != field_name is not equal to value
+# !i field_name is not case insensitively equal to value
+# >= field_name contains value
+# >i field_name contains case insensitively value
+# <= field_name is contained by value
+# <i field_name is contained case insensitively by value
+# #= field_name is empty or not set
+# #i field_name is not empty
+# Return value:
+# - if the conditions are verified (according to match_all strategy), return match
+# - if the conditions are not verified, return fail
+
+# match one of the condition: "stress mode activated", "client_name contains debian.org" or
+# "recipient is empty"
+match {
+ type = match;
+
+ # configuration
+ match_all = false;
+ condition = stress == yes;
+ condition = client_name >= debian.org;
+ condition = recipient #=;
+
+ # hook
+ on_match = postfix:OK;
+ on_fail = counter:0:1:greylist;
+}
+
+
+# - counter: trig actions depending on the value of a counter
+# Parameters:
+# - counter: the id of the counter to trig on (0 -> 63)
+# - hard_threshold: minimum counter value to trig the hard_match hook
+# - soft_threshold: minimum counter value to trig the soft_match hook
+# Return value:
+# - hard_match if the counter with the given id is greater or equal to hard_threshold
+# - soft_match if the counter value is between soft_threshold and hard_threshold
+# - fail if the counter value is below soft_match
+
+# match if the counter 0 value is greater than 8, or between 5 and 7
+counter {
+ type = counter;
+
+ # configuration
+ counter = 0;
+ hard_threshold = 8;
+ soft_threshold = 5;
+
+ # hook
+ on_hard_match = postfix:REJECT ${sender_domain};
+ on_soft_match = greylist;
+ on_fail = counter:1:10:match;
+}
+