What's the difference between DomainKey-Signature & DKIM-Signature?
Asked Answered
F

2

10

I'm trying to sign emails with DKIM using PHPMailer Class and i can't get it to work.

When i see the headers in my emails on gmail, i find that the class is successfully injecting DKIM in the email header but gmail doesn't even care.

The question is that i've viewed the headers of linkedIn emails and i found out that they are using 2 DKIM headers, DomainKey-Signature & DKIM-Signature.

What's the difference? and is that why Gmail doesn't verify my emails? & do you recommend any alternative & robust classes to sign emails with domain keys on php?

Thanks

Fishbowl answered 30/11, 2010 at 12:1 Comment(0)
H
12

Both use Public/Private keys to digitally sign emails. Both use a text file in the sender's DNS server that contain the public key that can be used by the recipient to verify the signature.

Domain Keys was the first version.

DKIM is the updated version.

The difference is how Domain Keys and DKIM sign the messages, and build the header.

Email recipients may implement either of them (or both). The only thing you can do, is sign with both classes, if you want to cover all bases.

Do you want the technical details on the differences between DomainKeys vs DKIM?

--Dave

Highboy answered 30/11, 2010 at 14:3 Comment(3)
Thanks dave for your answer, how to generate signed header for an email?Fishbowl
Unfortunately I don't know how to do this with PHP. Sorry.Highboy
It appears like PHPMailer supports DKIM. Haven't tested though: worxware.com/forum/viewthread.php?tid=185Sandra
V
0

DKIM support in PHPMailer 5.1 doesn't work correctly out of the box. Here is what I had to do, to get it working:

  1. I applied the fix at this URL: http://sourceforge.net/tracker/index.php?func=detail&aid=2960165&group_id=26031&atid=385707

  2. At line 566, I had to change this:

    // digitally sign with DKIM if enabled
    if ($this->DKIM_domain && $this->DKIM_private) {
      $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
      $header = str_replace("\r\n","\n",$header_dkim) . $header;
    }
    

...to this:

  // digitally sign with DKIM if enabled
  if ($this->DKIM_domain && $this->DKIM_private) {

    // Hack to add To: header to the headers which are passed to DKIM_Add
            // Note that this only adds the first To: recipient, so it's going to break
            // if you try to send an email to more than one person simultaneously

    $header_temp = $header . $this->LE . 'To: ' . $this->to[0][0];
    $header_dkim = $this->DKIM_Add($header_temp,$this->EncodeHeader($this->SecureHeader($this->Subject)),$body);
    $header = str_replace("\r\n","\n",$header_dkim) . $header;
  }
Verenaverene answered 19/3, 2011 at 1:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.