From: Faiyaz Ahmed Date: Wed, 17 Jan 2007 16:03:30 +0000 (+0000) Subject: Except on MTA error and continue. X-Git-Tag: Monitor-1.0-0~104 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2901cc0eef82ed312d724ed4bb6ee3511f12299a;hp=9b625461143f97db09bd96bfb9785ecdfead20a8;p=monitor.git Except on MTA error and continue. --- diff --git a/mailer.py b/mailer.py index 8df3b98..dc0799d 100755 --- a/mailer.py +++ b/mailer.py @@ -4,7 +4,7 @@ # # Faiyaz Ahmed # -# $Id: $ +# $Id: mailer.py,v 1.4 2006/11/14 19:20:13 faiyaza Exp $ from emailTxt import * import smtplib import config @@ -63,9 +63,12 @@ def email (subject, text, to): msg = out.getvalue() out.close() if not config.debug: - server = smtplib.SMTP(MTA) - server.sendmail(FROM, to, msg) - server.quit() + try: + server = smtplib.SMTP(MTA) + server.sendmail(FROM, to, msg) + server.quit() + except Exception, err: + print "Mailer error: %s" % err if __name__=="__main__": import smtplib