[Moin-user] [Moin-User] notification email problem after upgrade

Thomas Waldmann tw-public at gmx.de
Wed Sep 6 10:00:50 EDT 2006


> After upgrade to MoinMoin 1.5.4 I don't receive notification mails in
> correct readable format...
> How should I know that MoinMoin sends mails with UTF-8 encoding ? I don't
> have any problem with English texts, my problem is with Persian texts...
> I think MoinMoin 1.5.4 doesn't send emails in UTF-8 format... I didn't 
> have
> this problem with MoinMoin 1.5.3
This is not a moin bug, but different behaviour of different python 
versions, see there:

http://moinmoin.wikiwikiweb.de/MoinMoinBugs/UnicodeMailNotificationEncodingBroken

http://moinmoin.wikiwikiweb.de/MoinMoinBugs/ResetPasswordEmailImproperlyEncoded

This patch should workaround it for all python versions:

--- a/MoinMoin/util/mail.py	Thu Jul 20 17:38:59 2006 +0200
+++ b/MoinMoin/util/mail.py	Thu Jul 20 18:01:31 2006 +0200
@@ -74,8 +74,14 @@ def sendmail(request, to, subject, text,
     charset = Charset(config.charset)
     charset.header_encoding = QP
     charset.body_encoding = QP
-    msg.set_charset(charset)    
-    msg.set_payload(charset.body_encode(text))
+    msg.set_charset(charset)
+
+    # 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

It will be included in 1.5.5 release soon.







More information about the Moin-user mailing list