Recently I ran into an email delivery problem, and the only error I could find was in the exim_mainlog and read “DKIM key retrieval failed”. This problem caused mail delivery to fail to all of the major email services (gmail, yahoo, hotmail) and many of the less major email services. The fix was pretty simple, but took far longer than it should have to figure out.

The full error looked a bit like this:
2014-10-19 21:53:48 1XJpTO-00077k-Gu **
R=dkim_lookuphost T=dkim_remote_smtp: SMTP error from remote mail server
after end of data: host []: 550 5.7.0
DKIM key retrieval failed

The problem was the ownership and permissions on the domain key’s file in the cPanel folder:


While this was a bit overkill, I decided to correct the permissions on all of the keys, rather than just the user in question. The error was immediately corrected with these commands:

chown root.mail /var/cpanel/domain_keys/private/*
chmod 644 /var/cpanel/domain_keys/private/*