Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
afdfb30d
Commit
afdfb30d
authored
8 years ago
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update email settings
parent
0967b03a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
+21
-22
db.py
cps/db.py
+1
-1
helper.py
cps/helper.py
+12
-14
email_edit.html
cps/templates/email_edit.html
+7
-3
web.py
cps/web.py
+1
-4
No files found.
cps/db.py
View file @
afdfb30d
...
...
@@ -105,7 +105,7 @@ class Identifiers(Base):
if
self
.
type
==
"amazon"
:
return
u"https://amzn.com/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"isbn"
:
return
u"http://
http://
www.worldcat.org/isbn/{0}"
.
format
(
self
.
val
)
return
u"http://www.worldcat.org/isbn/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"doi"
:
return
u"http://dx.doi.org/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"goodreads"
:
...
...
This diff is collapsed.
Click to expand it.
cps/helper.py
View file @
afdfb30d
...
...
@@ -113,16 +113,16 @@ def send_test_mail(kindle_mail):
org_stderr
=
smtplib
.
stderr
smtplib
.
stderr
=
StderrLogger
()
if
int
(
use_ssl
)
==
1
:
if
int
(
use_ssl
)
==
2
:
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"
])
...
...
@@ -151,8 +151,8 @@ def send_mail(book_id, kindle_mail):
msg
=
MIMEMultipart
()
msg
[
'From'
]
=
settings
[
"mail_from"
]
msg
[
'To'
]
=
kindle_mail
msg
[
'Subject'
]
=
_
(
'Send to Kindle'
)
text
=
_
(
'This email has been sent via calibre web.'
)
msg
[
'Subject'
]
=
_
(
u
'Send to Kindle'
)
text
=
_
(
u
'This email has been sent via calibre web.'
)
msg
.
attach
(
MIMEText
(
text
.
encode
(
'UTF-8'
),
'plain'
,
'UTF-8'
))
use_ssl
=
settings
.
get
(
'mail_use_ssl'
,
0
)
...
...
@@ -204,16 +204,14 @@ 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
)
if
int
(
use_ssl
)
==
2
:
mailserver
=
smtplib
.
SMTP_SSL
(
settings
[
"mail_server"
],
settings
[
"mail_port"
],
timeout
)
else
:
mailserver
=
smtplib
.
SMTP
(
settings
[
"mail_server"
],
settings
[
"mail_port"
],
timeout
)
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
.
starttls
()
if
settings
[
"mail_password"
]:
mailserver
.
login
(
settings
[
"mail_login"
],
settings
[
"mail_password"
])
...
...
This diff is collapsed.
Click to expand it.
cps/templates/email_edit.html
View file @
afdfb30d
...
...
@@ -8,12 +8,16 @@
<input
type=
"text"
class=
"form-control"
name=
"mail_server"
id=
"mail_server"
value=
"{{content.mail_server}}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"mail_port"
>
{{_('SMTP port (usually 25 for plain SMTP and
587 for SSL
)')}}
</label>
<label
for=
"mail_port"
>
{{_('SMTP port (usually 25 for plain SMTP and
465 for SSL and 587 for STARTTLS
)')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"mail_port"
id=
"mail_port"
value=
"{{content.mail_port}}"
>
</div>
<div
class=
"form-group"
>
<input
type=
"checkbox"
name=
"mail_use_ssl"
id=
"mail_use_ssl"
{%
if
content
.
mail_use_ssl
%}
checked
{%
endif
%}
>
<label
for=
"mail_use_ssl"
>
{{_('Server uses SSL (StartTLS)')}}
</label>
<label
for=
"mail_use_ssl"
>
{{_('Encryption')}}
</label>
<select
name=
"mail_use_ssl"
id=
"mail_use_ssl"
class=
"form-control"
>
<option
value=
"0"
{%
if
content
.
mail_use_ssl =
=
0
%}
selected
{%
endif
%}
>
{{ _('None') }}
</option>
<option
value=
"1"
{%
if
content
.
mail_use_ssl =
=
1
%}
selected
{%
endif
%}
>
{{ _('STARTTLS') }}
</option>
<option
value=
"2"
{%
if
content
.
mail_use_ssl =
=
2
%}
selected
{%
endif
%}
>
{{ _('SSL/TLS') }}
</option>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"mail_login"
>
{{_('SMTP login')}}
</label>
...
...
This diff is collapsed.
Click to expand it.
cps/web.py
View file @
afdfb30d
...
...
@@ -1562,10 +1562,7 @@ def edit_mailsettings():
content
.
mail_login
=
to_save
[
"mail_login"
]
content
.
mail_password
=
to_save
[
"mail_password"
]
content
.
mail_from
=
to_save
[
"mail_from"
]
if
"mail_use_ssl"
in
to_save
:
content
.
mail_use_ssl
=
1
else
:
content
.
mail_use_ssl
=
0
content
.
mail_use_ssl
=
int
(
to_save
[
"mail_use_ssl"
])
try
:
ub
.
session
.
commit
()
flash
(
_
(
u"Mail settings updated"
),
category
=
"success"
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment