Fix for msgwriter.go

This commit is contained in:
Winni Neessen 2022-03-13 19:04:58 +01:00
parent 3c9944cf41
commit fd04243ebf
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -101,11 +101,17 @@ func (mw *msgWriter) newPart(h map[string][]string) {
// writePart writes the corresponding part to the Msg body // writePart writes the corresponding part to the Msg body
func (mw *msgWriter) writePart(p *Part, cs Charset) { func (mw *msgWriter) writePart(p *Part, cs Charset) {
mh := textproto.MIMEHeader{} ct := fmt.Sprintf("%s; charset=%s", p.ctype, cs)
mh.Add(string(HeaderContentType), fmt.Sprintf("%s; charset=%s", cte := fmt.Sprintf("%s", p.enc)
p.ctype, cs)) if mw.d == 0 {
mh.Add(string(HeaderContentTransferEnc), string(p.enc)) mw.writeHeader(HeaderContentType, ct)
mw.writeHeader(HeaderContentTransferEnc, cte)
mw.writeString("\r\n")
}
if mw.d > 0 { if mw.d > 0 {
mh := textproto.MIMEHeader{}
mh.Add(string(HeaderContentType), ct)
mh.Add(string(HeaderContentTransferEnc), cte)
mw.newPart(mh) mw.newPart(mh)
} }
mw.writeBody(p.w, p.enc) mw.writeBody(p.w, p.enc)