[SOLVED] dd Negation to Postmaser Filter in XML File

Moderator: crythias

Post Reply
jason123
Znuny newbie
Posts: 33
Joined: 25 Apr 2016, 15:27
Znuny Version: OTRS 5

[SOLVED] dd Negation to Postmaser Filter in XML File

Post by jason123 »

Hi,

I am trying to negate the match in the .xml file for a postmaster filter, currently I have the following which works to match, but I want negate it. I cannot find anywhere in the documentation that shows how to negate a postmaster filter in xml, any help would be great:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="1.0" init="Application">

<ConfigItem Name="PostMaster::PreFilterModule###1-MyModule" Required="0" Valid="1">
    <Description Translatable="1">My module to filter and manipulate incoming messages.</Description>
    <Group>Ticket</Group>
    <SubGroup>Core::PostMaster</SubGroup>
    <Setting>
        <Hash>
            <Item Key="Module">Kernel::System::PostMaster::Filter::MyModule</Item>
            <Item Key="Match">
                <Hash>
                    <Item Key="Subject">(.*)testSubject(.)82(.*)</Item>
                </Hash>
            </Item>
            <Item Key="Set">
                <Hash>
                    <Item Key="X-OTRS-Queue">Raw</Item>
                </Hash>
            </Item>
        </Hash>
    </Setting>
</ConfigItem>

</otrs_config>
Last edited by jason123 on 10 Jul 2017, 15:27, edited 1 time in total.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Add Negation to Postmaser Filter in XML File

Post by reneeb »

Try

Code: Select all

(?!:testSubject.82)
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
jason123
Znuny newbie
Posts: 33
Joined: 25 Apr 2016, 15:27
Znuny Version: OTRS 5

Re: Add Negation to Postmaser Filter in XML File

Post by jason123 »

Hi reneeb,

Thanks for the reply.

I could not get the match to work in the .xml file, so I ended up applying the following: (.*)

This brought in all emails and then once in the code, I applied more control over the filtering.

Jason
Post Reply