-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
<?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 に答える