I am trying to setup a filter rule to deny users from emailing outside of the company domain. I believe I have the filter set correctly. When I test within cPanel it shows it is working but when I try it via webmail the emails are delivered. Below is the simple filter I have in place.
aaa.com is the company domain
zzz.com is all external domains
Any recipient does not contain aaa.com
Fail with message "Denied"
Test results from within cPanel filter section.
e Filter has matched the following condition(s):
foranyaddress $h_to:,$h_cc:,$h_bcc: ($thisaddress does not contain aaa.com)
$thisaddress does not contain aaa.com
Extracted address email@example.com
Return-path copied from sender
Sender = firstname.lastname@example.org
Recipient = email@example.com
Testing Exim filter file "/etc/vfilters/aaa.com"
Fail text "Denied"
Filtering ended by "fail".
Like I said, the above test works but if I try sending an email via webmail they are delivered without being denied. Any ideas on what I am missing here?