Mar*_*cin 1 email gmail swiftmailer
我发送邮件有问题.我在gmail上使用SwiftMailer 5.1.0和帐户,启用了smtp端口465和openssl,但是我有这个错误:
Serwer: smtp.gmail.com:465 ssl
From: BizIn - system mailowy <isystemnew.pcet@gmail.com>
To: test7771@test.pl
Mail debug: Connection could not be established with host smtp.gmail.com [ #0]
Run Code Online (Sandbox Code Playgroud)
在我的本地主机上,一切都很好,邮件也随之发送.但是在服务上我有错误.
Localhost在版本5.4.31中使用PHP,但在服务器上是5.6.0.
这里的解决方案为我解决了这个问题:https://github.com/swiftmailer/swiftmailer/issues/544
@ if-joerch if-joerch于2014年11月3日发表评论
如果您使用的是PHP 5.6,则会出现错误,因为swiftmailer中的流上下文使用了"SSL上下文选项".在PHP 5.6中,verify_peer和verify_peer_name默认设置为TRUE,因此PHP会检查SSL证书.目前无法使用某些选项在swiftmailer中禁用它.
您可以通过修改StreamBuffer.php中的函数"_establishSocketConnection"来禁用SSL检查.在stream_socket_client命令之前添加这些行:
Run Code Online (Sandbox Code Playgroud)$options['ssl']['verify_peer'] = FALSE; $options['ssl']['verify_peer_name'] = FALSE;如果可以在不破解代码的情况下设置这些选项,那就太棒了.