I am trying to have exim check the domain of outgoing and incoming mails against a domainlist. If the FROM address of the outgoing mail and the TO/CC/BCC address of the incoming mail are not in the list of local domains, I want to reject/discard the message. Below is what I have come up with, placed in the "acl_not_smpt" section:
discard
condition = ${if and {{! match_domain{${domain:${address:$h_from:}}}{+local_domains}}\
{if or {\
{! match_domain{${domain:${address:$h_to:}}}{+local_domains}}}\
{! match_domain{${domain:${address:$h_cc:}}}{+local_domains}}}\
{! match_domain{${domain:${address:$h_bcc:}}}{+local_domains}}}\
}\
}\
}\
message = Mail discarded for spoofing
But I am getting the below error in my exim log:
unknown condition "if" inside "and{...}" condition
Very new to exim syntax, some help appreciated.