How to check if SMTP is working from commandline (Linux)
The SMTP (Simple Mail Transfer Protocol) is an Internet standard for electronic mail (Email) transmission across Internet Protocol (IP) networks.
This tutorial shows how to connect to the SMTP mail server and send an Email using the ‘telnet’ command.
Step 1: Open a connection from your computer to an SMTP mail server
$ telnet smtp.domain.com 25 220 smtp.domain.com ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?
- smtp.domain.com – Your mail server;
- 25 – Default port for SMTP.
Step 2: Declare your domain name or IP-address
> HELO local.domain.name 250 smtp.domain.ext Hello local.domain.name [xxx.xxx.xxx.xxx], pleased to meet you
Step 3: Set sender’s email
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 a similar thing (the email address shown in an email client).
> MAIL FROM: email@example.com 250 2.1.0 firstname.lastname@example.org... Sender ok
Step 4: Set recipient’s email
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: email@example.com 250 2.1.5 firstname.lastname@example.org... Recipient ok
Step 5: To write the message, type DATA and press ‘Enter’
> DATA 354 Enter mail, end with "." on a line by itself
Step 6: On the first line type ‘SUBJECT: Your Subject’ and press ‘Enter’ twice
> SUBJECT: Test mail
Step 7: Continue typing your message
Hello, this is a TEST message, please don't reply. Thank you.
Step 8: Put a single period (.) on a line by itself and press ‘Enter’ to send your message.
> . 250 2.0.0 ???????? Message accepted for delivery
Step 9: Close the connection
> QUIT 221 2.0.0 server.com closing connection
Online Services for testing SMTP servers
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 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.
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.
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