From fb752e6936283c239a78f3a11925591b00ca21de Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Fri, 18 Jan 2013 13:46:50 +0000 Subject: [PATCH] catch SMTP exception if any - issue #311 --- extra/shutils/regressiontest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/extra/shutils/regressiontest.py b/extra/shutils/regressiontest.py index cff76c84a..93c571de4 100644 --- a/extra/shutils/regressiontest.py +++ b/extra/shutils/regressiontest.py @@ -91,7 +91,11 @@ if CONTENT: attachment.add_header("Content-Disposition", "attachment", filename="test_case_%d_console_output.txt" % test_count) msg.attach(attachment) - s = smtplib.SMTP(host=SMTP_SERVER, port=SMTP_PORT, timeout=SMTP_TIMEOUT) - #s.set_debuglevel(1) - s.sendmail(FROM, TO, msg.as_string()) - s.quit() + try: + s = smtplib.SMTP(host=SMTP_SERVER, port=SMTP_PORT, timeout=SMTP_TIMEOUT) + #s.set_debuglevel(1) + s.sendmail(FROM, TO, msg.as_string()) + s.quit() + # Catch all for SMTP exceptions + except smtplib.SMTPException, e: + print "Failure to send email: %s" % str(e)