From 6b062df6cd4d91bffa4eba44f487fbf3fc7f5208 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sat, 4 May 2024 09:32:53 +0200 Subject: Allow of use of STARTTLS when connecting to the SMTP server. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matěj Cepl --- import_issues.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/import_issues.py b/import_issues.py index b7195bf..da834a6 100755 --- a/import_issues.py +++ b/import_issues.py @@ -650,6 +650,12 @@ def main(): help="Use SMTP over SSL.", ) + parser.add_argument( + '--smtp-starttls', + action='store_true', + help="Use STARTTLS.", + ) + parser.add_argument( '--smtp-user', help="SMTP username.", @@ -720,6 +726,7 @@ def main(): smtp = None elif mode == 'send': smtp_ssl = args['smtp_ssl'] + smtp_starttls = args['smtp_starttls'] smtp_host = args['smtp_host'] or os.environ.get('SMTP_HOST', 'localhost') smtp_port = args['smtp_port'] or os.environ.get('SMTP_PORT', 465 if smtp_ssl else 25) smtp_user = args['smtp_user'] or os.environ.get('SMTP_USER', None) @@ -735,7 +742,11 @@ def main(): else: smtp = smtplib.SMTP(host=smtp_host, port=smtp_port) - # If SMTP isn't working: smtp.set_debuglevel(2) + # If SMTP isn't working: + # smtp.set_debuglevel(2) + + if smtp_starttls: + smtp.starttls() if smtp_user: smtp.login(smtp_user, smtp_password) -- cgit