Error sending email from django app

August 4, 2014 2.5k views

I've started a new production droplet in NYC2, it has virt-io, and backup.

I have a django application with many other services running, like redis, node, sockjs and celery.

Also, i want to point ou that my local server runs the exact same configuration with regards to email, and everything works fine.
I did not change anything regarding to firewall or networking in my droplet.

Can anybody help me fix this error?

My problem is that i can't send email from my django app.

My configuration is :

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_PORT = 587 #also tried with 465

Here is the error:

File "<console>", line 1, in <module>
  File "......./", line 158, in email_user
    send_mail(subject, message, from_email, [])
  File "......./local/lib/python2.7/site-packages/django/core/mail/", line 50, in send_mail
  File "........./local/lib/python2.7/site-packages/django/core/mail/", line 274, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "........./local/lib/python2.7/site-packages/django/core/mail/backends/", line 87, in send_messages
    new_conn_created =
  File "........./local/lib/python2.7/site-packages/django/core/mail/backends/", line 48, in open
  File "/usr/lib/python2.7/", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/", line 311, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/", line 286, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.7/", line 571, in create_connection
    raise err
error: [Errno 101] Network is unreachable
1 Answer

It looks like SMTP is blocked on your droplet -- please open up a support ticket so we can unblock it. Thanks!

Have another answer? Share your knowledge.