当我尝试通过在 php 上使用 mail() 发送 html 电子邮件时遇到问题,当我尝试使用此代码时它工作完美
$bodyhtml="<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<div dir='RTL'>
<p dir='RTL'>
<table>
<tr>
<td>
<div>
<p dir='RTL'><strong><span style='color:#00B0F0'>Hi</span></strong></p>
<p dir='RTL'><strong><span style='color:#FFC000'>Test</span></strong></p>
<p dir='RTL'><span style='color:#404040'>Test</span></p>
<p dir='RTL'><span style='color:#404040'>Test</span></p> </div></td> </tr> </table>
</p>
</div> </body></html>";
$headers = "From: " . $email. "\r\n";
$headers .= "Reply-To: ". $email . "\r\n";
$headers .= "CC: me@gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
mail($email, $subject, $bodyhtml, $headers);
但是当我尝试使用 html 按摩放置图像时:
$bodyhtml="<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<div dir='RTL'>
<p dir='RTL'> </p>
<p dir='RTL'>
<table>
<tr>
<img src='http://xxxxxx/form/image/image001.png' />
<td>
<div>
<p dir='RTL'><strong><span style='color:#00B0F0'>Hi</span></strong></p>
<p dir='RTL'><strong><span style='color:#FFC000'>Test</span></strong></p>
<p dir='RTL'><span style='color:#404040'>Test</span></p>
<p dir='RTL'><span style='color:#404040'>Test</span></p> </div></td> </tr> </table> </p> </div> </body></html>";
$headers = "From: " . $email. "\r\n";
$headers .= "Reply-To: ". $email . "\r\n";
$headers .= "CC: technomedia.ws@gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
mail($email, $subject, $bodyhtml, $headers);
发送按摩时失败,是什么问题或我该如何解决?