Skip to content

Commit fb752e6

Browse files
committed
catch SMTP exception if any - issue #311
1 parent 3dd9f29 commit fb752e6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

extra/shutils/regressiontest.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@
9191
attachment.add_header("Content-Disposition", "attachment", filename="test_case_%d_console_output.txt" % test_count)
9292
msg.attach(attachment)
9393

94-
s = smtplib.SMTP(host=SMTP_SERVER, port=SMTP_PORT, timeout=SMTP_TIMEOUT)
95-
#s.set_debuglevel(1)
96-
s.sendmail(FROM, TO, msg.as_string())
97-
s.quit()
94+
try:
95+
s = smtplib.SMTP(host=SMTP_SERVER, port=SMTP_PORT, timeout=SMTP_TIMEOUT)
96+
#s.set_debuglevel(1)
97+
s.sendmail(FROM, TO, msg.as_string())
98+
s.quit()
99+
# Catch all for SMTP exceptions
100+
except smtplib.SMTPException, e:
101+
print "Failure to send email: %s" % str(e)

0 commit comments

Comments
 (0)