Alerting: Add EmbeddedContents as alternative embedding in smtp (#99937)
Adds support for embedding []byte in SmtpClient instead of filenames. This is backwards compatible as it uses a new field EmbeddedContents to add an alternative to the existing EmbeddedFiles which takes filenames.
This commit is contained in:
@@ -142,6 +142,13 @@ func (sc *SmtpClient) setFiles(
|
||||
m.Embed(file)
|
||||
}
|
||||
|
||||
for _, file := range msg.EmbeddedContents {
|
||||
m.Embed(file.Name, gomail.SetCopyFunc(func(writer io.Writer) error {
|
||||
_, err := writer.Write(file.Content)
|
||||
return err
|
||||
}))
|
||||
}
|
||||
|
||||
for _, file := range msg.AttachedFiles {
|
||||
file := file
|
||||
m.Attach(file.Name, gomail.SetCopyFunc(func(writer io.Writer) error {
|
||||
|
||||
Reference in New Issue
Block a user