How to check SMTP port 25 is open for email sending out
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.blog.alphagnu.com 25
use server.blog.alphagnu.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.blog.alphagnu.com 25 Trying 5.161.42.110... Connected to server.blog.alphagnu.com. Escape character is '^]'. 220 server.blog.alphagnu.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.blog.alphagnu.com... telnet: connect to address 5.161.42.110: 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.