sendgrid / sendgrid-ruby

The Official Twilio SendGrid Led, Community Driven Ruby API Library
https://sendgrid.com
MIT License
625 stars 322 forks source link

Setting Content-Transfer-Encoding to base64 #418

Closed cristiangreco closed 4 years ago

cristiangreco commented 4 years ago

Issue Summary

Hi, I'm using the Mail Send v3 API to send emails over HTTP using this library through the sendgrid-actionmailer gem.

I set two contents in the request: one is "text/plain" and the other is "text/html". I want to apply a Content-Transfer-Encoding: base64 to both of them, so that they're transfered using base64. This seems to be possible with the SMTP api, but I haven't been able to achieve the same result with the HTTP api.

I've tried to use the "headers" request field by setting a Content-Transfer-Encoding header with value base64. However I receive the following error response:

SendGridActionMailer::DeliveryMethod::SendgridDeliveryError: Sendgrid delivery failed with 400 Header can not be one of the reserved keys. Refer to documentation link.

It seems that the HTTP api enforces the quoted-printable encoding, which is causing some issues with body content being altered during transmission: specifically, it sometimes happen that the decimal separator . in numbers disappears from email body. That's why I want to switch to a base64 encoding.

I there a way to set a custom "Content-Transfer-Encoding" for the contents of a multipart message?

thinkingserious commented 4 years ago

Hello @cristiangreco,

Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at https://support.sendgrid.com.

Thank you!

SendGrid DX Team

cristiangreco commented 4 years ago

Hey @thinkingserious, thanks for your answer!

I've actually reached out to the support team (ticket 3900511), and their suggestion was to file a bug here 😅

Regardless of the issue itself (a character disappearing from email body), would you be able to confirm whether it's possible or not to set a Content-Transfer-Encoding other than quoted-printable using the ruby library?

Thanks

childish-sambino commented 4 years ago

Does not appear possible with the web API: https://github.com/sendgrid/sendgrid-php/issues/98