Posted: May 14th, 2016
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.
KEKhost/KEKhosting recommends the use of port 26 or 587 for your mail server ports. Please remember that you will also need to open the ports in your firewall to make these ports available.
You will need to modify your configuration files from the command line. If you do not know how to do so, please consult the SSH or Command Line articles in this Knowledge Base. Please note that Linux has a number of different mail servers. Please be sure of which mail server you have installed.
These instructions are for Linux only. 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/
Note: the IP must be configured on your server.
Note: Qmail is a bit outdated and can be quite difficult to manage. Please note that under Plesk, it is not supported by iWeb to change the outgoing IP.