This is a quick howto to enable you to relay all your Postfix mailtraffic to either your ISP’s SMTP gateway or to forward your outgoing mail to a corporate centralized gateway. This can even be done on a non standard SMTP port.
I’ve applied this configuration to an Ubuntu Server 10.04LTS.
1. Find and edit your /etc/postfix/main.cf
2. Search for the attribute ‘relayhost’
3. Add the desired server name to the relayhost:
relayhost = your.smtpserver.com
4. Restart your postfix daemon:
Make sure your relayhost accepts incoming mail from other servers (relaying is mostly prohibited)
When you would like to change the default (incoming) port number of your relay server add :<portnumber> after the hostname of the relayhost attribute within the postfix config:
relayhost = your.smtpserver.com:<yourport>
The above should do the trick!