summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorJairo Llopis <jairo.llopis@tecnativa.com>2020-04-16 12:34:38 +0000
committerPedro M. Baeza <pedro.baeza@tecnativa.com>2021-01-14 09:23:15 +0000
commitfda91de992cb96f0a867844cd2a356ab98e8f80e (patch)
tree262100428cdd2de0aa955b1b20a50e580aeb21e5 /addons/mail/models/mail_thread.py
parent3c5296863f0030acc5d3dba0ff73a6f1b42d1255 (diff)
[FIX] mail: Do not consider reply if no "To:" is found
If an email was sent with empty "To:" and a proper alias in "CC:" (or any of the similar valid headers that conform the `rpc_tos_localparts` array), before 40ae36b7f8c412cd96dc9592d8d1fb90de1e52d2 the email wouldn't get rejected. After that commit it would get bounced. This comes from the not-so-obvious new python idiom used, `all()`. Check this out: ```python >>> all([False]) False >>> all([]) True ``` So, apart from the fix introduced in that commit, which seems valid, we have to make sure `email_to_localparts` actually has contents. Otherwise we are producing false bounces here. @Tecnativa TT23437 closes odoo/odoo#64522 X-original-commit: 8f094d3c01a6ad150b7945115cda515dbde1f4bc Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index a581075cfbf..f9a50041dc0 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -978,7 +978,7 @@ class MailThread(models.AbstractModel):
message_dict.pop('parent_id', None)
# check it does not directly contact catchall
- if catchall_alias and all(email_localpart == catchall_alias for email_localpart in email_to_localparts):
+ if catchall_alias and email_to_localparts and all(email_localpart == catchall_alias for email_localpart in email_to_localparts):
_logger.info('Routing mail from %s to %s with Message-Id %s: direct write to catchall, bounce', email_from, email_to, message_id)
body = self.env.ref('mail.mail_bounce_catchall')._render({
'message': message,