Skip to Content
Menu
This question has been flagged
1 Reply
199 Views

How can i prevent emails from incoming email server being created in the crm chatter?

Avatar
Discard
Best Answer

To prevent emails fetched from the incoming mail server from being automatically logged in the CRM chatter in Odoo, you can control this behavior at several levels, depending on your setup.


Here are the key options to prevent it


Option 1: Disable Auto-Followers or Auto-Threading

Odoo links incoming emails to existing records by matching the email's headers (Message-ID, References, etc.) or aliases. If you don’t want them to be added to the CRM chatter:


A. Remove aliases from CRM


Go to CRM > Configuration > Pipelines > Stages


Check if any alias is set up (like leads@yourdomain.com)


Remove or change the alias



B. Disable "Create a new record" in the alias settings


Go to Settings > Technical > Email > Aliases


Find the alias related to CRM


Set Action to Do nothing or Unlink it from CRM objects




---


Option 2: Modify Fetchmail or Mail Thread Behavior via Code


If you need finer control (e.g., allow emails in Helpdesk but not in CRM), override the mail handling logic:


Example: Override message_route or message_new to exclude CRM


from odoo.addons.mail.models.mail_thread import MailThread

from odoo import models


class CustomMailThread(MailThread):

    def message_route(self, message, message_dict, model=None, thread_id=None, custom_values=None):

        # Skip processing if it's for crm.lead

        if model == 'crm.lead':

            return []

        return super().message_route(message, message_dict, model, thread_id, custom_values)


This prevents emails from being routed to crm.lead.



---


Option 3: Use Domain Filtering in Incoming Mail Server


You can add filters to avoid processing certain messages altogether.


Go to Settings > Technical > Email > Incoming Mail Servers


Open your mail server


Add custom Python code in the Actions to Perform on Incoming Mails (e.g., skip based on subject or sender)




---


Option 4: Unsubscribe System from Threads


Sometimes, Odoo posts email replies to CRM because the system user is a follower. You can:


Disable automatic followers in CRM settings


Or programmatically unsubscribe users from records



lead.message_unsubscribe([user_id])



---


If you tell me how your mail server is configured or how you receive CRM messages (e.g., via alias, manually, automated integration), I can tailor the solution more precisely.



Avatar
Discard
Related Posts Replies Views Activity
4
May 25
1018
1
Apr 25
316
0
Mar 25
427
1
Sep 24
1354
0
Aug 24
743