dao.go 433 B

1234567891011121314151617181920212223242526
  1. package email
  2. import (
  3. "crypto/tls"
  4. "go-common/app/job/main/up/conf"
  5. gomail "gopkg.in/gomail.v2"
  6. )
  7. // Dao is redis dao.
  8. type Dao struct {
  9. email *gomail.Dialer
  10. }
  11. // New is new redis dao.
  12. func New(c *conf.Config) (d *Dao) {
  13. d = &Dao{
  14. // mail
  15. email: gomail.NewDialer(c.MailConf.Host, c.MailConf.Port, c.MailConf.Username, c.MailConf.Password),
  16. }
  17. d.email.TLSConfig = &tls.Config{
  18. InsecureSkipVerify: true,
  19. }
  20. return
  21. }