Thank you for asking this question on the Microsoft Q&A Platform.
You can block sending mail to a specific domain by creating a mail flow rule. The mail flow rule can be created in the Exchange admin center (EAC) or by using PowerShell.
EAC
To create a mail flow rule in the EAC, follow these steps:
- Sign in to the Exchange admin center (EAC).
- In the left navigation pane, select Protection > Mail flow rules.
- Click + and select Create a new rule.
- On the New rule page, enter a name for the rule in the Name box.
- In the Apply this rule if… section, select The recipient is and then select Domain is.
- In the Do the following… section, select Reject the message with the explanation and enter a custom message in the text box.
- Click Save.
PowerShell
To create a mail flow rule by using PowerShell, follow these steps:
- Open PowerShell.
- Connect to Exchange Online by using the following command:
Connect-ExchangeOnline -UserPrincipalName <UPN> -ShowProgress $true
- Create a new mail flow rule by using the following command:
New-TransportRule -Name "Block email to a specific domain" -RecipientDomainIs "<Domain>" -RejectMessageReasonText "<Custom message>"
Replace <UPN>
with the user principal name of the user who has Exchange Online admin permissions and <Domain>
with the domain that you want to block. Replace <Custom message>
with the message that you want to display to senders when they try to send an email to the blocked domain.
Sources:
- https://learn.microsoft.com/en-us/exchange/security-and-compliance/mail-flow-rules/mail-flow-rules
- https://learn.microsoft.com/en-us/exchange/security-and-compliance/mail-flow-rules/manage-mail-flow-rules
Hope this helps!
Accept Answer and Upvote, if any of the above helped, this thread can help others in the community looking for remediation for similar issues.
NOTE: To answer you as quickly as possible, please mention me in your reply.