Django Allauth login/signup fails with SMTPAuthenticationError (535) in production

I’m experiencing an issue in production where login and signup fail due to an SMTP authentication error when using Django Allauth.


❗ Error

SMTPAuthenticationError: (535, b'Incorrect authentication data')

Relevant traceback:

File ".../django/core/mail/backends/smtp.py", line 97, in open
    self.connection.login(self.username, self.password)

File ".../smtplib.py", line 669, in auth
    raise SMTPAuthenticationError(code, resp)

Environment

  • Django: 6.0.3

  • Python: 3.14.3

  • django-allauth: latest

  • Deployment: cPanel (Passenger)

  • OS: Linux (RHEL-based)


Email Configuration

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.agrotekpluss.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False

EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')

DEFAULT_FROM_EMAIL = 'atpsus@agrotekpluss.com'

Allauth Settings

ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_LOGIN_METHODS = {'email'}
ACCOUNT_SIGNUP_FIELDS = ['email*', 'password1*', 'password2*']

Steps to Reproduce

  1. Go to /accounts/login/ or signup page

  2. Submit valid credentials

  3. Allauth attempts to send verification email

  4. Request fails with SMTPAuthenticationError


Actual Behavior

  • Login/signup fails

  • Email is not sent

  • Exception is raised during SMTP authentication


Expected Behavior

  • User logs in or signs up successfully

  • Verification email is sent


What I’ve Observed

  • The issue only happens in production

  • It occurs specifically when Allauth sends a verification email

  • If I disable email verification, login works:

ACCOUNT_EMAIL_VERIFICATION = "optional"

Question

What could cause (535, b'Incorrect authentication data') in this setup?

  • Could it be incorrect SMTP credentials or host mismatch?

  • Does the SMTP server need additional configuration for TLS/auth?

  • Are there known issues with Django 6 / Python 3.14 and SMTP?


Additional Notes

  • SMTP is configured on port 587 with TLS

  • Using environment variables for credentials

  • No issues locally (only in production)


Any guidance on debugging or fixing SMTP authentication in this context would be appreciated.

Вернуться на верх