Laravel – Connection could not be established with host [ #0]

I’m trying to send an email from Gmail using Laravel from the localhost (I use XAMPP for Windows).

Set your .env file

Open you’re .env which is located in your root directory of our application and checkout for this settings:


Configure your Google Account

Open Your Google account and give access to less secured applications.
Login to your Google Email Account, go click on Google Account Button, then click on Security, go to Less secure app access settings and turn the radio button to ON.

In my case, Not working with these settings! I’m getting this error:

Connection could not be established with host [ #0]


In the Laravel project directory, edit config/mail.php and add the following:

'stream' => [
        'ssl' => [
            'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false,

It worked for me.

Leave a Comment