5 {pmg} ships with a highly configurable mail filter. It’s an easy but
6 powerful way to define filter rules by user, domains, time frame,
7 content type and resulting action.
9 [thumbnail="pmg-gui-mail-filter-rules.png", big=1]
11 Every rule has 5 categories ('FROM', 'TO', 'WHEN', 'WHAT' and
12 'ACTION'), and each category may contain several objects to match
17 Who is the sender or receiver of the e-mail? Those objects can be used
18 for the 'TO' and/or 'FROM' category.
21 Example: EMail-object - Who is the sender or receiver of the e-mail?
26 What is in the e-mail?
29 Example: Does the e-mail contain spam?
34 When is the e-mail received by {pmg}?
37 Example: Office Hours - Mail is received between 8:00 and 16:00.
42 Defines the final actions.
45 Example: Mark e-mail with “SPAM:” in the subject.
48 Rules are ordered by priority, so rules with higher priority are
49 executed first. It is also possible to set a processing direction:
51 'In':: Rule applies for all incoming e-mails
53 'Out':: Rule applies for all outgoing e-mails
55 'In & Out':: Rule applies for both directions
57 And you can also disable a rule completely, which is mostly useful for
58 testing and debugging. The 'Factory Defaults' button alows you to
59 reset the filter rules.
62 [[pmg_mailfilter_action]]
66 [thumbnail="pmg-gui-mail-filter-actions.png", big=1]
68 Please note that some actions stops further rule precessing. We call
74 Accept mail for Delivery. This is a 'final' action.
80 Block mail. This is a 'final' action.
86 Move to quarantine (virus mails are moved to the “virus quarantine”,
87 other mails are moved to “spam quarantine”). This is also a 'final' action.
93 Send notifications. Please note that object configuration can use
94 xref:rule_system_macros[macros], so it is easy to include additional
95 information. For example, the default 'Notify Admin' object sends the
96 following information:
98 .Sample notification action body:
100 Proxmox Notification:
102 Receiver: __RECEIVERS__
105 Matching Rule: __RULE__
113 Notification can also include a copy of the original mail.
116 Blind Carbon Copy (BCC)
117 ~~~~~~~~~~~~~~~~~~~~~~~
119 The BCC object simply sends a copy to another target. It is possible to
120 send the original unmodified mail, or the processed result. Please
121 note that this can be quite different, i.e. when a previous rule
128 This object is able to add or modify mail header attributes. As notice above, you can use xref:rule_system_macros[macros], making this a very powerful object. For example, the 'Modify Spam Level' actions adds detailed infomation about detected Spam characteristics to the ` X-SPAM-LEVEL` header.
130 .'Modify Spam Level' Header Attribute
136 Another prominent example is the 'Modify Spam Subject' action. This
137 simply adds the 'SPAM:' prefix to the original mail subject:
139 .'Modify Spam Subject' Header Attribute
142 Value: SPAM: __SUBJECT__
149 Remove attachments can either remove all attachments, or only those
150 matched by the rules 'What' - object. You can also specify the
151 replacement text if you want.
153 You can optionally move those mails into the attachment quarantine, where
154 the original mail with all attachments will be stored. The mail with the
155 attachments removed will continue in the rule system.
157 NOTE: The Attachment Quarantine Lifetime is the same as for the Spam Quarantine.
166 [[pmg_mailfilter_who]]
170 [thumbnail="pmg-gui-mail-filter-who-objects.png", big=1]
172 This type of objects can be used for the 'TO' and/or 'FROM' category,
173 and macth the sender or receiver of the e-mail. A single object can
174 combine multiple items, and the following item types are available:
178 Allows you to match a single mail address.
182 Only match the domain part of the mail address.
186 This one uses a regular expression to match the whole mail address.
188 IP Address or Network::
190 This can be used to match the senders IP address.
194 Test if the mail address belong to a specific LDAP user or group.
196 We have two important 'Who' - objects called 'Blacklist' and
197 'Whitelist'. Those are used in the default ruleset to globally block
198 or allow specific senders.
201 [[pmg_mailfilter_what]]
205 [thumbnail="pmg-gui-mail-filter-what-objects.png", big=1]
207 'What' - objects are used to classify the mail content. A single
208 object can combine multiple items, and the following item types are
213 Matches if configured value if greater than the detected spam level.
217 Matches on infected mails.
221 Match specified mail header fields (eg. `Subject:`, `From:`, ...)
223 Content Type Filter::
225 Can be used to match specific content types.
229 Uses regular expressions to match attachment filenames.
233 Can be used to match specific content types inside archives.
236 [[pmg_mailfilter_when]]
240 [thumbnail="pmg-gui-mail-filter-when-objects.png", big=1]
242 'When' - objects are use to activate rules at specific daytimes. You
243 can compose them of one or more time-frame items.
245 The default ruleset defines 'Office Hours', but this is not used by
249 [[pmg_mailfilter_regex]]
250 Using regular expressions
251 -------------------------
253 A regular expression is a string of characters which tells us which
254 string you are looking for. The following is a short introduction in
255 the syntax of regular expressions used by some objects. If you are
256 familiar with Perl, you already know the syntax.
258 Simple regular expressions
259 ~~~~~~~~~~~~~~~~~~~~~~~~~~
261 In its simplest form, a regular expression is just a word or phrase to
262 search for. `Mail` would match the string "Mail". The search is case
263 sensitive so "MAIL", "Mail", "mail" would not be matched.
268 Some characters have a special meaning. These characters are called
269 metacharacters. The Period (`.`) is a commonly used metacharacter. It
270 matches exactly one character, regardless of what the character is.
271 `e.mail` would match either "e-mail" or "e-mail" or "e2mail" but not
274 The question mark (`?`) indicates that the character immediately
275 preceding it either zero or one time. `e?mail` would match
276 either "email" or "mail" but not "e-mail".
278 Another metacharacter is the star (`*`). This indicates that the
279 character immediately to its left may repeated any number of times,
280 including zero. `e*mail` would match either "email" or "mail" or
283 The plus (`+`) metacharacter does the same as the star (*) excluding
284 zero. So `e+mail` does not match "mail".
286 Metacharacters may be combined. A common combination includes the
287 period and star metacharacters (`.*`), with the star immediately following
288 the period. This is used to match an arbitrary string of any length,
289 including the null string. For example: `.*company.*` matches
290 "company@domain.com" or "company@domain.co.uk" or
291 "department.company@domain.com".
293 The book xref:Friedl97[] provides a more comprehensive introduction.