Skip to content

Commit 19cc19e

Browse files
Bumping maxlines to 10^6 to support large mailboxes. Fixes coddingtonbear#81.
1 parent 9538996 commit 19cc19e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

django_mailbox/transports/imap.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
from imaplib import IMAP4, IMAP4_SSL
1+
import imaplib
22
import logging
33

44
from django.conf import settings
55

66
from .base import EmailTransport, MessageParseError
77

88

9+
# By default, imaplib will raise an exception if it encounters more
10+
# than 10k bytes; sometimes users attempt to consume mailboxes that
11+
# have a more, and modern computers are skookum-enough to handle just
12+
# a *few* more messages without causing any sort of problem.
13+
imaplib._MAXLINE = 1000000
14+
15+
916
logger = logging.getLogger(__name__)
1017

1118

@@ -28,11 +35,11 @@ def __init__(
2835
self.archive = archive
2936
self.folder = folder
3037
if ssl:
31-
self.transport = IMAP4_SSL
38+
self.transport = imaplib.IMAP4_SSL
3239
if not self.port:
3340
self.port = 993
3441
else:
35-
self.transport = IMAP4
42+
self.transport = imaplib.IMAP4
3643
if not self.port:
3744
self.port = 143
3845

0 commit comments

Comments
 (0)