Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
33988637
Commit
33988637
authored
Mar 05, 2026
by
shaw
Browse files
fix: SMTP测试连接和发送测试邮件返回具体错误信息而非internal error
parent
d4f6ad72
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/setting_handler.go
View file @
33988637
...
@@ -819,7 +819,7 @@ func (h *SettingHandler) TestSMTPConnection(c *gin.Context) {
...
@@ -819,7 +819,7 @@ func (h *SettingHandler) TestSMTPConnection(c *gin.Context) {
err
:=
h
.
emailService
.
TestSMTPConnectionWithConfig
(
config
)
err
:=
h
.
emailService
.
TestSMTPConnectionWithConfig
(
config
)
if
err
!=
nil
{
if
err
!=
nil
{
response
.
ErrorFrom
(
c
,
err
)
response
.
BadRequest
(
c
,
"SMTP connection test failed: "
+
err
.
Error
()
)
return
return
}
}
...
@@ -905,7 +905,7 @@ func (h *SettingHandler) SendTestEmail(c *gin.Context) {
...
@@ -905,7 +905,7 @@ func (h *SettingHandler) SendTestEmail(c *gin.Context) {
`
`
if
err
:=
h
.
emailService
.
SendEmailWithConfig
(
config
,
req
.
Email
,
subject
,
body
);
err
!=
nil
{
if
err
:=
h
.
emailService
.
SendEmailWithConfig
(
config
,
req
.
Email
,
subject
,
body
);
err
!=
nil
{
response
.
ErrorFrom
(
c
,
err
)
response
.
BadRequest
(
c
,
"Failed to send test email: "
+
err
.
Error
()
)
return
return
}
}
...
...
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