Attach io.Writer
hasanAjsf opened this issue · 0 comments
hasanAjsf commented
I can send an email smoothly with html5 template as:
t, _ := template.ParseFiles("template.html")
m.AddAlternativeWriter("text/html", func(w io.Writer) error {
return t.Execute(w, struct {
Name string
Message string
Number string
}{
Name: PushName,
Message: caption,
Number: sender,
})
})
What I'm looking for, is instead of sending the template as the email body, I want to send it as attachement, something like:
m.Attach(("text/html", func(w io.Reader) error {
return t.Execute(w, struct {
Name string
Message string
Number string
}{
Name: PushName,
Message: caption,
Number: sender,
})
})
What is the best way to do so.
Thanks