I was sending emails using gmail and everything was working perfectly, but suddendly it stoped working. And it shows me this
ErrorException in StreamBuffer.php line 94:
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
in StreamBuffer.php line 94
at HandleExceptions->handleError('2', 'stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed', 'C:\xampp\htdocs\coparmex\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php', '94', array())
at stream_socket_enable_crypto(resource, true, '9') in StreamBuffer.php line 94
at Swift_Transport_StreamBuffer->startTLS() in EsmtpTransport.php line 313
at Swift_Transport_EsmtpTransport->_doHeloCommand() in AbstractSmtpTransport.php line 118
at Swift_Transport_AbstractSmtpTransport->start() in Mailer.php line 79
at Swift_Mailer->send(object(Swift_Message), array()) in Mailer.php line 385
at Mailer->sendSwiftMessage(object(Swift_Message)) in Mailer.php line 171
And this only happends in my localhost, in the web host works fine. I don't understand what is going on :c
These are my gmail settings
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=gmail
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
That's an error with your SSL certificate. You're trying to use a SSL connection (encrypted, secure connection) without a proper certificate.
That's because you're connecting from localhost, which isn't secure, and that is blocked by the connection. You could avoid that by changing your localhost connection to a SSL based one.
See this link for more details.
I had the same issue and was able to resolve by removing a level of authentication security. That is, at some point Gmail asked me for the phone number - 2nd level of authentication. When I deleted this 2nd level I was happy again. I hope I have helped.
You should add below code in /config/mail.php ( worked on laravel 5.4 )
as you should never change code in vendors as suggested by Sultan Ahmad
in Laravel : this will solve the problem. go to
\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php
inside method private function establishSocketConnection()
after this code
then add this two lines
Hi I have also found this very useful on the server level: Edit \vendor\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php line 259 ish. comment out the $options = array(); and add the below.
This work with Laravel 6.0