Using PostMaster filters on raw emails

Jens Bothe, 21. Dec 2016 | AdministrationConsultingUse cases

OTRS has a deep background on handling emails. One of the most powerful tools integrated is the ability to analyze incoming emails and even fetch data to different fields of a ticket. The most known kind of filters are the “Match Filters” which can be configured through the admin panel.

These filters use Kernel::System::EmailParser to split the content of an incomming email into different parts, like the different headers and the body. Due to this splitting it is not possible to analyze parts of an email which are not stored in the headers or the body.

Solving the issue

Deeply hidden in the Sysconfig is the possible to create postmaster filters which use the raw or plaintext content. This filter can be found in the PostMaster::PreFilterModule###4-CMD section of the Ticket -> Core::PostMaster group. This filter matches if the command will create an output on STDOUT.

Let’s say I would like to set a Dynamic Field if the mail was signed by PGP/MIME. As the PGP signature is an additional MIME part within the mail this not possible with the “normal” filters.

Lets have a look on the raw email:

Subject: Some Test Mail
Message-ID: <>
Date: Wed, 21 Dec 2016 21:08:59 +0100
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
Content-Type: multipart/mixed; boundary="QjgNWgJvSE4d1wRcsuMPf9MFTaAMnLIFb";
From: "Jens O. Bothe" <>
To: 'Jens Bothe' <>
Message-ID: <>
Subject: Some Test Mail

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

this is a test



Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Comment: GPGTools -



I want to filter on the part:

Content-Type: application/pgp-signature; name="signature.asc"

So I have to add as CMD: grep “Content-Type: application/pgp-signature”

The full part in the Sysconfig

For my latest customer I created some additional filters. The XML file can be found here: PostMasterFilter.xml

Your email address will not be published. Required fields are marked *

This site uses cookies. By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.