Compare commits

..

No commits in common. "4275ef759394760f3dcec22728f58c4072683298" and "3be19bf29cddbdcabfbbb11312af3af05335fe4e" have entirely different histories.

2 changed files with 2 additions and 15 deletions

View File

@ -247,12 +247,6 @@ func ScanDeviceStatus() {
}
func SendMail(title, content string) {
//捕获异常
defer func() {
if err := recover(); err != nil {
fmt.Errorf("tool send mail error: %s", err)
}
}()
// TODO
// 发送邮件
// 邮件内容

View File

@ -2,6 +2,7 @@ package worker
import (
"fmt"
"log"
"net/smtp"
)
@ -14,13 +15,6 @@ type MyEmail struct {
}
func (e *MyEmail) Send(title, content string, toEmail []string) error {
//捕获异常
defer func() {
if err := recover(); err != nil {
fmt.Errorf("MyEmail send mail error: %s", err)
}
}()
// 设置邮件头部
header := make(map[string]string)
header["From"] = e.SmtpUserName
@ -37,8 +31,7 @@ func (e *MyEmail) Send(title, content string, toEmail []string) error {
// 发送邮件
err := smtp.SendMail(e.SmtpHost, smtp.PlainAuth("", e.SmtpUserName, e.SmtpPassword, "pop.qq.com"), e.SmtpUserName, toEmail, []byte(message))
if err != nil {
//log.Fatalf("smtp error: %s", err)
fmt.Errorf("send mail error: %s", err)
log.Fatalf("smtp error: %s", err)
}
return nil