mirror of
https://github.com/casdoor/casdoor.git
synced 2025-08-29 17:11:35 +08:00
fix: improvde code logic (#285)
Signed-off-by: sh1luo <690898835@qq.com>
This commit is contained in:
@@ -18,7 +18,7 @@ package object
|
||||
|
||||
import "github.com/go-gomail/gomail"
|
||||
|
||||
func SendEmail(provider *Provider, title, content, dest, sender string) string {
|
||||
func SendEmail(provider *Provider, title, content, dest, sender string) error {
|
||||
dialer := gomail.NewDialer(provider.Host, provider.Port, provider.ClientId, provider.ClientSecret)
|
||||
|
||||
message := gomail.NewMessage()
|
||||
@@ -27,10 +27,5 @@ func SendEmail(provider *Provider, title, content, dest, sender string) string {
|
||||
message.SetHeader("Subject", title)
|
||||
message.SetBody("text/html", content)
|
||||
|
||||
err := dialer.DialAndSend(message)
|
||||
if err == nil {
|
||||
return ""
|
||||
} else {
|
||||
return err.Error()
|
||||
}
|
||||
return dialer.DialAndSend(message)
|
||||
}
|
||||
|
Reference in New Issue
Block a user