I have the following mail settings in my settings.py file:
EMAIL_SUBJECT_PREFIX = "[project]"
EMAIL_USE_LOCALTIME = True
EMAIL_USE_SSL = True
EMAIL_HOST = "mail.domain.com"
EMAIL_FROM = "email@example.com"
EMAIL_HOST_USER = "firstname.lastname@example.org"
EMAIL_HOST_PASSWORD = "password"
EMAIL_PORT = 465
EMAIL_TIMEOUT = 14400
PASSWORD_RESET_TIMEOUT = 86400
and it worked before but now suddenly no longer. I checked and the password is correct because my existing email on Thunderbird still works even after setting that password to the one I have here. So the password is correct.
Why do I keep getting this error:
smtplib.SMTPAuthenticationError: (535, b’Incorrect authentication data’)
In the same breath why is this try except block not working and telling me mail was not sent?
send_mail(subject, message=message, from_email=from_email, recipient_list=[email], html_message=template)
return Response("Could not send mail")
For whatever reason, and regardless of whatever other application may be telling you, the credentials you are supplying are being rejected.
At work, I have a very small Python program that I use to test SMTP mail - it’s an easy way to check things like this. See smtplib — SMTP protocol client — Python 3.11.0 documentation for an example of a program you can build from.
It’s a whole lot easier to test this directly than through Django.
We would probably need to see the complete view to understand the flow of events. This snippet does not provide enough context to understand what’s happening.
It was a hosting provider error thanks Ken. Have not seen you answering any posts lately? Are you not going to be on the forum any more
I’m not sure what you’re looking at, but I’m still around and answering questions. It’s been quite pleasant to see that there’s been an uptick of others answering questions as well.
ok was just thinking cause you have not answered any of my questions lately and you answer everybody lol
Good to know you’re still here
Yes the more people that answer questions, the better for us struggling developers
Thanks Ken we appreciate any help we get from members and like they say you should stick to what you know, While I have you here please tell me how I do this:
I get a querydict in a request
I turn that querydic into a normal python dictionary:
data = dict(request.data)
Then I want to remove some items and add them to another dictionary
location = data.pop(‘street’)
But when I print(location) I get an empty list. How should i do it pls?
Never mind I got the answer thanks