diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index e6b471a26ba..f98ecc9dbd9 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -320,14 +320,12 @@ def append_content_to_html(html, content, plaintext=True, preserve=False, contai # Emails #---------------------------------------------------------- -email_re = re.compile(r""" - ([a-zA-Z][\w\.-]*[a-zA-Z0-9] # username part - @ # mandatory @ sign - [a-zA-Z0-9][\w\.-]* # domain must start with a letter ... Ged> why do we include a 0-9 then? - \. - [a-z]{2,3} # TLD - ) - """, re.VERBOSE) +# 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) + +# 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) + res_re = re.compile(r"\[([0-9]+)\]", re.UNICODE) command_re = re.compile("^Set-([a-z]+) *: *(.+)$", re.I + re.UNICODE)