initial SMTP connection now timeouts after 5 seconds, closes #70

This commit is contained in:
Martin Zimmermann 2014-03-03 23:42:35 +01:00
parent 154d591ae9
commit 9a735e8eac

View File

@ -58,7 +58,9 @@ class SMTP(object):
def __enter__(self): def __enter__(self):
klass = (smtplib.SMTP_SSL if self.conf.get('security') == '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')) self.client = klass(host=self.conf.get('host'),
port=self.conf.getint('port'),
timeout=5)
if self.conf.get('security') == 'starttls': if self.conf.get('security') == 'starttls':
self.client.starttls(); self.client.starttls();