Setup Relay Host Port and SMTP Authentication Client in Postfix

This setup will help you to route all outgoing email through your ISP SMTP server using different port number and that SMTP server requires you to authenticate before relaying. For this scenario, the ISP SMTP server is Exim.
1. Edit this file /etc/postfix/main.cf and add relayhost to point to your ISP SMTP server with port number as below: –
relayhost = mail.example.com:2525
2. Add the next parameter to allow Postfix to authenticate before relaying outgoing email as below: –
smtp_sasl_auth_enable = yes
3. Add the following line below to map authentication information as below: –
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
4. Then, add the next parameter to force Postfix to use AUTH LOGIN as below: –
smtp_sasl_mechanism_filter = login
5. Create a file /etc/postfix/sasl_passwd and put the authentication information as below: –
mail.example.com [email protected]:password
6. Next, run the following command below to create the lookup table: –
postmap /etc/postfix/sasl_passwd
7. Then, restart your Postfix service as below: –
service postfix restart
7. Finally, you can monitor your maillog using the command below: –
tail -f /var/log/maillog
Note: The above was tested on Postfix 2.2.10-1 in CentOS