// 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);
$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);
它必须声明发送的内容为html
我也做了实验,但不知道为什么还没成功,期待高手
设置格式,如何设置啊?
$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";
?>这个我测试成功
你对照着改下看看,成功了告诉我一下
你在mail()一定要带上上面这第三个参数