From 66f3d57b284c281240f40fa62acd67af0b4d00c0 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Tue, 5 Jul 2022 15:17:15 +0200 Subject: [PATCH] Updated imapfetch.py Signed-off-by: Janos SUTO --- util/imapfetch.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/util/imapfetch.py b/util/imapfetch.py index a96e37aa..5216e344 100755 --- a/util/imapfetch.py +++ b/util/imapfetch.py @@ -61,7 +61,16 @@ def process_folder(conn, folder): if opts['verbose']: print("Processing {}".format(folder)) - rc, data = conn.select(folder) + try: + rc, data = conn.select(folder) + except: + print("Error processing folder {}".format(folder)) + return + + if rc != "OK": + print("Error processing folder {}, rc={}, response={}".format(folder, rc, data)) + return + n = int(data[0]) if opts['verbose']: print("Folder {} has {} messages".format(folder, n)) @@ -94,7 +103,7 @@ def main(): parser.add_argument("-u", "--user", type=str, help="imap user") parser.add_argument("-p", "--password", type=str, help="imap password") parser.add_argument("-x", "--skip-list", type=str, help="IMAP folders to skip", - default="junk,trash,spam,draft") + default="junk,trash,spam,draft,\"[Gmail]\"") parser.add_argument("-f", "--folders", type=str, help="Comma separated list of IMAP folders to download") parser.add_argument("--date", type=str, help="Search before/since a given date," +