Skip to content

Commit d67e41e

Browse files
committed
content type needs to be set as base64
1 parent 5d1344e commit d67e41e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sendgrid_sender.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package sender
22

33
import (
44
"bytes"
5+
"encoding/base64"
56
"errors"
67
"fmt"
78
"os"
@@ -110,7 +111,10 @@ func buildMail(m mail.Message) (*smail.SGMailV3, error) {
110111
attachment := smail.NewAttachment()
111112
attachment.SetFilename(a.Name)
112113
attachment.SetContentID(a.Name)
113-
attachment.SetContent(b.String())
114+
115+
encoded := base64.StdEncoding.EncodeToString(b.Bytes())
116+
attachment.SetContent(encoded)
117+
114118
attachment.SetType(a.ContentType)
115119
attachment.SetDisposition(disposition)
116120
mm.AddAttachment(attachment)

0 commit comments

Comments
 (0)