Restrict creation of tickets by email

Moderator: crythias

Locked
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Restrict creation of tickets by email

Post by aph »

I would like to restrict the ability to create tickets by e-mail to certain e-mail addresses only. However, I'm not getting the postmaster filter working. Below is my postmaster filter
Unbenannt_186.PNG
So I basically want that only when html@example.com sends an e-mail to skywalker@otrs.org a ticket should be created in otrs. If an e-mail is sent from any other e-mail address to skywalker@otrs.org it should be ignored. I'm using a regex to handle cases where the 'From' field contains the name as well as the e-mail id (for example From: HTML email test <html@example.com>) and not just the e-mail address.
You do not have the required permissions to view the files attached to this post.
Last edited by aph on 03 Sep 2015, 16:53, edited 1 time in total.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
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: Restrict creation of tickets by email

Post by reneeb »

Instead of value "1", it has to be "yes" in the Ignore-Header...
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
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Restrict creation of tickets by email

Post by aph »

Found that out :D
Unbenannt_190.PNG
But now the e-mail from html@example.com (as well as From: System Tester <html@example.com>) get ignored. If I send an e-mail from an address other than html@example.com it also gets ignored. I can't seem to get the regex right. Any pointers?
You do not have the required permissions to view the files attached to this post.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Restrict creation of tickets by email

Post by crythias »

PostMasterFilters are (should be?) handled in abc order.
Create a filter 1-block that blocks all emails X-OTRS-Ignore True (do not check stop after match)
Create a filter 2-allow that allows from/to. X-OTRS-Ignore False

Although you'd probably also want to allow correspondence with a ticket number in the subject, so
3-allowfollowup match subject contains Ticket# (or whatever is the ticket string) X-OTRS-Ignore False

Note also (verify, don't take my word for it) that strings are already matched as part and not entirety of string.
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
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Restrict creation of tickets by email

Post by aph »

As it appears, using an OR statement does the trick if one wants to allow e-mails from more than one address. Multiple postmaster filters might not be necessary. In my case I want to allow only allow html(at)example.com and darthvader(at)otrs.org to send mails to skywalker(at)otrs.org
Unbenannt_194.PNG
I'm not sure how and whether I can use regular expressions in the statement. For example, if I want to allow e-mails only from domains example.com and otrs.org. My guess is

Code: Select all

(.*@example.com|.*@otrs.org)
. I havented tested it though. Any other suggestions for what the regex for filtering domains might look like?
You do not have the required permissions to view the files attached to this post.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Restrict creation of tickets by email

Post by aph »

Tested it. I can use a regex in OR statement.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
Locked