Change Default SMTP Port In exim postfix

Change Default SMTP Port In exim postfix

SMTP uses port 25 as its default port. When you configure mail server on your server, port 25 is use to send mails. Sometimes ISP blocked the 25 port for junk mail protection as a result you are unable to send mails from your server.

Most the ISP suggests to change the Default SMTP port to 26 or 587. You can change the default SMTP port by modifying configuration file of your mail server. Also, DO NOT forget to open the new SMTP port in server firewall. If the port is not open, your mails will not delivered to anyone. Before making any modifications do not forget to take backup of the configuration file.

Below are the steps to change default SMTP port:

POSTFIX

Open the configuration file of postfix and make the following changes.

vi /etc/postfix/master.cf

and make the following changes:

#Comment default line as below.
#smtp inet n – n – – smtpd
#Add new line with port as you like as below.
26 inet n – n – – smtpd

After making adjustment in configuration file. Please do not forget to restart the mail server.

/etc/init.d/postfix restart

EXIM

Open the /etc/exim.conf make the following changes in your file.

vi /etc/exim.conf 

Add the following three line in the configuration file, if do not exist. Replace the smtp port with the one you want to change.

daemon_smtp_ports = 26
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message

Now save the file and restart the exim.

/etc/init.d/exim restart

Now open the port in firewall and start sending mails.