How to Use Telnet to Test SMTP Connectivity on Port 25

How to Use Telnet to Test SMTP Connectivity on Port 25

Telnet is a networking tool that allows you to test connectivity with services on other servers. By using it on port 25, you can verify whether your server is communicating correctly with an SMTP mail server, which is essential for diagnosing email delivery issues.

Prerequisite

Make sure Telnet is installed on your server. If it is not, you can install it with the following command:

  1. yum install telnet -y

 

1. Basic SMTP Connectivity Test

To verify whether your server can communicate with a destination mail server on port 25, open the terminal and run the following command, replacing DESTINATION_SERVER with the hostname or IP of the mail server you want to test:

  1. telnet DESTINATION_SERVER 25

For example, to test connectivity with Gmail's mail server:

  1. telnet gmail-smtp-in.l.google.com 25

If the connection is successful, you will see a response similar to this:

  1. Trying 142.250.xxx.xx...
  2. Connected to gmail-smtp-in.l.google.com.
  3. 220 mx.google.com ESMTP ready

The 220 code indicates that the SMTP server is responding correctly. If instead the connection hangs or you receive a "Connection refused" error, it means that port 25 is blocked or the destination server is unreachable.

To close the Telnet session, type:

  1. quit

 

2. Specify an Outgoing IP Address

If your server has multiple IP addresses and you need to control which IP the connection is made from, you can use the -b option. Replace OUTGOING_IP with the IP you want to connect from and DESTINATION_SERVER with the mail server:

  1. telnet -b OUTGOING_IP DESTINATION_SERVER 25

For example:

  1. telnet -b 192.168.1.100 gmail-smtp-in.l.google.com 25

This is especially useful when you need to verify whether a specific IP on your server has port 25 open or if it is being blocked by a blacklist.

3. Interpreting the Results

  • 220 Response: The connection was successful and the SMTP server is ready to receive commands.
  • Connection refused: The destination server rejected the connection. The port may be closed or the mail service may not be running.
  • Connection timed out: The connection could not be established. A firewall is likely blocking port 25.
  • 421 or 550 Response: The server responded but rejected the connection, usually due to security restrictions or because your IP is on a blacklist.
Alert
Telnet does not encrypt the connection, so any information sent or received during the session could be intercepted by third parties. Use this tool only for diagnostic purposes and never send real credentials through it.

 

Telnet is a quick and simple way to verify whether your server can communicate with other mail servers on port 25. It is one of the first tools you should use when diagnosing email delivery issues.

If you have any questions, we are available to help you through our chat system.


    • Related Articles

    • How to Install cPanel on Your Server or VPS: Updated Guide by Distribution

      cPanel & WHM is the most widely used control panel in the web hosting industry. If you have a dedicated server or VPS with Webzi (or any other provider), this guide shows you how to install cPanel from scratch on the currently supported operating ...
    • JetBackup 5: How to fix the Integrity Check error using CLI/SSH

      When JetBackup performs its automated integrity verification processes, they may sometimes complete partially due to network interruptions, timeouts, or communication issues with the remote storage destination. If you receive notifications indicating ...
    • Emails don't appear in webmail searches

      When you search for an email in Roundcube (cPanel) and it doesn't appear in the results even though it exists in your mailbox, the problem almost always stems from the server not having properly indexed the messages. For example, if you try to locate ...
    • How to install and configure Nginx as a reverse proxy in cPanel/WHM 🚀

      What is Nginx and why use it with cPanel? Nginx is a high-performance web server that can function as a reverse proxy in front of Apache on cPanel servers. This configuration allows Nginx to handle static files (images, CSS, JavaScript) while Apache ...
    • How to Manually Move a cPanel Account to Another Partition

      cPanel includes a native feature called rearrange that allows moving accounts between partitions from WHM. However, this process requires enough free space on the source partition to create a temporary copy, and when the partition is nearly full, the ...