[Errno 111] Connection refused on smtp.gmail.com


EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’
EMAIL_HOST = ‘smtp.gmail.com
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_HOST_USER = ‘shyamrathod173@gmail.com’
EMAIL_HOST_PASSWORD = ‘XXXXXXX’
When i am check on localhost it’s work well but when i am check on host on cpanel it’s throw error

Welcome @Shyamra !

When requesting assistance with an error message, it’s usually more helpful to get the error and traceback from the server logs than the excerpt shown in the browser.

In this specific case, an Error 111 in a general connection error. For whatever reason, the host you’re running this on was unable to open a connection to smtp.gmail.com. There are a number of different possibilities for this error:

  • There’s an outbound firewall on your host network preventing outbound connections on port 587.

  • There’s an outbound firewall on your host network preventing outbound connections to smtp.gmail.com.

  • There’s a DNS issue in your host system’s network providing the wrong address for smtp.gmail.com.

  • gmail is currently blocking access for smtp connections from your IP address or subnet. (This is more likely than it sounds. Google is getting more proactive regarding the reduction of spam and continues to add restrictions and limitations regarding the systems from which it will accept email.)

(There are other possibilities as well - these are just the ones I can think of right now.)

Finding the cause will require you to do the research with your hosting provider (and possibly Google) to determine if it’s one of these issues - or something else.