On Sat, Apr 18, 2009 at 08:27:43AM +0300, Andrei Popescu (
andreimpopescu@gmail.com) wrote:
> On Sat,18.Apr.09, 08:04:12, Kurian Thayil wrote:
> > only whether the port is open or not. But what I need is to check if an
> > SMTP server is listening in that port. So I guess the best tool is
> > telnet and to check 220 status.
> Hhm, I thought a port cannot be "open" unless some server is *listening*
> on that port. What other server do you think would otherwise listen to
> port 25?
It could be under inetd, which would keep the port open even if it
couldn't actually start the mail server, or there could be a mail
server that's not accepting mail for some reason.
And people do abuse ports - I've even seen ssh in port 25.
So if the intent is to check if mail could be sent,
checking for smtp reply code is better.
(It's not 100% reliable either, but then nothing is, short of
actually sending the mail and waiting for reply or something.)