-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I'll try to reproduce and check what's going on. |
Beta Was this translation helpful? Give feedback.
-
Hi @ZinedineR, I wasn't able to reproduce this- given though, I don't have a GMail account, so I can't verify it there. But both my personal webmail and ProtonMail webUI as well Outlook showed the proper base64-dataurl-encoded image. Here is the code I used: package main
import (
"context"
"fmt"
"os"
"time"
"github.com/wneessen/go-mail"
)
var pt = `<!DOCTYPE html>
<html>
<head>
<title>This is the title</title>
</head>
<body>
<div style="color: #000000; line-height: 140%; text-align: left; word-wrap: break-word;">
<div style="line-height: 140%; text-align: left; overflow-wrap: break-word;" class="esd-text">
<p style="line-height: 170%;"><br></p>
<p style="line-height: 170%;">
<img src="data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAIMAAAAqCAYAAACQjuhAAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAMHpUWHROSW1hZ2VGaWxlUE5HIDEuMC4yAAB4XvPzzE1MT3XLzEkN8HNXMNQz0DMCAD+nBabU0vuhAAAHZElEQVR4Xu2aX0xU2R3HPyAocsdumsqd0SbtMmzTP3IlbFp123QjzLAvZsH2YWXAtnFRm67bReMDKtYHK7U2sUKjJjpCN1EctptWgW6aLMySNI1g02CaSzcm7Q6b/pGZe7dpXebCCgp9GObKMHe4M8MwmHo/j+d8z5mbe7/n9/udcyZn4pOHs1hYALlmAounB8sMFjqWGSx0LDNY6FhmsNCxzGChY5nBQscyg4VOWmZQr77J+1XbufOVEv62p54H9/5lNiR5HnxIvvwS+X8oYPWfvkiues1shEWGyEn1BHLy7l3ufntHTNuqTz3Dhtd+SNF39yQYlRy59y6w6h8nYfp+TPtDqY/ZZ76ZYJRFpkg5Mvz75ttxbY8+vs8/f3qKqSttzGphg1GLM6uFmfK2sSpwOM4IAHlKZqODoiooqmIme+rIMxMs5NH9jxP2Td3o4uGt31Nw5jy5RRsS6uYzo47xSdPrzITuIXzZTJ0+fn8f7w30EwgE0DQNAEEQcDqduF0vUVHhM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u4XFWsFBkzA0Cu6ED45a+Z8rUzde2KmRyA/JpdrNl/0EyWErbCyMsOhoJMaJrhaqvz7I5rCwXHDCOGYLNRvGCLN39Oo1RkF+0ERgMoSkg3iqIotPmuxhx8SZKkj1FVNW6ebJJRM0RZ7Wkgt8jBg86OhFEiR7Cx5sTPyCstN+xfCoVzB0vBUJDAhwFKNz1+4VGMTvG6e2/AgJ9ni2M//LoF5yQLMTKbYIttuz00SMvpHwOR9LVt29cJaxqjowGUUDBu/EqQ8t1EsuS5d7D2zAVyxI3xfZvLWXv+6rIYIUplpRsAny/5e413ensBKCstM1GmTnuHF4C6ut1cvtxB4xuHaD56nCuXO3BVuE1GZ4dlMwM8Thurd+/V2/JrdlFw+iK54vJWytUv1yAIkcre5+s0k+PzdernElu2pr8DMUJRFYJzq792V3xEUj4KxbWtBMuSJhYSTRs4Ni5rNJhPoSDQ3HyCY8ea8HV1oqgKdZ76uLuHCU3D13Wd7p4bABxsPGQ03ZKI1jAQ2WLOfwafrzPm3GElyYoZIJI2sk3pJonmoz/C2+HF7+/D7+9DkiTEuaikKMGYC6yGffsN64ulUigISJKELMs0Nx9hU6mEXbQjj/w5cvlkdzwRdUPWzLBSbN32AsUlJfg6rzH0x8G5j/94JQqCgCSVsXfvftNj5KXQfPQEXu8l/AP9esqASA3BLFxPobZZLlL+p9O5303hf3/GsO+3hwsM25PlxZu7DNt3fG47Tc//wLAvVUb+IqONhwlPhnF+vgS73Z7Vgx5FVRj94AOAuBvUlSblyCCsyQWMzbBcrM1bayZJmuVIA6kgFonLGoGWQsq7iZ1fzaVYTHlY2pSv38Qrz2W/3ngaSTlNWPz/kr0lbvHEY5nBQscyg4WOZQYLHcsMFjqWGSx0LDNY6FhmsNCxzGChY5nBQud/31HRBKRRII0AAAAASUVORK5CYII=">
</p>
</div>
<h2>This is HTML in a H2</h2>
</body>
</html>`
func main() {
m := mail.NewMsg()
if err := m.FromFormat("Toni Tester", os.Getenv("TEST_FROM")); err != nil {
fmt.Printf("failed to set FROM: %s\n", err)
os.Exit(1)
}
if err := m.To(`wn@neessen.net`); err != nil {
fmt.Printf("failed to set TO: %s\n", err)
os.Exit(1)
}
m.Subject("This is the subject")
m.SetDate()
m.SetMessageID()
m.SetBodyString(mail.TypeTextHTML, pt)
c, err := mail.NewClient(os.Getenv("TEST_HOST"), mail.WithSMTPAuth(mail.SMTPAuthPlain),
mail.WithUsername(os.Getenv("TEST_USER")), mail.WithPassword(os.Getenv("TEST_PASS")),
mail.WithDebugLog())
if err != nil {
fmt.Printf("failed to create new client: %s\n", err)
os.Exit(1)
}
if err := c.DialAndSend(m); err != nil {
fmt.Printf("failed to dial/send: %s\n", err)
os.Exit(1)
}
} |
Beta Was this translation helpful? Give feedback.
-
Thanks @wneessen for the answer. I have tried using your base64 file and used my GMAIL as the SMTP service. I would try using another SMTP service for better service. |
Beta Was this translation helpful? Give feedback.
Btw. I used this web tool to convert my image to base64: https://base64.guru/converter/encode/image/jpg