email.go 698 B

12345678910111213141516171819202122232425262728293031323334
  1. package service
  2. import (
  3. "go-common/app/job/bbq/video/model"
  4. gomail "gopkg.in/gomail.v2"
  5. )
  6. //SendMail ...
  7. func (s *Service) SendMail(mailType int) (err error) {
  8. var (
  9. m = gomail.NewMessage()
  10. message = map[string][]string{}
  11. cType string
  12. cBody string
  13. )
  14. switch mailType {
  15. //运营i后台脚本导入完成推送邮件
  16. case model.JobFinishNotice:
  17. message["To"] = s.c.Mail.To
  18. message["Subject"] = []string{"同步运营筛选视频任务已完成"}
  19. cBody = "运营筛选视频已经导入完成!"
  20. cType = "text/plain"
  21. case 2:
  22. message["To"] = []string{"write your address"}
  23. }
  24. m.SetHeaders(message)
  25. m.SetBody(cType, cBody)
  26. err = s.dao.SendMail(m)
  27. return
  28. }