Press "Enter" to skip to content

How to change the default Postfix port

Do you want to change the default Postfix port?

Here’s are the easy step-by-step how to change the default Postfix port:

Step 1: Edit the file /etc/postfix/master.cf and find the line below. You can comment the line below by adding # in front of the line to disable SMTP port 25.

smtp inet n - n - - smtpd

Next, add this line

25000 inet n - n - - smtpd

Replace 25000 with your preferred alternate port number.

Step 2: Restart the Postfix service or the MailScanner service if you have integrated MailScanner into Postfix.

Step 3: If you have enabled the firewall, you need to configure the firewall to allow traffic on the new port number.

Step 4: Test Postfix by connecting on the new port number.  Use the terminal command telnet localhost [port] instead of telnet localhost smtp to test your new port number.