I'm trying to implement a code to send HTML email with embedded image.
I already tried for simple HTML email with image but this image is taken from server.
I'm trying to implement a code to send HTML email with embedded image.
I already tried for simple HTML email with image but this image is taken from server.
This is the code I'm using to embed images into HTML mail and PDF documents.
<?php
$logo_path = 'http://localhost/img/logo.jpg';
$type = pathinfo($logo_path, PATHINFO_EXTENSION);
$image_contents = file_get_contents($logo_path);
$image64 = 'data:image/' . $type . ';base64,' . base64_encode($image_contents);
?>
<img src="<?php echo $image64 ?>" />
I made to golang command line to this job, the key part is doing cid replacement: