Closed EtienneBruines closed 9 years ago
I managed to fix this, by changing in gomail.go
(lines 175+)
// SetBody sets the body of the message.
func (msg *Message) SetBody(contentType, body string) {
msg.parts = []part{
part{
contentType: contentType,
body: bytes.NewBufferString(body),
},
}
}
to
// SetBody sets the body of the message.
func (msg *Message) SetBody(contentType, body string) {
msg.parts = append(msg.parts, []part{
part{
contentType: contentType,
body: bytes.NewBufferString(body),
},
}...)
}
However, the name SetBody
does not seem appropriate anymore. Perhaps this should be renamed to AddBody
in this case (breaking change), or another function all together (SetBody
with the original behavior, and AddBody
with the new behavior. ) Or perhaps AppendBody
instead of AddBody
.
Any thoughts?
AddAlternative is exactly what you are looking for.
Did not see that one! Thank you.
Its often convenient to send both
text/html
andtext/plain
: pretty emails for those that support it, and basic emails for those that don't.However, the second
SetBody
, replaces the first.