0

I am building a flask application which sends a mail when the user clicks on submit in a form. I'm following this tutorial - https://www.geeksforgeeks.org/sending-emails-using-api-in-flask-mail/

However, when I tried to run the app, I got the following error : smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials 67-20020a620446000000b0056b9d9e2521sm2627179pfe.177 - gsmtp')

I understand that this is because google blocked my sign-in attempt? When I go to the link mentioned in the article to allow access, I got this - Allow apps to access settings image

Can I anyone help? Is there any workaround for this? How do I send an email from flask anymore?

What I tried : Everything on https://www.geeksforgeeks.org/sending-emails-using-api-in-flask-mail/ What I expected to happen : An email to be sent. What actually happened : Google seems to no longer allow third party sign-ins. So login attempt to send mail was blocked. Is there any other way to login/send mails from gmails in flask?

Vivek
  • 27
  • 4

1 Answers1

1

You can replace the password by "App Password", to create app password, you can read the page: https://support.google.com/mail/answer/185833?hl=en

  • Thanks, That worked! :) However, This was just a test since I'm gonna be using a shared organization mail to send the emails. Is there anything I should know? (I noticed that google doesn't allow app passwords for shared inboxes) Does this setting depend on the domain? Should I request for anything from my organization? – Vivek Oct 26 '22 at 09:12
  • I have also used my organization mail for my work, If you have any problem with your email for work I think you should contact your admin (probably IT team) ) to solve that problem – Toàn Nguyễn Văn Oct 26 '22 at 09:24