email.go 865 B

1234567891011121314151617181920212223242526272829303132333435
  1. package notifications
  2. import (
  3. m "github.com/grafana/grafana/pkg/models"
  4. "github.com/grafana/grafana/pkg/setting"
  5. )
  6. // AttachedFile is struct representating email attached files
  7. type AttachedFile struct {
  8. Name string
  9. Content []byte
  10. }
  11. // Message is representation of the email message
  12. type Message struct {
  13. To []string
  14. From string
  15. Subject string
  16. Body string
  17. Info string
  18. ReplyTo []string
  19. EmbededFiles []string
  20. AttachedFiles []*AttachedFile
  21. }
  22. func setDefaultTemplateData(data map[string]interface{}, u *m.User) {
  23. data["AppUrl"] = setting.AppUrl
  24. data["BuildVersion"] = setting.BuildVersion
  25. data["BuildStamp"] = setting.BuildStamp
  26. data["EmailCodeValidHours"] = setting.EmailCodeValidMinutes / 60
  27. data["Subject"] = map[string]interface{}{}
  28. if u != nil {
  29. data["Name"] = u.NameOrFallback()
  30. }
  31. }