How to Perfom SMTP Test Command in Linux

SMTP (Simple Mail Transfer Protocol) is a protocol used for sending email messages between servers. SMTP is widely used by email clients and servers to send and receive email messages. SMTP testing is important to ensure that email servers are properly configured and functioning correctly. In this guide, we will show you how to perform an SMTP test command in Linux.

Step 1: Install telnet

The first step is to install telnet if it is not already installed on your Linux system. Telnet is a command-line tool used for connecting to remote servers using the Telnet protocol. To install telnet on Ubuntu/Debian, run the following command:

sudo apt-get install telnet

To install telnet on CentOS/Fedora, run the following command:

sudo yum install telnet

Step 2: Connect to SMTP server

To perform an SMTP test command, we need to connect to the SMTP server using telnet. To connect to the SMTP server, open a terminal and run the following command:

telnet mail.example.com 25

Replace “mail.example.com” with the hostname or IP address of the SMTP server. “25” is the default SMTP port.

See also  How to Check Concurrent user using Netstat Command on Linux Web Server

Step 3: Send a test email

Once you have connected to the SMTP server, you can send a test email by entering the following commands:

EHLO example.com
MAIL FROM: <you@example.com>
RCPT TO: <recipient@example.com>
DATA
Subject: Test email
Hello,
This is a test email.
.
QUIT

The first command “EHLO example.com” identifies the sending host and initiates the SMTP session. Replace “example.com” with your domain name.

The second command “MAIL FROM: ” specifies the sender’s email address.

The third command “RCPT TO: ” specifies the recipient’s email address.

The fourth command “DATA” initiates the data transfer for the message body.

See also  How to Resolve mount: mount point /cdrom does not exist

The fifth command is the actual message body. Replace the subject and message with your own.

The sixth command “.” indicates the end of the message body.

The seventh command “QUIT” terminates the SMTP session.

Step 4: Check the email inbox

After sending the test email, check the recipient’s email inbox to verify that the email was received. If the email was received, the SMTP test command was successful.

Commands Mentioned:

  • telnet – a command-line tool for connecting to remote servers using the Telnet protocol
See also  How to Restart Linux Network Service

Conclusion:

In this guide, we have shown you how to perform an SMTP test command in Linux. SMTP testing is important to ensure that email servers are properly configured and functioning correctly. Remember to replace “mail.example.com”, “you@example.com”, and “recipient@example.com” with the actual values in the commands.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *