Ct1992 Posted November 26, 2014 Share Posted November 26, 2014 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 = "inetc@gmail.com"; $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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.