Django SMTP Error: Authentication Error: Authentication Error

I set the django email address as follows:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Host for sending e-mail.
EMAIL_HOST = 'mytdl.de'

# Port for sending e-mail.
EMAIL_PORT = 25

# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = 'me@mytdl.de'
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')

But sending email using django-allauth will result in the following error:

(535, b'5.7.8 Error: authentication failed: authentication failure')

Testing settings with

 telnet  mytdl.de 25

or Thunderbird, as the email client works fine.

2.7.0 Authentication successful

But Django / SMTP data is still saved. Django is also trying

AUTH CRAM-MD5

but not

AUTH LOGIN

any ideas?

+5
source share
1 answer

If your mailbox is gmail, you can fix it using these simple steps:

  1. Log in to your gmail account (the one you use in your Django app to send emails).
  2. " " Google .
  3. " " " ".
  4. .

:

settings.py

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'example@gmail.com'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_PORT = 587
0

Source: https://habr.com/ru/post/1682204/


All Articles