You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
434 B

package dao
import (
"go-common/library/log"
"gopkg.in/gomail.v2"
)
func (d *Dao) SendEmail(subject string, to string, body string) (err error) {
msg := gomail.NewMessage()
msg.SetHeader("From", d.c.Mail.Username)
msg.SetHeader("To", to)
msg.SetHeader("Subject", subject)
msg.SetBody("text/plain", body)
if err = d.email.DialAndSend(msg); err != nil {
log.Error("s.email.DialAndSend error(%v)", err)
return
}
return
}