mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix bug in email sending when using an SSL connection
This commit is contained in:
parent
d8b578cadb
commit
3c4ab7fb96
@ -81,12 +81,7 @@ def sendmail(msg, from_, to, localhost=None, verbose=0, timeout=30,
|
|||||||
for x in to:
|
for x in to:
|
||||||
return sendmail_direct(from_, x, msg, timeout, localhost, verbose)
|
return sendmail_direct(from_, x, msg, timeout, localhost, verbose)
|
||||||
import smtplib
|
import smtplib
|
||||||
class SMTP_SSL(smtplib.SMTP_SSL): # Workaround for bug in smtplib.py
|
cls = smtplib.SMTP if encryption == 'TLS' else smtplib.SMTP_SSL
|
||||||
def _get_socket(self, host, port, timeout):
|
|
||||||
smtplib.SMTP_SSL._get_socket(self, host, port, timeout)
|
|
||||||
return self.sock
|
|
||||||
|
|
||||||
cls = smtplib.SMTP if encryption == 'TLS' else SMTP_SSL
|
|
||||||
timeout = None # Non-blocking sockets sometimes don't work
|
timeout = None # Non-blocking sockets sometimes don't work
|
||||||
port = int(port)
|
port = int(port)
|
||||||
s = cls(timeout=timeout, local_hostname=localhost)
|
s = cls(timeout=timeout, local_hostname=localhost)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user