0
無法執行選擇併發送到腳本中的所有電子郵件地址。PHPMAIL麻煩..任何建議?
// Get Employee's Email Address
$getEmail = "SELECT empEmail AS theEmail FROM employees";
$emailres = mysqli_query($mysqli, $getEmail) or die('-1'.mysqli_error());
$col = mysqli_fetch_assoc($emailres);
$theEmail = $col['theEmail'];
// the message
$message = '<html><body>';
$message .= '<h3>New Site Notifications</h3>';
$message .= '<p>'.$noticeTitle.'</p>';
$message .= '<p>'.$noticeText.'</p>';
$message .= '<p>'.$messageText.'</p>';
$message .= '<hr>';
$message .= '<p>'.$emailLoginLink.'</p>';
$message .= '<p>Thank you<br>Bliss Door Supervisors</p>';
$message .= '</body></html>';
$headers = "From: ".$siteName." <".$businessEmail.">\r\n";
$headers .= "Reply-To: ".$businessEmail."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// use wordwrap() if lines are longer than 70 characters
//$msg = wordwrap($msg,70);
// send email
mail($theEmail," New Site Notification",$message,$headers);
//End Send Mail
由於某種原因,它只發送數據庫中的第一封電子郵件,而不是其他10+ witihin。 任何人都可以看到我要去哪裏錯了嗎?或協助。
非常感謝 斯派克
嘗試使用循環。 –