1

Looking for html-email format, how i can include a jpeg-image (logo) in a email without call absolute address from website and without put it as attachment in it? Thanks.

Marcello Impastato
  • 2,195
  • 4
  • 27
  • 48

1 Answers1

1

Basically you need to read the contents of the image and transfer them to data uri which you can "inline" into the html like this:

$image_data=file_get_contents("some_image.jpg");
$encoded=base64_encode($image_data);
echo "<img src='data:image/jpeg;base64,{$encoded}'>";

Of course you will not echo the image tag, you just ineed to put it into the email with your preferred mailer client.

Kyborek
  • 1,478
  • 11
  • 20