We will be explaining how to use Telnet to test SMTP communications. To do this we will be using some values that you will need to replace with your own values. To identify the values to be changed we will be using in this article Bold Letters in UPPER CASE.
Please, install Telnet Client by running the following command in an opened as Administrator Command Prompt:
1- Open a Command Prompt window, type
telnet, and then press Enter.
This command opens the Telnet session. Please keep in mind that once you are typing in Telnet if you need to correct, back space does not work, just hit enter and retype the command.
set localecho, and then press Enter.
This optional command lets you view the characters as you type them, and it might be required for some SMTP servers.
set logfile <filename>, and then press Enter.
This command enables logging and specifies the log file for the Telnet session. If you only specify a file name, the log file is located in the current folder. If you specify a path and file name, the path needs to be on the local computer, and you might need to enter the path and file name in the Windows DOS 8.3 format (short name with no spaces). The path needs to exist, but the log file is created automatically.
OPEN MAIL1.FABRIKAM.COM 25, and then press Enter.
EHLO CONTOSO.COM, and then press Enter.
MAIL FROM:<CHRIS@CONTOSO.COM>, and then press Enter.
RCPT TO:<KATE@STARLIMS.COM> NOTIFY=success,failure, and then press Enter.
The optional NOTIFY command specifies the particular delivery status notification (DSN) messages (also known as bounce messages, nondelivery reports, or NDRs) that the SMTP is required to provide. In this example, you're requesting a DSN message for successful or failed message delivery.
DATA, and then press Enter.
Subject: Test from Contoso, and then press Enter.
10 Press Enter again.
A blank line is needed between the Subject: field and the message body.
This is a test message, and then press Enter.
12- Type a period ( . ), and then press Enter.
13- To disconnect from the SMTP server, type
QUIT, and then press Enter.
14- To close the Telnet session, type
quit, and then press Enter.
Here's what a successful session using the steps above looks like:
Microsoft Telnet> set localecho
Microsoft Telnet> set logfile c:\TelnetTest.txt
Microsoft Telnet> OPEN mail1.fabrikam.com 25
220 mail1.fabrikam.com Microsoft ESMTP MAIL Service ready at Fri, 5 Aug 2016 16:24:41 -0700
250-mail1.fabrikam.com Hello [172.16.0.5]
250-X-EXPS GSSAPI NTLM
MAIL FROM: <firstname.lastname@example.org>
250 2.1.0 Sender OK
RCPT TO: <KATE@STARLIMS.COM> NOTIFY=success,failure
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
This is a test message.
250 2.6.0 <email@example.com> [InternalId=5111011082268, Hostname=mail1.fabrikam.com] Queued mail for delivery
221 2.0.0 Service closing transmission channel
Usually the user SMTP Server is wrong and when you use the OPEN command it will give you an error.