Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
60448fbd
authored
Aug 23, 2024
by
OswinWu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 多地区outlook邮箱和ofb邮箱Auth
parent
e12516e9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
common/email-outlook-auth.go
+8
-0
common/email.go
+1
-1
No files found.
common/email-outlook-auth.go
View file @
60448fbd
...
...
@@ -3,6 +3,7 @@ package common
import
(
"errors"
"net/smtp"
"strings"
)
type
outlookAuth
struct
{
...
...
@@ -30,3 +31,10 @@ func (a *outlookAuth) Next(fromServer []byte, more bool) ([]byte, error) {
}
return
nil
,
nil
}
func
isOutlookServer
(
server
string
)
bool
{
// 兼容多地区的outlook邮箱和ofb邮箱
// 其实应该加一个Option来区分是否用LOGIN的方式登录
// 先临时兼容一下
return
strings
.
Contains
(
server
,
"outlook"
)
||
strings
.
Contains
(
server
,
"onmicrosoft"
)
}
common/email.go
View file @
60448fbd
...
...
@@ -68,7 +68,7 @@ func SendEmail(subject string, receiver string, content string) error {
if
err
!=
nil
{
return
err
}
}
else
if
strings
.
HasSuffix
(
SMTPAccount
,
"outlook.com"
)
{
}
else
if
isOutlookServer
(
SMTPAccount
)
{
auth
=
LoginAuth
(
SMTPAccount
,
SMTPToken
)
err
=
smtp
.
SendMail
(
addr
,
auth
,
SMTPAccount
,
to
,
mail
)
}
else
{
...
...
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