Exclude Email Account from System Filter Rule
Hi All,
I have a system filter rule in /etc/cpanel_exim_system_filter_custom and it is currently working now.
Now, I want an email account that will get excluded from that filter rule. For example all email account from @our-domain.com cannot send mails except for those domains our-domain.com, allowed-domain1.com, allowed-domain2.com, allowed-domain3.com and allowed-domain4.com but I want the email account excluded@out-domain.com excluded on that filter rule and can send to all domains. Please help :(
if (
$h_to: does not contain "our-domain.com" and
$h_to: does not contain "allowed-domain1.com" and
$h_to: does not contain "allowed-domain2.com" and
$h_to: does not contain "allowed-domain3.com" and
$h_to: does not contain "allowed-domain4.com"
)
and
($h_from: contains "our-domain.com")
then
fail text "Unauthorized Mail"
endif
Now, I want an email account that will get excluded from that filter rule. For example all email account from @our-domain.com cannot send mails except for those domains our-domain.com, allowed-domain1.com, allowed-domain2.com, allowed-domain3.com and allowed-domain4.com but I want the email account excluded@out-domain.com excluded on that filter rule and can send to all domains. Please help :(
-
Hello, You could try adding a separate filter rule ahead of the existing one that allows the message to proceed if it matches the specific condition you want to whitelist. Use the "Stop Processing Rules" action on the new filter rule so that the additional filter rules are not processed. Here's a document you may find helpful: 0 -
How do I position the filter rule? Is it before the fail rule or after it? Will this do? # Block all except for listed domains if ( $h_to: does not contain "our-domain.com" and $h_to: does not contain "allowed-domain1.com" and $h_to: does not contain "allowed-domain2.com" and $h_to: does not contain "allowed-domain3.com" and $h_to: does not contain "allowed-domain4.com" ) and ($h_from: contains "our-domain.com") then fail text "Unauthorized Mail" endif # Exclude email account from block all rule if ($h_from: contains "excluded@our-domain.com") and ($h_to: contains "@") then finish endif0 -
Hello, You'd actually want to add the new rule before the existing rule. Here's an example of how it should look: #123 if $header_from: matches "excluded@our-domain.com" then finish endif
Thank you.0 -
Hi Michael, will this do? if ($h_from: matches "excluded@our-domain.com") then finish elif ( $h_to: does not contain "our-domain.com" and $h_to: does not contain "allowed-domain1.com" and $h_to: does not contain "allowed-domain2.com" and $h_to: does not contain "allowed-domain3.com" and $h_to: does not contain "allowed-domain4.com" ) and ($h_from: contains "our-domain.com") then fail text "Unauthorized Mail" endif endif0 -
Hello, That looks like a single rule. You should try setting up multiple rules first, like you started in your previous example. Thank you. 0
Please sign in to leave a comment.
Comments
5 comments