Use TLS if available when sending emails

This commit is contained in:
2019-11-19 15:22:05 +01:00
parent 56e03ffffe
commit 086a3fc0ce
2 changed files with 5 additions and 1 deletions

View File

@@ -26,6 +26,10 @@ process = None
def smtp_send(smtp_host, smtp_port, mailfrom, recipient, mail): def smtp_send(smtp_host, smtp_port, mailfrom, recipient, mail):
s = smtplib.SMTP(host=smtp_host, port=smtp_port) s = smtplib.SMTP(host=smtp_host, port=smtp_port)
s.ehlo()
if s.has_extn("STARTTLS"):
s.starttls()
s.ehlo()
s.sendmail(mailfrom, [recipient], mail) s.sendmail(mailfrom, [recipient], mail)
s.quit() s.quit()

View File

@@ -1 +1 @@
__version__ = "0.0.3" __version__ = "0.0.4"