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
153 stars 590 forks source link

[17.0] mail_tracking starting endless email loop #1414

Open Bart-dh opened 1 week ago

Bart-dh commented 1 week 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 1 week ago

@chienandalu

chienandalu commented 1 week 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