3

Am getting a connection time out error when am trying to send a django mail through smtp. Below is my configuration -

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Host for sending e-mail.
EMAIL_HOST = 'smtp.zoho.com'

# Port for sending e-mail.
EMAIL_PORT = 587

# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = 'cs@amaze.com'
EMAIL_HOST_PASSWORD = 'amaze123'
EMAIL_USE_TLS = True

And the code which am using is :

    from django.core.mail import send_mail
    >>> send_mail('Order Confirmation', 'Order placed successfuly', 
'cs@amaze.com', ['check@gmail.com'])

Error -

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", li                                                                                        ne 61, in send_mail
    return mail.send()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", lin                                                                                        e 292, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py                                                                                        ", line 100, in send_messages
    new_conn_created = self.open()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py                                                                                        ", line 58, in open
    self.connection = connection_class(self.host, self.port, **connection_params                                                                                        )
  File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 316, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 110] Connection timed out
dreamer
  • 478
  • 1
  • 11
  • 24

1 Answers1

-1

Are you sure you need to use TLS and not SSL, and if needed have you enable smtp on your e-mail account?

Myhrael
  • 17
  • 5