forked from Silverfish/proton-bridge
feat: revert back to quoted-printable
This commit is contained in:
@ -27,6 +27,7 @@ import (
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"mime"
|
||||
"mime/quotedprintable"
|
||||
"net/mail"
|
||||
"net/textproto"
|
||||
"regexp"
|
||||
@ -185,7 +186,7 @@ func checkHeaders(headers []textproto.MIMEHeader) bool {
|
||||
|
||||
// ============================== 7bit Filter ==========================
|
||||
// For every MIME part in the tree that has "8bit" or "binary" content
|
||||
// transfer encoding: transcode it to "base64".
|
||||
// transfer encoding: transcode it to "quoted-printable".
|
||||
|
||||
type SevenBitFilter struct {
|
||||
target pmmime.VisitAcceptor
|
||||
@ -215,16 +216,16 @@ func (sd SevenBitFilter) Accept(partReader io.Reader, header textproto.MIMEHeade
|
||||
for k, v := range header {
|
||||
filteredHeader[k] = v
|
||||
}
|
||||
filteredHeader.Set("Content-Transfer-Encoding", "base64")
|
||||
filteredHeader.Set("Content-Transfer-Encoding", "quoted-printable")
|
||||
|
||||
filteredBuffer := &bytes.Buffer{}
|
||||
decodedSlice, _ := ioutil.ReadAll(decodedPart)
|
||||
w := base64.NewEncoder(base64.StdEncoding, filteredBuffer)
|
||||
w := quotedprintable.NewWriter(filteredBuffer)
|
||||
if _, err := w.Write(decodedSlice); err != nil {
|
||||
log.Errorf("cannot write base64 from %q: %v", cte, err)
|
||||
log.Errorf("cannot write quotedprintable from %q: %v", cte, err)
|
||||
}
|
||||
if err := w.Close(); err != nil {
|
||||
log.Errorf("cannot close base64 from %q: %v", cte, err)
|
||||
log.Errorf("cannot close quotedprintable from %q: %v", cte, err)
|
||||
}
|
||||
|
||||
_ = sd.target.Accept(filteredBuffer, filteredHeader, hasPlainSibling, true, isLast)
|
||||
|
||||
@ -115,7 +115,7 @@ func TestRFC822AddressFormat(t *testing.T) { //nolint[funlen]
|
||||
}
|
||||
}
|
||||
|
||||
func f(filename string) io.Reader {
|
||||
func f(filename string) io.ReadCloser {
|
||||
f, err := os.Open(filepath.Join("testdata", filename))
|
||||
|
||||
if err != nil {
|
||||
@ -146,63 +146,78 @@ func readerToString(r io.Reader) string {
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlain(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain.eml"), "", "")
|
||||
f := f("text_plain.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, s("text_plain.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain.mime"), mimeBody)
|
||||
assert.Equal(t, "body", plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainUTF8(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_utf8.eml"), "", "")
|
||||
f := f("text_plain_utf8.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, s("text_plain_utf8.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_utf8.mime"), mimeBody)
|
||||
assert.Equal(t, "body", plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainLatin1(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_latin1.eml"), "", "")
|
||||
f := f("text_plain_latin1.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "ééééééé", m.Body)
|
||||
assert.Equal(t, s("text_plain_latin1.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_latin1.mime"), mimeBody)
|
||||
assert.Equal(t, "ééééééé", plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainUnknownCharsetIsActuallyLatin1(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_unknown_latin1.eml"), "", "")
|
||||
f := f("text_plain_unknown_latin1.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "ééééééé", m.Body)
|
||||
assert.Equal(t, s("text_plain_unknown_latin1.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_unknown_latin1.mime"), mimeBody)
|
||||
assert.Equal(t, "ééééééé", plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainUnknownCharsetIsActuallyLatin2(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_unknown_latin2.eml"), "", "")
|
||||
f := f("text_plain_unknown_latin2.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
@ -215,14 +230,17 @@ func TestParseMessageTextPlainUnknownCharsetIsActuallyLatin2(t *testing.T) {
|
||||
assert.NotEqual(t, []byte("řšřšřš"), expect)
|
||||
|
||||
assert.Equal(t, string(expect), m.Body)
|
||||
assert.Equal(t, s("text_plain_unknown_latin2.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_unknown_latin2.mime"), mimeBody)
|
||||
assert.Equal(t, string(expect), plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainAlready7Bit(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_7bit.eml"), "", "")
|
||||
f := f("text_plain_7bit.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
@ -236,14 +254,17 @@ func TestParseMessageTextPlainAlready7Bit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainWithOctetAttachment(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_octet_attachment.eml"), "", "")
|
||||
f := f("text_plain_octet_attachment.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, s("text_plain_octet_attachment.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_octet_attachment.mime"), mimeBody)
|
||||
assert.Equal(t, "body", plainContents)
|
||||
|
||||
assert.Len(t, atts, 1)
|
||||
@ -251,14 +272,17 @@ func TestParseMessageTextPlainWithOctetAttachment(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainWithPlainAttachment(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_plain_attachment.eml"), "", "")
|
||||
f := f("text_plain_plain_attachment.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, s("text_plain_plain_attachment.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_plain_attachment.mime"), mimeBody)
|
||||
assert.Equal(t, "body", plainContents)
|
||||
|
||||
assert.Len(t, atts, 1)
|
||||
@ -266,14 +290,17 @@ func TestParseMessageTextPlainWithPlainAttachment(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseMessageTextPlainWithImageInline(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain_image_inline.eml"), "", "")
|
||||
f := f("text_plain_image_inline.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, s("text_plain_image_inline.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_image_inline.mime"), mimeBody)
|
||||
assert.Equal(t, "body", plainContents)
|
||||
|
||||
// The inline image is an 8x8 mic-dropping gopher.
|
||||
@ -285,14 +312,17 @@ func TestParseMessageTextPlainWithImageInline(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseMessageWithMultipleTextParts(t *testing.T) {
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("multiple_text_parts.eml"), "", "")
|
||||
f := f("multiple_text_parts.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body\nsome other part of the message", m.Body)
|
||||
assert.Equal(t, s("multiple_text_parts.b64"), mimeBody)
|
||||
assert.Equal(t, s("multiple_text_parts.mime"), mimeBody)
|
||||
assert.Equal(t, "body\nsome other part of the message", plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
@ -301,14 +331,17 @@ func TestParseMessageWithMultipleTextParts(t *testing.T) {
|
||||
func TestParseMessageTextHTML(t *testing.T) {
|
||||
rand.Seed(0)
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_html.eml"), "", "")
|
||||
f := f("text_html.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "<html><head></head><body>This is body of <b>HTML mail</b> without attachment</body></html>", m.Body)
|
||||
assert.Equal(t, s("text_html.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_html.mime"), mimeBody)
|
||||
assert.Equal(t, "This is body of *HTML mail* without attachment", plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
@ -317,7 +350,10 @@ func TestParseMessageTextHTML(t *testing.T) {
|
||||
func TestParseMessageTextHTMLAlready7Bit(t *testing.T) {
|
||||
rand.Seed(0)
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_html_7bit.eml"), "", "")
|
||||
f := f("text_html_7bit.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
@ -333,14 +369,17 @@ func TestParseMessageTextHTMLAlready7Bit(t *testing.T) {
|
||||
func TestParseMessageTextHTMLWithOctetAttachment(t *testing.T) {
|
||||
rand.Seed(0)
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_html_octet_attachment.eml"), "", "")
|
||||
f := f("text_html_octet_attachment.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "<html><head></head><body>This is body of <b>HTML mail</b> with attachment</body></html>", m.Body)
|
||||
assert.Equal(t, s("text_html_octet_attachment.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_html_octet_attachment.mime"), mimeBody)
|
||||
assert.Equal(t, "This is body of *HTML mail* with attachment", plainContents)
|
||||
|
||||
assert.Len(t, atts, 1)
|
||||
@ -351,7 +390,10 @@ func TestParseMessageTextHTMLWithOctetAttachment(t *testing.T) {
|
||||
func _TestParseMessageTextHTMLWithPlainAttachment(t *testing.T) { // nolint[deadcode]
|
||||
rand.Seed(0)
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_html_plain_attachment.eml"), "", "")
|
||||
f := f("text_html_plain_attachment.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
@ -359,7 +401,7 @@ func _TestParseMessageTextHTMLWithPlainAttachment(t *testing.T) { // nolint[dead
|
||||
|
||||
// BAD: plainContents should not be empty!
|
||||
assert.Equal(t, "<html><head></head><body>This is body of <b>HTML mail</b> with attachment</body></html>", m.Body)
|
||||
assert.Equal(t, s("text_html_plain_attachment.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_html_plain_attachment.mime"), mimeBody)
|
||||
assert.Equal(t, "This is body of *HTML mail* with attachment", plainContents)
|
||||
|
||||
assert.Len(t, atts, 1)
|
||||
@ -369,14 +411,17 @@ func _TestParseMessageTextHTMLWithPlainAttachment(t *testing.T) { // nolint[dead
|
||||
func TestParseMessageTextHTMLWithImageInline(t *testing.T) {
|
||||
rand.Seed(0)
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_html_image_inline.eml"), "", "")
|
||||
f := f("text_html_image_inline.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "<html><head></head><body>This is body of <b>HTML mail</b> with attachment</body></html>", m.Body)
|
||||
assert.Equal(t, s("text_html_image_inline.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_html_image_inline.mime"), mimeBody)
|
||||
assert.Equal(t, "This is body of *HTML mail* with attachment", plainContents)
|
||||
|
||||
// The inline image is an 8x8 mic-dropping gopher.
|
||||
@ -389,15 +434,18 @@ func TestParseMessageTextHTMLWithImageInline(t *testing.T) {
|
||||
|
||||
// NOTE: Enable when bug is fixed.
|
||||
func _TestParseMessageWithAttachedPublicKey(t *testing.T) { // nolint[deadcode]
|
||||
f := f("text_plain.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
// BAD: Public Key is not attached unless Content-Type is specified (not required)!
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_plain.eml"), "publickey", "publickeyname")
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "publickey", "publickeyname")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, s("text_plain_pubkey.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_plain_pubkey.mime"), mimeBody)
|
||||
assert.Equal(t, "body", plainContents)
|
||||
|
||||
// BAD: Public key not available as an attachment!
|
||||
@ -408,7 +456,10 @@ func _TestParseMessageWithAttachedPublicKey(t *testing.T) { // nolint[deadcode]
|
||||
func _TestParseMessageTextHTMLWithEmbeddedForeignEncoding(t *testing.T) { // nolint[deadcode]
|
||||
rand.Seed(0)
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f("text_html_embedded_foreign_encoding.eml"), "", "")
|
||||
f := f("text_html_embedded_foreign_encoding.eml")
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
m, mimeBody, plainContents, atts, err := Parse(f, "", "")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
@ -416,7 +467,7 @@ func _TestParseMessageTextHTMLWithEmbeddedForeignEncoding(t *testing.T) { // nol
|
||||
|
||||
// BAD: Bridge does not detect the charset specified in the <meta> tag of the html.
|
||||
assert.Equal(t, `<html><head><meta charset="ISO-8859-2"></head><body>latin2 řšřš</body></html>`, m.Body)
|
||||
assert.Equal(t, s("text_html_embedded_foreign_encoding.b64"), mimeBody)
|
||||
assert.Equal(t, s("text_html_embedded_foreign_encoding.mime"), mimeBody)
|
||||
assert.Equal(t, `latin2 řšřš`, plainContents)
|
||||
|
||||
assert.Len(t, atts, 0)
|
||||
|
||||
@ -5,12 +5,13 @@ To: Receiver <receiver@pm.me>
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
body
|
||||
|
||||
Ym9keQo=
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
c29tZSBvdGhlciBwYXJ0IG9mIHRoZSBtZXNzYWdl
|
||||
some other part of the message
|
||||
--longrandomstring--
|
||||
.
|
||||
18
pkg/message/testdata/text_html.b64
vendored
18
pkg/message/testdata/text_html.b64
vendored
@ -1,18 +0,0 @@
|
||||
Content-Type: multipart/alternative; boundary="0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d"
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Type: text/html
|
||||
|
||||
PGh0bWw+PGJvZHk+VGhpcyBpcyBib2R5IG9mIDxiPkhUTUwgbWFpbDwvYj4gd2l0aG91dCBhdHRhY2htZW50PC9ib2R5PjwvaHRtbD4=
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Type: text/plain
|
||||
|
||||
VGhpcyBpcyBib2R5IG9mICpIVE1MIG1haWwqIHdpdGhvdXQgYXR0YWNobWVudA==
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d--
|
||||
.
|
||||
@ -5,14 +5,15 @@ To: Receiver <receiver@pm.me>
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/html
|
||||
|
||||
PGh0bWw+PGhlYWQ+PG1ldGEgY2hhcnNldD0iSVNPLTg4NTktMiI+PC9oZWFkPjxib2R5PmxhdGluMiD4ufi5PC9ib2R5PjwvaHRtbD4K
|
||||
<html><body>This is body of <b>HTML mail</b> without attachment</body></htm=
|
||||
l>
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain
|
||||
|
||||
bGF0aW4yIO+/ve+/ve+/ve+/vQ==
|
||||
This is body of *HTML mail* without attachment
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d--
|
||||
.
|
||||
@ -10,15 +10,15 @@ Content-Type: multipart/alternative; boundary="0194fdc2fa2ffcc041d3ff12045b73c86
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/html
|
||||
|
||||
PGh0bWw+PGJvZHk+VGhpcyBpcyBib2R5IG9mIDxiPkhUTUwgbWFpbDwvYj4gd2l0aCBhdHRhY2htZW50PC9ib2R5PjwvaHRtbD4=
|
||||
<html><body>This is body of <b>HTML mail</b> with attachment</body></html>
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain
|
||||
|
||||
VGhpcyBpcyBib2R5IG9mICpIVE1MIG1haWwqIHdpdGggYXR0YWNobWVudA==
|
||||
This is body of *HTML mail* with attachment
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d--
|
||||
.
|
||||
|
||||
@ -10,15 +10,15 @@ Content-Type: multipart/alternative; boundary="0194fdc2fa2ffcc041d3ff12045b73c86
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/html
|
||||
|
||||
PGh0bWw+PGJvZHk+VGhpcyBpcyBib2R5IG9mIDxiPkhUTUwgbWFpbDwvYj4gd2l0aCBhdHRhY2htZW50PC9ib2R5PjwvaHRtbD4=
|
||||
<html><body>This is body of <b>HTML mail</b> with attachment</body></html>
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain
|
||||
|
||||
VGhpcyBpcyBib2R5IG9mICpIVE1MIG1haWwqIHdpdGggYXR0YWNobWVudA==
|
||||
This is body of *HTML mail* with attachment
|
||||
--0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d--
|
||||
.
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
Content-Type: multipart/mixed; boundary=longrandomstring
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Type: text/html
|
||||
|
||||
PGh0bWw+PGJvZHk+VGhpcyBpcyBib2R5IG9mIDxiPkhUTUwgbWFpbDwvYj4gd2l0aCBhdHRhY2htZW50PC9ib2R5PjwvaHRtbD4=
|
||||
--longrandomstring
|
||||
Content-Disposition: attachment
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
YXR0YWNobWVudA==
|
||||
--longrandomstring--
|
||||
.
|
||||
@ -1,5 +1,5 @@
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
Ym9keQ==
|
||||
body
|
||||
@ -5,9 +5,9 @@ To: Receiver <receiver@pm.me>
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Ym9keQ==
|
||||
body
|
||||
--longrandomstring
|
||||
Content-Disposition: inline
|
||||
Content-Transfer-Encoding: base64
|
||||
@ -1,6 +1,6 @@
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain; charset=ISO-8859-1
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
6enp6enp6Q==
|
||||
=E9=E9=E9=E9=E9=E9=E9
|
||||
@ -5,9 +5,9 @@ To: Receiver <receiver@pm.me>
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Ym9keQ==
|
||||
body
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Type: application/octet-stream
|
||||
@ -5,13 +5,13 @@ To: Receiver <receiver@pm.me>
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--longrandomstring
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Ym9keQ==
|
||||
body
|
||||
--longrandomstring
|
||||
Content-Disposition: attachment
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
YXR0YWNobWVudA==
|
||||
attachment
|
||||
--longrandomstring--
|
||||
.
|
||||
19
pkg/message/testdata/text_plain_pubkey.b64
vendored
19
pkg/message/testdata/text_plain_pubkey.b64
vendored
@ -1,19 +0,0 @@
|
||||
Content-Type: multipart/mixed; boundary="52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2"
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
Ym9keQ==
|
||||
--52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2
|
||||
Content-Disposition: attachment; filename="publickeyname.asc.pgp"
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Type: application/pgp-key; name="publickeyname"
|
||||
|
||||
cHVibGlja2V5
|
||||
|
||||
--52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2--
|
||||
.
|
||||
@ -1,6 +1,6 @@
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
+Ln4ufi5
|
||||
=E9=E9=E9=E9=E9=E9=E9
|
||||
@ -1,6 +1,6 @@
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
6enp6enp6Q==
|
||||
=F8=B9=F8=B9=F8=B9
|
||||
@ -1,6 +1,6 @@
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
|
||||
Ym9keQ==
|
||||
body
|
||||
Reference in New Issue
Block a user