开发者

mail using PHP send a image tag

开发者 https://www.devze.com 2023-01-05 03:13 出处:网络
The following header informations I have added to send a html content as a mail message. $headers= \'MIME-Version: 1.0\' .

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号