I am trying to send an email through the result sets generated in MySQL in PHP
This is the code.
<?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!";
}
?>
The problem is , I want the results to be displayed in table format. But instead of processing the html
tags, they are getting printed as well.
How to get the email with table format?
Thanks.