How I installed and confugured phpList to use DKIM

Version 3 Solutions you have discovered or come across should go here. Questions should go in the other three Version 3 forums, thank you.
Forum rules
Please do not ask questions here, this is for Version 3 Solutions you have discovered or come across.

How I installed and confugured phpList to use DKIM

Postby landrew » 11:39pm, Sun 18 Jan, 2015

I wanted to use DKIM with phpList but could not find one 'complete' posting on how to get it done. So, after doing a lot of research and testing, I have it working.

You will need to set up your host for outbound DKIM (for sending mail). There are several posts that say to have it set up in cPanel. That's OK, but this post is for those who want to set up DKIM themselves.

1. Go to http://phpmailer.worxware.com/ and chose the menu item 'Resources ==> Create DKIM Keys'. Follow the instructions and download the zip file with the credentials.

2. Place the two key files (.htkeypublic and .htkeyprivate) outside of the www (html_public) directory. If that is not possible, place them in a separate directory (i.e. /admin/DKIM).

3. Place the security code provided in the 'PHPMailer_code_plus_instructions.txt' file into your .htaccess file.

4. Create the DNS TXT record as provided in the download. You can do this in cPanel.
Note: I also created the selector record '_domainkey.mydomain.com.' '14400' 'TXT' 't=n; o=~;' as Hotmail seems to look for it. You should set t=y (test=Yes) until you are ready for production (leave off the single quotes as they are for clarity in this posting).

5. Edit 'sendmaillib.php in the admin directory of phpList. Place the following code after
Code: Select all
$mail = new PHPlistMailer($messageid,$destinationemail);

which can be found around line 750.

Code: Select all
  if (defined('USE_DKIM') && USE_DKIM == true) {
  //ADD DKIM - PHPMailer will automatically process this.
   $mail->DKIM_domain = DKIM_DOMAIN;
   $mail->DKIM_private = DKIM_PRIVATE_KEY;
   $mail->DKIM_selector = DKIM_SELECTOR;
   $mail->DKIM_passphrase = DKIM_PASSPHRASE;
   $mail->DKIM_identity = DKIM_IDENTITY;
  }


6. To use DKIM you must also use SMTP for sending your mail. Edit config.php, adding the following:
Code: Select all
define("PHPMAILERHOST",'your.smtp.host');
$phpmailer_smtpuser = 'email.address@yourdomain.com';
$phpmailer_smtppassword = 'your-password';
define('PHPMAILERPORT',465); //(25 or 587 may also work).
define("PHPMAILER_SECURE",'ssl'); //('ttl' may also work).


Note: make sure 'define("PHPMAILERHOST",'');' is commented (or better yet, deleted) at line ~35.

7. Edit config.php, adding the following:
Code: Select all
//DKIM SETTINGS
//Read in sendmaillib.php ~line 750
define('USE_DKIM', true);
define('DKIM_DOMAIN', 'yourdomain.com');
define('DKIM_PRIVATE_KEY', '/home/yourdomain/DKIM/.htkeyprivate');
define('DKIM_SELECTOR', 'phpmailer');
define('DKIM_PASSPHRASE', 'passphrase in download');
define('DKIM_IDENTITY', 'email.address@yourdomain.com');


Note: Use the values provided in the download. The private key location will be based on the path to your file.

Using these steps you should be able to get DKIM working with phpList. To test, send a test mail to an address at a host that checks inbound DKIM (Yahoo, Hotmail, Gmail, etc.). Look at the headers. You should see a line 'Authentication-Results' which should state 'dkim=pass header.i=@yourdomain.com'

You should also set up SPF and PTR records in your DNS. This is an important tool in having your mail accepted (not discussed here but a Google search has all you need).

I hope this helps someone looking for all the steps needed to integrate DKIM with phpList. This was tested in phpList v3.0.10 and v3.0.11.
landrew
phpList newbie
 
Posts: 1
Joined: 10:34pm, Sun 18 Jan, 2015

Return to Answers, HowTos, Tips and Tricks

Who is online

Users browsing this forum: No registered users and 1 guest