Odoo Community Association

Attachment MIME Type Restriction

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

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):

  1. Go to Settings → General Settings
  2. In the “Allowed Attachment Types” field, enter comma-separated MIME types
  3. Example: image/png,application/pdf
  4. Leave empty to allow all file types

Per-Model Configuration (Optional):

  1. Go to Settings → Technical → Database Structure → Models
  2. Select a model (e.g., “Contact” for res.partner)
  3. In the “Allowed Attachment Types” field, enter comma-separated MIME types
  4. 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

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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:

yostashiro aungkokolin1997

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.