RailsPlayground
How To Change Your SMTP Listening Port

This procedure is an answer to a common problem when an ISP blocks access to port 25 to IP address outside the ISP’s IP range. Often used to combat spam, it creates problems for users who have a need to use an SMTP server other then the one provided by the ISP.

This can only be performed by users with a VPS.

  1. First, SSH to your VPS and logon.
  2. edit /etc/services, and added the lines
    smtp2 26/tcp mail
    smtp2 26/udp mail
    

    I also recommend commenting the edited lines for anyone in the future that may need to reverse or
    change the SMTP ports again.
  3. copy /etc/xinetd.d/smtp_lxa to /etc/xinetd.d/smtp2_lxa
    cp /etc/xinetd.d/smtp_lxa /etc/xinetd.d/smtp2_lxa
    
  4. edit /etc/xinetd.d/smtp2_lxa and change the line
    “service smtp” to “service smtp2”
  5. Restart xinetd by using the following command:
    service xinetd restart
    

Verify that qmail is now listening on port 26 by either configuring your email client to send mail on port 26, or open a telnet session to your mail server, port 26, you should receive an ESMTP hello.