Attachment MIME Type Restriction
by Quartile https://github.com/OCA/social , Odoo Community Association (OCA) https://github.com/OCA/social| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 279 |
| Technical Name |
attachment_mimetype_restriction |
| License | AGPL-3 |
| Website | https://github.com/OCA/social |
Attachment MIME Type Restriction

This module restricts attachment uploads to an explicit allowlist of MIME types using content-based detection rather than filename extensions. Only configured MIME types are accepted; everything else is rejected. Leaving the allowlist empty disables the restriction and allows all file types.
For incoming emails, the email itself is always accepted, but any attachments whose MIME type is not in the allowlist are stripped out before the message is saved. A security notice is then posted on the related record listing the removed files, so users can see what was filtered.
Table of contents
Configuration
Global Configuration (Company-wide):
- Go to Settings → General Settings
- In the “Allowed Attachment Types” field, enter comma-separated MIME types
- Example: image/png,application/pdf
- Leave empty to allow all file types
Per-Model Configuration (Optional):
- Go to Settings → Technical → Database Structure → Models
- Select a model (e.g., “Contact” for res.partner)
- In the “Allowed Attachment Types” field, enter comma-separated MIME types
- Empty value = use global config; set value = override global config
Configuration Hierarchy:
Per-model settings override global settings when defined.
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Authors
- Quartile
Contributors
- Quartile <<https://www.quartile.co>> - Aung Ko Ko Lin
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
Current maintainers:

This module is part of the OCA/social project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Please log in to comment on this module