Block Outgoing Email Attachments by File Extension in Microsoft 365
Question details
Prevent users in an organization from sending email attachments with specified file-name extensions.

- Product
- Microsoft 365 Business and Exchange Online
- Device & OS
- not provided
- Scenario
- An administrator wants to restrict which attachment types can be sent from the organization.
- Observed behavior
- Messages containing attachments with listed extensions should be blocked before delivery.
Sign in to the Exchange admin center with an account that can manage mail flow rules. Prepare the list of extensions to block and decide whether the rule should apply to all messages sent by internal users or only messages sent outside the organization.
Create an Exchange Online mail flow rule to reject matching attachments
Use this rule to reject messages from your organization when an attachment has a listed file extension.
Go to the Exchange admin center at admin.exchange.microsoft.com, then select Mail flow > Rules. Choose Add a rule > Create a new rule.
Enter a name for the rule. Under Apply this rule if, select Any attachment > File extension matches these words, and enter the extensions to block, such as exe or bat.
Add a condition for The sender > Is internal/external and select Inside the organization. If you only want to block messages sent externally, also add The recipient > Is internal/external and select Outside the organization.
Under Do the following, select Block the message > Reject the message and include an explanation. Enter a message telling the sender which attachment types are not allowed.
Continue to the rule settings, select a test mode, and save the rule. Send representative messages with blocked and permitted extensions, then review the results. Edit the rule and select Enforce when it is ready to reject matching messages.

Edit Office attachments with WPS Office
WPS Office is a free, lightweight alternative for creating and editing documents, spreadsheets, and presentations. Its familiar interface and Office format compatibility make it easier to move existing files between applications. Exchange Online still manages attachment blocking.

Frequently Asked Questions
Can I block attachments only when users send email outside the organization?
Yes. In Mail flow > Rules, add a sender condition for Inside the organization and a recipient condition for Outside the organization alongside the attachment extension condition.
Does the rule remove the attachment or reject the entire email?
The Reject the message action rejects the entire message. You can include an explanation so the sender knows why it was blocked.
How can I test the rule without rejecting messages?
In the rule settings, select a test mode and save the rule. Send messages with representative blocked and permitted extensions, review the results, and change the rule mode to Enforce when ready.
Will an extension rule detect every file inside a ZIP archive?
Do not assume the attachment extension condition will inspect every nested file. Test archive scenarios separately and review your organization's additional attachment filtering policies.




