发HTML邮件的时候,一定要选择
Content-Type: text/html;
这种格式

解决方案 »

  1.   

    --$NextPart_1
    Content-Type: image/gif;
    name=\"$filename\"改成--$NextPart_1
    Content-Type: application/octet-stream;
    name=\"$filename\"
      

  2.   

    我昨天找了一个收到的也是html源代码<?php
    /* recipients */
    $to  = "[email protected]" . "," ; // note the comma
    $to .= "[email protected]";/* subject */
    $subject = "Birthday Reminders for August";/* message */
    $message = '
    <html>
    <head>
    <title>Birthday Reminders for August</title>
    </head>
    <body>
    <p>Here are the birthdays upcoming in August!</p>
    <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
    </table>
    </body>
    </html>
    ';/* To send HTML mail, you can set the Content-type header. */
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";/* additional headers */
    $headers .= "To: Mary <[email protected]>, Kelly <[email protected]>\r\n";
    $headers .= "From: Birthday Reminder <[email protected]>\r\n";
    $headers .= "Cc: [email protected]\r\n";
    $headers .= "Bcc: [email protected]\r\n";/* and now mail it */
    mail($to, $subject, $message, $headers);
    ?>
      

  3.   

    测试 TYmir(与天为敌) 的代码,能接受到正常的html页面显示网上能找到很多类似的代码,并且一般都能通过测试
    请注意一点(很重要!):
    1、邮件头中都是用换行符作为各参数项的分隔的,必须保证数量的正确
    2、对于“换行符”
      运行于win32下的发件服务器需使用"\r\n"
      运行于linux下的发件服务器需使用"\n"
    不能搞错,当测试失败时请先修改之
    3、对于一些新型的发件服务器,已经没有这个限制了。这也就是同样的代码在不同的发件服务器中表现不一样的原因之一
      

  4.   

    要按mime格式写才能保证每一个邮箱都正常收到html格式。
      

  5.   

    xuzuning(唠叨) 谢谢你啊,就是\r\n的问题把这个给疏忽了