Hong Manh's BlogHong Manh's Blog Sharing Technology Knowledge

How to Perform 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.

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: <you@example.com>” specifies the sender’s email address.</you@example.com>
  • The third command “RCPT TO: <recipient@example.com>” specifies the recipient’s email address.</recipient@example.com>
  • The fourth command “DATA” initiates the data transfer for the message body.
  • 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

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.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Press ESC to close

0
Would love your thoughts, please comment.x
()
x