Generate Gmail SMTP Credentials(with images)
6 very easy steps to send mail using Gmail SMTP in laravel 8.9.0:
1- Open your Google account settings
2- Click on the “2-Step Verification”
then click on “Get Started” and enter your google password
3- Verify your phone number
and click on “Turn On” 2 step verification
4- After turning on the two-step verification turn back to the security section click on “App passwords” and enter your Google password
5- Click on the select app dropdown and select other (Custom name)
6- Now type the name of your app/device
7- It will generate a 16-digit password and copy the password for later use
8- Open the .env file of your project
9- Convert this:
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=”${APP_NAME}”
With this:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=your-gmail-account@gmail.com
MAIL_PASSWORD=your-app-password (16 digits)
MAIL_ENCRYPTION=ssl
#MAIL_FROM_ADDRESS=null
#MAIL_FROM_NAME=”${APP_NAME}”
The Gmail SMTP is done and there is no need to change anything else.
I hope it helps!