service/bizcommon/util/sms.go

26 lines
591 B
Go

package util
import (
"service/library/logger"
"gopkg.in/gomail.v2"
)
func SendMessage(message string) {
m := gomail.NewMessage()
m.SetHeader("From", "956958740@qq.com", "心愿宝官方")
m.SetHeader("To", "3345833206@qq.com")
m.SetHeader("Subject", "心愿宝官方:请验证您的验证码")
m.SetBody("text/html", message)
// m.Attach("./Dockerfile") //添加附件
err := gomail.NewDialer("smtp.qq.com", 465, "956958740@qq.com", "dpqlpxawtgrybfdd").DialAndSend(m)
if err != nil {
logger.Error("Send Email Fail", err)
return
}
logger.Info("Send Email Success")
}