changeset 2034:ae88b5b6d019 gae

sendmail: catch unicode errors when E-Mail addr has non-ascii chars
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 18 Mar 2013 02:02:57 +0100
parents 6ac803a543ae
children 9349041e3489
files MoinMoin/mail/sendmail.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/mail/sendmail.py	Mon Mar 18 01:50:26 2013 +0100
+++ b/MoinMoin/mail/sendmail.py	Mon Mar 18 02:02:57 2013 +0100
@@ -180,6 +180,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 as e:
                 logging.exception("smtp mail failed with an exception.")
                 return (0, str(e))