Office 365 / Exchange Online Block Sender Domain
The procedure is the same whether you use the Classic Exchange admin center or the new Exchange admin center.
Go to Mail flow – Rules – Create a new rule
Give the new rule a name and click on More options …
Click on Apply this rule if … and select The sender … and domain is
Add the domain you want to block.
Click on Do the following … and select Block the message … – delete the message without notifiying anyone or one of the other two options regarding your needs.
In case you want to reject the message and further send an NDR (Non Delivery Report) to the sender, you can use the following option –> Reject the message with the enhanced status code …
In my case I want to send the status code 550 5.7.1 – Blocked, Marked as spam, Authentication
It will accept here only the enhanced status code single DSN (Delivery Status Notification) of 5.7.1
If you try to enter here the whole 550 5.7.1 status code it will appear the following error message apart from that the characters are limited:
The value you entered can’t be saved because it contains the following character: ‘5’. To save this, you must first configure a custom delivery status notification with this status code.
So just use the single DSN (Delivery Status Notification) code!
Sender which blocked by the policy will receive from now on the following NDR message back.
Links
Email non-delivery reports and SMTP errors in Exchange Online
https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/non-delivery-reports-in-exchange-online/non-delivery-reports-in-exchange-online