Sidekiq TCP Error solved by using port 587 (not 25)

Jobs::HandledExceptionWrapper: Wrapped Net::OpenTimeout: Timeout to open TCP connection to smtp.mailersend.net:25 (exceeds 5 seconds)

I’m getting this error … Does it mean I have to open port 25 for SMTP to function??

Yes. It’s trying to send mail and many hosting services block outgoing port 25.

I already IPtables allowed port 25 to accept connections … saved it and had it restart with every time server reboots or restarts! What else could be there??

I also, checked my SMTP credentials … and they’re good to go with my DNS configured and all that but still nothing is happening.

Any ideas what’s going here?? :bowing_man:

I don’t know what is happening. But if you would be at DigitalOcean it doesn’t matter if you opened port 25 because DO blocks it between you and the world.

1 Like

@Jakke I’m with OVH for so long and never had any issue with them but a few days ago I bought a new server from them and set it up right away with their powerful iptables system instead of traditional ufw I used to use until few days ago and of course opened ports 22, 80, 443, 6379 and few hours ago 25 but nothing is changing so far :technologist:

I’m guessing I might need to restart my system(s) server and discourse too maybe!

Ask them if they are blocking port 25. If likely being blocked at the router, not the os. Services like mailgun use port 2525 to avoid this problem.

1 Like

UFW is just a frontend for iptables that is just a fronend for packet controlling.

Using directly iptables gives more flexibility than UFW but it needs ipatables-persistent. But using iptables vs. UFW there is no bigger differences except two:

  • with iptable order matters
  • with iptable syntax matters

I would even say that mentioning of iptables is not enough when no one knows what you have there.

There is one small detail too. Docker just doesn’t care what you have done with iptables of VPS. Docker kind of bypasses it.

There is just one thing I don’t get: why are you using port 22?

For ssh connection to the server to install plugins and etc :slight_smile:

Having said that I was going to change that default port 22 to another number …!

Good idea but it’s the weekend and they tend to sleep in till late time :smiley:

1 Like

Of course. Please — don’t read what I’m writing, but what I should write :rofl:

Yeah. My bad. What I ment was why you want to use port 25…

1 Like

This is the original issue I’m facing in my first post and did not know what was that number 25 mean but guessed it was port number with mail sending or email confirming to be more persist and was right :slight_smile:

Did I answer you with port 25 ?? I’m not sure where it came from but it is there apparently :confused:

So with iptables / ufw you tend to block incoming traffic, but the error is about outgoing traffic from your server to mailersend.net.

But that is not your issue.

Port 25 is not being used for relaying emails (as opposed to delivering them) nowadays. Instead, most email services use port 587, and when I google for the mailersend documentation it indeed tells you to use port 587, not port 25.

3 Likes

I had this response from mailersend support;

It seems like you’re using port 25 smtp.mailersend.net:25 hence the error, at the time we only support 587 with TLS encryption.

Port 25 was default port on the setup credentials. But changed it right away to 587 and things are super smooth now :partying_face:

Problem SOLVED

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.