Revision: 15550 http://gar.svn.sourceforge.net/gar/?rev=15550&view=rev Author: wahwah Date: 2011-09-07 08:24:53 +0000 (Wed, 07 Sep 2011) Log Message: ----------- catalog_notifier: smtplib.SMTPRecipientsRefused
There's a need to catch this exception from smtplib when the email address is e.g. "Unknown". Modified Paths: -------------- csw/mgar/gar/v2/lib/python/catalog_notifier.py Modified: csw/mgar/gar/v2/lib/python/catalog_notifier.py =================================================================== --- csw/mgar/gar/v2/lib/python/catalog_notifier.py 2011-09-07 08:15:29 UTC (rev 15549) +++ csw/mgar/gar/v2/lib/python/catalog_notifier.py 2011-09-07 08:24:53 UTC (rev 15550) @@ -268,7 +268,12 @@ msg['From'] = from_address msg['To'] = email s = smtplib.SMTP('localhost') - s.sendmail(from_address, [email], msg.as_string()) + try: + s.sendmail(from_address, [email], msg.as_string()) + except smtplib.SMTPRecipientsRefused, e: + logging.warning( + "Sending email to %s failed, recipient refused.", + repr(email)) s.quit() logging.debug("E-mail sent.") else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ devel mailing list devel@lists.opencsw.org https://lists.opencsw.org/mailman/listinfo/devel