Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过PHP发送HTML邮件-奇怪的呈现_Php_Css_Html Table_Html Email_Margin - Fatal编程技术网

通过PHP发送HTML邮件-奇怪的呈现

通过PHP发送HTML邮件-奇怪的呈现,php,css,html-table,html-email,margin,Php,Css,Html Table,Html Email,Margin,我有一张简单的桌子: <table cellpadding="0" cellspacing="0" style="width:600px"> <tr> <td style="width:100px; padding:5px; border:1px solid #444">E-mail</td> <td style="width:500px; padding:5px; border:1px solid #444">ex

我有一张简单的桌子:

<table cellpadding="0" cellspacing="0" style="width:600px">
  <tr>
    <td style="width:100px; padding:5px; border:1px solid #444">E-mail</td>
    <td style="width:500px; padding:5px; border:1px solid #444">ex@ex.com</td>
  </tr>
  <tr>
    <td style="width:100px; padding:5px; border:1px solid #444">Message</td>
    <td style="width:500px; padding:5px; border:1px solid #444">sometext</td>
  </tr>
</table>

你桌子的宽度是600像素

单元格的宽度加起来如下所示:

第一个单元格:1px边框+5px填充+100px宽度+5px填充+1px边框=112px 第二个单元格1px边框+5px填充+500px宽度+5px填充+1px边框=512px

总宽度:600px宽度表中的624px

这可能不是问题所在,但我敢打赌这毫无帮助


我建议您先更正此问题,然后看看会发生什么。

您是否碰巧在mail()中的行之间插入了\n\r

好吧,我想出来了-问题是我在发送之前做了
nl2br($message)
。 ($message包含上述HTML代码)


但谢谢大家的参与

如果您使用另一个邮件客户端查看邮件,是否也会遇到同样的问题?你用哪一个?我在Gmail(截图)和另一个客户端上测试了它-同样的结果我在Gmail和Outlook express中检查了上面的代码。但不能复制相同的。
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";