我有一组电子邮件,想为数组中的每个条目发送一封电子邮件,但目前它只将其发送到第一个地址。我环顾四周,看不出我做错了什么。
//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)<scopesheetprocess@goodrich.com>";
//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");
}
由于 IT 问题,我正在使用 pear php 发送电子邮件,但这无关紧要,因为它应该每次都运行脚本并发送单独的电子邮件。