2014-11-17 161 views
1

我有發送郵件的問題。我使用SwiftMailer 5.1.0和帳戶在Gmail,SMTP端口465和OpenSSL是啓用的,但我有這樣的錯誤:SwiftMailer連接建立錯誤

Serwer: smtp.gmail.com:465 ssl 
From: BizIn - system mailowy <[email protected]> 
To: [email protected] 
Mail debug: Connection could not be established with host smtp.gmail.com [ #0] 

在我的本地主機的一切是好和電子郵件被髮送。但在serwer上我有錯誤。

本地主機在版本5.4.31中使用PHP,但在服務器上是5.6.0。

+0

這解決了我的問題:[https://stackoverflow.com /questions/38113860/error-stream-socket-enable-crypto-ssl-operation-failed-with-code-1-in-larav](https://stackoverflow.com/questions/38113860/error-stream-socket- enable-crypto-ssl-operation-failed-with-code-1-in-larav) –

回答

6

的修復在這裏解決了這個問題對我來說:https://github.com/swiftmailer/swiftmailer/issues/544

@ IF-joerch 如果-joerch評論2014年11月3日

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.

+2

\ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ Transport \ StreamBuffer.php – LeRoy