Added exception handling for setting up the smtp connection.

Without the exception handling, a stacktrace is thrown. This resulted in postprocessing failing when e-mailing was not configured properly, resulting in all kind of unexpected behavior, like for ex. source files not cleaned up properly.
This commit is contained in:
P0psicles 2016-01-06 10:52:48 +01:00
parent 1cf0b5f9b2
commit 9bd7e6eb17

View file

@ -176,7 +176,12 @@ class EmailNotifier:
def _sendmail(self, host, port, smtp_from, use_tls, user, pwd, to, msg, smtpDebug=False):
logger.log('HOST: %s; PORT: %s; FROM: %s, TLS: %s, USER: %s, PWD: %s, TO: %s' % (
host, port, smtp_from, use_tls, user, pwd, to), logger.DEBUG)
srv = smtplib.SMTP(host, int(port))
try:
srv = smtplib.SMTP(host, int(port))
except Exception as e:
self.last_err = '%s' % e
return False
if smtpDebug:
srv.set_debuglevel(1)
try: