In this tutorial we’ll check if SMTP port 25 is open for email sending out via Telnet on your Linux machine. Today most of the cloud provider disable the SMTP port 25 to prevent spamming issues. Remember Port 25 is needed to send emails out if it is closed you can’t send email out of the server via any ports despite it is open for you.
Here are the steps to check the SMTP port:
Open the Terminal or ssh on your server.
Type the following command to install telnet if it’s not already installed:
For centos/EL :-
yum install telnet
or for ubuntu/debian :-
apt install telnet
Type the following command and press Enter:
telnet server.uxlinux.com 25
use server.uxlinux.com hostname for better results or replace it with remote server ip or hostname
If the port is open, you will see a message like this:
[root@server]# telnet server.uxlinux.com 25 Trying 126.96.36.199... Connected to server.uxlinux.com. Escape character is '^]'. 220 server.uxlinux.com
This means that the SMTP port 25 is open and you can send emails.
If the port is closed or you cannot connect to the SMTP server, you will see an error message like this:
Trying server.uxlinux.com... telnet: connect to address 188.8.131.52: Connection refused telnet: Unable to connect to remote host
This means that the SMTP port 25 is closed or there is a network restriction and preventing the connection.
If the port is closed, you may need to check your firewall settings or contact your network administrator to troubleshoot the problem.