You use SMTP to send email. The phpmailer class does not use the SingleTo parameter when sending using Smtp.
, CreateHeader, SingleTo == true, $this- > SingleToArray, , PHPmailer.
, , phpmailer, , SingleTo
function & prepare_mailer($subject, $body) {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "SSL";
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Username = "xxxxxxxxxx@gmail.com";
$mail->Password = "*********";
$mail->SetFrom('xxx@xxx.com', 'XXXXXX');
$mail->AddReplyTo("no-reply@xxxxx.com","No Reply");
$mail->Subject = $subject;
$mail->MsgHTML($body);
return $mail;
}
foreach( $_POST['to'] as $to ){
$mail = null;
$mail = & prepare_mailer($_POST['subject'],$_POST['body']);
$mail->AddAddress($to['address'], $to['name']);
$mail->Send();
}