how to block external mails in 365 emails

Mr. Shivkumar Kashyap 0 Reputation points

I want to block all the domain for email outgoing and want to allow to particular domain for email

Microsoft Exchange Online
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
3,718 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Carlos Solís Salazar 13,071 Reputation points

    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.


    To create a mail flow rule in the EAC, follow these steps:

    1. Sign in to the Exchange admin center (EAC).
    2. In the left navigation pane, select Protection > Mail flow rules.
    3. Click + and select Create a new rule.
    4. On the New rule page, enter a name for the rule in the Name box.
    5. In the Apply this rule if… section, select The recipient is and then select Domain is.
    6. In the Do the following… section, select Reject the message with the explanation and enter a custom message in the text box.
    7. Click Save.


    To create a mail flow rule by using PowerShell, follow these steps:

    1. Open PowerShell.
    2. Connect to Exchange Online by using the following command:
    Connect-ExchangeOnline -UserPrincipalName <UPN> -ShowProgress $true
    1. 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.


    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.

    0 comments No comments