Though App-specific passwords are not recommended by Google, it’s useful in some cases. For example, In a scenario when we want to utilize Google Mail as an SMTP provider, it’s more efficient to use an app-specific password than account credentials.

The process is very simple; however, you must have a two-factor password turned on.

Step – 1: Go to the Google Account settings page.

Step – 2: Navigate to the “Security” Tab, and locate the “Signing in to Google” section.

Step – 3: Click on the “App Password” link. This will navigate to the “App Passwords” page, but before we might need to authenticate.

Step – 4: Now, Select App and device, then click on the “Generate” button which will generate the application password. This password will be displayed only once, hence we need to copy-paste it before we close the window.

This app password can be utilized as per our requirements. For example, for SMTP settings we can use it as follows.

    "smtpserver": "smtp.gmail.com",
    "smtpport": "587",
    "smtpusername": "--gmail email address—", 
    "smtppassword": "-- app specific password –",