Email: Use MJML email templates (#57751)
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
This commit is contained in:
co-authored by
Santiago
parent
18738cfd77
commit
ea27eca147
@@ -189,9 +189,13 @@ func TestEmailNotifierIntegration(t *testing.T) {
|
||||
messageTmpl: "",
|
||||
expSubject: "[FIRING:2] ",
|
||||
expSnippets: []string{
|
||||
"Firing: 2 alerts",
|
||||
"<li>alertname: FiringOne</li><li>severity: warning</li>",
|
||||
"<li>alertname: FiringTwo</li><li>severity: critical</li>",
|
||||
"2 firing instances",
|
||||
"<strong>severity</strong>",
|
||||
"warning\n",
|
||||
"critical\n",
|
||||
"<strong>alertname</strong>",
|
||||
"FiringTwo\n",
|
||||
"FiringOne\n",
|
||||
"<a href=\"http://fix.me\"",
|
||||
"<a href=\"http://localhost/base/d/abc",
|
||||
"<a href=\"http://localhost/base/d/abc?viewPanel=5",
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Masterminds/sprig/v3"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/events"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
@@ -53,6 +54,7 @@ func ProvideService(bus bus.Bus, cfg *setting.Cfg, mailer Mailer, store TempUser
|
||||
mailTemplates.Funcs(template.FuncMap{
|
||||
"Subject": subjectTemplateFunc,
|
||||
})
|
||||
mailTemplates.Funcs(sprig.FuncMap())
|
||||
|
||||
for _, pattern := range ns.Cfg.Smtp.TemplatesPatterns {
|
||||
templatePattern := filepath.Join(ns.Cfg.StaticRootPath, pattern)
|
||||
|
||||
Reference in New Issue
Block a user