mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-10 06:48:19 +02:00
fix import
This commit is contained in:
parent
8f944190ad
commit
9bfc3e5df1
5 changed files with 20 additions and 42 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import O365
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
|
|
@ -10,13 +9,8 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class Office365Transport(EmailTransport):
|
||||
def __init__(
|
||||
self, hostname, username, port=None, ssl=False, tls=False, folder=None
|
||||
self, hostname, username, folder=None
|
||||
):
|
||||
self.max_message_size = getattr(
|
||||
settings,
|
||||
'DJANGO_MAILBOX_MAX_MESSAGE_SIZE',
|
||||
False
|
||||
)
|
||||
self.integration_testing_subject = getattr(
|
||||
settings,
|
||||
'DJANGO_MAILBOX_INTEGRATION_TESTING_SUBJECT',
|
||||
|
|
@ -24,19 +18,16 @@ class Office365Transport(EmailTransport):
|
|||
)
|
||||
self.hostname = hostname
|
||||
self.username = username
|
||||
self.port = port
|
||||
self.folder = folder
|
||||
self.tls = tls
|
||||
if ssl:
|
||||
#self.transport = imaplib.IMAP4_SSL
|
||||
if not self.port:
|
||||
self.port = 993
|
||||
else:
|
||||
#self.transport = imaplib.IMAP4
|
||||
if not self.port:
|
||||
self.port = 143
|
||||
|
||||
def connect(self, client_id, client_secret, tenant_id):
|
||||
try:
|
||||
import O365
|
||||
except ImportError:
|
||||
raise ValueError(
|
||||
"Install o365 to use oauth2 auth for office365"
|
||||
)
|
||||
|
||||
credentials = (client_id, client_secret)
|
||||
|
||||
self.account = O365.Account(credentials, auth_flow_type='credentials', tenant_id=tenant_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue