sendgrid-go icon indicating copy to clipboard operation
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...

Open adamjack opened this issue 3 years ago • 1 comments

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

  1. Use this example code: https://github.com/sendgrid/sendgrid-go/blob/main/use-cases/attachments-with-mailer-helper.md
  2. Do a SetType of "text/plain; charset=utf-8"
  3. 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

adamjack avatar Jan 07 '22 03:01 adamjack

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.

JenniferMah avatar Jan 18 '22 21:01 JenniferMah