Linux > cPanel

Changing SMTP ports in Linux

(1/1)

joseletk:
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:


--- Code: ---    /etc/exim.conf
--- End code ---

You will need to add these lines, replacing 26 by 587 if desired:


--- Code: ---daemon_smtp_ports = 26
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message

--- End code ---

Postfix

You will need to edit the following file:


--- Code: ---/etc/postfix/master.cf
--- End code ---

Add a line to the file in the following format:


--- Code: ---<port> inet n - - - - smtpd
--- End code ---

Replace <port> with the appropriate port number, for example:


--- Code: ---26 inet n - - - - smtpd
--- End code ---

QMail

You will need to modify the following file:


--- Code: --- /etc/services
--- End code ---

Add the following line, replacing the <port> with the actual port:


--- Code: ---smtp_alt <port>/tcp # new SMTP port
--- End code ---

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:


--- Code: --- cp /etc/xinetd.d/smtp_psa /root/smtp_psa.backup
--- End code ---

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:


--- Code: ---service smtp_alt
--- End code ---

Then restart xinetd using the following command:


--- Code: ---/tc/init.d/xinetd restart
--- End code ---

If that does not work, you can use iptables to make the modification:

Change the IP in the following file:


--- Code: ---/var/qmail/control/outgoingip
--- End code ---

Then execute this command:


--- Code: ---/sbin/iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 25 -j SNAT --to $(< /var/qmail/control/outgoingip) >> /etc/rc.local
--- End code ---

Verify you are still able to send emails. If not, just remove this line from /etc/rc.local/


======================================================================

Navigation

[0] Message Index

Go to full version