我试图发出一个PHP电子邮件,列出所有客户订购的产品。起初,我只是列出数量,产品,细节等变量。它的工作,但只有一个产品被列入电子邮件。所以我觉得需要一个foreach循环。除了我的foreach循环没有回应产品详细信息之外,电子邮件中的所有内容都正常工作。PHP电子邮件不呼应foreach循环
该行没有附和......
echo '<p>'.$prdqty.' - '.$prdsize.' - '.$prdname.'</p><br><br>';
$to = $email;
$subject = 'Your Example order';
$message = '<img src="'.$logoImage.'">';
$message .= '
<html>
<head>
<title>Example Order</title>
</head>
<body>
<p>Hi '.$billToName.',</p><br><br>
<p>Thank you for ordering with us!</p>
<p>Your order was successfully sent to us and we will start processing it immediately.</p><br><br>
<p>A charge of $'.$total_price.' was placed on '.$billToName.'\'s card that was used for the order.
<p>Your order contained:</p>';
foreach($_SESSION['shopping_cart'] as $id => $product) {
$product_id = $product['product_id'];
$prdname = $products[$product_id]['product_name'];
$prdprice = $products[$product_id]['price'];
$prdqty = $product['quantity'];
$prdsize = $product['size'];
echo '<p>'.$prdqty.' - '.$prdsize.' - '.$prdname.'</p><br><br>';
}
$message .='
<p>'. $AuthorrizeResponseText.';</p><br><br>
<p>We really appreciate your business!</p>
</body>
</html>
';
$from = "[email protected]";
$cc = "[email protected]";
// 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: ' .$to. "\r\n";
$headers .= 'From: ' .$from. "\r\n";
$headers .= 'Cc: '.$cc. "\r\n";
// Send the email
mail($to,$subject,$message,$headers);
任何人看到任何会被阻止吗?