我試圖通過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標籤,而是打印它們。
如何獲取表格格式的電子郵件?
謝謝。