Jump to content

send email to multiple user using phpmailer


Ct1992

Recommended Posts

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.