php $mail = new phpmailer();,phpmailer – $mail-> addAddress()参数

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;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值