How To Run Postfix On A Different Port

In this tutorial I’m going to demonstrate how to run the Postfix Email Server on an alternative port. By default Postfix runs on port 25 but many ISPs restrict access to outgoing port 25 connections, making it impossible to connect to Postfix with an email client like Thunderbird or Outlook. I racked my brain trying to figure out why I couldn’t connect to Postfix with Thunderbird. Changing Postfix to run on TCP port 587 resolved the problem.

Start by opening up the Postfix file located under /etc/postfix/

At the top of the file make the following changes:

Changing the Postfix port in the file

Reload Postfix:

#postfix reload

Allow port 587 through the firewall if your system has one installed. On an Ubuntu system this can be done through UFW.


#ufw allow 587

Use Netstat to determine if the port is actually running and active:


netstat -tulpn | grep LISTEN

Leave a Comment