Did you find this useful?
Socialize it today.

SMTP Commands: How to Send Email Using Telnet

Friday, October 28, 2011

If you have ever needed to run a test to verify if your SMTP server  can relay email, a simple way of doing so without having to load another SMTP server or run an SMTP client application is to use the TELNET command. This article provides a quick summary of the common SMTP commands and sequence used by the SMTP Protocol to transfer email via the TELNET command.  Of course, your SMTP server must be configured to allow for mail relaying.

Step 1
Open a command prompt and connect to the SMTP server using TELNETover port 25.

C:\WINDOWS>telnet smtp.mailserver.com 25

This will open a TELNET window, and you should expect a response such as:
220 smtp.mailserver.com ESMTP MAIL Service, Ready

The response will vary depending on the SMTP server software.  However, the 220 response indicates that you made a successful connection.

Step 2
The next step is to identify yourself.  If your computer name is IT1.anITKB.com, then type in the following:
helo IT1.itgeared.com

If the server accepts your input, you should expect the following in return:
250 smtp.mailserver.com Hello []

The response will also vary from server application type and version.

Step 3
Next, provide the mail from address.  Depending on your mail server's security settings, the mail from may be required to be from a certain domain suffix.
mail from: user1@itgeared.com

The server should respond with something like:
250 2.1.0 user1@itgeared.com...Sender OK

Step 4
Provide the server who you want to send the e-mail to.
rcpt to: user2@itgeared.com

You can enter any e-mail address. If there is some problem with the recipient-address, your mail will bounce.  The response should be:
250 2.1.5 user2@itgeared.com

Step 5
The next step is to tell the server data is coming for the body of the message.

The server will then notify you that it is now OK to provide the data.
354 Start mail input; end with .

Step 6
Type in the message you want included in the body.
This is a test!

When you are done typing in the message body, hit the enter key, then type in a ".", then hit the enter key once again.
250 2.6.0 smtp@mailserver.com Queued mail for delivery.

Step 7
If you want to send out another message, repeat steps 4-6, otherwise, type in quit

The server will respond with:
221 2.0.0 smtp.mailserver.com Bye

That's it!  You have successfully sent mail via the TELNET command.

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.

Recommended Books & Training Resources