[SOLVED] OTRS PostMaster filter

Moderator: crythias

Post Reply
kongyong92
Znuny newbie
Posts: 43
Joined: 15 Sep 2017, 11:40
Znuny Version: OTRS v5.0.10
Real Name: Kong-Yong
Company: Rhenus Logistics

[SOLVED] OTRS PostMaster filter

Post by kongyong92 »

Hi all,

I will require some help with the RegEx so as to avoid the issue as described below from happening. Tried some variations but it seems to not work for me :(
P/S. clearly i am not an expert with RegEx yet. :(

I had the package 'EnhancedPostMasterFilter' installed.
https://opar.perl-services.de/dist/Enha ... lter-5.0.2

So far it works fine except when the users send in mails with unnecessary white spaces as shown below:

Code: Select all

Task:                             test data
Type of Business:                                     test abc
Service Type:                                     test data 123
instead of just having the information entered in the email body to be as follow:

Code: Select all

Task:test data
Type of Business: test abc
Service Type: test data 123
By sending mails in the first scenario described above, it resulted in the server to crash where the processors reach 100% usage and no further mails can be fetched.

The current regex that i have in place, which works fine for the second scenario described above is as follow:

Code: Select all

Task:\s+(?<task>.*?)\s*Type of Business:\s+(?<typeofbusiness>.*?)\s*Service Type:\s+(?<servicetype>.*?)\s
Will appreciate greatly if anyone can give me some advice in writing a regex to ignore the unnecessary white space.

Thanks in advance.
Last edited by kongyong92 on 24 Apr 2019, 08:54, edited 1 time in total.
Best regards,
Kong-Yong
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS PostMaster filter

Post by crythias »

Try this:

Code: Select all

Task:\s*(?<task>.*)\nType of Business:\s*(?<typeofbusiness>.*)\nService Type:\s*(?<servicetype>.*)\n
https://www.regexpal.com/?fam=108643 (add a carriage return on the last entry).

You might put this in the Substitution line:

Code: Select all

\nTask: $1\nType of Business: $2\nService Type: $3\n\t
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
kongyong92
Znuny newbie
Posts: 43
Joined: 15 Sep 2017, 11:40
Znuny Version: OTRS v5.0.10
Real Name: Kong-Yong
Company: Rhenus Logistics

Re: OTRS PostMaster filter

Post by kongyong92 »

Hi crythias,

Thanks a lot!

Works perfectly once i amended your recommendation slightly :)

For future readers:

Code: Select all

Task:\s*(?<task>.*)\n*Type of Business:\s*(?<typeofbusiness>.*)\n*Service Type:\s*(?<servicetype>.*)\n*
Appreciate your help!
Best regards,
Kong-Yong
Post Reply