Fix tls bug in python 3.4+
authorMátyás Jani <jzombi@gmail.com>
Mon, 14 Dec 2015 08:33:12 +0000 (09:33 +0100)
committerMátyás Jani <jzombi@gmail.com>
Mon, 14 Dec 2015 08:41:05 +0000 (09:41 +0100)
Signed-off-by: Matyas Jani <jzombi@gmail.com>
rss2email/email.py

index e0828727c780dddcf03df15258f905fa2388f121..c7df67d51e33eabf639e1c9bc4c101451dd232cb 100644 (file)
@@ -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: