2015-06-04 10:23:46 -05:00
|
|
|
package notifications
|
|
|
|
|
|
|
|
import (
|
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Create New mail message use MailFrom and MailUser
|
2015-06-05 04:08:19 -05:00
|
|
|
func newMailMessageFrom(To []string, from, subject, body string) m.SendEmailCommand {
|
|
|
|
return m.NewSendEmailCommand(To, from, subject, body)
|
2015-06-04 10:23:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create New mail message use MailFrom and MailUser
|
2015-06-05 04:08:19 -05:00
|
|
|
func newMailMessage(To string, subject, body string) m.SendEmailCommand {
|
|
|
|
return newMailMessageFrom([]string{To}, setting.Smtp.FromAddress, subject, body)
|
2015-06-04 10:23:46 -05:00
|
|
|
}
|
|
|
|
|
2015-06-05 04:08:19 -05:00
|
|
|
func getMailTmplData(u *m.User) map[interface{}]interface{} {
|
2015-06-04 10:23:46 -05:00
|
|
|
data := make(map[interface{}]interface{}, 10)
|
|
|
|
data["AppUrl"] = setting.AppUrl
|
|
|
|
data["BuildVersion"] = setting.BuildVersion
|
|
|
|
data["BuildStamp"] = setting.BuildStamp
|
2015-06-08 03:57:01 -05:00
|
|
|
data["EmailCodeValidHours"] = setting.EmailCodeValidMinutes / 60
|
2015-06-05 04:08:19 -05:00
|
|
|
data["Subject"] = map[string]interface{}{}
|
2015-06-04 10:23:46 -05:00
|
|
|
if u != nil {
|
2015-06-08 03:57:01 -05:00
|
|
|
data["Name"] = u.NameOrFallback()
|
2015-06-04 10:23:46 -05:00
|
|
|
}
|
|
|
|
return data
|
|
|
|
}
|