forked from mirror/django-mailbox
Adding gmail to the mailbox types
and adding the type to models.py
This commit is contained in:
parent
cc4e72305d
commit
677e420dec
2 changed files with 23 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue