sendgrid-go
sendgrid-go copied to clipboard
Sending an attachment with a Content-Type including ; (e.g. with character coding specified) causes no "err" and no email...
Issue Summary
Using the documented example code to send an attachment I (unintentionally) put a semi-colon in the type, and send failed semi-silently. I assume you'd like to return an error whenever the API calls fails, but error was nil.
Steps to Reproduce
- Use this example code: https://github.com/sendgrid/sendgrid-go/blob/main/use-cases/attachments-with-mailer-helper.md
- Do a SetType of "text/plain; charset=utf-8"
- No err is returned (so I thought it sent) but no email is sent. Looking inside the response I did see this, so fixed my problem:
400,{"errors":[{"message":"The attachment type cannot contain ';', or CRLF characters.","field":"attachments.0.type","help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.attachments.type"}
... I assume the preference is to set an "error" return whenever an email is not sent, so FYI on this.
Technical details:
- sendgrid-go version: v3.10.0+incompatible
- go version: go version go1.17 darwin/amd64
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.