Error sending email from django app

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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I am getting “error: [Errno 101] Network is unreachable” . If you have fixed the issue then please help !!

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