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

OS: Ubuntu 10.04 Program: Sendmail

I disabled daemon by setting daemon_mode = "None", queue_mode = "Daemon" in the sendmail.conf, updated the conf and restarted sendmail.

However, after that whenever I tried to send emails, I got a stat=Deferred: Connection refused by [] from the mail.log.

If I turn on the daemon again by setting it daemon_mode = "Daemon" then everything works fine. Plus, if I turn back on the daemon and try to send an email, all the previously deferred emails that's refused for the above reason are all sent successfully along the new email.

Does anyone know what is going wrong here? What I want is I want the daemon to stop listening for incoming email but leave the queue to clean up unsent messages.

share|improve this question
I haven't used sendmail in 10 years but I'm sure that there's a setting somewhere to tell it to only listen on for local users to send outgoing email but not allow connections on other IPs where someone can send you email. – DerfK Aug 16 '12 at 22:53
@DerfK Thanks for the reply, and I thought of the same. I'm just struggling to find that option somewhere... – Xavier_Ex Aug 17 '12 at 16:03
up vote 1 down vote accepted

In your /etc/mail/ change the DAEMON_OPTIONS to look like this:

DAEMON_OPTIONS(`Name=MTA, Addr=, Port=smtp')dnl
DAEMON_OPTIONS(`Name=MSP, Addr=, Port=submission')dnl

Then run sudo sendmailconfig and you are set.

share|improve this answer
Thanks but I already turned off the daemon, why would adjusting daemon options affect anything? – Xavier_Ex Aug 17 '12 at 16:02
@Xavier_Ex The above instructions configure sendmail to listen only on localhost. After setting this you would re-enable the daemon. – voretaq7 Aug 17 '12 at 16:10
@voretag7 I see, so this is to let Daemon run but listens to local machine only rather than listening to incoming emails from outside? – Xavier_Ex Aug 17 '12 at 16:18
Yes. This way any email that gets generated locally but has to exit the host for some reason (e.g. to get forwarded to another address) will not stuck in the queue. – adamo Aug 17 '12 at 16:50
Thanks guys this is actually neater than the solution that I cranked up. I'll accept this one. – Xavier_Ex Aug 17 '12 at 19:40

I believe I have solved the issue. I think the problem might be that if the daemon is turned on, then sendmail will rely on the daemon to send out emails. If the daemon is turned off then sendmail is sending the emails by another mean, which I don't exactly know (please share your knowledge if you know of the mechanism :P).

Anyway, the trick is that I had the mail host of the daemon set up fine, but not for that "another mean". I found this article which was really helpful. If anyone is having the same issue, one can look at the section "Dealing with Sendmail v8.12". Apparently I should generate a with some specific settings, but I didn't want to mess up my other settings in my existing so I just hacked it and directly modified the cf file.

I found the line:


And changed it to:


Where $mailhost is my actual mail host used to send out emails, in my case it's a google server. After the modification sendmail has to be restarted for the change to take effect. NOTE: running sendmailconfig or update_conf or any other means that updates the conf files for sendmail will discard the change, as it is not written into any .mc file, but a direct modification on the cf file!

I hope my experience will be helpful for someone else :)

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.