From 23be874367ee3a0b400c16277f73a346d7277ac9 Mon Sep 17 00:00:00 2001 From: Jim Duchek Date: Tue, 9 Jun 2026 15:52:04 -0700 Subject: [PATCH 1/4] Fix imapfetch to actually use the 'port' argument --- util/imapfetch.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/util/imapfetch.py b/util/imapfetch.py index efe06cdd..6e14761d 100755 --- a/util/imapfetch.py +++ b/util/imapfetch.py @@ -117,7 +117,7 @@ def main(): default="/etc/piler/piler.conf") parser.add_argument("--security", type=str, help="imap security. no, TLS or SSL", default="no") parser.add_argument("-s", "--server", type=str, help="imap server") - parser.add_argument("-P", "--port", type=int, help="port number", default=143) + parser.add_argument("-P", "--port", type=int, help="port number") parser.add_argument("-u", "--user", type=str, help="imap user") parser.add_argument("-p", "--password", type=str, help="imap password") parser.add_argument("--oauth2-token", type=str, help="oauth2 access token file") @@ -188,16 +188,17 @@ def main(): server = args.server user = args.user password = args.password + port = args.port if opts['verbose']: print("Skipped folder list: {}".format(opts['skip_folders'])) if security in ('no', 'imap'): - conn = imaplib.IMAP4(server) + conn = imaplib.IMAP4(server, port = port if port is not None else imaplib.IMAP4_PORT) elif security == 'imap-ssl': - conn = imaplib.IMAP4_SSL(server) + conn = imaplib.IMAP4_SSL(server, port = port if port is not None else imaplib.IMAP4_PORT_SSL) elif security == 'imap-tls': - conn = imaplib.IMAP4(server) + conn = imaplib.IMAP4(server, port = port if port is not None else imaplib.IMAP4_PORT) conn.starttls() if opts['access_token']: From 2b6fa617eb1fad4e9ef9d2c2d78148f4517162d5 Mon Sep 17 00:00:00 2001 From: Jim Duchek Date: Thu, 11 Jun 2026 13:38:39 -0700 Subject: [PATCH 2/4] Fix importing the imap settings from the db. --- util/imapfetch.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/imapfetch.py b/util/imapfetch.py index 6e14761d..8ac3811f 100755 --- a/util/imapfetch.py +++ b/util/imapfetch.py @@ -162,6 +162,7 @@ def main(): server = '' user = '' password = '' + port = None if args.import_from_table: read_options(args.config, opts) @@ -176,6 +177,10 @@ def main(): row = cursor.fetchone() if row: (opts['id'], security, server, user, password) = row + + server, _, port = server.partition(":") + port = port or None + security = row[1] else: print("Nothing to read from import table") From e64da62853eea04632314213dfa21408c9bfb71e Mon Sep 17 00:00:00 2001 From: Jim Duchek Date: Thu, 11 Jun 2026 23:08:19 -0700 Subject: [PATCH 3/4] Fixed typo in IMAP4_SSL_PORT constant --- util/imapfetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/imapfetch.py b/util/imapfetch.py index 8ac3811f..99652465 100755 --- a/util/imapfetch.py +++ b/util/imapfetch.py @@ -201,7 +201,7 @@ def main(): if security in ('no', 'imap'): conn = imaplib.IMAP4(server, port = port if port is not None else imaplib.IMAP4_PORT) elif security == 'imap-ssl': - conn = imaplib.IMAP4_SSL(server, port = port if port is not None else imaplib.IMAP4_PORT_SSL) + conn = imaplib.IMAP4_SSL(server, port = port if port is not None else imaplib.IMAP4_SSL_PORTL) elif security == 'imap-tls': conn = imaplib.IMAP4(server, port = port if port is not None else imaplib.IMAP4_PORT) conn.starttls() From 58ba4fca65cff20c221d0548ac82b6a008d37a1e Mon Sep 17 00:00:00 2001 From: Jim Duchek Date: Thu, 11 Jun 2026 23:09:38 -0700 Subject: [PATCH 4/4] Fixed ANOTHER typo in IMAP4_SSL_PORT --- util/imapfetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/imapfetch.py b/util/imapfetch.py index 99652465..4300015d 100755 --- a/util/imapfetch.py +++ b/util/imapfetch.py @@ -201,7 +201,7 @@ def main(): if security in ('no', 'imap'): conn = imaplib.IMAP4(server, port = port if port is not None else imaplib.IMAP4_PORT) elif security == 'imap-ssl': - conn = imaplib.IMAP4_SSL(server, port = port if port is not None else imaplib.IMAP4_SSL_PORTL) + conn = imaplib.IMAP4_SSL(server, port = port if port is not None else imaplib.IMAP4_SSL_PORT) elif security == 'imap-tls': conn = imaplib.IMAP4(server, port = port if port is not None else imaplib.IMAP4_PORT) conn.starttls()