Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
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
ai-tech
dify
Commits
bdc13f92
Unverified
Commit
bdc13f92
authored
Mar 09, 2024
by
Laurent Magnien
Committed by
GitHub
Mar 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SMTP authentication is optional (#2765)
Co-authored-by:
Laurent Magnien
<
laurent.magnien@adsn.fr
>
parent
ce58f060
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
ext_mail.py
api/extensions/ext_mail.py
+0
-2
smtp.py
api/libs/smtp.py
+2
-1
No files found.
api/extensions/ext_mail.py
View file @
bdc13f92
...
...
@@ -32,8 +32,6 @@ class Mail:
from
libs.smtp
import
SMTPClient
if
not
app
.
config
.
get
(
'SMTP_SERVER'
)
or
not
app
.
config
.
get
(
'SMTP_PORT'
):
raise
ValueError
(
'SMTP_SERVER and SMTP_PORT are required for smtp mail type'
)
if
not
app
.
config
.
get
(
'SMTP_USERNAME'
)
or
not
app
.
config
.
get
(
'SMTP_PASSWORD'
):
raise
ValueError
(
'SMTP_USERNAME and SMTP_PASSWORD are required for smtp mail type'
)
self
.
_client
=
SMTPClient
(
server
=
app
.
config
.
get
(
'SMTP_SERVER'
),
port
=
app
.
config
.
get
(
'SMTP_PORT'
),
...
...
api/libs/smtp.py
View file @
bdc13f92
...
...
@@ -16,7 +16,8 @@ class SMTPClient:
smtp
=
smtplib
.
SMTP
(
self
.
server
,
self
.
port
)
if
self
.
_use_tls
:
smtp
.
starttls
()
smtp
.
login
(
self
.
username
,
self
.
password
)
if
(
self
.
username
):
smtp
.
login
(
self
.
username
,
self
.
password
)
msg
=
MIMEMultipart
()
msg
[
'Subject'
]
=
mail
[
'subject'
]
msg
[
'From'
]
=
self
.
_from
...
...
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