You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I send two attachments at the same time, the content of the A attachment will be overwritten by the content of the attachment B, and the content of the attachment B is empty
My code is as follows,i appreciate it.
func SendMail(subject, body string, to []string, file map[string]*os.File) {
user := "[email protected]"
password := "123456"
m := gomail.NewMessage()
m.SetHeaders(map[string][]string{
"From": {m.FormatAddress("[email protected]", "test")},
"To": to,
"Subject": {subject},
})
m.SetBody("text/html", body)
for fname, f := range file {
m.Attach(fname, gomail.SetCopyFunc(func(w io.Writer) error {
_, err := io.Copy(w, f)
defer f.Close()
return err
}))
}
d := gomail.NewDialer("[email protected]", 587, user, password)
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
if err := d.DialAndSend(m); err != nil {
log.Println(err)
}
When I send two attachments at the same time, the content of the A attachment will be overwritten by the content of the attachment B, and the content of the attachment B is empty
My code is as follows,i appreciate it.
func SendMail(subject, body string, to []string, file map[string]*os.File) {
}
func main() {
}
The text was updated successfully, but these errors were encountered: