Getting error: Milter (opendkim): error connecting to filter: Connection refused by localhost

Posted December 18, 2016 8.3k views
EmailUbuntu 16.04

I’ve Ubuntu 16.04
I’m trying to config DKIM for sendmail.
Getting this error when email is sending:
sm-mta[19671]: uBILBoWg019671: Milter (opendkim): error connecting to filter: Connection refused by localhost

I’ve added port 12301 to firewall.
Also in /etc/opendkim.conf I’ve added:
Socket inet:12301@localhost

And also in /etc/default/opendkim:

And in /etc/mail/ at the end:
INPUTMAILFILTER(‘opendkim’, ’S=inet:12301@localhost’)

Any help?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Is it running?

  • I see this

    systemctl status opendkim.service
    ● opendkim.service - DomainKeys Identified Mail (DKIM) Milter
       Loaded: loaded (/lib/systemd/system/opendkim.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2016-12-18 21:50:29 UTC; 16s ago
         Docs: man:opendkim(8)
      Process: 20153 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/ -p $SOCKET $DAEMON_OPTS (c
      Process: 20146 ExecStartPre=/bin/chown opendkim.opendkim /var/run/opendkim (code=exited, status=0/SUCCESS)
      Process: 20141 ExecStartPre=/bin/mkdir -p /var/run/opendkim (code=exited, status=0/SUCCESS)
     Main PID: 18324 (code=exited, status=0/SUCCESS)