Conditional mail filtering

larkim

Member
Sep 27, 2007
11
0
51
Hi

I'm a user of cPanel, though not an admin. My shared hosting support haven't been able to help me with this.

To allow me to trace the source of unsolicited mails, whenever I sign up with e-mail addresses for websites / services etc I use [email protected]tc

So for this site, my email addy is [email protected]

I use a filter so that every mail where the header_to contains "matthew" is sent to a pop3 account on the server. All fine and dandy.

However, one of the signups I used in the past for google groups is abused a lot, and I don't want these mails to sit in my squirrelmail webmail. Not all is detected as spam.

I have added a specific filter for where header_to contains "google" to set to discard.

Unfortunately, when I test this (and in practice what happens) is that the mail matches both of these filters, and is therefore discarded AND sent on to my pop3 account.

The front end of cPanel doesn't seem to allow for conditional mail filters (e.g. if header_to contains matthew then if header_to contains google discard else forward_to pop3 endif endif - you know what I mean).

How could I achieve this?

Thanks!

Matt
 

larkim

Member
Sep 27, 2007
11
0
51
Just a post to add that having reviewed the info here I suspect that I'll be looking at editing the filter.yaml file in the .cpanel directory, and I'm comfortable with doing that. I'd mistakenly thought that the .filter folder in the root of my account was the one which I'd have to edit. Any pointers gratfully received.

Matt
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
...
The front end of cPanel doesn't seem to allow for conditional mail filters (e.g. if header_to contains matthew then if header_to contains google discard else forward_to pop3 endif endif - you know what I mean).
...
You can shorten the logic of that statement to IF header_to CONTAINS matthew AND header_to CONTAINS google DISCARD. This statement is supported by the mail filtering interface.

Simply when creating your rule, click the "+" button to the right of your first statement and a second line will pop up. Next to the button you just clicked, you'll see a drop-down list of 2 logical operators (AND OR).
 

larkim

Member
Sep 27, 2007
11
0
51
Does that work under cPanel 10 (which is what seems to be in place)? I can't find buttons to add additional conditions.

THanks for the quick response!

Matt
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Does that work under cPanel 10 (which is what seems to be in place)? I can't find buttons to add additional conditions.

THanks for the quick response!

Matt
cPanel 10 is a bit out of date, I would recommend upgrading to version 11 or asking your hosting provider to upgrade to version 11.
 

larkim

Member
Sep 27, 2007
11
0
51
OK, thanks I'll take that up with my hosting provider.

In the meanwhile, is it possible to edit filter.yaml without using the front end of cPanel in order to achieve my objective? If so, are there any resources which can help me figure out what the coding should be? I'm not a coding novice (well, not completely - complex dos batch scripts and VBA are my backgrounds in terms of scripting) but I haven't done anything that resembles the code structure of the .yaml file.

Thanks

Matt
 

larkim

Member
Sep 27, 2007
11
0
51
Update - actually using version 11

But the options described above to implement conditional filters don't appear to be there.

cPanel version shows as 11.11.0-RELEASE 16983, theme is cPanel X 2.6.0

I'll post an image later, but I'll describe the email filtering page:-

Entitled "Add filter"

"Filter" then drop down box with options "From, Subject, To, Any header, Body, SpamAssassin header..."
"that" then drop down box "contains, equals, regex..." etc
followed by box for the item to be matched etc.

Underneath there is "destination" with a text box to be completed. And below that just some advice about potential destinations. No option for anything conditional or any additional criteria.

Then there is a button for "activate". That's it.

Am I missing something?

Thanks for any help!

Matt

Edit - this link http://www.hooverwebdesign.com/support/email-filtering.html shows exactly the pages as I see them.
 
Last edited: