add allowed styles elements to render html

This commit is contained in:
Matthieu Lamalle 2025-03-13 09:14:10 +01:00
parent 888ff2ec47
commit f777cf6d11

View File

@ -81,6 +81,8 @@ func serveEmailHTMLContent(w http.ResponseWriter, r *http.Request) {
}
policy := bluemonday.UGCPolicy()
policy.AllowAttrs("style", "color", "bgcolor").OnElements("h1", "h2", "h3", "h4", "h5", "h6", "p", "ul", "ol", "li", "a", "br", "strong", "em", "i", "b", "u", "span", "div", "table", "thead", "tbody", "tr", "th", "td", "img")
sanitizedHTML := policy.Sanitize(email.HTML)
w.Header().Set("Content-Type", "text/html")