Site icon Mailtrap

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

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:

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:

Windows:

nslookup -type=mx mailtrap.io

Linux:

nslookup -type=mx mailtrap.io
Non-authoritative answer:
Server:		192.168.0.1
Address:	192.168.0.1#53

Non-authoritative answer:
mailtrap.io	mail exchanger = 10 aspmx2.googlemail.com.
mailtrap.io	mail exchanger = 10 aspmx3.googlemail.com.
mailtrap.io	mail exchanger = 1 aspmx.l.google.com.
mailtrap.io	mail exchanger = 5 alt1.aspmx.l.google.com.
mailtrap.io	mail exchanger = 5 alt2.aspmx.l.google.com.

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 http://whatismyipaddress.com/ 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.

Windows:

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

Linux:

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

Server:		192.168.0.1
Address:	192.168.0.1#53

Non-authoritative answer:
212.235.118.46.in-addr.arpa	name = SOL-FTTB.212.235.118.46.sovam.net.ua.

We now have two basic requirements – the MX record for railsware.com 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 mail.railsware.com 25

It will display something similar to the following code:

Trying 45.55.56.249...
Connected to mail.railsware.com (45.55.56.249).
Escape character is '^]'.
220 mail.railsware.com (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.
EHLO server.example.com

Something similar to the following should be returned:

250-mail.railsware.com says hello
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250-8BITMIME
250-XACK
250-XMRG
250-SIZE 54525952
250-VERP
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).

MAIL FROM: <test@railsware.com>
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.

RCPT TO: <test@railsware.com>
250 2.1.5 <test@railsware.com> 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.
DATA
354 send message

Some of the mail servers, including mail.rsilsware.com, 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 https://mxtoolbox.com/SuperTool.aspx?action=mx#.

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

https://mailtrap.io/fake-smtp-server/

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

https://mxtoolbox.com/diagnostic.aspx

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

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

Wormly

https://www.wormly.com/test_smtp_server

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

http://smtper.nanogenesis.fr/

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.

test-smtp.com

http://www.test-smtp.com/

Test SMTP simply sends requests to SMTP servers to perform Relaying tests. This service does not have a sufficient toolkit for a proper SMTP examination.

testsmtp.tcsoftware.net

http://testsmtp.tcsoftware.net/

Check SMTP works for certain parts of a process but isn’t enough for a proper examination. Does not provide a secure connection.

Check SMTP will run the following tests:

Additional resources

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

Exit mobile version