php-html电子邮件帮助


php html email help?

我使用以下代码处理php-html电子邮件:

   $to      = $email; 
   $subject = 'ABC'; 
   $message = $content;
   $headers  = "MIME-Version: 1.0'r'n";
   $headers .= "Content-type: text/html; charset=iso-8859-1'r'n";
   $headers .= 'From: ABC <a@b.com>'."'r'n";
   mail($to, $subject, $message, $headers); // Send our email

其中

$content='<html>
    <head>
      <title>Thanks</title>
    </head>
    <body>
        <div>
            <b>Thanks for your email</b>
        </div>
    </body>
    </html>'

现在收到的电子邮件包含:

'r'n 'r'n 'r'n 'r'n
'r'n
'r'n Thanks for your email'r'n
'r'n
'r'n 

我已经读了几个例子,就标题的格式而言,我并没有做错什么。无法识别问题,帮助?此外,任何关于实施电子通讯的帮助建议都将是有益的。

首先,在HTML格式的邮件中不需要使用<Head>标记。

试试这个:

$content = '<html><body>';
$content .='<div><b>Thanks for your email</b></div>';
$content .='</body></html>';

或者这个:

$content = "
<html>
    <body>
        <div>
            <b>Thanks for your email</b>
        </div>
    </body>
</html>";

他们中的一个会成功的

可能是'n'r,被解释为编码HTML文本。。因此,使用html标记<br>,请参阅以获取'n