Changing postfix port

Spam is annoying. For years, ISPs have been doing everything they can to prevent (well, mitigate) spam. One way they do this is to block outgoing traffic on Port 25 (the default port for SMTP email). Unfortunately, when I set up Postfix, I used the default settings — because getting email to work was much tougher than I expected and I didn't want to make things any more interesting than I had to!

Change the Port

It turns out that changing the port in postfix is fairly trivial. I chose to disable the default port (25) and enable the secure port (465).

sudo vi /etc/postfix/master.cf

This is accomplished by commenting out the default port (the line starting with "smtp") and uncommenting the secure port (the line starting with "smtps").

#smtp     inet  n       -       -       -       -       smtpd
smtps     inet  n       -       -       -       -       smtpd
sudo /etc/init.d/postfix reload

Depending on the flavor of unix you are using, you may need to specify the port in your configuration statement:

#smtp   inet  n       -       -       -       -       smtpd
465     inet  n       -       -       -       -       smtpd