S.O.S我正在尝试向选定的电子邮件发送消息(按表单发布),以便表单将student_id传递给php脚本,该脚本获取相应的student_email地址(由student_id引用),,,
我非常感谢你的帮助.
这是我每次都得到的错误信息,
Invalid refreshed: You must provide at
least one recipient email address.
Message was not sent PHP Mailer Error:
You must provide at least one
recipient email address.
代码:
// START FORM PROCESSING
if( isset($_POST['submit'])) { // Form has been submitted.
$student = trim(mysql_prep($_POST['student']));
$re_mail =$student["email"];
$mail = new PHPMailer();
$mail->PluginDir = './';
$mail->IsSMTP();
$mail->Port = 465;
$mail->Host = "smtp.gmail.com";
$mail->IsHTML(true);
$mail->Mailer = "smtp";
$mail->SMTPSecure = "ssl";
$mail->SMTPAuth = true;
$mail->Username = "xxxxx@gmail.com";
$mail->Password = "xxxxxxxxxx";
$mail->SingleTo = true; // if you want to send mail to the users individually so that no recipients can see that who has got the same email.
$mail->From = "xxxxxx@gmail.com";
$mail->FromName = "xxxxxxxxx";
$mail->addAddress($re_mail );
$mail->Subject = "Testing PHP Mailer with localhost ";
$mail->Body = "Hi,This system is working perfectly.";
if(!$mail->Send())
echo "Message was not sent PHP Mailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";}
?>
Email:
$students = get_all_students();//this function works fine
while ($student = mysql_fetch_array($students)) {
echo " {$student["first_name"]} ";
}
?>
注意:
我在function.php中有这个功能
function get_all_students() {
global $connection;
$query = "SELECT *
FROM student ORDER BY first_name ASC";
$student_set = mysql_query($query, $connection);
confirm_query($student_set);
return $student_set;
}