From 5fe3ffbf942e06258c092a75caddce159372a6bd Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Tue, 6 Dec 2022 15:20:31 +0800 Subject: [PATCH] fix: notify send email with duplicate attachments (#15493) Co-authored-by: Qiu Jian --- pkg/notify/sender/email.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/notify/sender/email.go b/pkg/notify/sender/email.go index 1b0be88921..1662503012 100644 --- a/pkg/notify/sender/email.go +++ b/pkg/notify/sender/email.go @@ -65,7 +65,8 @@ func SendEmail(conf *api.SEmailConfig, msg *api.SEmailMessage) error { gmsg.SetHeader("Subject", msg.Subject) gmsg.SetBody("text/html", msg.Body) - for _, attach := range msg.Attachments { + for i := range msg.Attachments { + attach := msg.Attachments[i] gmsg.Attach(attach.Filename, mail.SetCopyFunc(func(w io.Writer) error { mime := attach.Mime