Describe the bug
In sendEmail() (main.go:2236), strings.Replace(body, imgPath, "cid:"+cid, 1) only replaces the first occurrence of an image path. If the same image is referenced multiple times in the email body, subsequent occurrences won't be replaced with the correct CID, resulting in broken image references.
To reproduce
- Compose an email with the same image referenced twice in the body
- Send the email
- Second image reference remains as file path instead of CID
Expected behavior
Use strings.ReplaceAll() to replace all occurrences of the image path.
Describe the bug
In
sendEmail()(main.go:2236),strings.Replace(body, imgPath, "cid:"+cid, 1)only replaces the first occurrence of an image path. If the same image is referenced multiple times in the email body, subsequent occurrences won't be replaced with the correct CID, resulting in broken image references.To reproduce
Expected behavior
Use
strings.ReplaceAll()to replace all occurrences of the image path.