handle maxline
This commit is contained in:
parent
37cb1d9423
commit
1f04a016a3
1 changed files with 12 additions and 1 deletions
|
@ -101,7 +101,18 @@ class BackupImap:
|
||||||
os.mkdir(os.path.dirname(mailbox_path))
|
os.mkdir(os.path.dirname(mailbox_path))
|
||||||
if not os.path.exists(mailbox_path):
|
if not os.path.exists(mailbox_path):
|
||||||
os.mkdir(mailbox_path)
|
os.mkdir(mailbox_path)
|
||||||
search_response, search_data = self.imap.search('UTF-8', 'UNDELETED')
|
search_succeeded = False
|
||||||
|
while not search_succeeded:
|
||||||
|
try:
|
||||||
|
search_response, search_data = self.imap.search('UTF-8', 'UNDELETED')
|
||||||
|
search_succeeded = True
|
||||||
|
except Exception as error:
|
||||||
|
imaplib._MAXLINE += 10000
|
||||||
|
self._log.debug(
|
||||||
|
"Error searching mailbox, increasing maxline to %s. %s",
|
||||||
|
imaplib._MAXLINE,
|
||||||
|
error
|
||||||
|
)
|
||||||
if search_response == 'OK':
|
if search_response == 'OK':
|
||||||
all_msgs_uids = search_data[0].split()
|
all_msgs_uids = search_data[0].split()
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
|
|
Loading…
Reference in a new issue