Updated imapfetch.py

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2022-07-05 15:17:15 +02:00
parent e95e8496a7
commit 66f3d57b28

View File

@ -61,7 +61,16 @@ def process_folder(conn, folder):
if opts['verbose']:
print("Processing {}".format(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," +