Attachment Issues

Block Outgoing Email Attachments by File Extension in Microsoft 365

Camila MilosovichCamila Milosovich Nov 22, 2026 868 views

Question details

Prevent users in an organization from sending email attachments with specified file-name extensions.

Block Outgoing Email Attachments by File Extension in Microsoft 365
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.
Before you start

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.

Solution 1Recommended

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.

1
Open mail flow rules

Go to the Exchange admin center at admin.exchange.microsoft.com, then select Mail flow > Rules. Choose Add a rule > Create a new rule.

2
Add the attachment condition

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.

3
Limit the sender and recipient scope

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.

4
Choose the rejection action

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.

5
Test and enforce the rule

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.

Create an Exchange Online mail flow rule to reject matching attachments
The whole message is rejected: The reject action blocks the message rather than removing only the attachment. Test archive and encrypted attachment scenarios separately; an extension condition should not be assumed to inspect every file contained inside them.
Free Microsoft Office alternative

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.

Create and edit files that can be shared as email attachmentsCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXFamiliar interface for working with existing Office filesFree and lightweight for everyday document tasks
microsoft office alternative - wps office

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.