From 72598a465e14dc3c75c7c882d3ddeab27a96d929 2015-12-02 22:44:44 From: Miguel Valdez Date: 2015-12-02 22:44:44 Subject: [PATCH] admin.py: Catching error sending email. --- diff --git a/schainpy/admin.py b/schainpy/admin.py index ac5af84..212bb38 100644 --- a/schainpy/admin.py +++ b/schainpy/admin.py @@ -219,9 +219,14 @@ class SchainNotify: smtp.login(self.__emailFromAddress, self.__emailPass) # Send the email - smtp.sendmail(msg['From'], msg['To'], msg.as_string()) + try: + smtp.sendmail(msg['From'], msg['To'], msg.as_string()) + except: + print "***** Could not send the email to %s *****" %msg['To'] + smtp.quit() + return 0 + smtp.quit() - smtp.close() return 1