With google having disabled the access to enable access to less secure apps can anyone suggest ways in which I can send mails using flask-mail? It has to be disabled in the mail account I'm using to send mails using flask-mail.
-
Please provide enough code so others can better understand or reproduce the problem. – Community Jun 03 '22 at 19:53
-
I'd be curious to know more details on this issue, can you please post any exceptions you are seeing on the flask server when trying this? – v25 Jun 03 '22 at 21:55
-
Hi @alex, have you managed to solve this issue? I just encountered the same issue after Google disable less secure app access. Thank you – Jaden Ng Jun 08 '22 at 13:36
4 Answers
If your problem is about google security you can use app password instead of your account password in MAIL_PASSWORD configuration, To do that you should enable 2-step verification in your Google Account and then use app password, So go to your Google Account,
Security
Signing in to Google
Enable 2-step verification
App password
Make app password and use it as your MAIL_PASSWORD
In link below you can see other options

- 99
- 9
-
1But for 2 step verification, we need to provide the phone number right... I want to send using a dummy account. Any way to send without using 2-factor thing? – alex Jun 04 '22 at 10:07
-
Well I think Your app must be more secure and meet google security standards, or you can use other email client server – Mohammad Reza Aram Jun 04 '22 at 13:37
so you need to set up the App Password from setting.
This video shows how to set up App Password = link.
setps:
1. Manage your Google Account
2. Goto the Security. on left side
3.At security->Signing in to Google
1 first need on 2-setp-verfication.
2 then click App Password.then select app and device.
for me app=Mail.
device=Windows Compter.
3 A password is genrated. copy the password. It only show one time
4 used this password to login.

- 31
- 3
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 10 '22 at 15:53
I had a similar problem using sendmail and ESMTP with Google Mail, and the excellent 'sender_based_routing' patch from: http://faculty.cs.niu.edu/~rickert/cf/ which allows sendmail to choose a different relay based on email 'From:' headers; using my MS-365 corporate email selects smtp.outlook365.com , while using my personal email selects smtp.google.com.
Because I am out of mobile phone coverage while at home, I cannot enable 2-Factor authentication or use an App Token, which requires 2-factor authentication and the ability to receive SMS; my mobile phone package does not include SMS-over-WiFi, and Google's 2-factor Auth SMS messages are not sent over Google Chat SMS.
The only workaround I have found is to open a new Google WorkSpaces email account, then you can enable the SMTP relay feature, and sending email with sendmail + ESMTP then works again.
Google has thus doubled its revenue stream from me; and since I must copy every message sent by my new account to my old one, it has doubled my storage requirements, that I pay for. Clever Google! Never neglects an opportunity to squeeze more profit from its users.
Anyway, paying for 2 email accounts in order to send emails is vastly preferable to be being forced to use the horrible GMail GUI - I can use MA/GNUS Emacs to send mails - definitely worth it.
The best long term solution, which I will do as soon as I can, is setup one's own Email server , and scrap use of Google altogether - I wish I was in a position to do this, as soon as I am I will - it requires a static IP and an always-on server.

- 645
- 1
- 7
- 17
Note: Before proceeding please enable 2 factor authentication.
Less secure apps (https://myaccount.google.com/u/0/lesssecureapps) is no longer available.
We can use apppasswords feature provided by google via following link
https://myaccount.google.com/u/0/apppasswords
Check below image for reference, Use 16 digit code provided by google in-place of password.

- 1,939
- 26
- 36