SwiftMailer连接建立错误 [英] SwiftMailer connection established error

查看:175
本文介绍了SwiftMailer连接建立错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有发送邮件的问题。我使用SwiftMailer 5.1.0和帐户在gmail,smtp端口465和openssl是启用,但我有这个错误:

  Serwer :smtp.gmail.com:465 ssl 
从:BizIn - 系统mailowy< isystemnew.pcet@gmail.com&
To:test7771@test.pl
邮件调试:无法使用主机smtp.gmail.com建立连接[#0]

在我的本地主机上,一切都是okey和邮件发送。但是在serwer我有错误。



本地主机在版本5.4.31中使用PHP,但在服务器上为5.6.0。

解决方案

这个修复程序为我解决了这个问题: https://github.com/swiftmailer/swiftmailer/issues/544



@ if-joerch
if-joerch在2014年11月3日发表评论


如果您使用的是PHP 5.6,则会发生错误,因为SSL
上下文选项用于swiftmailer中的流上下文。 IN PHP
5.6 verify_peer和verify_peer_name默认设置为TRUE,因此PHP检查SSL证书。您可以通过使用某些选项在swiftmailer中禁用



您可以通过修改函数
_establishSocketConnection来禁用SSL检查在StreamBuffer.php。在stream_socket_client命令之前添加这些行

  $ options ['ssl'] ['verify_peer'] = FALSE; 
$ options ['ssl'] ['verify_peer_name'] = FALSE;

如果这些选项可以在没有黑客
代码的情况下进行设置,这将是非常好的。 p>


I have problem with sending mails. I using SwiftMailer 5.1.0 and account on gmail, smtp port 465 and openssl is enable, but I have this error:

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] 

At my localhost everything is okey and mails are send. But on serwer I have error.

Localhost using PHP in version 5.4.31, but at server is 5.6.0.

解决方案

The fix here solved it for me: https://github.com/swiftmailer/swiftmailer/issues/544

@if-joerch if-joerch commented on Nov 3, 2014

If you are using PHP 5.6, the error does occur because of the "SSL context options" used for the stream context in swiftmailer. IN PHP 5.6 verify_peer and verify_peer_name the default was set to TRUE, so PHP checks the SSL certificate. It is currently not possible to disable it in swiftmailer using some options.

You could disable the SSL check by modifying the function "_establishSocketConnection" in StreamBuffer.php. Add these lines before stream_socket_client command:

$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;

It would be great if these options could be set without hacking the code.

这篇关于SwiftMailer连接建立错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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