我设计了一个 HTML 页面,然后将其转换为在 PHP 中使用,以便发送 HTML 电子邮件。
$message = '<!DOCTYPE html>';
$message .= '<html>';
$message .= '<body bgcolor="#E8E8E8 ">';
$message .= '<table bgcolor="white" >';
$message .= '<tr>';
$message .= '<td style="font-family:\'Helvetica Neue\',Helvetica,Arial,sans-serif;">';
$message .= '<img src="#" width="200px">';
$message .= 'This is a test page.';
$message .= '</td>';
$message .= '</tr>';
$message .= '</table>';
$message .= '</body>';
$message .= '</html>';
$to = "you@example.com";
$subject = "Pulling my hair out";
$headers = "From: me@example.com";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to,$subject,$message,$headers);
尽管它作为一个独立的 html 页面看起来很完美(我什至制作了一个与 $message 数组相呼应的测试 php 页面,它看起来仍然很完美)它在电子邮件中会出现奇怪的问题(在它发送之后) .
有时会随机出现!在正文中间。有时标签中的样式不会显示在电子邮件中(当我“检查”电子邮件的 html 时)。看起来很不稳定。
我在这里想念什么?