From b24e37db6383af1f2cf9f99e75a0c065fd329210 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 10 Sep 2013 16:38:09 +0200 Subject: [PATCH] [FIX] ir.mail_server: be more lenient when validating From address When a user has their email as name, the system will construct the From header as "email". We previously forbade this, because the naive check only counts the number of emails in the From header. We might need to drop that assert or implement something better in the future. bzr revid: odo@openerp.com-20130910143809-wu32dkz20es579nv --- openerp/addons/base/ir/ir_mail_server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_mail_server.py b/openerp/addons/base/ir/ir_mail_server.py index 22bed1db95c..7e691a6eedd 100644 --- a/openerp/addons/base/ir/ir_mail_server.py +++ b/openerp/addons/base/ir/ir_mail_server.py @@ -402,7 +402,8 @@ class ir_mail_server(osv.osv): # The email's "Envelope From" (Return-Path), and all recipient addresses must only contain ASCII characters. from_rfc2822 = extract_rfc2822_addresses(smtp_from) - assert len(from_rfc2822) == 1, "Malformed 'Return-Path' or 'From' address - it may only contain plain ASCII characters" + assert len(set(from_rfc2822)) == 1, ("Malformed 'Return-Path' or 'From' address: %r - " + "It should contain one plain ASCII email") % smtp_from smtp_from = from_rfc2822[0] email_to = message['To'] email_cc = message['Cc']