strip <style> in html emails

This commit is contained in:
Aine
2022-08-25 21:27:00 +03:00
parent 3495c60f24
commit 331c2a8d5e
3 changed files with 77 additions and 10 deletions

View File

@@ -11,3 +11,27 @@ type Email struct {
HTML string
Files []*File
}
// NewEmail constructs Email object
func NewEmail(messageID, inReplyTo, subject, from, to, text, html string, files []*File) *Email {
email := &Email{
MessageID: messageID,
InReplyTo: inReplyTo,
From: from,
To: to,
Subject: subject,
Text: text,
HTML: html,
Files: files,
}
if html != "" {
var err error
html, err = StripHTMLTag(html, "style")
if err == nil {
email.HTML = html
}
}
return email
}