0

Using html2canvas.js I create an image and ajax(post) send it to the server.

On the php page I catch $dataURL=$_POST['dataURL'];

If you insert $dataURL into the body of the letter and send the letter, it goes away, but plain text arrives at the mail server in the form data:image/png;base64,iVBORw0KGg....

The question is how to make the conversion on the php data:image/png;base64 page into an understandable format?

If you paste this code in the body of the email, it works

If you mark src with the received value $_POST['dataURL'] nothing is displayed in the body of the email.

$message = '
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p style="text-align:center"><a><img alt="" src="https://server/logo.jpeg" /></a></p>
</body>
</html>
';

I need to show the image in the body of the email.

Dvoyka
  • 1
  • 1
  • 1
    Yes base64 images won't work in emails you need to convert base64 to a normal binary format and save in public folder. Try [this](https://stackoverflow.com/questions/15153776/convert-base64-string-to-an-image-file) – Vinay Mar 20 '22 at 15:27

0 Answers0