Skip to content
Snippets Groups Projects
  • Thibault Delavallée's avatar
    a70327da
    [IMP] tools, base, mail: better support non-ascii / IDNA when normalizing · a70327da
    Thibault Delavallée authored
    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
    a70327da
    History
    [IMP] tools, base, mail: better support non-ascii / IDNA when normalizing
    Thibault Delavallée authored
    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