Join Amazon Student FREE Two-Day Shipping for College Students!

Configure sendmail to use a different port for outgoing mail other than 25

Typically sendmail uses standard SMTP port 25 to relay mail. In most cases, this works fine as is, however, some ISPs block port 25. This makes it particularly difficult for sendmail to do its thing since it is supposed to work on port 25. In addition, opening port 25 could be risky.

What are the security risks of opening port 25?

Port 25 is used by the SMTP protocol to send mail. Some DDOS attacks seems to be targeted at port 25, email related. Under DDOS attacks, it will create huge number of connections to port 25 and causing too much traffic on the server.

Port 25 obviously needs to be open for us to receive legitimate email, so we can't block it. We can however change the default port 25 to other ports to reduce the risk of being attack.

To make sendmail listen on a different port:

1. edit /etc/mail/

Change Port=<portnumber> in the line DAEMON_OPTIONS.

2. Rebuild the

m4 /etc/mail/ > /etc/mail/

3. Restart sendmail.

For Debian:

/etc/rc.d/init.d/sendmail restart

For CentOS:

service sendmail restart

Leave a Reply

Your email address will not be published. Required fields are marked *


Your browser is out-of-date. Upgrade your browser today! Internet Explorer | FireFox | Chrome