电子邮件图像输出


email image output

我在发送图像时遇到了问题。我在发送电子邮件时没有遇到问题,只是图像没有显示。。只是链接。。你能帮我吗?这是我的密码。。提前感谢

require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host="smtp.mail.yahoo.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "*************"; // SMTP username
$mail->Password = "**********"; // SMTP password
$mail->From = "*********";
mail->FromName = "*****";
$mail->AddAddress(***********);
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Welcome to LilShop";
$mail->Body = '<html>
<head>
</head>
<body>
<a href="http://localhost/mylilshoppev4/mylilshoppe/menu.php">
<img src="C:'phpwebsites'mylilshoppev4'mylilshoppe'images'images'lilshop.gif"alt="lilshop "  width="380" height="380" style="margin-left:1.5em;margin-top:1.5em;"/></a>
</body>
</html>';

$mail->Send();

图像使用本地路径。任何收到电子邮件的人都无法使用该文件。

使用http://localhost/mylilshoppev4/mylilshoppe/images/images/lilshop.gif

源必须始终是图像的URL,代码中的图像永远不会在邮件中显示/上传

除了将文件放在外部网站上(imageshack、flickr等)之外,还可以将图像的内容作为"附加文件"包含在电子邮件中。如果您想这样做,请调查邮件附件和mime64编码。您仍然可以使用url引用该文件,但它将是相对的,即没有http://example.com/在前面。

只是一个警告。。。如果这是一个互联网上的网站,请确保你知道你从浏览器中读取的任何值都是你期望的:最好不要从浏览器中阅读,而是尽可能地对其进行硬编码。

此外,我建议确保php邮件函数不能在任何其他上下文中调用——例如,希望"http://example.com/email.php"将调用它,即使没有链接引用该文件

HtH

Ruth