OCA / social

Addons concerning odoo's social ERP features and messaging in general
https://odoo-community.org/project/99
GNU Affero General Public License v3.0
162 stars 615 forks source link

[17.0] mail_tracking starting endless email loop #1414

Open Bart-dh opened 4 months ago

Bart-dh commented 4 months ago

module: mail_tracking version: 17.0 EE Odoo.sh hosting

For some reason unknown to me, at some point when sending an email, catchall@test.odoo.com gets added as recipient, resulting in the sent mail returning to Odoo immediately, and starting an endless email loop. A client of ours sent 21k emails this weekend to a supplier because of this loop.

Note that the reply-to is catchall@test.com instead of catchall@test.odoo.com, so I don't know where the default catchall comes from. I have noticed that the module also adds extra suggested recipients though, so maybe this is related.

I have no proof that this module caused the issue, other than it started after installation, and does not happen anymore after deinstallation.

Bart-dh commented 4 months ago

@chienandalu

chienandalu commented 4 months ago

Hi, @Bart-dh

It could be that the original mail had that catchall@test.odoo.com in the extra recipients, which are added to the suggested recipients for the message replies: https://github.com/OCA/social/blob/27f38091da019420b4599c978295d4fd0094e76a/mail_tracking/models/mail_thread.py#L65-L73

We try to dectect the existing aliases:

https://github.com/OCA/social/blob/27f38091da019420b4599c978295d4fd0094e76a/mail_tracking/models/mail_thread.py#L77

In order to discard them

https://github.com/OCA/social/blob/27f38091da019420b4599c978295d4fd0094e76a/mail_tracking/models/mail_thread.py#L90-L94

This is where we retrieve them (in v17 there's a new way to set the catchall with the mail.alias.domain records that allow multi-domain catchalls): https://github.com/OCA/social/blob/27f38091da019420b4599c978295d4fd0094e76a/mail_tracking/models/mail_alias.py#L10-L23

Also check if a partner could have that catchall email set, as it could be that is assigning it directly: https://github.com/OCA/social/blob/27f38091da019420b4599c978295d4fd0094e76a/mail_tracking/models/mail_thread.py#L85-L86

Bart-dh commented 3 months ago

@chienandalu what is the reason for adding extra suggested recipients? To me it looks like extra functionality which is irrelevant to the rest of this module, but I could be mistaken

pedrobaeza commented 3 months ago

It's inside the scope, as Odoo is not considering CC unless a contact matching the email address exists, and this module does it.