// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";$text = "
  <style type=3D'text/css'>
<!--
.style1 {
    color: #FF0080;
    font-weight: bold;
}
.style2 {color: #FF0080}
-->
</style>
<span class=3D'style1'>ddddddddddddd</span><span class=3D'style2'>dd</span>
";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 mail("[email protected]","实验",$text,$headers);

解决方案 »

  1.   

    你注意看看$headers
    它必须声明发送的内容为html
    我也做了实验,但不知道为什么还没成功,期待高手
      

  2.   

    设置格式,是以文本来读,还是以html来读
      

  3.   

    header 的话哪几个参数是必须的?
    设置格式,如何设置啊?
      

  4.   

    看PHP手册的mail函数的示例
      

  5.   

    <?php
    $to="[email protected]";//a mail address
    $subject="test mail";
    $body="<table width='100%' border='1' cellspacing='0' cellpadding='0'>
      <tr>
        <td>11</td>
        <td>12</td>
      </tr>
      <tr>
        <td>21</td>
        <td>22</td>
      </tr>
    </table>";
    echo $subject;
    echo $from;
    $send=mail($to,$subject,stripslashes($body),"From: ".$from."\r\nContent-Type: text/html;charset=\"gb2312\""); 
    if($send)
       echo "send";
    else
       echo "not send";
    ?>这个我测试成功
    你对照着改下看看,成功了告诉我一下
      

  6.   

    重点是:Content-Type: text/html;charset=\"gb2312\"
    你在mail()一定要带上上面这第三个参数
      

  7.   

    后来试出来了,发送HTML格式成功,包括格式化的文本和图片。有空再仔细研究。谢谢各位朋友,新问题我再发贴给分。初次涉及WEB方面的东西,有些地方不是很明白,还请多多帮助。