Can’t telnet localhost smtp

smtptelnet

I'm trying to use telnet (debian lenny 5.0.2) to check behavior of a postfix installation, but I can't telnet to smtp.

telnet localhost smtp
telnet: Unable to connect to remote host: Connection refused

telnetting to port 25 doesn't work either. I can telnet to port 110 and pop3.

How should I go about debugging this?

UPDATE:
The command ps aux|grep 'postfix' revealed that postfix wasn't running. Inspection of /var/log/mail.err and /etc/postfix/main.cf uncovered a typo in main.cf. After correcting that, postfix ran fine.

Note that 'postfix start' returned a message reporting that postfix was starting. When postfix wasn't starting, no error message or warning was returned.

Best Answer

  • First: check if Postfix is running: ps aux | grep postfix
  • Second: check if somebody is actually listening on port 25: netstat -lnp | grep :25
  • Third: if all of the above is ok, then probably the system firewall is preventing you from opening that sort of connection; have a look at its configuration using iptables -L.