[FIX] mail: use strict email matching for bounces
When a bounce is received, we look for matching partners in order to increment the bounce counter. However by using [`ilike','email`] we carry the risk of matching emails that contain the bounce email: ['email', 'ilike', 'john@hitmail.com´] will also match 'random.john@hitmail.com' for example. Using strict equality is safer, and the worst that can happen is that we fail to count one bounce.
This commit is contained in:
@@ -1171,7 +1171,7 @@ class MailThread(models.AbstractModel):
|
||||
final_recipient_data = tools.decode_message_header(dsn, 'Final-Recipient')
|
||||
partner_address = final_recipient_data.split(';', 1)[1].strip()
|
||||
if partner_address:
|
||||
partners = partners.sudo().search([('email', 'like', partner_address)])
|
||||
partners = partners.sudo().search([('email', '=', partner_address)])
|
||||
for partner in partners:
|
||||
partner.message_receive_bounce(partner_address, partner, mail_id=bounced_mail_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user