Sendgrid-php: setContent only accepts base64 encoded strings

Created on 18 Jan 2017  路  8Comments  路  Source: sendgrid/sendgrid-php

Issue Summary

There is nowhere in the entire library where it is mentioned that the setContent function from the Attachment class only accepts a base64 encoded string. Not giving a correct parameter to the function will result in a {"errors":[{"message":"Bad Request","field":null,"help":null}]}, status 400.

Steps to Reproduce

  1. install and use the SG library
  2. give a non base64 encoded string to the setContent function from the Attachment class
  3. log response status and body

It's a documentation bug. We shouldn't have to guess the proper encoding for a string parameter - it should be clearly specified either in the function definition or in the examples.

Technical details:

  • sendgrid-php Version: master (latest commit: [commit number])
  • PHP Version: 5.x
help wanted bug

All 8 comments

Hello @sebmih,

You are correct, we will get this fixed. Thanks for the heads up!

With Best Regards,

Elmer

@thinkingserious
I can help updating the docs on this, if you need to. Let me know how to proceed.
Thank you!

FYI: My CLA paperwork should be on file already ;)

@paoga87,

Awesome! Just go ahead and make a pull request :)

Thanks!

Hello @sebmih @thinkingserious,

Documentation on BASE64 encoded content exists here: https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html#-Attachments

@sebmih is that what you were looking for?

@paoga87 Yes, but that's not the point. I shouldn't have to go a different website, in a different docs to find what I need.

@thinkingserious do you have any idea of exactly where I can add the attachment note on the documentation?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FilipLukac picture FilipLukac  路  4Comments

izhukovich picture izhukovich  路  4Comments

solonifer picture solonifer  路  3Comments

moontrv picture moontrv  路  3Comments

Aubynj picture Aubynj  路  3Comments