[IMP] mail: split multi-emails partners for outgoing emails
PURPOSE Be defensive when dealing with email fields, notably when having multi-emails or email field containing an already-formatted email. SPECIFICATIONS When building the final 'email_to' of outgoing emails using 'formataddr' we have issues if email contains multi emails or formatted email. Main fix of this commit is to extract emails and rebuild the 'email_to' list based on found emails. E.g. partner Raoul - email: "Raoul" <raoul@raoul.fr> -> before: to: "Raoul" <"Raoul" <raoul@raoul.fr>> (double format) -> after: to: "Raoul" <raoul@raoul.fr> E.g. partner Raoul - email: raoul1@raoul.fr, raoul2@raoul.fr -> before: to: "Raoul" <raoul1@raoul.fr, raoul2@raoul.fr> single email with multiple emails, depends on server fault tolerance) -> after: to: "Raoul" <raoul1@raoul.fr>, "Raoul" <raoul2@raoul.fr> multi emails Fix that computation by using all normalized emails found in 'email' fields and rebuilding a formatted email based on name + those emails. We do not use `email_formatted` as it is not really multi-enabled. We prefer a local defensive approach to be as tolerant as possible with respect to user inputs. Task-2612945 (Mail: Defensive email formatting) Part-of: odoo/odoo#74474
Showing
- addons/mail/models/mail_mail.py 8 additions, 1 deletionaddons/mail/models/mail_mail.py
- addons/test_mail/tests/test_mail_composer.py 8 additions, 0 deletionsaddons/test_mail/tests/test_mail_composer.py
- addons/test_mail/tests/test_mail_mail.py 10 additions, 6 deletionsaddons/test_mail/tests/test_mail_mail.py
- addons/test_mail/tests/test_message_post.py 5 additions, 4 deletionsaddons/test_mail/tests/test_message_post.py
- addons/test_mass_mailing/tests/test_mailing.py 2 additions, 0 deletionsaddons/test_mass_mailing/tests/test_mailing.py
Loading
Please register or sign in to comment