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:
#MAIL_DRIVER=smtp MAIL_DRIVER=smtp MAIL_HOST=smtp.googlemail.com MAIL_PORT=465 MAIL_USERNAME=My_EMAIl_ADDRESS MAIL_PASSWORD=MY_EMAIL_PASSWORD MAIL_ENCRYPTION=ssl
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 smtp.gmail.com [ #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.