From 75752e094c71f2574b27f2723ea7bde12aa3f7e4 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 24 Jan 2013 00:30:04 -0500 Subject: [PATCH] email: Encode the body when we might use 8bit encoding R. David Murray writes [1]: > In 2.x that will work, and will give you the 8bit CTE at need, as > long as you pass encoded text to MIMEText (as opposed to > unicode...which it doesn't really handle correctly if I recall > right). See also, [2]. [1]: http://bugs.python.org/issue12552 email.MIMEText overide BASE64 for utf8 charset [2]: http://bugs.python.org/issue12553 Add support for using a default CTE of '8bit' to MIMEText Signed-off-by: W. Trevor King --- rss2email/email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rss2email/email.py b/rss2email/email.py index 8bf3eb6..626acda 100644 --- a/rss2email/email.py +++ b/rss2email/email.py @@ -122,7 +122,7 @@ def get_message(sender, recipient, subject, body, content_type, del message['Content-Transfer-Encoding'] charset = _Charset(body_encoding) charset.body_encoding = _email_encoders.encode_7or8bit - message.set_payload(body, charset=charset) + message.set_payload(body.encode(body_encoding), charset=charset) if extra_headers: for key,value in extra_headers.items(): encoding = guess_encoding(value, encodings) -- 2.26.2