2013-04-01 50 views
-1

我已經在從SQL數據庫檢索的PHP格式的表格,記錄在表格的形式顯示,我要寄從數據庫發送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; ?> 
+1

看一看http://www.php.net/manual/en/book.mail.php在PHP郵件功能。 – Richard

回答

0
<?php 
// multiple recipients 
$to = '[email protected]' . ', '; // note the comma 
$to .= '[email protected]'; 

// 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 <[email protected]>, Kelly <[email protected]>' . "\r\n"; 
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; 
$headers .= 'Cc: [email protected]' . "\r\n"; 
$headers .= 'Bcc: [email protected]' . "\r\n"; 

// Mail it 
mail($to, $subject, $message, $headers); 
?> 

檢查PHP mail function

+0

我沒有從我的郵件正文上的$ productlist中獲取任何recodrs –

相關問題