[Django]-Django send_mail returns SMTPConnectError

0👍

Gmail account need this:

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'your-username@gmail.com'
EMAIL_HOST_PASSWORD = 'your-password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
  1. then test its works by:

python manage.py shell

from django.core.mail import send_mail
send_mail('testEmail', 'hi', 'Youremail@email.com', ['Emailtest@email.com'])

If you’re not using a gmail account and still getting problems then just try add the EMAIL_HOST_USER and EMAIL_HOST_PASSWORD to what you have. If you still have issues maybe your network is blocking you. Firewalls on your OS or router.

👤Adi Ep

Leave a comment