View definition

(*Message).AddAlternative

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

Description

AddAlternative adds an alternative part to the message.

It is commonly used to send HTML emails that default to the plain text version for backward compatibility. AddAlternative appends the new part to the end of the message. So the plain text part should be added before the HTML part. See http://en.wikipedia.org/wiki/MIME#Alternative

Examples

	m.SetHeader("To", "[email protected]")
	m.SetBody("text/plain", "¡Hola, señor!")
	m.AddAlternative("text/html", "¡Hola, señor!")

	want := &message{

	m.SetHeader("To", "[email protected]")
	m.SetBody("text/plain; format=flowed", "¡Hola, señor!", SetPartEncoding(Unencoded))
	m.AddAlternative("text/html", "¡Hola, señor!")

	want := &message{

	m.SetHeader("To", "[email protected]")
	m.SetBody("text/plain", "¡Hola, señor!")
	m.AddAlternative("text/html", "¡Hola, señor!")
	m.Attach(mockCopyFile("test.pdf"))
	m.Embed(mockCopyFile("image.jpg"))

AddAlternative is referenced in 2 repositories

github.com/go-gomail/gomail github.com/drone-plugins/drone-email