Due to a very large volume of junk email being produced today, most ISPs now block port 25. By default, your server may use port 25 to send mail; as a result, you could find that your email is being blocked. After completing the operations below, don't forget to restart your mail server!
Exim
If you have WHM/cPanel, you can simply go into Service Manager and change the port there. Be sure to enable 'Exim on Another Port'.
Otherwise, modify the following file, using your favourite text editor:
/etc/exim.conf
You will need to add these lines, replacing 26 by 587 if desired:
daemon_smtp_ports = 26
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message
Postfix
You will need to edit the following file:
/etc/postfix/master.cf
Add a line to the file in the following format:
<port> inet n - - - - smtpd
Replace <port> with the appropriate port number, for example:
26 inet n - - - - smtpd
QMail
You will need to modify the following file:
/etc/services
Add the following line, replacing the <port> with the actual port:
smtp_alt <port>/tcp # new SMTP port
If you are running xinetd as a super-server, you will need to follow these extra instructions:
First, make a backup copy of smtp_psa by using this command:
cp /etc/xinetd.d/smtp_psa /root/smtp_psa.backup
Everything located in /etc/xinet.d/ is loaded as xinet services.
Next, edit the file /etc/xinetd.d/smtp_psa and add the following line:
service smtp_alt
Then restart xinetd using the following command:
/tc/init.d/xinetd restart
If that does not work, you can use iptables to make the modification:
Change the IP in the following file:
/var/qmail/control/outgoingip
Then execute this command:
/sbin/iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 25 -j SNAT --to $(< /var/qmail/control/outgoingip) >> /etc/rc.local
Verify you are still able to send emails. If not, just remove this line from /etc/rc.local/
======================================================================