I'm trying to use DKIM on a FreeBSD 10.3 box using "stock" sendmail. I followed this tutorial: https://www.dan.me.uk/blog/2016/06/01/add-dkim-signing-to-freebsd-servers and now DKIM "works" -- sometimes.

My mail server handles mail for "casano.com". The MX record points to "mail.casano.com", which is this server. Internal to the firewall, the server has hostname "dudley", so it's FQDN is "dudley.casano.com".

Depending on the MUA that is sending the email, the DKIM signature passes or fails.

Using Thunderbird from another machine on my LAN (in TrustedHosts), DKIM signature passes.

Email sent from the command line of the server using "Mail", DKIM signature fails ("bad signature"). Email send from the mailman mail list program running on the server also fails DKIM checks.

Sometimes the emails have "dudley.casano.com" in various fields (like Message-Id, etc), sometimes "mail.casano.com", and sometimes, "casano.com".

I have generated key pairs for all three of "casano.com", "dudley.casano.com", and "mail.casano.com". The DKIM signature is always generated, but sometimes the key signature doesn't agree with what the DNS lookup returns.

My "selector" is "dudley-casano". If you wish to see the DNS, here:

dig -t txt 'dudley-casano._domainkey.casano.com'
dig -t txt 'dudley-casano._domainkey.mail.casano.com'
dig -t txt 'dudley-casano._domainkey.dudley.casano.com'

How do I get the various "identities" of my server to work with DKIM? I can rename the machine to "mail" and that will get rid of "dudley.casano.com", but still won't solve the problem, since I'll still have the "mail.casano.com"/"casano.com" dichotomy.

I have


set in my sendmail.mc, and


does not appear to fix the problem.


Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.