How to setup Google SMTP

Step 1. Login to Google Account

Go to (if not signed in, you will be asked to sign-in to your account).

Step 2. Enable 2-Step Verification

First, you have to enable the 2-Step Verification on your account before you set up the app password.

Click on the Security tab on the left-hand side to go to the Security page and within the section Signing in to Google click on 2-Step Verification.

Click on Get Started and on the next page enter your password to verify your account and hit Next.

Now you have to set up your phone. Enter the phone number you want to use for verification and then select the method to receive your code. It may be a Text message or a Phone Call. I will keep it a Text message and hit Next.

Google will send you a text message with a verification code. Enter the verification code & hit Next.
On the next page, Google will confirm that the 2-Step Verification is ON. Now click the back arrow next to the heading to go back to the Security page.

Step 3. Setup Application password

Within the section Signing in to Google, you will notice a new option that says App passwords.

Click on App passwords and verify your account. After verification, you will be able to create the app password for any app and device.

Now, select Mail from Select app and Other (custom name) from Select device and provide it a name. You can name it anything you like, I will name it PHPMailer and hit Generate.

Now you have successfully generated your app password. Copy this code and paste it somewhere safe, until you haven’t added it to the PHP script.

Remember, don’t share it with anyone.

App passwords are a security risk, so you should keep them safe and revoke application-specific passwords you no longer use. Be careful with them, and treat them like the master passwords to your account that they are.

– Important

You have successfully generated the app password.  Use it on SMTP password input.