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

Attach io.Writer #74

@hasanAjsf

Description

@hasanAjsf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions