Als ik de emails ontvang (heb het gelimiteerd op 2), krijg ik wél de emails op de verschillende adressen binnen
behorende bij de 2 verschillende personen.
Maar de naam en het inschrijfnummer in de aanhef is twee keer gelijk...
Waarom niet in elke email de bijbehorende naam + nummer?
Iemand een idee???
Eric
<?php
include_once('../config.php');
include_once('adminvars.php');
include_once('PHPMailer/class.phpmailer.php');
require('PHPMailer/PHPMailerAutoload.php');
$seiz_arr = getAdminVars();
$seiz = substr($seiz_arr[2],2,2); echo $seiz."<br>";
$query_sendto = mysql_query("SELECT inschrijfnr,vn,an,email FROM inschrijvingen WHERE inschrijfnr LIKE '$seiz%' AND nbgemaild='' AND inschrijfnr IN (SELECT inschrijfnr FROM betalingen WHERE betaald='1') ORDER BY inschrijfnr LIMIT 2");
$found = mysql_num_rows($query_sendto);
while ( list($inschrijfnr,$vn,$an,$email) = mysql_fetch_array($query_sendto) ){
if($email!=""){
$mail = new PHPMailer(); // defaults to using php "mail()"
$body .= "";
$replytomail = "[email protected]";
$replytoname = "Pietje Puk";
$address = $email;
$bccaddress = "[email protected]";
$mail->AddReplyTo($replytomail,$replytoname);
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->SetFrom($replytomail,$replytoname);
$mail->AddAddress($address, "");
$mail->AddBCC($bccaddress, "");
//Ter test:
$aanhef = "Bericht van Pietje Puk voor ".$vn." ".$an.", inschrNr:".$inschrijfnr; $content="Hallo,<br><br>Dit is de tekst<br><br>groet Pietje Puk."; $onderwerp="Subject: bericht van Pietje Puk";
$mail->Subject = $onderwerp;
$mail->AddEmbeddedImage('images/mailtemplate-bottom-bar.png', 'lijnimg', 'images/mailtemplate-bottom-bar.png');
include_once('mail_template_bodyis.php');
$mail->Body .= $body;
echo "Mail will now be send.<br>";
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent to ".$email." !<br>";
}
mysql_query("UPDATE inschrijvingen SET nbgemaild='1' WHERE inschrijfnr='$inschrijfnr'");
}
}//end of while
?>