0

I'm working on a project that includes sending mails.

For the front-end I'm using VueJS and Laravel for the backend/API part.

There's a part where the user will compose his/her own email in a rich text editor(wysiwyg). Then when the user embeds some image in the said editor, then when I pass it to the API, the image source becomes a base64 encoded image, then when it sends to the email recipient, it just displays the plain base64 text as the image source.

<img src="data:image/png:base64,............" />

The question is how can I display that base64 image in the email, instead of showing plain text base64 text.

I have tried adding headers to the mail, but it seems to not work.

$swiftMessage = $message->getSwiftMessage();
$headers = $swiftMessage->getHeaders();
$headers->addTextHeader('Content-Transfer-Encoding', 'base64');
$headers->addTextHeader('Content-Type', 'multipart/alternative;');
$headers->addTextHeader('Content-Type', 'text/html; charset=ISO-8859-1');

Thanks in advance!


EDIT

If you guys wanna see the headers I received in the email, here it is

Content-Type: text/html; charset=utf-8
Content-Type: multipart/alternative;
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Transfer-Encoding: base64
Lucentyr
  • 297
  • 1
  • 5
  • 14
  • have you tried to decode? i think you should decode it and then attach it as file. – MRustamzade Apr 16 '19 at 06:53
  • [Here](https://stackoverflow.com/questions/16242489/send-a-base64-image-in-html-email) you have the answer to that question. It's already answered. – Jalil Apr 16 '19 at 06:54

0 Answers0