Skip to content

Commit

Permalink
content type needs to be set as base64
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni committed Jul 22, 2021
1 parent 5d1344e commit d67e41e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sendgrid_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sender

import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"os"
Expand Down Expand Up @@ -110,7 +111,10 @@ func buildMail(m mail.Message) (*smail.SGMailV3, error) {
attachment := smail.NewAttachment()
attachment.SetFilename(a.Name)
attachment.SetContentID(a.Name)
attachment.SetContent(b.String())

encoded := base64.StdEncoding.EncodeToString(b.Bytes())
attachment.SetContent(encoded)

attachment.SetType(a.ContentType)
attachment.SetDisposition(disposition)
mm.AddAttachment(attachment)
Expand Down

0 comments on commit d67e41e

Please sign in to comment.