Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having a problem sending mail through sendmail. I have configured sendmail and it is fine. I telnetd the localhost and it connects but when i telnet port 25 is says telnet: Unable to connect to remote host: Connection refused. Also the smtp server uses port 25 so is there any way I can switch sendmail to listen to another port. I am using ubuntu. I don't have much experience with the mail server configurations so please help me out.


share|improve this question

migrated from Jan 19 '11 at 15:14

This question came from our site for professional and enthusiast programmers.

So you have both Sendmail and another SMTP server running? – Chris S Jan 19 '11 at 16:22
Thats exactly the way it is – usmanali Jan 20 '11 at 10:36

The site has a variety of documentation on configuring Sendmail. The cf/README file, in particular, discusses how to change the port on which Sendmail listens (look for DAEMON_OPTIONS).

share|improve this answer

The default server on Ubuntu is postfix which provides SMTP services. It should be able to be configured to listen on any or all of the standard ports SMTP(25), SSMTP(465), and Submission (587). The port used for any of these services should be reconfigurable. Configuration should be in /etc/ and or /etc/postfix.d. Check the configuration for a port string. man postfix.conf should give you documentation on the configuration.

The command aptitude install postfix-doc will install the postfix documentation package into /usr/share/doc/postfix.doc.

I use Exim4, which does allow the ports to be specified, instead of postfix. You should only have one SMTP package installed. The sendmail interface is provided by the Exim4, postfix, and sendmail packages.

Make sure you have an SMTP program running with the command netstat -lnt | grep :25. This should return at least one line.

Unless you have a static address configure your server to use your ISP's mail relay as a Smarthost. Your ISP may (should) be blocking outgoing connections to the Internet on port 25. This is done to deal with spambots which often run on virus infected PCs.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.