[FIX] mass_mailing : returns set of normalized email in _get_opt_out_list

If a recipient has a formatted email address like 'A <a@b.com>', the returned
opt_out list must contain normalized email ('a@b.com') in order to be comparable
during the get_mail_values of the mail.compose.message.
Otherwize, It won't match.

Task ID : 1909314
Closes PR #28667
This commit is contained in:
David Beguin
2018-11-14 11:23:44 +00:00
parent 6b9625e098
commit 3715104e98
+2 -1
View File
@@ -767,7 +767,8 @@ class MassMailing(models.Model):
[('list_id', 'in', self.contact_list_ids.ids)])
opt_out_contacts = target_list_contacts.filtered(lambda rel: rel.opt_out).mapped('contact_id.email')
opt_in_contacts = target_list_contacts.filtered(lambda rel: not rel.opt_out).mapped('contact_id.email')
opt_out = set(c for c in opt_out_contacts if c not in opt_in_contacts)
normalized_email = [tools.email_split(c) for c in opt_out_contacts if c not in opt_in_contacts]
opt_out = set(email[0].lower() for email in normalized_email if email)
_logger.info(
"Mass-mailing %s targets %s, blacklist: %s emails",