[IMP] tools, base, mail: better support non-ascii / IDNA when normalizing
PURPOSE Be defensive when dealing with email fields, notably when having multi-emails or email field containing an already-formatted email. SPECIFICATIONS As of rfc5322 section 3.4.1 local-part is case-sensitive. However most main providers do consider the local-part as case insensitive. With the introduction of smtp-utf8 within odoo, this assumption is certain to fall short for international emails. We now consider that * if local part is ascii: normalize still 'lower' ; * else: use as it, SMTP-UF8 is made for non-ascii local parts; Concerning domain part of the address, as of v14 international domain (IDNA) are handled fine. The domain is always lowercase, lowering it is fine as it is probably an error. With the introduction of IDNA, there is an encoding that allow non-ascii characters to be encoded to ascii ones, using 'idna.encode'. Also remove usage of 'email_re' in mailing email check. It is too restrictive compared to real formatting we support (or try to). Valid outgoing emails were directly canceled, notably when containing unicode. Task-2612945 (Mail: Defensive email formatting) Part-of: odoo/odoo#74474
Showing
- addons/mass_mailing/wizard/mail_compose_message.py 1 addition, 1 deletionaddons/mass_mailing/wizard/mail_compose_message.py
- addons/test_mass_mailing/tests/test_mailing.py 4 additions, 2 deletionsaddons/test_mass_mailing/tests/test_mailing.py
- odoo/addons/base/tests/test_mail.py 30 additions, 3 deletionsodoo/addons/base/tests/test_mail.py
- odoo/tools/mail.py 30 additions, 10 deletionsodoo/tools/mail.py
Loading
Please register or sign in to comment