Hi Y’all,
I have started using the following template which gives great email alert templates, but the subject looks bad (shown the actual HTML).
Grafana version: 9.3.2
email template:
{{ define "email" }}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<style></style>
</head>
<body>
<p>.Title = {{.Title}}</p>
<p>.State = {{.State}}</p>
<p>.Name = {{.Name}}</p>
<p>
.StateModel = {{.StateModel}}<br />
.StateModel.Color = {{.StateModel.Color}}<br />
.StateModel.Text = {{.StateModel.Text}}<br />
</p>
<p>.Message = {{.Message}}</p>
<p>.Error = {{.Error}}</p>
<p>.RuleUrl = {{.RuleUrl}}</p>
<p>.ImageLink = {{.ImageLink}}</p>
<p>
.EmbeddedImage = {{.EmbeddedImage}}<br />
{{if ne .EmbeddedImage "" }}
<img src="cid:{{.EmbeddedImage}}" />
{{end}}
</p>
<p>.AlertPageUrl = {{.AlertPageUrl}}</p>
<p>
.EvalMatches = {{.EvalMatches}}<br />
{{range .EvalMatches}} .Metric = {{.Metric}}<br />
.Value = {{.Value}}<br />
.Tags = {{.Tags}}<br />
{{end}}
</p>
</body>
</html>
{{ end }}
The subject when being sent looks like so -
it seems to show the HTML in the subject
I would like it to look like so -
[ STATUS | #OFALERTS | LABEL ] ALERTNAME
my slack template for this looks like so:
[{{- .Status | toUpper }} | {{ .Alerts.Firing | len }} | {{ .CommonLabels.env | toUpper }} ] {{ .CommonLabels.alertname -}}
Can it be reused?
Thank you