php始终发送邮件错误

php始终发送邮件错误,php,sendmail,Php,Sendmail,我有一个这样的错误 警告:mysql_fetch_array()希望参数1是resource,字符串在第543行的/home/sibisier/public_html/customer/input_customer_issue.php中给出 $query_email = "SELECT employee.nip, employee.nama, employee.job_title, employee.unit_id, emp

我有一个这样的错误

警告:mysql_fetch_array()希望参数1是resource,字符串在第543行的/home/sibisier/public_html/customer/input_customer_issue.php中给出

$query_email = "SELECT employee.nip, employee.nama, employee.job_title,
                                    employee.unit_id, employee.business_email, unit.nama_unit
                                    FROM employee
                                    INNER JOIN unit ON employee.unit_id = unit.unit_id
                                    where employee.job_title IN('Team Leader','Assistant Relationship Manager','PROFESSIONAL STAFF')
                                    AND employee.unit_id IN(12)";

                    $resul1 = mysql_query($query_email) or die(mysql_error());{
                        $to = $resul1['business_email'];
                        $subject = 'Notifikasi';

                        $message = "<table>";
                        $message .= "<tr><td>Date</td><td>:</td><td>" . $tanggal_sekarang . "</td></tr>";
                        $message .= "<tr><td>NIP</td><td>:</td><td>" . $nip . "</td></tr>";
                        $message .= "<tr><td>Unit</td><td>:</td><td>" . $resul1['nama_unit'] . "</td></tr>";
                        $message .= "<tr><td>CIF</td><td>:</td><td>" . $cif . "</td></tr>";
                        $message .= "<tr><td>Comment</td><td>:</td><td>" . $comment . "</td></tr>";
                        $message .= "</table>";
                        $headers = "From: admin@sibisiser.com \n";
                        $from .= "Reply-To: zack.zacky14@gmail.com \n";
                        $from .= "Content-type: text/html \r\n";
                        mail($to, $subject, $message,$headers, $from);
                        echo "Mail Sent.";
这是第543行的代码

$query_email = "SELECT employee.nip, employee.nama, employee.job_title,
                                    employee.unit_id, employee.business_email, unit.nama_unit
                                    FROM employee
                                    INNER JOIN unit ON employee.unit_id = unit.unit_id
                                    where employee.job_title IN('Team Leader','Assistant Relationship Manager','PROFESSIONAL STAFF')
                                    AND employee.unit_id IN(12)";

                    $resul1 = mysql_query($query_email) or die(mysql_error());{
                        $to = $resul1['business_email'];
                        $subject = 'Notifikasi';

                        $message = "<table>";
                        $message .= "<tr><td>Date</td><td>:</td><td>" . $tanggal_sekarang . "</td></tr>";
                        $message .= "<tr><td>NIP</td><td>:</td><td>" . $nip . "</td></tr>";
                        $message .= "<tr><td>Unit</td><td>:</td><td>" . $resul1['nama_unit'] . "</td></tr>";
                        $message .= "<tr><td>CIF</td><td>:</td><td>" . $cif . "</td></tr>";
                        $message .= "<tr><td>Comment</td><td>:</td><td>" . $comment . "</td></tr>";
                        $message .= "</table>";
                        $headers = "From: admin@sibisiser.com \n";
                        $from .= "Reply-To: zack.zacky14@gmail.com \n";
                        $from .= "Content-type: text/html \r\n";
                        mail($to, $subject, $message,$headers, $from);
                        echo "Mail Sent.";
$query\u email=“选择employee.nip、employee.nama、employee.job\u标题,
employee.unit\u id,employee.business\u电子邮件,unit.nama\u unit
来自员工
employee.unit\u id=unit.unit\u id上的内部加入单位
其中employee.job_头衔位于(‘团队负责人’、‘助理关系经理’、‘专业员工’)
(12)中的employee.unit_id;
$result1=mysql\u query($query\u email)或die(mysql\u error());{
$to=$resul1['business_email'];
$subject='Notifikasi';
$message=“”;
$message.=“日期:$tanggal_sekarang.”;
$message.=“NIP:”.$NIP.“;
$message.=“单位:”$result1['nama_Unit']。”;
$message.=“CIF:”.$CIF.“;
$message.=“注释:”.$Comment.“;
$message.=“”;
$headers=“From:admin@sibisiser.com\n“;
$from.=“回复:扎克。zacky14@gmail.com\n“;
$from.=“内容类型:text/html\r\n”;
邮件($to、$subject、$message、$headers、$from);
回显“已发送邮件”;
我不知道,我一直在搜索,总是得到这个错误


请告诉我需要帮助。谢谢

从以下位置下载PHPMailer软件包:

并尝试此代码->

<?php
require_once('PHPMailer/class.phpmailer.php');

$query_email = "SELECT employee.nip, employee.nama, employee.job_title,
                                    employee.unit_id, employee.business_email, unit.nama_unit
                                    FROM employee
                                    INNER JOIN unit ON employee.unit_id = unit.unit_id
                                    where employee.job_title IN('Team Leader','Assistant Relationship Manager','PROFESSIONAL STAFF')
                                    AND employee.unit_id IN(12)";

                        $resul1 = mysql_query($query_email) or die(mysql_error());

                        $row=mysql_fetch_array($resul1, MYSQL_ASSOC);
                        if($row)   {
                        $to = $row['business_email'];
                        $htmlbody =  '<table>
                        <tr><td>Date</td><td>:</td><td> '. $tanggal_sekarang .' </td></tr>
                        <tr><td>NIP</td><td>:</td><td> '. $nip .' </td></tr>;
                        <tr><td>Unit</td><td>:</td><td> '. $resul1['nama_unit'] .' </td></tr>;
                        <tr><td>CIF</td><td>:</td><td> '. $cif .' </td></tr>;
                        <tr><td>Comment</td><td>:</td><td> '. $comment .' </td></tr>;
                        </table>';

                        $mail = new PHPMailer();
                        $mail->From      = 'admin@sibisiser.com';
                        $mail->FromName  = 'yourName';
                        $mail->Subject   = 'Notifikasi';
                        $mail->Body      = $htmlbody;
                        $mail->AddAddress($to);
                        $mail->Send();



    }

?>

您包含的代码不包含
mysql\u fetch\u array()
我曾经尝试过很多,但它仍然不起作用,你能一步一步地定义吗?对不起,我是这里的新手,但谢谢你在mysql\u查询和$to行之间缺少几行。你能添加更多的代码吗?什么样的代码?我真的不知道这种情况谢谢sanki,这是我的错误。但是电子邮件没有发送。你知道为什么吗?一些由于网络拥塞,收到电子邮件大约需要15分钟。继续发送邮件至少4-5次。我知道这是你听到过的最愚蠢的建议,但我会在邮件延迟时尝试此方法,至少对我有效:)好的,我会再次发送电子邮件,真的提前谢谢sanki:)我会在收到邮件时更新邮件已发送:Dhey代码中有一些错误..编辑的代码经过良好测试,工作正常..现在尝试编辑的代码..工作正常!!!!!真的提前谢谢sanki:)你救了我的命:)