laravel 5.5 cannot send emails using gmail


Windows 10, Apache httpd 2.4, PHP 7.1.4, Laravel 5.5<br /> Gmail's less secure is Allowed.

<hr />

My .env file:

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=account@gmail.com MAIL_PASSWORD=password MAIL_ENCRYPTION=ssl

Error Message:<br /> Connection could not be established with host smtp.gmail.com


Error Message:<br /> stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\n<br /> error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

<hr />

I also tried


Error Message:<br /> Process could not be started

<hr />

Some people say that my question is duplicate of this question:<br /><a href="https://stackoverflow.com/questions/46080133/laravel-curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate" rel="nofollow">laravel : cURL error 60: SSL certificate unable to get local issuer certificate</a>

But that question, no answer is accepted, and all the answers don't work. I added a reply, say the problem I encoutered, then someone says that a reply should be an answer, my reply is not an answer. I should ask a new question. In that question, my reply was deleted!

Here is what I did: (Webinion's answer)<br /> Put cacert.pem


Edit Client.php

/vendor/guzzlehttp/guzzle/src/Client.php private function configureDefaults(array $config) { echo "<pre>", print_r(123, 1), "</pre>"; exit; $defaults = [ 'allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => true, 'decode_content' => true, //'verify' => true, 'verify' => dirname(__FILE__).'/cacert.pem', 'cookies' => false ];

At first, I added the cacert.pem line, not working.<br /> Then I added the echo line, didn't see 123 and it didn't exit. It seems that this Client.php is not used?

Error message:

Swift_TransportException Connection could not be established with host smtp.gmail.com [ #0] D:\www\...\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php if (false === $this->stream) { throw new Swift_TransportException( 'Connection could not be established with host '.$this->params['host']. ' ['.$errstr.' #'.$errno.']' ); }

That answer says guzzlehttp but my error message says swiftmailer. Laravel now uses different packages?


I found the solution. No need to change guzzlehttp/guzzle/src/Client.php which is suggested in another question.



Download cacert.pem file from <a href="https://curl.haxx.se/docs/caextract.html" rel="nofollow">https://curl.haxx.se/docs/caextract.html</a><br /> Put the cacert.pem somewhere you like.

</li> <li>

Edit php.ini

</li> </ol>

two lines:

curl.cainfo=D:/Servers/php/sslfiles/cacert.pem openssl.cafile=D:/Servers/php/sslfiles/cacert.pem <ol start="3"><li>Restart apache httpd.</li> </ol>


  • Duplicate files copied in APK reference.conf
  • UnitTest in swift | IOS Storyboard | Failed to cast viewcontroller class defined in objective c
  • Deduce the HDFS path at runtime on EMR
  • Hyperledger Composer CLI Ping to a Business Network returns AccessException
  • HostingEnvironment.QueueBackgroundWorkItem uses ASP.Net thread pool or another thread pool?
  • Laravel S3 File Upload MimeType Issue
  • PHP Carbon “month()” method generates wrong DateTime
  • Laravel 5 how to include autoload.php
  • Restructure php contact form
  • PHP mail() function not delivering mail
  • Merge list of objects into consistent list based on common matching attribute in Python
  • Insert records if not exist SQL Server 2005
  • Regex for nested values
  • Unique Permutations - with exceptions
  • Laravel at least one field is required
  • Aptana 3 remove bundle (jquery)
  • Cloud Code function running twice
  • How can I replace the server in Web Component Tester
  • Clear activity stack before launching another activity
  • 550 Access denied - Invalid HELO name
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • How can I sort a a table with VBA with given text condition?
  • Installing iPhone App to iPhone
  • Abort upload large uploads after reading headers
  • Email verification using google app script and google forms
  • Record samples being played with OpenAL
  • Ajax Loaded meta Tags
  • Xamarin Forms - UWP Fonts
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • RestKit - RKRequestDelegate does not exist
  • Arrays break string types in Julia
  • Data Validation Drop Down Box Arrow Disappearing
  • Hits per day in Google Big Query
  • Understanding cpu registers
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How do I configure my settings file to work with unit tests?
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • How do I use LINQ to get all the Items that have a particular SubItem?