mail using PHP send a image tag
The following header informations I have added to send a html content as a mail message.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Content-type: multypart/mixed; boundary=\'PHP-mixed'."\r\n";
$headers .= "Content-Transfer-Encoding: 8bit"."\r\n";
$headers .= "Content-Type: application/pdf; name=/home/sugumar/LOGO开发者_高级运维2.jpg"."\r\n";
mail($to, $subject, $message, $headers);
In the HTML body tag has image tag. but in mail the image is not shown. how to send the image with mail. I don't want as a attachment. its like a inline content.
You need to include the image as an attachment if you want it inline.
What you do is in your HTML, instead of putting <img src="filename.jpg" />
, you put the Content-ID of the image, i.e, <img src="cid:$cid" />
This article has a better breakdown with a working example:
http://www.phpeveryday.com/articles/PHP-Email-Using-Embedded-Images-in-HTML-Email-P113.html
精彩评论