From f32e8d5e77bdf31d765388960f69cd4d161c7c6c 2015-12-12 05:59:17 From: Miguel Valdez Date: 2015-12-12 05:59:17 Subject: [PATCH] Skip email notification if email or server are empty --- diff --git a/schainpy/admin.py b/schainpy/admin.py index 212bb38..b7ed04f 100644 --- a/schainpy/admin.py +++ b/schainpy/admin.py @@ -177,6 +177,12 @@ class SchainNotify: def sendEmail(self, email_from, email_to, subject='Error running ...', message="", subtitle="", filename="", html_format=True): + if not email_to: + return 0 + + if not self.__emailServer: + return 0 + msg = MIMEMultipart() msg['Subject'] = subject msg['From'] = "(Python SChain API): " + email_from