Change SMTP source IP address in sendmail
1. Edit sendmail.cf search for ClientPortOptions
2. Change
#O ClientPortOptions=Family=inet, Address=x.x.x.x
to
O ClientPortOptions=Family=inet, Address=
3. Restart sendmail
4. Verify by sending a mail and checking the full header
CLIENT_OPTIONS(`field1=value1,field2=value2,…’) in sendmail.mc file is equivalent to ClientPortOptions in the sendmail.cf file.
How to change SMTP port in postfix
The default SMTP port is 25. In Postfix we can change it to some other port (say 6000) using the following steps.
Open the file master.cf.
$ vi /etc/postfix/master.cf
Add the following line to the file.
6000 inet n - n - - smtpd
Restart postfix.
$ /etc/init.d/postfix restart
You can check the connection to the new port using telnet. Also make sure that the new port is not blocked in the server firewall.