filtering email with regex for emails with period in user name ie [email protected]

cPanel & WHM Version
9.0.11

TimBickerton

Registered
Mar 4, 2021
2
0
1
Australia
cPanel Access Level
Website Owner
We have a similar domain name to a government health service (we are .com.au they are .gov.au) and we continually get emails, most likely private and urgent to doctors etc sent to ur .com.au domain. All of the incoming erroneous emails have [email protected] email address and we do not use periods in our emails, i.e. we use [email protected].

I've tried a few times to Globally filter using both 'To' and 'Any Recipient' that matches regex to try a filter our [email protected] but have been unable to make it work. Any suggestions on what the regex expression would be in cpanel?

We just plan to 'fail with message' advising them they sent it to the wrong email address and it's been deleted.

Thanks in advance.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,238
363
cPanel Access Level
Root Administrator
Hey there! I'm not personally sure of the regex on that, but could you just filter the entire .gov.au domain instead? If you are .com.au you could filter the entire domain and not have to worry about the part of the address before the @
 

TimBickerton

Registered
Mar 4, 2021
2
0
1
Australia
cPanel Access Level
Website Owner
Hey there! I'm not personally sure of the regex on that, but could you just filter the entire .gov.au domain instead? If you are .com.au you could filter the entire domain and not have to worry about the part of the address before the @
unfortunately they are sending to .com.au rather than .gov.au
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,238
363
cPanel Access Level
Root Administrator
How about this guy?


That string is designed to match the period, and then you could filter based on that.

You could also do a string match before and after the period, but if you aren't using periods at all in your emails that may not be necessary.