From 79f64cbe72e66aad28a6834076a6b1f7d3e85b99 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 14 Jun 2020 00:30:56 -0700 Subject: [PATCH] fixed handling of smtplib.SMTPException, thanks Paolo --- gluon/tools.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gluon/tools.py b/gluon/tools.py index 5b7221af..9fafd48e 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -819,13 +819,12 @@ class Mail(object): # do not want to hide errors raising some exception here try: server.quit() - except: - pass - # ensure to close any socket with SMTP server - try: - server.close() - except: - pass + except smtplib.SMTPException: + # ensure to close any socket with SMTP server + try: + server.close() + except Exception: + pass except Exception as e: logger.warning('Mail.send failure:%s' % e) self.result = result