Fix for not changing password in email settings
Improved ssl certificate check on sending emails
This commit is contained in:
+5
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
import os
|
||||
import smtplib
|
||||
import ssl
|
||||
import threading
|
||||
import socket
|
||||
import mimetypes
|
||||
@@ -192,8 +193,9 @@ class TaskEmail(CalibreTask):
|
||||
# on python3 debugoutput is caught with overwritten _print_debug function
|
||||
log.debug("Start sending e-mail")
|
||||
if use_ssl == 2:
|
||||
context = ssl.create_default_context()
|
||||
self.asyncSMTP = EmailSSL(self.settings["mail_server"], self.settings["mail_port"],
|
||||
timeout=timeout)
|
||||
timeout=timeout, context=context)
|
||||
else:
|
||||
self.asyncSMTP = Email(self.settings["mail_server"], self.settings["mail_port"], timeout=timeout)
|
||||
|
||||
@@ -201,7 +203,8 @@ class TaskEmail(CalibreTask):
|
||||
if logger.is_debug_enabled():
|
||||
self.asyncSMTP.set_debuglevel(1)
|
||||
if use_ssl == 1:
|
||||
self.asyncSMTP.starttls()
|
||||
context = ssl.create_default_context()
|
||||
self.asyncSMTP.starttls(context=context)
|
||||
if self.settings["mail_password_e"]:
|
||||
self.asyncSMTP.login(str(self.settings["mail_login"]), str(self.settings["mail_password_e"]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user