Zend framework 为什么在zend framework中发送邮件但未收到?

Zend framework 为什么在zend framework中发送邮件但未收到?,zend-framework,zend-framework2,Zend Framework,Zend Framework2,我是zend框架的新手 我有一个发送邮件的代码,它正在工作,但是客户端没有收到消息,但它返回邮件已成功发送。你能教我如何使用zend_电子邮件吗 public function sendMailStatements($qid,$emails=array()) { require_once 'Zend/Mail.php'; require_once 'Zend/Mail/Transport/Smtp.php'; try { $config = array('

我是zend框架的新手

我有一个发送邮件的代码,它正在工作,但是客户端没有收到消息,但它返回邮件已成功发送。你能教我如何使用zend_电子邮件吗

public function sendMailStatements($qid,$emails=array()) {
    require_once 'Zend/Mail.php';
    require_once 'Zend/Mail/Transport/Smtp.php';
    try {
        $config = array('ssl' => 'ssl',
            'port' => 465,
            'auth' => 'login',
            'host'  => '127.0.0.1',
            'username' => 'username@gmail.com',
            'password' => 'password');

            $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
            Zend_Mail::setDefaultTransport($transport);
            $mail = new Zend_Mail();
            $mail->setSubject("Quotation LL Sports Exim");

            $body="Dear Sir/Madam<br>Kindly find the attached Quotation and give us your Feed BAck";
            $mail->setBodyHtml($body);
            foreach ($emails as $email):
                 $mail->addTo($email);
            endforeach;
            var_dump($emails);
             if($qid!=""):
                  $fullBaseUrl = getcwd();
                $full_path = $fullBaseUrl . "\\pdfs\\" .$qid.".pdf";
                $content = file_get_contents($full_path); // e.g. ("attachment/abc.pdf")
                $attachment = new Zend_Mime_Part($content);
                $attachment->type = 'application/pdf';
                $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
                $attachment->encoding = Zend_Mime::ENCODING_BASE64;
                $attachment->filename ="quotation.pdf"; // name of file

                $mail->addAttachment($attachment);                  

             endif;


             $mail->send($transport);

             return true;

    } catch (Zend_Exception $e) {
        echo "Caught exception: " . get_class($e) . "\n";
        echo "Message: " . $e->getMessage() . "\n";
        exit;
        // Other code to recover from the error
    }
}
公共函数sendMailStatements($qid,$emails=array()){
需要一次“Zend/Mail.php”;
需要_once“Zend/Mail/Transport/Smtp.php”;
试一试{
$config=array('ssl'=>'ssl',
“端口”=>465,
'auth'=>'login',
“主机”=>“127.0.0.1”,
'用户名'=>'username@gmail.com',
“密码”=>“密码”);
$transport=new-Zend\u-Mail\u-transport\u-Smtp('Smtp.gmail.com',$config);
Zend_Mail::setDefaultTransport($transport);
$mail=new Zend_mail();
$mail->setSubject(“报价单LL Sports Exim”);
$body=“尊敬的先生/女士
请查看随附的报价单,并向我们反馈”; $mail->setBodyHtml($body); foreach($电子邮件形式的电子邮件): $mail->addTo($email); endforeach; var_dump(电子邮件); 如果($qid!=“”): $fullBaseUrl=getcwd(); $full_path=$fullBaseUrl.\\pdfs\\“$qid..pdf”; $content=file_get_contents($full_path);//例如(“附件/abc.pdf”) $attachment=新的Zend_Mime_部分($content); $attachment->type='application/pdf'; $attachment->disposition=Zend\u Mime::disposition\u attachment; $attachment->encoding=Zend_Mime::encoding_BASE64; $attachment->filename=“quote.pdf”;//文件名 $mail->addAttachment($attachment); endif; $mail->send($transport); 返回true; }捕获(Zend_例外$e){ echo“捕获异常:”.get_类($e)。“\n”; 回显“消息:”..e->getMessage()。“\n”; 出口 //要从错误中恢复的其他代码 } }
请告诉我哪里做错了


提前感谢。

您可以查看机器的日志,看看它是否真的发送了电子邮件。否则,您可以使用[mail tester](mail tester.com)之类的工具来确定邮件发生了什么情况。可能邮件最终进入了spamfolder?您可以尝试查看计算机的日志,以确定它是否确实发送了电子邮件。否则,您可以使用[mail tester](mail tester.com)之类的工具来了解邮件发生了什么情况。也许邮件最终会进入垃圾邮件文件夹?