i want to send email to multiple user.this is my code:
$result = mysql_query("SELECT * FROM student WHERE className='$classname'");
while ($rec= mysql_fetch_array($result))
{
$title = "Quiz Information";
$body = "Dimaklumkan bahawa Miss/Madam/Sir ".$lecname." telah update tarikh quiz ".$quizname." pada: ".$quizdatefrom. " dan berakhir pada: ".$quizdateto;
$email = $rec['stuEmail'];
}
include_once("mailer/mailer.php");
okey, for the mailer.php :
require_once("class.phpmailer.php"); // path to the PHPMailer class
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "secret"; // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->From = "
[email protected]";
$mail->FromName = "i-Netc System";
$mail->AddAddress($email);
$mail->Subject = $title;
$mail->MsgHTML($body);
if (file_exists($path)){
$mail->AddAttachment($path);
}
$mail->WordWrap = 50;
$mail->Send();
i want to send to all email in database based on className but when i click submit button the email doesn't send at all