Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Attach io.Writer #74

Open
hasanAjsf opened this issue May 5, 2022 · 0 comments
Open

Attach io.Writer #74

hasanAjsf opened this issue May 5, 2022 · 0 comments

Comments

@hasanAjsf
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant