Jump to content

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     = "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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.