Test SMTP – How to send Email via Telnet

Test SMTP connection

This post is about one of the fundamentals tools any good Exchange administrator should be familiar with but that I see coming up over and over internet communities or support forums, how to send email and test SMTP via telnet.

Assume you just installed a new Exchange 2013 server and configured a send connector to deliver email to the internet and want to make sure all is working as intended sure enough you could use an Outlook client for the purpose but using telnet to test SMTP connections is much faster and very useful in any troubleshooting scenario.

Install Telnet Client to test SMTP connectivity

As the title implies the Telnet client is not installed by default with Windows so you will have to do this manually here’s how.

[su_spoiler title=”Windows 7/8″]

  1. Go to Control Panel and then Programs
  2. Click on Turn Windows Features On or Off
  3. Scroll down the list until you see the Telnet Client entry
  4. Tick the checkbox and click Ok to proceed with the installation

Alternatively you can use the command line as follows:

pkgmgr /iu:"TelnetClient"


[su_spoiler title=”Windows 2008 R2″]In Windows 2008 R2 you can use PowerShell to install the Telnet Client like this

# Import Server Manager Module to perform installation
Import-Module servermanager

# Install the Telnet Client Windows feature
Add-WindowsFeature telnet-client

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True    No             Success   {Telnet Client}

[su_note note_color=”#ffff96″ text_color=”#000000″ radius=”5″]Note: Alternatively you can use the same command line used for Windows 7/8 to achieve the same result[/su_note]


[su_spoiler title=”Windows 2012/2012 R2″]In Windows 2012 it is even easier to install the telnet feature thanks to the native PowerShell support for installing components:

Install-WindowsFeature Telnet-Client

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True    No             Success   {Telnet Client}


Send emails via Telnet

Open a command prompt and use telnet to connect to desired server over port 25 to test SMTP connectivity

telnet szhv-mb01.helocheck.com 25

If telnet is able to connect over port 25 you will be greeted by a similar message (called banner) like the following

220 SZHV-MM01.helocheck.com Microsoft ESMTP MAIL Service ready at Sat, 6 Jun 2015 04:33:35 +0200

The first command to be used to test SMTP is HELO which will “introduce” us to the remote server

helo testdomain.com
250 SZHV-MM01.helocheck.com Hello []

[su_note note_color=”#ffff96″ text_color=”#000000″ radius=”5″]Note: While it is not strictly necessary to specify a hostname after the HELO command, like helo testdomain.com, it is a good practice as many SMTP servers will deny the connection if a hostname is not supplied[/su_note]

Next command to be used would be the MAIL FROM command to specify the sender’s email address

mail from: <lethe@testdomain.com>
250 2.1.0 Sender OK

Once the sender has been specified use the RCPT TO command to specify the email’s recipient

rcpt to: <lethe@helocheck.com>
250 2.1.5 Recipient OK

[su_note note_color=”#ffff96″ text_color=”#000000″ radius=”5″]Note: As Skull noted in the comments to be strictly compliant and avoid your message is discarded by a overzaelous filter you need to enclose both the sender and the recipient addresses within < > [/su_note]

The final step is the DATA command which will tell remote server we’re sending data about the mail message itself

354 Start mail input; end with .

If for the sake of the test you just want to send a blank message just type a . (dot) otherwise you can specify components of the mail message like subject and body

subject: Test SMTP mail delivery via Telnet

Just a test message sent via Telnet


250 2.6.0  [InternalId=3675] Queued mail for delivery

Use the QUIT command to end the transmission and exit the session


221 2.0.0 Service closing transmission channel

If the message is queued by the server it means it has been accepted and the server will deliver it you can use Exchange message tracking to see the message being delivered to the final mailbox

As you’ve seen in the SMTP connection multiple status messages have been reported by the server which can be used to troubleshoot issues in the different scenarios or tell us if something is wrong.


4 thoughts on “Test SMTP – How to send Email via Telnet

  1. Technically, you should enclose the sender’s and the recipients’ addresses within angled brackets.
    Also, the SMTP commands should always be uppercase.

    HELO testdomain.com
    RCPT TO:

    This, if you want to be strictly compliant. Some anomaly-detection and antispam engines may become picky if you don’t… ^_^


  2. OK, the editor just munged the parts enclosed in angled brackets from my comment, considering them some sort of HTML tags. This makes the entire post look quite silly o_O


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s