Skip to main content

Using Telnet to troubleshoot your mail system

Telnet is old school, but it's still a handy tool for troubleshooting email and other services.
Using telnet to troubleshoot email
"July 11, 2018" by osseous is licensed under CC BY 2.0

For this article, I use as the domain name for mail servers and email addresses. In addition, I use the standard ports of 25 for SMTP and 110 for POP3.

The first thing you’ll need to do is install Telnet if it is not already present. (Telnet is not automatically installed on all systems in favor of the more secure SSH protocol.) To install Telnet on a Red Hat Enterprise Linux-based system, type:

$ yum install telnet

Testing an SMTP mail server

Now that you have Telnet installed, you’re ready to start. Let’s first verify that your SMTP server is available by connecting to it via Telnet with the following command:

$ telnet 25

Once connected, you will receive a response similar to the following:

Telnetting into the email server.

Initiate the connection with the SMTP service by using the following command:


The response looks like this:

ehlo output

You are now ready to send an email. Start by telling the system what email address the mail is coming from:

mail from:

The system will then acknowledge that the information is in the correct syntax, in the same format used in the previous image.

The mail server's response to ehlo.

Next, tell the system the recipients’ email address or addresses with the following command:

rcpt to: 

The system acknowledges that the information is in the correct syntax, as follows:

The recipient's email address is valid.

Tell the system that you are beginning the body of your email by typing data as follows:


The system will respond with a single dot (.) on its own line, which ends the email headers:

Email headers complete.

Now, set the subject and write the email’s content. Then, tell the system to send the email by using the dot (.) as follows:

subject: test

Test that your email addresses are working properly.



The system then reports that the email was accepted for delivery:

Email accepted.

Exit the session by typing quit, which disconnects us as shown here:

Session closed.

Testing a POP mail server

Now, check the configuration of your POP3 service, which is provided by Dovecot. The first step is to connect to the server over POP3, which is served on port 110:

$ telnet 110

Once connected, you will receive a response similar to the following:

Connecting to the POP mail server.

Next, provide the information for the user account you’re accessing. In this case, verify that user1 received the email you just sent them:

user user1

You see that the username is correct with:

The user user1 received the email.

Next, use the following command to authenticate using the user’s password:

pass xxxxxxxx

If the user and password are correct, the authentication is confirmed as follows:

Userpass output


To check and see what mail is available, use the list command:



This command returns a list of all email for that user, and the size of that email, as shown below (it does not return any other information). 

The list command's results.

To read an email, we need to use the retr command, which is short for retrieve:

retr 1

In this case, you asked to retrieve email number one, which as you can see is the email you sent directly via SMTP through Telnet:

Reading an email.

As this was a test email, delete it from the system using the dele command, as follows:

dele 1

Here you can see that the system responds that the mail is marked as deleted:

Deleting the email.

Run the list command again. You can see that there is no longer any email:

The user now has no email.

As with the SMTP services, we can type quit to exit:

Disconnecting from the server.

Wrapping up

You can tell a lot by using Telnet to perform basic email server testing. Whether you’re using POP or SMTP, experiment with this process when things are going well so you can see when things go wrong.

Topics:   Networking   Linux  
Author’s photo

Amy Marrich

Amy Marrich is a Principal Technical Marketing Manager at Red Hat. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.