DKIM works by assigning a cryptographic signature to your outbound messages, this signature contains a private key that is matched against the public key that exists in your domain’s DNS by the receiving MTA. This helps authenticate the sending source of the messages. In order to setup DKIM for Mailgun using your custom domain, follow these steps:

In order to configure DKIM for Mailgun, you need to verify your custom domain.

1. Login to your Mailgun account

2. Go to the Domains tab 

3. Add your domain in the Domain name box

4. On the domain settings page, you will find the DKIM records generated for your domain in the Domain Verification & DNS section 

5. Copy the DKIM record key value provided.

Publish the Mailgun DKIM key in the Valimail Enforce platform

1. Go to your domain's Configuration page in Valimail Enforce and publish the newly created DKIM key.

     a. Click on Add a DKIM key and fill in the info from the newly created Mailgun key and then click Add.

Log back into your Mailgun account, and check for a verified status (a green verification badge) against your domain name to confirm that your domain has been verified and set up with DKIM email authentication.

Once verified, you will be able to send properly authenticated emails with Mailgun on behalf of your domain.