Merge pull request #5143 from achillesrasquinha/py3
Decode Email Content to Unicode
This commit is contained in:
commit
bfe965a03f
2 changed files with 4 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ from __future__ import unicode_literals, print_function
|
|||
from six import iteritems, binary_type, text_type, string_types
|
||||
from werkzeug.local import Local, release_local
|
||||
import os, sys, importlib, inspect, json
|
||||
from past.builtins import cmp
|
||||
|
||||
# public
|
||||
from .exceptions import *
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import time, _socket, poplib, imaplib, email, email.utils, datetime, chardet, re
|
|||
from email_reply_parser import EmailReplyParser
|
||||
from email.header import decode_header
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe import _, safe_decode
|
||||
from frappe.utils import (extract_email_id, convert_utc_to_user_timezone, now,
|
||||
cint, cstr, strip, markdown, parse_addr)
|
||||
from frappe.utils.scheduler import log
|
||||
|
|
@ -360,9 +360,10 @@ class Email:
|
|||
"""Parses headers, content, attachments from given raw message.
|
||||
|
||||
:param content: Raw message."""
|
||||
self.raw = content
|
||||
self.raw = safe_decode(content)
|
||||
self.mail = email.message_from_string(self.raw)
|
||||
|
||||
|
||||
self.text_content = ''
|
||||
self.html_content = ''
|
||||
self.attachments = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue