What Do I Need?
- A Dedicated or VPS Linux Server
What is SMTP?
SMTP is a simple mail transfer protocol that’s a communication protocol for email transmission. It’s an internet standard that was defined in 1982 by RFC 821. User-level email clients use SMTP only for sending messages to a mail server for relaying and most commonly submitting outgoing emails to the mail server on port 587 or 465 as per RFC 8314.
- Server Setup
- A good tool to use is telnet for getting this done and getting it done right. If no hostname is included with the command it’ll revert to a command prompt.
- If you find that telnet is missing from your life then you’re going to need to get it installed and stat:
sudo apt-get install telnet
- You’ll also need ncat or nc. It’s a general-purpose command-line interface (CLI) tool used for port scanning, security, and monitoring. If ncat or nc isn’t installed, use the following command:
sudo apt-get install openssl
- Checking SMTP Connection using Telnet
- Telnet to the host that you want to check the connection of. SMTP servers usually communicate over SMTP ports 25, 2525, and 587. The Telnet SMTP test is one of the best ways to figure out your SMTP connection state:
telnet smtp.example.com 25 [2525 ¦ 587]
- Checking the SMTP Connection from Command Line Using Ncat or Nc
- Because ncat and nc have various functionalities, we’ll just check the connection using the following command:
nc -v -u smtp.example.com 587
- If the connection is successful you’d hope to see something like this:
- Should you have a problem connecting to the host, you’ll see something like this:
- All of the above steps are used to check the SMTP connection from the command line to a particular port of the host.
- Checking SMTP Connection over TLS using OpenSSL
- In order to set up a tls encrypted connection to an SMTP server, you’ll need the OpenSSL command:
openssl s_client -connect smtp.example.com:587 -starttls smtp
- You’ll see a lot of verbose data. If a connection is successfully established you’ll notice a 250 DSN end message:
- Consequently, once you’ve got 250 DSN you can now start your SMTP transaction using the following command:
EHLO “I am here”
There are a lot of things you can do next but personally, I’d recommend getting used to some of the free tools available for troubleshooting your email server. Using an SMTP check server will normally include several stages:
- checking your server DNS blacklist status
- verifying MX records
- relaying configurations
- ptr records
- Verifying the email address
You can use a lot of different free online-based applications for this stuff.
It includes simple tests for:
- SMTP Reverse DNS Mismatch
- SMTP Valid Hostname
- SMTP Banner Check
- SMTP TLS
- SMTP Connection Time
- SMTP Open Relay
- SMTP Transaction Time
However, you’ll find you’re not allowed to define ports or passwords and secure connections aren’t possible.
SMTPer is perhaps one of the most convenient solutions that allows the definition of a port and provides users with a secure connection and authorization.
Test SMTP simply sends requests to the SMTP server to perform relaying tests. This service doesn’t have any sufficient toolkit for proper SMTP examination, however.
Check SMTP works for certain parts of a process but know it isn’t enough for a proper examination. It doesn’t provide a secure connection. The following tests can be run:
- Check your server DNS Black List status
- Verify MX Records
- Relay Configuration
- PTR Record (Reverse Lookup)
- Verify Email Address
- Check the recommendations for the best VPS and get a suitable one.