From 7f29a231186deb1856098d81703848ab6b24328c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 16 Dec 2015 17:06:46 +0100 Subject: [PATCH] [FIX] tools: email TLDs can be longer than 6 chars According to the RFC1034 https://tools.ietf.org/html/rfc1034 A TLD can use up to 63 octets. The regex checking that an email address is valid should there allow emails using a TLD with such a length. Besides, the use of TLD domains exceeding 6 characters is more and more common, nowadays. e.g. using a domain `.amsterdam` opw-660014 --- openerp/tools/mail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index 20d6117e778..40a52a42b5f 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -603,10 +603,10 @@ def append_content_to_html(html, content, plaintext=True, preserve=False, contai #---------------------------------------------------------- # matches any email in a body of text -email_re = re.compile(r"""([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})""", re.VERBOSE) +email_re = re.compile(r"""([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63})""", re.VERBOSE) # matches a string containing only one email -single_email_re = re.compile(r"""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$""", re.VERBOSE) +single_email_re = re.compile(r"""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$""", re.VERBOSE) res_re = re.compile(r"\[([0-9]+)\]", re.UNICODE) command_re = re.compile("^Set-([a-z]+) *: *(.+)$", re.I + re.UNICODE)