How to fix Username and Password when accessing Googles SMTP server 2

In today’s digital age, security is paramount. With the increasing sophistication of cyber threats, it’s crucial to safeguard your online accounts, especially those containing sensitive information. When it comes to sending emails, using a secure email server like Google SMTP is essential. However, to ensure that your account remains protected, Google has implemented enhanced security measures, requiring the use of app passwords.

App passwords are unique 16-digit codes generated specifically for applications or devices that need access to your Google account. These passwords act as an additional layer of security, preventing unauthorized access even if your regular password is compromised.

Error Message Without App Password

If you attempt to send emails using your regular password instead of an app password, you will encounter the following error message:

535-5.7.8 Username and Password not accepted. Learn more at lf4-20020a170902fb4400b0019b4ee071ddsm4794plb.2999 gsmtp

This error message indicates that your login attempt has been rejected due to the absence of an app password. To resolve this issue, create an app password and use it instead of your regular password.

Why App Passwords are Mandatory for Sending Emails

There are several reasons why using app passwords is mandatory for sending emails through the Google SMTP server:

  • Enhanced Security: App passwords provide an extra layer of protection by creating a unique password for each application or device, preventing unauthorized access even if your regular password is stolen.
  • Compliance with Google’s Security Policies: Google strictly enforces the use of app passwords for all applications accessing the SMTP server to ensure that only authorized applications can send emails from your account.
  • Preventing Account Blocking: If you attempt to use your regular password to send emails through SMTP, your account may be blocked, as Google may interpret this as a potential security breach.

Generating and Using App Passwords

Creating an app password is a straightforward process

  1. Go to your google account
  2. Then the security page
  3. Scroll down to 2-step Verification (this must be enabled) click on that
  4. Scroll down to App passwords click on the arrow
  5. Give it an App name and click create
  6. Copy the password that is displayed to you now.

You can now use the apps password in the place of your true google password in your code or application.


App passwords play a crucial role in safeguarding your Google account when sending emails through the SMTP server. By implementing app passwords, you can significantly enhance your account security, preventing unauthorized access and ensuring that your emails remain protected.

About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as an application developer and a database expert. I have also been working with Google APIs since 2012 and I have been contributing to the Google .Net client library since 2013. In 2013 I became a a Google Developer Experts for Google Analytics.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 thoughts on “How to fix Username and Password when accessing Googles SMTP server

  • Karlo Babić

    PROBLEM with SMTP is no longer 2Fa and App Password.
    Current problem is Gmail API.. IT IS HORRIBLE what it asks for to do,
    then “Verification for your API might take up to few MONTHS”

    I have 2 days, not few months, do you have solution ?