Invalid Second Factor error sending email through Gmail

If you enabled 2 factor authentication in your security settings with Google, you may receive an "161: SMTP protocol error. 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactorinvalid second factor" message, which means you will need to create an app password to use, per Google's article at https://support.google.com/accounts/answer/185833.


  1. Go to your Google Account. 
  2. On the left navigation panel, choose Security. 
  3. On the "Signing in to Google" panel, choose App Passwords. 
  4. If you don’t see this option: 
    • 2-Step Verification is not set up for your account. 
    • 2-Step Verification is set up for security keys only. 
    • Your account is through work, school, or other organization. 
    • You’ve turned on Advanced Protection for your account.
  5. At the bottom, choose Select app and choose Mail. 
  6. Choose Select device and choose Windows Computer. 
  7. Choose Generate.
  8. Use the App password as the password in BLS for the email password instead of your normal GMail password. The App Password is the 16-character code in the yellow bar
  9. Choose Done.
Sometimes clicking the following link on the computer that BLS is installed on will help to authenticate the computer to allow BLS to send email through gmail:  https://g.co/allowaccess