2014-04-25 16:37:51 -07:00
|
|
|
import email
|
|
|
|
|
|
|
|
|
|
import six
|
|
|
|
|
|
|
|
|
|
# Do *not* remove this, we need to use this in subclasses of EmailTransport
|
|
|
|
|
if six.PY3:
|
2017-05-09 23:59:42 +02:00
|
|
|
from email.errors import MessageParseError # noqa: F401
|
2014-04-25 16:37:51 -07:00
|
|
|
else:
|
2017-05-09 23:59:42 +02:00
|
|
|
from email.Errors import MessageParseError # noqa: F401
|
2014-04-25 16:37:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|