mailbox.go 479 B

1234567891011121314151617
  1. package Utils
  2. import "gopkg.in/gomail.v2"
  3. func SendMail(to string, subject string, content string) bool {
  4. status := true
  5. mail := gomail.NewMessage()
  6. mail.SetHeader("From", mail.FormatAddress("open@wileho.com", "GEEKROS"))
  7. mail.SetHeader("To", to)
  8. mail.SetHeader("Subject", subject)
  9. mail.SetBody("text/html", content)
  10. send := gomail.NewDialer("smtp.qq.com", 587, "open@wileho.com", "")
  11. if err := send.DialAndSend(mail); err != nil {
  12. status = false
  13. }
  14. return status
  15. }