KB03101402 Filter CriteriaImportant - read this whole page, and the Configuration Tips before you start designing your filters. Filter Criteria The standard Filter Criteria available, which equate to the header fields found in most mail and news messages, are as follows:- Sender From To Cc Bcc Organisation Newsgroups Subject Reply-To Return-Path Message-ID Return-Receipt-To
Mailtraq also provides the following standard Filter Criteria which express other useful message properties:- #size the size of a message in lines #body the contents of the body text of a message #minrcpts the minimum number of recipients of a message #maxrcpts the maximum number of recipients of a message #minsize the minimum size of a message #maxsize the maximum size of a message #priority the priority setting of a message ("high" / "low")
The header fields of a message can be viewed by selecting the message in the console and choosing View from its context menu. The header fields begin at the top of the message and are separated from the text of the message body by a single blank line. Custom headers not found in the above list may also be entered as Filter Criteria by overwriting the existing text in that field. Note that the colon which appears after all header fields must not be entered into the Filter Criteria.
Filter Examples A filter entry consists of two fields, an entry in the Filter Criteria and a corresponding field value, for example:- Filter Criteria Field Value Subject dollar
...traps any message in which the Subject: header includes the text 'dollar' anywhere in that header field. Mailtraq makes case insensitive matches against the field values in filters thus that entry would also match 'Dollar' and 'DoLLar'. The standard wildcards available in Mailtraq can also be used in the field value, for example:- Filter Criteria Field Value To *@example.com
...traps any message addressed in the To: header to any user at the example.com domain. Custom headers may also be used in the Filter Criteria by overwriting the existing text. Some service providers, for example, use the non standard X-Apparently-To: header to record the message envelope forward address:- Filter Criteria Field Value X-Apparently-To fred
...traps any message in which that header holds an address containing the text 'fred'. That selection can be reversed by negating the Filter Criteria with a tilde "~" character (ASCII 126). For example, to trap all messages with 'example.com' in the To: header which do not contain the text 'fred' in the X-Apparently-To: header:- Filter Criteria Field Value To *@example.com ~X-Apparently-To fred
Note that Mailtraq applies implicit wildcards either side of field values (that is, a value of 'fred' matches both 'user@fred.example.com' and 'fred@example.com') but wildcards are otherwise required (that is, a value of 'make money' fails to trap 'make big money' but a value of 'make*money' traps both 'make money' and 'make big money'). Mailtraq filters can also be configured to act only if multiple conditions are met. For example, if messages are to be excluded only if they contain both an address in the Sender: header and a subject which includes the text "Foobar":-
Filter Criteria | Field Value | Match | Sender | * | | Subject | Foobar | | | | Not All |
Match The Match type modifies how a match is obtained:- All - the message is included only if all entries match Any - the message is included if any entries match None - the message is included only if no entries match Not All - the message is excluded only if all entries match
Configuration Tip
Note carefully the context in which filters are used. In some cases filter matches include messages, in other cases filter matches exclude messages. For example: Set Filter Criteria - To: Field Value - user@domain.com Set Filter Criteria - From: Field Value - user@domain.com Match - Any
will only allow messages into the mailbox that are either To or From user@domain.com All other messages will be discarded and cannot be recovered. How to test your filter It is useful to recall that you can right-click and Route copies of messages from another mailbox into the one that you are setting the Filter on. This makes it easy to test if your filter rules are working as expected. |