forked from mirror/django-mailbox
Actually fixing Python 3 support; verified both IMAP and POP3. Fixes #13 (seriously this time).
This commit is contained in:
parent
4002d5c222
commit
3b2d60a903
9 changed files with 145 additions and 16 deletions
19
django_mailbox/transports/base.py
Normal file
19
django_mailbox/transports/base.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue