How to test the SMTP Server

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. SMPT 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 SMPT, 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 SMPT server:

  • is 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 with a manual telnet session?

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

nslookup -type=mx plegma.host

Linux:

nslookup -type=mx plegma.host
Non-authoritative answer:
Server:		192.168.0.1
Address:	192.168.0.1#53
Non-authoritative answer:
plegma.host	mail exchanger = 10 aspmx2.googlemail.com.
plegma.host	mail exchanger = 10 aspmx3.googlemail.com.
plegma.host	mail exchanger = 1 aspmx.l.google.com.
plegma.host	mail exchanger = 5 alt1.aspmx.l.google.com.
plegma.host	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 plegma.host 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.plegma.host 25

It will display something similar to the following code:

Trying 45.55.56.249...
Connected to mail.plegma.host (45.55.56.249).
Escape character is '^]'.
220 mail.plegma.host (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.plegma.host 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@plegma.host>
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@plegma.host>
250 2.1.5 <test@plegma.host> 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.

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:

MX Toolbox

https://mxtoolbox.com/diagnostic.aspx
MX Toolbox is a free service that will perform simple tests of:

  • SMTP Reverse DNS Mismatch
  • SMTP Valid Hostname
  • SMTP Banner Check
  • SMTP TLS
  • 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

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:

  • Check your server DNS Black List status
  • Verify MX Records
  • Relay Configuration
  • PTR Record (Reverse Lookup)
  • Verify Email Address