不要网上粘代码!给我一个测试通过的吧!分都给你!

解决方案 »

  1.   

    我以前发过html格式的文件 
    你只需要将你的发送内容是html代码就行了!~~好像是这样!
      

  2.   


        $to ="**@***.com";//发往哪
        $from ="**@***.com";//从哪发
        $cc= "***@***.com";//抄送
        $subject ="标题你好";//标题
    //内容
    $content =<<<HTML
    <html>
    <head></head>
    <body>
    <h1>hello</h1>
    </body>
    </html>
    HTML;
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
        $headers .= "To: $to \r\n";
        $headers .= "Cc: $cc \r\n";
        $headers .= "From: $from" . "\r\n";
        $result = mail($to, $subject, $content, $headers); 
    if($result)
    {
    $ok.='OK'."<br />";
    }
    else
    {
     $ok.='no'."<br />";
    }
     echo $ok;//很有可能发到垃圾箱
      

  3.   

    写邮件的时候有时不也是直接用HTML代码写吗?