I've set up my postfix server according to this tutorial: Email with Postfix, Dovecot, and MySQL

However, I'm getting connection a refused error.

The mail queue says mail is coming in, but it is not getting delivered. Mail Queue

The mail logs are similarly uninformative.

Output of /var/log/mail.log:

Mar 18 14:08:03 magico postfix/qmgr[690]: 8F0E843441: from=<dxxxxxxxx@hotmail.com>, size=6139, nrcpt=1 (queue active)
Mar 18 14:08:03 magico postfix/lmtp[3435]: 8F0E843441: to=<davec@xxxxxxxxt.co.za>, relay=none, delay=1007, delays=1007/0.02/0/0, dsn=4.4.1, status=deferred (connect to dwgfinder.com[private/dovecot-lmtp]: Connection refused)

I suspect that there may be an issue with my /etc/hosts

If I ping my mail server address it returns a defunct servername:

PING mail.xxxxxxxoap.co.za (xxx.xxx.xxx.xxx) 56(84) bytes of data.
64 bytes from xxxxxxoodrc.co.uk (xxx.xxx.xxx.xxx): icmp_seq=1 ttl=56 time=215 ms

(from when I first leased the VPS).

My /etc/hosts has the following:       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters mail.xxxxxxxxxxxxt.co.za mail.xxxxxxxxxxxxoap.co.za

xxx.xxx.xxx.xxx    xxxxxxxxxxxxxr.com
# Auto-generated hostname. Please do not remove this comment.
xxx.xxx.xxx.xxx gico

Hopefully somebody has some suggestions on what to do to make my mail server run correctly!

  • The mail log is quite informative. "connection refused" can mean that a firewall on or around dwgfinder.com actively rejects connection requests, or that there is no listener at the smtp port. I don't know whether the outdated domain name is related to this; it seems not. – berndbausch Mar 19 at 9:24
  • Yes, that's why I felt it was uninformative. There are any number of reasons for the failure and simply saying 'connection refused' doesn't really narrow it down. – Dave Coventry Mar 19 at 10:20
  • Postfix doesn't have any more information. It sends a connection request, and receives an ICMP packet saying that connection is refused. There is no way Postfix can tell you why the other side doesn't want it to connect. You have to work with the other side to figure this out. – berndbausch Mar 19 at 12:26
  • Fair enough. I was just making the point that it didn't provide much information. In this case, however, it might have been useful if it indicated that the connection referred to was the connection to the delivery agent rather than a port or firewall issue. – Dave Coventry Mar 19 at 14:10

As should have been obvious from the fact that the emails were sitting in the Postfix queue, Postfix was accepting the emails alright, but Dovecot was refusing the connection and not delivering to the recipients.


service lmtp {
  unix_listener lmtp {
    user = postfix
    group = postfix
    mode = 0666


service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0666
    user = postfix

in /etc/dovecot/conf.d/10-master.conf seems to have sorted it out.

So it had nothing to do with the /etc/hosts configuration after all!

Sorry if I've sent anyone on a wild goose chase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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