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.
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.
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?
How about here: https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md
Like we have here: https://github.com/sendgrid/sendgrid-nodejs/blob/master/USE_CASES.md
This documentation is completed here: https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#attachments