mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 09:30:31 +00:00
Fix for not changing password in email settings
Improved ssl certificate check on sending emails
This commit is contained in:
parent
df74fdb4d1
commit
fda62dde1d
@ -1296,7 +1296,7 @@ def update_mailsettings():
|
||||
else:
|
||||
_config_int(to_save, "mail_port")
|
||||
_config_int(to_save, "mail_use_ssl")
|
||||
if "mail_password_e" in to_save:
|
||||
if to_save.get("mail_password_e", ""):
|
||||
_config_string(to_save, "mail_password_e")
|
||||
_config_int(to_save, "mail_size", lambda y: int(y) * 1024 * 1024)
|
||||
config.mail_server = to_save.get('mail_server', "").strip()
|
||||
@ -1781,7 +1781,7 @@ def _configuration_update_helper():
|
||||
# Goodreads configuration
|
||||
_config_checkbox(to_save, "config_use_goodreads")
|
||||
_config_string(to_save, "config_goodreads_api_key")
|
||||
if "config_goodreads_api_secret_e" in to_save:
|
||||
if to_save.get("config_goodreads_api_secret_e", ""):
|
||||
_config_string(to_save, "config_goodreads_api_secret_e")
|
||||
if services.goodreads_support:
|
||||
services.goodreads_support.connect(config.config_goodreads_api_key,
|
||||
|
@ -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"]))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user