Search code examples
pythongmail

How do I send emails through gmail via app passwords?


When trying to send an email with python through gmail, I need an app password. How would I set this up to send an email with python?


Solution

  • Apps passwords can be used to login to googles smtp server you need to have 2fa enabled on your google account in order to create an apps password.

    Google has not disabled apps passwords, they have disabled less secure apps.

    Simply create an apps password and use it in place of your standard gmail password in your code. Quick fix for SMTP username and password not accepted error

    How to create a Apps Password for connecting to Google's SMTP server.