Because incoming messages can be sorted automatically into queues or spam
mails can be moved into a specific queue, OTRS has the possibility to
filter incoming messages. It does not matter, if PostMasterPOP3.pl or
PostMaster.pl is used to get messages into the ticket system. Filter
rules can be created through the link "PostMaster Filter" in the admin area
of OTRS.
A filter rule consists of one or more filter criterias that must match if
the filter rule shall be executed and of one or more actions that are
executed, if the filter criterias match. You can define filter
criterias for the headers or the body of an email, e.g. search for specific
header entries or strings in the body, even regular expressions are
allowed. All actions for a filter rule are triggered by X-OTRS headers,
which are inserted if the filter criterias match. The ticket system
evaluates the inserted X-OTRS headers and executes the specific actions.
X-OTRS headers can be used to sort an incoming message into a specific
queue, change the priority of the message or ignore the message and deliver
it not to the system. The following table lists the different X-OTRS
headers and their meaning.
Table 5-4. Function of the different X-OTRS-headers
Name
Possible values
Description
X-OTRS-Priority:
1 very low, 2 low, 3 normal, 4 high, 5 very high
Sets the priority of a ticket.
X-OTRS-Queue:
Name of a queue in the system.
Sets the queue where the ticket shall be sorted in. Is a queue
set by a X-OTRS header all other filter rules that try to sort a
ticket into a specific queue are ignored.
X-OTRS-Ignore:
Yes
Is this X-OTRS header set to "Yes", the incomming message will
completely be ignored and never delivered to the system.
If this X-OTRS header is set no auto answer is delivered to the
sender of the message (mail loop protection).
A name must be specified for every filter rule. In the section for "Match"
the filter criteria can be specified. Choose via the listboxes for
"Header 1", "Header 2" and so on the parts of the messages where you would
like to search and specify via the input files on the right sides the
values. In the section for "Set" you can choose the actions that are
triggered, if the filter rules match. You can select for "Header 1",
"Header 2" and so on the X-OTRS-Header and set the values.
Example 5-1. Sort spam mails into a specific queue
A nice and usefull filter rule could be to let OTRS sort mails marked for
spam with Spamassassin into the "Junk" queue automatically.
Spamassassin adds for every checked mail the "X-Spam-Flag" header.
Is the mail marked as spam, the Header is set to "Yes". So the filter criteria
is "X-Spam-Flag: Yes". To create a filter rule with this criteria you can
insert the name for example "spam-mails". Also choose in the section for
"Match" for "Header 1" from the listbox "X-Spam-Flag:". Insert "Yes" as
value for this header. Now the filter criteria is specified. To make sure,
that all spam mails get sorted into the "Junk" queue choose in the section for
"Set" for "Header 1" the "X-OTRS-Queue:" entry. Specify "Junk" as value for
this header. Finally add the new filter rule to activate it for the next
new messages in the system.
There are aditional modules, that can be used to
filter incoming messages
more specificaly. This modules might be usefull on bigger and more complex
systems.