his detailed technical guide explains how to allow email communication only with specific domains and block all other domains in Microsoft 365 Business Basic, using Mail Flow (Transport) Rules in the Exchange Admin Center.
It also covers restricting email attachment size using the same rule engine.
Many organizations want to:
Allow emails only with trusted domains (banks, vendors, partners)
Block all other external incoming and outgoing emails
Prevent data leakage
Control attachment sizes (e.g., max 512 KB)
Mail Flow Rules (Transport Rules) are the most secure and license-independent way to achieve this in Microsoft 365 Business Basic.
Microsoft 365 Business Basic or higher
Global Admin or Exchange Admin role
Access to Exchange Admin Center
Microsoft 365 Admin Center
β Exchange Admin Center
β Mail Flow
β Rules
Allow emails from selected domains only
Block emails from all other external domains
Login to admin.microsoft.com
Go to Exchange Admin Center
Navigate to Mail flow β Rules
Click + Add rule β Create a new rule
Apply this rule if β The recipient
Is external/internal β Inside the organization
And β The sender
Is external/internal β Outside the organization
This ensures the rule applies only to incoming external emails.
Do the following β Block the message
Reject the message and include an explanation
Message shown to sender:
And β Block the message
Reject the message with enhanced status code
β‘ This tells sending servers the message was intentionally rejected by policy.
The sender
Domain is
Add allowed domains one by one:
β Emails from these domains will be allowed
β All other external domains will be blocked
Click Save
Users can send emails only to approved domains
Prevent accidental data leakage
Mail flow β Rules β + Add rule
Apply this rule if β The recipient
Is external/internal β Outside the organization
And β The sender
Is external/internal β Inside the organization
Block the message
Reject with explanation
The recipient
Domain is
β Users can send emails only to these domains
β All other outgoing emails are blocked
Limit email attachment size (example: 512 KB)
Apply this rule if
Any attachment
Size is greater than
Reject the message
Explanation:
Enhanced Status Code
Ensure rules are ordered correctly:
Allow email communication (incoming)
Allow email communication (outgoing)
Email attachment size restriction
Block incoming emails
Block outgoing emails
β‘ Allow rules must be above block rules.
β Use domain-based exceptions (not individual emails)
β Always use Enhanced Status Code 5.7.1
β Test rules using a pilot mailbox
β Document allowed domains internally
β Review rules quarterly
β Forgetting exceptions β blocks everything
β Wrong rule order β allowed emails get blocked
β Using mailbox-level rules instead of transport rules
Only approved domains can send and receive emails
All other domains are automatically rejected
Attachments above allowed size are blocked
Works with Microsoft 365 Business Basic
No extra license required
#Microsoft365 #ExchangeAdminCenter #MailFlowRules #EmailSecurity #Office365 #ExchangeOnline #DomainWhitelisting #EmailCompliance #CyberSecurity #ITAdmin #DataProtection #EmailPolicy #BusinessEmail #CloudSecurity #AttachmentRestriction #TransportRules #InfoSec #EmailGovernance #EnterpriseIT #SecurityBestPractices #MicrosoftAdmin #Office365Security #EmailControl #SpamPrevention #ITInfrastructure #SecureEmail #CompliancePolicy #MicrosoftExchange #EmailFiltering #ZeroTrust #CyberAwareness #ITSupport #EmailRestrictions #CloudAdmin #BusinessSecurity #ExchangeRules #EmailHardening #AttachmentPolicy #EmailFirewall #M365