Last Update: Sep 24, 2024 | Published: Jan 07, 2009
How can I verify that my Exchange server is accepting connections? How can I connect to my Exchange server via Telnet?
Sometimes you might want to troubleshoot your Exchange server from outside your corporate LAN (or from within, it makes no difference) in order to see if it accepts incoming connections. An example for this situation might be when your users are complaining about lack of incoming mail or lack of ability to pull mail from the server.
A quick way to check SMTP connectivity is to use the PORTQRY.EXE command (see Quickly Find Remote Open Ports page for more info):
Querying target system called: petri.com Attempting to resolve name to IP address... Name resolved to 64.5.48.48 TCP port 25 (smtp service): LISTENING Data returned from port: 220-atlas.polymorphic.net ESMTP Exim 4.24 #1 Sat, 11 Oct 2003 19:30:25 -0400 220-We do not authorize the use of this system to transport u64.5.48.48
You will also need to check various settings for possible problems, such as your virtual servers status, connectivity to the Internet, presence of a valid MX record and authentication problems, but if all seems to work fine and you still want to check the connectivity yourself – you can try it via Telnet.
Telnet forms part of the basic TCP/IP protocol suite and is therefore to be found on most machines that have TCP/IP installed. It is a very useful diagnostic tool that we can use to establish a connection to a remote computer (via a particular ‘port’) issue commands to the remote computer, and see the responses it produces.
The syntax used to run the telnet program is
telnet
where computer is the hostname, or IP address of the remote computer, and port is the TCP/IP port number that the service we are using runs on (25 for SMTP, 110 for POP3).
Sometimes you’ll want to see what you type in the Telnet console, so you’ll first start Telnet without actually connecting to the server, type
set local_echo
(or set localecho in Windows XP)
and then open the connection by typing
open <computer> <port>
SMTP is the TCP/IP protocol used to send e-mails via the Internet. It uses port number 25, so in order to use telnet to open an SMTP session with an Exchange server we use the command
telnet 25
If the connection is successful, we should see a banner and a command line interface. We then need to follow RFC 821 for the accepted SMTP commands, which are quite simple (as the name says…)
220 srv1.dpetri.net Microsoft ESMTP MAIL Service, Version: 5.0.2195.5329 ready at Sun, 15 Sep 2002 23:51:06 +0200 helo srv1.dpetri.net 250 srv1.dpetri.net Hello [192.168.0.100] mail from: [email protected] 250 2.1.0 [email protected] OK rcpt to: [email protected] 250 2.1.5 [email protected] data 354 Start mail input; end with . subject: this is a test Hi Daniel I'm trying to test this connection from Telnet. Let me know if you get this message. . 250 2.6.0 Queued mail for delivery quit 221 2.0.0 srv1.dpetri.net Service closing transmission channel Connection to host lost. Press any key to continue...
(Screenshot of the same dialog)
If the server accepted the e-mail, and if the recipient got it ok, there are no connectivity problems at your server and no firewall or stopped services issues.
POP3 is the TCP/IP protocol that is used to retrieve Internet mail from a server. It uses port number 110, so to open a POP session with our Exchange server we use the command
telnet 110
You will then begin to authenticate to the server and issuing POP3 commands as described in RFC 1939:
+OK Microsoft Exchange 2000 POP3 server version 6.0.6249.0 (srv1.dpetri.net) ready. user [email protected] +OK pass sbhtkp +OK User successfully logged on. list +OK 1 642 1 642 . stat +OK 1 642 retr 1 +OK Received: from srv1.dpetri.net ([192.168.0.100]) by srv1.dpetri.net with Microsoft SMTPSVC (5.0.2195.5329); Mon, 16 Sep 2002 00:00:00 +0200 To: "" From: "Admin" Subject: Please call me! X-Mailer: Ghost Mail 5.1 http://ay.home.ml.org/ X-Priority: 3 (Normal) Return-Path: [email protected] Message-ID: X-OriginalArrivalTime: 15 Sep 2002 22:00:00.0892 (UTC) FILETIME=[3CF74BC0:01C25D03] Date: 16 Sep 2002 00:00:00 +0200 Dear Daniel, Hope all is well with you. I'd like to talk to you ASAP, so please call me at lunchtime. Thanks, Admin. . dele 1 +OK stat +OK 0 0 quit +OK Microsoft Exchange 2000 POP3 server version 6.0.6249.0 signing off. Connection to host lost. Press any key to continue...
(Screenshot of the same dialog)
As with SMTP, if the server accepted the connection, and if you were able to retrieve your e-mail, there are no connectivity problems at your server and no firewall or stopped services issues.
You might also want to read the following related articles:
RFC 821 – Simple Mail Transfer Protocol
RFC 1939 – Post Office Protocol Version 3