【发布时间】:2021-08-04 22:20:49
【问题描述】:
我正在尝试将存储在我的服务器上的图像添加到使用 PHP 的 mail() 函数发送的电子邮件中。下面是php代码:
$subject = 'Password Reset';
$message = '
<html>
<head>
<title>Password Reset</title>
</head>
<body>
Salve '.$username.', utilizza questo link per resettare la password: <a href="https://gestionale.boscarato.eu/Elaborato/reset/reset_password.php?c='.$operation_code.'">Resetta la tua password </a>
<br><br>
<img src="http://gestionale.boscarato.eu/Elaborato/images/logo.png" alt="Logo" width="300" height="50">
<br>
Cordiali saluti,
<br>
<h5>Luca Boscarato [5E] </h5>
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'From: Luca Boscarato <boscarato.luca@gmail.com>' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($email, $subject, $message, $headers);
问题是图片无法显示(我已经在 gmail 上激活了“全部接受”选项,以便我的客户也接受外部图片。
【问题讨论】:
-
你为什么不试试 phpmailer with html true ?? github.com/PHPMailer/PHPMailer
-
是错字还是不知道.. 但是你错过了 = for alt in image source... alt="Logo"
-
我添加了 '=' 但我还是看不到图片
-
好的...你可以试试另一个图片链接吗??
-
您可以在浏览器中查看吗?因为我已经检查过了,它回复了我这个网站无法访问。