Forwarding emails by wildcard (name*@domain.com)

rmsuydam

Registered
Apr 28, 2009
1
0
51
My company does a lot of software testing, and we need to frequently create new users (by email address) for testing. Rather than manually creating a forward every time, I'd love to create a wildcard forwarder. For instance, any email I send to USER****@domain.com would be forwarded to my main account. IE, [email protected], [email protected], etc.

I cannot do a catch all forward, as I have several users wanting to do this. So, USERA****@domain.com, USERB****@domain.com, etc.

Any ideas?
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
My company does a lot of software testing, and we need to frequently create new users (by email address) for testing. Rather than manually creating a forward every time, I'd love to create a wildcard forwarder. For instance, any email I send to USER****@domain.com would be forwarded to my main account. IE, [email protected], [email protected], etc.

I cannot do a catch all forward, as I have several users wanting to do this. So, USERA****@domain.com, USERB****@domain.com, etc.

Any ideas?
You can set up an account-level filter and for the To field use a regular expression. For more information about Exim's regular expressions, check out: http://www.exim.org/exim-html-4.69/doc/html/spec_html/ch08.html
 

8p-design

Well-Known Member
Mar 25, 2006
57
5
158

gsloop

Registered
Jan 11, 2011
1
0
51
This doesn't work...

I've tried this, specifically.
CPanel v11.25.0

(cpanel > Account Level Filtering)
Create a new filter

Rules
Using either "to" or "any header" matches regex
"[email protected]" substituting the prefix I want and the domain this account is for...

Forward to the email addy I want it forwarded to.

This doesn't work, it produces a 550 bouce - "550 no such address here" (state 14)

Can someone please help - as far as I can tell, that regex should match, but this technique simply doesn't work anymore, if it really ever did.

-Greg
 

vishun

Registered
Jul 2, 2008
1
0
51
Did you know that with Gmail you can make use of [email protected] and receive those emails? It is a great feature for creating multiple accounts while testing, identifying where your email address got leaked from (e.g. [email protected]), and many more reasons.

I am posting a new thread about this since I was not able to reply to this one due to 7 years elapsing: Forwarding emails by wildcard (name*@domain.com) -- It comes up with a high rank in search results and I wish that we could update the thread with the updated instructions that follow:
  1. Login to cPanel
  2. Go to Global Email Filters
  3. Click the Create a New Filter button
  4. Under the Rules header, change the left drop down to Any Recipient to match emails with more than one recipient
  5. Change the right dropdown to matches regex
  6. In the input area below the rule drop downs, enter [email protected] while replacing "recipient_" and "domain.com" appropriately (e.g. [email protected])
  7. Under the Actions header, change the drop down to Redirect to Email
  8. In the input area below the action drop down, enter the real email address [email protected]

cPanel version 70.0.53
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello @vishun,

I've moved your post into the requested thread.

Thanks!
 

Richard-N

Member
Apr 21, 2017
11
3
3
croydon, surrey, UK
cPanel Access Level
Website Owner
Sadly that seems to have stopped working.

I have a set of global email filters to catch wildcard entries so basically [email protected] will get forwarded to my richard mil box. I do this by using a filter:

Any recipient matches regex \b(?i)richard[A-Za-z0-9._%+-][email protected]*\b

and that redirects to [email protected]

I had issues to start with when I was forwarding to a different domain, cpanel looked at my logs and concluded that it was because I was forwarding to a different domain. Changed that and a lot of issues went away but if the emails are copied to someone else also at mydomain then we both get two copies of the email. If an email is sent to more than 5 people at mydomain then it vanishes never to be seen again. So works but with some issues that I could live with for the convenience of wildcard filtering.

Today I tried to set up a wildcard filter for a new email address and got an error: To prevent recursive email delivery issues, you can not use a recipient from a controlling domain in a global delivery filter.

This is similar to the behaviour observed in this post Global email filters.

Wildcard filtering is something we had before cpanel so really keen to keep it but looks like we are about to have issues??


Did you know that with Gmail you can make use of [email protected] and receive those emails? It is a great feature for creating multiple accounts while testing, identifying where your email address got leaked from (e.g. [email protected]), and many more reasons.

I am posting a new thread about this since I was not able to reply to this one due to 7 years elapsing: Forwarding emails by wildcard (name*@domain.com) -- It comes up with a high rank in search results and I wish that we could update the thread with the updated instructions that follow:
  1. Login to cPanel
  2. Go to Global Email Filters
  3. Click the Create a New Filter button
  4. Under the Rules header, change the left drop down to Any Recipient to match emails with more than one recipient
  5. Change the right dropdown to matches regex
  6. In the input area below the rule drop downs, enter [email protected] while replacing "recipient_" and "domain.com" appropriately (e.g. [email protected])
  7. Under the Actions header, change the drop down to Redirect to Email
  8. In the input area below the action drop down, enter the real email address [email protected]

cPanel version 70.0.53
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hi @Richard-N,

I recommend opening a feature request for the ability to do this natively in the product. Post the link to the feature request here once it's opened and I'll look into how feasible it is to get something like this added to the product.

Thank you.
 

LauraRhian

Registered
May 31, 2020
1
0
1
UK
cPanel Access Level
Website Owner
Hello,

I have the same issue- need to set up email forwarding with a wildcard, so person***@mydomain.com redirects to [email protected]. Using the global filters solution suggested gives me the same problem: To prevent recursive email delivery issues, you can not use a recipient from a controlling domain in a global delivery filter.

Apologies if there is a solution posted somewhere else that I have missed. Any ideas?

Thanks,

Laura.