regular expressions for postmaster filter
Moderator: crythias
regular expressions for postmaster filter
Hello,
I didn't find a regular expression to get first three letters of first name and first two letters of name from an email address in the header "Body".
For example : 'FirstName.Name@domain.com...' ==> 'FirNa'
Thanks
I didn't find a regular expression to get first three letters of first name and first two letters of name from an email address in the header "Body".
For example : 'FirstName.Name@domain.com...' ==> 'FirNa'
Thanks
-
- 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: regular expressions for postmaster filter
Doesn't work with stock postmaster filters. You need either http://opar.perl-services.de/dist/Enhan ... lter-4.0.1 or write your own postmaster filter 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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: regular expressions for postmaster filter
Thanks you !
But how to convert a case text to uppercase text in postmaster filters ?
But how to convert a case text to uppercase text in postmaster filters ?
-
- 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: regular expressions for postmaster filter
If you want to do more than just match, you definitely need your own postmaster filter module... As a base, you could use 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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: regular expressions for postmaster filter
What do the file SetQueue.pm do ?
-
- 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: regular expressions for postmaster filter
It checks whether a ticket is not in Queue1 and not closed and sets the new queue and a new state for the ticket.
In your case, you have to replace the lines 46 to 56 with something like
In your case, you have to replace the lines 46 to 56 with something like
Code: Select all
my ($First, $Last) = $Param{GetParam}->{From} =~ m{
(\w{3}) # first three letter of firstname
\w+ # rest of firstname
\. # separator
(\w{2}) # first two letters of lastname
\w+ # rest of lastname
\@ # literal @
}xms;
# make the first character uppercase and the rest lowercase
$First = ucfirst lc $First;
$Last = ucfirst lc $Last;
# do what ever you want with the info
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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: regular expressions for postmaster filter
I tried to test your file but it doesn't work.
I added the file in C:\otrs\OTRS\Kernel\System\PostMaster\Filter, is it all ?
Then, is there an other configuration to do ?
I added the file in C:\otrs\OTRS\Kernel\System\PostMaster\Filter, is it all ?
Then, is there an other configuration to do ?
-
- 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: regular expressions for postmaster filter
The sample config is also in the 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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: regular expressions for postmaster filter
I am sorry but I don't know the gist.
How to do it ?
How to do it ?
-
- 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: regular expressions for postmaster filter
reneeb wrote:[...] As a base, you could use 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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: regular expressions for postmaster filter
Yes, I saw it before but where should I put this gist ?
In C:\otrs\OTRS\Custom\Kernel\Config.pm ?
In C:\otrs\OTRS\Custom\Kernel\Config.pm ?
-
- 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: regular expressions for postmaster filter
Yes in Kernel/Config.pm
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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: regular expressions for postmaster filter
Actually, it works very well with EnhancedPostmasterFilter because I had to reboot IIS to convert lowercase to uppercase !
Thanks you for all.
Thomas
Thanks you for all.
Thomas