When your service provider has blocked port 25, you may need to change it to 587 from your mail server. Port 25 generates security vulnerabilities during mail sending if it does not perform any authentication process. That is why service providers allow sending mail by authenticating over port 587. If you are using Postfix as the mail server, you can fix the problem by following the steps below.
Changing the default SMTP port for Postfix
Step 1: Open master.cf via nano
Open the Postfix configuration file which is located under /etc/postfix/master.cf.

Step 2: Activate SMTP
Activate SMTP by removing the ” # ” sign in front of smtpd from the configuration file and exit the file by saving it.

Step 3: Restart Postfix
systemctl restart postfix

Once you restart the postfix, you successfully change the port on Postfix with 587; your mail server is now secure.