OdooWiki OCA HUB

Email gateway - folders

fetchmail_attach_from_folder folder_open OCA/server-tools open_in_new
Tools License: AGPL-3

Adds the possibility to attach emails from a certain IMAP folder to objects, ie partners. Matching is done via several algorithms, ie email address, email address's domain or the original Odoo algorithm.

This gives a simple possibility to archive emails in Odoo without a mail client integration.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Fetch emails from specific IMAP folders and automatically attach them to existing Odoo records (like partners or sales orders) based on matching rules. You can also manually attach flagged emails to any record.

This module extends Odoo's incoming mail server configuration with a new "Folders to monitor" tab. For each IMAP folder you can define a separate rule: which folder to read, where to archive processed emails, which Odoo model to attach them to, and how to match emails to records.

Matching can be done by exact email address, by email domain, or using Odoo's standard threading algorithm. You can restrict matches with a domain filter, choose to use only the first match if several are found, and decide whether to delete, flag, or mark emails as seen after processing. You can also limit fetching to unread emails or only the last 24 hours.

Once a folder is confirmed, you can fetch emails immediately with a button, or they will be fetched automatically when the server runs. Matched emails are attached as messages to the target record, and an optional server action can run on that record. Non-matching emails can be flagged for manual handling.

A manual wizard lets you review flagged emails and attach them to any record by hand. The module adds the fetchmail.server.folder model and a manual attachment wizard, and modifies the fetchmail.server form view.

Depends on

mail
Models and fields (4)
  • fetchmail.server · extends an existing modelobject_id, folder_ids (Folders), server_type, folders_only (Process Only Specified Folders), folders_available (Available folders)
  • fetchmail.server.folder · new modelpath (Fetch from Folder), seen (Mark email as seen), state (Status), active, domain (Matching Domain), model_id (Target Model), sequence, action_id (Server Action), msg_state (Message state), server_id, mail_field (Email Field), match_first (Use First Match), model_field, model_order, archive_path (Archive Folder), delete_matching (Delete Matched Emails), match_algorithm (Matching Algorithm), flag_nonmatching (Flag Non-Matching Emails), fetch_unseen_only, fetch_last_day_only (Fetch Last 24 Hours Only)
  • fetchmail.attach.mail.manually · new modelname, mail_ids, folder_id
  • fetchmail.attach.mail.manually.mail · new modelbody, date, subject, object_id, wizard_id, email_from (From), message_uid (Message id)

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 3 confirmed, 6 with no information of 9 versions.

Sources · Odoo 16.0

Confirmed on 2026-11-03 in branch 16.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 18.0

In your fetchmail configuration, you'll find a new list field Folders to monitor. Add your folders here in IMAP notation (usually something like INBOX.your_folder_name.your_subfolder_name), choose a model to attach mails to and a matching algorithm to use.

Exact mailaddress

Fill in a field to search for the email address in Field (model). For partners, this would be email. Also fill in the header field from the email to look at in Field (email). If you want to match incoming mails from your customers, this would be from. You can also list header fields, so to match partners receiving this email, you might fill in to,cc,bcc.

Domain of email addresses

Match the domain of the email address(es) found in Field (email). This would attach a mail to test1@example.com to a record with Field (model) set to test2@example.com. Given that this is a fuzzy match, you probably want to check Use 1st match, because otherwise nothing happens if multiple possible matches are found.

Odoo standard

This is stricly speaking no matching algorithm, but calls the model's standard action on new incoming mail, which is usually creating a new record.

A widespread configuration is to have a shared mailbox with several folders, i.e. one where users drop mails they want to attach to partners. Let this folder be called From partners. Then create a folder configuration for your server with path "INBOX.From partners" (note the quotes because of the space, this is server dependent). Choose model Partners, set Field (model) to email and Field (email) to from. In Domain, you could fill in [('customer', '=', True)] to be sure to only match customer records.

Now when your users drop mails into this folder, they will be fetched by Odoo and attached to the partner in question. After some testing, you might want to check Delete matches in your folder configuration so that this folder doesn't grow indefinitely.

Another way to prevent having to process ever more messages from the folder to read is to automatically move all processed messages to an archive folder that can be specified.

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.