From: Mátyás Jani <jzombi@gmail.com>
Date: Mon, 14 Dec 2015 08:33:12 +0000 (+0100)
Subject: Fix tls bug in python 3.4+
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=03239000e1a44c830f216ed0746686878b12f5e4;p=rss2email.git

Fix tls bug in python 3.4+

Signed-off-by: Matyas Jani <jzombi@gmail.com>
---

diff --git a/rss2email/email.py b/rss2email/email.py
index e082872..c7df67d 100644
--- a/rss2email/email.py
+++ b/rss2email/email.py
@@ -145,12 +145,11 @@ def smtp_send(sender, recipient, message, config=None, section='DEFAULT'):
     server = config.get(section, 'smtp-server')
     _LOG.debug('sending message to {} via {}'.format(recipient, server))
     ssl = config.getboolean(section, 'smtp-ssl')
-    if ssl:
-        smtp = _smtplib.SMTP_SSL()
-    else:
-        smtp = _smtplib.SMTP()
     try:
-        smtp.connect(server)
+        if ssl:
+            smtp = _smtplib.SMTP_SSL(host=server)
+        else:
+            smtp = _smtplib.SMTP(host=server)
     except KeyboardInterrupt:
         raise
     except Exception as e: