fixed wrong translations. fixed smtp with ssl has no response.

This commit is contained in:
idalin 2017-01-16 15:37:42 +08:00
parent 6fcd65b4ce
commit 0458ea5acb
3 changed files with 19 additions and 13 deletions

View File

@ -113,13 +113,16 @@ def send_test_mail(kindle_mail):
org_stderr = smtplib.stderr
smtplib.stderr = StderrLogger()
mailserver = smtplib.SMTP(settings["mail_server"], settings["mail_port"],timeout)
if int(use_ssl) == 1:
mailserver = smtplib.SMTP_SSL(settings["mail_server"], settings["mail_port"], timeout)
else:
mailserver = smtplib.SMTP(settings["mail_server"], settings["mail_port"], timeout)
mailserver.set_debuglevel(1)
if int(use_ssl) == 1:
mailserver.ehlo()
mailserver.starttls()
mailserver.ehlo()
# if int(use_ssl) == 1:
# mailserver.ehlo()
# mailserver.starttls()
# mailserver.ehlo()
if settings["mail_password"]:
mailserver.login(settings["mail_login"], settings["mail_password"])
@ -150,7 +153,7 @@ def send_mail(book_id, kindle_mail):
msg['To'] = kindle_mail
msg['Subject'] = _('Send to Kindle')
text = _('This email has been sent via calibre web.')
msg.attach(MIMEText(text))
msg.attach(MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8'))
use_ssl = settings.get('mail_use_ssl', 0)
@ -201,13 +204,16 @@ def send_mail(book_id, kindle_mail):
org_stderr = smtplib.stderr
smtplib.stderr = StderrLogger()
if int(use_ssl) == 1:
mailserver = smtplib.SMTP_SSL(settings["mail_server"], settings["mail_port"],timeout)
else:
mailserver = smtplib.SMTP(settings["mail_server"], settings["mail_port"],timeout)
mailserver.set_debuglevel(1)
if int(use_ssl) == 1:
mailserver.ehlo()
mailserver.starttls()
mailserver.ehlo()
# if int(use_ssl) == 1:
# mailserver.ehlo()
# mailserver.starttls()
# mailserver.ehlo()
if settings["mail_password"]:
mailserver.login(settings["mail_login"], settings["mail_password"])

View File

@ -41,7 +41,7 @@ msgstr "发送到Kindle"
#: cps/helper.py:174 cps/helper.py:189
msgid "Could not find any formats suitable for sending by email"
msgstr "无法适合邮件发送的格式"
msgstr "无法找到适合邮件发送的格式"
#: cps/helper.py:183
msgid "Could not convert epub to mobi"
@ -156,7 +156,7 @@ msgstr "此书已被成功发给 %(kindlemail)s"
#: cps/web.py:1212
#, python-format
msgid "There was an error sending this book: %(res)s"
msgstr "发送 %(res)s 这本书的时候出现错误"
msgstr "发送这本书的时候出现错误: %(res)s"
#: cps/web.py:1214
msgid "Please configure your kindle email address first..."