mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Another fix for the written byte counting, this time for parts (alt/attach/embed)
This commit is contained in:
parent
429c9a1883
commit
68049b568d
1 changed files with 11 additions and 3 deletions
10
msgwriter.go
10
msgwriter.go
|
@ -260,8 +260,11 @@ func (mw *msgWriter) writeBody(f func(io.Writer) (int64, error), e Encoding) {
|
|||
case EncodingB64:
|
||||
ew = base64.NewEncoder(base64.StdEncoding, &wbuf)
|
||||
case NoEncoding:
|
||||
n, mw.err = f(w)
|
||||
_, mw.err = f(&wbuf)
|
||||
n, mw.err = io.Copy(w, &wbuf)
|
||||
if mw.d == 0 {
|
||||
mw.n += n
|
||||
}
|
||||
return
|
||||
default:
|
||||
ew = quotedprintable.NewWriter(w)
|
||||
|
@ -270,5 +273,10 @@ func (mw *msgWriter) writeBody(f func(io.Writer) (int64, error), e Encoding) {
|
|||
_, mw.err = f(ew)
|
||||
mw.err = ew.Close()
|
||||
n, mw.err = io.Copy(w, &wbuf)
|
||||
|
||||
// Since the part writer uses the Write() method, we don't need to add the
|
||||
// bytes twice
|
||||
if mw.d == 0 {
|
||||
mw.n += n
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue