OPAR - OPM Package ARchive

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


Other Versions
3.3.1, 4.0.1,
Uploaded by/on
reneeb on 04 Oct 2021
Download Website
Use named captures in Postmaster filter.

Rate/comment this package


EnhancedPostmasterFilter - use named captures in Postmaster filter


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.


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 "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 these servers:

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 these set actions:

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


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


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


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

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