Telnet test mail server using SMTP protocol

  
                  

This article describes how to telnet to port 25 on a computer running the Simple Mail Transfer Protocol (SMTP) service to resolve SMTP communication problems. By default, SMTP listens on port 25.

You can choose the appropriate troubleshooting steps below based on the type of problem you are experiencing. For example, if you have problems sending mail through SMTP between two Microsoft Exchange 2000 Server servers, you can test the SMTP connection by using Telnet on the sending server to connect to port 25 on the target server. Or, if you're having trouble receiving SMTP mail from the Internet, you can test the connection between your host that is on the Internet but not on your network and your SMTP server by following the steps outlined in this article. MORE INFORMATION There are several different variants of SMTP in the Microsoft product line. The SMTP service for the Microsoft Windows product line is included in Internet Information Services (IIS), while in Microsoft Windows NT Server 4.0, the SMTP service is included in the Option Pack. In newer versions of Windows, IIS has been integrated into the operating system, and you can add IIS using Add or Remove Programs in Control Panel. In addition, both Exchange 2000 and Microsoft Exchange Server 2003 use existing SMTP services and other features in IIS. Microsoft Exchange Server versions 4.0, 5.0, and 5.5 all contain their own SMTP versions in the form of Internet Mail Connector (IMC) or Internet Mail Service (IMS).

Note:

In Exchange 5.0 and higher, the Internet Mail Connector (IMC) was renamed to Internet Mail Service.

Before starting a Telnet session, you must have the full SMTP email address of the target user to whom you want to send this test message. The email address must be in the following format: [email protected] You can also have the fully qualified domain name (FQDN) or IP address of the server computer running the SMTP service (for example, 10.120.159.1). If the server is in your organization, you may already have this information. If the server is an external server, the easiest way to find this information is to use Nslookup.exe to find the DNS record that contains the information.

For additional information about NSlookup, please click on the article number below to view the article in the Microsoft Knowledge Base: 200525 Using NSlookup.exe For additional information on how to obtain Internet Mail Exchanger records, click The following article is numbered to view the article in the Microsoft Knowledge Base: 203204 XFOR: How to Obtain an Internet Mail Exchanger Record Make sure that SMTP is started on the server that is running the SMTP service. To test if SMTP is up, you can run the basic tests listed in this article and verify that you will receive 220 messages from the remote server. This will also verify if SMTP is running.

Note:

Some Telnet applications require you to turn on local echo to see the commands you type. To do this in a Microsoft Telnet session, type set local_echo at a command prompt.

In Microsoft Windows XP, you should type set localecho instead of set local_echo.

Basic Testing Follow these steps to ensure that the host and remote SMTP server can communicate. If you receive the following error message after you type any of the following commands, the SMTP server is unable to recognize what you typed because of a syntax error or a command error: 500 Command not recognized Check the command and type it again, or verify you Whether you are communicating directly with the Microsoft SMTP server.

Note:

Microsoft Telnet does not allow you to use the Backspace key. If you make a mistake while typing, you must press Enter and start typing the new command.

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

Note: Press Enter after typing each line of content. For example, type: telnet mail.contoso.com 25 Note: You can replace the server name with the IP address or FQDN of the SMTP server you are connecting to. Remember to press Enter after typing each command.

If the command works, you will receive a message from the SMTP server similar to the following: 220 site.contoso.com Microsoft Exchange Internet Mail Connector Note: Because there are many different versions of Microsoft SMTP or A three-way SMTP server, so you may receive different messages from the receiving server. However, you will definitely receive a 220 message containing the FQDN of the server and the version of SMTP. In addition, all versions of Microsoft SMTP include the word "Microsoft" in the 220 message. 2. Start communication by typing the following command: EHLO test.com Note: You can use the HELO command, but EHLO is a verb in the extended SMTP verb set that is supported by all current Microsoft implementations of SMTP. Unless you think there is a problem with the extended SMTP verb, it's best to use EHLO.

If the command is successful, you will receive the following message: 250 OK 3. Type the following command to notify the receiving SMTP server of the sender of the message: MAIL FROM:[email protected] Note: This address can be you Any SMTP address you want to use, but it is best to consider the following questions: 1. Some SMTP mail systems will filter mail based on MAIL FROM: address, and will block certain IP addresses from connecting to the SMTP mail system, or if connecting IP addresses with SMTP mail The domain in which the system resides does not match, and it also prohibits the address from sending email to the SMTP mail system. In this case, the domain is test.com. 2. If you are not using a valid email address when sending mail, you will not be able to determine if there is a problem sending the message because the non-delivery report (NDR) cannot reach the invalid IP address. If you use a valid email address, you will receive the following message from the SMTP server: 250 OK - MAIL FROM [email protected] 4. Type the following command to notify the receiving SMTP server of the recipient of the message.

Note:

It is best to always use the valid recipient SMTP address in the domain you are sending to. For example, if you are sending to [email protected], you must ensure that [email protected] exists in your domain. Otherwise, you will receive an NDR.

Type the following command using the SMTP address of the person you are sending to: RCPT TO:[email protected] You will receive the following message: 250 OK - Recipient User@ Domain.Com 5. Type the following command notification The SMTP server is ready to send data: DATA You will receive the following message: 354 Send data. End with CRLF.CRLF 6. You are now ready to start typing the 822/2822 part of the message. Users will see this part of the message in their inbox. Type the following command to add the subject line: Subject:test message Press Enter twice. This command does not display any information.

Note: Press Enter twice to be consistent with Request for Comments (RFC) 822 and 2822. It stipulates that the 822 command must be followed by a blank line. 7. Type the following command to add the message body: This is a test message you will not see a response from this command.8. Type a period (.) in the next blank line and press Enter. You will receive the following message: 250 OK 9. Type the following command to close the connection: QUIT You will receive the following message: 221 closing connection 10. Verify that the recipient has received the message you sent. If there are any error event messages in the application event log, or if there is a problem receiving the mail, check the configuration or communication of the host. Advanced Testing In addition to the basic testing steps listed earlier in this article, you can use a delivery receipt to test your messages in both directions. You can use this method to verify that the SMTP server can accept inbound connections and generate a delivery receipt for the sender to test the outbound connection to the SMTP server.

To request a delivery receipt for a test mail, see step 4 of the "Basic Testing" section of this article to ensure that the information provided is a valid email address that can receive delivery receipts. Then in step 5 of the "Basic Testing" section of this article, type the following command in the Telnet session: RCPT TO: [email protected] notify=success, failurestelnet mail.contoso.com 25 220 site.contoso.com Microsoft Exchange Internet Mail Connector EHLO test.com250 OK MAIL FROM:[email protected] 250 OK - MAIL FROM [email protected] RCPT TO:[email protected] 250 OK - Recipient User@ Domain.Com DATA 354 Send data. End with CRLF.CRLF Subject:test message Press Enter twice. This is a test message you will not see a response from this command. Type a period (.) in the next blank line and press Enter. 250 OK QUIT 221 closing connection Response to send mail: 500 format error, command unrecognizable (this error also includes command line too long) 501 Parameter format error 502 Command not 503 Error command sequence 504 Command parameter not 211 System status or System Help Response 214 Help Information 220 Service Ready 221 Service Shutdown Transport Channel 421 The service is not ready, the transport channel is closed (this response can be used as a response to any command when it must be closed) 250 The requested mail operation is completed 251 The user is not local, will The mail operation requested to forward to 450 is not completed, the mailbox is unavailable (for example, the mailbox is busy) 550 The required mail operation is not completed, the mailbox is unavailable (for example, the mailbox is not found, or is inaccessible) 451 Abandon the requested operation; Error 551 User is not local, please try 452 system storage is insufficient, the required operation is not performed 552 excessive storage allocation, the required operation is not performed 553 mailbox name is not available, the required operation is not performed (such as mailbox format error) 354 start mail input End the 554 operation with LF>.

Copyright © Windows knowledge All Rights Reserved