PythonAnywhere Forums

Getting SMTPServerDisconnected Please run connect() first

While running Django app I am getting "SMTPServerDisconnected please run connect() first" while sending email with SMTP.

I am using below settings

EMAIL_USE_TLS=True
EMAIL_HOST="smtp.gmail.com"
EMAIL_HOST_USER="myemail@gmail.com"
EMAIL_HOST_PASSWORD="loginpassword"
DEFAULT_FROM_EMAIL=EMAIL_HOST_USER
EMAIL_PORT=587

Please suggest, how I can fix this problem without using any other email services.

You may need to do more setup of your gmail account. See here for details.