我试图通过PHP中生成的结果集发送电子邮件在php中发送电子邮件无法使用HTML标记
这是代码。
<?php
$txtMsg = '<table><th>Name</th>';
$txtMsg = '';
mysql_connect("localhost", "root", "pop") or die(mysql_error());
mysql_select_db("jpd") or die(mysql_error());
$oustanding = mysql_query("select Name from results") or die(mysql_error());
$num=mysql_num_rows($oustanding);
while($row1 = mysql_fetch_array($oustanding)) {
?>
<tr>
<td><h3><?php echo $row1['Name']; ?></h3></td>
</tr>
<?php
$txtMsg .= "<tr><td>".$row1['Name']."</td></tr>";
}
ini_set ("SMTP", "xy.domain.com");
$mail_to= '[email protected]';
$mail_from='[email protected]';
$mail_sub='OutStanding Results';
$mail_mesg=$txtMsg;
//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,"From: $mail_from"))
echo "<br><br>Email Successfully Sent!";
else
echo "<br><br>Error Sending Email!";
}
?>
问题是,我希望结果以表格格式显示。但不是处理html标签,而是打印它们。
如何获取表格格式的电子邮件?
谢谢。