How do I embed Base64 Image Data into email using php mail?
<?php
$aImg = $_POST['aImage'];
$to = "abc@hotmail.com";
$subject = "Sending png image to email";
$message = "<html><head></head><body>";
$message .= '<img src="'.$aImg.'" alt="This is an Image" /></body></html>';
$headers = "Content-type: text/html";
if (mail($to, $subject, $message, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
After I run the codes, it shows "message successfully sent" but the image is not displayed out. It shows a small red cross image instead. I have been debugging for hours but still not able to get my image out. Currently, I'm sending the email to localhost for testing.