I have around 300 domains need to be whitelisted in M365 so our employees are able to send emails to recipients from these domains only.
I have created in rule in mail flow but can't save the rule because it is too long, and I get the error message as attached.
below is the rule description:
Apply this rule if
Is sent to 'Outside the organization'
Do the following
Set audit severity level to 'High' and reject the message and include the explanation 'Access Denied!' with the status code: '5.7.1'
recipients's address domain portion belongs to any of these domains: ....................(almost 300 domains)...........
or Is received from a member of group 'defined Group'
I tried to implement what a Microsoft article suggests to create several smaller rules work together to perform the function of one large rule, but that did not solve the problem (in case I have two rules, and the first one allowed the flow and the second one did not, the result will be block sending the email!)
I wonder if anyone has a work-around to solve this issue or any alternative solution.