Skip to content

(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials gj6sm7456452pjb.10 - gsmtp') #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
msMohit20 opened this issue Sep 20, 2020 · 43 comments

Comments

@msMohit20
Copy link

i am middle of the project and i was connecting django with gmail and i got this type of error.....

settings.py code for :

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS')
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

what should is in this !!!?

AND AS I AM PUTTING ANOTHER GMAIL ID IT SHOW THAT MAIL IS SENT BUT I CAN'T SEE THAT MAIL ANYWHERE???????????????????

@edward795
Copy link

Enable less secure app login for your google account, by default google doesn't allow you to login to smtp server.
Go here >>https://myaccount.google.com/lesssecureapps
and enable it and you will be good to go.

@msMohit20
Copy link
Author

Thanks man

@dungranisahil7699
Copy link

Show This Error:
(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials m1sm1619710pjo.10 - gsmtp')

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = '(Here I Give My Email)'
EMAIL_HOST_PASSWORD = '(Here I Give My Email Password)'

every thing is complete but email not send....!!!

@dungranisahil7699
Copy link

@edward795
I alredy enable less secure app.
suggest me plz...

@dipakbera
Copy link

dipakbera commented Jun 6, 2021

@edward795
I have the same problem even after enabling a less secure app. The issue has been solved. Now it is working. Thanks Man.

@tyhho
Copy link

tyhho commented Jun 8, 2021

@dipakbera
Hello, would you mind sharing what solved your issue in the end? In our case we also enabled less secure app but the same error shows up. Thanks!

@dipakbera
Copy link

dipakbera commented Jun 9, 2021 via email

@tyhho
Copy link

tyhho commented Jun 9, 2021

Thanks for getting back to me @dipakbera .
We solved the problem eventually by using a Google generated App Password. It looks like using the login pw was the problem for us before.
https://support.google.com/accounts/answer/185833?hl=en
2FA is still needed to generate this App pw but miraculously it solved the problem.
Thank you again!

@dipakbera
Copy link

dipakbera commented Jun 9, 2021 via email

@edchelstephens
Copy link

Hello guys,

Here's how we are able to solve this problem:

Django SMPT Error answer:

https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637758197720369506-3330444657&rd=2#cantsignin&zippy=%2Ci-cant-sign-in-to-my-email-client

Steps:

1. Create 2-Step Authentication

https://support.google.com/accounts/answer/185839

2. Create App Password

https://support.google.com/accounts/answer/185833

3. Use the APP password as your EMAIL_HOST_PASSWORD in your settings file

It should work after that 👍

@Rony390-hue
Copy link

how to show this using the alert box in GUI tkinter?

@Trickster811
Copy link

Trickster811 commented Feb 27, 2022

how to show this using the alert box in GUI tkinter?
Hello!! What want you to show using alert box

@Trickster811
Copy link

Hello guys,

Here's how we are able to solve this problem:

Django SMPT Error answer:

https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637758197720369506-3330444657&rd=2#cantsignin&zippy=%2Ci-cant-sign-in-to-my-email-client

Steps:

1. Create 2-Step Authentication

https://support.google.com/accounts/answer/185839

2. Create App Password

https://support.google.com/accounts/answer/185833

3. Use the APP password as your EMAIL_HOST_PASSWORD in your settings file

It should work after that +1

Not working for me dear

@pratikgho
Copy link

enable access to the less secure app is ON, still seeing the same error? does anyone got solution.

@fires2023
Copy link

fires2023 commented Jun 6, 2022

From google.

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.

https://support.google.com/accounts/answer/6010255?hl=en

@Trickster811
Copy link

Trickster811 commented Jun 6, 2022 via email

@Trickster811
Copy link

Trickster811 commented Jun 6, 2022 via email

@fires2023
Copy link

I tried to find that section of enabling less secure apps on google account, but it was available, This is the message I am getting from less secure app of my newly created account

This setting is no longer available

From Google, the say they 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

@Trickster811
Copy link

Trickster811 commented Jun 7, 2022 via email

@Trickster811
Copy link

Trickster811 commented Jun 7, 2022 via email

@Trickster811
Copy link

Trickster811 commented Jun 9, 2022 via email

@Osigbemes
Copy link

Osigbemes commented Jun 11, 2022

Hi, it seems google have disabled the toggle.
I am unable to turn on less secure apps from my end

@Trickster811
Copy link

Trickster811 commented Jun 11, 2022 via email

@OfficialMabz
Copy link

has anyone managed to come up with solution regarding this isssue.

@Trickster811
Copy link

Trickster811 commented Jun 12, 2022 via email

@NadiaAzri
Copy link

has anyone managed to come up with solution regarding this isssue.
waiting for the solution...

@Trickster811
Copy link

Trickster811 commented Jun 13, 2022 via email

@OfficialMabz
Copy link

has anyone managed to come up with solution regarding this isssue.
waiting for the solution...

I have manged to fix my issue as Google have disabled the less secure apps recently. All I had to do was make my google account 2 factor authentication, then generate a new app password to use within the settings.py of django app for email password. Hope it helps

@xmsdos
Copy link

xmsdos commented Jun 13, 2022 via email

@xmsdos
Copy link

xmsdos commented Jun 13, 2022 via email

@Andreea523
Copy link

has anyone managed to come up with solution regarding this isssue.
waiting for the solution...

I have manged to fix my issue as Google have disabled the less secure apps recently. All I had to do was make my google account 2 factor authentication, then generate a new app password to use within the settings.py of django app for email password. Hope it helps

How did you generate a new password?

I am trying to solve this problem, I have now the authentication in 2 factors, but I got block. And I need to solve faster this problem for a project that I need to present in few days

@xmsdos
Copy link

xmsdos commented Jun 17, 2022 via email

@xmsdos
Copy link

xmsdos commented Jun 17, 2022 via email

@shehantha08
Copy link

Go to your google account settings. Go to Security. then Turn on 2-step verification. Then App Password ta will be enable. From App Password you can generate password. use this password for authentication purposes

@hoainv1704
Copy link

hoainv1704 commented Jun 23, 2022

I got a message in the Security section that To protect your account, apps and devices that use less secure sign-in technology are blocked. To keep your account secure, Google will automatically turn this setting OFF if it’s not being used.]
So we can't turn off Less secure apps from May 30, 2022.
For more detail you can access this site https://support.google.com/accounts/answer/6010255?hl=en&utm_source=google-account&utm_medium=profile-less-secure-apps-card

@JJ1006
Copy link

JJ1006 commented Jun 23, 2022

Show This Error: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials m1sm1619710pjo.10 - gsmtp')

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_USE_TLS = True EMAIL_PORT = 587 EMAIL_HOST_USER = '(Here I Give My Email)' EMAIL_HOST_PASSWORD = '(Here I Give My Email Password)'

every thing is complete but email not send....!!!

Now you cannot turn on less secure app as the deadline was 30th May 2022

@rahultalukdargithub
Copy link

rahultalukdargithub commented Jul 10, 2022

I am using flask and same issue is happening for me .
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 i14-20020a170902c94e00b0016c4331e61csm579079pla.137 - gsmtp')

what to do?

@T40FPV
Copy link

T40FPV commented Aug 26, 2022

Hey, community, I did as follows and read everyone's comments in this thread and I keep getting the same kickback message.

@JJ1006
Copy link

JJ1006 commented Aug 26, 2022

Hey, I have fixed it. You need to go into your google accounts settings and then go to "security". Then scroll down to "app passwords". There you can generate a code that will work as a password.

Do not share that code with anyone.

I was able to complete this. Hope this helps.

Feel free to ask more.

@T40FPV
Copy link

T40FPV commented Aug 26, 2022

Hey, I have fixed it. You need to go into your google accounts settings and then go to "security". Then scroll down to "app passwords". There you can generate a code that will work as a password.
Do not share that code with anyone.
I was able to complete this. Hope this helps.
Feel free to ask more.

I did go into my Google Mail Settings and Turned on the 2 Step Verification and created the App Password. I put that password into my Settings.py and I still get:

SMTPAuthenticationError at /register/
(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials b22-20020a63e716000000b004298d7b6e70sm1862321pgi.54 - gsmtp')

The Code Reads as follows:

Settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'from.********@gmail.com'
EMAIL_HOST_PASSWORD = '****************'

The code in

Signals.py

from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver

from django.contrib.auth.models import User
from .models import Profile

from django.core.mail import send_mail
from django.conf import settings

@receiver(post_save, sender=Profile)

def createProfile(sender, instance, created, **kwargs):
if created:
user = instance
profile = Profile.objects.create(
user=user,
username=user.username,
email=user.email,
name=user.first_name,
)

    subject = 'Welcome to DevSearch'
    message = 'We are glad you are here!'

    send_mail(
        subject,
        message, 
        settings.EMAIL_HOST_USER,
        [profile.email],
        fail_silently=False,
    )

@KathpaliaChirag
Copy link

Enable less secure app login for your google account, by default google doesn't allow you to login to smtp server. Go here >>https://myaccount.google.com/lesssecureapps and enable it and you will be good to go.

it doesnt work anymore

@Trickster811
Copy link

Trickster811 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests