How to Test SMTP Server from the Command Line via Telnet and in Online Tools

On July 26, 2016
4min read
Yevgen Tsvetukhin Product Manager @Mailtrap

To make sure you understand all the details of what we are about to discuss, let’s define what SMTP is and what can be tested with it.

SMTP (Simple Mail Transfer Protocol) is the methodology behind the email workflow on the Internet. People have probably been wondering how emails get to their destination. SMTP fully covers it, implementing something similar to the mechanism of delivering an actual letter in an envelope. The SMTP server, or just a computer running SMTP, stands for a mail carrier of the Internet. The messages are sent directly to this server, which consequently delivers mails to their receivers. Quite convenient, isn’t it?

Various things can be tested with simply telneting into a given SMTP server:

  • Is the server working?
  • Is it a firewall that blocks communication?
  • Does the mail server allow for relaying of a particular domain or an email address?
  • What SMTP commands does the mail server support?
  • How much time does it take for a server to response?
  • Does the server respond with the correct hostname?

How to test SMTP server with a manual telnet session?

First, a telnet client has to be verified for the installation on the server. Then, you should search for a mail server to log in to. We will need the DNS MX record for a given domain to proceed with it. You can use something similar to the following command:


nslookup -type=mx


nslookup -type=mx
Non-authoritative answer:

Non-authoritative answer:	mail exchanger = 10	mail exchanger = 10	mail exchanger = 1	mail exchanger = 5	mail exchanger = 5

For the IP we are going to use, we need the DNS PTR. For this, we should start with the IP address the Internet sees us as having. Sites like this can be a perfect solution in this case.

Once you figured out your IP address, run the following command, with T.T.T.T standing for the IP address.


nslookup -type=ptr T.T.T.T


nslookup -type=ptr A.B.C.D


Non-authoritative answer:	name =

We now have two basic requirements – the MX record for and the PTR for the IP we will use. At this point, you can log in to the SMTP server. Use the following command to do it:

telnet 25

It will display something similar to the following code:

Connected to (
Escape character is '^]'.
220 (PowerMTA(TM) v4.0) ESMTP service ready
The first command to issue to the mail server is going to be EHLO or HELO, which is a basic greeting that initiates the communication between the SMTP server and the telnet client.

Something similar to the following should be returned: says hello
250-SIZE 54525952
250 DSN

The MAIL FROM command is going to be the next to issue. This command defines the address to which bounces are delivered. The “From” header is not the similar thing (the email address shown in an email client).

250 2.1.0 MAIL ok

We can send the RCPT TO command now that we the MAIL FROM command was sent. RCPT TO command determines to whom the message should be sent. This is both similar to and different than the “TO” header.

250 2.1.5 <> ok
Before starting the body of the message, you should run the DATA command. This command “explains” that all the other content, aside from previous, is the body of the message, including the headers.
354 send message

Some of the mail servers, including, support PIPELINING. It means that the SMTP mail server will wait until the DATA command is issued before responding to any other commands after the EHLO command. Enter the MAIL FROM, RCPT TO, and DATA commands before waiting for a response in this case.

Try Mailtrap for Free

Online services for testing SMTP servers

For the beginning, you need to define the address of a SMTP server. You can use ns lookup command to do it or us some of the online services as

The SMTP check service will include several stages as following: checking your server DNS Black List status, verifying MX Records, relaying configurations, PTR Record, verifying the email address. We have got some online services that can help you examine the SMTP server:

Mailtap Email Sandbox

Allows you to do quick email testing in a safe environment that prevents staging emails from reaching actual recipients. Setting up your SMTP server to run tests will not take up hours, and DNS blacklist status can be checked in seconds.

Besides checking blacklist status, using the Sandbox, you can check your emails’ spam score and quickly validate HTML/CSS. Both features are available in all Mailtrap plans.

MX Toolbox

MX Toolbox is a free service that will perform simple tests of:

  • SMTP Reverse DNS Mismatch
  • SMTP Valid Hostname
  • SMTP Banner Check
  • SMTP Connection Time
  • SMTP Open Relay
  • SMTP Transaction Time

However, you are not allowed to define the port, enter password etc. The number of tests is also limited.


Wormly gives you a free trial to check your SMTP servers, but does not allow defining the port or password, a secure connection is also not available.


SMTPer is indeed the most convenient solution that allows defining the port, provides users with a secure connection and authorization. You also can fill out both sender and recipient forms.

Additional resources

Need help with email sending set up for your infrastructure? Find your guide here:

Article by Yevgen Tsvetukhin Product Manager @Mailtrap