[FIX] base: traceback on testing outgoing mail server connection

- Settings > Technical > Email > Outgoing Mail Servers;
- Create a new serve with no security;
- Test connection.

Before this commit,  a traceback error is raised. This occurs because
SMTPException don't have 'smtp_error'.

Now, the UserError is shown correctly.

opw-2464796

closes odoo/odoo#67712

X-original-commit: f0e478a154b1f15146c7d95e0ffe146bb22b8cae
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2021-03-11 16:44:30 +00:00
parent 24d9b5990e
commit 304eef3ced
+1 -1
View File
@@ -146,7 +146,7 @@ class IrMailServer(models.Model):
except smtplib.SMTPResponseException as e:
raise UserError(_("Server replied with following exception:\n %s", ustr(e.smtp_error)))
except smtplib.SMTPException as e:
raise UserError(_("An SMTP exception occurred. Check port number and connection security type.\n %s", ustr(e.smtp_error)))
raise UserError(_("An SMTP exception occurred. Check port number and connection security type.\n %s", ustr(e)))
except SSLError as e:
raise UserError(_("An SSL exception occurred. Check connection security type.\n %s", ustr(e)))
except Exception as e: