aboutsummaryrefslogtreecommitdiffstats
path: root/import_issues.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-05-04 09:32:53 +0200
committerBryan Gardiner <bog@khumba.net>2024-05-04 15:48:08 -0700
commit6b062df6cd4d91bffa4eba44f487fbf3fc7f5208 (patch)
treeffd5f76957cc1ea20472d9e4213cc2571c777466 /import_issues.py
parent807dcfe05a81bb6f1e3a30d6f4c3d65e21233986 (diff)
downloadlazygl2srht-6b062df6cd4d91bffa4eba44f487fbf3fc7f5208.tar.gz
Allow of use of STARTTLS when connecting to the SMTP server.
Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
Diffstat (limited to 'import_issues.py')
-rwxr-xr-ximport_issues.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/import_issues.py b/import_issues.py
index b7195bf..da834a6 100755
--- a/import_issues.py
+++ b/import_issues.py
@@ -651,6 +651,12 @@ def main():
)
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)