Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XFOR: Telnet to Port 25 to Test SMTP Communication


View products that this article applies to.

Summary

This article describes how to telnet to port 25 on a computer that runs Simple Mail Transfer Protocol (SMTP) services to troubleshoot SMTP communication problems. The information in this article, including error messages, only applies to issues that might occur when you are trying to resolve SMTP communication issues with servers that are running Microsoft Exchange�Server and is not intended for general troubleshooting.

Follow the�troubleshooting steps that are appropriate for the problem that you are experiencing. For example, if you have problems sending�email messages over SMTP between two of your servers that are running�Exchange 2000 Server, you can test the SMTP connectivity by using Telnet on the sending server to connect to port 25 on the destination server. By default, SMTP listens on port 25. Or, if you have problems receiving SMTP email from the Internet, follow the steps that are listed in this article to test connectivity to your SMTP server from a host that resides on the Internet and that is not located on your network.�

NOTE:�This article only outlines information for a connectivity test for messaging with Exchange Server. If you cannot connect to the Exchange Server, search the Microsoft Knowledge Base for other symptoms or error messages that you are experiencing. For more information about how to troubleshoot Exchange transport issues, refer to the following article in the Microsoft Knowledge Base:
257265 General troubleshooting for transport issues in Exchange 2000 Server and in Exchange Server 2003

↑ Back to the top


More information

There are several variations of SMTP in the Microsoft product line. The Windows product line has an SMTP service that is included with Internet Information Services (IIS), and in Windows NT Server 4.0, the SMTP service was included in the Option Pack. In more recent versions of Windows, IIS is integrated into the operating system, and you can add IIS by using�Add or Remove Programs�in Control Panel. Additionally, Exchange 2000 Server and Exchange Server 2003 use the existing SMTP service from IIS with additional features. Exchange 4.0 Server, Exchange 5.0 Server, and Exchange 5.5 Server include their own versions of SMTP in the form of the Internet Mail Connector (IMC) or Internet Mail Service (IMS).�

Note�In Exchange 5.0 Server and later versions,�Internet Mail Connector (IMC) is called Internet Mail Service.�

Before you start the Telnet session, you must have the full SMTP email address of the destination user who you want to send this test message to. This email address must be in the following format:
User@Site.Domain.com
You must also have the fully qualified domain name (FQDN) or the IP address of the server that is running the SMTP services (for example, 10.120.159.1). If the servers are in your organization, you may already have this information. If the servers are external, the easiest way to find this information is to use Nslookup.exe to find the DNS records (also known as Internet Mail Exchanger records) that contain this information.�

For additional information about NSlookup, click the following article number to view the article in the Microsoft Knowledge Base:
200525 Using NSlookup.exe
For additional information about obtaining Internet Mail Exchanger records, click the following article number to view the article in the Microsoft Knowledge Base:
203204 XFOR: How to Obtain Internet Mail Exchanger Records

Make sure that SMTP has started on the server that runs the SMTP service. To test whether SMTP has started, you can run the basic tests that are listed in this article and verify that you receive the 220 response from the remote server. This also verifies that SMTP is running.

Notes
  • Some Telnet applications require you to turn on local echoing to see the commands that you are typing. To do this while in a Microsoft Telnet session, type set local_echo at the command prompt.
  • In Windows XP, type set localecho instead of set local_echo.

Basic Testing

To make sure that the host computer and the remote SMTP server can communicate, follow these steps. If you receive the following error message after you type any one of the following commands, the SMTP server does not recognize what you typed because of a syntax error or an incorrect command:
500 Command not recognized
Check the command and type it again or verify that you are communicating directly to a Microsoft SMTP server.

Note�Microsoft Telnet does not let you use the Backspace key. If you make a mistake when you type a command, you must press Enter, and then start a new command.�

