oscommerce에서 얼마나 많은 제품을 구매했는지에 따라 여러 개의 이메일을 발송하는 기능이 있습니다. 함수의 php mail() 부분에 헤더를 추가 할 때까지 잘 작동합니다. 당신이 울부 짖는 볼 수 있듯이, 내 헤더 읽기 :
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: [email protected] \r\n" .
"Reply-To: [email protected] \r\n" .
"X-Mailer: PHP/" . phpversion();
을하지만 (내가 HTML로 이메일을 보내기 위해 필요) 헤더를 선언 할 때, 첫 번째 메일이 발송됩니다. 헤더를 여러 번 보낼 수 없습니까? 모든 제안을 부탁드립니다!
기능 조각 :
foreach ($dstToProduct as $dsid => $productIndices) {
$email = $newDropships[$dsid]['email'];
$subject = "A new order has been placed";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: [email protected] \r\n" .
"Reply-To: [email protected] \r\n" .
"X-Mailer: PHP/" . phpversion();
// Build message text
$date = date('m/d/Y');
$text = '<table cellpadding="3" style="margin-top: 20px;"><tr style="background-color: #6d7d59; color: #ffffff; font-weight: bold; font-size: 12px;"><td style="width: 240px; vertical-align:text-top;">Product Name</td><td style="width: 120px; vertical-align:text-top;">Model Number</td><td style="width: 80px; vertical-align:text-top;">Quantity</td><td style="width: 80px; vertical-align:text-top;">Price</td></tr>';
foreach ($productIndices as $productIndex) {
$text .= '<tr style="background-color: #f0f0f0; color: #513311; font-size: 12px;"><td style="vertical-align:text-top;">' . $products_array[$productIndex]["text"] . '</td><td style="vertical-align:text-top;">' . $products_array[$productIndex]["model"] . '</td><td style="vertical-align:text-top;">' . $products_array[$productIndex]["qty"] . '</td><td style="vertical-align:text-top;">' . $products_array[$productIndex]["price"] . '</td></tr>';
}
$text .= '</table>';
if (!mail($email, $subject, $text, $headers)) {
mail('[email protected]', 'Error sending product', 'The following order was not sent: ' . $order_id);
}
}
}
(첫번째 메일을 보낸 후) 당신은 어떤 오류가? – MeNa
오류가 발생하지 않으며 오류 로그에서 아무 것도 찾을 수 없습니다. 루프를 멈추는 것처럼 보입니다. –