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?