fix: improvde code logic (#285)

Signed-off-by: sh1luo <690898835@qq.com>
This commit is contained in:
sh1luo
2021-09-04 22:20:47 +08:00
committed by GitHub
parent e68b0198f1
commit a4edf47dc4
10 changed files with 44 additions and 45 deletions

View File

@@ -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)
}