我有一个电子邮件数组,并希望为阵列中的每个条目发送一封电子邮件,但目前它只将它发送到第一个地址。我环顾四周,看不到我做错了什么。在foreach循环中调用require_once(),代码在每次迭代中都不可用
//This is the array
$emails = array($teamleademail, $coleademail, $sponsoremail, $facilitatoremail, $cisupportemail);
//Now the foreach statment
foreach ($emails as $value) {
//pulls in email sending code
require_once ("Mail.php");
//variables required to send the email
$from = "Scope Sheet Process Database (no reply)<[email protected]>";
//Make the $to variable that of the email in the array
$to = "$value";
$subject = "Scope Sheet $scopesheetid Closed";
$body = "Scope Sheet $scopesheetid has been closed and can no longer be edited.";
//send email code
require_once ("sendemail.php");
}
我使用PHP梨发送电子邮件,因为IT问题,但不应该重要,因为它要运行脚本,每次和发送电子邮件分开。
你可以var_dump $ emails吗? – Gntem 2012-07-13 10:25:46