5.14. Filtering incoming messages

From open-support.info

Jump to: navigation, search

OTRS has the capability to filter incoming messages, as reflected by incoming messages being sorted automatically into queues, or spam mails being moved into a specific queue. It is irrelevant whether PostMaster.pl or mail accounts are used to get messages into the ticket system. Filter rules can be created through the link "PostMaster Filter" on the Admin page (see Figure 5.49 below).


Figure 5.49. PostMaster filter management.


A filter consists of one or more criteria that must match for the defined actions to be executed on the email. Filter criteria may be defined 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 criteria 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 not deliver it to the system. The Table 5-4 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. If set in X-OTRS header, all other filter rules that try to sort a ticket into a specific queue are ignored.
X-OTRS-Lock: lock, unlock Sets the lock state of a ticket.
X-OTRS-Ignore: Yes or True If this X-OTRS header is set to "Yes", the incoming message will completely be ignored and never delivered to the system.
X-OTRS-State: new, open, closed successful, closed unsuccessful, ... Sets the next state of the ticket.
X-OTRS-State-PendingTime: e.g. 2010-11-20 00:00:00 Sets the pending time of a ticket (you also should sent a pending state via X-OTRS-State).
X-OTRS-Type: default (depends on your setup) Sets the type of a ticket (if Ticket::Type support is active).
X-OTRS-Service: (depends on your setup) Sets the service of a ticket (if Ticket::Service support is active).
X-OTRS-SLA: (depends on your setup) Sets the SLA of a ticket (if Ticket::Service support is active).
X-OTRS-CustomerUser: CustomerUser Sets the customer user for the ticket.
X-OTRS-CustomerNo: CustomerNo Sets the customer ID for this ticket.
X-OTRS-ArticleKey(1|2|3): Additional info key for the article. Saves an additional info key for this article.
X-OTRS-ArticleValue(1|2|3): Additional info value for the article. Saves an additional info value for the article.
X-OTRS-SenderType: agent, system, customer Sets the type of the ticket sender.
X-OTRS-ArticleType: email-external, email-internal, email-notification-ext, email-notification-int, phone, fax, sms, webrequest, note-internal, note-external, note-report Sets the article type for the incoming ticket.
X-OTRS-TicketKey(1|2|...|8): Additional info key for the ticket. Saves an additional info key for the ticket.
X-OTRS-TicketValue(1|2|...|8): Additional info value for the ticket. Saves an additional info value for the ticket.
X-OTRS-Loop: True 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. Filter criteria can be specified in the section "Filter Condition". Choose via the listboxes for "Header 1", "Header 2" and so on for the parts of the messages where you would like to search, and specify on the right side the values you wish to filter on. In the section "Set Email Headers", you can choose the actions that are triggered if the filter rules match. You can select for "Header 1", "Header 2" and so on to select the X-OTRS-Header and set the associated values (see Figure 5.50 below).


Figure 5.50. Add a PostMaster filter.


Example 5.1. Sort spam mails into a specific queue
A useful filter rule could be to let OTRS automatically move mails marked for spam with a spam detection tool such as SpamAssassin, into the "Junk" queue. SpamAssassin adds the "X-Spam-Flag" header to every checked mail. When the mail is marked as spam, the Header is set to "Yes". So the filter criteria would be "X-Spam-Flag: Yes". To create a filter rule with this criteria you can insert the name as, for example, "spam-mails". In the section for "Filter Condition", choose "X-Spam-Flag:" for "Header 1" from the listbox. Insert "Yes" as value for this header. Now the filter criteria is specified. To make sure that all spam mails get directed into the "Junk" queue, choose in the section for "Set Email Headers", the "X-OTRS-Queue:" entry for "Header 1". Specify "Junk" as value for this header. Finally add the new filter rule to activate it for new messages into the system.

There are additional modules, that can be used to filter incoming messages more specifically. These modules might be useful on larger, more complex systems.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox