From 658e065f236c56afa138268f9b81afb399f29b81 Mon Sep 17 00:00:00 2001 From: Chimo Date: Thu, 19 Dec 2013 21:08:27 -0500 Subject: [PATCH] Adds STARTTLS support to SMTP notifications --- isso/core.py | 2 +- isso/ext/notifications.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/isso/core.py b/isso/core.py index ba14201..f0a8b00 100644 --- a/isso/core.py +++ b/isso/core.py @@ -117,7 +117,7 @@ class Config: "reload = off", "profile = off", "[smtp]", "username = ", "password = ", - "host = localhost", "port = 465", "ssl = on", + "host = localhost", "port = 465", "security = ssl", "to = ", "from = ", "[guard]", "enabled = true", diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py index da645a0..3283bd6 100644 --- a/isso/ext/notifications.py +++ b/isso/ext/notifications.py @@ -57,9 +57,12 @@ class SMTP(object): uwsgi.spooler = spooler def __enter__(self): - klass = (smtplib.SMTP_SSL if self.conf.getboolean('ssl') else smtplib.SMTP) + klass = (smtplib.SMTP_SSL if self.conf.get('security') == 'ssl' else smtplib.SMTP) self.client = klass(host=self.conf.get('host'), port=self.conf.getint('port')) + if self.conf.get('security') == 'starttls': + self.client.starttls(); + if self.conf.get('username') and self.conf.get('password'): self.client.login(self.conf.get('username'), self.conf.get('password'))