OPAR - OPM Package ARchive

Browseable collection of plugins for the popular ticket system software Znuny and ((OTRS)) Community Edition.


EnhancedPostmasterFilter

Version
3.3.1
Other Versions
4.0.1, 5.0.3,
Uploaded by/on
reneeb on 11 Jan 2015
Framework
3.3.x
Links
Download Website
Description
Use named captures in Postmaster filter

Rate/comment this package

NAME

EnhancedPostmasterFilter

DESCRIPTION

Currently you have to develop your own PostMaster filter module when you want to catch several values from the mail and use them to set e.g. dynamic fields. The shipped module allows you only to use [***] to use the captured value in the "set" actions. But what is the captured value?

OTRS checks the fields defined in the "match" section in alphabetical order. So [***] is the value captured with the last capturing groups (()) of the last (in alphabetical order) field.

But what if you want to capture more values and use them? Then go with this module!

Now you can use names for the capturing groups and use the names in the "set" actions.

EXAMPLE

The following mail is a maintenance notification and you want to catch the two server ips in the mail body and the customer id in the subject. And finally you want to use those values to set the dynamic field Test to the customer id and the dynamic field Servers to "servers: xxxxxxx and yyyyyy".

  Return-Path: <maint@your-hoster.example>
  X-Original-To: opar@test.example
  Delivered-To: opar@test.example
  Received: from xxxx (xxxxxxxx) by mail.xxxxxx (Postfix) with ESMTPS id xxxxx for <opar@test.example>; Thu, 18 Dec 2014 13:13:22 +0100 (CET)
  To: opar@test.example
  Subject: Maintenance CustomerID 123456
  From: maint@your-hoster.example
  MIME-Version: 1.0
  Reply-To: maint@your-hoster.example
  Message-ID: <c2ac0b64d099e9cdb90cd6bcxxxx@server02>
  Date: Thu, 18 Dec 2014 13:13:22 +0100
  
  There will be maintenance on Sunday for theses servers:
  
  127.0.0.1
  1.1.1.1

Now you can define these matches:

  Field: Body        Value: \n\n(?<s1>\d+\.\d+\.\d+\.\d+)\n(?<s2>\d+\.\d+\.\d+\.\d+)
  Field: Subject     Value: CustomerID (?<cid>\d+)

And theses set actions:

  Field: X-OTRS-DynamicField-Test       Value: [**\cid**]
  Field: X-OTRS-DynamicField-Servers    Value: [**\s1**] and [**\s2**]

ACKNOWLEDGEMENT

The development of this addon was sponsored by Caritasverband Westerwald-Rhein-Lahn e.V.

SOURCECODE AND BUGTRACKER

The code repository and a bugtracker is available at http://github.com/reneeb/otrs-EnhancedPostmasterFilter. Please report any bugs and feature requests on github or via mail.

AUTHOR AND LICENSE

This package was written by Renee Baecker <otrs@perl-services.de>.

The package is licensed unter AGPL. If you did not receive this file, see http://www.gnu.org/licenses/agpl.txt.