Good content takes time and effort to come up with.

Please consider supporting us by just disabling your AD BLOCKER and reloading this page again.

Create Gmail App Password For SMTP Mails | StackCoder

Create Gmail App Password For SMTP Mails

07th July 2020 2 mins read
Share On     Share On WhatsApp     Share On LinkedIn

You will learn how to generate the Gmail App password for sending SMTP mails in a simple way. Earlier we had to compromise on security but now its a good initiative from Google to make more secured apps.

We will be covering the following topics

  1. Generating APP Password
  2. SMTP Credentials
  3. Implementation Article Links

Step 1 - Generating APP Password

Let's start with generating the APP password.

First, you need to login to your GMAIL

Mange Google Account

Google Settings

Google Settings

1 (Profile) - On right top corner click on your profile pic

2 (Mange Your Google Account) - Now click on Manage Your Google Account button. Which you take you to Gmail settings pages as shown below

App Passwords

Securing App Passwords

Securing App Passwords

1 (Security) - Make sure your have selected Security link on the left sidebar

2 (Signing To Google Section) - Now scroll to Signing In To Google section

3 (2 Step Verification) - Make sure your 2 - Step Verification is enabled. If not then please go ahead and add 2 Step Verification details. This is very important to secure your Gmail from unauthorized persons.

4 (App Password) - Now click on App Passwords which will take you to the following section

App Passwords

Generating App Password

Generating App Password

1 (App) - Select the Mail app

2 (Select Device) - Other and then add any custom name

3 (Generate) - Click on Generate button to generate your Gmail App Password

Copy App Password

Password Copying

Password Copying

Once the Gmail App Password is generated successfully then you will get the pop up similar to the above image with a password. Make sure to copy and save.

Step 2 - SMTP Credentials

Now looking at the above stuff your SMTP credentials will be similar to that of the following



The above is how your credentials will look like. Don't worry, the above is how your .env file looks like. You can use them with constants or directly add in the code.

NOTE: For the sake of security its best to add in .env file or some config file which won't be added to public available repositories.

Step 3 - Implementation Article Links

l have already written a PHP article on how to send the SMTP mails kindly check it out.

Send Email In PHP With PHPMailer


Hope you enjoyed the article. Please share it with your friends.

Author Image

Channaveer Hakari

I am a full-stack developer working at WifiDabba India Pvt Ltd. I started this blog so that I can share my knowledge and enhance my skills with constant learning.

Never stop learning. If you stop learning, you stop growing