In the following steps, you run Telnet from the command line.
  1. To open a command line, click Start, click Run, type cmd in the Open box, and then click OK.
  2. You can start a Telnet session by using the Telnet command in the following format:

    Note�Press Enter after you type each line.�
    telnet servername portnumber
    For example, type:
    telnet mail.contoso.com 25
    Note You can replace servername with the IP address or the FQDN of the SMTP server that you want to connect to. Remember to press ENTER after each command.

    If the command works, you receive a response from the SMTP server that resembles the following:
    220 site.contoso.com Microsoft Exchange Internet Mail Connector <version number of the IMC>
    Note� There are different versions of Microsoft SMTP servers or third-party SMTP servers, and you may receive different responses from the receiving server. What is important is that you receive the 220 response with the FQDN of the server and the version of SMTP. Additionally, all versions of Microsoft SMTP server include the term "Microsoft" in the 220 response.�
  3. Start communication by typing the following command:
    EHLO test.com
    Note
    � You can use the HELO command, but EHLO is a verb that exists in the Extended SMTP verb set that is supported in all current Microsoft implementations of SMTP. It is a good idea to use EHLO, unless you believe that there is a problem with the Extended SMTP verbs. �

    If the command is successful, you receive the following response:
    250 OK
  4. Type the following command to tell the receiving SMTP server who the message is from:
    MAIL FROM:Admin@test.com
    Note This address can be any SMTP address that you want, but it is a good idea to consider the following issues:
    • Some SMTP mail systems filter messages based on the MAIL FROM: address and may not allow certain IP addresses to connect or may not allow the IP address to send email to the SMTP mail system if the connecting IP address does not match the domain where the SMTP mail system resides. In this example, that domain is test.com.
    • If you do not use a valid email address when you send a message, you cannot determine whether the message had a delivery problem because the non-delivery report (NDR) cannot reach an IP address that is not valid. If you use a valid email address, you receive the following response from the SMTP server:�
      250 OK - MAIL FROM Admin@test.com
  5. �Type the following command to tell the receiving SMTP server the address that the email message is being sent to.�

    Note�It is a good idea to always use a valid recipient SMTP address in the domain that you are sending email to. For example, if you are sending to�john@domain.com, you must be certain that john@domain.com exists in the domain. Otherwise, you will receive an NDR.

    Type the following command and the SMTP address that you want to send the email message to:�
    RCPT TO: User@Domain.Com
    You receive the following response:
    250 OK - Recipient User@ Domain.Com
  6. Type the following command to tell the SMTP server that you are ready to send data:
    DATA
    You receive the following response:
    354 Send data. End with CRLF.CRLF
  7. You are now ready to type the 822/2822 section of the message. The user will see this part of the message in their inbox. Type the following command to add a subject line:
    Subject: test message
    Press Enter two times. You do not receive a response from this command.�

    Note�The two Enter commands must comply with Request for Comments (RFC) 822 and 2822. The 822 commands and must be followed by a blank line.�
  8. Type the following command to add message body text:
    This is a test message you will not see a response from this command.
  9. Type a period (.) at the next blank line, and then press Enter. You receive the following response:
    250 OK
  10. Close the connection by typing the following command:
    QUIT
    You receive the following response:
    221 closing connection
  11. Verify that the recipient received the message that you sent. If any error event messages occur in the application event log, or if there are problems receiving the message, check the configuration or the communication to the host.

Advanced Testing

In addition to the basic testing steps that are listed in this article, you can use a delivery receipt to test mail in both directions. You can use this method to verify that the SMTP server can accept an incoming connection and generate a delivery receipt back to the sender to test outgoing connectivity of the SMTP server.

To request a delivery receipt for the test message, see step�5 in the "Basic Testing" section to make sure that the information provided is a valid email address that can receive the delivery receipt. Then in step�6 in the "Basic Testing" section, type the following command in the Telnet session:�
RCPT TO:User@Site.Domain.Com notify=success,failure

↑ Back to the top


Keywords: kbhowto, KB153119

↑ Back to the top

Article Info
Article ID : 153119
Revision : 12
Created on : 9/3/2013
Published on : 9/3/2013
Exists online : False
Views : 582