zend框架zend_mail不发送电子邮件

时间:2018-08-24 10:55:37

标签: php zend-framework zend-mail

继承了zend Framework应用程序1.12版 并从最近停止发送电子邮件。

indexcontroller.php

$mail = new Zend_Mail('UTF-8');
                $mail->addTo($sender_email);
                $mail->setSubject("Result of Payment Transaction (Success)");
                ob_start();
                include APPLICATION_PATH . 
                 '/views/scripts/file.phtml';
                $message = ob_get_clean();

                $mail->setBodyText($message);
                $mail->setFrom('email@mail.com');
                $mail->send();

application.ini

                   ;EMAIL SETTTING
resources.mail.transport.type = Zend_Mail_Transport_Smtp
resources.mail.transport.host = "smtp.gmail.com"
resources.mail.transport.port = 465 
resources.mail.transport.auth = "login"
resources.mail.transport.username = "mail@emil.com"
resources.mail.transport.password = "pass"
resources.mail.transport.ssl = "ssl"

Bootstrap.php

         $emailConfig = array(
        'auth' => 'login',
        'username' => Zend_Registry::get('config')->email->username,
        'password' => Zend_Registry::get('config')->email->password,
        'ssl' => Zend_Registry::get('config')->email->protocol,
        'port' => Zend_Registry::get('config')->email->port
    ); 

    $mailTransport = new Zend_Mail_Transport_Smtp(
            Zend_Registry::get('config')->email->server, $emailConfig);
    Zend_Mail::setDefaultTransport($mailTransport);

我得到的输出错误是

  

异常信息:
  消息:无法打开插座

     

堆栈跟踪:
  1.库/Zend/Mail/Protocol/Smtp.php(167):Zend_Mail_Protocol_Abstract-> _connect('ssl://smtp.gmai ...')
  2.库/Zend/Mail/Transport/Smtp.php(199):Zend_Mail_Protocol_Smtp-> connect()
  3. library / Zend / Mail / Transport / Abstract.php(348):Zend_Mail_Transport_Smtp-> _ sendMail()

我查看了服务器是否正在连接, telnet smtp.gmail.com 465 连接的 用户名密码正确,我也尝试更改为tls,但仍然没有成功

任何反馈或参考,将不胜感激

0 个答案:

没有答案