[FIX] base: fix 'extract_rfc2822_addresses' in case of email-like name
Remove quotes when name of a formatted email is also an email, as indicated in tests. We still get two emails being sent for a given outgoing email when the name part is an email but that would be difficult to avoid. Task-3566542 closes odoo/odoo#141856 X-original-commit: odoo/odoo@d3cdaa6c18 Related: odoo/enterprise#50892 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -1982,7 +1982,7 @@ class TestComposerResultsComment(TestMailComposer, CronMixinCase):
|
||||
)
|
||||
# to check behavior of extract_rfc2822_addresses
|
||||
if recipient == new_partner:
|
||||
smtp_to_list = ['"test.to.1@test.example.com"', 'test.to.1@test.example.com']
|
||||
smtp_to_list = ['test.to.1@test.example.com', 'test.to.1@test.example.com']
|
||||
else:
|
||||
smtp_to_list = [recipient.email_normalized]
|
||||
if exp_alias_domain == self.mail_alias_domain:
|
||||
@@ -2788,7 +2788,7 @@ class TestComposerResultsMass(TestMailComposer):
|
||||
for recipient in recipients:
|
||||
# to check behavior of extract_rfc2822_addresses
|
||||
if recipient == new_partner:
|
||||
smtp_to_list = ['"test.to.1@test.example.com"', 'test.to.1@test.example.com']
|
||||
smtp_to_list = ['test.to.1@test.example.com', 'test.to.1@test.example.com']
|
||||
else:
|
||||
smtp_to_list = [recipient.email_normalized]
|
||||
if exp_alias_domain == self.mail_alias_domain:
|
||||
|
||||
@@ -64,7 +64,7 @@ smtplib.stderr = WriteToLogger()
|
||||
def is_ascii(s):
|
||||
return all(ord(cp) < 128 for cp in s)
|
||||
|
||||
address_pattern = re.compile(r'([^ ,<@]+@[^> ,]+)')
|
||||
address_pattern = re.compile(r'([^" ,<@]+@[^>" ,]+)')
|
||||
|
||||
def extract_rfc2822_addresses(text):
|
||||
"""Returns a list of valid RFC2822 addresses
|
||||
|
||||
@@ -763,9 +763,9 @@ class TestEmailTools(BaseCase):
|
||||
('"Admin" <admin@example.com>, Demo <malformed email>', ['admin@example.com']),
|
||||
('admin@éxample.com', ['admin@xn--xample-9ua.com']),
|
||||
# formatted input containing email
|
||||
('"admin@éxample.com" <admin@éxample.com>', ['admin@xn--xample-9ua.com']),
|
||||
('"admin@éxample.com" <admin@éxample.com>', ['admin@xn--xample-9ua.com', 'admin@xn--xample-9ua.com']),
|
||||
('"Robert Le Grand" <robert@notgmail.com>', ['robert@notgmail.com']),
|
||||
('"robert@notgmail.com" <robert@notgmail.com>', ['"robert@notgmail.com"', 'robert@notgmail.com']),
|
||||
('"robert@notgmail.com" <robert@notgmail.com>', ['robert@notgmail.com', 'robert@notgmail.com']),
|
||||
# accents
|
||||
('DéBoulonneur@examplé.com', ['DéBoulonneur@xn--exampl-gva.com']),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user