odoo/odoo#189409

Created by Marketing, Thibault Delavallee (tde)
Merged at bdccc578f4c5d85a16647dec28a9f5fba8155afa

Statuses:

label
odoo-dev:16.0-mail-validation-tde
head
425e213047c64ab92fb4b68f9cccd75266c86ec4
merged
1 year ago by Marketing, Thibault Delavallee (tde)
odoo/odoo
16.0 #189409
17.0 #190033
saas-17.2 #190504
saas-17.4 #190531
18.0 #190588
saas-18.2
saas-18.3
saas-18.4
19.0
master #190594

[FIX] mail: normalized when formatting email_to / email_cc

When preparing final outgoing email, partner email is normalized. We take their formatted email, which is their name and their normalized email. However email_to and email_cc are taken from input using 'email_split(_and_format)', which finds emails but do not format them.

This leads to incoherent behavior as most emails are normalized as we generally always use partners, but not all. In this commit we now split, normalize and format email_to and email_cc in outgoing emails.

This fixes a first issue where name are lost if a formatted email was entered in email_cc field. Only address was kept, now the name is correctly found and put back.

This also fixes an issue for validated email detection, in order to compare normalized emails. This was introduced at #185793 and may skip valid emails entered in email_to or email_cc.

This commit backports a tool introduced at dd4709e579841672b0c2a57d5f2941f3ce770801 which aims at allowing a quick convert from a string holding emails to a list of nicely formatted emails, using normalize version of email addresses. This is the standard we use in most flows.

task-4376876
Followup of task-3704658