1
0
Fork 0

Adding gmail to the mailbox types

and adding the type to models.py
This commit is contained in:
Alex Lovell-Troy 2014-05-28 21:24:46 -06:00
parent cc4e72305d
commit 677e420dec
2 changed files with 23 additions and 1 deletions

View file

@ -15,7 +15,7 @@ from django.core.files.base import ContentFile
from django.db import models
from django_mailbox.transports import Pop3Transport, ImapTransport,\
MaildirTransport, MboxTransport, BabylTransport, MHTransport, \
MMDFTransport
MMDFTransport, GmailImapTransport
from django_mailbox.signals import message_received
import six
from six.moves.urllib.parse import parse_qs, unquote, urlparse
@ -168,6 +168,14 @@ class Mailbox(models.Model):
archive=self.archive
)
conn.connect(self.username, self.password)
elif self.type == 'gmail':
conn = GmailImapTransport(
self.location,
port=self.port if self.port else None,
ssl=True,
archive=self.archive
)
conn.connect(self.username, self.password)
elif self.type == 'pop3':
conn = Pop3Transport(
self.location,