1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-10 06:48:19 +02:00

Add pluggable transport registry

This commit is contained in:
Adam Dobrawy 2018-05-15 00:52:46 +02:00
parent 201f568750
commit 6ded51bcde
4 changed files with 18 additions and 2 deletions

View file

@ -35,6 +35,7 @@ from django_mailbox.signals import message_received
from django_mailbox.transports import Pop3Transport, ImapTransport, \
MaildirTransport, MboxTransport, BabylTransport, MHTransport, \
MMDFTransport, GmailImapTransport
from django_mailbox.transports.registry import transport_registry
logger = logging.getLogger(__name__)
@ -223,7 +224,7 @@ class Mailbox(models.Model):
conn = MHTransport(self.location)
elif self.type == 'mmdf':
conn = MMDFTransport(self.location)
return conn
return transport_registry[self.type].from_url(self.uri)
def process_incoming_message(self, message):
"""Process a message incoming to this mailbox."""