From 169609658330c903d66859ccd9caa5c5e194597e Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Fri, 5 Oct 2018 10:11:48 -0400 Subject: [PATCH] Move/delete 10 IMAP messages at a time --- parsedmarc/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index debc7cf..a509f51 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -1202,13 +1202,15 @@ def get_dmarc_reports_from_inbox(host=None, user=None, password=None, if type(msg_uids) == str: msg_uids = [msg_uids] - server.add_flags(msg_uids, [imapclient.DELETED]) + for chunk in chunks(msg_uids, 10): + server.add_flags(chunk, [imapclient.DELETED]) + server.expunge() def move_messages(msg_uids, folder): if type(msg_uids) == str: msg_uids = [msg_uids] - for chunk in chunks(msg_uids, 100): + for chunk in chunks(msg_uids, 10): if move_supported: server.move(chunk, folder) else: