mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-25 23:15:08 +01:00
fix: part boundray and message encoding
This commit is contained in:
parent
79f22fb722
commit
46cf2ed498
2 changed files with 9 additions and 3 deletions
|
@ -138,6 +138,10 @@ func (mw *msgWriter) writeMsg(msg *Msg) {
|
||||||
if msg.hasMixed() {
|
if msg.hasMixed() {
|
||||||
mw.stopMP()
|
mw.stopMP()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if msg.hasSMime() {
|
||||||
|
mw.stopMP()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeGenHeader writes out all generic headers to the msgWriter
|
// writeGenHeader writes out all generic headers to the msgWriter
|
||||||
|
@ -341,7 +345,7 @@ func (mw *msgWriter) writeBody(writeFunc func(io.Writer) (int64, error), encodin
|
||||||
encodedWriter = quotedprintable.NewWriter(&writeBuffer)
|
encodedWriter = quotedprintable.NewWriter(&writeBuffer)
|
||||||
} else if encoding == EncodingB64 && !singingWithSMime {
|
} else if encoding == EncodingB64 && !singingWithSMime {
|
||||||
encodedWriter = base64.NewEncoder(base64.StdEncoding, &lineBreaker)
|
encodedWriter = base64.NewEncoder(base64.StdEncoding, &lineBreaker)
|
||||||
} else if encoding == NoEncoding {
|
} else if encoding == NoEncoding || singingWithSMime {
|
||||||
_, err = writeFunc(&writeBuffer)
|
_, err = writeFunc(&writeBuffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mw.err = fmt.Errorf("bodyWriter function: %w", err)
|
mw.err = fmt.Errorf("bodyWriter function: %w", err)
|
||||||
|
|
6
sime.go
6
sime.go
|
@ -105,8 +105,10 @@ func encodeToPEM(msg []byte) (*string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
r := arrayBuffer.String()
|
r := arrayBuffer.String()
|
||||||
r = strings.ReplaceAll(r, "-----BEGIN -----\n", "")
|
r = strings.TrimPrefix(r, "-----BEGIN -----")
|
||||||
r = strings.ReplaceAll(r, "-----END -----\n", "")
|
r = strings.Trim(r, "\n")
|
||||||
|
r = strings.TrimSuffix(r, "-----END -----")
|
||||||
|
r = strings.Trim(r, "\n")
|
||||||
|
|
||||||
return &r, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue