Postmaster filter not matching X-OTRS-CustomerNo

Moderator: crythias

Locked
mdoupe
Znuny newbie
Posts: 5
Joined: 08 Mar 2016, 17:29
Znuny Version: 5 patch 7

Postmaster filter not matching X-OTRS-CustomerNo

Post by mdoupe »

Hi all,

I'm having an issue with email tickets. When an email comes in, it doesn't seem to process the Postmaster Filters I set up in the GUI or the Filter I set in Kernel/Config.pm as per the documentation (https://otrs.github.io/doc/manual/admin ... ing-filter).

All of my customer users are synced via LDAP. My test user has "TEST" in the CustomerID field. In the Postmaster filter I set filters that look for "TEST" in X-OTRS-CustomerNo and then sets X-OTRS-Queue to a queue I set up named "TEST", but the ticket stays in the Raw Queue.

Thanks!
mdoupe
Znuny newbie
Posts: 5
Joined: 08 Mar 2016, 17:29
Znuny Version: 5 patch 7

Re: Postmaster filter not matching X-OTRS-CustomerNo

Post by mdoupe »

The filter I set up in case anyone is curious:

Code: Select all

  $Self->{'PostMaster::PreFilterModule'}->{'TEST'} = {
    Module => 'Kernel::System::PostMaster::Filter::Match',
    Match => {
      'X-OTRS-CustomerNo' => 'TEST',
    },
    Set => {
      'X-OTRS-Queue' => 'TEST',
    },
  };
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: Postmaster filter not matching X-OTRS-CustomerNo

Post by reneeb »

Are you sure the mail has the X-OTRS-CustomerNo header? If it is a mail from a customer I doubt that...

So you have to write your own postmaster filter module that checks the customer id from the ticket. A sample Postmaster filter is available at https://gist.github.com/reneeb/7308b1cb390a26c1bfe5
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
mdoupe
Znuny newbie
Posts: 5
Joined: 08 Mar 2016, 17:29
Znuny Version: 5 patch 7

Re: Postmaster filter not matching X-OTRS-CustomerNo

Post by mdoupe »

I've applied your sample postmaster filter. When an email comes in, I see the following in the log:

Code: Select all

OTRS-otrs.Console.pl-Maint::PostMaster::MailAccountFetch-44[17679]: [Error][Kernel::System::PostMaster::Filter::CESDSetQueue::Run][Line:38]: Need TicketID!
When I try to dump the TicketID with

Code: Select all

$LogObject->Log(Priority => 'error', Message  => "Ticket ID: $Param{TicketID}");
I get

Code: Select all

OTRS-otrs.Console.pl-Maint::PostMaster::MailAccountFetch-44[17679]: [Error][Kernel::System::PostMaster::Filter::CESDSetQueue::Run][Line:36]: Ticket ID:
My Config.PM has

Code: Select all

  $Self->{'PostMaster::PreFilterModule'}->{'TEST'} = {
    Module => 'Kernel::System::PostMaster::Filter::CESDSetQueue',
  };

I'm on version 5. Is there a way to find out what's changed RE: postmaster filters since the version you're on?
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: Postmaster filter not matching X-OTRS-CustomerNo

Post by reneeb »

On a "Pre" filter the ticket id is not available. You have to configure it as a "Post" filter (as shown in the sample gist)
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
mdoupe
Znuny newbie
Posts: 5
Joined: 08 Mar 2016, 17:29
Znuny Version: 5 patch 7

Re: Postmaster filter not matching X-OTRS-CustomerNo

Post by mdoupe »

Hah! Sorry about that.
Locked