Trouble signing outbound emails with DKIM

It seems very simple to get DKIM working with phpmailer.

  1. First create a new keypair. For testing purposes (not recommended for production), you can make one online at:
    http://dkimcore.org/tools/

For production, I’d recommend either a CLI tool like opendkim to create and manage keypairs or use openssl to create new keypair.
Note where you put your private key file.

  1. Then make a new TXT entry in your DNS provider that publishes your public key. I had to have it all in one line for it to work, but you should also be able to do it in two lines, if your DNS provider doesn’t allow lines of that length. See here e.g.: https://support.google.com/a/answer/173535?hl=en&ref_topic=2752442.
    splitting it up in 4 lines as indicated in dkimcore.org/tools did not work for me.

  2. Set up DKIM in SuiteCRM:

I simply opened the file:
/include/phpmailer/class.phpmailer.php

and inserted my details in these four lines
public $DKIM_selector = ‘((selector))’; // unique selector for this dkim key
public $DKIM_identity = ‘((news@domain.ch))’; // email address I’m sending mails from out of suitecrm
public $DKIM_domain = ‘((domain.ch))’; // domain that emails are sent from
public $DKIM_private = ‘/etc/opendkim/dkimkeyfile.key’; // file location to private key (text file)

As soon as this file was saved any new mails sent from localhost were signed with dkim.

!! important:
Make sure to keep your dkim private key outside of /var/www/… You don’t want or need www-data access to this file.

  1. Test your settings: use an email address at gmail.com to test your setup. send emails from suitecrm to your gmail address and you should see “signed by” or “dkim: pass”.
    https://support.google.com/a/answer/180707?co=GENIE.Platform%3DDesktop&hl=en&oco=0
2 Likes