changeset 998:8e1f7ba815b5

fix double quoted-printable encoding in forgotten password email. Double encoding was introduced by 50c7a0cc1791. Discussed on MoinMoinBugs/ResetPasswordEmailImproperlyEncoded. The problem was caused by a bug in python 2.4.3 and above, which doesn't QP-encode the message as previous versions do it.
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 20 Jul 2006 18:03:07 +0200
parents 8953764256c7
children 97ce857bdebf e1239c38785c 7746d74fda4f
files MoinMoin/mail/sendmail.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/mail/sendmail.py	Thu Jul 20 17:40:21 2006 +0200
+++ b/MoinMoin/mail/sendmail.py	Thu Jul 20 18:03:07 2006 +0200
@@ -74,7 +74,13 @@
     charset.header_encoding = QP
     charset.body_encoding = QP
     msg.set_charset(charset)
-    msg.set_payload(charset.body_encode(text))
+
+    # work around a bug in python 2.4.3 and above:
+    msg.set_payload('=')
+    if msg.as_string().endswith('='):
+        text = charset.body_encode(text)
+
+    msg.set_payload(text)
 
     # Create message headers
     # Don't expose emails addreses of the other subscribers, instead we