我已经尝试使用此代码向 TABLE (student) 中的所有学生发送电子邮件通知,当然学生的电子邮件已经存储在数据库中,所以当我尝试此代码时,它只会向一个学生发送电子邮件(第一个在桌子 ) !我已经使用“测试邮件服务器工具”来检查邮件是否发送,正如我所说的它只发送邮件给一个学生,我怎样才能将它发送给表中的所有学生(学生)?
include("connect.php");
$Load=$_SESSION['login_user'];
$smail= "Select Email from admin WHERE ID=$Load ";
$email= mysql_query($smail);
$result3 = mysql_query("Select email from student") or die(mysql_error());
$row3 =mysql_fetch_array($result3);
$mail =$row3['email'];
$to = $mail;
$subject = "SPMS";
$message = "You have a new Schedule" ;
$headers = "From: $email";
$sent = @mail($to, $subject, $message, $headers) ;
if($sent) {print "Your Email Notifications send successfully"; }
else {print "We encountered an error sending your mail"; }