How to Allow DOCX, XLSX, APP, and Other File Extensions in MailScanner

Introduction

MailScanner is a popular email security solution used on Linux and cPanel servers to protect users from spam, malware, viruses, and potentially dangerous email attachments. By default, MailScanner blocks certain file types based on predefined security rules to prevent malicious files from reaching users’ inboxes.

However, there are situations where legitimate business files such as Microsoft Word documents (.docx), Excel spreadsheets (.xlsx), application packages (.app), or other custom file formats need to be sent and received through email. In such cases, administrators must modify MailScanner’s configuration to allow specific file extensions.

This guide explains two methods for allowing blocked file extensions in MailScanner, either for a single domain or server-wide for all domains hosted on the server.


Solution 1: Disable MailScanner Protection for a Specific Domain

If only one domain needs to send or receive restricted file types, the easiest solution is to disable MailScanner scanning for that domain.

Steps

  1. Log in to cPanel.
  2. Navigate to:
Email → MailScanner Configuration
  1. Locate the domain name.
  2. Under the Spam Scanning option, select:
No
  1. Under the Virus Scanning option, select:
No
  1. Save the configuration.

Result

MailScanner will no longer scan emails for that domain, allowing users to send and receive all file types without attachment restrictions.

Note: This method reduces email security for the selected domain and should only be used when necessary.


Solution 2: Allow Specific File Extensions Server-Wide

If you want all domains hosted on the server to send and receive specific file types, update the MailScanner filename rules.

Step 1: Connect to the Server

Log in as root via SSH.

ssh root@server-ip

Step 2: Locate the MailScanner Rules File

On most cPanel servers:

/etc/MailScanner/filename.rules.conf

Some installations may use:

/etc/MailScanner/filename.rules.conf

Verify the exact file location before making changes.


Step 3: Edit the Configuration File

vi /etc/MailScanner/filename.rules.conf

Search for the section containing existing allow rules.


Step 4: Add the Required Extensions

To allow Microsoft Office files and other extensions, add:

allow \.docx$ - -
allow \.xlsx$ - -
allow \.app$ - -
allow \.x(ml)?\d{0,}\.rel$ - -

Additional examples:

allow \.pptx$ - -
allow \.csv$ - -
allow \.json$ - -
allow \.xml$ - -
allow \.zip$ - -

Important Formatting Note

When entering these rules:

allow \.docx$ - -

Use the TAB key between the fields.

Correct:

allow[TAB]\.docx$[TAB]-[TAB]-

Incorrect:

allow \.docx$ - -

Using spaces instead of tabs may cause MailScanner to ignore the rule.


Step 5: Restart MailScanner

After saving the file:

service MailScanner restart

or on newer systems:

systemctl restart MailScanner

Verify the Configuration

Send a test email containing one of the newly allowed file types:

  • .docx
  • .xlsx
  • .pptx
  • .app
  • .xml

If the message is delivered successfully, the configuration is working correctly.

You can also monitor MailScanner logs:

tail -f /var/log/maillog

or

tail -f /var/log/exim_mainlog

depending on your mail server configuration.


Conclusion

MailScanner provides strong protection against malicious email attachments, but legitimate business requirements may require certain file types to be allowed. Whether you need to permit attachments for a single domain or implement server-wide changes, MailScanner offers flexible configuration options through cPanel settings and filename rule definitions. By carefully allowing only the required extensions and maintaining antivirus protection, administrators can balance usability and security effectively.


Frequently Asked Questions (FAQ)

1. Why is MailScanner blocking DOCX and XLSX files?

MailScanner uses filename rules to prevent potentially dangerous attachments from being delivered. Some server administrators configure stricter policies that block Microsoft Office and compressed file formats by default.


2. Will allowing file extensions reduce email security?

Yes. Allowing additional file types increases the possibility of malicious files being delivered. It is recommended to allow only trusted file extensions and keep antivirus scanning enabled whenever possible.


3. Do I need to restart MailScanner after modifying filename.rules.conf?

Yes. Changes to MailScanner rules are not applied until the service is restarted.

systemctl restart MailScanner

or

service MailScanner restart

  1. Allow ZIP, TAR, and GZ Attachments in MailScanner
    Learn how to permit compressed archive file types in MailScanner without disabling email security entirely.
    Allow ZIP, TAR, and GZ Attachments in MailScanner
  2. Send an Email Using Telnet from Remote Servers
    Test SMTP connectivity and troubleshoot email delivery issues using Telnet commands directly from the server.
    Send an Email Using Telnet from Remote Servers
  3. Create an Email Account in cPanel
    Step-by-step guide for creating and managing email accounts through the cPanel interface.
    Create an Email Account in cPanel

 

admin

Writes about Cloud & AWS at Pheonix Solutions.

Leave a Reply

Scroll to Top