"SMTPAuthenticationError: Authentication disabled due to threshold limitation" on production server on AWS

I've set-up email sending in my Django project that is deployed on AWS. When I run it locally the emails go out without a problem, but when I try it on production server on EC2 ubuntu VM, I get smtplib.SMTPAuthenticationError: (535, b'5.7.0 Authentication disabled due to threshold limitation') error.

My settings are the same on both machines:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.my-provider.com'
EMAIL_PORT = 1025
EMAIL_HOST_USER = 'me@my-provider.com'
EMAIL_HOST_PASSWORD = 'mypassword'

Is there anything specific I need to do to be able to send emails form AWS? My outbound rules are set wide open.

That error means your SMTP provider temporarily disabled authentication because of a rate or login threshold.
It’s not related to AWS itself — it’s a protection mechanism from your mail provider (e.g. too many failed logins or connections from different IPs).

Here’s what you can do:

  1. Wait or contact your mail provider — many providers temporarily disable SMTP auth for 10–60 minutes if too many connections or logins are detected.

  2. Whitelist your EC2 IP — some SMTP servers block unknown IPs or require trusted IP ranges.

  3. Enable SMTP auth for external apps — check your provider’s dashboard for “Allow external SMTP clients” or “Less secure apps”.

  4. Try port 587 (STARTTLS) instead of 1025 — port 1025 is often only for local testing or mail relays, not for production.

    EMAIL_PORT = 587
    EMAIL_USE_TLS = True
    
    
  5. Check your credentials and environment variables — make sure AWS env vars are set properly and not empty strings.

If you’re testing locally with a mock SMTP server like MailHog, make sure to switch to your provider’s real SMTP endpoint in production.

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