535, b'5.7.139 Authentication unsuccessful, basic authentication is disabled
I have a website that uses an email contact form. Recently been told it does not work. When I recreated the error in development I got the error
535, b'5.7.139 Authentication unsuccessful, basic authentication is disabled.
I read online that basic authentication has been switched off by Microsoft. I am unsure how to resolve this. Is there a new way to authenticate? I cannot find anything that will allow a user to provide these simple details to send an email to our inbox.
I am using Django and the following code that did work before.
html = render_to_string('emails/contact_form.html', {
'first_name': first_name,
'last_name': last_name,
'email': email,
'content': content
})
send_mail('Message', content, EMAIL_HOST_USER, [EMAIL_HOST_USER], html_message=html)
The end users cannot provide that. You need to register your app with Microsoft, that will allow you do display an auth dialog on behalf of the user; that login will give you the access and refresh tokens, which you can use to authenticate to the SMTP endpoint. Refresh token will let you silently retrieve a fresh auth token without showing the auth dialog again.