title: Getting "Connection could not be established with host smtp.gmail.com :stream_socket_client()" error in laravel 8 on localhost for sending email
body: <p>I am trying to send email using gmail smtp in my laravel application which was working fine yesterday and emails were sending but today it is giving me this error. I tried every possible way but haven't figure out what is the problem. Any help would be appreciated. Thank you.</p>
  <p><strong>Here is my .env setting for smtp server</strong></p>
  <pre><code>    MAIL_MAILER=smtp
  MAIL_HOST=smtp.gmail.com
  MAIL_PORT=587
  MAIL_USERNAME=myemail
  MAIL_PASSWORD=mypassword
  MAIL_ENCRYPTION=tls
  MAIL_FROM_ADDRESS=myemail
  MAIL_FROM_NAME=&quot;${APP_NAME}&quot;
  </code></pre>
  <p><strong>I tried by changing</strong></p>
  <pre><code> MAIL_PORT= 465
   MAIL_ENCRYPTION = ssl
  </code></pre>
  <p><strong>I also changed</strong></p>
  <pre><code>MAIL_MAILER = sendmail
  </code></pre>
  <p>Still it is giving me the same error. I also allow access to unsecured apps from google but the error didn't go.</p>