Skip to content

Commit

Permalink
Make sure to correctly decode the data in any attachments we receive
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby White committed Jul 7, 2010
1 parent 7fed722 commit 903b181
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 903b181

Please sign in to comment.