Skip to content

Commit

Permalink
Merge remote-tracking branch 'jzombi/python3.4_tls'
Browse files Browse the repository at this point in the history
Avoid [1]:

  ssl.SSLError: [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:598)

when using .starttls() after an explicit .connect(host=...) on Python
3.4+ (where they start verifying hostnames).

[1]: http://bugs.python.org/issue25852

* jzombi/python3.4_tls:
  Fix tls bug in python 3.4+

Signed-off-by: W. Trevor King <[email protected]>
  • Loading branch information
wking committed Dec 14, 2015
2 parents b55dc17 + 0323900 commit 354543d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions rss2email/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 354543d

Please sign in to comment.