Skip to content

Commit 59abc76

Browse files
committed
Changed boundary for smtp
1 parent ffdd1a1 commit 59abc76

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

drivers/smtp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (m *smtpClient) bytes(t *mail.Transmission) []byte {
107107
if t.HasAttachments() {
108108
buf.WriteString(fmt.Sprintf("Content-Type: multipart/alternative; boundary=%s\r\n", boundary))
109109
} else {
110-
buf.WriteString("Content-Type: text/html; charset=UTF-8\r\n")
110+
buf.WriteString(fmt.Sprintf("Content-Type: text/html; charset=UTF-8; boundary=%s\r\n", boundary))
111111
}
112112

113113
buf.WriteString(fmt.Sprintf("Subject: %s\n", t.Subject))

drivers/smtp_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package drivers
1515

1616
import (
1717
"errors"
18+
"fmt"
1819
"github.com/ainsleyclark/go-mail/mail"
1920
"net/smtp"
2021
)
@@ -131,3 +132,22 @@ func (t *DriversTestSuite) TestSMTP_Send() {
131132
})
132133
}
133134
}
135+
136+
func (t *DriversTestSuite) TestSMTP_Bytes() {
137+
t.T().Skip()
138+
139+
m := smtpClient{}
140+
got := m.bytes(&mail.Transmission{
141+
Recipients: []string{"hello@gmail.com"},
142+
Subject: "Subject",
143+
HTML: "<h1>Hey!</h1>",
144+
PlainText: "Hey!",
145+
//Attachments: []mail.Attachment{
146+
// {
147+
// Filename: "test.jpg",
148+
// Bytes: []byte("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg=="),
149+
// },
150+
//},
151+
})
152+
fmt.Println(string(got))
153+
}

0 commit comments

Comments
 (0)