Closed
Description
Symfony version(s) affected: 4.3
Description
When using the Sendgrid HTTP transport; Sending an email with an attachment results in an error 400 "The attachment content must be base64 encoded." Exception.
The Sendgrid API does not like line breaks in the base64 encoded attachment content it appears, but the Base64Encoder in Mime do.
How to reproduce
Create a new Symfony\Component\Mime\Email
, attach some arbitrary content and send the email.
Possible Solution
In Symfony\Component\Mailer\Bridge\Sendgrid\Http\Api\SendgridTransport::getAttachments
, replace the \r\n
in the content returned from $attachment->bodyToString
.
I have created a PR #33672