Search code examples
sslopensslphpmailerdkim

Do I need an SSL installed to implement DKIM


I'm using open-dkim and phpmailer to sign my outgoing mail, I have my keys installed, and showing as valid, and the mail script is working, but I get one openSSL error that's holding up the process:

Warning: openssl_sign() [function.openssl-sign]: supplied key param cannot be coerced into a private key in /usr/share/php/class.phpmailer.php on line 2221

I know nothing of openssl, but my first thought was that this domain does not have an SSL installed, so maybe that's required with DKIM?? If so, is it as simple as installing the new SSL as usual, or do I have to relate the public/private keys to the SSL somehow?

Thanks

full script if needed:

<?

require_once("class.phpmailer.php");
$mailer = new PHPMailer();


$mailer->IsSMTP();
$mailer->Host = 'mail.domain.com';
$mailer->SMTPAuth = true;

$mailer->Username = 'info@domain.com';
$mailer->Password = 'pass';
$mailer->FromName = 'info@domain.com';
$mailer->From = 'info@domain.com';
$mailer->AddAddress('test@gmail.com','first last');
$mailer->Subject = 'Testing DKIM';

$mailer->DKIM_domain = 'domain.com';
$mailer->DKIM_private = 'private.txt';
$mailer->DKIM_selector = 'default'; //this effects what you put in your DNS record
$mailer->DKIM_passphrase = '';


$mailer->Body = 'this is just an email test';

if(!$mailer->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mailer->ErrorInfo;
exit;
} else {
echo "Message Sent!";   
}

?>

Solution

  • The answer was two parts:

    1) no, you do not apparently need a traditional SSL installed to use DKIM

    2) my error was due to copying my private key from an RTF document which added extra characters. I copied it into dreamweaver, stripped the extra characters, and I'm now receiving sign email from my server