Home » Exchange Server » Email Fundamentals: How to Send Email via Telnet

Email Fundamentals: How to Send Email via Telnet

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.

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.

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.

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

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.

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

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

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

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.

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.

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.

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

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.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server


  1. Daniel says:

    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

  2. Lukman says:

    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 tmexcpro1.teasymobile.com Microsoft ESMTP MAIL Service ready at Tue, 21 May
    2013 10:22:03 +0100
    250 tmexcpro1.teasymobile.com Hello []
    mail from: labdulsalam@teasymobile.com
    250 2.1.0 Sender OK
    rcpt to: lokmanabdulsalam@yahoo.com
    550 5.7.1 Unable to relay
    451 4.7.0 Timeout waiting for client input

    Best Regards
    Connection to host lost.


  3. Carlos says:

    I managed to send mails to myself, from bill gates and asd@asd.com
    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?

  4. John Gordon says:

    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?

  5. Leonard says:

    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

Leave a Reply

Your email address will not be published. Required fields are marked *