I have been trying search many files to set send_mail backend with Gmail host. Here is my settings:
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'myemail'
EMAIL_HOST_PASSWORD = 'mypassword'
DEFAULT_FROM_EMAIL = 'myemail'
It doesn't work...I find someone mentioned to set Gmail Account with "less secure app". So I tried, but it didn't work. On google website, it says:"To help keep your account secure, from May 30, 2022, Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password." (refer to: https://support.google.com/accounts/answer/6010255?hl=en).
Regardless of all, I still tried to use python3 manage.py shell, and got the error: SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials jj4-20020a170903048400b0016a2b68823esm9889669plb.141 - gsmtp')
Could anyone help me, thanks a lot!
I have a similar experience. When I tested the software, I got the error you mentioned. It made me very nervous.
The temporary solution was to change the account password. Then for some time, I was able to test again using gmail. Unfortunately, but after a short time, the access was blocked.
I have not found a solution and the previous settings are not available. It's a shame that the service makes everything difficult. You can try free SMTP alternatives.