Using filter match in setting values with PostMaster::Filter

Moderator: crythias

Locked
neonatus
Znuny newbie
Posts: 1
Joined: 04 Oct 2013, 09:12
Znuny Version: 3.0.11

Using filter match in setting values with PostMaster::Filter

Post by neonatus »

Hello,

I would like to set one of the values in our FreeField fields by the From address match by using the PostMaster::Filter::Match module.
This is the excerpt of my code in Config.pm (I did not know how to do it from the web GUI with the elements below):

Code: Select all

my %freekeys = (
   'test' => 'value1',
   'second' => 'value2'
);

$Self->{'PostMaster::PreFilterModule'}->{'1-FreeMatch} = {
     Module => 'Kernel::System::PostMaster::Filter::Match',
      Match => {
            From => '((pd|hm)\.(.*)|[Tt]est|[Ss]econd)@ourdomain.com',
        },
        Set => {
            'X-OTRS-TicketKey1' => 'MyKey1',
            #'X-OTRS-TicketValue1' => $freekeys{'second'}, # this works just fine...
            #'X-OTRS-TicketValue1' => $freekeys('[***]'), # this does not work (issues error in the log)
            'X-OTRS-TicketValue1' => lc('[***]'), # this assigns the value of the key to the X-OTRS-TicketValue1 var, but is not put to lowercase
        },
};
So my question is how can I make the [***] match result to be used correctly as the input for %freekeys hash key so I can assign the value of %freekeys hash to the X-OTRS-TicketValueN field. If it is possible at all.

Kind Regards,
Bostjan
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: Using filter match in setting values with PostMaster::Fi

Post by reneeb »

You have to write your own PostmasterFilter (Perl module).
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
Locked