脚本宝典收集整理的这篇文章主要介绍了php – Symfony SwiftMailer – 预期的响应代码220但是得到了代码“”,带有消息“”,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试从我的GOOGLE Apps域发送电子邮件.大多数时间都会发送电子邮件,但有时会抛出此异常并且不会发送电子邮件.
Uncaught PHP Exception Swift_TransportException: "Expected response code 220 but got code "",wITh message """ at C:\HostingSpaces\abc\domain.COM\wwwroot\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.PHP line 383 {"exception":"[object] (Swift_TransportException(code: 0): ExPEcted response code 220 but got code \"\",with message \"\" at C:\\HostingSpaces\\abc\\domain.com\\wwwroot\\vendor\\swiftmailer\\swiftmailer\\lib\\classes\\Swift\\Transport\\AbstractSmtpTransport.PHP:383)"} []
是的,我使用SSL,是的,我已经允许访问不太安全的应用程序,是的我使用端口465.我已启用假脱机,以便应用程序不会崩溃,因为异常不会被捕获.
swiftmailer: transport: smtp host: smtp.gmail.com username: no-reply@googledomain.com password: password port: 465 encryption: ssl spool: { type: memory }
我的电子邮件课程如下
public function send_new_order_email($entity) { try{ $message = $this->getEmailObj("toaddress@gmail.com"); $message->setBody( $this->renderView( 'APIBundle:Emails:ops_neworder.html.twig',array('entity' => $entity) ),'text/html' )->setSubject('New Order : '.$entity->getId()); $this->container->get('mailer')->send($message); } catch(Exception $e){} } PRivate function getEmailObj($email){ $message = \Swift_Message::newInstance() ->setFrom('no-reply@googledomain.com') ->setTo($email); return $message; }
你对这项工作有什么建议吗?
以上是脚本宝典为你收集整理的php – Symfony SwiftMailer – 预期的响应代码220但是得到了代码“”,带有消息“”全部内容,希望文章能够帮你解决php – Symfony SwiftMailer – 预期的响应代码220但是得到了代码“”,带有消息“”所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。