Skip to content
Browse files

Make sure to correctly decode the data in any attachments we receive

  • Loading branch information...
1 parent 7fed722 commit 903b181716a820ce55c85aa05c5c63c51e241550 Toby White committed Jul 7, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 mail.py
View
6 mail.py
@@ -65,11 +65,11 @@ def send_message(msg):
# because GAE doesn't give us enough control there.
for part in msg.walk():
if part.get_content_type() == 'text/plain' and not body:
- body = part.get_payload()
+ body = part.get_payload(decode=True)
elif part.get_content_type() == 'text/html' and not html:
- html = part.get_payload()
+ html = part.get_payload(decode=True)
elif not part.get_content_type().startswith('multipart'):
- attachments.append((get_filename(part), part.get_payload()))
+ attachments.append((get_filename(part), part.get_payload(decode=True)))
if not body:
raise BadMessageError("No message body specified")
message.body = body

0 comments on commit 903b181

Please sign in to comment.
Something went wrong with that request. Please try again.