How to enable port 25 on my Ubuntu server?

So I am running Spree e-commerce in Rails. When I click on ‘place order’ after I have added items to my cart and proceed to checkout i got this error. (same question as this person)

Errno::ECONNREFUSED in Spree::CheckoutController#update
Connection refused - connect(2) for "localhost" port 25

I believe it has something to do with the email but I am not 100 percent sure. As for spree is defaulted to port 25 as referred to here

I checked my port using

telnet mydroplet'sIPaddress 25

and it said (as expected)

telnet: Unable to connect to remote host: Connection refused

I tried a solution to unblock my port 25 by adding the line below as suggested in another question here.

iptables -I INPUT -p tcp -m tcp --dport 25 -j ACCEPT

and recheck using the same method and still no good.

I even went to setup my firewall using ufw and made sure my port 25 is available by following this tutorial

sudo ufw allow 25/tcp

still no good…


How do I enable my port 25?

I am running Ubuntu Ruby on Rails on 14.04 (Postgres, Nginx, Unicorn).

My IP address is if anyone wants to try my port 25.


This comment has been deleted

I have also issue with outgoing port 25, I tried every thing as mention in digitalocean’s community but still facing issue and No one answer my ticket from Digitalocean support system, How disappointing :(

*``` root@iMaker-test:~# telnet 25 Trying… telnet: Unable to connect to remote host: Connection timed out

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

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.

really? bye bye digitalocean

Same problem here. When I wrote to the support, this is the response I got:


You are unable to send mail as outgoing SMTP traffic is blocked at this time. After 60 days have passed you can request that the SMTP block on your account be lifted at that time.

Please let us know if you have any other questions!"

So that means if I’m migrating a website, particularly a forum, which needs to send user activation and reply notifications, you can’t go live for 60 days. That’s absolute horrible and unacceptable, especially when I have provided a valid credit card info to them at the time of sign up.

Hello all,

It is possible that port 25 is closed for new accounts. This is something we have been doing to reduce spam on our network. Please do not think that we are accusing you of sending spam, it is more that we simply cannot accurately determine who is going to send it.

Stopping spam is a constant fight, so we have implemented some restrictions on newer accounts. To qualify for the ability to send out email, we do require accounts to wait 60 days before we can look into removing the restriction. Once your account has reached 60 days of stable use, please do reach back out to us so we can look into this for you.

Hope that helps! Regards, Alex

Just open SSH to the server and allow it: ufw allow 25

+1, this is very upsetting.

Facing same problem and no apparent solution


Like many providers, DigitalOcean blocks Port 25 by default, so you would need to configure another port by which to send e-mail (2525 is a common alternative). You would need to configure your app to send mail through this (new )port and ensure that either your mail server or upstream mail server is capable of serving on this port as well (and, of course, open it on the firewall).

You’ll probably want to install either sendmail or postfix. Probably postfix.