我有php格式的表格,我从sql数据库中检索,记录以表格格式显示,我想邮寄从数据库中检索的记录
这是我的PHP代码
$productList
$sql =mysql_query("Select * from products where id IN(".implode(",",$where).")")
$productCount=mysql_num_rows($sql);
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["item_name"];
$price = $row["price"];
$productList .= '<div class="coupon">
<table width="618" height="201" border="0">
<tr><td colspan="2" rowspan="4" align="left" valign="top">Name '.$product_name.'" </td>
<td> Expires '.$expiry.'</td>
<td width="129" bgcolor="#033B90">Price '.$price.'</td>
</tr>
</table></div>';
有没有办法将产品列表结果发送到邮件地址
<?php echo $dynamicList; ?>
答案 0 :(得分:0)
请参阅mail
function:
mail('to@example.org', 'Subject', $dynamicList);
答案 1 :(得分:0)
<?php
// multiple recipients
$to = 'test@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = 'HTML message';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
检查php mail function