|
@@ -176,6 +176,7 @@ class MailFetcher(object):
|
176
|
176
|
port: str,
|
177
|
177
|
user: str,
|
178
|
178
|
password: str,
|
|
179
|
+ ssl: bool,
|
179
|
180
|
folder: str,
|
180
|
181
|
delay: int,
|
181
|
182
|
endpoint: str,
|
|
@@ -189,6 +190,7 @@ class MailFetcher(object):
|
189
|
190
|
:param port: imap connection port
|
190
|
191
|
:param user: user login of mailbox
|
191
|
192
|
:param password: user password of mailbox
|
|
193
|
+ :param ssl: use imap over ssl connection
|
192
|
194
|
:param folder: mail folder where new mail are fetched
|
193
|
195
|
:param delay: seconds to wait before fetching new mail again
|
194
|
196
|
:param endpoint: tracim http endpoint where decoded mail are send.
|
|
@@ -199,6 +201,7 @@ class MailFetcher(object):
|
199
|
201
|
self.port = port
|
200
|
202
|
self.user = user
|
201
|
203
|
self.password = password
|
|
204
|
+ self.ssl = ssl
|
202
|
205
|
self.folder = folder
|
203
|
206
|
self.delay = delay
|
204
|
207
|
self.endpoint = endpoint
|
|
@@ -225,11 +228,14 @@ class MailFetcher(object):
|
225
|
228
|
# Are old connexion properly close this way ?
|
226
|
229
|
if self._connection:
|
227
|
230
|
self._disconnect()
|
228
|
|
- # TODO - G.M - 2017-11-15 Support unencrypted connection ?
|
229
|
231
|
# TODO - G.M - 2017-11-23 Support for predefined SSLContext ?
|
230
|
232
|
# without ssl_context param, tracim use default security configuration
|
231
|
233
|
# which is great in most case.
|
232
|
|
- self._connection = imaplib.IMAP4_SSL(self.host, self.port)
|
|
234
|
+ if self.ssl:
|
|
235
|
+ self._connection = imaplib.IMAP4_SSL(self.host, self.port)
|
|
236
|
+ else:
|
|
237
|
+ self._connection = imaplib.IMAP4(self.host, self.port)
|
|
238
|
+
|
233
|
239
|
try:
|
234
|
240
|
self._connection.login(self.user, self.password)
|
235
|
241
|
except Exception as e:
|