[Nym3-commit] r483 - trunk/nymbaron
zax at conuropsis.org
zax at conuropsis.org
Thu Mar 16 20:50:53 CET 2006
Author: zax
Date: 2006-03-16 20:50:52 +0100 (Thu, 16 Mar 2006)
New Revision: 483
Modified:
trunk/nymbaron/Mail.py
Log:
Add sendmail exception handling and log messages
Modified: trunk/nymbaron/Mail.py
===================================================================
--- trunk/nymbaron/Mail.py 2006-03-16 19:09:13 UTC (rev 482)
+++ trunk/nymbaron/Mail.py 2006-03-16 19:50:52 UTC (rev 483)
@@ -277,13 +277,15 @@
def relay_sendmail(payload, sm):
""" Depreciated in favour of using Python smtplib, but this
works fine on systems with sendmail"""
- # TODO Need some error handling when logging gets enabled
mail_logger.debug("Sending outgoing message using %s" % sm)
+ if not os.path.exists(sm):
+ mail_logger.warn("%s does not exist" % sm)
+ sys.exit(2)
p = os.popen("%s -t" % sm, "w")
p.write(payload)
status = p.close()
if status:
- mail_logger.warn("%s returned error %s" % (sm, status))
+ mail_logger.warn("%s returned error %d" % (sm, status))
sys.exit(2)
else:
mail_logger.debug("Message successfully relayed to %s" % sm)
More information about the Nym3-commit
mailing list