changeset 5957:848ed9299ad8

sendmail: catch unicode errors when E-Mail addr has non-ascii chars
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 11 Mar 2013 01:12:07 +0100
parents 64f514bff31e
children ddb9a64cc1ec
files MoinMoin/mail/sendmail.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/mail/sendmail.py	Sun Mar 10 21:17:21 2013 +0100
+++ b/MoinMoin/mail/sendmail.py	Mon Mar 11 01:12:07 2013 +0100
@@ -149,6 +149,9 @@
                 except AttributeError:
                     # in case the connection failed, SMTP has no "sock" attribute
                     pass
+        except UnicodeError, e:
+            logging.exception("unicode error [%r -> %r]" % (mail_from, to, ))
+            return (0, str(e))
         except smtplib.SMTPException, e:
             logging.exception("smtp mail failed with an exception.")
             return (0, str(e))