Related Threads:

The problem

I have a server running Debian 3.2.65-1 and i am having some problems to connect other server to send emails through SMTP in a web app based on Drupal.

The first thing i've done is ckecking the server with telnet and the result is the following message.

Command Line syntax:

telnet smtp.mydomain.com 587


Trying XXX.XXX.XX.XXX...
telnet: Unable to connect to remote host: Connection timed out

After googling and reading some posts about different solutions:

  1. I can connect from other different machines to the SMTP server. So i discard the SMTP server as origin of the problem.
  2. The statement on 1 makes me think that it is a firewall problem. Then, I've checked iptables.

Command Line syntax:

iptables -L


Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

I understand that the server is open and it has the default configuration with no rules.

  1. I've found that the server has UFW, but it is not running.
  2. Following the advice of kasperd in comments: 3rd comment

netstat -ntlp


(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0*               LISTEN      -
tcp        0      0   *               LISTEN      -
tcp        0      0    *               LISTEN      -
tcp        0      0    *               LISTEN      -
tcp        0      0 *               LISTEN      -
tcp        0      0*               LISTEN      -
tcp6       0      0 :::111                  :::*                    LISTEN      -
tcp6       0      0 :::8080                 :::*                    LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::46645                :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::443                  :::*                    LISTEN      -
tcp6       0      0 ::1:6082                :::*                    LISTEN      -

Any ideas how can i fix it ?

  • do telnet X.X.X.X smtp to telnet to SMTP port vs into telnet port (which is usually disabled. – alexus Jan 19 '16 at 22:13
  • Thanks for your response. I've updated my question. I've been using telnet smtp.mydomain.com port everytime. The port i want to connect is 587 and i can connect to the STMP server with my local machine. IS there something i am missing? – Rufein Jan 20 '16 at 7:58
  • Try running netstat -ntlp on the server to see which services are actually listening. – kasperd Jan 20 '16 at 8:08
  • Thanks. I 've updated the question. I am not a sys-admin, so do you see something wrong in the output? – Rufein Jan 20 '16 at 8:33

Your server is not listening on port 587. I accept that you think you've been able to connect to it from some other machines, but I can only surmise that they've been going through some kind of transparent proxy which has hijacked connections to mail-server-type services, and whisked you off to some local mail server.

In other words, the machine that can't connect to server:587 is telling you the truth. Any machines that claim they can are lying to you.

  • Thank you very much !!! You have been close. But i accept your answers because it gave me clues to resolve the problem. There was a proxy to isolate the server. – Rufein Jan 22 '16 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.