From 0b92307b23aae8abe4add782ebef0b46b5441e76 Mon Sep 17 00:00:00 2001 From: Mukesh Sai Kumar Date: Fri, 24 May 2019 23:20:34 +0530 Subject: [PATCH] Added starttls support for SMTP --- gpg-mailgate.conf.sample | 3 +++ gpg-mailgate.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/gpg-mailgate.conf.sample b/gpg-mailgate.conf.sample index e3364d4..0b74a55 100644 --- a/gpg-mailgate.conf.sample +++ b/gpg-mailgate.conf.sample @@ -80,6 +80,9 @@ port = 10028 # mails through the GPG-Mailgate so they are encrypted enc_port = 25 +# Set this option to yes to use TLS for SMTP Servers which require TLS. +starttls = no + [database] # uncomment the settings below if you want # to read keys from a gpg-mailgate-web database diff --git a/gpg-mailgate.py b/gpg-mailgate.py index ef2538b..9830262 100755 --- a/gpg-mailgate.py +++ b/gpg-mailgate.py @@ -627,6 +627,8 @@ def send_msg( message, recipients ): log("Sending email to: <%s>" % '> <'.join( recipients )) relay = (cfg['relay']['host'], int(cfg['relay']['port'])) smtp = smtplib.SMTP(relay[0], relay[1]) + if cfg.has_key('relay') and cfg['relay'].has_key('starttls') and cfg['relay']['starttls'] == 'yes': + smtp.starttls() smtp.sendmail( from_addr, recipients, message ) else: log("No recipient found")