From adf3052024e4c945a7fed148e78465820e9cfb93 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 8 Mar 2017 12:18:55 +0100 Subject: [PATCH] [FIX] ir.mail_server: make SMTP test consistent with the rest Simplifies the code and makes sure we are calling the connect() method in the same way we do for normal deliveries, and that all parameters are processed in the same fashion. --- odoo/addons/base/ir/ir_mail_server.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/odoo/addons/base/ir/ir_mail_server.py b/odoo/addons/base/ir/ir_mail_server.py index 21ed5502ce6..71f6c81a3fa 100644 --- a/odoo/addons/base/ir/ir_mail_server.py +++ b/odoo/addons/base/ir/ir_mail_server.py @@ -174,9 +174,7 @@ class IrMailServer(models.Model): for server in self: smtp = False try: - smtp = self.connect(server.smtp_host, server.smtp_port, user=server.smtp_user, - password=server.smtp_pass, encryption=server.smtp_encryption, - smtp_debug=server.smtp_debug) + smtp = self.connect(mail_server_id=server.id) except Exception as e: raise UserError(_("Connection Test Failed! Here is what we got instead:\n %s") % ustr(e)) finally: @@ -222,7 +220,8 @@ class IrMailServer(models.Model): smtp_port = tools.config.get('smtp_port', 25) if port is None else port smtp_user = user or tools.config.get('smtp_user') smtp_password = password or tools.config.get('smtp_password') - if encryption is None and tools.config.get('smtp_ssl'): + smtp_encryption = encryption + if smtp_encryption is None and tools.config.get('smtp_ssl'): smtp_encryption = 'starttls' # smtp_ssl => STARTTLS as of v7 if not smtp_server: