Monday, March 5, 2012

Use Telnet to Test SMTP Communication
Technet library Article (bb123686)

Topic Last Modified: 2009-12-08

This topic explains how to use Telnet to test Simple Mail Transfer Protocol (SMTP) communication between messaging servers. By default, SMTP listens on port 25. If you use Telnet on port 25, you can enter the SMTP commands that are used to connect to an SMTP server and send a message exactly as if your Telnet session was an SMTP messaging server. You can see the success or failure of each step in the connection and message submission process.
Here are the scenarios where you may want to use Telnet to test SMTP communication to or from the transport servers that exist in your Microsoft Exchange Server organization:
•    Connect to your organization's Edge Transport server from a host that is located outside your perimeter network and send a test message.
•    Connect to a remote messaging server from your organization's Edge Transport server and send a test message.
The procedure in this topic shows you how to use Telnet Client, which is a component that is included with Microsoft Windows. Third-party Telnet clients may require a syntax that is different from that of the Windows Telnet component.
________________________________________
 Use Telnet on Port 25 to test SMTP communication
________________________________________
For purposes of providing an example, the following procedure uses the values that are described in the following list:
•    Destination SMTP server   mail1.fabrikam.com
•    Source domain   contoso.com
•    Sender's e-mail address   chris@contoso.com
•    Recipient's e-mail address   kate@fabrikam.com
•    Message subject   Test from Contoso
•    Message body   This is a test message
 Note:
You should always use a valid sender e-mail address so that any non-delivery report (NDR) messages that are generated by the destination SMTP server are delivered to the sender of the message. 


The commands in Telnet Client are not case-sensitive. The SMTP command verbs are capitalized for clarity.

1.    At a command prompt, type telnet, and then press ENTER. This command opens the Telnet session.

2.    Type set localecho and then press ENTER. This optional command lets you view the characters as you type them. This setting may be required for some SMTP servers.
3.    Type set logfile <filename>. This optional command enables logging of the Telnet session to the specified log file. If you only specify a file name, the location of the log file is the current working directory. If you specify a path and a file name, the path must be local to the computer. Both the path and the file name that you specify must be entered in the Microsoft DOS 8.3 format. The path that you specify must already exist. If you specify a log file that doesn't exist, it will be created for you.
4.    Type open mail1.fabrikam.com 25 and then press ENTER.

 Note:
You can't use the backspace key after you have connected to the destination SMTP server within the Telnet session. If you make a mistake as you type an SMTP command, you must press ENTER and then type the command again. Unrecognized SMTP commands or syntax errors result in an error message that resembles the following:

5.    500 5.3.3 Unrecognized command
6.    Type EHLO contoso.com and then press ENTER.
7.    Type MAIL FROM:chris@contoso.com and then press ENTER.
8.    Type RCPT TO:kate@fabrikam.com NOTIFY=success,failure and then press ENTER. The optional NOTIFY command defines the particular delivery status notification (DSN) messages that the destination SMTP server must provide to the sender. DSN messages are defined in RFC 1891. In this case, you're requesting a DSN message for successful or failed message delivery.
9.    Type DATA and then press ENTER. You will receive a response that resembles the following:
10.    354 Start mail input; end with <CLRF>.<CLRF>
11.    Type Subject: Test from Contoso and then press ENTER.
12.    Press ENTER. RFC 2822 requires a blank line between the Subject: header field and the message body.
13.    Type This is a test message and then press ENTER.
14.    Press ENTER, type a period ( . ) and then press ENTER. You will receive a response that resembles the following:
15.    250 2.6.0 <GUID> Queued mail for delivery
16.    To disconnect from the destination SMTP server, type QUIT and then press ENTER. You will receive a response that resembles the following:
17.    221 2.0.0 Service closing transmission channel
18.    To close the Telnet session, type quit and then press ENTER.



Technet

No comments:

Post a Comment