This is one of the essential troubleshooting tricks that an Exchange administrator needs to know, sending an email using Telnet from the command line.

Let’s say you’ve just configured a relay connector and want to test it from the server that you wish to allow relay from before you let that server’s owner know that it is all set up for them. Or perhaps you want to quickly test whether a another email server on the internet is accepting mail from your network.

For just about any scenario where you want to quickly test SMTP knowing this method is very useful.

Note: this technique requires the Telnet client to be installed on the computer you’re running the test from. For Windows XP and Windows Server 2003 it will already be installed, but Windows 7 and Windows Server 2008 need to install it first.

Installing the Telnet Client for Windows 7

To install the Telnet client on a Windows 7 computer use these steps.

  1. Open the Control Panel
  2. Click on Programs
  3. Click on Turns Windows Features on or off
  4. Scroll down the list until you see Telnet Client, and tick that box
  5. Click OK and close the Control Panel

Installing the Telnet Client for Windows Server 2008

To install the Telnet client on a Windows Server 2008 computer open a command prompt and run the following command.

C:\>servermanagercmd -i telnet-client

Start Installation...
[Installation] Succeeded: [Telnet Client].

Success: Installation succeeded.

Installing the Telnet Client for Windows Server 2008 R2

To install the Telnet client on a Windows Server 2008 R2 computer open a PowerShell window and run the following command.

PS C:\> Import-Module servermanager
PS C:\> Add-WindowsFeature telnet-client

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

Sending Email from the Command Line via Telnet

Open a command prompt and use Telnet to connect to the remote email server on port 25.

C:\>telnet esp-ho-ex2010a 25

If Telnet is able to connect to the remote server you should see its welcome banner.

220 Microsoft ESMTP MAIL Service ready at T
ue, 9 Aug 2011 22:00:04 +1000

The first command to send is the HELO command. Some email servers will accept HELO on its own, others will require you to also provide a host or domain name along with it.

250 Hello []

Next use the MAIL FROM command to tell the remote server who the email is from.

mail from:
250 2.1.0 Sender OK

Now use the RCPT TO command to tell the remote server who to deliver the email to.

rcpt to:
250 2.1.5 Recipient OK

The final step for the bare minimum set of commands is the DATA command.

354 Start mail input; end with .

If you just want to send a blank message type a period “.” and press enter. Otherwise you can set a subject line for the message if you like. Use SUBJECT and then type your subject line, and press enter.

subject: this is a test message

Type any text you want to include with the message, press enter, and then finally type a period “.” and press enter to send the email.

sending a test message via telnet
250 2.6.0  [InternalId=320] Queued mail for delivery

If the message was queued for delivery then it has been accepted by the server. If this is an Exchange server that you control then you can use message tracking to troubleshoot further if the message doesn’t make it to the inbox that you were expecting.

Type the QUIT command to terminate the connection when you’re done.

SMTP Status Codes

You may notice along the way that after typing commands you see responses from the server starting with “250”.

250 is a good thing, and there are a lot of other SMTP status codes you’ll encounter the more you use this technique. For example an email server may deny your attempt to relay mail between two domains.

550 5.7.1 Unable to relay

Or you may encounter an email server that is explicitly blocking email from your domain.

554 5.1.0 Sender denied

There are a lot of different scenarios you might encounter here, and thankfully the SMTP status codes will help you troubleshoot them.

Now that you understand how to send email using Telnet and the command line I hope you find this technique very useful in the future.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for


  1. tro

    how to append rply-to in telnet mailing.

  2. Manish

    Thanks. Mail issue is resolved

  3. Leonard

    after i set the text :

    sending a test message via telnet
    . ( hit ENTER )

    i have the message :
    250 OK
    but there is no email coming in my inbox

  4. Bright Ugochukwu

    Very useful

  5. John Gordon

    I setup a SharePoint connector which seems to work when sending internal emails, but my emails to outside clients don’t deliver. Is there a way using this procedure (or a powershell command) where I can test message delivery through a specific connector?

    1. Avatar photo
      Paul Cunningham

      I just use telnet from the server that I’m trying to allow relay from.

  6. David

    Great tips!

  7. Carlos

    I managed to send mails to myself, from bill gates and
    My problem comes when I get into the message tracking center and try to find those mails, and cant find any

    I suposed the smpt server that is relying all those mails should be capable of logging that activity

    What im missing?

  8. Lukman

    Hello paul,
    Kindly assist with the below error (550 5.7.1 Unable to relay) am running exch 2010 in win2008r2 ,i can send and recive mail to some domain .

    220 Microsoft ESMTP MAIL Service ready at Tue, 21 May
    2013 10:22:03 +0100
    250 Hello []
    mail from:
    250 2.1.0 Sender OK
    rcpt to:
    550 5.7.1 Unable to relay
    451 4.7.0 Timeout waiting for client input

    Best Regards
    Connection to host lost.


  9. Kernel

    How to make send email telnet with vairous several recipients?

    1. Carlos

      Just keep adding the command RCPT TO:
      as many times and as form as many recipients you need
      then continue qith DATA and so on

  10. Daniel

    Good tip. This is something every sysadmin should know. I still remember being shown this as a junior sysadmin. How useful it has been since!

    To install the Telnet Client on W7 or Vista, you could also run the following command from an elevated command prompt:
    start /w ocsetup TelnetClient

Leave a Reply