Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with some email clients that do not split Base64 encoded output in accordance with RFC2045. #362

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"encoding/base64"
"io"
"mime"
"mime/quotedprintable"
"net/textproto"
"sort"
"strings"
"time"

"github.com/huangshaokun/mimequotedprintable"
"github.com/jhillyerd/enmime/v2/internal/coding"
"github.com/jhillyerd/enmime/v2/internal/stringutil"
)
Expand Down Expand Up @@ -243,7 +243,7 @@ func (p *Part) encodeContent(b *bufio.Writer, cte transferEncoding) (err error)
text = text[lineLen:]
}
case teQuoted:
qp := quotedprintable.NewWriter(b)
qp := mimequotedprintable.NewWriter(b)
if _, err = qp.Write(p.Content); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a
github.com/go-test/deep v1.1.1
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f
github.com/huangshaokun/mimequotedprintable v0.0.0-20230626102010-a5b2166f9691
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f h1:3BSP1Tbs2djlpprl7wCLuiqMaUh5SJkkzI2gDs+FgLs=
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
github.com/huangshaokun/mimequotedprintable v0.0.0-20230626102010-a5b2166f9691 h1:cMH8l7waIU0+24EihDQBtCfpwdHsvYNaNgOOg2iyAPE=
github.com/huangshaokun/mimequotedprintable v0.0.0-20230626102010-a5b2166f9691/go.mod h1:gDBKZcuLIpRM4uX1/Dv2jLAF+9Fqf5zy0Rg2XzPh+Iw=
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 h1:iCHtR9CQyktQ5+f3dMVZfwD2KWJUgm7M0gdL9NGr8KA=
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
Expand Down
4 changes: 2 additions & 2 deletions part.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"encoding/base64"
"io"
"math/rand"
"mime/quotedprintable"
"net/textproto"
"strconv"
"strings"
"time"

"github.com/gogs/chardet"
"github.com/huangshaokun/mimequotedprintable"
"github.com/jhillyerd/enmime/v2/internal/coding"
inttp "github.com/jhillyerd/enmime/v2/internal/textproto"
"github.com/jhillyerd/enmime/v2/mediatype"
Expand Down Expand Up @@ -290,7 +290,7 @@ func (p *Part) decodeContent(r io.Reader, readPartErrorPolicy ReadPartErrorPolic
switch strings.ToLower(encoding) {
case cteQuotedPrintable:
contentReader = coding.NewQPCleaner(contentReader)
contentReader = quotedprintable.NewReader(contentReader)
contentReader = mimequotedprintable.NewReader(contentReader)
case cteBase64:
b64cleaner = coding.NewBase64Cleaner(contentReader)
contentReader = base64.NewDecoder(base64.RawStdEncoding, b64cleaner)
Expand Down
Loading