View definition

(*Message).AddAlternativeWriter

Defined in github.com/go-gomail/gomail/message.go

Description

AddAlternativeWriter adds an alternative part to the message. It can be useful with the text/template or html/template packages.

Examples

// HTML part. See http://en.wikipedia.org/wiki/MIME#Alternative
func (m *Message) AddAlternative(contentType, body string, settings ...PartSetting) {
	m.AddAlternativeWriter(contentType, newCopier(body), settings...)
}

	m.SetHeader("From", "[email protected]")
	m.SetHeader("To", "[email protected]")
	m.AddAlternativeWriter("text/plain", func(w io.Writer) error {
		_, err := w.Write([]byte("Test message"))
		return err

		return err
	})
	m.AddAlternativeWriter("text/html", func(w io.Writer) error {
		_, err := w.Write([]byte("Test HTML"))
		return err

AddAlternativeWriter is referenced in 1 repository

github.com/go-gomail/gomail