Following on from the previous post Exim4 & DKIM I ran into a problem with no DKIM signature being added to outgoing mail. As I had this working when sending emails directly I figure it has to do with the smarthost config in Exim4.

Turns out the problem is that there is no DKIM config in the smarthosts config section.

The section we’re looking for is remote_smtp_smarthost: which if you search for in the exim4.conf.template file shows as being within transport/30_exim4-config_remote_smtp_smarthost, so the corresponding separate config file would be under conf.d/transport.

I then set about coying the DKIM related parts from the smtp_remote: section into the remote_smtp_smarthost: section:

dkim_domain = DKIM_DOMAIN
dkim_selector = DKIM_SELECTOR
dkim_private_key = DKIM_PRIVATE_KEY
dkim_canon = DKIM_CANON
dkim_strict = DKIM_STRICT
dkim_sign_headers = DKIM_SIGN_HEADERS

As I was correcting this I decided to go back to putting the DKIM variables back into the /etc/exim4/conf.d/main/00_local_macros file or section at the top of the /etc/exim4/exim4.conf.template file.

After updating the config and restarting the service sent messages then started getting a DKIM signature header.