setting_smtp.go 907 B

12345678910111213141516171819202122232425262728293031
  1. package setting
  2. type SmtpSettings struct {
  3. Enabled bool
  4. Host string
  5. User string
  6. Password string
  7. CertFile string
  8. KeyFile string
  9. FromAddress string
  10. SkipVerify bool
  11. SendWelcomeEmailOnSignUp bool
  12. TemplatesPattern string
  13. }
  14. func readSmtpSettings() {
  15. sec := Cfg.Section("smtp")
  16. Smtp.Enabled = sec.Key("enabled").MustBool(false)
  17. Smtp.Host = sec.Key("host").String()
  18. Smtp.User = sec.Key("user").String()
  19. Smtp.Password = sec.Key("password").String()
  20. Smtp.CertFile = sec.Key("cert_file").String()
  21. Smtp.KeyFile = sec.Key("key_file").String()
  22. Smtp.FromAddress = sec.Key("from_address").String()
  23. Smtp.SkipVerify = sec.Key("skip_verify").MustBool(false)
  24. emails := Cfg.Section("emails")
  25. Smtp.SendWelcomeEmailOnSignUp = emails.Key("welcome_email_on_sign_up").MustBool(false)
  26. Smtp.TemplatesPattern = emails.Key("templates_pattern").MustString("emails/*.html")
  27. }