2014-04-25 16:37:51 -07:00
|
|
|
import email
|
|
|
|
|
|
|
|
|
|
# Do *not* remove this, we need to use this in subclasses of EmailTransport
|
2019-10-15 05:31:13 +02:00
|
|
|
from email.errors import MessageParseError # noqa: F401
|
2014-04-25 16:37:51 -07:00
|
|
|
|
|
|
|
|
|
2019-10-15 05:31:13 +02:00
|
|
|
class EmailTransport:
|
2014-04-25 16:37:51 -07:00
|
|
|
def get_email_from_bytes(self, contents):
|
2019-10-15 05:31:13 +02:00
|
|
|
message = email.message_from_bytes(contents)
|
2014-04-25 16:37:51 -07:00
|
|
|
|
|
|
|
|
return message
|
2018-05-15 00:52:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class PluggableEmailTransport(EmailTransport):
|
|
|
|
|
@classmethod
|
|
|
|
|
def from_uri(cls, uri):
|
|
|
|
|
raise NotImplemented("The class does not implement {0}.from_uri, and it should. "
|
|
|
|
|
"Overwrite {0}.from_uri.".format(cls.__name__))
|