I wanted to filter emails by the From field using the 'Global Email Filters' feature in my cPanel Account, but this is not working.
Below is an example rule called 'Dodgy SPAM (PCP)'.
And this is an example email I wanted to block:
From: PCP Claims <pcpclaims@somespammer.com> Sent: 13 February 2022 17:35 To: iamspam@example.com Subject: If you took finance for your car, you may have been overcharged Did you take finance for your car? There's a chance that you were overcharged If you have a current PCP agreement, or it has ended within the last 5 years, then the likelihood is that you were the victim of mis-selling. Whether that's undisclosed commission, hidden APR's, failure to offer a more suitable product or one of many other reasons. Get A Free Assessment If you no longer wish to receive these let us know here
When i tested the email it says "Error: You do not own an email filter that matches the given parameters."
So my rules are in place and I have a suitable email text to test and it should be working.
NB: It should be noted that blocking SPAM using the individual email account filters works fine, just not the global one.
Solution
After some back and forth tickets with my provider the following solution was reached and my issue disappeared.
There is some problem with 'Global email filter' option from the cpanel itself due to which is not working. Now we have forwarded this issue to the Cpanel team. They will look into it and once we received any update from them then we will update you on the same ticket accordingly.
Hosting Provider
So they then followed this up with the following resolution:
I found that the vfilters file for this domain was missing. This is where the global filters are normally stored and read from when Exim processes them.
[01:46:26 server77 root@xxxxxxxx ~]cPs# cat /etc/vfilters/quantumwarp.com cat: /etc/vfilters/quantumwarp.com: No such file or directory
I created this file and corrected permissions.
[01:47:00 server77 root@xxxxxxxx ~]cPs# touch /etc/vfilters/quantumwarp.com && /scripts/mailperm abcdefg --verbose Checking mx configuration for demo.quantumwarp.com (abcdefg)...[auto]...Done Checking mx configuration for quantumwarp.com (abcdefg)...[local]...Done Checking mx configuration for search.quantumwarp.com (abcdefg)...[auto]...Done Fixed permissions on /etc/vfilters/quantumwarp.com : was (0644), now (0640) Fixed ownership of /etc/vfilters/quantumwarp.com : was (uid=0,gid=0), now (uid=1481,gid=12) Fixed permissions on /home/abcdefg/mail/quantumwarp.com/hosting/dovecot-quota: was (0600), now (0640)
The custom filters are now there as normally expected:
[01:50:28 server77 root@xxxxxxxx ~]cPs# wc -l /etc/vfilters/quantumwarp.com 65 /etc/vfilters/quantumwarp.com
With this, the filters should proceed to function as expected. You may find this helpful for testing the filters going forward:
As per their update (cPanel), there was issue with the vfilter configuration file which was missing for the site (quantumwarp.com). Now they have rectified the issue and 'Global Email Filter' option is working fine now.