0

I wanted to send an email with an image. I had used <img src="urloftheimg" />. But the image is not sending because to access this image we have to send custom headers. How do I send an image in the email which needs custom headers?

I am able to access the image somehow in the external PHP file with the following code:

header('Content-Type: image/png');
    $uri = 'http://urloftheimage';
    $ch = curl_init($uri);
    curl_setopt_array($ch, array(
        CURLOPT_HTTPHEADER  => array('key:value'),
        CURLOPT_RETURNTRANSFER  =>true,
        CURLOPT_VERBOSE     => 1
    ));
    $out = curl_exec($ch);
    curl_close($ch);
    echo $out;

When I had echo, I got the image, but how do I send this image in the email?

Dylan Wheeler
  • 6,928
  • 14
  • 56
  • 80
Pradeep Sanku
  • 201
  • 1
  • 2
  • 13

1 Answers1

0

Send an email as HTML email and display image using base64

How to convert image to base64 encoding?

Sending Nice HTML Email with PHP

Community
  • 1
  • 1
b0ne
  • 653
  • 3
  • 10