从mysql查询发送的PHP电子邮件

时间:2012-11-05 12:44:45

标签: php mysql email

我的下面的代码没有发送电子邮件,当点击链接时,它应查询数据库然后发送电子邮件。 我做错了什么指针? 谢谢你的帮助。

<?php   

require_once('dbconnect.php');
$query="SELECT * FROM Locations WHERE id='$id'";
$result=mysql_query($query);
while ($row = $result -> fetch_assoc()) {
 $submitter = $row['submitter'];
 $submitteremail = $row['submitteremail'];
 $message .= "$submitter";
}
 $to = "$submitteremail";
 $subject = "Submission approved";
 $from = "wxyz@mail.com";
 $headers = "From:".$from;
 mail($to, $subject, $message, $headers);


echo 'Email sent';
mysql_close();
exit();

&GT;

0 个答案:

没有答案