-1

我有从 sql 数据库中检索到的 php 格式的表,记录以表格式显示,我想邮寄从数据库中检索到的记录

这是我的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&nbsp;'.$expiry.'</td>
<td width="129" bgcolor="#033B90">Price '.$price.'</td>
</tr>
</table></div>';

有没有办法将产品列表结果发送到邮件地址

<?php echo $dynamicList; ?>
4

2 回答 2

0

Refer to the mail function:

mail('to@example.org', 'Subject', $dynamicList);
于 2013-04-01T10:04:26.690 回答
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邮件功能

于 2013-04-01T10:17:26.580 回答