Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant