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. 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:
For example, to test connectivity with Gmail's mail server:
If the connection is successful, you will see a response similar to this:
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:
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:
For example:
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
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.