Emails not adding DKIM signature: Milter service - Connection refused [closed]

Solution 1:

So I have figured out the problem. On checking the error logs in /var/log/mail.log, I noticed multiple lines with the same error:

warning: connect to Milter service inet:localhost:8891: Connection refused

On googling this, I found numerous other people going through the same problem and finally came across a forum discussion about this issue (this is an issue with opendkim btw and not with virtualmin as I initially thought) and figured out that opendkim was not using the correct port (8891) and all I needed to do was:

  1. Un-comment the following line (remove the trailing #) from /etc/opendkim.conf:

Socket                  inet:8892@localhost

  1. On that same line, change 8892 to 8891:

Socket                  inet:8891@localhost
  1. Comment the following line (Add a trailing #) from /etc/opendkim.conf:

#Socket                 local:/var/run/opendkim/opendkim.sock

You can now simply restart opendkim by running the following command (Ubuntu):

service opendkim restart

And also restart apache by running the following command (Ubuntu):

service apache2 restart

And your outbound emails should start including the DKIM signature in your email header.