1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Close connections after we are done with them

This commit is contained in:
Akshet Pandey 2024-02-28 11:42:21 -08:00
parent 592126c439
commit fbaa378e59
3 changed files with 19 additions and 16 deletions

View file

@ -6,13 +6,6 @@ from django.conf import settings
from .base import EmailTransport, MessageParseError
# By default, imaplib will raise an exception if it encounters more
# than 10k bytes; sometimes users attempt to consume mailboxes that
# have a more, and modern computers are skookum-enough to handle just
# a *few* more messages without causing any sort of problem.
imaplib._MAXLINE = 1000000
logger = logging.getLogger(__name__)
@ -56,6 +49,10 @@ class ImapTransport(EmailTransport):
else:
self.server.select()
def close(self):
self.server.close()
self.server.logout()
def _get_all_message_ids(self):
# Fetch all the message uids
response, message_ids = self.server.uid('search', None, 'ALL')