1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-10 06:48:19 +02:00
django-mailbox/django_mailbox/transports/base.py
2020-12-08 09:09:23 +05:30

18 lines
555 B
Python

import email
# Do *not* remove this, we need to use this in subclasses of EmailTransport
from email.errors import MessageParseError # noqa: F401
class EmailTransport:
def get_email_from_bytes(self, contents):
message = email.message_from_bytes(contents)
return message
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__))