Testing SMTP using Telnet

As an IT admin, you might find yourself in a situation where you need to test sending emails without an email client such as Microsoft Outlook. When that time comes, a great way to test SMTP connectivity is leveraging TELNET.

Here are a few easy steps to test mail flow:

  1. Make sure you know what SMTP server you are trying to connect to e.g. smtp.example.net.au or if it’s an internal mail server you can use the FQDN or IP address e.g. MAILSERVER.local or
  2. Make sure you have telnet installed on your client machine, you can do this via the following technet article
  3. Open up command prompt on your machine, click on start > run and type in cmd.
  4. In the command prompt window, type: telnet servername/IP 25 and press enter.
    Note: telnet initiates a telnet connection, the server name is the mail server you are attempting to send mail from and 25 is the default SMTP port.
  5. Now type in the following to test mail flow:
    Note: after each step press enter
  • HELO mail server domain name e.g. HELO example.com
  • MAIL FROM:user@domain.com e.g. MAIL FROM:user@example.com
  • RCPT TO:user@externaldomain.com e.g. RCPT TO:user@gmail.com
  • DATA
  • Type in some test data, this will be the body of the email e.g. Hello Sir 🙂
  • To stop typing in text in the body, you need to press Enter followed by a full stop . the press Enter again.
  • QUIT to exit the telnet session
If your email comes through then you’re a winner, if not don’t stress, there will most likely be other restrictions in place to prevent you from sending emails from SMTP servers. Please note that this is the first point of mail flow testing and further troubleshooting may be required.
This is also a good way of finding out if the host you are connecting to is actually a mail server! Unless of course SMTP is on another port or firewall rules are in place.

Leave a Reply

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