Swift_TransportExceptionConnection无法与主机smtp.gmail.com建立 [英] Swift_TransportExceptionConnection could not be established with host smtp.gmail.com

查看:907
本文介绍了Swift_TransportExceptionConnection无法与主机smtp.gmail.com建立的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图在php中发送电子邮件。

 运输:smtp 
主机:smtp.gmail.com
用户名:example@example.com
密码:密码
端口:587
加密:ssl

已尝试的选项:


  1. 尝试了端口(22,465,587)和加密(无加密, SSL,TLS)

  2. 允许访问安全性较低的应用程序,并关闭两种验证方式。 $ b



    并尝试使用上面的主机名称和ips。


  3. 测试过的mailtrap.io及其正常工作! (在mailtrap收件箱中接收电子邮件,所以代码中没有问题


  4. 我在另一个.net应用程序中使用相同的Gmail帐户它的工作很好。


还有什么可以尝试的?

$ b $在 streamBuffer.php 中添加了这一行,它工作正常!

  $ options = array_merge($ options,array('ssl'=> array('allow_self_signed'=> true,'verify_peer'=> false) )); 


Trying to send email in php.

transport: smtp
host: smtp.gmail.com
username: example@example.com
password: password
port: 587
encryption: ssl

Options already tried:

  1. Tried all combinations of port (22, 465, 587) and encryption (No encryption, SSL, TLS)
  2. Allow access to less secure apps is on and two ways authentication is off.
  3. checked host details:

    and tried with above host name and ips.

  4. Tested mailtrap.io and its working fine! (receiving email in mailtrap inbox, so no issue in code)

  5. I'm using same gmail account in another .net application and its working fine over there.

What could be the option left to try?

解决方案

Added this line in streamBuffer.php and it worked!

$options = array_merge($options, array('ssl' => array('allow_self_signed' => true, 'verify_peer' => false)));

这篇关于Swift_TransportExceptionConnection无法与主机smtp.gmail.com建立的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