Reputation: 91
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 <[email protected]>
To: [email protected]
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.
Upvotes: 1
Views: 10267
Reputation: 1335
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.
Upvotes: 6