1
0
Fork 0

Actually fixing Python 3 support; verified both IMAP and POP3. Fixes #13 (seriously this time).

This commit is contained in:
Adam Coddington 2014-04-25 16:37:51 -07:00
parent 4002d5c222
commit 3b2d60a903
9 changed files with 145 additions and 16 deletions

View file

@ -0,0 +1,19 @@
import email
import six
# Do *not* remove this, we need to use this in subclasses of EmailTransport
if six.PY3:
from email.errors import MessageParseError
else:
from email.Errors import MessageParseError
class EmailTransport(object):
def get_email_from_bytes(self, contents):
if six.PY3:
message = email.message_from_bytes(contents)
else:
message = email.message_from_string(contents)
return message